Skip to content

Commit

Permalink
fix: wagmi update no longer breaks localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
hiporox committed May 3, 2024
1 parent eea8b07 commit a0e4b21
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/common/ui/templates/rainboxkit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
Expand All @@ -12,24 +13,26 @@ const mainnetHttp = http(
`https://eth-mainnet.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_API_KEY}`
);

export const wagmiConfig = createConfig({
const wagmiParams: CreateConfigParameters<readonly [Chain, ...Chain[]], Record<number, Transport>> = {
chains: [optimism, mainnet],
transports: {
[optimism.id]: optimismHttp,
[mainnet.id]: mainnetHttp,
},
});
};

export const wagmiConfig = createConfig(wagmiParams);

export const publicClient = createPublicClient({
chain: optimism,
transport: optimismHttp,
});

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({
Expand Down

0 comments on commit a0e4b21

Please sign in to comment.