Trait RpcTxConverter
pub trait RpcTxConverter<Tx, RpcTx, TxInfo>:
Clone
+ Debug
+ Unpin
+ Send
+ Sync
+ 'static {
type Err;
// Required method
fn convert_rpc_tx(
&self,
tx: Tx,
signer: Address,
tx_info: TxInfo,
) -> Result<RpcTx, Self::Err>;
}
Expand description
Converts Tx
into RpcTx
Where:
Tx
is a transaction from the consensus layer.RpcTx
is a transaction response object of the RPC API
The conversion function is accompanied by signer
’s address and tx_info
providing extra
context about a transaction in a block.
The RpcTxConverter
has two blanket implementations:
()
assumingTx
implementsIntoRpcTx
and is used as default forRpcConverter
.Fn(Tx, Address, TxInfo) -> RpcTx
and can be applied usingRpcConverter::with_rpc_tx_converter
.
One should prefer to implement IntoRpcTx
for Tx
to get the RpcTxConverter
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 Err
type Err
An associated error that can happen during the conversion.
Required Methods§
fn convert_rpc_tx(
&self,
tx: Tx,
signer: Address,
tx_info: TxInfo,
) -> Result<RpcTx, Self::Err>
fn convert_rpc_tx( &self, tx: Tx, signer: Address, tx_info: TxInfo, ) -> Result<RpcTx, Self::Err>
Performs the conversion of tx
from Tx
into RpcTx
.
See RpcTxConverter
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.