1
0
mirror of https://github.com/oceanprotocol/react.git synced 2025-02-14 21:10:38 +01:00

get chainId as early as possible

This commit is contained in:
Matthias Kretschmann 2020-07-20 13:33:42 +02:00
parent 941ca71d1d
commit c5a273eac4
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -84,6 +84,10 @@ function OceanProvider({
const web3 = new Web3(provider) const web3 = new Web3(provider)
setWeb3(web3) setWeb3(web3)
const chainId = web3 && (await web3.eth.getChainId())
setChainId(chainId)
Logger.log('chain id ', chainId)
config.web3Provider = web3 config.web3Provider = web3
const ocean = await Ocean.getInstance(config) const ocean = await Ocean.getInstance(config)
@ -103,10 +107,6 @@ function OceanProvider({
const balance = await getBalance(account) const balance = await getBalance(account)
setBalance(balance) setBalance(balance)
Logger.log('balance', JSON.stringify(balance)) Logger.log('balance', JSON.stringify(balance))
const chainId = web3 && (await web3.eth.getChainId())
setChainId(chainId)
Logger.log('chain id ', chainId)
} }
async function logout() { async function logout() {