Skip to content

Commit

Permalink
Add isTestnet to registerNewNetwork
Browse files Browse the repository at this point in the history
  • Loading branch information
chrstph-dvx committed Oct 23, 2024
1 parent b63a189 commit 512ef6b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions src/utils/registerNewNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -21,6 +26,7 @@ export const registerNewNetwork = async (
confirmPeriodBlocks,
ethBridge,
isCustom: true,
isTestnet: isTestnet(parentChainId),
};

return registerCustomArbitrumNetwork(arbitrumNetwork);
Expand Down

0 comments on commit 512ef6b

Please sign in to comment.