1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
use crate::{Network, ReceiptResponse, TransactionResponse};
mod builder;
mod wallet;
pub use wallet::EthereumWallet;
/// Types for a mainnet-like Ethereum network.
#[derive(Clone, Copy, Debug)]
pub struct Ethereum {
_private: (),
}
impl Network for Ethereum {
type TxType = alloy_consensus::TxType;
type TxEnvelope = alloy_consensus::TxEnvelope;
type UnsignedTx = alloy_consensus::TypedTransaction;
type ReceiptEnvelope = alloy_consensus::ReceiptEnvelope;
type Header = alloy_consensus::Header;
type TransactionRequest = alloy_rpc_types_eth::transaction::TransactionRequest;
type TransactionResponse = alloy_rpc_types_eth::Transaction;
type ReceiptResponse = alloy_rpc_types_eth::TransactionReceipt;
type HeaderResponse = alloy_rpc_types_eth::Header;
}
impl ReceiptResponse for alloy_rpc_types_eth::TransactionReceipt {
fn contract_address(&self) -> Option<alloy_primitives::Address> {
self.contract_address
}
fn status(&self) -> bool {
self.inner.status()
}
}
impl TransactionResponse for alloy_rpc_types_eth::Transaction {
#[doc(alias = "transaction_hash")]
fn tx_hash(&self) -> alloy_primitives::B256 {
self.hash
}
fn from(&self) -> alloy_primitives::Address {
self.from
}
fn to(&self) -> Option<alloy_primitives::Address> {
self.to
}
fn value(&self) -> alloy_primitives::U256 {
self.value
}
fn gas(&self) -> u128 {
self.gas
}
}