forked from 0xverin/Nextjs-Wagmi-Template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwagmi.ts
33 lines (29 loc) · 1.05 KB
/
wagmi.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { connectorsForWallets } from "@rainbow-me/rainbowkit";
import { injectedWallet, rainbowWallet, walletConnectWallet, metaMaskWallet } from "@rainbow-me/rainbowkit/wallets";
import { configureChains, createConfig } from "wagmi";
import { mainnet, goerli, bscTestnet } from "wagmi/chains";
import { alchemyProvider } from "wagmi/providers/alchemy";
import { publicProvider } from "wagmi/providers/public";
import { env } from "./env";
import "wagmi/window";
const projectId = env.projectId;
export const { chains, publicClient, webSocketPublicClient } = configureChains(
[mainnet, goerli, bscTestnet],
[alchemyProvider({ apiKey: process.env.NEXT_PUBLIC_ALCHEMY_ID }), publicProvider()]
);
const connectors = connectorsForWallets([
{
groupName: "Popular",
wallets: [
injectedWallet({ chains }),
metaMaskWallet({ projectId, chains }),
rainbowWallet({ projectId, chains }),
walletConnectWallet({ projectId, chains }),
],
},
]);
export const wagmiClient = createConfig({
autoConnect: true,
connectors,
publicClient,
});