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 <noreply@anthropic.com>
This commit is contained in:
parent
b553acd756
commit
0b5e8198d6
|
|
@ -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)) });
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue