@cogcoin/client 0.5.0
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/LICENSE +21 -0
- package/README.md +136 -0
- package/dist/app-paths.d.ts +38 -0
- package/dist/app-paths.js +121 -0
- package/dist/art/banner.txt +13 -0
- package/dist/art/scroll.txt +13 -0
- package/dist/art/train-car.txt +6 -0
- package/dist/art/train-smoke.txt +6 -0
- package/dist/art/train.txt +6 -0
- package/dist/bitcoind/bootstrap/chainstate.d.ts +4 -0
- package/dist/bitcoind/bootstrap/chainstate.js +13 -0
- package/dist/bitcoind/bootstrap/constants.d.ts +7 -0
- package/dist/bitcoind/bootstrap/constants.js +12 -0
- package/dist/bitcoind/bootstrap/controller.d.ts +29 -0
- package/dist/bitcoind/bootstrap/controller.js +101 -0
- package/dist/bitcoind/bootstrap/download.d.ts +2 -0
- package/dist/bitcoind/bootstrap/download.js +196 -0
- package/dist/bitcoind/bootstrap/headers.d.ts +13 -0
- package/dist/bitcoind/bootstrap/headers.js +61 -0
- package/dist/bitcoind/bootstrap/paths.d.ts +4 -0
- package/dist/bitcoind/bootstrap/paths.js +15 -0
- package/dist/bitcoind/bootstrap/snapshot-file.d.ts +7 -0
- package/dist/bitcoind/bootstrap/snapshot-file.js +42 -0
- package/dist/bitcoind/bootstrap/state.d.ts +40 -0
- package/dist/bitcoind/bootstrap/state.js +70 -0
- package/dist/bitcoind/bootstrap/types.d.ts +28 -0
- package/dist/bitcoind/bootstrap/types.js +1 -0
- package/dist/bitcoind/bootstrap.d.ts +8 -0
- package/dist/bitcoind/bootstrap.js +7 -0
- package/dist/bitcoind/client/factory.d.ts +3 -0
- package/dist/bitcoind/client/factory.js +57 -0
- package/dist/bitcoind/client/follow-block-times.d.ts +8 -0
- package/dist/bitcoind/client/follow-block-times.js +25 -0
- package/dist/bitcoind/client/follow-loop.d.ts +10 -0
- package/dist/bitcoind/client/follow-loop.js +57 -0
- package/dist/bitcoind/client/internal-types.d.ts +63 -0
- package/dist/bitcoind/client/internal-types.js +18 -0
- package/dist/bitcoind/client/managed-client.d.ts +20 -0
- package/dist/bitcoind/client/managed-client.js +197 -0
- package/dist/bitcoind/client/rate-tracker.d.ts +2 -0
- package/dist/bitcoind/client/rate-tracker.js +24 -0
- package/dist/bitcoind/client/sync-engine.d.ts +3 -0
- package/dist/bitcoind/client/sync-engine.js +143 -0
- package/dist/bitcoind/client.d.ts +1 -0
- package/dist/bitcoind/client.js +1 -0
- package/dist/bitcoind/errors.d.ts +1 -0
- package/dist/bitcoind/errors.js +49 -0
- package/dist/bitcoind/index.d.ts +2 -0
- package/dist/bitcoind/index.js +1 -0
- package/dist/bitcoind/indexer-daemon-main.d.ts +1 -0
- package/dist/bitcoind/indexer-daemon-main.js +472 -0
- package/dist/bitcoind/indexer-daemon.d.ts +107 -0
- package/dist/bitcoind/indexer-daemon.js +391 -0
- package/dist/bitcoind/node.d.ts +8 -0
- package/dist/bitcoind/node.js +219 -0
- package/dist/bitcoind/normalize.d.ts +3 -0
- package/dist/bitcoind/normalize.js +47 -0
- package/dist/bitcoind/progress/assets.d.ts +10 -0
- package/dist/bitcoind/progress/assets.js +90 -0
- package/dist/bitcoind/progress/constants.d.ts +48 -0
- package/dist/bitcoind/progress/constants.js +53 -0
- package/dist/bitcoind/progress/controller.d.ts +28 -0
- package/dist/bitcoind/progress/controller.js +188 -0
- package/dist/bitcoind/progress/follow-scene.d.ts +40 -0
- package/dist/bitcoind/progress/follow-scene.js +367 -0
- package/dist/bitcoind/progress/formatting.d.ts +23 -0
- package/dist/bitcoind/progress/formatting.js +227 -0
- package/dist/bitcoind/progress/quote-scene.d.ts +4 -0
- package/dist/bitcoind/progress/quote-scene.js +137 -0
- package/dist/bitcoind/progress/train-scene.d.ts +9 -0
- package/dist/bitcoind/progress/train-scene.js +92 -0
- package/dist/bitcoind/progress/tty-renderer.d.ts +18 -0
- package/dist/bitcoind/progress/tty-renderer.js +150 -0
- package/dist/bitcoind/progress.d.ts +7 -0
- package/dist/bitcoind/progress.js +7 -0
- package/dist/bitcoind/quotes.d.ts +24 -0
- package/dist/bitcoind/quotes.js +195 -0
- package/dist/bitcoind/rpc.d.ts +71 -0
- package/dist/bitcoind/rpc.js +322 -0
- package/dist/bitcoind/service-paths.d.ts +19 -0
- package/dist/bitcoind/service-paths.js +49 -0
- package/dist/bitcoind/service.d.ts +40 -0
- package/dist/bitcoind/service.js +735 -0
- package/dist/bitcoind/testing.d.ts +9 -0
- package/dist/bitcoind/testing.js +9 -0
- package/dist/bitcoind/types.d.ts +396 -0
- package/dist/bitcoind/types.js +3 -0
- package/dist/bytes.d.ts +9 -0
- package/dist/bytes.js +36 -0
- package/dist/cli/commands/follow.d.ts +2 -0
- package/dist/cli/commands/follow.js +43 -0
- package/dist/cli/commands/mining-admin.d.ts +2 -0
- package/dist/cli/commands/mining-admin.js +92 -0
- package/dist/cli/commands/mining-read.d.ts +2 -0
- package/dist/cli/commands/mining-read.js +173 -0
- package/dist/cli/commands/mining-runtime.d.ts +2 -0
- package/dist/cli/commands/mining-runtime.js +108 -0
- package/dist/cli/commands/status.d.ts +2 -0
- package/dist/cli/commands/status.js +31 -0
- package/dist/cli/commands/sync.d.ts +2 -0
- package/dist/cli/commands/sync.js +52 -0
- package/dist/cli/commands/wallet-admin.d.ts +2 -0
- package/dist/cli/commands/wallet-admin.js +175 -0
- package/dist/cli/commands/wallet-mutation.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation.js +681 -0
- package/dist/cli/commands/wallet-read.d.ts +2 -0
- package/dist/cli/commands/wallet-read.js +265 -0
- package/dist/cli/context.d.ts +3 -0
- package/dist/cli/context.js +75 -0
- package/dist/cli/io.d.ts +3 -0
- package/dist/cli/io.js +12 -0
- package/dist/cli/mining-format.d.ts +5 -0
- package/dist/cli/mining-format.js +156 -0
- package/dist/cli/mining-json.d.ts +49 -0
- package/dist/cli/mining-json.js +89 -0
- package/dist/cli/mutation-command-groups.d.ts +15 -0
- package/dist/cli/mutation-command-groups.js +71 -0
- package/dist/cli/mutation-json.d.ts +430 -0
- package/dist/cli/mutation-json.js +311 -0
- package/dist/cli/mutation-resolved-json.d.ts +124 -0
- package/dist/cli/mutation-resolved-json.js +129 -0
- package/dist/cli/mutation-success.d.ts +20 -0
- package/dist/cli/mutation-success.js +47 -0
- package/dist/cli/mutation-text-format.d.ts +22 -0
- package/dist/cli/mutation-text-format.js +171 -0
- package/dist/cli/mutation-text-write.d.ts +13 -0
- package/dist/cli/mutation-text-write.js +16 -0
- package/dist/cli/output.d.ts +185 -0
- package/dist/cli/output.js +1085 -0
- package/dist/cli/parse.d.ts +3 -0
- package/dist/cli/parse.js +971 -0
- package/dist/cli/preview-json.d.ts +416 -0
- package/dist/cli/preview-json.js +293 -0
- package/dist/cli/prompt.d.ts +3 -0
- package/dist/cli/prompt.js +33 -0
- package/dist/cli/read-json.d.ts +187 -0
- package/dist/cli/read-json.js +675 -0
- package/dist/cli/runner.d.ts +2 -0
- package/dist/cli/runner.js +129 -0
- package/dist/cli/signals.d.ts +3 -0
- package/dist/cli/signals.js +63 -0
- package/dist/cli/status-format.d.ts +2 -0
- package/dist/cli/status-format.js +48 -0
- package/dist/cli/types.d.ts +148 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/wallet-format.d.ts +29 -0
- package/dist/cli/wallet-format.js +637 -0
- package/dist/cli/workflow-hints.d.ts +13 -0
- package/dist/cli/workflow-hints.js +94 -0
- package/dist/cli-runner.d.ts +3 -0
- package/dist/cli-runner.js +3 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +6 -0
- package/dist/client/default-client.d.ts +11 -0
- package/dist/client/default-client.js +118 -0
- package/dist/client/factory.d.ts +2 -0
- package/dist/client/factory.js +15 -0
- package/dist/client/initialization.d.ts +6 -0
- package/dist/client/initialization.js +30 -0
- package/dist/client/persistence.d.ts +5 -0
- package/dist/client/persistence.js +28 -0
- package/dist/client/store-adapter.d.ts +3 -0
- package/dist/client/store-adapter.js +20 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/passive-status.d.ts +36 -0
- package/dist/passive-status.js +100 -0
- package/dist/sqlite/better-sqlite3.d.ts +26 -0
- package/dist/sqlite/better-sqlite3.js +4 -0
- package/dist/sqlite/checkpoints.d.ts +11 -0
- package/dist/sqlite/checkpoints.js +27 -0
- package/dist/sqlite/driver.d.ts +17 -0
- package/dist/sqlite/driver.js +98 -0
- package/dist/sqlite/index.d.ts +4 -0
- package/dist/sqlite/index.js +9 -0
- package/dist/sqlite/migrate.d.ts +2 -0
- package/dist/sqlite/migrate.js +37 -0
- package/dist/sqlite/store.d.ts +3 -0
- package/dist/sqlite/store.js +122 -0
- package/dist/sqlite/tip-meta.d.ts +26 -0
- package/dist/sqlite/tip-meta.js +97 -0
- package/dist/sqlite/types.d.ts +10 -0
- package/dist/sqlite/types.js +1 -0
- package/dist/types.d.ts +55 -0
- package/dist/types.js +1 -0
- package/dist/wallet/archive.d.ts +4 -0
- package/dist/wallet/archive.js +39 -0
- package/dist/wallet/cogop/constants.d.ts +32 -0
- package/dist/wallet/cogop/constants.js +32 -0
- package/dist/wallet/cogop/index.d.ts +32 -0
- package/dist/wallet/cogop/index.js +213 -0
- package/dist/wallet/cogop/numeric.d.ts +3 -0
- package/dist/wallet/cogop/numeric.js +24 -0
- package/dist/wallet/cogop/scriptpubkey.d.ts +2 -0
- package/dist/wallet/cogop/scriptpubkey.js +13 -0
- package/dist/wallet/cogop/validate-name.d.ts +2 -0
- package/dist/wallet/cogop/validate-name.js +18 -0
- package/dist/wallet/fs/atomic.d.ts +6 -0
- package/dist/wallet/fs/atomic.js +46 -0
- package/dist/wallet/fs/lock.d.ts +19 -0
- package/dist/wallet/fs/lock.js +61 -0
- package/dist/wallet/fs/status-file.d.ts +1 -0
- package/dist/wallet/fs/status-file.js +4 -0
- package/dist/wallet/lifecycle.d.ts +193 -0
- package/dist/wallet/lifecycle.js +1475 -0
- package/dist/wallet/material.d.ts +45 -0
- package/dist/wallet/material.js +118 -0
- package/dist/wallet/mining/config.d.ts +18 -0
- package/dist/wallet/mining/config.js +44 -0
- package/dist/wallet/mining/constants.d.ts +24 -0
- package/dist/wallet/mining/constants.js +24 -0
- package/dist/wallet/mining/control.d.ts +53 -0
- package/dist/wallet/mining/control.js +758 -0
- package/dist/wallet/mining/coordination.d.ts +40 -0
- package/dist/wallet/mining/coordination.js +121 -0
- package/dist/wallet/mining/hook-protocol.d.ts +47 -0
- package/dist/wallet/mining/hook-protocol.js +161 -0
- package/dist/wallet/mining/hook-runner.d.ts +1 -0
- package/dist/wallet/mining/hook-runner.js +52 -0
- package/dist/wallet/mining/hooks.d.ts +38 -0
- package/dist/wallet/mining/hooks.js +520 -0
- package/dist/wallet/mining/index.d.ts +8 -0
- package/dist/wallet/mining/index.js +6 -0
- package/dist/wallet/mining/runner.d.ts +155 -0
- package/dist/wallet/mining/runner.js +2574 -0
- package/dist/wallet/mining/runtime-artifacts.d.ts +17 -0
- package/dist/wallet/mining/runtime-artifacts.js +166 -0
- package/dist/wallet/mining/sentences.d.ts +23 -0
- package/dist/wallet/mining/sentences.js +281 -0
- package/dist/wallet/mining/state.d.ts +9 -0
- package/dist/wallet/mining/state.js +75 -0
- package/dist/wallet/mining/types.d.ts +141 -0
- package/dist/wallet/mining/types.js +1 -0
- package/dist/wallet/mining/visualizer.d.ts +19 -0
- package/dist/wallet/mining/visualizer.js +134 -0
- package/dist/wallet/mining/worker-main.d.ts +1 -0
- package/dist/wallet/mining/worker-main.js +17 -0
- package/dist/wallet/read/context.d.ts +20 -0
- package/dist/wallet/read/context.js +532 -0
- package/dist/wallet/read/filter.d.ts +9 -0
- package/dist/wallet/read/filter.js +42 -0
- package/dist/wallet/read/index.d.ts +4 -0
- package/dist/wallet/read/index.js +3 -0
- package/dist/wallet/read/project.d.ts +11 -0
- package/dist/wallet/read/project.js +300 -0
- package/dist/wallet/read/types.d.ts +144 -0
- package/dist/wallet/read/types.js +1 -0
- package/dist/wallet/runtime.d.ts +26 -0
- package/dist/wallet/runtime.js +28 -0
- package/dist/wallet/state/crypto.d.ts +31 -0
- package/dist/wallet/state/crypto.js +127 -0
- package/dist/wallet/state/provider.d.ts +37 -0
- package/dist/wallet/state/provider.js +312 -0
- package/dist/wallet/state/session.d.ts +12 -0
- package/dist/wallet/state/session.js +23 -0
- package/dist/wallet/state/storage.d.ts +19 -0
- package/dist/wallet/state/storage.js +55 -0
- package/dist/wallet/tx/anchor.d.ts +40 -0
- package/dist/wallet/tx/anchor.js +1210 -0
- package/dist/wallet/tx/cog.d.ts +92 -0
- package/dist/wallet/tx/cog.js +1055 -0
- package/dist/wallet/tx/common.d.ts +89 -0
- package/dist/wallet/tx/common.js +156 -0
- package/dist/wallet/tx/confirm.d.ts +15 -0
- package/dist/wallet/tx/confirm.js +24 -0
- package/dist/wallet/tx/domain-admin.d.ts +105 -0
- package/dist/wallet/tx/domain-admin.js +869 -0
- package/dist/wallet/tx/domain-market.d.ts +112 -0
- package/dist/wallet/tx/domain-market.js +1365 -0
- package/dist/wallet/tx/field.d.ts +101 -0
- package/dist/wallet/tx/field.js +1853 -0
- package/dist/wallet/tx/identity-selector.d.ts +12 -0
- package/dist/wallet/tx/identity-selector.js +52 -0
- package/dist/wallet/tx/index.d.ts +7 -0
- package/dist/wallet/tx/index.js +7 -0
- package/dist/wallet/tx/journal.d.ts +5 -0
- package/dist/wallet/tx/journal.js +31 -0
- package/dist/wallet/tx/register.d.ts +68 -0
- package/dist/wallet/tx/register.js +952 -0
- package/dist/wallet/tx/reputation.d.ts +72 -0
- package/dist/wallet/tx/reputation.js +693 -0
- package/dist/wallet/tx/targets.d.ts +7 -0
- package/dist/wallet/tx/targets.js +122 -0
- package/dist/wallet/types.d.ts +249 -0
- package/dist/wallet/types.js +1 -0
- package/dist/writing_quotes.json +1654 -0
- package/package.json +78 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { buildCogResolvedJson, buildDomainAdminResolvedJson, buildDomainMarketResolvedJson, buildFieldResolvedJson, buildRegisterResolvedJson, buildReputationResolvedJson, decimalOrNull, } from "./mutation-resolved-json.js";
|
|
2
|
+
function normalizeTxSummary(txid, wtxid) {
|
|
3
|
+
return {
|
|
4
|
+
txid: txid ?? null,
|
|
5
|
+
wtxid: wtxid ?? null,
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export function buildSingleTxMutationData(options) {
|
|
9
|
+
return {
|
|
10
|
+
resultType: "single-tx-mutation",
|
|
11
|
+
mutation: {
|
|
12
|
+
kind: options.kind,
|
|
13
|
+
journalKind: options.journalKind ?? options.kind,
|
|
14
|
+
localStatus: options.localStatus,
|
|
15
|
+
reusedExisting: options.reusedExisting,
|
|
16
|
+
intentFingerprintHex: options.intentFingerprintHex ?? null,
|
|
17
|
+
},
|
|
18
|
+
transaction: normalizeTxSummary(options.txid, options.wtxid),
|
|
19
|
+
intent: options.intent,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function buildFamilyMutationData(options) {
|
|
23
|
+
return {
|
|
24
|
+
resultType: "family-mutation",
|
|
25
|
+
family: {
|
|
26
|
+
kind: options.familyKind,
|
|
27
|
+
localStatus: options.familyStatus,
|
|
28
|
+
reusedExisting: options.reusedExisting,
|
|
29
|
+
currentStep: options.currentStep ?? null,
|
|
30
|
+
intentFingerprintHex: options.intentFingerprintHex ?? null,
|
|
31
|
+
},
|
|
32
|
+
transactions: {
|
|
33
|
+
tx1: normalizeTxSummary(options.tx1Txid, options.tx1Wtxid),
|
|
34
|
+
tx2: normalizeTxSummary(options.tx2Txid, options.tx2Wtxid),
|
|
35
|
+
},
|
|
36
|
+
intent: options.intent,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function buildStateChangeData(options) {
|
|
40
|
+
return {
|
|
41
|
+
resultType: "state-change",
|
|
42
|
+
stateChange: {
|
|
43
|
+
kind: options.kind,
|
|
44
|
+
before: options.before ?? null,
|
|
45
|
+
after: options.after ?? null,
|
|
46
|
+
},
|
|
47
|
+
state: options.state,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function buildOperationData(options) {
|
|
51
|
+
return {
|
|
52
|
+
resultType: "operation",
|
|
53
|
+
operation: {
|
|
54
|
+
kind: options.kind,
|
|
55
|
+
...options.operation,
|
|
56
|
+
},
|
|
57
|
+
state: options.state ?? null,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export function buildRegisterMutationData(result, options) {
|
|
61
|
+
return {
|
|
62
|
+
...buildSingleTxMutationData({
|
|
63
|
+
kind: "register",
|
|
64
|
+
localStatus: result.status,
|
|
65
|
+
txid: result.txid,
|
|
66
|
+
reusedExisting: result.reusedExisting,
|
|
67
|
+
intent: {
|
|
68
|
+
domainName: result.domainName,
|
|
69
|
+
registerKind: result.registerKind,
|
|
70
|
+
forceRace: options.forceRace,
|
|
71
|
+
fromIdentitySelector: options.fromIdentity,
|
|
72
|
+
},
|
|
73
|
+
}),
|
|
74
|
+
resolved: buildRegisterResolvedJson(result),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export function buildDomainMarketMutationData(result, options) {
|
|
78
|
+
const intent = {
|
|
79
|
+
domainName: result.domainName,
|
|
80
|
+
listedPriceCogtoshi: decimalOrNull(result.listedPriceCogtoshi),
|
|
81
|
+
recipientScriptPubKeyHex: result.recipientScriptPubKeyHex ?? null,
|
|
82
|
+
};
|
|
83
|
+
if (options.commandKind === "buy") {
|
|
84
|
+
intent.fromIdentitySelector = options.fromIdentity ?? null;
|
|
85
|
+
}
|
|
86
|
+
const data = buildSingleTxMutationData({
|
|
87
|
+
kind: options.commandKind,
|
|
88
|
+
localStatus: result.status,
|
|
89
|
+
txid: result.txid,
|
|
90
|
+
reusedExisting: result.reusedExisting,
|
|
91
|
+
intent,
|
|
92
|
+
journalKind: result.kind,
|
|
93
|
+
});
|
|
94
|
+
if (options.commandKind !== "buy") {
|
|
95
|
+
return {
|
|
96
|
+
...data,
|
|
97
|
+
resolved: buildDomainMarketResolvedJson(result, options.commandKind),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
...data,
|
|
102
|
+
resolved: buildDomainMarketResolvedJson(result, options.commandKind),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export function buildCogMutationData(result, options) {
|
|
106
|
+
const data = buildSingleTxMutationData({
|
|
107
|
+
kind: options.commandKind,
|
|
108
|
+
localStatus: result.status,
|
|
109
|
+
txid: result.txid,
|
|
110
|
+
reusedExisting: result.reusedExisting,
|
|
111
|
+
intent: {
|
|
112
|
+
amountCogtoshi: decimalOrNull(result.amountCogtoshi),
|
|
113
|
+
recipientScriptPubKeyHex: result.recipientScriptPubKeyHex ?? null,
|
|
114
|
+
recipientDomainName: result.recipientDomainName ?? null,
|
|
115
|
+
lockId: result.lockId ?? null,
|
|
116
|
+
fromIdentitySelector: options.fromIdentity,
|
|
117
|
+
timeoutBlocksOrDuration: options.timeoutBlocksOrDuration ?? null,
|
|
118
|
+
timeoutHeight: options.timeoutHeight ?? null,
|
|
119
|
+
conditionHex: options.conditionHex ?? null,
|
|
120
|
+
},
|
|
121
|
+
journalKind: result.kind,
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
...data,
|
|
125
|
+
resolved: buildCogResolvedJson(result, options.commandKind),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
export function buildAnchorMutationData(result, options) {
|
|
129
|
+
return buildFamilyMutationData({
|
|
130
|
+
familyKind: "anchor",
|
|
131
|
+
familyStatus: result.status,
|
|
132
|
+
reusedExisting: result.reusedExisting,
|
|
133
|
+
currentStep: result.status === "confirmed" ? "confirmed" : "submitted",
|
|
134
|
+
tx1Txid: result.tx1Txid,
|
|
135
|
+
tx2Txid: result.tx2Txid,
|
|
136
|
+
intent: {
|
|
137
|
+
domainName: result.domainName,
|
|
138
|
+
dedicatedIndex: result.dedicatedIndex,
|
|
139
|
+
foundingMessageIncluded: options.foundingMessageText !== null,
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
export function buildDomainAdminMutationData(result, options) {
|
|
144
|
+
const data = buildSingleTxMutationData({
|
|
145
|
+
kind: options.commandKind,
|
|
146
|
+
localStatus: result.status,
|
|
147
|
+
txid: result.txid,
|
|
148
|
+
reusedExisting: result.reusedExisting,
|
|
149
|
+
intent: {
|
|
150
|
+
domainName: result.domainName,
|
|
151
|
+
recipientScriptPubKeyHex: result.recipientScriptPubKeyHex ?? null,
|
|
152
|
+
endpointValueHex: result.endpointValueHex ?? null,
|
|
153
|
+
endpointByteLength: result.endpointValueHex === null || result.endpointValueHex === undefined
|
|
154
|
+
? null
|
|
155
|
+
: result.endpointValueHex.length / 2,
|
|
156
|
+
},
|
|
157
|
+
journalKind: result.kind,
|
|
158
|
+
});
|
|
159
|
+
return {
|
|
160
|
+
...data,
|
|
161
|
+
resolved: buildDomainAdminResolvedJson(result),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
export function buildFieldMutationData(result) {
|
|
165
|
+
if (result.family) {
|
|
166
|
+
return {
|
|
167
|
+
...buildFamilyMutationData({
|
|
168
|
+
familyKind: "field",
|
|
169
|
+
familyStatus: result.status,
|
|
170
|
+
reusedExisting: result.reusedExisting,
|
|
171
|
+
currentStep: result.status === "confirmed" ? "confirmed" : "submitted",
|
|
172
|
+
tx1Txid: result.tx1Txid ?? null,
|
|
173
|
+
tx2Txid: result.tx2Txid ?? null,
|
|
174
|
+
intent: {
|
|
175
|
+
domainName: result.domainName,
|
|
176
|
+
fieldName: result.fieldName,
|
|
177
|
+
expectedFieldId: result.fieldId,
|
|
178
|
+
permanent: result.permanent,
|
|
179
|
+
format: result.format,
|
|
180
|
+
},
|
|
181
|
+
}),
|
|
182
|
+
resolved: buildFieldResolvedJson(result),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
...buildSingleTxMutationData({
|
|
187
|
+
kind: result.kind,
|
|
188
|
+
localStatus: result.status,
|
|
189
|
+
txid: result.txid,
|
|
190
|
+
reusedExisting: result.reusedExisting,
|
|
191
|
+
intent: {
|
|
192
|
+
domainName: result.domainName,
|
|
193
|
+
fieldName: result.fieldName,
|
|
194
|
+
fieldId: result.fieldId,
|
|
195
|
+
permanent: result.permanent,
|
|
196
|
+
format: result.format,
|
|
197
|
+
},
|
|
198
|
+
}),
|
|
199
|
+
resolved: buildFieldResolvedJson(result),
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
export function buildReputationMutationData(result) {
|
|
203
|
+
const data = buildSingleTxMutationData({
|
|
204
|
+
kind: result.kind === "give" ? "rep-give" : "rep-revoke",
|
|
205
|
+
localStatus: result.status,
|
|
206
|
+
txid: result.txid,
|
|
207
|
+
reusedExisting: result.reusedExisting,
|
|
208
|
+
intent: {
|
|
209
|
+
sourceDomainName: result.sourceDomainName,
|
|
210
|
+
targetDomainName: result.targetDomainName,
|
|
211
|
+
amountCogtoshi: result.amountCogtoshi.toString(),
|
|
212
|
+
reviewIncluded: result.reviewIncluded,
|
|
213
|
+
},
|
|
214
|
+
});
|
|
215
|
+
return {
|
|
216
|
+
...data,
|
|
217
|
+
resolved: buildReputationResolvedJson(result),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
export function buildWalletLockMutationData(result) {
|
|
221
|
+
const after = {
|
|
222
|
+
walletRootId: result.walletRootId,
|
|
223
|
+
locked: true,
|
|
224
|
+
};
|
|
225
|
+
return buildStateChangeData({
|
|
226
|
+
kind: "wallet-lock",
|
|
227
|
+
state: after,
|
|
228
|
+
after,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
export function buildInitMutationData(result) {
|
|
232
|
+
const after = {
|
|
233
|
+
walletRootId: result.walletRootId,
|
|
234
|
+
fundingAddress: result.fundingAddress,
|
|
235
|
+
unlockUntilUnixMs: result.unlockUntilUnixMs,
|
|
236
|
+
locked: false,
|
|
237
|
+
};
|
|
238
|
+
return buildStateChangeData({
|
|
239
|
+
kind: "init",
|
|
240
|
+
state: after,
|
|
241
|
+
before: null,
|
|
242
|
+
after,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
export function buildUnlockMutationData(result) {
|
|
246
|
+
const after = {
|
|
247
|
+
walletRootId: result.state.walletRootId,
|
|
248
|
+
locked: false,
|
|
249
|
+
unlockUntilUnixMs: result.unlockUntilUnixMs,
|
|
250
|
+
fundingAddress: result.state.funding.address,
|
|
251
|
+
source: result.source,
|
|
252
|
+
};
|
|
253
|
+
return buildStateChangeData({
|
|
254
|
+
kind: "unlock",
|
|
255
|
+
state: after,
|
|
256
|
+
after,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
export function buildWalletExportMutationData(result) {
|
|
260
|
+
const state = {
|
|
261
|
+
walletRootId: result.walletRootId,
|
|
262
|
+
archivePath: result.archivePath,
|
|
263
|
+
};
|
|
264
|
+
return buildOperationData({
|
|
265
|
+
kind: "wallet-export",
|
|
266
|
+
state,
|
|
267
|
+
operation: {
|
|
268
|
+
walletRootId: result.walletRootId,
|
|
269
|
+
archivePath: result.archivePath,
|
|
270
|
+
exportMode: "trusted-quiescent",
|
|
271
|
+
},
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
export function buildWalletImportMutationData(result) {
|
|
275
|
+
const after = {
|
|
276
|
+
walletRootId: result.walletRootId,
|
|
277
|
+
archivePath: result.archivePath,
|
|
278
|
+
fundingAddress: result.fundingAddress,
|
|
279
|
+
unlockUntilUnixMs: result.unlockUntilUnixMs,
|
|
280
|
+
};
|
|
281
|
+
return buildStateChangeData({
|
|
282
|
+
kind: "wallet-import",
|
|
283
|
+
state: after,
|
|
284
|
+
after,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
export function buildRepairMutationData(result) {
|
|
288
|
+
const after = {
|
|
289
|
+
walletRootId: result.walletRootId,
|
|
290
|
+
recoveredFromBackup: result.recoveredFromBackup,
|
|
291
|
+
recreatedManagedCoreWallet: result.recreatedManagedCoreWallet,
|
|
292
|
+
bitcoindServiceAction: result.bitcoindServiceAction,
|
|
293
|
+
bitcoindCompatibilityIssue: result.bitcoindCompatibilityIssue,
|
|
294
|
+
managedCoreReplicaAction: result.managedCoreReplicaAction,
|
|
295
|
+
bitcoindPostRepairHealth: result.bitcoindPostRepairHealth,
|
|
296
|
+
resetIndexerDatabase: result.resetIndexerDatabase,
|
|
297
|
+
indexerDaemonAction: result.indexerDaemonAction,
|
|
298
|
+
indexerCompatibilityIssue: result.indexerCompatibilityIssue,
|
|
299
|
+
indexerPostRepairHealth: result.indexerPostRepairHealth,
|
|
300
|
+
miningPreRepairRunMode: result.miningPreRepairRunMode,
|
|
301
|
+
miningResumeAction: result.miningResumeAction,
|
|
302
|
+
miningPostRepairRunMode: result.miningPostRepairRunMode,
|
|
303
|
+
miningResumeError: result.miningResumeError,
|
|
304
|
+
note: result.note,
|
|
305
|
+
};
|
|
306
|
+
return buildStateChangeData({
|
|
307
|
+
kind: "repair",
|
|
308
|
+
state: after,
|
|
309
|
+
after,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { CogMutationResult, DomainAdminMutationResult, DomainMarketMutationResult, FieldMutationResult, RegisterDomainResult, ReputationMutationResult } from "../wallet/tx/index.js";
|
|
2
|
+
export declare function decimalOrNull(value: bigint | null | undefined): string | null;
|
|
3
|
+
export declare function buildRegisterResolvedJson(result: RegisterDomainResult): {
|
|
4
|
+
path: "root" | "subdomain";
|
|
5
|
+
parentDomainName: string | null;
|
|
6
|
+
sender: {
|
|
7
|
+
selector: string;
|
|
8
|
+
localIndex: number;
|
|
9
|
+
scriptPubKeyHex: string;
|
|
10
|
+
address: string;
|
|
11
|
+
};
|
|
12
|
+
economicEffect: {
|
|
13
|
+
kind: "treasury-payment" | "cog-burn";
|
|
14
|
+
amount: string | null;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare function buildDomainMarketResolvedJson(result: DomainMarketMutationResult, commandKind: "transfer" | "sell" | "unsell" | "buy"): {
|
|
18
|
+
buyer: {
|
|
19
|
+
selector: string;
|
|
20
|
+
localIndex: number;
|
|
21
|
+
scriptPubKeyHex: string;
|
|
22
|
+
address: string;
|
|
23
|
+
} | null;
|
|
24
|
+
seller: {
|
|
25
|
+
scriptPubKeyHex: string;
|
|
26
|
+
address: string | null;
|
|
27
|
+
} | null;
|
|
28
|
+
sender?: undefined;
|
|
29
|
+
recipient?: undefined;
|
|
30
|
+
economicEffect?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
sender: {
|
|
33
|
+
selector: string;
|
|
34
|
+
localIndex: number;
|
|
35
|
+
scriptPubKeyHex: string;
|
|
36
|
+
address: string;
|
|
37
|
+
};
|
|
38
|
+
recipient: {
|
|
39
|
+
scriptPubKeyHex: string;
|
|
40
|
+
address: string | null;
|
|
41
|
+
opaque: boolean;
|
|
42
|
+
} | null;
|
|
43
|
+
economicEffect: {
|
|
44
|
+
kind: "ownership-transfer";
|
|
45
|
+
clearsListing: boolean;
|
|
46
|
+
listedPriceCogtoshi?: undefined;
|
|
47
|
+
} | {
|
|
48
|
+
kind: "listing-set" | "listing-clear";
|
|
49
|
+
listedPriceCogtoshi: string;
|
|
50
|
+
clearsListing?: undefined;
|
|
51
|
+
};
|
|
52
|
+
buyer?: undefined;
|
|
53
|
+
seller?: undefined;
|
|
54
|
+
} | null;
|
|
55
|
+
export declare function buildCogResolvedJson(result: CogMutationResult, commandKind: "send" | "claim" | "reclaim" | "cog-lock"): {
|
|
56
|
+
claimPath?: import("../wallet/tx/cog.js").CogResolvedClaimPath | null | undefined;
|
|
57
|
+
sender: {
|
|
58
|
+
selector: string;
|
|
59
|
+
localIndex: number;
|
|
60
|
+
scriptPubKeyHex: string;
|
|
61
|
+
address: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export declare function buildDomainAdminResolvedJson(result: DomainAdminMutationResult): {
|
|
65
|
+
sender: {
|
|
66
|
+
selector: string;
|
|
67
|
+
localIndex: number;
|
|
68
|
+
scriptPubKeyHex: string;
|
|
69
|
+
address: string;
|
|
70
|
+
};
|
|
71
|
+
target: {
|
|
72
|
+
scriptPubKeyHex: string;
|
|
73
|
+
address: string | null;
|
|
74
|
+
opaque: boolean;
|
|
75
|
+
} | null;
|
|
76
|
+
effect: {
|
|
77
|
+
kind: "endpoint-set";
|
|
78
|
+
byteLength: number;
|
|
79
|
+
} | {
|
|
80
|
+
kind: "endpoint-clear" | "delegate-set" | "delegate-clear" | "miner-set" | "miner-clear" | "canonicalize-owner";
|
|
81
|
+
byteLength?: undefined;
|
|
82
|
+
};
|
|
83
|
+
} | null;
|
|
84
|
+
export declare function buildFieldResolvedJson(result: FieldMutationResult): {
|
|
85
|
+
sender: {
|
|
86
|
+
selector: string;
|
|
87
|
+
localIndex: number;
|
|
88
|
+
scriptPubKeyHex: string;
|
|
89
|
+
address: string;
|
|
90
|
+
};
|
|
91
|
+
path: import("../wallet/tx/field.js").FieldResolvedPath;
|
|
92
|
+
value: {
|
|
93
|
+
format: number;
|
|
94
|
+
byteLength: number;
|
|
95
|
+
} | null;
|
|
96
|
+
effect: {
|
|
97
|
+
kind: "create-and-initialize-field";
|
|
98
|
+
tx1BurnCogtoshi: "100";
|
|
99
|
+
tx2AdditionalBurnCogtoshi: "1";
|
|
100
|
+
burnCogtoshi?: undefined;
|
|
101
|
+
} | {
|
|
102
|
+
kind: "create-empty-field" | "write-field-value" | "clear-field-value";
|
|
103
|
+
burnCogtoshi: "0" | "1" | "100";
|
|
104
|
+
tx1BurnCogtoshi?: undefined;
|
|
105
|
+
tx2AdditionalBurnCogtoshi?: undefined;
|
|
106
|
+
};
|
|
107
|
+
} | null;
|
|
108
|
+
export declare function buildReputationResolvedJson(result: ReputationMutationResult): {
|
|
109
|
+
sender: {
|
|
110
|
+
selector: string;
|
|
111
|
+
localIndex: number;
|
|
112
|
+
scriptPubKeyHex: string;
|
|
113
|
+
address: string;
|
|
114
|
+
};
|
|
115
|
+
effect: {
|
|
116
|
+
kind: "give-support" | "revoke-support";
|
|
117
|
+
burnCogtoshi: string;
|
|
118
|
+
};
|
|
119
|
+
review: {
|
|
120
|
+
included: boolean;
|
|
121
|
+
byteLength: number | null;
|
|
122
|
+
};
|
|
123
|
+
selfStake: boolean;
|
|
124
|
+
} | null;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
export function decimalOrNull(value) {
|
|
2
|
+
return value === null || value === undefined ? null : value.toString();
|
|
3
|
+
}
|
|
4
|
+
function buildResolvedSenderJson(sender) {
|
|
5
|
+
return {
|
|
6
|
+
selector: sender.selector,
|
|
7
|
+
localIndex: sender.localIndex,
|
|
8
|
+
scriptPubKeyHex: sender.scriptPubKeyHex,
|
|
9
|
+
address: sender.address,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function buildScriptTargetJson(target) {
|
|
13
|
+
return target === null || target === undefined
|
|
14
|
+
? null
|
|
15
|
+
: {
|
|
16
|
+
scriptPubKeyHex: target.scriptPubKeyHex,
|
|
17
|
+
address: target.address,
|
|
18
|
+
opaque: target.opaque,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function buildRegisterResolvedJson(result) {
|
|
22
|
+
return {
|
|
23
|
+
path: result.resolved.path,
|
|
24
|
+
parentDomainName: result.resolved.parentDomainName,
|
|
25
|
+
sender: buildResolvedSenderJson(result.resolved.sender),
|
|
26
|
+
economicEffect: {
|
|
27
|
+
kind: result.resolved.economicEffect.kind,
|
|
28
|
+
amount: decimalOrNull(result.resolved.economicEffect.amount),
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function buildDomainMarketResolvedJson(result, commandKind) {
|
|
33
|
+
if (commandKind === "buy") {
|
|
34
|
+
return {
|
|
35
|
+
buyer: result.resolvedBuyer === null || result.resolvedBuyer === undefined
|
|
36
|
+
? null
|
|
37
|
+
: buildResolvedSenderJson(result.resolvedBuyer),
|
|
38
|
+
seller: result.resolvedSeller === null || result.resolvedSeller === undefined
|
|
39
|
+
? null
|
|
40
|
+
: {
|
|
41
|
+
scriptPubKeyHex: result.resolvedSeller.scriptPubKeyHex,
|
|
42
|
+
address: result.resolvedSeller.address,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (result.resolved === null || result.resolved === undefined) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
sender: buildResolvedSenderJson(result.resolved.sender),
|
|
51
|
+
recipient: buildScriptTargetJson(result.resolved.recipient),
|
|
52
|
+
economicEffect: result.resolved.economicEffect.kind === "ownership-transfer"
|
|
53
|
+
? {
|
|
54
|
+
kind: result.resolved.economicEffect.kind,
|
|
55
|
+
clearsListing: result.resolved.economicEffect.clearsListing,
|
|
56
|
+
}
|
|
57
|
+
: {
|
|
58
|
+
kind: result.resolved.economicEffect.kind,
|
|
59
|
+
listedPriceCogtoshi: result.resolved.economicEffect.listedPriceCogtoshi,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export function buildCogResolvedJson(result, commandKind) {
|
|
64
|
+
return {
|
|
65
|
+
sender: buildResolvedSenderJson(result.resolved.sender),
|
|
66
|
+
...(commandKind === "claim" || commandKind === "reclaim"
|
|
67
|
+
? { claimPath: result.resolved.claimPath }
|
|
68
|
+
: {}),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export function buildDomainAdminResolvedJson(result) {
|
|
72
|
+
if (result.resolved === null || result.resolved === undefined) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
sender: buildResolvedSenderJson(result.resolved.sender),
|
|
77
|
+
target: buildScriptTargetJson(result.resolved.target),
|
|
78
|
+
effect: result.resolved.effect.kind === "endpoint-set"
|
|
79
|
+
? {
|
|
80
|
+
kind: result.resolved.effect.kind,
|
|
81
|
+
byteLength: result.resolved.effect.byteLength,
|
|
82
|
+
}
|
|
83
|
+
: {
|
|
84
|
+
kind: result.resolved.effect.kind,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export function buildFieldResolvedJson(result) {
|
|
89
|
+
if (result.resolved === null || result.resolved === undefined) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
sender: buildResolvedSenderJson(result.resolved.sender),
|
|
94
|
+
path: result.resolved.path,
|
|
95
|
+
value: result.resolved.value === null
|
|
96
|
+
? null
|
|
97
|
+
: {
|
|
98
|
+
format: result.resolved.value.format,
|
|
99
|
+
byteLength: result.resolved.value.byteLength,
|
|
100
|
+
},
|
|
101
|
+
effect: result.resolved.effect.kind === "create-and-initialize-field"
|
|
102
|
+
? {
|
|
103
|
+
kind: result.resolved.effect.kind,
|
|
104
|
+
tx1BurnCogtoshi: result.resolved.effect.tx1BurnCogtoshi,
|
|
105
|
+
tx2AdditionalBurnCogtoshi: result.resolved.effect.tx2AdditionalBurnCogtoshi,
|
|
106
|
+
}
|
|
107
|
+
: {
|
|
108
|
+
kind: result.resolved.effect.kind,
|
|
109
|
+
burnCogtoshi: result.resolved.effect.burnCogtoshi,
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export function buildReputationResolvedJson(result) {
|
|
114
|
+
if (result.resolved === null || result.resolved === undefined) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
sender: buildResolvedSenderJson(result.resolved.sender),
|
|
119
|
+
effect: {
|
|
120
|
+
kind: result.resolved.effect.kind,
|
|
121
|
+
burnCogtoshi: result.resolved.effect.burnCogtoshi,
|
|
122
|
+
},
|
|
123
|
+
review: {
|
|
124
|
+
included: result.resolved.review.included,
|
|
125
|
+
byteLength: result.resolved.review.byteLength,
|
|
126
|
+
},
|
|
127
|
+
selfStake: result.resolved.selfStake,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type MutationTextField } from "./mutation-text-write.js";
|
|
2
|
+
import type { ParsedCliArgs, RequiredCliRunnerContext } from "./types.js";
|
|
3
|
+
export interface MutationSuccessNextSteps {
|
|
4
|
+
json: string[];
|
|
5
|
+
text: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function commandMutationNextSteps(command: string): MutationSuccessNextSteps;
|
|
8
|
+
export declare function workflowMutationNextSteps(nextSteps: readonly string[]): MutationSuccessNextSteps;
|
|
9
|
+
export declare function writeMutationCommandSuccess(parsed: ParsedCliArgs, context: RequiredCliRunnerContext, options: {
|
|
10
|
+
data: unknown;
|
|
11
|
+
previewData?: unknown;
|
|
12
|
+
reusedExisting: boolean;
|
|
13
|
+
reusedMessage: string;
|
|
14
|
+
nextSteps: MutationSuccessNextSteps;
|
|
15
|
+
text: {
|
|
16
|
+
heading: string;
|
|
17
|
+
fields: MutationTextField[];
|
|
18
|
+
};
|
|
19
|
+
warnings?: string[];
|
|
20
|
+
}): number;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createPreviewSuccessEnvelope, createMutationSuccessEnvelope, describeCanonicalCommand, resolvePreviewJsonSchema, resolveStableMutationJsonSchema, writeJsonValue, } from "./output.js";
|
|
2
|
+
import { writeMutationTextResult, } from "./mutation-text-write.js";
|
|
3
|
+
import { formatNextStepLines } from "./workflow-hints.js";
|
|
4
|
+
export function commandMutationNextSteps(command) {
|
|
5
|
+
return {
|
|
6
|
+
json: [`Run \`${command}\`.`],
|
|
7
|
+
text: [`Next step: ${command}`],
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function workflowMutationNextSteps(nextSteps) {
|
|
11
|
+
return {
|
|
12
|
+
json: [...nextSteps],
|
|
13
|
+
text: formatNextStepLines(nextSteps),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function mutationOutcome(reusedExisting) {
|
|
17
|
+
return reusedExisting ? "reconciled" : "submitted";
|
|
18
|
+
}
|
|
19
|
+
function reuseExplanation(reusedExisting, message) {
|
|
20
|
+
return reusedExisting ? [message] : [];
|
|
21
|
+
}
|
|
22
|
+
export function writeMutationCommandSuccess(parsed, context, options) {
|
|
23
|
+
if (parsed.outputMode === "preview-json") {
|
|
24
|
+
writeJsonValue(context.stdout, createPreviewSuccessEnvelope(resolvePreviewJsonSchema(parsed), describeCanonicalCommand(parsed), mutationOutcome(options.reusedExisting), options.previewData ?? options.data, {
|
|
25
|
+
explanations: reuseExplanation(options.reusedExisting, options.reusedMessage),
|
|
26
|
+
nextSteps: options.nextSteps.json,
|
|
27
|
+
warnings: options.warnings,
|
|
28
|
+
}));
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
if (parsed.outputMode === "json") {
|
|
32
|
+
writeJsonValue(context.stdout, createMutationSuccessEnvelope(resolveStableMutationJsonSchema(parsed), describeCanonicalCommand(parsed), mutationOutcome(options.reusedExisting), options.data, {
|
|
33
|
+
explanations: reuseExplanation(options.reusedExisting, options.reusedMessage),
|
|
34
|
+
nextSteps: options.nextSteps.json,
|
|
35
|
+
warnings: options.warnings,
|
|
36
|
+
}));
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
writeMutationTextResult(context.stdout, {
|
|
40
|
+
heading: options.text.heading,
|
|
41
|
+
fields: options.text.fields,
|
|
42
|
+
reusedExisting: options.reusedExisting,
|
|
43
|
+
reusedMessage: options.reusedMessage,
|
|
44
|
+
trailerLines: options.nextSteps.text,
|
|
45
|
+
});
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CogMutationResult, DomainAdminMutationResult, DomainMarketMutationResult, FieldMutationResult, ReputationMutationResult, RegisterDomainResult } from "../wallet/tx/index.js";
|
|
2
|
+
export declare function formatRegisterSenderSummary(result: RegisterDomainResult): string;
|
|
3
|
+
export declare function formatRegisterEconomicEffect(result: RegisterDomainResult): string;
|
|
4
|
+
export declare function formatBuyBuyerSummary(result: DomainMarketMutationResult): string;
|
|
5
|
+
export declare function formatBuySellerSummary(result: DomainMarketMutationResult): string;
|
|
6
|
+
export declare function formatBuySettlementSummary(): string;
|
|
7
|
+
export declare function formatDomainMarketSenderSummary(result: DomainMarketMutationResult): string;
|
|
8
|
+
export declare function formatDomainMarketRecipientSummary(result: DomainMarketMutationResult): string;
|
|
9
|
+
export declare function formatDomainMarketEconomicEffect(result: DomainMarketMutationResult): string;
|
|
10
|
+
export declare function formatDomainAdminSenderSummary(result: DomainAdminMutationResult): string;
|
|
11
|
+
export declare function formatDomainAdminTargetSummary(result: DomainAdminMutationResult): string;
|
|
12
|
+
export declare function formatDomainAdminEffect(result: DomainAdminMutationResult): string;
|
|
13
|
+
export declare function formatDomainAdminPayloadSummary(result: DomainAdminMutationResult): string;
|
|
14
|
+
export declare function formatFieldSenderSummary(result: FieldMutationResult): string;
|
|
15
|
+
export declare function formatFieldPath(result: FieldMutationResult): string;
|
|
16
|
+
export declare function formatFieldValueSummary(result: FieldMutationResult): string;
|
|
17
|
+
export declare function formatFieldEffect(result: FieldMutationResult): string;
|
|
18
|
+
export declare function formatCogSenderSummary(result: CogMutationResult): string;
|
|
19
|
+
export declare function formatCogClaimPath(result: CogMutationResult): string;
|
|
20
|
+
export declare function formatReputationSenderSummary(result: ReputationMutationResult): string;
|
|
21
|
+
export declare function formatReputationReviewSummary(result: ReputationMutationResult): string;
|
|
22
|
+
export declare function formatReputationEffect(result: ReputationMutationResult): string;
|