Skip to content

feat(flashcard): draw the Bearer card on the Cashu card screen - #755

Merged
islandbitcoin merged 2 commits into
mainfrom
jabariennis/flashcard-v2-card-art
Oct 6, 2026
Merged

islandbitcoin merged 2 commits into
mainfrom
jabariennis/flashcard-v2-card-art

Conversation

@islandbitcoin

@islandbitcoin islandbitcoin commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What

The Cashu card screen (app/screens/card-screen/flashcard-v2.tsx) now draws the Flash Card physical design, Concept A "Bearer", as vector art instead of the static flashcard.png: matte near-black base with grain, the gold chip in its dashed orange ring, the contactless marks, the faint brand-bolt watermark, the orange gradient slash with the ₿ on it, and FLASH / BEARER CARD at bottom right. The masked id is derived from the card pubkey's last four hex digits, the same way flash-pos derives it.

The home screen's Cashu card row shows the same art as its thumbnail, in place of the BoltCard's flag icon (second commit).

Why

The physical card design is final and the same card should look identical on the card screen here and on the charge screen in flash-pos.

How

  • app/components/flashcard-v2-art/cardArtV2.tsx is a byte-for-byte copy of flash-pos's src/components/cashu/charge/cardArtV2.tsx (flash-pos 5a4b8b5). __tests__/components/flashcard-v2-art.spec.tsx pins this copy's file bytes, CARD_ART digest and rendered tree to the same constants flash-pos's __tests__/components/cashu/cardArtV2.test.tsx pins, and asserts the SVG structure. Neither spec reads the other repo's file: an edit to either copy fails that repo's suite until its pins are bumped, which is the cue to sync the other. The flash-pos side of this (the byte and render pins in its test) landed in flash-pos as 46d4541. Real cross-repo detection needs a CI step that can read flash-pos (follow-up).
  • The shared file keeps flash-pos's Prettier style via an eslint override in .eslintrc.json and prettier.config.js, which spells out flash-pos's effective options so none come from this repo's root.
  • The card is laid out in flow, 10 dp down, with the balance 16 dp under it (as under the old picture's card), so no placeholder re-derives its height. On the dark theme the card gets a 1 dp grey4 outline: its near-black base and black shadow do not show on the black page.
  • FLASH, BEARER CARD and ₿ are artwork drawn from Inter 4.001 glyph outlines; the font itself is not bundled, and per the OFL FAQ the artwork needs no notice. THIRD_PARTY_NOTICES.md carries the OFL notice for the bundled Sora fonts and credits Inter as a courtesy.
  • New i18n key FlashcardV2.cardEnding for the card's accessibility label, read one character at a time ("Flashcard ending 0 C 6 7"); translations regenerated with yarn update-translations.
  • Home row thumbnail (second commit). Balance takes an optional iconNode that it draws in place of its icon; the BoltCard row keeps its icon. The Cashu card row draws FlashcardV2Art at the icon's width (54 dp), without the card screen's drop shadow, inside a view hidden from screen readers, because the row's title and amount already say what it is. On the dark theme the thumbnail also gets the card's 1 dp outline.

Testing

  • yarn tsc:check clean.
  • npx jest __tests__/screens/flashcard-v2*.spec.tsx __tests__/contexts/flashcard-cashu-card.spec.tsx __tests__/components/flashcard-v2-art.spec.tsx __tests__/components/wallet-overview-cashu-card.spec.tsx: green.
  • yarn check:translations: no generated diffs.
  • ESLint clean on all touched files. Two pre-existing no-template-curly-in-string errors remain in the generated app/i18n/en/index.ts (BankTransfer copy); they are on main and untouched here.
  • The art was rendered on a Pixel 8 Pro in flash-pos's charge screen (on white) and scored against the design sheet by two independent reviewers (9/10 each).
  • Home row thumbnail: a new test in __tests__/components/wallet-overview-cashu-card.spec.tsx pins the thumbnail's width, its missing shadow, and that screen readers skip it. It fails if the row drops the thumbnail, if the thumbnail keeps the shadow, if Balance ignores iconNode, or if the hiding is removed (each one tried). With both commits: yarn tsc:check clean, lint clean on changed lines, full suite 161 suites / 1,896 tests.
  • Android: rendered on a Pixel 8 Pro (debug build, versionCode 93) with a real card tapped (1,443 sats, applet v0.4). Light theme: card in flow under the header, shadow visible. Dark theme (Settings → Theme → Dark Mode): the 1 dp outline separates the black card from the black page. 2026-10-05.
  • iOS: rendered on an iPhone 17 Pro (iOS 26.6.2, Debug build of the LNFlash-Alt scheme with an embedded bundle) with the same card tapped. Light and dark theme both confirmed correct by eye. 2026-10-05. The home row's Bearer-card thumbnail (0590a72) was also confirmed on the same iPhone.
  • Home row thumbnail: not yet seen on a device (either platform, light or dark theme).

Notes for review

  • Neither app bundles Inter, so the wordmark is paths, not text; Outfit/Sora were rejected because their A and S letterforms differ from the sheet.
  • The card-assets print master differs from the chosen sheet in several places (wordmark size, ₿ colour, chip geometry, slash); tracked separately.

🤖 Generated with Claude Code

Replaces the static flashcard.png with the Flash Card physical design
(Concept A, Bearer) as vector art: app/components/flashcard-v2-art/
cardArtV2.tsx is a byte-for-byte copy of flash-pos's card face, and the
parity spec pins the file's SHA-256, the node digest and the rendered
trees so the two apps cannot drift without a test failing. The card is
drawn in flow (centred, 10 dp above, 16 dp below) instead of the old
PNG's absolute placement, so the balance and the action row sit where
they did on main. In dark mode a 1 dp outline keeps the near-black card
visible on the black page. The accessibility label says the card's
masked id letter by letter ("Flashcard ending 0 C 6 7"); the printed id
derives from the pubkey's last four hex digits as in flash-pos.

FLASH, BEARER CARD and ₿ are outlined Inter glyph paths; the bundled
Sora fonts and those glyphs are credited in THIRD_PARTY_NOTICES.md. The
shared file keeps flash-pos's Prettier style through a self-contained
override. New i18n key FlashcardV2.cardEnding; translations regenerated.

Rebased onto main after #748-#754; the branch's own copy of #748's
action-row move was dropped in favour of main's.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@islandbitcoin
islandbitcoin force-pushed the jabariennis/flashcard-v2-card-art branch from 3500087 to 5983071 Compare October 5, 2026 16:15
The home screen's Cashu card row used the BoltCard's flag icon. It now shows
the Flashcard v2 art (FlashcardV2Art) at the icon's width, without the card
screen's drop shadow, and hidden from screen readers: the row's title and
amount already say what it is. `Balance` takes an optional `iconNode` to
draw in place of its icon; the BoltCard row keeps its icon.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@islandbitcoin
islandbitcoin merged commit a33ad53 into main Oct 6, 2026
10 checks passed
@islandbitcoin
islandbitcoin deleted the jabariennis/flashcard-v2-card-art branch October 6, 2026 01:32
islandbitcoin pushed a commit that referenced this pull request Oct 9, 2026
Mirror the five new FlashcardV2 keys (slotsSpentNote, topUpSlotsReclaim,
topUpReclaimed, topUpSlotsSettling, topUpSettlingNote) and the updated
slotSummary into all 23 locale files, the same way #746/#747/#755 did,
so check:translation-drift passes.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WxkKbrg2Xohf3mQj7BLrs6
islandbitcoin added a commit that referenced this pull request Oct 9, 2026
…#759)

* feat(cashu-card): CLEAR_SPENT, slot-shape check and spent-slot reads (ENG-631)

Add the CLEAR_SPENT (0x31) APDU and `isProofShaped`, the card file's slot
checks that tell a CLEAR_SPENT remnant from a proof. A card read now reads
every occupied slot (`readCardSlots`) and carries the spent slots on
`CashuCardInfo.spentSlots`, so the next top-up can ask the mint about them
before its load tap. The Flashcard context re-reads the slots after an op
that moved the balance or the spent count, so a clear shows at once.

`getUnspentByKeyset` still reads unspent slots only; nothing here sends
CLEAR_SPENT.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WxkKbrg2Xohf3mQj7BLrs6

* feat(cashu-card-topup): reclaim mint-settled spent slots on the load tap (ENG-631)

`reclaimVerdicts` asks the mint (NUT-07) about the card's proof-shaped spent
slots before the tap; `reclaimPlan` says what a reclaim will do with them;
`reclaimSpentSlots` re-reads the spent slots in the session and sends
CLEAR_SPENT only when every one is a remnant or mint-SPENT, otherwise sends
nothing and counts what is still settling. `prepareTopUp` counts
`card.reclaimable` as room; `loadTopUp` itself still never clears, and its
inventory no longer takes a torn spent slot's nonce as the record's proof.
`TopUpError` can carry the reclaim's result with a refusal.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WxkKbrg2Xohf3mQj7BLrs6

* feat(flashcard-v2): free settled spent slots on the top-up's load tap (ENG-631)

The load tap now runs VERIFY_PIN, the reclaim, then the load in one session;
the mint is asked about the spent slots before the tap, and a mint that
cannot answer costs no tap. The amount step counts the slots the tap will
free as room (`reclaimable`), the done step says how many were freed, and a
no-room refusal says how many spent slots are still settling. The card
screen shows unspent, spent and free counts with a note on spent slots.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WxkKbrg2Xohf3mQj7BLrs6

* fix(cashu-card-topup): hand the reclaim's card read to the load, and drop the retry note from the done step (ENG-631)

Review fixes on #759.

- `reclaimSpentSlots` hands on what it read (`inventory`: the slot
  statuses and each spent slot's proof) when it sent no CLEAR_SPENT, and
  `loadTopUp` takes that in place of a read of its own. A first load in
  the same tap now sends no GET_SLOT_STATUS; a resumed load reads only
  the unspent slots, taking the spent ones from the reclaim. After a
  clear the read is stale and the load reads the card afresh, which
  after a full clear means the unspent slots alone. On a resumed load
  of a card with k spent and u unspent slots that is u GET_PROOFs
  before the first LOAD_PROOF instead of 1 + k + u.
- The done step's settling note no longer reuses `topUpSlotsSettling`,
  whose "Try again later." belongs to the `slots` refusal: a load that
  went through has nothing to try again. New `topUpSettlingNote`.

Tests: engine tests count the tap's APDUs for a first and a resumed load
with and without a clear, and assert the inventory handed on (or not);
the hook test checks the hand-off; the screen test asserts the new note
and that it carries no retry imperative.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WxkKbrg2Xohf3mQj7BLrs6

* chore(i18n): add FlashcardV2 reclaim copy to every locale

Mirror the five new FlashcardV2 keys (slotsSpentNote, topUpSlotsReclaim,
topUpReclaimed, topUpSlotsSettling, topUpSettlingNote) and the updated
slotSummary into all 23 locale files, the same way #746/#747/#755 did,
so check:translation-drift passes.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WxkKbrg2Xohf3mQj7BLrs6

* fix(flashcard-v2): wait for the reclaim plan before showing the amount field, and rethrow the engine's own refusal (ENG-631)

Review fixes on #759:

- The amount field waited for the unfinished-top-ups read but not for the
  reclaim plan. On a card with no empty slot and every slot spent, the room
  was 0 until the mint answered, so the field refused every amount ("try a
  smaller amount") and then changed its mind a round-trip later. The screen
  now tracks the plan settling (`reclaimRead`), set at once when there is
  nothing to ask about and in a `finally` otherwise, and the field waits on
  both reads.

- `useCardTopUp.load` built a fresh TopUpError to attach the reclaim, so a
  refused load's stack pointed at the catch block rather than the engine's
  own check. `TopUpError.reclaim` is now writable and the original error is
  rethrown with it set.

Tests: two screen tests hold the plan (resolve / reject) and assert no field
mounts until it settles; a hook test asserts the rejected error is the very
one the engine threw.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WxkKbrg2Xohf3mQj7BLrs6

* fix(flashcard-v2): show a spinner while the amount field waits on the reclaim plan (ENG-631)

Review fix on #759:

- The amount field waits for the reclaim plan, and that plan is a mint
  round-trip over the phone's network with no timeout. On a card with
  spent slots the amount step showed the unit caption, "Paid from" and a
  disabled Continue around a blank gap for as long as the mint took to
  answer, or RN fetch took to fail. An ActivityIndicator now sits in the
  field's slot (`topup-amount-loading`) until both the unfinished-top-ups
  read and the plan have settled, matching the screen's own loading step.

- The held-plan, held-read and refused-mint screen tests assert the
  indicator is present before settle/refuse and gone after.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WxkKbrg2Xohf3mQj7BLrs6

---------

Co-authored-by: Dread <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
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