From a4d38ca02dbda259c6dd9ce52962d7a4cc17922f Mon Sep 17 00:00:00 2001 From: koutst Date: Mon, 9 Dec 2024 16:12:34 -0500 Subject: [PATCH 1/2] Fix staging deposit web3 modal --- config/utils/env.ts | 4 ++++ pages/Base.js | 21 +++++---------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/config/utils/env.ts b/config/utils/env.ts index 48eb93946f..495f0fd7c2 100644 --- a/config/utils/env.ts +++ b/config/utils/env.ts @@ -11,3 +11,7 @@ export const getCurrServerEnv = (): ENV => { export const isDevEnv = (): boolean => { return getCurrServerEnv() === "development"; }; + +export const isProduction = (): boolean => { + return getCurrServerEnv() === "production"; +}; diff --git a/pages/Base.js b/pages/Base.js index a6b4dc1129..f300730e1c 100644 --- a/pages/Base.js +++ b/pages/Base.js @@ -2,7 +2,7 @@ import { AuthActions } from "../redux/auth"; import { createContext, useEffect, useState } from "react"; import { connect } from "react-redux"; import { HubActions } from "../redux/hub"; -import { isDevEnv } from "~/config/utils/env"; +import { isDevEnv, isProduction } from "~/config/utils/env"; import { NewPostButtonContext } from "~/components/contexts/NewPostButtonContext.ts"; import { NavigationContextProvider } from "~/components/contexts/NavigationContext"; import { SavedCitationsContextProvider } from "~/components/contexts/SavedCitationsContext"; @@ -24,7 +24,7 @@ import OrganizationContextProvider from "~/components/contexts/OrganizationConte import CustomHead from "../components/Head"; import { WagmiConfig, createConfig, configureChains } from "wagmi"; import { createPublicClient, http } from "viem"; -import { mainnet } from "wagmi/chains"; +import { mainnet, sepolia } from "wagmi/chains"; import { EthereumClient, w3mConnectors, @@ -51,7 +51,7 @@ LEFT_SIDEBAR_MIN_WIDTH; const projectId = "a3e8904e258fe256bf772b764d3acfab"; const { chains, publicClient, webSocketPublicClient } = configureChains( - [mainnet], + [isProduction ? mainnet : sepolia], [ w3mProvider({ projectId }), infuraProvider({ @@ -64,6 +64,7 @@ const { chains, publicClient, webSocketPublicClient } = configureChains( const config = createConfig({ autoConnect: true, connectors: [ + ...w3mConnectors({ projectId, chains }), new MetaMaskConnector({ chains }), new CoinbaseWalletConnector({ chains, @@ -84,13 +85,6 @@ const config = createConfig({ shimDisconnect: true, }, }), - new InjectedConnector({ - chains, - options: { - name: "Injected", - shimDisconnect: true, - }, - }), ], publicClient, webSocketPublicClient, @@ -106,12 +100,7 @@ const DynamicAlertTemplate = dynamic(() => const DynamicNavbar = dynamic(() => import("~/components/Navbar")); export const NavbarContext = createContext(); -const wagmiConfig = createConfig({ - autoConnect: true, - connectors: w3mConnectors({ projectId, chains }), - publicClient, -}); -const ethereumClient = new EthereumClient(wagmiConfig, chains); +const ethereumClient = new EthereumClient(config, chains); function Base({ auth, From b78a8be64e25e2a91a760046b5a55c13727236b4 Mon Sep 17 00:00:00 2001 From: koutst Date: Tue, 10 Dec 2024 10:10:03 -0500 Subject: [PATCH 2/2] Fix isProduction call --- pages/Base.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/Base.js b/pages/Base.js index f300730e1c..57bdcc7ed8 100644 --- a/pages/Base.js +++ b/pages/Base.js @@ -51,7 +51,7 @@ LEFT_SIDEBAR_MIN_WIDTH; const projectId = "a3e8904e258fe256bf772b764d3acfab"; const { chains, publicClient, webSocketPublicClient } = configureChains( - [isProduction ? mainnet : sepolia], + [isProduction() ? mainnet : sepolia], [ w3mProvider({ projectId }), infuraProvider({