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:
Txis a transaction from the consensus layer.RpcTxis 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:
()assumingTximplementsIntoRpcTxand is used as default forRpcConverter.Fn(Tx, Address, TxInfo) -> RpcTxand 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§
Required Methods§
Sourcefn 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.