From 512ef6bb0ac5e67b005876a3cd02f8cc024b7f05 Mon Sep 17 00:00:00 2001 From: Christophe Date: Wed, 23 Oct 2024 20:19:53 +0200 Subject: [PATCH] Add isTestnet to registerNewNetwork --- src/chains.ts | 10 +++++++++- src/utils/registerNewNetwork.ts | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/chains.ts b/src/chains.ts index 04dc167c..2009ba65 100644 --- a/src/chains.ts +++ b/src/chains.ts @@ -125,19 +125,27 @@ export function registerCustomParentChain( customParentChains[chain.id] = chain; } -export const chains = [ +export const mainnets = [ // mainnet L1 mainnet, // mainnet L2 arbitrumOne, arbitrumNova, base, +]; + +export const testnets = [ // testnet L1 sepolia, holesky, // testnet L2 arbitrumSepolia, baseSepolia, +]; + +export const chains = [ + ...mainnets, + ...testnets, // local nitro-testnode nitroTestnodeL1, nitroTestnodeL2, diff --git a/src/utils/registerNewNetwork.ts b/src/utils/registerNewNetwork.ts index 0aaf09fd..bdd926c6 100644 --- a/src/utils/registerNewNetwork.ts +++ b/src/utils/registerNewNetwork.ts @@ -4,6 +4,11 @@ import { getArbitrumNetworkInformationFromRollup, registerCustomArbitrumNetwork, } from '@arbitrum/sdk'; +import { testnets } from '../chains'; + +const isTestnet = (parentChainId: number) => { + return testnets.some((testnet) => testnet.id === parentChainId); +}; export const registerNewNetwork = async ( parentProvider: JsonRpcProvider, @@ -21,6 +26,7 @@ export const registerNewNetwork = async ( confirmPeriodBlocks, ethBridge, isCustom: true, + isTestnet: isTestnet(parentChainId), }; return registerCustomArbitrumNetwork(arbitrumNetwork);