Skip to content

Commit

Permalink
feat: add is_ethereum
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Sep 19, 2024
1 parent c2c641f commit 2a38118
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,24 @@ impl Chain {
self.0
}

/// Returns `true` if this chain is Ethereum or an Ethereum testnet.
#[inline]
pub const fn is_ethereum(&self) -> bool {
matches!(
self.kind(),
ChainKind::Named(
NamedChain::Mainnet
| NamedChain::Morden
| NamedChain::Ropsten
| NamedChain::Rinkeby
| NamedChain::Goerli
| NamedChain::Kovan
| NamedChain::Holesky
| NamedChain::Sepolia
)
)
}

/// Returns true if the chain contains Optimism configuration.
#[inline]
pub const fn is_optimism(self) -> bool {
Expand Down

0 comments on commit 2a38118

Please sign in to comment.