From ba32cd0a65fa93e8f9bf4ac108e843f140b51083 Mon Sep 17 00:00:00 2001 From: defiQUG Date: Fri, 27 Mar 2026 22:21:15 -0700 Subject: [PATCH] feat(frontend-dapp): wagmi transport + env types for Chain 2138 - Optional http() transport for 2138 when VITE_ENABLE_CHAIN2138 set - Document VITE_* 2138 vars in .env.example; augment vite-env.d.ts Made-with: Cursor --- frontend-dapp/.env.example | 5 +++++ frontend-dapp/src/config/wagmi.ts | 5 +++++ frontend-dapp/src/vite-env.d.ts | 18 ++++++++++++------ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/frontend-dapp/.env.example b/frontend-dapp/.env.example index 1dbb1dc..80269fd 100644 --- a/frontend-dapp/.env.example +++ b/frontend-dapp/.env.example @@ -8,6 +8,11 @@ VITE_WALLETCONNECT_PROJECT_ID=your_reown_project_id_from_cloud_reown_com VITE_THIRDWEB_CLIENT_ID=your_thirdweb_client_id_here VITE_RPC_URL_138=https://rpc-http-pub.d-bis.org +# Defi Oracle Meta Testnet (chain ID 2138) — off unless VITE_ENABLE_CHAIN2138 is true or 1 +# VITE_ENABLE_CHAIN2138=true +# VITE_RPC_URL_2138=https://rpc.public-2138.defi-oracle.io +# VITE_EXPLORER_URL_2138=https://public-2138.defi-oracle.io + # Optional Environment Variables VITE_ETHERSCAN_API_KEY=YourApiKeyToken VITE_SAFE_SERVICE_URL=https://safe-transaction-mainnet.safe.global diff --git a/frontend-dapp/src/config/wagmi.ts b/frontend-dapp/src/config/wagmi.ts index 02df252..39b26d6 100644 --- a/frontend-dapp/src/config/wagmi.ts +++ b/frontend-dapp/src/config/wagmi.ts @@ -4,6 +4,8 @@ import { allNetworks, chainRpcUrls, chain138, + chain2138Testnet, + chain2138TestnetEnabled, allMainnet, etherlink, bsc, @@ -23,6 +25,9 @@ export const config = createConfig({ ], transports: { [chain138.id]: http(chainRpcUrls[chain138.id]), + ...(chain2138TestnetEnabled + ? { [chain2138Testnet.id]: http(chainRpcUrls[chain2138Testnet.id]) } + : {}), [allMainnet.id]: http(chainRpcUrls[allMainnet.id]), [etherlink.id]: http(chainRpcUrls[etherlink.id]), [bsc.id]: http(chainRpcUrls[bsc.id]), diff --git a/frontend-dapp/src/vite-env.d.ts b/frontend-dapp/src/vite-env.d.ts index 0cd7264..08b686a 100644 --- a/frontend-dapp/src/vite-env.d.ts +++ b/frontend-dapp/src/vite-env.d.ts @@ -1,15 +1,21 @@ /// -import { EventEmitter } from 'events'; +interface ImportMetaEnv { + readonly VITE_ENABLE_CHAIN2138?: string + readonly VITE_RPC_URL_2138?: string + readonly VITE_EXPLORER_URL_2138?: string +} + +import { EventEmitter } from 'events' interface Window { - Buffer: typeof Buffer; - EventEmitter: typeof EventEmitter; + Buffer: typeof Buffer + EventEmitter: typeof EventEmitter } declare global { - var Buffer: typeof import('buffer').Buffer; - var EventEmitter: typeof import('events').EventEmitter; + var Buffer: typeof import('buffer').Buffer + var EventEmitter: typeof import('events').EventEmitter } -export {}; +export {}