Promise and RxJS APIs around Polkadot and Substrate based chains via RPC calls. It is dynamically generated based on what the Substrate runtime provides in terms of metadata.
When decoding a signed extrinsic that didn't contain an assetId to pay the fees and trying to call .toHuman(), it fails. That's caused because assetId is optional and calling .toHuman() on undefined errors. This is fixed by checking whether assetId is defined or not before calling toHuman() and based on that, calling the function or setting the value as null.
Before
Block: 1000001
TypeError: Cannot read properties of undefined (reading 'toHuman')
at Type.toHuman (/home/bee344/Documentos/parity/tests/node_modules/@polkadot/types/cjs/extrinsic/Extrinsic.js:254:39)
at /home/bee344/Documentos/parity/tests/build/index.js:25:39
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
/home/bee344/Documentos/parity/tests/node_modules/@polkadot/types/cjs/extrinsic/Extrinsic.js:254
assetId: this.assetId.toHuman(isExpanded, disableAscii),
^
TypeError: Cannot read properties of undefined (reading 'toHuman')
at Type.toHuman (/home/bee344/Documentos/parity/tests/node_modules/@polkadot/types/cjs/extrinsic/Extrinsic.js:254:39)
at /home/bee344/Documentos/parity/tests/build/index.js:25:39
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v18.18.2
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Description
When decoding a
signed
extrinsic that didn't contain anassetId
to pay the fees and trying to call.toHuman()
, it fails. That's caused becauseassetId
is optional and calling.toHuman()
onundefined
errors. This is fixed by checking whetherassetId
is defined or not before callingtoHuman()
and based on that, calling the function or setting the value asnull
.Before
After
To replicate
Closes #5875