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
This commit is contained in:
defiQUG
2026-03-27 22:21:15 -07:00
parent 5df1365a1d
commit ba32cd0a65
3 changed files with 22 additions and 6 deletions

View File

@@ -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

View File

@@ -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]),

View File

@@ -1,15 +1,21 @@
/// <reference types="vite/client" />
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 {}