Trait Transaction
pub trait Transaction {
type TransactionError: TransactionError;
type TransactionType: Into<TransactionType>;
type AccessList: AccessListTrait;
type Legacy: LegacyTx;
type Eip2930: Eip2930Tx<AccessList = Self::AccessList>;
type Eip1559: Eip1559Tx<AccessList = Self::AccessList>;
type Eip4844: Eip4844Tx<AccessList = Self::AccessList>;
type Eip7702: Eip7702Tx<AccessList = Self::AccessList>;
// Required method
fn tx_type(&self) -> Self::TransactionType;
// Provided methods
fn legacy(&self) -> &Self::Legacy { ... }
fn eip2930(&self) -> &Self::Eip2930 { ... }
fn eip1559(&self) -> &Self::Eip1559 { ... }
fn eip4844(&self) -> &Self::Eip4844 { ... }
fn eip7702(&self) -> &Self::Eip7702 { ... }
fn common_fields(&self) -> &dyn CommonTxFields { ... }
fn max_fee(&self) -> u128 { ... }
fn effective_gas_price(&self, base_fee: Uint<256, 4>) -> Uint<256, 4> { ... }
fn kind(&self) -> TxKind { ... }
fn access_list(&self) -> Option<&Self::AccessList> { ... }
}
Expand description
Main Transaction trait that abstracts and specifies all transaction currently supported by Ethereum.
Access to any associated type is gaited behind tx_type
function.
It can be extended to support new transaction types and only transaction types can be deprecated by not returning tx_type.
Required Associated Types§
type TransactionError: TransactionError
type TransactionError: TransactionError
An error that occurs when validating a transaction.
type TransactionType: Into<TransactionType>
type TransactionType: Into<TransactionType>
Transaction type.
type AccessList: AccessListTrait
type AccessList: AccessListTrait
Access list type.
type Legacy: LegacyTx
type Eip2930: Eip2930Tx<AccessList = Self::AccessList>
type Eip1559: Eip1559Tx<AccessList = Self::AccessList>
type Eip4844: Eip4844Tx<AccessList = Self::AccessList>
type Eip7702: Eip7702Tx<AccessList = Self::AccessList>
Required Methods§
fn tx_type(&self) -> Self::TransactionType
fn tx_type(&self) -> Self::TransactionType
Transaction type. Depending on this field other functions should be called.
If transaction is Legacy, then legacy()
should be called.
Provided Methods§
fn common_fields(&self) -> &dyn CommonTxFields
fn common_fields(&self) -> &dyn CommonTxFields
Common fields for all transactions.
fn effective_gas_price(&self, base_fee: Uint<256, 4>) -> Uint<256, 4>
fn effective_gas_price(&self, base_fee: Uint<256, 4>) -> Uint<256, 4>
Effective gas price is gas price field for Legacy and Eip2930 transaction While for transactions after Eip1559 it is minimum of max_fee and base+max_priority_fee.
fn kind(&self) -> TxKind
fn kind(&self) -> TxKind
Transaction kind.
fn access_list(&self) -> Option<&Self::AccessList>
fn access_list(&self) -> Option<&Self::AccessList>
Returns access list.