added abi_contract.py - Contract Abi decoding utility functions #69
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What was wrong?
All fine, just adding functionality for convenience.
This PR provides the missing piece when trying to decode an arbitrary transaction input stream with a json abi definition. So all you do is create a
ContractAbi()
object providing the abi declaration in json format and then call eitherContractAbi.describe_constructor(b_constructor_arguments)
orContractAbi.describe_input(b_inputbytes)
. I am using this functionality in my etherchain library and cli to decode transactions/arguments and dump contract source code.Here's a short example. For a complete example scroll below the cute animal picture.
How was it fixed?
added new module
abi_contract.py
providing the missing functionality not changing any existing code.Cute Animal Picture
full example
Decode inputs to contract at 0xab7c74abc0c4d48d1bdad5dcb26153fc8780f83e to a more human friendly notation (see decoded constructor args and one of the input transactions; details see code below)