From fee6ef5ab8a82d9b5f7575cf147457ce91853299 Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Fri, 8 Apr 2022 16:12:31 +0300 Subject: [PATCH] Simplifying isSupportedOceanNetwork check logic --- src/@context/Web3.tsx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/@context/Web3.tsx b/src/@context/Web3.tsx index cb84a1c5b..e1f5e59d0 100644 --- a/src/@context/Web3.tsx +++ b/src/@context/Web3.tsx @@ -14,7 +14,7 @@ import WalletConnectProvider from '@walletconnect/web3-provider' import { LoggerInstance } from '@oceanprotocol/lib' import { isBrowser } from '@utils/index' import { getEnsName } from '@utils/ens' -import { getOceanBalance, getOceanConfig } from '@utils/ocean' +import { getOceanBalance } from '@utils/ocean' import useNetworkMetadata, { getNetworkDataById, getNetworkDisplayName, @@ -314,13 +314,10 @@ function Web3Provider({ children }: { children: ReactNode }): ReactElement { // ----------------------------------- useEffect(() => { - for (let i = 0; i < appConfig.chainIds.length; i++) { - if (networkId === appConfig.chainIds[i]) { - setIsSupportedOceanNetwork(true) - break - } else if (i === appConfig.chainIds.length) { - setIsSupportedOceanNetwork(false) - } + if (appConfig.chainIdsSupported.includes(networkId)) { + setIsSupportedOceanNetwork(true) + } else { + setIsSupportedOceanNetwork(false) } }, [networkId, appConfig])