android: wallet screen batch (unlocked line, copy, restore height, direction, send, view-only) #159

Owner

The Android half of the wallet batch, on top of the seed-offset import card.

Base: onionwire/t_a6258883-onionwire-android-seed-offset-field-on-w (PR #157, still open) — this branch also merges the core branch onionwire/t_0329f5bf-onionwire-wallet-unlocked-balance-restor (PR #158) for the SDK surface it compiles against. Neither the offset field, its re-type, offset passphrases do not match, nor the blocking "offset not saved" card is touched.

1. Unlocked line

Wire.walletUnlockedBalance(), same off / err sentinels as walletBalance(). Under the headline, a dim mono unlocked {n} XMR when the call returned a number; omitted on off / err; shown even when it equals the total. Not a second error banner.

2. Copy the receive address

Quiet Copy under the address, gated exactly like the address itself. LocalClipboard + ClipEntry, with ClipDescription.EXTRA_IS_SENSITIVE set on the clip. Status copied address. The seed card still has no copy button and the invite copy path is untouched.

3. Restore height on seed import

Optional restore height after the offset field. Digits only (RestoreHeight.digitsOnly), helper: Blank scans from 0. A height after your first receive hides older funds. Blank calls through with an empty height string. importWallet / importWalletWithOffset are replaced by one importSeed(password, seed, offset, height) RPC, so offset and height go in one request. A non-empty offset still leaves offset_pending set and the SEEN card up.

4. Direction on recent transfers

TransferCard prefixes TransferRow.direction (in / out / pending), dim, before the truncated txid. Amount and txid are unchanged. The binding carries the field, so no default is invented.

5. Send to a pasted address

New quiet Send action — not the Invoice/Tip composer, which stays friend-only. Fields: visible address, amount XMR; then a confirm step that reads both back and requires SEND (WalletSendGate, its own word, not the seed gate's SEEN). No camera, no QR. Calls walletSend(address, amount); success clears the composer and reloads transfers, failure shows walletFailureText of the core's own string (view-only / unsynced refusals are the core's words, shown as-is, no chat message). Blank fields never reach the SDK; the address is never logged.

6. View-only import

View-only button beside Import (Import stays). Its own card: address, masked view key with a re-type gate (view keys do not match, no RPC on mismatch), optional restore height, wallet file passphrase. Calls importViewOnly(password, address, viewKey, height). The key is never logged, never copied, and dies with the card.

A view-only wallet has no seed: the create-seed SEEN gate is not run and SEED_BACKED_UP_KEY is not written on this path (that flag is install-wide and would lie about a different wallet). SeedBackupGate gains a viewOnly input — true hides the unbacked warning, keeps the receive address visible, and outranks the offset card; false keeps every existing rule. walletViewOnly() is the only probe (walletKeys() is never called to decide this), paired with a session flag set by this screen's own view-only import so a probe that has not answered cannot flash the unbacked card. Nothing new is persisted in prefs. The balance card is labelled view-only in onSurfaceVariant.

Visual

Terminal instrument: no scanlines, no extra accent, no new filled buttons. Copy, Send and View-only are quiet text/outlined at the same weight as Import, at labelSmall.

Tests

./gradlew :app:testDebugUnitTest --tests '*SeedBackupGateTest*'

BUILD SUCCESSFUL — 34 tests, 0 failures (24 existing offset/seed cases still pass, 10 new: view-only hides the warning and shows the address, viewOnly=false keeps the old rules, restore-height filtering, and the send word). Full app JVM suite: 229 tests / 0 failures. :app:assembleDebug green (app-debug.apk, 40,755,755 B, sha256 d233bf2e88fda1b728ba409ef50cdfbac6f2ee0b97cc43ee37280b03fcb6dca2). Not verified on a device.

Scope

WalletScreen.kt, WireViewModel.kt, ui/SeedBackupGate.kt, ui/SeedBackupGateTest.kt. Nothing under src/, crates/, docs/, no camera, no seed clipboard, no sealing of the view key.

The Android half of the wallet batch, on top of the seed-offset import card. **Base:** `onionwire/t_a6258883-onionwire-android-seed-offset-field-on-w` (PR #157, still open) — this branch also merges the core branch `onionwire/t_0329f5bf-onionwire-wallet-unlocked-balance-restor` (PR #158) for the SDK surface it compiles against. Neither the offset field, its re-type, `offset passphrases do not match`, nor the blocking "offset not saved" card is touched. ### 1. Unlocked line `Wire.walletUnlockedBalance()`, same `off` / `err` sentinels as `walletBalance()`. Under the headline, a dim mono `unlocked {n} XMR` when the call returned a number; omitted on `off` / `err`; shown even when it equals the total. Not a second error banner. ### 2. Copy the receive address Quiet `Copy` under the address, gated exactly like the address itself. `LocalClipboard` + `ClipEntry`, with `ClipDescription.EXTRA_IS_SENSITIVE` set on the clip. Status `copied address`. The seed card still has no copy button and the invite copy path is untouched. ### 3. Restore height on seed import Optional `restore height` after the offset field. Digits only (`RestoreHeight.digitsOnly`), helper: *Blank scans from 0. A height after your first receive hides older funds.* Blank calls through with an empty height string. `importWallet` / `importWalletWithOffset` are replaced by one `importSeed(password, seed, offset, height)` RPC, so offset and height go in one request. A non-empty offset still leaves `offset_pending` set and the SEEN card up. ### 4. Direction on recent transfers `TransferCard` prefixes `TransferRow.direction` (`in` / `out` / `pending`), dim, before the truncated txid. Amount and txid are unchanged. The binding carries the field, so no default is invented. ### 5. Send to a pasted address New quiet `Send` action — not the Invoice/Tip composer, which stays friend-only. Fields: visible address, amount XMR; then a confirm step that reads both back and requires `SEND` (`WalletSendGate`, its own word, not the seed gate's `SEEN`). No camera, no QR. Calls `walletSend(address, amount)`; success clears the composer and reloads transfers, failure shows `walletFailureText` of the core's own string (view-only / unsynced refusals are the core's words, shown as-is, no chat message). Blank fields never reach the SDK; the address is never logged. ### 6. View-only import `View-only` button beside `Import` (Import stays). Its own card: address, masked view key with a re-type gate (`view keys do not match`, no RPC on mismatch), optional restore height, wallet file passphrase. Calls `importViewOnly(password, address, viewKey, height)`. The key is never logged, never copied, and dies with the card. A view-only wallet has no seed: the create-seed SEEN gate is not run and **`SEED_BACKED_UP_KEY` is not written on this path** (that flag is install-wide and would lie about a different wallet). `SeedBackupGate` gains a `viewOnly` input — true hides the unbacked warning, keeps the receive address visible, and outranks the offset card; false keeps every existing rule. `walletViewOnly()` is the only probe (`walletKeys()` is never called to decide this), paired with a session flag set by this screen's own view-only import so a probe that has not answered cannot flash the unbacked card. Nothing new is persisted in prefs. The balance card is labelled `view-only` in `onSurfaceVariant`. ### Visual Terminal instrument: no scanlines, no extra accent, no new filled buttons. Copy, Send and View-only are quiet text/outlined at the same weight as Import, at `labelSmall`. ### Tests ``` ./gradlew :app:testDebugUnitTest --tests '*SeedBackupGateTest*' ``` BUILD SUCCESSFUL — 34 tests, 0 failures (24 existing offset/seed cases still pass, 10 new: view-only hides the warning and shows the address, `viewOnly=false` keeps the old rules, restore-height filtering, and the send word). Full app JVM suite: 229 tests / 0 failures. `:app:assembleDebug` green (`app-debug.apk`, 40,755,755 B, sha256 `d233bf2e88fda1b728ba409ef50cdfbac6f2ee0b97cc43ee37280b03fcb6dca2`). Not verified on a device. ### Scope `WalletScreen.kt`, `WireViewModel.kt`, `ui/SeedBackupGate.kt`, `ui/SeedBackupGateTest.kt`. Nothing under `src/`, `crates/`, `docs/`, no camera, no seed clipboard, no sealing of the view key.
wallet: unlocked balance, restore height, outgoing rows, send, view-only import
All checks were successful
ci / test (pull_request) Successful in 6m39s
ci / sdk (pull_request) Successful in 1m31s
android-ci / android (pull_request) Successful in 12m57s
ci / fuzz (pull_request) Successful in 5m3s
93deaa5309
`get_balance` carries two numbers and the wallet screen only showed one:
`Node::wallet_balance_line` now reads both out of a single answer
(`balance {total} XMR · unlocked {unlocked} XMR`, the `balance 0 XMR` prefix
kept, total-only when the RPC reports no unlocked half), and
`Node::wallet_unlocked_balance` reports the unlocked half on its own with
`wallet_balance`'s `off` / `err` sentinels. `wallet_balance` keeps its shape.

`get_transfers` sends `out: true` and parses the `out` bucket, so `TransferRow`
carries `direction` (`in`, `out`, `pending`; a pending item's own `type` wins)
and the screen can tell a spent transfer from a received one.

`Wallet::restore_wallet` / `Node::wallet_restore` take an optional
`restore_height` beside the seed offset: blank omits the field, a typed `0` is
sent as `0`, `Some(n)` is a JSON number, and a non-numeric height is a local
refusal (`restore height must be a block number`). A height after the first
receive hides the older funds and this version has no rescan — the TUI says so
on its own step, whose footer is not the offset's.

`Node::wallet_send` spends to a pasted address: `check_address`, then
`xmr_to_atomic`, then `Wallet::transfer` — no friend, no `tip` frame, no chat
line, no payment row. The outgoing transfer list is the record. `pay::check_address`
and `Wallet::transfer` own the gates, so a view-only or unsynced refusal is the
string they already return.

`Wallet::import_view_only` / `Node::wallet_import_view_only` watch an address
through `generate_from_keys` with no `spendkey` in the request at all: same
filename/password refusals, `check_address`, a 64-hex view key or a local
refusal, no 64th catalogue column. The view key is typed into a hidden entry
(twice), is never sealed, never logged and never on an argv, and the screen
wipes it on every exit.

TUI: `n` sends (address, amount, then `SEND`; Esc spends nothing), `y` copies
the receive address over OSC 52, `v` imports a view-only wallet (no seed, so no
`SEEN` gate), and the seed import gained a `restore height` step between the
offset and the file passphrase. The wallet footer and its help line carry the
new keys and keep every old token. The F6 body renders in the flexible region —
a bordered block in the two-row slot it used drew its borders and clipped the
whole body, address and balance line included.

SDK: `wallet_unlocked_balance`, `wallet_send`, `wallet_view_only`,
`import_seed(password, seed, offset, height)` and
`import_view_only(password, address, view_key, height)`, plus
`TransferRow.direction`. `wallet_balance`, `import_wallet` and
`import_wallet_with_offset` are untouched.

Docs: WALLET (unlocked vs total, restore height, outgoing rows, local send,
view-only import), THREAT_MODEL (a view key entered at import is a secret and a
view-only file is not a spend authority), TUI (footer + the new keys and steps),
README (one sentence).

Tests: recorded-request cases in `tests/wallet.rs` (height as a number and
omitted when blank, `generate_from_keys` carries the view key and no spendkey,
`get_transfers` asks for `out`, `wallet_send` reaches `transfer` and never
`tip`, a bad view key never dials), node-level line/unlocked pairs from one
dial, and TUI step tests for the send, copy, height and view-only flows.

No new crate, no Cargo change, no android/ change.
android: unlocked balance, address copy, restore height, send, view-only import
All checks were successful
ci / test (pull_request) Successful in 6m5s
ci / sdk (pull_request) Successful in 1m6s
ci / fuzz (pull_request) Successful in 4m55s
android-ci / android (pull_request) Successful in 13m1s
5d000155d0
Consumes the core branch's SDK surface (wallet_unlocked_balance,
wallet_send, wallet_view_only, import_seed, import_view_only,
TransferRow.direction) on top of the seed-offset import card.

- balance card: a dim mono `unlocked {n} XMR` under the headline, same
  off/err sentinels as walletBalance, omitted for both sentinels and shown
  even when it equals the total.
- receive address: a quiet `Copy` under it, gated with the address itself.
  ClipEntry marked ClipDescription.EXTRA_IS_SENSITIVE, status `copied
  address`. The seed still has no copy button.
- seed import: optional `restore height` after the offset field, digits
  only, helper says a height after the first receive hides older funds.
  importWallet/importWalletWithOffset are replaced by one importSeed(
  password, seed, offset, height) RPC; the offset is still trimmed, blank
  still means the plain path, and a non-empty offset still leaves the
  persisted offset_pending flag and its SEEN card.
- recent transfers: TransferCard prefixes the core's own direction
  (in/out/pending), dim, before the truncated txid.
- Send: a quiet action with address + amount, then a confirm step that
  requires SEND (WalletSendGate, deliberately not the seed gate's SEEN).
  Calls walletSend; success clears the composer and reloads transfers, a
  failure shows the core's own words (view-only / unsynced) verbatim.
  Blank fields never reach the SDK. Not the friend-only Invoice/Tip path.
- View-only: a `View-only` button beside Import, and its own card —
  address, masked view key with a re-type gate (`view keys do not match`,
  no RPC on mismatch), optional restore height, wallet file passphrase.
  Calls importViewOnly. The key is never logged or copied and dies with
  the card; SEED_BACKED_UP_KEY is not written on this path.
- SeedBackupGate: new `viewOnly` input. True hides the unbacked-seed
  warning, shows the receive address, and outranks the offset card; false
  keeps every existing rule. The probe is walletViewOnly(), never
  walletKeys(). The screen pairs it with a session flag set by its own
  view-only import, so a probe that has not answered cannot flash the
  unbacked card over a wallet with no seed. Balance card is labelled
  `view-only` in onSurfaceVariant.

Tests: :app:testDebugUnitTest --tests '*SeedBackupGateTest*' -> 34 tests,
0 failures (24 existing + 10 new), plus the full app JVM suite 229/0.
:app:assembleDebug green (app-debug.apk 40,755,755 B). Not verified on a
device.
sirius merged commit bfbe12f386 into onionwire/t_a6258883-onionwire-android-seed-offset-field-on-w 2026-09-26 00:57:37 +00:00
sirius deleted branch onionwire/t_63a0ca13-onionwire-android-wallet-screen-batch-un 2026-09-26 00:57:44 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/onionwire!159
No description provided.