feat: add Boba chain (#2236)

* fix: etherscan url order

* feat: add Boba chain
This commit is contained in:
DaniPopes 2023-03-09 22:58:15 +01:00 committed by GitHub
parent f9086e703c
commit ce26dfc0d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 36 additions and 7 deletions

View File

@ -125,6 +125,8 @@ pub enum Chain {
Canto = 7700, Canto = 7700,
CantoTestnet = 740, CantoTestnet = 740,
Boba = 288,
} }
// === impl Chain === // === impl Chain ===
@ -256,7 +258,7 @@ impl Chain {
// Explicitly exhaustive. See NB above. // Explicitly exhaustive. See NB above.
Morden | Ropsten | Rinkeby | Goerli | Kovan | XDai | Chiado | Sepolia | Moonbase | Morden | Ropsten | Rinkeby | Goerli | Kovan | XDai | Chiado | Sepolia | Moonbase |
MoonbeamDev | Optimism | OptimismGoerli | OptimismKovan | Poa | Sokol | Rsk | MoonbeamDev | Optimism | OptimismGoerli | OptimismKovan | Poa | Sokol | Rsk |
EmeraldTestnet => return None, EmeraldTestnet | Boba => return None,
}; };
Some(Duration::from_millis(ms)) Some(Duration::from_millis(ms))
@ -295,7 +297,8 @@ impl Chain {
EmeraldTestnet | EmeraldTestnet |
Celo | Celo |
CeloAlfajores | CeloAlfajores |
CeloBaklava => true, CeloBaklava |
Boba => true,
// Known EIP-1559 chains // Known EIP-1559 chains
Mainnet | Mainnet |
@ -344,14 +347,17 @@ impl Chain {
Rinkeby => ("https://api-rinkeby.etherscan.io/api", "https://rinkeby.etherscan.io"), Rinkeby => ("https://api-rinkeby.etherscan.io/api", "https://rinkeby.etherscan.io"),
Goerli => ("https://api-goerli.etherscan.io/api", "https://goerli.etherscan.io"), Goerli => ("https://api-goerli.etherscan.io/api", "https://goerli.etherscan.io"),
Sepolia => ("https://api-sepolia.etherscan.io/api", "https://sepolia.etherscan.io"), Sepolia => ("https://api-sepolia.etherscan.io/api", "https://sepolia.etherscan.io"),
Polygon => ("https://api.polygonscan.com/api", "https://polygonscan.com"), Polygon => ("https://api.polygonscan.com/api", "https://polygonscan.com"),
PolygonMumbai => { PolygonMumbai => {
("https://api-testnet.polygonscan.com/api", "https://mumbai.polygonscan.com") ("https://api-testnet.polygonscan.com/api", "https://mumbai.polygonscan.com")
} }
Avalanche => ("https://api.snowtrace.io/api", "https://snowtrace.io"), Avalanche => ("https://api.snowtrace.io/api", "https://snowtrace.io"),
AvalancheFuji => { AvalancheFuji => {
("https://api-testnet.snowtrace.io/api", "https://testnet.snowtrace.io") ("https://api-testnet.snowtrace.io/api", "https://testnet.snowtrace.io")
} }
Optimism => { Optimism => {
("https://api-optimistic.etherscan.io/api", "https://optimistic.etherscan.io") ("https://api-optimistic.etherscan.io/api", "https://optimistic.etherscan.io")
} }
@ -363,39 +369,52 @@ impl Chain {
"https://api-kovan-optimistic.etherscan.io/api", "https://api-kovan-optimistic.etherscan.io/api",
"https://kovan-optimistic.etherscan.io", "https://kovan-optimistic.etherscan.io",
), ),
Fantom => ("https://api.ftmscan.com/api", "https://ftmscan.com"), Fantom => ("https://api.ftmscan.com/api", "https://ftmscan.com"),
FantomTestnet => ("https://api-testnet.ftmscan.com/api", "https://testnet.ftmscan.com"), FantomTestnet => ("https://api-testnet.ftmscan.com/api", "https://testnet.ftmscan.com"),
BinanceSmartChain => ("https://api.bscscan.com/api", "https://bscscan.com"), BinanceSmartChain => ("https://api.bscscan.com/api", "https://bscscan.com"),
BinanceSmartChainTestnet => { BinanceSmartChainTestnet => {
("https://api-testnet.bscscan.com/api", "https://testnet.bscscan.com") ("https://api-testnet.bscscan.com/api", "https://testnet.bscscan.com")
} }
Arbitrum => ("https://api.arbiscan.io/api", "https://arbiscan.io"), Arbitrum => ("https://api.arbiscan.io/api", "https://arbiscan.io"),
ArbitrumTestnet => { ArbitrumTestnet => {
("https://api-testnet.arbiscan.io/api", "https://testnet.arbiscan.io") ("https://api-testnet.arbiscan.io/api", "https://testnet.arbiscan.io")
} }
ArbitrumGoerli => ("https://api-goerli.arbiscan.io/api", "https://goerli.arbiscan.io"), ArbitrumGoerli => ("https://api-goerli.arbiscan.io/api", "https://goerli.arbiscan.io"),
ArbitrumNova => ("https://api-nova.arbiscan.io/api", "https://nova.arbiscan.io/"), ArbitrumNova => ("https://api-nova.arbiscan.io/api", "https://nova.arbiscan.io/"),
Cronos => ("https://api.cronoscan.com/api", "https://cronoscan.com"), Cronos => ("https://api.cronoscan.com/api", "https://cronoscan.com"),
CronosTestnet => { CronosTestnet => {
("https://api-testnet.cronoscan.com/api", "https://testnet.cronoscan.com") ("https://api-testnet.cronoscan.com/api", "https://testnet.cronoscan.com")
} }
Moonbeam => ("https://api-moonbeam.moonscan.io/api", "https://moonbeam.moonscan.io/"), Moonbeam => ("https://api-moonbeam.moonscan.io/api", "https://moonbeam.moonscan.io/"),
Moonbase => ("https://api-moonbase.moonscan.io/api", "https://moonbase.moonscan.io/"), Moonbase => ("https://api-moonbase.moonscan.io/api", "https://moonbase.moonscan.io/"),
Moonriver => ("https://api-moonriver.moonscan.io/api", "https://moonriver.moonscan.io"), Moonriver => ("https://api-moonriver.moonscan.io/api", "https://moonriver.moonscan.io"),
// blockscout API is etherscan compatible // blockscout API is etherscan compatible
XDai => { XDai => {
("https://blockscout.com/xdai/mainnet/api", "https://blockscout.com/xdai/mainnet") ("https://blockscout.com/xdai/mainnet/api", "https://blockscout.com/xdai/mainnet")
} }
Chiado => { Chiado => {
("https://blockscout.chiadochain.net/api", "https://blockscout.chiadochain.net") ("https://blockscout.chiadochain.net/api", "https://blockscout.chiadochain.net")
} }
FilecoinHyperspaceTestnet => { FilecoinHyperspaceTestnet => {
("https://api.hyperspace.node.glif.io/rpc/v1", "https://hyperspace.filfox.info") ("https://api.hyperspace.node.glif.io/rpc/v1", "https://hyperspace.filfox.info")
} }
Sokol => ("https://blockscout.com/poa/sokol/api", "https://blockscout.com/poa/sokol"), Sokol => ("https://blockscout.com/poa/sokol/api", "https://blockscout.com/poa/sokol"),
Poa => ("https://blockscout.com/poa/core/api", "https://blockscout.com/poa/core"), Poa => ("https://blockscout.com/poa/core/api", "https://blockscout.com/poa/core"),
Rsk => ("https://blockscout.com/rsk/mainnet/api", "https://blockscout.com/rsk/mainnet"), Rsk => ("https://blockscout.com/rsk/mainnet/api", "https://blockscout.com/rsk/mainnet"),
Oasis => ("https://scan.oasischain.io/api", "https://scan.oasischain.io/"), Oasis => ("https://scan.oasischain.io/api", "https://scan.oasischain.io/"),
Emerald => { Emerald => {
("https://explorer.emerald.oasis.dev/api", "https://explorer.emerald.oasis.dev/") ("https://explorer.emerald.oasis.dev/api", "https://explorer.emerald.oasis.dev/")
} }
@ -403,24 +422,31 @@ impl Chain {
"https://testnet.explorer.emerald.oasis.dev/api", "https://testnet.explorer.emerald.oasis.dev/api",
"https://testnet.explorer.emerald.oasis.dev/", "https://testnet.explorer.emerald.oasis.dev/",
), ),
Aurora => ("https://api.aurorascan.dev/api", "https://aurorascan.dev"), Aurora => ("https://api.aurorascan.dev/api", "https://aurorascan.dev"),
AuroraTestnet => { AuroraTestnet => {
("https://testnet.aurorascan.dev/api", "https://testnet.aurorascan.dev") ("https://testnet.aurorascan.dev/api", "https://testnet.aurorascan.dev")
} }
Evmos => ("https://evm.evmos.org/api", "https://evm.evmos.org/"), Evmos => ("https://evm.evmos.org/api", "https://evm.evmos.org/"),
EvmosTestnet => ("https://evm.evmos.dev/api", "https://evm.evmos.dev/"), EvmosTestnet => ("https://evm.evmos.dev/api", "https://evm.evmos.dev/"),
Celo => ("https://explorer.celo.org/mainnet", "https://explorer.celo.org/mainnet/api"),
Celo => ("https://explorer.celo.org/mainnet/api", "https://explorer.celo.org/mainnet"),
CeloAlfajores => { CeloAlfajores => {
("https://explorer.celo.org/alfajores", "https://explorer.celo.org/alfajores/api") ("https://explorer.celo.org/alfajores/api", "https://explorer.celo.org/alfajores")
} }
CeloBaklava => { CeloBaklava => {
("https://explorer.celo.org/baklava", "https://explorer.celo.org/baklava/api") ("https://explorer.celo.org/baklava/api", "https://explorer.celo.org/baklava")
} }
Canto => ("https://evm.explorer.canto.io/", "https://evm.explorer.canto.io/api"),
Canto => ("https://evm.explorer.canto.io/api", "https://evm.explorer.canto.io/"),
CantoTestnet => ( CantoTestnet => (
"https://testnet-explorer.canto.neobase.one/",
"https://testnet-explorer.canto.neobase.one/api", "https://testnet-explorer.canto.neobase.one/api",
"https://testnet-explorer.canto.neobase.one/",
), ),
Boba => ("https://api.bobascan.com/api", "https://bobascan.com"),
AnvilHardhat | Dev | Morden | MoonbeamDev | FilecoinMainnet => { AnvilHardhat | Dev | Morden | MoonbeamDev | FilecoinMainnet => {
// this is explicitly exhaustive so we don't forget to add new urls when adding a // this is explicitly exhaustive so we don't forget to add new urls when adding a
// new chain // new chain
@ -467,6 +493,7 @@ impl Chain {
Celo | Celo |
CeloAlfajores | CeloAlfajores |
CeloBaklava => "ETHERSCAN_API_KEY", CeloBaklava => "ETHERSCAN_API_KEY",
Avalanche | AvalancheFuji => "SNOWTRACE_API_KEY", Avalanche | AvalancheFuji => "SNOWTRACE_API_KEY",
Polygon | PolygonMumbai => "POLYGONSCAN_API_KEY", Polygon | PolygonMumbai => "POLYGONSCAN_API_KEY",
@ -477,6 +504,8 @@ impl Chain {
Canto | CantoTestnet => "BLOCKSCOUT_API_KEY", Canto | CantoTestnet => "BLOCKSCOUT_API_KEY",
Boba => "BOBASCAN_API_KEY",
// Explicitly exhaustive. See NB above. // Explicitly exhaustive. See NB above.
XDai | XDai |
Chiado | Chiado |