op_alloy::network

Trait Network

Source
pub trait Network:
    Sized
    + Debug
    + Clone
    + Copy
    + Send
    + Sync
    + 'static {
    type TxType: Into<u8> + PartialEq + Eq + TryFrom<u8, Error = Eip2718Error> + Debug + Display + Clone + Copy + Send + Sync + 'static;
    type TxEnvelope: Eip2718Envelope + Debug;
    type UnsignedTx: From<Self::TxEnvelope>;
    type ReceiptEnvelope: Eip2718Envelope + TxReceipt;
    type Header: BlockHeader;
    type TransactionRequest: RpcObject + TransactionBuilder<Self> + Debug + From<Self::TxEnvelope> + From<Self::UnsignedTx>;
    type TransactionResponse: RpcObject + TransactionResponse + AsRef<Self::TxEnvelope>;
    type ReceiptResponse: RpcObject + ReceiptResponse;
    type HeaderResponse: RpcObject + HeaderResponse + AsRef<Self::Header>;
    type BlockResponse: RpcObject + BlockResponse<Transaction = Self::TransactionResponse, Header = Self::HeaderResponse>;
}
Available on crate feature network only.
Expand description

Captures type info for network-specific RPC requests/responses.

Networks are only containers for types, so it is recommended to use ZSTs for their definition.

Required Associated Types§

Source

type TxType: Into<u8> + PartialEq + Eq + TryFrom<u8, Error = Eip2718Error> + Debug + Display + Clone + Copy + Send + Sync + 'static

The network transaction type enum.

This should be a simple #[repr(u8)] enum, and as such has strict type bounds for better use in error messages, assertions etc.

Source

type TxEnvelope: Eip2718Envelope + Debug

The network transaction envelope type.

Source

type UnsignedTx: From<Self::TxEnvelope>

An enum over the various transaction types.

Source

type ReceiptEnvelope: Eip2718Envelope + TxReceipt

The network receipt envelope type.

Source

type Header: BlockHeader

The network header type.

Source

type TransactionRequest: RpcObject + TransactionBuilder<Self> + Debug + From<Self::TxEnvelope> + From<Self::UnsignedTx>

The JSON body of a transaction request.

Source

type TransactionResponse: RpcObject + TransactionResponse + AsRef<Self::TxEnvelope>

The JSON body of a transaction response.

Source

type ReceiptResponse: RpcObject + ReceiptResponse

The JSON body of a transaction receipt.

Source

type HeaderResponse: RpcObject + HeaderResponse + AsRef<Self::Header>

The JSON body of a header response.

Source

type BlockResponse: RpcObject + BlockResponse<Transaction = Self::TransactionResponse, Header = Self::HeaderResponse>

The JSON body of a block response.

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.

Implementors§

Source§

impl Network for AnyNetwork

Source§

impl Network for Ethereum

Source§

impl Network for Optimism