diff --git a/src/helpers/wrapRootElement.tsx b/src/helpers/wrapRootElement.tsx index bd53ab979..4dcbe930d 100644 --- a/src/helpers/wrapRootElement.tsx +++ b/src/helpers/wrapRootElement.tsx @@ -1,14 +1,23 @@ import React, { ReactElement } from 'react' import { OceanProvider } from '@oceanprotocol/react' -import { web3ModalOpts, getOceanConfig } from '../utils/wallet' -import { network } from '../../app.config' +import { ConfigHelper } from '@oceanprotocol/lib' +import { web3ModalOpts } from '../utils/wallet' +import { useSiteMetadata } from '../hooks/useSiteMetadata' + +function getOceanConfig(network: string): ConfigHelper { + return new ConfigHelper().getConfig( + network, + process.env.GATSBY_INFURA_PROJECT_ID + ) +} export default function wrapRootElement({ element }: { element: ReactElement }): ReactElement { - const oceanInitialConfig = getOceanConfig(network) + const { appConfig } = useSiteMetadata() + const oceanInitialConfig = getOceanConfig(appConfig.network) return (