Skip to content

Commit 92cc519

Browse files
authored
Merge pull request #192 from Proof-Of-Humanity/feat/custom-rpc-support
Enhance withClientConnected to support JSON-RPC provider for dynamic …
2 parents 3e5fb56 + 2232b71 commit 92cc519

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/components/HighOrder/withClientConnected.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,23 @@ import {
44
w3mProvider,
55
} from "@web3modal/ethereum";
66
import { Web3Modal } from "@web3modal/react";
7-
import { supportedChains } from "config/chains";
7+
import { supportedChains, getChainRpc } from "config/chains";
88
import { WagmiConfig, configureChains, createConfig } from "wagmi";
9+
import { jsonRpcProvider } from "wagmi/providers/jsonRpc";
910

1011
const projectId = process.env.WALLET_CONNECT_PROJECT_ID;
1112

12-
const { publicClient } = configureChains(supportedChains as any, [
13-
w3mProvider({ projectId }),
14-
]);
13+
const { publicClient } = configureChains(
14+
supportedChains as any,
15+
[
16+
jsonRpcProvider({
17+
rpc: (chain) => ({
18+
http: getChainRpc(chain.id),
19+
}),
20+
}),
21+
w3mProvider({ projectId }),
22+
]
23+
);
1524

1625
const wagmiConfig = createConfig({
1726
autoConnect: true,

0 commit comments

Comments
 (0)