@cogcoin/client 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli/commands/mining-read.js +1 -1
- package/dist/cli/commands/wallet-mutation/anchor.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/anchor.js +33 -0
- package/dist/cli/commands/wallet-mutation/bitcoin-transfer.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/bitcoin-transfer.js +32 -0
- package/dist/cli/commands/wallet-mutation/cog.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/cog.js +131 -0
- package/dist/cli/commands/wallet-mutation/context.d.ts +3 -0
- package/dist/cli/commands/wallet-mutation/context.js +18 -0
- package/dist/cli/commands/wallet-mutation/domain-admin.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/domain-admin.js +173 -0
- package/dist/cli/commands/wallet-mutation/domain-market.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/domain-market.js +107 -0
- package/dist/cli/commands/wallet-mutation/field.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/field.js +125 -0
- package/dist/cli/commands/wallet-mutation/register.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/register.js +38 -0
- package/dist/cli/commands/wallet-mutation/registry.d.ts +3 -0
- package/dist/cli/commands/wallet-mutation/registry.js +39 -0
- package/dist/cli/commands/wallet-mutation/reputation.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation/reputation.js +57 -0
- package/dist/cli/commands/wallet-mutation/types.d.ts +32 -0
- package/dist/cli/commands/wallet-mutation/types.js +1 -0
- package/dist/cli/commands/wallet-mutation.js +13 -765
- package/dist/cli/commands/wallet-read.js +4 -4
- package/dist/cli/mutation-success.d.ts +0 -2
- package/dist/cli/output/classify.d.ts +7 -0
- package/dist/cli/output/classify.js +94 -0
- package/dist/cli/output/render.d.ts +2 -0
- package/dist/cli/output/render.js +13 -0
- package/dist/cli/output/rules/cli-surface.d.ts +2 -0
- package/dist/cli/output/rules/cli-surface.js +110 -0
- package/dist/cli/output/rules/generic.d.ts +2 -0
- package/dist/cli/output/rules/generic.js +13 -0
- package/dist/cli/output/rules/index.d.ts +2 -0
- package/dist/cli/output/rules/index.js +24 -0
- package/dist/cli/output/rules/mining-update.d.ts +2 -0
- package/dist/cli/output/rules/mining-update.js +68 -0
- package/dist/cli/output/rules/services.d.ts +2 -0
- package/dist/cli/output/rules/services.js +110 -0
- package/dist/cli/output/rules/wallet-admin.d.ts +2 -0
- package/dist/cli/output/rules/wallet-admin.js +224 -0
- package/dist/cli/output/rules/wallet-mutations.d.ts +2 -0
- package/dist/cli/output/rules/wallet-mutations.js +274 -0
- package/dist/cli/output/types.d.ts +16 -0
- package/dist/cli/output/types.js +1 -0
- package/dist/cli/output.d.ts +2 -168
- package/dist/cli/output.js +6 -989
- package/dist/cli/pagination.d.ts +15 -0
- package/dist/cli/pagination.js +16 -0
- package/dist/cli/recommendations.d.ts +4 -0
- package/dist/cli/recommendations.js +108 -0
- package/dist/cli/wallet-format/availability.d.ts +5 -0
- package/dist/cli/wallet-format/availability.js +96 -0
- package/dist/cli/wallet-format/balance.d.ts +2 -0
- package/dist/cli/wallet-format/balance.js +162 -0
- package/dist/cli/wallet-format/domains.d.ts +8 -0
- package/dist/cli/wallet-format/domains.js +84 -0
- package/dist/cli/wallet-format/fields.d.ts +6 -0
- package/dist/cli/wallet-format/fields.js +61 -0
- package/dist/cli/wallet-format/identity.d.ts +5 -0
- package/dist/cli/wallet-format/identity.js +19 -0
- package/dist/cli/wallet-format/locks.d.ts +7 -0
- package/dist/cli/wallet-format/locks.js +52 -0
- package/dist/cli/wallet-format/overview.d.ts +2 -0
- package/dist/cli/wallet-format/overview.js +122 -0
- package/dist/cli/wallet-format/pending.d.ts +13 -0
- package/dist/cli/wallet-format/pending.js +101 -0
- package/dist/cli/wallet-format/shared.d.ts +7 -0
- package/dist/cli/wallet-format/shared.js +31 -0
- package/dist/cli/wallet-format/status.d.ts +3 -0
- package/dist/cli/wallet-format/status.js +27 -0
- package/dist/cli/wallet-format.d.ts +8 -30
- package/dist/cli/wallet-format.js +8 -830
- package/dist/cli/wallet-read-helpers.d.ts +6 -0
- package/dist/cli/wallet-read-helpers.js +17 -0
- package/dist/wallet/mining/candidate.d.ts +1 -1
- package/dist/wallet/mining/candidate.js +3 -3
- package/dist/wallet/mining/constants.d.ts +2 -2
- package/dist/wallet/mining/constants.js +2 -2
- package/dist/wallet/mining/sentence-protocol.d.ts +2 -2
- package/dist/wallet/mining/sentences.js +8 -8
- package/dist/wallet/tx/anchor/confirm.d.ts +15 -0
- package/dist/wallet/tx/anchor/confirm.js +60 -0
- package/dist/wallet/tx/anchor/draft.d.ts +39 -0
- package/dist/wallet/tx/anchor/draft.js +167 -0
- package/dist/wallet/tx/anchor/index.d.ts +5 -0
- package/dist/wallet/tx/anchor/index.js +148 -0
- package/dist/wallet/tx/anchor/intent.d.ts +61 -0
- package/dist/wallet/tx/anchor/intent.js +101 -0
- package/dist/wallet/tx/anchor/plan.d.ts +3 -0
- package/dist/wallet/tx/anchor/plan.js +18 -0
- package/dist/wallet/tx/anchor/result.d.ts +25 -0
- package/dist/wallet/tx/anchor/result.js +20 -0
- package/dist/wallet/tx/anchor.d.ts +1 -39
- package/dist/wallet/tx/anchor.js +1 -494
- package/dist/wallet/tx/bitcoin-transfer/confirm.d.ts +7 -0
- package/dist/wallet/tx/bitcoin-transfer/confirm.js +11 -0
- package/dist/wallet/tx/bitcoin-transfer/index.d.ts +5 -0
- package/dist/wallet/tx/bitcoin-transfer/index.js +112 -0
- package/dist/wallet/tx/bitcoin-transfer/intent.d.ts +52 -0
- package/dist/wallet/tx/bitcoin-transfer/intent.js +74 -0
- package/dist/wallet/tx/bitcoin-transfer/plan.d.ts +5 -0
- package/dist/wallet/tx/bitcoin-transfer/plan.js +21 -0
- package/dist/wallet/tx/bitcoin-transfer/result.d.ts +19 -0
- package/dist/wallet/tx/bitcoin-transfer/result.js +16 -0
- package/dist/wallet/tx/bitcoin-transfer.d.ts +1 -35
- package/dist/wallet/tx/bitcoin-transfer.js +1 -200
- package/dist/wallet/tx/cog/confirm.d.ts +13 -0
- package/dist/wallet/tx/cog/confirm.js +59 -0
- package/dist/wallet/tx/cog/draft.d.ts +20 -0
- package/dist/wallet/tx/cog/draft.js +114 -0
- package/dist/wallet/tx/cog/index.d.ts +6 -0
- package/dist/wallet/tx/cog/index.js +117 -0
- package/dist/wallet/tx/cog/intent.d.ts +30 -0
- package/dist/wallet/tx/cog/intent.js +169 -0
- package/dist/wallet/tx/cog/plan.d.ts +19 -0
- package/dist/wallet/tx/cog/plan.js +65 -0
- package/dist/wallet/tx/cog/result.d.ts +27 -0
- package/dist/wallet/tx/cog/result.js +28 -0
- package/dist/wallet/tx/cog/types.d.ts +186 -0
- package/dist/wallet/tx/cog/types.js +2 -0
- package/dist/wallet/tx/cog/variants/claim.d.ts +3 -0
- package/dist/wallet/tx/cog/variants/claim.js +92 -0
- package/dist/wallet/tx/cog/variants/lock.d.ts +2 -0
- package/dist/wallet/tx/cog/variants/lock.js +102 -0
- package/dist/wallet/tx/cog/variants/send.d.ts +2 -0
- package/dist/wallet/tx/cog/variants/send.js +77 -0
- package/dist/wallet/tx/cog.d.ts +1 -96
- package/dist/wallet/tx/cog.js +1 -824
- package/dist/wallet/tx/common.d.ts +14 -199
- package/dist/wallet/tx/common.js +10 -493
- package/dist/wallet/tx/domain-admin/confirm.d.ts +17 -0
- package/dist/wallet/tx/domain-admin/confirm.js +58 -0
- package/dist/wallet/tx/domain-admin/draft.d.ts +20 -0
- package/dist/wallet/tx/domain-admin/draft.js +161 -0
- package/dist/wallet/tx/domain-admin/index.d.ts +9 -0
- package/dist/wallet/tx/domain-admin/index.js +150 -0
- package/dist/wallet/tx/domain-admin/intent.d.ts +12 -0
- package/dist/wallet/tx/domain-admin/intent.js +61 -0
- package/dist/wallet/tx/domain-admin/plan.d.ts +19 -0
- package/dist/wallet/tx/domain-admin/plan.js +64 -0
- package/dist/wallet/tx/domain-admin/result.d.ts +19 -0
- package/dist/wallet/tx/domain-admin/result.js +33 -0
- package/dist/wallet/tx/domain-admin/types.d.ts +162 -0
- package/dist/wallet/tx/domain-admin/types.js +1 -0
- package/dist/wallet/tx/domain-admin/variants/canonical.d.ts +2 -0
- package/dist/wallet/tx/domain-admin/variants/canonical.js +22 -0
- package/dist/wallet/tx/domain-admin/variants/delegate.d.ts +3 -0
- package/dist/wallet/tx/domain-admin/variants/delegate.js +60 -0
- package/dist/wallet/tx/domain-admin/variants/endpoint.d.ts +3 -0
- package/dist/wallet/tx/domain-admin/variants/endpoint.js +102 -0
- package/dist/wallet/tx/domain-admin/variants/miner.d.ts +3 -0
- package/dist/wallet/tx/domain-admin/variants/miner.js +59 -0
- package/dist/wallet/tx/domain-admin.d.ts +1 -107
- package/dist/wallet/tx/domain-admin.js +1 -729
- package/dist/wallet/tx/domain-market/confirm.d.ts +6 -0
- package/dist/wallet/tx/domain-market/confirm.js +52 -0
- package/dist/wallet/tx/domain-market/draft.d.ts +43 -0
- package/dist/wallet/tx/domain-market/draft.js +286 -0
- package/dist/wallet/tx/domain-market/index.d.ts +6 -0
- package/dist/wallet/tx/domain-market/index.js +145 -0
- package/dist/wallet/tx/domain-market/intent.d.ts +15 -0
- package/dist/wallet/tx/domain-market/intent.js +131 -0
- package/dist/wallet/tx/domain-market/plan.d.ts +31 -0
- package/dist/wallet/tx/domain-market/plan.js +98 -0
- package/dist/wallet/tx/domain-market/result.d.ts +45 -0
- package/dist/wallet/tx/domain-market/result.js +88 -0
- package/dist/wallet/tx/domain-market/types.d.ts +221 -0
- package/dist/wallet/tx/domain-market/types.js +1 -0
- package/dist/wallet/tx/domain-market/variants/buy.d.ts +2 -0
- package/dist/wallet/tx/domain-market/variants/buy.js +103 -0
- package/dist/wallet/tx/domain-market/variants/sell.d.ts +2 -0
- package/dist/wallet/tx/domain-market/variants/sell.js +91 -0
- package/dist/wallet/tx/domain-market/variants/transfer.d.ts +2 -0
- package/dist/wallet/tx/domain-market/variants/transfer.js +105 -0
- package/dist/wallet/tx/domain-market.d.ts +1 -116
- package/dist/wallet/tx/domain-market.js +1 -1078
- package/dist/wallet/tx/draft-build.d.ts +60 -0
- package/dist/wallet/tx/draft-build.js +127 -0
- package/dist/wallet/tx/executor.d.ts +6 -40
- package/dist/wallet/tx/executor.js +6 -100
- package/dist/wallet/tx/fee.d.ts +30 -0
- package/dist/wallet/tx/fee.js +98 -0
- package/dist/wallet/tx/field/confirm.d.ts +11 -0
- package/dist/wallet/tx/field/confirm.js +19 -0
- package/dist/wallet/tx/field/draft.d.ts +23 -0
- package/dist/wallet/tx/field/draft.js +202 -0
- package/dist/wallet/tx/field/index.d.ts +5 -0
- package/dist/wallet/tx/field/index.js +140 -0
- package/dist/wallet/tx/field/intent.d.ts +5 -0
- package/dist/wallet/tx/field/intent.js +50 -0
- package/dist/wallet/tx/field/plan.d.ts +20 -0
- package/dist/wallet/tx/field/plan.js +65 -0
- package/dist/wallet/tx/field/result.d.ts +29 -0
- package/dist/wallet/tx/field/result.js +103 -0
- package/dist/wallet/tx/field/types.d.ts +163 -0
- package/dist/wallet/tx/field/types.js +1 -0
- package/dist/wallet/tx/field/variants/clear.d.ts +2 -0
- package/dist/wallet/tx/field/variants/clear.js +60 -0
- package/dist/wallet/tx/field/variants/create.d.ts +2 -0
- package/dist/wallet/tx/field/variants/create.js +67 -0
- package/dist/wallet/tx/field/variants/set.d.ts +2 -0
- package/dist/wallet/tx/field/variants/set.js +195 -0
- package/dist/wallet/tx/field.d.ts +1 -95
- package/dist/wallet/tx/field.js +1 -920
- package/dist/wallet/tx/mining-preemption.d.ts +6 -0
- package/dist/wallet/tx/mining-preemption.js +7 -0
- package/dist/wallet/tx/primitives.d.ts +13 -0
- package/dist/wallet/tx/primitives.js +42 -0
- package/dist/wallet/tx/psbt-assert.d.ts +14 -0
- package/dist/wallet/tx/psbt-assert.js +39 -0
- package/dist/wallet/tx/publish.d.ts +37 -0
- package/dist/wallet/tx/publish.js +88 -0
- package/dist/wallet/tx/readiness.d.ts +7 -0
- package/dist/wallet/tx/readiness.js +61 -0
- package/dist/wallet/tx/reconcile.d.ts +24 -0
- package/dist/wallet/tx/reconcile.js +72 -0
- package/dist/wallet/tx/register/confirm.d.ts +6 -0
- package/dist/wallet/tx/register/confirm.js +66 -0
- package/dist/wallet/tx/register/draft.d.ts +42 -0
- package/dist/wallet/tx/register/draft.js +181 -0
- package/dist/wallet/tx/register/index.d.ts +6 -0
- package/dist/wallet/tx/register/index.js +158 -0
- package/dist/wallet/tx/register/intent.d.ts +74 -0
- package/dist/wallet/tx/register/intent.js +119 -0
- package/dist/wallet/tx/register/plan.d.ts +43 -0
- package/dist/wallet/tx/register/plan.js +168 -0
- package/dist/wallet/tx/register/result.d.ts +78 -0
- package/dist/wallet/tx/register/result.js +41 -0
- package/dist/wallet/tx/register.d.ts +1 -70
- package/dist/wallet/tx/register.js +1 -681
- package/dist/wallet/tx/reputation/confirm.d.ts +11 -0
- package/dist/wallet/tx/reputation/confirm.js +51 -0
- package/dist/wallet/tx/reputation/draft.d.ts +20 -0
- package/dist/wallet/tx/reputation/draft.js +130 -0
- package/dist/wallet/tx/reputation/index.d.ts +4 -0
- package/dist/wallet/tx/reputation/index.js +162 -0
- package/dist/wallet/tx/reputation/intent.d.ts +36 -0
- package/dist/wallet/tx/reputation/intent.js +157 -0
- package/dist/wallet/tx/reputation/plan.d.ts +19 -0
- package/dist/wallet/tx/reputation/plan.js +64 -0
- package/dist/wallet/tx/reputation/result.d.ts +21 -0
- package/dist/wallet/tx/reputation/result.js +31 -0
- package/dist/wallet/tx/reputation/types.d.ts +130 -0
- package/dist/wallet/tx/reputation/types.js +1 -0
- package/dist/wallet/tx/reputation.d.ts +1 -74
- package/dist/wallet/tx/reputation.js +1 -556
- package/dist/wallet/tx/signing.d.ts +18 -0
- package/dist/wallet/tx/signing.js +31 -0
- package/dist/wallet/tx/state-persist.d.ts +27 -0
- package/dist/wallet/tx/state-persist.js +54 -0
- package/dist/wallet/tx/types.d.ts +44 -0
- package/dist/wallet/tx/types.js +1 -0
- package/package.json +1 -1
- package/dist/cli/mining-json.d.ts +0 -20
- package/dist/cli/mining-json.js +0 -46
- package/dist/cli/mutation-json.d.ts +0 -325
- package/dist/cli/mutation-json.js +0 -269
- package/dist/cli/mutation-resolved-json.d.ts +0 -117
- package/dist/cli/mutation-resolved-json.js +0 -123
- package/dist/cli/preview-json.d.ts +0 -319
- package/dist/cli/preview-json.js +0 -254
- package/dist/cli/read-json.d.ts +0 -190
- package/dist/cli/read-json.js +0 -627
package/dist/cli/output.js
CHANGED
|
@@ -1,995 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
function jsonReplacer(_key, value) {
|
|
7
|
-
return typeof value === "bigint" ? value.toString() : value;
|
|
8
|
-
}
|
|
9
|
-
export function createSuccessEnvelope(schema, command, data, options = {}) {
|
|
10
|
-
return {
|
|
11
|
-
schema,
|
|
12
|
-
ok: true,
|
|
13
|
-
command,
|
|
14
|
-
generatedAtUnixMs: options.generatedAtUnixMs ?? Date.now(),
|
|
15
|
-
warnings: options.warnings ?? [],
|
|
16
|
-
explanations: options.explanations ?? [],
|
|
17
|
-
nextSteps: options.nextSteps ?? [],
|
|
18
|
-
data,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export function createErrorEnvelope(schema, command, errorCode, message, options = {}) {
|
|
22
|
-
return {
|
|
23
|
-
schema,
|
|
24
|
-
ok: false,
|
|
25
|
-
command,
|
|
26
|
-
generatedAtUnixMs: options.generatedAtUnixMs ?? Date.now(),
|
|
27
|
-
warnings: options.warnings ?? [],
|
|
28
|
-
explanations: options.explanations ?? [],
|
|
29
|
-
nextSteps: options.nextSteps ?? [],
|
|
30
|
-
error: {
|
|
31
|
-
code: errorCode,
|
|
32
|
-
message,
|
|
33
|
-
details: options.details ?? {},
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export function createPreviewSuccessEnvelope(schema, command, outcome, data, options = {}) {
|
|
38
|
-
return {
|
|
39
|
-
schema,
|
|
40
|
-
ok: true,
|
|
41
|
-
command,
|
|
42
|
-
generatedAtUnixMs: options.generatedAtUnixMs ?? Date.now(),
|
|
43
|
-
outcome,
|
|
44
|
-
warnings: options.warnings ?? [],
|
|
45
|
-
explanations: options.explanations ?? [],
|
|
46
|
-
nextSteps: options.nextSteps ?? [],
|
|
47
|
-
data,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
export function createMutationSuccessEnvelope(schema, command, outcome, data, options = {}) {
|
|
51
|
-
return {
|
|
52
|
-
schema,
|
|
53
|
-
ok: true,
|
|
54
|
-
command,
|
|
55
|
-
generatedAtUnixMs: options.generatedAtUnixMs ?? Date.now(),
|
|
56
|
-
outcome,
|
|
57
|
-
warnings: options.warnings ?? [],
|
|
58
|
-
explanations: options.explanations ?? [],
|
|
59
|
-
nextSteps: options.nextSteps ?? [],
|
|
60
|
-
data,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
export function createPreviewErrorEnvelope(schema, command, errorCode, message, options = {}) {
|
|
64
|
-
return {
|
|
65
|
-
schema,
|
|
66
|
-
ok: false,
|
|
67
|
-
command,
|
|
68
|
-
generatedAtUnixMs: options.generatedAtUnixMs ?? Date.now(),
|
|
69
|
-
outcome: options.outcome ?? "failed",
|
|
70
|
-
warnings: options.warnings ?? [],
|
|
71
|
-
explanations: options.explanations ?? [],
|
|
72
|
-
nextSteps: options.nextSteps ?? [],
|
|
73
|
-
error: {
|
|
74
|
-
code: errorCode,
|
|
75
|
-
message,
|
|
76
|
-
details: options.details ?? {},
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
export function createMutationErrorEnvelope(schema, command, errorCode, message, options = {}) {
|
|
81
|
-
return {
|
|
82
|
-
schema,
|
|
83
|
-
ok: false,
|
|
84
|
-
command,
|
|
85
|
-
generatedAtUnixMs: options.generatedAtUnixMs ?? Date.now(),
|
|
86
|
-
outcome: options.outcome ?? "failed",
|
|
87
|
-
warnings: options.warnings ?? [],
|
|
88
|
-
explanations: options.explanations ?? [],
|
|
89
|
-
nextSteps: options.nextSteps ?? [],
|
|
90
|
-
error: {
|
|
91
|
-
code: errorCode,
|
|
92
|
-
message,
|
|
93
|
-
details: options.details ?? {},
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
export function normalizeListPage(items, options) {
|
|
98
|
-
const totalKnown = items.length;
|
|
99
|
-
const appliedLimit = options.all ? null : (options.limit ?? options.defaultLimit);
|
|
100
|
-
const pagedItems = appliedLimit === null ? [...items] : items.slice(0, appliedLimit);
|
|
101
|
-
const truncated = appliedLimit !== null && totalKnown > appliedLimit;
|
|
102
|
-
return {
|
|
103
|
-
items: pagedItems,
|
|
104
|
-
page: {
|
|
105
|
-
limit: appliedLimit,
|
|
106
|
-
returned: pagedItems.length,
|
|
107
|
-
truncated,
|
|
108
|
-
moreAvailable: truncated,
|
|
109
|
-
totalKnown,
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
export function createTruncationNote(page) {
|
|
114
|
-
if (!page.truncated || page.limit === null || page.totalKnown === null) {
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
return `Showing first ${page.returned} of ${page.totalKnown}. Use --limit <n> or --all for more.`;
|
|
118
|
-
}
|
|
119
|
-
export function classifyCliError(error) {
|
|
120
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
121
|
-
if (message.startsWith("cli_")) {
|
|
122
|
-
return { exitCode: 2, errorCode: message, message };
|
|
123
|
-
}
|
|
124
|
-
if (/^wallet_init_confirmation_failed_word_\d+$/.test(message)) {
|
|
125
|
-
return { exitCode: 2, errorCode: message, message };
|
|
126
|
-
}
|
|
127
|
-
if (message === "mining_setup_invalid_provider"
|
|
128
|
-
|| message === "mining_setup_missing_api_key"
|
|
129
|
-
|| message === "mining_setup_missing_model_id"
|
|
130
|
-
|| message === "mining_setup_canceled") {
|
|
131
|
-
return { exitCode: 2, errorCode: message, message };
|
|
132
|
-
}
|
|
133
|
-
if (message.endsWith("_typed_ack_required")) {
|
|
134
|
-
return { exitCode: 2, errorCode: message, message };
|
|
135
|
-
}
|
|
136
|
-
if (message === "wallet_typed_confirmation_rejected"
|
|
137
|
-
|| message === "wallet_delete_confirmation_required"
|
|
138
|
-
|| message === "wallet_prompt_value_required"
|
|
139
|
-
|| message === "wallet_restore_mnemonic_invalid"
|
|
140
|
-
|| message === "wallet_restore_replace_confirmation_required"
|
|
141
|
-
|| message === "wallet_seed_name_invalid"
|
|
142
|
-
|| message === "wallet_seed_name_reserved"
|
|
143
|
-
|| message === "reset_wallet_choice_invalid") {
|
|
144
|
-
return { exitCode: 2, errorCode: message, message };
|
|
145
|
-
}
|
|
146
|
-
if (message === "not_found") {
|
|
147
|
-
return { exitCode: 3, errorCode: "not_found", message: "Requested object not found." };
|
|
148
|
-
}
|
|
149
|
-
if (message === "wallet_seed_not_found") {
|
|
150
|
-
return { exitCode: 3, errorCode: message, message };
|
|
151
|
-
}
|
|
152
|
-
if (message === "wallet_seed_index_invalid") {
|
|
153
|
-
return { exitCode: 4, errorCode: message, message };
|
|
154
|
-
}
|
|
155
|
-
if (message === "reset_process_shutdown_failed"
|
|
156
|
-
|| message === "reset_data_root_delete_failed"
|
|
157
|
-
|| message === "reset_secret_cleanup_failed"
|
|
158
|
-
|| message === "reset_snapshot_preserve_failed") {
|
|
159
|
-
return { exitCode: 5, errorCode: message, message };
|
|
160
|
-
}
|
|
161
|
-
if (isBlockedError(message)) {
|
|
162
|
-
return { exitCode: 4, errorCode: message, message };
|
|
163
|
-
}
|
|
164
|
-
return { exitCode: 5, errorCode: message, message };
|
|
165
|
-
}
|
|
166
|
-
function isBlockedError(message) {
|
|
167
|
-
if (message === "wallet_control_lock_busy"
|
|
168
|
-
|| message.startsWith("file_lock_busy_")) {
|
|
169
|
-
return true;
|
|
170
|
-
}
|
|
171
|
-
if (message === "wallet_uninitialized"
|
|
172
|
-
|| message === "local-state-corrupt"
|
|
173
|
-
|| message === "wallet_already_initialized"
|
|
174
|
-
|| message === "wallet_restore_requires_main_wallet"
|
|
175
|
-
|| message === "wallet_seed_name_exists"
|
|
176
|
-
|| message === "wallet_seed_not_found"
|
|
177
|
-
|| message === "wallet_delete_main_not_supported"
|
|
178
|
-
|| message === "wallet_repair_indexer_reset_requires_yes"
|
|
179
|
-
|| message === "managed_bitcoind_service_version_mismatch"
|
|
180
|
-
|| message === "managed_bitcoind_wallet_root_mismatch"
|
|
181
|
-
|| message === "managed_bitcoind_runtime_mismatch"
|
|
182
|
-
|| message === "indexer_daemon_service_version_mismatch"
|
|
183
|
-
|| message === "indexer_daemon_wallet_root_mismatch"
|
|
184
|
-
|| message === "indexer_daemon_schema_mismatch"
|
|
185
|
-
|| message === "mine_setup_requires_tty"
|
|
186
|
-
|| message === "mine_prompt_requires_tty"
|
|
187
|
-
|| message === "mine_prompt_domain_not_mineable"
|
|
188
|
-
|| message === "mining_preemption_timeout"
|
|
189
|
-
|| message === "wallet_client_password_setup_required"
|
|
190
|
-
|| message === "wallet_client_password_migration_required"
|
|
191
|
-
|| message === "wallet_client_password_locked"
|
|
192
|
-
|| message === "wallet_secret_provider_linux_runtime_error"
|
|
193
|
-
|| message === "wallet_secret_provider_macos_runtime_error"
|
|
194
|
-
|| message === "wallet_secret_provider_windows_runtime_error"
|
|
195
|
-
|| message === "wallet_state_legacy_envelope_unsupported") {
|
|
196
|
-
return true;
|
|
197
|
-
}
|
|
198
|
-
return /(?:^|_)(?:locked|uninitialized|repair_required|requires_tty|typed_ack_required|confirmation_rejected|tip_mismatch|core_replica_not_ready|setup|no_eligible_sender|ambiguous_sender|insufficient|stale|paused|validation|catching_up|starting|unavailable|schema_mismatch|service_version_mismatch|wallet_root_mismatch|runtime_mismatch|replica_missing|replica_mismatch|failed)(?:_|$)/.test(message)
|
|
199
|
-
|| /repair-required/.test(message);
|
|
200
|
-
}
|
|
1
|
+
import { classifyCliError } from "./output/classify.js";
|
|
2
|
+
import { formatCliTextErrorLines } from "./output/render.js";
|
|
3
|
+
import { createCliErrorPresentation } from "./output/rules/index.js";
|
|
4
|
+
export { classifyCliError } from "./output/classify.js";
|
|
5
|
+
export { createCliErrorPresentation } from "./output/rules/index.js";
|
|
201
6
|
export function formatCliTextError(error) {
|
|
202
7
|
const classified = classifyCliError(error);
|
|
203
8
|
const presentation = createCliErrorPresentation(classified.errorCode, classified.message, error);
|
|
204
|
-
|
|
205
|
-
return null;
|
|
206
|
-
}
|
|
207
|
-
const lines = [`What happened: ${presentation.what}`];
|
|
208
|
-
if (presentation.why !== null) {
|
|
209
|
-
lines.push(`Why: ${presentation.why}`);
|
|
210
|
-
}
|
|
211
|
-
if (presentation.next !== null) {
|
|
212
|
-
lines.push(`Next: ${presentation.next}`);
|
|
213
|
-
}
|
|
214
|
-
return lines;
|
|
215
|
-
}
|
|
216
|
-
export function createCliErrorPresentation(errorCode, fallbackMessage, error) {
|
|
217
|
-
if (errorCode.endsWith("_sender_utxo_unavailable")) {
|
|
218
|
-
return {
|
|
219
|
-
what: "Sender identity has no spendable confirmed BTC input.",
|
|
220
|
-
why: "This command preserves the Cogcoin sender identity in vin[0]. The selected sender currently has no confirmed spendable UTXO available for that role.",
|
|
221
|
-
next: "Wait for the sender's BTC output to confirm, or fund that sender identity and retry.",
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
if (errorCode === "wallet_control_lock_busy") {
|
|
225
|
-
return {
|
|
226
|
-
what: "Another Cogcoin command is already controlling this wallet.",
|
|
227
|
-
why: "Commands that sync, follow, or mutate the local index take an exclusive wallet control lock so they do not write the same sqlite store concurrently.",
|
|
228
|
-
next: "Run `cogcoin repair` to reset the local lock state, then retry.",
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
if (errorCode.startsWith("file_lock_busy_")) {
|
|
232
|
-
const lockPath = errorCode.slice("file_lock_busy_".length);
|
|
233
|
-
const lockPurpose = error instanceof FileLockBusyError
|
|
234
|
-
? error.existingMetadata?.purpose ?? null
|
|
235
|
-
: null;
|
|
236
|
-
if (lockPath.includes("wallet-control.lock")) {
|
|
237
|
-
return {
|
|
238
|
-
what: lockPurpose === null
|
|
239
|
-
? "Wallet control lock is busy."
|
|
240
|
-
: `Wallet control lock is busy (purpose: ${lockPurpose}).`,
|
|
241
|
-
why: "Another Cogcoin command currently holds the exclusive wallet control lock for this wallet.",
|
|
242
|
-
next: "Run `cogcoin repair` to reset the local lock state, then retry.",
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
return {
|
|
246
|
-
what: lockPurpose === null
|
|
247
|
-
? `Lock file is busy: ${lockPath}.`
|
|
248
|
-
: `Lock file is busy: ${lockPath} (purpose: ${lockPurpose}).`,
|
|
249
|
-
why: "The command was blocked by the current local wallet or service state.",
|
|
250
|
-
next: "Run `cogcoin repair` to reset the local lock state, then retry.",
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
if (errorCode === "reset_wallet_choice_invalid") {
|
|
254
|
-
return {
|
|
255
|
-
what: "Wallet reset choice is invalid.",
|
|
256
|
-
why: "This reset path accepts only Enter for the default entropy-retaining reset, \"skip\", or \"clear wallet entropy\".",
|
|
257
|
-
next: "Rerun `cogcoin reset` and enter one of the accepted wallet reset choices.",
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
if (errorCode === "reset_wallet_entropy_reset_unavailable") {
|
|
261
|
-
return {
|
|
262
|
-
what: "Entropy-retaining wallet reset is unavailable.",
|
|
263
|
-
why: "Cogcoin found wallet state, but it could not safely load and reconstruct it into a fresh wallet while preserving only the mnemonic-derived continuity data.",
|
|
264
|
-
next: "Rerun `cogcoin reset` and choose \"skip\" to keep the wallet unchanged, or type \"clear wallet entropy\" to erase it fully.",
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
if (errorCode === "reset_process_shutdown_failed") {
|
|
268
|
-
return {
|
|
269
|
-
what: "Reset could not stop all tracked managed processes.",
|
|
270
|
-
why: "At least one Cogcoin-managed background process remained alive after the reset shutdown attempt, so the filesystem reset was aborted before deleting local state.",
|
|
271
|
-
next: "Stop the remaining managed process and rerun `cogcoin reset`.",
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
if (errorCode === "reset_data_root_delete_failed") {
|
|
275
|
-
return {
|
|
276
|
-
what: "Reset could not remove the local Cogcoin data roots.",
|
|
277
|
-
why: "The reset flow reached the destructive phase, but at least one local Cogcoin data root could not be deleted completely.",
|
|
278
|
-
next: "Check permissions and any open file handles under the Cogcoin data roots, then rerun `cogcoin reset`.",
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
if (errorCode === "reset_secret_cleanup_failed") {
|
|
282
|
-
return {
|
|
283
|
-
what: "Reset finished the filesystem wipe but could not fully clean up wallet secret-provider material.",
|
|
284
|
-
why: "The local Cogcoin files were already removed or rewritten, but at least one tracked wallet secret could not be deleted cleanly.",
|
|
285
|
-
next: "Remove the remaining wallet secret material, then rerun `cogcoin status` to confirm the new state.",
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
if (errorCode === "reset_snapshot_preserve_failed") {
|
|
289
|
-
return {
|
|
290
|
-
what: "Reset could not preserve the downloaded 910000 UTXO snapshot.",
|
|
291
|
-
why: "You asked reset to keep the valid snapshot, but staging or restoring that large bootstrap file did not complete successfully.",
|
|
292
|
-
next: "Rerun `cogcoin reset` and choose to delete the snapshot, or restore the snapshot file manually before retrying.",
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
if (errorCode === "wallet_uninitialized") {
|
|
296
|
-
return {
|
|
297
|
-
what: "Wallet is not initialized.",
|
|
298
|
-
why: "There is no local wallet root yet for this command to use.",
|
|
299
|
-
next: "Run `cogcoin init` first.",
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
if (errorCode === "wallet_repair_indexer_reset_requires_yes") {
|
|
303
|
-
return {
|
|
304
|
-
what: "Repair needs permission to reset the local indexer database.",
|
|
305
|
-
why: "The local indexer database could not be opened as a healthy Cogcoin store, so repair would need to delete and rebuild it before continuing.",
|
|
306
|
-
next: "Rerun `cogcoin repair --yes` to allow repair to recreate the local indexer database.",
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
if (errorCode === "wallet_already_initialized") {
|
|
310
|
-
return {
|
|
311
|
-
what: "Wallet is already initialized.",
|
|
312
|
-
why: "This machine already has a local wallet root, so initialization cannot safely create a second one in the same runtime location.",
|
|
313
|
-
next: "Run `cogcoin status` to inspect the existing wallet.",
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
if (errorCode === "wallet_client_password_setup_required") {
|
|
317
|
-
return {
|
|
318
|
-
what: "Client password setup is still required.",
|
|
319
|
-
why: "This machine has not finished configuring password-protected local wallet secrets yet.",
|
|
320
|
-
next: "Run `cogcoin init` to create the client password and finish local secret setup.",
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
if (errorCode === "wallet_client_password_migration_required") {
|
|
324
|
-
return {
|
|
325
|
-
what: "Client password migration is still required.",
|
|
326
|
-
why: "This machine still has wallet secrets in the older platform-specific local format, so Cogcoin will not use them until they are migrated into password-protected local files.",
|
|
327
|
-
next: "Run `cogcoin init` to create the client password and migrate local wallet secrets.",
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
if (errorCode === "wallet_client_password_locked") {
|
|
331
|
-
return {
|
|
332
|
-
what: "Client password is locked.",
|
|
333
|
-
why: "This command needs the password-protected local wallet secret, but this process does not currently hold an unlocked client-password session.",
|
|
334
|
-
next: "Rerun the command in an interactive terminal so Cogcoin can prompt for the client password. Separate CLI invocations no longer share unlocked state.",
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
if (errorCode === "wallet_client_password_change_requires_tty") {
|
|
338
|
-
return {
|
|
339
|
-
what: "Client password change needs an interactive terminal.",
|
|
340
|
-
why: "Cogcoin has to securely prompt for the current client password and the new password twice before it can rotate local wallet-secret protection.",
|
|
341
|
-
next: "Run `cogcoin client change-password` in an interactive terminal.",
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
if (errorCode === "cli_client_unlock_removed") {
|
|
345
|
-
return {
|
|
346
|
-
what: "`client unlock` was removed.",
|
|
347
|
-
why: "Cogcoin no longer shares unlocked client-password sessions across separate CLI commands.",
|
|
348
|
-
next: "Rerun password-aware commands in an interactive terminal so Cogcoin can prompt for the client password when needed.",
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
if (errorCode === "cli_client_lock_removed") {
|
|
352
|
-
return {
|
|
353
|
-
what: "`client lock` was removed.",
|
|
354
|
-
why: "Cogcoin no longer keeps reusable unlocked client-password sessions after a command exits.",
|
|
355
|
-
next: "Fresh CLI invocations start locked automatically and prompt when wallet-local secrets are needed.",
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
if (errorCode === "cli_restore_removed" || errorCode === "cli_wallet_restore_removed") {
|
|
359
|
-
return {
|
|
360
|
-
what: "Standalone restore commands were removed.",
|
|
361
|
-
why: "Cogcoin now uses `cogcoin init` as the single wallet setup entrypoint for both new and restored wallets.",
|
|
362
|
-
next: "Run `cogcoin init` and choose \"Restore existing wallet\".",
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
if (errorCode === "cli_wallet_delete_removed") {
|
|
366
|
-
return {
|
|
367
|
-
what: "`wallet delete` was removed.",
|
|
368
|
-
why: "Cogcoin no longer supports multiple local wallet seeds, so replacing the wallet now flows through reset and init.",
|
|
369
|
-
next: "Run `cogcoin reset`, choose \"clear wallet entropy\", then rerun `cogcoin init`.",
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
if (errorCode === "cli_seed_removed") {
|
|
373
|
-
return {
|
|
374
|
-
what: "`--seed` was removed.",
|
|
375
|
-
why: "Cogcoin now supports only a single local wallet instead of multiple named wallet seeds.",
|
|
376
|
-
next: "Use the current wallet directly, or run `cogcoin reset`, choose \"clear wallet entropy\", then rerun `cogcoin init` to import a different wallet.",
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
if (errorCode === "wallet_restore_requires_main_wallet") {
|
|
380
|
-
return {
|
|
381
|
-
what: "Legacy multi-seed restore is no longer available.",
|
|
382
|
-
why: "Cogcoin no longer supports restoring into named imported wallet slots.",
|
|
383
|
-
next: "Run `cogcoin init` and choose \"Restore existing wallet\".",
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
if (errorCode === "wallet_seed_name_exists") {
|
|
387
|
-
return {
|
|
388
|
-
what: "Legacy multi-seed state is still present.",
|
|
389
|
-
why: "This machine still has old named-wallet artifacts from the removed multi-seed model.",
|
|
390
|
-
next: "Run `cogcoin reset`, choose \"clear wallet entropy\", then rerun `cogcoin init`.",
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
if (errorCode === "wallet_seed_not_found") {
|
|
394
|
-
return {
|
|
395
|
-
what: "Legacy named-wallet state was not found.",
|
|
396
|
-
why: "Cogcoin no longer supports selecting named local wallet seeds.",
|
|
397
|
-
next: "Use the single current wallet, or run `cogcoin reset` and `cogcoin init` to replace it.",
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
if (errorCode === "wallet_seed_index_invalid") {
|
|
401
|
-
return {
|
|
402
|
-
what: "Legacy wallet-seed registry is invalid.",
|
|
403
|
-
why: "Cogcoin found old multi-seed metadata from a removed feature and could not trust it for cleanup decisions.",
|
|
404
|
-
next: "Run `cogcoin repair`, or reset the wallet state if you intend to replace the local wallet.",
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
if (errorCode === "wallet_delete_main_not_supported") {
|
|
408
|
-
return {
|
|
409
|
-
what: "`wallet delete` is no longer available.",
|
|
410
|
-
why: "Cogcoin no longer supports deleting named imported wallets because the client now has a single local wallet model.",
|
|
411
|
-
next: "Run `cogcoin reset`, choose \"clear wallet entropy\", then rerun `cogcoin init`.",
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
if (errorCode === "local-state-corrupt" || errorCode.includes("repair_required") || errorCode.includes("repair-required")) {
|
|
415
|
-
return {
|
|
416
|
-
what: "Local recovery is required.",
|
|
417
|
-
why: "The wallet detected unresolved or untrusted local state for this operation.",
|
|
418
|
-
next: "Run `cogcoin repair`, then retry the command.",
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
if (errorCode.endsWith("_typed_ack_required")) {
|
|
422
|
-
return {
|
|
423
|
-
what: "Typed acknowledgement is still required.",
|
|
424
|
-
why: "`--yes` only bypasses plain yes/no confirmation. This path requires the exact typed acknowledgement because it is higher risk or irreversible.",
|
|
425
|
-
next: "Rerun the command in an interactive terminal and type the requested acknowledgement.",
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
if (errorCode === "wallet_typed_confirmation_rejected") {
|
|
429
|
-
return {
|
|
430
|
-
what: "Typed acknowledgement was declined.",
|
|
431
|
-
why: "This secure admin command requires the exact typed acknowledgement before it will continue.",
|
|
432
|
-
next: "Rerun the command in an interactive terminal and type the requested acknowledgement.",
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
if (/^wallet_init_confirmation_failed_word_\d+$/.test(errorCode)) {
|
|
436
|
-
return {
|
|
437
|
-
what: "Mnemonic confirmation failed.",
|
|
438
|
-
why: "The requested recovery-phrase confirmation word did not match, so wallet initialization was canceled before it could finish.",
|
|
439
|
-
next: "Run `cogcoin init` again and re-enter the requested confirmation words carefully. The same recovery phrase will be shown until confirmation succeeds.",
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
if (errorCode === "wallet_restore_mnemonic_invalid") {
|
|
443
|
-
return {
|
|
444
|
-
what: "Recovery phrase is invalid.",
|
|
445
|
-
why: "Mnemonic-only restore accepts only a valid 24-word English BIP39 phrase with a matching checksum.",
|
|
446
|
-
next: "Rerun `cogcoin init`, choose \"Restore existing wallet\", and enter the 24 recovery words in the original order.",
|
|
447
|
-
};
|
|
448
|
-
}
|
|
449
|
-
if (errorCode === "wallet_restore_replace_confirmation_required") {
|
|
450
|
-
return {
|
|
451
|
-
what: "Typed replacement acknowledgement is still required.",
|
|
452
|
-
why: "Mnemonic restore will replace the existing local wallet state and managed Core wallet replica only after you type the exact replacement acknowledgement.",
|
|
453
|
-
next: "Rerun `cogcoin restore` in an interactive terminal and type \"RESTORE\" when prompted.",
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
if (errorCode === "wallet_seed_name_invalid" || errorCode === "wallet_seed_name_reserved" || errorCode === "cli_invalid_seed_name") {
|
|
457
|
-
return {
|
|
458
|
-
what: "Named wallet seeds were removed.",
|
|
459
|
-
why: "Cogcoin no longer accepts named local wallet seeds because the client now uses a single wallet model.",
|
|
460
|
-
next: "Run `cogcoin init` for setup, or reset the wallet first if you need to replace it.",
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
if (errorCode === "cli_missing_seed_name") {
|
|
464
|
-
return {
|
|
465
|
-
what: "Named wallet seeds were removed.",
|
|
466
|
-
why: "This version of Cogcoin no longer supports `--seed`.",
|
|
467
|
-
next: "Drop `--seed` and retry, or use reset plus init if you need to replace the wallet.",
|
|
468
|
-
};
|
|
469
|
-
}
|
|
470
|
-
if (errorCode === "cli_seed_not_supported_for_command" || errorCode === "wallet_init_seed_not_supported") {
|
|
471
|
-
return {
|
|
472
|
-
what: "Named wallet seeds were removed.",
|
|
473
|
-
why: "Cogcoin now operates on a single local wallet instead of multiple named wallet seeds.",
|
|
474
|
-
next: "Drop `--seed` and retry.",
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
if (errorCode === "cli_from_not_supported_for_command") {
|
|
478
|
-
return {
|
|
479
|
-
what: "`--from` is no longer supported.",
|
|
480
|
-
why: "Cogcoin now uses a single wallet address for local transaction authorship, so sender selection is no longer part of the CLI.",
|
|
481
|
-
next: "Retry the command without `--from`.",
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
if (errorCode === "cli_missing_satvb") {
|
|
485
|
-
return {
|
|
486
|
-
what: "A sat/vB value is required.",
|
|
487
|
-
why: "`--satvb` needs an explicit positive fee rate value in sat/vB for the mutation you are submitting.",
|
|
488
|
-
next: "Rerun the command with `--satvb <number>`.",
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
if (errorCode === "cli_invalid_satvb") {
|
|
492
|
-
return {
|
|
493
|
-
what: "The sat/vB value is invalid.",
|
|
494
|
-
why: "`--satvb` accepts only a positive finite decimal number such as `12` or `12.5`.",
|
|
495
|
-
next: "Choose a positive sat/vB value and retry.",
|
|
496
|
-
};
|
|
497
|
-
}
|
|
498
|
-
if (errorCode === "cli_satvb_not_supported_for_command") {
|
|
499
|
-
return {
|
|
500
|
-
what: "This command does not support `--satvb`.",
|
|
501
|
-
why: "The fee-rate override only applies to wallet mutation commands that build and broadcast transactions.",
|
|
502
|
-
next: "Drop `--satvb` for this command, or use it with a wallet mutation command like `cogcoin register` or `cogcoin send`.",
|
|
503
|
-
};
|
|
504
|
-
}
|
|
505
|
-
if (errorCode === "cli_anchor_clear_removed") {
|
|
506
|
-
return {
|
|
507
|
-
what: "`anchor clear` is no longer available.",
|
|
508
|
-
why: "Anchor is now a direct single-transaction wallet mutation, so there is no separate cleanup command for reserved local workflow state.",
|
|
509
|
-
next: "Retry with `cogcoin anchor <domain>` or inspect the domain with `cogcoin show <domain>`.",
|
|
510
|
-
};
|
|
511
|
-
}
|
|
512
|
-
if (errorCode === "cli_wallet_export_removed") {
|
|
513
|
-
return {
|
|
514
|
-
what: "`wallet export` is no longer available.",
|
|
515
|
-
why: "Portable encrypted wallet archives were removed from the client, so wallet state is no longer exported through a `.cogcoin` archive file.",
|
|
516
|
-
next: "Use the wallet mnemonic as the supported recovery path, or retry with another wallet command.",
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
if (errorCode === "cli_wallet_import_removed") {
|
|
520
|
-
return {
|
|
521
|
-
what: "`wallet import` is no longer available.",
|
|
522
|
-
why: "Portable encrypted wallet archives were removed from the client, so this version no longer imports wallet state from archive files.",
|
|
523
|
-
next: "Use `cogcoin init`, choose \"Restore existing wallet\", and enter the recovery mnemonic instead.",
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
if (errorCode === "cli_field_create_initial_value_not_supported") {
|
|
527
|
-
return {
|
|
528
|
-
what: "`field create` no longer accepts an initial value.",
|
|
529
|
-
why: "Field creation is now always a single FIELD_REG transaction. Any field value must be written afterward with a separate `field set` command.",
|
|
530
|
-
next: "Create the field first, then run `cogcoin field set <domain> <field> ...`.",
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
if (errorCode === "mining_setup_invalid_provider") {
|
|
534
|
-
return {
|
|
535
|
-
what: "Mining provider choice is invalid.",
|
|
536
|
-
why: "Built-in mining setup currently supports only `openai` or `anthropic` as the provider selection.",
|
|
537
|
-
next: "Rerun `cogcoin mine setup` and choose either `openai` or `anthropic`.",
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
if (errorCode === "mining_setup_missing_api_key") {
|
|
541
|
-
return {
|
|
542
|
-
what: "Mining provider API key is required.",
|
|
543
|
-
why: "Built-in mining setup cannot save provider configuration without a non-empty API key.",
|
|
544
|
-
next: "Rerun `cogcoin mine setup` and enter the provider API key when prompted.",
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
if (errorCode === "mining_setup_missing_model_id") {
|
|
548
|
-
return {
|
|
549
|
-
what: "Mining model ID is required.",
|
|
550
|
-
why: "Built-in mining setup cannot save a custom mining model choice unless it has a non-empty model ID.",
|
|
551
|
-
next: "Rerun `cogcoin mine setup`, choose `Custom model ID...`, and enter the model ID when prompted.",
|
|
552
|
-
};
|
|
553
|
-
}
|
|
554
|
-
if (errorCode === "mining_setup_canceled") {
|
|
555
|
-
return {
|
|
556
|
-
what: "Mining setup was canceled.",
|
|
557
|
-
why: "The interactive mining-model selection was canceled before any provider configuration was saved.",
|
|
558
|
-
next: "Rerun `cogcoin mine setup` when you are ready to choose a provider model.",
|
|
559
|
-
};
|
|
560
|
-
}
|
|
561
|
-
if (errorCode === "mine_prompt_domain_not_mineable") {
|
|
562
|
-
return {
|
|
563
|
-
what: "A new mining prompt override can only target a mineable anchored root domain.",
|
|
564
|
-
why: "Cogcoin only creates new domain prompt overrides for locally controlled anchored root domains that are currently mineable. Existing stored prompt entries can still be edited or cleared by name even when they are dormant.",
|
|
565
|
-
next: "Run `cogcoin domains --mineable` to see eligible domains, or rerun `cogcoin mine prompt <domain>` for an existing stored prompt entry.",
|
|
566
|
-
};
|
|
567
|
-
}
|
|
568
|
-
if (errorCode.endsWith("_confirmation_rejected")) {
|
|
569
|
-
return {
|
|
570
|
-
what: "Confirmation was declined.",
|
|
571
|
-
why: "The command requires explicit approval before it will publish a state-changing action.",
|
|
572
|
-
next: "Rerun the command and confirm it. If this command uses a plain yes/no path, you can also add `--yes`.",
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
if (errorCode === "wallet_anchor_invalid_message" || errorCode.startsWith("wallet_anchor_invalid_message_")) {
|
|
576
|
-
const reason = errorCode.startsWith("wallet_anchor_invalid_message_")
|
|
577
|
-
? errorCode.slice("wallet_anchor_invalid_message_".length).trim()
|
|
578
|
-
: null;
|
|
579
|
-
return {
|
|
580
|
-
what: "Founding message cannot be encoded in canonical Coglex.",
|
|
581
|
-
why: reason === null || reason === ""
|
|
582
|
-
? "The supplied founding message could not be encoded into the canonical on-chain Coglex sentence format."
|
|
583
|
-
: reason,
|
|
584
|
-
next: "Retry with a different founding message, or rerun `cogcoin anchor <domain>` without `--message` to skip it.",
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
if (errorCode === "wallet_prompt_value_required") {
|
|
588
|
-
return {
|
|
589
|
-
what: "Required input was not provided.",
|
|
590
|
-
why: "This secure admin command needs a non-empty terminal response before it can continue safely.",
|
|
591
|
-
next: "Rerun the command in an interactive terminal and enter the requested value.",
|
|
592
|
-
};
|
|
593
|
-
}
|
|
594
|
-
if (errorCode === "wallet_secret_provider_linux_runtime_error") {
|
|
595
|
-
return {
|
|
596
|
-
what: "Linux local wallet-secret access failed.",
|
|
597
|
-
why: "Cogcoin could not read or write the local wallet secret file for this Linux account.",
|
|
598
|
-
next: "Check that the Cogcoin state directory is readable and writable for this Linux user, then retry.",
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
if (errorCode === "wallet_secret_provider_macos_runtime_error") {
|
|
602
|
-
return {
|
|
603
|
-
what: "macOS local wallet-secret access failed.",
|
|
604
|
-
why: "Cogcoin could not read or write the password-protected local wallet secret file for this macOS account.",
|
|
605
|
-
next: "Check that the Cogcoin state directory is readable and writable for this macOS user, then retry.",
|
|
606
|
-
};
|
|
607
|
-
}
|
|
608
|
-
if (errorCode === "wallet_secret_provider_windows_runtime_error") {
|
|
609
|
-
return {
|
|
610
|
-
what: "Windows local wallet-secret access failed.",
|
|
611
|
-
why: "Cogcoin could not read or write the local wallet secret file for this Windows account.",
|
|
612
|
-
next: "Check that the Cogcoin state directory is readable and writable for this Windows user, then retry.",
|
|
613
|
-
};
|
|
614
|
-
}
|
|
615
|
-
if (errorCode === "wallet_state_legacy_envelope_unsupported") {
|
|
616
|
-
return {
|
|
617
|
-
what: "Legacy wallet state is no longer supported.",
|
|
618
|
-
why: "This wallet state was created by an older Cogcoin format that this version no longer loads directly.",
|
|
619
|
-
next: "Restore or otherwise recover the wallet into the current format, then retry the command.",
|
|
620
|
-
};
|
|
621
|
-
}
|
|
622
|
-
if (errorCode.endsWith("_requires_tty") && errorCode !== "cli_update_requires_tty") {
|
|
623
|
-
return {
|
|
624
|
-
what: "Interactive terminal input is required.",
|
|
625
|
-
why: "This command needs terminal input before it can continue safely.",
|
|
626
|
-
next: "Rerun the command in an interactive terminal.",
|
|
627
|
-
};
|
|
628
|
-
}
|
|
629
|
-
if (errorCode.includes("tip_mismatch") || errorCode.includes("stale") || errorCode.includes("catching_up") || errorCode.includes("starting")) {
|
|
630
|
-
return {
|
|
631
|
-
what: "Trusted service state is not ready.",
|
|
632
|
-
why: "The wallet, bitcoind, or indexer is not yet aligned closely enough for this command to proceed safely.",
|
|
633
|
-
next: "Check `cogcoin status`, wait for services to settle, and retry. If the state stays degraded, run `cogcoin repair`.",
|
|
634
|
-
};
|
|
635
|
-
}
|
|
636
|
-
if (errorCode === "indexer_daemon_background_follow_recovery_failed") {
|
|
637
|
-
return {
|
|
638
|
-
what: "The managed indexer daemon could not recover automatic background follow.",
|
|
639
|
-
why: "Cogcoin tried to resume or restart the compatible managed indexer daemon, but it still failed to enter background follow.",
|
|
640
|
-
next: "Run `cogcoin repair` if this persists, then retry.",
|
|
641
|
-
};
|
|
642
|
-
}
|
|
643
|
-
if (errorCode === "indexer_daemon_service_version_mismatch") {
|
|
644
|
-
return {
|
|
645
|
-
what: "The live indexer daemon is running an incompatible service API version.",
|
|
646
|
-
why: "This wallet only trusts indexer daemons that speak `cogcoin/indexer-ipc/v1`, and the reachable daemon reported a different API version.",
|
|
647
|
-
next: "Run `cogcoin repair` so the wallet can stop the incompatible daemon and restart a compatible managed indexer service.",
|
|
648
|
-
};
|
|
649
|
-
}
|
|
650
|
-
if (errorCode === "indexer_daemon_wallet_root_mismatch") {
|
|
651
|
-
return {
|
|
652
|
-
what: "The live indexer daemon belongs to a different wallet root.",
|
|
653
|
-
why: "Managed indexer daemons are namespaced per wallet root, and the reachable daemon reported a different wallet root than this local wallet.",
|
|
654
|
-
next: "Run `cogcoin repair` so the wallet can stop the conflicting managed daemon and restore the correct local indexer service.",
|
|
655
|
-
};
|
|
656
|
-
}
|
|
657
|
-
if (errorCode === "indexer_daemon_schema_mismatch") {
|
|
658
|
-
return {
|
|
659
|
-
what: "The live indexer daemon is using an incompatible sqlite schema.",
|
|
660
|
-
why: "This wallet only trusts indexer daemons with the expected sqlite schema contract, and the reachable daemon reported a schema mismatch.",
|
|
661
|
-
next: "Run `cogcoin repair` after stopping the incompatible daemon, then retry.",
|
|
662
|
-
};
|
|
663
|
-
}
|
|
664
|
-
if (errorCode === "indexer_daemon_protocol_error") {
|
|
665
|
-
return {
|
|
666
|
-
what: "The live indexer daemon socket is not speaking the expected protocol.",
|
|
667
|
-
why: "A process is bound to the managed indexer socket, but it did not respond with a valid cogcoin indexer IPC status exchange.",
|
|
668
|
-
next: "Run `cogcoin repair` to clear stale managed indexer artifacts and restore a compatible daemon.",
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
|
-
if (errorCode === "managed_bitcoind_service_version_mismatch" || errorCode.includes("bitcoind_service_version_mismatch")) {
|
|
672
|
-
return {
|
|
673
|
-
what: "The live managed bitcoind service is running an incompatible service version.",
|
|
674
|
-
why: "This wallet only trusts managed bitcoind services that speak `cogcoin/bitcoind-service/v1`, and the reachable service reported a different runtime contract.",
|
|
675
|
-
next: "Run `cogcoin repair` so the wallet can stop the incompatible managed bitcoind service and restart a compatible one.",
|
|
676
|
-
};
|
|
677
|
-
}
|
|
678
|
-
if (errorCode === "managed_bitcoind_wallet_root_mismatch" || errorCode.includes("bitcoind_wallet_root_mismatch")) {
|
|
679
|
-
return {
|
|
680
|
-
what: "The live managed bitcoind service belongs to a different wallet root.",
|
|
681
|
-
why: "Managed bitcoind services are tied to one wallet root, and the reachable service reported a different wallet root than this local wallet expects.",
|
|
682
|
-
next: "Run `cogcoin repair` so the wallet can stop the conflicting managed bitcoind service and restore the correct one.",
|
|
683
|
-
};
|
|
684
|
-
}
|
|
685
|
-
if (errorCode === "managed_bitcoind_runtime_mismatch" || errorCode.includes("bitcoind_runtime_mismatch")) {
|
|
686
|
-
return {
|
|
687
|
-
what: "The live managed bitcoind service runtime does not match this wallet.",
|
|
688
|
-
why: "The reachable service is using a different chain, data directory, or runtime root than this wallet expects, so its status cannot be trusted here.",
|
|
689
|
-
next: "Run `cogcoin repair` so the wallet can clear the conflicting runtime and restart a compatible managed bitcoind service.",
|
|
690
|
-
};
|
|
691
|
-
}
|
|
692
|
-
if (errorCode.includes("bitcoind_replica_missing")) {
|
|
693
|
-
return {
|
|
694
|
-
what: "The managed Core wallet replica is missing.",
|
|
695
|
-
why: "This wallet needs a matching managed Core descriptor-wallet replica before it can safely perform stateful operations.",
|
|
696
|
-
next: "Run `cogcoin repair` to recreate the managed Core wallet replica, then retry.",
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
if (errorCode.includes("bitcoind_replica_mismatch")) {
|
|
700
|
-
return {
|
|
701
|
-
what: "The managed Core wallet replica does not match trusted wallet state.",
|
|
702
|
-
why: "The local wallet state and the managed Core replica disagree, so this command refuses to keep going on untrusted Core metadata.",
|
|
703
|
-
next: "Run `cogcoin repair` to recreate or rebind the managed Core wallet replica, then retry.",
|
|
704
|
-
};
|
|
705
|
-
}
|
|
706
|
-
if (errorCode === "mining_preemption_timeout") {
|
|
707
|
-
return {
|
|
708
|
-
what: "Wallet repair is blocked by active mining work.",
|
|
709
|
-
why: "Repair waits for mining generation work to acknowledge preemption before it mutates local indexer runtime artifacts.",
|
|
710
|
-
next: "Pause or stop mining, then rerun `cogcoin repair`.",
|
|
711
|
-
};
|
|
712
|
-
}
|
|
713
|
-
if (errorCode.includes("paused")) {
|
|
714
|
-
return {
|
|
715
|
-
what: "Work is currently paused.",
|
|
716
|
-
why: "Another wallet or mining workflow has priority right now.",
|
|
717
|
-
next: "Wait for the current work to settle, then rerun the command.",
|
|
718
|
-
};
|
|
719
|
-
}
|
|
720
|
-
if (errorCode.includes("setup") || errorCode.includes("validation") || errorCode.includes("core_replica_not_ready")) {
|
|
721
|
-
return {
|
|
722
|
-
what: "Local setup is incomplete.",
|
|
723
|
-
why: "This command depends on a local component that is not ready yet.",
|
|
724
|
-
next: "Review the local status output, finish the required setup or repair step, and retry.",
|
|
725
|
-
};
|
|
726
|
-
}
|
|
727
|
-
if (errorCode === "wallet_bitcoin_transfer_insufficient_funds") {
|
|
728
|
-
return {
|
|
729
|
-
what: "Wallet address does not have enough BTC.",
|
|
730
|
-
why: "The requested satoshi amount plus the mining fee exceeds the wallet's spendable BTC balance.",
|
|
731
|
-
next: "Reduce the amount or add more BTC to the wallet address, then retry.",
|
|
732
|
-
};
|
|
733
|
-
}
|
|
734
|
-
if (errorCode.includes("insufficient")) {
|
|
735
|
-
return {
|
|
736
|
-
what: "Available funds are insufficient.",
|
|
737
|
-
why: "The wallet address does not currently have enough spendable funds for this operation.",
|
|
738
|
-
next: "Add more funds to the wallet address, then retry.",
|
|
739
|
-
};
|
|
740
|
-
}
|
|
741
|
-
if (errorCode === "wallet_register_from_not_supported_for_subdomain") {
|
|
742
|
-
return {
|
|
743
|
-
what: "`--from` is not supported for subdomain registration.",
|
|
744
|
-
why: "Cogcoin now uses a single wallet address for local writes, so sender overrides are no longer part of subdomain registration.",
|
|
745
|
-
next: "Retry without `--from`.",
|
|
746
|
-
};
|
|
747
|
-
}
|
|
748
|
-
if (errorCode === "wallet_register_sender_not_root_eligible") {
|
|
749
|
-
return {
|
|
750
|
-
what: "Root registration sender is not eligible.",
|
|
751
|
-
why: "Root registration now always uses the wallet address, and the local wallet state did not produce a usable sender.",
|
|
752
|
-
next: "Inspect `cogcoin address` and retry.",
|
|
753
|
-
};
|
|
754
|
-
}
|
|
755
|
-
if (errorCode === "wallet_register_sender_not_found") {
|
|
756
|
-
return {
|
|
757
|
-
what: "Local sender was not found.",
|
|
758
|
-
why: "The wallet could not resolve a usable local wallet sender for this command.",
|
|
759
|
-
next: "Inspect `cogcoin address` and retry.",
|
|
760
|
-
};
|
|
761
|
-
}
|
|
762
|
-
if (errorCode === "wallet_register_sender_read_only") {
|
|
763
|
-
return {
|
|
764
|
-
what: "Wallet sender is not spendable.",
|
|
765
|
-
why: "This command needs the wallet address to author the transaction, but the local wallet sender is not spendable.",
|
|
766
|
-
next: "Check `cogcoin address`, restore the spendable wallet, and retry.",
|
|
767
|
-
};
|
|
768
|
-
}
|
|
769
|
-
if (errorCode === "wallet_register_sender_address_unavailable") {
|
|
770
|
-
return {
|
|
771
|
-
what: "Wallet address is unavailable.",
|
|
772
|
-
why: "The local wallet sender was resolved, but the wallet does not currently have a usable display address for it.",
|
|
773
|
-
next: "Inspect `cogcoin address` and retry.",
|
|
774
|
-
};
|
|
775
|
-
}
|
|
776
|
-
if (errorCode === "wallet_buy_sender_not_found") {
|
|
777
|
-
return {
|
|
778
|
-
what: "Local buyer was not found.",
|
|
779
|
-
why: "The wallet could not resolve a usable local wallet sender for this purchase.",
|
|
780
|
-
next: "Inspect `cogcoin address` and retry.",
|
|
781
|
-
};
|
|
782
|
-
}
|
|
783
|
-
if (errorCode === "wallet_buy_sender_read_only") {
|
|
784
|
-
return {
|
|
785
|
-
what: "Wallet sender is not spendable.",
|
|
786
|
-
why: "Buying now always uses the wallet address, but the local wallet sender is not spendable.",
|
|
787
|
-
next: "Check `cogcoin address`, restore the spendable wallet, and retry.",
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
|
-
if (errorCode === "wallet_buy_sender_address_unavailable") {
|
|
791
|
-
return {
|
|
792
|
-
what: "Wallet address is unavailable.",
|
|
793
|
-
why: "The wallet could not produce a usable display address for the local sender.",
|
|
794
|
-
next: "Inspect `cogcoin address` and retry.",
|
|
795
|
-
};
|
|
796
|
-
}
|
|
797
|
-
if (errorCode === "wallet_buy_already_owner") {
|
|
798
|
-
return {
|
|
799
|
-
what: "The wallet already owns the domain.",
|
|
800
|
-
why: "A buy mutation cannot target a domain already owned by this wallet address.",
|
|
801
|
-
next: "Inspect the current owner with `cogcoin show <domain>` and choose a different domain.",
|
|
802
|
-
};
|
|
803
|
-
}
|
|
804
|
-
if (errorCode === "wallet_buy_insufficient_cog_balance") {
|
|
805
|
-
return {
|
|
806
|
-
what: "The wallet does not have enough COG.",
|
|
807
|
-
why: "The wallet address does not currently have the listed domain price available in spendable COG balance.",
|
|
808
|
-
next: "Add more COG to the wallet address, then retry.",
|
|
809
|
-
};
|
|
810
|
-
}
|
|
811
|
-
if (errorCode === "wallet_transfer_owner_not_locally_controlled" || errorCode === "wallet_sell_owner_not_locally_controlled") {
|
|
812
|
-
return {
|
|
813
|
-
what: "Domain owner is not locally controlled.",
|
|
814
|
-
why: "This command must be authored by the current unanchored domain owner, and that current owner script/address is not controlled by this wallet.",
|
|
815
|
-
next: "Inspect the current owner with `cogcoin show <domain>`, then retry from the wallet that controls the owner.",
|
|
816
|
-
};
|
|
817
|
-
}
|
|
818
|
-
if (errorCode === "wallet_transfer_owner_read_only" || errorCode === "wallet_sell_owner_read_only") {
|
|
819
|
-
return {
|
|
820
|
-
what: "Domain owner is not spendable in this wallet.",
|
|
821
|
-
why: "The current domain owner is visible locally, but this wallet cannot author owner mutations from it.",
|
|
822
|
-
next: "Use the wallet that controls the owner, or import the spendable owner into this wallet before retrying.",
|
|
823
|
-
};
|
|
824
|
-
}
|
|
825
|
-
if (errorCode === "wallet_field_create_owner_not_locally_controlled"
|
|
826
|
-
|| errorCode === "wallet_field_set_owner_not_locally_controlled"
|
|
827
|
-
|| errorCode === "wallet_field_clear_owner_not_locally_controlled") {
|
|
828
|
-
return {
|
|
829
|
-
what: "Anchored field owner is not locally controlled.",
|
|
830
|
-
why: "Field mutations must be authored by the current anchored owner of the domain, and that current owner script/address is not controlled by this wallet.",
|
|
831
|
-
next: "Inspect the current owner with `cogcoin show <domain>`, then retry from the wallet that controls the owner.",
|
|
832
|
-
};
|
|
833
|
-
}
|
|
834
|
-
if (errorCode === "wallet_field_create_owner_read_only"
|
|
835
|
-
|| errorCode === "wallet_field_set_owner_read_only"
|
|
836
|
-
|| errorCode === "wallet_field_clear_owner_read_only") {
|
|
837
|
-
return {
|
|
838
|
-
what: "Anchored field owner is not spendable in this wallet.",
|
|
839
|
-
why: "The current anchored owner is visible locally, but this wallet cannot author field mutations from it.",
|
|
840
|
-
next: "Use the wallet that controls the owner, or import the spendable owner into this wallet before retrying.",
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
|
-
if (errorCode === "wallet_domain_endpoint_owner_not_locally_controlled"
|
|
844
|
-
|| errorCode === "wallet_domain_delegate_owner_not_locally_controlled"
|
|
845
|
-
|| errorCode === "wallet_domain_miner_owner_not_locally_controlled"
|
|
846
|
-
|| errorCode === "wallet_domain_canonical_owner_not_locally_controlled") {
|
|
847
|
-
return {
|
|
848
|
-
what: "Anchored domain owner is not locally controlled.",
|
|
849
|
-
why: "This anchored domain-admin command must be authored by the current anchored owner, and that current owner script/address is not controlled by this wallet.",
|
|
850
|
-
next: "Inspect the current owner with `cogcoin show <domain>`, then retry from the wallet that controls the owner.",
|
|
851
|
-
};
|
|
852
|
-
}
|
|
853
|
-
if (errorCode === "wallet_domain_endpoint_owner_read_only"
|
|
854
|
-
|| errorCode === "wallet_domain_delegate_owner_read_only"
|
|
855
|
-
|| errorCode === "wallet_domain_miner_owner_read_only"
|
|
856
|
-
|| errorCode === "wallet_domain_canonical_owner_read_only") {
|
|
857
|
-
return {
|
|
858
|
-
what: "Anchored domain owner is not spendable in this wallet.",
|
|
859
|
-
why: "The current anchored owner is visible locally, but this wallet cannot author anchored admin mutations from it.",
|
|
860
|
-
next: "Use the wallet that controls the owner, or import the spendable owner into this wallet before retrying.",
|
|
861
|
-
};
|
|
862
|
-
}
|
|
863
|
-
if (errorCode === "wallet_rep_give_source_owner_not_locally_controlled"
|
|
864
|
-
|| errorCode === "wallet_rep_revoke_source_owner_not_locally_controlled") {
|
|
865
|
-
return {
|
|
866
|
-
what: "Anchored reputation source owner is not locally controlled.",
|
|
867
|
-
why: "Reputation mutations must be authored by the current anchored owner of the source domain, and that current owner script/address is not controlled by this wallet.",
|
|
868
|
-
next: "Inspect the current source-domain owner with `cogcoin show <domain>`, then retry from the wallet that controls the owner.",
|
|
869
|
-
};
|
|
870
|
-
}
|
|
871
|
-
if (errorCode === "wallet_rep_give_source_owner_read_only"
|
|
872
|
-
|| errorCode === "wallet_rep_revoke_source_owner_read_only") {
|
|
873
|
-
return {
|
|
874
|
-
what: "Anchored reputation source owner is not spendable in this wallet.",
|
|
875
|
-
why: "The current anchored source-domain owner is visible locally, but this wallet cannot author reputation mutations from it.",
|
|
876
|
-
next: "Use the wallet that controls the owner, or import the spendable owner into this wallet before retrying.",
|
|
877
|
-
};
|
|
878
|
-
}
|
|
879
|
-
if (errorCode === "wallet_send_sender_address_unavailable" || errorCode === "wallet_lock_sender_address_unavailable") {
|
|
880
|
-
return {
|
|
881
|
-
what: "Wallet address is unavailable.",
|
|
882
|
-
why: "The wallet could not produce a usable display address for the local sender.",
|
|
883
|
-
next: "Inspect `cogcoin address` and retry.",
|
|
884
|
-
};
|
|
885
|
-
}
|
|
886
|
-
if (errorCode === "wallet_bitcoin_transfer_invalid_amount") {
|
|
887
|
-
return {
|
|
888
|
-
what: "Bitcoin transfer amount is invalid.",
|
|
889
|
-
why: "This command accepts only a positive whole-number satoshi amount such as `1200`.",
|
|
890
|
-
next: "Rerun `cogcoin bitcoin transfer <sats> --to <address>` with a positive integer satoshi amount.",
|
|
891
|
-
};
|
|
892
|
-
}
|
|
893
|
-
if (errorCode === "wallet_bitcoin_transfer_invalid_address") {
|
|
894
|
-
return {
|
|
895
|
-
what: "Bitcoin transfer recipient address is invalid.",
|
|
896
|
-
why: "This command only accepts a standard mainnet BTC address in `--to`.",
|
|
897
|
-
next: "Rerun `cogcoin bitcoin transfer <sats> --to <address>` with a valid mainnet BTC address.",
|
|
898
|
-
};
|
|
899
|
-
}
|
|
900
|
-
if (errorCode === "wallet_bitcoin_transfer_address_required") {
|
|
901
|
-
return {
|
|
902
|
-
what: "Bitcoin transfer recipient must be a standard BTC address.",
|
|
903
|
-
why: "V1 of this command does not support opaque script targets such as `spk:<hex>`.",
|
|
904
|
-
next: "Rerun `cogcoin bitcoin transfer <sats> --to <address>` with a standard mainnet BTC address.",
|
|
905
|
-
};
|
|
906
|
-
}
|
|
907
|
-
if (errorCode === "wallet_bitcoin_transfer_self_transfer") {
|
|
908
|
-
return {
|
|
909
|
-
what: "Bitcoin transfer recipient matches the wallet address.",
|
|
910
|
-
why: "This command rejects self-transfers to the wallet funding script/address.",
|
|
911
|
-
next: "Choose a different recipient address and retry.",
|
|
912
|
-
};
|
|
913
|
-
}
|
|
914
|
-
if (errorCode === "wallet_bitcoin_transfer_confirmation_rejected") {
|
|
915
|
-
return {
|
|
916
|
-
what: "Bitcoin transfer confirmation was rejected.",
|
|
917
|
-
why: "The interactive confirmation was declined before the BTC payment was broadcast.",
|
|
918
|
-
next: "Review the recipient address and amount, then rerun the command if you still want to send BTC.",
|
|
919
|
-
};
|
|
920
|
-
}
|
|
921
|
-
if (errorCode === "wallet_bitcoin_transfer_requires_tty") {
|
|
922
|
-
return {
|
|
923
|
-
what: "Bitcoin transfer confirmation needs an interactive terminal.",
|
|
924
|
-
why: "Without `--yes`, Cogcoin must ask for an interactive confirmation before publishing a BTC payment.",
|
|
925
|
-
next: "Rerun the command in an interactive terminal, or add `--yes` if that is appropriate for your workflow.",
|
|
926
|
-
};
|
|
927
|
-
}
|
|
928
|
-
if (errorCode === "cli_update_requires_tty") {
|
|
929
|
-
return {
|
|
930
|
-
what: "Updating Cogcoin needs an interactive terminal or `--yes`.",
|
|
931
|
-
why: "When a newer client release is available, `cogcoin update` prompts before running the global npm install unless `--yes` is provided.",
|
|
932
|
-
next: "Rerun `cogcoin update` in an interactive terminal, or add `--yes` to apply the update non-interactively.",
|
|
933
|
-
};
|
|
934
|
-
}
|
|
935
|
-
if (errorCode === "cli_update_registry_unavailable") {
|
|
936
|
-
return {
|
|
937
|
-
what: "Cogcoin could not read the latest client version from the npm registry.",
|
|
938
|
-
why: "The explicit update command requires a fresh registry lookup before it can compare versions or run the install.",
|
|
939
|
-
next: "Check network access and rerun `cogcoin update`.",
|
|
940
|
-
};
|
|
941
|
-
}
|
|
942
|
-
if (errorCode === "cli_update_npm_not_found") {
|
|
943
|
-
return {
|
|
944
|
-
what: "Cogcoin could not find npm to install the update.",
|
|
945
|
-
why: "The update command runs `npm install -g @cogcoin/client`, and no usable `npm` executable was available on PATH.",
|
|
946
|
-
next: "Install Node.js/npm or fix PATH, then rerun `cogcoin update`.",
|
|
947
|
-
};
|
|
948
|
-
}
|
|
949
|
-
if (errorCode === "cli_update_install_failed") {
|
|
950
|
-
return {
|
|
951
|
-
what: "Cogcoin update installation failed.",
|
|
952
|
-
why: "The global npm install exited unsuccessfully before the client update completed.",
|
|
953
|
-
next: "Review the npm output above, fix the installation issue, then rerun `cogcoin update`.",
|
|
954
|
-
};
|
|
955
|
-
}
|
|
956
|
-
if (errorCode === "wallet_claim_sender_not_local") {
|
|
957
|
-
return {
|
|
958
|
-
what: "The claim sender is not locally controlled.",
|
|
959
|
-
why: "Before timeout, the wallet may only claim as the current recipient-domain owner, and that owner is not available in this wallet.",
|
|
960
|
-
next: "Check the current recipient-domain owner with `cogcoin show <domain>` or use the wallet that controls the owner.",
|
|
961
|
-
};
|
|
962
|
-
}
|
|
963
|
-
if (errorCode === "wallet_reclaim_sender_not_local") {
|
|
964
|
-
return {
|
|
965
|
-
what: "The reclaim sender is not locally controlled.",
|
|
966
|
-
why: "After timeout, the wallet may only reclaim as the original locker, and that locker is not controlled by this wallet.",
|
|
967
|
-
next: "Use the wallet that controls the original locker, or inspect the lock details with `cogcoin locks`.",
|
|
968
|
-
};
|
|
969
|
-
}
|
|
970
|
-
if (errorCode.includes("ambiguous_sender") || errorCode.includes("no_eligible_sender")) {
|
|
971
|
-
return {
|
|
972
|
-
what: "Sender selection could not be resolved.",
|
|
973
|
-
why: "The wallet could not determine a usable local sender for this command.",
|
|
974
|
-
next: "Inspect `cogcoin address` and `cogcoin status`, then retry.",
|
|
975
|
-
};
|
|
976
|
-
}
|
|
977
|
-
if (classifiedAsBlockedMessage(errorCode)) {
|
|
978
|
-
return {
|
|
979
|
-
what: fallbackMessage,
|
|
980
|
-
why: "The command was blocked by the current local wallet or service state.",
|
|
981
|
-
next: "Review `cogcoin status` and retry after the blocking condition is cleared.",
|
|
982
|
-
};
|
|
983
|
-
}
|
|
984
|
-
return null;
|
|
985
|
-
}
|
|
986
|
-
function classifiedAsBlockedMessage(errorCode) {
|
|
987
|
-
return isBlockedError(errorCode);
|
|
988
|
-
}
|
|
989
|
-
export function describeCanonicalCommand(parsed) {
|
|
990
|
-
return describeCanonicalCommandFromArgs(parsed.command, parsed.args, {
|
|
991
|
-
follow: parsed.follow,
|
|
992
|
-
});
|
|
9
|
+
return formatCliTextErrorLines(presentation);
|
|
993
10
|
}
|
|
994
11
|
export function writeHandledCliError(options) {
|
|
995
12
|
const classified = classifyCliError(options.error);
|