From 780537d8cc4430ac1678a3caf4f22171cd8909e3 Mon Sep 17 00:00:00 2001 From: Arnav-Nehra Date: Tue, 30 Dec 2025 13:00:59 +0530 Subject: [PATCH 1/2] fixed supported token not loading --- frontend/src/components/TokenPicker.jsx | 39 ++++++++++++++++++++----- frontend/src/hooks/useTokenList.js | 2 ++ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/TokenPicker.jsx b/frontend/src/components/TokenPicker.jsx index 5d3fe892..b292c3fd 100644 --- a/frontend/src/components/TokenPicker.jsx +++ b/frontend/src/components/TokenPicker.jsx @@ -12,7 +12,7 @@ import { import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; -import { useTokenList } from "../hooks/useTokenList"; +import { ChainIdToName, useTokenList } from "../hooks/useTokenList"; import { useTokenSearch } from "../hooks/useTokenSearch"; import { CopyButton } from "./ui/copyButton"; import { Avatar } from "./ui/avatar"; @@ -315,12 +315,37 @@ export function TokenPicker({
- - Failed to load tokens - - - {tokensError} - + {tokensError.includes("manually input") ? ( + <> + + Testnet:{" "} + {ChainIdToName[chainId] || "Unknown"} ( + {chainId}) + + + Token Selection is not supported in testnets. + + + {tokensError} + + + ) : tokensError.includes("not supported") ? ( + <> + + Chain Not Supported + + {tokensError} + + ) : ( + <> + + Failed to load tokens + + + {tokensError} + + + )}
) : filteredTokens.length === 0 ? ( diff --git a/frontend/src/hooks/useTokenList.js b/frontend/src/hooks/useTokenList.js index 9c42cf7b..045abd1f 100644 --- a/frontend/src/hooks/useTokenList.js +++ b/frontend/src/hooks/useTokenList.js @@ -25,6 +25,8 @@ export function useTokenList(chainId) { // Return cached tokens if available if (tokenCache[chainId]) { setTokens(tokenCache[chainId]); + setError(null); + setLoading(false); return; } From cf7c849a76ba1cd25ba9fc67ed9c8d1fdbe0e741 Mon Sep 17 00:00:00 2001 From: Arnav-Nehra Date: Fri, 2 Jan 2026 09:47:28 +0530 Subject: [PATCH 2/2] disable button on testnet --- frontend/src/components/TokenPicker.jsx | 35 ++++++++++++++++--------- frontend/src/hooks/useTokenList.js | 2 +- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/TokenPicker.jsx b/frontend/src/components/TokenPicker.jsx index b292c3fd..3147cd4d 100644 --- a/frontend/src/components/TokenPicker.jsx +++ b/frontend/src/components/TokenPicker.jsx @@ -12,7 +12,7 @@ import { import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; -import { ChainIdToName, useTokenList } from "../hooks/useTokenList"; +import { ChainIdToName, useTokenList, isTestnet } from "../hooks/useTokenList"; import { useTokenSearch } from "../hooks/useTokenSearch"; import { CopyButton } from "./ui/copyButton"; import { Avatar } from "./ui/avatar"; @@ -216,20 +216,22 @@ export function TokenPicker({ setOpen(false); }; + const isOnTestnet = isTestnet(chainId); + return ( <> + {isOnTestnet && ( +
+ +

+ Token selection is disabled on testnets. Please switch to a mainnet network to use this feature. +

+
+ )} + setOpen(false)}>
diff --git a/frontend/src/hooks/useTokenList.js b/frontend/src/hooks/useTokenList.js index 045abd1f..af5e6edf 100644 --- a/frontend/src/hooks/useTokenList.js +++ b/frontend/src/hooks/useTokenList.js @@ -7,7 +7,7 @@ const tokenCache = {}; const TESTNET_CHAIN_IDS = new Set([11155111, 5]); // Sepolia, Goerli // Helper function to check if a chain is testnet -const isTestnet = (chainId) => TESTNET_CHAIN_IDS.has(chainId); +export const isTestnet = (chainId) => TESTNET_CHAIN_IDS.has(chainId); export const ChainIdToName = { 1: "ethereum",