-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Fix issue decoding log with only indexed parameters #2549
Conversation
@@ -229,7 +229,7 @@ export default class AbiCoder { | |||
nonIndexedInputItems.push(input); | |||
}); | |||
|
|||
if (data) { | |||
if (data && data !== '0x') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you handle the '0x' case here: https://github.com/ethereum/web3.js/blob/1.0/packages/web3-eth-contract/src/decoders/EventLogDecoder.js#L50
Thanks for the PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would something like
if (response.data === '0x') delete response.data
suffice?
Is that what you meant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do it this way:
if (response.data === '0x') {
reponse.data = null;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍
e423d93
to
2ce2412
Compare
@angus-hamill FYI: I'll release this fix when I've closed the issue #2539 |
Description
If a log has only indexed parameters, the data field may still be present as
0x
. TheAbiCoder
was attempting to decode this and erroring.Type of change
Checklist:
npm run test
in the root folder with success and extended the tests if necessary.npm run build
in the root folder and tested it in the browser and with node.npm run dtslint
in the root folder and tested that all my types are correct