ParentToChildMessageCreator

class arbitrum_py.message.parent_to_child_message_creator.ParentToChildMessageCreator(parent_signer)[source]

Bases: object

Creates retryable tickets by directly calling the Inbox contract on the Parent chain.

This class handles the creation and management of cross-chain messages from a parent chain to a child chain in the Arbitrum ecosystem. It provides functionality to create retryable tickets, estimate gas costs, generate transaction requests, and handle both ETH and ERC20 token transfers.

__init__(parent_signer)[source]

Initialize the message creator with a parent chain signer.

Parameters:

parent_signer (Any) – The parent-chain signer object that must have a provider

Raises:

MissingProviderArbSdkError – If the provided signer lacks a provider

static get_ticket_estimate(params, parent_provider, child_provider, retryable_gas_overrides=None)[source]

Get current gas estimates for creating a retryable ticket on the child chain.

This method calculates the gas parameters needed for creating a retryable ticket, including maxSubmissionCost, maxFeePerGas, gasLimit, and deposit amounts.

Parameters:
  • params (Dict[str, Any]) – Parameters for the retryable ticket

  • parent_provider (Web3) – Web3 provider for the Parent chain

  • child_provider (Web3) – Web3 provider for the Child chain

  • retryable_gas_overrides (Optional[GasOverrides]) – Optional gas override parameters

Return type:

Dict[str, Any]

Returns:

Dictionary containing gas estimation parameters including maxSubmissionCost, maxFeePerGas, gasLimit, and deposit

static get_ticket_creation_request_call_data(params, estimates, excess_fee_refund_address, call_value_refund_address, native_token_is_eth)[source]

Prepare calldata for creating a retryable ticket.

This method generates the appropriate contract call data based on whether the child chain uses ETH or ERC20 tokens natively. It encodes the function call parameters according to the contract’s ABI.

Parameters:
  • params (Dict[str, Any]) – Parameters for the retryable ticket

  • estimates (Dict[str, Any]) – Gas estimates for the transaction

  • excess_fee_refund_address (str) – Address to refund excess fees

  • call_value_refund_address (str) – Address to refund unused call value

  • native_token_is_eth (bool) – Whether the child chain uses ETH natively

Return type:

bytes

Returns:

Encoded contract call data as bytes

static get_ticket_creation_request(params, parent_provider, child_provider, options=None)[source]

Generate a transaction request for creating a retryable ticket.

This method prepares all necessary parameters and data for creating a retryable ticket transaction. It handles the preparation of gas estimates, contract call data, and transaction parameters.

Parameters:
  • params (Dict[str, Any]) – Parameters for the retryable ticket

  • parent_provider (Web3) – The parent chain provider

  • child_provider (Web3) – The child chain provider

  • options (Optional[GasOverrides]) – Optional gas override parameters

Returns:

  • txRequest: Transaction parameters (to, data, value, from)

  • retryableData: Retryable ticket parameters

  • isValid: Function to validate gas estimates

Return type:

Dictionary containing

create_retryable_ticket(params, child_provider, options=None)[source]

Send a transaction on the parent chain to create a retryable ticket.

This method handles the actual submission of the transaction to create a retryable ticket on the parent chain. It processes the transaction parameters and waits for the transaction to be confirmed.

Parameters:
  • params (Dict[str, Any]) – Either a ParentToChildMessageParams dict or a ParentToChildTransactionRequest

  • child_provider (Web3) – A web3 provider for the child chain

  • options (Optional[GasOverrides]) – Optional gas override parameters

Return type:

ParentTransactionReceipt

Returns:

Transaction receipt wrapped in a ParentTransactionReceipt object