mirror of
https://github.com/oceanprotocol/react.git
synced 2025-02-14 21:10:38 +01:00
metadataStore → metadataCache
This commit is contained in:
parent
28abbc857f
commit
1674ce2acb
@ -2,7 +2,7 @@
|
||||
|
||||
<h1 align="center">react</h1>
|
||||
|
||||
> 🎣 React hooks & components on top of @oceanprotocol/lib
|
||||
> 🎣 React hooks & components on top of ocean.js
|
||||
|
||||
[](https://www.npmjs.com/package/@oceanprotocol/react)
|
||||
[](https://travis-ci.com/oceanprotocol/react)
|
||||
@ -56,7 +56,12 @@ Then within your component use the included hooks to interact with Ocean's funct
|
||||
|
||||
```tsx
|
||||
import React from 'react'
|
||||
import { useOcean, useMetadata, useConsume, usePublish } from '@oceanprotocol/react'
|
||||
import {
|
||||
useOcean,
|
||||
useMetadata,
|
||||
useConsume,
|
||||
usePublish
|
||||
} from '@oceanprotocol/react'
|
||||
|
||||
const did = 'did:op:0x000000000'
|
||||
|
||||
|
20
package-lock.json
generated
20
package-lock.json
generated
@ -1516,17 +1516,17 @@
|
||||
}
|
||||
},
|
||||
"@oceanprotocol/contracts": {
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-0.5.3.tgz",
|
||||
"integrity": "sha512-gJ8qQACJgxOPIrPE0OFQ09iYXBAisOGg56EmelQlsMUgp0yY0DKgBntDP83S/Ho1yBjGygqfxCjQrPH63hh/PA=="
|
||||
"version": "0.5.5",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-0.5.5.tgz",
|
||||
"integrity": "sha512-Omwlh3KxPm2JOuLd6DW4teAQhGaIv0fRTopCvctey0XGsf3DcbJpwS0A0YfgLQnvCyyVMKsiq90YCqpJ3SO/cw=="
|
||||
},
|
||||
"@oceanprotocol/lib": {
|
||||
"version": "0.5.6",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.5.6.tgz",
|
||||
"integrity": "sha512-S8OU/FYjDJCKkx098GDT9LfxmTTe/gA8zv5fVMy7lRG1k5WFDsHHMplqZkU9mUGXg1aDDtt7KbctwxNdt7ZGFg==",
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.6.0.tgz",
|
||||
"integrity": "sha512-5Kv6oVV7nneeVoT79fAQh93Ksb4Zg0TjjbVutMIYDt9kB8/Iwc/5NYU88unaz4XHX5zBl5rqnwfWoZMRDaI7hA==",
|
||||
"requires": {
|
||||
"@ethereum-navigator/navigator": "^0.5.0",
|
||||
"@oceanprotocol/contracts": "^0.5.3",
|
||||
"@oceanprotocol/contracts": "^0.5.5",
|
||||
"decimal.js": "^10.2.0",
|
||||
"fs": "0.0.1-security",
|
||||
"lzma": "^2.3.2",
|
||||
@ -10378,9 +10378,9 @@
|
||||
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
|
||||
},
|
||||
"uuid": {
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz",
|
||||
"integrity": "sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ=="
|
||||
"version": "8.3.1",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.1.tgz",
|
||||
"integrity": "sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg=="
|
||||
},
|
||||
"v8-compile-cache": {
|
||||
"version": "2.1.1",
|
||||
|
@ -25,7 +25,7 @@
|
||||
"dist/"
|
||||
],
|
||||
"dependencies": {
|
||||
"@oceanprotocol/lib": "^0.5.6",
|
||||
"@oceanprotocol/lib": "^0.6.0",
|
||||
"axios": "^0.20.0",
|
||||
"decimal.js": "^10.2.1",
|
||||
"web3": "^1.3.0",
|
||||
|
@ -5,7 +5,7 @@ import {
|
||||
Metadata,
|
||||
Logger,
|
||||
BestPrice,
|
||||
MetadataStore
|
||||
MetadataCache
|
||||
} from '@oceanprotocol/lib'
|
||||
import { useOcean } from 'providers'
|
||||
import { getBestDataTokenPrice } from 'utils/dtUtils'
|
||||
@ -33,13 +33,13 @@ function useMetadata(asset?: DID | string | DDO): UseMetadata {
|
||||
|
||||
const getDDO = useCallback(
|
||||
async (did: DID | string): Promise<DDO | undefined> => {
|
||||
if (!config.metadataStoreUri) return
|
||||
if (!config.metadataCacheUri) return
|
||||
|
||||
const metadataStore = new MetadataStore(config.metadataStoreUri, Logger)
|
||||
const ddo = await metadataStore.retrieveDDO(did)
|
||||
const metadataCache = new MetadataCache(config.metadataCacheUri, Logger)
|
||||
const ddo = await metadataCache.retrieveDDO(did)
|
||||
return ddo
|
||||
},
|
||||
[config.metadataStoreUri]
|
||||
[config.metadataCacheUri]
|
||||
)
|
||||
|
||||
const getPrice = useCallback(
|
||||
|
@ -30,7 +30,7 @@ const oceanDefaultConfig = new ConfigHelper().getConfig(
|
||||
|
||||
const config = {
|
||||
...oceanDefaultConfig,
|
||||
metadataStoreUri: 'https://your-metadata-store.com',
|
||||
metadataCacheUri: 'https://your-metadata-cache.com',
|
||||
providerUri: 'https://your-provider.com'
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user