Struct alloy_chains::Chain
source · pub struct Chain(/* private fields */);Expand description
Either a known NamedChain or a EIP-155 chain ID.
Implementations§
source§impl Chain
impl Chain
sourcepub const fn from_named(named: NamedChain) -> Self
pub const fn from_named(named: NamedChain) -> Self
Creates a new Chain by wrapping a NamedChain.
sourcepub fn from_id(id: u64) -> Self
pub fn from_id(id: u64) -> Self
Creates a new Chain by wrapping a NamedChain.
sourcepub const fn from_id_unchecked(id: u64) -> Self
pub const fn from_id_unchecked(id: u64) -> Self
Creates a new Chain from the given ID, without checking if an associated NamedChain
exists.
This is discouraged, as other methods assume that the chain ID is not known, but it is not unsafe.
sourcepub const fn optimism_goerli() -> Self
pub const fn optimism_goerli() -> Self
Returns the optimism goerli chain.
sourcepub const fn optimism_mainnet() -> Self
pub const fn optimism_mainnet() -> Self
Returns the optimism mainnet chain.
sourcepub const fn base_goerli() -> Self
pub const fn base_goerli() -> Self
Returns the base goerli chain.
sourcepub const fn base_mainnet() -> Self
pub const fn base_mainnet() -> Self
Returns the base mainnet chain.
sourcepub const fn is_optimism(self) -> bool
pub const fn is_optimism(self) -> bool
Returns true if the chain contains Optimism configuration.
sourcepub const fn named(self) -> Option<NamedChain>
pub const fn named(self) -> Option<NamedChain>
Attempts to convert the chain into a named chain.
source§impl Chain
impl Chain
Methods delegated to NamedChain. Note that ChainKind::Id won’t be converted because it was
already done at construction.
sourcepub const fn average_blocktime_hint(self) -> Option<Duration>
pub const fn average_blocktime_hint(self) -> Option<Duration>
Returns the chain’s average blocktime, if applicable.
See NamedChain::average_blocktime_hint for more info.
sourcepub const fn is_legacy(self) -> bool
pub const fn is_legacy(self) -> bool
Returns whether the chain implements EIP-1559 (with the type 2 EIP-2718 transaction type).
See NamedChain::is_legacy for more info.
sourcepub const fn supports_shanghai(self) -> bool
pub const fn supports_shanghai(self) -> bool
Returns whether the chain supports the Shanghai hardfork.
See NamedChain::supports_shanghai for more info.
sourcepub const fn etherscan_urls(self) -> Option<(&'static str, &'static str)>
pub const fn etherscan_urls(self) -> Option<(&'static str, &'static str)>
Returns the chain’s blockchain explorer and its API (Etherscan and Etherscan-like) URLs.
See NamedChain::etherscan_urls for more info.
sourcepub const fn etherscan_api_key_name(self) -> Option<&'static str>
pub const fn etherscan_api_key_name(self) -> Option<&'static str>
Returns the chain’s blockchain explorer’s API key environment variable’s default name.
See NamedChain::etherscan_api_key_name for more info.
sourcepub fn etherscan_api_key(self) -> Option<String>
pub fn etherscan_api_key(self) -> Option<String>
Returns the chain’s blockchain explorer’s API key, from the environment variable with the
name specified in etherscan_api_key_name.
See NamedChain::etherscan_api_key for more info.
sourcepub fn public_dns_network_protocol(self) -> Option<String>
pub fn public_dns_network_protocol(self) -> Option<String>
Returns the address of the public DNS node list for the given chain.
See NamedChain::public_dns_network_protocol for more info.