diff --git a/src/dmint-api.ts b/src/dmint-api.ts index 82203c2..6902ab2 100644 --- a/src/dmint-api.ts +++ b/src/dmint-api.ts @@ -417,7 +417,10 @@ export async function fetchContractsSimple(): Promise<[string, number][]> { */ export async function fetchContractsExtended(): Promise { // Try REST API first - const restContracts = await fetchFromRestApi("/dmint/contracts?version=2&limit=5000&include_icon_data=true"); + // Don't inline icon hex in the list — it bloats the payload massively. The + // indexer instead returns an icon URL (the lazy /dmint/contracts/{ref}/icon + // route) that the browser fetches and caches per-token on render. + const restContracts = await fetchFromRestApi("/dmint/contracts?version=2&limit=5000"); if (restContracts && restContracts.length > 0) { const mapped = restContracts.map(mapRestContract); indexExtendedContracts(mapped); diff --git a/src/pages/TokenList.tsx b/src/pages/TokenList.tsx index d59a73e..117f698 100644 --- a/src/pages/TokenList.tsx +++ b/src/pages/TokenList.tsx @@ -10,7 +10,7 @@ import { SearchIcon, TriangleDownIcon, TriangleUpIcon, CloseIcon } from "@chakra import { LuRefreshCw } from "react-icons/lu"; import { Link, useNavigate } from "react-router-dom"; import { deriveSubContractRefCandidates } from "../utils"; -import { miningEnabled, miningStatus, selectedContract } from "../signals"; +import { miningEnabled, miningStatus, selectedContract, restApiUrl } from "../signals"; import miner from "../miner"; import { addMessage } from "../message"; import { @@ -52,6 +52,12 @@ function resolveIconUrl(url?: string): string | undefined { const cid = url.replace("ipfs://", ""); return `https://ipfs.io/ipfs/${cid}`; } + // Server-relative icon routes (e.g. /dmint/contracts/{ref}/icon) resolve + // against the REST API origin, not the app origin. + if (url.startsWith("/")) { + const base = (restApiUrl.value || "").replace(/\/$/, ""); + return base ? `${base}${url}` : url; + } return url; } @@ -78,6 +84,7 @@ function TokenIcon({ iconType, iconData, iconUrl }: { boxSize="24px" borderRadius="full" objectFit="cover" + loading="lazy" onError={() => setError(true)} /> );