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_mainnet() -> Self
pub const fn optimism_mainnet() -> Self
Returns the optimism mainnet chain.
sourcepub const fn optimism_goerli() -> Self
pub const fn optimism_goerli() -> Self
Returns the optimism goerli chain.
sourcepub const fn optimism_sepolia() -> Self
pub const fn optimism_sepolia() -> Self
Returns the optimism sepolia chain.
sourcepub const fn base_mainnet() -> Self
pub const fn base_mainnet() -> Self
Returns the base mainnet chain.
sourcepub const fn base_goerli() -> Self
pub const fn base_goerli() -> Self
Returns the base goerli chain.
sourcepub const fn base_sepolia() -> Self
pub const fn base_sepolia() -> Self
Returns the base sepolia chain.
sourcepub const fn arbitrum_mainnet() -> Self
pub const fn arbitrum_mainnet() -> Self
Returns the arbitrum mainnet chain.
sourcepub const fn arbitrum_nova() -> Self
pub const fn arbitrum_nova() -> Self
Returns the arbitrum nova chain.
sourcepub const fn arbitrum_goerli() -> Self
pub const fn arbitrum_goerli() -> Self
Returns the arbitrum goerli chain.
sourcepub const fn arbitrum_sepolia() -> Self
pub const fn arbitrum_sepolia() -> Self
Returns the arbitrum sepolia chain.
sourcepub const fn arbitrum_testnet() -> Self
pub const fn arbitrum_testnet() -> Self
Returns the arbitrum testnet chain.
sourcepub const fn syndr_sepolia() -> Self
pub const fn syndr_sepolia() -> Self
Returns the syndr sepolia chain.
sourcepub const fn fraxtal_testnet() -> Self
pub const fn fraxtal_testnet() -> Self
Returns the fraxtal testnet chain.
sourcepub const fn blast_sepolia() -> Self
pub const fn blast_sepolia() -> Self
Returns the blast sepolia chain.
sourcepub const fn linea_goerli() -> Self
pub const fn linea_goerli() -> Self
Returns the linea goerli chain.
sourcepub const fn linea_sepolia() -> Self
pub const fn linea_sepolia() -> Self
Returns the linea sepolia chain.
sourcepub const fn mode_sepolia() -> Self
pub const fn mode_sepolia() -> Self
Returns the mode sepolia chain.
sourcepub const fn bsc_mainnet() -> Self
pub const fn bsc_mainnet() -> Self
Returns the bsc mainnet chain.
sourcepub const fn bsc_testnet() -> Self
pub const fn bsc_testnet() -> Self
Returns the bsc testnet chain.
sourcepub const fn opbnb_mainnet() -> Self
pub const fn opbnb_mainnet() -> Self
Returns the opbnb mainnet chain.
sourcepub const fn opbnb_testnet() -> Self
pub const fn opbnb_testnet() -> Self
Returns the opbnb testnet chain.
sourcepub const fn ronin_testnet() -> Self
pub const fn ronin_testnet() -> Self
Returns the ronin testnet chain.
sourcepub const fn taiko_hekla() -> Self
pub const fn taiko_hekla() -> Self
Returns the taiko hekla chain.
sourcepub const fn flare_coston2() -> Self
pub const fn flare_coston2() -> Self
Returns the flare testnet chain.
sourcepub const fn immutable_testnet() -> Self
pub const fn immutable_testnet() -> Self
Returns the Immutable zkEVM testnet chain.
sourcepub const fn ink_sepolia() -> Self
pub const fn ink_sepolia() -> Self
Returns the ink sepolia chain.
sourcepub const fn ink_mainnet() -> Self
pub const fn ink_mainnet() -> Self
Returns the ink mainnet chain.
sourcepub const fn scroll_mainnet() -> Self
pub const fn scroll_mainnet() -> Self
Returns the scroll mainnet chain
sourcepub const fn scroll_sepolia() -> Self
pub const fn scroll_sepolia() -> Self
Returns the scroll sepolia chain
sourcepub const fn treasure_topaz_testnet() -> Self
pub const fn treasure_topaz_testnet() -> Self
Returns the Treasure Topaz testnet chain.
sourcepub const fn is_ethereum(&self) -> bool
pub const fn is_ethereum(&self) -> bool
Returns true
if this chain is Ethereum or an Ethereum testnet.
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 is_arbitrum(self) -> bool
pub const fn is_arbitrum(self) -> bool
Returns true if the chain contains Arbitrum 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 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.
Trait Implementations§
source§impl From<NamedChain> for Chain
impl From<NamedChain> for Chain
source§fn from(id: NamedChain) -> Self
fn from(id: NamedChain) -> Self
source§impl PartialEq for Chain
impl PartialEq for Chain
source§impl PartialOrd<u64> for Chain
impl PartialOrd<u64> for Chain
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl TryFrom<Chain> for NamedChain
impl TryFrom<Chain> for NamedChain
impl Copy for Chain
impl Eq for Chain
impl StructuralPartialEq for Chain
Auto Trait Implementations§
impl Freeze for Chain
impl RefUnwindSafe for Chain
impl Send for Chain
impl Sync for Chain
impl Unpin for Chain
impl UnwindSafe for Chain
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.