diff --git a/ethers-core/src/types/chain.rs b/ethers-core/src/types/chain.rs index 5397e78fb7..78bcc64d20 100644 --- a/ethers-core/src/types/chain.rs +++ b/ethers-core/src/types/chain.rs @@ -39,6 +39,8 @@ pub enum Chain { ArbitrumTestnet = 421611, Cronos = 25, CronosTestnet = 338, + Emerald = 42262, + EmeraldTestnet = 42261, } impl fmt::Display for Chain { @@ -69,6 +71,8 @@ impl fmt::Display for Chain { Chain::ArbitrumTestnet => "arbitrum-testnet", Chain::Cronos => "cronos", Chain::CronosTestnet => "cronos-testnet", + Chain::Emerald => "emerald", + Chain::EmeraldTestnet => "emerald-testnet", }; write!(formatter, "{}", chain) @@ -123,6 +127,8 @@ impl TryFrom for Chain { 421611 => Chain::ArbitrumTestnet, 25 => Chain::Cronos, 338 => Chain::CronosTestnet, + 42262 => Chain::Emerald, + 42261 => Chain::EmeraldTestnet, _ => return Err(ParseChainError(chain.to_string())), }) } diff --git a/ethers-etherscan/src/lib.rs b/ethers-etherscan/src/lib.rs index 1515a8b27c..a590eab948 100644 --- a/ethers-etherscan/src/lib.rs +++ b/ethers-etherscan/src/lib.rs @@ -100,6 +100,7 @@ impl Client { Chain::Moonbeam | Chain::MoonbeamDev | Chain::Moonriver => { std::env::var("MOONSCAN_API_KEY")? } + Chain::Emerald | Chain::EmeraldTestnet => std::env::var("OASIS_API_KEY")?, Chain::Dev => return Err(EtherscanError::LocalNetworksNotSupported), }; Self::new(chain, api_key) @@ -263,6 +264,13 @@ impl ClientBuilder { Chain::Moonriver => { urls("https://api-moonriver.moonscan.io/api", "https://moonriver.moonscan.io") } + Chain::Emerald => { + urls("https://explorer.emerald.oasis.dev/api", "https://explorer.emerald.oasis.dev") + } + Chain::EmeraldTestnet => urls( + "https://testnet.explorer.emerald.oasis.dev/api", + "https://testnet.explorer.emerald.oasis.dev", + ), Chain::Dev => return Err(EtherscanError::LocalNetworksNotSupported), chain => return Err(EtherscanError::ChainNotSupported(chain)), };