@cogcoin/client 0.5.14 → 1.0.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/README.md +80 -25
- package/dist/app-paths.d.ts +5 -6
- package/dist/app-paths.js +8 -16
- package/dist/art/balance.txt +10 -0
- package/dist/art/welcome.txt +16 -0
- package/dist/bitcoind/bootstrap/controller.d.ts +1 -0
- package/dist/bitcoind/bootstrap/controller.js +53 -1
- package/dist/bitcoind/client/follow-block-times.d.ts +1 -0
- package/dist/bitcoind/client/follow-block-times.js +1 -1
- package/dist/bitcoind/client/internal-types.d.ts +7 -3
- package/dist/bitcoind/client/managed-client.d.ts +4 -2
- package/dist/bitcoind/client/managed-client.js +14 -0
- package/dist/bitcoind/client/sync-engine.js +72 -11
- package/dist/bitcoind/hash-order.d.ts +4 -0
- package/dist/bitcoind/hash-order.js +13 -0
- package/dist/bitcoind/indexer-daemon-main.js +11 -3
- package/dist/bitcoind/normalize.js +3 -2
- package/dist/bitcoind/processing-start-height.d.ts +5 -0
- package/dist/bitcoind/processing-start-height.js +7 -0
- package/dist/bitcoind/progress/constants.d.ts +4 -0
- package/dist/bitcoind/progress/constants.js +4 -0
- package/dist/bitcoind/progress/controller.d.ts +2 -1
- package/dist/bitcoind/progress/controller.js +3 -3
- package/dist/bitcoind/progress/follow-scene.d.ts +6 -2
- package/dist/bitcoind/progress/follow-scene.js +29 -6
- package/dist/bitcoind/progress/formatting.d.ts +1 -0
- package/dist/bitcoind/progress/formatting.js +6 -0
- package/dist/bitcoind/progress/train-scene.js +37 -18
- package/dist/bitcoind/progress/tty-renderer.d.ts +6 -1
- package/dist/bitcoind/progress/tty-renderer.js +8 -4
- package/dist/bitcoind/rpc.d.ts +2 -1
- package/dist/bitcoind/rpc.js +3 -0
- package/dist/bitcoind/types.d.ts +16 -0
- package/dist/bytes.d.ts +1 -0
- package/dist/bytes.js +3 -0
- package/dist/cli/art.d.ts +2 -0
- package/dist/cli/art.js +37 -0
- package/dist/cli/commands/client-admin.d.ts +2 -0
- package/dist/cli/commands/client-admin.js +91 -0
- package/dist/cli/commands/follow.js +0 -2
- package/dist/cli/commands/mining-admin.js +6 -47
- package/dist/cli/commands/mining-read.js +11 -50
- package/dist/cli/commands/mining-runtime.js +38 -3
- package/dist/cli/commands/service-runtime.js +0 -2
- package/dist/cli/commands/status.js +8 -2
- package/dist/cli/commands/sync.js +51 -4
- package/dist/cli/commands/wallet-admin.js +142 -136
- package/dist/cli/commands/wallet-mutation.js +91 -79
- package/dist/cli/commands/wallet-read.js +15 -18
- package/dist/cli/context.js +4 -14
- package/dist/cli/mining-format.d.ts +0 -1
- package/dist/cli/mining-format.js +5 -37
- package/dist/cli/mining-json.d.ts +0 -18
- package/dist/cli/mining-json.js +0 -35
- package/dist/cli/mutation-command-groups.d.ts +1 -2
- package/dist/cli/mutation-command-groups.js +0 -5
- package/dist/cli/mutation-json.d.ts +24 -145
- package/dist/cli/mutation-json.js +30 -136
- package/dist/cli/mutation-resolved-json.d.ts +0 -7
- package/dist/cli/mutation-resolved-json.js +4 -10
- package/dist/cli/mutation-success.d.ts +2 -0
- package/dist/cli/mutation-success.js +11 -1
- package/dist/cli/mutation-text-format.js +1 -3
- package/dist/cli/output.d.ts +1 -1
- package/dist/cli/output.js +254 -231
- package/dist/cli/parse.d.ts +1 -1
- package/dist/cli/parse.js +93 -122
- package/dist/cli/preview-json.d.ts +17 -120
- package/dist/cli/preview-json.js +14 -97
- package/dist/cli/prompt.js +8 -13
- package/dist/cli/read-json.d.ts +15 -37
- package/dist/cli/read-json.js +44 -140
- package/dist/cli/runner.js +10 -13
- package/dist/cli/types.d.ts +8 -17
- package/dist/cli/types.js +0 -2
- package/dist/cli/wallet-format.d.ts +1 -0
- package/dist/cli/wallet-format.js +205 -144
- package/dist/cli/workflow-hints.d.ts +3 -3
- package/dist/cli/workflow-hints.js +11 -8
- package/dist/client/default-client.d.ts +3 -1
- package/dist/client/default-client.js +45 -2
- package/dist/client/factory.js +1 -1
- package/dist/client/initialization.js +23 -0
- package/dist/client/persistence.js +5 -5
- package/dist/client/store-adapter.js +1 -0
- package/dist/sqlite/checkpoints.d.ts +1 -0
- package/dist/sqlite/checkpoints.js +7 -0
- package/dist/sqlite/store.js +14 -1
- package/dist/types.d.ts +1 -0
- package/dist/wallet/coin-control.d.ts +41 -11
- package/dist/wallet/coin-control.js +100 -357
- package/dist/wallet/descriptor-normalization.d.ts +1 -3
- package/dist/wallet/descriptor-normalization.js +0 -16
- package/dist/wallet/lifecycle.d.ts +7 -99
- package/dist/wallet/lifecycle.js +513 -968
- package/dist/wallet/managed-core-wallet.d.ts +13 -0
- package/dist/wallet/managed-core-wallet.js +20 -0
- package/dist/wallet/mining/constants.d.ts +5 -12
- package/dist/wallet/mining/constants.js +5 -12
- package/dist/wallet/mining/control.d.ts +1 -13
- package/dist/wallet/mining/control.js +45 -349
- package/dist/wallet/mining/index.d.ts +3 -4
- package/dist/wallet/mining/index.js +1 -2
- package/dist/wallet/mining/runner.d.ts +179 -6
- package/dist/wallet/mining/runner.js +891 -501
- package/dist/wallet/mining/runtime-artifacts.js +23 -3
- package/dist/wallet/mining/sentence-protocol.d.ts +44 -0
- package/dist/wallet/mining/sentence-protocol.js +123 -0
- package/dist/wallet/mining/sentences.d.ts +4 -8
- package/dist/wallet/mining/sentences.js +3 -52
- package/dist/wallet/mining/state.d.ts +11 -6
- package/dist/wallet/mining/state.js +7 -6
- package/dist/wallet/mining/types.d.ts +2 -30
- package/dist/wallet/mining/visualizer.d.ts +31 -3
- package/dist/wallet/mining/visualizer.js +135 -13
- package/dist/wallet/read/context.d.ts +0 -2
- package/dist/wallet/read/context.js +119 -140
- package/dist/wallet/read/filter.js +2 -11
- package/dist/wallet/read/index.d.ts +1 -1
- package/dist/wallet/read/project.js +24 -77
- package/dist/wallet/read/types.d.ts +10 -25
- package/dist/wallet/reset.d.ts +0 -1
- package/dist/wallet/reset.js +60 -138
- package/dist/wallet/root-resolution.d.ts +1 -5
- package/dist/wallet/root-resolution.js +0 -18
- package/dist/wallet/runtime.d.ts +0 -6
- package/dist/wallet/runtime.js +0 -8
- package/dist/wallet/state/client-password-agent.js +208 -0
- package/dist/wallet/state/client-password.d.ts +65 -0
- package/dist/wallet/state/client-password.js +952 -0
- package/dist/wallet/state/crypto.d.ts +1 -20
- package/dist/wallet/state/crypto.js +0 -63
- package/dist/wallet/state/provider.d.ts +23 -11
- package/dist/wallet/state/provider.js +248 -290
- package/dist/wallet/state/storage.d.ts +2 -2
- package/dist/wallet/state/storage.js +48 -16
- package/dist/wallet/tx/anchor.d.ts +3 -28
- package/dist/wallet/tx/anchor.js +349 -1240
- package/dist/wallet/tx/bitcoin-transfer.d.ts +35 -0
- package/dist/wallet/tx/bitcoin-transfer.js +200 -0
- package/dist/wallet/tx/cog.d.ts +5 -1
- package/dist/wallet/tx/cog.js +149 -185
- package/dist/wallet/tx/common.d.ts +74 -10
- package/dist/wallet/tx/common.js +315 -138
- package/dist/wallet/tx/domain-admin.d.ts +3 -1
- package/dist/wallet/tx/domain-admin.js +61 -99
- package/dist/wallet/tx/domain-market.d.ts +5 -1
- package/dist/wallet/tx/domain-market.js +221 -228
- package/dist/wallet/tx/field.d.ts +4 -10
- package/dist/wallet/tx/field.js +84 -914
- package/dist/wallet/tx/identity-selector.d.ts +9 -3
- package/dist/wallet/tx/identity-selector.js +17 -35
- package/dist/wallet/tx/index.d.ts +3 -1
- package/dist/wallet/tx/index.js +2 -1
- package/dist/wallet/tx/register.d.ts +3 -1
- package/dist/wallet/tx/register.js +62 -220
- package/dist/wallet/tx/reputation.d.ts +3 -1
- package/dist/wallet/tx/reputation.js +58 -95
- package/dist/wallet/types.d.ts +8 -122
- package/package.json +5 -5
- package/dist/wallet/archive.d.ts +0 -4
- package/dist/wallet/archive.js +0 -41
- package/dist/wallet/mining/hook-protocol.d.ts +0 -47
- package/dist/wallet/mining/hook-protocol.js +0 -161
- package/dist/wallet/mining/hook-runner.js +0 -52
- package/dist/wallet/mining/hooks.d.ts +0 -38
- package/dist/wallet/mining/hooks.js +0 -520
- package/dist/wallet/state/explicit-lock.d.ts +0 -4
- package/dist/wallet/state/explicit-lock.js +0 -19
- package/dist/wallet/state/session.d.ts +0 -12
- package/dist/wallet/state/session.js +0 -23
- /package/dist/wallet/{mining/hook-runner.d.ts → state/client-password-agent.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parseCogAmountToCogtoshi, } from "../../wallet/tx/index.js";
|
|
2
|
-
import { buildAnchorMutationData,
|
|
3
|
-
import { buildAnchorPreviewData,
|
|
4
|
-
import {
|
|
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
5
|
import { commandMutationNextSteps, workflowMutationNextSteps, writeMutationCommandSuccess, } from "../mutation-success.js";
|
|
6
6
|
import { writeLine } from "../io.js";
|
|
7
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";
|
|
@@ -9,6 +9,7 @@ import { createTerminalPrompter } from "../prompt.js";
|
|
|
9
9
|
import { writeHandledCliError } from "../output.js";
|
|
10
10
|
import { getAnchorNextSteps, getRegisterNextSteps, } from "../workflow-hints.js";
|
|
11
11
|
import { createOwnedLockCleanupSignalWatcher, waitForCompletionOrStop, } from "../signals.js";
|
|
12
|
+
import { withInteractiveWalletSecretProvider } from "../../wallet/state/provider.js";
|
|
12
13
|
function createFieldValueSource(parsed) {
|
|
13
14
|
if (parsed.endpointText !== null) {
|
|
14
15
|
return { kind: "text", value: parsed.endpointText };
|
|
@@ -40,7 +41,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
40
41
|
]);
|
|
41
42
|
try {
|
|
42
43
|
const outcome = await waitForCompletionOrStop((async () => {
|
|
43
|
-
if (!isWalletMutationCommand(parsed.command)) {
|
|
44
|
+
if (parsed.command !== "bitcoin-transfer" && !isWalletMutationCommand(parsed.command)) {
|
|
44
45
|
writeLine(context.stderr, `wallet mutation command not implemented: ${parsed.command}`);
|
|
45
46
|
return 1;
|
|
46
47
|
}
|
|
@@ -48,35 +49,33 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
48
49
|
const dbPath = parsed.dbPath ?? context.resolveDefaultClientDatabasePath();
|
|
49
50
|
const prompter = createCommandPrompter(parsed, context);
|
|
50
51
|
const interactive = prompter.isInteractive;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const provider = withInteractiveWalletSecretProvider(context.walletSecretProvider, prompter);
|
|
53
|
+
if (parsed.command === "bitcoin-transfer") {
|
|
54
|
+
const result = await context.transferBitcoin({
|
|
55
|
+
amountSatsText: parsed.args[0],
|
|
56
|
+
target: parsed.transferTarget,
|
|
54
57
|
dataDir,
|
|
55
58
|
databasePath: dbPath,
|
|
56
|
-
provider
|
|
59
|
+
provider,
|
|
57
60
|
prompter,
|
|
58
61
|
assumeYes: parsed.assumeYes,
|
|
59
62
|
paths: runtimePaths,
|
|
60
63
|
});
|
|
61
|
-
const nextSteps = result.cleared
|
|
62
|
-
? workflowMutationNextSteps([`cogcoin show ${result.domainName}`, `cogcoin anchor ${result.domainName}`])
|
|
63
|
-
: commandMutationNextSteps(`cogcoin show ${result.domainName}`);
|
|
64
64
|
return writeMutationCommandSuccess(parsed, context, {
|
|
65
|
-
data:
|
|
66
|
-
previewData: buildAnchorClearPreviewData(result),
|
|
65
|
+
data: buildBitcoinTransferData(result),
|
|
67
66
|
reusedExisting: false,
|
|
68
67
|
reusedMessage: "",
|
|
69
68
|
interactive,
|
|
70
|
-
|
|
71
|
-
nextSteps,
|
|
69
|
+
explorerTxid: result.txid,
|
|
70
|
+
nextSteps: workflowMutationNextSteps([]),
|
|
72
71
|
text: {
|
|
73
|
-
heading:
|
|
72
|
+
heading: "Bitcoin transfer submitted.",
|
|
74
73
|
fields: [
|
|
75
|
-
{ label: "
|
|
76
|
-
{ label: "
|
|
77
|
-
{ label: "
|
|
78
|
-
{ label: "
|
|
79
|
-
{ label: "
|
|
74
|
+
{ label: "Sender", value: result.senderAddress },
|
|
75
|
+
{ label: "Recipient", value: result.recipientAddress },
|
|
76
|
+
{ label: "Amount", value: `${result.amountSats.toString()} sats` },
|
|
77
|
+
{ label: "Fee", value: `${result.feeSats.toString()} sats` },
|
|
78
|
+
{ label: "Txid", value: result.txid },
|
|
80
79
|
],
|
|
81
80
|
},
|
|
82
81
|
});
|
|
@@ -86,9 +85,10 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
86
85
|
domainName: parsed.args[0],
|
|
87
86
|
foundingMessageText: parsed.anchorMessage,
|
|
88
87
|
promptForFoundingMessageWhenMissing: parsed.anchorMessage === null,
|
|
88
|
+
feeRateSatVb: parsed.satvb,
|
|
89
89
|
dataDir,
|
|
90
90
|
databasePath: dbPath,
|
|
91
|
-
provider
|
|
91
|
+
provider,
|
|
92
92
|
prompter,
|
|
93
93
|
paths: runtimePaths,
|
|
94
94
|
});
|
|
@@ -101,18 +101,17 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
101
101
|
foundingMessageText: result.foundingMessageText ?? parsed.anchorMessage,
|
|
102
102
|
}),
|
|
103
103
|
reusedExisting: result.reusedExisting,
|
|
104
|
-
reusedMessage: "The existing anchor
|
|
104
|
+
reusedMessage: "The existing pending anchor was reconciled instead of creating a duplicate.",
|
|
105
|
+
fees: result.fees,
|
|
105
106
|
interactive,
|
|
106
|
-
explorerTxid: result.
|
|
107
|
+
explorerTxid: result.txid,
|
|
107
108
|
nextSteps: workflowMutationNextSteps(nextSteps),
|
|
108
109
|
text: {
|
|
109
|
-
heading: "Anchor
|
|
110
|
+
heading: "Anchor submitted.",
|
|
110
111
|
fields: [
|
|
111
112
|
{ label: "Domain", value: result.domainName },
|
|
112
|
-
{ label: "Dedicated index", value: String(result.dedicatedIndex) },
|
|
113
113
|
{ label: "Status", value: result.status },
|
|
114
|
-
{ label: "
|
|
115
|
-
{ label: "Tx2", value: result.tx2Txid },
|
|
114
|
+
{ label: "Txid", value: result.txid },
|
|
116
115
|
],
|
|
117
116
|
},
|
|
118
117
|
});
|
|
@@ -120,11 +119,11 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
120
119
|
if (isRegisterMutationCommand(parsed.command)) {
|
|
121
120
|
const result = await context.registerDomain({
|
|
122
121
|
domainName: parsed.args[0],
|
|
122
|
+
feeRateSatVb: parsed.satvb,
|
|
123
123
|
dataDir,
|
|
124
124
|
databasePath: dbPath,
|
|
125
125
|
forceRace: parsed.forceRace,
|
|
126
|
-
|
|
127
|
-
provider: context.walletSecretProvider,
|
|
126
|
+
provider,
|
|
128
127
|
prompter,
|
|
129
128
|
assumeYes: parsed.assumeYes,
|
|
130
129
|
paths: runtimePaths,
|
|
@@ -133,14 +132,13 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
133
132
|
return writeMutationCommandSuccess(parsed, context, {
|
|
134
133
|
data: buildRegisterMutationData(result, {
|
|
135
134
|
forceRace: parsed.forceRace,
|
|
136
|
-
fromIdentity: parsed.fromIdentity,
|
|
137
135
|
}),
|
|
138
136
|
previewData: buildRegisterPreviewData(result, {
|
|
139
137
|
forceRace: parsed.forceRace,
|
|
140
|
-
fromIdentity: parsed.fromIdentity,
|
|
141
138
|
}),
|
|
142
139
|
reusedExisting: result.reusedExisting,
|
|
143
140
|
reusedMessage: "The existing pending registration was reconciled instead of creating a duplicate.",
|
|
141
|
+
fees: result.fees,
|
|
144
142
|
interactive,
|
|
145
143
|
explorerTxid: result.txid,
|
|
146
144
|
nextSteps: workflowMutationNextSteps(nextSteps),
|
|
@@ -162,9 +160,10 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
162
160
|
const result = await context.transferDomain({
|
|
163
161
|
domainName: parsed.args[0],
|
|
164
162
|
target: parsed.transferTarget,
|
|
163
|
+
feeRateSatVb: parsed.satvb,
|
|
165
164
|
dataDir,
|
|
166
165
|
databasePath: dbPath,
|
|
167
|
-
provider
|
|
166
|
+
provider,
|
|
168
167
|
prompter,
|
|
169
168
|
assumeYes: parsed.assumeYes,
|
|
170
169
|
paths: runtimePaths,
|
|
@@ -178,6 +177,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
178
177
|
}),
|
|
179
178
|
reusedExisting: result.reusedExisting,
|
|
180
179
|
reusedMessage: "The existing pending transfer was reconciled instead of creating a duplicate.",
|
|
180
|
+
fees: result.fees,
|
|
181
181
|
interactive,
|
|
182
182
|
explorerTxid: result.txid,
|
|
183
183
|
nextSteps: commandMutationNextSteps(`cogcoin show ${result.domainName}`),
|
|
@@ -201,9 +201,10 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
201
201
|
const result = await context.sellDomain({
|
|
202
202
|
domainName: parsed.args[0],
|
|
203
203
|
listedPriceCogtoshi,
|
|
204
|
+
feeRateSatVb: parsed.satvb,
|
|
204
205
|
dataDir,
|
|
205
206
|
databasePath: dbPath,
|
|
206
|
-
provider
|
|
207
|
+
provider,
|
|
207
208
|
prompter,
|
|
208
209
|
assumeYes: parsed.assumeYes,
|
|
209
210
|
paths: runtimePaths,
|
|
@@ -217,6 +218,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
217
218
|
}),
|
|
218
219
|
reusedExisting: result.reusedExisting,
|
|
219
220
|
reusedMessage: "The existing pending listing mutation was reconciled instead of creating a duplicate.",
|
|
221
|
+
fees: result.fees,
|
|
220
222
|
interactive,
|
|
221
223
|
explorerTxid: result.txid,
|
|
222
224
|
nextSteps: commandMutationNextSteps(`cogcoin show ${result.domainName}`),
|
|
@@ -242,18 +244,20 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
242
244
|
: parsed.endpointJson !== null
|
|
243
245
|
? { kind: "json", value: parsed.endpointJson }
|
|
244
246
|
: { kind: "bytes", value: parsed.endpointBytes },
|
|
247
|
+
feeRateSatVb: parsed.satvb,
|
|
245
248
|
dataDir,
|
|
246
249
|
databasePath: dbPath,
|
|
247
|
-
provider
|
|
250
|
+
provider,
|
|
248
251
|
prompter,
|
|
249
252
|
assumeYes: parsed.assumeYes,
|
|
250
253
|
paths: runtimePaths,
|
|
251
254
|
})
|
|
252
255
|
: await context.clearDomainEndpoint({
|
|
253
256
|
domainName: parsed.args[0],
|
|
257
|
+
feeRateSatVb: parsed.satvb,
|
|
254
258
|
dataDir,
|
|
255
259
|
databasePath: dbPath,
|
|
256
|
-
provider
|
|
260
|
+
provider,
|
|
257
261
|
prompter,
|
|
258
262
|
assumeYes: parsed.assumeYes,
|
|
259
263
|
paths: runtimePaths,
|
|
@@ -267,6 +271,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
267
271
|
}),
|
|
268
272
|
reusedExisting: result.reusedExisting,
|
|
269
273
|
reusedMessage: "The existing pending endpoint mutation was reconciled instead of creating a duplicate.",
|
|
274
|
+
fees: result.fees,
|
|
270
275
|
interactive,
|
|
271
276
|
explorerTxid: result.txid,
|
|
272
277
|
nextSteps: commandMutationNextSteps(`cogcoin show ${result.domainName}`),
|
|
@@ -288,18 +293,20 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
288
293
|
? await context.setDomainDelegate({
|
|
289
294
|
domainName: parsed.args[0],
|
|
290
295
|
target: parsed.args[1],
|
|
296
|
+
feeRateSatVb: parsed.satvb,
|
|
291
297
|
dataDir,
|
|
292
298
|
databasePath: dbPath,
|
|
293
|
-
provider
|
|
299
|
+
provider,
|
|
294
300
|
prompter,
|
|
295
301
|
assumeYes: parsed.assumeYes,
|
|
296
302
|
paths: runtimePaths,
|
|
297
303
|
})
|
|
298
304
|
: await context.clearDomainDelegate({
|
|
299
305
|
domainName: parsed.args[0],
|
|
306
|
+
feeRateSatVb: parsed.satvb,
|
|
300
307
|
dataDir,
|
|
301
308
|
databasePath: dbPath,
|
|
302
|
-
provider
|
|
309
|
+
provider,
|
|
303
310
|
prompter,
|
|
304
311
|
assumeYes: parsed.assumeYes,
|
|
305
312
|
paths: runtimePaths,
|
|
@@ -313,6 +320,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
313
320
|
}),
|
|
314
321
|
reusedExisting: result.reusedExisting,
|
|
315
322
|
reusedMessage: "The existing pending delegate mutation was reconciled instead of creating a duplicate.",
|
|
323
|
+
fees: result.fees,
|
|
316
324
|
interactive,
|
|
317
325
|
explorerTxid: result.txid,
|
|
318
326
|
nextSteps: commandMutationNextSteps(`cogcoin show ${result.domainName}`),
|
|
@@ -334,18 +342,20 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
334
342
|
? await context.setDomainMiner({
|
|
335
343
|
domainName: parsed.args[0],
|
|
336
344
|
target: parsed.args[1],
|
|
345
|
+
feeRateSatVb: parsed.satvb,
|
|
337
346
|
dataDir,
|
|
338
347
|
databasePath: dbPath,
|
|
339
|
-
provider
|
|
348
|
+
provider,
|
|
340
349
|
prompter,
|
|
341
350
|
assumeYes: parsed.assumeYes,
|
|
342
351
|
paths: runtimePaths,
|
|
343
352
|
})
|
|
344
353
|
: await context.clearDomainMiner({
|
|
345
354
|
domainName: parsed.args[0],
|
|
355
|
+
feeRateSatVb: parsed.satvb,
|
|
346
356
|
dataDir,
|
|
347
357
|
databasePath: dbPath,
|
|
348
|
-
provider
|
|
358
|
+
provider,
|
|
349
359
|
prompter,
|
|
350
360
|
assumeYes: parsed.assumeYes,
|
|
351
361
|
paths: runtimePaths,
|
|
@@ -359,6 +369,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
359
369
|
}),
|
|
360
370
|
reusedExisting: result.reusedExisting,
|
|
361
371
|
reusedMessage: "The existing pending miner mutation was reconciled instead of creating a duplicate.",
|
|
372
|
+
fees: result.fees,
|
|
362
373
|
interactive,
|
|
363
374
|
explorerTxid: result.txid,
|
|
364
375
|
nextSteps: commandMutationNextSteps(`cogcoin show ${result.domainName}`),
|
|
@@ -378,9 +389,10 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
378
389
|
if (parsed.command === "domain-canonical") {
|
|
379
390
|
const result = await context.setDomainCanonical({
|
|
380
391
|
domainName: parsed.args[0],
|
|
392
|
+
feeRateSatVb: parsed.satvb,
|
|
381
393
|
dataDir,
|
|
382
394
|
databasePath: dbPath,
|
|
383
|
-
provider
|
|
395
|
+
provider,
|
|
384
396
|
prompter,
|
|
385
397
|
assumeYes: parsed.assumeYes,
|
|
386
398
|
paths: runtimePaths,
|
|
@@ -394,6 +406,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
394
406
|
}),
|
|
395
407
|
reusedExisting: result.reusedExisting,
|
|
396
408
|
reusedMessage: "The existing pending canonical mutation was reconciled instead of creating a duplicate.",
|
|
409
|
+
fees: result.fees,
|
|
397
410
|
interactive,
|
|
398
411
|
explorerTxid: result.txid,
|
|
399
412
|
nextSteps: commandMutationNextSteps(`cogcoin show ${result.domainName}`),
|
|
@@ -414,15 +427,10 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
414
427
|
domainName: parsed.args[0],
|
|
415
428
|
fieldName: parsed.args[1],
|
|
416
429
|
permanent: parsed.fieldPermanent,
|
|
417
|
-
|
|
418
|
-
|| parsed.endpointJson !== null
|
|
419
|
-
|| parsed.endpointBytes !== null
|
|
420
|
-
|| parsed.fieldFormat !== null)
|
|
421
|
-
? createFieldValueSource(parsed)
|
|
422
|
-
: null,
|
|
430
|
+
feeRateSatVb: parsed.satvb,
|
|
423
431
|
dataDir,
|
|
424
432
|
databasePath: dbPath,
|
|
425
|
-
provider
|
|
433
|
+
provider,
|
|
426
434
|
prompter,
|
|
427
435
|
assumeYes: parsed.assumeYes,
|
|
428
436
|
paths: runtimePaths,
|
|
@@ -431,14 +439,16 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
431
439
|
data: buildFieldMutationData(result),
|
|
432
440
|
previewData: buildFieldPreviewData(result),
|
|
433
441
|
reusedExisting: result.reusedExisting,
|
|
434
|
-
reusedMessage:
|
|
435
|
-
|
|
436
|
-
: "The existing pending field creation was reconciled instead of creating a duplicate.",
|
|
442
|
+
reusedMessage: "The existing pending field creation was reconciled instead of creating a duplicate.",
|
|
443
|
+
fees: result.fees,
|
|
437
444
|
interactive,
|
|
438
|
-
explorerTxid: result.
|
|
439
|
-
nextSteps:
|
|
445
|
+
explorerTxid: result.txid,
|
|
446
|
+
nextSteps: workflowMutationNextSteps([
|
|
447
|
+
`cogcoin field show ${result.domainName} ${result.fieldName}`,
|
|
448
|
+
`cogcoin field set ${result.domainName} ${result.fieldName} --text <value>`,
|
|
449
|
+
]),
|
|
440
450
|
text: {
|
|
441
|
-
heading:
|
|
451
|
+
heading: "Field creation submitted.",
|
|
442
452
|
fields: [
|
|
443
453
|
{ label: "Domain", value: result.domainName },
|
|
444
454
|
{ label: "Field", value: result.fieldName },
|
|
@@ -447,9 +457,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
447
457
|
{ label: "Value", value: formatFieldValueSummary(result), when: result.resolved?.value !== null && result.resolved?.value !== undefined },
|
|
448
458
|
{ label: "Effect", value: formatFieldEffect(result) },
|
|
449
459
|
{ label: "Status", value: result.status },
|
|
450
|
-
{ label: "
|
|
451
|
-
{ label: "Tx2", value: result.tx2Txid ?? "unknown", when: result.family },
|
|
452
|
-
{ label: "Txid", value: result.txid, when: !result.family },
|
|
460
|
+
{ label: "Txid", value: result.txid },
|
|
453
461
|
],
|
|
454
462
|
},
|
|
455
463
|
});
|
|
@@ -459,9 +467,10 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
459
467
|
domainName: parsed.args[0],
|
|
460
468
|
fieldName: parsed.args[1],
|
|
461
469
|
source: createFieldValueSource(parsed),
|
|
470
|
+
feeRateSatVb: parsed.satvb,
|
|
462
471
|
dataDir,
|
|
463
472
|
databasePath: dbPath,
|
|
464
|
-
provider
|
|
473
|
+
provider,
|
|
465
474
|
prompter,
|
|
466
475
|
assumeYes: parsed.assumeYes,
|
|
467
476
|
paths: runtimePaths,
|
|
@@ -471,6 +480,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
471
480
|
previewData: buildFieldPreviewData(result),
|
|
472
481
|
reusedExisting: result.reusedExisting,
|
|
473
482
|
reusedMessage: "The existing pending field update was reconciled instead of creating a duplicate.",
|
|
483
|
+
fees: result.fees,
|
|
474
484
|
interactive,
|
|
475
485
|
explorerTxid: result.txid,
|
|
476
486
|
nextSteps: commandMutationNextSteps(`cogcoin field show ${result.domainName} ${result.fieldName}`),
|
|
@@ -492,9 +502,10 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
492
502
|
const result = await context.clearField({
|
|
493
503
|
domainName: parsed.args[0],
|
|
494
504
|
fieldName: parsed.args[1],
|
|
505
|
+
feeRateSatVb: parsed.satvb,
|
|
495
506
|
dataDir,
|
|
496
507
|
databasePath: dbPath,
|
|
497
|
-
provider
|
|
508
|
+
provider,
|
|
498
509
|
prompter,
|
|
499
510
|
assumeYes: parsed.assumeYes,
|
|
500
511
|
paths: runtimePaths,
|
|
@@ -504,6 +515,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
504
515
|
previewData: buildFieldPreviewData(result),
|
|
505
516
|
reusedExisting: result.reusedExisting,
|
|
506
517
|
reusedMessage: "The existing pending field clear was reconciled instead of creating a duplicate.",
|
|
518
|
+
fees: result.fees,
|
|
507
519
|
interactive,
|
|
508
520
|
explorerTxid: result.txid,
|
|
509
521
|
nextSteps: commandMutationNextSteps(`cogcoin field show ${result.domainName} ${result.fieldName}`),
|
|
@@ -524,10 +536,10 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
524
536
|
const result = await context.sendCog({
|
|
525
537
|
amountCogtoshi: parseCogAmountToCogtoshi(parsed.args[0]),
|
|
526
538
|
target: parsed.transferTarget,
|
|
527
|
-
|
|
539
|
+
feeRateSatVb: parsed.satvb,
|
|
528
540
|
dataDir,
|
|
529
541
|
databasePath: dbPath,
|
|
530
|
-
provider
|
|
542
|
+
provider,
|
|
531
543
|
prompter,
|
|
532
544
|
assumeYes: parsed.assumeYes,
|
|
533
545
|
paths: runtimePaths,
|
|
@@ -535,14 +547,13 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
535
547
|
return writeMutationCommandSuccess(parsed, context, {
|
|
536
548
|
data: buildCogMutationData(result, {
|
|
537
549
|
commandKind: "send",
|
|
538
|
-
fromIdentity: parsed.fromIdentity,
|
|
539
550
|
}),
|
|
540
551
|
previewData: buildCogPreviewData(result, {
|
|
541
552
|
commandKind: "send",
|
|
542
|
-
fromIdentity: parsed.fromIdentity,
|
|
543
553
|
}),
|
|
544
554
|
reusedExisting: result.reusedExisting,
|
|
545
555
|
reusedMessage: "The existing pending COG transfer was reconciled instead of creating a duplicate.",
|
|
556
|
+
fees: result.fees,
|
|
546
557
|
interactive,
|
|
547
558
|
explorerTxid: result.txid,
|
|
548
559
|
nextSteps: commandMutationNextSteps("cogcoin balance"),
|
|
@@ -562,13 +573,13 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
562
573
|
const result = await context.lockCogToDomain({
|
|
563
574
|
amountCogtoshi: parseCogAmountToCogtoshi(parsed.args[0]),
|
|
564
575
|
recipientDomainName: parsed.lockRecipientDomain,
|
|
565
|
-
fromIdentity: parsed.fromIdentity,
|
|
566
576
|
timeoutBlocksOrDuration: parsed.unlockFor,
|
|
567
577
|
timeoutHeight: parsed.untilHeight === null ? null : Number.parseInt(parsed.untilHeight, 10),
|
|
568
578
|
conditionHex: parsed.conditionHex,
|
|
579
|
+
feeRateSatVb: parsed.satvb,
|
|
569
580
|
dataDir,
|
|
570
581
|
databasePath: dbPath,
|
|
571
|
-
provider
|
|
582
|
+
provider,
|
|
572
583
|
prompter,
|
|
573
584
|
assumeYes: parsed.assumeYes,
|
|
574
585
|
paths: runtimePaths,
|
|
@@ -576,20 +587,19 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
576
587
|
return writeMutationCommandSuccess(parsed, context, {
|
|
577
588
|
data: buildCogMutationData(result, {
|
|
578
589
|
commandKind: "cog-lock",
|
|
579
|
-
fromIdentity: parsed.fromIdentity,
|
|
580
590
|
timeoutBlocksOrDuration: parsed.unlockFor,
|
|
581
591
|
timeoutHeight: parsed.untilHeight,
|
|
582
592
|
conditionHex: parsed.conditionHex,
|
|
583
593
|
}),
|
|
584
594
|
previewData: buildCogPreviewData(result, {
|
|
585
595
|
commandKind: "cog-lock",
|
|
586
|
-
fromIdentity: parsed.fromIdentity,
|
|
587
596
|
timeoutBlocksOrDuration: parsed.unlockFor,
|
|
588
597
|
timeoutHeight: parsed.untilHeight,
|
|
589
598
|
conditionHex: parsed.conditionHex,
|
|
590
599
|
}),
|
|
591
600
|
reusedExisting: result.reusedExisting,
|
|
592
601
|
reusedMessage: "The existing pending lock was reconciled instead of creating a duplicate.",
|
|
602
|
+
fees: result.fees,
|
|
593
603
|
interactive,
|
|
594
604
|
explorerTxid: result.txid,
|
|
595
605
|
nextSteps: commandMutationNextSteps("cogcoin locks"),
|
|
@@ -609,23 +619,23 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
609
619
|
const result = await context.claimCogLock({
|
|
610
620
|
lockId: Number.parseInt(parsed.args[0], 10),
|
|
611
621
|
preimageHex: parsed.preimageHex,
|
|
622
|
+
feeRateSatVb: parsed.satvb,
|
|
612
623
|
dataDir,
|
|
613
624
|
databasePath: dbPath,
|
|
614
|
-
provider
|
|
625
|
+
provider,
|
|
615
626
|
prompter,
|
|
616
627
|
paths: runtimePaths,
|
|
617
628
|
});
|
|
618
629
|
return writeMutationCommandSuccess(parsed, context, {
|
|
619
630
|
data: buildCogMutationData(result, {
|
|
620
631
|
commandKind: "claim",
|
|
621
|
-
fromIdentity: null,
|
|
622
632
|
}),
|
|
623
633
|
previewData: buildCogPreviewData(result, {
|
|
624
634
|
commandKind: "claim",
|
|
625
|
-
fromIdentity: null,
|
|
626
635
|
}),
|
|
627
636
|
reusedExisting: result.reusedExisting,
|
|
628
637
|
reusedMessage: "The existing pending claim was reconciled instead of creating a duplicate.",
|
|
638
|
+
fees: result.fees,
|
|
629
639
|
interactive,
|
|
630
640
|
explorerTxid: result.txid,
|
|
631
641
|
nextSteps: commandMutationNextSteps("cogcoin locks --claimable"),
|
|
@@ -645,23 +655,23 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
645
655
|
if (isReclaimMutationCommand(parsed.command)) {
|
|
646
656
|
const result = await context.reclaimCogLock({
|
|
647
657
|
lockId: Number.parseInt(parsed.args[0], 10),
|
|
658
|
+
feeRateSatVb: parsed.satvb,
|
|
648
659
|
dataDir,
|
|
649
660
|
databasePath: dbPath,
|
|
650
|
-
provider
|
|
661
|
+
provider,
|
|
651
662
|
prompter,
|
|
652
663
|
paths: runtimePaths,
|
|
653
664
|
});
|
|
654
665
|
return writeMutationCommandSuccess(parsed, context, {
|
|
655
666
|
data: buildCogMutationData(result, {
|
|
656
667
|
commandKind: "reclaim",
|
|
657
|
-
fromIdentity: null,
|
|
658
668
|
}),
|
|
659
669
|
previewData: buildCogPreviewData(result, {
|
|
660
670
|
commandKind: "reclaim",
|
|
661
|
-
fromIdentity: null,
|
|
662
671
|
}),
|
|
663
672
|
reusedExisting: result.reusedExisting,
|
|
664
673
|
reusedMessage: "The existing pending reclaim was reconciled instead of creating a duplicate.",
|
|
674
|
+
fees: result.fees,
|
|
665
675
|
interactive,
|
|
666
676
|
explorerTxid: result.txid,
|
|
667
677
|
nextSteps: commandMutationNextSteps("cogcoin locks --reclaimable"),
|
|
@@ -685,9 +695,10 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
685
695
|
targetDomainName: parsed.args[1],
|
|
686
696
|
amountCogtoshi: parseCogAmountToCogtoshi(parsed.args[2]),
|
|
687
697
|
reviewText: parsed.reviewText,
|
|
698
|
+
feeRateSatVb: parsed.satvb,
|
|
688
699
|
dataDir,
|
|
689
700
|
databasePath: dbPath,
|
|
690
|
-
provider
|
|
701
|
+
provider,
|
|
691
702
|
prompter,
|
|
692
703
|
assumeYes: parsed.assumeYes,
|
|
693
704
|
paths: runtimePaths,
|
|
@@ -697,9 +708,10 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
697
708
|
targetDomainName: parsed.args[1],
|
|
698
709
|
amountCogtoshi: parseCogAmountToCogtoshi(parsed.args[2]),
|
|
699
710
|
reviewText: parsed.reviewText,
|
|
711
|
+
feeRateSatVb: parsed.satvb,
|
|
700
712
|
dataDir,
|
|
701
713
|
databasePath: dbPath,
|
|
702
|
-
provider
|
|
714
|
+
provider,
|
|
703
715
|
prompter,
|
|
704
716
|
assumeYes: parsed.assumeYes,
|
|
705
717
|
paths: runtimePaths,
|
|
@@ -709,6 +721,7 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
709
721
|
previewData: buildReputationPreviewData(result),
|
|
710
722
|
reusedExisting: result.reusedExisting,
|
|
711
723
|
reusedMessage: "The existing pending reputation mutation was reconciled instead of creating a duplicate.",
|
|
724
|
+
fees: result.fees,
|
|
712
725
|
interactive,
|
|
713
726
|
explorerTxid: result.txid,
|
|
714
727
|
nextSteps: commandMutationNextSteps(`cogcoin show ${result.targetDomainName}`),
|
|
@@ -730,10 +743,10 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
730
743
|
if (isBuyMutationCommand(parsed.command)) {
|
|
731
744
|
const result = await context.buyDomain({
|
|
732
745
|
domainName: parsed.args[0],
|
|
733
|
-
|
|
746
|
+
feeRateSatVb: parsed.satvb,
|
|
734
747
|
dataDir,
|
|
735
748
|
databasePath: dbPath,
|
|
736
|
-
provider
|
|
749
|
+
provider,
|
|
737
750
|
prompter,
|
|
738
751
|
assumeYes: parsed.assumeYes,
|
|
739
752
|
paths: runtimePaths,
|
|
@@ -741,14 +754,13 @@ export async function runWalletMutationCommand(parsed, context) {
|
|
|
741
754
|
return writeMutationCommandSuccess(parsed, context, {
|
|
742
755
|
data: buildDomainMarketMutationData(result, {
|
|
743
756
|
commandKind: "buy",
|
|
744
|
-
fromIdentity: parsed.fromIdentity,
|
|
745
757
|
}),
|
|
746
758
|
previewData: buildDomainMarketPreviewData(result, {
|
|
747
759
|
commandKind: "buy",
|
|
748
|
-
fromIdentity: parsed.fromIdentity,
|
|
749
760
|
}),
|
|
750
761
|
reusedExisting: result.reusedExisting,
|
|
751
762
|
reusedMessage: "The existing pending purchase was reconciled instead of creating a duplicate.",
|
|
763
|
+
fees: result.fees,
|
|
752
764
|
interactive,
|
|
753
765
|
explorerTxid: result.txid,
|
|
754
766
|
nextSteps: commandMutationNextSteps(`cogcoin show ${result.domainName}`),
|
|
@@ -6,6 +6,7 @@ import { filterWalletDomains } from "../../wallet/read/index.js";
|
|
|
6
6
|
import { createErrorEnvelope, createSuccessEnvelope, describeCanonicalCommand, normalizeListPage, writeJsonValue, } from "../output.js";
|
|
7
7
|
import { buildAddressJson, buildBalanceJson, buildDomainsJson, buildFieldJson, buildFieldsJson, buildIdsJson, buildLocksJson, buildShowJson, buildWalletStatusJson, listFieldsForJson, listLocksForJson, } from "../read-json.js";
|
|
8
8
|
import { formatNextStepLines, getAddressNextSteps, getFundingQuickstartGuidance, getIdsNextSteps, getLocksNextSteps, } from "../workflow-hints.js";
|
|
9
|
+
import { withInteractiveWalletSecretProvider } from "../../wallet/state/provider.js";
|
|
9
10
|
function createUnknownPage(parsed, defaultLimit) {
|
|
10
11
|
return {
|
|
11
12
|
limit: parsed.listAll ? null : (parsed.listLimit ?? defaultLimit),
|
|
@@ -41,10 +42,13 @@ export async function runWalletReadCommand(parsed, context) {
|
|
|
41
42
|
const dataDir = parsed.dataDir ?? context.resolveDefaultBitcoindDataDir();
|
|
42
43
|
const runtimePaths = context.resolveWalletRuntimePaths(parsed.seedName);
|
|
43
44
|
await context.ensureDirectory(dirname(dbPath));
|
|
45
|
+
const provider = parsed.outputMode === "text"
|
|
46
|
+
? withInteractiveWalletSecretProvider(context.walletSecretProvider, context.createPrompter())
|
|
47
|
+
: context.walletSecretProvider;
|
|
44
48
|
const readContext = await context.openWalletReadContext({
|
|
45
49
|
dataDir,
|
|
46
50
|
databasePath: dbPath,
|
|
47
|
-
secretProvider:
|
|
51
|
+
secretProvider: provider,
|
|
48
52
|
paths: runtimePaths,
|
|
49
53
|
});
|
|
50
54
|
try {
|
|
@@ -61,10 +65,10 @@ export async function runWalletReadCommand(parsed, context) {
|
|
|
61
65
|
return emitJson(context, parsed, "cogcoin/address/v1", buildAddressJson(readContext));
|
|
62
66
|
}
|
|
63
67
|
writeLine(context.stdout, formatFundingAddressReport(readContext));
|
|
64
|
-
if (readContext.model?.
|
|
68
|
+
if (readContext.model?.walletAddress !== null && readContext.model?.walletAddress !== undefined) {
|
|
65
69
|
writeLine(context.stdout, `Quickstart: ${getFundingQuickstartGuidance()}`);
|
|
66
70
|
}
|
|
67
|
-
for (const line of formatNextStepLines(getAddressNextSteps(readContext, readContext.model?.
|
|
71
|
+
for (const line of formatNextStepLines(getAddressNextSteps(readContext, readContext.model?.walletAddress ?? null))) {
|
|
68
72
|
writeLine(context.stdout, line);
|
|
69
73
|
}
|
|
70
74
|
return 0;
|
|
@@ -72,27 +76,20 @@ export async function runWalletReadCommand(parsed, context) {
|
|
|
72
76
|
case "ids": {
|
|
73
77
|
const defaultLimit = 100;
|
|
74
78
|
if (parsed.outputMode === "json") {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
});
|
|
83
|
-
return emitJson(context, parsed, "cogcoin/ids/v1", buildIdsJson(readContext, page, items));
|
|
79
|
+
return emitJson(context, parsed, "cogcoin/ids/v1", buildIdsJson(readContext, readContext.model === null
|
|
80
|
+
? createUnknownPage(parsed, defaultLimit)
|
|
81
|
+
: normalizeListPage([readContext.model.walletAddress ?? `spk:${readContext.model.walletScriptPubKeyHex}`], {
|
|
82
|
+
limit: parsed.listLimit,
|
|
83
|
+
all: parsed.listAll,
|
|
84
|
+
defaultLimit,
|
|
85
|
+
}).page));
|
|
84
86
|
}
|
|
85
87
|
writeLine(context.stdout, formatIdentityListReport(readContext, {
|
|
86
88
|
limit: parsed.listAll ? null : (parsed.listLimit ?? defaultLimit),
|
|
87
89
|
all: parsed.listAll,
|
|
88
90
|
}));
|
|
89
91
|
if (readContext.model !== null) {
|
|
90
|
-
const
|
|
91
|
-
limit: parsed.listLimit,
|
|
92
|
-
all: parsed.listAll,
|
|
93
|
-
defaultLimit,
|
|
94
|
-
});
|
|
95
|
-
for (const line of formatNextStepLines(getIdsNextSteps(items))) {
|
|
92
|
+
for (const line of formatNextStepLines(getIdsNextSteps(readContext.model.walletAddress))) {
|
|
96
93
|
writeLine(context.stdout, line);
|
|
97
94
|
}
|
|
98
95
|
}
|