Skip to content

Commit

Permalink
feat: add sonic testnet (#110)
Browse files Browse the repository at this point in the history
https://docs.soniclabs.com/sonic/testnet/getting-started

---------

Co-authored-by: hokk812 <hokk812@users.noreply.github.com>
  • Loading branch information
hokk812 and hokk812 authored Nov 5, 2024
1 parent 8935865 commit 945ff31
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
12 changes: 12 additions & 0 deletions assets/chains.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions src/named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
}))
}

Expand Down Expand Up @@ -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,
}
}

Expand Down Expand Up @@ -944,7 +946,8 @@ impl NamedChain {
| SoneiumMinatoTestnet
| WorldSepolia
| UnichainSepolia
| Curtis => true,
| Curtis
| SonicTestnet => true,

// Dev chains.
Dev | AnvilHardhat => true,
Expand Down Expand Up @@ -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",
),
})
}

Expand Down Expand Up @@ -1468,7 +1475,8 @@ impl NamedChain {
| Pulsechain
| PulsechainTestnet
| AutonomysNovaTestnet
| Iotex => return None,
| Iotex
| SonicTestnet => return None,
};

Some(api_key_name)
Expand Down

0 comments on commit 945ff31

Please sign in to comment.