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

feat(chain): add zora networks #2677

Merged
merged 3 commits into from
Nov 16, 2023
Merged
Changes from 1 commit
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
25 changes: 22 additions & 3 deletions ethers-core/src/types/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ pub enum Chain {
#[strum(to_string = "mantle-testnet")]
#[serde(alias = "mantle_testnet")]
MantleTestnet = 5001,

Zora = 7777777,
ZoraGoerli = 999,
ZoraSepolia = 999999999,

}

// === impl Chain ===
Expand Down Expand Up @@ -312,7 +317,8 @@ impl Chain {
Morden | Ropsten | Rinkeby | Goerli | Kovan | Sepolia | Holesky | Moonbase |
MoonbeamDev | OptimismKovan | Poa | Sokol | Rsk | EmeraldTestnet | Boba | Base |
BaseGoerli | ZkSync | ZkSyncTestnet | PolygonZkEvm | PolygonZkEvmTestnet | Metis |
Linea | LineaTestnet | Mantle | MantleTestnet => return None,
Linea | LineaTestnet | Mantle | MantleTestnet | Zora | ZoraGoerli | ZoraSepolia
=> return None,
};

Some(Duration::from_millis(ms))
Expand Down Expand Up @@ -378,7 +384,10 @@ impl Chain {
LineaTestnet |
FilecoinCalibrationTestnet |
Gnosis |
Chiado => false,
Chiado |
Zora |
ZoraGoerli |
ZoraSepolia => false,

// Unknown / not applicable, default to false for backwards compatibility
Dev | AnvilHardhat | Morden | Ropsten | Rinkeby | Cronos | CronosTestnet | Kovan |
Expand Down Expand Up @@ -571,6 +580,16 @@ impl Chain {
("https://explorer.testnet.mantle.xyz/api", "https://explorer.testnet.mantle.xyz")
}

Zora => ("https://explorer.zora.energy/api", "https://explorer.zora.energy"),
ZoraGoerli => (
"https://testnet.explorer.zora.energy/api",
"https://testnet.explorer.zora.energy",
),
ZoraSepolia => (
"https://sepolia.explorer.zora.energy/api",
"https://sepolia.explorer.zora.energy"
),

AnvilHardhat | Dev | Morden | MoonbeamDev | FilecoinMainnet => {
// this is explicitly exhaustive so we don't forget to add new urls when adding a
// new chain
Expand Down Expand Up @@ -636,7 +655,7 @@ impl Chain {

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

Canto | CantoTestnet => "BLOCKSCOUT_API_KEY",
Canto | CantoTestnet | Zora | ZoraGoerli | ZoraSepolia => "BLOCKSCOUT_API_KEY",

Boba => "BOBASCAN_API_KEY",

Expand Down
Loading