@shieldedtech/moth-cli 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 +291 -0
  2. package/package.json +5 -5
package/CHANGELOG.md ADDED
@@ -0,0 +1,291 @@
1
+ # @shieldedtech/moth-cli
2
+
3
+ ## 0.14.1-canary.20260920003715-d833e34
4
+
5
+ ### Patch Changes
6
+
7
+ - @shieldedtech/moth-wallet@0.14.1-canary.20260920003715-d833e34
8
+ - @shieldedtech/moth-tui@0.14.1-canary.20260920003715-d833e34
9
+
10
+ ## 0.14.0
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [3b39fb6]
15
+ - Updated dependencies [3b39fb6]
16
+ - Updated dependencies [3b39fb6]
17
+ - Updated dependencies [55a878c]
18
+ - Updated dependencies [77edf22]
19
+ - Updated dependencies [aa3c276]
20
+ - Updated dependencies [19a1a23]
21
+ - @shieldedtech/moth-wallet@0.14.0
22
+ - @shieldedtech/moth-tui@0.14.0
23
+
24
+ ## 0.13.0
25
+
26
+ ### Minor Changes
27
+
28
+ - b49c96d: Give the CLI and TUI the pre-seed, timings and DUST-registration behaviour the
29
+ extension already had.
30
+
31
+ **Birthdays.** `chainTip` moves from the extension's background handlers into
32
+ core, and `wallet generate` on both surfaces records the chain tip as the new
33
+ wallet's birthday. Without one the `reference.height <= birthday` guard can never
34
+ pass, so no CLI or TUI wallet could ever be pre-seeded — the difference between
35
+ 29.3s and 78.6 min on preprod. Imports still get none, deliberately: a restored
36
+ wallet may hold funds at any height, and seeding it past its own history would
37
+ lose them silently.
38
+
39
+ **`moth preseed status|refresh|build`.** Thin wrappers over core functions
40
+ that already existed but had no caller outside the extension. `refresh` is the
41
+ one worth having — 9.1s to catch a reference up, against 53.6 min to rebuild it
42
+ from genesis, which is what someone does by hand when the command is missing.
43
+ `build` says how long it will take before starting, because an unattended command
44
+ that appears to hang for an hour is indistinguishable from a broken one.
45
+
46
+ **Phase timings on disk.** `createFileTimingStore` backs the existing
47
+ storage-agnostic recorder with `~/.moth/timings.json` — the path
48
+ `docs/BENCHMARKING.md` already documented and nothing wrote. `moth diagnostics
49
+ timings` shows the timeline as deltas, and recording stays off until switched on.
50
+ A headless sync is where this matters most: it is the surface with no other
51
+ signal about where the time went.
52
+
53
+ **DUST registration in the TUI.** `DustRegistrationNotYetError` is now caught
54
+ distinctly, so a wallet whose NIGHT is too new to cover the registration fee is
55
+ told "not yet" instead of shown the raw SDK error as a failure. The panel and the
56
+ CLI already did this; the TUI was the surface still reporting it as a defect.
57
+ - 426b757: Detect and steer users away from the devnet dust-ledger wedge (docs/bugs-found #15-style defect).
58
+
59
+ Some devnets (midnight-node 2.0.0-rc.4 / midnight-ledger 9.1.0.0-rc.3) can
60
+ enter a state where a DUST registration leaves the node's dust ledger unable
61
+ to reconcile with any wallet's, permanently — every subsequent dust spend,
62
+ from every wallet, fails with the same `InvalidDustSpendProof` /
63
+ `Custom error: 170` signature that a normal transient race also produces.
64
+ Only a chain reset clears it; retrying does not. This is not a Moth defect —
65
+ see `docs/upstream-issues/dust-ledger-wedge-invalid-dust-spend-proof.md` for
66
+ the evidence and the draft issue against `midnightntwrk/midnight-node` /
67
+ `midnight-ledger` — but Moth users hit it on shared and local devnets, so
68
+ Moth now detects and steers around it rather than retrying forever.
69
+
70
+ **Detection** (`@shieldedtech/moth-wallet`, `sync/dust-ledger-health.ts`): a
71
+ run of consecutive, independently built submissions rejected with the same
72
+ ambiguous signature — with the chain confirmed still producing new blocks
73
+ meanwhile — is
74
+ surfaced as `DustLedgerWedgedError` instead of a generic failure. Wired into
75
+ every fee-paying submission path: the extension's offscreen host, `moth
76
+ transfer` / `moth dust register`, and the daemon's `transferTokens` /
77
+ `dustRegister` / `dustDeregister` RPCs (used by both the headless CLI daemon
78
+ and the TUI).
79
+
80
+ **Registration UX** (`@shieldedtech/moth-extension`): the "Register for
81
+ DUST" flow now warns before registering a NIGHT coin that has sat
82
+ unregistered for more than a minute — the only pattern with zero known
83
+ failures across four documented occurrences is registering within seconds of
84
+ funding — and a wallet that has never registered is nudged to do so as soon
85
+ as new NIGHT is observed, rather than waiting for the user to find the Dust
86
+ screen on their own.
87
+
88
+ **Repro harness**: `packages/cli/tests/integration/daemon/dust-wedge-repro.test.ts`
89
+ isolates the fund-to-register delay as the one variable prior occurrences
90
+ didn't control for, holding UTXO size fixed at the size every known success
91
+ used (10,000,000 NIGHT).
92
+
93
+ No change to transaction construction, signing, or proving — every
94
+ registration involved in the underlying defect was accepted by the ledger,
95
+ so this only classifies what a rejection means after the fact.
96
+ - b49c96d: Move a pre-seed reference between machines: `moth preseed export` / `import`.
97
+
98
+ Building a reference IS the chain walk — tens of minutes, once per network per
99
+ machine. That cost is identical for everyone, because a reference holds public
100
+ chain state and nothing else, so it is work that should be done once and shared
101
+ rather than repeated by every developer who clones the repo. ADR 0005 called for
102
+ these two actions; the rest of the command shipped without them.
103
+
104
+ The on-disk shape is the one `scripts/export-preseed.mjs` already writes and CI
105
+ already publishes: gzipped state per sub-wallet plus a manifest. One format, so a
106
+ reference exported here can be dropped into the extension package, and one
107
+ downloaded from a release can be imported here.
108
+
109
+ `export` never writes the reference wallet's mnemonic. That is the only secret in
110
+ the arrangement — the state blobs are public chain data, but the mnemonic
111
+ controls the wallet they were built from, and a published reference is meant to
112
+ be safe to hand to strangers. The command says so in its own output.
113
+
114
+ `import` refuses rather than guesses. A bundle for another network would seed
115
+ wallets from a chain they have never been on, and the mismatch is silent
116
+ afterwards. A bundle older than what is already present is a downgrade that costs
117
+ catch-up time on every wallet created from then on; `--force` allows it, for
118
+ replacing a corrupt newer reference with a known-good older one.
119
+
120
+ Every part is decompressed before any part is written. Unpacking as it went left
121
+ the store holding new shielded and unshielded state beside an old dust state when
122
+ a later part turned out to be corrupt — a mixture that never existed on chain,
123
+ with a height key that still looked consistent. The height is written last, since
124
+ it is what marks a reference usable.
125
+
126
+ ### Patch Changes
127
+
128
+ - Updated dependencies [a17b719]
129
+ - Updated dependencies [b49c96d]
130
+ - Updated dependencies [f736ebd]
131
+ - Updated dependencies [b49c96d]
132
+ - Updated dependencies [0508a38]
133
+ - Updated dependencies [2dabc50]
134
+ - Updated dependencies [426b757]
135
+ - Updated dependencies [eb4d56a]
136
+ - Updated dependencies [3e131e2]
137
+ - Updated dependencies [9afd580]
138
+ - Updated dependencies [b49c96d]
139
+ - Updated dependencies [e31eaf8]
140
+ - Updated dependencies [c2f8b73]
141
+ - Updated dependencies [b49c96d]
142
+ - Updated dependencies [b49c96d]
143
+ - Updated dependencies [b49c96d]
144
+ - Updated dependencies [c1c462e]
145
+ - Updated dependencies [9be5669]
146
+ - Updated dependencies [43eb678]
147
+ - Updated dependencies [ea1793d]
148
+ - Updated dependencies [316ca82]
149
+ - Updated dependencies [89f34aa]
150
+ - Updated dependencies [04f1aa4]
151
+ - @shieldedtech/moth-wallet@0.13.0
152
+ - @shieldedtech/moth-tui@0.13.0
153
+
154
+ ## 0.12.1
155
+
156
+ ### Patch Changes
157
+
158
+ - Updated dependencies [bd8d41f]
159
+ - @shieldedtech/moth-tui@0.12.1
160
+ - @shieldedtech/moth-wallet@0.12.1
161
+
162
+ ## 0.12.0
163
+
164
+ ### Minor Changes
165
+
166
+ - ea15676: Coordinate the first public package release under the Moth package names.
167
+
168
+ This is a minor bump because no package has previously been published under the
169
+ new names. The release remains experimental and unsupported, so it stays below
170
+ 1.0.0. Package names, CLI identifiers, environment variables, connector identity,
171
+ and local state paths are aligned before publication; no compatibility shim is
172
+ required for an unpublished package.
173
+
174
+ ### Patch Changes
175
+
176
+ - Updated dependencies [be98f55]
177
+ - Updated dependencies [ea15676]
178
+ - @shieldedtech/moth-wallet@0.12.0
179
+ - @shieldedtech/moth-tui@0.12.0
180
+
181
+ ## 0.2.0
182
+
183
+ ### Minor Changes
184
+
185
+ - 36cb067: Add selectable proof-server and local WASM proving across the core wallet, CLI,
186
+ terminal dashboard, browser extension, and dApp connector API.
187
+ - fc93b31: Add the opt-in daemon for sharing one live wallet between a long-running host
188
+ (the TUI dashboard or `moth daemon serve`) and CLI clients over an authenticated
189
+ Unix-socket or TCP RPC. The daemon owns the sync engine and spending keys;
190
+ clients route the build/balance/prove/sign/submit pipeline through it, so keys
191
+ never leave the host process. Adds the `moth daemon serve|transfer|call|deploy|
192
+ submit-tx|dust register|dust deregister|key gen|key list|key revoke|maintenance`
193
+ subcommands, API-key authentication with read/write scopes, an append-only audit
194
+ log, and an L3 confirmation queue (interactive modal, or headless auto-approve
195
+ gated behind an explicit flag + env var).
196
+
197
+ ### Patch Changes
198
+
199
+ - b157dd2: Add the browser extension wallet and dApp connector workflow.
200
+
201
+ The wallet core now supports browser-safe persisted sync state, activity history,
202
+ message signing, staged transfer construction and submission, fee estimation,
203
+ and DUST and intent operations. Add the WXT side-panel extension and Connector
204
+ Lab mock dApp, expose the new APIs through the browser adapter, and keep the CLI
205
+ and TUI integrations compatible with asynchronous sync cache handling and the
206
+ Ink runtime.
207
+
208
+ - 771338d: Tell the user when registration needs time, instead of failing and blaming the
209
+ proof server.
210
+
211
+ Registering NIGHT for DUST generation is self-funding: a `DustRegistration`
212
+ carries `allow_fee_payment`, and the ledger lets the transaction pay its own fee
213
+ from the DUST its NIGHT _would have_ generated had it been registered all along.
214
+ That is what stops the obvious deadlock — DUST pays fees, and registering is how
215
+ you get DUST.
216
+
217
+ Self-funding is not free. `generationless_fee_availability` caps the backdated
218
+ amount at `elapsed × night_value × generation_decay_rate`, which starts at zero.
219
+ So a freshly funded wallet cannot cover the fee yet, and the wait is _inversely
220
+ proportional to the balance_: at the ledger's defaults a 0.3 DUST fee needs ~36s
221
+ at 1,000 NIGHT, ~6 min at 100, ~1 hour at 10, and ~10 hours at 1.
222
+
223
+ Reported from preprod as a red failure card reading "That didn't go through",
224
+ with the raw SDK message and a footnote suggesting the proof server. Two of those
225
+ three were wrong: nothing went wrong, and proving never happened — the SDK refuses
226
+ before building.
227
+
228
+ `estimateRegistrationAffordability` (core, pure, WASM-free) turns the SDK's
229
+ per-UTxO figures into an answer: affordable now, affordable in N seconds, or never
230
+ at this holding. That last case matters — when the ceiling is below the fee,
231
+ "wait" is the wrong advice and "hold more NIGHT" is the right one.
232
+
233
+ `designateForDust` throws `DustRegistrationNotYetError` carrying that estimate.
234
+ Because the guard sits in core, it reaches every run mode at once — extension,
235
+ CLI, TUI and daemon RPC all route through the same function.
236
+
237
+ Two decisions worth recording. The estimate is computed only on the failure path,
238
+ so a registration that was always going to succeed pays nothing for it. And
239
+ whether to raise the typed error is decided by the affordability numbers, not by
240
+ matching the SDK's message text — string-matching would need re-matching on every
241
+ SDK release, and would fail silently when it drifted.
242
+
243
+ The panel now shows "Not quite yet", says nothing was spent, and gives a localized
244
+ wait ("Ready in about 8 hours"). `mayBeProvingFailure` suppresses the proof-server
245
+ footnote for every outcome decided before proving.
246
+
247
+ `moth dust register` gains a pre-flight and `--wait` (with `--wait-timeout`). The
248
+ pre-flight matters more on the CLI than in the panel: without it the only way to
249
+ learn the wait is to fail, and re-running means paying for a full sync first.
250
+ `--wait` polls rather than sleeping the predicted duration blind, since the
251
+ estimate moves if the wallet's NIGHT changes underneath it.
252
+
253
+ Also corrects the documentation. Four files stated that the ledger imposes a 3h
254
+ grace period before DUST appears. `dust_grace_period` is 3 hours, but it bounds how
255
+ stale a transaction's declared `ctime` may be — it is not a delay before
256
+ generation starts, which is linear from the UTxO's creation with a time-to-cap of
257
+ about a week. The observation behind the claim was real; the mechanism was
258
+ invented to fit it. The guides are corrected in place; ADR 0003 is annotated
259
+ rather than rewritten, since it is a dated record of what was decided.
260
+
261
+ - Updated dependencies [fc93b31]
262
+ - Updated dependencies [fc93b31]
263
+ - Updated dependencies [12881a3]
264
+ - Updated dependencies [b157dd2]
265
+ - Updated dependencies [c7d1ef7]
266
+ - Updated dependencies [36cb067]
267
+ - Updated dependencies [003720d]
268
+ - Updated dependencies [fc93b31]
269
+ - Updated dependencies [6f914fc]
270
+ - Updated dependencies [fc93b31]
271
+ - Updated dependencies [fc93b31]
272
+ - Updated dependencies [771338d]
273
+ - Updated dependencies [fc93b31]
274
+ - Updated dependencies [ba86b72]
275
+ - Updated dependencies [fc93b31]
276
+ - Updated dependencies [b7e2f00]
277
+ - Updated dependencies [1c597ff]
278
+ - Updated dependencies [24cb16c]
279
+ - Updated dependencies [0f9369f]
280
+ - Updated dependencies [bf49ced]
281
+ - Updated dependencies [0f197e2]
282
+ - Updated dependencies [1f69f66]
283
+ - Updated dependencies [fc93b31]
284
+ - Updated dependencies [6766583]
285
+ - Updated dependencies [fc93b31]
286
+ - Updated dependencies [2fde86f]
287
+ - Updated dependencies [e431662]
288
+ - Updated dependencies [717639a]
289
+ - Updated dependencies [e8b98da]
290
+ - @shieldedtech/moth-wallet@0.2.0
291
+ - @shieldedtech/moth-tui@0.2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shieldedtech/moth-cli",
3
- "version": "0.14.0",
3
+ "version": "0.14.1-canary.20260920003715-d833e34",
4
4
  "description": "CLI tool for Midnight Network wallet operations and contract deployments. 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",
@@ -32,15 +32,15 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@oclif/core": "^4.2.0",
35
- "@shieldedtech/moth-tui": "^0.14.0",
36
- "@shieldedtech/moth-wallet": "^0.14.0",
35
+ "@shieldedtech/moth-tui": "0.14.1-canary.20260920003715-d833e34",
36
+ "@shieldedtech/moth-wallet": "0.14.1-canary.20260920003715-d833e34",
37
37
  "dotenv": "17.4.2",
38
38
  "ink": "^7.0.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^25.6.0",
42
42
  "typescript": "^5.5.0",
43
- "vitest": "^3.1.0"
43
+ "vitest": "^5.0.1"
44
44
  },
45
45
  "oclif": {
46
46
  "bin": "moth",
@@ -55,4 +55,4 @@
55
55
  }
56
56
  }
57
57
  }
58
- }
58
+ }