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 padlength (
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:
EnumStatus 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:
EnumStatus 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:
objectBase 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 chainsender (
str) – The address of the message sendermessage_number (
int) – The sequential number of the messageparent_base_fee (
int) – The base fee on the parent chainmessage_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
- 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 chainfrom_address (
str) – Address sending the messagemessage_number (
int) – Sequential message numberparent_base_fee (
int) – Base fee on parent chaindest_address (
str) – Destination addresschild_call_value (
int) – Call value on child chainparent_call_value (
int) – Call value on parent chainmax_submission_fee (
int) – Maximum submission feeexcess_fee_refund_address (
str) – Address for excess fee refundcall_value_refund_address (
str) – Address for call value refundgas_limit (
int) – Gas limitmax_fee_per_gas (
int) – Maximum fee per gasdata (
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 chainchain_id (
int) – ID of the child chainsender (
str) – Address of the message sendermessage_number (
int) – Sequential message numberparent_base_fee (
int) – Base fee on parent chainmessage_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:
ParentToChildMessageReader 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 chainchain_id (
int) – ID of the child chainsender (
str) – Address of the message sendermessage_number (
int) – Sequential message numberparent_base_fee (
int) – Base fee on parent chainmessage_data (
Dict[str,Any]) – Dictionary containing message parameters
- 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 fortimeout (
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
- wait_for_status(confirmations=None, timeout=None)[source]¶
Wait for the status of the message.
- Parameters:
confirmations (
Optional[int]) – Number of confirmations to wait fortimeout (
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
- class arbitrum_py.message.parent_to_child_message.ParentToChildMessageReaderClassic(child_provider, chain_id, message_number)[source]¶
Bases:
objectClassic 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 chainchain_id (
int) – ID of the child chainmessage_number (
int) – Sequential message number
- 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 chainmessage_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 fortimeout (
Optional[int]) – Timeout in seconds
- Return type:
Optional[TxReceipt]- Returns:
Receipt for the retryable creation transaction, or None if not found
- class arbitrum_py.message.parent_to_child_message.ParentToChildMessageWriter(chain_signer, chain_id, sender, message_number, parent_base_fee, message_data)[source]¶
Bases:
ParentToChildMessageReaderWriter 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 chainchain_id (
int) – ID of the child chainsender (
str) – Address of the message sendermessage_number (
int) – Sequential message numberparent_base_fee (
int) – Base fee on parent chainmessage_data (
Dict[str,Any]) – Dictionary containing message parameters
- redeem(overrides=None)[source]¶
Redeem the retryable ticket.
- Parameters:
overrides (
Optional[Dict[str,Any]]) – Overrides for the redeem transaction- Return type:
- Returns:
Receipt for the redeem transaction
- class arbitrum_py.message.parent_to_child_message.EthDepositMessage(child_provider, child_chain_id, message_number, from_address, to_address, value)[source]¶
Bases:
objectClass for ETH deposit messages.
This class provides functionality for managing ETH deposit messages.
- Parameters:
child_provider (
Any) – Provider for the child chainchild_chain_id (
int) – ID of the child chainmessage_number (
int) – Sequential message numberfrom_address (
str) – Address sending the messageto_address (
str) – Destination addressvalue (
NewType()(Wei,int)) – Value of the message
- 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 chainmessage_number (
int) – Sequential message numberfrom_address (
str) – Address sending the messageto_address (
str) – Destination addressvalue (
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 chainmessage_number (
int) – Sequential message numbersender_addr (
str) – Address sending the messageinbox_message_event_data (
str) – Event data for the inbox message
- Return type:
- 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
- wait(confirmations=None, timeout=None)[source]¶
Wait for the message to be deposited.
- Parameters:
confirmations (
Optional[int]) – Number of confirmations to wait fortimeout (
Optional[int]) – Timeout in seconds
- Return type:
Optional[TxReceipt]- Returns:
Receipt for the deposit transaction, or None if not found