From c0d5634ed205f30029b5d7c4e298f80d4b75c20e Mon Sep 17 00:00:00 2001 From: Fionna Chan <13184582+fionnachan@users.noreply.github.com> Date: Mon, 21 Oct 2024 19:19:16 +0800 Subject: [PATCH] refactor: tighten isOrbitChain check (#2004) --- packages/arb-token-bridge-ui/src/util/networks.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/arb-token-bridge-ui/src/util/networks.ts b/packages/arb-token-bridge-ui/src/util/networks.ts index e6b22e9a83..06fe5ca182 100644 --- a/packages/arb-token-bridge-ui/src/util/networks.ts +++ b/packages/arb-token-bridge-ui/src/util/networks.ts @@ -385,6 +385,14 @@ function isTestnetChain(chainId: ChainId) { } } +function getIsArbitrumChain(chainId: ChainId) { + try { + return !!getArbitrumNetwork(chainId).parentChainId + } catch (error) { + return false + } +} + export function isNetwork(chainId: ChainId) { const isEthereumMainnet = chainId === ChainId.Ethereum @@ -404,7 +412,7 @@ export function isNetwork(chainId: ChainId) { isArbitrumOne || isArbitrumNova || isArbitrumLocal || isArbitrumSepolia const isCoreChain = isEthereumMainnetOrTestnet || isArbitrum - const isOrbitChain = !isCoreChain + const isOrbitChain = getIsArbitrumChain(chainId) && !isCoreChain return { // L1