diff --git a/assets/chains.json b/assets/chains.json index 37d7947..d67bda9 100644 --- a/assets/chains.json +++ b/assets/chains.json @@ -72,6 +72,18 @@ "etherscanBaseUrl": "https://optimistic.etherscan.io", "etherscanApiKeyName": "ETHERSCAN_API_KEY" }, + "14": { + "internalId": "Flare", + "name": "flare", + "averageBlocktimeHint": 1800, + "isLegacy": false, + "supportsShanghai": false, + "isTestnet": false, + "nativeCurrencySymbol": "FLR", + "etherscanApiUrl": "https://flare-explorer.flare.network/api", + "etherscanBaseUrl": "https://flare-explorer.flare.network", + "etherscanApiKeyName": "BLOCKSCOUT_API_KEY" + }, "20": { "internalId": "Elastos", "name": "elastos", @@ -204,6 +216,18 @@ "etherscanBaseUrl": "https://gnosisscan.io", "etherscanApiKeyName": "ETHERSCAN_API_KEY" }, + "114": { + "internalId": "FlareCoston2", + "name": "flare-coston2", + "averageBlocktimeHint": 2500, + "isLegacy": false, + "supportsShanghai": false, + "isTestnet": true, + "nativeCurrencySymbol": "C2FLR", + "etherscanApiUrl": "https://coston2-explorer.flare.network/api", + "etherscanBaseUrl": "https://coston2-explorer.flare.network", + "etherscanApiKeyName": "BLOCKSCOUT_API_KEY" + }, "137": { "internalId": "Polygon", "name": "polygon", @@ -216,6 +240,18 @@ "etherscanBaseUrl": "https://polygonscan.com", "etherscanApiKeyName": "POLYGONSCAN_API_KEY" }, + "148": { + "internalId": "Shimmer", + "name": "shimmer", + "averageBlocktimeHint": 5000, + "isLegacy": true, + "supportsShanghai": true, + "isTestnet": true, + "nativeCurrencySymbol": "SMR", + "etherscanApiUrl": "https://explorer.evm.shimmer.network/api", + "etherscanBaseUrl": "https://explorer.evm.shimmer.network", + "etherscanApiKeyName": "BLOCKSCOUT_API_KEY" + }, "204": { "internalId": "OpBNBMainnet", "name": "opbnb-mainnet", diff --git a/src/chain.rs b/src/chain.rs index ac4ed76..f0da789 100644 --- a/src/chain.rs +++ b/src/chain.rs @@ -414,6 +414,23 @@ impl Chain { Self::from_named(NamedChain::TaikoHekla) } + /// Returns the shimmer testnet chain. + #[inline] + pub const fn shimmer() -> Self { + Self::from_named(NamedChain::Shimmer) + } + + /// Returns the flare mainnet chain. + #[inline] + pub const fn flare() -> Self { + Self::from_named(NamedChain::Flare) + } + + /// Returns the flare testnet chain. + #[inline] + pub const fn flare_coston2() -> Self { + Self::from_named(NamedChain::FlareCoston2) + } /// Returns the kind of this chain. #[inline] pub const fn kind(&self) -> &ChainKind { diff --git a/src/named.rs b/src/named.rs index 250bd29..546a02d 100644 --- a/src/named.rs +++ b/src/named.rs @@ -181,6 +181,8 @@ pub enum NamedChain { #[cfg_attr(feature = "serde", serde(alias = "syndr-sepolia"))] SyndrSepolia = 444444, + Shimmer = 148, + #[strum(to_string = "fraxtal")] #[cfg_attr(feature = "serde", serde(alias = "fraxtal"))] Fraxtal = 252, @@ -261,6 +263,10 @@ pub enum NamedChain { serde(rename = "autonomys_nova_testnet", alias = "autonomys-nova-testnet") )] AutonomysNovaTestnet = 490000, + + Flare = 14, + #[cfg_attr(feature = "serde", serde(alias = "flare-coston2"))] + FlareCoston2 = 114, } // This must be implemented manually so we avoid a conflict with `TryFromPrimitive` where it treats @@ -453,6 +459,8 @@ impl NamedChain { C::Scroll | C::ScrollSepolia => 3_000, + C::Shimmer => 5_000, + C::Gnosis | C::Chiado => 5_000, C::Elastos => 5_000, @@ -490,6 +498,10 @@ impl NamedChain { C::OpBNBMainnet | C::OpBNBTestnet | C::AutonomysNovaTestnet => 1_000, C::Ronin => 3_000, + + C::Flare => 1_800, + + C::FlareCoston2 => 2_500, })) } @@ -530,6 +542,7 @@ impl NamedChain { | C::PolygonZkEvmTestnet | C::Scroll | C::ScrollSepolia + | C::Shimmer | C::Metis | C::Viction | C::Elastos @@ -581,7 +594,9 @@ impl NamedChain { | C::OpBNBTestnet | C::Taiko | C::TaikoHekla - | C::AutonomysNovaTestnet => false, + | C::AutonomysNovaTestnet + | C::Flare + | C::FlareCoston2 => false, // Unknown / not applicable, default to false for backwards compatibility. C::Dev @@ -643,6 +658,7 @@ impl NamedChain { | C::EtherlinkTestnet | C::Scroll | C::ScrollSepolia + | C::Shimmer | C::OpBNBMainnet | C::OpBNBTestnet | C::KakarotSepolia @@ -703,6 +719,7 @@ impl NamedChain { | C::PolygonAmoy | C::PolygonZkEvmTestnet | C::ScrollSepolia + | C::Shimmer | C::ZkSyncTestnet | C::ZoraGoerli | C::ZoraSepolia @@ -712,7 +729,8 @@ impl NamedChain { | C::EtherlinkTestnet | C::OpBNBTestnet | C::TaikoHekla - | C::AutonomysNovaTestnet => true, + | C::AutonomysNovaTestnet + | C::FlareCoston2 => true, // Dev chains. C::Dev | C::AnvilHardhat => true, @@ -761,7 +779,8 @@ impl NamedChain { | C::Degen | C::OpBNBMainnet | C::Ronin - | C::Taiko => false, + | C::Taiko + | C::Flare => false, } } @@ -794,6 +813,12 @@ impl NamedChain { C::Ronin => "RON", + C::Shimmer => "SMR", + + C::Flare => "FLR", + + C::FlareCoston2 => "C2FLR", + _ => return None, }) } @@ -918,6 +943,10 @@ impl NamedChain { ("https://api-sepolia.scrollscan.com/api", "https://sepolia.scrollscan.com") } + C::Shimmer => { + ("https://explorer.evm.shimmer.network/api", "https://explorer.evm.shimmer.network") + } + C::Metis => { ("https://andromeda-explorer.metis.io/api", "https://andromeda-explorer.metis.io") } @@ -1056,6 +1085,13 @@ impl NamedChain { C::Ronin => ("https://skynet-api.roninchain.com/ronin", "https://app.roninchain.com"), C::Taiko => ("https://api.taikoscan.io/api", "https://taikoscan.io"), C::TaikoHekla => ("https://api-testnet.taikoscan.io/api", "https://hekla.taikoscan.io"), + C::Flare => { + ("https://flare-explorer.flare.network/api", "https://flare-explorer.flare.network") + } + C::FlareCoston2 => ( + "https://coston2-explorer.flare.network/api", + "https://coston2-explorer.flare.network", + ), }) } @@ -1140,7 +1176,10 @@ impl NamedChain { | C::Pgn | C::PgnSepolia | C::KakarotSepolia - | C::EtherlinkTestnet => "BLOCKSCOUT_API_KEY", + | C::EtherlinkTestnet + | C::Shimmer + | C::Flare + | C::FlareCoston2 => "BLOCKSCOUT_API_KEY", C::Boba => "BOBASCAN_API_KEY",