diff --git a/contexts/wagmi-provider.tsx b/contexts/wagmi-provider.tsx index 3875a36935..c90b44ae14 100644 --- a/contexts/wagmi-provider.tsx +++ b/contexts/wagmi-provider.tsx @@ -4,7 +4,7 @@ import {getDefaultConfig} from "@rainbow-me/rainbowkit"; import getConfig from "next/config"; import {parseCookies} from "nookies"; import {defineChain} from "viem"; -import {aurora, auroraTestnet, mainnet, moonbeam, polygon, polygonAmoy, polygonMumbai} from "viem/chains"; +import {aurora, auroraTestnet, mainnet, moonbeam, polygon, polygonAmoy, polygonMumbai, localhost} from "viem/chains"; import {cookieStorage, cookieToInitialState, createStorage, WagmiProvider} from "wagmi"; interface WagmiProps { @@ -30,18 +30,31 @@ const coinEx = defineChain({ } }); +const ganache = defineChain({ + ...localhost, + blockExplorers: { + default: { + name: "Local", + url: "http://127.0.0.1:8545", + } + } +}); + const config = getDefaultConfig({ appName: "BEPRO", projectId: publicRuntimeConfig?.walletConnectProjectId || "bc2288336095f20ebf8653a1ab670566", chains: [ polygon, - polygonAmoy, - polygonMumbai, aurora, - auroraTestnet, moonbeam, coinEx, mainnet, + polygonAmoy, + polygonMumbai, + auroraTestnet, + ... (publicRuntimeConfig?.isProduction ? [] : [ + ganache, + ]) ], ssr: true, storage: createStorage({ diff --git a/next.config.js b/next.config.js index 123704766f..030d53cfb2 100644 --- a/next.config.js +++ b/next.config.js @@ -32,7 +32,7 @@ const publicRuntimeConfig = { }, walletConnectProjectId: process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID, defaultChain: { - id: process.env.NEXT_PUBLIC_NEEDS_CHAIN_ID, + id: +process.env.NEXT_PUBLIC_NEEDS_CHAIN_ID || 137, name: process.env.NEXT_PUBLIC_NEEDS_CHAIN_NAME, nativeToken: process.env.NEXT_PUBLIC_NATIVE_TOKEN_NAME, blockscan: process.env.NEXT_PUBLIC_BLOCKSCAN_LINK, diff --git a/pages/_app.tsx b/pages/_app.tsx index f58a425313..8c754f592a 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -8,7 +8,6 @@ import {appWithTranslation} from "next-i18next"; import getConfig from "next/config"; import {useRouter} from "next/router"; import {GoogleAnalytics} from "nextjs-google-analytics"; -import {polygon} from "viem/chains"; import ConsentCookie from "components/consent-cokie"; import Loading from "components/loading"; @@ -43,7 +42,7 @@ function App({ Component, pageProps: { session, seoData, ...pageProps } }) { - +