From 945ff3181bcaff00f41dac018eb62aeec9d9528d Mon Sep 17 00:00:00 2001 From: hokk812 <186725893+hokk812@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:33:44 +0300 Subject: [PATCH] feat: add sonic testnet (#110) https://docs.soniclabs.com/sonic/testnet/getting-started --------- Co-authored-by: hokk812 --- assets/chains.json | 12 ++++++++++++ src/named.rs | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/assets/chains.json b/assets/chains.json index e042428..1b96b66 100644 --- a/assets/chains.json +++ b/assets/chains.json @@ -1176,6 +1176,18 @@ "etherscanBaseUrl": "https://explorer.celo.org/baklava", "etherscanApiKeyName": "BLOCKSCOUT_API_KEY" }, + "64165": { + "internalId": "SonicTestnet", + "name": "sonic-testnet", + "averageBlocktimeHint": null, + "isLegacy": false, + "supportsShanghai": false, + "isTestnet": true, + "nativeCurrencySymbol": null, + "etherscanApiUrl": "https://api.routescan.io/v2/network/testnet/evm/64165/etherscan/api", + "etherscanBaseUrl": "https://scan.soniclabs.com", + "etherscanApiKeyName": null + }, "80001": { "internalId": "PolygonMumbai", "name": "mumbai", diff --git a/src/named.rs b/src/named.rs index ae66e03..1471c90 100644 --- a/src/named.rs +++ b/src/named.rs @@ -384,6 +384,8 @@ pub enum NamedChain { #[strum(to_string = "curtis", serialize = "apechain-testnet")] #[cfg_attr(feature = "serde", serde(alias = "apechain-testnet", alias = "curtis"))] Curtis = 33111, + + SonicTestnet = 64165, } // This must be implemented manually so we avoid a conflict with `TryFromPrimitive` where it treats @@ -659,7 +661,7 @@ impl NamedChain { Morden | Ropsten | Rinkeby | Goerli | Kovan | Sepolia | Holesky | MantleTestnet | Moonbase | MoonbeamDev | OptimismKovan | Poa | Sokol | Rsk | EmeraldTestnet | Boba | ZkSync | ZkSyncTestnet | PolygonZkEvm | PolygonZkEvmTestnet | Metis - | Linea | LineaGoerli | LineaSepolia | KakarotSepolia => return None, + | Linea | LineaGoerli | LineaSepolia | KakarotSepolia | SonicTestnet => return None, })) } @@ -789,7 +791,7 @@ impl NamedChain { Dev | AnvilHardhat | Morden | Ropsten | Rinkeby | Cronos | CronosTestnet | Kovan | Sokol | Poa | Moonbeam | MoonbeamDev | Moonriver | Moonbase | Evmos | EvmosTestnet | Aurora | AuroraTestnet | Canto | CantoTestnet | Iotex | Core - | Merlin | Bitlayer => false, + | Merlin | Bitlayer | SonicTestnet => false, } } @@ -944,7 +946,8 @@ impl NamedChain { | SoneiumMinatoTestnet | WorldSepolia | UnichainSepolia - | Curtis => true, + | Curtis + | SonicTestnet => true, // Dev chains. Dev | AnvilHardhat => true, @@ -1346,6 +1349,10 @@ impl NamedChain { ApeChain => ("https://api.apescan.io/api", "https://apescan.io"), Curtis => ("https://curtis.explorer.caldera.xyz/api/v2", "https://curtis.apescan.io"), + SonicTestnet => ( + "https://api.routescan.io/v2/network/testnet/evm/64165/etherscan/api", + "https://scan.soniclabs.com", + ), }) } @@ -1468,7 +1475,8 @@ impl NamedChain { | Pulsechain | PulsechainTestnet | AutonomysNovaTestnet - | Iotex => return None, + | Iotex + | SonicTestnet => return None, }; Some(api_key_name)