Skip to content

feat(keychain): disable unaffordable payment tokens + singlePurchaseOnly option - #2656

Merged
bal7hazar merged 1 commit into
mainfrom
feat/purchase-token-gating
Jul 21, 2026
Merged

bal7hazar merged 1 commit into
mainfrom
feat/purchase-token-gating

Conversation

@bal7hazar

Copy link
Copy Markdown
Collaborator

Summary

Two bundle/starterpack purchase UX fixes:

  • Token selector: currencies whose balance cannot cover the purchase are now disabled in the dropdown (new useTokenSufficiency hook reusing the fallback pricing logic — direct cost for the payment token / USDC variants, Ekubo quote otherwise). This removes the confusing flow where picking an unaffordable token triggered the balance check and silently auto-switched to another currency. The USD (credits) option is never disabled so users can always deposit funds. Unknown balances/quotes leave the token selectable (unknown ≠ insufficient).
  • singlePurchaseOnly option on BundleOptions and StarterpackOptions: when set, the +/- quantity buttons are hidden and quantity is fixed at 1; the Apple Pay minimum quantity auto-bump is skipped (its existing "Amount Too Low" gate takes over). Without the option, behavior is unchanged.

Test plan

  • New unit tests for useTokenSufficiency (payment token, quantity scaling, swap-quoted tokens, credits pseudo-token, balance errors)
  • Full keychain suite (752 tests) and controller suite (72 tests) pass
  • tsc -b and eslint clean on both packages

🤖 Generated with Claude Code

…chaseOnly option

Two bundle-purchase UX fixes:

- The token selector listed every currency, including ones the paying
  wallet could not cover; picking one triggered the balance check and
  auto-switched to another funded currency. The selector now disables
  tokens whose balance cannot cover the purchase (via a new
  useTokenSufficiency hook mirroring the fallback pricing logic). The
  USD/credits option is never disabled so users can still top up.

- New optional singlePurchaseOnly flag on BundleOptions and
  StarterpackOptions: when set, the +/- quantity buttons are hidden and
  the quantity is fixed to 1 (the Apple Pay minimum auto-bump is also
  skipped; its "Amount Too Low" gate takes over). Default behavior is
  unchanged.

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

vercel Bot commented Jul 21, 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 21, 2026 7:42am
controller-ui Ready Ready Preview Jul 21, 2026 7:42am
keychain Ready Ready Preview Jul 21, 2026 7:42am
keychain-storybook Ready Ready Preview Jul 21, 2026 7:42am

Request Review

This branch was successfully deployed

4 active deployments
Preview – keychain-storybook — fe0f15fc Deployed Jul 21, 2026 by vercel[bot]
Preview – keychain — fe0f15fc Deployed Jul 21, 2026 by vercel[bot]
Preview – controller-example-next — fe0f15fc Deployed Jul 21, 2026 by vercel[bot]
Preview – controller-ui — fe0f15fc Deployed Jul 21, 2026 by vercel[bot]
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