1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-14 17:24:51 +01:00
This commit is contained in:
Matthias Kretschmann 2020-08-11 08:44:31 +02:00
parent 8316a1ab8b
commit 148f11fc4f
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 11 additions and 19 deletions

View File

@ -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: {

View File

@ -1,16 +1,8 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import { OceanProvider } from '@oceanprotocol/react' import { OceanProvider } from '@oceanprotocol/react'
import { ConfigHelper } from '@oceanprotocol/lib' import { web3ModalOpts, getOceanConfig } from '../utils/wallet'
import { web3ModalOpts } from '../utils/wallet'
import { network } from '../../app.config' import { network } from '../../app.config'
function getOceanConfig(network: string) {
return new ConfigHelper().getConfig(
network,
process.env.GATSBY_INFURA_PROJECT_ID
)
}
export default function wrapRootElement({ export default function wrapRootElement({
element element
}: { }: {
@ -18,15 +10,9 @@ export default function wrapRootElement({
}): ReactElement { }): ReactElement {
const oceanInitialConfig = getOceanConfig(network) const oceanInitialConfig = getOceanConfig(network)
async function handleNetworkChanged(chainId: number) {
const config = getOceanConfig(chainId)
connect(config)
}
return ( return (
<OceanProvider <OceanProvider
initialConfig={oceanInitialConfig} initialConfig={oceanInitialConfig}
handleNetworkChanged={handleNetworkChanged}
web3ModalOpts={web3ModalOpts} web3ModalOpts={web3ModalOpts}
> >
{element} {element}

View File

@ -1,7 +1,13 @@
import loadable from '@loadable/component' import loadable from '@loadable/component'
import { appConfig } from '../../app.config' import { infuraProjectId, network } from '../../app.config'
import { ConfigHelper } from '@oceanprotocol/lib'
const { infuraProjectId, network, oceanConfig } = appConfig export function getOceanConfig(network: string): ConfigHelper {
return new ConfigHelper().getConfig(
network,
process.env.GATSBY_INFURA_PROJECT_ID
)
}
const web3ModalTheme = { const web3ModalTheme = {
background: 'var(--brand-white)', background: 'var(--brand-white)',
@ -27,7 +33,7 @@ const providerOptions = {
package: Torus, package: Torus,
options: { options: {
networkParams: { networkParams: {
host: oceanConfig.url // optional // host: oceanConfig.url // optional
// chainId: 1337, // optional // chainId: 1337, // optional
// networkId: 1337 // optional // networkId: 1337 // optional
} }