Spark Wallet UX + Lightning Flow — Chronological Build Log
Briefing and Constraints
You asked for the Spark wallet to look exactly like the existing Bitcoin screen, keep code minimal, and avoid duplicate/legacy code. You also set strict process rules: no git commands, no tests, approvals before implementation, and short, precise responses. You wanted the receive/send flow to mirror Bitcoin UI and to support Lightning invoices, LNURL, and later onchain withdrawals from Spark.
Phase 1 — UI Parity and Automatic Claiming
- Goal: Make screens/SparkBitcoinWalletScreen.tsx visually match screens/BitcoinScreen.tsx.
- Key changes: Spark screen styling, spacing, typography, and button layout aligned to the Bitcoin screen; receive and send buttons matched exactly.
- Behavior change: Spark screen now auto-checks for pending transfers and auto-claims them into the Spark wallet.
- Apple Pay: The Apple Pay header button stayed, with a placeholder for passing the Spark deposit address later.
Phase 2 — Receive Modal Redesign (Spark)
- Goal: Make Spark receive screen match Bitcoin receive screen layout.
- Key changes in screens/SparkBitcoinReceiveModal.tsx:
- Address at the top.
- QR code positioned in the same layout as Bitcoin receive.
- Share / tap-to-copy interactions aligned with Bitcoin UI.
- Invoice creation UX:
- A sats input field styled like the Bitcoin send amount input.
- Euro line under it for parity.
- The button changed to “Create Invoice”.
- Behavior:
- Before invoice creation: show deposit address; hide invoice QR.
- After invoice creation: show only invoice + invoice QR in the same style.
Phase 3 — Caching and Responsiveness
- Goal: Remove long loading delays.
- Changes:
- Cached Spark deposit address and balance.
- Spark screen loads from cache first and refreshes in background.
Phase 4 — Spark Send Flow and Confirmation
- Goal: Mirror Bitcoin send flow with a final confirmation step.
- Changes:
- Scan or paste moves into screens/SparkLightningSendModal.tsx.
- Sender sees a confirm screen before any payment is sent.
- Zero-amount invoices prompt for amount entry instead of sending.
Phase 5 — LNURL and Lightning Address Support
- Goal: Support LNURL pay and Lightning address inputs.
- New service: services/SparkLnurlService.ts added:
- Normalize inputs (strip lightning: prefix).
- Resolve LNURL pay request (resolveLnurlPayRequest).
- Request invoice from LNURL callback (requestLnurlInvoice).
- Send modal changes in screens/SparkLightningSendModal.tsx:
- Accept LNURL bech32, LNURL URL, and Lightning address.
- Clamp amount to LNURL min; auto-fill minimum.
- Hide network errors from user UI; keep them for logs.
- If invalid input, clear prefill and highlight request input instead of showing invalid data.
Phase 6 — Onchain Withdrawals from Spark
- Goal: Allow “normal Bitcoin address” sends (Spark → L1).
- Service update in services/SparkBitcoinWalletService.ts:
- withdrawToBitcoinAddress uses Spark getWithdrawalFeeQuote + withdraw.
- Default exit speed: ExitSpeed.MEDIUM.
- Logs truncate address for safety.
- Screen logic update in screens/SparkBitcoinWalletScreen.tsx:
- Detect onchain address in handleConfirmSend.
- Route to withdrawToBitcoinAddress instead of payLightningInvoice.
- Refresh Spark balance and pending deposits after withdraw.
Phase 7 — UX Refinements You Requested
- Invalid prefill behavior:
- If paste/scan is not valid invoice/address/LNURL, the input is cleared and highlighted.
- Input focus and keypad:
- After valid prefill, amount input auto-focuses.
- Cursor stays at the end of the amount.
- Number pad opens immediately.
- Centering:
- Amount block is vertically centered between header and CTA.
- Title logic:
- Header shows memo if present.
- Otherwise “Send Lightning” or “Send Bitcoin” (onchain).
How You Guided the Build
- You gave clear visual comparisons (Bitcoin screen as the exact target).
- You caught UI mismatches quickly (icon, padding, layout) and asked for 1:1 copy.
- You prioritized minimal code and “no fallback” logic.
- You approved changes step-by-step and clarified edge cases:
- Zero-amount invoices should prompt.
- LNURL should be pay-only for now.
- Network errors should not be user-facing.
- You pushed for exact UX flow consistency, especially around confirmation, validation, and amount entry.
What We Did Not Do
- No git commands.
- No tests (explicitly requested).
- No changes to the original Bitcoin screen.
Current State Summary
- Spark wallet UI matches Bitcoin screen layout.
- Receive modal matches Bitcoin receive flow, with Spark deposit address and invoice creation.
- Send modal supports Lightning invoices, LNURL, Lightning addresses, and onchain BTC addresses.
- Invalid input never pre-fills; amount flow is focused and centered.
- Spark balance and deposit address are cached for faster UI.
Post created via email from emin@nuri.com