Calldata

Utilities for handling and decoding transaction calldata in the Arbitrum SDK.

This module provides functions for extracting and decoding information from transaction calldata, particularly for cross-chain token transfers between L1 (Ethereum) and L2 (Arbitrum).

class arbitrum_py.utils.calldata.TxRequest(*args, **kwargs)[source]

Bases: dict

Type definition for transaction request data.

data: str
to: str
value: int
class arbitrum_py.utils.calldata.ParentToChildTxReqAndSigner(*args, **kwargs)[source]

Bases: dict

Type definition for a parent-to-child (L1 to L2) transaction request with signer.

Variables:
  • txRequest – The transaction request parameters

  • signer – The signer for the transaction (optional)

txRequest: TxRequest
signer: Optional[Any]
arbitrum_py.utils.calldata.get_erc20_parent_address_from_parent_to_child_tx_request(tx_req)[source]

Extract the ERC20 parent token address from a L1->L2 transaction request.

This function decodes the transaction calldata to extract the token address from either ‘outboundTransfer’ or ‘outboundTransferCustomRefund’ function calls on the L1GatewayRouter contract.

Parameters:

tx_req (ParentToChildTxReqAndSigner) – The transaction request containing the calldata.

Returns:

The ERC20 token address on L1 (parent chain)

Return type:

str

Raises:

ArbSdkError – If the calldata doesn’t match expected function signatures.