diff --git a/src/components/dynamic/DynamicComponent.vue b/src/components/dynamic/DynamicComponent.vue index a25fa392..d2c2b137 100644 --- a/src/components/dynamic/DynamicComponent.vue +++ b/src/components/dynamic/DynamicComponent.vue @@ -1,11 +1,21 @@ diff --git a/src/components/dynamic/index.ts b/src/components/dynamic/index.ts index 919e4983..2ed3443e 100644 --- a/src/components/dynamic/index.ts +++ b/src/components/dynamic/index.ts @@ -12,7 +12,7 @@ import TimestampElement from './TimestampElement.vue'; import ObjectHorizontalElement from './ObjectHorizontalElement.vue'; import Long from 'long'; import { MsgRegistry } from 'secretjs'; -import { toBech32 } from '@cosmjs/encoding'; +import { fromBase64, toBech32 } from '@cosmjs/encoding'; export function select(v: any, direct?: string) { // if(k === 'txs' && v) { @@ -105,7 +105,9 @@ export const decodeProto = (msg: { } if (type) { - const instance = (type.decode || type.deserialize)(msg.value); + const instance = (type.decode || type.deserialize)( + typeof msg.value === 'string' ? fromBase64(msg.value) : msg.value + ); if (instance.msgs) { instance.msgs = instance.msgs.map(decodeProto); } diff --git a/src/libs/utils.ts b/src/libs/utils.ts index d00d301c..07245165 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -260,3 +260,16 @@ export function rgbToHsl(color: string) { l, }; } + +export const wrapBinary = (value: any): any => { + if (value instanceof Uint8Array) { + return toBase64(value); + } + + if (typeof value === 'object') { + for (const key in value) { + value[key] = wrapBinary(value[key]); + } + } + return value; +}; diff --git a/src/modules/[chain]/tx/[hash].vue b/src/modules/[chain]/tx/[hash].vue index 8eea2db6..564c0a1a 100644 --- a/src/modules/[chain]/tx/[hash].vue +++ b/src/modules/[chain]/tx/[hash].vue @@ -7,6 +7,7 @@ import { logs } from '@cosmjs/stargate'; import { JsonViewer } from 'vue3-json-viewer'; // if you used v1.0.5 or latster ,you should add import "vue3-json-viewer/dist/index.css" import 'vue3-json-viewer/dist/index.css'; +import { wrapBinary } from '@/libs/utils'; const props = defineProps(['hash', 'chain']); @@ -143,7 +144,7 @@ const txLogs = computed(() => { >

JSON