diff --git a/e2e/build-block.test.ts b/e2e/build-block.test.ts index 64150968..f9852ec8 100644 --- a/e2e/build-block.test.ts +++ b/e2e/build-block.test.ts @@ -4,7 +4,7 @@ import { setupAll } from './helper' describe.each([ { chain: 'Polkadot', endpoint: 'wss://rpc.polkadot.io' }, - { chain: 'Kusama', endpoint: 'wss://kusama-rpc.polkadot.io' }, + { chain: 'Kusama', endpoint: 'wss://kusama-rpc.dwellir.com' }, { chain: 'Acala', endpoint: 'wss://acala-rpc-1.aca-api.network' }, ])('Latest $chain can build blocks', async ({ endpoint }) => { const { setup, teardownAll } = await setupAll({ endpoint }) diff --git a/src/utils/decoder.ts b/src/utils/decoder.ts index 5454aa7c..2a9b1de0 100644 --- a/src/utils/decoder.ts +++ b/src/utils/decoder.ts @@ -53,7 +53,7 @@ export const decodeKeyValue = async (block: Block, key: HexString, value?: HexSt return { [key]: value } } - const decodedValue = meta.registry.createType(decodedKey.outputType, hexToU8a(value)) + const decodedValue = value ? meta.registry.createType(decodedKey.outputType, hexToU8a(value)).toHuman() : null switch (decodedKey.args.length) { case 2: { @@ -61,7 +61,7 @@ export const decodeKeyValue = async (block: Block, key: HexString, value?: HexSt [storage.section]: { [storage.method]: { [decodedKey.args[0].toString()]: { - [decodedKey.args[1].toString()]: decodedValue.toHuman(), + [decodedKey.args[1].toString()]: decodedValue, }, }, }, @@ -71,7 +71,7 @@ export const decodeKeyValue = async (block: Block, key: HexString, value?: HexSt return { [storage.section]: { [storage.method]: { - [decodedKey.args[0].toString()]: decodedValue.toHuman(), + [decodedKey.args[0].toString()]: decodedValue, }, }, } @@ -79,7 +79,7 @@ export const decodeKeyValue = async (block: Block, key: HexString, value?: HexSt default: return { [storage.section]: { - [storage.method]: decodedValue.toHuman(), + [storage.method]: decodedValue, }, } } @@ -92,8 +92,8 @@ export const decodeStorageDiff = async (block: Block, diff: [HexString, HexStrin const oldState = {} const newState = {} for (const [key, value] of diff) { - _.merge(oldState, await decodeKeyValue(block, key as HexString, (await parent.get(key)) as any)) - _.merge(newState, await decodeKeyValue(block, key as HexString, value)) + _.merge(oldState, await decodeKeyValue(parent, key, (await parent.get(key)) as any)) + _.merge(newState, await decodeKeyValue(block, key, value)) } return [oldState, newState, diffPatcher.diff(oldState, newState)] }