only use networkId, remove chainId

This commit is contained in:
Matthias Kretschmann 2020-10-02 12:59:11 +02:00
parent 1576bd3e90
commit 9bd86e70ea
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 4 additions and 11 deletions

View File

@ -7,7 +7,7 @@ import shortid from 'shortid'
import { MetadataExample } from './MetadataExample'
export function AllDdos() {
const { chainId, account, accountId, ocean } = useOcean()
const { networkId, account, accountId, ocean } = useOcean()
const [ddos, setDdos] = useState<DDO[]>()
@ -26,7 +26,7 @@ export function AllDdos() {
setDdos(assets.results.slice(0, 4))
}
init()
}, [ocean, account, chainId, accountId])
}, [ocean, account, networkId, accountId])
return (
<>

View File

@ -17,7 +17,7 @@ interface UseMetadata {
}
function useMetadata(asset?: DID | string | DDO): UseMetadata {
const { ocean, status, accountId, chainId } = useOcean()
const { ocean, status, accountId, networkId } = useOcean()
const [internalDdo, setDDO] = useState<DDO>()
const [internalDid, setDID] = useState<DID | string>()
const [metadata, setMetadata] = useState<Metadata>()
@ -100,7 +100,7 @@ function useMetadata(asset?: DID | string | DDO): UseMetadata {
return () => {
clearInterval(interval)
}
}, [accountId, chainId, internalDdo, getMetadata, getPrice])
}, [accountId, networkId, internalDdo, getMetadata, getPrice])
return {
ddo: internalDdo,

View File

@ -28,7 +28,6 @@ interface OceanProviderValue {
account: Account
accountId: string
balance: Balance
chainId: number | undefined
networkId: number | undefined
status: ProviderStatus
connect: (config?: Config) => Promise<void>
@ -51,7 +50,6 @@ function OceanProvider({
const [web3Provider, setWeb3Provider] = useState<any | undefined>()
const [ocean, setOcean] = useState<Ocean | undefined>()
const [web3Modal, setWeb3Modal] = useState<Web3Modal>()
const [chainId, setChainId] = useState<number | undefined>()
const [networkId, setNetworkId] = useState<number | undefined>()
const [account, setAccount] = useState<Account | undefined>()
const [accountId, setAccountId] = useState<string | undefined>()
@ -93,10 +91,6 @@ function OceanProvider({
setWeb3(web3)
Logger.log('Web3 created.', web3)
const chainId = web3 && (await web3.eth.getChainId())
setChainId(chainId)
Logger.log('chain id ', chainId)
const networkId = web3 && (await web3.eth.net.getId())
setNetworkId(networkId)
Logger.log('network id ', networkId)
@ -177,7 +171,6 @@ function OceanProvider({
account,
accountId,
balance,
chainId,
networkId,
status,
config,