-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat!: add decode_as_debug_str
to ABIDecoder
#1291
Conversation
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.
The pair of (String, ParamType)
comes up a lot.
Wdyt about giving it a name? Maybe Member
so that it can refer both to struct fields and enum variants.
This is great! I think it would be very useful for my tooling side decoding needs. Would it possible to also encode similarly given a param type and value to encode? |
decode_debug
to ParamType
decode_as_debug_str
to ABIDecoder
decode_as_debug_str
to ABIDecoder
decode_as_debug_str
to ABIDecoder
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.
Great work! This is useful enough, in my opinion, to have a small section in our docs. Thoughts? It can be done in a follow-up, not necessarily in this PR.
Here is the issue for that: #1296 |
PR: #690 updated
ParamType
and added names forstruct
andenum
types and their fields/variants. This was later removed in PR: #885 as we completely changed how log decoding is done.This PR returns struct and enum names (also fields/variants) so that users can use
ParamTypes
at runtime to debug log or return receipts. In addition, users are able to go directly fromProgramABI
and some data to decoded debug. Here is an example how this is used:There are actually not so many changes but I refactored the
param_types.rs
file into a new module with several files to separate the logical units and their tests.BREAKING CHANGE:
EnumVariants
are now imported throughparam_types::EnumVariants