Skip to main content

FoundryTxConversion

Trait FoundryTxConversion 

Source
pub trait FoundryTxConversion<N: Network>: EvmTypesHost {
    // Required methods
    fn evm_tx(
        envelope: N::TxEnvelope,
        sender: Address,
        payload: TxPayload,
    ) -> Result<Recovered<Self::Tx>>;
    fn envelope_from_any_rpc(tx: &AnyRpcTransaction) -> Result<N::TxEnvelope>;

    // Provided methods
    fn tx_from_request(
        request: N::TransactionRequest,
    ) -> Result<Recovered<Self::Tx>>
       where N::TransactionRequest: NetworkTransactionBuilder<N>,
             N::UnsignedTx: SignableTransaction<Signature>,
             N::TxEnvelope: From<Signed<N::UnsignedTx>> { ... }
    fn tx_from_signed(envelope: N::TxEnvelope) -> Result<Recovered<Self::Tx>>
       where N::TxEnvelope: SignerRecoverable { ... }
    fn decode_tx(bytes: &[u8]) -> Result<Recovered<Self::Tx>>
       where N::TxEnvelope: SignerRecoverable { ... }
    fn tx_from_any_rpc(tx: &AnyRpcTransaction) -> Result<Recovered<Self::Tx>> { ... }
}
Expand description

Converts an Alloy network’s native transactions into an evm2 execution family’s transactions.

The family, rather than the transaction type alone, owns conversion: families can share a transaction representation while retaining different conversion policies and diagnostics.

Required Methods§

Source

fn evm_tx( envelope: N::TxEnvelope, sender: Address, payload: TxPayload, ) -> Result<Recovered<Self::Tx>>

Converts a network envelope sent by sender, once, right before execution.

Source

fn envelope_from_any_rpc(tx: &AnyRpcTransaction) -> Result<N::TxEnvelope>

Converts a transaction fetched over RPC into this network’s envelope.

Envelopes this family cannot represent fail rather than being projected onto another type.

Provided Methods§

Source

fn tx_from_request( request: N::TransactionRequest, ) -> Result<Recovered<Self::Tx>>
where N::TransactionRequest: NetworkTransactionBuilder<N>, N::UnsignedTx: SignableTransaction<Signature>, N::TxEnvelope: From<Signed<N::UnsignedTx>>,

Converts a complete unsigned request into a simulated transaction.

The request must name its sender and carry every field its transaction type needs; Foundry fills defaults through [TransactionBuilder] before converting, never afterwards.

Source

fn tx_from_signed(envelope: N::TxEnvelope) -> Result<Recovered<Self::Tx>>
where N::TxEnvelope: SignerRecoverable,

Converts a signed envelope into a transaction sent by its recovered signer.

Source

fn decode_tx(bytes: &[u8]) -> Result<Recovered<Self::Tx>>
where N::TxEnvelope: SignerRecoverable,

Decodes exactly the EIP-2718 bytes that were signed and converts them for execution.

Source

fn tx_from_any_rpc(tx: &AnyRpcTransaction) -> Result<Recovered<Self::Tx>>

Converts a transaction fetched over RPC, using its RPC sender as it executed on chain.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FoundryTxConversion<Base> for BaseEvmTypes

Available on crate feature base only.
Source§

fn evm_tx( envelope: BaseTxEnvelope, sender: Address, payload: TxPayload, ) -> Result<Recovered<BaseTxEnvelope>>

Source§

fn envelope_from_any_rpc(tx: &AnyRpcTransaction) -> Result<BaseTxEnvelope>

Source§

impl FoundryTxConversion<Ethereum> for BaseEvmTypes

Source§

fn evm_tx( envelope: TxEnvelope, sender: Address, _payload: TxPayload, ) -> Result<Recovered<TxEnvelope>>

Source§

fn tx_from_request(request: TransactionRequest) -> Result<Recovered<TxEnvelope>>

Source§

fn envelope_from_any_rpc(tx: &AnyRpcTransaction) -> Result<TxEnvelope>

Source§

impl FoundryTxConversion<Ethereum> for MonadEvmTypes

Available on crate feature monad only.
Source§

fn evm_tx( envelope: TxEnvelope, sender: Address, _payload: TxPayload, ) -> Result<Recovered<TxEnvelope>>

Source§

fn tx_from_request(request: TransactionRequest) -> Result<Recovered<TxEnvelope>>

Source§

fn envelope_from_any_rpc(tx: &AnyRpcTransaction) -> Result<TxEnvelope>

Source§

impl FoundryTxConversion<Optimism> for OpEvmTypes

Available on crate feature optimism only.
Source§

fn evm_tx( envelope: OpConsensusTxEnvelope, sender: Address, payload: TxPayload, ) -> Result<Recovered<OpTxEnvelope>>

Source§

fn envelope_from_any_rpc( tx: &AnyRpcTransaction, ) -> Result<OpConsensusTxEnvelope>

Source§

impl FoundryTxConversion<TempoNetwork> for TempoEvmTypes

Source§

fn evm_tx( envelope: TxEnvelopeFor<TempoEvmNetwork>, sender: Address, payload: TxPayload, ) -> Result<Recovered<TempoTxEnv>>

Source§

fn tx_from_request( request: TransactionRequestFor<TempoEvmNetwork>, ) -> Result<Recovered<TempoTxEnv>>

Source§

fn envelope_from_any_rpc( tx: &AnyRpcTransaction, ) -> Result<TxEnvelopeFor<TempoEvmNetwork>>

Implementors§