1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

metadataStore → metadataCache, package updates

This commit is contained in:
Matthias Kretschmann 2020-10-13 17:05:57 +02:00
parent aeb26b89c5
commit 93179c8c37
Signed by: m
GPG Key ID: 606EEEF3C479A91F
13 changed files with 353 additions and 331 deletions

View File

@ -2,5 +2,5 @@
GATSBY_NETWORK="rinkeby"
#GATSBY_INFURA_PROJECT_ID="xxx"
#GATSBY_METADATA_STORE_URI="xxx"
#GATSBY_METADATA_CACHE_URI="xxx"
#GATSBY_MARKET_FEE_ADDRESS="0xxx"

View File

@ -1,7 +1,7 @@
module.exports = {
network: process.env.GATSBY_NETWORK || 'rinkeby',
infuraProjectId: process.env.GATSBY_INFURA_PROJECT_ID || 'xxx',
metadataStoreUri: process.env.GATSBY_METADATA_STORE_URI,
metadataCacheUri: process.env.GATSBY_METADATA_CACHE_URI,
// The ETH address the marketplace fee will be sent to.
marketFeeAddress:
process.env.GATSBY_MARKET_FEE_ADDRESS ||

586
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -22,15 +22,15 @@
"@coingecko/cryptoformat": "^0.4.2",
"@loadable/component": "5.13.1",
"@oceanprotocol/art": "^3.0.0",
"@oceanprotocol/lib": "^0.5.6",
"@oceanprotocol/react": "^0.1.4",
"@oceanprotocol/lib": "^0.6.0",
"@oceanprotocol/react": "^0.2.0",
"@oceanprotocol/typographies": "^0.1.0",
"@sindresorhus/slugify": "^1.0.0",
"@tippyjs/react": "^4.2.0",
"@toruslabs/torus-embed": "^1.8.5",
"@toruslabs/torus-embed": "^1.8.6",
"@types/classnames": "^2.2.10",
"@vercel/node": "^1.8.4",
"@walletconnect/web3-provider": "^1.3.0",
"@walletconnect/web3-provider": "^1.3.1",
"axios": "^0.20.0",
"classnames": "^2.2.6",
"date-fns": "^2.16.1",
@ -40,12 +40,12 @@
"ethereum-blockies": "github:MyEtherWallet/blockies",
"filesize": "^6.1.0",
"formik": "^2.2.0",
"gatsby": "^2.24.73",
"gatsby": "^2.24.76",
"gatsby-image": "^2.4.21",
"gatsby-plugin-manifest": "^2.4.34",
"gatsby-plugin-react-helmet": "^3.3.14",
"gatsby-plugin-remove-trailing-slashes": "^2.3.13",
"gatsby-plugin-sharp": "^2.6.40",
"gatsby-plugin-sharp": "^2.6.42",
"gatsby-plugin-svgr": "^2.0.2",
"gatsby-plugin-webpack-size": "^1.0.0",
"gatsby-source-filesystem": "^2.3.34",
@ -60,7 +60,7 @@
"query-string": "^6.13.5",
"react": "^16.13.1",
"react-data-table-component": "^6.11.5",
"react-datepicker": "^3.2.2",
"react-datepicker": "^3.3.0",
"react-dom": "^16.13.1",
"react-dotdotdot": "^1.3.1",
"react-dropzone": "^11.2.0",
@ -91,7 +91,7 @@
"@types/lodash.debounce": "^4.0.3",
"@types/lodash.omit": "^4.5.6",
"@types/node": "^14.11.8",
"@types/react": "^16.9.51",
"@types/react": "^16.9.52",
"@types/react-datepicker": "^3.1.1",
"@types/react-helmet": "^6.1.0",
"@types/react-paginate": "^6.2.1",
@ -99,18 +99,18 @@
"@types/remove-markdown": "^0.1.1",
"@types/shortid": "0.0.29",
"@types/yup": "^0.29.8",
"@typescript-eslint/eslint-plugin": "^4.4.0",
"@typescript-eslint/parser": "^4.4.0",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.1",
"babel-loader": "^8.1.0",
"babel-preset-react-app": "^9.1.2",
"eslint": "^7.10.0",
"eslint": "^7.11.0",
"eslint-config-oceanprotocol": "^1.5.0",
"eslint-config-prettier": "^6.12.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.21.3",
"eslint-plugin-react": "^7.21.4",
"eslint-plugin-react-hooks": "^4.1.2",
"identity-obj-proxy": "^3.0.0",
"jest": "^26.5.2",
"jest": "^26.5.3",
"prettier": "^2.1.2",
"serve": "^11.3.2",
"source-map-explorer": "^2.5.0",

View File

@ -1,6 +1,6 @@
import AssetTeaser from '../molecules/AssetTeaser'
import React from 'react'
import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatastore/MetadataStore'
import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatacache/MetadataCache'
import { useLocation, useNavigate } from '@reach/router'
import Pagination from '../molecules/Pagination'
import { updateQueryStringParameter } from '../../utils'
@ -57,7 +57,7 @@ const AssetList: React.FC<AssetListProps> = ({ queryResult }) => {
})
) : (
<div className={styles.empty}>
No results found in {config.metadataStoreUri}
No results found in {config.metadataCacheUri}
</div>
)}
</div>

View File

@ -1,5 +1,5 @@
import { Logger } from '@oceanprotocol/lib'
import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatastore/MetadataStore'
import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatacache/MetadataCache'
import { useOcean } from '@oceanprotocol/react'
import React, { ReactElement, useEffect, useState } from 'react'
import Loader from '../../atoms/Loader'

View File

@ -1,12 +1,12 @@
import React, { ReactElement, useEffect, useState } from 'react'
import SearchBar from '../molecules/SearchBar'
import styles from './Home.module.css'
import { MetadataStore, Logger } from '@oceanprotocol/lib'
import { MetadataCache, Logger } from '@oceanprotocol/lib'
import AssetList from '../organisms/AssetList'
import {
QueryResult,
SearchQuery
} from '@oceanprotocol/lib/dist/node/metadatastore/MetadataStore'
} from '@oceanprotocol/lib/dist/node/metadatacache/MetadataCache'
import Container from '../atoms/Container'
import Loader from '../atoms/Loader'
import { useOcean } from '@oceanprotocol/react'
@ -25,10 +25,10 @@ const queryLatest = {
sort: { created: -1 }
}
async function getAssets(query: SearchQuery, metadataStoreUri: string) {
async function getAssets(query: SearchQuery, metadataCacheUri: string) {
try {
const metadataStore = new MetadataStore(metadataStoreUri, Logger)
const result = await metadataStore.queryMetadata(query)
const metadataCache = new MetadataCache(metadataCacheUri, Logger)
const result = await metadataCache.queryMetadata(query)
return result
} catch (error) {
@ -46,19 +46,19 @@ export default function HomePage(): ReactElement {
async function init() {
const queryResultHighest = await getAssets(
queryHighest,
config.metadataStoreUri
config.metadataCacheUri
)
setQueryResultHighest(queryResultHighest)
const queryResultLatest = await getAssets(
queryLatest,
config.metadataStoreUri
config.metadataCacheUri
)
setQueryResultLatest(queryResultLatest)
setLoading(false)
}
init()
}, [config.metadataStoreUri])
}, [config.metadataCacheUri])
return (
<>

View File

@ -3,7 +3,7 @@ import { Router } from '@reach/router'
import AssetContent from '../../components/organisms/AssetContent'
import Layout from '../../components/Layout'
import { MetadataMarket } from '../../@types/MetaData'
import { MetadataStore, Logger, DDO } from '@oceanprotocol/lib'
import { MetadataCache, Logger, DDO } from '@oceanprotocol/lib'
import Alert from '../../components/atoms/Alert'
import Loader from '../../components/atoms/Loader'
import { useOcean } from '@oceanprotocol/react'
@ -24,12 +24,12 @@ export default function PageTemplateAssetDetails({
useEffect(() => {
async function init() {
try {
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)
if (!ddo) {
setTitle('Could not retrieve asset')
setError('The DDO was not found in MetadataStore.')
setError('The DDO was not found in MetadataCache.')
return
}
@ -44,7 +44,7 @@ export default function PageTemplateAssetDetails({
}
}
init()
}, [did, config.metadataStoreUri])
}, [did, config.metadataCacheUri])
return did && metadata ? (
<Layout title={title} uri={uri}>

View File

@ -1,5 +1,5 @@
import React, { ReactElement, useState, useEffect } from 'react'
import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatastore/MetadataStore'
import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatacache/MetadataCache'
import SearchBar from '../../molecules/SearchBar'
import AssetList from '../../organisms/AssetList'
import styles from './index.module.css'
@ -28,12 +28,12 @@ export default function SearchPage({
useEffect(() => {
async function initSearch() {
setLoading(true)
const queryResult = await getResults(parsed, config.metadataStoreUri)
const queryResult = await getResults(parsed, config.metadataCacheUri)
setQueryResult(queryResult)
setLoading(false)
}
initSearch()
}, [text, tag, page, config.metadataStoreUri])
}, [text, tag, page, config.metadataCacheUri])
return (
<section className={styles.grid}>

View File

@ -1,8 +1,8 @@
import {
SearchQuery,
QueryResult
} from '@oceanprotocol/lib/dist/node/metadatastore/MetadataStore'
import { MetadataStore, Logger } from '@oceanprotocol/lib'
} from '@oceanprotocol/lib/dist/node/metadatacache/MetadataCache'
import { MetadataCache, Logger } from '@oceanprotocol/lib'
export function getSearchQuery(
page?: string | string[],
@ -30,12 +30,12 @@ export function getSearchQuery(
export async function getResults(
params: { text?: string; tag?: string; page?: string; offset?: string },
metadataStoreUri: string
metadataCacheUri: string
): Promise<QueryResult> {
const { text, tag, page, offset } = params
const metadataStore = new MetadataStore(metadataStoreUri, Logger)
const queryResult = await metadataStore.queryMetadata(
const metadataCache = new MetadataCache(metadataCacheUri, Logger)
const queryResult = await metadataCache.queryMetadata(
getSearchQuery(page, offset, text, tag)
)

View File

@ -5,7 +5,7 @@ import appConfig from '../../app.config'
import { Logger } from '@oceanprotocol/lib'
export function NetworkMonitor(): ReactElement {
const { metadataStoreUri } = appConfig
const { metadataCacheUri } = appConfig
const { connect, web3Provider } = useOcean()
useEffect(() => {
@ -16,8 +16,8 @@ export function NetworkMonitor(): ReactElement {
const newConfig = {
...initialConfig,
// add metadataStoreUri only when defined
...(metadataStoreUri && { metadataStoreUri })
// add metadataCacheUri only when defined
...(metadataCacheUri && { metadataCacheUri })
}
try {
@ -32,7 +32,7 @@ export function NetworkMonitor(): ReactElement {
return () => {
web3Provider.removeListener('chainChanged', handleNetworkChanged)
}
}, [web3Provider, connect, metadataStoreUri])
}, [web3Provider, connect, metadataCacheUri])
return <></>
}

View File

@ -24,13 +24,13 @@ export default function wrapRootElement({
}: {
element: ReactElement
}): ReactElement {
const { metadataStoreUri, network } = appConfig
const { metadataCacheUri, network } = appConfig
const oceanInitialConfig = getOceanConfig(network)
const initialConfig = {
...oceanInitialConfig,
// add metadataStoreUri only when defined
...(metadataStoreUri && { metadataStoreUri })
// add metadataCacheUri only when defined
...(metadataCacheUri && { metadataCacheUri })
}
return (

View File

@ -1,6 +1,6 @@
import ddo from '../../__fixtures__/ddo'
const metadataStore = {
const metadataCache = {
queryMetadata: () => {
return {
results: [] as any[],
@ -11,13 +11,13 @@ const metadataStore = {
}
const libMock = {
MetadataStore: () => metadataStore,
MetadataStore: () => metadataCache,
DDO: () => ddo,
ocean: {
accounts: {
list: () => ['xxx', 'xxx']
},
metadataStore,
metadataCache,
// compute: {
// status: (account: string) => {
// return [job]