1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

Simplifying isSupportedOceanNetwork check logic

This commit is contained in:
Jamie Hewitt 2022-04-08 16:12:31 +03:00
parent b950b59807
commit fee6ef5ab8

View File

@ -14,7 +14,7 @@ import WalletConnectProvider from '@walletconnect/web3-provider'
import { LoggerInstance } from '@oceanprotocol/lib' import { LoggerInstance } from '@oceanprotocol/lib'
import { isBrowser } from '@utils/index' import { isBrowser } from '@utils/index'
import { getEnsName } from '@utils/ens' import { getEnsName } from '@utils/ens'
import { getOceanBalance, getOceanConfig } from '@utils/ocean' import { getOceanBalance } from '@utils/ocean'
import useNetworkMetadata, { import useNetworkMetadata, {
getNetworkDataById, getNetworkDataById,
getNetworkDisplayName, getNetworkDisplayName,
@ -314,13 +314,10 @@ function Web3Provider({ children }: { children: ReactNode }): ReactElement {
// ----------------------------------- // -----------------------------------
useEffect(() => { useEffect(() => {
for (let i = 0; i < appConfig.chainIds.length; i++) { if (appConfig.chainIdsSupported.includes(networkId)) {
if (networkId === appConfig.chainIds[i]) { setIsSupportedOceanNetwork(true)
setIsSupportedOceanNetwork(true) } else {
break setIsSupportedOceanNetwork(false)
} else if (i === appConfig.chainIds.length) {
setIsSupportedOceanNetwork(false)
}
} }
}, [networkId, appConfig]) }, [networkId, appConfig])