|
1 | 1 | import "@rainbow-me/rainbowkit/styles.css";
|
2 | 2 | import { QueryClient } from "@tanstack/react-query";
|
3 |
| -import { Chain as RChain, getDefaultConfig } from "@rainbow-me/rainbowkit"; |
4 | 3 | import { allNetworks, mainnetNetworks } from "common/src/chains";
|
5 | 4 | import { getClient, getConnectorClient } from "@wagmi/core";
|
6 | 5 | import { providers } from "ethers";
|
7 |
| -import { type Account, type Chain, type Client, type Transport } from "viem"; |
| 6 | +import { |
| 7 | + http, |
| 8 | + type Account, |
| 9 | + type Chain, |
| 10 | + type Client, |
| 11 | + type Transport, |
| 12 | +} from "viem"; |
8 | 13 | import { Connector } from "wagmi";
|
9 |
| - |
10 |
| -export const allChains: RChain[] = |
11 |
| - process.env.REACT_APP_ENV === "development" ? allNetworks : mainnetNetworks; |
| 14 | +import { |
| 15 | + rainbowWallet, |
| 16 | + safeWallet, |
| 17 | + walletConnectWallet, |
| 18 | + coinbaseWallet, |
| 19 | +} from "@rainbow-me/rainbowkit/wallets"; |
| 20 | +import { connectorsForWallets } from "@rainbow-me/rainbowkit"; |
12 | 21 |
|
13 | 22 | /* TODO: remove hardcoded value once we have environment variables validation */
|
14 | 23 | const projectId =
|
15 | 24 | process.env.REACT_APP_WALLETCONNECT_PROJECT_ID ??
|
16 | 25 | "2685061cae0bcaf2b244446153eda9e1";
|
| 26 | +const connectors = connectorsForWallets( |
| 27 | + [ |
| 28 | + { |
| 29 | + groupName: "Popular", |
| 30 | + wallets: [safeWallet, rainbowWallet, walletConnectWallet, coinbaseWallet], |
| 31 | + }, |
| 32 | + ], |
| 33 | + { |
| 34 | + appName: "Gitcoin Manager", |
| 35 | + projectId, |
| 36 | + } |
| 37 | +); |
| 38 | +export const allChains: Chain[] = |
| 39 | + process.env.REACT_APP_ENV === "development" ? allNetworks : mainnetNetworks; |
| 40 | + |
| 41 | +import { createConfig } from "wagmi"; |
| 42 | + |
| 43 | +const transports = allChains.reduce( |
| 44 | + (acc, chain) => { |
| 45 | + acc[chain.id] = http(); |
| 46 | + return acc; |
| 47 | + }, |
| 48 | + {} as Record<number, ReturnType<typeof http>> |
| 49 | +); |
17 | 50 |
|
18 |
| -export const config = getDefaultConfig({ |
19 |
| - appName: "Gitcoin Manager", |
20 |
| - projectId, |
21 |
| - chains: [...allChains] as [Chain, ...Chain[]], |
22 |
| - // eslint-disable-next-line @typescript-eslint/no-explicit-any |
23 |
| -}) as any; |
| 51 | +export const config = createConfig({ |
| 52 | + chains: [...allChains] as unknown as readonly [Chain, ...Chain[]], |
| 53 | + connectors, |
| 54 | + transports, |
| 55 | +}); |
24 | 56 |
|
25 | 57 | const queryClient = new QueryClient();
|
26 | 58 |
|
|
0 commit comments