op_alloy_network

Trait Network

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;
    type ReceiptResponse: RpcObject + ReceiptResponse;
    type HeaderResponse: RpcObject + HeaderResponse;
    type BlockResponse: RpcObject + BlockResponse<Transaction = Self::TransactionResponse, Header = Self::HeaderResponse>;
}
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§

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.

type TxEnvelope: Eip2718Envelope + Debug

The network transaction envelope type.

type UnsignedTx: From<Self::TxEnvelope>

An enum over the various transaction types.

type ReceiptEnvelope: Eip2718Envelope + TxReceipt

The network receipt envelope type.

type Header: BlockHeader

The network header type.

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

The JSON body of a transaction request.

type TransactionResponse: RpcObject + TransactionResponse

The JSON body of a transaction response.

type ReceiptResponse: RpcObject + ReceiptResponse

The JSON body of a transaction receipt.

type HeaderResponse: RpcObject + HeaderResponse

The JSON body of a header response.

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

The JSON body of a block response.

Object Safety§

This trait is not object safe.

Implementors§

§

impl Network for AnyNetwork

§

type TxType = AnyTxType

§

type TxEnvelope = TxEnvelope

§

type UnsignedTx = TypedTransaction

§

type ReceiptEnvelope = AnyReceiptEnvelope

§

type Header = Header

§

type TransactionRequest = WithOtherFields<TransactionRequest>

§

type TransactionResponse = WithOtherFields<Transaction>

§

type ReceiptResponse = WithOtherFields<TransactionReceipt<AnyReceiptEnvelope<Log>>>

§

type HeaderResponse = Header

§

type BlockResponse = WithOtherFields<Block<<AnyNetwork as Network>::TransactionResponse, <AnyNetwork as Network>::HeaderResponse>>

§

impl Network for Ethereum

§

type TxType = TxType

§

type TxEnvelope = TxEnvelope

§

type UnsignedTx = TypedTransaction

§

type ReceiptEnvelope = ReceiptEnvelope

§

type Header = Header

§

type TransactionRequest = TransactionRequest

§

type TransactionResponse = Transaction

§

type ReceiptResponse = TransactionReceipt

§

type HeaderResponse = Header

§

type BlockResponse = Block

source§

impl Network for Optimism