@cogcoin/client 1.1.8 → 1.1.10
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 +1 -1
- package/dist/bitcoind/managed-bitcoind-service-config.d.ts +13 -0
- package/dist/bitcoind/managed-bitcoind-service-config.js +165 -0
- package/dist/bitcoind/managed-bitcoind-service-lifecycle.d.ts +28 -0
- package/dist/bitcoind/managed-bitcoind-service-lifecycle.js +290 -0
- package/dist/bitcoind/managed-bitcoind-service-process.d.ts +8 -0
- package/dist/bitcoind/managed-bitcoind-service-process.js +48 -0
- package/dist/bitcoind/managed-bitcoind-service-replica.d.ts +8 -0
- package/dist/bitcoind/managed-bitcoind-service-replica.js +142 -0
- package/dist/bitcoind/managed-bitcoind-service-status.d.ts +42 -0
- package/dist/bitcoind/managed-bitcoind-service-status.js +178 -0
- package/dist/bitcoind/managed-bitcoind-service-types.d.ts +36 -0
- package/dist/bitcoind/managed-bitcoind-service-types.js +1 -0
- package/dist/bitcoind/service.d.ts +7 -63
- package/dist/bitcoind/service.js +7 -797
- package/dist/cli/commands/mining-read.js +1 -1
- package/dist/cli/commands/wallet-mutation/anchor.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/anchor.js +33 -0
- package/dist/cli/commands/wallet-mutation/bitcoin-transfer.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/bitcoin-transfer.js +32 -0
- package/dist/cli/commands/wallet-mutation/cog.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/cog.js +131 -0
- package/dist/cli/commands/wallet-mutation/context.d.ts +3 -0
- package/dist/cli/commands/wallet-mutation/context.js +18 -0
- package/dist/cli/commands/wallet-mutation/domain-admin.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/domain-admin.js +173 -0
- package/dist/cli/commands/wallet-mutation/domain-market.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/domain-market.js +107 -0
- package/dist/cli/commands/wallet-mutation/field.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/field.js +125 -0
- package/dist/cli/commands/wallet-mutation/register.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/register.js +38 -0
- package/dist/cli/commands/wallet-mutation/registry.d.ts +3 -0
- package/dist/cli/commands/wallet-mutation/registry.js +39 -0
- package/dist/cli/commands/wallet-mutation/reputation.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/reputation.js +57 -0
- package/dist/cli/commands/wallet-mutation/types.d.ts +32 -0
- package/dist/cli/commands/wallet-mutation/types.js +1 -0
- package/dist/cli/commands/wallet-mutation.js +13 -765
- package/dist/cli/commands/wallet-read.js +4 -4
- package/dist/cli/mutation-success.d.ts +0 -2
- package/dist/cli/output/classify.d.ts +7 -0
- package/dist/cli/output/classify.js +94 -0
- package/dist/cli/output/render.d.ts +2 -0
- package/dist/cli/output/render.js +13 -0
- package/dist/cli/output/rules/cli-surface.d.ts +2 -0
- package/dist/cli/output/rules/cli-surface.js +110 -0
- package/dist/cli/output/rules/generic.d.ts +2 -0
- package/dist/cli/output/rules/generic.js +13 -0
- package/dist/cli/output/rules/index.d.ts +2 -0
- package/dist/cli/output/rules/index.js +24 -0
- package/dist/cli/output/rules/mining-update.d.ts +2 -0
- package/dist/cli/output/rules/mining-update.js +68 -0
- package/dist/cli/output/rules/services.d.ts +2 -0
- package/dist/cli/output/rules/services.js +110 -0
- package/dist/cli/output/rules/wallet-admin.d.ts +2 -0
- package/dist/cli/output/rules/wallet-admin.js +224 -0
- package/dist/cli/output/rules/wallet-mutations.d.ts +2 -0
- package/dist/cli/output/rules/wallet-mutations.js +274 -0
- package/dist/cli/output/types.d.ts +16 -0
- package/dist/cli/output/types.js +1 -0
- package/dist/cli/output.d.ts +2 -168
- package/dist/cli/output.js +6 -989
- package/dist/cli/pagination.d.ts +15 -0
- package/dist/cli/pagination.js +16 -0
- package/dist/cli/recommendations.d.ts +4 -0
- package/dist/cli/recommendations.js +108 -0
- package/dist/cli/wallet-format/availability.d.ts +5 -0
- package/dist/cli/wallet-format/availability.js +96 -0
- package/dist/cli/wallet-format/balance.d.ts +2 -0
- package/dist/cli/wallet-format/balance.js +162 -0
- package/dist/cli/wallet-format/domains.d.ts +8 -0
- package/dist/cli/wallet-format/domains.js +84 -0
- package/dist/cli/wallet-format/fields.d.ts +6 -0
- package/dist/cli/wallet-format/fields.js +61 -0
- package/dist/cli/wallet-format/identity.d.ts +5 -0
- package/dist/cli/wallet-format/identity.js +19 -0
- package/dist/cli/wallet-format/locks.d.ts +7 -0
- package/dist/cli/wallet-format/locks.js +52 -0
- package/dist/cli/wallet-format/overview.d.ts +2 -0
- package/dist/cli/wallet-format/overview.js +122 -0
- package/dist/cli/wallet-format/pending.d.ts +13 -0
- package/dist/cli/wallet-format/pending.js +101 -0
- package/dist/cli/wallet-format/shared.d.ts +7 -0
- package/dist/cli/wallet-format/shared.js +31 -0
- package/dist/cli/wallet-format/status.d.ts +3 -0
- package/dist/cli/wallet-format/status.js +27 -0
- package/dist/cli/wallet-format.d.ts +8 -30
- package/dist/cli/wallet-format.js +8 -830
- package/dist/cli/wallet-read-helpers.d.ts +6 -0
- package/dist/cli/wallet-read-helpers.js +17 -0
- package/dist/wallet/mining/candidate.d.ts +1 -1
- package/dist/wallet/mining/candidate.js +3 -3
- package/dist/wallet/mining/constants.d.ts +2 -2
- package/dist/wallet/mining/constants.js +2 -2
- package/dist/wallet/mining/engine-types.d.ts +1 -0
- package/dist/wallet/mining/engine-types.js +9 -1
- package/dist/wallet/mining/publish.js +3 -6
- package/dist/wallet/mining/runner.js +30 -18
- package/dist/wallet/mining/sentence-protocol.d.ts +2 -2
- package/dist/wallet/mining/sentences.js +8 -8
- package/dist/wallet/mining/visualizer.js +7 -6
- package/dist/wallet/read/context.d.ts +4 -10
- package/dist/wallet/read/context.js +4 -227
- package/dist/wallet/read/local-state.d.ts +28 -0
- package/dist/wallet/read/local-state.js +233 -0
- package/dist/wallet/read/managed-bitcoind.d.ts +30 -0
- package/dist/wallet/read/managed-bitcoind.js +138 -0
- package/dist/wallet/read/managed-indexer.d.ts +23 -0
- package/dist/wallet/read/managed-indexer.js +87 -0
- package/dist/wallet/read/managed-services.d.ts +6 -21
- package/dist/wallet/read/managed-services.js +23 -196
- package/dist/wallet/tx/anchor/confirm.d.ts +15 -0
- package/dist/wallet/tx/anchor/confirm.js +60 -0
- package/dist/wallet/tx/anchor/draft.d.ts +39 -0
- package/dist/wallet/tx/anchor/draft.js +167 -0
- package/dist/wallet/tx/anchor/index.d.ts +5 -0
- package/dist/wallet/tx/anchor/index.js +148 -0
- package/dist/wallet/tx/anchor/intent.d.ts +61 -0
- package/dist/wallet/tx/anchor/intent.js +101 -0
- package/dist/wallet/tx/anchor/plan.d.ts +3 -0
- package/dist/wallet/tx/anchor/plan.js +18 -0
- package/dist/wallet/tx/anchor/result.d.ts +25 -0
- package/dist/wallet/tx/anchor/result.js +20 -0
- package/dist/wallet/tx/anchor.d.ts +1 -39
- package/dist/wallet/tx/anchor.js +1 -494
- package/dist/wallet/tx/bitcoin-transfer/confirm.d.ts +7 -0
- package/dist/wallet/tx/bitcoin-transfer/confirm.js +11 -0
- package/dist/wallet/tx/bitcoin-transfer/index.d.ts +5 -0
- package/dist/wallet/tx/bitcoin-transfer/index.js +112 -0
- package/dist/wallet/tx/bitcoin-transfer/intent.d.ts +52 -0
- package/dist/wallet/tx/bitcoin-transfer/intent.js +74 -0
- package/dist/wallet/tx/bitcoin-transfer/plan.d.ts +5 -0
- package/dist/wallet/tx/bitcoin-transfer/plan.js +21 -0
- package/dist/wallet/tx/bitcoin-transfer/result.d.ts +19 -0
- package/dist/wallet/tx/bitcoin-transfer/result.js +16 -0
- package/dist/wallet/tx/bitcoin-transfer.d.ts +1 -35
- package/dist/wallet/tx/bitcoin-transfer.js +1 -200
- package/dist/wallet/tx/cog/confirm.d.ts +13 -0
- package/dist/wallet/tx/cog/confirm.js +59 -0
- package/dist/wallet/tx/cog/draft.d.ts +20 -0
- package/dist/wallet/tx/cog/draft.js +114 -0
- package/dist/wallet/tx/cog/index.d.ts +6 -0
- package/dist/wallet/tx/cog/index.js +117 -0
- package/dist/wallet/tx/cog/intent.d.ts +30 -0
- package/dist/wallet/tx/cog/intent.js +169 -0
- package/dist/wallet/tx/cog/plan.d.ts +19 -0
- package/dist/wallet/tx/cog/plan.js +65 -0
- package/dist/wallet/tx/cog/result.d.ts +27 -0
- package/dist/wallet/tx/cog/result.js +28 -0
- package/dist/wallet/tx/cog/types.d.ts +186 -0
- package/dist/wallet/tx/cog/types.js +2 -0
- package/dist/wallet/tx/cog/variants/claim.d.ts +3 -0
- package/dist/wallet/tx/cog/variants/claim.js +92 -0
- package/dist/wallet/tx/cog/variants/lock.d.ts +2 -0
- package/dist/wallet/tx/cog/variants/lock.js +102 -0
- package/dist/wallet/tx/cog/variants/send.d.ts +2 -0
- package/dist/wallet/tx/cog/variants/send.js +77 -0
- package/dist/wallet/tx/cog.d.ts +1 -96
- package/dist/wallet/tx/cog.js +1 -824
- package/dist/wallet/tx/common.d.ts +14 -199
- package/dist/wallet/tx/common.js +10 -493
- package/dist/wallet/tx/domain-admin/confirm.d.ts +17 -0
- package/dist/wallet/tx/domain-admin/confirm.js +58 -0
- package/dist/wallet/tx/domain-admin/draft.d.ts +20 -0
- package/dist/wallet/tx/domain-admin/draft.js +161 -0
- package/dist/wallet/tx/domain-admin/index.d.ts +9 -0
- package/dist/wallet/tx/domain-admin/index.js +150 -0
- package/dist/wallet/tx/domain-admin/intent.d.ts +12 -0
- package/dist/wallet/tx/domain-admin/intent.js +61 -0
- package/dist/wallet/tx/domain-admin/plan.d.ts +19 -0
- package/dist/wallet/tx/domain-admin/plan.js +64 -0
- package/dist/wallet/tx/domain-admin/result.d.ts +19 -0
- package/dist/wallet/tx/domain-admin/result.js +33 -0
- package/dist/wallet/tx/domain-admin/types.d.ts +162 -0
- package/dist/wallet/tx/domain-admin/types.js +1 -0
- package/dist/wallet/tx/domain-admin/variants/canonical.d.ts +2 -0
- package/dist/wallet/tx/domain-admin/variants/canonical.js +22 -0
- package/dist/wallet/tx/domain-admin/variants/delegate.d.ts +3 -0
- package/dist/wallet/tx/domain-admin/variants/delegate.js +60 -0
- package/dist/wallet/tx/domain-admin/variants/endpoint.d.ts +3 -0
- package/dist/wallet/tx/domain-admin/variants/endpoint.js +102 -0
- package/dist/wallet/tx/domain-admin/variants/miner.d.ts +3 -0
- package/dist/wallet/tx/domain-admin/variants/miner.js +59 -0
- package/dist/wallet/tx/domain-admin.d.ts +1 -107
- package/dist/wallet/tx/domain-admin.js +1 -729
- package/dist/wallet/tx/domain-market/confirm.d.ts +6 -0
- package/dist/wallet/tx/domain-market/confirm.js +52 -0
- package/dist/wallet/tx/domain-market/draft.d.ts +43 -0
- package/dist/wallet/tx/domain-market/draft.js +286 -0
- package/dist/wallet/tx/domain-market/index.d.ts +6 -0
- package/dist/wallet/tx/domain-market/index.js +145 -0
- package/dist/wallet/tx/domain-market/intent.d.ts +15 -0
- package/dist/wallet/tx/domain-market/intent.js +131 -0
- package/dist/wallet/tx/domain-market/plan.d.ts +31 -0
- package/dist/wallet/tx/domain-market/plan.js +98 -0
- package/dist/wallet/tx/domain-market/result.d.ts +45 -0
- package/dist/wallet/tx/domain-market/result.js +88 -0
- package/dist/wallet/tx/domain-market/types.d.ts +221 -0
- package/dist/wallet/tx/domain-market/types.js +1 -0
- package/dist/wallet/tx/domain-market/variants/buy.d.ts +2 -0
- package/dist/wallet/tx/domain-market/variants/buy.js +103 -0
- package/dist/wallet/tx/domain-market/variants/sell.d.ts +2 -0
- package/dist/wallet/tx/domain-market/variants/sell.js +91 -0
- package/dist/wallet/tx/domain-market/variants/transfer.d.ts +2 -0
- package/dist/wallet/tx/domain-market/variants/transfer.js +105 -0
- package/dist/wallet/tx/domain-market.d.ts +1 -116
- package/dist/wallet/tx/domain-market.js +1 -1078
- package/dist/wallet/tx/draft-build.d.ts +60 -0
- package/dist/wallet/tx/draft-build.js +127 -0
- package/dist/wallet/tx/executor.d.ts +6 -40
- package/dist/wallet/tx/executor.js +6 -100
- package/dist/wallet/tx/fee.d.ts +30 -0
- package/dist/wallet/tx/fee.js +98 -0
- package/dist/wallet/tx/field/confirm.d.ts +11 -0
- package/dist/wallet/tx/field/confirm.js +19 -0
- package/dist/wallet/tx/field/draft.d.ts +23 -0
- package/dist/wallet/tx/field/draft.js +202 -0
- package/dist/wallet/tx/field/index.d.ts +5 -0
- package/dist/wallet/tx/field/index.js +140 -0
- package/dist/wallet/tx/field/intent.d.ts +5 -0
- package/dist/wallet/tx/field/intent.js +50 -0
- package/dist/wallet/tx/field/plan.d.ts +20 -0
- package/dist/wallet/tx/field/plan.js +65 -0
- package/dist/wallet/tx/field/result.d.ts +29 -0
- package/dist/wallet/tx/field/result.js +103 -0
- package/dist/wallet/tx/field/types.d.ts +163 -0
- package/dist/wallet/tx/field/types.js +1 -0
- package/dist/wallet/tx/field/variants/clear.d.ts +2 -0
- package/dist/wallet/tx/field/variants/clear.js +60 -0
- package/dist/wallet/tx/field/variants/create.d.ts +2 -0
- package/dist/wallet/tx/field/variants/create.js +67 -0
- package/dist/wallet/tx/field/variants/set.d.ts +2 -0
- package/dist/wallet/tx/field/variants/set.js +195 -0
- package/dist/wallet/tx/field.d.ts +1 -95
- package/dist/wallet/tx/field.js +1 -920
- package/dist/wallet/tx/mining-preemption.d.ts +6 -0
- package/dist/wallet/tx/mining-preemption.js +7 -0
- package/dist/wallet/tx/primitives.d.ts +13 -0
- package/dist/wallet/tx/primitives.js +42 -0
- package/dist/wallet/tx/psbt-assert.d.ts +14 -0
- package/dist/wallet/tx/psbt-assert.js +39 -0
- package/dist/wallet/tx/publish.d.ts +37 -0
- package/dist/wallet/tx/publish.js +88 -0
- package/dist/wallet/tx/readiness.d.ts +7 -0
- package/dist/wallet/tx/readiness.js +61 -0
- package/dist/wallet/tx/reconcile.d.ts +24 -0
- package/dist/wallet/tx/reconcile.js +72 -0
- package/dist/wallet/tx/register/confirm.d.ts +6 -0
- package/dist/wallet/tx/register/confirm.js +66 -0
- package/dist/wallet/tx/register/draft.d.ts +42 -0
- package/dist/wallet/tx/register/draft.js +181 -0
- package/dist/wallet/tx/register/index.d.ts +6 -0
- package/dist/wallet/tx/register/index.js +158 -0
- package/dist/wallet/tx/register/intent.d.ts +74 -0
- package/dist/wallet/tx/register/intent.js +119 -0
- package/dist/wallet/tx/register/plan.d.ts +43 -0
- package/dist/wallet/tx/register/plan.js +168 -0
- package/dist/wallet/tx/register/result.d.ts +78 -0
- package/dist/wallet/tx/register/result.js +41 -0
- package/dist/wallet/tx/register.d.ts +1 -70
- package/dist/wallet/tx/register.js +1 -681
- package/dist/wallet/tx/reputation/confirm.d.ts +11 -0
- package/dist/wallet/tx/reputation/confirm.js +51 -0
- package/dist/wallet/tx/reputation/draft.d.ts +20 -0
- package/dist/wallet/tx/reputation/draft.js +130 -0
- package/dist/wallet/tx/reputation/index.d.ts +4 -0
- package/dist/wallet/tx/reputation/index.js +162 -0
- package/dist/wallet/tx/reputation/intent.d.ts +36 -0
- package/dist/wallet/tx/reputation/intent.js +157 -0
- package/dist/wallet/tx/reputation/plan.d.ts +19 -0
- package/dist/wallet/tx/reputation/plan.js +64 -0
- package/dist/wallet/tx/reputation/result.d.ts +21 -0
- package/dist/wallet/tx/reputation/result.js +31 -0
- package/dist/wallet/tx/reputation/types.d.ts +130 -0
- package/dist/wallet/tx/reputation/types.js +1 -0
- package/dist/wallet/tx/reputation.d.ts +1 -74
- package/dist/wallet/tx/reputation.js +1 -556
- package/dist/wallet/tx/signing.d.ts +18 -0
- package/dist/wallet/tx/signing.js +31 -0
- package/dist/wallet/tx/state-persist.d.ts +27 -0
- package/dist/wallet/tx/state-persist.js +54 -0
- package/dist/wallet/tx/types.d.ts +44 -0
- package/dist/wallet/tx/types.js +1 -0
- package/package.json +1 -1
- package/dist/cli/mining-json.d.ts +0 -20
- package/dist/cli/mining-json.js +0 -46
- package/dist/cli/mutation-json.d.ts +0 -325
- package/dist/cli/mutation-json.js +0 -269
- package/dist/cli/mutation-resolved-json.d.ts +0 -117
- package/dist/cli/mutation-resolved-json.js +0 -123
- package/dist/cli/preview-json.d.ts +0 -319
- package/dist/cli/preview-json.js +0 -254
- package/dist/cli/read-json.d.ts +0 -190
- package/dist/cli/read-json.js +0 -627
|
@@ -1,33 +1,9 @@
|
|
|
1
|
-
import { parseCogAmountToCogtoshi, } from "../../wallet/tx/index.js";
|
|
2
|
-
import { buildAnchorMutationData, buildBitcoinTransferData, buildCogMutationData, buildDomainAdminMutationData, buildDomainMarketMutationData, buildFieldMutationData, buildRegisterMutationData, buildReputationMutationData, } from "../mutation-json.js";
|
|
3
|
-
import { buildAnchorPreviewData, buildCogPreviewData, buildDomainAdminPreviewData, buildDomainMarketPreviewData, buildFieldPreviewData, buildRegisterPreviewData, buildReputationPreviewData, } from "../preview-json.js";
|
|
4
|
-
import { isAnchorMutationCommand, isBuyMutationCommand, isClaimMutationCommand, isReclaimMutationCommand, isRegisterMutationCommand, isReputationMutationCommand, isSellOrUnsellMutationCommand, isSendMutationCommand, isTransferMutationCommand, isUnsellMutationCommand, isWalletMutationCommand, } from "../mutation-command-groups.js";
|
|
5
|
-
import { commandMutationNextSteps, workflowMutationNextSteps, writeMutationCommandSuccess, } from "../mutation-success.js";
|
|
6
|
-
import { writeLine } from "../io.js";
|
|
7
|
-
import { formatBuyBuyerSummary, formatBuySellerSummary, formatBuySettlementSummary, formatCogClaimPath, formatCogSenderSummary, formatDomainAdminEffect, formatDomainAdminPayloadSummary, formatDomainAdminSenderSummary, formatDomainAdminTargetSummary, formatDomainMarketEconomicEffect, formatDomainMarketRecipientSummary, formatDomainMarketSenderSummary, formatFieldEffect, formatFieldPath, formatFieldSenderSummary, formatFieldValueSummary, formatRegisterEconomicEffect, formatRegisterSenderSummary, formatReputationEffect, formatReputationReviewSummary, formatReputationSenderSummary, } from "../mutation-text-format.js";
|
|
8
|
-
import { writeHandledCliError } from "../output.js";
|
|
9
|
-
import { getAnchorNextSteps, getRegisterNextSteps, } from "../workflow-hints.js";
|
|
10
1
|
import { createOwnedLockCleanupSignalWatcher, waitForCompletionOrStop, } from "../signals.js";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (parsed.endpointJson !== null) {
|
|
17
|
-
return { kind: "json", value: parsed.endpointJson };
|
|
18
|
-
}
|
|
19
|
-
if (parsed.endpointBytes !== null) {
|
|
20
|
-
return { kind: "bytes", value: parsed.endpointBytes };
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
kind: "raw",
|
|
24
|
-
format: parsed.fieldFormat,
|
|
25
|
-
value: parsed.fieldValue,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function createCommandPrompter(context) {
|
|
29
|
-
return context.createPrompter();
|
|
30
|
-
}
|
|
2
|
+
import { writeHandledCliError } from "../output.js";
|
|
3
|
+
import { writeLine } from "../io.js";
|
|
4
|
+
import { writeMutationCommandSuccess } from "../mutation-success.js";
|
|
5
|
+
import { resolveWalletMutationCommandContext } from "./wallet-mutation/context.js";
|
|
6
|
+
import { getWalletMutationCommandSpec } from "./wallet-mutation/registry.js";
|
|
31
7
|
export async function runWalletMutationCommand(parsed, context) {
|
|
32
8
|
const runtimePaths = context.resolveWalletRuntimePaths();
|
|
33
9
|
const stopWatcher = createOwnedLockCleanupSignalWatcher(context.signalSource, context.forceExit, [
|
|
@@ -38,745 +14,17 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
38
14
|
]);
|
|
39
15
|
try {
|
|
40
16
|
const outcome = await waitForCompletionOrStop((async () => {
|
|
41
|
-
|
|
17
|
+
const spec = getWalletMutationCommandSpec(parsed.command);
|
|
18
|
+
if (spec === null) {
|
|
42
19
|
writeLine(context.stderr, `wallet mutation command not implemented: ${parsed.command}`);
|
|
43
20
|
return 1;
|
|
44
21
|
}
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const result = await context.transferBitcoin({
|
|
52
|
-
amountSatsText: parsed.args[0],
|
|
53
|
-
target: parsed.transferTarget,
|
|
54
|
-
dataDir,
|
|
55
|
-
databasePath: dbPath,
|
|
56
|
-
provider,
|
|
57
|
-
prompter,
|
|
58
|
-
assumeYes: parsed.assumeYes,
|
|
59
|
-
paths: runtimePaths,
|
|
60
|
-
});
|
|
61
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
62
|
-
data: buildBitcoinTransferData(result),
|
|
63
|
-
reusedExisting: false,
|
|
64
|
-
reusedMessage: "",
|
|
65
|
-
interactive,
|
|
66
|
-
explorerTxid: result.txid,
|
|
67
|
-
nextSteps: workflowMutationNextSteps([]),
|
|
68
|
-
text: {
|
|
69
|
-
heading: "Bitcoin transfer submitted.",
|
|
70
|
-
fields: [
|
|
71
|
-
{ label: "Sender", value: result.senderAddress },
|
|
72
|
-
{ label: "Recipient", value: result.recipientAddress },
|
|
73
|
-
{ label: "Amount", value: `${result.amountSats.toString()} sats` },
|
|
74
|
-
{ label: "Fee", value: `${result.feeSats.toString()} sats` },
|
|
75
|
-
{ label: "Txid", value: result.txid },
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
if (isAnchorMutationCommand(parsed.command)) {
|
|
81
|
-
const result = await context.anchorDomain({
|
|
82
|
-
domainName: parsed.args[0],
|
|
83
|
-
foundingMessageText: parsed.anchorMessage,
|
|
84
|
-
promptForFoundingMessageWhenMissing: parsed.anchorMessage === null,
|
|
85
|
-
feeRateSatVb: parsed.satvb,
|
|
86
|
-
dataDir,
|
|
87
|
-
databasePath: dbPath,
|
|
88
|
-
provider,
|
|
89
|
-
prompter,
|
|
90
|
-
paths: runtimePaths,
|
|
91
|
-
});
|
|
92
|
-
const nextSteps = getAnchorNextSteps(result.domainName);
|
|
93
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
94
|
-
data: buildAnchorMutationData(result, {
|
|
95
|
-
foundingMessageText: result.foundingMessageText ?? parsed.anchorMessage,
|
|
96
|
-
}),
|
|
97
|
-
previewData: buildAnchorPreviewData(result, {
|
|
98
|
-
foundingMessageText: result.foundingMessageText ?? parsed.anchorMessage,
|
|
99
|
-
}),
|
|
100
|
-
reusedExisting: result.reusedExisting,
|
|
101
|
-
reusedMessage: "The existing pending anchor was reconciled instead of creating a duplicate.",
|
|
102
|
-
fees: result.fees,
|
|
103
|
-
interactive,
|
|
104
|
-
explorerTxid: result.txid,
|
|
105
|
-
nextSteps: workflowMutationNextSteps(nextSteps),
|
|
106
|
-
text: {
|
|
107
|
-
heading: "Anchor submitted.",
|
|
108
|
-
fields: [
|
|
109
|
-
{ label: "Domain", value: result.domainName },
|
|
110
|
-
{ label: "Status", value: result.status },
|
|
111
|
-
{ label: "Txid", value: result.txid },
|
|
112
|
-
],
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
if (isRegisterMutationCommand(parsed.command)) {
|
|
117
|
-
const result = await context.registerDomain({
|
|
118
|
-
domainName: parsed.args[0],
|
|
119
|
-
feeRateSatVb: parsed.satvb,
|
|
120
|
-
dataDir,
|
|
121
|
-
databasePath: dbPath,
|
|
122
|
-
forceRace: parsed.forceRace,
|
|
123
|
-
provider,
|
|
124
|
-
prompter,
|
|
125
|
-
assumeYes: parsed.assumeYes,
|
|
126
|
-
paths: runtimePaths,
|
|
127
|
-
});
|
|
128
|
-
const nextSteps = getRegisterNextSteps(result.domainName, result.registerKind);
|
|
129
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
130
|
-
data: buildRegisterMutationData(result, {
|
|
131
|
-
forceRace: parsed.forceRace,
|
|
132
|
-
}),
|
|
133
|
-
previewData: buildRegisterPreviewData(result, {
|
|
134
|
-
forceRace: parsed.forceRace,
|
|
135
|
-
}),
|
|
136
|
-
reusedExisting: result.reusedExisting,
|
|
137
|
-
reusedMessage: "The existing pending registration was reconciled instead of creating a duplicate.",
|
|
138
|
-
fees: result.fees,
|
|
139
|
-
interactive,
|
|
140
|
-
explorerTxid: result.txid,
|
|
141
|
-
nextSteps: workflowMutationNextSteps(nextSteps),
|
|
142
|
-
text: {
|
|
143
|
-
heading: "Registration submitted.",
|
|
144
|
-
fields: [
|
|
145
|
-
{ label: "Domain", value: result.domainName },
|
|
146
|
-
{ label: "Path", value: result.resolved.path },
|
|
147
|
-
{ label: "Parent", value: result.resolved.parentDomainName ?? "", when: result.resolved.parentDomainName !== null },
|
|
148
|
-
{ label: "Sender", value: formatRegisterSenderSummary(result) },
|
|
149
|
-
{ label: "Economic effect", value: formatRegisterEconomicEffect(result) },
|
|
150
|
-
{ label: "Status", value: result.status },
|
|
151
|
-
{ label: "Txid", value: result.txid },
|
|
152
|
-
],
|
|
153
|
-
},
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
if (isTransferMutationCommand(parsed.command)) {
|
|
157
|
-
const result = await context.transferDomain({
|
|
158
|
-
domainName: parsed.args[0],
|
|
159
|
-
target: parsed.transferTarget,
|
|
160
|
-
feeRateSatVb: parsed.satvb,
|
|
161
|
-
dataDir,
|
|
162
|
-
databasePath: dbPath,
|
|
163
|
-
provider,
|
|
164
|
-
prompter,
|
|
165
|
-
assumeYes: parsed.assumeYes,
|
|
166
|
-
paths: runtimePaths,
|
|
167
|
-
});
|
|
168
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
169
|
-
data: buildDomainMarketMutationData(result, {
|
|
170
|
-
commandKind: "transfer",
|
|
171
|
-
}),
|
|
172
|
-
previewData: buildDomainMarketPreviewData(result, {
|
|
173
|
-
commandKind: "transfer",
|
|
174
|
-
}),
|
|
175
|
-
reusedExisting: result.reusedExisting,
|
|
176
|
-
reusedMessage: "The existing pending transfer was reconciled instead of creating a duplicate.",
|
|
177
|
-
fees: result.fees,
|
|
178
|
-
interactive,
|
|
179
|
-
explorerTxid: result.txid,
|
|
180
|
-
nextSteps: commandMutationNextSteps(`cogcoin show ${result.domainName}`),
|
|
181
|
-
text: {
|
|
182
|
-
heading: "Transfer submitted.",
|
|
183
|
-
fields: [
|
|
184
|
-
{ label: "Domain", value: result.domainName },
|
|
185
|
-
{ label: "Sender", value: formatDomainMarketSenderSummary(result) },
|
|
186
|
-
{ label: "Recipient", value: formatDomainMarketRecipientSummary(result) },
|
|
187
|
-
{ label: "Economic effect", value: formatDomainMarketEconomicEffect(result) },
|
|
188
|
-
{ label: "Status", value: result.status },
|
|
189
|
-
{ label: "Txid", value: result.txid },
|
|
190
|
-
],
|
|
191
|
-
},
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
if (isSellOrUnsellMutationCommand(parsed.command)) {
|
|
195
|
-
const listedPriceCogtoshi = isUnsellMutationCommand(parsed.command)
|
|
196
|
-
? 0n
|
|
197
|
-
: parseCogAmountToCogtoshi(parsed.args[1]);
|
|
198
|
-
const result = await context.sellDomain({
|
|
199
|
-
domainName: parsed.args[0],
|
|
200
|
-
listedPriceCogtoshi,
|
|
201
|
-
feeRateSatVb: parsed.satvb,
|
|
202
|
-
dataDir,
|
|
203
|
-
databasePath: dbPath,
|
|
204
|
-
provider,
|
|
205
|
-
prompter,
|
|
206
|
-
assumeYes: parsed.assumeYes,
|
|
207
|
-
paths: runtimePaths,
|
|
208
|
-
});
|
|
209
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
210
|
-
data: buildDomainMarketMutationData(result, {
|
|
211
|
-
commandKind: result.listedPriceCogtoshi === 0n ? "unsell" : "sell",
|
|
212
|
-
}),
|
|
213
|
-
previewData: buildDomainMarketPreviewData(result, {
|
|
214
|
-
commandKind: result.listedPriceCogtoshi === 0n ? "unsell" : "sell",
|
|
215
|
-
}),
|
|
216
|
-
reusedExisting: result.reusedExisting,
|
|
217
|
-
reusedMessage: "The existing pending listing mutation was reconciled instead of creating a duplicate.",
|
|
218
|
-
fees: result.fees,
|
|
219
|
-
interactive,
|
|
220
|
-
explorerTxid: result.txid,
|
|
221
|
-
nextSteps: commandMutationNextSteps(`cogcoin show ${result.domainName}`),
|
|
222
|
-
text: {
|
|
223
|
-
heading: result.listedPriceCogtoshi === 0n ? "Listing cancellation submitted." : "Listing submitted.",
|
|
224
|
-
fields: [
|
|
225
|
-
{ label: "Domain", value: result.domainName },
|
|
226
|
-
{ label: "Sender", value: formatDomainMarketSenderSummary(result) },
|
|
227
|
-
{ label: "Price", value: `${result.listedPriceCogtoshi?.toString() ?? "0"} cogtoshi` },
|
|
228
|
-
{ label: "Economic effect", value: formatDomainMarketEconomicEffect(result) },
|
|
229
|
-
{ label: "Status", value: result.status },
|
|
230
|
-
{ label: "Txid", value: result.txid },
|
|
231
|
-
],
|
|
232
|
-
},
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
if (parsed.command === "domain-endpoint-set" || parsed.command === "domain-endpoint-clear") {
|
|
236
|
-
const result = parsed.command === "domain-endpoint-set"
|
|
237
|
-
? await context.setDomainEndpoint({
|
|
238
|
-
domainName: parsed.args[0],
|
|
239
|
-
source: parsed.endpointText !== null
|
|
240
|
-
? { kind: "text", value: parsed.endpointText }
|
|
241
|
-
: parsed.endpointJson !== null
|
|
242
|
-
? { kind: "json", value: parsed.endpointJson }
|
|
243
|
-
: { kind: "bytes", value: parsed.endpointBytes },
|
|
244
|
-
feeRateSatVb: parsed.satvb,
|
|
245
|
-
dataDir,
|
|
246
|
-
databasePath: dbPath,
|
|
247
|
-
provider,
|
|
248
|
-
prompter,
|
|
249
|
-
assumeYes: parsed.assumeYes,
|
|
250
|
-
paths: runtimePaths,
|
|
251
|
-
})
|
|
252
|
-
: await context.clearDomainEndpoint({
|
|
253
|
-
domainName: parsed.args[0],
|
|
254
|
-
feeRateSatVb: parsed.satvb,
|
|
255
|
-
dataDir,
|
|
256
|
-
databasePath: dbPath,
|
|
257
|
-
provider,
|
|
258
|
-
prompter,
|
|
259
|
-
assumeYes: parsed.assumeYes,
|
|
260
|
-
paths: runtimePaths,
|
|
261
|
-
});
|
|
262
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
263
|
-
data: buildDomainAdminMutationData(result, {
|
|
264
|
-
commandKind: parsed.command,
|
|
265
|
-
}),
|
|
266
|
-
previewData: buildDomainAdminPreviewData(result, {
|
|
267
|
-
commandKind: parsed.command,
|
|
268
|
-
}),
|
|
269
|
-
reusedExisting: result.reusedExisting,
|
|
270
|
-
reusedMessage: "The existing pending endpoint mutation was reconciled instead of creating a duplicate.",
|
|
271
|
-
fees: result.fees,
|
|
272
|
-
interactive,
|
|
273
|
-
explorerTxid: result.txid,
|
|
274
|
-
nextSteps: commandMutationNextSteps(`cogcoin show ${result.domainName}`),
|
|
275
|
-
text: {
|
|
276
|
-
heading: parsed.command === "domain-endpoint-set" ? "Endpoint update submitted." : "Endpoint clear submitted.",
|
|
277
|
-
fields: [
|
|
278
|
-
{ label: "Domain", value: result.domainName },
|
|
279
|
-
{ label: "Sender", value: formatDomainAdminSenderSummary(result) },
|
|
280
|
-
{ label: "Payload", value: formatDomainAdminPayloadSummary(result) },
|
|
281
|
-
{ label: "Effect", value: formatDomainAdminEffect(result) },
|
|
282
|
-
{ label: "Status", value: result.status },
|
|
283
|
-
{ label: "Txid", value: result.txid },
|
|
284
|
-
],
|
|
285
|
-
},
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
if (parsed.command === "domain-delegate-set" || parsed.command === "domain-delegate-clear") {
|
|
289
|
-
const result = parsed.command === "domain-delegate-set"
|
|
290
|
-
? await context.setDomainDelegate({
|
|
291
|
-
domainName: parsed.args[0],
|
|
292
|
-
target: parsed.args[1],
|
|
293
|
-
feeRateSatVb: parsed.satvb,
|
|
294
|
-
dataDir,
|
|
295
|
-
databasePath: dbPath,
|
|
296
|
-
provider,
|
|
297
|
-
prompter,
|
|
298
|
-
assumeYes: parsed.assumeYes,
|
|
299
|
-
paths: runtimePaths,
|
|
300
|
-
})
|
|
301
|
-
: await context.clearDomainDelegate({
|
|
302
|
-
domainName: parsed.args[0],
|
|
303
|
-
feeRateSatVb: parsed.satvb,
|
|
304
|
-
dataDir,
|
|
305
|
-
databasePath: dbPath,
|
|
306
|
-
provider,
|
|
307
|
-
prompter,
|
|
308
|
-
assumeYes: parsed.assumeYes,
|
|
309
|
-
paths: runtimePaths,
|
|
310
|
-
});
|
|
311
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
312
|
-
data: buildDomainAdminMutationData(result, {
|
|
313
|
-
commandKind: parsed.command,
|
|
314
|
-
}),
|
|
315
|
-
previewData: buildDomainAdminPreviewData(result, {
|
|
316
|
-
commandKind: parsed.command,
|
|
317
|
-
}),
|
|
318
|
-
reusedExisting: result.reusedExisting,
|
|
319
|
-
reusedMessage: "The existing pending delegate mutation was reconciled instead of creating a duplicate.",
|
|
320
|
-
fees: result.fees,
|
|
321
|
-
interactive,
|
|
322
|
-
explorerTxid: result.txid,
|
|
323
|
-
nextSteps: commandMutationNextSteps(`cogcoin show ${result.domainName}`),
|
|
324
|
-
text: {
|
|
325
|
-
heading: parsed.command === "domain-delegate-set" ? "Delegate update submitted." : "Delegate clear submitted.",
|
|
326
|
-
fields: [
|
|
327
|
-
{ label: "Domain", value: result.domainName },
|
|
328
|
-
{ label: "Sender", value: formatDomainAdminSenderSummary(result) },
|
|
329
|
-
{ label: "Target", value: formatDomainAdminTargetSummary(result) },
|
|
330
|
-
{ label: "Effect", value: formatDomainAdminEffect(result) },
|
|
331
|
-
{ label: "Status", value: result.status },
|
|
332
|
-
{ label: "Txid", value: result.txid },
|
|
333
|
-
],
|
|
334
|
-
},
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
if (parsed.command === "domain-miner-set" || parsed.command === "domain-miner-clear") {
|
|
338
|
-
const result = parsed.command === "domain-miner-set"
|
|
339
|
-
? await context.setDomainMiner({
|
|
340
|
-
domainName: parsed.args[0],
|
|
341
|
-
target: parsed.args[1],
|
|
342
|
-
feeRateSatVb: parsed.satvb,
|
|
343
|
-
dataDir,
|
|
344
|
-
databasePath: dbPath,
|
|
345
|
-
provider,
|
|
346
|
-
prompter,
|
|
347
|
-
assumeYes: parsed.assumeYes,
|
|
348
|
-
paths: runtimePaths,
|
|
349
|
-
})
|
|
350
|
-
: await context.clearDomainMiner({
|
|
351
|
-
domainName: parsed.args[0],
|
|
352
|
-
feeRateSatVb: parsed.satvb,
|
|
353
|
-
dataDir,
|
|
354
|
-
databasePath: dbPath,
|
|
355
|
-
provider,
|
|
356
|
-
prompter,
|
|
357
|
-
assumeYes: parsed.assumeYes,
|
|
358
|
-
paths: runtimePaths,
|
|
359
|
-
});
|
|
360
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
361
|
-
data: buildDomainAdminMutationData(result, {
|
|
362
|
-
commandKind: parsed.command,
|
|
363
|
-
}),
|
|
364
|
-
previewData: buildDomainAdminPreviewData(result, {
|
|
365
|
-
commandKind: parsed.command,
|
|
366
|
-
}),
|
|
367
|
-
reusedExisting: result.reusedExisting,
|
|
368
|
-
reusedMessage: "The existing pending miner mutation was reconciled instead of creating a duplicate.",
|
|
369
|
-
fees: result.fees,
|
|
370
|
-
interactive,
|
|
371
|
-
explorerTxid: result.txid,
|
|
372
|
-
nextSteps: commandMutationNextSteps(`cogcoin show ${result.domainName}`),
|
|
373
|
-
text: {
|
|
374
|
-
heading: parsed.command === "domain-miner-set" ? "Miner update submitted." : "Miner clear submitted.",
|
|
375
|
-
fields: [
|
|
376
|
-
{ label: "Domain", value: result.domainName },
|
|
377
|
-
{ label: "Sender", value: formatDomainAdminSenderSummary(result) },
|
|
378
|
-
{ label: "Target", value: formatDomainAdminTargetSummary(result) },
|
|
379
|
-
{ label: "Effect", value: formatDomainAdminEffect(result) },
|
|
380
|
-
{ label: "Status", value: result.status },
|
|
381
|
-
{ label: "Txid", value: result.txid },
|
|
382
|
-
],
|
|
383
|
-
},
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
if (parsed.command === "domain-canonical") {
|
|
387
|
-
const result = await context.setDomainCanonical({
|
|
388
|
-
domainName: parsed.args[0],
|
|
389
|
-
feeRateSatVb: parsed.satvb,
|
|
390
|
-
dataDir,
|
|
391
|
-
databasePath: dbPath,
|
|
392
|
-
provider,
|
|
393
|
-
prompter,
|
|
394
|
-
assumeYes: parsed.assumeYes,
|
|
395
|
-
paths: runtimePaths,
|
|
396
|
-
});
|
|
397
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
398
|
-
data: buildDomainAdminMutationData(result, {
|
|
399
|
-
commandKind: "domain-canonical",
|
|
400
|
-
}),
|
|
401
|
-
previewData: buildDomainAdminPreviewData(result, {
|
|
402
|
-
commandKind: "domain-canonical",
|
|
403
|
-
}),
|
|
404
|
-
reusedExisting: result.reusedExisting,
|
|
405
|
-
reusedMessage: "The existing pending canonical mutation was reconciled instead of creating a duplicate.",
|
|
406
|
-
fees: result.fees,
|
|
407
|
-
interactive,
|
|
408
|
-
explorerTxid: result.txid,
|
|
409
|
-
nextSteps: commandMutationNextSteps(`cogcoin show ${result.domainName}`),
|
|
410
|
-
text: {
|
|
411
|
-
heading: "Canonical update submitted.",
|
|
412
|
-
fields: [
|
|
413
|
-
{ label: "Domain", value: result.domainName },
|
|
414
|
-
{ label: "Sender", value: formatDomainAdminSenderSummary(result) },
|
|
415
|
-
{ label: "Effect", value: formatDomainAdminEffect(result) },
|
|
416
|
-
{ label: "Status", value: result.status },
|
|
417
|
-
{ label: "Txid", value: result.txid },
|
|
418
|
-
],
|
|
419
|
-
},
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
if (parsed.command === "field-create") {
|
|
423
|
-
const result = await context.createField({
|
|
424
|
-
domainName: parsed.args[0],
|
|
425
|
-
fieldName: parsed.args[1],
|
|
426
|
-
permanent: parsed.fieldPermanent,
|
|
427
|
-
feeRateSatVb: parsed.satvb,
|
|
428
|
-
dataDir,
|
|
429
|
-
databasePath: dbPath,
|
|
430
|
-
provider,
|
|
431
|
-
prompter,
|
|
432
|
-
assumeYes: parsed.assumeYes,
|
|
433
|
-
paths: runtimePaths,
|
|
434
|
-
});
|
|
435
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
436
|
-
data: buildFieldMutationData(result),
|
|
437
|
-
previewData: buildFieldPreviewData(result),
|
|
438
|
-
reusedExisting: result.reusedExisting,
|
|
439
|
-
reusedMessage: "The existing pending field creation was reconciled instead of creating a duplicate.",
|
|
440
|
-
fees: result.fees,
|
|
441
|
-
interactive,
|
|
442
|
-
explorerTxid: result.txid,
|
|
443
|
-
nextSteps: workflowMutationNextSteps([
|
|
444
|
-
`cogcoin field show ${result.domainName} ${result.fieldName}`,
|
|
445
|
-
`cogcoin field set ${result.domainName} ${result.fieldName} --text <value>`,
|
|
446
|
-
]),
|
|
447
|
-
text: {
|
|
448
|
-
heading: "Field creation submitted.",
|
|
449
|
-
fields: [
|
|
450
|
-
{ label: "Domain", value: result.domainName },
|
|
451
|
-
{ label: "Field", value: result.fieldName },
|
|
452
|
-
{ label: "Sender", value: formatFieldSenderSummary(result) },
|
|
453
|
-
{ label: "Path", value: formatFieldPath(result) },
|
|
454
|
-
{ label: "Value", value: formatFieldValueSummary(result), when: result.resolved?.value !== null && result.resolved?.value !== undefined },
|
|
455
|
-
{ label: "Effect", value: formatFieldEffect(result) },
|
|
456
|
-
{ label: "Status", value: result.status },
|
|
457
|
-
{ label: "Txid", value: result.txid },
|
|
458
|
-
],
|
|
459
|
-
},
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
if (parsed.command === "field-set") {
|
|
463
|
-
const result = await context.setField({
|
|
464
|
-
domainName: parsed.args[0],
|
|
465
|
-
fieldName: parsed.args[1],
|
|
466
|
-
source: createFieldValueSource(parsed),
|
|
467
|
-
feeRateSatVb: parsed.satvb,
|
|
468
|
-
dataDir,
|
|
469
|
-
databasePath: dbPath,
|
|
470
|
-
provider,
|
|
471
|
-
prompter,
|
|
472
|
-
assumeYes: parsed.assumeYes,
|
|
473
|
-
paths: runtimePaths,
|
|
474
|
-
});
|
|
475
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
476
|
-
data: buildFieldMutationData(result),
|
|
477
|
-
previewData: buildFieldPreviewData(result),
|
|
478
|
-
reusedExisting: result.reusedExisting,
|
|
479
|
-
reusedMessage: "The existing pending field update was reconciled instead of creating a duplicate.",
|
|
480
|
-
fees: result.fees,
|
|
481
|
-
interactive,
|
|
482
|
-
explorerTxid: result.txid,
|
|
483
|
-
nextSteps: commandMutationNextSteps(`cogcoin field show ${result.domainName} ${result.fieldName}`),
|
|
484
|
-
text: {
|
|
485
|
-
heading: "Field update submitted.",
|
|
486
|
-
fields: [
|
|
487
|
-
{ label: "Domain", value: result.domainName },
|
|
488
|
-
{ label: "Field", value: result.fieldName },
|
|
489
|
-
{ label: "Sender", value: formatFieldSenderSummary(result) },
|
|
490
|
-
{ label: "Value", value: formatFieldValueSummary(result) },
|
|
491
|
-
{ label: "Effect", value: formatFieldEffect(result) },
|
|
492
|
-
{ label: "Status", value: result.status },
|
|
493
|
-
{ label: "Txid", value: result.txid },
|
|
494
|
-
],
|
|
495
|
-
},
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
if (parsed.command === "field-clear") {
|
|
499
|
-
const result = await context.clearField({
|
|
500
|
-
domainName: parsed.args[0],
|
|
501
|
-
fieldName: parsed.args[1],
|
|
502
|
-
feeRateSatVb: parsed.satvb,
|
|
503
|
-
dataDir,
|
|
504
|
-
databasePath: dbPath,
|
|
505
|
-
provider,
|
|
506
|
-
prompter,
|
|
507
|
-
assumeYes: parsed.assumeYes,
|
|
508
|
-
paths: runtimePaths,
|
|
509
|
-
});
|
|
510
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
511
|
-
data: buildFieldMutationData(result),
|
|
512
|
-
previewData: buildFieldPreviewData(result),
|
|
513
|
-
reusedExisting: result.reusedExisting,
|
|
514
|
-
reusedMessage: "The existing pending field clear was reconciled instead of creating a duplicate.",
|
|
515
|
-
fees: result.fees,
|
|
516
|
-
interactive,
|
|
517
|
-
explorerTxid: result.txid,
|
|
518
|
-
nextSteps: commandMutationNextSteps(`cogcoin field show ${result.domainName} ${result.fieldName}`),
|
|
519
|
-
text: {
|
|
520
|
-
heading: "Field clear submitted.",
|
|
521
|
-
fields: [
|
|
522
|
-
{ label: "Domain", value: result.domainName },
|
|
523
|
-
{ label: "Field", value: result.fieldName },
|
|
524
|
-
{ label: "Sender", value: formatFieldSenderSummary(result) },
|
|
525
|
-
{ label: "Effect", value: formatFieldEffect(result) },
|
|
526
|
-
{ label: "Status", value: result.status },
|
|
527
|
-
{ label: "Txid", value: result.txid },
|
|
528
|
-
],
|
|
529
|
-
},
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
if (isSendMutationCommand(parsed.command)) {
|
|
533
|
-
const result = await context.sendCog({
|
|
534
|
-
amountCogtoshi: parseCogAmountToCogtoshi(parsed.args[0]),
|
|
535
|
-
target: parsed.transferTarget,
|
|
536
|
-
feeRateSatVb: parsed.satvb,
|
|
537
|
-
dataDir,
|
|
538
|
-
databasePath: dbPath,
|
|
539
|
-
provider,
|
|
540
|
-
prompter,
|
|
541
|
-
assumeYes: parsed.assumeYes,
|
|
542
|
-
paths: runtimePaths,
|
|
543
|
-
});
|
|
544
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
545
|
-
data: buildCogMutationData(result, {
|
|
546
|
-
commandKind: "send",
|
|
547
|
-
}),
|
|
548
|
-
previewData: buildCogPreviewData(result, {
|
|
549
|
-
commandKind: "send",
|
|
550
|
-
}),
|
|
551
|
-
reusedExisting: result.reusedExisting,
|
|
552
|
-
reusedMessage: "The existing pending COG transfer was reconciled instead of creating a duplicate.",
|
|
553
|
-
fees: result.fees,
|
|
554
|
-
interactive,
|
|
555
|
-
explorerTxid: result.txid,
|
|
556
|
-
nextSteps: commandMutationNextSteps("cogcoin balance"),
|
|
557
|
-
text: {
|
|
558
|
-
heading: "COG transfer submitted.",
|
|
559
|
-
fields: [
|
|
560
|
-
{ label: "Sender", value: formatCogSenderSummary(result) },
|
|
561
|
-
{ label: "Amount", value: `${result.amountCogtoshi?.toString() ?? "unknown"} cogtoshi` },
|
|
562
|
-
{ label: "Recipient", value: result.recipientScriptPubKeyHex === null || result.recipientScriptPubKeyHex === undefined ? "unknown" : `spk:${result.recipientScriptPubKeyHex}` },
|
|
563
|
-
{ label: "Status", value: result.status },
|
|
564
|
-
{ label: "Txid", value: result.txid },
|
|
565
|
-
],
|
|
566
|
-
},
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
if (parsed.command === "cog-lock") {
|
|
570
|
-
const result = await context.lockCogToDomain({
|
|
571
|
-
amountCogtoshi: parseCogAmountToCogtoshi(parsed.args[0]),
|
|
572
|
-
recipientDomainName: parsed.lockRecipientDomain,
|
|
573
|
-
timeoutBlocksOrDuration: parsed.unlockFor,
|
|
574
|
-
timeoutHeight: parsed.untilHeight === null ? null : Number.parseInt(parsed.untilHeight, 10),
|
|
575
|
-
conditionHex: parsed.conditionHex,
|
|
576
|
-
feeRateSatVb: parsed.satvb,
|
|
577
|
-
dataDir,
|
|
578
|
-
databasePath: dbPath,
|
|
579
|
-
provider,
|
|
580
|
-
prompter,
|
|
581
|
-
assumeYes: parsed.assumeYes,
|
|
582
|
-
paths: runtimePaths,
|
|
583
|
-
});
|
|
584
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
585
|
-
data: buildCogMutationData(result, {
|
|
586
|
-
commandKind: "cog-lock",
|
|
587
|
-
timeoutBlocksOrDuration: parsed.unlockFor,
|
|
588
|
-
timeoutHeight: parsed.untilHeight,
|
|
589
|
-
conditionHex: parsed.conditionHex,
|
|
590
|
-
}),
|
|
591
|
-
previewData: buildCogPreviewData(result, {
|
|
592
|
-
commandKind: "cog-lock",
|
|
593
|
-
timeoutBlocksOrDuration: parsed.unlockFor,
|
|
594
|
-
timeoutHeight: parsed.untilHeight,
|
|
595
|
-
conditionHex: parsed.conditionHex,
|
|
596
|
-
}),
|
|
597
|
-
reusedExisting: result.reusedExisting,
|
|
598
|
-
reusedMessage: "The existing pending lock was reconciled instead of creating a duplicate.",
|
|
599
|
-
fees: result.fees,
|
|
600
|
-
interactive,
|
|
601
|
-
explorerTxid: result.txid,
|
|
602
|
-
nextSteps: commandMutationNextSteps("cogcoin locks"),
|
|
603
|
-
text: {
|
|
604
|
-
heading: "COG lock submitted.",
|
|
605
|
-
fields: [
|
|
606
|
-
{ label: "Sender", value: formatCogSenderSummary(result) },
|
|
607
|
-
{ label: "Amount", value: `${result.amountCogtoshi?.toString() ?? "unknown"} cogtoshi` },
|
|
608
|
-
{ label: "Recipient domain", value: result.recipientDomainName ?? "unknown" },
|
|
609
|
-
{ label: "Status", value: result.status },
|
|
610
|
-
{ label: "Txid", value: result.txid },
|
|
611
|
-
],
|
|
612
|
-
},
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
if (isClaimMutationCommand(parsed.command)) {
|
|
616
|
-
const result = await context.claimCogLock({
|
|
617
|
-
lockId: Number.parseInt(parsed.args[0], 10),
|
|
618
|
-
preimageHex: parsed.preimageHex,
|
|
619
|
-
feeRateSatVb: parsed.satvb,
|
|
620
|
-
dataDir,
|
|
621
|
-
databasePath: dbPath,
|
|
622
|
-
provider,
|
|
623
|
-
prompter,
|
|
624
|
-
paths: runtimePaths,
|
|
625
|
-
});
|
|
626
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
627
|
-
data: buildCogMutationData(result, {
|
|
628
|
-
commandKind: "claim",
|
|
629
|
-
}),
|
|
630
|
-
previewData: buildCogPreviewData(result, {
|
|
631
|
-
commandKind: "claim",
|
|
632
|
-
}),
|
|
633
|
-
reusedExisting: result.reusedExisting,
|
|
634
|
-
reusedMessage: "The existing pending claim was reconciled instead of creating a duplicate.",
|
|
635
|
-
fees: result.fees,
|
|
636
|
-
interactive,
|
|
637
|
-
explorerTxid: result.txid,
|
|
638
|
-
nextSteps: commandMutationNextSteps("cogcoin locks --claimable"),
|
|
639
|
-
text: {
|
|
640
|
-
heading: "Lock claim submitted.",
|
|
641
|
-
fields: [
|
|
642
|
-
{ label: "Lock", value: String(result.lockId ?? "unknown") },
|
|
643
|
-
{ label: "Path", value: formatCogClaimPath(result) },
|
|
644
|
-
{ label: "Sender", value: formatCogSenderSummary(result) },
|
|
645
|
-
{ label: "Amount", value: `${result.amountCogtoshi?.toString() ?? "unknown"} cogtoshi` },
|
|
646
|
-
{ label: "Status", value: result.status },
|
|
647
|
-
{ label: "Txid", value: result.txid },
|
|
648
|
-
],
|
|
649
|
-
},
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
if (isReclaimMutationCommand(parsed.command)) {
|
|
653
|
-
const result = await context.reclaimCogLock({
|
|
654
|
-
lockId: Number.parseInt(parsed.args[0], 10),
|
|
655
|
-
feeRateSatVb: parsed.satvb,
|
|
656
|
-
dataDir,
|
|
657
|
-
databasePath: dbPath,
|
|
658
|
-
provider,
|
|
659
|
-
prompter,
|
|
660
|
-
paths: runtimePaths,
|
|
661
|
-
});
|
|
662
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
663
|
-
data: buildCogMutationData(result, {
|
|
664
|
-
commandKind: "reclaim",
|
|
665
|
-
}),
|
|
666
|
-
previewData: buildCogPreviewData(result, {
|
|
667
|
-
commandKind: "reclaim",
|
|
668
|
-
}),
|
|
669
|
-
reusedExisting: result.reusedExisting,
|
|
670
|
-
reusedMessage: "The existing pending reclaim was reconciled instead of creating a duplicate.",
|
|
671
|
-
fees: result.fees,
|
|
672
|
-
interactive,
|
|
673
|
-
explorerTxid: result.txid,
|
|
674
|
-
nextSteps: commandMutationNextSteps("cogcoin locks --reclaimable"),
|
|
675
|
-
text: {
|
|
676
|
-
heading: "Lock reclaim submitted.",
|
|
677
|
-
fields: [
|
|
678
|
-
{ label: "Lock", value: String(result.lockId ?? "unknown") },
|
|
679
|
-
{ label: "Path", value: formatCogClaimPath(result) },
|
|
680
|
-
{ label: "Sender", value: formatCogSenderSummary(result) },
|
|
681
|
-
{ label: "Amount", value: `${result.amountCogtoshi?.toString() ?? "unknown"} cogtoshi` },
|
|
682
|
-
{ label: "Status", value: result.status },
|
|
683
|
-
{ label: "Txid", value: result.txid },
|
|
684
|
-
],
|
|
685
|
-
},
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
if (isReputationMutationCommand(parsed.command)) {
|
|
689
|
-
const result = parsed.command === "rep-give"
|
|
690
|
-
? await context.giveReputation({
|
|
691
|
-
sourceDomainName: parsed.args[0],
|
|
692
|
-
targetDomainName: parsed.args[1],
|
|
693
|
-
amountCogtoshi: parseCogAmountToCogtoshi(parsed.args[2]),
|
|
694
|
-
reviewText: parsed.reviewText,
|
|
695
|
-
feeRateSatVb: parsed.satvb,
|
|
696
|
-
dataDir,
|
|
697
|
-
databasePath: dbPath,
|
|
698
|
-
provider,
|
|
699
|
-
prompter,
|
|
700
|
-
assumeYes: parsed.assumeYes,
|
|
701
|
-
paths: runtimePaths,
|
|
702
|
-
})
|
|
703
|
-
: await context.revokeReputation({
|
|
704
|
-
sourceDomainName: parsed.args[0],
|
|
705
|
-
targetDomainName: parsed.args[1],
|
|
706
|
-
amountCogtoshi: parseCogAmountToCogtoshi(parsed.args[2]),
|
|
707
|
-
reviewText: parsed.reviewText,
|
|
708
|
-
feeRateSatVb: parsed.satvb,
|
|
709
|
-
dataDir,
|
|
710
|
-
databasePath: dbPath,
|
|
711
|
-
provider,
|
|
712
|
-
prompter,
|
|
713
|
-
assumeYes: parsed.assumeYes,
|
|
714
|
-
paths: runtimePaths,
|
|
715
|
-
});
|
|
716
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
717
|
-
data: buildReputationMutationData(result),
|
|
718
|
-
previewData: buildReputationPreviewData(result),
|
|
719
|
-
reusedExisting: result.reusedExisting,
|
|
720
|
-
reusedMessage: "The existing pending reputation mutation was reconciled instead of creating a duplicate.",
|
|
721
|
-
fees: result.fees,
|
|
722
|
-
interactive,
|
|
723
|
-
explorerTxid: result.txid,
|
|
724
|
-
nextSteps: commandMutationNextSteps(`cogcoin show ${result.targetDomainName}`),
|
|
725
|
-
text: {
|
|
726
|
-
heading: parsed.command === "rep-give" ? "Reputation support submitted." : "Reputation revoke submitted.",
|
|
727
|
-
fields: [
|
|
728
|
-
{ label: "Source domain", value: result.sourceDomainName },
|
|
729
|
-
{ label: "Target domain", value: result.targetDomainName },
|
|
730
|
-
{ label: "Sender", value: formatReputationSenderSummary(result) },
|
|
731
|
-
{ label: "Amount", value: `${result.amountCogtoshi.toString()} cogtoshi` },
|
|
732
|
-
{ label: "Review", value: formatReputationReviewSummary(result) },
|
|
733
|
-
{ label: "Effect", value: formatReputationEffect(result) },
|
|
734
|
-
{ label: "Status", value: result.status },
|
|
735
|
-
{ label: "Txid", value: result.txid },
|
|
736
|
-
],
|
|
737
|
-
},
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
if (isBuyMutationCommand(parsed.command)) {
|
|
741
|
-
const result = await context.buyDomain({
|
|
742
|
-
domainName: parsed.args[0],
|
|
743
|
-
feeRateSatVb: parsed.satvb,
|
|
744
|
-
dataDir,
|
|
745
|
-
databasePath: dbPath,
|
|
746
|
-
provider,
|
|
747
|
-
prompter,
|
|
748
|
-
assumeYes: parsed.assumeYes,
|
|
749
|
-
paths: runtimePaths,
|
|
750
|
-
});
|
|
751
|
-
return writeMutationCommandSuccess(parsed, context, {
|
|
752
|
-
data: buildDomainMarketMutationData(result, {
|
|
753
|
-
commandKind: "buy",
|
|
754
|
-
}),
|
|
755
|
-
previewData: buildDomainMarketPreviewData(result, {
|
|
756
|
-
commandKind: "buy",
|
|
757
|
-
}),
|
|
758
|
-
reusedExisting: result.reusedExisting,
|
|
759
|
-
reusedMessage: "The existing pending purchase was reconciled instead of creating a duplicate.",
|
|
760
|
-
fees: result.fees,
|
|
761
|
-
interactive,
|
|
762
|
-
explorerTxid: result.txid,
|
|
763
|
-
nextSteps: commandMutationNextSteps(`cogcoin show ${result.domainName}`),
|
|
764
|
-
text: {
|
|
765
|
-
heading: "Purchase submitted.",
|
|
766
|
-
fields: [
|
|
767
|
-
{ label: "Domain", value: result.domainName },
|
|
768
|
-
{ label: "Buyer", value: formatBuyBuyerSummary(result) },
|
|
769
|
-
{ label: "Seller", value: formatBuySellerSummary(result) },
|
|
770
|
-
{ label: "Price", value: `${result.listedPriceCogtoshi?.toString() ?? "unknown"} cogtoshi` },
|
|
771
|
-
{ label: "Settlement", value: formatBuySettlementSummary() },
|
|
772
|
-
{ label: "Status", value: result.status },
|
|
773
|
-
{ label: "Txid", value: result.txid },
|
|
774
|
-
],
|
|
775
|
-
},
|
|
776
|
-
});
|
|
777
|
-
}
|
|
778
|
-
writeLine(context.stderr, `wallet mutation command not implemented: ${parsed.command}`);
|
|
779
|
-
return 1;
|
|
22
|
+
const resolved = resolveWalletMutationCommandContext(parsed, context, runtimePaths);
|
|
23
|
+
const success = await spec.run(resolved);
|
|
24
|
+
return writeMutationCommandSuccess(parsed, context, {
|
|
25
|
+
...success,
|
|
26
|
+
interactive: resolved.interactive,
|
|
27
|
+
});
|
|
780
28
|
})(), stopWatcher);
|
|
781
29
|
if (outcome.kind === "stopped") {
|
|
782
30
|
return outcome.code;
|