@cogcoin/client 1.1.8 → 1.1.10
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/bitcoind/managed-bitcoind-service-config.d.ts +13 -0
- package/dist/bitcoind/managed-bitcoind-service-config.js +165 -0
- package/dist/bitcoind/managed-bitcoind-service-lifecycle.d.ts +28 -0
- package/dist/bitcoind/managed-bitcoind-service-lifecycle.js +290 -0
- package/dist/bitcoind/managed-bitcoind-service-process.d.ts +8 -0
- package/dist/bitcoind/managed-bitcoind-service-process.js +48 -0
- package/dist/bitcoind/managed-bitcoind-service-replica.d.ts +8 -0
- package/dist/bitcoind/managed-bitcoind-service-replica.js +142 -0
- package/dist/bitcoind/managed-bitcoind-service-status.d.ts +42 -0
- package/dist/bitcoind/managed-bitcoind-service-status.js +178 -0
- package/dist/bitcoind/managed-bitcoind-service-types.d.ts +36 -0
- package/dist/bitcoind/managed-bitcoind-service-types.js +1 -0
- package/dist/bitcoind/service.d.ts +7 -63
- package/dist/bitcoind/service.js +7 -797
- 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/engine-types.d.ts +1 -0
- package/dist/wallet/mining/engine-types.js +9 -1
- package/dist/wallet/mining/publish.js +3 -6
- package/dist/wallet/mining/runner.js +30 -18
- package/dist/wallet/mining/sentence-protocol.d.ts +2 -2
- package/dist/wallet/mining/sentences.js +8 -8
- package/dist/wallet/mining/visualizer.js +7 -6
- package/dist/wallet/read/context.d.ts +4 -10
- package/dist/wallet/read/context.js +4 -227
- package/dist/wallet/read/local-state.d.ts +28 -0
- package/dist/wallet/read/local-state.js +233 -0
- package/dist/wallet/read/managed-bitcoind.d.ts +30 -0
- package/dist/wallet/read/managed-bitcoind.js +138 -0
- package/dist/wallet/read/managed-indexer.d.ts +23 -0
- package/dist/wallet/read/managed-indexer.js +87 -0
- package/dist/wallet/read/managed-services.d.ts +6 -21
- package/dist/wallet/read/managed-services.js +23 -196
- 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
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { describeBusyLock } from "../classify.js";
|
|
2
|
+
export const walletAdminErrorRules = [
|
|
3
|
+
({ errorCode, error }) => {
|
|
4
|
+
if (errorCode === "wallet_control_lock_busy") {
|
|
5
|
+
return {
|
|
6
|
+
what: "Another Cogcoin command is already controlling this wallet.",
|
|
7
|
+
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.",
|
|
8
|
+
next: "Run `cogcoin repair` to reset the local lock state, then retry.",
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const busyLock = describeBusyLock(errorCode, error);
|
|
12
|
+
if (busyLock === null) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
if (busyLock.lockPath.includes("wallet-control.lock")) {
|
|
16
|
+
return {
|
|
17
|
+
what: busyLock.lockPurpose === null
|
|
18
|
+
? "Wallet control lock is busy."
|
|
19
|
+
: `Wallet control lock is busy (purpose: ${busyLock.lockPurpose}).`,
|
|
20
|
+
why: "Another Cogcoin command currently holds the exclusive wallet control lock for this wallet.",
|
|
21
|
+
next: "Run `cogcoin repair` to reset the local lock state, then retry.",
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
what: busyLock.lockPurpose === null
|
|
26
|
+
? `Lock file is busy: ${busyLock.lockPath}.`
|
|
27
|
+
: `Lock file is busy: ${busyLock.lockPath} (purpose: ${busyLock.lockPurpose}).`,
|
|
28
|
+
why: "The command was blocked by the current local wallet or service state.",
|
|
29
|
+
next: "Run `cogcoin repair` to reset the local lock state, then retry.",
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
({ errorCode }) => {
|
|
33
|
+
if (errorCode === "reset_wallet_choice_invalid") {
|
|
34
|
+
return {
|
|
35
|
+
what: "Wallet reset choice is invalid.",
|
|
36
|
+
why: "This reset path accepts only Enter for the default entropy-retaining reset, \"skip\", or \"clear wallet entropy\".",
|
|
37
|
+
next: "Rerun `cogcoin reset` and enter one of the accepted wallet reset choices.",
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (errorCode === "reset_wallet_entropy_reset_unavailable") {
|
|
41
|
+
return {
|
|
42
|
+
what: "Entropy-retaining wallet reset is unavailable.",
|
|
43
|
+
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.",
|
|
44
|
+
next: "Rerun `cogcoin reset` and choose \"skip\" to keep the wallet unchanged, or type \"clear wallet entropy\" to erase it fully.",
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (errorCode === "reset_process_shutdown_failed") {
|
|
48
|
+
return {
|
|
49
|
+
what: "Reset could not stop all tracked managed processes.",
|
|
50
|
+
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.",
|
|
51
|
+
next: "Stop the remaining managed process and rerun `cogcoin reset`.",
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (errorCode === "reset_data_root_delete_failed") {
|
|
55
|
+
return {
|
|
56
|
+
what: "Reset could not remove the local Cogcoin data roots.",
|
|
57
|
+
why: "The reset flow reached the destructive phase, but at least one local Cogcoin data root could not be deleted completely.",
|
|
58
|
+
next: "Check permissions and any open file handles under the Cogcoin data roots, then rerun `cogcoin reset`.",
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (errorCode === "reset_secret_cleanup_failed") {
|
|
62
|
+
return {
|
|
63
|
+
what: "Reset finished the filesystem wipe but could not fully clean up wallet secret-provider material.",
|
|
64
|
+
why: "The local Cogcoin files were already removed or rewritten, but at least one tracked wallet secret could not be deleted cleanly.",
|
|
65
|
+
next: "Remove the remaining wallet secret material, then rerun `cogcoin status` to confirm the new state.",
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (errorCode === "reset_snapshot_preserve_failed") {
|
|
69
|
+
return {
|
|
70
|
+
what: "Reset could not preserve the downloaded 910000 UTXO snapshot.",
|
|
71
|
+
why: "You asked reset to keep the valid snapshot, but staging or restoring that large bootstrap file did not complete successfully.",
|
|
72
|
+
next: "Rerun `cogcoin reset` and choose to delete the snapshot, or restore the snapshot file manually before retrying.",
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (errorCode === "wallet_uninitialized") {
|
|
76
|
+
return {
|
|
77
|
+
what: "Wallet is not initialized.",
|
|
78
|
+
why: "There is no local wallet root yet for this command to use.",
|
|
79
|
+
next: "Run `cogcoin init` first.",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if (errorCode === "wallet_repair_indexer_reset_requires_yes") {
|
|
83
|
+
return {
|
|
84
|
+
what: "Repair needs permission to reset the local indexer database.",
|
|
85
|
+
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.",
|
|
86
|
+
next: "Rerun `cogcoin repair --yes` to allow repair to recreate the local indexer database.",
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (errorCode === "wallet_already_initialized") {
|
|
90
|
+
return {
|
|
91
|
+
what: "Wallet is already initialized.",
|
|
92
|
+
why: "This machine already has a local wallet root, so initialization cannot safely create a second one in the same runtime location.",
|
|
93
|
+
next: "Run `cogcoin status` to inspect the existing wallet.",
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (errorCode === "wallet_client_password_setup_required") {
|
|
97
|
+
return {
|
|
98
|
+
what: "Client password setup is still required.",
|
|
99
|
+
why: "This machine has not finished configuring password-protected local wallet secrets yet.",
|
|
100
|
+
next: "Run `cogcoin init` to create the client password and finish local secret setup.",
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (errorCode === "wallet_client_password_migration_required") {
|
|
104
|
+
return {
|
|
105
|
+
what: "Client password migration is still required.",
|
|
106
|
+
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.",
|
|
107
|
+
next: "Run `cogcoin init` to create the client password and migrate local wallet secrets.",
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
if (errorCode === "wallet_client_password_locked") {
|
|
111
|
+
return {
|
|
112
|
+
what: "Client password is locked.",
|
|
113
|
+
why: "This command needs the password-protected local wallet secret, but this process does not currently hold an unlocked client-password session.",
|
|
114
|
+
next: "Rerun the command in an interactive terminal so Cogcoin can prompt for the client password. Separate CLI invocations no longer share unlocked state.",
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (errorCode === "wallet_client_password_change_requires_tty") {
|
|
118
|
+
return {
|
|
119
|
+
what: "Client password change needs an interactive terminal.",
|
|
120
|
+
why: "Cogcoin has to securely prompt for the current client password and the new password twice before it can rotate local wallet-secret protection.",
|
|
121
|
+
next: "Run `cogcoin client change-password` in an interactive terminal.",
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (errorCode === "wallet_restore_requires_main_wallet") {
|
|
125
|
+
return {
|
|
126
|
+
what: "Legacy multi-seed restore is no longer available.",
|
|
127
|
+
why: "Cogcoin no longer supports restoring into named imported wallet slots.",
|
|
128
|
+
next: "Run `cogcoin init` and choose \"Restore existing wallet\".",
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
if (errorCode === "wallet_seed_name_exists") {
|
|
132
|
+
return {
|
|
133
|
+
what: "Legacy multi-seed state is still present.",
|
|
134
|
+
why: "This machine still has old named-wallet artifacts from the removed multi-seed model.",
|
|
135
|
+
next: "Run `cogcoin reset`, choose \"clear wallet entropy\", then rerun `cogcoin init`.",
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
if (errorCode === "wallet_seed_not_found") {
|
|
139
|
+
return {
|
|
140
|
+
what: "Legacy named-wallet state was not found.",
|
|
141
|
+
why: "Cogcoin no longer supports selecting named local wallet seeds.",
|
|
142
|
+
next: "Use the single current wallet, or run `cogcoin reset` and `cogcoin init` to replace it.",
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
if (errorCode === "wallet_seed_index_invalid") {
|
|
146
|
+
return {
|
|
147
|
+
what: "Legacy wallet-seed registry is invalid.",
|
|
148
|
+
why: "Cogcoin found old multi-seed metadata from a removed feature and could not trust it for cleanup decisions.",
|
|
149
|
+
next: "Run `cogcoin repair`, or reset the wallet state if you intend to replace the local wallet.",
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
if (errorCode === "wallet_delete_main_not_supported") {
|
|
153
|
+
return {
|
|
154
|
+
what: "`wallet delete` is no longer available.",
|
|
155
|
+
why: "Cogcoin no longer supports deleting named imported wallets because the client now has a single local wallet model.",
|
|
156
|
+
next: "Run `cogcoin reset`, choose \"clear wallet entropy\", then rerun `cogcoin init`.",
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
if (errorCode === "local-state-corrupt" || errorCode.includes("repair_required") || errorCode.includes("repair-required")) {
|
|
160
|
+
return {
|
|
161
|
+
what: "Local recovery is required.",
|
|
162
|
+
why: "The wallet detected unresolved or untrusted local state for this operation.",
|
|
163
|
+
next: "Run `cogcoin repair`, then retry the command.",
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
if (errorCode.endsWith("_typed_ack_required")) {
|
|
167
|
+
return {
|
|
168
|
+
what: "Typed acknowledgement is still required.",
|
|
169
|
+
why: "`--yes` only bypasses plain yes/no confirmation. This path requires the exact typed acknowledgement because it is higher risk or irreversible.",
|
|
170
|
+
next: "Rerun the command in an interactive terminal and type the requested acknowledgement.",
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
if (errorCode === "wallet_typed_confirmation_rejected") {
|
|
174
|
+
return {
|
|
175
|
+
what: "Typed acknowledgement was declined.",
|
|
176
|
+
why: "This secure admin command requires the exact typed acknowledgement before it will continue.",
|
|
177
|
+
next: "Rerun the command in an interactive terminal and type the requested acknowledgement.",
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
if (/^wallet_init_confirmation_failed_word_\d+$/.test(errorCode)) {
|
|
181
|
+
return {
|
|
182
|
+
what: "Mnemonic confirmation failed.",
|
|
183
|
+
why: "The requested recovery-phrase confirmation word did not match, so wallet initialization was canceled before it could finish.",
|
|
184
|
+
next: "Run `cogcoin init` again and re-enter the requested confirmation words carefully. The same recovery phrase will be shown until confirmation succeeds.",
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
if (errorCode === "wallet_restore_mnemonic_invalid") {
|
|
188
|
+
return {
|
|
189
|
+
what: "Recovery phrase is invalid.",
|
|
190
|
+
why: "Mnemonic-only restore accepts only a valid 24-word English BIP39 phrase with a matching checksum.",
|
|
191
|
+
next: "Rerun `cogcoin init`, choose \"Restore existing wallet\", and enter the 24 recovery words in the original order.",
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
if (errorCode === "wallet_restore_replace_confirmation_required") {
|
|
195
|
+
return {
|
|
196
|
+
what: "Typed replacement acknowledgement is still required.",
|
|
197
|
+
why: "Mnemonic restore will replace the existing local wallet state and managed Core wallet replica only after you type the exact replacement acknowledgement.",
|
|
198
|
+
next: "Rerun `cogcoin restore` in an interactive terminal and type \"RESTORE\" when prompted.",
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
if (errorCode === "wallet_seed_name_invalid" || errorCode === "wallet_seed_name_reserved" || errorCode === "cli_invalid_seed_name") {
|
|
202
|
+
return {
|
|
203
|
+
what: "Named wallet seeds were removed.",
|
|
204
|
+
why: "Cogcoin no longer accepts named local wallet seeds because the client now uses a single wallet model.",
|
|
205
|
+
next: "Run `cogcoin init` for setup, or reset the wallet first if you need to replace it.",
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
if (errorCode === "wallet_prompt_value_required") {
|
|
209
|
+
return {
|
|
210
|
+
what: "Required input was not provided.",
|
|
211
|
+
why: "This secure admin command needs a non-empty terminal response before it can continue safely.",
|
|
212
|
+
next: "Rerun the command in an interactive terminal and enter the requested value.",
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
if (errorCode === "wallet_state_legacy_envelope_unsupported") {
|
|
216
|
+
return {
|
|
217
|
+
what: "Legacy wallet state is no longer supported.",
|
|
218
|
+
why: "This wallet state was created by an older Cogcoin format that this version no longer loads directly.",
|
|
219
|
+
next: "Restore or otherwise recover the wallet into the current format, then retry the command.",
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
return null;
|
|
223
|
+
},
|
|
224
|
+
];
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
export const walletMutationErrorRules = [
|
|
2
|
+
({ errorCode }) => {
|
|
3
|
+
if (errorCode.endsWith("_sender_utxo_unavailable")) {
|
|
4
|
+
return {
|
|
5
|
+
what: "Sender identity has no spendable confirmed BTC input.",
|
|
6
|
+
why: "This command preserves the Cogcoin sender identity in vin[0]. The selected sender currently has no confirmed spendable UTXO available for that role.",
|
|
7
|
+
next: "Wait for the sender's BTC output to confirm, or fund that sender identity and retry.",
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
if (errorCode.endsWith("_confirmation_rejected")) {
|
|
11
|
+
return {
|
|
12
|
+
what: "Confirmation was declined.",
|
|
13
|
+
why: "The command requires explicit approval before it will publish a state-changing action.",
|
|
14
|
+
next: "Rerun the command and confirm it. If this command uses a plain yes/no path, you can also add `--yes`.",
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (errorCode === "wallet_anchor_invalid_message" || errorCode.startsWith("wallet_anchor_invalid_message_")) {
|
|
18
|
+
const reason = errorCode.startsWith("wallet_anchor_invalid_message_")
|
|
19
|
+
? errorCode.slice("wallet_anchor_invalid_message_".length).trim()
|
|
20
|
+
: null;
|
|
21
|
+
return {
|
|
22
|
+
what: "Founding message cannot be encoded in canonical Coglex.",
|
|
23
|
+
why: reason === null || reason === ""
|
|
24
|
+
? "The supplied founding message could not be encoded into the canonical on-chain Coglex sentence format."
|
|
25
|
+
: reason,
|
|
26
|
+
next: "Retry with a different founding message, or rerun `cogcoin anchor <domain>` without `--message` to skip it.",
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (errorCode === "wallet_secret_provider_linux_runtime_error") {
|
|
30
|
+
return {
|
|
31
|
+
what: "Linux local wallet-secret access failed.",
|
|
32
|
+
why: "Cogcoin could not read or write the local wallet secret file for this Linux account.",
|
|
33
|
+
next: "Check that the Cogcoin state directory is readable and writable for this Linux user, then retry.",
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (errorCode === "wallet_secret_provider_macos_runtime_error") {
|
|
37
|
+
return {
|
|
38
|
+
what: "macOS local wallet-secret access failed.",
|
|
39
|
+
why: "Cogcoin could not read or write the password-protected local wallet secret file for this macOS account.",
|
|
40
|
+
next: "Check that the Cogcoin state directory is readable and writable for this macOS user, then retry.",
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (errorCode === "wallet_secret_provider_windows_runtime_error") {
|
|
44
|
+
return {
|
|
45
|
+
what: "Windows local wallet-secret access failed.",
|
|
46
|
+
why: "Cogcoin could not read or write the local wallet secret file for this Windows account.",
|
|
47
|
+
next: "Check that the Cogcoin state directory is readable and writable for this Windows user, then retry.",
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (errorCode === "wallet_bitcoin_transfer_insufficient_funds") {
|
|
51
|
+
return {
|
|
52
|
+
what: "Wallet address does not have enough BTC.",
|
|
53
|
+
why: "The requested satoshi amount plus the mining fee exceeds the wallet's spendable BTC balance.",
|
|
54
|
+
next: "Reduce the amount or add more BTC to the wallet address, then retry.",
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (errorCode.includes("insufficient")) {
|
|
58
|
+
return {
|
|
59
|
+
what: "Available funds are insufficient.",
|
|
60
|
+
why: "The wallet address does not currently have enough spendable funds for this operation.",
|
|
61
|
+
next: "Add more funds to the wallet address, then retry.",
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (errorCode === "wallet_register_from_not_supported_for_subdomain") {
|
|
65
|
+
return {
|
|
66
|
+
what: "`--from` is not supported for subdomain registration.",
|
|
67
|
+
why: "Cogcoin now uses a single wallet address for local writes, so sender overrides are no longer part of subdomain registration.",
|
|
68
|
+
next: "Retry without `--from`.",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (errorCode === "wallet_register_sender_not_root_eligible") {
|
|
72
|
+
return {
|
|
73
|
+
what: "Root registration sender is not eligible.",
|
|
74
|
+
why: "Root registration now always uses the wallet address, and the local wallet state did not produce a usable sender.",
|
|
75
|
+
next: "Inspect `cogcoin address` and retry.",
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (errorCode === "wallet_register_sender_not_found") {
|
|
79
|
+
return {
|
|
80
|
+
what: "Local sender was not found.",
|
|
81
|
+
why: "The wallet could not resolve a usable local wallet sender for this command.",
|
|
82
|
+
next: "Inspect `cogcoin address` and retry.",
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (errorCode === "wallet_register_sender_read_only") {
|
|
86
|
+
return {
|
|
87
|
+
what: "Wallet sender is not spendable.",
|
|
88
|
+
why: "This command needs the wallet address to author the transaction, but the local wallet sender is not spendable.",
|
|
89
|
+
next: "Check `cogcoin address`, restore the spendable wallet, and retry.",
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (errorCode === "wallet_register_sender_address_unavailable") {
|
|
93
|
+
return {
|
|
94
|
+
what: "Wallet address is unavailable.",
|
|
95
|
+
why: "The local wallet sender was resolved, but the wallet does not currently have a usable display address for it.",
|
|
96
|
+
next: "Inspect `cogcoin address` and retry.",
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (errorCode === "wallet_buy_sender_not_found") {
|
|
100
|
+
return {
|
|
101
|
+
what: "Local buyer was not found.",
|
|
102
|
+
why: "The wallet could not resolve a usable local wallet sender for this purchase.",
|
|
103
|
+
next: "Inspect `cogcoin address` and retry.",
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
if (errorCode === "wallet_buy_sender_read_only") {
|
|
107
|
+
return {
|
|
108
|
+
what: "Wallet sender is not spendable.",
|
|
109
|
+
why: "Buying now always uses the wallet address, but the local wallet sender is not spendable.",
|
|
110
|
+
next: "Check `cogcoin address`, restore the spendable wallet, and retry.",
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
if (errorCode === "wallet_buy_sender_address_unavailable") {
|
|
114
|
+
return {
|
|
115
|
+
what: "Wallet address is unavailable.",
|
|
116
|
+
why: "The wallet could not produce a usable display address for the local sender.",
|
|
117
|
+
next: "Inspect `cogcoin address` and retry.",
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (errorCode === "wallet_buy_already_owner") {
|
|
121
|
+
return {
|
|
122
|
+
what: "The wallet already owns the domain.",
|
|
123
|
+
why: "A buy mutation cannot target a domain already owned by this wallet address.",
|
|
124
|
+
next: "Inspect the current owner with `cogcoin show <domain>` and choose a different domain.",
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
if (errorCode === "wallet_buy_insufficient_cog_balance") {
|
|
128
|
+
return {
|
|
129
|
+
what: "The wallet does not have enough COG.",
|
|
130
|
+
why: "The wallet address does not currently have the listed domain price available in spendable COG balance.",
|
|
131
|
+
next: "Add more COG to the wallet address, then retry.",
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
if (errorCode === "wallet_transfer_owner_not_locally_controlled" || errorCode === "wallet_sell_owner_not_locally_controlled") {
|
|
135
|
+
return {
|
|
136
|
+
what: "Domain owner is not locally controlled.",
|
|
137
|
+
why: "This command must be authored by the current unanchored domain owner, and that current owner script/address is not controlled by this wallet.",
|
|
138
|
+
next: "Inspect the current owner with `cogcoin show <domain>`, then retry from the wallet that controls the owner.",
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
if (errorCode === "wallet_transfer_owner_read_only" || errorCode === "wallet_sell_owner_read_only") {
|
|
142
|
+
return {
|
|
143
|
+
what: "Domain owner is not spendable in this wallet.",
|
|
144
|
+
why: "The current domain owner is visible locally, but this wallet cannot author owner mutations from it.",
|
|
145
|
+
next: "Use the wallet that controls the owner, or import the spendable owner into this wallet before retrying.",
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
if (errorCode === "wallet_field_create_owner_not_locally_controlled"
|
|
149
|
+
|| errorCode === "wallet_field_set_owner_not_locally_controlled"
|
|
150
|
+
|| errorCode === "wallet_field_clear_owner_not_locally_controlled") {
|
|
151
|
+
return {
|
|
152
|
+
what: "Anchored field owner is not locally controlled.",
|
|
153
|
+
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.",
|
|
154
|
+
next: "Inspect the current owner with `cogcoin show <domain>`, then retry from the wallet that controls the owner.",
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
if (errorCode === "wallet_field_create_owner_read_only"
|
|
158
|
+
|| errorCode === "wallet_field_set_owner_read_only"
|
|
159
|
+
|| errorCode === "wallet_field_clear_owner_read_only") {
|
|
160
|
+
return {
|
|
161
|
+
what: "Anchored field owner is not spendable in this wallet.",
|
|
162
|
+
why: "The current anchored owner is visible locally, but this wallet cannot author field mutations from it.",
|
|
163
|
+
next: "Use the wallet that controls the owner, or import the spendable owner into this wallet before retrying.",
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
if (errorCode === "wallet_domain_endpoint_owner_not_locally_controlled"
|
|
167
|
+
|| errorCode === "wallet_domain_delegate_owner_not_locally_controlled"
|
|
168
|
+
|| errorCode === "wallet_domain_miner_owner_not_locally_controlled"
|
|
169
|
+
|| errorCode === "wallet_domain_canonical_owner_not_locally_controlled") {
|
|
170
|
+
return {
|
|
171
|
+
what: "Anchored domain owner is not locally controlled.",
|
|
172
|
+
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.",
|
|
173
|
+
next: "Inspect the current owner with `cogcoin show <domain>`, then retry from the wallet that controls the owner.",
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
if (errorCode === "wallet_domain_endpoint_owner_read_only"
|
|
177
|
+
|| errorCode === "wallet_domain_delegate_owner_read_only"
|
|
178
|
+
|| errorCode === "wallet_domain_miner_owner_read_only"
|
|
179
|
+
|| errorCode === "wallet_domain_canonical_owner_read_only") {
|
|
180
|
+
return {
|
|
181
|
+
what: "Anchored domain owner is not spendable in this wallet.",
|
|
182
|
+
why: "The current anchored owner is visible locally, but this wallet cannot author anchored admin mutations from it.",
|
|
183
|
+
next: "Use the wallet that controls the owner, or import the spendable owner into this wallet before retrying.",
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
if (errorCode === "wallet_rep_give_source_owner_not_locally_controlled"
|
|
187
|
+
|| errorCode === "wallet_rep_revoke_source_owner_not_locally_controlled") {
|
|
188
|
+
return {
|
|
189
|
+
what: "Anchored reputation source owner is not locally controlled.",
|
|
190
|
+
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.",
|
|
191
|
+
next: "Inspect the current source-domain owner with `cogcoin show <domain>`, then retry from the wallet that controls the owner.",
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
if (errorCode === "wallet_rep_give_source_owner_read_only"
|
|
195
|
+
|| errorCode === "wallet_rep_revoke_source_owner_read_only") {
|
|
196
|
+
return {
|
|
197
|
+
what: "Anchored reputation source owner is not spendable in this wallet.",
|
|
198
|
+
why: "The current anchored source-domain owner is visible locally, but this wallet cannot author reputation mutations from it.",
|
|
199
|
+
next: "Use the wallet that controls the owner, or import the spendable owner into this wallet before retrying.",
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
if (errorCode === "wallet_send_sender_address_unavailable" || errorCode === "wallet_lock_sender_address_unavailable") {
|
|
203
|
+
return {
|
|
204
|
+
what: "Wallet address is unavailable.",
|
|
205
|
+
why: "The wallet could not produce a usable display address for the local sender.",
|
|
206
|
+
next: "Inspect `cogcoin address` and retry.",
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
if (errorCode === "wallet_bitcoin_transfer_invalid_amount") {
|
|
210
|
+
return {
|
|
211
|
+
what: "Bitcoin transfer amount is invalid.",
|
|
212
|
+
why: "This command accepts only a positive whole-number satoshi amount such as `1200`.",
|
|
213
|
+
next: "Rerun `cogcoin bitcoin transfer <sats> --to <address>` with a positive integer satoshi amount.",
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
if (errorCode === "wallet_bitcoin_transfer_invalid_address") {
|
|
217
|
+
return {
|
|
218
|
+
what: "Bitcoin transfer recipient address is invalid.",
|
|
219
|
+
why: "This command only accepts a standard mainnet BTC address in `--to`.",
|
|
220
|
+
next: "Rerun `cogcoin bitcoin transfer <sats> --to <address>` with a valid mainnet BTC address.",
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
if (errorCode === "wallet_bitcoin_transfer_address_required") {
|
|
224
|
+
return {
|
|
225
|
+
what: "Bitcoin transfer recipient must be a standard BTC address.",
|
|
226
|
+
why: "V1 of this command does not support opaque script targets such as `spk:<hex>`.",
|
|
227
|
+
next: "Rerun `cogcoin bitcoin transfer <sats> --to <address>` with a standard mainnet BTC address.",
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
if (errorCode === "wallet_bitcoin_transfer_self_transfer") {
|
|
231
|
+
return {
|
|
232
|
+
what: "Bitcoin transfer recipient matches the wallet address.",
|
|
233
|
+
why: "This command rejects self-transfers to the wallet funding script/address.",
|
|
234
|
+
next: "Choose a different recipient address and retry.",
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
if (errorCode === "wallet_bitcoin_transfer_confirmation_rejected") {
|
|
238
|
+
return {
|
|
239
|
+
what: "Bitcoin transfer confirmation was rejected.",
|
|
240
|
+
why: "The interactive confirmation was declined before the BTC payment was broadcast.",
|
|
241
|
+
next: "Review the recipient address and amount, then rerun the command if you still want to send BTC.",
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
if (errorCode === "wallet_bitcoin_transfer_requires_tty") {
|
|
245
|
+
return {
|
|
246
|
+
what: "Bitcoin transfer confirmation needs an interactive terminal.",
|
|
247
|
+
why: "Without `--yes`, Cogcoin must ask for an interactive confirmation before publishing a BTC payment.",
|
|
248
|
+
next: "Rerun the command in an interactive terminal, or add `--yes` if that is appropriate for your workflow.",
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
if (errorCode === "wallet_claim_sender_not_local") {
|
|
252
|
+
return {
|
|
253
|
+
what: "The claim sender is not locally controlled.",
|
|
254
|
+
why: "Before timeout, the wallet may only claim as the current recipient-domain owner, and that owner is not available in this wallet.",
|
|
255
|
+
next: "Check the current recipient-domain owner with `cogcoin show <domain>` or use the wallet that controls the owner.",
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
if (errorCode === "wallet_reclaim_sender_not_local") {
|
|
259
|
+
return {
|
|
260
|
+
what: "The reclaim sender is not locally controlled.",
|
|
261
|
+
why: "After timeout, the wallet may only reclaim as the original locker, and that locker is not controlled by this wallet.",
|
|
262
|
+
next: "Use the wallet that controls the original locker, or inspect the lock details with `cogcoin locks`.",
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
if (errorCode.includes("ambiguous_sender") || errorCode.includes("no_eligible_sender")) {
|
|
266
|
+
return {
|
|
267
|
+
what: "Sender selection could not be resolved.",
|
|
268
|
+
why: "The wallet could not determine a usable local sender for this command.",
|
|
269
|
+
next: "Inspect `cogcoin address` and `cogcoin status`, then retry.",
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
return null;
|
|
273
|
+
},
|
|
274
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface CliErrorClassification {
|
|
2
|
+
exitCode: number;
|
|
3
|
+
errorCode: string;
|
|
4
|
+
message: string;
|
|
5
|
+
}
|
|
6
|
+
export interface CliErrorPresentation {
|
|
7
|
+
what: string;
|
|
8
|
+
why: string | null;
|
|
9
|
+
next: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface CliErrorPresentationInput {
|
|
12
|
+
errorCode: string;
|
|
13
|
+
fallbackMessage: string;
|
|
14
|
+
error?: unknown;
|
|
15
|
+
}
|
|
16
|
+
export type CliErrorPresentationRule = (input: CliErrorPresentationInput) => CliErrorPresentation | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|