mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
more config refactor
This commit is contained in:
parent
e9f39be9c3
commit
bf0375f58f
@ -1,13 +1,15 @@
|
|||||||
const { ConfigHelper } = require('@oceanprotocol/lib')
|
const { ConfigHelper } = require('@oceanprotocol/lib')
|
||||||
|
|
||||||
const oceanConfig = new ConfigHelper().getConfig(
|
function getDefaultOceanConfig() {
|
||||||
process.env.GATSBY_NETWORK || 'rinkeby'
|
return new ConfigHelper().getConfig(
|
||||||
|
process.env.GATSBY_NETWORK || 'rinkeby',
|
||||||
|
process.env.GATSBY_INFURA_PROJECT_ID
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
const appConfig = {
|
||||||
oceanConfig: {
|
oceanConfig: {
|
||||||
...oceanConfig,
|
...getDefaultOceanConfig(),
|
||||||
url: `https://rinkeby.infura.io/${process.env.GATSBY_INFURA_PROJECT_ID}`,
|
|
||||||
verbose: 3
|
verbose: 3
|
||||||
},
|
},
|
||||||
// Main, Rinkeby, Kovan
|
// Main, Rinkeby, Kovan
|
||||||
@ -15,3 +17,8 @@ module.exports = {
|
|||||||
networks: [4],
|
networks: [4],
|
||||||
infuraProjectId: process.env.GATSBY_INFURA_PROJECT_ID || 'xxx'
|
infuraProjectId: process.env.GATSBY_INFURA_PROJECT_ID || 'xxx'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
getDefaultOceanConfig,
|
||||||
|
appConfig
|
||||||
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require('dotenv').config()
|
require('dotenv').config()
|
||||||
|
|
||||||
const siteContent = require('./content/site.json')
|
const siteContent = require('./content/site.json')
|
||||||
const appConfig = require('./app.config')
|
const { appConfig } = require('./app.config')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
siteMetadata: {
|
siteMetadata: {
|
||||||
|
12
package-lock.json
generated
12
package-lock.json
generated
@ -3745,14 +3745,14 @@
|
|||||||
"integrity": "sha512-j4PEZSVtKSqxDYMVh/hd5vk088Bg6a6QkrUMTXN9Q6OIFAMfHM235f1AxaakNrEyK0FKMD908KuJEdfFLRn9Hw=="
|
"integrity": "sha512-j4PEZSVtKSqxDYMVh/hd5vk088Bg6a6QkrUMTXN9Q6OIFAMfHM235f1AxaakNrEyK0FKMD908KuJEdfFLRn9Hw=="
|
||||||
},
|
},
|
||||||
"@oceanprotocol/contracts": {
|
"@oceanprotocol/contracts": {
|
||||||
"version": "0.3.1",
|
"version": "0.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-0.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-0.3.3.tgz",
|
||||||
"integrity": "sha512-LaOPxTID+iMRaUYneAOyG6jQQL8Gz9XA0jEqXvhJOqB/WL2zySL2StXpXPpMxzFq6APdpbnQ70s4jBgVChBN2w=="
|
"integrity": "sha512-ZQ5RHQWp6xkmATt7Sl12LhnH4dovewgKPX1gGeZoDSyFcmpjMDngtJpDns8jMsaclU61tPScw7K/EmxS1ydiCg=="
|
||||||
},
|
},
|
||||||
"@oceanprotocol/lib": {
|
"@oceanprotocol/lib": {
|
||||||
"version": "0.1.8",
|
"version": "0.1.9",
|
||||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.1.8.tgz",
|
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.1.9.tgz",
|
||||||
"integrity": "sha512-qYaOpPzziMP7dMKEMEchqkB8bZHc/CQy2wR7DLP4X/ke28Z1RNYPgrPOo3by7DMEPbHwzqkpAqMoBlrdNh+MqA==",
|
"integrity": "sha512-o4qjpoPm5s3NutNfwAV3ALPjAzvWknn6p/aI+GGH2ZtDkDE9zx0k+TqaWCsMaM/3e5v23eCof517y4Hd459EZg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@ethereum-navigator/navigator": "^0.5.0",
|
"@ethereum-navigator/navigator": "^0.5.0",
|
||||||
"@oceanprotocol/contracts": "^0.3.1",
|
"@oceanprotocol/contracts": "^0.3.1",
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@loadable/component": "^5.13.1",
|
"@loadable/component": "^5.13.1",
|
||||||
"@oceanprotocol/art": "^3.0.0",
|
"@oceanprotocol/art": "^3.0.0",
|
||||||
|
"@oceanprotocol/lib": "^0.1.9",
|
||||||
"@oceanprotocol/react": "^0.0.27",
|
"@oceanprotocol/react": "^0.0.27",
|
||||||
"@oceanprotocol/typographies": "^0.1.0",
|
"@oceanprotocol/typographies": "^0.1.0",
|
||||||
"@sindresorhus/slugify": "^1.0.0",
|
"@sindresorhus/slugify": "^1.0.0",
|
||||||
|
@ -7,7 +7,7 @@ import { updateQueryStringParameter } from '../../utils'
|
|||||||
import styles from './AssetList.module.css'
|
import styles from './AssetList.module.css'
|
||||||
import { MetadataMarket } from '../../@types/Metadata'
|
import { MetadataMarket } from '../../@types/Metadata'
|
||||||
import { DDO } from '@oceanprotocol/lib'
|
import { DDO } from '@oceanprotocol/lib'
|
||||||
import { getOceanConfig } from '../../utils/getConfig'
|
import { getDefaultOceanConfig } from '../../../app.config'
|
||||||
|
|
||||||
declare type AssetListProps = {
|
declare type AssetListProps = {
|
||||||
queryResult: QueryResult
|
queryResult: QueryResult
|
||||||
@ -17,7 +17,7 @@ const AssetList: React.FC<AssetListProps> = ({ queryResult }) => {
|
|||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
|
||||||
const { metadataStoreUri } = getOceanConfig()
|
const { metadataStoreUri } = getDefaultOceanConfig()
|
||||||
|
|
||||||
// Construct the urls on the pagination links. This is only for UX,
|
// Construct the urls on the pagination links. This is only for UX,
|
||||||
// since the links are no <Link> they will not work by itself.
|
// since the links are no <Link> they will not work by itself.
|
||||||
|
@ -6,11 +6,11 @@ import AssetList from '../organisms/AssetList'
|
|||||||
import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatastore/MetadataStore'
|
import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatastore/MetadataStore'
|
||||||
import Container from '../atoms/Container'
|
import Container from '../atoms/Container'
|
||||||
import Loader from '../atoms/Loader'
|
import Loader from '../atoms/Loader'
|
||||||
import { getOceanConfig } from '../../utils/getConfig'
|
import { getDefaultOceanConfig } from '../../../app.config'
|
||||||
|
|
||||||
async function getLatestAssets() {
|
async function getLatestAssets() {
|
||||||
try {
|
try {
|
||||||
const { metadataStoreUri } = getOceanConfig()
|
const { metadataStoreUri } = getDefaultOceanConfig()
|
||||||
const metadataStore = new MetadataStore(metadataStoreUri, Logger)
|
const metadataStore = new MetadataStore(metadataStoreUri, Logger)
|
||||||
|
|
||||||
const result = await metadataStore.queryMetadata({
|
const result = await metadataStore.queryMetadata({
|
||||||
|
@ -6,7 +6,7 @@ import { MetadataMarket, ServiceMetadataMarket } from '../../@types/Metadata'
|
|||||||
import { MetadataStore, Logger, DDO } from '@oceanprotocol/lib'
|
import { MetadataStore, Logger, DDO } from '@oceanprotocol/lib'
|
||||||
import Alert from '../../components/atoms/Alert'
|
import Alert from '../../components/atoms/Alert'
|
||||||
import Loader from '../../components/atoms/Loader'
|
import Loader from '../../components/atoms/Loader'
|
||||||
import { getOceanConfig } from '../../utils/getConfig'
|
import { getDefaultOceanConfig } from '../../../app.config'
|
||||||
|
|
||||||
export default function PageTemplateAssetDetails({
|
export default function PageTemplateAssetDetails({
|
||||||
did,
|
did,
|
||||||
@ -23,7 +23,7 @@ export default function PageTemplateAssetDetails({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function init() {
|
async function init() {
|
||||||
try {
|
try {
|
||||||
const { metadataStoreUri } = getOceanConfig()
|
const { metadataStoreUri } = getDefaultOceanConfig()
|
||||||
const metadataStore = new MetadataStore(metadataStoreUri, Logger)
|
const metadataStore = new MetadataStore(metadataStoreUri, Logger)
|
||||||
const ddo = await metadataStore.retrieveDDO(did)
|
const ddo = await metadataStore.retrieveDDO(did)
|
||||||
setDdo(ddo)
|
setDdo(ddo)
|
||||||
|
@ -4,7 +4,7 @@ import {
|
|||||||
} from '@oceanprotocol/lib/dist/node/metadatastore/MetadataStore'
|
} from '@oceanprotocol/lib/dist/node/metadatastore/MetadataStore'
|
||||||
import { priceQueryParamToWei } from '../../../utils'
|
import { priceQueryParamToWei } from '../../../utils'
|
||||||
import { MetadataStore, Logger } from '@oceanprotocol/lib'
|
import { MetadataStore, Logger } from '@oceanprotocol/lib'
|
||||||
import { getOceanConfig } from '../../../utils/getConfig'
|
import { getDefaultOceanConfig } from '../../../../app.config'
|
||||||
|
|
||||||
export function getSearchQuery(
|
export function getSearchQuery(
|
||||||
page?: string | string[],
|
page?: string | string[],
|
||||||
@ -52,7 +52,7 @@ export async function getResults(params: any): Promise<QueryResult> {
|
|||||||
])
|
])
|
||||||
: undefined
|
: undefined
|
||||||
|
|
||||||
const { metadataStoreUri } = getOceanConfig()
|
const { metadataStoreUri } = getDefaultOceanConfig()
|
||||||
const metadataStore = new MetadataStore(metadataStoreUri, Logger)
|
const metadataStore = new MetadataStore(metadataStoreUri, Logger)
|
||||||
const queryResult = await metadataStore.queryMetadata(
|
const queryResult = await metadataStore.queryMetadata(
|
||||||
getSearchQuery(page, offset, text, tag, priceQuery)
|
getSearchQuery(page, offset, text, tag, priceQuery)
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import React, { ReactElement } from 'react'
|
import React, { ReactElement } from 'react'
|
||||||
import { OceanProvider } from '@oceanprotocol/react'
|
import { OceanProvider } from '@oceanprotocol/react'
|
||||||
import { oceanConfig } from '../../app.config'
|
import { appConfig } from '../../app.config'
|
||||||
|
|
||||||
const wrapRootElement = ({
|
const wrapRootElement = ({
|
||||||
element
|
element
|
||||||
}: {
|
}: {
|
||||||
element: ReactElement
|
element: ReactElement
|
||||||
}): ReactElement => (
|
}): ReactElement => (
|
||||||
<OceanProvider config={oceanConfig}>{element}</OceanProvider>
|
<OceanProvider config={appConfig.oceanConfig}>{element}</OceanProvider>
|
||||||
)
|
)
|
||||||
|
|
||||||
export default wrapRootElement
|
export default wrapRootElement
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
import { ConfigHelper, Config } from '@oceanprotocol/lib'
|
|
||||||
|
|
||||||
export function getOceanConfig(): Config {
|
|
||||||
return new ConfigHelper().getConfig(process.env.GATSBY_NETWORK || 'rinkeby')
|
|
||||||
}
|
|
@ -1,5 +1,7 @@
|
|||||||
import { OceanProviderValue } from '@oceanprotocol/react'
|
import { OceanProviderValue } from '@oceanprotocol/react'
|
||||||
import { networks, infuraProjectId } from '../../app.config'
|
import { appConfig } from '../../app.config'
|
||||||
|
|
||||||
|
const { infuraProjectId, networks } = appConfig
|
||||||
|
|
||||||
const web3ModalTheme = {
|
const web3ModalTheme = {
|
||||||
background: 'var(--brand-white)',
|
background: 'var(--brand-white)',
|
||||||
|
Loading…
Reference in New Issue
Block a user