diff --git a/CHANGELOG.md b/CHANGELOG.md index 853c8d1ee..c46161269 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Unreleased +- Add support for Emerald Mainnet and Testnet chains (the Oasis Paratimes) - Removed Cronos mainnet beta from `is_legacy` [1246](https://github.com/gakonst/ethers-rs/pull/1246) - Fix RLP decoding of `from` field for `Eip1559TransactionRequest` and `Eip2930TransactionRequest`, remove `Eip1559TransactionRequest` `sighash` diff --git a/ethers-core/src/types/chain.rs b/ethers-core/src/types/chain.rs index 2eb5bafc9..f577be4a0 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 053c160cd..a34693acd 100644 --- a/ethers-etherscan/src/lib.rs +++ b/ethers-etherscan/src/lib.rs @@ -101,6 +101,7 @@ impl Client { Chain::Moonbeam | Chain::MoonbeamDev | Chain::Moonriver => { std::env::var("MOONSCAN_API_KEY")? } + Chain::Emerald | Chain::EmeraldTestnet => String::default(), Chain::Dev => return Err(EtherscanError::LocalNetworksNotSupported), }; Self::new(chain, api_key) @@ -264,6 +265,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)), };