feat(rwallet): add 5 more testnet chains for EVM balance scanning

Adds Arbitrum Sepolia, Optimism Sepolia, Polygon Amoy, Avalanche Fuji,
and BSC Testnet with RPC URLs, native tokens, popular ERC-20s, and
Alchemy slug mappings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-12 20:19:56 -07:00
parent fcea37b91b
commit e2d26d506c
2 changed files with 39 additions and 3 deletions

View File

@ -61,6 +61,11 @@ const CHAIN_COLORS: Record<string, string> = {
"324": "#8c8dfc", "324": "#8c8dfc",
"11155111": "#f59e0b", "11155111": "#f59e0b",
"84532": "#f59e0b", "84532": "#f59e0b",
"421614": "#9ca3af",
"11155420": "#ff6680",
"80002": "#a855f7",
"43113": "#fb923c",
"97": "#fbbf24",
}; };
const CHAIN_NAMES: Record<string, string> = { const CHAIN_NAMES: Record<string, string> = {

View File

@ -121,9 +121,14 @@ const CHAIN_MAP: Record<string, { name: string; prefix: string }> = {
"324": { name: "zkSync", prefix: "zksync" }, "324": { name: "zkSync", prefix: "zksync" },
"11155111": { name: "Sepolia", prefix: "sep" }, "11155111": { name: "Sepolia", prefix: "sep" },
"84532": { name: "Base Sepolia", prefix: "basesep" }, "84532": { name: "Base Sepolia", prefix: "basesep" },
"421614": { name: "Arbitrum Sepolia", prefix: "arbsep" },
"11155420": { name: "Optimism Sepolia", prefix: "optsep" },
"80002": { name: "Polygon Amoy", prefix: "polyamoy" },
"43113": { name: "Avalanche Fuji", prefix: "avaxfuji" },
"97": { name: "BSC Testnet", prefix: "bsctest" },
}; };
const TESTNET_CHAIN_IDS = new Set(["11155111", "84532"]); const TESTNET_CHAIN_IDS = new Set(["11155111", "84532", "421614", "11155420", "80002", "43113", "97"]);
function getChains(includeTestnets: boolean): [string, { name: string; prefix: string }][] { function getChains(includeTestnets: boolean): [string, { name: string; prefix: string }][] {
return Object.entries(CHAIN_MAP).filter(([id]) => includeTestnets || !TESTNET_CHAIN_IDS.has(id)); return Object.entries(CHAIN_MAP).filter(([id]) => includeTestnets || !TESTNET_CHAIN_IDS.has(id));
@ -151,6 +156,11 @@ const DEFAULT_RPC_URLS: Record<string, string> = {
"324": "https://mainnet.era.zksync.io", "324": "https://mainnet.era.zksync.io",
"11155111": "https://rpc.sepolia.org", "11155111": "https://rpc.sepolia.org",
"84532": "https://sepolia.base.org", "84532": "https://sepolia.base.org",
"421614": "https://sepolia-rollup.arbitrum.io/rpc",
"11155420": "https://sepolia.optimism.io",
"80002": "https://rpc-amoy.polygon.technology",
"43113": "https://api.avax-test.network/ext/bc/C/rpc",
"97": "https://data-seed-prebsc-1-s1.binance.org:8545",
}; };
// Chain ID → env var name fragment + Alchemy subdomain (for auto-construct) // Chain ID → env var name fragment + Alchemy subdomain (for auto-construct)
@ -165,8 +175,13 @@ const CHAIN_ENV_NAMES: Record<string, { envName: string; alchemySlug?: string }>
"43114": { envName: "AVALANCHE" }, "43114": { envName: "AVALANCHE" },
"56": { envName: "BSC" }, "56": { envName: "BSC" },
"324": { envName: "ZKSYNC" }, "324": { envName: "ZKSYNC" },
"11155111": { envName: "SEPOLIA" }, "11155111": { envName: "SEPOLIA", alchemySlug: "eth-sepolia" },
"84532": { envName: "BASE_SEPOLIA" }, "84532": { envName: "BASE_SEPOLIA", alchemySlug: "base-sepolia" },
"421614": { envName: "ARB_SEPOLIA", alchemySlug: "arb-sepolia" },
"11155420": { envName: "OPT_SEPOLIA", alchemySlug: "opt-sepolia" },
"80002": { envName: "POLYGON_AMOY", alchemySlug: "polygon-amoy" },
"43113": { envName: "AVAX_FUJI" },
"97": { envName: "BSC_TESTNET" },
}; };
/** /**
@ -204,6 +219,11 @@ const NATIVE_TOKENS: Record<string, { name: string; symbol: string; decimals: nu
"324": { name: "Ether", symbol: "ETH", decimals: 18 }, "324": { name: "Ether", symbol: "ETH", decimals: 18 },
"11155111": { name: "Sepolia ETH", symbol: "ETH", decimals: 18 }, "11155111": { name: "Sepolia ETH", symbol: "ETH", decimals: 18 },
"84532": { name: "Base Sepolia ETH", symbol: "ETH", decimals: 18 }, "84532": { name: "Base Sepolia ETH", symbol: "ETH", decimals: 18 },
"421614": { name: "Arb Sepolia ETH", symbol: "ETH", decimals: 18 },
"11155420": { name: "OP Sepolia ETH", symbol: "ETH", decimals: 18 },
"80002": { name: "Amoy POL", symbol: "POL", decimals: 18 },
"43113": { name: "Fuji AVAX", symbol: "AVAX", decimals: 18 },
"97": { name: "Test BNB", symbol: "tBNB", decimals: 18 },
}; };
async function rpcCall(rpcUrl: string, method: string, params: any[]): Promise<any> { async function rpcCall(rpcUrl: string, method: string, params: any[]): Promise<any> {
@ -440,6 +460,17 @@ const POPULAR_TOKENS: Record<string, Array<{ address: string; name: string; symb
"84532": [ "84532": [
{ address: "0x036CbD53842c5426634e7929541eC2318f3dCF7e", name: "USD Coin", symbol: "USDC", decimals: 6 }, { address: "0x036CbD53842c5426634e7929541eC2318f3dCF7e", name: "USD Coin", symbol: "USDC", decimals: 6 },
], ],
"421614": [
{ address: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d", name: "USD Coin", symbol: "USDC", decimals: 6 },
{ address: "0x980B62Da83eFf3D4576C647993b0c1D7faf17c73", name: "Wrapped Ether", symbol: "WETH", decimals: 18 },
],
"11155420": [
{ address: "0x5fd84259d66Cd46123540766Be93DFE6D43130D7", name: "USD Coin", symbol: "USDC", decimals: 6 },
{ address: "0x4200000000000000000000000000000000000006", name: "Wrapped Ether", symbol: "WETH", decimals: 18 },
],
"80002": [
{ address: "0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582", name: "USD Coin", symbol: "USDC", decimals: 6 },
],
}; };
// ERC-20 balanceOf(address) — selector 0x70a08231 // ERC-20 balanceOf(address) — selector 0x70a08231