@shieldedtech/moth-tui 0.14.0 → 0.14.1-canary.20260920003715-d833e34

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