Add support to Aurora network (#1535)

* Add support to Aurora network

Documentation about aurora chain:
https://doc.aurora.dev/getting-started/network-endpoints

* Update changelog

* Format code using rustfmt.toml
This commit is contained in:
Marcelo Fornet 2022-07-30 21:42:04 +02:00 committed by GitHub
parent e855676afc
commit c7563a5f64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View File

@ -81,6 +81,7 @@
- Add `From<H160>` and From<Vec<H160>> traits to `ValueOrArray<H160>` [#1199](https://github.com/gakonst/ethers-rs/pull/1200) - Add `From<H160>` and From<Vec<H160>> traits to `ValueOrArray<H160>` [#1199](https://github.com/gakonst/ethers-rs/pull/1200)
- Fix handling of Websocket connection errors [#1287](https://github.com/gakonst/ethers-rs/pull/1287) - Fix handling of Websocket connection errors [#1287](https://github.com/gakonst/ethers-rs/pull/1287)
- Add Arithmetic Shift Right operation for I256 [#1323](https://github.com/gakonst/ethers-rs/issues/1323) - Add Arithmetic Shift Right operation for I256 [#1323](https://github.com/gakonst/ethers-rs/issues/1323)
- [#1535](https://github.com/gakonst/ethers-rs/pull/1535) Add support to Aurora and Aurora testnet networks.
## ethers-contract-abigen ## ethers-contract-abigen

View File

@ -56,6 +56,8 @@ pub enum Chain {
EmeraldTestnet = 42261, EmeraldTestnet = 42261,
Evmos = 9001, Evmos = 9001,
EvmosTestnet = 9000, EvmosTestnet = 9000,
Aurora = 1313161554,
AuroraTestnet = 1313161555,
} }
impl fmt::Display for Chain { impl fmt::Display for Chain {
@ -97,6 +99,8 @@ impl fmt::Display for Chain {
Chain::AnvilHardhat => "anvil-hardhat", Chain::AnvilHardhat => "anvil-hardhat",
Chain::Evmos => "evmos", Chain::Evmos => "evmos",
Chain::EvmosTestnet => "evmos-testnet", Chain::EvmosTestnet => "evmos-testnet",
Chain::Aurora => "aurora",
Chain::AuroraTestnet => "aurora-testnet",
}; };
write!(formatter, "{}", chain) write!(formatter, "{}", chain)
@ -162,6 +166,8 @@ impl TryFrom<u64> for Chain {
42261 => Chain::EmeraldTestnet, 42261 => Chain::EmeraldTestnet,
9001 => Chain::Evmos, 9001 => Chain::Evmos,
9000 => Chain::EvmosTestnet, 9000 => Chain::EvmosTestnet,
1313161554 => Chain::Aurora,
1313161555 => Chain::AuroraTestnet,
_ => return Err(ParseChainError(chain.to_string())), _ => return Err(ParseChainError(chain.to_string())),
}) })
} }
@ -215,6 +221,8 @@ impl FromStr for Chain {
"oasis" => Chain::Oasis, "oasis" => Chain::Oasis,
"emerald" => Chain::Emerald, "emerald" => Chain::Emerald,
"emerald-testnet" => Chain::EmeraldTestnet, "emerald-testnet" => Chain::EmeraldTestnet,
"aurora" => Chain::Aurora,
"aurora-testnet" => Chain::AuroraTestnet,
_ => return Err(ParseChainError(chain.to_owned())), _ => return Err(ParseChainError(chain.to_owned())),
}) })
} }

View File

@ -91,7 +91,9 @@ impl Client {
Chain::Arbitrum | Chain::Arbitrum |
Chain::ArbitrumTestnet | Chain::ArbitrumTestnet |
Chain::Cronos | Chain::Cronos |
Chain::CronosTestnet => std::env::var("ETHERSCAN_API_KEY")?, Chain::CronosTestnet |
Chain::Aurora |
Chain::AuroraTestnet => std::env::var("ETHERSCAN_API_KEY")?,
Chain::Fantom | Chain::FantomTestnet => { Chain::Fantom | Chain::FantomTestnet => {
std::env::var("FTMSCAN_API_KEY").or_else(|_| std::env::var("FANTOMSCAN_API_KEY"))? std::env::var("FTMSCAN_API_KEY").or_else(|_| std::env::var("FANTOMSCAN_API_KEY"))?
} }