From 0b5e8198d6c7db4fb2f50958775567109f9f00b4 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Mon, 9 Mar 2026 13:38:39 -0700 Subject: [PATCH] fix(rwallet): always show testnet chains when toggle is on Testnet chains (Sepolia, Base Sepolia) are now always included in detection results when testnets are toggled on, even if no native balance is found. This allows viewing ERC-20 tokens on testnets where native ETH balance may be zero. Co-Authored-By: Claude Opus 4.6 --- modules/rwallet/mod.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/modules/rwallet/mod.ts b/modules/rwallet/mod.ts index 9f96b17..fbad47a 100644 --- a/modules/rwallet/mod.ts +++ b/modules/rwallet/mod.ts @@ -70,6 +70,15 @@ routes.get("/api/safe/detect/:address", async (c) => { }) ); + // Always include testnet chains when toggled on (skip detection) + if (includeTestnets) { + for (const [chainId, info] of Object.entries(CHAIN_MAP)) { + if (TESTNET_CHAIN_IDS.has(chainId) && !results.some((r) => r.chainId === chainId)) { + results.push({ chainId, name: info.name, prefix: info.prefix }); + } + } + } + return c.json({ address, chains: results.sort((a, b) => a.name.localeCompare(b.name)) }); }); @@ -341,6 +350,15 @@ routes.get("/api/eoa/detect/:address", async (c) => { }) ); + // Always include testnet chains when toggled on (skip detection) + if (includeTestnets) { + for (const [chainId, info] of Object.entries(CHAIN_MAP)) { + if (TESTNET_CHAIN_IDS.has(chainId) && !results.some((r) => r.chainId === chainId)) { + results.push({ chainId, name: info.name, prefix: info.prefix, balance: "0x0" }); + } + } + } + return c.json({ address, chains: results.sort((a, b) => a.name.localeCompare(b.name)) }); });