Decode logs offline
Use event_decode_json when topics and data are already available from get_logs, get_transaction_logs, or a fixture. The ABI event fragment controls how indexed topics and data words are decoded.
- For a non-anonymous event, the first topic should be event_signature('EventName(types...)'). Anonymous events omit topic0 and begin with their first indexed parameter.
- The canonical sample reconstructs USDC transaction 0x5cbf...3dde, log index 97, at Ethereum block 20,000,000 without an RPC call.
- Indexed addresses are stored as left-padded BYTES32 topics.
- Indexed dynamic values are represented by their indexed topic hash.
- Non-indexed values are decoded from the data BLOB. A mismatched non-anonymous topic0 is currently not rejected.
- Malformed ABI, topics, or data return NULL instead of raising a decode error.