Skip to content

Commit 6974fdb

Browse files
committed
chore(web): configure-sdk-with-web3-context
1 parent 220ea2f commit 6974fdb

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

web/src/context/Web3Provider.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { createConfig, fallback, http, WagmiProvider, webSocket } from "wagmi";
66
import { mainnet, arbitrumSepolia, arbitrum, gnosisChiado, gnosis, sepolia } from "wagmi/chains";
77
import { walletConnect } from "wagmi/connectors";
88

9+
import { configureSDK } from "@kleros/kleros-sdk/src/sdk";
10+
911
import { ALL_CHAINS, DEFAULT_CHAIN } from "consts/chains";
1012
import { isProductionDeployment } from "consts/index";
1113

@@ -36,9 +38,10 @@ export const getDefaultChainRpcUrl = (protocol: AlchemyProtocol) => {
3638
return getChainRpcUrl(protocol, DEFAULT_CHAIN);
3739
};
3840

41+
const alchemyTransport = (chain: Chain) =>
42+
fallback([http(alchemyURL("https", chain.id)), webSocket(alchemyURL("wss", chain.id))]);
43+
3944
export const getTransports = () => {
40-
const alchemyTransport = (chain: Chain) =>
41-
fallback([http(alchemyURL("https", chain.id)), webSocket(alchemyURL("wss", chain.id))]);
4245
const defaultTransport = (chain: Chain) =>
4346
fallback([http(chain.rpcUrls.default?.http?.[0]), webSocket(chain.rpcUrls.default?.webSocket?.[0])]);
4447

@@ -62,6 +65,13 @@ const wagmiConfig = createConfig({
6265
connectors: [walletConnect({ projectId, showQrModal: false })],
6366
});
6467

68+
configureSDK({
69+
client: {
70+
chain: isProduction ? arbitrum : arbitrumSepolia,
71+
transport: isProduction ? alchemyTransport(arbitrum) : alchemyTransport(arbitrumSepolia),
72+
},
73+
});
74+
6575
createWeb3Modal({
6676
wagmiConfig,
6777
projectId,

0 commit comments

Comments
 (0)