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 { 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])