tui(history): payment history and tx detail screen #83

Merged
sirius merged 4 commits from wt/t_935bf84e into feat/wallet-create-import 2026-09-16 04:01:38 +00:00
Owner

Payment history + tx detail (card t_935bf84e)

Implements Screen::History with draw_history, history_row_text, history_detail. The h key opens payment history from both the main screen and the wallet screen. State (payments list) is loaded once on open via Node::list_payments and re-read only on explicit refresh — the 100ms poll never hits the store per frame.

What

  • history_row_text: direction marker (> /< ), amount via pay::atomic_to_xmr_str, verified state as word + glyph (verified/unverified), truncated txid, awaiting receipt when txid is None. ASCII mode drops glyphs, keeps words.
  • history_detail: full txid, address, memo, amount, direction, verified state, timestamp. All peer-supplied fields (memo, address) sanitized via sanitize::display_text first.
  • draw_history: full-screen overlay, empty state no payments with this friend yet, Enter toggles detail, Esc back.
  • help_overlay_text() extended with F6 h payment history with selected friend; tests/tui_chrome.rs needle list extended with F6 h.

Refresh policy

Refresh on open (loads the list), after send, and on explicit refresh key. No 100ms re-query of the store — state lives on the Screen::History struct.

Evidence

cargo test --locked → 0 failures. cargo clippy --locked --all-targets -- -D warnings → clean.

Frames at 80x24

Empty:

┌history  bob──────────────────────────────────────────────────────────────────┐
│no payments with this friend yet                                              │
└──────────────────────────────────────────────────────────────────────────────┘
Enter detail  Esc back  ? help                                                  ```

Mixed verified/unverified list:

┌history alice────────────────────────────────────────────────────────────────┐
│> 0.001 XMR ✓ verified abcdef012345678… 21m │
│< 0.05 XMR ✓ verified deadbeefdeadbee… 3m │
│> 0.0005 XMR ✗ unverified awaiting receipt 1m │
└──────────────────────────────────────────────────────────────────────────────┘
Enter detail Esc back ? help ```

Detail view with hostile memo (input contains a C0 control char + bidi override; rendered as inert paynowreverse):

┌history  alice  detail────────────────────────────────────────────────────────┐
│txid  awaiting receipt                                                        │
│address  (none)                                                               │
│memo  paynowreverse                                                           │
│amount  0.0005 XMR                                                            │
│kind  invoice                                                                 │
│direction  outbound                                                           │
│verified  unverified                                                          │
│timestamp  1700000200 (1m ago)                                                │
└──────────────────────────────────────────────────────────────────────────────┘
Esc back  ? help                                                                ```

### Files changed
- `src/tui.rs`: `Screen::History`, `draw_history`, `history_row_text`, `history_detail`, `verified_text`, `txid_display`, `payment_age`, `payment_direction`, `wrap_text`, `open_history`, key handling, `Screen::History` footer hints
- `tests/tui_spec.rs`: row/detail/empty/ASCII tests
- `tests/tui_chrome.rs`: `F6 h` needle
- `tests/tui_frames.rs`: frame dump tests for evidence
- `docs/TUI.md`: after frames added to Deliverable 5
## Payment history + tx detail (card t_935bf84e) Implements `Screen::History` with `draw_history`, `history_row_text`, `history_detail`. The `h` key opens payment history from both the main screen and the wallet screen. State (payments list) is loaded once on open via `Node::list_payments` and re-read only on explicit refresh — the 100ms poll never hits the store per frame. ### What - `history_row_text`: direction marker (`> `/`< `), amount via `pay::atomic_to_xmr_str`, verified state as word + glyph (`verified`/`unverified`), truncated txid, `awaiting receipt` when txid is None. ASCII mode drops glyphs, keeps words. - `history_detail`: full txid, address, memo, amount, direction, verified state, timestamp. All peer-supplied fields (memo, address) sanitized via `sanitize::display_text` first. - `draw_history`: full-screen overlay, empty state `no payments with this friend yet`, `Enter` toggles detail, `Esc` back. - `help_overlay_text()` extended with `F6 h payment history with selected friend`; `tests/tui_chrome.rs` needle list extended with `F6 h`. ### Refresh policy Refresh on open (loads the list), after send, and on explicit refresh key. No 100ms re-query of the store — state lives on the `Screen::History` struct. ### Evidence `cargo test --locked` → 0 failures. `cargo clippy --locked --all-targets -- -D warnings` → clean. ### Frames at 80x24 Empty: ``` ┌history bob──────────────────────────────────────────────────────────────────┐ │no payments with this friend yet │ └──────────────────────────────────────────────────────────────────────────────┘ Enter detail Esc back ? help ``` Mixed verified/unverified list: ``` ┌history alice────────────────────────────────────────────────────────────────┐ │> 0.001 XMR ✓ verified abcdef012345678… 21m │ │< 0.05 XMR ✓ verified deadbeefdeadbee… 3m │ │> 0.0005 XMR ✗ unverified awaiting receipt 1m │ └──────────────────────────────────────────────────────────────────────────────┘ Enter detail Esc back ? help ``` Detail view with hostile memo (input contains a C0 control char + bidi override; rendered as inert `paynowreverse`): ``` ┌history alice detail────────────────────────────────────────────────────────┐ │txid awaiting receipt │ │address (none) │ │memo paynowreverse │ │amount 0.0005 XMR │ │kind invoice │ │direction outbound │ │verified unverified │ │timestamp 1700000200 (1m ago) │ └──────────────────────────────────────────────────────────────────────────────┘ Esc back ? help ``` ### Files changed - `src/tui.rs`: `Screen::History`, `draw_history`, `history_row_text`, `history_detail`, `verified_text`, `txid_display`, `payment_age`, `payment_direction`, `wrap_text`, `open_history`, key handling, `Screen::History` footer hints - `tests/tui_spec.rs`: row/detail/empty/ASCII tests - `tests/tui_chrome.rs`: `F6 h` needle - `tests/tui_frames.rs`: frame dump tests for evidence - `docs/TUI.md`: after frames added to Deliverable 5
wallet: app-owned child lifecycle + user-chosen ChainSource
All checks were successful
ci / test (pull_request) Successful in 4m1s
ci / sdk (pull_request) Successful in 1m2s
8331a2dde6
The app now owns monero-wallet-rpc (and monerod when the chain source is
local) instead of requiring the user to start them and export
ONIONWIRE_WALLET_RPC.

- ChainSource enum: None / Local { monerod_bin, datadir } / Remote { host,
  port }. No default remote node; Remote is only constructed from explicit
  user input. A .onion Remote is refused without a SOCKS proxy (separate
  card).
- WalletChild in src/wallet_child.rs spawns monero-wallet-rpc with
  --rpc-bind-ip 127.0.0.1, a random free loopback port, generated
  --rpc-login, and --wallet-dir /wallet; monerod too for a
  local source. --trusted-daemon is never passed.
- Generated RPC creds are sealed in the encrypted SQLCipher store
  (wallet_child table, AEAD on top of whole-db encryption), never a
  plaintext file. The Wallet client is built from the generated loopback
  URL, not from_env.
- Readiness predicate: chain_ready() requires synchronized==true, height>0,
  height>=target_height; can_spend() and can_verify_receipts() gate on it.
  Unsynced -> receipts stay verified=0, spend refused with a clear message.
- Backend-aware timeouts: local management calls keep 5s; chain-dependent
  calls (get_info, get_transfers, transfer) get 60s (CHAIN_RPC_TIMEOUT),
  because a first sync or a remote daemon outlasts 5s and a 5s cap there
  is what left receipts permanently unverified.
- node.rs ingest_receipt gates on can_verify_receipts() instead of
  configured() alone.
- docs/WALLET.md rewritten for the child lifecycle + chain source.

Base: feat/wallet-create-import (PR #66). Do not rebase onto main.

Co-Authored-By: Hermes Agent <agent@local>
Merge branch 'feat/wallet-create-import' into wt/t_69ce8e46
All checks were successful
ci / test (pull_request) Successful in 3m56s
ci / sdk (pull_request) Successful in 57s
3f62734efd
Reviewed-on: #73
wallet: stored config (F7), WalletStatus snapshot, pay/tip readiness guard
All checks were successful
ci / test (pull_request) Successful in 4m22s
ci / sdk (pull_request) Successful in 1m15s
d7e91f850a
The only input path for the wallet was env. Add the same three remote-mode
fields as stored config so the F7 screen can set them and headless runs read
one source of truth:

- `wallet_config` table in the encrypted store (one row; the login is sealed
  with the store data key under `onionwire/wallet-config/v1`, on top of
  SQLCipher). Empty URL clears it. `Store::load_wallet_config` /
  `save_wallet_config`.
- `WalletConfig { rpc_url, rpc_login: Zeroizing<String>, no_spend }` with a
  redacting `Debug`; `Wallet::from_config`, and `Wallet::for_boot` which
  prefers stored config, falls back to env, and refuses to dial a bad stored
  endpoint. Node::start* now reads the store before constructing the wallet.
- `WalletStatus { configured, connected, last_error, balance_line,
  receive_address }`: `connected` only ever comes from a probe
  (`Wallet::status`, get_address + get_balance); config alone leaves it false.
  `Node::wallet_status` is the cheap draw-path read, `wallet_refresh` the
  probe that folds into it.
- One-shot `Wallet::ping(rpc_url, rpc_login) -> PingResult { ok, status,
  error }` for the Test-connection button: same loopback/digest rules, errors
  redacted and capped.
- `readiness(configured, connected, no_spend, is_tip) -> Readiness` plus
  `Node::wallet_readiness` (async, block_on-friendly): not configured →
  NOT_CONFIGURED_MSG; /tip on a no-spend wallet → VIEW_ONLY_MSG before any
  dial; configured but not connected → NOT_CONNECTED_MSG; else ready.
- `Node::wallet_save_config` persists, validates first, then re-reads so the
  live wallet and snapshot follow a Save without a restart.
- `Node::wallet` is now a Mutex<Wallet> (cloned out before each await) so the
  wallet can be re-pointed mid-session.

Local-mode fields stay reserved: the child lifecycle is t_69ce8e46 and is not
wired here. docs/WALLET.md documents the stored config, boot precedence and
the exact guard copy.

Tests: 38 in tests/wallet.rs including exact-refusal-copy, boot precedence,
sealed-on-disk login, ping sanitization and connected-only-after-probe.
Reviewed-on: #75
TUI: node control, chain-source picker, honest wallet sync readiness
All checks were successful
ci / test (pull_request) Successful in 4m28s
ci / sdk (pull_request) Successful in 1m19s
cfdfe38536
Add the TUI control plane for the wallet child and chain source,
stacked on the wallet-child-lifecycle card:

- Chain-source picker (s): receive-only / local monerod / remote daemon
  with daemon-address entry + trust-shift warning for clearnet hosts
- Node control (n): start/stop the app-owned monero-wallet-rpc child,
  with fail-closed onion+SOCKS guard in the status line
- Wallet screen refreshes after picker/child changes, shows sync progress
  from the daemon and the chain-source/free-space/storage status line
- Honest spend guard: wallet view reflects real WalletStatus + Readiness
  so balance/transfer rendering only claims authority when the daemon is
  reachable, never while the child is silent
- Help overlay + footer hints updated for the new 's'/'n' keys
- Tests: chain-source round-trip through sealed record, saved-source
  starts the child, parse_source handles the 'none' kind
Reviewed-on: #76
node: read-only Node::list_payments(friend_pk) for the TUI payment history
All checks were successful
ci / test (pull_request) Successful in 4m29s
ci / sdk (pull_request) Successful in 1m19s
fe6465aa6b
Re-exposes the existing Store::list_payments as one typed read method so
src/tui.rs can render a friend's payment history without ever touching the
store. Maps the store error to Result<_, String> exactly like the
neighbouring list_messages / wallet_recent_transfers, and returns
store::Payment as-is (id, dir, kind, amount_atomic, address, memo, txid,
verified, created_at).

Read-only: no schema change, no migration, no new frame, no new column, no
docs/PROTOCOL.md change, and no store handle becomes reachable from the TUI.
An unknown friend is empty history (Ok(vec![])), not an error.

Test placement deviates from the card, deliberately: it lives in
src/node.rs's #[cfg(test)] mod tests instead of tests/pay.rs, because Node
has no constructor that avoids Tor (Node::start* is the only public one) and
ingest_receipt is private, so tests/pay.rs cannot build a Node at all. The
test uses an unbootstrapped Arti client plus a null deliverer over a real
encrypted store in a temp dir, writes the outbound row directly and drives
the inbound row through the node's own ingest_receipt.
Reviewed-on: #78
Reviewed-on: #79
tui(wallet): chain/daemon honesty, view-only badge, address copy (OSC 52)
All checks were successful
ci / test (pull_request) Successful in 4m34s
ci / sdk (pull_request) Successful in 1m20s
310671785b
- Screen::Wallet.view wrapped in Box<WalletView> to avoid large_enum_variant
- draw_wallet restructured to Deliverable 5 pane layout: primary, chain,
  history, action row, footer
- View-only wallet shows 'view-only' badge with spend status word
- ChainSource variants render their specific copy (Local/Remote/None)
- DaemonSync.reachable=false renders 'sync: unknown' with no balance claim
- Address copy via OSC 52 escape sequence; 'y' key; fallback hint on screen
- QR modal resized to fit 80x24 without clipping
- wallet_screen_at_with() test helper for copy_note parameter
- 33 new tests covering receive-only, local synced/syncing, remote
  unreachable, view-only badge, QR modal, address copy escape sequence

All 52 TUI tests pass (10 tui_frames + 19 tui_chrome + 23 tui_spec).
Clippy clean on lib and all three test targets.
fix(tui): replace emoji wallet badges with ASCII glyphs + word
All checks were successful
ci / test (pull_request) Successful in 4m3s
ci / sdk (pull_request) Successful in 59s
b9f84e6f4b
- Badge now '[!] view-only — /tip off' / '[ok] spend enabled'
  (never emoji, never colour-only; word carries meaning under NO_COLOR)
- Update test: assert 'view-only' word + ASCII '[!]' glyph present
- Add wallet frame dumps to dump_audit_frames: receive-only,
  local synced, local syncing, remote unreachable, view-only badge,
  QR modal — at 80x24 and 120x40
- Add wallet_screen_no_line_exceeds_frame_at_80_and_120: asserts
  every rendered line stays within frame width (chars_count metric)
- Add wallet_view_only_badge_renders_at_80_and_120: badge present
  and within width at both sizes

Tests: 21 tui_frames, 19 tui_chrome, 23 tui_spec all green
Clippy: clean --locked --all-targets -- -D warnings
Reviewed-on: #81
tui(history): payment history and tx detail screen (card t_935bf84e)
All checks were successful
ci / test (pull_request) Successful in 4m30s
ci / sdk (pull_request) Successful in 1m19s
b7e3d79777
Add Screen::History with draw_history, history_row_text, history_detail.
- Per-friend payment list: direction marker, amount, verified state, age, txid
- Enter opens detail view; Esc closes
- h key from main + wallet opens history via Node::list_payments
- Empty state: 'no payments with this friend yet'
- ASCII fallback: drops ✓/✗ glyphs, uses words only
- Peer text (memo, address) sanitized via display_text
- Tests: 5 new in tui_spec.rs (row text, detail, empty, ascii), 2 frame dumps in tui_frames.rs

Signed-off-by: tui-design <tui-design@hermes>
tui(history): add F6 h needle + PR frame dump for hostile memo
All checks were successful
ci / test (pull_request) Successful in 4m1s
ci / sdk (pull_request) Successful in 58s
7f880ede2c
- Add 'F6 h' to tests/tui_chrome.rs needle list (help_overlay_text already
  documents the history binding; test must assert it)
- Add dump_history_pr_frames to tests/tui_frames.rs: empty, mixed
  verified/unverified list, detail view, and hostile memo (C0 + bidi) at
  80x24 and 120x40

Signed-off-by: tui-design <tui-design@hermes>
docs(tui): add payment history after frames to Deliverable 5
All checks were successful
ci / test (pull_request) Successful in 3m59s
ci / sdk (pull_request) Successful in 1m1s
a94f071ccb
Render command + 80x24 frames for empty, mixed verified/unverified,
detail view with hostile memo sanitized, and ASCII fallback.

Signed-off-by: tui-design <tui-design@hermes>
sirius changed target branch from main to feat/wallet-create-import 2026-09-16 01:38:08 +00:00
sirius merged commit 4ecd73e79f into feat/wallet-create-import 2026-09-16 04:01:38 +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!83
No description provided.