ArbProvider¶
- class arbitrum_py.utils.arb_provider.ArbFormatter[source]¶
Bases:
objectA formatter class for Arbitrum-specific data structures.
This class provides methods for formatting blocks and transaction receipts to include Arbitrum-specific fields. It is the Python equivalent of the TypeScript ArbFormatter class.
- The formatter handles the following Arbitrum-specific fields:
sendRoot: Hash of the send root
sendCount: Number of messages sent
l1BlockNumber: L1 block number reference
gasUsedForL1: Gas used for L1 posting (in receipts)
- receipt(value)[source]¶
Format a raw transaction receipt into an ArbTransactionReceipt.
Adds Arbitrum-specific fields to the standard transaction receipt: - l1BlockNumber: The referenced L1 block number - gasUsedForL1: Amount of gas used for L1 posting
- Parameters:
value (Dict[str, Any]) – Raw receipt data from a node
- Returns:
Formatted receipt with Arbitrum-specific fields
- Return type:
- block(block)[source]¶
Format a raw block into an ArbBlock.
Adds Arbitrum-specific fields to the standard block: - sendRoot: Hash of the send root - sendCount: Number of messages sent - l1BlockNumber: Referenced L1 block number
- Parameters:
block (Dict[str, Any]) – Raw block data from the node
- Returns:
Formatted block with Arbitrum-specific fields
- Return type:
- block_with_transactions(block)[source]¶
Format a raw block (including full transactions) into an ArbBlockWithTransactions.
Similar to block(), but includes complete transaction objects rather than just transaction hashes.
- Parameters:
block (Dict[str, Any]) – Raw block data including full transaction objects
- Returns:
Formatted block with transactions and Arbitrum-specific fields
- Return type:
- class arbitrum_py.utils.arb_provider.ArbitrumProvider(provider, network=None)[source]¶
Bases:
objectAn Arbitrum-aware provider that wraps a Web3 provider.
This class extends the functionality of a standard Web3 provider to handle Arbitrum-specific data structures and formatting. It automatically formats blocks and receipts to include Arbitrum-specific fields.
- Parameters:
provider (Union[SignerOrProvider, 'ArbitrumProvider', Any]) – The underlying provider to wrap
network (Optional[Any]) – Optional network configuration (currently unused)
- property provider: Any¶
Get the underlying provider instance.
- Returns:
The wrapped provider instance
- Return type:
Any
- get_transaction_receipt(transaction_hash)[source]¶
Get and format a transaction receipt with Arbitrum-specific fields.
- Parameters:
transaction_hash (str) – The transaction hash to fetch
- Returns:
Transaction receipt with Arbitrum-specific fields
- Return type:
- get_block_with_transactions(block_identifier)[source]¶
Get and format a block (including transactions) with Arbitrum-specific fields.
- Parameters:
block_identifier (Union[str, int]) – Block identifier (number, hash, or tag like ‘latest’)
- Returns:
Block with full transactions and Arbitrum-specific fields
- Return type: