tui: F7 wallet setup — RPC endpoint and chain source on screen
All checks were successful
android-ci / android (pull_request) Successful in 10m33s
ci / test (pull_request) Successful in 6m53s
ci / sdk (pull_request) Successful in 1m33s
ci / fuzz (pull_request) Successful in 5m4s

`wallet::NOT_CONFIGURED_MSG` has always said "open F7 to set it up" and there
was no F7. This is that screen.

- `FunctionKey::Setup` on `F7`, live on Main, the settings menu and peer
  payments, same invariant `F9` follows.
- `Screen::WalletSetupConfig` carries `WalletSetupConfigState`: a snapshot of
  plain data taken when the screen opens, never a handle onto `Node`.
- Rows: the wallet RPC endpoint and its login (never rendered back — the row
  says `hidden · set`, `Debug` redacts it), the view-only toggle, and a chain
  picker over all four `ChainSource` cases with their own fields.
- `Node::set_remote_daemon` / `set_local_monerod` / `set_receive_only`, so the
  TUI can reach what only the Android API could, plus `F6`'s in-process source.
- An untouched chain row is not written, so an F7 save cannot silently undo the
  in-process choice; picking a remote daemon says who is trusted in the same
  frame, one line, lowercase.
- `Ctrl-T` tests the endpoint and shows the sanitized `PingResult::line()`.
  Saving never dials. A rejected form writes nothing — the node validates.
- Docs that claimed there is no F7 (`docs/TUI.md`, `docs/WALLET.md`) now
  describe the screen; the settings menu's `endpoint` row names the key.
This commit is contained in:
agent 2026-09-26 23:18:46 -04:00
commit a48d40bc4e
No known key found for this signature in database
4 changed files with 1335 additions and 22 deletions

View file

@ -26,12 +26,13 @@ ASCII chrome.
| `WalletSelect` | `F6` `w` | Saved wallets, pick one or create one |
| `WalletSetup` | `F6` `c` / `i`, or `/wallet create` / `import` | Spend warning, seed, optional seed-offset passphrase, import |
| `WalletsSettings` | `F9` or `/settings` | Discovery menu (does not replace F-keys) |
| `WalletSetupConfig` | `F7` | Wallet RPC endpoint and chain source, editable |
| `PeerPayments` | F9 then `p` | Peer-scoped `/pay` / `/tip` history |
| `Quit` | `Ctrl-Q` | Type `CLEAR` or `QUIT` |
Help (`?`) is an overlay, not a screen. `/who` / `F5` is an overlay on Main.
There is **no `F7`**. Function keys that fire from Main, the settings menu, and
Function keys that fire from Main, the settings menu, and
peer-payments are:
| Key | `FunctionKey` | Action |
@ -41,11 +42,13 @@ peer-payments are:
| `F4` | Rotate | Onion locator |
| `F5` | Who | Selected friend's profile |
| `F6` | Wallet | Wallet screen |
| `F7` | Setup | Wallet RPC endpoint and chain source |
| `F8` | RotatePrekey | Prekey hard cut |
| `F9` | OpenMenu | Wallets & settings |
`F9` is live on Main, the settings menu, and peer-payments so a printed shortcut
never no-ops there. Other screens handle their own keys (Esc back, typed
never no-ops there, and `F7` joins it for the same reason: `/settings` points at
the setup screen. Other screens handle their own keys (Esc back, typed
confirms).
## Main
@ -53,16 +56,21 @@ confirms).
Focus starts on the composer. Footer hints (`main_footer_hints`):
```
Tab F2 F3 F4 F5 F6 F9 ? help Ctrl-Q
Tab F2 F3 F4 F5 F6 F7 F9 ? help Ctrl-Q
```
Pane-specific (`pane_footer_hints`):
| Pane | Hint |
|---|---|
| Roster | `j k select F3 add F6 wallet F9 settings ? help` |
| Chat | `j k scroll g G ends F4 rotate F9 settings ? help` |
| Composer | `Enter send / commands F9 settings ? help` |
| Roster | `j k F3 add F6 wallet F7 setup F9 ? help` |
| Chat | `j k g G ends F4 rotate F7 setup F9 ? help` |
| Composer | `Enter send / commands F7 setup F9 ? help` |
The status line is drawn from the focused pane's hint, and the compactor drops
tokens from the front until the line fits, so a key that only appears in
`main_footer_hints` never reaches an 80-column terminal. `F7` is therefore named
in both, and the `F9` beside it is left bare so the whole hint still fits at 80.
| Key | Action |
|---|---|
@ -168,6 +176,45 @@ stored identity and locator are catalogue columns, not session state: a locator
rotates (`F4`) and identity is the roster key the node already holds, so the
live header keeps reading them from the node.
## Wallet setup (`F7`)
Footer: `Esc back Enter save Ctrl-T test` (plus the status line's own `? help`).
The compactor drops tokens from the front, and at 80 columns the status line
leaves about 25 cells, so the tail is what the default terminal shows. `Tab` and
`?` are universal; `Ctrl-U` is named on the login row it clears.
Live from Main, the `F9` settings menu, and peer payments; the menu's `endpoint`
row names `F7` as the key that edits it. Body is `WalletSetupConfigState`, a
snapshot taken when the screen opens — the render path never reads the store.
Two things live here: the wallet RPC endpoint, and the chain source.
| Row | Kind | Notes |
|---|---|---|
| `url` | text | the wallet RPC endpoint |
| `login` | text | `user:pass`. Never rendered back: the row reads `hidden · set` or `(none)` |
| `view-only` | toggle | `no_spend`; `/tip` is refused before any dial |
| `chain` | picker | `space` cycles receive-only, local node, remote daemon, in-process |
| `daemon` | text | `host:port`, for the remote daemon |
| `monerod` | text | the binary this box spawns for a local node |
| `prune` | toggle | local and in-process sources |
`Enter` saves and answers on the status row: `saved · not dialled — ctrl-t tests`
`the endpoint`, or the node's own refusal in its own words. The endpoint is
validated by `Node::wallet_save_config` — loopback host, login required — and a
rejected form is rejected **before** it is written: nothing in the sealed record
moves and a running wallet is not re-dialled. `Ctrl-T` dials the endpoint and
answers with the sanitized `PingResult` line (never the password). `Ctrl-U`
clears the focused field, which is how a hidden login gets replaced.
The chain row is written only when it was changed. An untouched row leaves
whatever `F6`'s `1`/`2`/`3` picker stored, so opening `F7` to fix a port cannot
silently undo the in-process choice. Picking a remote daemon says so in the same
frame — `a daemon you do not run sees this wallet's chain traffic` — because that
is the pick that moves chain trust off this box. The address must parse as
`host:port` first.
Esc is the single exit and wipes the login buffer (`Zeroizing<String>`).
## Wallets & settings (`F9` / `/settings`)
Discovery layer, not a replacement. Function keys stay live on this screen.
@ -180,14 +227,14 @@ Rows name the shortcut they sit beside (`F6 c`, `F6 i`, `F6 r`, `F6 s/x`,
- `p` opens peer payment history for the selected friend (`Node::list_payments`).
- Esc back to Main.
The menu **shows** endpoint state; it does not edit a stored RPC URL. The error
copy for an unconfigured wallet still says “open F7” (`src/wallet.rs`); that
key does not exist. Set `ONIONWIRE_WALLET_RPC` or use `F6` create/import and
the child.
The menu **shows** endpoint state; it does not edit it. The `endpoint` row names
`F7`, which is the key that opens `WalletSetupConfig` and the key the “open F7”
copy in `src/wallet.rs` now points at — that error is no longer advice for a key
that does not exist.
Chain source (binaries, remote host) is stored via `Node::set_wallet_child_config`.
The desktop TUI's in-process picker is `F6` keys `1`/`2`/`3`. There is no
on-screen editor for an external RPC URL or a remote daemon host.
Chain source is stored via `Node::set_wallet_child_config`. `F6` keys
`1`/`2`/`3` set the in-process source; `F7` sets any of the four, plus the
external RPC URL and a remote daemon host.
## Peer payments (`F9` then `p`)

View file

@ -207,10 +207,15 @@ Boot precedence: **stored config → env → disabled**. Stored config that cann
be used (non-loopback, `.onion`, missing login) is reported and falls back to
env rather than dialling the bad endpoint.
`Store::save_wallet_config` / `Node::wallet_save_config` exist. **No TUI screen
writes them.** There is no `F7`. The not-configured refusal still says
`Store::save_wallet_config` / `Node::wallet_save_config` exist, and the `F7`
screen (`WalletSetupConfig`) writes them: the endpoint, its login, and the chain
source. Nothing else does — `F6` and `F9` show state, the env vars are the
headless path. The not-configured refusal says
`wallet not configured — open F7 to set it up, or set ONIONWIRE_WALLET_RPC`
(`src/wallet.rs`). Live surfaces: `F6`, `F9`, or the env vars.
(`src/wallet.rs`), and that key is real.
A save validated by `Node::wallet_save_config` (loopback host, login required)
re-points the wallet without a restart; a rejected form writes nothing.
`/pay` and `/tip` run `wallet_readiness` before send: