Skip to content

feat: import the phone's settings and quickpay on the watch - #2188

Draft
jvsena42 wants to merge 15 commits into
feat/wear-paymentsfrom
feat/wear-settings-sync
Draft

jvsena42 wants to merge 15 commits into
feat/wear-paymentsfrom
feat/wear-settings-sync

Conversation

@jvsena42

@jvsena42 jvsena42 commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Part of #2105
Source: team, #2105

Warning

Do not publish the Wear app until #2152 ships. The watch runs the same Spark wallet as the phone, and Spark real-time sync is off (realTimeSyncServerUrl = null), so two live instances share no state. Mainnet is also gated off in this build (Env.IS_MAINNET_ENABLED = false).

Stacked on #2182 (feat/wear-payments). This PR makes the watch adopt the phone's settings by reading the phone's settings backup from VSS, read-only, and adds QuickPay on the watch with the phone's rules.

Description

  • Adds a read-only import of the phone's settings backup (BackupCategory.SETTINGS) from VSS. The watch derives the same store id and LNURL-auth sign-in from the shared recovery phrase and passphrase, and its VSS code can only read: one reader interface with a single read, one file naming the library, and a test that fails if anything else appears. It imports when the wallet is ready on screen, every 5 minutes while the app is open (not in ambient), and when the wearer taps the new "Phone settings" row; it never writes, deletes or lists.
  • Adopts the phone's primary display, bitcoin unit (Modern or Classic), fiat currency and QuickPay settings. The watch has no option to change them. The Balance page, send, receive, activity and the tile all follow the imported unit; tapping the balance still swaps until the phone's setting changes.
  • Adds QuickPay on the watch, matching the phone's rules: an invoice with its amount (also in a unified URI) or a fixed-amount LNURL-pay / Lightning address, valued without the fee against the QuickPay amount at the last USD rate, within the daily limit, with a failed or unsent payment released. It skips Review and hold and goes straight to sending and the same result screens. The self-send guard and every pre-hold check run first.
  • QuickPay never applies to a send nobody is watching: a link that waited for the wallet more than 30 s, a lock, pause or ambient in between, a send flow Android recreated, or a link replayed from Recents. QuickPay is off until the first successful import, and turns off when the backup is missing, unreadable or a newer format.
  • Adds a contract fixture checked from both sides (WatchBackupContractTest.kt on the phone, PhoneBackupContractTest.kt on the watch), so a renamed phone setting fails a test instead of silently turning QuickPay off.
  • Adds docs (docs/wear.md › Settings sync, QuickPay) and journeys.

Out of Scope

  • wear: the phone and the watch each keep their own QuickPay daily count until pairing, so together they can spend up to twice the daily limit. The live settings push and shared state come with the pairing PR.
  • wear: QuickPay turned off on the phone reaches the watch at its next successful import (on open, every 5 minutes, or a tap on Phone settings).
  • wear: the phone can require its PIN to raise QuickPay limits; the watch has no PIN and adopts whatever the phone saved.
  • wear: the watch keeps no payment ledger, so a QuickPay payment that was pending and fails later stays counted for the day (the phone reconciles it). Stricter, never looser.
  • wear: an app on the paired phone could open a payment link on the watch while the watch screen is on and unlocked; that counts as attended. Documented.
  • wear: the VSS library's LNURL-auth sign-in has no timeout, so a sign-in server that never answers can block later imports until the process ends. Documented; the fix belongs in the library.
  • Deferred review findings:

Design

N/A — no design available. #2105 is a prototype with no Figma; the one new Settings row follows the existing watch Settings rows.

Preview

Large round emulator (454 px, Wear OS 7), local ./spark stack, phone settings from the hosted staging VSS, app commit 0cd1fdd6b.

Phone settings row Imported Classic + EUR QuickPay: Sent Over the limit: hold
Settings with the Phone settings row and its sync time Balance in Classic with EUR after the import Sent 200 sats under QuickPay, no review or hold Review with hold to pay for 10 000 sats over the QuickPay limit

Recordings (large round emulator):

  • QuickPay pays 200 sats with no review or hold:
quickpay-skips-hold.mp4
  • Over the limit, the hold comes back:
quickpay-over-limit-holds.mp4
  • Tapping Phone settings imports the phone's unit and currency:
settings-import-units.mp4

QA Notes

Setup

  • Watch: Wear_Large_Round_API37 as in feat: add wear os app foundation #2177, with the local-stack build (journeys/wear/README.md › Local ./spark stack, bitkit-docker spark-* services and bitcoind).
  • Phone: an Android 36 phone emulator (system-images;android-36;google_apis_playstore;x86_64, no Google account) with the plain phone dev build; it writes its settings to Blocktank's hosted staging VSS. Run one emulator at a time: set the phone's settings, wait for the upload, stop the phone, then start the watch.
  • Wallet: the public test phrase plus a per-machine passphrase (journeys/wear/README.md › Private settings wallet), so each machine's settings backup is its own. Fund it with receive-paid.xml.

Journeys

  • J1: new settings-import-units.xml — the watch adopts the phone's primary display, unit and currency
  • J2: new settings-swap-survives-import.xml — a swap on the watch survives an import of unchanged settings
  • J3: new quickpay-skips-hold.xml — an invoice under the limit pays without Review or hold
  • J4: new quickpay-on-app-start.xml — a link that starts the app pays under QuickPay
  • J5: new quickpay-over-limit-holds.xml — an invoice over the limit shows Review and hold
  • J6: new quickpay-off-holds.xml — QuickPay off on the phone brings back Review and hold

Manual Tests

  • 1. On a physical watch, open a payment link from Bitkit in Recents after backing out of its Review → the app opens on Home and nothing is paid (the replayed link is ignored)

Automated Checks

  • added PhoneBackupReaderTest.kt — the VSS reader can only read; no other source names the library or a write call
  • added PhoneSettingsParserTest.kt — envelope, field and enum forms, unknown keys, size limit, newer versions
  • added PhoneBackupContractTest.kt, WatchBackupContractTest.kt — the fixture matches the phone's serializer, store id prefix and URLs, and the watch's parser
  • added SettingsSyncRepoTest.kt — import timing, minimum gap, cancellation when the wallet stops being ready, wipe races, unreadable backups turning QuickPay off
  • added QuickPayRepoTest.kt — the phone's threshold, boundary and daily-limit arithmetic, missing rates, release paths
  • added QuickPaySpendStoreTest.kt — the day's count, time zones, release
  • added ReplayedLaunchTest.kt — a launch from Recents is a plain launch
  • updated PaymentsRepoTest.kt, SendViewModelTest.kt — eligible inputs, attendance window, recreated flows, release on failure, never-imported settings
  • updated SettingsStoreTest.kt, CurrencyTest.kt, HomeViewModelTest.kt, SettingsViewModelTest.kt, ActivityViewModelTest.kt, ReceiveViewModelTest.kt, TileStateTest.kt — imported settings, Classic formatting, the Phone settings row, the tile's unit

Evidence

  • Rebased onto feat: add wear payments and the self-send guard #2182's link-schemes and offline-error commits at 92493bc43: gate passed (just compile, just test, just lint); a race where QuickPay's second look said yes with the wallet already Offline was found by a new test and fixed. J1–J6 below ran before this rebase, at 0cd1fdd6b.
  • Gate on the final tree (0cd1fdd6b): just compile, just test, just lint all passed with strict dependency verification.
  • J1–J6 passed on Wear_Large_Round_API37 (Wear OS 7) at 0cd1fdd6b: the watch on the local ./spark stack, the phone (Bitkit_Phone_API36, Android 16, dev build) writing to the hosted staging VSS, with the public test phrase plus a per-machine passphrase. J3 and J4 paid 200 sats with the hold skipped (J4 from a cold start, in about 4 s); J5 showed the hold for 10 000 sats and nothing paid before it; J6 showed the hold for 200 sats after QuickPay was turned off on the phone.
  • A watch emulator smoke check earlier in the branch imported a real backup 1.8 s after the wallet synced.
  • Every QuickPay rule was checked against the phone's code in review (threshold, rounding, cents counted, daily cap, release on failure, eligible inputs).

Gaps

  • Manual test 1 (Recents replay) needs a physical watch; ReplayedLaunchTest.kt checks only the flag.
  • The daily cap, a typed amount, and a missing, unreadable or newer backup have no journey; unit tests only.
  • The small round watch was not run for this PR.
  • J1–J6 were not rerun after the rebase at 92493bc43; the merged offline and QuickPay behaviour is unit-tested (SendViewModelTest.kt, PaymentsRepoTest.kt).
  • In Classic the large balance reads 0.0005000 while the secondary reads 0.00050000; same value, to be compared with the phone's Classic format.
  • On an iOS-written backup nothing was tried; if a QuickPay key is missing, QuickPay stays off.

Models used

  • Planning/scoping: claude-opus-5-5 (reasoning: medium)
  • Implementation: claude-fable-5-2 (reasoning: medium), claude-opus-5-5 (reasoning: medium)
  • Review: claude-fable-5-2 (reasoning: medium), claude-opus-5-5 (reasoning: medium)
  • Review rounds: 4
  • Journey runs: claude-sonnet-5-5 (reasoning: medium)

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Regtest APK

Built from aa51146 (run).

Download bitkit-dev-debug universal APK (expires in 30 days).

jvsena42 and others added 15 commits December 4, 2026 13:10
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… settings import

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… in the repo's own scope

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e wait

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…schemes

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@jvsena42
jvsena42 force-pushed the feat/wear-settings-sync branch from 886e270 to aa51146 Compare December 4, 2026 12:10

This branch has not been deployed

No deployments
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