@unlink-xyz/core 0.1.0 → 0.1.3-canary.01ac52d
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 +9 -0
- package/dist/account/{zkAccount.d.ts → account.d.ts} +36 -5
- package/dist/account/account.d.ts.map +1 -0
- package/dist/account/accounts.d.ts +42 -0
- package/dist/account/accounts.d.ts.map +1 -0
- package/dist/account/seed.d.ts +45 -0
- package/dist/account/seed.d.ts.map +1 -0
- package/dist/account/serialization.d.ts +6 -0
- package/dist/account/serialization.d.ts.map +1 -0
- package/dist/browser/index.js +56253 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/wallet/index.js +55974 -0
- package/dist/browser/wallet/index.js.map +1 -0
- package/dist/clients/broadcaster.d.ts +8 -2
- package/dist/clients/broadcaster.d.ts.map +1 -1
- package/dist/clients/http.d.ts +6 -0
- package/dist/clients/http.d.ts.map +1 -1
- package/dist/clients/indexer.d.ts +16 -0
- package/dist/clients/indexer.d.ts.map +1 -1
- package/dist/config.d.ts +35 -9
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/crypto/adapters/index.d.ts +17 -0
- package/dist/crypto/adapters/index.d.ts.map +1 -0
- package/dist/crypto/adapters/polyfills.d.ts +5 -0
- package/dist/crypto/adapters/polyfills.d.ts.map +1 -0
- package/dist/crypto/encrypt.d.ts +33 -0
- package/dist/crypto/encrypt.d.ts.map +1 -0
- package/dist/crypto/secure-memory.d.ts +25 -0
- package/dist/crypto/secure-memory.d.ts.map +1 -0
- package/dist/errors.d.ts +17 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/history/index.d.ts +3 -0
- package/dist/history/index.d.ts.map +1 -0
- package/dist/history/service.d.ts +46 -0
- package/dist/history/service.d.ts.map +1 -0
- package/dist/history/types.d.ts +21 -0
- package/dist/history/types.d.ts.map +1 -0
- package/dist/index.d.ts +16 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9969 -16
- package/dist/index.js.map +1 -0
- package/dist/keys/address.d.ts +13 -0
- package/dist/keys/address.d.ts.map +1 -0
- package/dist/keys/derive.d.ts +37 -0
- package/dist/keys/derive.d.ts.map +1 -0
- package/dist/keys/hex.d.ts +14 -0
- package/dist/keys/hex.d.ts.map +1 -0
- package/dist/keys/index.d.ts +5 -0
- package/dist/keys/index.d.ts.map +1 -0
- package/dist/keys/mnemonic.d.ts +6 -0
- package/dist/keys/mnemonic.d.ts.map +1 -0
- package/dist/keys.d.ts +5 -1
- package/dist/keys.d.ts.map +1 -1
- package/dist/prover/config.d.ts +53 -22
- package/dist/prover/config.d.ts.map +1 -1
- package/dist/prover/integrity.d.ts +20 -0
- package/dist/prover/integrity.d.ts.map +1 -0
- package/dist/prover/prover.d.ts +16 -20
- package/dist/prover/prover.d.ts.map +1 -1
- package/dist/prover/registry.d.ts +3 -30
- package/dist/prover/registry.d.ts.map +1 -1
- package/dist/state/merkle/hydrator.d.ts +21 -19
- package/dist/state/merkle/hydrator.d.ts.map +1 -1
- package/dist/state/merkle/index.d.ts +2 -2
- package/dist/state/merkle/index.d.ts.map +1 -1
- package/dist/state/merkle/merkle-tree.d.ts +8 -0
- package/dist/state/merkle/merkle-tree.d.ts.map +1 -1
- package/dist/state/store/ciphertext-store.d.ts +11 -0
- package/dist/state/store/ciphertext-store.d.ts.map +1 -1
- package/dist/state/store/history-store.d.ts +24 -0
- package/dist/state/store/history-store.d.ts.map +1 -0
- package/dist/state/store/index.d.ts +3 -2
- package/dist/state/store/index.d.ts.map +1 -1
- package/dist/state/store/job-store.d.ts +7 -7
- package/dist/state/store/job-store.d.ts.map +1 -1
- package/dist/state/store/jobs.d.ts +70 -25
- package/dist/state/store/jobs.d.ts.map +1 -1
- package/dist/state/store/leaf-store.d.ts +4 -0
- package/dist/state/store/leaf-store.d.ts.map +1 -1
- package/dist/state/store/note-store.d.ts +7 -7
- package/dist/state/store/note-store.d.ts.map +1 -1
- package/dist/state/store/nullifier-store.d.ts +9 -0
- package/dist/state/store/nullifier-store.d.ts.map +1 -1
- package/dist/state/store/records.d.ts +39 -2
- package/dist/state/store/records.d.ts.map +1 -1
- package/dist/state/store/root-store.d.ts.map +1 -1
- package/dist/state/store/store.d.ts +79 -27
- package/dist/state/store/store.d.ts.map +1 -1
- package/dist/storage/indexeddb.d.ts.map +1 -1
- package/dist/storage/memory.d.ts.map +1 -1
- package/dist/transactions/adapter.d.ts +31 -0
- package/dist/transactions/adapter.d.ts.map +1 -0
- package/dist/transactions/deposit.d.ts +12 -17
- package/dist/transactions/deposit.d.ts.map +1 -1
- package/dist/transactions/index.d.ts +9 -4
- package/dist/transactions/index.d.ts.map +1 -1
- package/dist/transactions/note-selection.d.ts +17 -0
- package/dist/transactions/note-selection.d.ts.map +1 -0
- package/dist/transactions/note-sync.d.ts +5 -33
- package/dist/transactions/note-sync.d.ts.map +1 -1
- package/dist/transactions/reconcile.d.ts +9 -11
- package/dist/transactions/reconcile.d.ts.map +1 -1
- package/dist/transactions/transact.d.ts +30 -27
- package/dist/transactions/transact.d.ts.map +1 -1
- package/dist/transactions/transaction-planner.d.ts +34 -0
- package/dist/transactions/transaction-planner.d.ts.map +1 -0
- package/dist/transactions/transfer-planner.d.ts +37 -0
- package/dist/transactions/transfer-planner.d.ts.map +1 -0
- package/dist/transactions/types/deposit.d.ts +67 -0
- package/dist/transactions/types/deposit.d.ts.map +1 -0
- package/dist/transactions/types/domain.d.ts +70 -0
- package/dist/transactions/types/domain.d.ts.map +1 -0
- package/dist/transactions/types/index.d.ts +18 -0
- package/dist/transactions/types/index.d.ts.map +1 -0
- package/dist/transactions/types/options.d.ts +54 -0
- package/dist/transactions/types/options.d.ts.map +1 -0
- package/dist/transactions/types/planning.d.ts +82 -0
- package/dist/transactions/types/planning.d.ts.map +1 -0
- package/dist/transactions/types/state-stores.d.ts +151 -0
- package/dist/transactions/types/state-stores.d.ts.map +1 -0
- package/dist/transactions/types/transact.d.ts +83 -0
- package/dist/transactions/types/transact.d.ts.map +1 -0
- package/dist/transactions/withdrawal-planner.d.ts +58 -0
- package/dist/transactions/withdrawal-planner.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/tsup.browser.config.d.ts +7 -0
- package/dist/tsup.browser.config.d.ts.map +1 -0
- package/dist/tsup.config.d.ts +8 -0
- package/dist/tsup.config.d.ts.map +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/amounts.d.ts +26 -0
- package/dist/utils/amounts.d.ts.map +1 -0
- package/dist/utils/async.d.ts +9 -0
- package/dist/utils/async.d.ts.map +1 -1
- package/dist/utils/async.js +38 -11
- package/dist/utils/async.js.map +1 -0
- package/dist/utils/bigint.d.ts +0 -2
- package/dist/utils/bigint.d.ts.map +1 -1
- package/dist/utils/format.d.ts +25 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/notes.d.ts +15 -0
- package/dist/utils/notes.d.ts.map +1 -0
- package/dist/utils/polling.d.ts +5 -0
- package/dist/utils/polling.d.ts.map +1 -1
- package/dist/utils/random.d.ts +18 -0
- package/dist/utils/random.d.ts.map +1 -0
- package/dist/utils/signature.d.ts +6 -0
- package/dist/utils/signature.d.ts.map +1 -1
- package/dist/utils/validators.d.ts +21 -10
- package/dist/utils/validators.d.ts.map +1 -1
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/dist/wallet/adapter.d.ts +21 -0
- package/dist/wallet/adapter.d.ts.map +1 -0
- package/dist/wallet/burner/service.d.ts +32 -0
- package/dist/wallet/burner/service.d.ts.map +1 -0
- package/dist/wallet/burner/types.d.ts +47 -0
- package/dist/wallet/burner/types.d.ts.map +1 -0
- package/dist/wallet/index.d.ts +20 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/index.js +9712 -0
- package/dist/wallet/index.js.map +1 -0
- package/dist/wallet/sdk.d.ts +47 -0
- package/dist/wallet/sdk.d.ts.map +1 -0
- package/dist/wallet/types.d.ts +455 -0
- package/dist/wallet/types.d.ts.map +1 -0
- package/dist/wallet/unlink-wallet.d.ts +186 -0
- package/dist/wallet/unlink-wallet.d.ts.map +1 -0
- package/package.json +40 -14
- package/dist/account/zkAccount.d.ts.map +0 -1
- package/dist/account/zkAccount.js +0 -128
- package/dist/clients/broadcaster.js +0 -23
- package/dist/clients/http.js +0 -57
- package/dist/clients/indexer.js +0 -67
- package/dist/config.js +0 -29
- package/dist/core.js +0 -12
- package/dist/errors.js +0 -18
- package/dist/key-derivation/babyjubjub.d.ts +0 -9
- package/dist/key-derivation/babyjubjub.d.ts.map +0 -1
- package/dist/key-derivation/babyjubjub.js +0 -9
- package/dist/key-derivation/bech32.d.ts +0 -22
- package/dist/key-derivation/bech32.d.ts.map +0 -1
- package/dist/key-derivation/bech32.js +0 -86
- package/dist/key-derivation/bip32.d.ts +0 -17
- package/dist/key-derivation/bip32.d.ts.map +0 -1
- package/dist/key-derivation/bip32.js +0 -41
- package/dist/key-derivation/bip39.d.ts +0 -22
- package/dist/key-derivation/bip39.d.ts.map +0 -1
- package/dist/key-derivation/bip39.js +0 -56
- package/dist/key-derivation/bytes.d.ts +0 -19
- package/dist/key-derivation/bytes.d.ts.map +0 -1
- package/dist/key-derivation/bytes.js +0 -92
- package/dist/key-derivation/hash.d.ts +0 -3
- package/dist/key-derivation/hash.d.ts.map +0 -1
- package/dist/key-derivation/hash.js +0 -10
- package/dist/key-derivation/index.d.ts +0 -8
- package/dist/key-derivation/index.d.ts.map +0 -1
- package/dist/key-derivation/index.js +0 -7
- package/dist/key-derivation/wallet-node.d.ts +0 -45
- package/dist/key-derivation/wallet-node.d.ts.map +0 -1
- package/dist/key-derivation/wallet-node.js +0 -109
- package/dist/keys.js +0 -41
- package/dist/prover/config.js +0 -80
- package/dist/prover/index.js +0 -1
- package/dist/prover/prover.js +0 -274
- package/dist/prover/registry.js +0 -57
- package/dist/schema.js +0 -14
- package/dist/state/ciphertext-store.d.ts +0 -12
- package/dist/state/ciphertext-store.d.ts.map +0 -1
- package/dist/state/ciphertext-store.js +0 -25
- package/dist/state/index.js +0 -2
- package/dist/state/leaf-store.d.ts +0 -17
- package/dist/state/leaf-store.d.ts.map +0 -1
- package/dist/state/leaf-store.js +0 -35
- package/dist/state/merkle/hydrator.js +0 -36
- package/dist/state/merkle/index.js +0 -2
- package/dist/state/merkle/merkle-tree.js +0 -104
- package/dist/state/merkle-tree.d.ts +0 -34
- package/dist/state/merkle-tree.d.ts.map +0 -1
- package/dist/state/merkle-tree.js +0 -104
- package/dist/state/note-store.d.ts +0 -37
- package/dist/state/note-store.d.ts.map +0 -1
- package/dist/state/note-store.js +0 -133
- package/dist/state/nullifier-store.d.ts +0 -13
- package/dist/state/nullifier-store.d.ts.map +0 -1
- package/dist/state/nullifier-store.js +0 -21
- package/dist/state/records.d.ts +0 -57
- package/dist/state/records.d.ts.map +0 -1
- package/dist/state/records.js +0 -1
- package/dist/state/root-store.d.ts +0 -13
- package/dist/state/root-store.d.ts.map +0 -1
- package/dist/state/root-store.js +0 -30
- package/dist/state/store/ciphertext-store.js +0 -25
- package/dist/state/store/index.js +0 -8
- package/dist/state/store/job-store.js +0 -118
- package/dist/state/store/jobs.js +0 -1
- package/dist/state/store/leaf-store.js +0 -35
- package/dist/state/store/note-store.js +0 -142
- package/dist/state/store/nullifier-store.js +0 -30
- package/dist/state/store/records.js +0 -1
- package/dist/state/store/root-store.js +0 -30
- package/dist/state/store/store.js +0 -22
- package/dist/state/store.d.ts +0 -26
- package/dist/state/store.d.ts.map +0 -1
- package/dist/state/store.js +0 -19
- package/dist/storage/index.js +0 -2
- package/dist/storage/indexeddb.js +0 -205
- package/dist/storage/memory.js +0 -87
- package/dist/transactions/deposit.js +0 -173
- package/dist/transactions/index.js +0 -4
- package/dist/transactions/note-sync.js +0 -320
- package/dist/transactions/reconcile.js +0 -39
- package/dist/transactions/transact.js +0 -561
- package/dist/transactions/types.d.ts +0 -114
- package/dist/transactions/types.d.ts.map +0 -1
- package/dist/transactions/types.js +0 -1
- package/dist/types.js +0 -1
- package/dist/utils/bigint.js +0 -29
- package/dist/utils/crypto.d.ts +0 -12
- package/dist/utils/crypto.d.ts.map +0 -1
- package/dist/utils/crypto.js +0 -39
- package/dist/utils/json-codec.js +0 -25
- package/dist/utils/polling.js +0 -6
- package/dist/utils/signature.js +0 -12
- package/dist/utils/validators.js +0 -70
|
@@ -1,50 +1,95 @@
|
|
|
1
|
+
import type { HistoryAmount, HistoryKind } from "../../history/types.js";
|
|
2
|
+
import type { SerializedWitness } from "../../transactions/types/domain.js";
|
|
1
3
|
export type JobStatus = "pending" | "submitted" | "broadcasting" | "succeeded" | "failed" | "dead";
|
|
2
|
-
export type
|
|
3
|
-
export type
|
|
4
|
+
export type JobKind = "deposit" | "transfer" | "withdraw" | "adapter";
|
|
5
|
+
export type JobRecordBase = {
|
|
4
6
|
relayId: string;
|
|
5
|
-
kind:
|
|
7
|
+
kind: JobKind;
|
|
6
8
|
chainId: number;
|
|
9
|
+
/** Master public key (hex string) for correlating jobs with history/account views. */
|
|
10
|
+
mpk?: string;
|
|
7
11
|
status: JobStatus;
|
|
8
|
-
broadcasterRelayId?: string | null;
|
|
9
12
|
txHash?: string | null;
|
|
10
13
|
createdAt: number;
|
|
11
14
|
lastCheckedAt?: number;
|
|
12
15
|
timeoutMs: number;
|
|
13
16
|
error?: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Optional history preview so UIs can show pending/failed history rows before notes are indexed.
|
|
19
|
+
* Amount deltas follow HistoryAmount semantics (positive receive, negative send).
|
|
20
|
+
*/
|
|
21
|
+
historyPreview?: {
|
|
22
|
+
kind: HistoryKind;
|
|
23
|
+
amounts: HistoryAmount[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Predicted commitment info for deposits.
|
|
28
|
+
*/
|
|
29
|
+
export type PredictedCommitment = {
|
|
30
|
+
hex: string;
|
|
31
|
+
token: string;
|
|
32
|
+
amount: string;
|
|
33
|
+
index?: number;
|
|
34
|
+
root?: string;
|
|
14
35
|
};
|
|
15
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Record for tracking deposits
|
|
38
|
+
*/
|
|
39
|
+
export type DepositRecord = JobRecordBase & {
|
|
16
40
|
kind: "deposit";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
index?: number;
|
|
20
|
-
root?: string;
|
|
21
|
-
};
|
|
41
|
+
/** Predicted commitments for each note */
|
|
42
|
+
predictedCommitments: PredictedCommitment[];
|
|
22
43
|
};
|
|
23
|
-
export type
|
|
44
|
+
export type TransactContext = {
|
|
24
45
|
index: number;
|
|
25
46
|
nullifier: string;
|
|
26
|
-
witness:
|
|
27
|
-
root: string;
|
|
28
|
-
leaf: string;
|
|
29
|
-
pathElements: string[][];
|
|
30
|
-
pathIndices: number[];
|
|
31
|
-
leafIndex: number;
|
|
32
|
-
};
|
|
47
|
+
witness: SerializedWitness;
|
|
33
48
|
root: string;
|
|
34
49
|
};
|
|
35
|
-
export type
|
|
50
|
+
export type TransactOutput = {
|
|
36
51
|
hex: string;
|
|
37
52
|
index: number;
|
|
38
53
|
root?: string;
|
|
39
54
|
};
|
|
40
|
-
|
|
41
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Individual transaction info within a transact job.
|
|
57
|
+
*/
|
|
58
|
+
export type TransactJobTransaction = {
|
|
59
|
+
token: string;
|
|
60
|
+
nullifiers: string[];
|
|
61
|
+
predictedCommitments: Array<{
|
|
62
|
+
hex: string;
|
|
63
|
+
index?: number;
|
|
64
|
+
}>;
|
|
65
|
+
/** For withdrawals: amount and recipient */
|
|
66
|
+
withdrawal?: {
|
|
67
|
+
amount: string;
|
|
68
|
+
recipient: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
/** Fields shared by transfer and withdraw records */
|
|
72
|
+
type PoolTransactionFields = {
|
|
42
73
|
poolAddress: string;
|
|
43
74
|
calldata: string;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
75
|
+
/** Individual transactions in the batch */
|
|
76
|
+
transactions: TransactJobTransaction[];
|
|
77
|
+
};
|
|
78
|
+
export type TransferRecord = JobRecordBase & PoolTransactionFields & {
|
|
79
|
+
kind: "transfer";
|
|
80
|
+
};
|
|
81
|
+
export type WithdrawRecord = JobRecordBase & PoolTransactionFields & {
|
|
82
|
+
kind: "withdraw";
|
|
83
|
+
};
|
|
84
|
+
export type AdapterRecord = JobRecordBase & PoolTransactionFields & {
|
|
85
|
+
kind: "adapter";
|
|
86
|
+
adapterAddress: string;
|
|
87
|
+
adapterCalldata: string;
|
|
47
88
|
};
|
|
48
|
-
|
|
89
|
+
/** Union of all pool transaction records */
|
|
90
|
+
export type PoolTransactionRecord = TransferRecord | WithdrawRecord | AdapterRecord;
|
|
91
|
+
/** Union of all job records */
|
|
92
|
+
export type JobRecord = DepositRecord | TransferRecord | WithdrawRecord | AdapterRecord;
|
|
49
93
|
export declare const DEFAULT_JOB_TIMEOUT_MS: number;
|
|
94
|
+
export {};
|
|
50
95
|
//# sourceMappingURL=jobs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../../state/store/jobs.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,WAAW,GACX,cAAc,GACd,WAAW,GACX,QAAQ,GACR,MAAM,CAAC;AAEX,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../../state/store/jobs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAE5E,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,WAAW,GACX,cAAc,GACd,WAAW,GACX,QAAQ,GACR,MAAM,C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|
|
11
11
|
getLeaf(chainId: number, index: number): Promise<LeafRecord | null>;
|
|
12
|
+
/**
|
|
13
|
+
* Load all cached leaves for a chain in index order.
|
|
14
|
+
*/
|
|
15
|
+
listLeaves(chainId: number): Promise<LeafRecord[]>;
|
|
12
16
|
/**
|
|
13
17
|
* Remove all cached leaves for a chain.
|
|
14
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leaf-store.d.ts","sourceRoot":"","sources":["../../../state/store/leaf-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO;IAE5C;;OAEG;kBACiB,UAAU;IAM9B;;OAEG;qBACoB,MAAM,SAAS,MAAM;
|
|
1
|
+
{"version":3,"file":"leaf-store.d.ts","sourceRoot":"","sources":["../../../state/store/leaf-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO;IAE5C;;OAEG;kBACiB,UAAU;IAM9B;;OAEG;qBACoB,MAAM,SAAS,MAAM;IAI5C;;OAEG;wBACuB,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAQxD;;OAEG;yBACwB,MAAM;EAQpC"}
|
|
@@ -4,7 +4,9 @@ export declare const emptyBytes: () => Uint8Array<ArrayBuffer>;
|
|
|
4
4
|
export declare function createNoteStore(storage: Storage): {
|
|
5
5
|
/**
|
|
6
6
|
* Upsert a note record and maintain the unspent-note index for fast balance queries.
|
|
7
|
-
* If the note already exists and is marked as spent, preserve the
|
|
7
|
+
* If the note already exists and is marked as spent, preserve spentAt unless the caller
|
|
8
|
+
* provides an explicit spentAt value (eg. upgrading from a local observation time to an
|
|
9
|
+
* on-chain timestamp from the indexer).
|
|
8
10
|
*/
|
|
9
11
|
putNote(note: NoteInsert): Promise<void>;
|
|
10
12
|
/**
|
|
@@ -21,18 +23,16 @@ export declare function createNoteStore(storage: Storage): {
|
|
|
21
23
|
includeSpent?: boolean;
|
|
22
24
|
}): Promise<NoteRecord[]>;
|
|
23
25
|
/**
|
|
24
|
-
* Mark a cached note as spent by setting its timestamp and
|
|
26
|
+
* Mark a cached note as spent by setting its timestamp and transaction hash.
|
|
25
27
|
*/
|
|
26
|
-
markNoteSpent(chainId: number, index: number, spentAt?: number): Promise<NoteRecord>;
|
|
28
|
+
markNoteSpent(chainId: number, index: number, spentAt?: number, spentTxHash?: string): Promise<NoteRecord>;
|
|
27
29
|
/**
|
|
28
30
|
* Drop the spent marker from a cached note, returning it to the unspent index.
|
|
29
31
|
*/
|
|
30
32
|
markNoteUnspent(chainId: number, index: number): Promise<NoteRecord>;
|
|
31
33
|
/**
|
|
32
|
-
*
|
|
34
|
+
* Remove all cached notes and their unspent indices for a chain.
|
|
33
35
|
*/
|
|
34
|
-
|
|
35
|
-
chainId?: number;
|
|
36
|
-
}): Promise<Record<string, bigint>>;
|
|
36
|
+
clearNotes(chainId: number): Promise<void>;
|
|
37
37
|
};
|
|
38
38
|
//# sourceMappingURL=note-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note-store.d.ts","sourceRoot":"","sources":["../../../state/store/note-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"note-store.d.ts","sourceRoot":"","sources":["../../../state/store/note-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAevD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAElE,eAAO,MAAM,UAAU,+BAA0B,CAAC;AAElD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO;IA2D5C;;;;;OAKG;kBACiB,UAAU;IAW9B;;OAEG;qBACoB,MAAM,SAAS,MAAM;IAI5C;;OAEG;wBAEQ;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB;IAkBH;;OAEG;2BAEQ,MAAM,SACR,MAAM,kCAEC,MAAM;IAiBtB;;OAEG;6BAC4B,MAAM,SAAS,MAAM;IAcpD;;OAEG;wBACuB,MAAM;EAmBnC"}
|
|
@@ -13,5 +13,14 @@ export declare function createNullifierStore(storage: Storage): {
|
|
|
13
13
|
* Count all nullifiers stored locally for a given chain.
|
|
14
14
|
*/
|
|
15
15
|
countNullifiers(chainId: number): Promise<number>;
|
|
16
|
+
/**
|
|
17
|
+
* Remove all cached nullifiers for a chain.
|
|
18
|
+
*/
|
|
19
|
+
clearNullifiers(chainId: number): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Remove cached nullifiers whose noteIndex >= fromIndex.
|
|
22
|
+
* Used by partial resync to keep the count-based optimization accurate.
|
|
23
|
+
*/
|
|
24
|
+
clearNullifiersFromIndex(chainId: number, fromIndex: number): Promise<void>;
|
|
16
25
|
};
|
|
17
26
|
//# sourceMappingURL=nullifier-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nullifier-store.d.ts","sourceRoot":"","sources":["../../../state/store/nullifier-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO;IAEjD;;OAEG;4BAC2B,eAAe;IAS7C;;OAEG;0BACyB,MAAM,SAAS,MAAM;
|
|
1
|
+
{"version":3,"file":"nullifier-store.d.ts","sourceRoot":"","sources":["../../../state/store/nullifier-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO;IAEjD;;OAEG;4BAC2B,eAAe;IAS7C;;OAEG;0BACyB,MAAM,SAAS,MAAM;IAIjD;;OAEG;6BAC4B,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvD;;OAEG;6BAC4B,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOrD;;;OAGG;sCAEQ,MAAM,aACJ,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC;EAmBnB"}
|
|
@@ -22,10 +22,33 @@ export type NoteRecord = {
|
|
|
22
22
|
random: string;
|
|
23
23
|
/** Nullifier that will be revealed when the note is spent. */
|
|
24
24
|
nullifier: string;
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Transaction hash that inserted this note commitment on-chain.
|
|
27
|
+
* Derived from the indexer commitment record.
|
|
28
|
+
*/
|
|
29
|
+
createdTxHash?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Indexer event type associated with the commitment insertion.
|
|
32
|
+
* Typically "deposit" or "transact" once supported by the indexer.
|
|
33
|
+
*/
|
|
34
|
+
createdEventType?: string;
|
|
35
|
+
/** Optional timestamp (ms) when this note was created/observed by the indexer. */
|
|
36
|
+
createdAt?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Optional timestamp (ms) when the note was marked as spent.
|
|
39
|
+
* Prefer an on-chain/indexer-derived time when available; otherwise it may be a local observation time.
|
|
40
|
+
*/
|
|
41
|
+
spentAt?: number;
|
|
42
|
+
/** Transaction hash that spent this note (via its nullifier), when known. */
|
|
43
|
+
spentTxHash?: string;
|
|
44
|
+
};
|
|
45
|
+
export type NoteInsert = Omit<NoteRecord, "spentAt"> & {
|
|
46
|
+
/**
|
|
47
|
+
* Optional timestamp (ms) when the note was marked as spent.
|
|
48
|
+
* When omitted, existing spentAt (if any) is preserved by the note store.
|
|
49
|
+
*/
|
|
26
50
|
spentAt?: number;
|
|
27
51
|
};
|
|
28
|
-
export type NoteInsert = Omit<NoteRecord, 'spentAt'>;
|
|
29
52
|
/**
|
|
30
53
|
* Details about a nullifier observed on-chain, whether or not we own the note.
|
|
31
54
|
*/
|
|
@@ -45,6 +68,20 @@ export type LeafRecord = {
|
|
|
45
68
|
index: number;
|
|
46
69
|
/** Commitment value stored in the tree. */
|
|
47
70
|
commitment: string;
|
|
71
|
+
/** Transaction hash that created this commitment. */
|
|
72
|
+
txHash?: string;
|
|
73
|
+
/** Event type: "deposit" or "transact". */
|
|
74
|
+
eventType?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Optional adapter event fields persisted for "adapter_deposit" leaves.
|
|
77
|
+
* Keeping these in local state avoids per-leaf indexer fetches during rescans.
|
|
78
|
+
*/
|
|
79
|
+
adapterNpk?: string;
|
|
80
|
+
adapterToken?: string;
|
|
81
|
+
adapterAmount?: string;
|
|
82
|
+
adapterRandom?: string;
|
|
83
|
+
/** Unix timestamp (seconds) when indexed. */
|
|
84
|
+
insertedAt?: number;
|
|
48
85
|
};
|
|
49
86
|
/**
|
|
50
87
|
* Historical merkle root snapshot used for proof construction.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../../state/store/records.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,UAAU,EAAE,MAA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vD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root-store.d.ts","sourceRoot":"","sources":["../../../state/store/root-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO;IAE5C;;OAEG;kBACiB,UAAU;IAU9B;;OAEG;qBACoB,MAAM,SAAS,MAAM;
|
|
1
|
+
{"version":3,"file":"root-store.d.ts","sourceRoot":"","sources":["../../../state/store/root-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO;IAE5C;;OAEG;kBACiB,UAAU;IAU9B;;OAEG;qBACoB,MAAM,SAAS,MAAM;EAI/C"}
|
|
@@ -1,34 +1,86 @@
|
|
|
1
|
+
import type { HistoryEntry } from "../../history/types.js";
|
|
1
2
|
import type { Storage } from "../../types.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
statuses?: import("./jobs.js").JobStatus[];
|
|
8
|
-
}): Promise<import("./jobs.js").PendingJobRecord[]>;
|
|
9
|
-
deletePendingJob(relayId: string): Promise<void>;
|
|
10
|
-
putCiphertext(chainId: number, index: number, payload: Uint8Array): Promise<void>;
|
|
11
|
-
getCiphertext(chainId: number, index: number): Promise<Uint8Array<ArrayBuffer> | null>;
|
|
12
|
-
putRoot(root: import("./records.js").RootRecord): Promise<void>;
|
|
13
|
-
getRoot(chainId: number, value: string): Promise<import("./records.js").RootRecord | null>;
|
|
14
|
-
putLeaf(leaf: import("./records.js").LeafRecord): Promise<void>;
|
|
15
|
-
getLeaf(chainId: number, index: number): Promise<import("./records.js").LeafRecord | null>;
|
|
16
|
-
clearLeaves(chainId: number): Promise<void>;
|
|
17
|
-
putNullifier(nullifier: import("./records.js").NullifierRecord): Promise<void>;
|
|
18
|
-
getNullifier(chainId: number, value: string): Promise<import("./records.js").NullifierRecord | null>;
|
|
19
|
-
countNullifiers(chainId: number): Promise<number>;
|
|
20
|
-
putNote(note: import("./records.js").NoteInsert): Promise<void>;
|
|
21
|
-
getNote(chainId: number, index: number): Promise<import("./records.js").NoteRecord | null>;
|
|
3
|
+
import type { JobKind, JobRecord, JobStatus } from "./jobs.js";
|
|
4
|
+
import type { LeafRecord, NoteInsert, NoteRecord, NullifierRecord, RootRecord } from "./records.js";
|
|
5
|
+
export interface StateStore {
|
|
6
|
+
putNote(note: NoteInsert): Promise<void>;
|
|
7
|
+
getNote(chainId: number, index: number): Promise<NoteRecord | null>;
|
|
22
8
|
listNotes(options?: {
|
|
23
9
|
chainId?: number;
|
|
24
10
|
mpk?: string;
|
|
25
11
|
token?: string;
|
|
26
12
|
includeSpent?: boolean;
|
|
27
|
-
}): Promise<
|
|
28
|
-
markNoteSpent(chainId: number, index: number, spentAt?: number): Promise<
|
|
29
|
-
markNoteUnspent(chainId: number, index: number): Promise<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
}): Promise<NoteRecord[]>;
|
|
14
|
+
markNoteSpent(chainId: number, index: number, spentAt?: number, spentTxHash?: string): Promise<NoteRecord>;
|
|
15
|
+
markNoteUnspent(chainId: number, index: number): Promise<NoteRecord>;
|
|
16
|
+
clearNotes(chainId: number): Promise<void>;
|
|
17
|
+
putNullifier(nullifier: NullifierRecord): Promise<void>;
|
|
18
|
+
getNullifier(chainId: number, value: string): Promise<NullifierRecord | null>;
|
|
19
|
+
countNullifiers(chainId: number): Promise<number>;
|
|
20
|
+
clearNullifiers(chainId: number): Promise<void>;
|
|
21
|
+
clearNullifiersFromIndex(chainId: number, fromIndex: number): Promise<void>;
|
|
22
|
+
putLeaf(leaf: LeafRecord): Promise<void>;
|
|
23
|
+
getLeaf(chainId: number, index: number): Promise<LeafRecord | null>;
|
|
24
|
+
listLeaves(chainId: number): Promise<LeafRecord[]>;
|
|
25
|
+
clearLeaves(chainId: number): Promise<void>;
|
|
26
|
+
putRoot(root: RootRecord): Promise<void>;
|
|
27
|
+
getRoot(chainId: number, value: string): Promise<RootRecord | null>;
|
|
28
|
+
putCiphertext(chainId: number, index: number, payload: Uint8Array): Promise<void>;
|
|
29
|
+
getCiphertext(chainId: number, index: number): Promise<Uint8Array | null>;
|
|
30
|
+
listCiphertexts(chainId: number): Promise<{
|
|
31
|
+
index: number;
|
|
32
|
+
payload: Uint8Array;
|
|
33
|
+
}[]>;
|
|
34
|
+
clearCiphertexts(chainId: number): Promise<void>;
|
|
35
|
+
putJob(job: JobRecord): Promise<void>;
|
|
36
|
+
getJob(relayId: string): Promise<JobRecord | null>;
|
|
37
|
+
listJobs(filter?: {
|
|
38
|
+
kind?: JobKind;
|
|
39
|
+
statuses?: JobStatus[];
|
|
40
|
+
}): Promise<JobRecord[]>;
|
|
41
|
+
deleteJob(relayId: string): Promise<void>;
|
|
42
|
+
putHistoryEntry(entry: HistoryEntry): Promise<void>;
|
|
43
|
+
hasHistorySnapshot(options: {
|
|
44
|
+
chainId: number;
|
|
45
|
+
mpk: string;
|
|
46
|
+
}): Promise<boolean>;
|
|
47
|
+
listHistoryEntries(options: {
|
|
48
|
+
chainId: number;
|
|
49
|
+
mpk: string;
|
|
50
|
+
}): Promise<HistoryEntry[]>;
|
|
51
|
+
clearHistoryEntries(options: {
|
|
52
|
+
chainId: number;
|
|
53
|
+
mpk: string;
|
|
54
|
+
}): Promise<void>;
|
|
55
|
+
commitHistorySnapshot(options: {
|
|
56
|
+
chainId: number;
|
|
57
|
+
mpk: string;
|
|
58
|
+
}): Promise<void>;
|
|
59
|
+
syncCommitment(params: {
|
|
60
|
+
leaf: LeafRecord;
|
|
61
|
+
ciphertext: {
|
|
62
|
+
chainId: number;
|
|
63
|
+
index: number;
|
|
64
|
+
payload: Uint8Array;
|
|
65
|
+
};
|
|
66
|
+
root: RootRecord;
|
|
67
|
+
note?: NoteRecord;
|
|
68
|
+
}): Promise<void>;
|
|
69
|
+
syncCommitmentBatch(items: Array<{
|
|
70
|
+
leaf: LeafRecord;
|
|
71
|
+
ciphertext: {
|
|
72
|
+
chainId: number;
|
|
73
|
+
index: number;
|
|
74
|
+
payload: Uint8Array;
|
|
75
|
+
};
|
|
76
|
+
root: RootRecord;
|
|
77
|
+
note?: NoteRecord;
|
|
78
|
+
}>): Promise<void>;
|
|
79
|
+
getRescanCursor(chainId: number, mpk: string): Promise<number | null>;
|
|
80
|
+
setRescanCursor(chainId: number, mpk: string, value: number): Promise<void>;
|
|
81
|
+
clearRescanCursors(chainId: number): Promise<void>;
|
|
82
|
+
/** Clear notes, leaves, ciphertexts, and unspent indices for indices >= fromIndex. */
|
|
83
|
+
clearChainDataFromIndex(chainId: number, fromIndex: number): Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
export declare function createStateStore(storage: Storage): StateStore;
|
|
34
86
|
//# sourceMappingURL=store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../state/store/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../state/store/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,KAAK,EAAW,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAKvD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAI/D,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,eAAe,EACf,UAAU,EACX,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,UAAU;IAEzB,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACpE,SAAS,CAAC,OAAO,CAAC,EAAE;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC1B,aAAa,CACX,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC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|
1
|
-
{"version":3,"file":"indexeddb.d.ts","sourceRoot":"","sources":["../../storage/indexeddb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,KAAK,EAAuC,OAAO,EAAE,MAAM,aAAa,CAAC;AAiBhF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;
|
|
1
|
+
{"version":3,"file":"indexeddb.d.ts","sourceRoot":"","sources":["../../storage/indexeddb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,KAAK,EAAuC,OAAO,EAAE,MAAM,aAAa,CAAC;AAiBhF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAmEF,wBAAgB,sBAAsB,CAAC,IAAI,GAAE,gBAAqB,GAAG,OAAO,CAyK3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../storage/memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,EAAuC,OAAO,EAAE,MAAM,aAAa,CAAC;AAI3E,wBAAgB,mBAAmB,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../storage/memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,EAAuC,OAAO,EAAE,MAAM,aAAa,CAAC;AAI3E,wBAAgB,mBAAmB,IAAI,OAAO,CA2E7C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AdapterExecutionCall, AdapterExecutionReshield } from "./transact.js";
|
|
2
|
+
export type { AdapterExecutionCall, AdapterExecutionReshield, } from "./transact.js";
|
|
3
|
+
export declare const ADAPTER_EXECUTE_ABI: readonly ["function execute(bytes _transactData, (address to, bytes data, uint256 value)[] _calls, (uint256 npk, uint256 random, address token, uint256 minAmount)[] _reshields, address[] _inputTokens, uint256 _nonce, uint256 _deadline)"];
|
|
4
|
+
export type BuildCallParams = {
|
|
5
|
+
to: string;
|
|
6
|
+
abi: string;
|
|
7
|
+
functionName: string;
|
|
8
|
+
args: unknown[];
|
|
9
|
+
value?: bigint;
|
|
10
|
+
};
|
|
11
|
+
export type EncodeAdapterExecuteParams = {
|
|
12
|
+
transactCalldata: string;
|
|
13
|
+
calls: AdapterExecutionCall[];
|
|
14
|
+
reshields: AdapterExecutionReshield[];
|
|
15
|
+
inputTokens: string[];
|
|
16
|
+
nonce: bigint;
|
|
17
|
+
deadline: bigint;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Build a single adapter call from ABI metadata.
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildCall(params: BuildCallParams): AdapterExecutionCall;
|
|
23
|
+
/**
|
|
24
|
+
* Build a standard ERC-20 approve call for adapter execution.
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildApproveCall(token: string, spender: string, amount: bigint): AdapterExecutionCall;
|
|
27
|
+
/**
|
|
28
|
+
* Encode `UnlinkAdapter.execute(...)` calldata.
|
|
29
|
+
*/
|
|
30
|
+
export declare function encodeAdapterExecute(params: EncodeAdapterExecuteParams): string;
|
|
31
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../transactions/adapter.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,mBAAmB,+OAEtB,CAAC;AAQX,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,oBAAoB,EAAE,CAAC;IAC9B,SAAS,EAAE,wBAAwB,EAAE,CAAC;IACtC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAgDF;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,oBAAoB,CAoCvE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,oBAAoB,CAetB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,0BAA0B,GACjC,MAAM,CAuBR"}
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export declare function createDepositClient(stateStore: DepositStateStore, options: DepositClientOptions): {
|
|
14
|
-
request(request: DepositRequest): Promise<DepositRelayResult>;
|
|
15
|
-
syncPendingDeposit(relayId: string): Promise<DepositSyncResult>;
|
|
16
|
-
};
|
|
17
|
-
export {};
|
|
1
|
+
import type { BaseStateStore, DepositParams, DepositRelayResult, DepositSyncResult, ServiceOptions } from "./types/index.js";
|
|
2
|
+
export declare const DEPOSIT_ABI: readonly ["function deposit(address _depositor, (uint256 npk, uint256 amount, address token)[] notes, (uint256 ephemeralKey, uint256[3] data)[] ciphertexts) payable"];
|
|
3
|
+
/**
|
|
4
|
+
* Prepare a deposit: compute commitments, build calldata, and persist pending job.
|
|
5
|
+
* Accepts 1 or more notes in a single transaction.
|
|
6
|
+
*/
|
|
7
|
+
export declare function deposit(store: BaseStateStore, req: DepositParams): Promise<DepositRelayResult>;
|
|
8
|
+
/**
|
|
9
|
+
* Wait for all commitments in a deposit to be indexed and update local state.
|
|
10
|
+
* Works for both single and multi-note deposits.
|
|
11
|
+
*/
|
|
12
|
+
export declare function syncDeposit(store: BaseStateStore, relayId: string, opts: ServiceOptions): Promise<DepositSyncResult>;
|
|
18
13
|
//# sourceMappingURL=deposit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deposit.d.ts","sourceRoot":"","sources":["../../transactions/deposit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deposit.d.ts","sourceRoot":"","sources":["../../transactions/deposit.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EAEjB,cAAc,EACf,MAAM,kBAAkB,CAAC;AAE1B,eAAO,MAAM,WAAW,wKAEd,CAAC;AAmEX;;;GAGG;AACH,wBAAsB,OAAO,CAC3B,KAAK,EAAE,cAAc,EACrB,GAAG,EAAE,aAAa,GACjB,OAAO,CAAC,kBAAkB,CAAC,CAgD7B;AAkHD;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,iBAAiB,CAAC,CAiD5B"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { deposit, syncDeposit, DEPOSIT_ABI } from "./deposit.js";
|
|
2
|
+
export { transact, syncTransact, computeBoundParamsHash, computeAdapterDataHash, } from "./transact.js";
|
|
3
|
+
export type { AdapterExecutionCall, AdapterExecutionReshield, } from "./transact.js";
|
|
4
|
+
export { ADAPTER_EXECUTE_ABI, buildApproveCall, buildCall, encodeAdapterExecute, type BuildCallParams, type EncodeAdapterExecuteParams, } from "./adapter.js";
|
|
5
|
+
export { planTransaction } from "./transaction-planner.js";
|
|
6
|
+
export { planWithdrawals, type WithdrawalPlan, type WithdrawalInput, } from "./withdrawal-planner.js";
|
|
7
|
+
export { planTransfers, type TransferInput } from "./transfer-planner.js";
|
|
8
|
+
export { selectNotesForAmount } from "./note-selection.js";
|
|
3
9
|
export { createJobReconciler } from "./reconcile.js";
|
|
4
10
|
export { createNoteSyncService } from "./note-sync.js";
|
|
5
|
-
export type { NoteSyncStateStore } from "./
|
|
6
|
-
export type { DepositRelayResult, DepositNoteInput, DepositRequest, DepositSyncResult, DepositStateStore, Proof, OutputNoteInput, SpendNoteReference, TransactRelayResult, TransactRequest, TransactSyncResult, TransactStateStore, WithdrawalNoteInput, } from "./types.js";
|
|
11
|
+
export type { BaseStateStore, TransactStateStore, NoteSyncStateStore, PollingOptions, ServiceOptions, NoteSyncOptions, Proof, Ciphertext, NoteInput, WithdrawalNoteInput, SpendNoteReference, SerializedWitness, DepositParams, DepositRelayResult, DepositSyncResult, DepositCommitmentInfo, TransactParams, TransactItem, TransactRelayResult, TransactItemResult, TransactSyncResult, Recipient, PlannedOutput, TransactionPlan, SelectableNote, SelectionOptions, SelectionResult, } from "./types/index.js";
|
|
7
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../transactions/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../transactions/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,0BAA0B,GAChC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EACL,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,YAAY,EAEV,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAGlB,cAAc,EACd,cAAc,EACd,eAAe,EAGf,KAAK,EACL,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAGjB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EAGrB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAGlB,SAAS,EACT,aAAa,EACb,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,eAAe,GAChB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SelectableNote, SelectionOptions, SelectionResult } from "./types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Select notes for a transaction with consolidation-first strategy.
|
|
4
|
+
*
|
|
5
|
+
* Priorities:
|
|
6
|
+
* 1. Consolidation - prefer spending more small notes
|
|
7
|
+
* 2. Minimize change - find combinations with less overshoot
|
|
8
|
+
* 3. Respect maxInputs constraint
|
|
9
|
+
*
|
|
10
|
+
* @param notes - Available unspent notes (caller filters by token)
|
|
11
|
+
* @param totalNeeded - Total amount needed for all recipients
|
|
12
|
+
* @param options - Selection options
|
|
13
|
+
* @returns Selection result with notes and amounts
|
|
14
|
+
* @throws ValidationError if insufficient balance or constraints can't be met
|
|
15
|
+
*/
|
|
16
|
+
export declare function selectNotesForAmount<T>(notes: SelectableNote<T>[], totalNeeded: bigint, options?: SelectionOptions): SelectionResult<T>;
|
|
17
|
+
//# sourceMappingURL=note-selection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"note-selection.d.ts","sourceRoot":"","sources":["../../transactions/note-selection.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAyB1B;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,EAC1B,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,gBAAgB,GACzB,eAAe,CAAC,CAAC,CAAC,CAuEpB"}
|
|
@@ -1,46 +1,18 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
import { type LeafRecord, type LocalMerkleTrees, type NoteRecord, type RootRecord } from "../state/index.js";
|
|
5
|
-
export type NoteSyncStateStore = {
|
|
6
|
-
putLeaf(record: LeafRecord): Promise<void>;
|
|
7
|
-
getLeaf(chainId: number, index: number): Promise<LeafRecord | null>;
|
|
8
|
-
clearLeaves(chainId: number): Promise<void>;
|
|
9
|
-
putRoot(record: RootRecord): Promise<void>;
|
|
10
|
-
putNote(record: NoteRecord): Promise<void>;
|
|
11
|
-
getNote(chainId: number, index: number): Promise<NoteRecord | null>;
|
|
12
|
-
markNoteSpent(chainId: number, index: number, spentAt?: number): Promise<NoteRecord>;
|
|
13
|
-
putCiphertext(chainId: number, index: number, payload: Uint8Array): Promise<void>;
|
|
14
|
-
countNullifiers(chainId: number): Promise<number>;
|
|
15
|
-
putNullifier(record: {
|
|
16
|
-
chainId: number;
|
|
17
|
-
nullifier: string;
|
|
18
|
-
noteIndex?: number;
|
|
19
|
-
}): Promise<void>;
|
|
20
|
-
};
|
|
21
|
-
export type NoteSyncOptions = {
|
|
22
|
-
merkleTrees?: LocalMerkleTrees;
|
|
23
|
-
indexerClient?: ReturnType<typeof createIndexerClient>;
|
|
24
|
-
fetch?: FetchLike;
|
|
25
|
-
limit?: number;
|
|
26
|
-
};
|
|
1
|
+
import type { AccountView } from "../account/account.js";
|
|
2
|
+
import type { NoteSyncOptions, NoteSyncStateStore } from "./types/index.js";
|
|
3
|
+
export type { NoteSyncOptions, NoteSyncStateStore };
|
|
27
4
|
type ChainSyncStatus = {
|
|
28
5
|
inFlight: boolean;
|
|
29
6
|
lastSuccess: number | null;
|
|
30
7
|
lastError?: string;
|
|
31
8
|
};
|
|
32
9
|
export declare function createNoteSyncService(stateStore: NoteSyncStateStore, options?: NoteSyncOptions): {
|
|
33
|
-
|
|
34
|
-
start?: number;
|
|
35
|
-
forceFullScan?: boolean;
|
|
36
|
-
}) => Promise<NoteRecord[]>;
|
|
37
|
-
syncChain: (chainId: number, account: ZkAccount, opts?: {
|
|
10
|
+
syncChain: (chainId: number, account: AccountView, opts?: {
|
|
38
11
|
forceFullResync?: boolean;
|
|
39
12
|
}) => Promise<void>;
|
|
40
|
-
syncChains: (chainIds: number[], account:
|
|
13
|
+
syncChains: (chainIds: number[], account: AccountView, opts?: {
|
|
41
14
|
forceFullResync?: boolean;
|
|
42
15
|
}) => Promise<void>;
|
|
43
16
|
getStatus: () => Map<number, ChainSyncStatus>;
|
|
44
17
|
};
|
|
45
|
-
export {};
|
|
46
18
|
//# sourceMappingURL=note-sync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"note-sync.d.ts","sourceRoot":"","sources":["../../transactions/note-sync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"note-sync.d.ts","sourceRoot":"","sources":["../../transactions/note-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAmBzD,OAAO,KAAK,EAEV,eAAe,EACf,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAI1B,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC;AAEpD,KAAK,eAAe,GAAG;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAuCF,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,kBAAkB,EAC9B,OAAO,GAAE,eAAoB;yBAuqBlB,MAAM,WACN,WAAW,SACd;QAAE,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,KAClC,OAAO,CAAC,IAAI,CAAC;2BAoGJ,MAAM,EAAE,WACT,WAAW,SACb;QAAE,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,KACnC,OAAO,CAAC,IAAI,CAAC;;EAejB"}
|