Skip to content

fix(keychain): fall back to collection image when token images fail - #2663

Merged
bal7hazar merged 2 commits into
mainfrom
fix/collectible-image-fallbacks
Jul 22, 2026
Merged

bal7hazar merged 2 commits into
mainfrom
fix/collectible-image-fallbacks

Conversation

@bal7hazar

@bal7hazar bal7hazar commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Centralize Torii static image URL construction in torii-url.ts helpers, normalizing the contract address (zero-padded lowercase, like fix(arcade-ts): normalize Torii asset addresses arcade#300) and padding the token id.
  • Apply the asset page's working fallback chain — token image → legacy unpadded URL → metadata image → collection image — to the inventory collection cards, the collection assets grid, the account activity feed, the asset traceability logs, and the purchase views.
  • ThumbnailCollectible (used by activity/traceability rows) now accepts a list of candidates and probes each one, since Torii can return a 200 whose body is not decodable image data.
  • Integrates the nested data-URI decoding from fix(keychain): resolve nested NFT image URLs #2664 (supersedes it): when token metadata wraps a plain URL inside a base64 data URI, the decoded URL is promoted ahead of the Torii candidates so the intended image loads first.

Root cause

Torii serves /static/<contract>/<token>/image only under the zero-padded lowercase address form, and some collections (e.g. Glitch Bomb on gbomb-mainnet) have token metadata whose image is a base64-wrapped URL string, so the token-level endpoint returns undecodable content with a 200. Only the collection-level image (/static/<padded-contract>/image) reliably loads, and only the asset page preview fell back to it. Fixes the placeholder images reported on the inventory, collection, and activity surfaces.

Validation

  • pnpm --filter @cartridge/keychain test (770 passed) including new unit tests for the URL helpers and nested-URI decoding
  • pnpm --filter @cartridge/controller-ui test:ci, build, tsc --noEmit on both packages
  • pnpm lint / pnpm format
  • Verified against live gbomb-mainnet Torii: padded contract URLs return 200, unpadded 404, token-level body is a raw URL served as image/svg+xml

Prompted by: bal7hazar

🤖 Generated with Claude Code

Torii serves token images only under the zero-padded lowercase contract
address, and some collections (e.g. Glitch Bomb) return token-level image
bodies that are not decodable, so inventory cards, collection grids and
activity/traceability rows rendered placeholders while the asset page
recovered via its collection-image fallback.

Centralize static image URL construction in torii-url helpers (normalized
like cartridge-gg/arcade#300) and apply the asset page's fallback chain
(token image -> legacy unpadded URL -> metadata image -> collection image)
everywhere: collection hooks, activity feed, traceability cards and
purchase views. ThumbnailCollectible now probes a list of candidates and
displays the first one that actually decodes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
controller-example-next Ready Ready Preview Jul 22, 2026 5:41pm
controller-ui Ready Ready Preview Jul 22, 2026 5:41pm
keychain Ready Ready Preview Jul 22, 2026 5:41pm
keychain-storybook Ready Ready Preview Jul 22, 2026 5:41pm

Request Review

Integrate the nested data-URI decoding from #2664: when token metadata
wraps a plain URL inside a base64 data URI (e.g. Glitch Bomb), decode it
and promote it ahead of the Torii candidates so the intended image loads
first. Collection-level lists resolve the nested URI in place.

Supersedes #2664.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant