@cogcoin/client 1.1.4 → 1.1.6
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 +4 -5
- package/dist/bitcoind/indexer-daemon.d.ts +3 -7
- package/dist/bitcoind/indexer-daemon.js +43 -158
- package/dist/bitcoind/managed-runtime/bitcoind-policy.d.ts +16 -0
- package/dist/bitcoind/managed-runtime/bitcoind-policy.js +177 -0
- package/dist/bitcoind/managed-runtime/indexer-policy.d.ts +34 -0
- package/dist/bitcoind/managed-runtime/indexer-policy.js +200 -0
- package/dist/bitcoind/managed-runtime/status.d.ts +11 -0
- package/dist/bitcoind/managed-runtime/status.js +59 -0
- package/dist/bitcoind/managed-runtime/types.d.ts +37 -0
- package/dist/bitcoind/managed-runtime/types.js +1 -0
- package/dist/bitcoind/progress/tty-renderer.js +3 -2
- package/dist/bitcoind/service.d.ts +2 -7
- package/dist/bitcoind/service.js +46 -94
- package/dist/cli/command-registry.d.ts +39 -0
- package/dist/cli/command-registry.js +1132 -0
- package/dist/cli/commands/client-admin.js +6 -56
- package/dist/cli/commands/mining-admin.js +9 -32
- package/dist/cli/commands/mining-read.js +15 -56
- package/dist/cli/commands/mining-runtime.js +258 -57
- package/dist/cli/commands/service-runtime.js +1 -64
- package/dist/cli/commands/status.js +2 -15
- package/dist/cli/commands/update.js +6 -21
- package/dist/cli/commands/wallet-admin.js +18 -120
- package/dist/cli/commands/wallet-mutation.js +4 -7
- package/dist/cli/commands/wallet-read.js +31 -138
- package/dist/cli/context.js +2 -4
- package/dist/cli/mining-format.js +8 -2
- package/dist/cli/mutation-command-groups.d.ts +11 -11
- package/dist/cli/mutation-command-groups.js +9 -18
- package/dist/cli/mutation-json.d.ts +1 -17
- package/dist/cli/mutation-json.js +1 -28
- package/dist/cli/mutation-success.d.ts +0 -1
- package/dist/cli/mutation-success.js +0 -19
- package/dist/cli/output.d.ts +1 -10
- package/dist/cli/output.js +52 -481
- package/dist/cli/parse.d.ts +1 -1
- package/dist/cli/parse.js +38 -695
- package/dist/cli/runner.js +28 -113
- package/dist/cli/types.d.ts +7 -8
- package/dist/cli/update-notifier.js +1 -1
- package/dist/cli/wallet-format.js +1 -1
- package/dist/wallet/lifecycle/access.d.ts +5 -0
- package/dist/wallet/lifecycle/access.js +79 -0
- package/dist/wallet/lifecycle/context.d.ts +26 -0
- package/dist/wallet/lifecycle/context.js +58 -0
- package/dist/wallet/lifecycle/managed-core.d.ts +15 -0
- package/dist/wallet/lifecycle/managed-core.js +197 -0
- package/dist/wallet/lifecycle/repair-bitcoind.d.ts +10 -0
- package/dist/wallet/lifecycle/repair-bitcoind.js +142 -0
- package/dist/wallet/lifecycle/repair-indexer.d.ts +8 -0
- package/dist/wallet/lifecycle/repair-indexer.js +117 -0
- package/dist/wallet/lifecycle/repair-mining.d.ts +49 -0
- package/dist/wallet/lifecycle/repair-mining.js +304 -0
- package/dist/wallet/lifecycle/repair-runtime.d.ts +36 -0
- package/dist/wallet/lifecycle/repair-runtime.js +206 -0
- package/dist/wallet/lifecycle/repair.d.ts +9 -0
- package/dist/wallet/lifecycle/repair.js +127 -0
- package/dist/wallet/lifecycle/setup-prompts.d.ts +7 -0
- package/dist/wallet/lifecycle/setup-prompts.js +88 -0
- package/dist/wallet/lifecycle/setup-state.d.ts +26 -0
- package/dist/wallet/lifecycle/setup-state.js +159 -0
- package/dist/wallet/lifecycle/setup.d.ts +15 -0
- package/dist/wallet/lifecycle/setup.js +124 -0
- package/dist/wallet/lifecycle/types.d.ts +156 -0
- package/dist/wallet/lifecycle/types.js +1 -0
- package/dist/wallet/lifecycle.d.ts +4 -165
- package/dist/wallet/lifecycle.js +3 -1656
- package/dist/wallet/mining/candidate.d.ts +60 -0
- package/dist/wallet/mining/candidate.js +290 -0
- package/dist/wallet/mining/competitiveness.d.ts +22 -0
- package/dist/wallet/mining/competitiveness.js +640 -0
- package/dist/wallet/mining/control.js +7 -251
- package/dist/wallet/mining/cycle.d.ts +39 -0
- package/dist/wallet/mining/cycle.js +542 -0
- package/dist/wallet/mining/engine-state.d.ts +66 -0
- package/dist/wallet/mining/engine-state.js +211 -0
- package/dist/wallet/mining/engine-types.d.ts +173 -0
- package/dist/wallet/mining/engine-types.js +1 -0
- package/dist/wallet/mining/engine-utils.d.ts +7 -0
- package/dist/wallet/mining/engine-utils.js +75 -0
- package/dist/wallet/mining/events.d.ts +2 -0
- package/dist/wallet/mining/events.js +19 -0
- package/dist/wallet/mining/lifecycle.d.ts +71 -0
- package/dist/wallet/mining/lifecycle.js +355 -0
- package/dist/wallet/mining/projection.d.ts +61 -0
- package/dist/wallet/mining/projection.js +319 -0
- package/dist/wallet/mining/publish.d.ts +79 -0
- package/dist/wallet/mining/publish.js +614 -0
- package/dist/wallet/mining/runner.d.ts +12 -418
- package/dist/wallet/mining/runner.js +274 -3433
- package/dist/wallet/mining/supervisor.d.ts +134 -0
- package/dist/wallet/mining/supervisor.js +558 -0
- package/dist/wallet/mining/visualizer-sync.d.ts +42 -0
- package/dist/wallet/mining/visualizer-sync.js +166 -0
- package/dist/wallet/mining/visualizer.d.ts +1 -0
- package/dist/wallet/mining/visualizer.js +33 -18
- package/dist/wallet/read/context.js +13 -188
- package/dist/wallet/reset.d.ts +1 -1
- package/dist/wallet/reset.js +35 -11
- package/dist/wallet/runtime.d.ts +0 -6
- package/dist/wallet/runtime.js +2 -38
- package/dist/wallet/tx/common.d.ts +18 -0
- package/dist/wallet/tx/common.js +40 -26
- package/package.json +1 -1
- package/dist/wallet/state/seed-index.d.ts +0 -43
- package/dist/wallet/state/seed-index.js +0 -151
|
@@ -0,0 +1,1132 @@
|
|
|
1
|
+
const commandSpecs = [
|
|
2
|
+
{
|
|
3
|
+
id: "status",
|
|
4
|
+
handlerFamily: "status",
|
|
5
|
+
supportsYes: false,
|
|
6
|
+
supportsSatvb: false,
|
|
7
|
+
aliases: [{ tokens: ["status"] }],
|
|
8
|
+
helpEntries: [
|
|
9
|
+
{
|
|
10
|
+
usage: "status",
|
|
11
|
+
description: "Show wallet-aware local service and chain status",
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
describeCommand() {
|
|
15
|
+
return "cogcoin status";
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: "update",
|
|
20
|
+
handlerFamily: "update",
|
|
21
|
+
supportsYes: true,
|
|
22
|
+
supportsSatvb: false,
|
|
23
|
+
aliases: [{ tokens: ["update"] }],
|
|
24
|
+
helpEntries: [
|
|
25
|
+
{
|
|
26
|
+
usage: "update",
|
|
27
|
+
description: "Show the current and latest client versions and install updates",
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
describeCommand() {
|
|
31
|
+
return "cogcoin update";
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "client-unlock",
|
|
36
|
+
handlerFamily: "client-admin",
|
|
37
|
+
supportsYes: false,
|
|
38
|
+
supportsSatvb: false,
|
|
39
|
+
aliases: [{ tokens: ["client", "unlock"] }],
|
|
40
|
+
helpEntries: [
|
|
41
|
+
{
|
|
42
|
+
usage: "client unlock",
|
|
43
|
+
description: "Unlock password-protected local wallet secrets for a limited time",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
describeCommand() {
|
|
47
|
+
return "cogcoin client unlock";
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "client-lock",
|
|
52
|
+
handlerFamily: "client-admin",
|
|
53
|
+
supportsYes: false,
|
|
54
|
+
supportsSatvb: false,
|
|
55
|
+
aliases: [{ tokens: ["client", "lock"] }],
|
|
56
|
+
helpEntries: [
|
|
57
|
+
{
|
|
58
|
+
usage: "client lock",
|
|
59
|
+
description: "Flush the cached client password unlock session",
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
describeCommand() {
|
|
63
|
+
return "cogcoin client lock";
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: "client-change-password",
|
|
68
|
+
handlerFamily: "client-admin",
|
|
69
|
+
supportsYes: false,
|
|
70
|
+
supportsSatvb: false,
|
|
71
|
+
aliases: [{ tokens: ["client", "change-password"] }],
|
|
72
|
+
helpEntries: [
|
|
73
|
+
{
|
|
74
|
+
usage: "client change-password",
|
|
75
|
+
description: "Rotate the client password that protects local wallet secrets",
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
describeCommand() {
|
|
79
|
+
return "cogcoin client change-password";
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: "bitcoin-start",
|
|
84
|
+
handlerFamily: "service-runtime",
|
|
85
|
+
supportsYes: false,
|
|
86
|
+
supportsSatvb: false,
|
|
87
|
+
aliases: [{ tokens: ["bitcoin", "start"] }],
|
|
88
|
+
helpEntries: [
|
|
89
|
+
{
|
|
90
|
+
usage: "bitcoin start",
|
|
91
|
+
description: "Start the managed Bitcoin daemon",
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
describeCommand() {
|
|
95
|
+
return "cogcoin bitcoin start";
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "bitcoin-stop",
|
|
100
|
+
handlerFamily: "service-runtime",
|
|
101
|
+
supportsYes: false,
|
|
102
|
+
supportsSatvb: false,
|
|
103
|
+
aliases: [{ tokens: ["bitcoin", "stop"] }],
|
|
104
|
+
helpEntries: [
|
|
105
|
+
{
|
|
106
|
+
usage: "bitcoin stop",
|
|
107
|
+
description: "Stop the managed Bitcoin daemon and paired indexer",
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
describeCommand() {
|
|
111
|
+
return "cogcoin bitcoin stop";
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: "bitcoin-status",
|
|
116
|
+
handlerFamily: "service-runtime",
|
|
117
|
+
supportsYes: false,
|
|
118
|
+
supportsSatvb: false,
|
|
119
|
+
aliases: [{ tokens: ["bitcoin", "status"] }],
|
|
120
|
+
helpEntries: [
|
|
121
|
+
{
|
|
122
|
+
usage: "bitcoin status",
|
|
123
|
+
description: "Show managed Bitcoin daemon status without starting it",
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
describeCommand() {
|
|
127
|
+
return "cogcoin bitcoin status";
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
id: "bitcoin-transfer",
|
|
132
|
+
handlerFamily: "wallet-mutation",
|
|
133
|
+
supportsYes: true,
|
|
134
|
+
supportsSatvb: false,
|
|
135
|
+
aliases: [{ tokens: ["bitcoin", "transfer"] }],
|
|
136
|
+
helpEntries: [
|
|
137
|
+
{
|
|
138
|
+
usage: "bitcoin transfer <sats> --to <address>",
|
|
139
|
+
description: "Send plain BTC from the wallet address",
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
describeCommand(args) {
|
|
143
|
+
return `cogcoin bitcoin transfer ${args[0] ?? "<sats>"}`;
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: "indexer-start",
|
|
148
|
+
handlerFamily: "service-runtime",
|
|
149
|
+
supportsYes: false,
|
|
150
|
+
supportsSatvb: false,
|
|
151
|
+
aliases: [{ tokens: ["indexer", "start"] }],
|
|
152
|
+
helpEntries: [
|
|
153
|
+
{
|
|
154
|
+
usage: "indexer start",
|
|
155
|
+
description: "Start the managed Cogcoin indexer (and bitcoind if needed)",
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
describeCommand() {
|
|
159
|
+
return "cogcoin indexer start";
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
id: "indexer-stop",
|
|
164
|
+
handlerFamily: "service-runtime",
|
|
165
|
+
supportsYes: false,
|
|
166
|
+
supportsSatvb: false,
|
|
167
|
+
aliases: [{ tokens: ["indexer", "stop"] }],
|
|
168
|
+
helpEntries: [
|
|
169
|
+
{
|
|
170
|
+
usage: "indexer stop",
|
|
171
|
+
description: "Stop the managed Cogcoin indexer only",
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
describeCommand() {
|
|
175
|
+
return "cogcoin indexer stop";
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
id: "indexer-status",
|
|
180
|
+
handlerFamily: "service-runtime",
|
|
181
|
+
supportsYes: false,
|
|
182
|
+
supportsSatvb: false,
|
|
183
|
+
aliases: [{ tokens: ["indexer", "status"] }],
|
|
184
|
+
helpEntries: [
|
|
185
|
+
{
|
|
186
|
+
usage: "indexer status",
|
|
187
|
+
description: "Show managed Cogcoin indexer status without starting it",
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
describeCommand() {
|
|
191
|
+
return "cogcoin indexer status";
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
id: "init",
|
|
196
|
+
handlerFamily: "wallet-admin",
|
|
197
|
+
supportsYes: false,
|
|
198
|
+
supportsSatvb: false,
|
|
199
|
+
aliases: [
|
|
200
|
+
{ tokens: ["init"] },
|
|
201
|
+
{ tokens: ["wallet", "init"] },
|
|
202
|
+
],
|
|
203
|
+
helpEntries: [
|
|
204
|
+
{
|
|
205
|
+
usage: "init",
|
|
206
|
+
description: "Initialize a new wallet or restore an existing wallet",
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
usage: "wallet init",
|
|
210
|
+
description: "Alias for init",
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
describeCommand() {
|
|
214
|
+
return "cogcoin init";
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
id: "reset",
|
|
219
|
+
handlerFamily: "wallet-admin",
|
|
220
|
+
supportsYes: false,
|
|
221
|
+
supportsSatvb: false,
|
|
222
|
+
aliases: [{ tokens: ["reset"] }],
|
|
223
|
+
helpEntries: [
|
|
224
|
+
{
|
|
225
|
+
usage: "reset",
|
|
226
|
+
description: "Factory-reset local Cogcoin state with interactive retention prompts",
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
describeCommand() {
|
|
230
|
+
return "cogcoin reset";
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
id: "repair",
|
|
235
|
+
handlerFamily: "wallet-admin",
|
|
236
|
+
supportsYes: true,
|
|
237
|
+
supportsSatvb: false,
|
|
238
|
+
aliases: [{ tokens: ["repair"] }],
|
|
239
|
+
helpEntries: [
|
|
240
|
+
{
|
|
241
|
+
usage: "repair",
|
|
242
|
+
description: "Recover bounded wallet/indexer/runtime state",
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
describeCommand() {
|
|
246
|
+
return "cogcoin repair";
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
id: "address",
|
|
251
|
+
handlerFamily: "wallet-read",
|
|
252
|
+
supportsYes: false,
|
|
253
|
+
supportsSatvb: false,
|
|
254
|
+
aliases: [
|
|
255
|
+
{ tokens: ["address"] },
|
|
256
|
+
{ tokens: ["wallet", "address"] },
|
|
257
|
+
],
|
|
258
|
+
helpEntries: [
|
|
259
|
+
{
|
|
260
|
+
usage: "wallet address",
|
|
261
|
+
description: "Alias for address",
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
usage: "address",
|
|
265
|
+
description: "Show the BTC wallet address for this wallet",
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
describeCommand() {
|
|
269
|
+
return "cogcoin address";
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
id: "ids",
|
|
274
|
+
handlerFamily: "wallet-read",
|
|
275
|
+
supportsYes: false,
|
|
276
|
+
supportsSatvb: false,
|
|
277
|
+
aliases: [
|
|
278
|
+
{ tokens: ["ids"] },
|
|
279
|
+
{ tokens: ["wallet", "ids"] },
|
|
280
|
+
],
|
|
281
|
+
helpEntries: [
|
|
282
|
+
{
|
|
283
|
+
usage: "wallet ids",
|
|
284
|
+
description: "Alias for ids",
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
usage: "ids",
|
|
288
|
+
description: "Show the local wallet address",
|
|
289
|
+
},
|
|
290
|
+
],
|
|
291
|
+
describeCommand() {
|
|
292
|
+
return "cogcoin ids";
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
id: "mine",
|
|
297
|
+
handlerFamily: "mining-runtime",
|
|
298
|
+
supportsYes: false,
|
|
299
|
+
supportsSatvb: false,
|
|
300
|
+
aliases: [{ tokens: ["mine"], matchMode: "end-or-flag" }],
|
|
301
|
+
helpEntries: [
|
|
302
|
+
{
|
|
303
|
+
usage: "mine",
|
|
304
|
+
description: "Run the miner in the foreground",
|
|
305
|
+
},
|
|
306
|
+
],
|
|
307
|
+
describeCommand() {
|
|
308
|
+
return "cogcoin mine";
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
id: "mine-start",
|
|
313
|
+
handlerFamily: "mining-runtime",
|
|
314
|
+
supportsYes: false,
|
|
315
|
+
supportsSatvb: false,
|
|
316
|
+
aliases: [{ tokens: ["mine", "start"] }],
|
|
317
|
+
helpEntries: [
|
|
318
|
+
{
|
|
319
|
+
usage: "mine start",
|
|
320
|
+
description: "Start the miner as a background worker",
|
|
321
|
+
},
|
|
322
|
+
],
|
|
323
|
+
describeCommand() {
|
|
324
|
+
return "cogcoin mine start";
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: "mine-stop",
|
|
329
|
+
handlerFamily: "mining-runtime",
|
|
330
|
+
supportsYes: false,
|
|
331
|
+
supportsSatvb: false,
|
|
332
|
+
aliases: [{ tokens: ["mine", "stop"] }],
|
|
333
|
+
helpEntries: [
|
|
334
|
+
{
|
|
335
|
+
usage: "mine stop",
|
|
336
|
+
description: "Stop the active background miner",
|
|
337
|
+
},
|
|
338
|
+
],
|
|
339
|
+
describeCommand() {
|
|
340
|
+
return "cogcoin mine stop";
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
id: "mine-setup",
|
|
345
|
+
handlerFamily: "mining-admin",
|
|
346
|
+
supportsYes: false,
|
|
347
|
+
supportsSatvb: false,
|
|
348
|
+
aliases: [{ tokens: ["mine", "setup"] }],
|
|
349
|
+
helpEntries: [
|
|
350
|
+
{
|
|
351
|
+
usage: "mine setup",
|
|
352
|
+
description: "Configure the built-in mining provider",
|
|
353
|
+
},
|
|
354
|
+
],
|
|
355
|
+
describeCommand() {
|
|
356
|
+
return "cogcoin mine setup";
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
id: "mine-prompt-list",
|
|
361
|
+
handlerFamily: "mining-read",
|
|
362
|
+
supportsYes: false,
|
|
363
|
+
supportsSatvb: false,
|
|
364
|
+
aliases: [
|
|
365
|
+
{ tokens: ["mine", "prompt"], matchMode: "end-or-flag" },
|
|
366
|
+
{ tokens: ["mine", "prompt", "list"] },
|
|
367
|
+
],
|
|
368
|
+
helpEntries: [
|
|
369
|
+
{
|
|
370
|
+
usage: "mine prompt",
|
|
371
|
+
description: "Show per-domain mining prompt state",
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
usage: "mine prompt list",
|
|
375
|
+
description: "Alias for mine prompt",
|
|
376
|
+
},
|
|
377
|
+
],
|
|
378
|
+
describeCommand() {
|
|
379
|
+
return "cogcoin mine prompt";
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
id: "mine-prompt",
|
|
384
|
+
handlerFamily: "mining-admin",
|
|
385
|
+
supportsYes: false,
|
|
386
|
+
supportsSatvb: false,
|
|
387
|
+
aliases: [{ tokens: ["mine", "prompt"], matchMode: "requires-arg" }],
|
|
388
|
+
helpEntries: [
|
|
389
|
+
{
|
|
390
|
+
usage: "mine prompt <domain>",
|
|
391
|
+
description: "Configure a per-domain mining prompt override",
|
|
392
|
+
},
|
|
393
|
+
],
|
|
394
|
+
describeCommand(args) {
|
|
395
|
+
return `cogcoin mine prompt ${args[0] ?? "<domain>"}`;
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
id: "mine-status",
|
|
400
|
+
handlerFamily: "mining-read",
|
|
401
|
+
supportsYes: false,
|
|
402
|
+
supportsSatvb: false,
|
|
403
|
+
aliases: [{ tokens: ["mine", "status"] }],
|
|
404
|
+
helpEntries: [
|
|
405
|
+
{
|
|
406
|
+
usage: "mine status",
|
|
407
|
+
description: "Show mining control-plane health and readiness",
|
|
408
|
+
},
|
|
409
|
+
],
|
|
410
|
+
describeCommand() {
|
|
411
|
+
return "cogcoin mine status";
|
|
412
|
+
},
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
id: "mine-log",
|
|
416
|
+
handlerFamily: "mining-read",
|
|
417
|
+
supportsYes: false,
|
|
418
|
+
supportsSatvb: false,
|
|
419
|
+
aliases: [{ tokens: ["mine", "log"] }],
|
|
420
|
+
helpEntries: [
|
|
421
|
+
{
|
|
422
|
+
usage: "mine log",
|
|
423
|
+
description: "Show recent mining control-plane events",
|
|
424
|
+
},
|
|
425
|
+
],
|
|
426
|
+
describeCommand(_args, options) {
|
|
427
|
+
return `cogcoin mine log${options.follow ? " --follow" : ""}`;
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
id: "anchor",
|
|
432
|
+
handlerFamily: "wallet-mutation",
|
|
433
|
+
supportsYes: false,
|
|
434
|
+
supportsSatvb: true,
|
|
435
|
+
aliases: [
|
|
436
|
+
{ tokens: ["anchor"] },
|
|
437
|
+
{ tokens: ["domain", "anchor"] },
|
|
438
|
+
],
|
|
439
|
+
helpEntries: [
|
|
440
|
+
{
|
|
441
|
+
usage: "anchor <domain>",
|
|
442
|
+
description: "Anchor an owned unanchored domain with the wallet address",
|
|
443
|
+
},
|
|
444
|
+
],
|
|
445
|
+
describeCommand(args) {
|
|
446
|
+
return `cogcoin anchor ${args[0] ?? "<domain>"}`;
|
|
447
|
+
},
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
id: "register",
|
|
451
|
+
handlerFamily: "wallet-mutation",
|
|
452
|
+
supportsYes: true,
|
|
453
|
+
supportsSatvb: true,
|
|
454
|
+
aliases: [
|
|
455
|
+
{ tokens: ["register"] },
|
|
456
|
+
{ tokens: ["domain", "register"] },
|
|
457
|
+
],
|
|
458
|
+
helpEntries: [
|
|
459
|
+
{
|
|
460
|
+
usage: "register <domain>",
|
|
461
|
+
description: "Register a root domain or subdomain",
|
|
462
|
+
},
|
|
463
|
+
],
|
|
464
|
+
describeCommand(args) {
|
|
465
|
+
return `cogcoin register ${args[0] ?? "<domain>"}`;
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
id: "transfer",
|
|
470
|
+
handlerFamily: "wallet-mutation",
|
|
471
|
+
supportsYes: true,
|
|
472
|
+
supportsSatvb: true,
|
|
473
|
+
aliases: [
|
|
474
|
+
{ tokens: ["transfer"] },
|
|
475
|
+
{ tokens: ["domain", "transfer"] },
|
|
476
|
+
],
|
|
477
|
+
helpEntries: [
|
|
478
|
+
{
|
|
479
|
+
usage: "transfer <domain> --to <btc-target>",
|
|
480
|
+
description: "Transfer an unanchored domain to another BTC address or script",
|
|
481
|
+
},
|
|
482
|
+
],
|
|
483
|
+
describeCommand(args) {
|
|
484
|
+
return `cogcoin transfer ${args[0] ?? "<domain>"}`;
|
|
485
|
+
},
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
id: "sell",
|
|
489
|
+
handlerFamily: "wallet-mutation",
|
|
490
|
+
supportsYes: true,
|
|
491
|
+
supportsSatvb: true,
|
|
492
|
+
aliases: [
|
|
493
|
+
{ tokens: ["sell"] },
|
|
494
|
+
{ tokens: ["domain", "sell"] },
|
|
495
|
+
],
|
|
496
|
+
helpEntries: [
|
|
497
|
+
{
|
|
498
|
+
usage: "sell <domain> <price>",
|
|
499
|
+
description: "List an unanchored domain for sale in COG",
|
|
500
|
+
},
|
|
501
|
+
],
|
|
502
|
+
describeCommand(args) {
|
|
503
|
+
return `cogcoin sell ${args[0] ?? "<domain>"} ${args[1] ?? "<price>"}`;
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
id: "unsell",
|
|
508
|
+
handlerFamily: "wallet-mutation",
|
|
509
|
+
supportsYes: true,
|
|
510
|
+
supportsSatvb: true,
|
|
511
|
+
aliases: [
|
|
512
|
+
{ tokens: ["unsell"] },
|
|
513
|
+
{ tokens: ["domain", "unsell"] },
|
|
514
|
+
],
|
|
515
|
+
helpEntries: [
|
|
516
|
+
{
|
|
517
|
+
usage: "unsell <domain>",
|
|
518
|
+
description: "Clear an active domain listing",
|
|
519
|
+
},
|
|
520
|
+
],
|
|
521
|
+
describeCommand(args) {
|
|
522
|
+
return `cogcoin unsell ${args[0] ?? "<domain>"}`;
|
|
523
|
+
},
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
id: "buy",
|
|
527
|
+
handlerFamily: "wallet-mutation",
|
|
528
|
+
supportsYes: true,
|
|
529
|
+
supportsSatvb: true,
|
|
530
|
+
aliases: [
|
|
531
|
+
{ tokens: ["buy"] },
|
|
532
|
+
{ tokens: ["domain", "buy"] },
|
|
533
|
+
],
|
|
534
|
+
helpEntries: [
|
|
535
|
+
{
|
|
536
|
+
usage: "buy <domain>",
|
|
537
|
+
description: "Buy an unanchored listed domain in COG",
|
|
538
|
+
},
|
|
539
|
+
],
|
|
540
|
+
describeCommand(args) {
|
|
541
|
+
return `cogcoin buy ${args[0] ?? "<domain>"}`;
|
|
542
|
+
},
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
id: "send",
|
|
546
|
+
handlerFamily: "wallet-mutation",
|
|
547
|
+
supportsYes: true,
|
|
548
|
+
supportsSatvb: true,
|
|
549
|
+
aliases: [
|
|
550
|
+
{ tokens: ["send"] },
|
|
551
|
+
{ tokens: ["cog", "send"] },
|
|
552
|
+
],
|
|
553
|
+
helpEntries: [
|
|
554
|
+
{
|
|
555
|
+
usage: "send <amount> --to <btc-target>",
|
|
556
|
+
description: "Send COG from the wallet address to another BTC target",
|
|
557
|
+
},
|
|
558
|
+
],
|
|
559
|
+
describeCommand(args) {
|
|
560
|
+
return `cogcoin send ${args[0] ?? "<amount>"}`;
|
|
561
|
+
},
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
id: "claim",
|
|
565
|
+
handlerFamily: "wallet-mutation",
|
|
566
|
+
supportsYes: true,
|
|
567
|
+
supportsSatvb: true,
|
|
568
|
+
aliases: [
|
|
569
|
+
{ tokens: ["claim"] },
|
|
570
|
+
{ tokens: ["cog", "claim"] },
|
|
571
|
+
],
|
|
572
|
+
helpEntries: [
|
|
573
|
+
{
|
|
574
|
+
usage: "claim <lock-id> --preimage <32-byte-hex>",
|
|
575
|
+
description: "Claim an active COG lock before timeout",
|
|
576
|
+
},
|
|
577
|
+
],
|
|
578
|
+
describeCommand(args) {
|
|
579
|
+
return `cogcoin claim ${args[0] ?? "<lock-id>"}`;
|
|
580
|
+
},
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
id: "reclaim",
|
|
584
|
+
handlerFamily: "wallet-mutation",
|
|
585
|
+
supportsYes: true,
|
|
586
|
+
supportsSatvb: true,
|
|
587
|
+
aliases: [
|
|
588
|
+
{ tokens: ["reclaim"] },
|
|
589
|
+
{ tokens: ["cog", "reclaim"] },
|
|
590
|
+
],
|
|
591
|
+
helpEntries: [
|
|
592
|
+
{
|
|
593
|
+
usage: "reclaim <lock-id>",
|
|
594
|
+
description: "Reclaim an expired COG lock as the original locker",
|
|
595
|
+
},
|
|
596
|
+
],
|
|
597
|
+
describeCommand(args) {
|
|
598
|
+
return `cogcoin reclaim ${args[0] ?? "<lock-id>"}`;
|
|
599
|
+
},
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
id: "cog-lock",
|
|
603
|
+
handlerFamily: "wallet-mutation",
|
|
604
|
+
supportsYes: true,
|
|
605
|
+
supportsSatvb: true,
|
|
606
|
+
aliases: [{ tokens: ["cog", "lock"] }],
|
|
607
|
+
helpEntries: [
|
|
608
|
+
{
|
|
609
|
+
usage: "cog lock <amount> --to-domain <domain> (--for <blocks-or-duration> | --until-height <height>) --condition <sha256hex>",
|
|
610
|
+
description: "Lock COG to an anchored recipient domain",
|
|
611
|
+
},
|
|
612
|
+
],
|
|
613
|
+
describeCommand(args) {
|
|
614
|
+
return `cogcoin cog lock ${args[0] ?? "<amount>"}`;
|
|
615
|
+
},
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
id: "wallet-status",
|
|
619
|
+
handlerFamily: "wallet-read",
|
|
620
|
+
supportsYes: false,
|
|
621
|
+
supportsSatvb: false,
|
|
622
|
+
aliases: [{ tokens: ["wallet", "status"] }],
|
|
623
|
+
helpEntries: [
|
|
624
|
+
{
|
|
625
|
+
usage: "wallet status",
|
|
626
|
+
description: "Show detailed wallet-local status and service health",
|
|
627
|
+
},
|
|
628
|
+
],
|
|
629
|
+
describeCommand() {
|
|
630
|
+
return "cogcoin wallet status";
|
|
631
|
+
},
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
id: "wallet-show-mnemonic",
|
|
635
|
+
handlerFamily: "wallet-admin",
|
|
636
|
+
supportsYes: false,
|
|
637
|
+
supportsSatvb: false,
|
|
638
|
+
aliases: [{ tokens: ["wallet", "show-mnemonic"] }],
|
|
639
|
+
helpEntries: [
|
|
640
|
+
{
|
|
641
|
+
usage: "wallet show-mnemonic",
|
|
642
|
+
description: "Reveal the initialized wallet recovery phrase after typed confirmation",
|
|
643
|
+
},
|
|
644
|
+
],
|
|
645
|
+
describeCommand() {
|
|
646
|
+
return "cogcoin wallet show-mnemonic";
|
|
647
|
+
},
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
id: "balance",
|
|
651
|
+
handlerFamily: "wallet-read",
|
|
652
|
+
supportsYes: false,
|
|
653
|
+
supportsSatvb: false,
|
|
654
|
+
aliases: [
|
|
655
|
+
{ tokens: ["balance"] },
|
|
656
|
+
{ tokens: ["cog", "balance"] },
|
|
657
|
+
],
|
|
658
|
+
helpEntries: [
|
|
659
|
+
{
|
|
660
|
+
usage: "balance",
|
|
661
|
+
description: "Show local wallet COG balances",
|
|
662
|
+
},
|
|
663
|
+
],
|
|
664
|
+
describeCommand() {
|
|
665
|
+
return "cogcoin balance";
|
|
666
|
+
},
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
id: "locks",
|
|
670
|
+
handlerFamily: "wallet-read",
|
|
671
|
+
supportsYes: false,
|
|
672
|
+
supportsSatvb: false,
|
|
673
|
+
aliases: [
|
|
674
|
+
{ tokens: ["locks"] },
|
|
675
|
+
{ tokens: ["cog", "locks"] },
|
|
676
|
+
],
|
|
677
|
+
helpEntries: [
|
|
678
|
+
{
|
|
679
|
+
usage: "locks",
|
|
680
|
+
description: "Show locally related active COG locks",
|
|
681
|
+
},
|
|
682
|
+
],
|
|
683
|
+
describeCommand() {
|
|
684
|
+
return "cogcoin locks";
|
|
685
|
+
},
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
id: "domains",
|
|
689
|
+
handlerFamily: "wallet-read",
|
|
690
|
+
supportsYes: false,
|
|
691
|
+
supportsSatvb: false,
|
|
692
|
+
aliases: [
|
|
693
|
+
{ tokens: ["domains"] },
|
|
694
|
+
{ tokens: ["domain", "list"] },
|
|
695
|
+
],
|
|
696
|
+
helpEntries: [
|
|
697
|
+
{
|
|
698
|
+
usage: "domain list",
|
|
699
|
+
description: "Alias for domains",
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
usage: "domains [--anchored] [--listed] [--mineable]",
|
|
703
|
+
description: "Show locally related domains",
|
|
704
|
+
},
|
|
705
|
+
],
|
|
706
|
+
describeCommand() {
|
|
707
|
+
return "cogcoin domains";
|
|
708
|
+
},
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
id: "show",
|
|
712
|
+
handlerFamily: "wallet-read",
|
|
713
|
+
supportsYes: false,
|
|
714
|
+
supportsSatvb: false,
|
|
715
|
+
aliases: [
|
|
716
|
+
{ tokens: ["show"] },
|
|
717
|
+
{ tokens: ["domain", "show"] },
|
|
718
|
+
],
|
|
719
|
+
helpEntries: [
|
|
720
|
+
{
|
|
721
|
+
usage: "domain show <domain>",
|
|
722
|
+
description: "Alias for show <domain>",
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
usage: "show <domain>",
|
|
726
|
+
description: "Show one domain and its local-wallet relationship",
|
|
727
|
+
},
|
|
728
|
+
],
|
|
729
|
+
describeCommand(args) {
|
|
730
|
+
return `cogcoin show ${args[0] ?? "<domain>"}`;
|
|
731
|
+
},
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
id: "fields",
|
|
735
|
+
handlerFamily: "wallet-read",
|
|
736
|
+
supportsYes: false,
|
|
737
|
+
supportsSatvb: false,
|
|
738
|
+
aliases: [
|
|
739
|
+
{ tokens: ["fields"] },
|
|
740
|
+
{ tokens: ["field", "list"] },
|
|
741
|
+
],
|
|
742
|
+
helpEntries: [
|
|
743
|
+
{
|
|
744
|
+
usage: "fields <domain>",
|
|
745
|
+
description: "List current fields on a domain",
|
|
746
|
+
},
|
|
747
|
+
],
|
|
748
|
+
describeCommand(args) {
|
|
749
|
+
return `cogcoin fields ${args[0] ?? "<domain>"}`;
|
|
750
|
+
},
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
id: "field",
|
|
754
|
+
handlerFamily: "wallet-read",
|
|
755
|
+
supportsYes: false,
|
|
756
|
+
supportsSatvb: false,
|
|
757
|
+
aliases: [
|
|
758
|
+
{ tokens: ["field"], matchMode: "always" },
|
|
759
|
+
{ tokens: ["field", "show"] },
|
|
760
|
+
],
|
|
761
|
+
helpEntries: [
|
|
762
|
+
{
|
|
763
|
+
usage: "field <domain> <field>",
|
|
764
|
+
description: "Show one current field value",
|
|
765
|
+
},
|
|
766
|
+
],
|
|
767
|
+
describeCommand(args) {
|
|
768
|
+
return `cogcoin field ${args[0] ?? "<domain>"} ${args[1] ?? "<field>"}`;
|
|
769
|
+
},
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
id: "field-create",
|
|
773
|
+
handlerFamily: "wallet-mutation",
|
|
774
|
+
supportsYes: true,
|
|
775
|
+
supportsSatvb: true,
|
|
776
|
+
aliases: [{ tokens: ["field", "create"] }],
|
|
777
|
+
helpEntries: [
|
|
778
|
+
{
|
|
779
|
+
usage: "field create <domain> <field>",
|
|
780
|
+
description: "Create a new empty anchored field",
|
|
781
|
+
},
|
|
782
|
+
],
|
|
783
|
+
describeCommand(args) {
|
|
784
|
+
return `cogcoin field create ${args[0] ?? "<domain>"} ${args[1] ?? "<field>"}`;
|
|
785
|
+
},
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
id: "field-set",
|
|
789
|
+
handlerFamily: "wallet-mutation",
|
|
790
|
+
supportsYes: true,
|
|
791
|
+
supportsSatvb: true,
|
|
792
|
+
aliases: [{ tokens: ["field", "set"] }],
|
|
793
|
+
helpEntries: [
|
|
794
|
+
{
|
|
795
|
+
usage: "field set <domain> <field>",
|
|
796
|
+
description: "Update an existing anchored field value",
|
|
797
|
+
},
|
|
798
|
+
],
|
|
799
|
+
describeCommand(args) {
|
|
800
|
+
return `cogcoin field set ${args[0] ?? "<domain>"} ${args[1] ?? "<field>"}`;
|
|
801
|
+
},
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
id: "field-clear",
|
|
805
|
+
handlerFamily: "wallet-mutation",
|
|
806
|
+
supportsYes: true,
|
|
807
|
+
supportsSatvb: true,
|
|
808
|
+
aliases: [{ tokens: ["field", "clear"] }],
|
|
809
|
+
helpEntries: [
|
|
810
|
+
{
|
|
811
|
+
usage: "field clear <domain> <field>",
|
|
812
|
+
description: "Clear an existing anchored field value",
|
|
813
|
+
},
|
|
814
|
+
],
|
|
815
|
+
describeCommand(args) {
|
|
816
|
+
return `cogcoin field clear ${args[0] ?? "<domain>"} ${args[1] ?? "<field>"}`;
|
|
817
|
+
},
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
id: "domain-endpoint-set",
|
|
821
|
+
handlerFamily: "wallet-mutation",
|
|
822
|
+
supportsYes: true,
|
|
823
|
+
supportsSatvb: true,
|
|
824
|
+
aliases: [{ tokens: ["domain", "endpoint", "set"] }],
|
|
825
|
+
helpEntries: [],
|
|
826
|
+
describeCommand(args) {
|
|
827
|
+
return `cogcoin domain endpoint set ${args[0] ?? "<domain>"}`;
|
|
828
|
+
},
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
id: "domain-endpoint-clear",
|
|
832
|
+
handlerFamily: "wallet-mutation",
|
|
833
|
+
supportsYes: true,
|
|
834
|
+
supportsSatvb: true,
|
|
835
|
+
aliases: [{ tokens: ["domain", "endpoint", "clear"] }],
|
|
836
|
+
helpEntries: [],
|
|
837
|
+
describeCommand(args) {
|
|
838
|
+
return `cogcoin domain endpoint clear ${args[0] ?? "<domain>"}`;
|
|
839
|
+
},
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
id: "domain-delegate-set",
|
|
843
|
+
handlerFamily: "wallet-mutation",
|
|
844
|
+
supportsYes: true,
|
|
845
|
+
supportsSatvb: true,
|
|
846
|
+
aliases: [{ tokens: ["domain", "delegate", "set"] }],
|
|
847
|
+
helpEntries: [],
|
|
848
|
+
describeCommand(args) {
|
|
849
|
+
return `cogcoin domain delegate set ${args[0] ?? "<domain>"} ${args[1] ?? "<btc-target>"}`;
|
|
850
|
+
},
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
id: "domain-delegate-clear",
|
|
854
|
+
handlerFamily: "wallet-mutation",
|
|
855
|
+
supportsYes: true,
|
|
856
|
+
supportsSatvb: true,
|
|
857
|
+
aliases: [{ tokens: ["domain", "delegate", "clear"] }],
|
|
858
|
+
helpEntries: [],
|
|
859
|
+
describeCommand(args) {
|
|
860
|
+
return `cogcoin domain delegate clear ${args[0] ?? "<domain>"}`;
|
|
861
|
+
},
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
id: "domain-miner-set",
|
|
865
|
+
handlerFamily: "wallet-mutation",
|
|
866
|
+
supportsYes: true,
|
|
867
|
+
supportsSatvb: true,
|
|
868
|
+
aliases: [{ tokens: ["domain", "miner", "set"] }],
|
|
869
|
+
helpEntries: [],
|
|
870
|
+
describeCommand(args) {
|
|
871
|
+
return `cogcoin domain miner set ${args[0] ?? "<domain>"} ${args[1] ?? "<btc-target>"}`;
|
|
872
|
+
},
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
id: "domain-miner-clear",
|
|
876
|
+
handlerFamily: "wallet-mutation",
|
|
877
|
+
supportsYes: true,
|
|
878
|
+
supportsSatvb: true,
|
|
879
|
+
aliases: [{ tokens: ["domain", "miner", "clear"] }],
|
|
880
|
+
helpEntries: [],
|
|
881
|
+
describeCommand(args) {
|
|
882
|
+
return `cogcoin domain miner clear ${args[0] ?? "<domain>"}`;
|
|
883
|
+
},
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
id: "domain-canonical",
|
|
887
|
+
handlerFamily: "wallet-mutation",
|
|
888
|
+
supportsYes: true,
|
|
889
|
+
supportsSatvb: true,
|
|
890
|
+
aliases: [{ tokens: ["domain", "canonical"] }],
|
|
891
|
+
helpEntries: [],
|
|
892
|
+
describeCommand(args) {
|
|
893
|
+
return `cogcoin domain canonical ${args[0] ?? "<domain>"}`;
|
|
894
|
+
},
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
id: "rep-give",
|
|
898
|
+
handlerFamily: "wallet-mutation",
|
|
899
|
+
supportsYes: true,
|
|
900
|
+
supportsSatvb: true,
|
|
901
|
+
aliases: [{ tokens: ["rep", "give"] }],
|
|
902
|
+
helpEntries: [
|
|
903
|
+
{
|
|
904
|
+
usage: "rep give <source-domain> <target-domain> <amount>",
|
|
905
|
+
description: "Burn COG as anchored-domain reputation support",
|
|
906
|
+
},
|
|
907
|
+
],
|
|
908
|
+
describeCommand(args) {
|
|
909
|
+
return `cogcoin rep give ${args[0] ?? "<source-domain>"} ${args[1] ?? "<target-domain>"} ${args[2] ?? "<amount>"}`;
|
|
910
|
+
},
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
id: "rep-revoke",
|
|
914
|
+
handlerFamily: "wallet-mutation",
|
|
915
|
+
supportsYes: true,
|
|
916
|
+
supportsSatvb: true,
|
|
917
|
+
aliases: [{ tokens: ["rep", "revoke"] }],
|
|
918
|
+
helpEntries: [
|
|
919
|
+
{
|
|
920
|
+
usage: "rep revoke <source-domain> <target-domain> <amount>",
|
|
921
|
+
description: "Revoke visible support without refunding burned COG",
|
|
922
|
+
},
|
|
923
|
+
],
|
|
924
|
+
describeCommand(args) {
|
|
925
|
+
return `cogcoin rep revoke ${args[0] ?? "<source-domain>"} ${args[1] ?? "<target-domain>"} ${args[2] ?? "<amount>"}`;
|
|
926
|
+
},
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
id: "sync",
|
|
930
|
+
handlerFamily: "sync",
|
|
931
|
+
supportsYes: true,
|
|
932
|
+
supportsSatvb: false,
|
|
933
|
+
aliases: [{ tokens: ["sync"] }],
|
|
934
|
+
helpEntries: [],
|
|
935
|
+
describeCommand() {
|
|
936
|
+
return "cogcoin sync";
|
|
937
|
+
},
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
id: "follow",
|
|
941
|
+
handlerFamily: "follow",
|
|
942
|
+
supportsYes: true,
|
|
943
|
+
supportsSatvb: false,
|
|
944
|
+
aliases: [{ tokens: ["follow"] }],
|
|
945
|
+
helpEntries: [],
|
|
946
|
+
describeCommand() {
|
|
947
|
+
return "cogcoin follow";
|
|
948
|
+
},
|
|
949
|
+
},
|
|
950
|
+
];
|
|
951
|
+
const removedPathSpecs = [
|
|
952
|
+
{ tokens: ["restore"], errorCode: "cli_restore_removed" },
|
|
953
|
+
{ tokens: ["wallet", "delete"], errorCode: "cli_wallet_delete_removed" },
|
|
954
|
+
{ tokens: ["wallet", "restore"], errorCode: "cli_wallet_restore_removed" },
|
|
955
|
+
{ tokens: ["wallet", "export"], errorCode: "cli_wallet_export_removed" },
|
|
956
|
+
{ tokens: ["wallet", "import"], errorCode: "cli_wallet_import_removed" },
|
|
957
|
+
{ tokens: ["anchor", "clear"], errorCode: "cli_anchor_clear_removed" },
|
|
958
|
+
{ tokens: ["domain", "anchor", "clear"], errorCode: "cli_anchor_clear_removed" },
|
|
959
|
+
];
|
|
960
|
+
const unknownPrefixSpecs = [
|
|
961
|
+
{ tokens: ["domain", "endpoint"], errorPrefix: "cli_unknown_command_domain_endpoint" },
|
|
962
|
+
{ tokens: ["domain", "delegate"], errorPrefix: "cli_unknown_command_domain_delegate" },
|
|
963
|
+
{ tokens: ["domain", "miner"], errorPrefix: "cli_unknown_command_domain_miner" },
|
|
964
|
+
{ tokens: ["wallet"], errorPrefix: "cli_unknown_command_wallet" },
|
|
965
|
+
{ tokens: ["bitcoin"], errorPrefix: "cli_unknown_command_bitcoin" },
|
|
966
|
+
{ tokens: ["client"], errorPrefix: "cli_unknown_command_client" },
|
|
967
|
+
{ tokens: ["indexer"], errorPrefix: "cli_unknown_command_indexer" },
|
|
968
|
+
{ tokens: ["mine"], errorPrefix: "cli_unknown_command_mine" },
|
|
969
|
+
{ tokens: ["domain"], errorPrefix: "cli_unknown_command_domain" },
|
|
970
|
+
{ tokens: ["cog"], errorPrefix: "cli_unknown_command_cog" },
|
|
971
|
+
{ tokens: ["rep"], errorPrefix: "cli_unknown_command_rep" },
|
|
972
|
+
];
|
|
973
|
+
const optionsSection = `Options:
|
|
974
|
+
--db <path> Override the SQLite database path
|
|
975
|
+
--data-dir <path> Override the managed bitcoin datadir
|
|
976
|
+
--for <duration> Relative timeout for cog lock, like 15m, 2h, or 1d
|
|
977
|
+
--message <text> Founding message text for anchor
|
|
978
|
+
--to <btc-target> Transfer or send target as an address or spk:<hex>
|
|
979
|
+
--to-domain <domain>
|
|
980
|
+
Recipient domain for cog lock
|
|
981
|
+
--condition <sha256hex>
|
|
982
|
+
32-byte lock condition hash
|
|
983
|
+
--until-height <height>
|
|
984
|
+
Absolute timeout height for cog lock
|
|
985
|
+
--preimage <32-byte-hex>
|
|
986
|
+
Claim preimage for an active lock
|
|
987
|
+
--review <text> Optional public review text for reputation operations
|
|
988
|
+
--satvb <n> Override the mutation fee rate in sat/vB
|
|
989
|
+
--text <utf8> UTF-8 payload text for endpoint or field writes
|
|
990
|
+
--json <json> UTF-8 payload JSON text for endpoint or field writes
|
|
991
|
+
--bytes <spec> Payload bytes as hex:<hex> or @<path>
|
|
992
|
+
--permanent Create the field as permanent
|
|
993
|
+
--format <spec> Advanced field format as raw:<u8>
|
|
994
|
+
--value <spec> Advanced field value as hex:<hex>, @<path>, or utf8:<text>
|
|
995
|
+
--claimable Show only currently claimable locks
|
|
996
|
+
--reclaimable Show only currently reclaimable locks
|
|
997
|
+
--anchored Show only anchored domains
|
|
998
|
+
--listed Show only currently listed domains
|
|
999
|
+
--mineable Show only locally mineable root domains
|
|
1000
|
+
--limit <n> Limit list rows (1..1000)
|
|
1001
|
+
--all Show all rows for list commands
|
|
1002
|
+
--follow Follow mining log output
|
|
1003
|
+
--progress <mode> Progress output mode: auto, tty, or none
|
|
1004
|
+
--force Reserved for future use
|
|
1005
|
+
--force-race Allow a visible root registration race
|
|
1006
|
+
--yes Approve eligible plain yes/no mutation confirmations non-interactively
|
|
1007
|
+
--help Show help
|
|
1008
|
+
--version Show package version`;
|
|
1009
|
+
const quickstartSection = `Quickstart:
|
|
1010
|
+
1. Run \`cogcoin init\` to create or restore a wallet.
|
|
1011
|
+
2. Run \`cogcoin sync\` to bootstrap assumeutxo and the managed Bitcoin/indexer state.
|
|
1012
|
+
3. Run \`cogcoin address\`, then fund the wallet with about 0.0015 BTC so you can buy a 6+ character domain to start mining and still keep BTC available for mining transaction fees.`;
|
|
1013
|
+
const examplesSection = `Examples:
|
|
1014
|
+
cogcoin status
|
|
1015
|
+
cogcoin bitcoin status
|
|
1016
|
+
cogcoin indexer status
|
|
1017
|
+
cogcoin init
|
|
1018
|
+
cogcoin wallet address
|
|
1019
|
+
cogcoin domain list --mineable
|
|
1020
|
+
cogcoin register alpha-child
|
|
1021
|
+
cogcoin anchor alpha
|
|
1022
|
+
cogcoin register alpha --satvb 12.5
|
|
1023
|
+
cogcoin buy alpha
|
|
1024
|
+
cogcoin field set alpha bio --text "hello"
|
|
1025
|
+
cogcoin rep give alpha beta 10 --review "great operator"
|
|
1026
|
+
cogcoin mine setup
|
|
1027
|
+
cogcoin mine prompt
|
|
1028
|
+
cogcoin mine prompt alpha
|
|
1029
|
+
cogcoin register alpha-child
|
|
1030
|
+
cogcoin mine status`;
|
|
1031
|
+
const commandSpecById = new Map(commandSpecs.map((spec) => [spec.id, spec]));
|
|
1032
|
+
const commandAliasEntries = commandSpecs.flatMap((spec) => spec.aliases.map((alias) => ({
|
|
1033
|
+
command: spec.id,
|
|
1034
|
+
tokens: alias.tokens,
|
|
1035
|
+
matchMode: alias.matchMode ?? "always",
|
|
1036
|
+
}))).sort((left, right) => right.tokens.length - left.tokens.length);
|
|
1037
|
+
function matchesTokens(argv, startIndex, tokens) {
|
|
1038
|
+
for (let offset = 0; offset < tokens.length; offset += 1) {
|
|
1039
|
+
if (argv[startIndex + offset] !== tokens[offset]) {
|
|
1040
|
+
return false;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
return true;
|
|
1044
|
+
}
|
|
1045
|
+
function nextTokenAfterMatch(argv, startIndex, tokens) {
|
|
1046
|
+
return argv[startIndex + tokens.length] ?? null;
|
|
1047
|
+
}
|
|
1048
|
+
function aliasMatches(argv, startIndex, alias) {
|
|
1049
|
+
if (!matchesTokens(argv, startIndex, alias.tokens)) {
|
|
1050
|
+
return false;
|
|
1051
|
+
}
|
|
1052
|
+
const nextToken = nextTokenAfterMatch(argv, startIndex, alias.tokens);
|
|
1053
|
+
switch (alias.matchMode) {
|
|
1054
|
+
case "always":
|
|
1055
|
+
return true;
|
|
1056
|
+
case "requires-arg":
|
|
1057
|
+
return nextToken !== null && !nextToken.startsWith("--");
|
|
1058
|
+
case "end-or-flag":
|
|
1059
|
+
return nextToken === null || nextToken.startsWith("--");
|
|
1060
|
+
default:
|
|
1061
|
+
return false;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
export function getCommandSpec(command) {
|
|
1065
|
+
return command === null ? null : (commandSpecById.get(command) ?? null);
|
|
1066
|
+
}
|
|
1067
|
+
export function resolveCommandMatch(argv, startIndex) {
|
|
1068
|
+
for (const removed of removedPathSpecs) {
|
|
1069
|
+
if (matchesTokens(argv, startIndex, removed.tokens)) {
|
|
1070
|
+
throw new Error(removed.errorCode);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
for (const alias of commandAliasEntries) {
|
|
1074
|
+
if (!aliasMatches(argv, startIndex, alias)) {
|
|
1075
|
+
continue;
|
|
1076
|
+
}
|
|
1077
|
+
return {
|
|
1078
|
+
command: alias.command,
|
|
1079
|
+
consumedTokens: alias.tokens.length,
|
|
1080
|
+
invokedTokens: alias.tokens,
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
return null;
|
|
1084
|
+
}
|
|
1085
|
+
export function resolveUnknownCommandError(argv, startIndex) {
|
|
1086
|
+
for (const prefix of unknownPrefixSpecs) {
|
|
1087
|
+
if (!matchesTokens(argv, startIndex, prefix.tokens)) {
|
|
1088
|
+
continue;
|
|
1089
|
+
}
|
|
1090
|
+
const nextToken = argv[startIndex + prefix.tokens.length] ?? null;
|
|
1091
|
+
return `${prefix.errorPrefix}${nextToken === null ? "" : `_${nextToken}`}`;
|
|
1092
|
+
}
|
|
1093
|
+
return `cli_unknown_command_${argv[startIndex] ?? ""}`;
|
|
1094
|
+
}
|
|
1095
|
+
export function getCommandHandlerFamily(command) {
|
|
1096
|
+
return getCommandSpec(command)?.handlerFamily ?? null;
|
|
1097
|
+
}
|
|
1098
|
+
export function commandSupportsYesFlag(command) {
|
|
1099
|
+
return getCommandSpec(command)?.supportsYes ?? false;
|
|
1100
|
+
}
|
|
1101
|
+
export function commandSupportsSatvb(command) {
|
|
1102
|
+
return getCommandSpec(command)?.supportsSatvb ?? false;
|
|
1103
|
+
}
|
|
1104
|
+
export function describeCanonicalCommandFromArgs(command, args, options = { follow: false }) {
|
|
1105
|
+
const spec = getCommandSpec(command);
|
|
1106
|
+
if (spec === null) {
|
|
1107
|
+
return command === null ? "cogcoin" : `cogcoin ${command.replaceAll("-", " ")}`;
|
|
1108
|
+
}
|
|
1109
|
+
return spec.describeCommand(args, options);
|
|
1110
|
+
}
|
|
1111
|
+
export function renderHelpText() {
|
|
1112
|
+
const commandLines = commandSpecs.flatMap((spec) => spec.helpEntries.map((entry) => {
|
|
1113
|
+
const paddedUsage = entry.usage.padEnd(24, " ");
|
|
1114
|
+
const gap = entry.usage.length >= 24 ? " " : "";
|
|
1115
|
+
return ` ${paddedUsage}${gap}${entry.description}`;
|
|
1116
|
+
}));
|
|
1117
|
+
return [
|
|
1118
|
+
"Usage: cogcoin <command> [options]",
|
|
1119
|
+
"",
|
|
1120
|
+
"Commands:",
|
|
1121
|
+
...commandLines,
|
|
1122
|
+
"",
|
|
1123
|
+
optionsSection,
|
|
1124
|
+
"",
|
|
1125
|
+
quickstartSection,
|
|
1126
|
+
"",
|
|
1127
|
+
examplesSection,
|
|
1128
|
+
].join("\n");
|
|
1129
|
+
}
|
|
1130
|
+
export function listCommandSpecsForTesting() {
|
|
1131
|
+
return commandSpecs;
|
|
1132
|
+
}
|