feat: add evmos support (#1398)

This commit is contained in:
Matthias Seitz 2022-06-22 19:09:05 +02:00 committed by GitHub
parent c2f5a87b63
commit 1ce2310874
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -53,6 +53,8 @@ pub enum Chain {
Oasis = 26863, Oasis = 26863,
Emerald = 42262, Emerald = 42262,
EmeraldTestnet = 42261, EmeraldTestnet = 42261,
Evmos = 9001,
EvmosTestnet = 9000,
} }
impl fmt::Display for Chain { impl fmt::Display for Chain {
@ -91,6 +93,8 @@ impl fmt::Display for Chain {
Chain::Emerald => "emerald", Chain::Emerald => "emerald",
Chain::EmeraldTestnet => "emerald-testnet", Chain::EmeraldTestnet => "emerald-testnet",
Chain::AnvilHardhat => "anvil-hardhat", Chain::AnvilHardhat => "anvil-hardhat",
Chain::Evmos => "evmos",
Chain::EvmosTestnet => "evmos-testnet",
}; };
write!(formatter, "{}", chain) write!(formatter, "{}", chain)

View File

@ -101,7 +101,9 @@ impl Client {
Chain::Poa | Chain::Poa |
Chain::Oasis | Chain::Oasis |
Chain::Emerald | Chain::Emerald |
Chain::EmeraldTestnet => String::default(), Chain::EmeraldTestnet |
Chain::Evmos |
Chain::EvmosTestnet => String::default(),
Chain::Moonbeam | Chain::Moonbase | Chain::MoonbeamDev | Chain::Moonriver => { Chain::Moonbeam | Chain::Moonbase | Chain::MoonbeamDev | Chain::Moonriver => {
std::env::var("MOONSCAN_API_KEY")? std::env::var("MOONSCAN_API_KEY")?
} }
@ -302,6 +304,8 @@ impl ClientBuilder {
Chain::AnvilHardhat | Chain::Dev => { Chain::AnvilHardhat | Chain::Dev => {
return Err(EtherscanError::LocalNetworksNotSupported) return Err(EtherscanError::LocalNetworksNotSupported)
} }
Chain::Evmos => urls("https://evm.evmos.org/api", "https://evm.evmos.org/"),
Chain::EvmosTestnet => urls("https://evm.evmos.dev/api", "https://evm.evmos.dev/"),
chain => return Err(EtherscanError::ChainNotSupported(chain)), chain => return Err(EtherscanError::ChainNotSupported(chain)),
}; };
self.with_api_url(etherscan_api_url?)?.with_url(etherscan_url?) self.with_api_url(etherscan_api_url?)?.with_url(etherscan_url?)