From 901d0c6e00a355a57e2ad70a7ea2548765661866 Mon Sep 17 00:00:00 2001 From: Alexandre Bazeaud <63203499+AlexandreBazeaud@users.noreply.github.com> Date: Mon, 21 Feb 2022 18:01:19 +0100 Subject: [PATCH] Add missing chains into parse method (#941) * Add missing chains into parse method * Update changelog --- CHANGELOG.md | 1 + ethers-core/src/types/chain.rs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index feac9d45..31e0e9cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Unreleased +- Add FTM Mainet and testnet to parse method "try_from" from Chain.rs and add cronos mainet and testnet to "from_str" - Add FTM mainnet and testnet Multicall addresses [927](https://github.com/gakonst/ethers-rs/pull/927) - Add Cronos mainnet beta and testnet to the list of known chains [926](https://github.com/gakonst/ethers-rs/pull/926) diff --git a/ethers-core/src/types/chain.rs b/ethers-core/src/types/chain.rs index a31f8e42..66facef5 100644 --- a/ethers-core/src/types/chain.rs +++ b/ethers-core/src/types/chain.rs @@ -103,6 +103,8 @@ impl TryFrom for Chain { 42 => Chain::Kovan, 100 => Chain::XDai, 137 => Chain::Polygon, + 250 => Chain::Fantom, + 4002 => Chain::FantomTestnet, 80001 => Chain::PolygonMumbai, 43114 => Chain::Avalanche, 43113 => Chain::AvalancheFuji, @@ -116,6 +118,8 @@ impl TryFrom for Chain { 97 => Chain::BinanceSmartChainTestnet, 42161 => Chain::Arbitrum, 421611 => Chain::ArbitrumTestnet, + 25 => Chain::Cronos, + 338 => Chain::CronosTestnet, _ => return Err(ParseChainError(chain.to_string())), }) } @@ -147,6 +151,8 @@ impl FromStr for Chain { "bsc-testnet" => Chain::BinanceSmartChainTestnet, "arbitrum" => Chain::Arbitrum, "arbitrum-testnet" => Chain::ArbitrumTestnet, + "cronos" => Chain::Cronos, + "cronos-testnet" => Chain::CronosTestnet, _ => return Err(ParseChainError(chain.to_owned())), }) }