@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.
- package/README.md +4 -5
- package/dist/bitcoind/indexer-daemon.d.ts +3 -7
- package/dist/bitcoind/indexer-daemon.js +43 -158
- package/dist/bitcoind/managed-runtime/bitcoind-policy.d.ts +16 -0
- package/dist/bitcoind/managed-runtime/bitcoind-policy.js +177 -0
- package/dist/bitcoind/managed-runtime/indexer-policy.d.ts +34 -0
- package/dist/bitcoind/managed-runtime/indexer-policy.js +200 -0
- package/dist/bitcoind/managed-runtime/status.d.ts +11 -0
- package/dist/bitcoind/managed-runtime/status.js +59 -0
- package/dist/bitcoind/managed-runtime/types.d.ts +37 -0
- package/dist/bitcoind/managed-runtime/types.js +1 -0
- package/dist/bitcoind/progress/tty-renderer.js +3 -2
- package/dist/bitcoind/service.d.ts +2 -7
- package/dist/bitcoind/service.js +46 -94
- package/dist/cli/command-registry.d.ts +39 -0
- package/dist/cli/command-registry.js +1132 -0
- package/dist/cli/commands/client-admin.js +6 -56
- package/dist/cli/commands/mining-admin.js +9 -32
- package/dist/cli/commands/mining-read.js +15 -56
- package/dist/cli/commands/mining-runtime.js +258 -57
- package/dist/cli/commands/service-runtime.js +1 -64
- package/dist/cli/commands/status.js +2 -15
- package/dist/cli/commands/update.js +6 -21
- package/dist/cli/commands/wallet-admin.js +18 -120
- package/dist/cli/commands/wallet-mutation.js +4 -7
- package/dist/cli/commands/wallet-read.js +31 -138
- package/dist/cli/context.js +2 -4
- package/dist/cli/mining-format.js +8 -2
- package/dist/cli/mutation-command-groups.d.ts +11 -11
- package/dist/cli/mutation-command-groups.js +9 -18
- package/dist/cli/mutation-json.d.ts +1 -17
- package/dist/cli/mutation-json.js +1 -28
- package/dist/cli/mutation-success.d.ts +0 -1
- package/dist/cli/mutation-success.js +0 -19
- package/dist/cli/output.d.ts +1 -10
- package/dist/cli/output.js +52 -481
- package/dist/cli/parse.d.ts +1 -1
- package/dist/cli/parse.js +38 -695
- package/dist/cli/runner.js +28 -113
- package/dist/cli/types.d.ts +7 -8
- package/dist/cli/update-notifier.js +1 -1
- package/dist/cli/wallet-format.js +1 -1
- package/dist/wallet/lifecycle/access.d.ts +5 -0
- package/dist/wallet/lifecycle/access.js +79 -0
- package/dist/wallet/lifecycle/context.d.ts +26 -0
- package/dist/wallet/lifecycle/context.js +58 -0
- package/dist/wallet/lifecycle/managed-core.d.ts +15 -0
- package/dist/wallet/lifecycle/managed-core.js +197 -0
- package/dist/wallet/lifecycle/repair-bitcoind.d.ts +10 -0
- package/dist/wallet/lifecycle/repair-bitcoind.js +142 -0
- package/dist/wallet/lifecycle/repair-indexer.d.ts +8 -0
- package/dist/wallet/lifecycle/repair-indexer.js +117 -0
- package/dist/wallet/lifecycle/repair-mining.d.ts +49 -0
- package/dist/wallet/lifecycle/repair-mining.js +304 -0
- package/dist/wallet/lifecycle/repair-runtime.d.ts +36 -0
- package/dist/wallet/lifecycle/repair-runtime.js +206 -0
- package/dist/wallet/lifecycle/repair.d.ts +9 -0
- package/dist/wallet/lifecycle/repair.js +127 -0
- package/dist/wallet/lifecycle/setup-prompts.d.ts +7 -0
- package/dist/wallet/lifecycle/setup-prompts.js +88 -0
- package/dist/wallet/lifecycle/setup-state.d.ts +26 -0
- package/dist/wallet/lifecycle/setup-state.js +159 -0
- package/dist/wallet/lifecycle/setup.d.ts +15 -0
- package/dist/wallet/lifecycle/setup.js +124 -0
- package/dist/wallet/lifecycle/types.d.ts +156 -0
- package/dist/wallet/lifecycle/types.js +1 -0
- package/dist/wallet/lifecycle.d.ts +4 -165
- package/dist/wallet/lifecycle.js +3 -1656
- package/dist/wallet/mining/candidate.d.ts +60 -0
- package/dist/wallet/mining/candidate.js +290 -0
- package/dist/wallet/mining/competitiveness.d.ts +22 -0
- package/dist/wallet/mining/competitiveness.js +640 -0
- package/dist/wallet/mining/control.js +7 -251
- package/dist/wallet/mining/cycle.d.ts +39 -0
- package/dist/wallet/mining/cycle.js +542 -0
- package/dist/wallet/mining/engine-state.d.ts +66 -0
- package/dist/wallet/mining/engine-state.js +211 -0
- package/dist/wallet/mining/engine-types.d.ts +173 -0
- package/dist/wallet/mining/engine-types.js +1 -0
- package/dist/wallet/mining/engine-utils.d.ts +7 -0
- package/dist/wallet/mining/engine-utils.js +75 -0
- package/dist/wallet/mining/events.d.ts +2 -0
- package/dist/wallet/mining/events.js +19 -0
- package/dist/wallet/mining/lifecycle.d.ts +71 -0
- package/dist/wallet/mining/lifecycle.js +355 -0
- package/dist/wallet/mining/projection.d.ts +61 -0
- package/dist/wallet/mining/projection.js +319 -0
- package/dist/wallet/mining/publish.d.ts +79 -0
- package/dist/wallet/mining/publish.js +614 -0
- package/dist/wallet/mining/runner.d.ts +12 -418
- package/dist/wallet/mining/runner.js +274 -3433
- package/dist/wallet/mining/supervisor.d.ts +134 -0
- package/dist/wallet/mining/supervisor.js +558 -0
- package/dist/wallet/mining/visualizer-sync.d.ts +42 -0
- package/dist/wallet/mining/visualizer-sync.js +166 -0
- package/dist/wallet/mining/visualizer.d.ts +1 -0
- package/dist/wallet/mining/visualizer.js +33 -18
- package/dist/wallet/read/context.js +13 -188
- package/dist/wallet/reset.d.ts +1 -1
- package/dist/wallet/reset.js +35 -11
- package/dist/wallet/runtime.d.ts +0 -6
- package/dist/wallet/runtime.js +2 -38
- package/dist/wallet/tx/common.d.ts +18 -0
- package/dist/wallet/tx/common.js +40 -26
- package/package.json +1 -1
- package/dist/wallet/state/seed-index.d.ts +0 -43
- package/dist/wallet/state/seed-index.js +0 -151
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { deriveWalletMaterialFromMnemonic } from "../material.js";
|
|
2
|
+
import { ensureClientPasswordConfigured, withInteractiveWalletSecretProvider, } from "../state/provider.js";
|
|
3
|
+
import { loadWalletStateForAccess, mapWalletReadAccessError } from "./access.js";
|
|
4
|
+
import { acquireWalletControlLock, resolveWalletManagedCoreContext, resolveWalletSetupContext, walletStateExists, } from "./context.js";
|
|
5
|
+
import { clearSensitiveDisplay, confirmMnemonic, confirmTypedAcknowledgement, promptForInitializationMode, promptForRestoreMnemonic, writeMnemonicReveal, } from "./setup-prompts.js";
|
|
6
|
+
import { clearPendingInitialization, loadOrCreatePendingInitializationMaterial, persistInitializedWallet, } from "./setup-state.js";
|
|
7
|
+
export async function initializeWallet(options) {
|
|
8
|
+
const context = resolveWalletSetupContext(options);
|
|
9
|
+
if (!context.prompter.isInteractive) {
|
|
10
|
+
throw new Error("wallet_init_requires_tty");
|
|
11
|
+
}
|
|
12
|
+
const interactiveProvider = withInteractiveWalletSecretProvider(context.provider, context.prompter);
|
|
13
|
+
const controlLock = await acquireWalletControlLock(context.paths, "wallet-init");
|
|
14
|
+
try {
|
|
15
|
+
const passwordAction = await ensureClientPasswordConfigured(context.provider, context.prompter);
|
|
16
|
+
if (await walletStateExists(context.paths)) {
|
|
17
|
+
await clearPendingInitialization(context.paths, interactiveProvider);
|
|
18
|
+
const loaded = await loadWalletStateForAccess({
|
|
19
|
+
...context,
|
|
20
|
+
provider: interactiveProvider,
|
|
21
|
+
dataDir: context.dataDir,
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
setupMode: "existing",
|
|
25
|
+
passwordAction,
|
|
26
|
+
walletAction: "already-initialized",
|
|
27
|
+
walletRootId: loaded.state.walletRootId,
|
|
28
|
+
fundingAddress: loaded.state.funding.address,
|
|
29
|
+
state: loaded.state,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const setupMode = await promptForInitializationMode(context.prompter);
|
|
33
|
+
let material;
|
|
34
|
+
if (setupMode === "generated") {
|
|
35
|
+
material = await loadOrCreatePendingInitializationMaterial({
|
|
36
|
+
provider: interactiveProvider,
|
|
37
|
+
paths: context.paths,
|
|
38
|
+
nowUnixMs: context.nowUnixMs,
|
|
39
|
+
});
|
|
40
|
+
writeMnemonicReveal(context.prompter, material.mnemonic.phrase, [
|
|
41
|
+
"Cogcoin Wallet Initialization",
|
|
42
|
+
"Write down this 24-word recovery phrase.",
|
|
43
|
+
"The same phrase will be shown again until confirmation succeeds:",
|
|
44
|
+
"",
|
|
45
|
+
]);
|
|
46
|
+
try {
|
|
47
|
+
await confirmMnemonic(context.prompter, material.mnemonic.words);
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
await clearSensitiveDisplay(context.prompter, "mnemonic-reveal");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
let mnemonicPhrase;
|
|
55
|
+
try {
|
|
56
|
+
mnemonicPhrase = await promptForRestoreMnemonic(context.prompter);
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
await clearSensitiveDisplay(context.prompter, "restore-mnemonic-entry");
|
|
60
|
+
}
|
|
61
|
+
await clearPendingInitialization(context.paths, interactiveProvider);
|
|
62
|
+
material = deriveWalletMaterialFromMnemonic(mnemonicPhrase);
|
|
63
|
+
}
|
|
64
|
+
const initialized = await persistInitializedWallet({
|
|
65
|
+
context,
|
|
66
|
+
provider: interactiveProvider,
|
|
67
|
+
material,
|
|
68
|
+
});
|
|
69
|
+
return {
|
|
70
|
+
setupMode,
|
|
71
|
+
passwordAction,
|
|
72
|
+
walletAction: "initialized",
|
|
73
|
+
walletRootId: initialized.walletRootId,
|
|
74
|
+
fundingAddress: initialized.state.funding.address,
|
|
75
|
+
state: initialized.state,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
await controlLock.release();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export async function showWalletMnemonic(options) {
|
|
83
|
+
const context = {
|
|
84
|
+
...resolveWalletManagedCoreContext({
|
|
85
|
+
provider: options.provider,
|
|
86
|
+
nowUnixMs: options.nowUnixMs,
|
|
87
|
+
paths: options.paths,
|
|
88
|
+
attachService: options.attachService,
|
|
89
|
+
rpcFactory: options.rpcFactory,
|
|
90
|
+
}),
|
|
91
|
+
prompter: options.prompter,
|
|
92
|
+
};
|
|
93
|
+
if (!context.prompter.isInteractive) {
|
|
94
|
+
throw new Error("wallet_show_mnemonic_requires_tty");
|
|
95
|
+
}
|
|
96
|
+
const interactiveProvider = withInteractiveWalletSecretProvider(context.provider, context.prompter);
|
|
97
|
+
const controlLock = await acquireWalletControlLock(context.paths, "wallet-show-mnemonic");
|
|
98
|
+
try {
|
|
99
|
+
if (!await walletStateExists(context.paths)) {
|
|
100
|
+
throw new Error("wallet_uninitialized");
|
|
101
|
+
}
|
|
102
|
+
const loaded = await loadWalletStateForAccess({
|
|
103
|
+
...context,
|
|
104
|
+
provider: interactiveProvider,
|
|
105
|
+
}).catch((error) => {
|
|
106
|
+
throw mapWalletReadAccessError(error);
|
|
107
|
+
});
|
|
108
|
+
await confirmTypedAcknowledgement(context.prompter, "show mnemonic", "Type \"show mnemonic\" to continue: ", "wallet_show_mnemonic_typed_ack_required");
|
|
109
|
+
writeMnemonicReveal(context.prompter, loaded.state.mnemonic.phrase, [
|
|
110
|
+
"Cogcoin Wallet Recovery Phrase",
|
|
111
|
+
"This 24-word recovery phrase controls the wallet.",
|
|
112
|
+
"",
|
|
113
|
+
]);
|
|
114
|
+
try {
|
|
115
|
+
await context.prompter.prompt("Press Enter to clear the recovery phrase from the screen: ");
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
await clearSensitiveDisplay(context.prompter, "mnemonic-reveal");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
finally {
|
|
122
|
+
await controlLock.release();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import type { attachOrStartIndexerDaemon, probeIndexerDaemon } from "../../bitcoind/indexer-daemon.js";
|
|
2
|
+
import type { createRpcClient } from "../../bitcoind/node.js";
|
|
3
|
+
import type { attachOrStartManagedBitcoindService, probeManagedBitcoindService } from "../../bitcoind/service.js";
|
|
4
|
+
import type { RpcListUnspentEntry } from "../../bitcoind/types.js";
|
|
5
|
+
import type { requestMiningGenerationPreemption } from "../mining/coordination.js";
|
|
6
|
+
import type { startBackgroundMining } from "../mining/runner.js";
|
|
7
|
+
import type { WalletRuntimePaths } from "../runtime.js";
|
|
8
|
+
import type { WalletSecretProvider } from "../state/provider.js";
|
|
9
|
+
import type { WalletStateV1 } from "../types.js";
|
|
10
|
+
export interface WalletPrompter {
|
|
11
|
+
readonly isInteractive: boolean;
|
|
12
|
+
writeLine(message: string): void;
|
|
13
|
+
prompt(message: string): Promise<string>;
|
|
14
|
+
promptHidden?(message: string): Promise<string>;
|
|
15
|
+
selectOption?(options: {
|
|
16
|
+
message: string;
|
|
17
|
+
options: Array<{
|
|
18
|
+
label: string;
|
|
19
|
+
description?: string | null;
|
|
20
|
+
value: string;
|
|
21
|
+
}>;
|
|
22
|
+
initialValue?: string | null;
|
|
23
|
+
footer?: string | null;
|
|
24
|
+
}): Promise<string>;
|
|
25
|
+
clearSensitiveDisplay?(scope: "mnemonic-reveal" | "restore-mnemonic-entry"): void | Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export interface WalletInitializationResult {
|
|
28
|
+
setupMode: "generated" | "restored" | "existing";
|
|
29
|
+
passwordAction: "created" | "migrated" | "already-configured";
|
|
30
|
+
walletAction: "initialized" | "already-initialized";
|
|
31
|
+
walletRootId: string;
|
|
32
|
+
fundingAddress: string;
|
|
33
|
+
state: WalletStateV1;
|
|
34
|
+
}
|
|
35
|
+
export interface WalletRepairResult {
|
|
36
|
+
walletRootId: string;
|
|
37
|
+
recoveredFromBackup: boolean;
|
|
38
|
+
recreatedManagedCoreWallet: boolean;
|
|
39
|
+
resetIndexerDatabase: boolean;
|
|
40
|
+
bitcoindServiceAction: "none" | "cleared-stale-artifacts" | "stopped-incompatible-service" | "restarted-compatible-service";
|
|
41
|
+
bitcoindCompatibilityIssue: "none" | "service-version-mismatch" | "wallet-root-mismatch" | "runtime-mismatch";
|
|
42
|
+
managedCoreReplicaAction: "none" | "recreated";
|
|
43
|
+
bitcoindPostRepairHealth: "ready" | "catching-up" | "starting" | "failed" | "unavailable";
|
|
44
|
+
indexerDaemonAction: "none" | "cleared-stale-artifacts" | "stopped-incompatible-daemon" | "restarted-compatible-daemon";
|
|
45
|
+
indexerCompatibilityIssue: "none" | "service-version-mismatch" | "wallet-root-mismatch" | "schema-mismatch";
|
|
46
|
+
indexerPostRepairHealth: "starting" | "catching-up" | "synced" | "failed";
|
|
47
|
+
miningPreRepairRunMode: "stopped" | "foreground" | "background";
|
|
48
|
+
miningResumeAction: "none" | "skipped-not-resumable" | "skipped-post-repair-blocked" | "resumed-background" | "resume-failed";
|
|
49
|
+
miningPostRepairRunMode: "stopped" | "background";
|
|
50
|
+
miningResumeError: string | null;
|
|
51
|
+
note: string | null;
|
|
52
|
+
}
|
|
53
|
+
export interface WalletLifecycleRpcClient {
|
|
54
|
+
getDescriptorInfo(descriptor: string): Promise<{
|
|
55
|
+
descriptor: string;
|
|
56
|
+
checksum: string;
|
|
57
|
+
}>;
|
|
58
|
+
createWallet(walletName: string, options: {
|
|
59
|
+
blank: boolean;
|
|
60
|
+
descriptors: boolean;
|
|
61
|
+
disablePrivateKeys: boolean;
|
|
62
|
+
loadOnStartup: boolean;
|
|
63
|
+
passphrase: string;
|
|
64
|
+
}): Promise<unknown>;
|
|
65
|
+
walletPassphrase(walletName: string, passphrase: string, timeoutSeconds: number): Promise<null>;
|
|
66
|
+
importDescriptors(walletName: string, requests: Array<{
|
|
67
|
+
desc: string;
|
|
68
|
+
timestamp: string | number;
|
|
69
|
+
active?: boolean;
|
|
70
|
+
internal?: boolean;
|
|
71
|
+
range?: number | [number, number];
|
|
72
|
+
}>): Promise<Array<{
|
|
73
|
+
success: boolean;
|
|
74
|
+
}>>;
|
|
75
|
+
walletLock(walletName: string): Promise<null>;
|
|
76
|
+
deriveAddresses(descriptor: string, range?: number | [number, number]): Promise<string[]>;
|
|
77
|
+
listDescriptors(walletName: string, privateOnly?: boolean): Promise<{
|
|
78
|
+
descriptors: Array<{
|
|
79
|
+
desc: string;
|
|
80
|
+
}>;
|
|
81
|
+
}>;
|
|
82
|
+
getWalletInfo(walletName: string): Promise<{
|
|
83
|
+
walletname: string;
|
|
84
|
+
private_keys_enabled: boolean;
|
|
85
|
+
descriptors: boolean;
|
|
86
|
+
}>;
|
|
87
|
+
loadWallet(walletName: string, loadOnStartup?: boolean): Promise<{
|
|
88
|
+
name: string;
|
|
89
|
+
warning: string;
|
|
90
|
+
}>;
|
|
91
|
+
unloadWallet?(walletName: string, loadOnStartup?: boolean): Promise<null>;
|
|
92
|
+
listWallets(): Promise<string[]>;
|
|
93
|
+
listUnspent(walletName: string, minConf?: number): Promise<RpcListUnspentEntry[]>;
|
|
94
|
+
getBlockchainInfo(): Promise<{
|
|
95
|
+
blocks: number;
|
|
96
|
+
headers: number;
|
|
97
|
+
}>;
|
|
98
|
+
}
|
|
99
|
+
export interface WalletManagedCoreDependencies {
|
|
100
|
+
attachService?: typeof attachOrStartManagedBitcoindService;
|
|
101
|
+
rpcFactory?: (config: Parameters<typeof createRpcClient>[0]) => WalletLifecycleRpcClient;
|
|
102
|
+
}
|
|
103
|
+
export interface WalletSetupDependencies extends WalletManagedCoreDependencies {
|
|
104
|
+
}
|
|
105
|
+
export interface WalletLifecycleResolvedContext {
|
|
106
|
+
provider: WalletSecretProvider;
|
|
107
|
+
paths: WalletRuntimePaths;
|
|
108
|
+
nowUnixMs: number;
|
|
109
|
+
}
|
|
110
|
+
export interface WalletManagedCoreContext extends WalletLifecycleResolvedContext {
|
|
111
|
+
attachService: NonNullable<WalletManagedCoreDependencies["attachService"]>;
|
|
112
|
+
rpcFactory: NonNullable<WalletManagedCoreDependencies["rpcFactory"]>;
|
|
113
|
+
}
|
|
114
|
+
export interface WalletAccessContext extends WalletManagedCoreContext {
|
|
115
|
+
dataDir?: string;
|
|
116
|
+
}
|
|
117
|
+
export interface WalletLoadedState {
|
|
118
|
+
state: WalletStateV1;
|
|
119
|
+
source: "primary" | "backup";
|
|
120
|
+
}
|
|
121
|
+
export interface WalletSetupContext extends WalletManagedCoreContext {
|
|
122
|
+
dataDir: string;
|
|
123
|
+
prompter: WalletPrompter;
|
|
124
|
+
}
|
|
125
|
+
export interface WalletRepairDependencies extends WalletManagedCoreDependencies {
|
|
126
|
+
probeBitcoindService?: typeof probeManagedBitcoindService;
|
|
127
|
+
attachIndexerDaemon?: typeof attachOrStartIndexerDaemon;
|
|
128
|
+
probeIndexerDaemon?: typeof probeIndexerDaemon;
|
|
129
|
+
requestMiningPreemption?: typeof requestMiningGenerationPreemption;
|
|
130
|
+
startBackgroundMining?: typeof startBackgroundMining;
|
|
131
|
+
}
|
|
132
|
+
export interface WalletRepairContext extends WalletManagedCoreContext {
|
|
133
|
+
dataDir: string;
|
|
134
|
+
databasePath: string;
|
|
135
|
+
assumeYes: boolean;
|
|
136
|
+
probeBitcoindService: NonNullable<WalletRepairDependencies["probeBitcoindService"]>;
|
|
137
|
+
attachIndexerDaemon: NonNullable<WalletRepairDependencies["attachIndexerDaemon"]>;
|
|
138
|
+
probeIndexerDaemon: NonNullable<WalletRepairDependencies["probeIndexerDaemon"]>;
|
|
139
|
+
requestMiningPreemption?: WalletRepairDependencies["requestMiningPreemption"];
|
|
140
|
+
startBackgroundMining?: WalletRepairDependencies["startBackgroundMining"];
|
|
141
|
+
}
|
|
142
|
+
export interface WalletBitcoindRepairStageResult {
|
|
143
|
+
state: WalletStateV1;
|
|
144
|
+
repairStateNeedsPersist: boolean;
|
|
145
|
+
recreatedManagedCoreWallet: boolean;
|
|
146
|
+
bitcoindServiceAction: WalletRepairResult["bitcoindServiceAction"];
|
|
147
|
+
bitcoindCompatibilityIssue: WalletRepairResult["bitcoindCompatibilityIssue"];
|
|
148
|
+
managedCoreReplicaAction: WalletRepairResult["managedCoreReplicaAction"];
|
|
149
|
+
bitcoindPostRepairHealth: WalletRepairResult["bitcoindPostRepairHealth"];
|
|
150
|
+
}
|
|
151
|
+
export interface WalletIndexerRepairStageResult {
|
|
152
|
+
resetIndexerDatabase: boolean;
|
|
153
|
+
indexerDaemonAction: WalletRepairResult["indexerDaemonAction"];
|
|
154
|
+
indexerCompatibilityIssue: WalletRepairResult["indexerCompatibilityIssue"];
|
|
155
|
+
indexerPostRepairHealth: WalletRepairResult["indexerPostRepairHealth"];
|
|
156
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,166 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { attachOrStartManagedBitcoindService, probeManagedBitcoindService } from "../bitcoind/service.js";
|
|
3
|
-
import { createRpcClient } from "../bitcoind/node.js";
|
|
4
|
-
import type { ManagedCoreWalletReplicaStatus, RpcListUnspentEntry } from "../bitcoind/types.js";
|
|
5
|
-
import { type WalletRuntimePaths } from "./runtime.js";
|
|
6
|
-
import { type WalletSecretProvider } from "./state/provider.js";
|
|
7
|
-
import type { WalletStateV1 } from "./types.js";
|
|
8
|
-
export interface WalletPrompter {
|
|
9
|
-
readonly isInteractive: boolean;
|
|
10
|
-
writeLine(message: string): void;
|
|
11
|
-
prompt(message: string): Promise<string>;
|
|
12
|
-
promptHidden?(message: string): Promise<string>;
|
|
13
|
-
selectOption?(options: {
|
|
14
|
-
message: string;
|
|
15
|
-
options: Array<{
|
|
16
|
-
label: string;
|
|
17
|
-
description?: string | null;
|
|
18
|
-
value: string;
|
|
19
|
-
}>;
|
|
20
|
-
initialValue?: string | null;
|
|
21
|
-
footer?: string | null;
|
|
22
|
-
}): Promise<string>;
|
|
23
|
-
clearSensitiveDisplay?(scope: "mnemonic-reveal" | "restore-mnemonic-entry"): void | Promise<void>;
|
|
24
|
-
}
|
|
25
|
-
export interface WalletInitializationResult {
|
|
26
|
-
passwordAction: "created" | "migrated" | "already-configured";
|
|
27
|
-
walletAction: "initialized" | "already-initialized";
|
|
28
|
-
walletRootId: string;
|
|
29
|
-
fundingAddress: string;
|
|
30
|
-
state: WalletStateV1;
|
|
31
|
-
}
|
|
32
|
-
export interface WalletRestoreResult {
|
|
33
|
-
passwordAction: "created" | "migrated" | "already-configured";
|
|
34
|
-
seedName?: string | null;
|
|
35
|
-
walletRootId: string;
|
|
36
|
-
fundingAddress: string;
|
|
37
|
-
state: WalletStateV1;
|
|
38
|
-
warnings?: string[];
|
|
39
|
-
}
|
|
40
|
-
export interface WalletDeleteResult {
|
|
41
|
-
seedName: string;
|
|
42
|
-
walletRootId: string;
|
|
43
|
-
deleted: boolean;
|
|
44
|
-
}
|
|
45
|
-
export interface WalletRepairResult {
|
|
46
|
-
walletRootId: string;
|
|
47
|
-
recoveredFromBackup: boolean;
|
|
48
|
-
recreatedManagedCoreWallet: boolean;
|
|
49
|
-
resetIndexerDatabase: boolean;
|
|
50
|
-
bitcoindServiceAction: "none" | "cleared-stale-artifacts" | "stopped-incompatible-service" | "restarted-compatible-service";
|
|
51
|
-
bitcoindCompatibilityIssue: "none" | "service-version-mismatch" | "wallet-root-mismatch" | "runtime-mismatch";
|
|
52
|
-
managedCoreReplicaAction: "none" | "recreated";
|
|
53
|
-
bitcoindPostRepairHealth: "ready" | "catching-up" | "starting" | "failed" | "unavailable";
|
|
54
|
-
indexerDaemonAction: "none" | "cleared-stale-artifacts" | "stopped-incompatible-daemon" | "restarted-compatible-daemon";
|
|
55
|
-
indexerCompatibilityIssue: "none" | "service-version-mismatch" | "wallet-root-mismatch" | "schema-mismatch";
|
|
56
|
-
indexerPostRepairHealth: "starting" | "catching-up" | "synced" | "failed";
|
|
57
|
-
miningPreRepairRunMode: "stopped" | "foreground" | "background";
|
|
58
|
-
miningResumeAction: "none" | "skipped-not-resumable" | "skipped-post-repair-blocked" | "resumed-background" | "resume-failed";
|
|
59
|
-
miningPostRepairRunMode: "stopped" | "background";
|
|
60
|
-
miningResumeError: string | null;
|
|
61
|
-
note: string | null;
|
|
62
|
-
}
|
|
1
|
+
export type { WalletInitializationResult, WalletPrompter, WalletRepairResult, } from "./lifecycle/types.js";
|
|
63
2
|
export { previewResetWallet, resetWallet, type WalletResetPreview, type WalletResetResult, } from "./reset.js";
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
checksum: string;
|
|
68
|
-
}>;
|
|
69
|
-
createWallet(walletName: string, options: {
|
|
70
|
-
blank: boolean;
|
|
71
|
-
descriptors: boolean;
|
|
72
|
-
disablePrivateKeys: boolean;
|
|
73
|
-
loadOnStartup: boolean;
|
|
74
|
-
passphrase: string;
|
|
75
|
-
}): Promise<unknown>;
|
|
76
|
-
walletPassphrase(walletName: string, passphrase: string, timeoutSeconds: number): Promise<null>;
|
|
77
|
-
importDescriptors(walletName: string, requests: Array<{
|
|
78
|
-
desc: string;
|
|
79
|
-
timestamp: string | number;
|
|
80
|
-
active?: boolean;
|
|
81
|
-
internal?: boolean;
|
|
82
|
-
range?: number | [number, number];
|
|
83
|
-
}>): Promise<Array<{
|
|
84
|
-
success: boolean;
|
|
85
|
-
}>>;
|
|
86
|
-
walletLock(walletName: string): Promise<null>;
|
|
87
|
-
deriveAddresses(descriptor: string, range?: number | [number, number]): Promise<string[]>;
|
|
88
|
-
listDescriptors(walletName: string, privateOnly?: boolean): Promise<{
|
|
89
|
-
descriptors: Array<{
|
|
90
|
-
desc: string;
|
|
91
|
-
}>;
|
|
92
|
-
}>;
|
|
93
|
-
getWalletInfo(walletName: string): Promise<{
|
|
94
|
-
walletname: string;
|
|
95
|
-
private_keys_enabled: boolean;
|
|
96
|
-
descriptors: boolean;
|
|
97
|
-
}>;
|
|
98
|
-
loadWallet(walletName: string, loadOnStartup?: boolean): Promise<{
|
|
99
|
-
name: string;
|
|
100
|
-
warning: string;
|
|
101
|
-
}>;
|
|
102
|
-
unloadWallet?(walletName: string, loadOnStartup?: boolean): Promise<null>;
|
|
103
|
-
listWallets(): Promise<string[]>;
|
|
104
|
-
listUnspent(walletName: string, minConf?: number): Promise<RpcListUnspentEntry[]>;
|
|
105
|
-
getBlockchainInfo(): Promise<{
|
|
106
|
-
blocks: number;
|
|
107
|
-
headers: number;
|
|
108
|
-
}>;
|
|
109
|
-
}
|
|
110
|
-
export declare function verifyManagedCoreWalletReplica(state: WalletStateV1, dataDir: string, dependencies?: {
|
|
111
|
-
nodeHandle?: {
|
|
112
|
-
rpc: Parameters<typeof createRpcClient>[0];
|
|
113
|
-
};
|
|
114
|
-
attachService?: typeof attachOrStartManagedBitcoindService;
|
|
115
|
-
rpcFactory?: (config: Parameters<typeof createRpcClient>[0]) => WalletLifecycleRpcClient;
|
|
116
|
-
}): Promise<ManagedCoreWalletReplicaStatus>;
|
|
117
|
-
export declare function initializeWallet(options: {
|
|
118
|
-
dataDir: string;
|
|
119
|
-
provider?: WalletSecretProvider;
|
|
120
|
-
prompter: WalletPrompter;
|
|
121
|
-
nowUnixMs?: number;
|
|
122
|
-
paths?: WalletRuntimePaths;
|
|
123
|
-
attachService?: typeof attachOrStartManagedBitcoindService;
|
|
124
|
-
rpcFactory?: (config: Parameters<typeof createRpcClient>[0]) => WalletLifecycleRpcClient;
|
|
125
|
-
}): Promise<WalletInitializationResult>;
|
|
126
|
-
export declare function showWalletMnemonic(options: {
|
|
127
|
-
provider?: WalletSecretProvider;
|
|
128
|
-
prompter: WalletPrompter;
|
|
129
|
-
nowUnixMs?: number;
|
|
130
|
-
paths?: WalletRuntimePaths;
|
|
131
|
-
}): Promise<void>;
|
|
132
|
-
export declare function restoreWalletFromMnemonic(options: {
|
|
133
|
-
dataDir: string;
|
|
134
|
-
provider?: WalletSecretProvider;
|
|
135
|
-
prompter: WalletPrompter;
|
|
136
|
-
nowUnixMs?: number;
|
|
137
|
-
paths?: WalletRuntimePaths;
|
|
138
|
-
attachService?: typeof attachOrStartManagedBitcoindService;
|
|
139
|
-
rpcFactory?: (config: Parameters<typeof createRpcClient>[0]) => WalletLifecycleRpcClient;
|
|
140
|
-
}): Promise<WalletRestoreResult>;
|
|
141
|
-
export declare function deleteImportedWalletSeed(options: {
|
|
142
|
-
dataDir: string;
|
|
143
|
-
provider?: WalletSecretProvider;
|
|
144
|
-
prompter: WalletPrompter;
|
|
145
|
-
assumeYes?: boolean;
|
|
146
|
-
nowUnixMs?: number;
|
|
147
|
-
paths?: WalletRuntimePaths;
|
|
148
|
-
attachService?: typeof attachOrStartManagedBitcoindService;
|
|
149
|
-
probeBitcoindService?: typeof probeManagedBitcoindService;
|
|
150
|
-
rpcFactory?: (config: Parameters<typeof createRpcClient>[0]) => WalletLifecycleRpcClient;
|
|
151
|
-
}): Promise<WalletDeleteResult>;
|
|
152
|
-
export declare function repairWallet(options: {
|
|
153
|
-
dataDir: string;
|
|
154
|
-
databasePath: string;
|
|
155
|
-
provider?: WalletSecretProvider;
|
|
156
|
-
assumeYes?: boolean;
|
|
157
|
-
nowUnixMs?: number;
|
|
158
|
-
paths?: WalletRuntimePaths;
|
|
159
|
-
attachService?: typeof attachOrStartManagedBitcoindService;
|
|
160
|
-
probeBitcoindService?: typeof probeManagedBitcoindService;
|
|
161
|
-
rpcFactory?: (config: Parameters<typeof createRpcClient>[0]) => WalletLifecycleRpcClient;
|
|
162
|
-
attachIndexerDaemon?: typeof attachOrStartIndexerDaemon;
|
|
163
|
-
probeIndexerDaemon?: typeof probeIndexerDaemon;
|
|
164
|
-
requestMiningPreemption?: typeof import("./mining/coordination.js").requestMiningGenerationPreemption;
|
|
165
|
-
startBackgroundMining?: typeof import("./mining/runner.js").startBackgroundMining;
|
|
166
|
-
}): Promise<WalletRepairResult>;
|
|
3
|
+
export { verifyManagedCoreWalletReplica } from "./lifecycle/managed-core.js";
|
|
4
|
+
export { initializeWallet, showWalletMnemonic } from "./lifecycle/setup.js";
|
|
5
|
+
export { repairWallet } from "./lifecycle/repair.js";
|