@shieldedtech/moth-tui 0.14.1 → 0.14.2-canary.20260928125650-b5fd114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/CHANGELOG.md +339 -0
  2. package/package.json +3 -3
package/CHANGELOG.md ADDED
@@ -0,0 +1,339 @@
1
+ # @shieldedtech/moth-tui
2
+
3
+ ## 0.14.2-canary.20260928125650-b5fd114
4
+
5
+ ### Patch Changes
6
+
7
+ - @shieldedtech/moth-wallet@0.14.2-canary.20260928125650-b5fd114
8
+
9
+ ## 0.14.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [0f0afa3]
14
+ - @shieldedtech/moth-wallet@0.14.1
15
+
16
+ ## 0.14.0
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [3b39fb6]
21
+ - Updated dependencies [3b39fb6]
22
+ - Updated dependencies [3b39fb6]
23
+ - Updated dependencies [55a878c]
24
+ - Updated dependencies [77edf22]
25
+ - Updated dependencies [aa3c276]
26
+ - Updated dependencies [19a1a23]
27
+ - @shieldedtech/moth-wallet@0.14.0
28
+
29
+ ## 0.13.0
30
+
31
+ ### Patch Changes
32
+
33
+ - b49c96d: Give the CLI and TUI the pre-seed, timings and DUST-registration behaviour the
34
+ extension already had.
35
+
36
+ **Birthdays.** `chainTip` moves from the extension's background handlers into
37
+ core, and `wallet generate` on both surfaces records the chain tip as the new
38
+ wallet's birthday. Without one the `reference.height <= birthday` guard can never
39
+ pass, so no CLI or TUI wallet could ever be pre-seeded — the difference between
40
+ 29.3s and 78.6 min on preprod. Imports still get none, deliberately: a restored
41
+ wallet may hold funds at any height, and seeding it past its own history would
42
+ lose them silently.
43
+
44
+ **`moth preseed status|refresh|build`.** Thin wrappers over core functions
45
+ that already existed but had no caller outside the extension. `refresh` is the
46
+ one worth having — 9.1s to catch a reference up, against 53.6 min to rebuild it
47
+ from genesis, which is what someone does by hand when the command is missing.
48
+ `build` says how long it will take before starting, because an unattended command
49
+ that appears to hang for an hour is indistinguishable from a broken one.
50
+
51
+ **Phase timings on disk.** `createFileTimingStore` backs the existing
52
+ storage-agnostic recorder with `~/.moth/timings.json` — the path
53
+ `docs/BENCHMARKING.md` already documented and nothing wrote. `moth diagnostics
54
+ timings` shows the timeline as deltas, and recording stays off until switched on.
55
+ A headless sync is where this matters most: it is the surface with no other
56
+ signal about where the time went.
57
+
58
+ **DUST registration in the TUI.** `DustRegistrationNotYetError` is now caught
59
+ distinctly, so a wallet whose NIGHT is too new to cover the registration fee is
60
+ told "not yet" instead of shown the raw SDK error as a failure. The panel and the
61
+ CLI already did this; the TUI was the surface still reporting it as a defect.
62
+ - eb4d56a: **The extension can restore an account from a raw hex seed.** Previously it
63
+ accepted a 24-word phrase and nothing else, which made accounts created from a
64
+ seed permanently unreachable there.
65
+
66
+ That was not a policy — a wallet created from a hex seed **has no mnemonic and
67
+ can never be given one**, because BIP-39's phrase-to-seed step is a one-way KDF.
68
+ There was nothing to type into the word grid. Meanwhile the TUI
69
+ (`tui/src/app.tsx`) and the CLI (`moth wallet import --seed-hex`) both had the
70
+ path, and the extension's own session model is seed-based end to end: it derives
71
+ `seedHex` at unlock and carries it through every operation. A mnemonic was only
72
+ ever a transport format for the seed, and the extension accepted just that one
73
+ format at the door.
74
+
75
+ The plumbing was the only thing missing. `wallets` in the browser facade *is* a
76
+ `WalletManager`, so `importFromSeed` was already callable from the offscreen
77
+ document; `unlock` already handled a `seed:` keystore. `ImportWalletRequest` is
78
+ now a union — exactly one of `mnemonic` / `seed`, enforced by the type rather
79
+ than a runtime check — threaded through the background/offscreen RPC, and the
80
+ offscreen host routes to whichever core call fits. The two stay separate calls,
81
+ not one with a branch: `import` runs the BIP-39 checksum, `importFromSeed`
82
+ shape-checks the hex.
83
+
84
+ The restore screen now offers both artifacts as tabs on one page. No
85
+ "which do you have?" step first: anyone restoring already knows which they hold,
86
+ so that step would cost a click and gather nothing.
87
+
88
+ **New in core: `wallet/hex-seed.ts`, and `importFromSeed` now validates.** It had
89
+ no validation whatsoever — a malformed seed reached the SDK and surfaced as a
90
+ bare `Invalid seed`, and a merely wrong-*length* seed was accepted outright,
91
+ silently producing a different wallet. `checkHexSeed` returns a machine-readable
92
+ problem so each surface can word it itself (the extension localises it; the CLI
93
+ and TUI use `describeHexSeedProblem`). The TUI and CLI inherit the fix.
94
+
95
+ **The validation is shaped around the fact that a hex seed has no checksum.**
96
+ Measured against the wallet SDK, `HDWallet.fromSeed` accepts any 16–64 byte
97
+ seed and refuses 15 or 65 — and every accepted length derives a *different*
98
+ wallet. So:
99
+
100
+ - change one character and there is **no error**, just a different, valid, empty
101
+ wallet;
102
+ - truncate a paste and the same is true;
103
+ - whereas one wrong word in a phrase fails `validateMnemonic`.
104
+
105
+ The bounds therefore match what the SDK actually accepts rather than a rule of
106
+ our own, with a test that fails if an SDK bump moves them. Lengths other than 32
107
+ or 64 bytes — the two sizes real tooling emits — are **warned about, not
108
+ refused**: a truncated paste looks exactly like a seed genuinely created at that
109
+ length, and refusing would lock such a wallet out. And the field is deliberately
110
+ **not** a password input: reading the seed back against a backup is the only
111
+ check available, so masking it would remove the sole defence.
112
+
113
+ Note those two sizes are not interchangeable. A 32-byte seed is what the Midnight
114
+ node toolkit and `moth wallet import --seed-hex` deal in; the 64-byte one is the
115
+ BIP-39 seed a phrase expands to, and what `exportSeedHex` returns for a
116
+ phrase-backed wallet. Truncating the latter to the former gives a different
117
+ wallet.
118
+
119
+ Restored accounts keep `createdHere: false` and no birthday, so they scan from
120
+ genesis — they may hold funds at any height, and seeding one past its own history
121
+ would hide them (ADR 0003, rule 4).
122
+
123
+ **The TUI's hex import was that validation.** `SeedEntryScreen` matched
124
+ `/^[0-9a-fA-F]{64}$/` and did it *before* `importFromSeed`, so core's new check
125
+ never ran and the screen refused every length the SDK accepts bar one — including
126
+ the 128-character seed this release teaches the extension to reveal. Round-trip
127
+ a phrase-backed account (extension → Accounts → Reveal → Hex seed) into the
128
+ TUI's hex import and it answered "Invalid hex seed. Must be exactly 64 hex
129
+ characters", while the CLI took the same string. The check now lives in
130
+ `tui/src/screens/onboarding/seed-input.ts` and delegates to `checkHexSeed`, so
131
+ the TUI inherits the bounds and the unusual-length warning instead of
132
+ re-deciding them; a test sweeps 16..64 bytes so the screen cannot silently drift
133
+ tighter than core again.
134
+
135
+ Also corrected: three places documented a BIP-39 seed as 64 hex characters. It is
136
+ 128 — 64 hex characters is a 32-byte seed, a different artifact that derives a
137
+ different wallet. `core/src/sync/operations.ts` and two spots in
138
+ `docs/spec/wallet-service/05-key-management.md`. That claim is precisely what
139
+ would lead someone to write `length === 64` validation and reject the seeds this
140
+ app exports (#99).
141
+
142
+ Closes #98.
143
+ - 43eb678: Bound the Wallet State view's coin lists to what the terminal can show.
144
+
145
+ Observed on mainnet, where a shielded wallet holds far more coins than a test
146
+ wallet does. The itemised list ran past its own section and painted over the ones
147
+ beneath it, so the Unshielded and Dust sections printed lines like
148
+
149
+ ```
150
+ ▸ Unshielded Wallet
151
+ Ba29ed4a053c1ec576e7f7684832c062bebc5cf67c0a4a9242f4defebd4b112b94 522 (1 coin)
152
+ ```
153
+
154
+ — that section's `Balance` label with a token row on top of it.
155
+
156
+ The cause is not formatting. Ink renders a frame in full and has no viewport, so a
157
+ frame taller than the terminal corrupts its redraw and lines overwrite one
158
+ another. `components/Select.tsx` already documents exactly this ("makes Ink
159
+ collapse the two lines onto one") and windows its list against `stdout.rows` to
160
+ avoid it; `StateView` had no equivalent and emitted a row per token plus a row per
161
+ coin, unbounded. `Label` pads with `padEnd` and never truncates, which is what
162
+ identifies the 2-character `Ba` as terminal overwrite rather than a truncation
163
+ bug — and why truncating the label would have fixed nothing.
164
+
165
+ Each block is now bounded as a whole, with the remainder reported:
166
+
167
+ ```
168
+ Balance
169
+ 29ed4a05…4b112b94 522 (1 coin)
170
+ … and 4,312 more
171
+ ```
172
+
173
+ Bounded as a whole because volume arrives from either direction — a wallet with
174
+ many tokens, or a token with many coins — and capping only the inner coin list
175
+ leaves the outer one unbounded. The rows are flattened into one list and one
176
+ budget covers them, so neither shape can overflow. The three sections split the
177
+ terminal's spare height; the `… and N more` line is counted against the budget it
178
+ belongs to.
179
+
180
+ Long token ids are now middle-elided to fit the terminal width. That is not only
181
+ cosmetic: at 80 columns a full 64-character id wrapped the header onto a second
182
+ line, which cost two rows where the budget assumed one.
183
+
184
+ `Dust` had the same unbounded shape and is fixed the same way, costing a
185
+ deregistered coin as two rows since it renders its `dtime` on a second line.
186
+
187
+ The row arithmetic lives in `utils/` as `flattenBalanceRows`, `windowRows`,
188
+ `truncateMiddle` and `balanceBudget`, unit-tested without rendering Ink.
189
+ - Updated dependencies [a17b719]
190
+ - Updated dependencies [b49c96d]
191
+ - Updated dependencies [f736ebd]
192
+ - Updated dependencies [b49c96d]
193
+ - Updated dependencies [0508a38]
194
+ - Updated dependencies [2dabc50]
195
+ - Updated dependencies [426b757]
196
+ - Updated dependencies [eb4d56a]
197
+ - Updated dependencies [3e131e2]
198
+ - Updated dependencies [9afd580]
199
+ - Updated dependencies [b49c96d]
200
+ - Updated dependencies [e31eaf8]
201
+ - Updated dependencies [c2f8b73]
202
+ - Updated dependencies [b49c96d]
203
+ - Updated dependencies [b49c96d]
204
+ - Updated dependencies [b49c96d]
205
+ - Updated dependencies [c1c462e]
206
+ - Updated dependencies [9be5669]
207
+ - Updated dependencies [ea1793d]
208
+ - Updated dependencies [316ca82]
209
+ - Updated dependencies [89f34aa]
210
+ - Updated dependencies [04f1aa4]
211
+ - @shieldedtech/moth-wallet@0.13.0
212
+
213
+ ## 0.12.1
214
+
215
+ ### Patch Changes
216
+
217
+ - bd8d41f: Fix the published TUI package to use a semver dependency range for `moth-wallet` so npm consumers can install it outside the Yarn workspace.
218
+ - @shieldedtech/moth-wallet@0.12.1
219
+
220
+ ## 0.12.0
221
+
222
+ ### Minor Changes
223
+
224
+ - ea15676: Coordinate the first public package release under the Moth package names.
225
+
226
+ This is a minor bump because no package has previously been published under the
227
+ new names. The release remains experimental and unsupported, so it stays below
228
+ 1.0.0. Package names, CLI identifiers, environment variables, connector identity,
229
+ and local state paths are aligned before publication; no compatibility shim is
230
+ required for an unpublished package.
231
+
232
+ ### Patch Changes
233
+
234
+ - Updated dependencies [be98f55]
235
+ - Updated dependencies [ea15676]
236
+ - @shieldedtech/moth-wallet@0.12.0
237
+
238
+ ## 0.2.0
239
+
240
+ ### Minor Changes
241
+
242
+ - 36cb067: Add selectable proof-server and local WASM proving across the core wallet, CLI,
243
+ terminal dashboard, browser extension, and dApp connector API.
244
+ - fc93b31: Add the opt-in daemon for sharing one live wallet between a long-running host
245
+ (the TUI dashboard or `moth daemon serve`) and CLI clients over an authenticated
246
+ Unix-socket or TCP RPC. The daemon owns the sync engine and spending keys;
247
+ clients route the build/balance/prove/sign/submit pipeline through it, so keys
248
+ never leave the host process. Adds the `moth daemon serve|transfer|call|deploy|
249
+ submit-tx|dust register|dust deregister|key gen|key list|key revoke|maintenance`
250
+ subcommands, API-key authentication with read/write scopes, an append-only audit
251
+ log, and an L3 confirmation queue (interactive modal, or headless auto-approve
252
+ gated behind an explicit flag + env var).
253
+
254
+ ### Patch Changes
255
+
256
+ - b157dd2: Add the browser extension wallet and dApp connector workflow.
257
+
258
+ The wallet core now supports browser-safe persisted sync state, activity history,
259
+ message signing, staged transfer construction and submission, fee estimation,
260
+ and DUST and intent operations. Add the WXT side-panel extension and Connector
261
+ Lab mock dApp, expose the new APIs through the browser adapter, and keep the CLI
262
+ and TUI integrations compatible with asynchronous sync cache handling and the
263
+ Ink runtime.
264
+
265
+ - 003720d: Clear balances on wallet/network switch in the terminal dashboard.
266
+
267
+ `useBalance` reset with `{...prev}`, so switching or importing a wallet briefly
268
+ showed the previous wallet's balances, coins, and sync progress under the new
269
+ wallet's name until the new sync emitted. It now resets to the empty state on a
270
+ switch. There is no steady-state flicker, since the sync effect only re-runs
271
+ when the wallet keys, network, or wallet name change.
272
+
273
+ - b7e2f00: add local network support
274
+ - e431662: Count booked unshielded inputs in the TUI's Wallet State balances.
275
+
276
+ The core folds booked (pending) unshielded inputs into the balance it reports,
277
+ but the state view summed only the available coin list, so the TUI and the
278
+ extension showed different NIGHT totals for the same wallet — observed on
279
+ preprod as 5,423.9987 against 8,423.998700, a gap of exactly the three booked
280
+ coins. A token whose coins were all booked had no row at all and read as not
281
+ held, while the extension still listed it.
282
+
283
+ The fungible balance block now groups over both populations and marks booked
284
+ coins `[in flight]` beside the existing `[Registered for Dust]` flag, so the
285
+ booked portion is visible rather than hidden behind an opaque "Pending N coins"
286
+ count. The grouping moved to `utils/balance.ts` as `groupCoinsForDisplay`, where
287
+ the arithmetic is unit-tested without rendering Ink. Shielded is unchanged: its
288
+ pending also holds incoming coins, which would over-count receipts.
289
+
290
+ - 717639a: Show DUST in DUST, not in NIGHT units, in the TUI balance table.
291
+
292
+ `useBalance` formatted the DUST balance with `formatNight`, which divides by
293
+ 10^6 (STARS per NIGHT). DUST is denominated in SPECKS, 10^15 per DUST, so every
294
+ figure the balance table has ever shown was too large by a factor of a billion —
295
+ and plausibly so, which is why it survived. Now uses `formatDustBalance`, which
296
+ core has exported all along.
297
+
298
+ Reported as #78, with the arithmetic worked through against `formatNight`'s
299
+ source. The same substitution was fixed separately in core's sync log line; this
300
+ is the other call site, and the one a user actually reads.
301
+
302
+ - e8b98da: Restore the TUI build after `SyncProgress` gained a required `slowest` field.
303
+
304
+ `overallSyncProgress` now reports which sub-wallet the percentage came from, so
305
+ the sync line can say "syncing 27% (dust)" instead of leaving a reader to guess
306
+ why it disagrees with a gauge showing shielded and unshielded at 100%. Making
307
+ `slowest` required was deliberate — an unlabelled percentage is the defect — but
308
+ two TUI literals construct `SyncProgress` by hand and were not updated, so
309
+ `packages/tui` stopped typechecking the moment that landed.
310
+
311
+ Both are cases where nothing is behind: the fallback used before any progress has
312
+ been reported, and a fully-synced test stub. Both take `slowest: null`.
313
+
314
+ - Updated dependencies [fc93b31]
315
+ - Updated dependencies [fc93b31]
316
+ - Updated dependencies [12881a3]
317
+ - Updated dependencies [b157dd2]
318
+ - Updated dependencies [c7d1ef7]
319
+ - Updated dependencies [36cb067]
320
+ - Updated dependencies [fc93b31]
321
+ - Updated dependencies [6f914fc]
322
+ - Updated dependencies [fc93b31]
323
+ - Updated dependencies [fc93b31]
324
+ - Updated dependencies [771338d]
325
+ - Updated dependencies [fc93b31]
326
+ - Updated dependencies [ba86b72]
327
+ - Updated dependencies [fc93b31]
328
+ - Updated dependencies [b7e2f00]
329
+ - Updated dependencies [1c597ff]
330
+ - Updated dependencies [24cb16c]
331
+ - Updated dependencies [0f9369f]
332
+ - Updated dependencies [bf49ced]
333
+ - Updated dependencies [0f197e2]
334
+ - Updated dependencies [1f69f66]
335
+ - Updated dependencies [fc93b31]
336
+ - Updated dependencies [6766583]
337
+ - Updated dependencies [fc93b31]
338
+ - Updated dependencies [2fde86f]
339
+ - @shieldedtech/moth-wallet@0.2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shieldedtech/moth-tui",
3
- "version": "0.14.1",
3
+ "version": "0.14.2-canary.20260928125650-b5fd114",
4
4
  "description": "Terminal UI for Midnight Network wallet operations. USE AT YOUR OWN RISK. Experimental software provided AS-IS with no warranty. Not audited. For development and testing purposes only.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@midnight-ntwrk/ledger-v8": "8.1.0",
30
30
  "@midnightntwrk/wallet-sdk": "^1.2.0",
31
- "@shieldedtech/moth-wallet": "^0.14.1",
31
+ "@shieldedtech/moth-wallet": "0.14.2-canary.20260928125650-b5fd114",
32
32
  "ink": "^7.0.1",
33
33
  "ink-spinner": "^5.0.0",
34
34
  "ink-text-input": "^6.0.0",
@@ -39,4 +39,4 @@
39
39
  "typescript": "^5.5.0",
40
40
  "vitest": "^5.0.1"
41
41
  }
42
- }
42
+ }