import { createConfig, http, webSocket } from "wagmi"; import { mainnet, sepolia } from "wagmi/chains"; import { defineChain } from "viem"; import { walletConnect, injected, metaMask } from "wagmi/connectors"; const projectId = process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID || ""; // Define Chain 138 (Custom Besu Network) const chain138 = defineChain({ id: 138, name: "Solace Chain 138", nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH", }, rpcUrls: { default: { http: [ process.env.NEXT_PUBLIC_CHAIN138_RPC_URL || "http://192.168.11.250:8545", "http://192.168.11.251:8545", "http://192.168.11.252:8545", ], webSocket: [ process.env.NEXT_PUBLIC_CHAIN138_WS_URL || "ws://192.168.11.250:8546", "ws://192.168.11.251:8546", "ws://192.168.11.252:8546", ], }, }, blockExplorers: { default: { name: "Chain 138 Explorer", url: "http://192.168.11.140", }, }, testnet: false, }); export const config = createConfig({ chains: [chain138, mainnet, sepolia], connectors: [ injected(), metaMask(), walletConnect({ projectId }), ], transports: { [chain138.id]: process.env.NEXT_PUBLIC_CHAIN138_WS_URL ? webSocket(process.env.NEXT_PUBLIC_CHAIN138_WS_URL) : http(process.env.NEXT_PUBLIC_CHAIN138_RPC_URL || "http://192.168.11.250:8545"), [mainnet.id]: http(), [sepolia.id]: http(process.env.NEXT_PUBLIC_SEPOLIA_RPC_URL), }, }); declare module "wagmi" { interface Register { config: typeof config; } }