-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Event Decoder stores numbers oddly. #261
Comments
That is certainly a bug. Can you provide a quick snippet? Are you on the v4 branch? I recall adding a fix for that, but I must have missed some place. |
Oh! Looking at the code and your example, I understand the bug. I’ll get a fix out soon. Thanks! |
I'm experiencing this on the |
Yeah. I'm going to make a proper The problem is with nested structures, like a tuple or array which contains BigNumbers. I felt the cold chill the second I read the Thanks! |
This should be fixed in Closing for now, but if you continue experiencing any issues, please feel free to re-open. :) |
When decoding an event like
Foo(uint256 a)
, I end up with an object like:I would have expected a BigNumber here, or barring that a hex encoded string.
_
prefixed property names are usually internal, so I am hesitant to write code that relies or reading that. Also, non-number values are stored without the inner-most object, so just{ b: '0xabcd1234' }
, which makes number values odd.After a significant amount of digging I found the issue is in the way it "freezes" the
values
key. It doesJSON.stringify
thenJSON.parse
on it, which results in stripping the prototype from all of the methods and leaving only the_hex
internal variable of the original BigNumber object.The text was updated successfully, but these errors were encountered: