ParentToChildMessage

arbitrum_py.message.parent_to_child_message.int_to_bytes(value)[source]

Convert an integer to its bytes representation.

Parameters:

value (int) – Integer value to convert

Return type:

bytes

Returns:

Bytes representation of the integer

arbitrum_py.message.parent_to_child_message.hex_to_bytes(value)[source]

Convert a hex string to bytes.

Parameters:

value (str) – Hex string (with or without ‘0x’ prefix)

Return type:

bytes

Returns:

Bytes representation of the hex string

arbitrum_py.message.parent_to_child_message.zero_pad(value, length)[source]

Pad a byte string with leading zeros to reach specified length.

Parameters:
  • value (bytes) – Bytes to pad

  • length (int) – Desired length after padding

Return type:

bytes

Returns:

Zero-padded bytes

arbitrum_py.message.parent_to_child_message.format_number(value)[source]

Format a number as a minimal-length byte string.

Parameters:

value (int) – Number to format

Return type:

bytes

Returns:

Minimal length bytes representation of the number

arbitrum_py.message.parent_to_child_message.concat(*args)[source]

Concatenate byte strings.

Parameters:

*args (Union[bytes, List[bytes], Tuple[bytes, ...]]) – Either multiple byte strings or a single iterable of byte strings

Return type:

bytes

Returns:

Concatenated bytes

class arbitrum_py.message.parent_to_child_message.ParentToChildMessageStatus(value)[source]

Bases: Enum

Status enum for parent-to-child messages.

Variables:
  • NOT_YET_CREATED (int) – The retryable ticket has yet to be created

  • CREATION_FAILED (int) – An attempt was made to create the retryable ticket, but it failed

  • FUNDS_DEPOSITED_ON_CHILD (int) – The retryable ticket has been created but has not been redeemed

  • REDEEMED (int) – The retryable ticket has been redeemed and the chain transaction has been executed

  • EXPIRED (int) – The message has either expired or has been canceled

NOT_YET_CREATED = 1
CREATION_FAILED = 2
FUNDS_DEPOSITED_ON_CHILD = 3
REDEEMED = 4
EXPIRED = 5
class arbitrum_py.message.parent_to_child_message.EthDepositMessageStatus(value)[source]

Bases: Enum

Status enum for ETH deposit messages.

Variables:
  • PENDING (int) – ETH is not deposited on Chain yet

  • DEPOSITED (int) – ETH is deposited successfully on Chain

PENDING = 1
DEPOSITED = 2
class arbitrum_py.message.parent_to_child_message.ParentToChildMessage(chain_id, sender, message_number, parent_base_fee, message_data)[source]

Bases: object

Base class for messages sent from parent chain to child chain.

This class handles the core functionality for parent-to-child messages, including retryable ticket creation and management.

Parameters:
  • chain_id (int) – The ID of the child chain

  • sender (str) – The address of the message sender

  • message_number (int) – The sequential number of the message

  • parent_base_fee (int) – The base fee on the parent chain

  • message_data (Dict[str, Any]) – Dictionary containing message parameters: - destAddress: Destination address - l2CallValue: Call value on L2 - l1Value: Value on L1 - maxSubmissionFee: Maximum submission fee - excessFeeRefundAddress: Address for excess fee refund - callValueRefundAddress: Address for call value refund - gasLimit: Gas limit - maxFeePerGas: Maximum fee per gas - data: Call data

__init__(chain_id, sender, message_number, parent_base_fee, message_data)[source]
static calculate_submit_retryable_id(child_chain_id, from_address, message_number, parent_base_fee, dest_address, child_call_value, parent_call_value, max_submission_fee, excess_fee_refund_address, call_value_refund_address, gas_limit, max_fee_per_gas, data)[source]

Calculate the unique identifier for a retryable submission.

Parameters:
  • child_chain_id (int) – ID of the child chain

  • from_address (str) – Address sending the message

  • message_number (int) – Sequential message number

  • parent_base_fee (int) – Base fee on parent chain

  • dest_address (str) – Destination address

  • child_call_value (int) – Call value on child chain

  • parent_call_value (int) – Call value on parent chain

  • max_submission_fee (int) – Maximum submission fee

  • excess_fee_refund_address (str) – Address for excess fee refund

  • call_value_refund_address (str) – Address for call value refund

  • gas_limit (int) – Gas limit

  • max_fee_per_gas (int) – Maximum fee per gas

  • data (str) – Call data

Return type:

NewType()(HexStr, str)

Returns:

Unique identifier for the retryable submission

static from_event_components(chain_signer_or_provider, chain_id, sender, message_number, parent_base_fee, message_data)[source]

Create a ParentToChildMessage instance from event components.

Parameters:
  • chain_signer_or_provider (Union[SignerProviderUtils, Any]) – Signer or provider for the chain

  • chain_id (int) – ID of the child chain

  • sender (str) – Address of the message sender

  • message_number (int) – Sequential message number

  • parent_base_fee (int) – Base fee on parent chain

  • message_data (Dict[str, Any]) – Dictionary containing message parameters

Return type:

Union[ParentToChildMessageReader, ParentToChildMessageWriter]

Returns:

ParentToChildMessage instance

class arbitrum_py.message.parent_to_child_message.ParentToChildMessageReader(child_provider, chain_id, sender, message_number, parent_base_fee, message_data)[source]

Bases: ParentToChildMessage

Reader class for parent-to-child messages.

This class extends the base ParentToChildMessage class and provides additional functionality for reading and managing parent-to-child messages.

Parameters:
  • child_provider (Any) – Provider for the child chain

  • chain_id (int) – ID of the child chain

  • sender (str) – Address of the message sender

  • message_number (int) – Sequential message number

  • parent_base_fee (int) – Base fee on parent chain

  • message_data (Dict[str, Any]) – Dictionary containing message parameters

__init__(child_provider, chain_id, sender, message_number, parent_base_fee, message_data)[source]
get_retryable_creation_receipt(confirmations=None, timeout=None)[source]

Get the receipt for the retryable creation transaction.

Parameters:
  • confirmations (Optional[int]) – Number of confirmations to wait for

  • timeout (Optional[int]) – Timeout in seconds

Return type:

Optional[TxReceipt]

Returns:

Receipt for the retryable creation transaction, or None if not found

get_auto_redeem_attempt()[source]

Get the auto-redeem attempt for the retryable creation transaction.

Return type:

Optional[TxReceipt]

Returns:

Receipt for the auto-redeem attempt, or None if not found

get_successful_redeem()[source]

Get the successful redeem for the retryable creation transaction.

Return type:

Dict[str, Any]

Returns:

Dictionary containing the successful redeem data

is_expired()[source]

Check if the message is expired.

@deprecated Will be removed in v3.0.0

Return type:

bool

Returns:

True if the message is expired, False otherwise

retryable_exists()[source]

Check if the retryable ticket exists.

Return type:

bool

Returns:

True if the retryable ticket exists, False otherwise

status()[source]

Get the status of the message.

Return type:

int

Returns:

Status of the message

wait_for_status(confirmations=None, timeout=None)[source]

Wait for the status of the message.

Parameters:
  • confirmations (Optional[int]) – Number of confirmations to wait for

  • timeout (Optional[int]) – Timeout in seconds

Return type:

Dict[str, Any]

Returns:

Dictionary containing the status data

static get_lifetime(child_provider)[source]

Get the lifetime of the retryable ticket.

Parameters:

child_provider (Any) – Provider for the child chain

Return type:

int

Returns:

Lifetime of the retryable ticket

get_timeout()[source]

Get the timeout of the retryable ticket.

Return type:

int

Returns:

Timeout of the retryable ticket

get_beneficiary()[source]

Get the beneficiary of the retryable ticket.

Return type:

str

Returns:

Beneficiary of the retryable ticket

class arbitrum_py.message.parent_to_child_message.ParentToChildMessageReaderClassic(child_provider, chain_id, message_number)[source]

Bases: object

Classic reader class for parent-to-child messages.

This class provides functionality for reading and managing parent-to-child messages in a classic manner.

Parameters:
  • child_provider (Any) – Provider for the child chain

  • chain_id (int) – ID of the child chain

  • message_number (int) – Sequential message number

__init__(child_provider, chain_id, message_number)[source]
static calculate_retryable_creation_id(chain_id, message_number)[source]

Calculate the unique identifier for a retryable creation.

Parameters:
  • chain_id (int) – ID of the child chain

  • message_number (int) – Sequential message number

Return type:

NewType()(HexStr, str)

Returns:

Unique identifier for the retryable creation

static calculate_auto_redeem_id(retryable_creation_id)[source]

Calculate the unique identifier for an auto-redeem.

Parameters:

retryable_creation_id (NewType()(HexStr, str)) – Unique identifier for the retryable creation

Return type:

NewType()(HexStr, str)

Returns:

Unique identifier for the auto-redeem

static calculate_chain_tx_hash(retryable_creation_id)[source]

Calculate the unique identifier for a chain transaction.

Parameters:

retryable_creation_id (NewType()(HexStr, str)) – Unique identifier for the retryable creation

Return type:

NewType()(HexStr, str)

Returns:

Unique identifier for the chain transaction

static calculate_chain_derived_hash(retryable_creation_id)[source]

Calculate the unique identifier for a chain-derived hash.

Parameters:

retryable_creation_id (NewType()(HexStr, str)) – Unique identifier for the retryable creation

Return type:

NewType()(HexStr, str)

Returns:

Unique identifier for the chain-derived hash

get_retryable_creation_receipt(confirmations=None, timeout=None)[source]

Get the receipt for the retryable creation transaction.

Parameters:
  • confirmations (Optional[int]) – Number of confirmations to wait for

  • timeout (Optional[int]) – Timeout in seconds

Return type:

Optional[TxReceipt]

Returns:

Receipt for the retryable creation transaction, or None if not found

status()[source]

Get the status of the message.

Return type:

int

Returns:

Status of the message

class arbitrum_py.message.parent_to_child_message.ParentToChildMessageWriter(chain_signer, chain_id, sender, message_number, parent_base_fee, message_data)[source]

Bases: ParentToChildMessageReader

Writer class for parent-to-child messages.

This class extends the ParentToChildMessageReader class and provides additional functionality for writing and managing parent-to-child messages.

Parameters:
  • chain_signer (Any) – Signer for the chain

  • chain_id (int) – ID of the child chain

  • sender (str) – Address of the message sender

  • message_number (int) – Sequential message number

  • parent_base_fee (int) – Base fee on parent chain

  • message_data (Dict[str, Any]) – Dictionary containing message parameters

__init__(chain_signer, chain_id, sender, message_number, parent_base_fee, message_data)[source]
redeem(overrides=None)[source]

Redeem the retryable ticket.

Parameters:

overrides (Optional[Dict[str, Any]]) – Overrides for the redeem transaction

Return type:

ChildTransactionReceipt

Returns:

Receipt for the redeem transaction

cancel(overrides=None)[source]

Cancel the retryable ticket.

Parameters:

overrides (Optional[Dict[str, Any]]) – Overrides for the cancel transaction

Return type:

TxReceipt

Returns:

Receipt for the cancel transaction

keep_alive(overrides=None)[source]

Keep the retryable ticket alive.

Parameters:

overrides (Optional[Dict[str, Any]]) – Overrides for the keep alive transaction

Return type:

TxReceipt

Returns:

Receipt for the keep alive transaction

class arbitrum_py.message.parent_to_child_message.EthDepositMessage(child_provider, child_chain_id, message_number, from_address, to_address, value)[source]

Bases: object

Class for ETH deposit messages.

This class provides functionality for managing ETH deposit messages.

Parameters:
  • child_provider (Any) – Provider for the child chain

  • child_chain_id (int) – ID of the child chain

  • message_number (int) – Sequential message number

  • from_address (str) – Address sending the message

  • to_address (str) – Destination address

  • value (NewType()(Wei, int)) – Value of the message

__init__(child_provider, child_chain_id, message_number, from_address, to_address, value)[source]
static calculate_deposit_tx_id(child_chain_id, message_number, from_address, to_address, value)[source]

Calculate the unique identifier for a deposit transaction.

Parameters:
  • child_chain_id (int) – ID of the child chain

  • message_number (int) – Sequential message number

  • from_address (str) – Address sending the message

  • to_address (str) – Destination address

  • value (NewType()(Wei, int)) – Value of the message

Return type:

NewType()(HexStr, str)

Returns:

Unique identifier for the deposit transaction

static from_event_components(child_provider, message_number, sender_addr, inbox_message_event_data)[source]

Create an EthDepositMessage instance from event components.

Parameters:
  • child_provider (Any) – Provider for the child chain

  • message_number (int) – Sequential message number

  • sender_addr (str) – Address sending the message

  • inbox_message_event_data (str) – Event data for the inbox message

Return type:

EthDepositMessage

Returns:

EthDepositMessage instance

static parse_eth_deposit_data(event_data)[source]

Parse the event data for an ETH deposit message.

Parameters:

event_data (str) – Event data for the ETH deposit message

Return type:

Dict[str, Any]

Returns:

Dictionary containing the parsed data

status()[source]

Get the status of the message.

Return type:

int

Returns:

Status of the message

wait(confirmations=None, timeout=None)[source]

Wait for the message to be deposited.

Parameters:
  • confirmations (Optional[int]) – Number of confirmations to wait for

  • timeout (Optional[int]) – Timeout in seconds

Return type:

Optional[TxReceipt]

Returns:

Receipt for the deposit transaction, or None if not found