mirror of
https://github.com/oceanprotocol/react.git
synced 2024-12-23 01:29:49 +01:00
only use networkId, remove chainId
This commit is contained in:
parent
1576bd3e90
commit
9bd86e70ea
@ -7,7 +7,7 @@ import shortid from 'shortid'
|
|||||||
import { MetadataExample } from './MetadataExample'
|
import { MetadataExample } from './MetadataExample'
|
||||||
|
|
||||||
export function AllDdos() {
|
export function AllDdos() {
|
||||||
const { chainId, account, accountId, ocean } = useOcean()
|
const { networkId, account, accountId, ocean } = useOcean()
|
||||||
|
|
||||||
const [ddos, setDdos] = useState<DDO[]>()
|
const [ddos, setDdos] = useState<DDO[]>()
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ export function AllDdos() {
|
|||||||
setDdos(assets.results.slice(0, 4))
|
setDdos(assets.results.slice(0, 4))
|
||||||
}
|
}
|
||||||
init()
|
init()
|
||||||
}, [ocean, account, chainId, accountId])
|
}, [ocean, account, networkId, accountId])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -17,7 +17,7 @@ interface UseMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function useMetadata(asset?: DID | string | DDO): 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 [internalDdo, setDDO] = useState<DDO>()
|
||||||
const [internalDid, setDID] = useState<DID | string>()
|
const [internalDid, setDID] = useState<DID | string>()
|
||||||
const [metadata, setMetadata] = useState<Metadata>()
|
const [metadata, setMetadata] = useState<Metadata>()
|
||||||
@ -100,7 +100,7 @@ function useMetadata(asset?: DID | string | DDO): UseMetadata {
|
|||||||
return () => {
|
return () => {
|
||||||
clearInterval(interval)
|
clearInterval(interval)
|
||||||
}
|
}
|
||||||
}, [accountId, chainId, internalDdo, getMetadata, getPrice])
|
}, [accountId, networkId, internalDdo, getMetadata, getPrice])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
ddo: internalDdo,
|
ddo: internalDdo,
|
||||||
|
@ -28,7 +28,6 @@ interface OceanProviderValue {
|
|||||||
account: Account
|
account: Account
|
||||||
accountId: string
|
accountId: string
|
||||||
balance: Balance
|
balance: Balance
|
||||||
chainId: number | undefined
|
|
||||||
networkId: number | undefined
|
networkId: number | undefined
|
||||||
status: ProviderStatus
|
status: ProviderStatus
|
||||||
connect: (config?: Config) => Promise<void>
|
connect: (config?: Config) => Promise<void>
|
||||||
@ -51,7 +50,6 @@ function OceanProvider({
|
|||||||
const [web3Provider, setWeb3Provider] = useState<any | undefined>()
|
const [web3Provider, setWeb3Provider] = useState<any | undefined>()
|
||||||
const [ocean, setOcean] = useState<Ocean | undefined>()
|
const [ocean, setOcean] = useState<Ocean | undefined>()
|
||||||
const [web3Modal, setWeb3Modal] = useState<Web3Modal>()
|
const [web3Modal, setWeb3Modal] = useState<Web3Modal>()
|
||||||
const [chainId, setChainId] = useState<number | undefined>()
|
|
||||||
const [networkId, setNetworkId] = useState<number | undefined>()
|
const [networkId, setNetworkId] = useState<number | undefined>()
|
||||||
const [account, setAccount] = useState<Account | undefined>()
|
const [account, setAccount] = useState<Account | undefined>()
|
||||||
const [accountId, setAccountId] = useState<string | undefined>()
|
const [accountId, setAccountId] = useState<string | undefined>()
|
||||||
@ -93,10 +91,6 @@ function OceanProvider({
|
|||||||
setWeb3(web3)
|
setWeb3(web3)
|
||||||
Logger.log('Web3 created.', 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())
|
const networkId = web3 && (await web3.eth.net.getId())
|
||||||
setNetworkId(networkId)
|
setNetworkId(networkId)
|
||||||
Logger.log('network id ', networkId)
|
Logger.log('network id ', networkId)
|
||||||
@ -177,7 +171,6 @@ function OceanProvider({
|
|||||||
account,
|
account,
|
||||||
accountId,
|
accountId,
|
||||||
balance,
|
balance,
|
||||||
chainId,
|
|
||||||
networkId,
|
networkId,
|
||||||
status,
|
status,
|
||||||
config,
|
config,
|
||||||
|
Loading…
Reference in New Issue
Block a user