FromConsensusTx

Trait FromConsensusTx 

pub trait FromConsensusTx<T> {
    type TxInfo;

    // Required method
    fn from_consensus_tx(tx: T, signer: Address, tx_info: Self::TxInfo) -> Self;
}
Available on crate feature node-api only.
Expand description

Converts T into self. It is reciprocal of IntoRpcTx.

Should create an RPC transaction response object based on a consensus transaction, its signer Address and an additional context FromConsensusTx::TxInfo.

Prefer implementing FromConsensusTx over IntoRpcTx because it automatically provides an implementation of IntoRpcTx thanks to the blanket implementation in this crate.

Prefer using IntoRpcTx over using FromConsensusTx when specifying trait bounds on a generic function. This way, types that directly implement IntoRpcTx can be used as arguments as well.

Required Associated Types§

type TxInfo

An additional context, usually TransactionInfo in a wrapper that carries some implementation specific extra information.

Required Methods§

fn from_consensus_tx(tx: T, signer: Address, tx_info: Self::TxInfo) -> Self

Performs the conversion consuming tx with signer and tx_info. See FromConsensusTx for details.

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§

§

impl<T> FromConsensusTx<T> for Transaction<T>
where T: OpTransaction + Transaction,

§

type TxInfo = OpTransactionInfo

§

fn from_consensus_tx( tx: T, signer: Address, tx_info: <Transaction<T> as FromConsensusTx<T>>::TxInfo, ) -> Transaction<T>

Implementors§

§

impl<TxIn, T> FromConsensusTx<TxIn> for reth_ethereum::rpc::eth::primitives::Transaction<T>
where TxIn: Transaction, T: Transaction + From<TxIn>,