@cogcoin/client 0.5.5 → 0.5.7

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 (91) hide show
  1. package/README.md +11 -2
  2. package/dist/bitcoind/bootstrap/chainstate.d.ts +2 -1
  3. package/dist/bitcoind/bootstrap/chainstate.js +4 -1
  4. package/dist/bitcoind/bootstrap/controller.d.ts +4 -1
  5. package/dist/bitcoind/bootstrap/controller.js +42 -5
  6. package/dist/bitcoind/bootstrap/getblock-archive.d.ts +39 -0
  7. package/dist/bitcoind/bootstrap/getblock-archive.js +548 -0
  8. package/dist/bitcoind/bootstrap/headers.d.ts +12 -0
  9. package/dist/bitcoind/bootstrap/headers.js +95 -10
  10. package/dist/bitcoind/bootstrap.d.ts +1 -0
  11. package/dist/bitcoind/bootstrap.js +1 -0
  12. package/dist/bitcoind/client/factory.js +91 -28
  13. package/dist/bitcoind/client/managed-client.d.ts +1 -1
  14. package/dist/bitcoind/client/managed-client.js +4 -3
  15. package/dist/bitcoind/client/sync-engine.js +55 -13
  16. package/dist/bitcoind/errors.js +18 -0
  17. package/dist/bitcoind/indexer-daemon-main.js +78 -0
  18. package/dist/bitcoind/indexer-daemon.d.ts +10 -1
  19. package/dist/bitcoind/indexer-daemon.js +44 -28
  20. package/dist/bitcoind/node.js +2 -0
  21. package/dist/bitcoind/processing-start-height.d.ts +7 -0
  22. package/dist/bitcoind/processing-start-height.js +9 -0
  23. package/dist/bitcoind/progress/constants.d.ts +1 -0
  24. package/dist/bitcoind/progress/constants.js +1 -0
  25. package/dist/bitcoind/progress/controller.d.ts +22 -0
  26. package/dist/bitcoind/progress/controller.js +49 -23
  27. package/dist/bitcoind/progress/formatting.js +29 -1
  28. package/dist/bitcoind/progress/render-policy.d.ts +35 -0
  29. package/dist/bitcoind/progress/render-policy.js +81 -0
  30. package/dist/bitcoind/retryable-rpc.d.ts +11 -0
  31. package/dist/bitcoind/retryable-rpc.js +30 -0
  32. package/dist/bitcoind/service-paths.js +2 -6
  33. package/dist/bitcoind/service.d.ts +21 -2
  34. package/dist/bitcoind/service.js +274 -122
  35. package/dist/bitcoind/testing.d.ts +2 -2
  36. package/dist/bitcoind/testing.js +2 -2
  37. package/dist/bitcoind/types.d.ts +36 -1
  38. package/dist/cli/commands/follow.js +11 -0
  39. package/dist/cli/commands/getblock-archive-restart.d.ts +5 -0
  40. package/dist/cli/commands/getblock-archive-restart.js +15 -0
  41. package/dist/cli/commands/mining-admin.js +4 -0
  42. package/dist/cli/commands/mining-read.js +8 -5
  43. package/dist/cli/commands/mining-runtime.js +4 -0
  44. package/dist/cli/commands/service-runtime.js +150 -134
  45. package/dist/cli/commands/status.js +2 -0
  46. package/dist/cli/commands/sync.js +11 -0
  47. package/dist/cli/commands/wallet-admin.js +106 -24
  48. package/dist/cli/commands/wallet-mutation.js +57 -4
  49. package/dist/cli/commands/wallet-read.js +2 -0
  50. package/dist/cli/context.js +8 -4
  51. package/dist/cli/mutation-command-groups.d.ts +2 -1
  52. package/dist/cli/mutation-command-groups.js +5 -0
  53. package/dist/cli/mutation-json.d.ts +18 -2
  54. package/dist/cli/mutation-json.js +49 -0
  55. package/dist/cli/mutation-success.d.ts +1 -0
  56. package/dist/cli/mutation-success.js +2 -2
  57. package/dist/cli/output.js +86 -1
  58. package/dist/cli/parse.d.ts +1 -1
  59. package/dist/cli/parse.js +133 -3
  60. package/dist/cli/preview-json.d.ts +10 -1
  61. package/dist/cli/preview-json.js +32 -0
  62. package/dist/cli/prompt.js +1 -1
  63. package/dist/cli/runner.js +4 -0
  64. package/dist/cli/types.d.ts +15 -5
  65. package/dist/cli/types.js +1 -1
  66. package/dist/cli/wallet-format.js +140 -14
  67. package/dist/wallet/lifecycle.d.ts +21 -1
  68. package/dist/wallet/lifecycle.js +252 -116
  69. package/dist/wallet/mining/visualizer.d.ts +11 -6
  70. package/dist/wallet/mining/visualizer.js +32 -15
  71. package/dist/wallet/read/context.js +10 -4
  72. package/dist/wallet/reset.d.ts +61 -2
  73. package/dist/wallet/reset.js +246 -89
  74. package/dist/wallet/root-resolution.d.ts +20 -0
  75. package/dist/wallet/root-resolution.js +37 -0
  76. package/dist/wallet/runtime.d.ts +13 -1
  77. package/dist/wallet/runtime.js +54 -11
  78. package/dist/wallet/state/crypto.d.ts +3 -0
  79. package/dist/wallet/state/crypto.js +3 -0
  80. package/dist/wallet/state/provider.d.ts +1 -0
  81. package/dist/wallet/state/provider.js +119 -3
  82. package/dist/wallet/state/seed-index.d.ts +43 -0
  83. package/dist/wallet/state/seed-index.js +151 -0
  84. package/dist/wallet/state/storage.d.ts +7 -1
  85. package/dist/wallet/state/storage.js +39 -0
  86. package/dist/wallet/tx/anchor.d.ts +22 -0
  87. package/dist/wallet/tx/anchor.js +215 -8
  88. package/dist/wallet/tx/index.d.ts +1 -1
  89. package/dist/wallet/tx/index.js +1 -1
  90. package/dist/wallet/types.d.ts +1 -0
  91. package/package.json +1 -1
@@ -5,17 +5,17 @@ import { attachOrStartManagedBitcoindService, probeManagedBitcoindService, stopM
5
5
  import { openSqliteStore } from "../sqlite/index.js";
6
6
  import type { ClientStoreAdapter } from "../types.js";
7
7
  import type { WalletRuntimePaths } from "../wallet/runtime.js";
8
- import type { exportWallet, WalletPrompter, importWallet, initializeWallet, lockWallet, previewResetWallet, repairWallet, resetWallet, restoreWalletFromMnemonic, unlockWallet } from "../wallet/lifecycle.js";
8
+ import type { exportWallet, WalletPrompter, importWallet, initializeWallet, deleteImportedWalletSeed, lockWallet, previewResetWallet, repairWallet, resetWallet, restoreWalletFromMnemonic, showWalletMnemonic, unlockWallet } from "../wallet/lifecycle.js";
9
9
  import type { openWalletReadContext } from "../wallet/read/index.js";
10
10
  import { loadWalletExplicitLock } from "../wallet/state/explicit-lock.js";
11
11
  import { loadUnlockSession } from "../wallet/state/session.js";
12
- import { loadWalletState } from "../wallet/state/storage.js";
12
+ import { loadRawWalletStateEnvelope, loadWalletState } from "../wallet/state/storage.js";
13
13
  import type { WalletSecretProvider } from "../wallet/state/provider.js";
14
14
  import type { disableMiningHooks, enableMiningHooks, followMiningLog, inspectMiningControlPlane, readMiningLog, runForegroundMining, setupBuiltInMining, startBackgroundMining, stopBackgroundMining } from "../wallet/mining/index.js";
15
- import type { anchorDomain, buyDomain, claimCogLock, clearDomainDelegate, clearDomainEndpoint, clearDomainMiner, clearField, createField, giveReputation, lockCogToDomain, registerDomain, reclaimCogLock, revokeReputation, sendCog, setField, setDomainCanonical, setDomainDelegate, setDomainEndpoint, setDomainMiner, sellDomain, transferDomain } from "../wallet/tx/index.js";
15
+ import type { anchorDomain, clearPendingAnchor, buyDomain, claimCogLock, clearDomainDelegate, clearDomainEndpoint, clearDomainMiner, clearField, createField, giveReputation, lockCogToDomain, registerDomain, reclaimCogLock, revokeReputation, sendCog, setField, setDomainCanonical, setDomainDelegate, setDomainEndpoint, setDomainMiner, sellDomain, transferDomain } from "../wallet/tx/index.js";
16
16
  export type ProgressOutput = "auto" | "tty" | "none";
17
17
  export type OutputMode = "text" | "json" | "preview-json";
18
- export type CommandName = "init" | "restore" | "reset" | "repair" | "sync" | "status" | "follow" | "bitcoin-start" | "bitcoin-stop" | "bitcoin-status" | "indexer-start" | "indexer-stop" | "indexer-status" | "unlock" | "anchor" | "domain-anchor" | "register" | "domain-register" | "transfer" | "domain-transfer" | "sell" | "domain-sell" | "unsell" | "domain-unsell" | "buy" | "domain-buy" | "domain-endpoint-set" | "domain-endpoint-clear" | "domain-delegate-set" | "domain-delegate-clear" | "domain-miner-set" | "domain-miner-clear" | "domain-canonical" | "field-list" | "field-show" | "field-create" | "field-set" | "field-clear" | "send" | "claim" | "reclaim" | "cog-send" | "cog-claim" | "cog-reclaim" | "cog-lock" | "rep-give" | "rep-revoke" | "cog-balance" | "cog-locks" | "hooks-mining-enable" | "hooks-mining-disable" | "hooks-mining-status" | "mine" | "mine-start" | "mine-stop" | "mine-setup" | "mine-status" | "mine-log" | "wallet-export" | "wallet-import" | "wallet-init" | "wallet-restore" | "wallet-lock" | "wallet-unlock" | "wallet-status" | "wallet-address" | "wallet-ids" | "address" | "ids" | "balance" | "locks" | "domain-list" | "domains" | "domain-show" | "show" | "fields" | "field";
18
+ export type CommandName = "init" | "restore" | "reset" | "repair" | "sync" | "status" | "follow" | "bitcoin-start" | "bitcoin-stop" | "bitcoin-status" | "indexer-start" | "indexer-stop" | "indexer-status" | "unlock" | "anchor" | "anchor-clear" | "domain-anchor" | "domain-anchor-clear" | "register" | "domain-register" | "transfer" | "domain-transfer" | "sell" | "domain-sell" | "unsell" | "domain-unsell" | "buy" | "domain-buy" | "domain-endpoint-set" | "domain-endpoint-clear" | "domain-delegate-set" | "domain-delegate-clear" | "domain-miner-set" | "domain-miner-clear" | "domain-canonical" | "field-list" | "field-show" | "field-create" | "field-set" | "field-clear" | "send" | "claim" | "reclaim" | "cog-send" | "cog-claim" | "cog-reclaim" | "cog-lock" | "rep-give" | "rep-revoke" | "cog-balance" | "cog-locks" | "hooks-mining-enable" | "hooks-mining-disable" | "hooks-mining-status" | "mine" | "mine-start" | "mine-stop" | "mine-setup" | "mine-status" | "mine-log" | "wallet-export" | "wallet-import" | "wallet-init" | "wallet-delete" | "wallet-restore" | "wallet-show-mnemonic" | "wallet-lock" | "wallet-unlock" | "wallet-status" | "wallet-address" | "wallet-ids" | "address" | "ids" | "balance" | "locks" | "domain-list" | "domains" | "domain-show" | "show" | "fields" | "field";
19
19
  export interface WritableLike {
20
20
  isTTY?: boolean;
21
21
  write(chunk: string): void;
@@ -36,6 +36,7 @@ export interface ParsedCliArgs {
36
36
  dbPath: string | null;
37
37
  dataDir: string | null;
38
38
  progressOutput: ProgressOutput;
39
+ seedName: string | null;
39
40
  unlockFor: string | null;
40
41
  assumeYes: boolean;
41
42
  forceRace: boolean;
@@ -93,7 +94,12 @@ export interface CliRunnerContext {
93
94
  store: ClientStoreAdapter;
94
95
  databasePath?: string;
95
96
  dataDir?: string;
97
+ walletRootId?: string;
96
98
  progressOutput?: ProgressOutput;
99
+ confirmGetblockArchiveRestart?: (options: {
100
+ currentArchiveEndHeight: number | null;
101
+ nextArchiveEndHeight: number;
102
+ }) => Promise<boolean>;
97
103
  }) => Promise<ManagedClientLike>;
98
104
  attachManagedBitcoindService?: typeof attachOrStartManagedBitcoindService;
99
105
  probeManagedBitcoindService?: typeof probeManagedBitcoindService;
@@ -106,6 +112,7 @@ export interface CliRunnerContext {
106
112
  inspectPassiveClientStatus?: typeof inspectPassiveClientStatus;
107
113
  openWalletReadContext?: typeof openWalletReadContext;
108
114
  loadWalletState?: typeof loadWalletState;
115
+ loadRawWalletStateEnvelope?: typeof loadRawWalletStateEnvelope;
109
116
  loadUnlockSession?: typeof loadUnlockSession;
110
117
  loadWalletExplicitLock?: typeof loadWalletExplicitLock;
111
118
  initializeWallet?: typeof initializeWallet;
@@ -113,10 +120,13 @@ export interface CliRunnerContext {
113
120
  previewResetWallet?: typeof previewResetWallet;
114
121
  exportWallet?: typeof exportWallet;
115
122
  importWallet?: typeof importWallet;
123
+ deleteImportedWalletSeed?: typeof deleteImportedWalletSeed;
124
+ showWalletMnemonic?: typeof showWalletMnemonic;
116
125
  unlockWallet?: typeof unlockWallet;
117
126
  lockWallet?: typeof lockWallet;
118
127
  registerDomain?: typeof registerDomain;
119
128
  anchorDomain?: typeof anchorDomain;
129
+ clearPendingAnchor?: typeof clearPendingAnchor;
120
130
  transferDomain?: typeof transferDomain;
121
131
  sellDomain?: typeof sellDomain;
122
132
  buyDomain?: typeof buyDomain;
@@ -153,7 +163,7 @@ export interface CliRunnerContext {
153
163
  readPackageVersion?: () => Promise<string>;
154
164
  resolveDefaultBitcoindDataDir?: () => string;
155
165
  resolveDefaultClientDatabasePath?: () => string;
156
- resolveWalletRuntimePaths?: () => WalletRuntimePaths;
166
+ resolveWalletRuntimePaths?: (seedName?: string | null) => WalletRuntimePaths;
157
167
  }
158
168
  export interface StopSignalWatcher {
159
169
  cleanup(): void;
package/dist/cli/types.js CHANGED
@@ -5,4 +5,4 @@ import { attachOrStartManagedBitcoindService, probeManagedBitcoindService, stopM
5
5
  import { openSqliteStore } from "../sqlite/index.js";
6
6
  import { loadWalletExplicitLock } from "../wallet/state/explicit-lock.js";
7
7
  import { loadUnlockSession } from "../wallet/state/session.js";
8
- import { loadWalletState } from "../wallet/state/storage.js";
8
+ import { loadRawWalletStateEnvelope, loadWalletState } from "../wallet/state/storage.js";
@@ -104,6 +104,12 @@ export function getRepairRecommendation(context) {
104
104
  return null;
105
105
  }
106
106
  export function getMutationRecommendation(context) {
107
+ const clearableAnchorFamily = (context.localState.state?.proactiveFamilies ?? []).find((family) => family.type === "anchor"
108
+ && family.status === "draft"
109
+ && family.currentStep === "reserved");
110
+ if (clearableAnchorFamily?.domainName != null) {
111
+ return `Run \`cogcoin anchor clear ${clearableAnchorFamily.domainName}\` to cancel the local pending anchor reservation, or rerun \`cogcoin anchor ${clearableAnchorFamily.domainName}\` to continue anchoring.`;
112
+ }
107
113
  const unresolvedFamily = (context.localState.state?.proactiveFamilies ?? []).find((family) => (family.type === "anchor" || family.type === "field")
108
114
  && (family.status === "broadcast-unknown" || family.status === "repair-required"));
109
115
  if (unresolvedFamily !== undefined) {
@@ -329,24 +335,144 @@ function appendWalletAvailability(lines, context) {
329
335
  lines.push(`Mutation note: ${mutationRecommendation}`);
330
336
  }
331
337
  }
332
- export function formatWalletOverviewReport(context) {
338
+ function overviewEntry(text, ok) {
339
+ return { text, ok };
340
+ }
341
+ function formatOverviewSection(header, entries) {
342
+ return [header, ...entries.map((entry) => `${entry.ok ? "✓" : "✗"} ${entry.text}`)].join("\n");
343
+ }
344
+ function isMiningOverviewOk(mining) {
345
+ return mining.runtime.bitcoindHealth === "ready"
346
+ && mining.runtime.nodeHealth === "synced"
347
+ && mining.runtime.indexerHealth === "synced"
348
+ && mining.runtime.miningState !== "repair-required"
349
+ && mining.runtime.miningState !== "paused-stale"
350
+ && !(mining.runtime.miningState === "paused" && mining.runtime.liveMiningFamilyInMempool === true);
351
+ }
352
+ function buildOverviewPathsSection(context) {
353
+ return [
354
+ overviewEntry(`DB path: ${context.databasePath}`, true),
355
+ overviewEntry(`Bitcoin datadir: ${context.dataDir}`, true),
356
+ ];
357
+ }
358
+ function buildOverviewWalletSection(context) {
359
+ const walletRoot = context.model?.walletRootId ?? context.localState.walletRootId ?? context.nodeStatus?.walletRootId ?? "none";
333
360
  const lines = [
334
- "Cogcoin Status",
335
- `DB path: ${context.databasePath}`,
336
- `Bitcoin datadir: ${context.dataDir}`,
361
+ overviewEntry(`State: ${context.localState.availability}`, context.localState.availability === "ready"),
362
+ overviewEntry(`Root: ${walletRoot}`, walletRoot !== "none"),
363
+ overviewEntry(`Unlock: ${formatUnlockExpiry(context.localState.unlockUntilUnixMs)}`, context.localState.unlockUntilUnixMs !== null),
337
364
  ];
338
- appendWalletAvailability(lines, context);
339
- appendServiceSummary(lines, context);
340
- if (context.model !== null) {
341
- lines.push(`Local identities: ${context.model.identities.length}`);
342
- lines.push(`Locally related domains: ${context.model.domains.length}`);
343
- lines.push(`Read-only identities: ${context.model.readOnlyIdentityCount}`);
365
+ if (context.localState.message !== null) {
366
+ lines.push(overviewEntry(`Note: ${context.localState.message}`, false));
344
367
  }
345
- else {
346
- lines.push("Wallet-derived sections: unavailable");
368
+ const nodeStatus = context.nodeStatus;
369
+ const replica = nodeStatus?.walletReplica ?? null;
370
+ if (replica !== null) {
371
+ lines.push(overviewEntry(`Managed Core wallet: ${replica.proofStatus ?? "not-proven"}`, replica.proofStatus === "ready"));
347
372
  }
348
- appendPendingMutationSummary(lines, context);
349
- return lines.join("\n");
373
+ if (nodeStatus?.walletReplicaMessage) {
374
+ lines.push(overviewEntry(`Managed Core note: ${nodeStatus.walletReplicaMessage}`, replica?.proofStatus === "ready"));
375
+ }
376
+ return lines;
377
+ }
378
+ function buildOverviewServicesSection(context) {
379
+ const bitcoindOk = context.bitcoind.health === "ready";
380
+ const nodeOk = context.nodeHealth === "synced";
381
+ const indexerOk = context.indexer.health === "synced";
382
+ const lines = [
383
+ overviewEntry(`Managed bitcoind: ${formatServiceHealth(context.bitcoind.health)}`, bitcoindOk),
384
+ ];
385
+ if (context.bitcoind.message !== null) {
386
+ lines.push(overviewEntry(`Managed bitcoind note: ${context.bitcoind.message}`, bitcoindOk));
387
+ }
388
+ lines.push(overviewEntry(`Bitcoin service: ${formatServiceHealth(context.nodeHealth)}`, nodeOk));
389
+ if (context.nodeStatus !== null) {
390
+ lines.push(overviewEntry(`Bitcoin best height: ${formatMaybe(context.nodeStatus.nodeBestHeight)}`, nodeOk));
391
+ lines.push(overviewEntry(`Bitcoin headers: ${formatMaybe(context.nodeStatus.nodeHeaderHeight)}`, nodeOk));
392
+ }
393
+ if (context.nodeMessage !== null) {
394
+ lines.push(overviewEntry(`Bitcoin note: ${context.nodeMessage}`, nodeOk));
395
+ }
396
+ lines.push(overviewEntry(`Indexer service: ${formatServiceHealth(context.indexer.health)}`, indexerOk));
397
+ lines.push(overviewEntry(`Indexer truth source: ${formatIndexerTruthSource(context.indexer.source)}`, indexerOk));
398
+ if (context.indexer.daemonInstanceId !== null && context.indexer.daemonInstanceId !== undefined) {
399
+ lines.push(overviewEntry(`Indexer daemon instance: ${context.indexer.daemonInstanceId}`, indexerOk));
400
+ }
401
+ if (context.indexer.snapshotSeq !== null && context.indexer.snapshotSeq !== undefined) {
402
+ lines.push(overviewEntry(`Indexer snapshot sequence: ${context.indexer.snapshotSeq}`, indexerOk));
403
+ }
404
+ if (context.indexer.status?.reorgDepth !== null && context.indexer.status?.reorgDepth !== undefined) {
405
+ lines.push(overviewEntry(`Indexer reorg depth: ${context.indexer.status.reorgDepth}`, indexerOk));
406
+ }
407
+ lines.push(overviewEntry(`Indexer tip height: ${context.indexer.snapshotTip === null ? "unavailable" : context.indexer.snapshotTip.height}`, indexerOk));
408
+ if (context.indexer.message !== null) {
409
+ lines.push(overviewEntry(`Indexer note: ${context.indexer.message}`, indexerOk));
410
+ }
411
+ if (context.mining !== undefined) {
412
+ const miningOk = isMiningOverviewOk(context.mining);
413
+ lines.push(overviewEntry(`Mining: ${formatMiningSummaryLine(context.mining)}`, miningOk));
414
+ if (context.mining.runtime.note !== null) {
415
+ lines.push(overviewEntry(`Mining note: ${context.mining.runtime.note}`, miningOk));
416
+ }
417
+ }
418
+ return lines;
419
+ }
420
+ function buildOverviewLocalInventorySection(context) {
421
+ if (context.model === null) {
422
+ return [overviewEntry("Status: Wallet-derived sections unavailable", false)];
423
+ }
424
+ return [
425
+ overviewEntry(`Local identities: ${context.model.identities.length}`, true),
426
+ overviewEntry(`Locally related domains: ${context.model.domains.length}`, true),
427
+ overviewEntry(`Read-only identities: ${context.model.readOnlyIdentityCount}`, true),
428
+ ];
429
+ }
430
+ function buildOverviewPendingWorkSection(context) {
431
+ const pendingFamilies = (context.localState.state?.proactiveFamilies ?? [])
432
+ .filter((family) => (family.type === "anchor" || family.type === "field")
433
+ && family.status !== "confirmed"
434
+ && family.status !== "canceled");
435
+ const pendingMutations = (context.localState.state?.pendingMutations ?? [])
436
+ .filter((mutation) => mutation.status !== "confirmed" && mutation.status !== "canceled");
437
+ if (pendingFamilies.length === 0 && pendingMutations.length === 0) {
438
+ return [overviewEntry("Status: none", true)];
439
+ }
440
+ const lines = [];
441
+ for (const family of pendingFamilies) {
442
+ const label = family.type === "field"
443
+ ? `Field family: ${family.domainName ?? "unknown"}.${family.fieldName ?? "unknown"}`
444
+ : `Anchor family: ${family.domainName ?? "unknown"}`;
445
+ lines.push(overviewEntry(`${label} ${family.status}${family.currentStep === null || family.currentStep === undefined ? "" : ` step ${family.currentStep}`}${family.reservedDedicatedIndex == null ? "" : ` index ${family.reservedDedicatedIndex}`}`, false));
446
+ }
447
+ for (const mutation of pendingMutations) {
448
+ lines.push(overviewEntry(`Mutation: ${formatPendingMutationSummaryLabel(mutation)} ${mutation.status} sender spk:${mutation.senderScriptPubKeyHex}${mutation.priceCogtoshi === undefined || mutation.priceCogtoshi === null ? "" : ` price ${formatCogAmount(mutation.priceCogtoshi)}`}${mutation.amountCogtoshi === undefined || mutation.amountCogtoshi === null ? "" : ` amount ${formatCogAmount(mutation.amountCogtoshi)}`}${isReputationMutation(mutation) ? "" : mutation.recipientDomainName === undefined || mutation.recipientDomainName === null ? "" : ` domain ${mutation.recipientDomainName}`}${mutation.lockId === undefined || mutation.lockId === null ? "" : ` lock ${mutation.lockId}`}${mutation.recipientScriptPubKeyHex === undefined || mutation.recipientScriptPubKeyHex === null ? "" : ` recipient spk:${mutation.recipientScriptPubKeyHex}`}${mutation.kind === "endpoint" ? (mutation.endpointValueHex === "" ? " endpoint clear" : ` endpoint-bytes ${(mutation.endpointValueHex?.length ?? 0) / 2}`) : ""}${mutation.kind === "field-create" || mutation.kind === "field-set" ? ` format ${formatFieldFormat(mutation.fieldFormat ?? 0)}` : ""}${mutation.kind === "field-clear" ? " clear" : ""}${mutation.reviewPayloadHex === undefined || mutation.reviewPayloadHex === null ? "" : " review"}`, false));
449
+ }
450
+ return lines;
451
+ }
452
+ function getOverviewNextStep(context) {
453
+ const repairRecommendation = getRepairRecommendation(context);
454
+ if (repairRecommendation !== null) {
455
+ return repairRecommendation;
456
+ }
457
+ if (getBootstrapSyncNextStep(context) !== null) {
458
+ return "Run `cogcoin sync` to bootstrap assumeutxo and the managed Bitcoin/indexer state.";
459
+ }
460
+ return getMutationRecommendation(context);
461
+ }
462
+ export function formatWalletOverviewReport(context) {
463
+ const parts = [
464
+ "\n⛭ Cogcoin Status ⛭",
465
+ formatOverviewSection("Paths", buildOverviewPathsSection(context)),
466
+ formatOverviewSection("Wallet", buildOverviewWalletSection(context)),
467
+ formatOverviewSection("Services", buildOverviewServicesSection(context)),
468
+ formatOverviewSection("Local Inventory", buildOverviewLocalInventorySection(context)),
469
+ formatOverviewSection("Pending Work", buildOverviewPendingWorkSection(context)),
470
+ ];
471
+ const nextStep = getOverviewNextStep(context);
472
+ if (nextStep !== null) {
473
+ parts.push(`Next step: ${nextStep}`);
474
+ }
475
+ return parts.join("\n\n");
350
476
  }
351
477
  export function formatDetailedWalletStatusReport(context) {
352
478
  const lines = ["Cogcoin Wallet Status"];
@@ -12,7 +12,7 @@ export interface WalletPrompter {
12
12
  writeLine(message: string): void;
13
13
  prompt(message: string): Promise<string>;
14
14
  promptHidden?(message: string): Promise<string>;
15
- clearSensitiveDisplay?(scope: "mnemonic-reveal"): void | Promise<void>;
15
+ clearSensitiveDisplay?(scope: "mnemonic-reveal" | "restore-mnemonic-entry"): void | Promise<void>;
16
16
  }
17
17
  export interface WalletInitializationResult {
18
18
  walletRootId: string;
@@ -42,12 +42,18 @@ export interface WalletImportResult {
42
42
  state: WalletStateV1;
43
43
  }
44
44
  export interface WalletRestoreResult {
45
+ seedName?: string | null;
45
46
  walletRootId: string;
46
47
  fundingAddress: string;
47
48
  unlockUntilUnixMs: number;
48
49
  state: WalletStateV1;
49
50
  warnings?: string[];
50
51
  }
52
+ export interface WalletDeleteResult {
53
+ seedName: string;
54
+ walletRootId: string;
55
+ deleted: boolean;
56
+ }
51
57
  export interface WalletRepairResult {
52
58
  walletRootId: string;
53
59
  recoveredFromBackup: boolean;
@@ -156,6 +162,12 @@ export declare function initializeWallet(options: {
156
162
  attachService?: typeof attachOrStartManagedBitcoindService;
157
163
  rpcFactory?: (config: Parameters<typeof createRpcClient>[0]) => WalletLifecycleRpcClient;
158
164
  }): Promise<WalletInitializationResult>;
165
+ export declare function showWalletMnemonic(options: {
166
+ provider?: WalletSecretProvider;
167
+ prompter: WalletPrompter;
168
+ nowUnixMs?: number;
169
+ paths?: WalletRuntimePaths;
170
+ }): Promise<void>;
159
171
  export declare function unlockWallet(options?: {
160
172
  provider?: WalletSecretProvider;
161
173
  nowUnixMs?: number;
@@ -208,6 +220,14 @@ export declare function restoreWalletFromMnemonic(options: {
208
220
  attachService?: typeof attachOrStartManagedBitcoindService;
209
221
  rpcFactory?: (config: Parameters<typeof createRpcClient>[0]) => WalletLifecycleRpcClient;
210
222
  }): Promise<WalletRestoreResult>;
223
+ export declare function deleteImportedWalletSeed(options: {
224
+ dataDir: string;
225
+ provider?: WalletSecretProvider;
226
+ prompter: WalletPrompter;
227
+ assumeYes?: boolean;
228
+ nowUnixMs?: number;
229
+ paths?: WalletRuntimePaths;
230
+ }): Promise<WalletDeleteResult>;
211
231
  export declare function repairWallet(options: {
212
232
  dataDir: string;
213
233
  databasePath: string;