#![doc = include_str!("../README.md")]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg",
html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico"
)]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use alloy_consensus::{BlockHeader, TxReceipt};
use alloy_eips::eip2718::{Eip2718Envelope, Eip2718Error};
use alloy_json_rpc::RpcObject;
use core::fmt::{Debug, Display};
mod transaction;
pub use transaction::{
BuildResult, NetworkWallet, TransactionBuilder, TransactionBuilder4844, TransactionBuilder7702,
TransactionBuilderError, TxSigner, TxSignerSync, UnbuiltTransactionError,
};
mod ethereum;
pub use ethereum::{Ethereum, EthereumWallet};
mod any;
pub use any::{AnyNetwork, AnyTxType};
pub use alloy_eips::eip2718;
pub use alloy_network_primitives::{
self as primitives, BlockResponse, HeaderResponse, ReceiptResponse, TransactionResponse,
};
pub trait Network: Debug + Clone + Copy + Sized + Send + Sync + 'static {
#[doc(alias = "TransactionType")]
type TxType: Into<u8>
+ PartialEq
+ Eq
+ TryFrom<u8, Error = Eip2718Error>
+ Debug
+ Display
+ Clone
+ Copy
+ Send
+ Sync
+ 'static;
#[doc(alias = "TransactionEnvelope")]
type TxEnvelope: Eip2718Envelope + Debug;
#[doc(alias = "UnsignedTransaction")]
type UnsignedTx: From<Self::TxEnvelope>;
#[doc(alias = "TransactionReceiptEnvelope", alias = "TxReceiptEnvelope")]
type ReceiptEnvelope: Eip2718Envelope + TxReceipt;
type Header: BlockHeader;
#[doc(alias = "TxRequest")]
type TransactionRequest: RpcObject
+ TransactionBuilder<Self>
+ Debug
+ From<Self::TxEnvelope>
+ From<Self::UnsignedTx>;
#[doc(alias = "TxResponse")]
type TransactionResponse: RpcObject + TransactionResponse;
#[doc(alias = "TransactionReceiptResponse", alias = "TxReceiptResponse")]
type ReceiptResponse: RpcObject + ReceiptResponse;
type HeaderResponse: RpcObject + HeaderResponse;
type BlockResponse: RpcObject
+ BlockResponse<Transaction = Self::TransactionResponse, Header = Self::HeaderResponse>;
}