TxEnvConverter

Trait TxEnvConverter 

pub trait TxEnvConverter<TxReq, TxEnv, Spec>:
    Debug
    + Send
    + Sync
    + Unpin
    + Clone
    + 'static {
    type Error;

    // Required method
    fn convert_tx_env(
        &self,
        tx_req: TxReq,
        cfg_env: &CfgEnv<Spec>,
        block_env: &BlockEnv,
    ) -> Result<TxEnv, Self::Error>;
}
Expand description

Converts TxReq into TxEnv.

Where:

  • TxReq is a transaction request received from an RPC API
  • TxEnv is the corresponding transaction environment for execution

The TxEnvConverter has two blanket implementations:

One should prefer to implement TryIntoTxEnv for TxReq to get the TxEnvConverter implementation for free, thanks to the blanket implementation, unless the conversion requires more context. For example, some configuration parameters or access handles to database, network, etc.

Required Associated Types§

type Error

An associated error that can occur during conversion.

Required Methods§

fn convert_tx_env( &self, tx_req: TxReq, cfg_env: &CfgEnv<Spec>, block_env: &BlockEnv, ) -> Result<TxEnv, Self::Error>

Converts a rpc transaction request into a transaction environment.

See TxEnvConverter for more information.

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<TxReq, TxEnv, Spec> TxEnvConverter<TxReq, TxEnv, Spec> for ()
where TxReq: TryIntoTxEnv<TxEnv>,

§

type Error = <TxReq as TryIntoTxEnv<TxEnv>>::Err

§

fn convert_tx_env( &self, tx_req: TxReq, cfg_env: &CfgEnv<Spec>, block_env: &BlockEnv, ) -> Result<TxEnv, <() as TxEnvConverter<TxReq, TxEnv, Spec>>::Error>

Implementors§

§

impl<F, TxReq, TxEnv, E, Spec> TxEnvConverter<TxReq, TxEnv, Spec> for F
where F: Fn(TxReq, &CfgEnv<Spec>, &BlockEnv) -> Result<TxEnv, E> + Debug + Send + Sync + Unpin + Clone + 'static, TxReq: Clone, E: Error + Send + Sync + 'static,

Converts rpc transaction requests into transaction environment using a closure.

§

type Error = E