@cogcoin/client 0.5.6 → 0.5.8
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 +11 -2
- package/dist/bitcoind/bootstrap/getblock-archive.d.ts +39 -0
- package/dist/bitcoind/bootstrap/getblock-archive.js +548 -0
- package/dist/bitcoind/bootstrap.d.ts +1 -0
- package/dist/bitcoind/bootstrap.js +1 -0
- package/dist/bitcoind/client/factory.js +92 -30
- package/dist/bitcoind/client/managed-client.d.ts +1 -1
- package/dist/bitcoind/client/managed-client.js +22 -2
- package/dist/bitcoind/client/sync-engine.js +7 -0
- package/dist/bitcoind/errors.js +18 -0
- package/dist/bitcoind/indexer-daemon-main.js +78 -0
- package/dist/bitcoind/indexer-daemon.d.ts +3 -1
- package/dist/bitcoind/indexer-daemon.js +13 -6
- package/dist/bitcoind/node.js +2 -0
- package/dist/bitcoind/progress/constants.d.ts +1 -0
- package/dist/bitcoind/progress/constants.js +1 -0
- package/dist/bitcoind/progress/controller.d.ts +22 -0
- package/dist/bitcoind/progress/controller.js +48 -23
- package/dist/bitcoind/progress/formatting.js +25 -0
- package/dist/bitcoind/progress/render-policy.d.ts +35 -0
- package/dist/bitcoind/progress/render-policy.js +81 -0
- package/dist/bitcoind/service-paths.js +2 -6
- package/dist/bitcoind/service.d.ts +5 -1
- package/dist/bitcoind/service.js +92 -54
- package/dist/bitcoind/testing.d.ts +2 -1
- package/dist/bitcoind/testing.js +2 -1
- package/dist/bitcoind/types.d.ts +35 -1
- package/dist/cli/commands/follow.js +2 -0
- package/dist/cli/commands/getblock-archive-restart.d.ts +5 -0
- package/dist/cli/commands/getblock-archive-restart.js +15 -0
- package/dist/cli/commands/mining-admin.js +4 -0
- package/dist/cli/commands/mining-read.js +8 -5
- package/dist/cli/commands/mining-runtime.js +4 -0
- package/dist/cli/commands/status.js +2 -0
- package/dist/cli/commands/sync.js +2 -0
- package/dist/cli/commands/wallet-admin.js +29 -3
- package/dist/cli/commands/wallet-mutation.js +57 -4
- package/dist/cli/commands/wallet-read.js +2 -0
- package/dist/cli/context.js +5 -3
- package/dist/cli/mutation-command-groups.d.ts +2 -1
- package/dist/cli/mutation-command-groups.js +5 -0
- package/dist/cli/mutation-json.d.ts +18 -2
- package/dist/cli/mutation-json.js +47 -0
- package/dist/cli/mutation-success.d.ts +1 -0
- package/dist/cli/mutation-success.js +2 -2
- package/dist/cli/output.js +97 -1
- package/dist/cli/parse.d.ts +1 -1
- package/dist/cli/parse.js +127 -3
- package/dist/cli/preview-json.d.ts +10 -1
- package/dist/cli/preview-json.js +30 -0
- package/dist/cli/prompt.js +1 -1
- package/dist/cli/runner.js +20 -0
- package/dist/cli/signals.js +1 -1
- package/dist/cli/types.d.ts +11 -4
- package/dist/cli/wallet-format.js +6 -0
- package/dist/wallet/lifecycle.d.ts +18 -1
- package/dist/wallet/lifecycle.js +170 -81
- package/dist/wallet/mining/visualizer.d.ts +11 -6
- package/dist/wallet/mining/visualizer.js +32 -15
- package/dist/wallet/reset.js +39 -27
- package/dist/wallet/runtime.d.ts +12 -1
- package/dist/wallet/runtime.js +53 -11
- package/dist/wallet/state/provider.d.ts +1 -0
- package/dist/wallet/state/provider.js +119 -3
- package/dist/wallet/state/seed-index.d.ts +43 -0
- package/dist/wallet/state/seed-index.js +151 -0
- package/dist/wallet/tx/anchor.d.ts +22 -0
- package/dist/wallet/tx/anchor.js +201 -8
- package/dist/wallet/tx/index.d.ts +1 -1
- package/dist/wallet/tx/index.js +1 -1
- package/package.json +1 -1
|
@@ -140,6 +140,36 @@ export function buildAnchorMutationData(result, options) {
|
|
|
140
140
|
},
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
+
export function buildAnchorClearMutationData(result) {
|
|
144
|
+
const before = result.cleared
|
|
145
|
+
? {
|
|
146
|
+
localAnchorIntent: "reserved",
|
|
147
|
+
dedicatedIndex: result.releasedDedicatedIndex,
|
|
148
|
+
familyStatus: result.previousFamilyStatus,
|
|
149
|
+
familyStep: result.previousFamilyStep,
|
|
150
|
+
}
|
|
151
|
+
: null;
|
|
152
|
+
const after = result.cleared
|
|
153
|
+
? {
|
|
154
|
+
localAnchorIntent: "none",
|
|
155
|
+
dedicatedIndex: null,
|
|
156
|
+
familyStatus: "canceled",
|
|
157
|
+
familyStep: result.previousFamilyStep,
|
|
158
|
+
}
|
|
159
|
+
: null;
|
|
160
|
+
return buildStateChangeData({
|
|
161
|
+
kind: "anchor-clear",
|
|
162
|
+
state: {
|
|
163
|
+
domainName: result.domainName,
|
|
164
|
+
cleared: result.cleared,
|
|
165
|
+
previousFamilyStatus: result.previousFamilyStatus,
|
|
166
|
+
previousFamilyStep: result.previousFamilyStep,
|
|
167
|
+
releasedDedicatedIndex: result.releasedDedicatedIndex,
|
|
168
|
+
},
|
|
169
|
+
before,
|
|
170
|
+
after,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
143
173
|
export function buildResetMutationData(result) {
|
|
144
174
|
return buildOperationData({
|
|
145
175
|
kind: "reset",
|
|
@@ -171,6 +201,21 @@ export function buildResetMutationData(result) {
|
|
|
171
201
|
},
|
|
172
202
|
});
|
|
173
203
|
}
|
|
204
|
+
export function buildWalletDeleteMutationData(result) {
|
|
205
|
+
return buildOperationData({
|
|
206
|
+
kind: "wallet-delete",
|
|
207
|
+
state: {
|
|
208
|
+
seedName: result.seedName,
|
|
209
|
+
walletRootId: result.walletRootId,
|
|
210
|
+
deleted: result.deleted,
|
|
211
|
+
},
|
|
212
|
+
operation: {
|
|
213
|
+
seedName: result.seedName,
|
|
214
|
+
walletRootId: result.walletRootId,
|
|
215
|
+
deleted: result.deleted,
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
}
|
|
174
219
|
export function buildDomainAdminMutationData(result, options) {
|
|
175
220
|
const data = buildSingleTxMutationData({
|
|
176
221
|
kind: options.commandKind,
|
|
@@ -261,6 +306,7 @@ export function buildWalletLockMutationData(result) {
|
|
|
261
306
|
}
|
|
262
307
|
export function buildInitMutationData(result) {
|
|
263
308
|
const after = {
|
|
309
|
+
seedName: "main",
|
|
264
310
|
walletRootId: result.walletRootId,
|
|
265
311
|
fundingAddress: result.fundingAddress,
|
|
266
312
|
unlockUntilUnixMs: result.unlockUntilUnixMs,
|
|
@@ -275,6 +321,7 @@ export function buildInitMutationData(result) {
|
|
|
275
321
|
}
|
|
276
322
|
export function buildRestoreMutationData(result) {
|
|
277
323
|
const after = {
|
|
324
|
+
seedName: result.seedName ?? null,
|
|
278
325
|
walletRootId: result.walletRootId,
|
|
279
326
|
fundingAddress: result.fundingAddress,
|
|
280
327
|
unlockUntilUnixMs: result.unlockUntilUnixMs,
|
|
@@ -21,7 +21,7 @@ function reuseExplanation(reusedExisting, message) {
|
|
|
21
21
|
}
|
|
22
22
|
export function writeMutationCommandSuccess(parsed, context, options) {
|
|
23
23
|
if (parsed.outputMode === "preview-json") {
|
|
24
|
-
writeJsonValue(context.stdout, createPreviewSuccessEnvelope(resolvePreviewJsonSchema(parsed), describeCanonicalCommand(parsed), mutationOutcome(options.reusedExisting), options.previewData ?? options.data, {
|
|
24
|
+
writeJsonValue(context.stdout, createPreviewSuccessEnvelope(resolvePreviewJsonSchema(parsed), describeCanonicalCommand(parsed), options.outcome ?? mutationOutcome(options.reusedExisting), options.previewData ?? options.data, {
|
|
25
25
|
explanations: reuseExplanation(options.reusedExisting, options.reusedMessage),
|
|
26
26
|
nextSteps: options.nextSteps.json,
|
|
27
27
|
warnings: options.warnings,
|
|
@@ -29,7 +29,7 @@ export function writeMutationCommandSuccess(parsed, context, options) {
|
|
|
29
29
|
return 0;
|
|
30
30
|
}
|
|
31
31
|
if (parsed.outputMode === "json") {
|
|
32
|
-
writeJsonValue(context.stdout, createMutationSuccessEnvelope(resolveStableMutationJsonSchema(parsed), describeCanonicalCommand(parsed), mutationOutcome(options.reusedExisting), options.data, {
|
|
32
|
+
writeJsonValue(context.stdout, createMutationSuccessEnvelope(resolveStableMutationJsonSchema(parsed), describeCanonicalCommand(parsed), options.outcome ?? mutationOutcome(options.reusedExisting), options.data, {
|
|
33
33
|
explanations: reuseExplanation(options.reusedExisting, options.reusedMessage),
|
|
34
34
|
nextSteps: options.nextSteps.json,
|
|
35
35
|
warnings: options.warnings,
|
package/dist/cli/output.js
CHANGED
|
@@ -151,10 +151,13 @@ export function classifyCliError(error) {
|
|
|
151
151
|
}
|
|
152
152
|
if (message === "wallet_typed_confirmation_rejected"
|
|
153
153
|
|| message === "wallet_export_overwrite_declined"
|
|
154
|
+
|| message === "wallet_delete_confirmation_required"
|
|
154
155
|
|| message === "wallet_prompt_value_required"
|
|
155
156
|
|| message === "wallet_archive_passphrase_mismatch"
|
|
156
157
|
|| message === "wallet_restore_mnemonic_invalid"
|
|
157
158
|
|| message === "wallet_restore_replace_confirmation_required"
|
|
159
|
+
|| message === "wallet_seed_name_invalid"
|
|
160
|
+
|| message === "wallet_seed_name_reserved"
|
|
158
161
|
|| message === "reset_wallet_choice_invalid"
|
|
159
162
|
|| message === "reset_wallet_passphrase_required"
|
|
160
163
|
|| message === "reset_wallet_access_failed") {
|
|
@@ -166,6 +169,12 @@ export function classifyCliError(error) {
|
|
|
166
169
|
if (message === "wallet_import_archive_not_found") {
|
|
167
170
|
return { exitCode: 3, errorCode: message, message };
|
|
168
171
|
}
|
|
172
|
+
if (message === "wallet_seed_not_found") {
|
|
173
|
+
return { exitCode: 3, errorCode: message, message };
|
|
174
|
+
}
|
|
175
|
+
if (message === "wallet_seed_index_invalid") {
|
|
176
|
+
return { exitCode: 4, errorCode: message, message };
|
|
177
|
+
}
|
|
169
178
|
if (message === "reset_process_shutdown_failed"
|
|
170
179
|
|| message === "reset_data_root_delete_failed"
|
|
171
180
|
|| message === "reset_secret_cleanup_failed"
|
|
@@ -185,6 +194,10 @@ function isBlockedError(message) {
|
|
|
185
194
|
|| message === "wallet_export_core_replica_not_ready"
|
|
186
195
|
|| message === "wallet_export_tip_mismatch"
|
|
187
196
|
|| message === "wallet_export_requires_quiescent_local_state"
|
|
197
|
+
|| message === "wallet_restore_requires_main_wallet"
|
|
198
|
+
|| message === "wallet_seed_name_exists"
|
|
199
|
+
|| message === "wallet_seed_not_found"
|
|
200
|
+
|| message === "wallet_delete_main_not_supported"
|
|
188
201
|
|| message === "wallet_repair_indexer_reset_requires_yes"
|
|
189
202
|
|| message === "managed_bitcoind_service_version_mismatch"
|
|
190
203
|
|| message === "managed_bitcoind_wallet_root_mismatch"
|
|
@@ -303,6 +316,41 @@ export function createCliErrorPresentation(errorCode, fallbackMessage) {
|
|
|
303
316
|
next: "Run `cogcoin status` to inspect the existing wallet, or export/import it instead of reinitializing.",
|
|
304
317
|
};
|
|
305
318
|
}
|
|
319
|
+
if (errorCode === "wallet_restore_requires_main_wallet") {
|
|
320
|
+
return {
|
|
321
|
+
what: "Main wallet is required before importing another seed.",
|
|
322
|
+
why: "Named restore only creates imported seeds. Cogcoin requires the primary `main` wallet to exist first so shared local state has a canonical default seed.",
|
|
323
|
+
next: "Run `cogcoin init`, then rerun `cogcoin restore --seed <name>`.",
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
if (errorCode === "wallet_seed_name_exists") {
|
|
327
|
+
return {
|
|
328
|
+
what: "Seed name is already in use.",
|
|
329
|
+
why: "This machine already has a wallet seed registered with that name.",
|
|
330
|
+
next: "Choose a different `--seed` name, or delete the imported seed first with `cogcoin wallet delete --seed <name>`.",
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
if (errorCode === "wallet_seed_not_found") {
|
|
334
|
+
return {
|
|
335
|
+
what: "Seed was not found.",
|
|
336
|
+
why: "No local wallet seed is registered under that name.",
|
|
337
|
+
next: "Check `--seed <name>` and retry.",
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
if (errorCode === "wallet_seed_index_invalid") {
|
|
341
|
+
return {
|
|
342
|
+
what: "Wallet seed registry is invalid.",
|
|
343
|
+
why: "Cogcoin could not parse or trust the local seed registry file, so it cannot safely decide which named wallet seed to use.",
|
|
344
|
+
next: "Run `cogcoin repair`, then retry the command.",
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
if (errorCode === "wallet_delete_main_not_supported") {
|
|
348
|
+
return {
|
|
349
|
+
what: "The main wallet cannot be deleted with `wallet delete`.",
|
|
350
|
+
why: "This command only removes imported seeds. The canonical `main` wallet is part of the base local client state.",
|
|
351
|
+
next: "Use `cogcoin reset` if you need to remove the main wallet.",
|
|
352
|
+
};
|
|
353
|
+
}
|
|
306
354
|
if (errorCode === "local-state-corrupt" || errorCode.includes("repair_required") || errorCode.includes("repair-required")) {
|
|
307
355
|
return {
|
|
308
356
|
what: "Local recovery is required.",
|
|
@@ -342,7 +390,7 @@ export function createCliErrorPresentation(errorCode, fallbackMessage) {
|
|
|
342
390
|
return {
|
|
343
391
|
what: "Recovery phrase is invalid.",
|
|
344
392
|
why: "Mnemonic-only restore accepts only a valid 24-word English BIP39 phrase with a matching checksum.",
|
|
345
|
-
next: "Rerun `cogcoin restore
|
|
393
|
+
next: "Rerun `cogcoin restore --seed <name>` and enter the 24 recovery words in the original order.",
|
|
346
394
|
};
|
|
347
395
|
}
|
|
348
396
|
if (errorCode === "wallet_restore_replace_confirmation_required") {
|
|
@@ -352,6 +400,41 @@ export function createCliErrorPresentation(errorCode, fallbackMessage) {
|
|
|
352
400
|
next: "Rerun `cogcoin restore` in an interactive terminal and type \"RESTORE\" when prompted.",
|
|
353
401
|
};
|
|
354
402
|
}
|
|
403
|
+
if (errorCode === "wallet_seed_name_invalid" || errorCode === "wallet_seed_name_reserved" || errorCode === "cli_invalid_seed_name") {
|
|
404
|
+
return {
|
|
405
|
+
what: "Seed name is invalid.",
|
|
406
|
+
why: "Wallet seed names must be lowercase slugs like `trading` or `cold-backup`, and `main` is reserved.",
|
|
407
|
+
next: "Choose a different seed name and retry.",
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
if (errorCode === "cli_missing_seed_name") {
|
|
411
|
+
return {
|
|
412
|
+
what: "A seed name is required.",
|
|
413
|
+
why: "This command needs `--seed <name>` to identify which imported wallet seed it should restore or delete.",
|
|
414
|
+
next: "Rerun the command with `--seed <name>`.",
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
if (errorCode === "cli_seed_not_supported_for_command" || errorCode === "wallet_init_seed_not_supported" || errorCode === "wallet_import_seed_not_supported") {
|
|
418
|
+
return {
|
|
419
|
+
what: "This command does not support `--seed`.",
|
|
420
|
+
why: "Only wallet-aware commands are seed-selectable. Global lifecycle and shared service commands still operate on the shared local client state.",
|
|
421
|
+
next: "Drop `--seed` for this command and retry.",
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
if (errorCode === "wallet_anchor_clear_inconsistent_state") {
|
|
425
|
+
return {
|
|
426
|
+
what: "Pending anchor state is inconsistent.",
|
|
427
|
+
why: "The domain still shows local pending anchor state, but the wallet could not find a matching clearable reserved anchor family.",
|
|
428
|
+
next: "Run `cogcoin repair`, then inspect the domain again before retrying `cogcoin anchor clear`.",
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
if (errorCode.startsWith("wallet_anchor_clear_not_clearable_")) {
|
|
432
|
+
return {
|
|
433
|
+
what: "Pending anchor cannot be cleared safely.",
|
|
434
|
+
why: "This command only clears a local pre-broadcast reservation. The anchor family is already beyond that safe stage or may have been observed by the wallet.",
|
|
435
|
+
next: "Rerun `cogcoin anchor <domain>` to reconcile the family, or run `cogcoin repair` if it remains unresolved.",
|
|
436
|
+
};
|
|
437
|
+
}
|
|
355
438
|
if (errorCode === "mining_hooks_enable_trust_acknowledgement_required") {
|
|
356
439
|
return {
|
|
357
440
|
what: "Trust acknowledgement is still required.",
|
|
@@ -735,6 +818,8 @@ export function describeCanonicalCommand(parsed) {
|
|
|
735
818
|
case "restore":
|
|
736
819
|
case "wallet-restore":
|
|
737
820
|
return "cogcoin restore";
|
|
821
|
+
case "wallet-delete":
|
|
822
|
+
return "cogcoin wallet delete";
|
|
738
823
|
case "wallet-show-mnemonic":
|
|
739
824
|
return "cogcoin wallet show-mnemonic";
|
|
740
825
|
case "unlock":
|
|
@@ -749,6 +834,9 @@ export function describeCanonicalCommand(parsed) {
|
|
|
749
834
|
case "anchor":
|
|
750
835
|
case "domain-anchor":
|
|
751
836
|
return `cogcoin anchor ${args[0] ?? "<domain>"}`;
|
|
837
|
+
case "anchor-clear":
|
|
838
|
+
case "domain-anchor-clear":
|
|
839
|
+
return `cogcoin anchor clear ${args[0] ?? "<domain>"}`;
|
|
752
840
|
case "register":
|
|
753
841
|
case "domain-register":
|
|
754
842
|
return `cogcoin register ${args[0] ?? "<domain>"}`;
|
|
@@ -918,6 +1006,8 @@ export function resolveStableMutationJsonSchema(parsed) {
|
|
|
918
1006
|
case "restore":
|
|
919
1007
|
case "wallet-restore":
|
|
920
1008
|
return "cogcoin/restore/v1";
|
|
1009
|
+
case "wallet-delete":
|
|
1010
|
+
return "cogcoin/wallet-delete/v1";
|
|
921
1011
|
case "unlock":
|
|
922
1012
|
case "wallet-unlock":
|
|
923
1013
|
return "cogcoin/unlock/v1";
|
|
@@ -934,6 +1024,9 @@ export function resolveStableMutationJsonSchema(parsed) {
|
|
|
934
1024
|
case "anchor":
|
|
935
1025
|
case "domain-anchor":
|
|
936
1026
|
return "cogcoin/anchor/v1";
|
|
1027
|
+
case "anchor-clear":
|
|
1028
|
+
case "domain-anchor-clear":
|
|
1029
|
+
return "cogcoin/anchor-clear/v1";
|
|
937
1030
|
case "register":
|
|
938
1031
|
case "domain-register":
|
|
939
1032
|
return "cogcoin/register/v1";
|
|
@@ -1012,7 +1105,9 @@ export function resolvePreviewJsonSchema(parsed) {
|
|
|
1012
1105
|
case "reset":
|
|
1013
1106
|
case "repair":
|
|
1014
1107
|
case "anchor":
|
|
1108
|
+
case "anchor-clear":
|
|
1015
1109
|
case "domain-anchor":
|
|
1110
|
+
case "domain-anchor-clear":
|
|
1016
1111
|
case "register":
|
|
1017
1112
|
case "domain-register":
|
|
1018
1113
|
case "transfer":
|
|
@@ -1067,6 +1162,7 @@ function createSchemaProbe(command) {
|
|
|
1067
1162
|
dbPath: null,
|
|
1068
1163
|
dataDir: null,
|
|
1069
1164
|
progressOutput: "auto",
|
|
1165
|
+
seedName: null,
|
|
1070
1166
|
unlockFor: null,
|
|
1071
1167
|
assumeYes: false,
|
|
1072
1168
|
forceRace: false,
|
package/dist/cli/parse.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ParsedCliArgs } from "./types.js";
|
|
2
|
-
export declare const HELP_TEXT = "Usage: cogcoin <command> [options]\n\nCommands:\n status Show wallet-aware local service and chain status\n status --output json Emit the stable v1 machine-readable status envelope\n bitcoin start Start the managed Bitcoin daemon\n bitcoin stop Stop the managed Bitcoin daemon and paired indexer\n bitcoin status Show managed Bitcoin daemon status without starting it\n indexer start Start the managed Cogcoin indexer (and bitcoind if needed)\n indexer stop Stop the managed Cogcoin indexer only\n indexer status Show managed Cogcoin indexer status without starting it\n init Initialize a new local wallet root\n init --output json Emit the stable v1 machine-readable init result envelope\n restore Restore
|
|
2
|
+
export declare const HELP_TEXT = "Usage: cogcoin <command> [options]\n\nCommands:\n status Show wallet-aware local service and chain status\n status --output json Emit the stable v1 machine-readable status envelope\n bitcoin start Start the managed Bitcoin daemon\n bitcoin stop Stop the managed Bitcoin daemon and paired indexer\n bitcoin status Show managed Bitcoin daemon status without starting it\n indexer start Start the managed Cogcoin indexer (and bitcoind if needed)\n indexer stop Stop the managed Cogcoin indexer only\n indexer status Show managed Cogcoin indexer status without starting it\n init Initialize a new local wallet root\n init --output json Emit the stable v1 machine-readable init result envelope\n restore Restore an imported named seed from a 24-word mnemonic; run sync afterward\n reset Factory-reset local Cogcoin state with interactive retention prompts\n repair Recover bounded wallet/indexer/runtime state\n unlock Clear an explicit wallet lock and unlock for a limited duration\n wallet address Alias for address\n wallet ids Alias for ids\n hooks enable mining Enable a validated custom mining hook\n hooks disable mining Return to built-in mining hooks\n hooks status Show mining hook validation and trust status\n mine Run the miner in the foreground\n mine start Start the miner as a background worker\n mine stop Stop the active background miner\n mine setup Configure the built-in mining provider\n mine setup --output json\n Emit the stable v1 machine-readable mine setup result envelope\n mine status Show mining control-plane health and readiness\n mine log Show recent mining control-plane events\n anchor <domain> Anchor an owned unanchored domain with the Tx1/Tx2 family\n anchor clear <domain> Clear a local-only pending anchor reservation before broadcast\n register <domain> [--from <identity>]\n Register a root domain or subdomain\n transfer <domain> --to <btc-target>\n Transfer an unanchored domain to another BTC identity\n sell <domain> <price> List an unanchored domain for sale in COG\n unsell <domain> Clear an active domain listing\n buy <domain> [--from <identity>]\n Buy an unanchored listed domain in COG\n send <amount> --to <btc-target>\n Send COG from one local identity to another BTC target\n claim <lock-id> --preimage <32-byte-hex>\n Claim an active COG lock before timeout\n reclaim <lock-id> Reclaim an expired COG lock as the original locker\n cog lock <amount> --to-domain <domain> (--for <blocks-or-duration> | --until-height <height>) --condition <sha256hex>\n Lock COG to an anchored recipient domain\n wallet status Show detailed wallet-local status and service health\n wallet init Initialize a new local wallet root\n wallet restore Restore an imported named seed from a 24-word mnemonic; run sync afterward\n wallet delete Delete one imported named seed without affecting main\n wallet show-mnemonic Reveal the initialized wallet recovery phrase after typed confirmation\n wallet unlock Clear an explicit wallet lock and unlock for a limited duration\n wallet lock Lock the local wallet and disable on-demand unlock\n wallet export <path> Export a portable encrypted wallet archive\n wallet import <path> Import a portable encrypted wallet archive\n address Show the BTC funding identity for this wallet\n ids List locally controlled identities\n balance Show per-identity COG balances\n locks Show locally related active COG locks\n domain list Alias for domains\n domain show <domain> Alias for show <domain>\n domains [--anchored] [--listed] [--mineable]\n Show locally related domains\n show <domain> Show one domain and its local-wallet relationship\n fields <domain> List current fields on a domain\n field <domain> <field> Show one current field value\n field create <domain> <field>\n Create a new anchored field, optionally with an initial value\n field set <domain> <field>\n Update an existing anchored field value\n field clear <domain> <field>\n Clear an existing anchored field value\n rep give <source-domain> <target-domain> <amount>\n Burn COG as anchored-domain reputation support\n rep revoke <source-domain> <target-domain> <amount>\n Revoke visible support without refunding burned COG\n\nOptions:\n --db <path> Override the SQLite database path\n --data-dir <path> Override the managed bitcoin datadir\n --for <duration> Unlock duration like 15m, 2h, or 1d when unlocking explicitly\n --message <text> Founding message text for anchor\n --to <btc-target> Transfer or send target as an address or spk:<hex>\n --from <identity> Resolve sender identity as id:<n>, domain:<name>, address, or spk:<hex>\n --to-domain <domain>\n Recipient domain for cog lock\n --condition <sha256hex>\n 32-byte lock condition hash\n --until-height <height>\n Absolute timeout height for cog lock\n --preimage <32-byte-hex>\n Claim preimage for an active lock\n --review <text> Optional public review text for reputation operations\n --text <utf8> UTF-8 payload text for endpoint or field writes\n --json <json> UTF-8 payload JSON text for endpoint or field writes\n --bytes <spec> Payload bytes as hex:<hex> or @<path>\n --permanent Create the field as permanent\n --format <spec> Advanced field format as raw:<u8>\n --value <spec> Advanced field value as hex:<hex>, @<path>, or utf8:<text>\n --claimable Show only currently claimable locks\n --reclaimable Show only currently reclaimable locks\n --anchored Show only anchored domains\n --listed Show only currently listed domains\n --mineable Show only locally mineable root domains\n --limit <n> Limit list rows (1..1000)\n --all Show all rows for list commands\n --verify Run full custom-hook verification\n --follow Follow mining log output\n --output <mode> Output mode: text, json, or preview-json\n --progress <mode> Progress output mode: auto, tty, or none\n --seed <name> Select an imported wallet seed for wallet-aware commands\n --force-race Allow a visible root registration race\n --yes Approve eligible plain yes/no mutation confirmations non-interactively\n --help Show help\n --version Show package version\n\nQuickstart:\n 1. Run `cogcoin init` to create the wallet.\n 2. Run `cogcoin sync` to bootstrap assumeutxo and the managed Bitcoin/indexer state.\n 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.\n\nExamples:\n cogcoin status --output json\n cogcoin bitcoin status\n cogcoin indexer status\n cogcoin init --output json\n cogcoin restore --seed trading\n cogcoin wallet address\n cogcoin domain list --mineable\n cogcoin register alpha-child\n cogcoin register weatherbot --from id:1\n cogcoin anchor alpha\n cogcoin buy alpha\n cogcoin buy alpha --from id:1\n cogcoin field create alpha bio --text \"hello\"\n cogcoin rep give alpha beta 10 --review \"great operator\"\n cogcoin hooks status\n cogcoin mine setup --output json\n cogcoin register alpha-child --output preview-json\n cogcoin mine status\n";
|
|
3
3
|
export declare function parseCliArgs(argv: string[]): ParsedCliArgs;
|
package/dist/cli/parse.js
CHANGED
|
@@ -12,7 +12,7 @@ Commands:
|
|
|
12
12
|
indexer status Show managed Cogcoin indexer status without starting it
|
|
13
13
|
init Initialize a new local wallet root
|
|
14
14
|
init --output json Emit the stable v1 machine-readable init result envelope
|
|
15
|
-
restore Restore
|
|
15
|
+
restore Restore an imported named seed from a 24-word mnemonic; run sync afterward
|
|
16
16
|
reset Factory-reset local Cogcoin state with interactive retention prompts
|
|
17
17
|
repair Recover bounded wallet/indexer/runtime state
|
|
18
18
|
unlock Clear an explicit wallet lock and unlock for a limited duration
|
|
@@ -30,6 +30,7 @@ Commands:
|
|
|
30
30
|
mine status Show mining control-plane health and readiness
|
|
31
31
|
mine log Show recent mining control-plane events
|
|
32
32
|
anchor <domain> Anchor an owned unanchored domain with the Tx1/Tx2 family
|
|
33
|
+
anchor clear <domain> Clear a local-only pending anchor reservation before broadcast
|
|
33
34
|
register <domain> [--from <identity>]
|
|
34
35
|
Register a root domain or subdomain
|
|
35
36
|
transfer <domain> --to <btc-target>
|
|
@@ -47,7 +48,8 @@ Commands:
|
|
|
47
48
|
Lock COG to an anchored recipient domain
|
|
48
49
|
wallet status Show detailed wallet-local status and service health
|
|
49
50
|
wallet init Initialize a new local wallet root
|
|
50
|
-
wallet restore Restore
|
|
51
|
+
wallet restore Restore an imported named seed from a 24-word mnemonic; run sync afterward
|
|
52
|
+
wallet delete Delete one imported named seed without affecting main
|
|
51
53
|
wallet show-mnemonic Reveal the initialized wallet recovery phrase after typed confirmation
|
|
52
54
|
wallet unlock Clear an explicit wallet lock and unlock for a limited duration
|
|
53
55
|
wallet lock Lock the local wallet and disable on-demand unlock
|
|
@@ -108,6 +110,7 @@ Options:
|
|
|
108
110
|
--follow Follow mining log output
|
|
109
111
|
--output <mode> Output mode: text, json, or preview-json
|
|
110
112
|
--progress <mode> Progress output mode: auto, tty, or none
|
|
113
|
+
--seed <name> Select an imported wallet seed for wallet-aware commands
|
|
111
114
|
--force-race Allow a visible root registration race
|
|
112
115
|
--yes Approve eligible plain yes/no mutation confirmations non-interactively
|
|
113
116
|
--help Show help
|
|
@@ -123,6 +126,7 @@ Examples:
|
|
|
123
126
|
cogcoin bitcoin status
|
|
124
127
|
cogcoin indexer status
|
|
125
128
|
cogcoin init --output json
|
|
129
|
+
cogcoin restore --seed trading
|
|
126
130
|
cogcoin wallet address
|
|
127
131
|
cogcoin domain list --mineable
|
|
128
132
|
cogcoin register alpha-child
|
|
@@ -139,7 +143,12 @@ Examples:
|
|
|
139
143
|
`;
|
|
140
144
|
function supportsYesFlag(command) {
|
|
141
145
|
switch (command) {
|
|
146
|
+
case "sync":
|
|
147
|
+
case "follow":
|
|
142
148
|
case "repair":
|
|
149
|
+
case "wallet-delete":
|
|
150
|
+
case "anchor-clear":
|
|
151
|
+
case "domain-anchor-clear":
|
|
143
152
|
case "register":
|
|
144
153
|
case "domain-register":
|
|
145
154
|
case "transfer":
|
|
@@ -174,6 +183,81 @@ function supportsYesFlag(command) {
|
|
|
174
183
|
return false;
|
|
175
184
|
}
|
|
176
185
|
}
|
|
186
|
+
function supportsSeedFlag(command) {
|
|
187
|
+
switch (command) {
|
|
188
|
+
case "status":
|
|
189
|
+
case "unlock":
|
|
190
|
+
case "anchor":
|
|
191
|
+
case "anchor-clear":
|
|
192
|
+
case "domain-anchor":
|
|
193
|
+
case "domain-anchor-clear":
|
|
194
|
+
case "register":
|
|
195
|
+
case "domain-register":
|
|
196
|
+
case "transfer":
|
|
197
|
+
case "domain-transfer":
|
|
198
|
+
case "sell":
|
|
199
|
+
case "domain-sell":
|
|
200
|
+
case "unsell":
|
|
201
|
+
case "domain-unsell":
|
|
202
|
+
case "buy":
|
|
203
|
+
case "domain-buy":
|
|
204
|
+
case "domain-endpoint-set":
|
|
205
|
+
case "domain-endpoint-clear":
|
|
206
|
+
case "domain-delegate-set":
|
|
207
|
+
case "domain-delegate-clear":
|
|
208
|
+
case "domain-miner-set":
|
|
209
|
+
case "domain-miner-clear":
|
|
210
|
+
case "domain-canonical":
|
|
211
|
+
case "field-list":
|
|
212
|
+
case "field-show":
|
|
213
|
+
case "field-create":
|
|
214
|
+
case "field-set":
|
|
215
|
+
case "field-clear":
|
|
216
|
+
case "send":
|
|
217
|
+
case "claim":
|
|
218
|
+
case "reclaim":
|
|
219
|
+
case "cog-send":
|
|
220
|
+
case "cog-claim":
|
|
221
|
+
case "cog-reclaim":
|
|
222
|
+
case "cog-lock":
|
|
223
|
+
case "rep-give":
|
|
224
|
+
case "rep-revoke":
|
|
225
|
+
case "cog-balance":
|
|
226
|
+
case "cog-locks":
|
|
227
|
+
case "mine":
|
|
228
|
+
case "mine-start":
|
|
229
|
+
case "mine-stop":
|
|
230
|
+
case "mine-setup":
|
|
231
|
+
case "mine-status":
|
|
232
|
+
case "mine-log":
|
|
233
|
+
case "wallet-export":
|
|
234
|
+
case "wallet-delete":
|
|
235
|
+
case "wallet-restore":
|
|
236
|
+
case "restore":
|
|
237
|
+
case "wallet-show-mnemonic":
|
|
238
|
+
case "wallet-lock":
|
|
239
|
+
case "wallet-unlock":
|
|
240
|
+
case "wallet-status":
|
|
241
|
+
case "wallet-address":
|
|
242
|
+
case "wallet-ids":
|
|
243
|
+
case "address":
|
|
244
|
+
case "ids":
|
|
245
|
+
case "balance":
|
|
246
|
+
case "locks":
|
|
247
|
+
case "domain-list":
|
|
248
|
+
case "domains":
|
|
249
|
+
case "domain-show":
|
|
250
|
+
case "show":
|
|
251
|
+
case "fields":
|
|
252
|
+
case "field":
|
|
253
|
+
return true;
|
|
254
|
+
default:
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
function requiresSeedFlag(command) {
|
|
259
|
+
return command === "restore" || command === "wallet-restore" || command === "wallet-delete";
|
|
260
|
+
}
|
|
177
261
|
export function parseCliArgs(argv) {
|
|
178
262
|
let command = null;
|
|
179
263
|
const args = [];
|
|
@@ -183,6 +267,7 @@ export function parseCliArgs(argv) {
|
|
|
183
267
|
let dbPath = null;
|
|
184
268
|
let dataDir = null;
|
|
185
269
|
let progressOutput = "auto";
|
|
270
|
+
let seedName = null;
|
|
186
271
|
let unlockFor = null;
|
|
187
272
|
let assumeYes = false;
|
|
188
273
|
let forceRace = false;
|
|
@@ -236,6 +321,17 @@ export function parseCliArgs(argv) {
|
|
|
236
321
|
}
|
|
237
322
|
continue;
|
|
238
323
|
}
|
|
324
|
+
if (token === "--seed") {
|
|
325
|
+
index += 1;
|
|
326
|
+
seedName = argv[index] ?? null;
|
|
327
|
+
if (seedName === null) {
|
|
328
|
+
throw new Error("cli_missing_seed_name");
|
|
329
|
+
}
|
|
330
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(seedName)) {
|
|
331
|
+
throw new Error("cli_invalid_seed_name");
|
|
332
|
+
}
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
239
335
|
if (token === "--data-dir") {
|
|
240
336
|
index += 1;
|
|
241
337
|
dataDir = argv[index] ?? null;
|
|
@@ -452,6 +548,11 @@ export function parseCliArgs(argv) {
|
|
|
452
548
|
index += 1;
|
|
453
549
|
continue;
|
|
454
550
|
}
|
|
551
|
+
if (subcommand === "delete") {
|
|
552
|
+
command = "wallet-delete";
|
|
553
|
+
index += 1;
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
455
556
|
if (subcommand === "show-mnemonic") {
|
|
456
557
|
command = "wallet-show-mnemonic";
|
|
457
558
|
index += 1;
|
|
@@ -586,6 +687,12 @@ export function parseCliArgs(argv) {
|
|
|
586
687
|
continue;
|
|
587
688
|
}
|
|
588
689
|
if (subcommand === "anchor") {
|
|
690
|
+
const action = argv[index + 2] ?? null;
|
|
691
|
+
if (action === "clear") {
|
|
692
|
+
command = "domain-anchor-clear";
|
|
693
|
+
index += 2;
|
|
694
|
+
continue;
|
|
695
|
+
}
|
|
589
696
|
command = "domain-anchor";
|
|
590
697
|
index += 1;
|
|
591
698
|
continue;
|
|
@@ -761,6 +868,11 @@ export function parseCliArgs(argv) {
|
|
|
761
868
|
|| token === "domains"
|
|
762
869
|
|| token === "show"
|
|
763
870
|
|| token === "fields") {
|
|
871
|
+
if (token === "anchor" && argv[index + 1] === "clear") {
|
|
872
|
+
command = "anchor-clear";
|
|
873
|
+
index += 1;
|
|
874
|
+
continue;
|
|
875
|
+
}
|
|
764
876
|
command = token;
|
|
765
877
|
continue;
|
|
766
878
|
}
|
|
@@ -780,6 +892,7 @@ export function parseCliArgs(argv) {
|
|
|
780
892
|
|| command === "reset"
|
|
781
893
|
|| command === "unlock"
|
|
782
894
|
|| command === "wallet-init"
|
|
895
|
+
|| command === "wallet-delete"
|
|
783
896
|
|| command === "wallet-restore"
|
|
784
897
|
|| command === "wallet-lock"
|
|
785
898
|
|| command === "wallet-unlock"
|
|
@@ -812,7 +925,11 @@ export function parseCliArgs(argv) {
|
|
|
812
925
|
if ((command === "register" || command === "domain-register") && args.length !== 1) {
|
|
813
926
|
throw new Error("cli_missing_domain_argument");
|
|
814
927
|
}
|
|
815
|
-
if ((command === "anchor"
|
|
928
|
+
if ((command === "anchor"
|
|
929
|
+
|| command === "domain-anchor"
|
|
930
|
+
|| command === "anchor-clear"
|
|
931
|
+
|| command === "domain-anchor-clear")
|
|
932
|
+
&& args.length !== 1) {
|
|
816
933
|
throw new Error("cli_missing_domain_argument");
|
|
817
934
|
}
|
|
818
935
|
if ((command === "domain-endpoint-set"
|
|
@@ -868,6 +985,12 @@ export function parseCliArgs(argv) {
|
|
|
868
985
|
if (assumeYes && !supportsYesFlag(command)) {
|
|
869
986
|
throw new Error("cli_yes_not_supported_for_command");
|
|
870
987
|
}
|
|
988
|
+
if (seedName !== null && !supportsSeedFlag(command)) {
|
|
989
|
+
throw new Error("cli_seed_not_supported_for_command");
|
|
990
|
+
}
|
|
991
|
+
if (requiresSeedFlag(command) && seedName === null) {
|
|
992
|
+
throw new Error("cli_missing_seed_name");
|
|
993
|
+
}
|
|
871
994
|
if (forceRace && command !== "register" && command !== "domain-register") {
|
|
872
995
|
throw new Error("cli_force_race_not_supported_for_command");
|
|
873
996
|
}
|
|
@@ -1012,6 +1135,7 @@ export function parseCliArgs(argv) {
|
|
|
1012
1135
|
dbPath,
|
|
1013
1136
|
dataDir,
|
|
1014
1137
|
progressOutput,
|
|
1138
|
+
seedName,
|
|
1015
1139
|
unlockFor,
|
|
1016
1140
|
assumeYes,
|
|
1017
1141
|
forceRace,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnchorDomainResult, CogMutationResult, DomainAdminMutationResult, DomainMarketMutationResult, FieldMutationResult, RegisterDomainResult, ReputationMutationResult } from "../wallet/tx/index.js";
|
|
1
|
+
import type { AnchorDomainResult, ClearPendingAnchorResult, CogMutationResult, DomainAdminMutationResult, DomainMarketMutationResult, FieldMutationResult, RegisterDomainResult, ReputationMutationResult } from "../wallet/tx/index.js";
|
|
2
2
|
import type { WalletRepairResult, WalletResetPreview } from "../wallet/lifecycle.js";
|
|
3
3
|
import type { MiningControlPlaneView, MiningRuntimeStatusV1 } from "../wallet/mining/index.js";
|
|
4
4
|
export declare function buildSingleTxMutationPreviewData(options: {
|
|
@@ -223,6 +223,15 @@ export declare function buildAnchorPreviewData(result: AnchorDomainResult, optio
|
|
|
223
223
|
};
|
|
224
224
|
intent: Record<string, unknown>;
|
|
225
225
|
};
|
|
226
|
+
export declare function buildAnchorClearPreviewData(result: ClearPendingAnchorResult): {
|
|
227
|
+
resultType: "state-change";
|
|
228
|
+
stateChange: {
|
|
229
|
+
kind: string;
|
|
230
|
+
before: Record<string, unknown> | null;
|
|
231
|
+
after: Record<string, unknown> | null;
|
|
232
|
+
};
|
|
233
|
+
state: Record<string, unknown>;
|
|
234
|
+
};
|
|
226
235
|
export declare function buildDomainAdminPreviewData(result: DomainAdminMutationResult, options: {
|
|
227
236
|
commandKind: "domain-endpoint-set" | "domain-endpoint-clear" | "domain-delegate-set" | "domain-delegate-clear" | "domain-miner-set" | "domain-miner-clear" | "domain-canonical";
|
|
228
237
|
}): {
|
package/dist/cli/preview-json.js
CHANGED
|
@@ -140,6 +140,36 @@ export function buildAnchorPreviewData(result, options) {
|
|
|
140
140
|
},
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
+
export function buildAnchorClearPreviewData(result) {
|
|
144
|
+
const before = result.cleared
|
|
145
|
+
? {
|
|
146
|
+
localAnchorIntent: "reserved",
|
|
147
|
+
dedicatedIndex: result.releasedDedicatedIndex,
|
|
148
|
+
familyStatus: result.previousFamilyStatus,
|
|
149
|
+
familyStep: result.previousFamilyStep,
|
|
150
|
+
}
|
|
151
|
+
: null;
|
|
152
|
+
const after = result.cleared
|
|
153
|
+
? {
|
|
154
|
+
localAnchorIntent: "none",
|
|
155
|
+
dedicatedIndex: null,
|
|
156
|
+
familyStatus: "canceled",
|
|
157
|
+
familyStep: result.previousFamilyStep,
|
|
158
|
+
}
|
|
159
|
+
: null;
|
|
160
|
+
return buildStateChangePreviewData({
|
|
161
|
+
kind: "anchor-clear",
|
|
162
|
+
state: {
|
|
163
|
+
domainName: result.domainName,
|
|
164
|
+
cleared: result.cleared,
|
|
165
|
+
previousFamilyStatus: result.previousFamilyStatus,
|
|
166
|
+
previousFamilyStep: result.previousFamilyStep,
|
|
167
|
+
releasedDedicatedIndex: result.releasedDedicatedIndex,
|
|
168
|
+
},
|
|
169
|
+
before,
|
|
170
|
+
after,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
143
173
|
export function buildDomainAdminPreviewData(result, options) {
|
|
144
174
|
const data = buildSingleTxMutationPreviewData({
|
|
145
175
|
kind: options.commandKind,
|
package/dist/cli/prompt.js
CHANGED
|
@@ -53,7 +53,7 @@ export function createTerminalPrompter(input, output) {
|
|
|
53
53
|
if (!input.isTTY || !output.isTTY) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
if (scope === "mnemonic-reveal") {
|
|
56
|
+
if (scope === "mnemonic-reveal" || scope === "restore-mnemonic-entry") {
|
|
57
57
|
output.write(CLEAR_SENSITIVE_DISPLAY_SEQUENCE);
|
|
58
58
|
}
|
|
59
59
|
},
|