Event¶
Event parsing utilities for Arbitrum SDK.
This module provides utilities for parsing and decoding Ethereum event logs, with type-safe interfaces similar to TypeScript’s TypedEvent system.
- class arbitrum_py.data_entities.event.EventArgs[source]¶
Bases:
TypedDictBase type for event arguments.
- class arbitrum_py.data_entities.event.TypedEvent(*args, **kwargs)[source]¶
Bases:
Protocol[T]Protocol for typed events, similar to TypeScript’s TypedEvent.
- __init__(*args, **kwargs)¶
- class arbitrum_py.data_entities.event.ContractEventProcessor(*args, **kwargs)[source]¶
Bases:
ProtocolProtocol for contract event processing interface.
- __init__(*args, **kwargs)¶
- arbitrum_py.data_entities.event.parse_typed_log(contract_name, log, event_name)[source]¶
Parse a single log entry against a specific event.
This function attempts to decode a log entry using the specified event’s ABI. If the log’s topic matches the event signature, it returns the decoded arguments.
- Parameters:
contract_name (
str) – Name of the contract containing the event definitionlog (
Dict[str,Any]) – Log dictionary from transaction receiptevent_name (
str) – Name of the event to decode (e.g. ‘WithdrawalInitiated’)
- Return type:
Optional[Dict[str,Any]]- Returns:
Decoded event arguments if log matches event signature, None otherwise
- Raises:
ValueError – If event not found in contract ABI
ABIFunctionNotFound – If contract ABI is invalid
- arbitrum_py.data_entities.event.parse_typed_logs(contract_name, logs, event_name)[source]¶
Parse multiple logs against a specific event.
This function processes an array of logs, filtering out any that don’t match the specified event’s signature and decoding the matching ones.
- Parameters:
contract_name (
str) – Name of the contract containing the event definitionlogs (
List[Dict[str,Any]]) – List of log dictionaries from transaction receiptevent_name (
str) – Name of the event to decode (e.g. ‘WithdrawalInitiated’)
- Return type:
List[Dict[str,Any]]- Returns:
List of decoded event arguments from matching logs
- Raises:
ValueError – If event not found in contract ABI
ABIFunctionNotFound – If contract ABI is invalid
- arbitrum_py.data_entities.event.get_event_signature(contract_name, event_name)[source]¶
Get the keccak256 signature hash for an event.
Computes the event signature by concatenating the event name with its parameter types and taking the keccak256 hash.
- Parameters:
contract_name (
str) – Name of the contract containing the eventevent_name (
str) – Name of the event to get signature for
- Return type:
NewType()(HexStr,str)- Returns:
Hex string of the event signature hash
- Raises:
ValueError – If event not found in contract ABI