Trait reth_transaction_pool::PoolTransaction

source ·
pub trait PoolTransaction:
    Debug
    + Send
    + Sync
    + Clone {
    type TryFromConsensusError;
    type Consensus: From<Self> + TryInto<Self>;
    type Pooled: Into<Self>;

Show 24 methods // Required methods fn try_from_consensus( tx: Self::Consensus, ) -> Result<Self, Self::TryFromConsensusError>; fn into_consensus(self) -> Self::Consensus; fn from_pooled(pooled: Self::Pooled) -> Self; fn hash(&self) -> &TxHash; fn sender(&self) -> Address; fn nonce(&self) -> u64; fn cost(&self) -> U256; fn gas_limit(&self) -> u64; fn max_fee_per_gas(&self) -> u128; fn access_list(&self) -> Option<&AccessList>; fn max_priority_fee_per_gas(&self) -> Option<u128>; fn max_fee_per_blob_gas(&self) -> Option<u128>; fn effective_tip_per_gas(&self, base_fee: u64) -> Option<u128>; fn priority_fee_or_price(&self) -> u128; fn kind(&self) -> TxKind; fn input(&self) -> &[u8] ; fn size(&self) -> usize; fn tx_type(&self) -> u8; fn encoded_length(&self) -> usize; fn chain_id(&self) -> Option<u64>; // Provided methods fn to(&self) -> Option<Address> { ... } fn is_eip1559(&self) -> bool { ... } fn is_eip4844(&self) -> bool { ... } fn is_eip7702(&self) -> bool { ... }
}
Expand description

Trait for transaction types used inside the pool

Required Associated Types§

source

type TryFromConsensusError

Associated error type for the try_from_consensus method.

source

type Consensus: From<Self> + TryInto<Self>

Associated type representing the raw consensus variant of the transaction.

source

type Pooled: Into<Self>

Associated type representing the recovered pooled variant of the transaction.

Required Methods§

source

fn try_from_consensus( tx: Self::Consensus, ) -> Result<Self, Self::TryFromConsensusError>

Define a method to convert from the Consensus type to Self

source

fn into_consensus(self) -> Self::Consensus

Define a method to convert from the Self type to Consensus

source

fn from_pooled(pooled: Self::Pooled) -> Self

Define a method to convert from the Pooled type to Self

source

fn hash(&self) -> &TxHash

Hash of the transaction.

source

fn sender(&self) -> Address

The Sender of the transaction.

source

fn nonce(&self) -> u64

Returns the nonce for this transaction.

source

fn cost(&self) -> U256

Returns the cost that this transaction is allowed to consume:

For EIP-1559 transactions: max_fee_per_gas * gas_limit + tx_value. For legacy transactions: gas_price * gas_limit + tx_value. For EIP-4844 blob transactions: max_fee_per_gas * gas_limit + tx_value + max_blob_fee_per_gas * blob_gas_used.

source

fn gas_limit(&self) -> u64

Amount of gas that should be used in executing this transaction. This is paid up-front.

source

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” (GasFeeCap).

source

fn access_list(&self) -> Option<&AccessList>

Returns the access_list for the particular transaction type. For Legacy transactions, returns default.

source

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

source

fn max_fee_per_blob_gas(&self) -> Option<u128>

Returns the EIP-4844 max fee per data gas

This will return None for non-EIP4844 transactions

source

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.

source

fn priority_fee_or_price(&self) -> u128

Returns the max priority fee per gas if the transaction is an EIP-1559 transaction, and otherwise returns the gas price.

source

fn kind(&self) -> TxKind

Returns the transaction’s [TxKind], which is the address of the recipient or [TxKind::Create] if the transaction is a contract creation.

source

fn input(&self) -> &[u8]

Returns the input data of this transaction.

source

fn size(&self) -> usize

Returns a measurement of the heap usage of this type and all its internals.

source

fn tx_type(&self) -> u8

Returns the transaction type

source

fn encoded_length(&self) -> usize

Returns the length of the rlp encoded transaction object

Note: Implementations should cache this value.

source

fn chain_id(&self) -> Option<u64>

Returns chain_id

Provided Methods§

source

fn to(&self) -> Option<Address>

Returns the recipient of the transaction if it is not a [TxKind::Create] transaction.

source

fn is_eip1559(&self) -> bool

Returns true if the transaction is an EIP-1559 transaction.

source

fn is_eip4844(&self) -> bool

Returns true if the transaction is an EIP-4844 transaction.

source

fn is_eip7702(&self) -> bool

Returns true if the transaction is an EIP-7702 transaction.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl PoolTransaction for MockTransaction

Available on crate feature test-utils only.
source§

type TryFromConsensusError = TryFromRecoveredTransactionError

source§

type Consensus = TransactionSignedEcRecovered

source§

type Pooled = PooledTransactionsElementEcRecovered

source§

impl PoolTransaction for EthPooledTransaction

source§

type TryFromConsensusError = TryFromRecoveredTransactionError

source§

type Consensus = TransactionSignedEcRecovered

source§

type Pooled = PooledTransactionsElementEcRecovered