tui: read the wallet list from the store and load the chosen wallet
The selection screen shipped as presentation only: `F6 w` opened its unavailable state, the rows were never read, and Enter on a wallet said switching was not wired up. The catalogue, the create path and the screen all existed; nothing joined them. - `App::open_wallet_select` builds its rows from `Node::list_wallets` at the moment the screen opens (never cached from startup), and a failed read is the screen's own error state rather than "no saved wallets". - `App::choose_wallet` resolves `WalletChoice::Open(index)` against the catalogue as it is now — the index is a position, and two saved wallets may share an identity key — then loads it. `+ create new wallet` still starts the existing create flow. - `Node::open_wallet(filename)` is the load: it refuses a file the catalogue does not hold, re-points the sealed wallet-child record with a read-modify-write (the generated RPC creds survive), and restarts a running child onto the new file. An idle child takes the change on its next start. - `App::new` starts on the selection screen when the catalogue is non-empty and on the create flow when it is empty, so a restart lands on the wallets it remembers and a first run has no dead empty list. - The stored identity/locator stay catalogue columns: a locator rotates (F4) and identity is the roster key the node already holds, so the live header keeps reading them from the node. - `SELECT_UNAVAILABLE` is gone with the state it described; docs/TUI.md now describes the wired behaviour. Tests (both new): `Node::open_wallet` over an offline node — the chosen file, the creds kept across the read-modify-write, the choice surviving a reopen, and a non-catalogue file refused; and the app path in src/tui.rs over a real store-backed node — start screen both ways, catalogue mapping, row index over a shared identity, the create row, and a wallet recorded after startup appearing the next time the list opens.
This commit is contained in:
parent
d96de1d7f0
commit
8986724848
3 changed files with 439 additions and 29 deletions
17
docs/TUI.md
17
docs/TUI.md
|
|
@ -150,9 +150,24 @@ failed is named on the screen — that is a different state from `no saved walle
|
|||
yet`, and the two never share copy.
|
||||
|
||||
Rows are plain display data (`WalletRow`), built by the caller from
|
||||
`Store::list_wallets`; the render path never reads the store. Selection is by
|
||||
`Node::list_wallets`; the render path never reads the store. Selection is by
|
||||
row index, not by identity key (two records may share one).
|
||||
|
||||
The list is read when the screen opens — from the start screen and from
|
||||
`F6` `w` — so a wallet created or imported in this session is offered the next
|
||||
time the screen opens, with no restart. Enter on a wallet row re-points the
|
||||
app-owned wallet child at that row's `wallet_filename` (`Node::open_wallet`,
|
||||
a read-modify-write of the sealed record, so the generated RPC creds survive);
|
||||
a running child is restarted onto the new file, and an idle one picks the
|
||||
change up on its next start.
|
||||
|
||||
**Start screen.** An install with at least one saved wallet opens on
|
||||
`WalletSelect`; a fresh install (empty catalogue) opens on the create flow
|
||||
(`WalletSetup::CreateWarn`), so the first run has no dead empty list. The
|
||||
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.
|
||||
|
||||
## Wallets & settings (`F9` / `/settings`)
|
||||
|
||||
Discovery layer, not a replacement. Function keys stay live on this screen.
|
||||
|
|
|
|||
Loading…
Reference in a new issue