Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
feat: add kakarot sepolia
Browse files Browse the repository at this point in the history
  • Loading branch information
bajpai244 committed Feb 14, 2024
1 parent 6136dde commit 4b5315b
Showing 1 changed file with 127 additions and 122 deletions.
249 changes: 127 additions & 122 deletions ethers-core/src/types/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ pub enum Chain {

Mode = 34443,
ModeSepolia = 919,

KakarotSepolia = 107107114116,
}

// === impl Chain ===
Expand Down Expand Up @@ -334,11 +336,11 @@ impl Chain {
Viction => 2_000,
Mode | ModeSepolia => 2_000,
// Explicitly exhaustive. See NB above.
Morden | Ropsten | Rinkeby | Goerli | Kovan | Sepolia | Holesky | Moonbase |
MoonbeamDev | OptimismKovan | Poa | Sokol | Rsk | EmeraldTestnet | Boba | Base |
BaseGoerli | BaseSepolia | BlastSepolia | ZkSync | ZkSyncTestnet | PolygonZkEvm |
PolygonZkEvmTestnet | Metis | Linea | LineaTestnet | Mantle | MantleTestnet |
Zora | ZoraGoerli | ZoraSepolia => return None,
Morden | Ropsten | Rinkeby | Goerli | Kovan | Sepolia | Holesky | Moonbase
| MoonbeamDev | OptimismKovan | Poa | Sokol | Rsk | EmeraldTestnet | Boba | Base
| BaseGoerli | BaseSepolia | BlastSepolia | ZkSync | ZkSyncTestnet | PolygonZkEvm
| PolygonZkEvmTestnet | Metis | Linea | LineaTestnet | Mantle | MantleTestnet
| Zora | ZoraGoerli | ZoraSepolia | KakarotSepolia => return None,
};

Some(Duration::from_millis(ms))
Expand All @@ -359,68 +361,69 @@ impl Chain {

match self {
// Known legacy chains / non EIP-1559 compliant
OptimismKovan |
Fantom |
FantomTestnet |
BinanceSmartChain |
BinanceSmartChainTestnet |
ArbitrumTestnet |
Rsk |
Oasis |
Emerald |
EmeraldTestnet |
Celo |
CeloAlfajores |
CeloBaklava |
Boba |
ZkSync |
ZkSyncTestnet |
Mantle |
MantleTestnet |
PolygonZkEvm |
PolygonZkEvmTestnet |
Metis |
Viction |
Scroll |
ScrollSepolia => true,
OptimismKovan
| Fantom
| FantomTestnet
| BinanceSmartChain
| BinanceSmartChainTestnet
| ArbitrumTestnet
| Rsk
| Oasis
| Emerald
| EmeraldTestnet
| Celo
| CeloAlfajores
| CeloBaklava
| Boba
| ZkSync
| ZkSyncTestnet
| Mantle
| MantleTestnet
| PolygonZkEvm
| PolygonZkEvmTestnet
| Metis
| Viction
| Scroll
| ScrollSepolia => true,

// Known EIP-1559 chains
Mainnet |
Goerli |
Sepolia |
Holesky |
Base |
BaseGoerli |
BaseSepolia |
BlastSepolia |
Optimism |
OptimismGoerli |
OptimismSepolia |
Polygon |
PolygonMumbai |
PolygonAmoy |
Avalanche |
AvalancheFuji |
Arbitrum |
ArbitrumGoerli |
ArbitrumSepolia |
ArbitrumNova |
FilecoinMainnet |
Linea |
LineaTestnet |
FilecoinCalibrationTestnet |
Gnosis |
Chiado |
Mode |
ModeSepolia |
Zora |
ZoraGoerli |
ZoraSepolia => false,
Mainnet
| Goerli
| Sepolia
| Holesky
| Base
| BaseGoerli
| BaseSepolia
| BlastSepolia
| Optimism
| OptimismGoerli
| OptimismSepolia
| Polygon
| PolygonMumbai
| PolygonAmoy
| Avalanche
| AvalancheFuji
| Arbitrum
| ArbitrumGoerli
| ArbitrumSepolia
| ArbitrumNova
| FilecoinMainnet
| Linea
| LineaTestnet
| FilecoinCalibrationTestnet
| Gnosis
| Chiado
| Mode
| ModeSepolia
| Zora
| ZoraGoerli
| ZoraSepolia
| KakarotSepolia => false,

// Unknown / not applicable, default to false for backwards compatibility
Dev | AnvilHardhat | Morden | Ropsten | Rinkeby | Cronos | CronosTestnet | Kovan |
Sokol | Poa | Moonbeam | MoonbeamDev | Moonriver | Moonbase | Evmos |
EvmosTestnet | Aurora | AuroraTestnet | Canto | CantoTestnet | ScrollAlphaTestnet => {
Dev | AnvilHardhat | Morden | Ropsten | Rinkeby | Cronos | CronosTestnet | Kovan
| Sokol | Poa | Moonbeam | MoonbeamDev | Moonriver | Moonbase | Evmos
| EvmosTestnet | Aurora | AuroraTestnet | Canto | CantoTestnet | ScrollAlphaTestnet => {
false
}
}
Expand Down Expand Up @@ -627,11 +630,14 @@ impl Chain {
ZoraSepolia => {
("https://sepolia.explorer.zora.energy/api", "https://sepolia.explorer.zora.energy")
}
KakarotSepolia => {
("https://sepolia.kakarotscan.org/api", "https://sepolia.kakarotscan.org")
}

AnvilHardhat | Dev | Morden | MoonbeamDev | FilecoinMainnet => {
// this is explicitly exhaustive so we don't forget to add new urls when adding a
// new chain
return None
return None;
}
Viction => ("https://www.vicscan.xyz/api", "https://www.vicscan.xyz"),

Expand Down Expand Up @@ -659,41 +665,41 @@ impl Chain {
use Chain::*;

let api_key_name = match self {
Mainnet |
Morden |
Ropsten |
Kovan |
Rinkeby |
Goerli |
Holesky |
Optimism |
OptimismGoerli |
OptimismKovan |
OptimismSepolia |
BinanceSmartChain |
BinanceSmartChainTestnet |
Arbitrum |
ArbitrumTestnet |
ArbitrumGoerli |
ArbitrumSepolia |
ArbitrumNova |
Cronos |
CronosTestnet |
Aurora |
AuroraTestnet |
Celo |
CeloAlfajores |
CeloBaklava |
Base |
Linea |
Mantle |
MantleTestnet |
BaseGoerli |
BaseSepolia |
BlastSepolia |
Gnosis |
Scroll |
ScrollSepolia => "ETHERSCAN_API_KEY",
Mainnet
| Morden
| Ropsten
| Kovan
| Rinkeby
| Goerli
| Holesky
| Optimism
| OptimismGoerli
| OptimismKovan
| OptimismSepolia
| BinanceSmartChain
| BinanceSmartChainTestnet
| Arbitrum
| ArbitrumTestnet
| ArbitrumGoerli
| ArbitrumSepolia
| ArbitrumNova
| Cronos
| CronosTestnet
| Aurora
| AuroraTestnet
| Celo
| CeloAlfajores
| CeloBaklava
| Base
| Linea
| Mantle
| MantleTestnet
| BaseGoerli
| BaseSepolia
| BlastSepolia
| Gnosis
| Scroll
| ScrollSepolia => "ETHERSCAN_API_KEY",

Avalanche | AvalancheFuji => "SNOWTRACE_API_KEY",

Expand All @@ -705,33 +711,32 @@ impl Chain {

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

Canto | CantoTestnet | Zora | ZoraGoerli | ZoraSepolia | Mode | ModeSepolia => {
"BLOCKSCOUT_API_KEY"
}
Canto | CantoTestnet | Zora | ZoraGoerli | ZoraSepolia | Mode | ModeSepolia
| KakarotSepolia => "BLOCKSCOUT_API_KEY",

Boba => "BOBASCAN_API_KEY",

// Explicitly exhaustive. See NB above.
ScrollAlphaTestnet |
Metis |
Chiado |
Sepolia |
Rsk |
Sokol |
Poa |
Oasis |
Emerald |
EmeraldTestnet |
Evmos |
EvmosTestnet |
AnvilHardhat |
Dev |
ZkSync |
ZkSyncTestnet |
FilecoinMainnet |
LineaTestnet |
Viction |
FilecoinCalibrationTestnet => return None,
ScrollAlphaTestnet
| Metis
| Chiado
| Sepolia
| Rsk
| Sokol
| Poa
| Oasis
| Emerald
| EmeraldTestnet
| Evmos
| EvmosTestnet
| AnvilHardhat
| Dev
| ZkSync
| ZkSyncTestnet
| FilecoinMainnet
| LineaTestnet
| Viction
| FilecoinCalibrationTestnet => return None,
};

Some(api_key_name)
Expand Down

0 comments on commit 4b5315b

Please sign in to comment.