@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
|
@@ -167,6 +167,8 @@ export declare function buildWalletMutationTransaction<TPlan>(options: {
|
|
|
167
167
|
feeRate?: number;
|
|
168
168
|
availableFundingMinConf?: number;
|
|
169
169
|
temporarilyUnlockedPolicyOutpoints?: readonly OutpointRecord[];
|
|
170
|
+
recoverManagedCoreWalletLockedOnce?: boolean;
|
|
171
|
+
onManagedCoreWalletLockedRecoveryOutcome?: (outcome: "recovered" | "still-locked") => void;
|
|
170
172
|
}): Promise<BuiltWalletMutationTransaction>;
|
|
171
173
|
export declare function fundAndValidateWalletMutationDraft<TPlan>(options: {
|
|
172
174
|
rpc: WalletMutationRpcClient;
|
package/dist/wallet/tx/common.js
CHANGED
|
@@ -435,6 +435,8 @@ export async function buildWalletMutationTransaction(options) {
|
|
|
435
435
|
walletName: options.walletName,
|
|
436
436
|
internalPassphrase: options.state.managedCoreWallet.internalPassphrase,
|
|
437
437
|
timeoutSeconds: MANAGED_CORE_WALLET_UNLOCK_TIMEOUT_SECONDS,
|
|
438
|
+
recoverLockedWalletOnce: options.recoverManagedCoreWalletLockedOnce,
|
|
439
|
+
onLockedWalletRecoveryOutcome: options.onManagedCoreWalletLockedRecoveryOutcome,
|
|
438
440
|
run: async () => {
|
|
439
441
|
const signed = await options.rpc.walletProcessPsbt(options.walletName, funded.psbt, true, "DEFAULT");
|
|
440
442
|
const finalized = await options.rpc.finalizePsbt(signed.psbt, true);
|
|
@@ -4,15 +4,15 @@ import { resolve as resolvePath } from "node:path";
|
|
|
4
4
|
import { lookupDomain, resolveCanonical } from "@cogcoin/indexer/queries";
|
|
5
5
|
import { attachOrStartManagedBitcoindService } from "../../bitcoind/service.js";
|
|
6
6
|
import { createRpcClient } from "../../bitcoind/node.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { createDefaultWalletSecretProvider, } from "../state/provider.js";
|
|
7
|
+
import {} from "../runtime.js";
|
|
8
|
+
import {} from "../state/provider.js";
|
|
10
9
|
import { serializeSetCanonical, serializeSetDelegate, serializeSetEndpoint, serializeSetMiner, validateDomainName, } from "../cogop/index.js";
|
|
11
10
|
import { openWalletReadContext } from "../read/index.js";
|
|
12
|
-
import { assertFixedInputPrefixMatches, assertFundingInputsAfterFixedPrefix, assertWalletMutationContextReady, buildWalletMutationTransactionWithReserveFallback,
|
|
11
|
+
import { assertFixedInputPrefixMatches, assertFundingInputsAfterFixedPrefix, assertWalletMutationContextReady, buildWalletMutationTransactionWithReserveFallback, createFundingMutationSender, createWalletMutationFeeMetadata, getDecodedInputScriptPubKeyHex, isLocalWalletScript, mergeFixedWalletInputs, outpointKey, unlockTemporaryBuilderLocks, updateMutationRecord, } from "./common.js";
|
|
13
12
|
import { confirmYesNo } from "./confirm.js";
|
|
13
|
+
import { executeWalletMutationOperation, persistWalletMutationState, publishWalletMutation, resolveExistingWalletMutation, } from "./executor.js";
|
|
14
14
|
import { getCanonicalIdentitySelector } from "./identity-selector.js";
|
|
15
|
-
import {
|
|
15
|
+
import { upsertPendingMutation } from "./journal.js";
|
|
16
16
|
import { normalizeBtcTarget } from "./targets.js";
|
|
17
17
|
function normalizeDomainName(domainName) {
|
|
18
18
|
const normalized = domainName.trim().toLowerCase();
|
|
@@ -184,18 +184,7 @@ function createDraftMutation(options) {
|
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
186
|
async function saveUpdatedMutationState(options) {
|
|
187
|
-
|
|
188
|
-
...options.state,
|
|
189
|
-
stateRevision: options.state.stateRevision + 1,
|
|
190
|
-
lastWrittenAtUnixMs: options.nowUnixMs,
|
|
191
|
-
};
|
|
192
|
-
await saveWalletStatePreservingUnlock({
|
|
193
|
-
state: nextState,
|
|
194
|
-
provider: options.provider,
|
|
195
|
-
nowUnixMs: options.nowUnixMs,
|
|
196
|
-
paths: options.paths,
|
|
197
|
-
});
|
|
198
|
-
return nextState;
|
|
187
|
+
return persistWalletMutationState(options);
|
|
199
188
|
}
|
|
200
189
|
function mutationConfirmedOnChain(mutation, context) {
|
|
201
190
|
if (context.snapshot === null) {
|
|
@@ -415,236 +404,138 @@ async function loadEndpointPayload(source) {
|
|
|
415
404
|
}
|
|
416
405
|
return payload;
|
|
417
406
|
}
|
|
418
|
-
async function sendBuiltTransaction(options) {
|
|
419
|
-
let nextState = options.state;
|
|
420
|
-
const broadcasting = updateMutationRecord(options.mutation, "broadcasting", options.nowUnixMs, {
|
|
421
|
-
attemptedTxid: options.built.txid,
|
|
422
|
-
attemptedWtxid: options.built.wtxid,
|
|
423
|
-
temporaryBuilderLockedOutpoints: options.built.temporaryBuilderLockedOutpoints,
|
|
424
|
-
});
|
|
425
|
-
nextState = upsertPendingMutation(nextState, broadcasting);
|
|
426
|
-
nextState = await saveUpdatedMutationState({
|
|
427
|
-
state: nextState,
|
|
428
|
-
provider: options.provider,
|
|
429
|
-
nowUnixMs: options.nowUnixMs,
|
|
430
|
-
paths: options.paths,
|
|
431
|
-
});
|
|
432
|
-
if (options.snapshotHeight !== null && options.snapshotHeight !== (await options.rpc.getBlockchainInfo()).blocks) {
|
|
433
|
-
await unlockTemporaryBuilderLocks(options.rpc, options.walletName, options.built.temporaryBuilderLockedOutpoints);
|
|
434
|
-
throw new Error(`${options.errorPrefix}_tip_mismatch`);
|
|
435
|
-
}
|
|
436
|
-
try {
|
|
437
|
-
await options.rpc.sendRawTransaction(options.built.rawHex);
|
|
438
|
-
}
|
|
439
|
-
catch (error) {
|
|
440
|
-
if (!isAlreadyAcceptedError(error)) {
|
|
441
|
-
if (isBroadcastUnknownError(error)) {
|
|
442
|
-
const unknown = updateMutationRecord(broadcasting, "broadcast-unknown", options.nowUnixMs, {
|
|
443
|
-
attemptedTxid: options.built.txid,
|
|
444
|
-
attemptedWtxid: options.built.wtxid,
|
|
445
|
-
temporaryBuilderLockedOutpoints: options.built.temporaryBuilderLockedOutpoints,
|
|
446
|
-
});
|
|
447
|
-
nextState = upsertPendingMutation(nextState, unknown);
|
|
448
|
-
nextState = await saveUpdatedMutationState({
|
|
449
|
-
state: nextState,
|
|
450
|
-
provider: options.provider,
|
|
451
|
-
nowUnixMs: options.nowUnixMs,
|
|
452
|
-
paths: options.paths,
|
|
453
|
-
});
|
|
454
|
-
throw new Error(`${options.errorPrefix}_broadcast_unknown`);
|
|
455
|
-
}
|
|
456
|
-
await unlockTemporaryBuilderLocks(options.rpc, options.walletName, options.built.temporaryBuilderLockedOutpoints);
|
|
457
|
-
const canceled = updateMutationRecord(broadcasting, "canceled", options.nowUnixMs, {
|
|
458
|
-
attemptedTxid: options.built.txid,
|
|
459
|
-
attemptedWtxid: options.built.wtxid,
|
|
460
|
-
temporaryBuilderLockedOutpoints: [],
|
|
461
|
-
});
|
|
462
|
-
nextState = upsertPendingMutation(nextState, canceled);
|
|
463
|
-
nextState = await saveUpdatedMutationState({
|
|
464
|
-
state: nextState,
|
|
465
|
-
provider: options.provider,
|
|
466
|
-
nowUnixMs: options.nowUnixMs,
|
|
467
|
-
paths: options.paths,
|
|
468
|
-
});
|
|
469
|
-
throw error;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
await unlockTemporaryBuilderLocks(options.rpc, options.walletName, options.built.temporaryBuilderLockedOutpoints);
|
|
473
|
-
const live = updateMutationRecord(broadcasting, "live", options.nowUnixMs, {
|
|
474
|
-
attemptedTxid: options.built.txid,
|
|
475
|
-
attemptedWtxid: options.built.wtxid,
|
|
476
|
-
temporaryBuilderLockedOutpoints: [],
|
|
477
|
-
});
|
|
478
|
-
nextState = upsertPendingMutation(nextState, live);
|
|
479
|
-
nextState = await saveUpdatedMutationState({
|
|
480
|
-
state: nextState,
|
|
481
|
-
provider: options.provider,
|
|
482
|
-
nowUnixMs: options.nowUnixMs,
|
|
483
|
-
paths: options.paths,
|
|
484
|
-
});
|
|
485
|
-
return { state: nextState, mutation: live };
|
|
486
|
-
}
|
|
487
407
|
async function submitDomainAdminMutation(options) {
|
|
488
|
-
const
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
walletRootId: null,
|
|
494
|
-
});
|
|
495
|
-
try {
|
|
496
|
-
const miningPreemption = await pauseMiningForWalletMutation({
|
|
497
|
-
paths,
|
|
498
|
-
reason: options.errorPrefix,
|
|
499
|
-
});
|
|
500
|
-
const readContext = await (options.openReadContext ?? openWalletReadContext)({
|
|
501
|
-
dataDir: options.dataDir,
|
|
502
|
-
databasePath: options.databasePath,
|
|
503
|
-
secretProvider: provider,
|
|
504
|
-
walletControlLockHeld: true,
|
|
505
|
-
paths,
|
|
506
|
-
});
|
|
507
|
-
try {
|
|
408
|
+
const execution = await executeWalletMutationOperation({
|
|
409
|
+
...options,
|
|
410
|
+
controlLockPurpose: options.errorPrefix,
|
|
411
|
+
preemptionReason: options.errorPrefix,
|
|
412
|
+
async resolveOperation(readContext) {
|
|
508
413
|
const normalizedDomainName = normalizeDomainName(options.domainName);
|
|
509
414
|
const operation = resolveAnchoredDomainOperation(readContext, normalizedDomainName, options.errorPrefix, { requireRoot: options.requireRoot });
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
415
|
+
return {
|
|
416
|
+
...operation,
|
|
417
|
+
normalizedDomainName,
|
|
418
|
+
resolvedSender: createResolvedDomainAdminSenderSummary(operation.sender, operation.senderSelector),
|
|
419
|
+
payload: await options.createPayload(operation),
|
|
420
|
+
};
|
|
421
|
+
},
|
|
422
|
+
createIntentFingerprint(operation) {
|
|
423
|
+
return createIntentFingerprint([
|
|
513
424
|
options.kind,
|
|
514
425
|
operation.state.walletRootId,
|
|
515
426
|
...options.intentParts(operation),
|
|
516
427
|
]);
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
walletRootId: operation.state.walletRootId,
|
|
522
|
-
});
|
|
523
|
-
const rpc = (options.rpcFactory ?? createRpcClient)(node.rpc);
|
|
524
|
-
const walletName = operation.state.managedCoreWallet.walletName;
|
|
525
|
-
const feeSelection = await resolveWalletMutationFeeSelection({
|
|
526
|
-
rpc,
|
|
527
|
-
feeRateSatVb: options.feeRateSatVb ?? null,
|
|
528
|
-
});
|
|
529
|
-
const existingMutation = findPendingMutationByIntent(operation.state, intentFingerprintHex);
|
|
530
|
-
let workingState = operation.state;
|
|
531
|
-
let replacementFixedInputs = null;
|
|
532
|
-
if (existingMutation !== null) {
|
|
533
|
-
const reconciled = await reconcilePendingAdminMutation({
|
|
428
|
+
},
|
|
429
|
+
async resolveExistingMutation({ operation, existingMutation, execution }) {
|
|
430
|
+
if (existingMutation === null) {
|
|
431
|
+
return {
|
|
534
432
|
state: operation.state,
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
paths,
|
|
539
|
-
rpc,
|
|
540
|
-
walletName,
|
|
541
|
-
context: readContext,
|
|
542
|
-
});
|
|
543
|
-
workingState = reconciled.state;
|
|
544
|
-
if (reconciled.resolution === "confirmed" || reconciled.resolution === "live") {
|
|
545
|
-
const reuse = await resolvePendingMutationReuseDecision({
|
|
546
|
-
rpc,
|
|
547
|
-
walletName,
|
|
548
|
-
mutation: reconciled.mutation,
|
|
549
|
-
nextFeeSelection: feeSelection,
|
|
550
|
-
});
|
|
551
|
-
if (reuse.reuseExisting) {
|
|
552
|
-
return {
|
|
553
|
-
kind: options.kind,
|
|
554
|
-
domainName: normalizedDomainName,
|
|
555
|
-
txid: reconciled.mutation.attemptedTxid ?? "unknown",
|
|
556
|
-
status: reconciled.resolution,
|
|
557
|
-
reusedExisting: true,
|
|
558
|
-
recipientScriptPubKeyHex: payload.recipientScriptPubKeyHex ?? null,
|
|
559
|
-
endpointValueHex: payload.endpointValueHex ?? null,
|
|
560
|
-
resolved: {
|
|
561
|
-
sender: resolvedSender,
|
|
562
|
-
target: payload.resolvedTarget,
|
|
563
|
-
effect: payload.resolvedEffect,
|
|
564
|
-
},
|
|
565
|
-
fees: reuse.fees,
|
|
566
|
-
};
|
|
567
|
-
}
|
|
568
|
-
replacementFixedInputs = reuse.replacementFixedInputs;
|
|
569
|
-
}
|
|
570
|
-
if (reconciled.resolution === "repair-required") {
|
|
571
|
-
throw new Error(`${options.errorPrefix}_repair_required`);
|
|
572
|
-
}
|
|
433
|
+
replacementFixedInputs: null,
|
|
434
|
+
result: null,
|
|
435
|
+
};
|
|
573
436
|
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
437
|
+
return resolveExistingWalletMutation({
|
|
438
|
+
existingMutation,
|
|
439
|
+
execution,
|
|
440
|
+
repairRequiredErrorCode: `${options.errorPrefix}_repair_required`,
|
|
441
|
+
reconcileExistingMutation: (mutation) => reconcilePendingAdminMutation({
|
|
442
|
+
state: operation.state,
|
|
443
|
+
mutation,
|
|
444
|
+
provider: execution.provider,
|
|
445
|
+
nowUnixMs: execution.nowUnixMs,
|
|
446
|
+
paths: execution.paths,
|
|
447
|
+
rpc: execution.rpc,
|
|
448
|
+
walletName: execution.walletName,
|
|
449
|
+
context: execution.readContext,
|
|
450
|
+
}),
|
|
451
|
+
createReuseResult: ({ mutation, resolution, fees }) => ({
|
|
452
|
+
kind: options.kind,
|
|
453
|
+
domainName: operation.normalizedDomainName,
|
|
454
|
+
txid: mutation.attemptedTxid ?? "unknown",
|
|
455
|
+
status: resolution,
|
|
456
|
+
reusedExisting: true,
|
|
457
|
+
recipientScriptPubKeyHex: operation.payload.recipientScriptPubKeyHex ?? null,
|
|
458
|
+
endpointValueHex: operation.payload.endpointValueHex ?? null,
|
|
459
|
+
resolved: {
|
|
460
|
+
sender: operation.resolvedSender,
|
|
461
|
+
target: operation.payload.resolvedTarget,
|
|
462
|
+
effect: operation.payload.resolvedEffect,
|
|
463
|
+
},
|
|
464
|
+
fees,
|
|
465
|
+
}),
|
|
591
466
|
});
|
|
467
|
+
},
|
|
468
|
+
confirm({ operation }) {
|
|
469
|
+
return options.confirm(operation);
|
|
470
|
+
},
|
|
471
|
+
createDraftMutation({ operation, existingMutation, execution, intentFingerprintHex }) {
|
|
472
|
+
return {
|
|
473
|
+
mutation: createDraftMutation({
|
|
474
|
+
kind: options.kind,
|
|
475
|
+
domainName: operation.normalizedDomainName,
|
|
476
|
+
sender: operation.sender,
|
|
477
|
+
intentFingerprintHex,
|
|
478
|
+
nowUnixMs: execution.nowUnixMs,
|
|
479
|
+
feeSelection: execution.feeSelection,
|
|
480
|
+
recipientScriptPubKeyHex: operation.payload.recipientScriptPubKeyHex ?? null,
|
|
481
|
+
endpointValueHex: operation.payload.endpointValueHex ?? null,
|
|
482
|
+
existing: existingMutation,
|
|
483
|
+
}),
|
|
484
|
+
prepared: null,
|
|
485
|
+
};
|
|
486
|
+
},
|
|
487
|
+
async build({ operation, state, execution, replacementFixedInputs }) {
|
|
592
488
|
const adminPlan = buildPlanForDomainAdminOperation({
|
|
593
|
-
state
|
|
594
|
-
allUtxos: await rpc.listUnspent(walletName, 1),
|
|
489
|
+
state,
|
|
490
|
+
allUtxos: await execution.rpc.listUnspent(execution.walletName, 1),
|
|
595
491
|
sender: operation.sender,
|
|
596
|
-
opReturnData: payload.opReturnData,
|
|
492
|
+
opReturnData: operation.payload.opReturnData,
|
|
597
493
|
errorPrefix: options.errorPrefix,
|
|
598
494
|
});
|
|
599
|
-
|
|
600
|
-
rpc,
|
|
601
|
-
walletName,
|
|
602
|
-
state
|
|
495
|
+
return buildTransaction({
|
|
496
|
+
rpc: execution.rpc,
|
|
497
|
+
walletName: execution.walletName,
|
|
498
|
+
state,
|
|
603
499
|
plan: {
|
|
604
500
|
...adminPlan,
|
|
605
501
|
fixedInputs: mergeFixedWalletInputs(adminPlan.fixedInputs, replacementFixedInputs),
|
|
606
502
|
},
|
|
607
|
-
feeRateSatVb: feeSelection.feeRateSatVb,
|
|
503
|
+
feeRateSatVb: execution.feeSelection.feeRateSatVb,
|
|
608
504
|
});
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
505
|
+
},
|
|
506
|
+
publish({ state, execution, built, mutation }) {
|
|
507
|
+
return publishWalletMutation({
|
|
508
|
+
rpc: execution.rpc,
|
|
509
|
+
walletName: execution.walletName,
|
|
510
|
+
snapshotHeight: execution.readContext.snapshot?.tip?.height ?? null,
|
|
613
511
|
built,
|
|
614
|
-
mutation
|
|
615
|
-
state
|
|
616
|
-
provider,
|
|
617
|
-
nowUnixMs,
|
|
618
|
-
paths,
|
|
512
|
+
mutation,
|
|
513
|
+
state,
|
|
514
|
+
provider: execution.provider,
|
|
515
|
+
nowUnixMs: execution.nowUnixMs,
|
|
516
|
+
paths: execution.paths,
|
|
619
517
|
errorPrefix: options.errorPrefix,
|
|
620
518
|
});
|
|
519
|
+
},
|
|
520
|
+
createResult({ operation, mutation, built, status, reusedExisting, fees }) {
|
|
621
521
|
return {
|
|
622
522
|
kind: options.kind,
|
|
623
|
-
domainName: normalizedDomainName,
|
|
624
|
-
txid:
|
|
625
|
-
status:
|
|
626
|
-
reusedExisting
|
|
627
|
-
recipientScriptPubKeyHex: payload.recipientScriptPubKeyHex ?? null,
|
|
628
|
-
endpointValueHex: payload.endpointValueHex ?? null,
|
|
523
|
+
domainName: operation.normalizedDomainName,
|
|
524
|
+
txid: mutation.attemptedTxid ?? built?.txid ?? "unknown",
|
|
525
|
+
status: status,
|
|
526
|
+
reusedExisting,
|
|
527
|
+
recipientScriptPubKeyHex: operation.payload.recipientScriptPubKeyHex ?? null,
|
|
528
|
+
endpointValueHex: operation.payload.endpointValueHex ?? null,
|
|
629
529
|
resolved: {
|
|
630
|
-
sender: resolvedSender,
|
|
631
|
-
target: payload.resolvedTarget,
|
|
632
|
-
effect: payload.resolvedEffect,
|
|
530
|
+
sender: operation.resolvedSender,
|
|
531
|
+
target: operation.payload.resolvedTarget,
|
|
532
|
+
effect: operation.payload.resolvedEffect,
|
|
633
533
|
},
|
|
634
|
-
fees
|
|
635
|
-
selection: feeSelection,
|
|
636
|
-
built,
|
|
637
|
-
}),
|
|
534
|
+
fees,
|
|
638
535
|
};
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
await miningPreemption.release();
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
finally {
|
|
646
|
-
await controlLock.release();
|
|
647
|
-
}
|
|
536
|
+
},
|
|
537
|
+
});
|
|
538
|
+
return execution.result;
|
|
648
539
|
}
|
|
649
540
|
export async function setDomainEndpoint(options) {
|
|
650
541
|
const payloadBytes = await loadEndpointPayload(options.source);
|