@cogcoin/client 1.1.6 → 1.1.8

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 (125) hide show
  1. package/README.md +2 -2
  2. package/dist/bitcoind/indexer-daemon.js +29 -79
  3. package/dist/bitcoind/managed-runtime/bitcoind-runtime.d.ts +20 -0
  4. package/dist/bitcoind/managed-runtime/bitcoind-runtime.js +74 -0
  5. package/dist/bitcoind/managed-runtime/bitcoind-status.d.ts +11 -0
  6. package/dist/bitcoind/managed-runtime/bitcoind-status.js +44 -0
  7. package/dist/bitcoind/managed-runtime/indexer-runtime.d.ts +15 -0
  8. package/dist/bitcoind/managed-runtime/indexer-runtime.js +82 -0
  9. package/dist/bitcoind/managed-runtime/types.d.ts +40 -0
  10. package/dist/bitcoind/node.d.ts +2 -2
  11. package/dist/bitcoind/node.js +2 -2
  12. package/dist/bitcoind/rpc.d.ts +2 -1
  13. package/dist/bitcoind/rpc.js +53 -3
  14. package/dist/bitcoind/service.js +47 -127
  15. package/dist/cli/command-registry.d.ts +1 -1
  16. package/dist/cli/command-registry.js +2 -64
  17. package/dist/cli/commands/client-admin.js +3 -18
  18. package/dist/cli/commands/mining-runtime.js +4 -60
  19. package/dist/cli/commands/wallet-admin.js +6 -6
  20. package/dist/cli/context.js +1 -3
  21. package/dist/cli/mining-json.d.ts +1 -22
  22. package/dist/cli/mining-json.js +0 -23
  23. package/dist/cli/output.js +16 -2
  24. package/dist/cli/parse.js +0 -2
  25. package/dist/cli/preview-json.d.ts +1 -22
  26. package/dist/cli/preview-json.js +0 -19
  27. package/dist/cli/types.d.ts +1 -3
  28. package/dist/cli/wallet-format.js +1 -1
  29. package/dist/cli/workflow-hints.d.ts +1 -2
  30. package/dist/cli/workflow-hints.js +5 -8
  31. package/dist/wallet/lifecycle/context.js +0 -1
  32. package/dist/wallet/lifecycle/repair-mining.d.ts +1 -5
  33. package/dist/wallet/lifecycle/repair-mining.js +5 -39
  34. package/dist/wallet/lifecycle/repair.js +0 -3
  35. package/dist/wallet/lifecycle/setup.js +10 -8
  36. package/dist/wallet/lifecycle/types.d.ts +1 -4
  37. package/dist/wallet/managed-core-wallet.d.ts +2 -0
  38. package/dist/wallet/managed-core-wallet.js +27 -1
  39. package/dist/wallet/mining/candidate.d.ts +1 -0
  40. package/dist/wallet/mining/candidate.js +38 -6
  41. package/dist/wallet/mining/competitiveness.d.ts +1 -0
  42. package/dist/wallet/mining/competitiveness.js +6 -0
  43. package/dist/wallet/mining/cycle.d.ts +2 -0
  44. package/dist/wallet/mining/cycle.js +14 -4
  45. package/dist/wallet/mining/engine-state.js +10 -0
  46. package/dist/wallet/mining/engine-types.d.ts +1 -0
  47. package/dist/wallet/mining/index.d.ts +1 -1
  48. package/dist/wallet/mining/index.js +1 -1
  49. package/dist/wallet/mining/publish.d.ts +3 -0
  50. package/dist/wallet/mining/publish.js +78 -6
  51. package/dist/wallet/mining/runner.d.ts +0 -32
  52. package/dist/wallet/mining/runner.js +59 -104
  53. package/dist/wallet/mining/stop.d.ts +7 -0
  54. package/dist/wallet/mining/stop.js +23 -0
  55. package/dist/wallet/mining/supervisor.d.ts +2 -36
  56. package/dist/wallet/mining/supervisor.js +139 -246
  57. package/dist/wallet/mining/visualizer-sync.js +79 -15
  58. package/dist/wallet/read/context.d.ts +1 -5
  59. package/dist/wallet/read/context.js +21 -205
  60. package/dist/wallet/read/managed-services.d.ts +33 -0
  61. package/dist/wallet/read/managed-services.js +222 -0
  62. package/dist/wallet/reset/artifacts.d.ts +16 -0
  63. package/dist/wallet/reset/artifacts.js +141 -0
  64. package/dist/wallet/reset/execution.d.ts +38 -0
  65. package/dist/wallet/reset/execution.js +458 -0
  66. package/dist/wallet/reset/preflight.d.ts +7 -0
  67. package/dist/wallet/reset/preflight.js +116 -0
  68. package/dist/wallet/reset/preview.d.ts +2 -0
  69. package/dist/wallet/reset/preview.js +50 -0
  70. package/dist/wallet/reset/process-cleanup.d.ts +12 -0
  71. package/dist/wallet/reset/process-cleanup.js +179 -0
  72. package/dist/wallet/reset/types.d.ts +189 -0
  73. package/dist/wallet/reset/types.js +1 -0
  74. package/dist/wallet/reset.d.ts +4 -119
  75. package/dist/wallet/reset.js +4 -882
  76. package/dist/wallet/state/client-password/bootstrap.d.ts +2 -0
  77. package/dist/wallet/state/client-password/bootstrap.js +3 -0
  78. package/dist/wallet/state/client-password/context.d.ts +10 -0
  79. package/dist/wallet/state/client-password/context.js +46 -0
  80. package/dist/wallet/state/client-password/crypto.d.ts +34 -0
  81. package/dist/wallet/state/client-password/crypto.js +117 -0
  82. package/dist/wallet/state/client-password/files.d.ts +10 -0
  83. package/dist/wallet/state/client-password/files.js +109 -0
  84. package/dist/wallet/state/client-password/legacy-cleanup.d.ts +11 -0
  85. package/dist/wallet/state/client-password/legacy-cleanup.js +338 -0
  86. package/dist/wallet/state/client-password/messages.d.ts +3 -0
  87. package/dist/wallet/state/client-password/messages.js +9 -0
  88. package/dist/wallet/state/client-password/migration.d.ts +4 -0
  89. package/dist/wallet/state/client-password/migration.js +32 -0
  90. package/dist/wallet/state/client-password/prompts.d.ts +12 -0
  91. package/dist/wallet/state/client-password/prompts.js +79 -0
  92. package/dist/wallet/state/client-password/protected-secrets.d.ts +13 -0
  93. package/dist/wallet/state/client-password/protected-secrets.js +90 -0
  94. package/dist/wallet/state/client-password/readiness.d.ts +4 -0
  95. package/dist/wallet/state/client-password/readiness.js +48 -0
  96. package/dist/wallet/state/client-password/references.d.ts +1 -0
  97. package/dist/wallet/state/client-password/references.js +56 -0
  98. package/dist/wallet/state/client-password/rotation.d.ts +6 -0
  99. package/dist/wallet/state/client-password/rotation.js +98 -0
  100. package/dist/wallet/state/client-password/session-policy.d.ts +6 -0
  101. package/dist/wallet/state/client-password/session-policy.js +28 -0
  102. package/dist/wallet/state/client-password/session.d.ts +19 -0
  103. package/dist/wallet/state/client-password/session.js +170 -0
  104. package/dist/wallet/state/client-password/setup.d.ts +8 -0
  105. package/dist/wallet/state/client-password/setup.js +49 -0
  106. package/dist/wallet/state/client-password/types.d.ts +82 -0
  107. package/dist/wallet/state/client-password/types.js +5 -0
  108. package/dist/wallet/state/client-password.d.ts +7 -38
  109. package/dist/wallet/state/client-password.js +52 -937
  110. package/dist/wallet/tx/anchor.js +123 -216
  111. package/dist/wallet/tx/cog.js +294 -489
  112. package/dist/wallet/tx/common.d.ts +2 -0
  113. package/dist/wallet/tx/common.js +2 -0
  114. package/dist/wallet/tx/domain-admin.js +111 -220
  115. package/dist/wallet/tx/domain-market.js +401 -681
  116. package/dist/wallet/tx/executor.d.ts +176 -0
  117. package/dist/wallet/tx/executor.js +302 -0
  118. package/dist/wallet/tx/field.js +109 -215
  119. package/dist/wallet/tx/register.js +158 -269
  120. package/dist/wallet/tx/reputation.js +120 -227
  121. package/package.json +1 -1
  122. package/dist/wallet/mining/worker-main.d.ts +0 -1
  123. package/dist/wallet/mining/worker-main.js +0 -17
  124. package/dist/wallet/state/client-password-agent.d.ts +0 -1
  125. package/dist/wallet/state/client-password-agent.js +0 -211
@@ -3,13 +3,13 @@ import { encodeSentence } from "@cogcoin/scoring";
3
3
  import { lookupDomain } from "@cogcoin/indexer/queries";
4
4
  import { attachOrStartManagedBitcoindService } from "../../bitcoind/service.js";
5
5
  import { createRpcClient } from "../../bitcoind/node.js";
6
- import { acquireFileLock } from "../fs/lock.js";
7
- import { resolveWalletRuntimePathsForTesting } from "../runtime.js";
8
- import { createDefaultWalletSecretProvider, } from "../state/provider.js";
6
+ import {} from "../runtime.js";
7
+ import {} from "../state/provider.js";
9
8
  import { serializeDomainAnchor, validateDomainName, } from "../cogop/index.js";
10
9
  import { openWalletReadContext } from "../read/index.js";
11
- import { assertWalletMutationContextReady, buildWalletMutationTransactionWithReserveFallback, createBuiltWalletMutationFeeSummary, createWalletMutationFeeMetadata, isAlreadyAcceptedError, isBroadcastUnknownError, mergeFixedWalletInputs, outpointKey, pauseMiningForWalletMutation, resolvePendingMutationReuseDecision, resolveWalletMutationFeeSelection, saveWalletStatePreservingUnlock, unlockTemporaryBuilderLocks, updateMutationRecord, } from "./common.js";
12
- import { findPendingMutationByIntent, upsertPendingMutation } from "./journal.js";
10
+ import { assertWalletMutationContextReady, buildWalletMutationTransactionWithReserveFallback, createWalletMutationFeeMetadata, mergeFixedWalletInputs, outpointKey, saveWalletStatePreservingUnlock, unlockTemporaryBuilderLocks, updateMutationRecord, } from "./common.js";
11
+ import { executeWalletMutationOperation, persistWalletMutationState, publishWalletMutation, resolveExistingWalletMutation, } from "./executor.js";
12
+ import { upsertPendingMutation } from "./journal.js";
13
13
  function normalizeDomainName(domainName) {
14
14
  const normalized = domainName.trim().toLowerCase();
15
15
  if (normalized.length === 0) {
@@ -224,18 +224,7 @@ function anchorConfirmedOnSnapshot(options) {
224
224
  || (options.state.localScriptPubKeyHexes ?? []).includes(ownerHex);
225
225
  }
226
226
  async function saveState(options) {
227
- const nextState = {
228
- ...options.state,
229
- stateRevision: options.state.stateRevision + 1,
230
- lastWrittenAtUnixMs: options.nowUnixMs,
231
- };
232
- await saveWalletStatePreservingUnlock({
233
- state: nextState,
234
- provider: options.provider,
235
- nowUnixMs: options.nowUnixMs,
236
- paths: options.paths,
237
- });
238
- return nextState;
227
+ return persistWalletMutationState(options);
239
228
  }
240
229
  async function reconcilePendingAnchorMutation(options) {
241
230
  if (options.mutation.status === "repair-required") {
@@ -337,27 +326,12 @@ export async function anchorDomain(options) {
337
326
  if (!options.prompter.isInteractive) {
338
327
  throw new Error("wallet_anchor_requires_tty");
339
328
  }
340
- const provider = options.provider ?? createDefaultWalletSecretProvider();
341
- const nowUnixMs = options.nowUnixMs ?? Date.now();
342
- const paths = options.paths ?? resolveWalletRuntimePathsForTesting();
343
329
  const normalizedDomainName = normalizeDomainName(options.domainName);
344
- const controlLock = await acquireFileLock(paths.walletControlLockPath, {
345
- purpose: "wallet-anchor",
346
- walletRootId: null,
347
- });
348
- try {
349
- const miningPreemption = await pauseMiningForWalletMutation({
350
- paths,
351
- reason: "wallet-anchor",
352
- });
353
- const readContext = await (options.openReadContext ?? openWalletReadContext)({
354
- dataDir: options.dataDir,
355
- databasePath: options.databasePath,
356
- secretProvider: provider,
357
- walletControlLockHeld: true,
358
- paths,
359
- });
360
- try {
330
+ const execution = await executeWalletMutationOperation({
331
+ ...options,
332
+ controlLockPurpose: "wallet-anchor",
333
+ preemptionReason: "wallet-anchor",
334
+ async resolveOperation(readContext) {
361
335
  assertWalletMutationContextReady(readContext, "wallet_anchor");
362
336
  const message = await resolveFoundingMessage({
363
337
  foundingMessageText: options.foundingMessageText,
@@ -383,93 +357,82 @@ export async function anchorDomain(options) {
383
357
  if (state.funding.address.trim() === "") {
384
358
  throw new Error("wallet_anchor_owner_identity_not_supported");
385
359
  }
386
- const intentFingerprintHex = createIntentFingerprint([
387
- "anchor",
388
- state.walletRootId,
360
+ return {
361
+ state,
389
362
  normalizedDomainName,
390
- state.funding.scriptPubKeyHex,
391
- message.payloadHex ?? "",
363
+ chainDomain,
364
+ message,
365
+ };
366
+ },
367
+ createIntentFingerprint(operation) {
368
+ return createIntentFingerprint([
369
+ "anchor",
370
+ operation.state.walletRootId,
371
+ operation.normalizedDomainName,
372
+ operation.state.funding.scriptPubKeyHex,
373
+ operation.message.payloadHex ?? "",
392
374
  ]);
393
- const node = await (options.attachService ?? attachOrStartManagedBitcoindService)({
394
- dataDir: options.dataDir,
395
- chain: "main",
396
- startHeight: 0,
397
- walletRootId: state.walletRootId,
398
- });
399
- const rpc = (options.rpcFactory ?? createRpcClient)(node.rpc);
400
- const walletName = state.managedCoreWallet.walletName;
401
- const feeSelection = await resolveWalletMutationFeeSelection({
402
- rpc,
403
- feeRateSatVb: options.feeRateSatVb ?? null,
404
- });
405
- const existingMutation = findPendingMutationByIntent(state, intentFingerprintHex);
406
- let workingState = state;
407
- let replacementFixedInputs = null;
408
- if (existingMutation !== null) {
409
- const reconciled = await reconcilePendingAnchorMutation({
410
- state,
411
- mutation: existingMutation,
412
- provider,
413
- nowUnixMs,
414
- paths,
415
- rpc,
416
- walletName,
417
- context: readContext,
418
- foundingMessageText: message.text,
419
- });
420
- workingState = reconciled.state;
421
- if (reconciled.resolution === "confirmed" || reconciled.resolution === "live") {
422
- const reuse = await resolvePendingMutationReuseDecision({
423
- rpc,
424
- walletName,
425
- mutation: reconciled.mutation,
426
- nextFeeSelection: feeSelection,
427
- });
428
- if (reuse.reuseExisting) {
429
- return {
430
- domainName: normalizedDomainName,
431
- txid: reconciled.mutation.attemptedTxid ?? "unknown",
432
- status: reconciled.resolution,
433
- reusedExisting: true,
434
- foundingMessageText: message.text,
435
- fees: reuse.fees,
436
- };
437
- }
438
- replacementFixedInputs = reuse.replacementFixedInputs;
439
- }
440
- if (reconciled.resolution === "repair-required") {
441
- throw new Error("wallet_anchor_repair_required");
442
- }
375
+ },
376
+ async resolveExistingMutation({ operation, existingMutation, execution }) {
377
+ if (existingMutation === null) {
378
+ return { state: operation.state, replacementFixedInputs: null, result: null };
443
379
  }
444
- await confirmDirectAnchor(options.prompter, {
445
- domainName: normalizedDomainName,
446
- walletAddress: state.funding.address,
447
- foundingMessageText: message.text,
380
+ return resolveExistingWalletMutation({
381
+ existingMutation,
382
+ execution,
383
+ repairRequiredErrorCode: "wallet_anchor_repair_required",
384
+ reconcileExistingMutation: (mutation) => reconcilePendingAnchorMutation({
385
+ state: operation.state,
386
+ mutation,
387
+ provider: execution.provider,
388
+ nowUnixMs: execution.nowUnixMs,
389
+ paths: execution.paths,
390
+ rpc: execution.rpc,
391
+ walletName: execution.walletName,
392
+ context: execution.readContext,
393
+ foundingMessageText: operation.message.text,
394
+ }),
395
+ createReuseResult: ({ mutation, resolution, fees }) => ({
396
+ domainName: operation.normalizedDomainName,
397
+ txid: mutation.attemptedTxid ?? "unknown",
398
+ status: resolution,
399
+ reusedExisting: true,
400
+ foundingMessageText: operation.message.text,
401
+ fees,
402
+ }),
448
403
  });
449
- let nextState = upsertPendingMutation(workingState, createDraftAnchorMutation({
450
- state: workingState,
451
- domainName: normalizedDomainName,
452
- intentFingerprintHex,
453
- nowUnixMs,
454
- feeSelection,
455
- existing: existingMutation ?? null,
456
- }));
457
- nextState = await saveState({
458
- state: nextState,
459
- provider,
460
- nowUnixMs,
461
- paths,
404
+ },
405
+ confirm({ operation }) {
406
+ return confirmDirectAnchor(options.prompter, {
407
+ domainName: operation.normalizedDomainName,
408
+ walletAddress: operation.state.funding.address,
409
+ foundingMessageText: operation.message.text,
462
410
  });
411
+ },
412
+ createDraftMutation({ operation, existingMutation, execution, intentFingerprintHex }) {
413
+ return {
414
+ mutation: createDraftAnchorMutation({
415
+ state: operation.state,
416
+ domainName: operation.normalizedDomainName,
417
+ intentFingerprintHex,
418
+ nowUnixMs: execution.nowUnixMs,
419
+ feeSelection: execution.feeSelection,
420
+ existing: existingMutation ?? null,
421
+ }),
422
+ prepared: null,
423
+ };
424
+ },
425
+ async build({ operation, state, execution, replacementFixedInputs }) {
463
426
  const directAnchorPlan = buildDirectAnchorPlan({
464
- state: nextState,
465
- allUtxos: await rpc.listUnspent(walletName, 1),
466
- domainId: chainDomain.domainId,
467
- foundingMessagePayloadHex: message.payloadHex,
427
+ state,
428
+ allUtxos: await execution.rpc.listUnspent(execution.walletName, 1),
429
+ domainId: operation.chainDomain.domainId,
430
+ foundingMessagePayloadHex: operation.message.payloadHex,
468
431
  });
469
- const built = await buildWalletMutationTransactionWithReserveFallback({
470
- rpc,
471
- walletName,
472
- state: nextState,
432
+ return buildWalletMutationTransactionWithReserveFallback({
433
+ rpc: execution.rpc,
434
+ walletName: execution.walletName,
435
+ state,
473
436
  plan: {
474
437
  ...directAnchorPlan,
475
438
  fixedInputs: mergeFixedWalletInputs(directAnchorPlan.fixedInputs, replacementFixedInputs),
@@ -477,111 +440,55 @@ export async function anchorDomain(options) {
477
440
  validateFundedDraft: validateDirectAnchorDraft,
478
441
  finalizeErrorCode: "wallet_anchor_finalize_failed",
479
442
  mempoolRejectPrefix: "wallet_anchor_mempool_rejected",
480
- feeRate: feeSelection.feeRateSatVb,
443
+ feeRate: execution.feeSelection.feeRateSatVb,
481
444
  });
482
- const currentMutation = nextState.pendingMutations?.find((mutation) => mutation.intentFingerprintHex === intentFingerprintHex)
483
- ?? createDraftAnchorMutation({
484
- state: nextState,
485
- domainName: normalizedDomainName,
486
- intentFingerprintHex,
487
- nowUnixMs,
488
- feeSelection,
489
- });
490
- const broadcastingMutation = updateMutationRecord(currentMutation, "broadcasting", nowUnixMs, {
491
- attemptedTxid: built.txid,
492
- attemptedWtxid: built.wtxid,
493
- temporaryBuilderLockedOutpoints: built.temporaryBuilderLockedOutpoints,
494
- });
495
- nextState = await saveState({
496
- state: upsertPendingMutation(nextState, broadcastingMutation),
497
- provider,
498
- nowUnixMs,
499
- paths,
500
- });
501
- ensureSameTipHeight(readContext, (await rpc.getBlockchainInfo()).blocks, "wallet_anchor_tip_mismatch");
502
- let accepted = false;
503
- try {
504
- await rpc.sendRawTransaction(built.rawHex);
505
- accepted = true;
506
- }
507
- catch (error) {
508
- if (isAlreadyAcceptedError(error)) {
509
- accepted = true;
510
- }
511
- else if (isBroadcastUnknownError(error)) {
512
- const unknownMutation = updateMutationRecord(broadcastingMutation, "broadcast-unknown", nowUnixMs, {
513
- attemptedTxid: built.txid,
514
- attemptedWtxid: built.wtxid,
515
- temporaryBuilderLockedOutpoints: built.temporaryBuilderLockedOutpoints,
516
- });
517
- await saveState({
518
- state: upsertPendingMutation(nextState, unknownMutation),
519
- provider,
520
- nowUnixMs,
521
- paths,
522
- });
523
- throw new Error("wallet_anchor_broadcast_unknown");
524
- }
525
- else {
526
- await unlockTemporaryBuilderLocks(rpc, walletName, built.temporaryBuilderLockedOutpoints);
527
- const canceledMutation = updateMutationRecord(broadcastingMutation, "canceled", nowUnixMs, {
445
+ },
446
+ publish({ operation, state, execution, built, mutation }) {
447
+ return publishWalletMutation({
448
+ rpc: execution.rpc,
449
+ walletName: execution.walletName,
450
+ snapshotHeight: execution.readContext.snapshot?.tip?.height ?? null,
451
+ built,
452
+ mutation,
453
+ state,
454
+ provider: execution.provider,
455
+ nowUnixMs: execution.nowUnixMs,
456
+ paths: execution.paths,
457
+ errorPrefix: "wallet_anchor",
458
+ async afterAccepted({ state: acceptedState, broadcastingMutation, built, nowUnixMs }) {
459
+ const finalStatus = anchorConfirmedOnSnapshot({
460
+ snapshot: execution.readContext.snapshot,
461
+ state: acceptedState,
462
+ domainName: operation.normalizedDomainName,
463
+ }) ? "confirmed" : "live";
464
+ const finalMutation = updateMutationRecord(broadcastingMutation, finalStatus, nowUnixMs, {
528
465
  attemptedTxid: built.txid,
529
466
  attemptedWtxid: built.wtxid,
530
467
  temporaryBuilderLockedOutpoints: [],
531
468
  });
532
- await saveState({
533
- state: upsertPendingMutation(nextState, canceledMutation),
534
- provider,
535
- nowUnixMs,
536
- paths,
537
- });
538
- throw error;
539
- }
540
- }
541
- if (!accepted) {
542
- throw new Error("wallet_anchor_broadcast_failed");
543
- }
544
- await unlockTemporaryBuilderLocks(rpc, walletName, built.temporaryBuilderLockedOutpoints);
545
- const finalStatus = anchorConfirmedOnSnapshot({
546
- snapshot: readContext.snapshot,
547
- state: nextState,
548
- domainName: normalizedDomainName,
549
- }) ? "confirmed" : "live";
550
- const finalMutation = updateMutationRecord(broadcastingMutation, finalStatus, nowUnixMs, {
551
- attemptedTxid: built.txid,
552
- attemptedWtxid: built.wtxid,
553
- temporaryBuilderLockedOutpoints: [],
554
- });
555
- nextState = upsertAnchoredDomainRecord({
556
- state: upsertPendingMutation(nextState, finalMutation),
557
- domainName: normalizedDomainName,
558
- domainId: chainDomain.domainId,
559
- foundingMessageText: message.text,
560
- });
561
- nextState = await saveState({
562
- state: nextState,
563
- provider,
564
- nowUnixMs,
565
- paths,
469
+ return {
470
+ state: upsertAnchoredDomainRecord({
471
+ state: upsertPendingMutation(acceptedState, finalMutation),
472
+ domainName: operation.normalizedDomainName,
473
+ domainId: operation.chainDomain.domainId,
474
+ foundingMessageText: operation.message.text,
475
+ }),
476
+ mutation: finalMutation,
477
+ status: finalStatus,
478
+ };
479
+ },
566
480
  });
481
+ },
482
+ createResult({ operation, mutation, built, status, reusedExisting, fees }) {
567
483
  return {
568
- domainName: normalizedDomainName,
569
- txid: built.txid,
570
- status: finalStatus,
571
- reusedExisting: false,
572
- foundingMessageText: message.text,
573
- fees: createBuiltWalletMutationFeeSummary({
574
- selection: feeSelection,
575
- built,
576
- }),
484
+ domainName: operation.normalizedDomainName,
485
+ txid: mutation.attemptedTxid ?? built?.txid ?? "unknown",
486
+ status: status,
487
+ reusedExisting,
488
+ foundingMessageText: operation.message.text,
489
+ fees,
577
490
  };
578
- }
579
- finally {
580
- await readContext.close();
581
- await miningPreemption.release();
582
- }
583
- }
584
- finally {
585
- await controlLock.release();
586
- }
491
+ },
492
+ });
493
+ return execution.result;
587
494
  }