Skip to content

Commit

Permalink
Update named.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
DoTheBestToGetTheBest authored Nov 27, 2023
1 parent e57782e commit 2360467
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,22 @@ impl NamedChain {
None
}
}
/// Returns true if the chain is a testnet.
pub fn is_testnet(&self) -> bool {
match self {
NamedChain::Goerli | NamedChain::Sepolia | NamedChain::Dev => true,
_ => false,
}
}
/// Return symbol of native currency used in the blockchain
pub fn native_currency_symbol(&self) -> &str {
match self {
NamedChain::Mainnet | NamedChain::Goerli | NamedChain::Rinkeby => "ETH",
NamedChain::BinanceSmartChain => "BNB",
// will add for others
_ => "Unknown",
}
}
}

#[cfg(test)]
Expand Down

0 comments on commit 2360467

Please sign in to comment.