Skip to content

Commit

Permalink
refactor: tighten isOrbitChain check (#2004)
Browse files Browse the repository at this point in the history
  • Loading branch information
fionnachan authored Oct 21, 2024
1 parent de9ea32 commit c0d5634
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/arb-token-bridge-ui/src/util/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit c0d5634

Please sign in to comment.