From a0e4b21c330143301b41ecfc1fea13cee36ca6e3 Mon Sep 17 00:00:00 2001 From: Julian Early Date: Fri, 3 May 2024 14:08:07 -0700 Subject: [PATCH] fix: wagmi update no longer breaks localhost --- src/common/ui/templates/rainboxkit/index.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/common/ui/templates/rainboxkit/index.tsx b/src/common/ui/templates/rainboxkit/index.tsx index f81b8925..0c3b9c45 100644 --- a/src/common/ui/templates/rainboxkit/index.tsx +++ b/src/common/ui/templates/rainboxkit/index.tsx @@ -2,7 +2,8 @@ import "@rainbow-me/rainbowkit/styles.css"; import { getDefaultConfig, midnightTheme } from "@rainbow-me/rainbowkit"; import { optimism, mainnet } from "@wagmi/core/chains"; import { http, createConfig } from "@wagmi/core"; -import { createPublicClient } from "viem"; +import { Chain, Transport, createPublicClient } from "viem"; +import { CreateConfigParameters } from "wagmi"; const optimismHttp = http( `https://opt-mainnet.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_API_KEY}` @@ -12,13 +13,15 @@ const mainnetHttp = http( `https://eth-mainnet.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_API_KEY}` ); -export const wagmiConfig = createConfig({ +const wagmiParams: CreateConfigParameters> = { chains: [optimism, mainnet], transports: { [optimism.id]: optimismHttp, [mainnet.id]: mainnetHttp, }, -}); +}; + +export const wagmiConfig = createConfig(wagmiParams); export const publicClient = createPublicClient({ chain: optimism, @@ -26,10 +29,10 @@ export const publicClient = createPublicClient({ }); export const config = getDefaultConfig({ + ...wagmiParams, appName: process.env.NEXT_PUBLIC_APP_NAME!, projectId: process.env.NEXT_PUBLIC_WALLET_CONNECT_ID!, ssr: true, - ...wagmiConfig, }); export const rainbowKitTheme = midnightTheme({