tui(history): payment history and tx detail screen #83
Loading…
Reference in a new issue
No description provided.
Delete branch "wt/t_935bf84e"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Payment history + tx detail (card t_935bf84e)
Implements
Screen::Historywithdraw_history,history_row_text,history_detail. Thehkey opens payment history from both the main screen and the wallet screen. State (payments list) is loaded once on open viaNode::list_paymentsand re-read only on explicit refresh — the 100ms poll never hits the store per frame.What
history_row_text: direction marker (>/<), amount viapay::atomic_to_xmr_str, verified state as word + glyph (verified/unverified), truncated txid,awaiting receiptwhen 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 viasanitize::display_textfirst.draw_history: full-screen overlay, empty stateno payments with this friend yet,Entertoggles detail,Escback.help_overlay_text()extended withF6 h payment history with selected friend;tests/tui_chrome.rsneedle list extended withF6 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::Historystruct.Evidence
cargo test --locked→ 0 failures.cargo clippy --locked --all-targets -- -D warnings→ clean.Frames at 80x24
Empty:
┌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):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>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.