Skip to content
This repository has been archived by the owner on Aug 3, 2021. It is now read-only.

Commit

Permalink
metadataStore → metadataCache
Browse files Browse the repository at this point in the history
  • Loading branch information
kremalicious committed Oct 13, 2020
1 parent 28abbc8 commit 1674ce2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 19 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
[![npm](https://img.shields.io/npm/v/@oceanprotocol/react.svg)](https://www.npmjs.com/package/@oceanprotocol/react)
[![Build Status](https://travis-ci.com/oceanprotocol/react.svg?token=3psqw6c8KMDqfdGQ2x6d&branch=main)](https://travis-ci.com/oceanprotocol/react)
Expand Down Expand Up @@ -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'

Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions src/hooks/useMetadata/useMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Metadata,
Logger,
BestPrice,
MetadataStore
MetadataCache
} from '@oceanprotocol/lib'
import { useOcean } from 'providers'
import { getBestDataTokenPrice } from 'utils/dtUtils'
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/providers/OceanProvider/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand Down

0 comments on commit 1674ce2

Please sign in to comment.