Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
feat: add anvil hardhat chain id
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Jun 7, 2022
1 parent f561460 commit 2f4a086
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ethers-core/src/types/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub enum Chain {
Polygon = 137,
Fantom = 250,
Dev = 1337,
AnvilHardhat = 31337,
FantomTestnet = 4002,
PolygonMumbai = 80001,
Avalanche = 43114,
Expand Down Expand Up @@ -86,6 +87,7 @@ impl fmt::Display for Chain {
Chain::Oasis => "oasis",
Chain::Emerald => "emerald",
Chain::EmeraldTestnet => "emerald-testnet",
Chain::AnvilHardhat => "dev",
};

write!(formatter, "{}", chain)
Expand Down Expand Up @@ -123,6 +125,7 @@ impl TryFrom<u64> for Chain {
100 => Chain::XDai,
137 => Chain::Polygon,
1337 => Chain::Dev,
31337 => Chain::Dev,
250 => Chain::Fantom,
4002 => Chain::FantomTestnet,
80001 => Chain::PolygonMumbai,
Expand Down Expand Up @@ -185,6 +188,7 @@ impl FromStr for Chain {
"fantom" => Chain::Fantom,
"fantom-testnet" => Chain::FantomTestnet,
"dev" => Chain::Dev,
"anvil" | "hardhat" => Chain::AnvilHardhat,
"bsc" => Chain::BinanceSmartChain,
"bsc-testnet" => Chain::BinanceSmartChainTestnet,
"arbitrum" => Chain::Arbitrum,
Expand Down Expand Up @@ -225,7 +229,7 @@ impl Chain {
}
}

impl default::Default for Chain {
impl Default for Chain {
fn default() -> Self {
Chain::Mainnet
}
Expand Down

0 comments on commit 2f4a086

Please sign in to comment.