4byte
Examples
Note
These examples are crafted as a Jupyter notebook. You can download the original notebook file here.
Also note that inside Jupyter notebooks, await
can be used freely outside of asyncio.run()
.
In [1]:
from ctc.protocols import fourbyte_utils
Query function signature¶
In [2]:
await fourbyte_utils.async_query_function_signatures('0x18160ddd')
Out[2]:
[{'id': 179, 'created_at': '2016-07-09T03:58:45.230129Z', 'hex_signature': '0x18160ddd', 'text_signature': 'totalSupply()', 'bytes_signature': '\x18\x16\rÝ'}, {'id': 166702, 'created_at': '2019-10-03T12:55:14.688679Z', 'hex_signature': '0x18160ddd', 'text_signature': 'voting_var(address,uint256,int128,int128)', 'bytes_signature': '\x18\x16\rÝ'}]
Query event signature¶
In [3]:
event_hash = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
await fourbyte_utils.async_query_event_signatures(event_hash)
Out[3]:
[{'id': 1, 'created_at': '2020-11-30T22:38:00.801049Z', 'hex_signature': '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', 'text_signature': 'Transfer(address,address,uint256)', 'bytes_signature': 'ÝòR\xad\x1bâÈ\x9bi°hü7\x8dª\x95+§ñcÄ¡\x16(õZMõ#³ï'}]
Reference
- async ctc.protocols.fourbyte_utils.async_build_event_signatures_dataset(signature_data=None)
- Return type
None
- async ctc.protocols.fourbyte_utils.async_build_function_signatures_dataset(signature_data=None)
- Return type
None
- async ctc.protocols.fourbyte_utils.async_query_event_signatures(hex_signature=None, *, id=None, bytes_signature=None, text_signature=None, use_local=True, use_remote=True)
- Return type
Sequence
[Entry
]
- async ctc.protocols.fourbyte_utils.async_query_function_signatures(hex_signature=None, *, id=None, bytes_signature=None, text_signature=None, use_local=True, use_remote=True)
- Return type
Sequence
[Entry
]