From 93400e671a474c85120c4960cd258ec4b6961ec2 Mon Sep 17 00:00:00 2001 From: Peterjah Date: Thu, 2 Jan 2025 14:54:21 +0100 Subject: [PATCH] add MAINNET RPC from env --- src/const/wagmi.ts | 3 ++- src/env.d.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/const/wagmi.ts b/src/const/wagmi.ts index a1333fc9..cd67c478 100644 --- a/src/const/wagmi.ts +++ b/src/const/wagmi.ts @@ -1,11 +1,12 @@ import { bsc, bscTestnet, mainnet, sepolia } from 'viem/chains'; import { createConfig, createStorage, http } from 'wagmi'; +const { VITE_MAINNET_RPC } = import.meta.env; export const config = createConfig({ chains: [mainnet, sepolia, bsc, bscTestnet], storage: createStorage({ storage: window.localStorage }), transports: { - [mainnet.id]: http(), + [mainnet.id]: http(VITE_MAINNET_RPC ?? mainnet.rpcUrls.default.http[0]), [sepolia.id]: http('https://rpc2.sepolia.org'), [bsc.id]: http(), [bscTestnet.id]: http(), diff --git a/src/env.d.ts b/src/env.d.ts index 1baaffdb..770c675c 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -13,6 +13,7 @@ interface ImportMetaEnv { readonly VITE_NO_BRIDGE: string; readonly VITE_INFURA_API_KEY: string; readonly VITE_ALCHEMY_API_KEY: string; + readonly VITE_MAINNET_RPC: string; } interface ImportMeta {