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§
Sourcefn evm_tx(
envelope: N::TxEnvelope,
sender: Address,
payload: TxPayload,
) -> Result<Recovered<Self::Tx>>
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.
Sourcefn envelope_from_any_rpc(tx: &AnyRpcTransaction) -> Result<N::TxEnvelope>
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§
Sourcefn 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_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.
Sourcefn tx_from_signed(envelope: N::TxEnvelope) -> Result<Recovered<Self::Tx>>where
N::TxEnvelope: SignerRecoverable,
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.
Sourcefn decode_tx(bytes: &[u8]) -> Result<Recovered<Self::Tx>>where
N::TxEnvelope: SignerRecoverable,
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.
Sourcefn tx_from_any_rpc(tx: &AnyRpcTransaction) -> Result<Recovered<Self::Tx>>
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.
impl FoundryTxConversion<Base> for BaseEvmTypes
base only.Source§impl FoundryTxConversion<Ethereum> for BaseEvmTypes
impl FoundryTxConversion<Ethereum> for BaseEvmTypes
Source§impl FoundryTxConversion<Ethereum> for MonadEvmTypes
Available on crate feature monad only.
impl FoundryTxConversion<Ethereum> for MonadEvmTypes
monad only.Source§impl FoundryTxConversion<Optimism> for OpEvmTypes
Available on crate feature optimism only.
impl FoundryTxConversion<Optimism> for OpEvmTypes
optimism only.