diff --git a/web-devtools/src/context/Web3Provider.tsx b/web-devtools/src/context/Web3Provider.tsx index cb25b691e..80783db39 100644 --- a/web-devtools/src/context/Web3Provider.tsx +++ b/web-devtools/src/context/Web3Provider.tsx @@ -72,7 +72,7 @@ if (!projectId) { throw new Error("WalletConnect project ID is not set in NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID environment variable."); } -const wagmiConfig = createConfig({ +export const wagmiConfig = createConfig({ chains, transports, connectors: [walletConnect({ projectId })], diff --git a/web-devtools/src/utils/getDisputeRequestParamsFromTxn.ts b/web-devtools/src/utils/getDisputeRequestParamsFromTxn.ts index 785f99fa4..ed532b452 100644 --- a/web-devtools/src/utils/getDisputeRequestParamsFromTxn.ts +++ b/web-devtools/src/utils/getDisputeRequestParamsFromTxn.ts @@ -1,9 +1,9 @@ import { getPublicClient } from "@wagmi/core"; import { type GetTransactionReceiptReturnType, decodeEventLog, getEventSelector } from "viem"; +import { wagmiConfig } from "context/Web3Provider"; import { iArbitrableV2Abi } from "hooks/contracts/generated"; import { isUndefined } from "utils/isUndefined"; -import { wagmiConfig } from "utils/wagmiConfig"; export const getDisputeRequestParamsFromTxn = async (hash: `0x${string}`, chainId: number) => { try { diff --git a/web-devtools/src/utils/wagmiConfig.ts b/web-devtools/src/utils/wagmiConfig.ts deleted file mode 100644 index e7eb88ff5..000000000 --- a/web-devtools/src/utils/wagmiConfig.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { type Chain } from "viem"; -import { createConfig, fallback, http, webSocket } from "wagmi"; -import { mainnet, arbitrumSepolia, arbitrum, gnosisChiado } from "wagmi/chains"; - -import { ALL_CHAINS } from "consts/chains"; -import { isProductionDeployment } from "consts/index"; - -const chains = ALL_CHAINS as [Chain, ...Chain[]]; - -export const alchemyApiKey = process.env.NEXT_PUBLIC_ALCHEMY_API_KEY ?? ""; - -type AlchemyProtocol = "https" | "wss"; -type AlchemyChain = "arb-sepolia" | "eth-mainnet" | "arb"; -const alchemyURL = (protocol: AlchemyProtocol, chain: AlchemyChain) => - `${protocol}://${chain}.g.alchemy.com/v2/${alchemyApiKey}`; -const alchemyTransport = (chain: AlchemyChain) => - fallback([webSocket(alchemyURL("wss", chain)), http(alchemyURL("https", chain))]); - -const transports = { - [isProductionDeployment() ? arbitrum.id : arbitrumSepolia.id]: isProductionDeployment() - ? alchemyTransport("arb") - : alchemyTransport("arb-sepolia"), - [mainnet.id]: alchemyTransport("eth-mainnet"), - [gnosisChiado.id]: fallback([webSocket("wss://rpc.chiadochain.net/wss"), http("https://rpc.chiadochain.net")]), -}; - -export const wagmiConfig = createConfig({ - chains: chains, - transports: transports, -});