diff --git a/src/providers/OceanProvider/OceanProvider.tsx b/src/providers/OceanProvider/OceanProvider.tsx index d64ed9d..90181a5 100644 --- a/src/providers/OceanProvider/OceanProvider.tsx +++ b/src/providers/OceanProvider/OceanProvider.tsx @@ -29,6 +29,7 @@ interface OceanProviderValue { accountId: string balance: Balance chainId: number | undefined + networkId: number | undefined status: ProviderStatus connect: (config?: Config) => Promise logout: () => Promise @@ -51,6 +52,7 @@ function OceanProvider({ const [ocean, setOcean] = useState() const [web3Modal, setWeb3Modal] = useState() const [chainId, setChainId] = useState() + const [networkId, setNetworkId] = useState() const [account, setAccount] = useState() const [accountId, setAccountId] = useState() const [config, setConfig] = useState(initialConfig) @@ -95,6 +97,10 @@ function OceanProvider({ setChainId(chainId) Logger.log('chain id ', chainId) + const networkId = web3 && (await web3.eth.net.getId()) + setNetworkId(networkId) + Logger.log('network id ', networkId) + config.web3Provider = web3 const ocean = await Ocean.getInstance(config) setOcean(ocean) @@ -172,6 +178,7 @@ function OceanProvider({ accountId, balance, chainId, + networkId, status, config, connect,