@invisi-labs/sdk 1.1.6 → 1.1.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.
- package/dist/{NoteOutput-DRkVnwlx.d.cts → broadcaster-preparation-DMxxZ_1Q.d.cts} +309 -120
- package/dist/{NoteOutput-DpDC6T2O.d.ts → broadcaster-preparation-DMxxZ_1Q.d.ts} +309 -120
- package/dist/broadcaster-preparation-RMWQFYNL.js +11 -0
- package/dist/broadcaster-preparation-UGOTO4SX.cjs +11 -0
- package/dist/broadcaster-preparation-UGOTO4SX.cjs.map +1 -0
- package/dist/chunk-7F7ZZW3L.cjs +374 -0
- package/dist/chunk-7F7ZZW3L.cjs.map +1 -0
- package/dist/{chunk-4SD3MW6N.js → chunk-EHP5TBC6.js} +1347 -2493
- package/dist/chunk-EHP5TBC6.js.map +1 -0
- package/dist/{broadcaster-preparation-QVL62KM6.js → chunk-GTPUYPQL.js} +6 -6
- package/dist/chunk-GTPUYPQL.js.map +1 -0
- package/dist/{chunk-FL4TIGWW.js → chunk-ITTGBIG2.js} +617 -521
- package/dist/chunk-ITTGBIG2.js.map +1 -0
- package/dist/chunk-J2JH6HIG.cjs +1877 -0
- package/dist/chunk-J2JH6HIG.cjs.map +1 -0
- package/dist/chunk-LOU7AP2B.cjs +128 -0
- package/dist/chunk-LOU7AP2B.cjs.map +1 -0
- package/dist/chunk-RHNIHI4P.cjs +3565 -0
- package/dist/chunk-RHNIHI4P.cjs.map +1 -0
- package/dist/{chunk-QC6TQR3R.js → chunk-XHKQ2BO2.js} +12 -12
- package/dist/chunk-XHKQ2BO2.js.map +1 -0
- package/dist/ethers.cjs +11 -385
- package/dist/ethers.cjs.map +1 -1
- package/dist/ethers.d.cts +3 -4
- package/dist/ethers.d.ts +3 -4
- package/dist/ethers.js +1 -1
- package/dist/index.cjs +451 -7845
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -702
- package/dist/index.d.ts +72 -702
- package/dist/index.js +374 -862
- package/dist/index.js.map +1 -1
- package/dist/receipt-logs-CvC951p7.d.cts +318 -0
- package/dist/receipt-logs-m0-bhaxW.d.ts +318 -0
- package/dist/session-support.cjs +168 -0
- package/dist/session-support.cjs.map +1 -0
- package/dist/session-support.d.cts +252 -0
- package/dist/session-support.d.ts +252 -0
- package/dist/session-support.js +168 -0
- package/dist/session-support.js.map +1 -0
- package/package.json +10 -20
- package/dist/broadcaster-preparation-QVL62KM6.js.map +0 -1
- package/dist/chunk-4SD3MW6N.js.map +0 -1
- package/dist/chunk-FL4TIGWW.js.map +0 -1
- package/dist/chunk-QC6TQR3R.js.map +0 -1
- package/dist/indexeddb.cjs +0 -6878
- package/dist/indexeddb.cjs.map +0 -1
- package/dist/indexeddb.d.cts +0 -20
- package/dist/indexeddb.d.ts +0 -20
- package/dist/indexeddb.js +0 -71
- package/dist/indexeddb.js.map +0 -1
- package/dist/memory.cjs +0 -6886
- package/dist/memory.cjs.map +0 -1
- package/dist/memory.d.cts +0 -12
- package/dist/memory.d.ts +0 -12
- package/dist/memory.js +0 -11
- package/dist/sqlite.cjs +0 -6862
- package/dist/sqlite.cjs.map +0 -1
- package/dist/sqlite.d.cts +0 -28
- package/dist/sqlite.d.ts +0 -28
- package/dist/sqlite.js +0 -55
- package/dist/sqlite.js.map +0 -1
- package/dist/state-C4HZFotm.d.cts +0 -78
- package/dist/state-C4HZFotm.d.ts +0 -78
- package/dist/store-8aBhnbGr.d.ts +0 -42
- package/dist/store-YrbXb6CY.d.cts +0 -42
- /package/dist/{memory.js.map → broadcaster-preparation-RMWQFYNL.js.map} +0 -0
package/dist/sqlite.d.cts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { A as AtomicRecordStore, a as AtomicRecord, T as TransactionalWalletStore, W as WalletRecordCodec } from './store-YrbXb6CY.cjs';
|
|
2
|
-
import './state-C4HZFotm.cjs';
|
|
3
|
-
import '@invisi-labs/core';
|
|
4
|
-
import '@invisi-labs/prover';
|
|
5
|
-
|
|
6
|
-
interface SQLiteStatement {
|
|
7
|
-
get(...params: unknown[]): unknown;
|
|
8
|
-
run(...params: unknown[]): {
|
|
9
|
-
changes: number | bigint;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
/** Compatible with node:sqlite DatabaseSync and synchronous SQLite drivers. The caller owns its lifetime. */
|
|
13
|
-
interface SQLiteConnection {
|
|
14
|
-
exec(sql: string): void;
|
|
15
|
-
prepare(sql: string): SQLiteStatement;
|
|
16
|
-
}
|
|
17
|
-
declare class SQLiteAtomicRecords implements AtomicRecordStore {
|
|
18
|
-
#private;
|
|
19
|
-
constructor(db: SQLiteConnection);
|
|
20
|
-
read(key: string): Promise<AtomicRecord | undefined>;
|
|
21
|
-
compareAndSwap(key: string, previousRevision: number, next: AtomicRecord): Promise<boolean>;
|
|
22
|
-
}
|
|
23
|
-
/** Explicit persistent storage; encryption/serialization is always chosen by the caller. */
|
|
24
|
-
declare class SQLiteWalletStore extends TransactionalWalletStore {
|
|
25
|
-
constructor(db: SQLiteConnection, codec: WalletRecordCodec);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { SQLiteAtomicRecords, type SQLiteConnection, type SQLiteStatement, SQLiteWalletStore };
|
package/dist/sqlite.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { A as AtomicRecordStore, a as AtomicRecord, T as TransactionalWalletStore, W as WalletRecordCodec } from './store-8aBhnbGr.js';
|
|
2
|
-
import './state-C4HZFotm.js';
|
|
3
|
-
import '@invisi-labs/core';
|
|
4
|
-
import '@invisi-labs/prover';
|
|
5
|
-
|
|
6
|
-
interface SQLiteStatement {
|
|
7
|
-
get(...params: unknown[]): unknown;
|
|
8
|
-
run(...params: unknown[]): {
|
|
9
|
-
changes: number | bigint;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
/** Compatible with node:sqlite DatabaseSync and synchronous SQLite drivers. The caller owns its lifetime. */
|
|
13
|
-
interface SQLiteConnection {
|
|
14
|
-
exec(sql: string): void;
|
|
15
|
-
prepare(sql: string): SQLiteStatement;
|
|
16
|
-
}
|
|
17
|
-
declare class SQLiteAtomicRecords implements AtomicRecordStore {
|
|
18
|
-
#private;
|
|
19
|
-
constructor(db: SQLiteConnection);
|
|
20
|
-
read(key: string): Promise<AtomicRecord | undefined>;
|
|
21
|
-
compareAndSwap(key: string, previousRevision: number, next: AtomicRecord): Promise<boolean>;
|
|
22
|
-
}
|
|
23
|
-
/** Explicit persistent storage; encryption/serialization is always chosen by the caller. */
|
|
24
|
-
declare class SQLiteWalletStore extends TransactionalWalletStore {
|
|
25
|
-
constructor(db: SQLiteConnection, codec: WalletRecordCodec);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { SQLiteAtomicRecords, type SQLiteConnection, type SQLiteStatement, SQLiteWalletStore };
|
package/dist/sqlite.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TransactionalWalletStore
|
|
3
|
-
} from "./chunk-4SD3MW6N.js";
|
|
4
|
-
import "./chunk-FL4TIGWW.js";
|
|
5
|
-
import "./chunk-QC6TQR3R.js";
|
|
6
|
-
|
|
7
|
-
// src/integrations/sqlite.ts
|
|
8
|
-
var SQLiteAtomicRecords = class {
|
|
9
|
-
#db;
|
|
10
|
-
constructor(db) {
|
|
11
|
-
this.#db = db;
|
|
12
|
-
db.exec("PRAGMA busy_timeout = 5000");
|
|
13
|
-
db.exec(
|
|
14
|
-
"CREATE TABLE IF NOT EXISTS invisi_wallet_state (scope_key TEXT PRIMARY KEY, revision INTEGER NOT NULL, data BLOB NOT NULL)"
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
async read(key) {
|
|
18
|
-
const row = this.#db.prepare("SELECT revision, data FROM invisi_wallet_state WHERE scope_key = ?").get(key);
|
|
19
|
-
if (!row) return void 0;
|
|
20
|
-
if (!Number.isSafeInteger(row.revision) || row.revision < 1 || !(row.data instanceof Uint8Array))
|
|
21
|
-
throw new Error("invalid SQLite wallet record");
|
|
22
|
-
return { revision: row.revision, data: Uint8Array.from(row.data) };
|
|
23
|
-
}
|
|
24
|
-
async compareAndSwap(key, previousRevision, next) {
|
|
25
|
-
this.#db.exec("BEGIN IMMEDIATE");
|
|
26
|
-
try {
|
|
27
|
-
const row = this.#db.prepare("SELECT revision FROM invisi_wallet_state WHERE scope_key = ?").get(key);
|
|
28
|
-
if ((row?.revision ?? 0) !== previousRevision) {
|
|
29
|
-
this.#db.exec("ROLLBACK");
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
this.#db.prepare(
|
|
33
|
-
"INSERT INTO invisi_wallet_state(scope_key,revision,data) VALUES(?,?,?) ON CONFLICT(scope_key) DO UPDATE SET revision=excluded.revision,data=excluded.data"
|
|
34
|
-
).run(key, next.revision, next.data);
|
|
35
|
-
this.#db.exec("COMMIT");
|
|
36
|
-
return true;
|
|
37
|
-
} catch (error) {
|
|
38
|
-
try {
|
|
39
|
-
this.#db.exec("ROLLBACK");
|
|
40
|
-
} catch {
|
|
41
|
-
}
|
|
42
|
-
throw error;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
var SQLiteWalletStore = class extends TransactionalWalletStore {
|
|
47
|
-
constructor(db, codec) {
|
|
48
|
-
super(new SQLiteAtomicRecords(db), codec, { persistent: true });
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
export {
|
|
52
|
-
SQLiteAtomicRecords,
|
|
53
|
-
SQLiteWalletStore
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=sqlite.js.map
|
package/dist/sqlite.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/integrations/sqlite.ts"],"sourcesContent":["import {\n TransactionalWalletStore,\n type AtomicRecord,\n type AtomicRecordStore,\n type WalletRecordCodec,\n} from \"../session\";\nexport interface SQLiteStatement {\n get(...params: unknown[]): unknown;\n run(...params: unknown[]): { changes: number | bigint };\n}\n/** Compatible with node:sqlite DatabaseSync and synchronous SQLite drivers. The caller owns its lifetime. */\nexport interface SQLiteConnection {\n exec(sql: string): void;\n prepare(sql: string): SQLiteStatement;\n}\nexport class SQLiteAtomicRecords implements AtomicRecordStore {\n readonly #db: SQLiteConnection;\n constructor(db: SQLiteConnection) {\n this.#db = db;\n db.exec(\"PRAGMA busy_timeout = 5000\");\n db.exec(\n \"CREATE TABLE IF NOT EXISTS invisi_wallet_state (scope_key TEXT PRIMARY KEY, revision INTEGER NOT NULL, data BLOB NOT NULL)\"\n );\n }\n async read(key: string): Promise<AtomicRecord | undefined> {\n const row = this.#db\n .prepare(\"SELECT revision, data FROM invisi_wallet_state WHERE scope_key = ?\")\n .get(key) as { revision: number; data: Uint8Array } | undefined;\n if (!row) return undefined;\n if (\n !Number.isSafeInteger(row.revision) ||\n row.revision < 1 ||\n !(row.data instanceof Uint8Array)\n )\n throw new Error(\"invalid SQLite wallet record\");\n return { revision: row.revision, data: Uint8Array.from(row.data) };\n }\n async compareAndSwap(\n key: string,\n previousRevision: number,\n next: AtomicRecord\n ): Promise<boolean> {\n this.#db.exec(\"BEGIN IMMEDIATE\");\n try {\n const row = this.#db\n .prepare(\"SELECT revision FROM invisi_wallet_state WHERE scope_key = ?\")\n .get(key) as { revision: number } | undefined;\n if ((row?.revision ?? 0) !== previousRevision) {\n this.#db.exec(\"ROLLBACK\");\n return false;\n }\n this.#db\n .prepare(\n \"INSERT INTO invisi_wallet_state(scope_key,revision,data) VALUES(?,?,?) ON CONFLICT(scope_key) DO UPDATE SET revision=excluded.revision,data=excluded.data\"\n )\n .run(key, next.revision, next.data);\n this.#db.exec(\"COMMIT\");\n return true;\n } catch (error) {\n try {\n this.#db.exec(\"ROLLBACK\");\n } catch {}\n throw error;\n }\n }\n}\n/** Explicit persistent storage; encryption/serialization is always chosen by the caller. */\nexport class SQLiteWalletStore extends TransactionalWalletStore {\n constructor(db: SQLiteConnection, codec: WalletRecordCodec) {\n super(new SQLiteAtomicRecords(db), codec, { persistent: true });\n }\n}\n"],"mappings":";;;;;;;AAeO,IAAM,sBAAN,MAAuD;AAAA,EACjD;AAAA,EACT,YAAY,IAAsB;AAC9B,SAAK,MAAM;AACX,OAAG,KAAK,4BAA4B;AACpC,OAAG;AAAA,MACC;AAAA,IACJ;AAAA,EACJ;AAAA,EACA,MAAM,KAAK,KAAgD;AACvD,UAAM,MAAM,KAAK,IACZ,QAAQ,oEAAoE,EAC5E,IAAI,GAAG;AACZ,QAAI,CAAC,IAAK,QAAO;AACjB,QACI,CAAC,OAAO,cAAc,IAAI,QAAQ,KAClC,IAAI,WAAW,KACf,EAAE,IAAI,gBAAgB;AAEtB,YAAM,IAAI,MAAM,8BAA8B;AAClD,WAAO,EAAE,UAAU,IAAI,UAAU,MAAM,WAAW,KAAK,IAAI,IAAI,EAAE;AAAA,EACrE;AAAA,EACA,MAAM,eACF,KACA,kBACA,MACgB;AAChB,SAAK,IAAI,KAAK,iBAAiB;AAC/B,QAAI;AACA,YAAM,MAAM,KAAK,IACZ,QAAQ,8DAA8D,EACtE,IAAI,GAAG;AACZ,WAAK,KAAK,YAAY,OAAO,kBAAkB;AAC3C,aAAK,IAAI,KAAK,UAAU;AACxB,eAAO;AAAA,MACX;AACA,WAAK,IACA;AAAA,QACG;AAAA,MACJ,EACC,IAAI,KAAK,KAAK,UAAU,KAAK,IAAI;AACtC,WAAK,IAAI,KAAK,QAAQ;AACtB,aAAO;AAAA,IACX,SAAS,OAAO;AACZ,UAAI;AACA,aAAK,IAAI,KAAK,UAAU;AAAA,MAC5B,QAAQ;AAAA,MAAC;AACT,YAAM;AAAA,IACV;AAAA,EACJ;AACJ;AAEO,IAAM,oBAAN,cAAgC,yBAAyB;AAAA,EAC5D,YAAY,IAAsB,OAA0B;AACxD,UAAM,IAAI,oBAAoB,EAAE,GAAG,OAAO,EAAE,YAAY,KAAK,CAAC;AAAA,EAClE;AACJ;","names":[]}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Note, CreditDeliveryState } from '@invisi-labs/core';
|
|
2
|
-
import { Hex } from '@invisi-labs/prover';
|
|
3
|
-
|
|
4
|
-
interface WalletScope {
|
|
5
|
-
namespace: string;
|
|
6
|
-
chainId: bigint;
|
|
7
|
-
protocolAddress: Hex;
|
|
8
|
-
ownerAddress: Hex;
|
|
9
|
-
}
|
|
10
|
-
interface Checkpoint {
|
|
11
|
-
number: bigint;
|
|
12
|
-
hash: Hex;
|
|
13
|
-
}
|
|
14
|
-
type SpentState = "unknown" | "unspent" | "spent";
|
|
15
|
-
interface ReceiptPosition {
|
|
16
|
-
commitment: Hex;
|
|
17
|
-
treeId: bigint;
|
|
18
|
-
leafIndex: number;
|
|
19
|
-
blockNumber: bigint;
|
|
20
|
-
blockHash: Hex;
|
|
21
|
-
transactionHash?: Hex;
|
|
22
|
-
}
|
|
23
|
-
interface StoredNote extends ReceiptPosition {
|
|
24
|
-
note: Note;
|
|
25
|
-
spent: SpentState;
|
|
26
|
-
checkedThrough?: Checkpoint;
|
|
27
|
-
}
|
|
28
|
-
interface StoredCredit extends ReceiptPosition {
|
|
29
|
-
receivingKeySource?: {
|
|
30
|
-
kind: "draw" | "top-up";
|
|
31
|
-
commitment: Hex;
|
|
32
|
-
};
|
|
33
|
-
state: CreditDeliveryState;
|
|
34
|
-
role: "owner" | "spender";
|
|
35
|
-
spent: SpentState;
|
|
36
|
-
checkedThrough?: Checkpoint;
|
|
37
|
-
}
|
|
38
|
-
type OperationStatus = "prepared" | "authorized" | "proved" | "ready" | "submitted" | "confirmed" | "failed" | "expired" | "uncertain" | "reorged";
|
|
39
|
-
interface OperationRecord {
|
|
40
|
-
id: string;
|
|
41
|
-
status: OperationStatus;
|
|
42
|
-
inputs: string[];
|
|
43
|
-
deadline?: bigint;
|
|
44
|
-
transactionHash?: Hex;
|
|
45
|
-
payload?: unknown;
|
|
46
|
-
}
|
|
47
|
-
interface WalletState {
|
|
48
|
-
schemaVersion: 1;
|
|
49
|
-
scope: WalletScope;
|
|
50
|
-
revision: number;
|
|
51
|
-
notes: Record<string, StoredNote>;
|
|
52
|
-
credits: Record<string, StoredCredit>;
|
|
53
|
-
reservations: Record<string, string>;
|
|
54
|
-
operations: Record<string, OperationRecord>;
|
|
55
|
-
/** Last canonical block observed while processing known candidates; never a completeness claim. */
|
|
56
|
-
observedThrough?: Checkpoint;
|
|
57
|
-
/** Completed contiguous RPC discovery ranges; independent of operation reconciliation. */
|
|
58
|
-
discoveryThrough?: Checkpoint;
|
|
59
|
-
invalidated?: string;
|
|
60
|
-
}
|
|
61
|
-
interface WalletStore {
|
|
62
|
-
readonly persistent: boolean;
|
|
63
|
-
readSnapshot(scope: WalletScope): Promise<WalletState>;
|
|
64
|
-
/** Pure synchronous mutation; an optimistic persistent adapter may retry it. */
|
|
65
|
-
transaction<T>(scope: WalletScope, action: (draft: WalletState) => T): Promise<T>;
|
|
66
|
-
}
|
|
67
|
-
interface BalanceSnapshot {
|
|
68
|
-
tokenAddress: Hex;
|
|
69
|
-
scope: WalletScope;
|
|
70
|
-
checkedThrough: Checkpoint | null;
|
|
71
|
-
confirmedKnown: bigint;
|
|
72
|
-
reserved: bigint;
|
|
73
|
-
availableKnown: bigint | null;
|
|
74
|
-
invalidated: boolean;
|
|
75
|
-
}
|
|
76
|
-
declare function walletBalance(state: WalletState, tokenAddress: Hex): BalanceSnapshot;
|
|
77
|
-
|
|
78
|
-
export { type BalanceSnapshot as B, type Checkpoint as C, type OperationStatus as O, type ReceiptPosition as R, type SpentState as S, type WalletScope as W, type WalletState as a, type WalletStore as b, type StoredNote as c, walletBalance as w };
|
package/dist/state-C4HZFotm.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Note, CreditDeliveryState } from '@invisi-labs/core';
|
|
2
|
-
import { Hex } from '@invisi-labs/prover';
|
|
3
|
-
|
|
4
|
-
interface WalletScope {
|
|
5
|
-
namespace: string;
|
|
6
|
-
chainId: bigint;
|
|
7
|
-
protocolAddress: Hex;
|
|
8
|
-
ownerAddress: Hex;
|
|
9
|
-
}
|
|
10
|
-
interface Checkpoint {
|
|
11
|
-
number: bigint;
|
|
12
|
-
hash: Hex;
|
|
13
|
-
}
|
|
14
|
-
type SpentState = "unknown" | "unspent" | "spent";
|
|
15
|
-
interface ReceiptPosition {
|
|
16
|
-
commitment: Hex;
|
|
17
|
-
treeId: bigint;
|
|
18
|
-
leafIndex: number;
|
|
19
|
-
blockNumber: bigint;
|
|
20
|
-
blockHash: Hex;
|
|
21
|
-
transactionHash?: Hex;
|
|
22
|
-
}
|
|
23
|
-
interface StoredNote extends ReceiptPosition {
|
|
24
|
-
note: Note;
|
|
25
|
-
spent: SpentState;
|
|
26
|
-
checkedThrough?: Checkpoint;
|
|
27
|
-
}
|
|
28
|
-
interface StoredCredit extends ReceiptPosition {
|
|
29
|
-
receivingKeySource?: {
|
|
30
|
-
kind: "draw" | "top-up";
|
|
31
|
-
commitment: Hex;
|
|
32
|
-
};
|
|
33
|
-
state: CreditDeliveryState;
|
|
34
|
-
role: "owner" | "spender";
|
|
35
|
-
spent: SpentState;
|
|
36
|
-
checkedThrough?: Checkpoint;
|
|
37
|
-
}
|
|
38
|
-
type OperationStatus = "prepared" | "authorized" | "proved" | "ready" | "submitted" | "confirmed" | "failed" | "expired" | "uncertain" | "reorged";
|
|
39
|
-
interface OperationRecord {
|
|
40
|
-
id: string;
|
|
41
|
-
status: OperationStatus;
|
|
42
|
-
inputs: string[];
|
|
43
|
-
deadline?: bigint;
|
|
44
|
-
transactionHash?: Hex;
|
|
45
|
-
payload?: unknown;
|
|
46
|
-
}
|
|
47
|
-
interface WalletState {
|
|
48
|
-
schemaVersion: 1;
|
|
49
|
-
scope: WalletScope;
|
|
50
|
-
revision: number;
|
|
51
|
-
notes: Record<string, StoredNote>;
|
|
52
|
-
credits: Record<string, StoredCredit>;
|
|
53
|
-
reservations: Record<string, string>;
|
|
54
|
-
operations: Record<string, OperationRecord>;
|
|
55
|
-
/** Last canonical block observed while processing known candidates; never a completeness claim. */
|
|
56
|
-
observedThrough?: Checkpoint;
|
|
57
|
-
/** Completed contiguous RPC discovery ranges; independent of operation reconciliation. */
|
|
58
|
-
discoveryThrough?: Checkpoint;
|
|
59
|
-
invalidated?: string;
|
|
60
|
-
}
|
|
61
|
-
interface WalletStore {
|
|
62
|
-
readonly persistent: boolean;
|
|
63
|
-
readSnapshot(scope: WalletScope): Promise<WalletState>;
|
|
64
|
-
/** Pure synchronous mutation; an optimistic persistent adapter may retry it. */
|
|
65
|
-
transaction<T>(scope: WalletScope, action: (draft: WalletState) => T): Promise<T>;
|
|
66
|
-
}
|
|
67
|
-
interface BalanceSnapshot {
|
|
68
|
-
tokenAddress: Hex;
|
|
69
|
-
scope: WalletScope;
|
|
70
|
-
checkedThrough: Checkpoint | null;
|
|
71
|
-
confirmedKnown: bigint;
|
|
72
|
-
reserved: bigint;
|
|
73
|
-
availableKnown: bigint | null;
|
|
74
|
-
invalidated: boolean;
|
|
75
|
-
}
|
|
76
|
-
declare function walletBalance(state: WalletState, tokenAddress: Hex): BalanceSnapshot;
|
|
77
|
-
|
|
78
|
-
export { type BalanceSnapshot as B, type Checkpoint as C, type OperationStatus as O, type ReceiptPosition as R, type SpentState as S, type WalletScope as W, type WalletState as a, type WalletStore as b, type StoredNote as c, walletBalance as w };
|
package/dist/store-8aBhnbGr.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { a as WalletState, b as WalletStore, W as WalletScope } from './state-C4HZFotm.js';
|
|
2
|
-
|
|
3
|
-
/** A stored encrypted blob and its CAS revision. No private state is exposed to adapters. */
|
|
4
|
-
interface AtomicRecord {
|
|
5
|
-
revision: number;
|
|
6
|
-
data: Uint8Array;
|
|
7
|
-
}
|
|
8
|
-
interface AtomicRecordStore {
|
|
9
|
-
read(key: string): Promise<AtomicRecord | undefined>;
|
|
10
|
-
compareAndSwap(key: string, previousRevision: number, next: AtomicRecord): Promise<boolean>;
|
|
11
|
-
}
|
|
12
|
-
interface WalletRecordCodec {
|
|
13
|
-
encode(value: WalletState, context: {
|
|
14
|
-
key: string;
|
|
15
|
-
revision: number;
|
|
16
|
-
}): Promise<Uint8Array>;
|
|
17
|
-
decode(data: Uint8Array, context: {
|
|
18
|
-
key: string;
|
|
19
|
-
revision: number;
|
|
20
|
-
}): Promise<WalletState>;
|
|
21
|
-
}
|
|
22
|
-
declare class TransactionalWalletStore implements WalletStore {
|
|
23
|
-
#private;
|
|
24
|
-
readonly persistent: boolean;
|
|
25
|
-
constructor(records: AtomicRecordStore, codec: WalletRecordCodec, options: {
|
|
26
|
-
persistent: boolean;
|
|
27
|
-
});
|
|
28
|
-
readSnapshot(scope: WalletScope): Promise<WalletState>;
|
|
29
|
-
transaction<T>(scope: WalletScope, action: (draft: WalletState) => T): Promise<T>;
|
|
30
|
-
toJSON(): {
|
|
31
|
-
walletStore: boolean;
|
|
32
|
-
persistent: boolean;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/** Explicitly nonpersistent reference storage; data never leaves this process. */
|
|
36
|
-
declare class MemoryAtomicRecords implements AtomicRecordStore {
|
|
37
|
-
#private;
|
|
38
|
-
read(key: string): Promise<AtomicRecord | undefined>;
|
|
39
|
-
compareAndSwap(key: string, previousRevision: number, next: AtomicRecord): Promise<boolean>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { type AtomicRecordStore as A, MemoryAtomicRecords as M, TransactionalWalletStore as T, type WalletRecordCodec as W, type AtomicRecord as a };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { a as WalletState, b as WalletStore, W as WalletScope } from './state-C4HZFotm.cjs';
|
|
2
|
-
|
|
3
|
-
/** A stored encrypted blob and its CAS revision. No private state is exposed to adapters. */
|
|
4
|
-
interface AtomicRecord {
|
|
5
|
-
revision: number;
|
|
6
|
-
data: Uint8Array;
|
|
7
|
-
}
|
|
8
|
-
interface AtomicRecordStore {
|
|
9
|
-
read(key: string): Promise<AtomicRecord | undefined>;
|
|
10
|
-
compareAndSwap(key: string, previousRevision: number, next: AtomicRecord): Promise<boolean>;
|
|
11
|
-
}
|
|
12
|
-
interface WalletRecordCodec {
|
|
13
|
-
encode(value: WalletState, context: {
|
|
14
|
-
key: string;
|
|
15
|
-
revision: number;
|
|
16
|
-
}): Promise<Uint8Array>;
|
|
17
|
-
decode(data: Uint8Array, context: {
|
|
18
|
-
key: string;
|
|
19
|
-
revision: number;
|
|
20
|
-
}): Promise<WalletState>;
|
|
21
|
-
}
|
|
22
|
-
declare class TransactionalWalletStore implements WalletStore {
|
|
23
|
-
#private;
|
|
24
|
-
readonly persistent: boolean;
|
|
25
|
-
constructor(records: AtomicRecordStore, codec: WalletRecordCodec, options: {
|
|
26
|
-
persistent: boolean;
|
|
27
|
-
});
|
|
28
|
-
readSnapshot(scope: WalletScope): Promise<WalletState>;
|
|
29
|
-
transaction<T>(scope: WalletScope, action: (draft: WalletState) => T): Promise<T>;
|
|
30
|
-
toJSON(): {
|
|
31
|
-
walletStore: boolean;
|
|
32
|
-
persistent: boolean;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/** Explicitly nonpersistent reference storage; data never leaves this process. */
|
|
36
|
-
declare class MemoryAtomicRecords implements AtomicRecordStore {
|
|
37
|
-
#private;
|
|
38
|
-
read(key: string): Promise<AtomicRecord | undefined>;
|
|
39
|
-
compareAndSwap(key: string, previousRevision: number, next: AtomicRecord): Promise<boolean>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { type AtomicRecordStore as A, MemoryAtomicRecords as M, TransactionalWalletStore as T, type WalletRecordCodec as W, type AtomicRecord as a };
|
|
File without changes
|