@cogcoin/client 0.5.0
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/LICENSE +21 -0
- package/README.md +136 -0
- package/dist/app-paths.d.ts +38 -0
- package/dist/app-paths.js +121 -0
- package/dist/art/banner.txt +13 -0
- package/dist/art/scroll.txt +13 -0
- package/dist/art/train-car.txt +6 -0
- package/dist/art/train-smoke.txt +6 -0
- package/dist/art/train.txt +6 -0
- package/dist/bitcoind/bootstrap/chainstate.d.ts +4 -0
- package/dist/bitcoind/bootstrap/chainstate.js +13 -0
- package/dist/bitcoind/bootstrap/constants.d.ts +7 -0
- package/dist/bitcoind/bootstrap/constants.js +12 -0
- package/dist/bitcoind/bootstrap/controller.d.ts +29 -0
- package/dist/bitcoind/bootstrap/controller.js +101 -0
- package/dist/bitcoind/bootstrap/download.d.ts +2 -0
- package/dist/bitcoind/bootstrap/download.js +196 -0
- package/dist/bitcoind/bootstrap/headers.d.ts +13 -0
- package/dist/bitcoind/bootstrap/headers.js +61 -0
- package/dist/bitcoind/bootstrap/paths.d.ts +4 -0
- package/dist/bitcoind/bootstrap/paths.js +15 -0
- package/dist/bitcoind/bootstrap/snapshot-file.d.ts +7 -0
- package/dist/bitcoind/bootstrap/snapshot-file.js +42 -0
- package/dist/bitcoind/bootstrap/state.d.ts +40 -0
- package/dist/bitcoind/bootstrap/state.js +70 -0
- package/dist/bitcoind/bootstrap/types.d.ts +28 -0
- package/dist/bitcoind/bootstrap/types.js +1 -0
- package/dist/bitcoind/bootstrap.d.ts +8 -0
- package/dist/bitcoind/bootstrap.js +7 -0
- package/dist/bitcoind/client/factory.d.ts +3 -0
- package/dist/bitcoind/client/factory.js +57 -0
- package/dist/bitcoind/client/follow-block-times.d.ts +8 -0
- package/dist/bitcoind/client/follow-block-times.js +25 -0
- package/dist/bitcoind/client/follow-loop.d.ts +10 -0
- package/dist/bitcoind/client/follow-loop.js +57 -0
- package/dist/bitcoind/client/internal-types.d.ts +63 -0
- package/dist/bitcoind/client/internal-types.js +18 -0
- package/dist/bitcoind/client/managed-client.d.ts +20 -0
- package/dist/bitcoind/client/managed-client.js +197 -0
- package/dist/bitcoind/client/rate-tracker.d.ts +2 -0
- package/dist/bitcoind/client/rate-tracker.js +24 -0
- package/dist/bitcoind/client/sync-engine.d.ts +3 -0
- package/dist/bitcoind/client/sync-engine.js +143 -0
- package/dist/bitcoind/client.d.ts +1 -0
- package/dist/bitcoind/client.js +1 -0
- package/dist/bitcoind/errors.d.ts +1 -0
- package/dist/bitcoind/errors.js +49 -0
- package/dist/bitcoind/index.d.ts +2 -0
- package/dist/bitcoind/index.js +1 -0
- package/dist/bitcoind/indexer-daemon-main.d.ts +1 -0
- package/dist/bitcoind/indexer-daemon-main.js +472 -0
- package/dist/bitcoind/indexer-daemon.d.ts +107 -0
- package/dist/bitcoind/indexer-daemon.js +391 -0
- package/dist/bitcoind/node.d.ts +8 -0
- package/dist/bitcoind/node.js +219 -0
- package/dist/bitcoind/normalize.d.ts +3 -0
- package/dist/bitcoind/normalize.js +47 -0
- package/dist/bitcoind/progress/assets.d.ts +10 -0
- package/dist/bitcoind/progress/assets.js +90 -0
- package/dist/bitcoind/progress/constants.d.ts +48 -0
- package/dist/bitcoind/progress/constants.js +53 -0
- package/dist/bitcoind/progress/controller.d.ts +28 -0
- package/dist/bitcoind/progress/controller.js +188 -0
- package/dist/bitcoind/progress/follow-scene.d.ts +40 -0
- package/dist/bitcoind/progress/follow-scene.js +367 -0
- package/dist/bitcoind/progress/formatting.d.ts +23 -0
- package/dist/bitcoind/progress/formatting.js +227 -0
- package/dist/bitcoind/progress/quote-scene.d.ts +4 -0
- package/dist/bitcoind/progress/quote-scene.js +137 -0
- package/dist/bitcoind/progress/train-scene.d.ts +9 -0
- package/dist/bitcoind/progress/train-scene.js +92 -0
- package/dist/bitcoind/progress/tty-renderer.d.ts +18 -0
- package/dist/bitcoind/progress/tty-renderer.js +150 -0
- package/dist/bitcoind/progress.d.ts +7 -0
- package/dist/bitcoind/progress.js +7 -0
- package/dist/bitcoind/quotes.d.ts +24 -0
- package/dist/bitcoind/quotes.js +195 -0
- package/dist/bitcoind/rpc.d.ts +71 -0
- package/dist/bitcoind/rpc.js +322 -0
- package/dist/bitcoind/service-paths.d.ts +19 -0
- package/dist/bitcoind/service-paths.js +49 -0
- package/dist/bitcoind/service.d.ts +40 -0
- package/dist/bitcoind/service.js +735 -0
- package/dist/bitcoind/testing.d.ts +9 -0
- package/dist/bitcoind/testing.js +9 -0
- package/dist/bitcoind/types.d.ts +396 -0
- package/dist/bitcoind/types.js +3 -0
- package/dist/bytes.d.ts +9 -0
- package/dist/bytes.js +36 -0
- package/dist/cli/commands/follow.d.ts +2 -0
- package/dist/cli/commands/follow.js +43 -0
- package/dist/cli/commands/mining-admin.d.ts +2 -0
- package/dist/cli/commands/mining-admin.js +92 -0
- package/dist/cli/commands/mining-read.d.ts +2 -0
- package/dist/cli/commands/mining-read.js +173 -0
- package/dist/cli/commands/mining-runtime.d.ts +2 -0
- package/dist/cli/commands/mining-runtime.js +108 -0
- package/dist/cli/commands/status.d.ts +2 -0
- package/dist/cli/commands/status.js +31 -0
- package/dist/cli/commands/sync.d.ts +2 -0
- package/dist/cli/commands/sync.js +52 -0
- package/dist/cli/commands/wallet-admin.d.ts +2 -0
- package/dist/cli/commands/wallet-admin.js +175 -0
- package/dist/cli/commands/wallet-mutation.d.ts +2 -0
- package/dist/cli/commands/wallet-mutation.js +681 -0
- package/dist/cli/commands/wallet-read.d.ts +2 -0
- package/dist/cli/commands/wallet-read.js +265 -0
- package/dist/cli/context.d.ts +3 -0
- package/dist/cli/context.js +75 -0
- package/dist/cli/io.d.ts +3 -0
- package/dist/cli/io.js +12 -0
- package/dist/cli/mining-format.d.ts +5 -0
- package/dist/cli/mining-format.js +156 -0
- package/dist/cli/mining-json.d.ts +49 -0
- package/dist/cli/mining-json.js +89 -0
- package/dist/cli/mutation-command-groups.d.ts +15 -0
- package/dist/cli/mutation-command-groups.js +71 -0
- package/dist/cli/mutation-json.d.ts +430 -0
- package/dist/cli/mutation-json.js +311 -0
- package/dist/cli/mutation-resolved-json.d.ts +124 -0
- package/dist/cli/mutation-resolved-json.js +129 -0
- package/dist/cli/mutation-success.d.ts +20 -0
- package/dist/cli/mutation-success.js +47 -0
- package/dist/cli/mutation-text-format.d.ts +22 -0
- package/dist/cli/mutation-text-format.js +171 -0
- package/dist/cli/mutation-text-write.d.ts +13 -0
- package/dist/cli/mutation-text-write.js +16 -0
- package/dist/cli/output.d.ts +185 -0
- package/dist/cli/output.js +1085 -0
- package/dist/cli/parse.d.ts +3 -0
- package/dist/cli/parse.js +971 -0
- package/dist/cli/preview-json.d.ts +416 -0
- package/dist/cli/preview-json.js +293 -0
- package/dist/cli/prompt.d.ts +3 -0
- package/dist/cli/prompt.js +33 -0
- package/dist/cli/read-json.d.ts +187 -0
- package/dist/cli/read-json.js +675 -0
- package/dist/cli/runner.d.ts +2 -0
- package/dist/cli/runner.js +129 -0
- package/dist/cli/signals.d.ts +3 -0
- package/dist/cli/signals.js +63 -0
- package/dist/cli/status-format.d.ts +2 -0
- package/dist/cli/status-format.js +48 -0
- package/dist/cli/types.d.ts +148 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/wallet-format.d.ts +29 -0
- package/dist/cli/wallet-format.js +637 -0
- package/dist/cli/workflow-hints.d.ts +13 -0
- package/dist/cli/workflow-hints.js +94 -0
- package/dist/cli-runner.d.ts +3 -0
- package/dist/cli-runner.js +3 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +6 -0
- package/dist/client/default-client.d.ts +11 -0
- package/dist/client/default-client.js +118 -0
- package/dist/client/factory.d.ts +2 -0
- package/dist/client/factory.js +15 -0
- package/dist/client/initialization.d.ts +6 -0
- package/dist/client/initialization.js +30 -0
- package/dist/client/persistence.d.ts +5 -0
- package/dist/client/persistence.js +28 -0
- package/dist/client/store-adapter.d.ts +3 -0
- package/dist/client/store-adapter.js +20 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/passive-status.d.ts +36 -0
- package/dist/passive-status.js +100 -0
- package/dist/sqlite/better-sqlite3.d.ts +26 -0
- package/dist/sqlite/better-sqlite3.js +4 -0
- package/dist/sqlite/checkpoints.d.ts +11 -0
- package/dist/sqlite/checkpoints.js +27 -0
- package/dist/sqlite/driver.d.ts +17 -0
- package/dist/sqlite/driver.js +98 -0
- package/dist/sqlite/index.d.ts +4 -0
- package/dist/sqlite/index.js +9 -0
- package/dist/sqlite/migrate.d.ts +2 -0
- package/dist/sqlite/migrate.js +37 -0
- package/dist/sqlite/store.d.ts +3 -0
- package/dist/sqlite/store.js +122 -0
- package/dist/sqlite/tip-meta.d.ts +26 -0
- package/dist/sqlite/tip-meta.js +97 -0
- package/dist/sqlite/types.d.ts +10 -0
- package/dist/sqlite/types.js +1 -0
- package/dist/types.d.ts +55 -0
- package/dist/types.js +1 -0
- package/dist/wallet/archive.d.ts +4 -0
- package/dist/wallet/archive.js +39 -0
- package/dist/wallet/cogop/constants.d.ts +32 -0
- package/dist/wallet/cogop/constants.js +32 -0
- package/dist/wallet/cogop/index.d.ts +32 -0
- package/dist/wallet/cogop/index.js +213 -0
- package/dist/wallet/cogop/numeric.d.ts +3 -0
- package/dist/wallet/cogop/numeric.js +24 -0
- package/dist/wallet/cogop/scriptpubkey.d.ts +2 -0
- package/dist/wallet/cogop/scriptpubkey.js +13 -0
- package/dist/wallet/cogop/validate-name.d.ts +2 -0
- package/dist/wallet/cogop/validate-name.js +18 -0
- package/dist/wallet/fs/atomic.d.ts +6 -0
- package/dist/wallet/fs/atomic.js +46 -0
- package/dist/wallet/fs/lock.d.ts +19 -0
- package/dist/wallet/fs/lock.js +61 -0
- package/dist/wallet/fs/status-file.d.ts +1 -0
- package/dist/wallet/fs/status-file.js +4 -0
- package/dist/wallet/lifecycle.d.ts +193 -0
- package/dist/wallet/lifecycle.js +1475 -0
- package/dist/wallet/material.d.ts +45 -0
- package/dist/wallet/material.js +118 -0
- package/dist/wallet/mining/config.d.ts +18 -0
- package/dist/wallet/mining/config.js +44 -0
- package/dist/wallet/mining/constants.d.ts +24 -0
- package/dist/wallet/mining/constants.js +24 -0
- package/dist/wallet/mining/control.d.ts +53 -0
- package/dist/wallet/mining/control.js +758 -0
- package/dist/wallet/mining/coordination.d.ts +40 -0
- package/dist/wallet/mining/coordination.js +121 -0
- package/dist/wallet/mining/hook-protocol.d.ts +47 -0
- package/dist/wallet/mining/hook-protocol.js +161 -0
- package/dist/wallet/mining/hook-runner.d.ts +1 -0
- package/dist/wallet/mining/hook-runner.js +52 -0
- package/dist/wallet/mining/hooks.d.ts +38 -0
- package/dist/wallet/mining/hooks.js +520 -0
- package/dist/wallet/mining/index.d.ts +8 -0
- package/dist/wallet/mining/index.js +6 -0
- package/dist/wallet/mining/runner.d.ts +155 -0
- package/dist/wallet/mining/runner.js +2574 -0
- package/dist/wallet/mining/runtime-artifacts.d.ts +17 -0
- package/dist/wallet/mining/runtime-artifacts.js +166 -0
- package/dist/wallet/mining/sentences.d.ts +23 -0
- package/dist/wallet/mining/sentences.js +281 -0
- package/dist/wallet/mining/state.d.ts +9 -0
- package/dist/wallet/mining/state.js +75 -0
- package/dist/wallet/mining/types.d.ts +141 -0
- package/dist/wallet/mining/types.js +1 -0
- package/dist/wallet/mining/visualizer.d.ts +19 -0
- package/dist/wallet/mining/visualizer.js +134 -0
- package/dist/wallet/mining/worker-main.d.ts +1 -0
- package/dist/wallet/mining/worker-main.js +17 -0
- package/dist/wallet/read/context.d.ts +20 -0
- package/dist/wallet/read/context.js +532 -0
- package/dist/wallet/read/filter.d.ts +9 -0
- package/dist/wallet/read/filter.js +42 -0
- package/dist/wallet/read/index.d.ts +4 -0
- package/dist/wallet/read/index.js +3 -0
- package/dist/wallet/read/project.d.ts +11 -0
- package/dist/wallet/read/project.js +300 -0
- package/dist/wallet/read/types.d.ts +144 -0
- package/dist/wallet/read/types.js +1 -0
- package/dist/wallet/runtime.d.ts +26 -0
- package/dist/wallet/runtime.js +28 -0
- package/dist/wallet/state/crypto.d.ts +31 -0
- package/dist/wallet/state/crypto.js +127 -0
- package/dist/wallet/state/provider.d.ts +37 -0
- package/dist/wallet/state/provider.js +312 -0
- package/dist/wallet/state/session.d.ts +12 -0
- package/dist/wallet/state/session.js +23 -0
- package/dist/wallet/state/storage.d.ts +19 -0
- package/dist/wallet/state/storage.js +55 -0
- package/dist/wallet/tx/anchor.d.ts +40 -0
- package/dist/wallet/tx/anchor.js +1210 -0
- package/dist/wallet/tx/cog.d.ts +92 -0
- package/dist/wallet/tx/cog.js +1055 -0
- package/dist/wallet/tx/common.d.ts +89 -0
- package/dist/wallet/tx/common.js +156 -0
- package/dist/wallet/tx/confirm.d.ts +15 -0
- package/dist/wallet/tx/confirm.js +24 -0
- package/dist/wallet/tx/domain-admin.d.ts +105 -0
- package/dist/wallet/tx/domain-admin.js +869 -0
- package/dist/wallet/tx/domain-market.d.ts +112 -0
- package/dist/wallet/tx/domain-market.js +1365 -0
- package/dist/wallet/tx/field.d.ts +101 -0
- package/dist/wallet/tx/field.js +1853 -0
- package/dist/wallet/tx/identity-selector.d.ts +12 -0
- package/dist/wallet/tx/identity-selector.js +52 -0
- package/dist/wallet/tx/index.d.ts +7 -0
- package/dist/wallet/tx/index.js +7 -0
- package/dist/wallet/tx/journal.d.ts +5 -0
- package/dist/wallet/tx/journal.js +31 -0
- package/dist/wallet/tx/register.d.ts +68 -0
- package/dist/wallet/tx/register.js +952 -0
- package/dist/wallet/tx/reputation.d.ts +72 -0
- package/dist/wallet/tx/reputation.js +693 -0
- package/dist/wallet/tx/targets.d.ts +7 -0
- package/dist/wallet/tx/targets.js +122 -0
- package/dist/wallet/types.d.ts +249 -0
- package/dist/wallet/types.js +1 -0
- package/dist/writing_quotes.json +1654 -0
- package/package.json +78 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
function isRootDomainName(domainName) {
|
|
2
|
+
return !domainName.includes("-");
|
|
3
|
+
}
|
|
4
|
+
export function formatNextStepLines(nextSteps) {
|
|
5
|
+
return nextSteps.map((step) => `Next step: ${step}`);
|
|
6
|
+
}
|
|
7
|
+
export function getFundingQuickstartGuidance() {
|
|
8
|
+
return "Fund this wallet with about 0.0015 BTC so you can buy a 6+ character domain to start mining and still keep BTC available for mining transaction fees.";
|
|
9
|
+
}
|
|
10
|
+
export function getInitNextSteps() {
|
|
11
|
+
return ["cogcoin sync", "cogcoin address"];
|
|
12
|
+
}
|
|
13
|
+
function blocksSyncBootstrap(context) {
|
|
14
|
+
return context.bitcoind.health === "service-version-mismatch"
|
|
15
|
+
|| context.bitcoind.health === "wallet-root-mismatch"
|
|
16
|
+
|| context.bitcoind.health === "runtime-mismatch"
|
|
17
|
+
|| context.bitcoind.health === "replica-missing"
|
|
18
|
+
|| context.bitcoind.health === "replica-mismatch"
|
|
19
|
+
|| context.bitcoind.health === "failed"
|
|
20
|
+
|| context.indexer.health === "schema-mismatch"
|
|
21
|
+
|| context.indexer.health === "service-version-mismatch"
|
|
22
|
+
|| context.indexer.health === "wallet-root-mismatch"
|
|
23
|
+
|| context.indexer.health === "failed";
|
|
24
|
+
}
|
|
25
|
+
export function getBootstrapSyncNextStep(context) {
|
|
26
|
+
if (blocksSyncBootstrap(context)) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return context.bitcoind.health !== "ready"
|
|
30
|
+
|| context.indexer.health !== "synced"
|
|
31
|
+
|| context.nodeHealth !== "synced"
|
|
32
|
+
? "cogcoin sync"
|
|
33
|
+
: null;
|
|
34
|
+
}
|
|
35
|
+
export function getRegisterNextSteps(domainName, registerKind) {
|
|
36
|
+
return registerKind === "root"
|
|
37
|
+
? [
|
|
38
|
+
`cogcoin show ${domainName}`,
|
|
39
|
+
`cogcoin anchor ${domainName} once it confirms`,
|
|
40
|
+
]
|
|
41
|
+
: [`cogcoin show ${domainName}`];
|
|
42
|
+
}
|
|
43
|
+
export function getAnchorNextSteps(domainName) {
|
|
44
|
+
const nextSteps = [`cogcoin show ${domainName}`];
|
|
45
|
+
if (isRootDomainName(domainName)) {
|
|
46
|
+
nextSteps.push("cogcoin mine", "cogcoin mine start");
|
|
47
|
+
}
|
|
48
|
+
return nextSteps;
|
|
49
|
+
}
|
|
50
|
+
export function getHooksEnableMiningNextSteps() {
|
|
51
|
+
return ["cogcoin mine", "cogcoin mine start"];
|
|
52
|
+
}
|
|
53
|
+
export function getMineSetupNextSteps() {
|
|
54
|
+
return ["cogcoin mine", "cogcoin mine start"];
|
|
55
|
+
}
|
|
56
|
+
export function getMineStopNextSteps() {
|
|
57
|
+
return ["cogcoin mine log"];
|
|
58
|
+
}
|
|
59
|
+
export function getAddressNextSteps(context, address) {
|
|
60
|
+
if (address === null || address === undefined || address.length === 0) {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
const nextSteps = [];
|
|
64
|
+
const bootstrapSync = getBootstrapSyncNextStep(context);
|
|
65
|
+
if (bootstrapSync !== null) {
|
|
66
|
+
nextSteps.push(bootstrapSync);
|
|
67
|
+
}
|
|
68
|
+
nextSteps.push("fund this wallet, then run cogcoin status");
|
|
69
|
+
return nextSteps;
|
|
70
|
+
}
|
|
71
|
+
export function getIdsNextSteps(identities) {
|
|
72
|
+
return identities === null || identities === undefined || identities.length === 0
|
|
73
|
+
? []
|
|
74
|
+
: [
|
|
75
|
+
"cogcoin register <root> --from <selector>",
|
|
76
|
+
"cogcoin send ... --from <selector>",
|
|
77
|
+
"cogcoin cog lock ... --from <selector>",
|
|
78
|
+
];
|
|
79
|
+
}
|
|
80
|
+
export function getLocksNextSteps(locks) {
|
|
81
|
+
if (locks === null || locks === undefined || locks.length === 0) {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
const nextSteps = [];
|
|
85
|
+
const claimable = locks.find((lock) => lock.claimableNow);
|
|
86
|
+
const reclaimable = locks.find((lock) => lock.reclaimableNow);
|
|
87
|
+
if (claimable !== undefined) {
|
|
88
|
+
nextSteps.push(`cogcoin claim ${claimable.lockId} --preimage <32-byte-hex>`);
|
|
89
|
+
}
|
|
90
|
+
if (reclaimable !== undefined) {
|
|
91
|
+
nextSteps.push(`cogcoin reclaim ${reclaimable.lockId}`);
|
|
92
|
+
}
|
|
93
|
+
return nextSteps;
|
|
94
|
+
}
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BitcoinBlock, GenesisParameters, IndexerState } from "@cogcoin/indexer/types";
|
|
2
|
+
import type { ApplyBlockResult, Client, ClientStoreAdapter, ClientTip } from "../types.js";
|
|
3
|
+
export declare class DefaultClient implements Client {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(store: ClientStoreAdapter, genesisParameters: GenesisParameters, state: IndexerState, tip: ClientTip | null, snapshotInterval: number);
|
|
6
|
+
getTip(): Promise<ClientTip | null>;
|
|
7
|
+
getState(): Promise<IndexerState>;
|
|
8
|
+
applyBlock(block: BitcoinBlock): Promise<ApplyBlockResult>;
|
|
9
|
+
rewindToHeight(height: number): Promise<ClientTip | null>;
|
|
10
|
+
close(): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { applyBlockWithScoring, deserializeBlockRecord, rewindBlock, serializeIndexerState, } from "@cogcoin/indexer";
|
|
2
|
+
import { createCheckpoint, createStoredBlockRecord, createTip } from "./persistence.js";
|
|
3
|
+
export class DefaultClient {
|
|
4
|
+
#store;
|
|
5
|
+
#genesisParameters;
|
|
6
|
+
#snapshotInterval;
|
|
7
|
+
#state;
|
|
8
|
+
#tip;
|
|
9
|
+
#closed = false;
|
|
10
|
+
#queue = Promise.resolve();
|
|
11
|
+
constructor(store, genesisParameters, state, tip, snapshotInterval) {
|
|
12
|
+
this.#store = store;
|
|
13
|
+
this.#genesisParameters = genesisParameters;
|
|
14
|
+
this.#state = state;
|
|
15
|
+
this.#tip = tip;
|
|
16
|
+
this.#snapshotInterval = snapshotInterval;
|
|
17
|
+
}
|
|
18
|
+
async getTip() {
|
|
19
|
+
await this.#queue;
|
|
20
|
+
return this.#tip === null ? null : { ...this.#tip };
|
|
21
|
+
}
|
|
22
|
+
async getState() {
|
|
23
|
+
await this.#queue;
|
|
24
|
+
return this.#state;
|
|
25
|
+
}
|
|
26
|
+
async applyBlock(block) {
|
|
27
|
+
return this.#enqueue(async () => {
|
|
28
|
+
this.#assertOpen();
|
|
29
|
+
const applied = await applyBlockWithScoring(this.#state, block, this.#genesisParameters);
|
|
30
|
+
const tip = createTip(block, applied.stateHashHex);
|
|
31
|
+
const stateBytes = serializeIndexerState(applied.state);
|
|
32
|
+
const createdAt = Date.now();
|
|
33
|
+
const checkpoint = this.#shouldCheckpoint(block.height)
|
|
34
|
+
? createCheckpoint(tip, stateBytes, createdAt)
|
|
35
|
+
: null;
|
|
36
|
+
const writeEntry = {
|
|
37
|
+
tip,
|
|
38
|
+
stateBytes,
|
|
39
|
+
blockRecord: createStoredBlockRecord(applied.blockRecord, createdAt),
|
|
40
|
+
checkpoint,
|
|
41
|
+
deleteAboveHeight: null,
|
|
42
|
+
};
|
|
43
|
+
await this.#store.writeAppliedBlock(writeEntry);
|
|
44
|
+
this.#state = applied.state;
|
|
45
|
+
this.#tip = tip;
|
|
46
|
+
return {
|
|
47
|
+
tip,
|
|
48
|
+
checkpoint,
|
|
49
|
+
applied,
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
async rewindToHeight(height) {
|
|
54
|
+
return this.#enqueue(async () => {
|
|
55
|
+
this.#assertOpen();
|
|
56
|
+
if (this.#tip === null) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
if (height >= this.#tip.height) {
|
|
60
|
+
return { ...this.#tip };
|
|
61
|
+
}
|
|
62
|
+
let nextState = this.#state;
|
|
63
|
+
let nextTip = this.#tip;
|
|
64
|
+
while (nextTip !== null && nextTip.height > height) {
|
|
65
|
+
const storedRecord = await this.#store.loadBlockRecord(nextTip.height);
|
|
66
|
+
if (storedRecord === null) {
|
|
67
|
+
throw new Error(`client_store_missing_block_record_${nextTip.height}`);
|
|
68
|
+
}
|
|
69
|
+
nextState = rewindBlock(nextState, deserializeBlockRecord(storedRecord.recordBytes));
|
|
70
|
+
const currentHeight = nextState.history.currentHeight;
|
|
71
|
+
if (currentHeight === null) {
|
|
72
|
+
nextTip = null;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const currentRecord = await this.#store.loadBlockRecord(currentHeight);
|
|
76
|
+
nextTip = {
|
|
77
|
+
height: currentHeight,
|
|
78
|
+
blockHashHex: nextState.history.currentHashHex ?? currentRecord?.blockHashHex ?? "",
|
|
79
|
+
previousHashHex: currentRecord?.previousHashHex ?? null,
|
|
80
|
+
stateHashHex: nextState.history.stateHashByHeight.get(currentHeight) ?? null,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const stateBytes = nextTip === null ? null : serializeIndexerState(nextState);
|
|
84
|
+
await this.#store.writeAppliedBlock({
|
|
85
|
+
tip: nextTip,
|
|
86
|
+
stateBytes,
|
|
87
|
+
blockRecord: null,
|
|
88
|
+
checkpoint: null,
|
|
89
|
+
deleteAboveHeight: height,
|
|
90
|
+
});
|
|
91
|
+
this.#state = nextState;
|
|
92
|
+
this.#tip = nextTip;
|
|
93
|
+
return nextTip === null ? null : { ...nextTip };
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
async close() {
|
|
97
|
+
await this.#enqueue(async () => {
|
|
98
|
+
if (this.#closed) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
this.#closed = true;
|
|
102
|
+
await this.#store.close();
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
#assertOpen() {
|
|
106
|
+
if (this.#closed) {
|
|
107
|
+
throw new Error("client_closed");
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
#shouldCheckpoint(height) {
|
|
111
|
+
return this.#snapshotInterval > 0 && height % this.#snapshotInterval === 0;
|
|
112
|
+
}
|
|
113
|
+
#enqueue(operation) {
|
|
114
|
+
const next = this.#queue.then(operation, operation);
|
|
115
|
+
this.#queue = next.then(() => undefined, () => undefined);
|
|
116
|
+
return next;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { loadBundledGenesisParameters } from "@cogcoin/indexer";
|
|
2
|
+
import { DefaultClient } from "./default-client.js";
|
|
3
|
+
import { initializeState } from "./initialization.js";
|
|
4
|
+
import { createClientStoreAdapter } from "./store-adapter.js";
|
|
5
|
+
const DEFAULT_SNAPSHOT_INTERVAL = 1000;
|
|
6
|
+
export async function openClient(options) {
|
|
7
|
+
const store = createClientStoreAdapter(options.store);
|
|
8
|
+
const genesisParameters = options.genesisParameters ?? await loadBundledGenesisParameters();
|
|
9
|
+
const snapshotInterval = options.snapshotInterval ?? DEFAULT_SNAPSHOT_INTERVAL;
|
|
10
|
+
if (!Number.isInteger(snapshotInterval) || snapshotInterval < 1) {
|
|
11
|
+
throw new RangeError("client_snapshot_interval_invalid");
|
|
12
|
+
}
|
|
13
|
+
const { state, tip } = await initializeState(store, genesisParameters);
|
|
14
|
+
return new DefaultClient(store, genesisParameters, state, tip, snapshotInterval);
|
|
15
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GenesisParameters, IndexerState } from "@cogcoin/indexer/types";
|
|
2
|
+
import type { ClientStoreAdapter, ClientTip } from "../types.js";
|
|
3
|
+
export declare function initializeState(store: ClientStoreAdapter, genesisParameters: GenesisParameters): Promise<{
|
|
4
|
+
state: IndexerState;
|
|
5
|
+
tip: ClientTip | null;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createInitialState, deserializeIndexerState, } from "@cogcoin/indexer";
|
|
2
|
+
export async function initializeState(store, genesisParameters) {
|
|
3
|
+
const tip = await store.loadTip();
|
|
4
|
+
const snapshot = await store.loadLatestSnapshot();
|
|
5
|
+
if (snapshot === null) {
|
|
6
|
+
if (tip !== null) {
|
|
7
|
+
throw new Error("client_store_tip_without_snapshot");
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
state: createInitialState(genesisParameters),
|
|
11
|
+
tip: null,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const state = deserializeIndexerState(snapshot.stateBytes);
|
|
15
|
+
if (tip === null) {
|
|
16
|
+
return {
|
|
17
|
+
state,
|
|
18
|
+
tip: {
|
|
19
|
+
height: snapshot.height,
|
|
20
|
+
blockHashHex: snapshot.blockHashHex,
|
|
21
|
+
previousHashHex: null,
|
|
22
|
+
stateHashHex: state.history.stateHashByHeight.get(snapshot.height) ?? null,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
if (tip.height !== snapshot.height || tip.blockHashHex !== snapshot.blockHashHex) {
|
|
27
|
+
throw new Error("client_store_snapshot_tip_mismatch");
|
|
28
|
+
}
|
|
29
|
+
return { state, tip };
|
|
30
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BitcoinBlock, BlockRecord } from "@cogcoin/indexer/types";
|
|
2
|
+
import type { ClientCheckpoint, ClientTip, StoredBlockRecord } from "../types.js";
|
|
3
|
+
export declare function createTip(block: BitcoinBlock, stateHashHex: string | null): ClientTip;
|
|
4
|
+
export declare function createStoredBlockRecord(blockRecord: BlockRecord, createdAt: number): StoredBlockRecord;
|
|
5
|
+
export declare function createCheckpoint(tip: ClientTip, stateBytes: Uint8Array, createdAt: number): ClientCheckpoint;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { serializeBlockRecord } from "@cogcoin/indexer";
|
|
2
|
+
import { bytesToHex } from "../bytes.js";
|
|
3
|
+
export function createTip(block, stateHashHex) {
|
|
4
|
+
return {
|
|
5
|
+
height: block.height,
|
|
6
|
+
blockHashHex: bytesToHex(block.hash),
|
|
7
|
+
previousHashHex: block.previousHash === null ? null : bytesToHex(block.previousHash),
|
|
8
|
+
stateHashHex,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export function createStoredBlockRecord(blockRecord, createdAt) {
|
|
12
|
+
return {
|
|
13
|
+
height: blockRecord.height,
|
|
14
|
+
blockHashHex: blockRecord.hashHex,
|
|
15
|
+
previousHashHex: blockRecord.previousHashHex,
|
|
16
|
+
stateHashHex: blockRecord.stateHashHex,
|
|
17
|
+
recordBytes: serializeBlockRecord(blockRecord),
|
|
18
|
+
createdAt,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function createCheckpoint(tip, stateBytes, createdAt) {
|
|
22
|
+
return {
|
|
23
|
+
height: tip.height,
|
|
24
|
+
blockHashHex: tip.blockHashHex,
|
|
25
|
+
stateBytes,
|
|
26
|
+
createdAt,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function assertClientStoreAdapter(store) {
|
|
2
|
+
const requiredMethods = [
|
|
3
|
+
"loadTip",
|
|
4
|
+
"loadLatestSnapshot",
|
|
5
|
+
"loadBlockRecordsAfter",
|
|
6
|
+
"writeAppliedBlock",
|
|
7
|
+
"deleteBlockRecordsAbove",
|
|
8
|
+
"loadBlockRecord",
|
|
9
|
+
"close",
|
|
10
|
+
];
|
|
11
|
+
for (const method of requiredMethods) {
|
|
12
|
+
if (typeof store[method] !== "function") {
|
|
13
|
+
throw new TypeError(`client_store_adapter_missing_${String(method)}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return store;
|
|
17
|
+
}
|
|
18
|
+
export function createClientStoreAdapter(store) {
|
|
19
|
+
return assertClientStoreAdapter(store);
|
|
20
|
+
}
|
package/dist/client.d.ts
ADDED
package/dist/client.js
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createClientStoreAdapter, openClient } from "./client.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
interface PassiveTipStatus {
|
|
2
|
+
height: number;
|
|
3
|
+
blockHashHex: string;
|
|
4
|
+
previousHashHex: string | null;
|
|
5
|
+
stateHashHex: string | null;
|
|
6
|
+
updatedAt: number;
|
|
7
|
+
}
|
|
8
|
+
interface PassiveCheckpointStatus {
|
|
9
|
+
height: number;
|
|
10
|
+
blockHashHex: string;
|
|
11
|
+
createdAt: number;
|
|
12
|
+
}
|
|
13
|
+
interface PassiveBootstrapStatus {
|
|
14
|
+
phase: string;
|
|
15
|
+
downloadedBytes: number;
|
|
16
|
+
totalBytes: number;
|
|
17
|
+
validated: boolean;
|
|
18
|
+
loadTxOutSetComplete: boolean;
|
|
19
|
+
baseHeight: number | null;
|
|
20
|
+
tipHashHex: string | null;
|
|
21
|
+
lastError: string | null;
|
|
22
|
+
snapshotHeight: number | null;
|
|
23
|
+
updatedAt: number | null;
|
|
24
|
+
}
|
|
25
|
+
export interface PassiveClientStatus {
|
|
26
|
+
dbPath: string;
|
|
27
|
+
bitcoinDataDir: string;
|
|
28
|
+
storeInitialized: boolean;
|
|
29
|
+
storeExists: boolean;
|
|
30
|
+
indexedTip: PassiveTipStatus | null;
|
|
31
|
+
latestCheckpoint: PassiveCheckpointStatus | null;
|
|
32
|
+
bootstrap: PassiveBootstrapStatus | null;
|
|
33
|
+
storeError: string | null;
|
|
34
|
+
}
|
|
35
|
+
export declare function inspectPassiveClientStatus(dbPath: string, bitcoinDataDir: string): Promise<PassiveClientStatus>;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { readFile, stat } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { openReadonlySqliteDatabase } from "./sqlite/driver.js";
|
|
4
|
+
import { loadLatestCheckpoint } from "./sqlite/checkpoints.js";
|
|
5
|
+
import { loadTipMeta } from "./sqlite/tip-meta.js";
|
|
6
|
+
function fileExists(path) {
|
|
7
|
+
return stat(path).then(() => true, () => false);
|
|
8
|
+
}
|
|
9
|
+
function readBootstrapState(raw) {
|
|
10
|
+
const parsed = JSON.parse(raw);
|
|
11
|
+
return {
|
|
12
|
+
phase: parsed.phase ?? "unknown",
|
|
13
|
+
downloadedBytes: parsed.downloadedBytes ?? 0,
|
|
14
|
+
totalBytes: parsed.snapshot?.sizeBytes ?? 0,
|
|
15
|
+
validated: parsed.validated ?? false,
|
|
16
|
+
loadTxOutSetComplete: parsed.loadTxOutSetComplete ?? false,
|
|
17
|
+
baseHeight: parsed.baseHeight ?? null,
|
|
18
|
+
tipHashHex: parsed.tipHashHex ?? null,
|
|
19
|
+
lastError: parsed.lastError ?? null,
|
|
20
|
+
snapshotHeight: parsed.snapshot?.height ?? null,
|
|
21
|
+
updatedAt: parsed.updatedAt ?? null,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
async function inspectSqliteStore(dbPath) {
|
|
25
|
+
const database = await openReadonlySqliteDatabase(dbPath);
|
|
26
|
+
try {
|
|
27
|
+
const indexedTipMeta = await loadTipMeta(database);
|
|
28
|
+
const checkpointRow = await loadLatestCheckpoint(database);
|
|
29
|
+
return {
|
|
30
|
+
storeInitialized: true,
|
|
31
|
+
indexedTip: indexedTipMeta === null
|
|
32
|
+
? null
|
|
33
|
+
: {
|
|
34
|
+
height: indexedTipMeta.tip.height,
|
|
35
|
+
blockHashHex: indexedTipMeta.tip.blockHashHex,
|
|
36
|
+
previousHashHex: indexedTipMeta.tip.previousHashHex,
|
|
37
|
+
stateHashHex: indexedTipMeta.tip.stateHashHex,
|
|
38
|
+
updatedAt: indexedTipMeta.updatedAt,
|
|
39
|
+
},
|
|
40
|
+
latestCheckpoint: checkpointRow === null
|
|
41
|
+
? null
|
|
42
|
+
: {
|
|
43
|
+
height: checkpointRow.height,
|
|
44
|
+
blockHashHex: checkpointRow.blockHashHex,
|
|
45
|
+
createdAt: checkpointRow.createdAt,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
await database.close();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export async function inspectPassiveClientStatus(dbPath, bitcoinDataDir) {
|
|
54
|
+
const storeExists = await fileExists(dbPath);
|
|
55
|
+
const bootstrapPath = join(bitcoinDataDir, "bootstrap", "state.json");
|
|
56
|
+
let bootstrap = null;
|
|
57
|
+
try {
|
|
58
|
+
bootstrap = readBootstrapState(await readFile(bootstrapPath, "utf8"));
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
bootstrap = null;
|
|
62
|
+
}
|
|
63
|
+
if (!storeExists) {
|
|
64
|
+
return {
|
|
65
|
+
dbPath,
|
|
66
|
+
bitcoinDataDir,
|
|
67
|
+
storeInitialized: false,
|
|
68
|
+
storeExists: false,
|
|
69
|
+
indexedTip: null,
|
|
70
|
+
latestCheckpoint: null,
|
|
71
|
+
bootstrap,
|
|
72
|
+
storeError: null,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const store = await inspectSqliteStore(dbPath);
|
|
77
|
+
return {
|
|
78
|
+
dbPath,
|
|
79
|
+
bitcoinDataDir,
|
|
80
|
+
storeInitialized: store.storeInitialized,
|
|
81
|
+
storeExists: true,
|
|
82
|
+
indexedTip: store.indexedTip,
|
|
83
|
+
latestCheckpoint: store.latestCheckpoint,
|
|
84
|
+
bootstrap,
|
|
85
|
+
storeError: null,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
return {
|
|
90
|
+
dbPath,
|
|
91
|
+
bitcoinDataDir,
|
|
92
|
+
storeInitialized: false,
|
|
93
|
+
storeExists: true,
|
|
94
|
+
indexedTip: null,
|
|
95
|
+
latestCheckpoint: null,
|
|
96
|
+
bootstrap,
|
|
97
|
+
storeError: error instanceof Error ? error.message : String(error),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
type BetterSqliteValue = bigint | Buffer | number | string | null;
|
|
2
|
+
export interface BetterSqliteRow {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
}
|
|
5
|
+
export interface BetterSqliteStatement {
|
|
6
|
+
run(...params: BetterSqliteValue[]): {
|
|
7
|
+
changes: bigint | number;
|
|
8
|
+
lastInsertRowid: bigint | number;
|
|
9
|
+
};
|
|
10
|
+
get(...params: BetterSqliteValue[]): BetterSqliteRow | undefined;
|
|
11
|
+
all(...params: BetterSqliteValue[]): BetterSqliteRow[];
|
|
12
|
+
}
|
|
13
|
+
export interface BetterSqliteDatabaseHandle {
|
|
14
|
+
exec(sql: string): void;
|
|
15
|
+
prepare(sql: string): BetterSqliteStatement;
|
|
16
|
+
close(): void;
|
|
17
|
+
}
|
|
18
|
+
export interface BetterSqliteOpenOptions {
|
|
19
|
+
fileMustExist?: boolean;
|
|
20
|
+
readonly?: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface BetterSqliteConstructor {
|
|
23
|
+
new (filename: string, options?: BetterSqliteOpenOptions): BetterSqliteDatabaseHandle;
|
|
24
|
+
}
|
|
25
|
+
export declare function loadBetterSqlite3(): Promise<BetterSqliteConstructor>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ClientCheckpoint } from "../types.js";
|
|
2
|
+
import type { SqliteDatabase } from "./driver.js";
|
|
3
|
+
export interface StoredCheckpointRow {
|
|
4
|
+
height: number;
|
|
5
|
+
blockHashHex: string;
|
|
6
|
+
stateBytes: Uint8Array;
|
|
7
|
+
createdAt: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function loadLatestCheckpoint(database: SqliteDatabase): Promise<StoredCheckpointRow | null>;
|
|
10
|
+
export declare function replaceCheckpoint(database: SqliteDatabase, checkpoint: ClientCheckpoint): Promise<void>;
|
|
11
|
+
export declare function deleteCheckpointsAbove(database: SqliteDatabase, height: number): Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { bytesToHex, cloneBytes, hexToBytes } from "../bytes.js";
|
|
2
|
+
function decodeCheckpointRow(row) {
|
|
3
|
+
if (row === null) {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
return {
|
|
7
|
+
height: row.height,
|
|
8
|
+
blockHashHex: bytesToHex(row.block_hash),
|
|
9
|
+
stateBytes: cloneBytes(row.state_bytes),
|
|
10
|
+
createdAt: row.created_at,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export async function loadLatestCheckpoint(database) {
|
|
14
|
+
return decodeCheckpointRow(await database.get(`SELECT height, block_hash, state_bytes, created_at FROM checkpoints ORDER BY height DESC LIMIT 1`));
|
|
15
|
+
}
|
|
16
|
+
export async function replaceCheckpoint(database, checkpoint) {
|
|
17
|
+
await database.run(`INSERT OR REPLACE INTO checkpoints (height, block_hash, state_bytes, created_at)
|
|
18
|
+
VALUES (?, ?, ?, ?)`, [
|
|
19
|
+
checkpoint.height,
|
|
20
|
+
hexToBytes(checkpoint.blockHashHex),
|
|
21
|
+
checkpoint.stateBytes,
|
|
22
|
+
checkpoint.createdAt,
|
|
23
|
+
]);
|
|
24
|
+
}
|
|
25
|
+
export async function deleteCheckpointsAbove(database, height) {
|
|
26
|
+
await database.run(`DELETE FROM checkpoints WHERE height > ?`, [height]);
|
|
27
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SqliteStoreOptions } from "./types.js";
|
|
2
|
+
type SqliteValue = bigint | null | number | string | Uint8Array;
|
|
3
|
+
export interface SqliteRunResult {
|
|
4
|
+
changes: number;
|
|
5
|
+
lastInsertRowid: bigint | number | null;
|
|
6
|
+
}
|
|
7
|
+
export interface SqliteDatabase {
|
|
8
|
+
exec(sql: string): Promise<void>;
|
|
9
|
+
run(sql: string, params?: readonly SqliteValue[]): Promise<SqliteRunResult>;
|
|
10
|
+
get<T>(sql: string, params?: readonly SqliteValue[]): Promise<T | null>;
|
|
11
|
+
all<T>(sql: string, params?: readonly SqliteValue[]): Promise<T[]>;
|
|
12
|
+
transaction<T>(operation: () => Promise<T>): Promise<T>;
|
|
13
|
+
close(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare function openSqliteDatabase(options: SqliteStoreOptions): Promise<SqliteDatabase>;
|
|
16
|
+
export declare function openReadonlySqliteDatabase(filename: string): Promise<SqliteDatabase>;
|
|
17
|
+
export {};
|