diff --git a/assets/chains.json b/assets/chains.json index e96d290..7068013 100644 --- a/assets/chains.json +++ b/assets/chains.json @@ -432,6 +432,18 @@ "etherscanBaseUrl": "https://explorer.publicgoods.network", "etherscanApiKeyName": "BLOCKSCOUT_API_KEY" }, + "480": { + "internalId": "World", + "name": "world", + "averageBlocktimeHint": 2000, + "isLegacy": false, + "supportsShanghai": true, + "isTestnet": false, + "nativeCurrencySymbol": "WRLD", + "etherscanApiUrl": "https://worldchain-mainnet.explorer.alchemy.com/api", + "etherscanBaseUrl": "https://worldchain-mainnet.explorer.alchemy.com", + "etherscanApiKeyName": "BLOCKSCOUT_API_KEY" + }, "595": { "internalId": "AcalaMandalaTestnet", "name": "acala-mandala-testnet", @@ -720,6 +732,18 @@ "etherscanBaseUrl": "https://testnet.ftmscan.com", "etherscanApiKeyName": "FTMSCAN_API_KEY" }, + "4801": { + "internalId": "WorldSepolia", + "name": "world-sepolia", + "averageBlocktimeHint": 2000, + "isLegacy": false, + "supportsShanghai": true, + "isTestnet": true, + "nativeCurrencySymbol": "WRLD", + "etherscanApiUrl": "https://worldchain-sepolia.explorer.alchemy.com/api", + "etherscanBaseUrl": "https://worldchain-sepolia.explorer.alchemy.com", + "etherscanApiKeyName": "BLOCKSCOUT_API_KEY" + }, "5000": { "internalId": "Mantle", "name": "mantle", diff --git a/src/named.rs b/src/named.rs index aac5d66..93893c8 100644 --- a/src/named.rs +++ b/src/named.rs @@ -4,7 +4,6 @@ use num_enum::TryFromPrimitiveError; #[allow(unused_imports)] use alloc::string::String; - // When adding a new chain: // 1. add new variant to the NamedChain enum; // 2. add extra information in the last `impl` block (explorer URLs, block time) when applicable; @@ -361,6 +360,12 @@ pub enum NamedChain { #[strum(to_string = "soneium-minato-testnet")] #[cfg_attr(feature = "serde", serde(alias = "soneium-minato-testnet"))] SoneiumMinatoTestnet = 1946, + + #[cfg_attr(feature = "serde", serde(alias = "worldchain"))] + World = 480, + #[strum(to_string = "world-sepolia")] + #[cfg_attr(feature = "serde", serde(alias = "worldchain-sepolia", alias = "world-sepolia"))] + WorldSepolia = 4801, } // This must be implemented manually so we avoid a conflict with `TryFromPrimitive` where it treats @@ -507,6 +512,8 @@ impl NamedChain { | OpBNBTestnet | SoneiumMinatoTestnet | Odyssey + | World + | WorldSepolia ) } @@ -611,6 +618,8 @@ impl NamedChain { Immutable | ImmutableTestnet => 2_000, + World | WorldSepolia => 2_000, + Morden | Ropsten | Rinkeby | Goerli | Kovan | Sepolia | Holesky | MantleTestnet | Moonbase | MoonbeamDev | OptimismKovan | Poa | Sokol | Rsk | EmeraldTestnet | Boba | ZkSync | ZkSyncTestnet | PolygonZkEvm | PolygonZkEvmTestnet | Metis @@ -732,7 +741,9 @@ impl NamedChain { | Koi | Immutable | ImmutableTestnet - | SoneiumMinatoTestnet => false, + | SoneiumMinatoTestnet + | World + | WorldSepolia => false, // Unknown / not applicable, default to false for backwards compatibility. Dev | AnvilHardhat | Morden | Ropsten | Rinkeby | Cronos | CronosTestnet | Kovan @@ -811,6 +822,8 @@ impl NamedChain { | Immutable | ImmutableTestnet | SoneiumMinatoTestnet + | World + | WorldSepolia ) } @@ -882,7 +895,8 @@ impl NamedChain { | XaiSepolia | Koi | ImmutableTestnet - | SoneiumMinatoTestnet => true, + | SoneiumMinatoTestnet + | WorldSepolia => true, // Dev chains. Dev | AnvilHardhat => true, @@ -894,7 +908,7 @@ impl NamedChain { | Emerald | FilecoinMainnet | Avalanche | Celo | Aurora | Canto | Boba | Base | Fraxtal | Linea | ZkSync | Mantle | GravityAlphaMainnet | Xai | Zora | Pgn | Mode | Viction | Elastos | Degen | OpBNBMainnet | Ronin | Taiko | Flare | Acala | Karura - | Darwinia | Cfx | Crab | Pulsechain | Etherlink | Immutable => false, + | Darwinia | Cfx | Crab | Pulsechain | Etherlink | Immutable | World => false, } } @@ -938,6 +952,8 @@ impl NamedChain { Immutable => "IMX", ImmutableTestnet => "tIMX", + World | WorldSepolia => "WRLD", + _ => return None, }) } @@ -1251,6 +1267,14 @@ impl NamedChain { Odyssey => { ("https://odyssey-explorer.ithaca.xyz/api", "https://odyssey-explorer.ithaca.xyz") } + World => ( + "https://worldchain-mainnet.explorer.alchemy.com/api", + "https://worldchain-mainnet.explorer.alchemy.com", + ), + WorldSepolia => ( + "https://worldchain-sepolia.explorer.alchemy.com/api", + "https://worldchain-sepolia.explorer.alchemy.com", + ), }) } @@ -1330,9 +1354,8 @@ impl NamedChain { Acala | AcalaMandalaTestnet | AcalaTestnet | Canto | CantoTestnet | Etherlink | EtherlinkTestnet | Flare | FlareCoston2 | KakarotSepolia | Karura | KaruraTestnet | Mode | ModeSepolia | Pgn | PgnSepolia | Shimmer | Zora | ZoraGoerli | ZoraSepolia - | Darwinia | Crab | Koi | Immutable | ImmutableTestnet | SoneiumMinatoTestnet => { - "BLOCKSCOUT_API_KEY" - } + | Darwinia | Crab | Koi | Immutable | ImmutableTestnet | SoneiumMinatoTestnet + | World | WorldSepolia => "BLOCKSCOUT_API_KEY", Boba => "BOBASCAN_API_KEY",