RetryableData

class arbitrum_py.data_entities.retryable_data.RetryableData(from_address, to, l2_call_value, deposit, max_submission_cost, excess_fee_refund_address, call_value_refund_address, gas_limit, max_fee_per_gas, data)[source]

Bases: object

Represents a retryable ticket’s data structure on Arbitrum.

This class mirrors the RetryableData error struct from Inbox.sol and contains all parameters needed to create or estimate a retryable ticket transaction.

Variables:
  • fromAddress (HexAddress) – The L1 address creating the retryable ticket

  • to (HexAddress) – Destination address on L2

  • l2CallValue (int) – The amount of ETH (or token) supplied on L2

  • deposit (int) – The total deposit on L1 covering L2 gas + L2 call value

  • maxSubmissionCost (int) – The base submission fee for sending the message

  • excessFeeRefundAddress (HexAddress) – L2 address for any leftover gas funds

  • callValueRefundAddress (HexAddress) – L2 address for leftover callValue if canceled

  • gasLimit (int) – The L2 gas limit for execution

  • maxFeePerGas (int) – The max L2 gas price

  • data (bytes) – The calldata for the L2 contract call

abi_types: List[str] = ['address', 'address', 'uint256', 'uint256', 'uint256', 'address', 'address', 'uint256', 'uint256', 'bytes']
__init__(from_address, to, l2_call_value, deposit, max_submission_cost, excess_fee_refund_address, call_value_refund_address, gas_limit, max_fee_per_gas, data)[source]

Initialize a new RetryableData instance.

Parameters:
  • from_address (NewType()(HexAddress, NewType()(HexStr, str))) – The L1 address creating the retryable ticket

  • to (NewType()(HexAddress, NewType()(HexStr, str))) – Destination address on L2

  • l2_call_value (int) – The amount of ETH (or token) supplied on L2

  • deposit (int) – The total deposit on L1 covering L2 gas + L2 call value

  • max_submission_cost (int) – The base submission fee for sending the message

  • excess_fee_refund_address (NewType()(HexAddress, NewType()(HexStr, str))) – L2 address for any leftover gas funds

  • call_value_refund_address (NewType()(HexAddress, NewType()(HexStr, str))) – L2 address for leftover callValue if canceled

  • gas_limit (int) – The L2 gas limit for execution

  • max_fee_per_gas (int) – The max L2 gas price

  • data (bytes) – The calldata for the L2 contract call

class arbitrum_py.data_entities.retryable_data.RetryableDataTools[source]

Bases: object

Tools for parsing retryable data from revert errors.

When calling createRetryableTicket on Inbox.sol, special values can be passed for gasLimit and maxFeePerGas. This causes the call to revert with the info needed to estimate the gas needed for a retryable ticket.

Variables:

ErrorTriggeringParams (Dict[str, int]) – Parameters that should be passed to createRetryableTicket to induce a revert with retryable data. Contains gasLimit=1 and maxFeePerGas=1.

ErrorTriggeringParams: Dict[str, int] = {'gasLimit': 1, 'maxFeePerGas': 1}
static try_parse_error(error_data_hex)[source]

Parse RetryableData struct from revert error data.

Attempts to parse a RetryableData struct from the given hex string. The input should be the revert data from a transaction that reverts with error RetryableData(…).

Parameters:

error_data_hex (NewType()(HexStr, str)) – The raw revert data as a hex string (with or without ‘0x’ prefix)

Return type:

Optional[CaseDict]

Returns:

A CaseDict containing the parsed RetryableData fields if successful, or None if parsing fails. The returned dict will have the following fields:

  • from (HexAddress): The L1 sender address

  • to (HexAddress): The L2 destination address

  • l2CallValue (int): Amount of ETH/tokens for L2

  • deposit (int): Total L1 deposit amount

  • maxSubmissionCost (int): Base submission fee

  • excessFeeRefundAddress (HexAddress): Refund address for excess gas

  • callValueRefundAddress (HexAddress): Refund address for call value

  • gasLimit (int): L2 gas limit

  • maxFeePerGas (int): Max L2 gas price

  • data (bytes): L2 call data

Example

>>> error_data = "0x..."  # Revert data from failed tx
>>> retryable = RetryableDataTools.try_parse_error(error_data)
>>> if retryable:
...     print(f"L2 destination: {retryable['to']}")
...     print(f"Gas limit: {retryable['gasLimit']}")