Build a wallet NFT gallery on Astar
Use GET /v1/owners/{address}/nfts to load current holdings. Token IDs stay as strings, and media_url is included only when Aradia already stores the original bytes.
Request the first page
Section titled “Request the first page”curl -sS \ -H "Authorization: Bearer $ARADIA_API_TOKEN" \ "https://api.aradia.app/v1/owners/0x0000000000000000000000000000000000000002/nfts?limit=100"const api = "https://api.aradia.app";const owner = "0x0000000000000000000000000000000000000002";
const response = await fetch(`${api}/v1/owners/${owner}/nfts?limit=100`, { headers: { Authorization: `Bearer ${process.env.ARADIA_API_TOKEN}` },});if (!response.ok) throw new Error(`Aradia API error ${response.status}`);
const page = await response.json();const gallery = page.data.map((nft) => ({ id: `${nft.collection_address}:${nft.token_id}`, title: nft.name ?? `Token ${nft.token_id}`, src: nft.media_url ?? nft.image_url ?? null, mediaType: nft.media_type ?? "image",}));import osimport requests
owner = "0x0000000000000000000000000000000000000002"response = requests.get( f"https://api.aradia.app/v1/owners/{owner}/nfts", params={"limit": 100}, headers={"Authorization": f"Bearer {os.environ['ARADIA_API_TOKEN']}"}, timeout=30,)response.raise_for_status()gallery = [ { "id": f"{nft['collection_address']}:{nft['token_id']}", "src": nft.get("media_url") or nft.get("image_url"), } for nft in response.json()["data"]]Render media without broken promises
Section titled “Render media without broken promises”Use media_url ?? image_url. A present media_url means the original is already on Aradia’s disk. When it is absent, image_url is the metadata source and may still depend on IPFS availability.
Use media_type to choose the element:
function NFTMedia({ nft }) { const src = nft.media_url ?? nft.image_url; if (!src) return <div aria-label="Artwork unavailable" />; if (nft.media_type?.startsWith("video/")) return <video src={src} controls preload="metadata" />; return <img src={src} alt={nft.name ?? `NFT ${nft.token_id}`} loading="lazy" />;}Load every page
Section titled “Load every page”When pagination.has_more is true, copy every value in pagination.next_page_params into the next request. Keep the owner and limit unchanged.
Related reference: GET /v1/owners/{address}/nfts.
