ParentToChildMessageCreator¶
- class arbitrum_py.message.parent_to_child_message_creator.ParentToChildMessageCreator(parent_signer)[source]¶
Bases:
objectCreates 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 ticketparent_provider (
Web3) – Web3 provider for the Parent chainchild_provider (
Web3) – Web3 provider for the Child chainretryable_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 ticketestimates (
Dict[str,Any]) – Gas estimates for the transactionexcess_fee_refund_address (
str) – Address to refund excess feescall_value_refund_address (
str) – Address to refund unused call valuenative_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 ticketparent_provider (
Web3) – The parent chain providerchild_provider (
Web3) – The child chain provideroptions (
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 ParentToChildTransactionRequestchild_provider (
Web3) – A web3 provider for the child chainoptions (
Optional[GasOverrides]) – Optional gas override parameters
- Return type:
- Returns:
Transaction receipt wrapped in a ParentTransactionReceipt object