ArbProvider

class arbitrum_py.utils.arb_provider.ArbFormatter[source]

Bases: object

A 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:

ArbTransactionReceipt

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:

ArbBlock

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:

ArbBlockWithTransactions

class arbitrum_py.utils.arb_provider.ArbitrumProvider(provider, network=None)[source]

Bases: object

An 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)

__init__(provider, network=None)[source]
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:

ArbTransactionReceipt

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:

ArbBlockWithTransactions

get_block(block_identifier)[source]

Get and format a block with Arbitrum-specific fields.

Parameters:

block_identifier (Union[str, int]) – Block identifier (number, hash, or tag like ‘latest’)

Returns:

Block with Arbitrum-specific fields

Return type:

ArbBlock