@shieldedtech/moth-tui 0.13.0 → 0.13.1-canary.20260909171538-3195f0e

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