feat: add filecoin chains (#2177)
* feat: add filecoin chains * formatting * fix: add missing match --------- Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
This commit is contained in:
parent
537d0a9deb
commit
47b56a65b1
|
@ -109,6 +109,9 @@ pub enum Chain {
|
||||||
Emerald = 42262,
|
Emerald = 42262,
|
||||||
EmeraldTestnet = 42261,
|
EmeraldTestnet = 42261,
|
||||||
|
|
||||||
|
FilecoinMainnet = 314,
|
||||||
|
FilecoinHyperspaceTestnet = 3141,
|
||||||
|
|
||||||
Avalanche = 43114,
|
Avalanche = 43114,
|
||||||
#[strum(serialize = "fuji", serialize = "avalanche-fuji")]
|
#[strum(serialize = "fuji", serialize = "avalanche-fuji")]
|
||||||
AvalancheFuji = 43113,
|
AvalancheFuji = 43113,
|
||||||
|
@ -248,8 +251,9 @@ impl Chain {
|
||||||
Emerald => 6_000,
|
Emerald => 6_000,
|
||||||
Dev | AnvilHardhat => 200,
|
Dev | AnvilHardhat => 200,
|
||||||
Celo | CeloAlfajores | CeloBaklava => 5_000,
|
Celo | CeloAlfajores | CeloBaklava => 5_000,
|
||||||
|
FilecoinHyperspaceTestnet | FilecoinMainnet => 30_000,
|
||||||
// Explicitly exhaustive. See NB above.
|
// Explictly handle all network to make it easier not to forget this match when new
|
||||||
|
// networks are added.
|
||||||
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 => return None,
|
||||||
|
@ -294,14 +298,20 @@ impl Chain {
|
||||||
CeloBaklava => true,
|
CeloBaklava => true,
|
||||||
|
|
||||||
// Known EIP-1559 chains
|
// Known EIP-1559 chains
|
||||||
Mainnet | Goerli | Sepolia | Polygon | PolygonMumbai | Avalanche | AvalancheFuji => {
|
Mainnet |
|
||||||
false
|
Goerli |
|
||||||
}
|
Sepolia |
|
||||||
|
Polygon |
|
||||||
|
PolygonMumbai |
|
||||||
|
Avalanche |
|
||||||
|
AvalancheFuji |
|
||||||
|
FilecoinHyperspaceTestnet => false,
|
||||||
|
|
||||||
// Unknown / not applicable, default to false for backwards compatibility
|
// Unknown / not applicable, default to false for backwards compatibility
|
||||||
Dev | AnvilHardhat | Morden | Ropsten | Rinkeby | Cronos | CronosTestnet | Kovan |
|
Dev | AnvilHardhat | Morden | Ropsten | Rinkeby | Cronos | CronosTestnet | Kovan |
|
||||||
Sokol | Poa | XDai | Moonbeam | MoonbeamDev | Moonriver | Moonbase | Evmos |
|
Sokol | Poa | XDai | Moonbeam | MoonbeamDev | Moonriver | Moonbase | Evmos |
|
||||||
EvmosTestnet | Chiado | Aurora | AuroraTestnet | Canto | CantoTestnet => false,
|
EvmosTestnet | Chiado | Aurora | AuroraTestnet | Canto | CantoTestnet |
|
||||||
|
FilecoinMainnet => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,6 +389,9 @@ impl Chain {
|
||||||
Chiado => {
|
Chiado => {
|
||||||
("https://blockscout.chiadochain.net/api", "https://blockscout.chiadochain.net")
|
("https://blockscout.chiadochain.net/api", "https://blockscout.chiadochain.net")
|
||||||
}
|
}
|
||||||
|
FilecoinHyperspaceTestnet => {
|
||||||
|
("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"),
|
||||||
|
@ -408,9 +421,11 @@ impl Chain {
|
||||||
"https://testnet-explorer.canto.neobase.one/",
|
"https://testnet-explorer.canto.neobase.one/",
|
||||||
"https://testnet-explorer.canto.neobase.one/api",
|
"https://testnet-explorer.canto.neobase.one/api",
|
||||||
),
|
),
|
||||||
|
AnvilHardhat | Dev | Morden | MoonbeamDev | FilecoinMainnet => {
|
||||||
// Explicitly exhaustive. See NB above.
|
// this is explicitly exhaustive so we don't forget to add new urls when adding a
|
||||||
AnvilHardhat | Dev | Morden | MoonbeamDev => return None,
|
// new chain
|
||||||
|
return None
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Some(urls)
|
Some(urls)
|
||||||
|
@ -452,7 +467,6 @@ 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",
|
||||||
|
@ -464,8 +478,21 @@ impl Chain {
|
||||||
Canto | CantoTestnet => "BLOCKSCOUT_API_KEY",
|
Canto | CantoTestnet => "BLOCKSCOUT_API_KEY",
|
||||||
|
|
||||||
// Explicitly exhaustive. See NB above.
|
// Explicitly exhaustive. See NB above.
|
||||||
XDai | Chiado | Sepolia | Rsk | Sokol | Poa | Oasis | Emerald | EmeraldTestnet |
|
XDai |
|
||||||
Evmos | EvmosTestnet | AnvilHardhat | Dev => return None,
|
Chiado |
|
||||||
|
Sepolia |
|
||||||
|
Rsk |
|
||||||
|
Sokol |
|
||||||
|
Poa |
|
||||||
|
Oasis |
|
||||||
|
Emerald |
|
||||||
|
EmeraldTestnet |
|
||||||
|
Evmos |
|
||||||
|
EvmosTestnet |
|
||||||
|
AnvilHardhat |
|
||||||
|
Dev |
|
||||||
|
FilecoinMainnet |
|
||||||
|
FilecoinHyperspaceTestnet => return None,
|
||||||
};
|
};
|
||||||
|
|
||||||
Some(api_key_name)
|
Some(api_key_name)
|
||||||
|
|
Loading…
Reference in New Issue