pub trait Transaction:
Debug
+ Any
+ Send
+ Sync
+ 'static {
Show 17 methods
// Required methods
fn chain_id(&self) -> Option<ChainId>;
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 value(&self) -> U256;
fn input(&self) -> &Bytes;
fn ty(&self) -> u8;
fn access_list(&self) -> Option<&AccessList>;
fn blob_versioned_hashes(&self) -> Option<&[B256]>;
fn authorization_list(&self) -> Option<&[SignedAuthorization]>;
// Provided methods
fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128> { ... }
fn to(&self) -> Option<Address> { ... }
}
Expand description
Represents a minimal EVM transaction.
Required Methods§
Sourcefn 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”.
Sourcefn 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
Sourcefn 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”.
Sourcefn 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.
Sourcefn 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.
Sourcefn blob_versioned_hashes(&self) -> Option<&[B256]>
fn blob_versioned_hashes(&self) -> Option<&[B256]>
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§
Sourcefn 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
.
Implementations on Foreign Types§
Source§impl<T: Transaction> Transaction for WithOtherFields<T>
Available on crate feature serde
only.
impl<T: Transaction> Transaction for WithOtherFields<T>
serde
only.