Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add acala karura mandala network #76

Merged
merged 4 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions assets/chains.json

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

115 changes: 88 additions & 27 deletions src/named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,23 @@ pub enum NamedChain {
Flare = 14,
#[cfg_attr(feature = "serde", serde(alias = "flare-coston2"))]
FlareCoston2 = 114,

#[strum(to_string = "acala")]
#[cfg_attr(feature = "serde", serde(alias = "acala"))]
Acala = 787,
#[strum(to_string = "acala-mandala-testnet")]
#[cfg_attr(feature = "serde", serde(alias = "acala-mandala-testnet"))]
AcalaMandalaTestnet = 595,
#[strum(to_string = "acala-testnet")]
#[cfg_attr(feature = "serde", serde(alias = "acala-testnet"))]
AcalaTestnet = 597,

#[strum(to_string = "karura")]
#[cfg_attr(feature = "serde", serde(alias = "karura"))]
Karura = 686,
#[strum(to_string = "karura-testnet")]
#[cfg_attr(feature = "serde", serde(alias = "karura-testnet"))]
KaruraTestnet = 596,
}

// This must be implemented manually so we avoid a conflict with `TryFromPrimitive` where it treats
Expand Down Expand Up @@ -438,7 +455,13 @@ impl NamedChain {

C::Polygon | C::PolygonMumbai | C::PolygonAmoy => 2_100,

C::Moonbeam | C::Moonriver => 12_500,
C::Acala
| C::AcalaMandalaTestnet
| C::AcalaTestnet
| C::Karura
| C::KaruraTestnet
| C::Moonbeam
| C::Moonriver => 12_500,

C::BinanceSmartChain | C::BinanceSmartChainTestnet => 3_000,

Expand Down Expand Up @@ -524,30 +547,35 @@ impl NamedChain {

match self {
// Known legacy chains / non EIP-1559 compliant.
C::OptimismKovan
| C::Fantom
| C::FantomTestnet
C::Acala
| C::AcalaMandalaTestnet
| C::AcalaTestnet
| C::ArbitrumTestnet
| C::BinanceSmartChain
| C::BinanceSmartChainTestnet
| C::ArbitrumTestnet
| C::Rsk
| C::Oasis
| C::Emerald
| C::EmeraldTestnet
| C::Boba
| C::Celo
| C::CeloAlfajores
| C::CeloBaklava
| C::Boba
| C::ZkSync
| C::ZkSyncTestnet
| C::Elastos
| C::Emerald
| C::EmeraldTestnet
| C::Fantom
| C::FantomTestnet
| C::Karura
| C::KaruraTestnet
| C::MantleTestnet
| C::Metis
| C::Oasis
| C::OptimismKovan
| C::PolygonZkEvm
| C::PolygonZkEvmTestnet
| C::Ronin
| C::Rsk
| C::Shimmer
| C::MantleTestnet
| C::Metis
| C::Viction
| C::Elastos
| C::Ronin => true,
| C::ZkSync
| C::ZkSyncTestnet => true,

// Known EIP-1559 chains.
C::Mainnet
Expand Down Expand Up @@ -673,7 +701,12 @@ impl NamedChain {
| C::TaikoHekla
| C::Avalanche
| C::AvalancheFuji
| C::AutonomysNovaTestnet => true,
| C::AutonomysNovaTestnet
| C::Acala
| C::AcalaMandalaTestnet
| C::AcalaTestnet
| C::Karura
| C::KaruraTestnet => true,
_ => false,
}
}
Expand Down Expand Up @@ -740,7 +773,10 @@ impl NamedChain {
| C::OpBNBTestnet
| C::TaikoHekla
| C::AutonomysNovaTestnet
| C::FlareCoston2 => true,
| C::FlareCoston2
| C::AcalaMandalaTestnet
| C::AcalaTestnet
| C::KaruraTestnet => true,

// Dev chains.
C::Dev | C::AnvilHardhat => true,
Expand Down Expand Up @@ -790,7 +826,9 @@ impl NamedChain {
| C::OpBNBMainnet
| C::Ronin
| C::Taiko
| C::Flare => false,
| C::Flare
| C::Acala
| C::Karura => false,
}
}

Expand Down Expand Up @@ -1107,6 +1145,24 @@ impl NamedChain {
"https://coston2-explorer.flare.network/api",
"https://coston2-explorer.flare.network",
),
C::Acala => {
("https://blockscout.acala.network/api", "https://blockscout.acala.network")
}
C::AcalaMandalaTestnet => (
"https://blockscout.mandala.aca-staging.network/api",
"https://blockscout.mandala.aca-staging.network",
),
C::AcalaTestnet => (
"https://blockscout.acala-testnet.aca-staging.network/api",
"https://blockscout.acala-testnet.aca-staging.network",
),
C::Karura => {
("https://blockscout.karura.network/api", "https://blockscout.karura.network")
}
C::KaruraTestnet => (
"https://blockscout.karura-testnet.aca-staging.network/api",
"https://blockscout.karura-testnet.aca-staging.network",
),
})
}

Expand Down Expand Up @@ -1182,20 +1238,25 @@ impl NamedChain {

C::Moonbeam | C::Moonbase | C::MoonbeamDev | C::Moonriver => "MOONSCAN_API_KEY",

C::Canto
C::Acala
| C::AcalaMandalaTestnet
| C::AcalaTestnet
| C::Canto
| C::CantoTestnet
| C::Zora
| C::ZoraGoerli
| C::ZoraSepolia
| C::EtherlinkTestnet
| C::Flare
| C::FlareCoston2
| C::KakarotSepolia
| C::Karura
| C::KaruraTestnet
| C::Mode
| C::ModeSepolia
| C::Pgn
| C::PgnSepolia
| C::KakarotSepolia
| C::EtherlinkTestnet
| C::Shimmer
| C::Flare
| C::FlareCoston2 => "BLOCKSCOUT_API_KEY",
| C::Zora
| C::ZoraGoerli
| C::ZoraSepolia => "BLOCKSCOUT_API_KEY",

C::Boba => "BOBASCAN_API_KEY",

Expand Down
Loading