Skip to content

Swap: a Zora coin shows as a card (media, creator, market) - #4

Merged
sktbrd merged 1 commit into
mainfrom
zora-coin-card
Sep 3, 2026
Merged

Swap: a Zora coin shows as a card (media, creator, market)#4
sktbrd merged 1 commit into
mainfrom
zora-coin-card

Conversation

@sktbrd

@sktbrd sktbrd commented Sep 3, 2026

Copy link
Copy Markdown
Member

What

Selecting a Zora creator coin on /swap used to give an eight-line uppercase name in the picker button and nothing else — the amount field fell below the fold and the coin looked like any other ticker. Now a coin on either side of the swap gets a card under the strip, fed by the @zoralabs/coins-sdk the site already uses:

  • the coin's media in the middle (image, or a muted looping video with its still as poster)
  • creator handle + avatar, link to the coin on Zora
  • market cap with the 24h move, 24h volume, holders
  • the description clamped to one line
  • one sentence: "You are trading $COIN for ETH." / "You are buying $COIN with ETH."

The card renders nothing until the SDK confirms the token is a coin, so ordinary ERC-20s are untouched. The picker button's name is now one truncated line with the full name in its title, for every token.

Files

  • coinCardModel.ts — pure: media choice (video vs image, IPFS → HTTP), compact USD, 24h delta, clamped description, Zora URL. 7 unit tests.
  • ZoraCoinCard.tsx — the component, one query per address cached 10 min.
  • SwapWidget.tsx — mounts the two cards under the strip; truncates the picker label.
  • messages/{en,pt-br}/swap.jsoncoinCard.* strings.

Notes

  • NEXT_PUBLIC_ZORA_API_KEY is used when set, as elsewhere in the site; without it the SDK's public rate applies.
  • Autoplaying video is muted + playsInline, so it never blocks or makes sound.

Checks: vitest 7/7 on the new module, tsc --noEmit clean in touched files, eslint and prettier clean. Follows #3 (SwapPro quotes).

🤖 Generated with Claude Code

@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
gnars.com Ready Ready Preview Sep 3, 2026 10:32pm UTC

Request Review

…r, market

Selecting a Zora creator coin used to give an eight-line uppercase name
in the picker button and nothing else: the amount field fell below the
fold and the coin looked like any other ticker. Now a coin on either side
of the swap gets a card under the strip, from the Zora SDK the site
already uses: the coin's media (image, or a muted looping video with its
still as poster), the creator's handle and avatar, market cap with the
24h move, 24h volume, holders, the description clamped to a line, a link
to the coin on Zora, and one sentence saying what you are trading it for.
The card renders nothing until the SDK confirms the token is a coin, so
ordinary ERC-20s are untouched.

The picker button's name is now one truncated line with the full name in
its title, on every token.

zoraCoinCard.ts holds the pure parts (media choice, compact USD, 24h
delta, clamped description, Zora URL) with unit tests; ZoraCoinCard.tsx
is the component; strings added in en and pt-br.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@sktbrd
sktbrd merged commit 2ff383d into main Sep 3, 2026
2 checks passed
@sktbrd
sktbrd deleted the zora-coin-card branch September 3, 2026 22:41
sktbrd added a commit that referenced this pull request Sep 3, 2026
The card shipped in #4 never drew: the Zora SDK, called from the browser
without a key, is answered by a Cloudflare block, which is also why coins
showed a letter where their image belonged. A new /api/coins/meta calls
Zora server-side with a browser-shaped agent and the site's key when one
is set, and when Zora still will not answer it reads the coin's own
contractURI() on Base and serves the same media from IPFS — without
market figures, which only Zora has. The card fetches that route; the
SDK import is gone from the client. onchainToCoin maps the on-chain JSON
into the SDK shape, with tests.

Co-authored-by: Claude Fable 5.1 <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