From 2360467ba96dab0e3656e701b1cff4b9418ccc40 Mon Sep 17 00:00:00 2001 From: DoTheBestToGetTheBest <146037313+DoTheBestToGetTheBest@users.noreply.github.com> Date: Mon, 27 Nov 2023 10:36:30 -0800 Subject: [PATCH] Update named.rs --- src/named.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/named.rs b/src/named.rs index d5e2043..a5fed20 100644 --- a/src/named.rs +++ b/src/named.rs @@ -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)]