Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions clients/js/src/consts/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ const Testnet = {
chain_id: 713715,
},
Sepolia: {
rpc: "https://rpc.ankr.com/eth_sepolia",
rpc: "https://ethereum-sepolia-rpc.publicnode.com",
key: getEnvVar("ETH_KEY_TESTNET"),
chain_id: 11155111,
},
Expand Down Expand Up @@ -523,7 +523,7 @@ const Testnet = {
chain_id: 84532,
},
OptimismSepolia: {
rpc: "https://rpc.ankr.com/optimism_sepolia",
rpc: "https://optimism-sepolia-rpc.publicnode.com",
key: getEnvVar("ETH_KEY_TESTNET"),
chain_id: 11155420,
},
Expand Down
11 changes: 9 additions & 2 deletions clients/js/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Network,
PlatformToChains,
chainToPlatform,
chains,
toChain,
} from "@wormhole-foundation/sdk-base";
import { spawnSync } from "child_process";
Expand Down Expand Up @@ -56,6 +57,12 @@ export function chainToChain(input: string): Chain {
if (input.length < 2) {
throw new Error(`Invalid chain: ${input}`);
}
const chainStr = input[0].toUpperCase() + input.slice(1).toLowerCase();
return toChain(chainStr);
// Match case-insensitively and ignore underscores so multi-word chains
// work in any spelling (BaseSepolia, basesepolia, base_sepolia).
const normalized = input.replace(/_/g, "").toLowerCase();
const chain = chains.find((c) => c.toLowerCase() === normalized);
if (!chain) {
throw new Error(`Invalid chain: ${input}`);
}
return chain;
}
Loading