1
1
import React from "react" ;
2
2
3
- import { createWeb3Modal } from "@web3modal/wagmi/react" ;
4
3
import { type Chain } from "viem" ;
5
- import { createConfig , fallback , http , WagmiProvider , webSocket } from "wagmi" ;
6
- import { mainnet , arbitrumSepolia , arbitrum , gnosisChiado , sepolia , gnosis } from "wagmi/chains" ;
7
- import { walletConnect } from "wagmi/connectors" ;
4
+ import { fallback , http , WagmiProvider , webSocket } from "wagmi" ;
5
+ import { mainnet , arbitrumSepolia , arbitrum , gnosisChiado , sepolia , gnosis } from "@reown/appkit/networks" ;
8
6
9
7
import { configureSDK } from "@kleros/kleros-sdk/src/sdk" ;
10
8
11
9
import { ALL_CHAINS , DEFAULT_CHAIN } from "consts/chains" ;
12
10
import { isProductionDeployment } from "consts/index" ;
13
-
11
+ import { createAppKit } from "@reown/appkit/react" ;
12
+ import { WagmiAdapter } from "@reown/appkit-adapter-wagmi" ;
14
13
import { theme } from "styles/Theme" ;
15
14
16
15
const alchemyApiKey = process . env . NEXT_PUBLIC_ALCHEMY_API_KEY ;
@@ -74,10 +73,10 @@ if (!projectId) {
74
73
throw new Error ( "WalletConnect project ID is not set in NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID environment variable." ) ;
75
74
}
76
75
77
- export const wagmiConfig = createConfig ( {
78
- chains,
76
+ const wagmiAdapter = new WagmiAdapter ( {
77
+ networks : chains ,
78
+ projectId,
79
79
transports,
80
- connectors : [ walletConnect ( { projectId } ) ] ,
81
80
} ) ;
82
81
83
82
configureSDK ( {
@@ -87,18 +86,18 @@ configureSDK({
87
86
} ,
88
87
} ) ;
89
88
90
- createWeb3Modal ( {
91
- wagmiConfig,
89
+ createAppKit ( {
90
+ adapters : [ wagmiAdapter ] ,
91
+ networks : chains ,
92
+ defaultNetwork : isProduction ? arbitrum : arbitrumSepolia ,
92
93
projectId,
93
- defaultChain : isProduction ? arbitrum : arbitrumSepolia ,
94
94
themeVariables : {
95
95
"--w3m-color-mix" : theme . klerosUIComponentsPrimaryPurple ,
96
96
"--w3m-color-mix-strength" : 20 ,
97
97
} ,
98
98
} ) ;
99
-
100
99
const Web3Provider : React . FC < { children : React . ReactNode } > = ( { children } ) => {
101
- return < WagmiProvider config = { wagmiConfig } > { children } </ WagmiProvider > ;
100
+ return < WagmiProvider config = { wagmiAdapter . wagmiConfig } > { children } </ WagmiProvider > ;
102
101
} ;
103
102
104
103
export default Web3Provider ;
0 commit comments