Trait TransactionTrait
pub trait TransactionTrait:
Typed2718
+ Debug
+ Any
+ Send
+ Sync
+ 'static {
Show 20 methods
// Required methods
fn chain_id(&self) -> Option<u64>;
fn nonce(&self) -> u64;
fn gas_limit(&self) -> u64;
fn gas_price(&self) -> Option<u128>;
fn max_fee_per_gas(&self) -> u128;
fn max_priority_fee_per_gas(&self) -> Option<u128>;
fn max_fee_per_blob_gas(&self) -> Option<u128>;
fn priority_fee_or_price(&self) -> u128;
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128;
fn is_dynamic_fee(&self) -> bool;
fn kind(&self) -> TxKind;
fn is_create(&self) -> bool;
fn value(&self) -> Uint<256, 4>;
fn input(&self) -> &Bytes;
fn access_list(&self) -> Option<&AccessList>;
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>;
fn authorization_list(&self) -> Option<&[SignedAuthorization]>;
// Provided methods
fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128> { ... }
fn to(&self) -> Option<Address> { ... }
fn blob_gas_used(&self) -> Option<u64> { ... }
}
Expand description
Represents a minimal EVM transaction.
Required Methods§
fn max_fee_per_gas(&self) -> u128
fn max_fee_per_gas(&self) -> u128
Returns the EIP-1559 the maximum fee per gas the caller is willing to pay.
For legacy transactions this is gas_price
.
This is also commonly referred to as the “Gas Fee Cap”.
fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_priority_fee_per_gas(&self) -> Option<u128>
Returns the EIP-1559 Priority fee the caller is paying to the block author.
This will return None
for non-EIP1559 transactions
fn max_fee_per_blob_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
Max fee per blob gas for EIP-4844 transaction.
Returns None
for non-eip4844 transactions.
This is also commonly referred to as the “Blob Gas Fee Cap”.
fn priority_fee_or_price(&self) -> u128
fn priority_fee_or_price(&self) -> u128
Return the max priority fee per gas if the transaction is an EIP-1559 transaction, and otherwise return the gas price.
§Warning
This is different than the max_priority_fee_per_gas
method, which returns None
for
non-EIP-1559 transactions.
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
Returns the effective gas price for the given base fee.
If the transaction is a legacy or EIP2930 transaction, the gas price is returned.
fn is_dynamic_fee(&self) -> bool
fn is_dynamic_fee(&self) -> bool
Returns true
if the transaction supports dynamic fees.
fn is_create(&self) -> bool
fn is_create(&self) -> bool
Returns true if the transaction is a contract creation.
We don’t provide a default implementation via kind
as it copies the 21-byte
TxKind
for this simple check. A proper implementation shouldn’t allocate.
fn access_list(&self) -> Option<&AccessList>
fn access_list(&self) -> Option<&AccessList>
Returns the EIP-2930 access_list
for the particular transaction type. Returns None
for
older transaction types.
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
Blob versioned hashes for eip4844 transaction. For previous transaction types this is
None
.
Returns the SignedAuthorization
list of the transaction.
Returns None
if this transaction is not EIP-7702.
Provided Methods§
fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>
fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>
Returns the effective tip for this transaction.
For EIP-1559 transactions: min(max_fee_per_gas - base_fee, max_priority_fee_per_gas)
.
For legacy transactions: gas_price - base_fee
.
fn to(&self) -> Option<Address>
fn to(&self) -> Option<Address>
Get the transaction’s address of the contract that will be called, or the address that will receive the transfer.
Returns None
if this is a CREATE
transaction.
fn blob_gas_used(&self) -> Option<u64>
fn blob_gas_used(&self) -> Option<u64>
Returns the total gas for all blobs in this transaction.
Returns None
for non-eip4844 transactions.
Implementations on Foreign Types§
§impl Transaction for AnyTxEnvelope
impl Transaction for AnyTxEnvelope
fn chain_id(&self) -> Option<u64>
fn nonce(&self) -> u64
fn gas_limit(&self) -> u64
fn gas_price(&self) -> Option<u128>
fn max_fee_per_gas(&self) -> u128
fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
fn priority_fee_or_price(&self) -> u128
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
fn is_dynamic_fee(&self) -> bool
fn kind(&self) -> TxKind
fn is_create(&self) -> bool
fn value(&self) -> Uint<256, 4>
fn input(&self) -> &Bytes
fn access_list(&self) -> Option<&AccessList>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
§impl Transaction for AnyTypedTransaction
impl Transaction for AnyTypedTransaction
fn chain_id(&self) -> Option<u64>
fn nonce(&self) -> u64
fn gas_limit(&self) -> u64
fn gas_price(&self) -> Option<u128>
fn max_fee_per_gas(&self) -> u128
fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
fn priority_fee_or_price(&self) -> u128
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
fn is_dynamic_fee(&self) -> bool
fn kind(&self) -> TxKind
fn is_create(&self) -> bool
fn value(&self) -> Uint<256, 4>
fn input(&self) -> &Bytes
fn access_list(&self) -> Option<&AccessList>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
§impl Transaction for OpPooledTransaction
impl Transaction for OpPooledTransaction
fn chain_id(&self) -> Option<u64>
fn nonce(&self) -> u64
fn gas_limit(&self) -> u64
fn gas_price(&self) -> Option<u128>
fn max_fee_per_gas(&self) -> u128
fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
fn priority_fee_or_price(&self) -> u128
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
fn is_dynamic_fee(&self) -> bool
fn kind(&self) -> TxKind
fn is_create(&self) -> bool
fn value(&self) -> Uint<256, 4>
fn input(&self) -> &Bytes
fn access_list(&self) -> Option<&AccessList>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
§impl Transaction for OpTransactionSigned
impl Transaction for OpTransactionSigned
fn chain_id(&self) -> Option<u64>
fn nonce(&self) -> u64
fn gas_limit(&self) -> u64
fn gas_price(&self) -> Option<u128>
fn max_fee_per_gas(&self) -> u128
fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
fn priority_fee_or_price(&self) -> u128
fn kind(&self) -> TxKind
fn is_create(&self) -> bool
fn value(&self) -> Uint<256, 4>
fn input(&self) -> &Bytes
fn access_list(&self) -> Option<&AccessList>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
fn is_dynamic_fee(&self) -> bool
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>
§impl Transaction for OpTxEnvelope
impl Transaction for OpTxEnvelope
fn chain_id(&self) -> Option<u64>
fn nonce(&self) -> u64
fn gas_limit(&self) -> u64
fn gas_price(&self) -> Option<u128>
fn max_fee_per_gas(&self) -> u128
fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
fn priority_fee_or_price(&self) -> u128
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
fn is_dynamic_fee(&self) -> bool
fn kind(&self) -> TxKind
fn is_create(&self) -> bool
fn to(&self) -> Option<Address>
fn value(&self) -> Uint<256, 4>
fn input(&self) -> &Bytes
fn access_list(&self) -> Option<&AccessList>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
§impl Transaction for OpTypedTransaction
impl Transaction for OpTypedTransaction
fn chain_id(&self) -> Option<u64>
fn nonce(&self) -> u64
fn gas_limit(&self) -> u64
fn gas_price(&self) -> Option<u128>
fn max_fee_per_gas(&self) -> u128
fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
fn priority_fee_or_price(&self) -> u128
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
fn is_dynamic_fee(&self) -> bool
fn kind(&self) -> TxKind
fn is_create(&self) -> bool
fn to(&self) -> Option<Address>
fn value(&self) -> Uint<256, 4>
fn input(&self) -> &Bytes
fn access_list(&self) -> Option<&AccessList>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
§impl Transaction for Transaction
impl Transaction for Transaction
fn chain_id(&self) -> Option<u64>
fn nonce(&self) -> u64
fn gas_limit(&self) -> u64
fn gas_price(&self) -> Option<u128>
fn max_fee_per_gas(&self) -> u128
fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
fn priority_fee_or_price(&self) -> u128
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
fn is_dynamic_fee(&self) -> bool
fn kind(&self) -> TxKind
fn is_create(&self) -> bool
fn to(&self) -> Option<Address>
fn value(&self) -> Uint<256, 4>
fn input(&self) -> &Bytes
fn access_list(&self) -> Option<&AccessList>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
§impl Transaction for TxDeposit
impl Transaction for TxDeposit
fn chain_id(&self) -> Option<u64>
fn nonce(&self) -> u64
fn gas_limit(&self) -> u64
fn gas_price(&self) -> Option<u128>
fn max_fee_per_gas(&self) -> u128
fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
fn priority_fee_or_price(&self) -> u128
fn effective_gas_price(&self, _: Option<u64>) -> u128
fn is_dynamic_fee(&self) -> bool
fn kind(&self) -> TxKind
fn is_create(&self) -> bool
fn value(&self) -> Uint<256, 4>
fn input(&self) -> &Bytes
fn access_list(&self) -> Option<&AccessList>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
§impl Transaction for UnknownTxEnvelope
impl Transaction for UnknownTxEnvelope
fn chain_id(&self) -> Option<u64>
fn nonce(&self) -> u64
fn gas_limit(&self) -> u64
fn gas_price(&self) -> Option<u128>
fn max_fee_per_gas(&self) -> u128
fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
fn priority_fee_or_price(&self) -> u128
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
fn is_dynamic_fee(&self) -> bool
fn kind(&self) -> TxKind
fn is_create(&self) -> bool
fn value(&self) -> Uint<256, 4>
fn input(&self) -> &Bytes
fn access_list(&self) -> Option<&AccessList>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
§impl Transaction for UnknownTypedTransaction
impl Transaction for UnknownTypedTransaction
fn chain_id(&self) -> Option<u64>
fn nonce(&self) -> u64
fn gas_limit(&self) -> u64
fn gas_price(&self) -> Option<u128>
fn max_fee_per_gas(&self) -> u128
fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
fn priority_fee_or_price(&self) -> u128
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
fn is_dynamic_fee(&self) -> bool
fn kind(&self) -> TxKind
fn is_create(&self) -> bool
fn value(&self) -> Uint<256, 4>
fn input(&self) -> &Bytes
fn access_list(&self) -> Option<&AccessList>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
§impl<'a, T> Transaction for &'a T
impl<'a, T> Transaction for &'a T
fn chain_id(&self) -> Option<u64>
fn nonce(&self) -> u64
fn gas_limit(&self) -> u64
fn gas_price(&self) -> Option<u128>
fn max_fee_per_gas(&self) -> u128
fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
fn priority_fee_or_price(&self) -> u128
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>
fn is_dynamic_fee(&self) -> bool
fn kind(&self) -> TxKind
fn is_create(&self) -> bool
fn to(&self) -> Option<Address>
fn value(&self) -> Uint<256, 4>
fn input(&self) -> &Bytes
fn access_list(&self) -> Option<&AccessList>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
fn blob_gas_used(&self) -> Option<u64>
§impl<T> Transaction for Arc<T>
impl<T> Transaction for Arc<T>
fn chain_id(&self) -> Option<u64>
fn nonce(&self) -> u64
fn gas_limit(&self) -> u64
fn gas_price(&self) -> Option<u128>
fn max_fee_per_gas(&self) -> u128
fn max_priority_fee_per_gas(&self) -> Option<u128>
fn max_fee_per_blob_gas(&self) -> Option<u128>
fn priority_fee_or_price(&self) -> u128
fn effective_gas_price(&self, base_fee: Option<u64>) -> u128
fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>
fn is_dynamic_fee(&self) -> bool
fn kind(&self) -> TxKind
fn is_create(&self) -> bool
fn to(&self) -> Option<Address>
fn value(&self) -> Uint<256, 4>
fn input(&self) -> &Bytes
fn access_list(&self) -> Option<&AccessList>
fn blob_versioned_hashes(&self) -> Option<&[FixedBytes<32>]>
fn blob_gas_used(&self) -> Option<u64>
Implementors§
impl Transaction for PooledTransaction
impl Transaction for reth::primitives::Transaction
impl Transaction for TransactionSigned
impl Transaction for TxEip1559
impl Transaction for TxEip2930
impl Transaction for TxEip4844
impl Transaction for TxEip7702
impl Transaction for TxEip4844Variant
impl Transaction for TxEip4844WithSidecar
impl Transaction for TxEnvelope
impl Transaction for TxLegacy
impl Transaction for TypedTransaction
impl<T> Transaction for WithOtherFields<T>where
T: Transaction,
serde
only.