TransactionRequest¶
- class arbitrum_py.data_entities.transaction_request.ParentToChildMessageParams(to, callValue, callData)[source]¶
Bases:
objectParameters for a message from parent chain to child chain.
This class defines the parameters needed to describe a message call on the child chain (e.g., L2 in the case of Arbitrum).
- Variables:
to (HexAddress) – The target address on the child chain
callValue (Wei) – The value in wei to be sent with the message
callData (HexStr) – The encoded function data to be executed
-
to:
NewType()(HexAddress,NewType()(HexStr,str))¶
-
callValue:
NewType()(Wei,int)¶
-
callData:
NewType()(HexStr,str)¶
- __init__(to, callValue, callData)¶
- class arbitrum_py.data_entities.transaction_request.ParentToChildMessageGasParams(gasLimit, maxFeePerGas, maxSubmissionCost)[source]¶
Bases:
objectGas parameters for parent to child chain message execution.
This class defines the gas-related parameters needed for message execution on the child chain.
- Variables:
gasLimit (int) – Maximum gas that can be used for execution
maxFeePerGas (Wei) – Maximum fee per gas unit willing to pay
maxSubmissionCost (Wei) – Maximum cost willing to pay for submission
-
gasLimit:
int¶
-
maxFeePerGas:
NewType()(Wei,int)¶
-
maxSubmissionCost:
NewType()(Wei,int)¶
- __init__(gasLimit, maxFeePerGas, maxSubmissionCost)¶
- class arbitrum_py.data_entities.transaction_request.ParentToChildTransactionRequest(tx_request, retryable_data)[source]¶
Bases:
objectA transaction request that triggers execution on the child chain.
This class represents transactions that initiate some execution on the child chain, such as L1->L2 message bridging operations in Arbitrum.
The transaction consists of two main parts: 1. The transaction request on the parent chain 2. Parameters for the retryable ticket that will be created on the child chain
- Variables:
txRequest (TxParams) – Core transaction fields for the parent chain
retryableData (ParentToChildMessageParams & ParentToChildMessageGasParams) – Parameters for the retryable ticket execution on the child chain
Example
>>> txRequest = { ... 'to': '0x...', # Bridge contract address ... 'data': '0x...', # Encoded function data ... 'value': 1000000000000000000, # 1 ETH ... 'from': '0x...' # Sender address ... } >>> retryableData = { ... 'to': '0x...', # L2 target ... 'callValue': 1000000000000000000, ... 'callData': '0x...', ... 'gasLimit': 100000, ... 'maxFeePerGas': 2000000000, ... 'maxSubmissionCost': 1000000000 ... } >>> request = ParentToChildTransactionRequest(tx_request, retryable_data)
- __init__(tx_request, retryable_data)[source]¶
Initialize a new ParentToChildTransactionRequest.
- Parameters:
txRequest – Transaction parameters for the parent chain
retryableData – Parameters for the child chain execution
- Raises:
ValueError – If required fields are missing from txRequest
- is_valid()[source]¶
Check if the transaction would have enough margin to succeed.
This method verifies that the transaction parameters provide enough margin for reliable execution, checking aspects like: - Sufficient gas limits - Adequate maxSubmissionCost - Appropriate maxFeePerGas values
- Returns:
- True if the transaction parameters provide enough margin
for reliable execution, False otherwise
- Return type:
bool
- class arbitrum_py.data_entities.transaction_request.ChildToParentTransactionRequest(tx_request, estimate_parent_gas_limit)[source]¶
Bases:
objectA transaction request that triggers a message from child to parent chain.
This class represents transactions that initiate messages from the child chain to the parent chain, such as L2->L1 withdrawals in Arbitrum.
- Variables:
tx_request (TxParams) – Core transaction fields for the child chain
estimate_parent_gas_limit (Callable[[Web3], Wei]) – Function to estimate the gas needed on the parent chain for message finalization
Example
>>> def estimate_l1_gas(l1_provider: Web3) -> Wei: ... # Estimate gas needed for L1 execution ... return Wei(100000) ... >>> tx_request = { ... 'to': '0x...', # L2 withdrawal contract ... 'data': '0x...', # Encoded withdrawal data ... 'value': 1000000000000000000, # 1 ETH ... 'from': '0x...' # Sender address ... } >>> request = ChildToParentTransactionRequest( ... tx_request, ... estimate_l1_gas ... )
- __init__(tx_request, estimate_parent_gas_limit)[source]¶
Initialize a new ChildToParentTransactionRequest.
- Parameters:
tx_request (
TxParams) – Transaction parameters for the child chainestimate_parent_gas_limit (
Callable[[Web3],NewType()(Wei,int)]) – Function that estimates the gas needed for message finalization on the parent chain
- Raises:
ValueError – If required fields are missing from tx_request
- arbitrum_py.data_entities.transaction_request.is_parent_to_child_transaction_request(possible_request)[source]¶
Check if an object is a ParentToChildTransactionRequest.
This function serves as both a runtime type check and a type guard in static type checking contexts.
- Parameters:
possible_request (
Union[TypeVar(T),ParentToChildTransactionRequest]) – Object to check- Return type:
bool- Returns:
True if the object appears to be a ParentToChildTransactionRequest
Example
>>> req = ParentToChildTransactionRequest(txRequest, retryable_data) >>> is_parent_to_child_transaction_request(req) # True >>> is_parent_to_child_transaction_request({'other': 'data'}) # False
- arbitrum_py.data_entities.transaction_request.is_child_to_parent_transaction_request(possible_request)[source]¶
Check if an object is a ChildToParentTransactionRequest.
This function serves as both a runtime type check and a type guard in static type checking contexts.
- Parameters:
possible_request (
Union[TypeVar(T),ChildToParentTransactionRequest]) – Object to check- Return type:
bool- Returns:
True if the object appears to be a ChildToParentTransactionRequest
Example
>>> req = ChildToParentTransactionRequest(txRequest, estimate_gas) >>> is_child_to_parent_transaction_request(req) # True >>> is_child_to_parent_transaction_request({'other': 'data'}) # False