@cogcoin/client 1.0.2 → 1.1.1
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 +3 -2
- package/dist/bitcoind/client/factory.d.ts +0 -8
- package/dist/bitcoind/client/factory.js +1 -59
- package/dist/bitcoind/client/managed-client.d.ts +1 -3
- package/dist/bitcoind/client/managed-client.js +3 -47
- package/dist/bitcoind/client/sync-engine.js +1 -1
- package/dist/bitcoind/indexer-daemon-main.js +171 -35
- package/dist/bitcoind/indexer-daemon.d.ts +11 -3
- package/dist/bitcoind/indexer-daemon.js +147 -59
- package/dist/bitcoind/indexer-monitor.d.ts +12 -0
- package/dist/bitcoind/indexer-monitor.js +93 -0
- package/dist/bitcoind/progress/controller.js +4 -1
- package/dist/bitcoind/progress/follow-scene.d.ts +7 -1
- package/dist/bitcoind/progress/follow-scene.js +94 -5
- package/dist/bitcoind/progress/tty-renderer.d.ts +2 -0
- package/dist/bitcoind/progress/tty-renderer.js +2 -0
- package/dist/bitcoind/testing.d.ts +0 -1
- package/dist/bitcoind/testing.js +0 -1
- package/dist/bitcoind/types.d.ts +5 -2
- package/dist/cli/commands/follow.js +44 -49
- package/dist/cli/commands/mining-admin.js +56 -2
- package/dist/cli/commands/mining-read.js +43 -3
- package/dist/cli/commands/mining-runtime.js +91 -73
- package/dist/cli/commands/service-runtime.js +42 -2
- package/dist/cli/commands/status.js +3 -1
- package/dist/cli/commands/sync.js +50 -90
- package/dist/cli/commands/wallet-admin.js +21 -3
- package/dist/cli/commands/wallet-read.js +2 -0
- package/dist/cli/context.d.ts +0 -1
- package/dist/cli/context.js +7 -24
- package/dist/cli/managed-indexer-observer.d.ts +33 -0
- package/dist/cli/managed-indexer-observer.js +163 -0
- package/dist/cli/mining-format.d.ts +3 -1
- package/dist/cli/mining-format.js +35 -0
- package/dist/cli/mining-json.d.ts +11 -1
- package/dist/cli/mining-json.js +9 -0
- package/dist/cli/output.js +24 -0
- package/dist/cli/parse.d.ts +1 -1
- package/dist/cli/parse.js +23 -0
- package/dist/cli/read-json.d.ts +13 -1
- package/dist/cli/read-json.js +31 -0
- package/dist/cli/runner.js +4 -2
- package/dist/cli/signals.d.ts +12 -0
- package/dist/cli/signals.js +31 -13
- package/dist/cli/types.d.ts +8 -4
- package/dist/cli/update-service.d.ts +2 -12
- package/dist/cli/update-service.js +2 -68
- package/dist/package-version.d.ts +1 -0
- package/dist/package-version.js +17 -0
- package/dist/semver.d.ts +12 -0
- package/dist/semver.js +68 -0
- package/dist/wallet/lifecycle.js +0 -6
- package/dist/wallet/mining/config.js +54 -3
- package/dist/wallet/mining/control.d.ts +5 -2
- package/dist/wallet/mining/control.js +153 -34
- package/dist/wallet/mining/domain-prompts.d.ts +17 -0
- package/dist/wallet/mining/domain-prompts.js +130 -0
- package/dist/wallet/mining/index.d.ts +2 -1
- package/dist/wallet/mining/index.js +1 -0
- package/dist/wallet/mining/runner.d.ts +58 -2
- package/dist/wallet/mining/runner.js +553 -331
- package/dist/wallet/mining/sentence-protocol.d.ts +1 -0
- package/dist/wallet/mining/sentences.js +7 -4
- package/dist/wallet/mining/types.d.ts +26 -0
- package/dist/wallet/mining/visualizer.d.ts +3 -0
- package/dist/wallet/mining/visualizer.js +106 -12
- package/dist/wallet/read/context.d.ts +1 -0
- package/dist/wallet/read/context.js +19 -10
- package/dist/wallet/reset.js +0 -1
- package/dist/wallet/state/client-password-agent.js +4 -1
- package/dist/wallet/state/client-password.js +15 -8
- package/dist/wallet/tx/anchor.js +0 -1
- package/dist/wallet/tx/bitcoin-transfer.js +0 -1
- package/dist/wallet/tx/cog.js +0 -3
- package/dist/wallet/tx/common.js +1 -1
- package/dist/wallet/tx/domain-admin.js +0 -1
- package/dist/wallet/tx/domain-market.js +0 -3
- package/dist/wallet/tx/field.js +0 -1
- package/dist/wallet/tx/register.js +0 -1
- package/dist/wallet/tx/reputation.js +0 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
-
import { attachOrStartManagedBitcoindService } from "../../bitcoind/service.js";
|
|
2
|
+
import { attachOrStartManagedBitcoindService, probeManagedBitcoindService, stopManagedBitcoindService } from "../../bitcoind/service.js";
|
|
3
3
|
import { createRpcClient } from "../../bitcoind/node.js";
|
|
4
4
|
import type { ProgressOutputMode } from "../../bitcoind/types.js";
|
|
5
5
|
import { type FixedWalletInput, type MutationSender, type WalletMutationRpcClient } from "../tx/common.js";
|
|
@@ -10,6 +10,7 @@ import { type WalletRuntimePaths } from "../runtime.js";
|
|
|
10
10
|
import { type WalletSecretProvider } from "../state/provider.js";
|
|
11
11
|
import type { MiningStateRecord, OutpointRecord, WalletStateV1 } from "../types.js";
|
|
12
12
|
import { requestMiningGenerationPreemption } from "./coordination.js";
|
|
13
|
+
import { type MiningSentenceGenerationRequest } from "./sentences.js";
|
|
13
14
|
import type { MiningControlPlaneView, MiningEventRecord, MiningRuntimeStatusV1 } from "./types.js";
|
|
14
15
|
import { type MiningFollowVisualizerState, type MiningSentenceBoardEntry, MiningFollowVisualizer } from "./visualizer.js";
|
|
15
16
|
type MiningRpcClient = WalletMutationRpcClient & {
|
|
@@ -94,6 +95,8 @@ interface MiningRunnerStatusOverrides {
|
|
|
94
95
|
currentAbsoluteFeeSats?: number | null;
|
|
95
96
|
currentBlockFeeSpentSats?: string;
|
|
96
97
|
lastSuspendDetectedAtUnixMs?: number | null;
|
|
98
|
+
reconnectSettledUntilUnixMs?: number | null;
|
|
99
|
+
tipSettledUntilUnixMs?: number | null;
|
|
97
100
|
providerState?: MiningRuntimeStatusV1["providerState"];
|
|
98
101
|
corePublishState?: MiningRuntimeStatusV1["corePublishState"];
|
|
99
102
|
currentPublishDecision?: string | null;
|
|
@@ -175,10 +178,19 @@ interface MiningLoopState {
|
|
|
175
178
|
selectedCandidate: MiningCandidate | null;
|
|
176
179
|
ui: MiningFollowVisualizerState;
|
|
177
180
|
waitingNote: string | null;
|
|
181
|
+
bitcoinRecoveryFirstFailureAtUnixMs: number | null;
|
|
182
|
+
bitcoinRecoveryFirstUnreachableAtUnixMs: number | null;
|
|
183
|
+
bitcoinRecoveryLastRestartAttemptAtUnixMs: number | null;
|
|
184
|
+
bitcoinRecoveryServiceInstanceId: string | null;
|
|
185
|
+
bitcoinRecoveryProcessId: number | null;
|
|
186
|
+
reconnectSettledUntilUnixMs: number | null;
|
|
187
|
+
tipSettledUntilUnixMs: number | null;
|
|
178
188
|
}
|
|
179
189
|
export interface RunForegroundMiningOptions extends RunnerDependencies {
|
|
180
190
|
dataDir: string;
|
|
181
191
|
databasePath: string;
|
|
192
|
+
clientVersion?: string | null;
|
|
193
|
+
updateAvailable?: boolean;
|
|
182
194
|
provider?: WalletSecretProvider;
|
|
183
195
|
prompter: WalletPrompter;
|
|
184
196
|
builtInSetupEnsured?: boolean;
|
|
@@ -224,6 +236,7 @@ export declare function resetMiningUiForTipForTesting(loopState: MiningLoopState
|
|
|
224
236
|
export declare function resolveSettledBoardForTesting(options: {
|
|
225
237
|
snapshotState: NonNullable<WalletReadContext["snapshot"]>["state"] | null | undefined;
|
|
226
238
|
snapshotTipHeight: number | null;
|
|
239
|
+
snapshotTipPreviousHashHex?: string | null;
|
|
227
240
|
nodeBestHeight: number | null;
|
|
228
241
|
}): {
|
|
229
242
|
settledBlockHeight: number | null;
|
|
@@ -273,7 +286,7 @@ export declare function createMiningPlanForTesting(options: {
|
|
|
273
286
|
referencedBlockHashInternal: Uint8Array;
|
|
274
287
|
targetBlockHeight: number;
|
|
275
288
|
};
|
|
276
|
-
conflictOutpoint: OutpointRecord;
|
|
289
|
+
conflictOutpoint: OutpointRecord | null;
|
|
277
290
|
allUtxos: Awaited<ReturnType<MiningRpcClient["listUnspent"]>>;
|
|
278
291
|
feeRateSatVb: number;
|
|
279
292
|
}): {
|
|
@@ -294,6 +307,19 @@ export declare function resolveMiningConflictOutpointForTesting(options: {
|
|
|
294
307
|
state: WalletStateV1;
|
|
295
308
|
allUtxos: Awaited<ReturnType<MiningRpcClient["listUnspent"]>>;
|
|
296
309
|
}): OutpointRecord | null;
|
|
310
|
+
export declare function buildMiningGenerationRequestForTesting(options: {
|
|
311
|
+
targetBlockHeight: number;
|
|
312
|
+
referencedBlockHashDisplay: string;
|
|
313
|
+
generatedAtUnixMs?: number;
|
|
314
|
+
requestId?: string;
|
|
315
|
+
domains: Array<{
|
|
316
|
+
domainId: number;
|
|
317
|
+
domainName: string;
|
|
318
|
+
requiredWords: [string, string, string, string, string];
|
|
319
|
+
}>;
|
|
320
|
+
domainExtraPrompts?: Record<string, string>;
|
|
321
|
+
extraPrompt?: string | null;
|
|
322
|
+
}): MiningSentenceGenerationRequest;
|
|
297
323
|
declare function publishCandidateOnce(options: {
|
|
298
324
|
readContext: WalletReadContext & {
|
|
299
325
|
localState: {
|
|
@@ -356,11 +382,15 @@ declare function runMiningLoop(options: {
|
|
|
356
382
|
fetchImpl?: typeof fetch;
|
|
357
383
|
openReadContext: typeof openWalletReadContext;
|
|
358
384
|
attachService: typeof attachOrStartManagedBitcoindService;
|
|
385
|
+
probeService?: typeof probeManagedBitcoindService;
|
|
386
|
+
stopService?: typeof stopManagedBitcoindService;
|
|
359
387
|
rpcFactory: (config: Parameters<typeof createRpcClient>[0]) => MiningRpcClient;
|
|
360
388
|
stdout?: {
|
|
361
389
|
write(chunk: string): void;
|
|
362
390
|
};
|
|
363
391
|
visualizer?: MiningFollowVisualizer;
|
|
392
|
+
nowImpl?: () => number;
|
|
393
|
+
sleepImpl?: typeof sleep;
|
|
364
394
|
}): Promise<void>;
|
|
365
395
|
declare function waitForBackgroundHealthy(paths: WalletRuntimePaths): Promise<MiningRuntimeStatusV1 | null>;
|
|
366
396
|
export declare function runForegroundMining(options: RunForegroundMiningOptions): Promise<void>;
|
|
@@ -384,6 +414,7 @@ export declare function handleDetectedMiningRuntimeResumeForTesting(options: {
|
|
|
384
414
|
detectedAtUnixMs: number;
|
|
385
415
|
openReadContext: typeof openWalletReadContext;
|
|
386
416
|
visualizer?: MiningFollowVisualizer;
|
|
417
|
+
loopState?: MiningLoopState;
|
|
387
418
|
}): Promise<void>;
|
|
388
419
|
export declare function takeOverMiningRuntimeForTesting(options: {
|
|
389
420
|
paths: WalletRuntimePaths;
|
|
@@ -406,11 +437,36 @@ export declare function performMiningCycleForTesting(options: {
|
|
|
406
437
|
fetchImpl?: typeof fetch;
|
|
407
438
|
openReadContext: typeof openWalletReadContext;
|
|
408
439
|
attachService: typeof attachOrStartManagedBitcoindService;
|
|
440
|
+
probeService?: typeof probeManagedBitcoindService;
|
|
441
|
+
stopService?: typeof stopManagedBitcoindService;
|
|
409
442
|
rpcFactory: (config: Parameters<typeof createRpcClient>[0]) => MiningRpcClient;
|
|
410
443
|
stdout?: {
|
|
411
444
|
write(chunk: string): void;
|
|
412
445
|
};
|
|
413
446
|
loopState?: MiningLoopState;
|
|
447
|
+
nowImpl?: () => number;
|
|
448
|
+
}): Promise<void>;
|
|
449
|
+
export declare function runMiningLoopForTesting(options: {
|
|
450
|
+
dataDir: string;
|
|
451
|
+
databasePath: string;
|
|
452
|
+
provider: WalletSecretProvider;
|
|
453
|
+
paths: WalletRuntimePaths;
|
|
454
|
+
runMode: "foreground" | "background";
|
|
455
|
+
backgroundWorkerPid: number | null;
|
|
456
|
+
backgroundWorkerRunId: string | null;
|
|
457
|
+
signal?: AbortSignal;
|
|
458
|
+
fetchImpl?: typeof fetch;
|
|
459
|
+
openReadContext: typeof openWalletReadContext;
|
|
460
|
+
attachService: typeof attachOrStartManagedBitcoindService;
|
|
461
|
+
probeService?: typeof probeManagedBitcoindService;
|
|
462
|
+
stopService?: typeof stopManagedBitcoindService;
|
|
463
|
+
rpcFactory: (config: Parameters<typeof createRpcClient>[0]) => MiningRpcClient;
|
|
464
|
+
stdout?: {
|
|
465
|
+
write(chunk: string): void;
|
|
466
|
+
};
|
|
467
|
+
visualizer?: MiningFollowVisualizer;
|
|
468
|
+
nowImpl?: () => number;
|
|
469
|
+
sleepImpl?: typeof sleep;
|
|
414
470
|
}): Promise<void>;
|
|
415
471
|
export declare function buildPrePublishStatusOverridesForTesting(options: {
|
|
416
472
|
state: WalletStateV1;
|