@sig-net/midnight-contract-deploy 0.21.0-rc.8 → 0.21.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.
@@ -10,26 +10,69 @@ import { mergeWalletEntries, WalletEntrySchema, WalletFacade, } from "@midnightn
10
10
  import { HDWallet, Roles } from "@midnightntwrk/wallet-sdk-hd";
11
11
  import { ShieldedWallet } from "@midnightntwrk/wallet-sdk-shielded";
12
12
  import { createKeystore, PublicKey as UnshieldedPublicKey, UnshieldedWallet, } from "@midnightntwrk/wallet-sdk-unshielded-wallet";
13
+ import { formatDust } from "./format-dust.js";
14
+ import { isLocalStandaloneNetwork } from "./network-id.js";
13
15
  import { parseSeed } from "./seed.js";
16
+ // The facade balances every submitted transaction with
17
+ // `feesWithMargin(params, FEE_BLOCKS_MARGIN) + additionalFeeOverhead`, so the
18
+ // overhead is burned as dust on EVERY transaction. It compensates for the
19
+ // wallet sdk pricing a PROOF-ERASED transaction while the node prices the
20
+ // real proof bytes: the node's fee exceeds the wallet's estimate by an amount
21
+ // that grows with proof size, and the node rejects the spend with
22
+ // Malformed(BalanceCheckOverspend) when the wallet under-provides. The local
23
+ // standalone chain's dust is free, so its overhead covers the gap this
24
+ // repo's circuits produce with headroom. A deployed network's dust is scarce
25
+ // (faucet-funded NIGHT generates it slowly), so its overhead is zero: raise
26
+ // it for a network whose node rejects a spend with
27
+ // Malformed(BalanceCheckOverspend).
28
+ const UNDEPLOYED_ADDITIONAL_FEE_OVERHEAD = 50000000000000n;
29
+ const DEPLOYED_ADDITIONAL_FEE_OVERHEAD = 0n;
30
+ // Fee margin in blocks the facade balances with, alongside the overhead.
31
+ const FEE_BLOCKS_MARGIN = 5;
14
32
  /**
15
- * Default `additionalFeeOverhead` the facade balances transactions with: it
16
- * burns `feesWithMargin(params, feeBlocksMargin) + additionalFeeOverhead`
17
- * per transaction, so the overhead is burned as dust on EVERY submitted
18
- * transaction.
33
+ * The `additionalFeeOverhead` a facade balances with when its
34
+ * {@link WalletFacadeOptions} name none: 5e13 on the local standalone chain,
35
+ * whose dust is free, and 0 on every deployed network, whose dust is scarce.
19
36
  *
20
- * The overhead compensates for the wallet sdk pricing a PROOF-ERASED
21
- * transaction while the node prices the real proof bytes. The node's fee
22
- * consequently exceeds the wallet's estimate by an amount that grows with
23
- * proof size, and the node rejects the spend with
24
- * Malformed(BalanceCheckOverspend) when the wallet under-provides. 5e13
25
- * covers the gap this repo's circuits produce, with headroom, and the excess
26
- * is simply burned dust. The default is tuned for local fakenet chains where
27
- * dust is free: real-network deploys may want a lower value (see
28
- * {@link WalletFacadeOptions}).
37
+ * @param networkId - The network the facade connects to.
38
+ * @returns The overhead burned as dust on top of every transaction's estimated fee.
29
39
  */
30
- export const DEFAULT_ADDITIONAL_FEE_OVERHEAD = 50000000000000n;
31
- // Fee margin in blocks the facade balances with, alongside the overhead.
32
- const FEE_BLOCKS_MARGIN = 5;
40
+ export function defaultAdditionalFeeOverhead(networkId) {
41
+ return isLocalStandaloneNetwork(networkId)
42
+ ? UNDEPLOYED_ADDITIONAL_FEE_OVERHEAD
43
+ : DEPLOYED_ADDITIONAL_FEE_OVERHEAD;
44
+ }
45
+ // A facade refusal that names its shortfall does so as "(have X, need Y)":
46
+ // the dust-registration refusal ("Insufficient generated dust to cover
47
+ // registration fee (have X, need Y)") does, the balancing refusal
48
+ // ("Insufficient Funds: could not balance dust") names no amount.
49
+ const DUST_SHORTFALL = /dust\b.*?\(have (\d+), need (\d+)\)/i;
50
+ /**
51
+ * The amounts a facade refusal names when it refuses for lack of DUST.
52
+ *
53
+ * @param error - What a facade call threw.
54
+ * @returns The named shortfall, or undefined for a refusal that names no
55
+ * amount and for any other error.
56
+ */
57
+ export function dustShortfall(error) {
58
+ const match = DUST_SHORTFALL.exec(String(error));
59
+ const have = match?.[1];
60
+ const need = match?.[2];
61
+ return have === undefined || need === undefined
62
+ ? undefined
63
+ : { have: BigInt(have), need: BigInt(need) };
64
+ }
65
+ /**
66
+ * The ledger transaction an unproven-transaction byte string carries (a
67
+ * contract deploy from `buildDeployTransaction` in deploy.ts, a maintenance
68
+ * update), in the form the facade prices and balances.
69
+ *
70
+ * @param serializedTransaction - The unproven transaction bytes.
71
+ * @returns The deserialized unproven transaction.
72
+ */
73
+ function deserializeUnprovenTransaction(serializedTransaction) {
74
+ return ledger.Transaction.deserialize("signature", "pre-proof", "pre-binding", serializedTransaction);
75
+ }
33
76
  /**
34
77
  * Parse a seed and derive the three role keys (Zswap / NightExternal / Dust).
35
78
  * Pure crypto — no network. This is the step that exercises the ledger WASM.
@@ -92,7 +135,7 @@ export function initialiseWalletFacade(keys, config, options = {}) {
92
135
  // The facade talks to the node over WebSocket, so flip http(s) -> ws(s).
93
136
  relayURL: new URL(config.nodeUrl.replace(/^http/, "ws")),
94
137
  costParameters: {
95
- additionalFeeOverhead: options.additionalFeeOverhead ?? DEFAULT_ADDITIONAL_FEE_OVERHEAD,
138
+ additionalFeeOverhead: options.additionalFeeOverhead ?? defaultAdditionalFeeOverhead(config.networkId),
96
139
  feeBlocksMargin: FEE_BLOCKS_MARGIN,
97
140
  },
98
141
  txHistoryStorage: new InMemoryTransactionHistoryStorage(WalletEntrySchema, mergeWalletEntries),
@@ -104,27 +147,52 @@ export function initialiseWalletFacade(keys, config, options = {}) {
104
147
  }
105
148
  // Recipes (balancing plans for submitted transactions) expire 30 min out.
106
149
  const RECIPE_TTL_MS = 30 * 60 * 1000;
107
- // Balancing throws Wallet.InsufficientFunds ("could not balance dust") while
108
- // the paying wallet's DUST is still generating: a young local chain accrues
109
- // it block by block from the genesis NIGHT, and a freshly registered wallet
110
- // on a deployed network starts from its first few units. Building the recipe
111
- // costs no proving, so it is retried in place until the wallet covers the
112
- // fee. A wallet with nothing to generate from fails fast in ensureFeeReady
113
- // (funding.ts) before any of this, so the bounded retry cannot mask real
114
- // underfunding.
150
+ // Dust generates continuously once NIGHT is registered, but a fresh
151
+ // registration takes a few blocks before a spendable balance appears.
152
+ const DUST_POLL_INTERVAL_MS = 5_000;
153
+ /**
154
+ * Wait until the wallet's spendable DUST (fee) balance reaches `minimumDust`,
155
+ * polling the synced facade state and logging each reading. Pair with
156
+ * {@link registerNightForDustGeneration}: a wallet whose NIGHT was just
157
+ * registered has no dust for a few blocks.
158
+ *
159
+ * @param facade - A started wallet facade.
160
+ * @param minimumDust - The spendable DUST to wait for, in base units (1 = any dust at all).
161
+ * @param timeoutMs - Give-up deadline in milliseconds.
162
+ * @returns The first spendable dust balance at or above `minimumDust`.
163
+ * @throws {Error} If the balance stays below `minimumDust` for `timeoutMs`.
164
+ */
165
+ export async function waitForSpendableDust(facade, minimumDust, timeoutMs = 300_000) {
166
+ const deadline = Date.now() + timeoutMs;
167
+ for (;;) {
168
+ const state = await facade.waitForSyncedState();
169
+ const dust = state.dust.balance(new Date());
170
+ if (dust >= minimumDust)
171
+ return dust;
172
+ if (Date.now() >= deadline) {
173
+ throw new Error(`spendable DUST reached ${formatDust(dust)} of the ${formatDust(minimumDust)} needed after ${String(timeoutMs)} ms: ` +
174
+ "is the wallet's NIGHT registered for dust generation, and is there enough of it to generate the fees?");
175
+ }
176
+ console.log(`spendable DUST ${formatDust(dust)} of the ${formatDust(minimumDust)} needed, waiting...`);
177
+ await new Promise((resolve) => setTimeout(resolve, DUST_POLL_INTERVAL_MS));
178
+ }
179
+ }
115
180
  const BALANCE_RETRY_INTERVAL_MS = 15_000;
116
181
  const BALANCE_RETRY_TIMEOUT_MS = 6 * 60 * 1000;
117
182
  /**
118
- * Run a recipe-building call, retrying while it fails for lack of DUST. Each
119
- * retry first waits for the facade to report itself synced again, so the
120
- * balancer works from the chain tip rather than the view the last attempt
121
- * failed on.
183
+ * Run a recipe-building call, retrying while it fails for lack of DUST
184
+ * within {@link BALANCE_RETRY_TIMEOUT_MS}. A refusal naming its shortfall
185
+ * (see {@link dustShortfall}) waits for the spendable DUST to reach the
186
+ * named amount before building again. One naming no amount is rebuilt each
187
+ * interval, after the facade reports itself synced again so the balancer
188
+ * works from the chain tip.
122
189
  *
123
190
  * @param facade - The started facade `build` balances with.
124
191
  * @param build - The balancing call to (re)attempt.
125
192
  * @returns The recipe `build` resolves to.
126
- * @throws {Error} The last error once {@link BALANCE_RETRY_TIMEOUT_MS} is
127
- * spent, or immediately for any error other than insufficient dust.
193
+ * @throws {Error} Immediately for any error other than insufficient dust, the
194
+ * facade's own error once the retry budget is spent, or the wait's error
195
+ * when a named shortfall does not generate within the budget.
128
196
  */
129
197
  async function balanceWhileDustGenerates(facade, build) {
130
198
  const deadline = Date.now() + BALANCE_RETRY_TIMEOUT_MS;
@@ -134,16 +202,37 @@ async function balanceWhileDustGenerates(facade, build) {
134
202
  }
135
203
  catch (error) {
136
204
  const message = String(error);
137
- const insufficientDust = message.includes("InsufficientFunds") || message.includes("could not balance dust");
205
+ const insufficientDust = message.includes("could not balance dust") || dustShortfall(error) !== undefined;
138
206
  if (!insufficientDust || Date.now() >= deadline)
139
207
  throw error;
140
- console.log(`the wallet cannot cover the fee yet (DUST still generating), retrying in ${String(BALANCE_RETRY_INTERVAL_MS / 1000)}s`);
141
- await new Promise((resolve) => setTimeout(resolve, BALANCE_RETRY_INTERVAL_MS));
142
- const state = await facade.waitForSyncedState();
143
- console.log(`wallet resynced, spendable DUST: ${String(state.dust.balance(new Date()))}`);
208
+ console.warn("DUST fee balancing failed, retrying:", error);
209
+ const shortfall = dustShortfall(error);
210
+ if (shortfall === undefined) {
211
+ console.log(`the wallet cannot cover the fee yet (DUST still generating), retrying in ${String(BALANCE_RETRY_INTERVAL_MS / 1000)}s`);
212
+ await new Promise((resolve) => setTimeout(resolve, BALANCE_RETRY_INTERVAL_MS));
213
+ const state = await facade.waitForSyncedState();
214
+ console.log(`wallet resynced, spendable DUST: ${formatDust(state.dust.balance(new Date()))}`);
215
+ continue;
216
+ }
217
+ console.log(`the wallet holds ${formatDust(shortfall.have)} of the ${formatDust(shortfall.need)} DUST the fee needs, waiting for the rest to generate`);
218
+ await waitForSpendableDust(facade, shortfall.need, deadline - Date.now());
144
219
  }
145
220
  }
146
221
  }
222
+ /**
223
+ * The fee the facade prices a serialized unproven transaction at: the
224
+ * ledger's fee with the facade's block margin plus the network's overhead
225
+ * (see {@link defaultAdditionalFeeOverhead}). The balancing inputs the
226
+ * facade adds at submission carry a further small fee, so this is the floor
227
+ * of what submitting the transaction burns.
228
+ *
229
+ * @param facade - A started facade, whose network sets the overhead.
230
+ * @param serializedTransaction - The unproven transaction bytes.
231
+ * @returns The transaction's fee in DUST base units.
232
+ */
233
+ export async function estimateUnprovenTransactionFee(facade, serializedTransaction) {
234
+ return facade.calculateTransactionFee(deserializeUnprovenTransaction(serializedTransaction));
235
+ }
147
236
  /**
148
237
  * Balance, sign, prove and submit a serialized unproven transaction (e.g. a
149
238
  * contract deploy built by `buildDeployTransaction` in deploy.ts). Proving
@@ -157,8 +246,7 @@ async function balanceWhileDustGenerates(facade, build) {
157
246
  * budget, proving fails, or the node rejects the transaction.
158
247
  */
159
248
  export async function submitUnprovenTransaction(facade, keys, serializedTransaction) {
160
- // Deserialize back into the ledger UnprovenTransaction the facade balances.
161
- const tx = ledger.Transaction.deserialize("signature", "pre-proof", "pre-binding", serializedTransaction);
249
+ const tx = deserializeUnprovenTransaction(serializedTransaction);
162
250
  // Balance (add dust/fee inputs) → sign those inputs → finalize (prove) → submit.
163
251
  console.log("balancing and signing transaction...");
164
252
  const recipe = await balanceWhileDustGenerates(facade, () => facade.balanceUnprovenTransaction(tx, { shieldedSecretKeys: keys.shieldedSecretKeys, dustSecretKey: keys.dustSecretKey }, { ttl: new Date(Date.now() + RECIPE_TTL_MS) }));
@@ -191,23 +279,45 @@ export async function transferNight(facade, keys, state, toUnshieldedAddress, ne
191
279
  throw new Error("funder wallet holds no unshielded NIGHT to transfer");
192
280
  }
193
281
  const receiverAddress = MidnightBech32m.parse(toUnshieldedAddress).decode(UnshieldedAddress, networkId);
194
- const recipe = await balanceWhileDustGenerates(facade, () => facade.transferTransaction([{ type: "unshielded", outputs: [{ type: nightTokenType, receiverAddress, amount }] }], { shieldedSecretKeys: keys.shieldedSecretKeys, dustSecretKey: keys.dustSecretKey }, { ttl: new Date(Date.now() + RECIPE_TTL_MS), payFees: true }));
282
+ const ttl = new Date(Date.now() + RECIPE_TTL_MS);
283
+ const secretKeys = {
284
+ shieldedSecretKeys: keys.shieldedSecretKeys,
285
+ dustSecretKey: keys.dustSecretKey,
286
+ };
287
+ // Keep the reserved NIGHT inputs in one transfer throughout fee retries.
288
+ const transfer = await facade.transferTransaction([{ type: "unshielded", outputs: [{ type: nightTokenType, receiverAddress, amount }] }], secretKeys, { ttl, payFees: false });
289
+ const recipe = await balanceWhileDustGenerates(facade, () => facade.balanceUnprovenTransaction(transfer.transaction, secretKeys, {
290
+ ttl,
291
+ tokenKindsToBalance: ["dust"],
292
+ })).catch(async (error) => {
293
+ await facade.revert(transfer).catch((revertError) => {
294
+ console.error("Failed to release NIGHT transfer inputs:", revertError);
295
+ });
296
+ throw error;
297
+ });
195
298
  const signed = await facade.signRecipe(recipe, keys.unshieldedKeystore.signDataAsync);
196
299
  const finalized = await facade.finalizeRecipe(signed);
197
300
  return facade.submitTransaction(finalized);
198
301
  }
302
+ // How long a fresh NIGHT UTXO may take to generate its own registration fee.
303
+ const GENERATED_DUST_TIMEOUT_MS = 5 * 60 * 1000;
199
304
  /**
200
305
  * Register every NIGHT UTXO not yet registered for dust generation, so the
201
306
  * wallet can pay transaction fees (fees are paid in DUST, which only
202
307
  * generates on registered NIGHT). Registers ONLY unregistered UTXOs — the
203
308
  * node rejects a re-registration of an already-registered one — and submits
204
- * nothing when there is nothing new to register.
309
+ * nothing when there is nothing new to register. A first-time registration
310
+ * pays its own fee out of the dust its NIGHT UTXOs have generated since they
311
+ * landed, and a UTXO that landed moments ago has not yet generated it: the
312
+ * facade refuses naming the shortfall (see {@link dustShortfall}), and this
313
+ * waits for exactly that amount to generate before registering again.
205
314
  *
206
315
  * @param facade - A started wallet facade for `keys` (builds, proves and submits the registration).
207
316
  * @param keys - The key material of the same wallet; its unshielded keystore signs the registration.
208
317
  * @param state - The synced facade state to read the NIGHT UTXOs from.
209
318
  * @returns How many NIGHT UTXOs this call registered (0 = nothing unregistered, including no NIGHT at all).
210
- * @throws {Error} If the node rejects the registration transaction.
319
+ * @throws {Error} If the fee does not generate within {@link GENERATED_DUST_TIMEOUT_MS}, or
320
+ * the node rejects the registration transaction.
211
321
  */
212
322
  export async function registerNightForDustGeneration(facade, keys, state) {
213
323
  const unregistered = state.unshielded.availableCoins.filter((coin) => !coin.meta.registeredForDustGeneration);
@@ -216,37 +326,25 @@ export async function registerNightForDustGeneration(facade, keys, state) {
216
326
  // Register → finalize (prove) → submit. The registration segments are
217
327
  // signed inside registerNightUtxosForDustGeneration via the keystore
218
328
  // callback; no separate signRecipe step.
219
- const recipe = await facade.registerNightUtxosForDustGeneration(unregistered, keys.unshieldedKeystore.getPublicKey(), keys.unshieldedKeystore.signDataAsync);
329
+ const register = () => facade.registerNightUtxosForDustGeneration(unregistered, keys.unshieldedKeystore.getPublicKey(), keys.unshieldedKeystore.signDataAsync);
330
+ let recipe;
331
+ try {
332
+ recipe = await register();
333
+ }
334
+ catch (error) {
335
+ const shortfall = dustShortfall(error);
336
+ if (shortfall === undefined)
337
+ throw error;
338
+ console.log(`the NIGHT has generated ${formatDust(shortfall.have)} of the ${formatDust(shortfall.need)} DUST its registration costs, waiting...`);
339
+ await facade.waitForGeneratedDust(unregistered, shortfall.need, {
340
+ timeoutMs: GENERATED_DUST_TIMEOUT_MS,
341
+ });
342
+ recipe = await register();
343
+ }
220
344
  const finalized = await facade.finalizeRecipe(recipe);
221
345
  await facade.submitTransaction(finalized);
222
346
  return unregistered.length;
223
347
  }
224
- // Dust generates continuously once NIGHT is registered, but a fresh
225
- // registration takes a few blocks before a spendable balance appears.
226
- const DUST_POLL_INTERVAL_MS = 5_000;
227
- /**
228
- * Wait until the wallet's spendable DUST (fee) balance is positive, polling
229
- * the synced facade state. Pair with {@link registerNightForDustGeneration}:
230
- * a wallet whose NIGHT was just registered has no dust for a few blocks.
231
- *
232
- * @param facade - A started wallet facade.
233
- * @param timeoutMs - Give-up deadline in milliseconds.
234
- * @returns The first positive dust balance observed.
235
- * @throws {Error} If no dust appears within `timeoutMs`.
236
- */
237
- export async function waitForSpendableDust(facade, timeoutMs = 300_000) {
238
- const deadline = Date.now() + timeoutMs;
239
- for (;;) {
240
- const state = await facade.waitForSyncedState();
241
- const dust = state.dust.balance(new Date());
242
- if (dust > 0n)
243
- return dust;
244
- if (Date.now() >= deadline) {
245
- throw new Error(`no spendable DUST after ${String(timeoutMs)} ms — is the wallet's NIGHT registered for dust generation?`);
246
- }
247
- await new Promise((resolve) => setTimeout(resolve, DUST_POLL_INTERVAL_MS));
248
- }
249
- }
250
348
  /**
251
349
  * Run `fn` against a started-and-synced {@link WalletFacade}, then stop the
252
350
  * facade — even when `fn` throws. The one place the start / wait-for-sync /
@@ -263,13 +361,143 @@ export async function withSyncedWalletFacade(keys, config, fn, options = {}) {
263
361
  const facade = await initialiseWalletFacade(keys, config, options);
264
362
  await facade.start(keys.shieldedSecretKeys, keys.dustSecretKey);
265
363
  try {
266
- console.log(`syncing wallet (indexer: ${config.indexerUrl})...`);
267
- const state = await facade.waitForSyncedState();
268
- console.log("wallet synced");
364
+ const state = await waitForSyncedStateLogging(facade, "wallet", config);
269
365
  return await fn(facade, state);
270
366
  }
271
367
  finally {
272
368
  await facade.stop().catch(() => undefined);
273
369
  }
274
370
  }
371
+ // How often a sync in progress reports itself.
372
+ const SYNC_HEARTBEAT_MS = 10_000;
373
+ /**
374
+ * One sub-wallet's sync position as "applied/highest", the two indices every
375
+ * sub-wallet's progress record carries under its own field names.
376
+ *
377
+ * @param applied - The index the sub-wallet has applied up to.
378
+ * @param highest - The highest index the indexer reports.
379
+ * @returns The position, with a percentage once the highest index is known.
380
+ */
381
+ function syncPosition(applied, highest) {
382
+ if (highest <= 0n)
383
+ return `${String(applied)}/?`;
384
+ return `${String(applied)}/${String(highest)} (${String((applied * 100n) / highest)}%)`;
385
+ }
386
+ /**
387
+ * Wait for a started facade to report itself synced, logging a heartbeat
388
+ * every {@link SYNC_HEARTBEAT_MS} with the elapsed time and each sub-wallet's
389
+ * position, so a long first sync on a deployed network shows it is moving.
390
+ *
391
+ * @param facade - The started facade to wait on.
392
+ * @param label - The wallet's name in the log lines (its role, e.g. `root`).
393
+ * @param config - The stack the facade syncs against, named in the first line.
394
+ * @returns The synced state.
395
+ */
396
+ async function waitForSyncedStateLogging(facade, label, config) {
397
+ const started = Date.now();
398
+ const elapsed = () => `${String(Math.round((Date.now() - started) / 1000))}s`;
399
+ console.log(`syncing ${label} wallet (indexer: ${config.indexerUrl})...`);
400
+ let latest;
401
+ const subscription = facade.state().subscribe({
402
+ next: (state) => {
403
+ latest = state;
404
+ },
405
+ });
406
+ const heartbeat = setInterval(() => {
407
+ const position = latest === undefined
408
+ ? "no state yet"
409
+ : `shielded ${syncPosition(latest.shielded.progress.appliedIndex, latest.shielded.progress.highestIndex)}, ` +
410
+ `dust ${syncPosition(latest.dust.progress.appliedIndex, latest.dust.progress.highestIndex)}, ` +
411
+ `unshielded ${syncPosition(latest.unshielded.progress.appliedId, latest.unshielded.progress.highestTransactionId)}`;
412
+ console.log(` ${label} wallet still syncing after ${elapsed()}: ${position}`);
413
+ }, SYNC_HEARTBEAT_MS);
414
+ try {
415
+ const state = await facade.waitForSyncedState();
416
+ console.log(`${label} wallet synced in ${elapsed()}`);
417
+ return state;
418
+ }
419
+ finally {
420
+ clearInterval(heartbeat);
421
+ subscription.unsubscribe();
422
+ }
423
+ }
424
+ /**
425
+ * The dedup key a {@link WalletRegistry} files a seed under: its normalised
426
+ * hex, so two spellings of one seed (0x-prefixed, upper case, a mnemonic and
427
+ * its derived hex) share a facade.
428
+ *
429
+ * @param seed - The wallet seed, as hex or a BIP-39 mnemonic.
430
+ * @returns The seed's normalised hex.
431
+ * @throws {ParseError} If the seed parses as neither form.
432
+ */
433
+ export function walletRegistryKey(seed) {
434
+ return parseSeed(seed).source.seedHex;
435
+ }
436
+ /**
437
+ * One started, synced facade per wallet for the life of a pipeline: the
438
+ * first request for a seed builds, starts and fully syncs its facade (the
439
+ * expensive step on a deployed network, where a fresh facade scans the chain
440
+ * from nothing), every later request returns the same running facade, whose
441
+ * `waitForSyncedState()` only catches up incrementally. {@link close} stops
442
+ * every facade once, at the end.
443
+ */
444
+ export class WalletRegistry {
445
+ config;
446
+ options;
447
+ wallets = new Map();
448
+ /**
449
+ * @param config - The stack every facade in the registry connects to.
450
+ * @param options - Facade tuning passed to every facade built here.
451
+ */
452
+ constructor(config, options = {}) {
453
+ this.config = config;
454
+ this.options = options;
455
+ }
456
+ /**
457
+ * The started, synced wallet for `seed`, built on first request.
458
+ *
459
+ * @param seed - The wallet seed, as hex or a BIP-39 mnemonic.
460
+ * @param label - The wallet's role name, used in the sync log lines.
461
+ * @returns The registered wallet.
462
+ * @throws {Error} Whatever building, starting or syncing the facade throws. The
463
+ * failed entry is dropped, so a later request retries.
464
+ */
465
+ wallet(seed, label) {
466
+ const key = walletRegistryKey(seed);
467
+ const existing = this.wallets.get(key);
468
+ if (existing !== undefined)
469
+ return existing;
470
+ const opened = this.open(seed, label).catch((error) => {
471
+ this.wallets.delete(key);
472
+ throw error;
473
+ });
474
+ this.wallets.set(key, opened);
475
+ return opened;
476
+ }
477
+ async open(seed, label) {
478
+ const keys = deriveAccountKeys(seed, this.config.networkId);
479
+ const facade = await initialiseWalletFacade(keys, this.config, this.options);
480
+ await facade.start(keys.shieldedSecretKeys, keys.dustSecretKey);
481
+ try {
482
+ await waitForSyncedStateLogging(facade, label, this.config);
483
+ }
484
+ catch (error) {
485
+ await facade.stop().catch(() => undefined);
486
+ throw error;
487
+ }
488
+ return { label, keys, facade };
489
+ }
490
+ /**
491
+ * Stop every facade the registry opened. Safe to call more than once and
492
+ * with nothing opened.
493
+ */
494
+ async close() {
495
+ const opened = [...this.wallets.values()];
496
+ this.wallets.clear();
497
+ await Promise.all(opened.map(async (pending) => {
498
+ const wallet = await pending.catch(() => undefined);
499
+ await wallet?.facade.stop().catch(() => undefined);
500
+ }));
501
+ }
502
+ }
275
503
  //# sourceMappingURL=wallet.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../src/plumbing/wallet.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8EAA8E;AAC9E,2EAA2E;AAC3E,oEAAoE;AACpE,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAC3F,OAAO,EACL,WAAW,EACX,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,2BAA2B,EAC3B,iBAAiB,GAClB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAEL,kBAAkB,EAElB,iBAAiB,EACjB,YAAY,GACb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EACL,cAAc,EACd,SAAS,IAAI,mBAAmB,EAEhC,gBAAgB,GACjB,MAAM,6CAA6C,CAAC;AAIrD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AA4BtC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,eAAmB,CAAC;AAEnE,yEAAyE;AACzE,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAgB5B;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,SAAoB;IAClE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAE5C,MAAM,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACxC,IAAI,EAAE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CAAC,kBAAkB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAChE,IAAI,CAAC;YACH,MAAM,yBAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YAC3C,MAAM,KAAK,CAAC;QACd,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACjC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC3B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACpD,MAAM,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACrD,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sig-net/midnight-contract-deploy",
3
- "version": "0.21.0-rc.8",
3
+ "version": "0.21.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sig-net/midnight-integration",
@@ -36,10 +36,10 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "@effect/platform-node": "^0.108.1",
40
- "@midnight-ntwrk/compact-js": "2.5.5-rc.8",
41
- "@midnight-ntwrk/compact-js-node": "2.5.5-rc.8",
42
- "@midnight-ntwrk/midnight-js": "5.0.0-beta.7",
39
+ "@effect/platform-node": "^0.108.2",
40
+ "@midnight-ntwrk/compact-js": "2.5.5-rc.7",
41
+ "@midnight-ntwrk/compact-js-node": "2.5.5-rc.7",
42
+ "@midnight-ntwrk/midnight-js": "5.0.0-beta.6",
43
43
  "@midnight-ntwrk/platform-js": "^3.0.0",
44
44
  "@midnightntwrk/ledger-v9": "1.0.0-rc.3",
45
45
  "@midnightntwrk/wallet-sdk-abstractions": "3.0.0-beta.0",
@@ -50,16 +50,17 @@
50
50
  "@midnightntwrk/wallet-sdk-shielded": "4.0.0-beta.2",
51
51
  "@midnightntwrk/wallet-sdk-unshielded-wallet": "4.0.0-beta.2",
52
52
  "@scure/bip39": "^2.2.0",
53
- "@sig-net/midnight": "^0.21.0-rc.8",
54
- "@sig-net/midnight-contract": "^0.21.0-rc.8",
55
- "effect": "^3.22.1"
53
+ "@sig-net/midnight": "^0.21.0",
54
+ "@sig-net/midnight-contract": "^0.21.0",
55
+ "effect": "^3.22.2"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/node": "^26.1.0",
59
- "@vitest/coverage-v8": "^4.1.10",
59
+ "@vitest/coverage-v8": "^5.0.0",
60
60
  "tsx": "^4.23.0",
61
61
  "typescript": "^7.0.2",
62
- "vitest": "^4.1.9"
62
+ "vite": "^8.2.2",
63
+ "vitest": "^5.0.0"
63
64
  },
64
65
  "main": "./dist/index.js",
65
66
  "types": "./dist/index.d.ts"