Trait FromRecoveredTx

Source
pub trait FromRecoveredTx<Tx> {
    // Required method
    fn from_recovered_tx(tx: &Tx, sender: Address) -> Self;
}
Expand description

Helper trait for building a transaction environment from a recovered transaction.

This trait enables the conversion of consensus transaction types (which have been recovered with their sender address) into the EVM’s transaction environment. It’s automatically used when a Recovered<T> type is passed to the EVM’s transact method.

The expectation is that any recovered consensus transaction can be converted into the transaction type that the EVM operates on (typically TxEnv).

§Implementation

This trait is implemented for all standard Ethereum transaction types (TxLegacy, TxEip2930, TxEip1559, TxEip4844, TxEip7702) and transaction envelopes (EthereumTxEnvelope).

§Example

// Recover the signer from a transaction
let recovered = tx.recover_signer()?;

// The recovered transaction can now be used with the EVM
// This works because Recovered<T> implements IntoTxEnv when T implements FromRecoveredTx
evm.transact(recovered)?;

Required Methods§

Source

fn from_recovered_tx(tx: &Tx, sender: Address) -> Self

Builds a TxEnv from a transaction and a sender address.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl FromRecoveredTx<Signed<TxEip1559>> for TxEnv

Source§

impl FromRecoveredTx<Signed<TxEip2930>> for TxEnv

Source§

impl FromRecoveredTx<Signed<TxEip4844>> for TxEnv

Source§

impl FromRecoveredTx<Signed<TxEip7702>> for TxEnv

Source§

impl FromRecoveredTx<Signed<TxLegacy>> for TxEnv

Source§

impl FromRecoveredTx<TxEip1559> for TxEnv

Source§

fn from_recovered_tx(tx: &TxEip1559, caller: Address) -> Self

Source§

impl FromRecoveredTx<TxEip2930> for TxEnv

Source§

fn from_recovered_tx(tx: &TxEip2930, caller: Address) -> Self

Source§

impl FromRecoveredTx<TxEip4844> for TxEnv

Source§

fn from_recovered_tx(tx: &TxEip4844, caller: Address) -> Self

Source§

impl FromRecoveredTx<TxEip7702> for TxEnv

Source§

fn from_recovered_tx(tx: &TxEip7702, caller: Address) -> Self

Source§

impl FromRecoveredTx<TxLegacy> for TxEnv

Source§

fn from_recovered_tx(tx: &TxLegacy, caller: Address) -> Self

Source§

impl<Eip4844: AsRef<TxEip4844>> FromRecoveredTx<EthereumTxEnvelope<Eip4844>> for TxEnv

Source§

fn from_recovered_tx(tx: &EthereumTxEnvelope<Eip4844>, sender: Address) -> Self

Implementors§

Source§

impl<TxEnv, T> FromRecoveredTx<&T> for TxEnv
where TxEnv: FromRecoveredTx<T>,