@shieldedtech/moth-tui 0.14.1 → 0.15.0-next.20260925125759-5ffbb70

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