@cogcoin/client 1.1.6 → 1.1.7
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.
- package/README.md +2 -2
- package/dist/bitcoind/indexer-daemon.js +29 -79
- package/dist/bitcoind/managed-runtime/bitcoind-runtime.d.ts +20 -0
- package/dist/bitcoind/managed-runtime/bitcoind-runtime.js +74 -0
- package/dist/bitcoind/managed-runtime/bitcoind-status.d.ts +11 -0
- package/dist/bitcoind/managed-runtime/bitcoind-status.js +44 -0
- package/dist/bitcoind/managed-runtime/indexer-runtime.d.ts +15 -0
- package/dist/bitcoind/managed-runtime/indexer-runtime.js +82 -0
- package/dist/bitcoind/managed-runtime/types.d.ts +40 -0
- package/dist/bitcoind/node.d.ts +2 -2
- package/dist/bitcoind/node.js +2 -2
- package/dist/bitcoind/rpc.d.ts +2 -1
- package/dist/bitcoind/rpc.js +53 -3
- package/dist/bitcoind/service.js +46 -126
- package/dist/cli/command-registry.d.ts +1 -1
- package/dist/cli/command-registry.js +2 -64
- package/dist/cli/commands/client-admin.js +3 -18
- package/dist/cli/commands/mining-runtime.js +4 -60
- package/dist/cli/commands/wallet-admin.js +6 -6
- package/dist/cli/context.js +1 -3
- package/dist/cli/mining-json.d.ts +1 -22
- package/dist/cli/mining-json.js +0 -23
- package/dist/cli/output.js +16 -2
- package/dist/cli/parse.js +0 -2
- package/dist/cli/preview-json.d.ts +1 -22
- package/dist/cli/preview-json.js +0 -19
- package/dist/cli/types.d.ts +1 -3
- package/dist/cli/wallet-format.js +1 -1
- package/dist/cli/workflow-hints.d.ts +1 -2
- package/dist/cli/workflow-hints.js +5 -8
- package/dist/wallet/lifecycle/context.js +0 -1
- package/dist/wallet/lifecycle/repair-mining.d.ts +1 -5
- package/dist/wallet/lifecycle/repair-mining.js +5 -39
- package/dist/wallet/lifecycle/repair.js +0 -3
- package/dist/wallet/lifecycle/setup.js +10 -8
- package/dist/wallet/lifecycle/types.d.ts +1 -4
- package/dist/wallet/managed-core-wallet.d.ts +2 -0
- package/dist/wallet/managed-core-wallet.js +27 -1
- package/dist/wallet/mining/candidate.d.ts +1 -0
- package/dist/wallet/mining/candidate.js +38 -6
- package/dist/wallet/mining/competitiveness.d.ts +1 -0
- package/dist/wallet/mining/competitiveness.js +6 -0
- package/dist/wallet/mining/cycle.d.ts +2 -0
- package/dist/wallet/mining/cycle.js +14 -4
- package/dist/wallet/mining/engine-types.d.ts +1 -0
- package/dist/wallet/mining/index.d.ts +1 -1
- package/dist/wallet/mining/index.js +1 -1
- package/dist/wallet/mining/publish.d.ts +3 -0
- package/dist/wallet/mining/publish.js +78 -6
- package/dist/wallet/mining/runner.d.ts +0 -32
- package/dist/wallet/mining/runner.js +59 -104
- package/dist/wallet/mining/stop.d.ts +7 -0
- package/dist/wallet/mining/stop.js +23 -0
- package/dist/wallet/mining/supervisor.d.ts +2 -36
- package/dist/wallet/mining/supervisor.js +139 -246
- package/dist/wallet/read/context.d.ts +1 -5
- package/dist/wallet/read/context.js +20 -204
- package/dist/wallet/read/managed-services.d.ts +33 -0
- package/dist/wallet/read/managed-services.js +222 -0
- package/dist/wallet/state/client-password/bootstrap.d.ts +2 -0
- package/dist/wallet/state/client-password/bootstrap.js +3 -0
- package/dist/wallet/state/client-password/context.d.ts +10 -0
- package/dist/wallet/state/client-password/context.js +46 -0
- package/dist/wallet/state/client-password/crypto.d.ts +34 -0
- package/dist/wallet/state/client-password/crypto.js +117 -0
- package/dist/wallet/state/client-password/files.d.ts +10 -0
- package/dist/wallet/state/client-password/files.js +109 -0
- package/dist/wallet/state/client-password/legacy-cleanup.d.ts +11 -0
- package/dist/wallet/state/client-password/legacy-cleanup.js +338 -0
- package/dist/wallet/state/client-password/messages.d.ts +3 -0
- package/dist/wallet/state/client-password/messages.js +9 -0
- package/dist/wallet/state/client-password/migration.d.ts +4 -0
- package/dist/wallet/state/client-password/migration.js +32 -0
- package/dist/wallet/state/client-password/prompts.d.ts +12 -0
- package/dist/wallet/state/client-password/prompts.js +79 -0
- package/dist/wallet/state/client-password/protected-secrets.d.ts +13 -0
- package/dist/wallet/state/client-password/protected-secrets.js +90 -0
- package/dist/wallet/state/client-password/readiness.d.ts +4 -0
- package/dist/wallet/state/client-password/readiness.js +48 -0
- package/dist/wallet/state/client-password/references.d.ts +1 -0
- package/dist/wallet/state/client-password/references.js +56 -0
- package/dist/wallet/state/client-password/rotation.d.ts +6 -0
- package/dist/wallet/state/client-password/rotation.js +98 -0
- package/dist/wallet/state/client-password/session-policy.d.ts +6 -0
- package/dist/wallet/state/client-password/session-policy.js +28 -0
- package/dist/wallet/state/client-password/session.d.ts +19 -0
- package/dist/wallet/state/client-password/session.js +170 -0
- package/dist/wallet/state/client-password/setup.d.ts +8 -0
- package/dist/wallet/state/client-password/setup.js +49 -0
- package/dist/wallet/state/client-password/types.d.ts +82 -0
- package/dist/wallet/state/client-password/types.js +5 -0
- package/dist/wallet/state/client-password.d.ts +7 -38
- package/dist/wallet/state/client-password.js +52 -937
- package/dist/wallet/tx/anchor.js +123 -216
- package/dist/wallet/tx/cog.js +294 -489
- package/dist/wallet/tx/common.d.ts +2 -0
- package/dist/wallet/tx/common.js +2 -0
- package/dist/wallet/tx/domain-admin.js +111 -220
- package/dist/wallet/tx/domain-market.js +401 -681
- package/dist/wallet/tx/executor.d.ts +176 -0
- package/dist/wallet/tx/executor.js +302 -0
- package/dist/wallet/tx/field.js +109 -215
- package/dist/wallet/tx/register.js +158 -269
- package/dist/wallet/tx/reputation.js +120 -227
- package/package.json +1 -1
- package/dist/wallet/mining/worker-main.d.ts +0 -1
- package/dist/wallet/mining/worker-main.js +0 -17
- package/dist/wallet/state/client-password-agent.d.ts +0 -1
- package/dist/wallet/state/client-password-agent.js +0 -211
package/dist/wallet/tx/anchor.js
CHANGED
|
@@ -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 {
|
|
7
|
-
import {
|
|
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,
|
|
12
|
-
import {
|
|
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
|
-
|
|
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
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
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
|
-
|
|
387
|
-
|
|
388
|
-
state.walletRootId,
|
|
360
|
+
return {
|
|
361
|
+
state,
|
|
389
362
|
normalizedDomainName,
|
|
390
|
-
|
|
391
|
-
message
|
|
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
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
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
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
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
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
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
|
|
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
|
-
|
|
470
|
-
rpc,
|
|
471
|
-
walletName,
|
|
472
|
-
state
|
|
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
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
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
|
-
|
|
533
|
-
state:
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
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
|
|
570
|
-
status:
|
|
571
|
-
reusedExisting
|
|
572
|
-
foundingMessageText: message.text,
|
|
573
|
-
fees
|
|
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
|
-
|
|
580
|
-
|
|
581
|
-
await miningPreemption.release();
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
finally {
|
|
585
|
-
await controlLock.release();
|
|
586
|
-
}
|
|
491
|
+
},
|
|
492
|
+
});
|
|
493
|
+
return execution.result;
|
|
587
494
|
}
|