@cogcoin/client 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/README.md +4 -5
  2. package/dist/bitcoind/indexer-daemon.d.ts +3 -7
  3. package/dist/bitcoind/indexer-daemon.js +43 -158
  4. package/dist/bitcoind/managed-runtime/bitcoind-policy.d.ts +16 -0
  5. package/dist/bitcoind/managed-runtime/bitcoind-policy.js +177 -0
  6. package/dist/bitcoind/managed-runtime/indexer-policy.d.ts +34 -0
  7. package/dist/bitcoind/managed-runtime/indexer-policy.js +200 -0
  8. package/dist/bitcoind/managed-runtime/status.d.ts +11 -0
  9. package/dist/bitcoind/managed-runtime/status.js +59 -0
  10. package/dist/bitcoind/managed-runtime/types.d.ts +37 -0
  11. package/dist/bitcoind/managed-runtime/types.js +1 -0
  12. package/dist/bitcoind/progress/tty-renderer.js +3 -2
  13. package/dist/bitcoind/service.d.ts +2 -7
  14. package/dist/bitcoind/service.js +46 -94
  15. package/dist/cli/command-registry.d.ts +39 -0
  16. package/dist/cli/command-registry.js +1132 -0
  17. package/dist/cli/commands/client-admin.js +6 -56
  18. package/dist/cli/commands/mining-admin.js +9 -32
  19. package/dist/cli/commands/mining-read.js +15 -56
  20. package/dist/cli/commands/mining-runtime.js +258 -57
  21. package/dist/cli/commands/service-runtime.js +1 -64
  22. package/dist/cli/commands/status.js +2 -15
  23. package/dist/cli/commands/update.js +6 -21
  24. package/dist/cli/commands/wallet-admin.js +18 -120
  25. package/dist/cli/commands/wallet-mutation.js +4 -7
  26. package/dist/cli/commands/wallet-read.js +31 -138
  27. package/dist/cli/context.js +2 -4
  28. package/dist/cli/mining-format.js +8 -2
  29. package/dist/cli/mutation-command-groups.d.ts +11 -11
  30. package/dist/cli/mutation-command-groups.js +9 -18
  31. package/dist/cli/mutation-json.d.ts +1 -17
  32. package/dist/cli/mutation-json.js +1 -28
  33. package/dist/cli/mutation-success.d.ts +0 -1
  34. package/dist/cli/mutation-success.js +0 -19
  35. package/dist/cli/output.d.ts +1 -10
  36. package/dist/cli/output.js +52 -481
  37. package/dist/cli/parse.d.ts +1 -1
  38. package/dist/cli/parse.js +38 -695
  39. package/dist/cli/runner.js +28 -113
  40. package/dist/cli/types.d.ts +7 -8
  41. package/dist/cli/update-notifier.js +1 -1
  42. package/dist/cli/wallet-format.js +1 -1
  43. package/dist/wallet/lifecycle/access.d.ts +5 -0
  44. package/dist/wallet/lifecycle/access.js +79 -0
  45. package/dist/wallet/lifecycle/context.d.ts +26 -0
  46. package/dist/wallet/lifecycle/context.js +58 -0
  47. package/dist/wallet/lifecycle/managed-core.d.ts +15 -0
  48. package/dist/wallet/lifecycle/managed-core.js +197 -0
  49. package/dist/wallet/lifecycle/repair-bitcoind.d.ts +10 -0
  50. package/dist/wallet/lifecycle/repair-bitcoind.js +142 -0
  51. package/dist/wallet/lifecycle/repair-indexer.d.ts +8 -0
  52. package/dist/wallet/lifecycle/repair-indexer.js +117 -0
  53. package/dist/wallet/lifecycle/repair-mining.d.ts +49 -0
  54. package/dist/wallet/lifecycle/repair-mining.js +304 -0
  55. package/dist/wallet/lifecycle/repair-runtime.d.ts +36 -0
  56. package/dist/wallet/lifecycle/repair-runtime.js +206 -0
  57. package/dist/wallet/lifecycle/repair.d.ts +9 -0
  58. package/dist/wallet/lifecycle/repair.js +127 -0
  59. package/dist/wallet/lifecycle/setup-prompts.d.ts +7 -0
  60. package/dist/wallet/lifecycle/setup-prompts.js +88 -0
  61. package/dist/wallet/lifecycle/setup-state.d.ts +26 -0
  62. package/dist/wallet/lifecycle/setup-state.js +159 -0
  63. package/dist/wallet/lifecycle/setup.d.ts +15 -0
  64. package/dist/wallet/lifecycle/setup.js +124 -0
  65. package/dist/wallet/lifecycle/types.d.ts +156 -0
  66. package/dist/wallet/lifecycle/types.js +1 -0
  67. package/dist/wallet/lifecycle.d.ts +4 -165
  68. package/dist/wallet/lifecycle.js +3 -1656
  69. package/dist/wallet/mining/candidate.d.ts +60 -0
  70. package/dist/wallet/mining/candidate.js +290 -0
  71. package/dist/wallet/mining/competitiveness.d.ts +22 -0
  72. package/dist/wallet/mining/competitiveness.js +640 -0
  73. package/dist/wallet/mining/control.js +7 -251
  74. package/dist/wallet/mining/cycle.d.ts +39 -0
  75. package/dist/wallet/mining/cycle.js +542 -0
  76. package/dist/wallet/mining/engine-state.d.ts +66 -0
  77. package/dist/wallet/mining/engine-state.js +211 -0
  78. package/dist/wallet/mining/engine-types.d.ts +173 -0
  79. package/dist/wallet/mining/engine-types.js +1 -0
  80. package/dist/wallet/mining/engine-utils.d.ts +7 -0
  81. package/dist/wallet/mining/engine-utils.js +75 -0
  82. package/dist/wallet/mining/events.d.ts +2 -0
  83. package/dist/wallet/mining/events.js +19 -0
  84. package/dist/wallet/mining/lifecycle.d.ts +71 -0
  85. package/dist/wallet/mining/lifecycle.js +355 -0
  86. package/dist/wallet/mining/projection.d.ts +61 -0
  87. package/dist/wallet/mining/projection.js +319 -0
  88. package/dist/wallet/mining/publish.d.ts +79 -0
  89. package/dist/wallet/mining/publish.js +614 -0
  90. package/dist/wallet/mining/runner.d.ts +12 -418
  91. package/dist/wallet/mining/runner.js +274 -3433
  92. package/dist/wallet/mining/supervisor.d.ts +134 -0
  93. package/dist/wallet/mining/supervisor.js +558 -0
  94. package/dist/wallet/mining/visualizer-sync.d.ts +42 -0
  95. package/dist/wallet/mining/visualizer-sync.js +166 -0
  96. package/dist/wallet/mining/visualizer.d.ts +1 -0
  97. package/dist/wallet/mining/visualizer.js +33 -18
  98. package/dist/wallet/read/context.js +13 -188
  99. package/dist/wallet/reset.d.ts +1 -1
  100. package/dist/wallet/reset.js +35 -11
  101. package/dist/wallet/runtime.d.ts +0 -6
  102. package/dist/wallet/runtime.js +2 -38
  103. package/dist/wallet/tx/common.d.ts +18 -0
  104. package/dist/wallet/tx/common.js +40 -26
  105. package/package.json +1 -1
  106. package/dist/wallet/state/seed-index.d.ts +0 -43
  107. package/dist/wallet/state/seed-index.js +0 -151
@@ -1,16 +1,10 @@
1
1
  export const walletMutationCommands = [
2
2
  "anchor",
3
- "domain-anchor",
4
3
  "register",
5
- "domain-register",
6
4
  "transfer",
7
- "domain-transfer",
8
5
  "sell",
9
- "domain-sell",
10
6
  "unsell",
11
- "domain-unsell",
12
7
  "buy",
13
- "domain-buy",
14
8
  "domain-endpoint-set",
15
9
  "domain-endpoint-clear",
16
10
  "domain-delegate-set",
@@ -22,11 +16,8 @@ export const walletMutationCommands = [
22
16
  "field-set",
23
17
  "field-clear",
24
18
  "send",
25
- "cog-send",
26
19
  "claim",
27
- "cog-claim",
28
20
  "reclaim",
29
- "cog-reclaim",
30
21
  "cog-lock",
31
22
  "rep-give",
32
23
  "rep-revoke",
@@ -37,34 +28,34 @@ export function isWalletMutationCommand(command) {
37
28
  && walletMutationCommandSet.has(command);
38
29
  }
39
30
  export function isAnchorMutationCommand(command) {
40
- return command === "anchor" || command === "domain-anchor";
31
+ return command === "anchor";
41
32
  }
42
33
  export function isRegisterMutationCommand(command) {
43
- return command === "register" || command === "domain-register";
34
+ return command === "register";
44
35
  }
45
36
  export function isTransferMutationCommand(command) {
46
- return command === "transfer" || command === "domain-transfer";
37
+ return command === "transfer";
47
38
  }
48
39
  export function isSellMutationCommand(command) {
49
- return command === "sell" || command === "domain-sell";
40
+ return command === "sell";
50
41
  }
51
42
  export function isUnsellMutationCommand(command) {
52
- return command === "unsell" || command === "domain-unsell";
43
+ return command === "unsell";
53
44
  }
54
45
  export function isSellOrUnsellMutationCommand(command) {
55
46
  return isSellMutationCommand(command) || isUnsellMutationCommand(command);
56
47
  }
57
48
  export function isBuyMutationCommand(command) {
58
- return command === "buy" || command === "domain-buy";
49
+ return command === "buy";
59
50
  }
60
51
  export function isSendMutationCommand(command) {
61
- return command === "send" || command === "cog-send";
52
+ return command === "send";
62
53
  }
63
54
  export function isClaimMutationCommand(command) {
64
- return command === "claim" || command === "cog-claim";
55
+ return command === "claim";
65
56
  }
66
57
  export function isReclaimMutationCommand(command) {
67
- return command === "reclaim" || command === "cog-reclaim";
58
+ return command === "reclaim";
68
59
  }
69
60
  export function isReputationMutationCommand(command) {
70
61
  return command === "rep-give" || command === "rep-revoke";
@@ -1,5 +1,5 @@
1
1
  import type { AnchorDomainResult, BitcoinTransferResult, CogMutationResult, DomainAdminMutationResult, DomainMarketMutationResult, FieldMutationResult, RegisterDomainResult, ReputationMutationResult, WalletMutationFeeSummary } from "../wallet/tx/index.js";
2
- import type { WalletInitializationResult, WalletDeleteResult, WalletRepairResult, WalletResetResult, WalletRestoreResult } from "../wallet/lifecycle.js";
2
+ import type { WalletInitializationResult, WalletRepairResult, WalletResetResult } from "../wallet/lifecycle.js";
3
3
  export declare function buildSingleTxMutationData(options: {
4
4
  kind: string;
5
5
  localStatus: string;
@@ -201,13 +201,6 @@ export declare function buildResetMutationData(result: WalletResetResult): {
201
201
  };
202
202
  state: Record<string, unknown> | null;
203
203
  };
204
- export declare function buildWalletDeleteMutationData(result: WalletDeleteResult): {
205
- resultType: "operation";
206
- operation: {
207
- kind: string;
208
- };
209
- state: Record<string, unknown> | null;
210
- };
211
204
  export declare function buildDomainAdminMutationData(result: DomainAdminMutationResult, options: {
212
205
  commandKind: "domain-endpoint-set" | "domain-endpoint-clear" | "domain-delegate-set" | "domain-delegate-clear" | "domain-miner-set" | "domain-miner-clear" | "domain-canonical";
213
206
  }): {
@@ -321,15 +314,6 @@ export declare function buildInitMutationData(result: WalletInitializationResult
321
314
  };
322
315
  state: Record<string, unknown>;
323
316
  };
324
- export declare function buildRestoreMutationData(result: WalletRestoreResult): {
325
- resultType: "state-change";
326
- stateChange: {
327
- kind: string;
328
- before: Record<string, unknown> | null;
329
- after: Record<string, unknown> | null;
330
- };
331
- state: Record<string, unknown>;
332
- };
333
317
  export declare function buildRepairMutationData(result: WalletRepairResult): {
334
318
  resultType: "state-change";
335
319
  stateChange: {
@@ -167,21 +167,6 @@ export function buildResetMutationData(result) {
167
167
  },
168
168
  });
169
169
  }
170
- export function buildWalletDeleteMutationData(result) {
171
- return buildOperationData({
172
- kind: "wallet-delete",
173
- state: {
174
- seedName: result.seedName,
175
- walletRootId: result.walletRootId,
176
- deleted: result.deleted,
177
- },
178
- operation: {
179
- seedName: result.seedName,
180
- walletRootId: result.walletRootId,
181
- deleted: result.deleted,
182
- },
183
- });
184
- }
185
170
  export function buildDomainAdminMutationData(result, options) {
186
171
  const data = buildSingleTxMutationData({
187
172
  kind: options.commandKind,
@@ -244,7 +229,7 @@ export function buildReputationMutationData(result) {
244
229
  }
245
230
  export function buildInitMutationData(result) {
246
231
  const after = {
247
- seedName: "main",
232
+ setupMode: result.setupMode,
248
233
  passwordAction: result.passwordAction,
249
234
  walletAction: result.walletAction,
250
235
  walletRootId: result.walletRootId,
@@ -257,18 +242,6 @@ export function buildInitMutationData(result) {
257
242
  after,
258
243
  });
259
244
  }
260
- export function buildRestoreMutationData(result) {
261
- const after = {
262
- seedName: result.seedName ?? null,
263
- walletRootId: result.walletRootId,
264
- fundingAddress: result.fundingAddress,
265
- };
266
- return buildStateChangeData({
267
- kind: "restore",
268
- state: after,
269
- after,
270
- });
271
- }
272
245
  export function buildRepairMutationData(result) {
273
246
  const after = {
274
247
  walletRootId: result.walletRootId,
@@ -2,7 +2,6 @@ import { type WalletMutationFeeSummary } from "../wallet/tx/common.js";
2
2
  import { type MutationTextField } from "./mutation-text-write.js";
3
3
  import type { ParsedCliArgs, RequiredCliRunnerContext } from "./types.js";
4
4
  export interface MutationSuccessNextSteps {
5
- json: string[];
6
5
  text: string[];
7
6
  }
8
7
  export declare function commandMutationNextSteps(command: string): MutationSuccessNextSteps;
@@ -1,16 +1,13 @@
1
1
  import { formatSatVb, } from "../wallet/tx/common.js";
2
- import { createPreviewSuccessEnvelope, createMutationSuccessEnvelope, describeCanonicalCommand, resolvePreviewJsonSchema, resolveStableMutationJsonSchema, writeJsonValue, } from "./output.js";
3
2
  import { writeMutationTextResult, } from "./mutation-text-write.js";
4
3
  import { formatNextStepLines } from "./workflow-hints.js";
5
4
  export function commandMutationNextSteps(command) {
6
5
  return {
7
- json: [`Run \`${command}\`.`],
8
6
  text: [`Next step: ${command}`],
9
7
  };
10
8
  }
11
9
  export function workflowMutationNextSteps(nextSteps) {
12
10
  return {
13
- json: [...nextSteps],
14
11
  text: formatNextStepLines(nextSteps),
15
12
  };
16
13
  }
@@ -30,22 +27,6 @@ function feeFields(fees) {
30
27
  ];
31
28
  }
32
29
  export function writeMutationCommandSuccess(parsed, context, options) {
33
- if (parsed.outputMode === "preview-json") {
34
- writeJsonValue(context.stdout, createPreviewSuccessEnvelope(resolvePreviewJsonSchema(parsed), describeCanonicalCommand(parsed), options.outcome ?? mutationOutcome(options.reusedExisting), options.previewData ?? options.data, {
35
- explanations: reuseExplanation(options.reusedExisting, options.reusedMessage),
36
- nextSteps: options.nextSteps.json,
37
- warnings: options.warnings,
38
- }));
39
- return 0;
40
- }
41
- if (parsed.outputMode === "json") {
42
- writeJsonValue(context.stdout, createMutationSuccessEnvelope(resolveStableMutationJsonSchema(parsed), describeCanonicalCommand(parsed), options.outcome ?? mutationOutcome(options.reusedExisting), options.data, {
43
- explanations: reuseExplanation(options.reusedExisting, options.reusedMessage),
44
- nextSteps: options.nextSteps.json,
45
- warnings: options.warnings,
46
- }));
47
- return 0;
48
- }
49
30
  writeMutationTextResult(context.stdout, {
50
31
  heading: options.text.heading,
51
32
  fields: [...options.text.fields, ...feeFields(options.fees)],
@@ -1,4 +1,4 @@
1
- import type { CommandName, OutputMode, ParsedCliArgs, WritableLike } from "./types.js";
1
+ import type { ParsedCliArgs, WritableLike } from "./types.js";
2
2
  export interface JsonAvailabilityEntry {
3
3
  available: boolean;
4
4
  stale: boolean;
@@ -106,7 +106,6 @@ export interface PreviewJsonErrorEnvelope extends PreviewJsonEnvelopeBase {
106
106
  };
107
107
  }
108
108
  export declare function writeJsonValue(stream: WritableLike, value: unknown): void;
109
- export declare function isStructuredOutputMode(mode: OutputMode): boolean;
110
109
  export declare function createSuccessEnvelope<T>(schema: string, command: string, data: T, options?: {
111
110
  warnings?: string[];
112
111
  explanations?: string[];
@@ -169,14 +168,6 @@ export declare function createCliErrorPresentation(errorCode: string, fallbackMe
169
168
  next: string | null;
170
169
  } | null;
171
170
  export declare function describeCanonicalCommand(parsed: ParsedCliArgs): string;
172
- export declare function inferOutputMode(argv: readonly string[]): OutputMode;
173
- export declare function resolveStableJsonSchema(parsed: ParsedCliArgs): string | null;
174
- export declare function resolveStableMutationJsonSchema(parsed: ParsedCliArgs): string | null;
175
- export declare function resolveStableMiningControlJsonSchema(parsed: ParsedCliArgs): string | null;
176
- export declare function resolvePreviewJsonSchema(parsed: ParsedCliArgs): string | null;
177
- export declare function isJsonOutputSupportedCommand(command: CommandName | null): boolean;
178
- export declare function isPreviewJsonOutputSupportedCommand(command: CommandName | null): boolean;
179
- export declare function createCommandJsonErrorEnvelope(parsed: ParsedCliArgs, error: unknown): StableJsonErrorEnvelope | MutationJsonErrorEnvelope | PreviewJsonErrorEnvelope;
180
171
  export declare function writeHandledCliError(options: {
181
172
  parsed: ParsedCliArgs;
182
173
  stdout: WritableLike;