Skip to content

Commit

Permalink
feat: add sonic mainnet (#135)
Browse files Browse the repository at this point in the history
Add Sonic mainnet
  • Loading branch information
vulkanfry authored Jan 22, 2025
1 parent dc89b63 commit e17c0bd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 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.

20 changes: 14 additions & 6 deletions src/named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,12 @@ pub enum NamedChain {
#[cfg_attr(feature = "serde", serde(alias = "apechain-testnet", alias = "curtis"))]
Curtis = 33111,

#[strum(to_string = "sonic-testnet")]
#[cfg_attr(feature = "serde", serde(alias = "sonic-testnet"))]
SonicTestnet = 64165,
#[strum(to_string = "sonic")]
#[cfg_attr(feature = "serde", serde(alias = "sonic"))]
Sonic = 146,

#[strum(to_string = "treasure")]
#[cfg_attr(feature = "serde", serde(alias = "treasure"))]
Expand Down Expand Up @@ -709,6 +714,8 @@ impl NamedChain {
Zeta => 6_000,
Kaia => 1_000,

Sonic => 1_000,

UnichainSepolia => 1_000,

BerachainBartio | BerachainArtio => 2_000,
Expand Down Expand Up @@ -845,6 +852,7 @@ impl NamedChain {
| ImmutableTestnet
| Soneium
| SoneiumMinatoTestnet
| Sonic
| World
| WorldSepolia
| UnichainSepolia
Expand Down Expand Up @@ -1018,7 +1026,6 @@ impl NamedChain {
| XaiSepolia
| Koi
| ImmutableTestnet
| Soneium
| SoneiumMinatoTestnet
| WorldSepolia
| UnichainSepolia
Expand All @@ -1039,9 +1046,8 @@ impl NamedChain {
| Fraxtal | Ink | Linea | ZkSync | Mantle | GravityAlphaMainnet | Xai | Zora | Pgn
| Mode | Viction | Elastos | Degen | OpBNBMainnet | Ronin | Taiko | Flare | Acala
| Karura | Darwinia | Cfx | Crab | Pulsechain | Etherlink | Immutable | World
| Iotex | Core | Merlin | Bitlayer | ApeChain | Vana | Zeta | Kaia | Treasure | Bob => {
false
}
| Iotex | Core | Merlin | Bitlayer | ApeChain | Vana | Zeta | Kaia | Treasure | Bob
| Soneium | Sonic => false,
}
}

Expand Down Expand Up @@ -1102,6 +1108,8 @@ impl NamedChain {

BerachainBartio | BerachainArtio => "BERA",

Sonic => "S",

_ => return None,
})
}
Expand Down Expand Up @@ -1458,7 +1466,7 @@ impl NamedChain {
"https://api.routescan.io/v2/network/testnet/evm/64165/etherscan/api",
"https://scan.soniclabs.com",
),

Sonic => ("https://api.sonicscan.org/api", "https://sonicscan.org"),
Treasure => ("https://block-explorer.treasurescan.io/api", "https://treasurescan.io"),
TreasureTopaz => (
"https://block-explorer.topaz.treasurescan.io/api",
Expand Down Expand Up @@ -1559,7 +1567,7 @@ impl NamedChain {
Vana => "VANASCAN_API_KEY",
Zeta => "ZETASCAN_API_KEY",
Kaia => "KAIASCAN_API_KEY",

Sonic => "SONICSCAN_API_KEY",
// Explicitly exhaustive. See NB above.
Metis
| Chiado
Expand Down

0 comments on commit e17c0bd

Please sign in to comment.