@shieldedtech/moth-wallet 0.2.0

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 (230) hide show
  1. package/README.md +62 -0
  2. package/dist/contract/args-parser.d.ts +29 -0
  3. package/dist/contract/args-parser.d.ts.map +1 -0
  4. package/dist/contract/args-parser.js +123 -0
  5. package/dist/contract/args-parser.js.map +1 -0
  6. package/dist/contract/artifact-loader.d.ts +26 -0
  7. package/dist/contract/artifact-loader.d.ts.map +1 -0
  8. package/dist/contract/artifact-loader.js +129 -0
  9. package/dist/contract/artifact-loader.js.map +1 -0
  10. package/dist/contract/call.d.ts +32 -0
  11. package/dist/contract/call.d.ts.map +1 -0
  12. package/dist/contract/call.js +245 -0
  13. package/dist/contract/call.js.map +1 -0
  14. package/dist/contract/deploy.d.ts +36 -0
  15. package/dist/contract/deploy.d.ts.map +1 -0
  16. package/dist/contract/deploy.js +388 -0
  17. package/dist/contract/deploy.js.map +1 -0
  18. package/dist/contract/fungible-token.d.ts +40 -0
  19. package/dist/contract/fungible-token.d.ts.map +1 -0
  20. package/dist/contract/fungible-token.js +88 -0
  21. package/dist/contract/fungible-token.js.map +1 -0
  22. package/dist/contract/initial-private-state.d.ts +18 -0
  23. package/dist/contract/initial-private-state.d.ts.map +1 -0
  24. package/dist/contract/initial-private-state.js +44 -0
  25. package/dist/contract/initial-private-state.js.map +1 -0
  26. package/dist/contract/maintenance.d.ts +72 -0
  27. package/dist/contract/maintenance.d.ts.map +1 -0
  28. package/dist/contract/maintenance.js +430 -0
  29. package/dist/contract/maintenance.js.map +1 -0
  30. package/dist/contract/state.d.ts +16 -0
  31. package/dist/contract/state.d.ts.map +1 -0
  32. package/dist/contract/state.js +18 -0
  33. package/dist/contract/state.js.map +1 -0
  34. package/dist/contract/witness-loader.d.ts +3 -0
  35. package/dist/contract/witness-loader.d.ts.map +1 -0
  36. package/dist/contract/witness-loader.js +27 -0
  37. package/dist/contract/witness-loader.js.map +1 -0
  38. package/dist/daemon/api-keys.d.ts +66 -0
  39. package/dist/daemon/api-keys.d.ts.map +1 -0
  40. package/dist/daemon/api-keys.js +222 -0
  41. package/dist/daemon/api-keys.js.map +1 -0
  42. package/dist/daemon/audit-log.d.ts +65 -0
  43. package/dist/daemon/audit-log.d.ts.map +1 -0
  44. package/dist/daemon/audit-log.js +73 -0
  45. package/dist/daemon/audit-log.js.map +1 -0
  46. package/dist/daemon/client.d.ts +63 -0
  47. package/dist/daemon/client.d.ts.map +1 -0
  48. package/dist/daemon/client.js +214 -0
  49. package/dist/daemon/client.js.map +1 -0
  50. package/dist/daemon/confirmation-queue.d.ts +46 -0
  51. package/dist/daemon/confirmation-queue.d.ts.map +1 -0
  52. package/dist/daemon/confirmation-queue.js +92 -0
  53. package/dist/daemon/confirmation-queue.js.map +1 -0
  54. package/dist/daemon/index.d.ts +23 -0
  55. package/dist/daemon/index.d.ts.map +1 -0
  56. package/dist/daemon/index.js +26 -0
  57. package/dist/daemon/index.js.map +1 -0
  58. package/dist/daemon/protocol.d.ts +40 -0
  59. package/dist/daemon/protocol.d.ts.map +1 -0
  60. package/dist/daemon/protocol.js +104 -0
  61. package/dist/daemon/protocol.js.map +1 -0
  62. package/dist/daemon/server.d.ts +158 -0
  63. package/dist/daemon/server.d.ts.map +1 -0
  64. package/dist/daemon/server.js +297 -0
  65. package/dist/daemon/server.js.map +1 -0
  66. package/dist/daemon/wallet-handlers.d.ts +37 -0
  67. package/dist/daemon/wallet-handlers.d.ts.map +1 -0
  68. package/dist/daemon/wallet-handlers.js +533 -0
  69. package/dist/daemon/wallet-handlers.js.map +1 -0
  70. package/dist/daemon/wallet-rpc-parsers.d.ts +14 -0
  71. package/dist/daemon/wallet-rpc-parsers.d.ts.map +1 -0
  72. package/dist/daemon/wallet-rpc-parsers.js +259 -0
  73. package/dist/daemon/wallet-rpc-parsers.js.map +1 -0
  74. package/dist/daemon/wallet-rpc-types.d.ts +138 -0
  75. package/dist/daemon/wallet-rpc-types.d.ts.map +1 -0
  76. package/dist/daemon/wallet-rpc-types.js +11 -0
  77. package/dist/daemon/wallet-rpc-types.js.map +1 -0
  78. package/dist/diagnostics/fs-timing-store.d.ts +29 -0
  79. package/dist/diagnostics/fs-timing-store.d.ts.map +1 -0
  80. package/dist/diagnostics/fs-timing-store.js +81 -0
  81. package/dist/diagnostics/fs-timing-store.js.map +1 -0
  82. package/dist/diagnostics/timings.d.ts +64 -0
  83. package/dist/diagnostics/timings.d.ts.map +1 -0
  84. package/dist/diagnostics/timings.js +100 -0
  85. package/dist/diagnostics/timings.js.map +1 -0
  86. package/dist/index.d.ts +37 -0
  87. package/dist/index.d.ts.map +1 -0
  88. package/dist/index.js +47 -0
  89. package/dist/index.js.map +1 -0
  90. package/dist/network/indexer-client.d.ts +66 -0
  91. package/dist/network/indexer-client.d.ts.map +1 -0
  92. package/dist/network/indexer-client.js +112 -0
  93. package/dist/network/indexer-client.js.map +1 -0
  94. package/dist/network/node-client.d.ts +27 -0
  95. package/dist/network/node-client.d.ts.map +1 -0
  96. package/dist/network/node-client.js +94 -0
  97. package/dist/network/node-client.js.map +1 -0
  98. package/dist/proof/client.d.ts +15 -0
  99. package/dist/proof/client.d.ts.map +1 -0
  100. package/dist/proof/client.js +77 -0
  101. package/dist/proof/client.js.map +1 -0
  102. package/dist/proof/provider.d.ts +12 -0
  103. package/dist/proof/provider.d.ts.map +1 -0
  104. package/dist/proof/provider.js +96 -0
  105. package/dist/proof/provider.js.map +1 -0
  106. package/dist/providers/index.d.ts +2 -0
  107. package/dist/providers/index.d.ts.map +1 -0
  108. package/dist/providers/index.js +2 -0
  109. package/dist/providers/index.js.map +1 -0
  110. package/dist/providers/midnight-provider.d.ts +11 -0
  111. package/dist/providers/midnight-provider.d.ts.map +1 -0
  112. package/dist/providers/midnight-provider.js +30 -0
  113. package/dist/providers/midnight-provider.js.map +1 -0
  114. package/dist/storage/adapter.d.ts +8 -0
  115. package/dist/storage/adapter.d.ts.map +1 -0
  116. package/dist/storage/adapter.js +2 -0
  117. package/dist/storage/adapter.js.map +1 -0
  118. package/dist/storage/fs-adapter.d.ts +14 -0
  119. package/dist/storage/fs-adapter.d.ts.map +1 -0
  120. package/dist/storage/fs-adapter.js +126 -0
  121. package/dist/storage/fs-adapter.js.map +1 -0
  122. package/dist/storage/safe-path.d.ts +13 -0
  123. package/dist/storage/safe-path.d.ts.map +1 -0
  124. package/dist/storage/safe-path.js +35 -0
  125. package/dist/storage/safe-path.js.map +1 -0
  126. package/dist/sync/activity.d.ts +53 -0
  127. package/dist/sync/activity.d.ts.map +1 -0
  128. package/dist/sync/activity.js +92 -0
  129. package/dist/sync/activity.js.map +1 -0
  130. package/dist/sync/dust-registration-estimate.d.ts +54 -0
  131. package/dist/sync/dust-registration-estimate.d.ts.map +1 -0
  132. package/dist/sync/dust-registration-estimate.js +103 -0
  133. package/dist/sync/dust-registration-estimate.js.map +1 -0
  134. package/dist/sync/node-sync-store.d.ts +10 -0
  135. package/dist/sync/node-sync-store.d.ts.map +1 -0
  136. package/dist/sync/node-sync-store.js +42 -0
  137. package/dist/sync/node-sync-store.js.map +1 -0
  138. package/dist/sync/operations.d.ts +138 -0
  139. package/dist/sync/operations.d.ts.map +1 -0
  140. package/dist/sync/operations.js +395 -0
  141. package/dist/sync/operations.js.map +1 -0
  142. package/dist/sync/preseed-parts.d.ts +18 -0
  143. package/dist/sync/preseed-parts.d.ts.map +1 -0
  144. package/dist/sync/preseed-parts.js +33 -0
  145. package/dist/sync/preseed-parts.js.map +1 -0
  146. package/dist/sync/preseed.d.ts +95 -0
  147. package/dist/sync/preseed.d.ts.map +1 -0
  148. package/dist/sync/preseed.js +365 -0
  149. package/dist/sync/preseed.js.map +1 -0
  150. package/dist/sync/progress.d.ts +45 -0
  151. package/dist/sync/progress.d.ts.map +1 -0
  152. package/dist/sync/progress.js +51 -0
  153. package/dist/sync/progress.js.map +1 -0
  154. package/dist/sync/sdk-dedup.d.ts +53 -0
  155. package/dist/sync/sdk-dedup.d.ts.map +1 -0
  156. package/dist/sync/sdk-dedup.js +134 -0
  157. package/dist/sync/sdk-dedup.js.map +1 -0
  158. package/dist/sync/sync-store.d.ts +33 -0
  159. package/dist/sync/sync-store.d.ts.map +1 -0
  160. package/dist/sync/sync-store.js +45 -0
  161. package/dist/sync/sync-store.js.map +1 -0
  162. package/dist/sync/wallet-sync.d.ts +153 -0
  163. package/dist/sync/wallet-sync.d.ts.map +1 -0
  164. package/dist/sync/wallet-sync.js +943 -0
  165. package/dist/sync/wallet-sync.js.map +1 -0
  166. package/dist/types/errors.d.ts +18 -0
  167. package/dist/types/errors.d.ts.map +1 -0
  168. package/dist/types/errors.js +33 -0
  169. package/dist/types/errors.js.map +1 -0
  170. package/dist/types/exit-codes.d.ts +8 -0
  171. package/dist/types/exit-codes.d.ts.map +1 -0
  172. package/dist/types/exit-codes.js +7 -0
  173. package/dist/types/exit-codes.js.map +1 -0
  174. package/dist/types/index.d.ts +6 -0
  175. package/dist/types/index.d.ts.map +1 -0
  176. package/dist/types/index.js +3 -0
  177. package/dist/types/index.js.map +1 -0
  178. package/dist/types/network.d.ts +65 -0
  179. package/dist/types/network.d.ts.map +1 -0
  180. package/dist/types/network.js +108 -0
  181. package/dist/types/network.js.map +1 -0
  182. package/dist/types/tokens.d.ts +3 -0
  183. package/dist/types/tokens.d.ts.map +1 -0
  184. package/dist/types/tokens.js +11 -0
  185. package/dist/types/tokens.js.map +1 -0
  186. package/dist/types/transaction.d.ts +13 -0
  187. package/dist/types/transaction.d.ts.map +1 -0
  188. package/dist/types/transaction.js +2 -0
  189. package/dist/types/transaction.js.map +1 -0
  190. package/dist/types/wallet.d.ts +82 -0
  191. package/dist/types/wallet.d.ts.map +1 -0
  192. package/dist/types/wallet.js +2 -0
  193. package/dist/types/wallet.js.map +1 -0
  194. package/dist/wallet/address-validate.d.ts +7 -0
  195. package/dist/wallet/address-validate.d.ts.map +1 -0
  196. package/dist/wallet/address-validate.js +28 -0
  197. package/dist/wallet/address-validate.js.map +1 -0
  198. package/dist/wallet/address.d.ts +32 -0
  199. package/dist/wallet/address.d.ts.map +1 -0
  200. package/dist/wallet/address.js +107 -0
  201. package/dist/wallet/address.js.map +1 -0
  202. package/dist/wallet/app-secret.d.ts +15 -0
  203. package/dist/wallet/app-secret.d.ts.map +1 -0
  204. package/dist/wallet/app-secret.js +45 -0
  205. package/dist/wallet/app-secret.js.map +1 -0
  206. package/dist/wallet/balance-format.d.ts +12 -0
  207. package/dist/wallet/balance-format.d.ts.map +1 -0
  208. package/dist/wallet/balance-format.js +51 -0
  209. package/dist/wallet/balance-format.js.map +1 -0
  210. package/dist/wallet/batch-transfer.d.ts +36 -0
  211. package/dist/wallet/batch-transfer.d.ts.map +1 -0
  212. package/dist/wallet/batch-transfer.js +93 -0
  213. package/dist/wallet/batch-transfer.js.map +1 -0
  214. package/dist/wallet/keystore.d.ts +16 -0
  215. package/dist/wallet/keystore.d.ts.map +1 -0
  216. package/dist/wallet/keystore.js +76 -0
  217. package/dist/wallet/keystore.js.map +1 -0
  218. package/dist/wallet/manager.d.ts +77 -0
  219. package/dist/wallet/manager.d.ts.map +1 -0
  220. package/dist/wallet/manager.js +474 -0
  221. package/dist/wallet/manager.js.map +1 -0
  222. package/dist/wallet/mnemonic.d.ts +5 -0
  223. package/dist/wallet/mnemonic.d.ts.map +1 -0
  224. package/dist/wallet/mnemonic.js +28 -0
  225. package/dist/wallet/mnemonic.js.map +1 -0
  226. package/dist/wallet/sign-message.d.ts +20 -0
  227. package/dist/wallet/sign-message.d.ts.map +1 -0
  228. package/dist/wallet/sign-message.js +58 -0
  229. package/dist/wallet/sign-message.js.map +1 -0
  230. package/package.json +55 -0
@@ -0,0 +1,54 @@
1
+ /** Per-UTxO generation figures, as the SDK's `estimateRegistration` reports
2
+ * them. All amounts in Specks. */
3
+ export interface DustGenerationSlice {
4
+ /** Backdated DUST this UTxO could contribute right now. */
5
+ generatedNow: bigint;
6
+ /** Specks per second this UTxO accrues (`night_value * decay_rate`). */
7
+ rate: bigint;
8
+ /** Ceiling this UTxO can ever reach (`night_value * night_dust_ratio`). */
9
+ maxCap: bigint;
10
+ /** Already backing DUST, so excluded from backdated fee payment — the
11
+ * ledger's `!night_indices.contains_key(initial_nonce)` filter. */
12
+ registeredForDustGeneration: boolean;
13
+ }
14
+ export interface DustRegistrationEstimate {
15
+ /** What the registration costs, in Specks. */
16
+ fee: bigint;
17
+ /** Backdated DUST available to it right now. */
18
+ available: bigint;
19
+ /** Combined accrual, in Specks per second. */
20
+ rate: bigint;
21
+ /** The most this NIGHT could ever offer, however long the wallet waits. */
22
+ maxAvailable: bigint;
23
+ /** Whether registering would succeed now. */
24
+ affordable: boolean;
25
+ /**
26
+ * Seconds until `available` reaches `fee`.
27
+ *
28
+ * `0` when already affordable. `null` when waiting cannot get there — either
29
+ * nothing is accruing, or the ceiling is below the fee, in which case the
30
+ * answer is "hold more NIGHT", not "wait longer". Distinguishing these
31
+ * matters: telling someone to wait for something that will never arrive is
32
+ * worse than telling them nothing.
33
+ */
34
+ secondsUntilAffordable: number | null;
35
+ }
36
+ /** A rough, readable duration. Deliberately vague at the top end: the estimate
37
+ * assumes the holding does not change, and "about 8 hours" carries that
38
+ * honestly where "7h 55m 12s" would imply a precision it does not have. */
39
+ export declare function describeWait(seconds: number): string;
40
+ /**
41
+ * Registration cannot pay its own fee yet.
42
+ *
43
+ * A distinct type because this is not a failure in any useful sense — nothing
44
+ * was built, nothing booked, nothing spent, and the same call will succeed later
45
+ * with no change to the wallet. Callers that show it as an error alongside
46
+ * genuine ones (a dead node, a refused proof) mislead: this one just needs time,
47
+ * or more NIGHT.
48
+ */
49
+ export declare class DustRegistrationNotYetError extends Error {
50
+ readonly estimate: DustRegistrationEstimate;
51
+ constructor(estimate: DustRegistrationEstimate, cause?: unknown);
52
+ }
53
+ export declare function estimateRegistrationAffordability(fee: bigint, slices: readonly DustGenerationSlice[]): DustRegistrationEstimate;
54
+ //# sourceMappingURL=dust-registration-estimate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dust-registration-estimate.d.ts","sourceRoot":"","sources":["../../src/sync/dust-registration-estimate.ts"],"names":[],"mappings":"AA6BA;mCACmC;AACnC,MAAM,WAAW,mBAAmB;IAClC,2DAA2D;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAC;IACf;wEACoE;IACpE,2BAA2B,EAAE,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,wBAAwB;IACvC,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,YAAY,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,UAAU,EAAE,OAAO,CAAC;IACpB;;;;;;;;OAQG;IACH,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAYD;;4EAE4E;AAC5E,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CASpD;AAED;;;;;;;;GAQG;AACH,qBAAa,2BAA4B,SAAQ,KAAK;IACpD,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;gBAEhC,QAAQ,EAAE,wBAAwB,EAAE,KAAK,CAAC,EAAE,OAAO;CAehE;AAED,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,mBAAmB,EAAE,GACrC,wBAAwB,CA+B1B"}
@@ -0,0 +1,103 @@
1
+ // When a fresh wallet can actually register NIGHT for DUST generation.
2
+ //
3
+ // Registering is self-funding by design — it does not require the wallet to
4
+ // already hold DUST, which would be a bootstrap deadlock. Instead a
5
+ // DustRegistration carries `allow_fee_payment`, and the ledger lets the
6
+ // transaction pay its own fee out of the DUST its NIGHT *would have* generated
7
+ // had it been registered all along (midnight-ledger `spec/dust.md`, "because
8
+ // registrations run a challenge of paying for their own fees…").
9
+ //
10
+ // Self-funding is not the same as free. `generationless_fee_availability`
11
+ // (midnight-ledger `ledger/src/dust.rs`) caps that backdated amount at
12
+ //
13
+ // elapsed_since_utxo_created * night_value * generation_decay_rate
14
+ //
15
+ // so it grows from zero. A wallet funded moments ago cannot cover the fee yet,
16
+ // and one holding very little NIGHT accrues towards it slowly: at the ledger's
17
+ // default parameters (5 DUST per NIGHT, ~1 week to cap) a 0.3 DUST registration
18
+ // fee needs roughly 36s at 1,000 NIGHT, 6 min at 100, an hour at 10, and 10
19
+ // hours at 1.
20
+ //
21
+ // Without a pre-flight the wallet builds the transaction, hands it to the SDK,
22
+ // and surfaces the SDK's own guard as a failure after the fact — which reads as
23
+ // a broken wallet rather than "not yet". Worse, our failure card blamed the
24
+ // proof server, which has nothing to do with it. This computes the answer up
25
+ // front so the wallet can say how long instead.
26
+ //
27
+ // Pure and WASM-free: the arithmetic is the part worth testing, and it needs no
28
+ // facade, no chain and no proving.
29
+ /** Specks in one DUST — the ledger's SPECKS_PER_DUST. */
30
+ const SPECKS_PER_DUST = 1000000000000000n;
31
+ /** Whole DUST to 4dp, for messages a person reads. */
32
+ function formatDust(specks) {
33
+ const whole = specks / SPECKS_PER_DUST;
34
+ const frac = ((specks % SPECKS_PER_DUST) * 10000n) / SPECKS_PER_DUST;
35
+ return `${whole}.${frac.toString().padStart(4, '0')}`;
36
+ }
37
+ /** A rough, readable duration. Deliberately vague at the top end: the estimate
38
+ * assumes the holding does not change, and "about 8 hours" carries that
39
+ * honestly where "7h 55m 12s" would imply a precision it does not have. */
40
+ export function describeWait(seconds) {
41
+ if (seconds < 60)
42
+ return `about ${Math.max(1, Math.round(seconds))} seconds`;
43
+ if (seconds < 3_600)
44
+ return `about ${Math.round(seconds / 60)} minutes`;
45
+ if (seconds < 86_400) {
46
+ const hours = Math.round((seconds / 3_600) * 10) / 10;
47
+ return `about ${hours} hour${hours === 1 ? '' : 's'}`;
48
+ }
49
+ const days = Math.round((seconds / 86_400) * 10) / 10;
50
+ return `about ${days} day${days === 1 ? '' : 's'}`;
51
+ }
52
+ /**
53
+ * Registration cannot pay its own fee yet.
54
+ *
55
+ * A distinct type because this is not a failure in any useful sense — nothing
56
+ * was built, nothing booked, nothing spent, and the same call will succeed later
57
+ * with no change to the wallet. Callers that show it as an error alongside
58
+ * genuine ones (a dead node, a refused proof) mislead: this one just needs time,
59
+ * or more NIGHT.
60
+ */
61
+ export class DustRegistrationNotYetError extends Error {
62
+ estimate;
63
+ constructor(estimate, cause) {
64
+ const have = formatDust(estimate.available);
65
+ const need = formatDust(estimate.fee);
66
+ super(estimate.secondsUntilAffordable === null
67
+ ? `Registration costs ${need} DUST of backdated generation, but this NIGHT can only ever provide ` +
68
+ `${formatDust(estimate.maxAvailable)} DUST. Hold more NIGHT and try again.`
69
+ : `Registration pays its own fee from the DUST this NIGHT would already have generated. ` +
70
+ `It needs ${need} DUST and has ${have} so far — ${describeWait(estimate.secondsUntilAffordable)} to go. ` +
71
+ `Nothing was spent.`, { cause });
72
+ this.name = 'DustRegistrationNotYetError';
73
+ this.estimate = estimate;
74
+ }
75
+ }
76
+ export function estimateRegistrationAffordability(fee, slices) {
77
+ // Only UTxOs not already backing DUST can fund a registration by backdating.
78
+ const eligible = slices.filter((s) => !s.registeredForDustGeneration);
79
+ const sum = (pick) => eligible.reduce((total, s) => total + pick(s), 0n);
80
+ const available = sum((s) => s.generatedNow);
81
+ const rate = sum((s) => s.rate);
82
+ const maxAvailable = sum((s) => s.maxCap);
83
+ if (available >= fee) {
84
+ return { fee, available, rate, maxAvailable, affordable: true, secondsUntilAffordable: 0 };
85
+ }
86
+ // Unreachable rather than slow. Both cases are real: a wallet whose NIGHT is
87
+ // all registered already has no accrual to wait on, and a wallet holding too
88
+ // little NIGHT tops out below the fee.
89
+ const reachable = rate > 0n && maxAvailable >= fee;
90
+ const shortfall = fee - available;
91
+ return {
92
+ fee,
93
+ available,
94
+ rate,
95
+ maxAvailable,
96
+ affordable: false,
97
+ // Ceiling, not rounding: at the exact quotient the balance has only just
98
+ // reached the fee, and reporting a second early sends the user back to the
99
+ // same failure.
100
+ secondsUntilAffordable: reachable ? Number((shortfall + rate - 1n) / rate) : null,
101
+ };
102
+ }
103
+ //# sourceMappingURL=dust-registration-estimate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dust-registration-estimate.js","sourceRoot":"","sources":["../../src/sync/dust-registration-estimate.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,4EAA4E;AAC5E,oEAAoE;AACpE,wEAAwE;AACxE,+EAA+E;AAC/E,6EAA6E;AAC7E,iEAAiE;AACjE,EAAE;AACF,0EAA0E;AAC1E,uEAAuE;AACvE,EAAE;AACF,uEAAuE;AACvE,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,gFAAgF;AAChF,4EAA4E;AAC5E,cAAc;AACd,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,4EAA4E;AAC5E,6EAA6E;AAC7E,gDAAgD;AAChD,EAAE;AACF,gFAAgF;AAChF,mCAAmC;AAuCnC,yDAAyD;AACzD,MAAM,eAAe,GAAG,iBAAsB,CAAC;AAE/C,sDAAsD;AACtD,SAAS,UAAU,CAAC,MAAc;IAChC,MAAM,KAAK,GAAG,MAAM,GAAG,eAAe,CAAC;IACvC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,GAAG,eAAe,CAAC,GAAG,MAAO,CAAC,GAAG,eAAe,CAAC;IACtE,OAAO,GAAG,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AACxD,CAAC;AAED;;4EAE4E;AAC5E,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,SAAS,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,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S,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;KAClF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { SyncStateStore } from './sync-store.js';
2
+ export declare class NodeSyncStateStore implements SyncStateStore {
3
+ private readonly base;
4
+ constructor(base?: string);
5
+ private fileFor;
6
+ get(key: string): Promise<string | null>;
7
+ put(key: string, value: string): Promise<void>;
8
+ delete(key: string): Promise<void>;
9
+ }
10
+ //# sourceMappingURL=node-sync-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-sync-store.d.ts","sourceRoot":"","sources":["../../src/sync/node-sync-store.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAEpD,qBAAa,kBAAmB,YAAW,cAAc;IACvD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;gBAElB,IAAI,CAAC,EAAE,MAAM;IAIzB,OAAO,CAAC,OAAO;IAIT,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAUxC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM9C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAOzC"}
@@ -0,0 +1,42 @@
1
+ // Filesystem-backed SyncStateStore preserving the legacy ~/.moth layout
2
+ // (sync/<network>/<wallet>/<part>.dat, empty-ref/<network>/...).
3
+ // This is the only sync module allowed to import node:* — it is exposed via
4
+ // the package's "./*" subpath exports and must never be re-exported from the
5
+ // barrel, which has to stay browser-bundleable.
6
+ import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from 'node:fs';
7
+ import { join, dirname } from 'node:path';
8
+ import { homedir } from 'node:os';
9
+ export class NodeSyncStateStore {
10
+ base;
11
+ constructor(base) {
12
+ this.base = base ?? join(homedir(), '.moth');
13
+ }
14
+ fileFor(key) {
15
+ return join(this.base, ...key.split('/'));
16
+ }
17
+ async get(key) {
18
+ const file = this.fileFor(key);
19
+ if (!existsSync(file))
20
+ return null;
21
+ try {
22
+ return readFileSync(file, 'utf-8');
23
+ }
24
+ catch {
25
+ return null;
26
+ }
27
+ }
28
+ async put(key, value) {
29
+ const file = this.fileFor(key);
30
+ mkdirSync(dirname(file), { recursive: true, mode: 0o700 });
31
+ writeFileSync(file, value, { encoding: 'utf-8', mode: 0o600 });
32
+ }
33
+ async delete(key) {
34
+ try {
35
+ unlinkSync(this.fileFor(key));
36
+ }
37
+ catch {
38
+ /* ignore */
39
+ }
40
+ }
41
+ }
42
+ //# sourceMappingURL=node-sync-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-sync-store.js","sourceRoot":"","sources":["../../src/sync/node-sync-store.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,iEAAiE;AACjE,4EAA4E;AAC5E,6EAA6E;AAC7E,gDAAgD;AAEhD,OAAO,EAAC,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAC,MAAM,SAAS,CAAC;AACvF,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AACxC,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAGhC,MAAM,OAAO,kBAAkB;IACZ,IAAI,CAAS;IAE9B,YAAY,IAAa;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAEO,OAAO,CAAC,GAAW;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACnC,IAAI,CAAC;YACH,OAAO,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAa;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC/B,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC;QACzD,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,EAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW;QACtB,IAAI,CAAC;YACH,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QAChC,CAAC;QAAC,MAAM,CAAC;YACP,YAAY;QACd,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,138 @@
1
+ import * as ledger from '@midnight-ntwrk/ledger-v8';
2
+ import type { WalletFacade, UtxoWithMeta } from '@midnightntwrk/wallet-sdk/facade';
3
+ import { DustRegistrationNotYetError, type DustRegistrationEstimate } from './dust-registration-estimate.js';
4
+ export { DustRegistrationNotYetError, type DustRegistrationEstimate };
5
+ /** The proven, signed, ready-to-submit transaction produced by the facade. */
6
+ export type FinalizedTransaction = ledger.FinalizedTransaction;
7
+ export type TxStage = 'building' | 'proving' | 'submitting';
8
+ export interface SendRequest {
9
+ type: 'shielded' | 'unshielded';
10
+ tokenId: string;
11
+ amount: bigint;
12
+ to: string;
13
+ }
14
+ /** An input the wallet offers into a swap intent (no recipient — it's spent). */
15
+ export interface SwapInput {
16
+ type: 'shielded' | 'unshielded';
17
+ tokenId: string;
18
+ amount: bigint;
19
+ }
20
+ export type { WalletKeys } from '../types/wallet.js';
21
+ import type { WalletKeys } from '../types/wallet.js';
22
+ /**
23
+ * Derive the typed key bundle from a 64-char BIP-39 hex seed. Option A key
24
+ * model (v8's D-KM-3): callers derive once at unlock and discard the raw seed
25
+ * immediately — the bundle holds everything the write paths need, so the seed
26
+ * is never threaded through the daemon or the extension messaging layers.
27
+ */
28
+ export declare function deriveWalletKeys(seedHex: string): WalletKeys;
29
+ /**
30
+ * Build, prove and sign a transfer, stopping short of submission.
31
+ * The dApp connector's makeTransfer/submitTransaction split needs the
32
+ * finalized transaction as a standalone artifact; sendTokens composes this
33
+ * with submission.
34
+ */
35
+ export declare function buildTransferTransaction(facade: WalletFacade, keys: WalletKeys, networkId: string, requests: SendRequest[], onProgress?: (stage: TxStage) => void): Promise<FinalizedTransaction>;
36
+ /**
37
+ * Estimate the complete DUST fee for a transfer, including the balancing
38
+ * transaction that pays it. The facade's transfer builder books selected
39
+ * inputs even when fee payment is disabled, so the temporary base transaction
40
+ * is always reverted before returning.
41
+ */
42
+ export declare function estimateTransferFee(facade: WalletFacade, keys: WalletKeys, networkId: string, requests: SendRequest[]): Promise<bigint>;
43
+ /**
44
+ * Submit a previously built transfer with retries.
45
+ */
46
+ export declare function submitFinalizedTransaction(facade: WalletFacade, finalized: FinalizedTransaction): Promise<string>;
47
+ /**
48
+ * Send tokens via the wallet facade using a pre-derived key bundle. Prefer this
49
+ * over {@link sendTokens} when the caller already holds WalletKeys (the daemon
50
+ * and the extension, which derive once at unlock and drop the seed — Option A /
51
+ * D-KM-3, docs/spec/wallet-service/05-key-management.md).
52
+ */
53
+ export declare function sendTokensWithKeys(facade: WalletFacade, keys: WalletKeys, networkId: string, requests: SendRequest[], onProgress?: (stage: TxStage) => void): Promise<string>;
54
+ /**
55
+ * Balance a dApp-supplied transaction (connector `balanceSealedTransaction` /
56
+ * `balanceUnsealedTransaction`): pay fees and add wallet inputs/outputs to
57
+ * remove imbalances, then prove + bind into a submit-ready FinalizedTransaction.
58
+ *
59
+ * `sealed` selects the input stage:
60
+ * - sealed → Transaction<SignatureEnabled, Proof, Binding> (FinalizedTransaction)
61
+ * - unsealed → Transaction<SignatureEnabled, Proof, PreBinding> (UnboundTransaction)
62
+ *
63
+ * The prove/finalize tail is the same as {@link buildTransferTransaction}.
64
+ */
65
+ export declare function balanceTransaction(facade: WalletFacade, keys: WalletKeys, networkId: string, txBytes: Uint8Array, sealed: boolean, onProgress?: (stage: TxStage) => void): Promise<FinalizedTransaction>;
66
+ /**
67
+ * Build a swap intent (connector `makeIntent`): the wallet's half of a swap,
68
+ * providing `inputs` (spent) and `outputs` (sent to recipients). Returns the
69
+ * raw unproven, unbound transaction from the SDK's `initSwap` — deliberately
70
+ * NOT proven or bound, so the dApp can combine it with the counterparty's half
71
+ * before the combined transaction is proven, balanced, and submitted.
72
+ *
73
+ * NOTE: the connector's `intentId` option is not honored — the SDK's `initSwap`
74
+ * exposes no segment-id control, so callers cannot pin the intent's id or opt
75
+ * out of transaction merging.
76
+ */
77
+ export declare function buildSwapIntent(facade: WalletFacade, keys: WalletKeys, networkId: string, inputs: SwapInput[], outputs: SendRequest[], payFees: boolean, onProgress?: (stage: TxStage) => void): Promise<ledger.UnprovenTransaction>;
78
+ /**
79
+ * Send tokens via the wallet facade. Convenience wrapper that derives a
80
+ * WalletKeys bundle from the seed and delegates to
81
+ * {@link sendTokensWithKeys}. Holds the seed in memory only for the
82
+ * duration of derivation — used by paths like the in-process `moth
83
+ * transfer` CLI command that already work in terms of seedHex.
84
+ */
85
+ export declare function sendTokens(facade: WalletFacade, seedHex: string, networkId: string, requests: SendRequest[], onProgress?: (stage: TxStage) => void): Promise<string>;
86
+ /**
87
+ * A NIGHT UTXO with its dust-registration status.
88
+ * `raw` is the underlying SDK object; pass it back to designate/dedesignate.
89
+ */
90
+ export interface NightUtxo {
91
+ raw: UtxoWithMeta;
92
+ value: bigint;
93
+ registered: boolean;
94
+ }
95
+ /**
96
+ * List the active wallet's NIGHT UTXOs (registered + unregistered).
97
+ * Waits for the unshielded sub-wallet to be strict-complete — does NOT gate on
98
+ * aggregate `isSynced`, which never becomes true for a fresh wallet whose only
99
+ * activity is unshielded (e.g. a faucet-funded test wallet pre-dust-register).
100
+ */
101
+ export declare function listNightUtxos(facade: WalletFacade): Promise<NightUtxo[]>;
102
+ /**
103
+ * Register NIGHT UTXOs for DUST generation, using a pre-derived
104
+ * WalletKeys bundle (D-KM-3 path — preferred over the seedHex variant
105
+ * for daemon callers).
106
+ */
107
+ export declare function designateForDustWithKeys(facade: WalletFacade, keys: WalletKeys, networkId: string, receiver?: string, onProgress?: (stage: TxStage) => void, selectedUtxos?: NightUtxo[]): Promise<string | null>;
108
+ /**
109
+ * Register NIGHT UTXOs for DUST generation.
110
+ * If `selectedUtxos` is provided, registers exactly those; otherwise auto-selects
111
+ * all currently unregistered NIGHT UTXOs.
112
+ */
113
+ export declare function designateForDust(facade: WalletFacade, seedHex: string, networkId: string, receiver?: string, onProgress?: (stage: TxStage) => void, selectedUtxos?: NightUtxo[]): Promise<string | null>;
114
+ /**
115
+ * Whether registration can pay its own fee yet, and if not, how long until it
116
+ * can. Reads state and builds a throwaway transaction for costing; books
117
+ * nothing and spends nothing.
118
+ *
119
+ * Registration is self-funding — it draws on the DUST its NIGHT would have
120
+ * generated had it been registered all along — but that backdated amount starts
121
+ * at zero and grows with the NIGHT's age, so a freshly funded wallet cannot
122
+ * cover the fee yet. Without asking first, the wallet builds, proves, fails on
123
+ * the SDK's guard, and reports a defect where the honest answer is "not yet, try
124
+ * in about six minutes". See sync/dust-registration-estimate.ts.
125
+ */
126
+ export declare function estimateDustRegistration(facade: WalletFacade, selectedUtxos?: NightUtxo[]): Promise<DustRegistrationEstimate>;
127
+ /**
128
+ * Deregister NIGHT UTXOs from DUST generation, using a pre-derived
129
+ * WalletKeys bundle (D-KM-3 path).
130
+ */
131
+ export declare function dedesignateFromDustWithKeys(facade: WalletFacade, keys: WalletKeys, networkId: string, onProgress?: (stage: TxStage) => void, selectedUtxos?: NightUtxo[]): Promise<string>;
132
+ /**
133
+ * Deregister NIGHT UTXOs from DUST generation.
134
+ * If `selectedUtxos` is provided, deregisters exactly those; otherwise auto-selects
135
+ * all currently registered NIGHT UTXOs.
136
+ */
137
+ export declare function dedesignateFromDust(facade: WalletFacade, seedHex: string, networkId: string, onProgress?: (stage: TxStage) => void, selectedUtxos?: NightUtxo[]): Promise<string>;
138
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/sync/operations.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAQpD,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EAKb,MAAM,kCAAkC,CAAC;AAK1C,OAAO,EAEL,2BAA2B,EAC3B,KAAK,wBAAwB,EAC9B,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EAAC,2BAA2B,EAAE,KAAK,wBAAwB,EAAC,CAAC;AAEpE,8EAA8E;AAC9E,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAE/D,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,CAAC;AAE5D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,UAAU,GAAG,YAAY,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;CACZ;AA0BD,iFAAiF;AACjF,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,UAAU,GAAG,YAAY,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAKD,YAAY,EAAC,UAAU,EAAC,MAAM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