@cogcoin/client 1.1.8 → 1.1.9
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/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/sentence-protocol.d.ts +2 -2
- package/dist/wallet/mining/sentences.js +8 -8
- 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
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { formatFieldEffect, formatFieldPath, formatFieldSenderSummary, formatFieldValueSummary, } from "../../mutation-text-format.js";
|
|
2
|
+
import { commandMutationNextSteps, workflowMutationNextSteps, } from "../../mutation-success.js";
|
|
3
|
+
function createFieldValueSource(endpointText, endpointJson, endpointBytes, fieldFormat, fieldValue) {
|
|
4
|
+
if (endpointText !== null) {
|
|
5
|
+
return { kind: "text", value: endpointText };
|
|
6
|
+
}
|
|
7
|
+
if (endpointJson !== null) {
|
|
8
|
+
return { kind: "json", value: endpointJson };
|
|
9
|
+
}
|
|
10
|
+
if (endpointBytes !== null) {
|
|
11
|
+
return { kind: "bytes", value: endpointBytes };
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
kind: "raw",
|
|
15
|
+
format: fieldFormat,
|
|
16
|
+
value: fieldValue,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export const fieldMutationCommandSpec = {
|
|
20
|
+
id: "field",
|
|
21
|
+
async run(command) {
|
|
22
|
+
if (command.parsed.command === "field-create") {
|
|
23
|
+
const result = await command.context.createField({
|
|
24
|
+
domainName: command.parsed.args[0],
|
|
25
|
+
fieldName: command.parsed.args[1],
|
|
26
|
+
permanent: command.parsed.fieldPermanent,
|
|
27
|
+
feeRateSatVb: command.parsed.satvb,
|
|
28
|
+
dataDir: command.dataDir,
|
|
29
|
+
databasePath: command.dbPath,
|
|
30
|
+
provider: command.provider,
|
|
31
|
+
prompter: command.prompter,
|
|
32
|
+
assumeYes: command.parsed.assumeYes,
|
|
33
|
+
paths: command.runtimePaths,
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
reusedExisting: result.reusedExisting,
|
|
37
|
+
reusedMessage: "The existing pending field creation was reconciled instead of creating a duplicate.",
|
|
38
|
+
fees: result.fees,
|
|
39
|
+
explorerTxid: result.txid,
|
|
40
|
+
nextSteps: workflowMutationNextSteps([
|
|
41
|
+
`cogcoin field show ${result.domainName} ${result.fieldName}`,
|
|
42
|
+
`cogcoin field set ${result.domainName} ${result.fieldName} --text <value>`,
|
|
43
|
+
]),
|
|
44
|
+
text: {
|
|
45
|
+
heading: "Field creation submitted.",
|
|
46
|
+
fields: [
|
|
47
|
+
{ label: "Domain", value: result.domainName },
|
|
48
|
+
{ label: "Field", value: result.fieldName },
|
|
49
|
+
{ label: "Sender", value: formatFieldSenderSummary(result) },
|
|
50
|
+
{ label: "Path", value: formatFieldPath(result) },
|
|
51
|
+
{ label: "Value", value: formatFieldValueSummary(result), when: result.resolved?.value !== null && result.resolved?.value !== undefined },
|
|
52
|
+
{ label: "Effect", value: formatFieldEffect(result) },
|
|
53
|
+
{ label: "Status", value: result.status },
|
|
54
|
+
{ label: "Txid", value: result.txid },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (command.parsed.command === "field-set") {
|
|
60
|
+
const result = await command.context.setField({
|
|
61
|
+
domainName: command.parsed.args[0],
|
|
62
|
+
fieldName: command.parsed.args[1],
|
|
63
|
+
source: createFieldValueSource(command.parsed.endpointText, command.parsed.endpointJson, command.parsed.endpointBytes, command.parsed.fieldFormat, command.parsed.fieldValue),
|
|
64
|
+
feeRateSatVb: command.parsed.satvb,
|
|
65
|
+
dataDir: command.dataDir,
|
|
66
|
+
databasePath: command.dbPath,
|
|
67
|
+
provider: command.provider,
|
|
68
|
+
prompter: command.prompter,
|
|
69
|
+
assumeYes: command.parsed.assumeYes,
|
|
70
|
+
paths: command.runtimePaths,
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
reusedExisting: result.reusedExisting,
|
|
74
|
+
reusedMessage: "The existing pending field update was reconciled instead of creating a duplicate.",
|
|
75
|
+
fees: result.fees,
|
|
76
|
+
explorerTxid: result.txid,
|
|
77
|
+
nextSteps: commandMutationNextSteps(`cogcoin field show ${result.domainName} ${result.fieldName}`),
|
|
78
|
+
text: {
|
|
79
|
+
heading: "Field update submitted.",
|
|
80
|
+
fields: [
|
|
81
|
+
{ label: "Domain", value: result.domainName },
|
|
82
|
+
{ label: "Field", value: result.fieldName },
|
|
83
|
+
{ label: "Sender", value: formatFieldSenderSummary(result) },
|
|
84
|
+
{ label: "Value", value: formatFieldValueSummary(result) },
|
|
85
|
+
{ label: "Effect", value: formatFieldEffect(result) },
|
|
86
|
+
{ label: "Status", value: result.status },
|
|
87
|
+
{ label: "Txid", value: result.txid },
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (command.parsed.command === "field-clear") {
|
|
93
|
+
const result = await command.context.clearField({
|
|
94
|
+
domainName: command.parsed.args[0],
|
|
95
|
+
fieldName: command.parsed.args[1],
|
|
96
|
+
feeRateSatVb: command.parsed.satvb,
|
|
97
|
+
dataDir: command.dataDir,
|
|
98
|
+
databasePath: command.dbPath,
|
|
99
|
+
provider: command.provider,
|
|
100
|
+
prompter: command.prompter,
|
|
101
|
+
assumeYes: command.parsed.assumeYes,
|
|
102
|
+
paths: command.runtimePaths,
|
|
103
|
+
});
|
|
104
|
+
return {
|
|
105
|
+
reusedExisting: result.reusedExisting,
|
|
106
|
+
reusedMessage: "The existing pending field clear was reconciled instead of creating a duplicate.",
|
|
107
|
+
fees: result.fees,
|
|
108
|
+
explorerTxid: result.txid,
|
|
109
|
+
nextSteps: commandMutationNextSteps(`cogcoin field show ${result.domainName} ${result.fieldName}`),
|
|
110
|
+
text: {
|
|
111
|
+
heading: "Field clear submitted.",
|
|
112
|
+
fields: [
|
|
113
|
+
{ label: "Domain", value: result.domainName },
|
|
114
|
+
{ label: "Field", value: result.fieldName },
|
|
115
|
+
{ label: "Sender", value: formatFieldSenderSummary(result) },
|
|
116
|
+
{ label: "Effect", value: formatFieldEffect(result) },
|
|
117
|
+
{ label: "Status", value: result.status },
|
|
118
|
+
{ label: "Txid", value: result.txid },
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
throw new Error(`wallet mutation command not implemented: ${command.parsed.command}`);
|
|
124
|
+
},
|
|
125
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { formatRegisterEconomicEffect, formatRegisterSenderSummary } from "../../mutation-text-format.js";
|
|
2
|
+
import { workflowMutationNextSteps, } from "../../mutation-success.js";
|
|
3
|
+
import { getRegisterNextSteps } from "../../workflow-hints.js";
|
|
4
|
+
export const registerMutationCommandSpec = {
|
|
5
|
+
id: "register",
|
|
6
|
+
async run(command) {
|
|
7
|
+
const result = await command.context.registerDomain({
|
|
8
|
+
domainName: command.parsed.args[0],
|
|
9
|
+
feeRateSatVb: command.parsed.satvb,
|
|
10
|
+
dataDir: command.dataDir,
|
|
11
|
+
databasePath: command.dbPath,
|
|
12
|
+
forceRace: command.parsed.forceRace,
|
|
13
|
+
provider: command.provider,
|
|
14
|
+
prompter: command.prompter,
|
|
15
|
+
assumeYes: command.parsed.assumeYes,
|
|
16
|
+
paths: command.runtimePaths,
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
reusedExisting: result.reusedExisting,
|
|
20
|
+
reusedMessage: "The existing pending registration was reconciled instead of creating a duplicate.",
|
|
21
|
+
fees: result.fees,
|
|
22
|
+
explorerTxid: result.txid,
|
|
23
|
+
nextSteps: workflowMutationNextSteps(getRegisterNextSteps(result.domainName, result.registerKind)),
|
|
24
|
+
text: {
|
|
25
|
+
heading: "Registration submitted.",
|
|
26
|
+
fields: [
|
|
27
|
+
{ label: "Domain", value: result.domainName },
|
|
28
|
+
{ label: "Path", value: result.resolved.path },
|
|
29
|
+
{ label: "Parent", value: result.resolved.parentDomainName ?? "", when: result.resolved.parentDomainName !== null },
|
|
30
|
+
{ label: "Sender", value: formatRegisterSenderSummary(result) },
|
|
31
|
+
{ label: "Economic effect", value: formatRegisterEconomicEffect(result) },
|
|
32
|
+
{ label: "Status", value: result.status },
|
|
33
|
+
{ label: "Txid", value: result.txid },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { anchorMutationCommandSpec } from "./anchor.js";
|
|
2
|
+
import { bitcoinTransferCommandSpec } from "./bitcoin-transfer.js";
|
|
3
|
+
import { cogMutationCommandSpec } from "./cog.js";
|
|
4
|
+
import { domainAdminMutationCommandSpec } from "./domain-admin.js";
|
|
5
|
+
import { domainMarketMutationCommandSpec } from "./domain-market.js";
|
|
6
|
+
import { fieldMutationCommandSpec } from "./field.js";
|
|
7
|
+
import { registerMutationCommandSpec } from "./register.js";
|
|
8
|
+
import { reputationMutationCommandSpec } from "./reputation.js";
|
|
9
|
+
const walletMutationCommandSpecs = new Map([
|
|
10
|
+
["bitcoin-transfer", bitcoinTransferCommandSpec],
|
|
11
|
+
["anchor", anchorMutationCommandSpec],
|
|
12
|
+
["register", registerMutationCommandSpec],
|
|
13
|
+
["transfer", domainMarketMutationCommandSpec],
|
|
14
|
+
["sell", domainMarketMutationCommandSpec],
|
|
15
|
+
["unsell", domainMarketMutationCommandSpec],
|
|
16
|
+
["buy", domainMarketMutationCommandSpec],
|
|
17
|
+
["domain-endpoint-set", domainAdminMutationCommandSpec],
|
|
18
|
+
["domain-endpoint-clear", domainAdminMutationCommandSpec],
|
|
19
|
+
["domain-delegate-set", domainAdminMutationCommandSpec],
|
|
20
|
+
["domain-delegate-clear", domainAdminMutationCommandSpec],
|
|
21
|
+
["domain-miner-set", domainAdminMutationCommandSpec],
|
|
22
|
+
["domain-miner-clear", domainAdminMutationCommandSpec],
|
|
23
|
+
["domain-canonical", domainAdminMutationCommandSpec],
|
|
24
|
+
["field-create", fieldMutationCommandSpec],
|
|
25
|
+
["field-set", fieldMutationCommandSpec],
|
|
26
|
+
["field-clear", fieldMutationCommandSpec],
|
|
27
|
+
["send", cogMutationCommandSpec],
|
|
28
|
+
["cog-lock", cogMutationCommandSpec],
|
|
29
|
+
["claim", cogMutationCommandSpec],
|
|
30
|
+
["reclaim", cogMutationCommandSpec],
|
|
31
|
+
["rep-give", reputationMutationCommandSpec],
|
|
32
|
+
["rep-revoke", reputationMutationCommandSpec],
|
|
33
|
+
]);
|
|
34
|
+
export function getWalletMutationCommandSpec(command) {
|
|
35
|
+
if (command === null) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return walletMutationCommandSpecs.get(command) ?? null;
|
|
39
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { parseCogAmountToCogtoshi } from "../../../wallet/tx/index.js";
|
|
2
|
+
import { formatReputationEffect, formatReputationReviewSummary, formatReputationSenderSummary, } from "../../mutation-text-format.js";
|
|
3
|
+
import { commandMutationNextSteps } from "../../mutation-success.js";
|
|
4
|
+
export const reputationMutationCommandSpec = {
|
|
5
|
+
id: "reputation",
|
|
6
|
+
async run(command) {
|
|
7
|
+
const result = command.parsed.command === "rep-give"
|
|
8
|
+
? await command.context.giveReputation({
|
|
9
|
+
sourceDomainName: command.parsed.args[0],
|
|
10
|
+
targetDomainName: command.parsed.args[1],
|
|
11
|
+
amountCogtoshi: parseCogAmountToCogtoshi(command.parsed.args[2]),
|
|
12
|
+
reviewText: command.parsed.reviewText,
|
|
13
|
+
feeRateSatVb: command.parsed.satvb,
|
|
14
|
+
dataDir: command.dataDir,
|
|
15
|
+
databasePath: command.dbPath,
|
|
16
|
+
provider: command.provider,
|
|
17
|
+
prompter: command.prompter,
|
|
18
|
+
assumeYes: command.parsed.assumeYes,
|
|
19
|
+
paths: command.runtimePaths,
|
|
20
|
+
})
|
|
21
|
+
: await command.context.revokeReputation({
|
|
22
|
+
sourceDomainName: command.parsed.args[0],
|
|
23
|
+
targetDomainName: command.parsed.args[1],
|
|
24
|
+
amountCogtoshi: parseCogAmountToCogtoshi(command.parsed.args[2]),
|
|
25
|
+
reviewText: command.parsed.reviewText,
|
|
26
|
+
feeRateSatVb: command.parsed.satvb,
|
|
27
|
+
dataDir: command.dataDir,
|
|
28
|
+
databasePath: command.dbPath,
|
|
29
|
+
provider: command.provider,
|
|
30
|
+
prompter: command.prompter,
|
|
31
|
+
assumeYes: command.parsed.assumeYes,
|
|
32
|
+
paths: command.runtimePaths,
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
reusedExisting: result.reusedExisting,
|
|
36
|
+
reusedMessage: "The existing pending reputation mutation was reconciled instead of creating a duplicate.",
|
|
37
|
+
fees: result.fees,
|
|
38
|
+
explorerTxid: result.txid,
|
|
39
|
+
nextSteps: commandMutationNextSteps(`cogcoin show ${result.targetDomainName}`),
|
|
40
|
+
text: {
|
|
41
|
+
heading: command.parsed.command === "rep-give"
|
|
42
|
+
? "Reputation support submitted."
|
|
43
|
+
: "Reputation revoke submitted.",
|
|
44
|
+
fields: [
|
|
45
|
+
{ label: "Source domain", value: result.sourceDomainName },
|
|
46
|
+
{ label: "Target domain", value: result.targetDomainName },
|
|
47
|
+
{ label: "Sender", value: formatReputationSenderSummary(result) },
|
|
48
|
+
{ label: "Amount", value: `${result.amountCogtoshi.toString()} cogtoshi` },
|
|
49
|
+
{ label: "Review", value: formatReputationReviewSummary(result) },
|
|
50
|
+
{ label: "Effect", value: formatReputationEffect(result) },
|
|
51
|
+
{ label: "Status", value: result.status },
|
|
52
|
+
{ label: "Txid", value: result.txid },
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { WalletRuntimePaths } from "../../../wallet/runtime.js";
|
|
2
|
+
import type { WalletSecretProvider } from "../../../wallet/state/provider.js";
|
|
3
|
+
import type { WalletPrompter } from "../../../wallet/lifecycle.js";
|
|
4
|
+
import type { WalletMutationFeeSummary } from "../../../wallet/tx/index.js";
|
|
5
|
+
import type { MutationSuccessNextSteps } from "../../mutation-success.js";
|
|
6
|
+
import type { MutationTextField } from "../../mutation-text-write.js";
|
|
7
|
+
import type { ParsedCliArgs, RequiredCliRunnerContext } from "../../types.js";
|
|
8
|
+
export interface ResolvedWalletMutationCommandContext {
|
|
9
|
+
parsed: ParsedCliArgs;
|
|
10
|
+
context: RequiredCliRunnerContext;
|
|
11
|
+
runtimePaths: WalletRuntimePaths;
|
|
12
|
+
dataDir: string;
|
|
13
|
+
dbPath: string;
|
|
14
|
+
prompter: WalletPrompter;
|
|
15
|
+
provider: WalletSecretProvider;
|
|
16
|
+
interactive: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface WalletMutationCommandSuccessDescriptor {
|
|
19
|
+
reusedExisting: boolean;
|
|
20
|
+
reusedMessage: string;
|
|
21
|
+
fees?: WalletMutationFeeSummary | null;
|
|
22
|
+
explorerTxid?: string | null;
|
|
23
|
+
nextSteps: MutationSuccessNextSteps;
|
|
24
|
+
text: {
|
|
25
|
+
heading: string;
|
|
26
|
+
fields: MutationTextField[];
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface WalletMutationCommandSpec {
|
|
30
|
+
id: string;
|
|
31
|
+
run(context: ResolvedWalletMutationCommandContext): Promise<WalletMutationCommandSuccessDescriptor>;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|