@ocash/sdk 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +159 -2
- package/dist/browser.cjs +3473 -680
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +127 -15
- package/dist/browser.d.ts +127 -15
- package/dist/browser.js +3434 -650
- package/dist/browser.js.map +1 -1
- package/dist/{index-DgLBElAG.d.cts → index-CI7UllxU.d.cts} +1613 -136
- package/dist/{index-DgLBElAG.d.ts → index-CI7UllxU.d.ts} +1613 -136
- package/dist/index.cjs +3106 -497
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3074 -474
- package/dist/index.js.map +1 -1
- package/dist/node.cjs +4151 -549
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +234 -6
- package/dist/node.d.ts +234 -6
- package/dist/node.js +4119 -527
- package/dist/node.js.map +1 -1
- package/package.json +27 -3
package/dist/browser.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as StorageAdapter, M as MerkleNodeRecord, a as MerkleTreeState, E as EntryMemoRecord, L as ListEntryMemosQuery, b as EntryNullifierRecord, c as ListEntryNullifiersQuery, H as Hex, d as SyncCursor, U as UtxoRecord, e as ListUtxosQuery, O as OperationType, f as StoredOperation, g as OperationDetailFor, h as ListOperationsQuery } from './index-
|
|
2
|
-
export { A as App_ABI,
|
|
1
|
+
import { S as StorageAdapter, M as MerkleNodeRecord, a as MerkleTreeState, E as EntryMemoRecord, L as ListEntryMemosQuery, b as EntryNullifierRecord, c as ListEntryNullifiersQuery, H as Hex, d as SyncCursor, U as UtxoRecord, e as ListUtxosQuery, O as OperationType, f as StoredOperation, g as OperationDetailFor, h as OperationStatus, i as ListOperationsQuery } from './index-CI7UllxU.cjs';
|
|
2
|
+
export { A as App_ABI, j as AssetOverrideEntry, k as AssetsOverride, B as BABYJUBJUB_SCALAR_FIELD, l as BASE_DEV, m as BASE_MAINNET, n as BSC_DEV, o as BSC_MAINNET, p as BSC_TESTNET, q as BSC_TESTNET_DEV, C as ChainConfigInput, r as CommitmentData, s as CryptoToolkit, D as DepositOperation, t as DepositOperationDetail, u as DummyFactory, v as ETH_DEV, w as ETH_MAINNET, K as KeyManager, x as KeyValueClient, y as KeyValueStore, z as KeyValueStoreOptions, F as LedgerInfo, G as MemoKit, I as MemoryStore, J as MerkleLeafRecord, N as OCashSdk, P as OCashSdkConfig, Q as OperationCreateInput, R as OpsApi, T as PlannerEstimateTransferResult, V as PlannerEstimateWithdrawResult, W as ProofResult, X as RedisStore, Y as RedisStoreOptions, Z as RelayerRequest, _ as SEPOLIA_DEV, $ as SEPOLIA_TESTNET, a0 as SdkEvent, a1 as SyncChainStatus, a2 as TokenMetadata, a3 as TransactionReceipt, a4 as TransferOperation, a5 as TransferOperationDetail, a6 as TransferWitnessInput, a7 as Utils, a8 as WalletSessionInput, a9 as WithdrawOperation, aa as WithdrawOperationDetail, ab as WithdrawWitnessInput, ac as WitnessBuildResult, ad as WitnessContext, ae as assertChainConfigInput, af as assertTokenList, ag as assertTokenMetadata, ah as calcTransferProofBinding, ai as calcWithdrawProofBinding, aj as createSdk, ak as default, al as defaultAssetsOverrideMainnet, am as defaultAssetsOverrideTestnet, an as fetchPoolTokensFromContract, ao as normalizeTokenMetadata } from './index-CI7UllxU.cjs';
|
|
3
3
|
import 'viem';
|
|
4
4
|
|
|
5
5
|
type IndexedDbStoreOptions = {
|
|
@@ -8,85 +8,197 @@ type IndexedDbStoreOptions = {
|
|
|
8
8
|
indexedDb?: IDBFactory;
|
|
9
9
|
maxOperations?: number;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* IndexedDB-backed StorageAdapter for browser environments.
|
|
13
|
+
*/
|
|
11
14
|
declare class IndexedDbStore implements StorageAdapter {
|
|
12
15
|
private readonly options;
|
|
16
|
+
private static readonly DB_VERSION;
|
|
13
17
|
private walletId;
|
|
14
18
|
private readonly cursors;
|
|
15
|
-
private readonly utxos;
|
|
16
19
|
private operations;
|
|
17
|
-
private merkleLeaves;
|
|
18
20
|
private merkleTrees;
|
|
19
|
-
private merkleNodes;
|
|
20
|
-
private entryMemos;
|
|
21
|
-
private entryNullifiers;
|
|
22
21
|
private db;
|
|
23
|
-
private saveChain;
|
|
24
22
|
private readonly maxOperations;
|
|
23
|
+
/**
|
|
24
|
+
* Create an IndexedDbStore with optional database settings.
|
|
25
|
+
*/
|
|
25
26
|
constructor(options?: IndexedDbStoreOptions);
|
|
27
|
+
/**
|
|
28
|
+
* Initialize store for a wallet id and load persisted state.
|
|
29
|
+
*/
|
|
26
30
|
init(options?: {
|
|
27
31
|
walletId?: string;
|
|
28
32
|
}): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Close the DB connection and clear handle.
|
|
35
|
+
*/
|
|
29
36
|
close(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve base object store name (default: ocash_store).
|
|
39
|
+
*/
|
|
30
40
|
private storeName;
|
|
41
|
+
private walletKey;
|
|
42
|
+
private storeDefs;
|
|
31
43
|
private openDb;
|
|
32
|
-
private
|
|
44
|
+
private storeNames;
|
|
45
|
+
private getAll;
|
|
46
|
+
private getAllByIndex;
|
|
47
|
+
private getByKey;
|
|
48
|
+
private getByKeys;
|
|
49
|
+
private putMany;
|
|
50
|
+
private deleteByKeys;
|
|
51
|
+
private deleteAllByIndex;
|
|
52
|
+
/**
|
|
53
|
+
* Load persisted state into memory and normalize it.
|
|
54
|
+
*/
|
|
33
55
|
private load;
|
|
34
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Get a merkle node by id.
|
|
58
|
+
*/
|
|
35
59
|
getMerkleNode(chainId: number, id: string): Promise<MerkleNodeRecord | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* Upsert merkle nodes and persist.
|
|
62
|
+
*/
|
|
36
63
|
upsertMerkleNodes(chainId: number, nodes: MerkleNodeRecord[]): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Clear merkle nodes for a chain.
|
|
66
|
+
*/
|
|
37
67
|
clearMerkleNodes(chainId: number): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Get persisted merkle tree metadata for a chain.
|
|
70
|
+
*/
|
|
38
71
|
getMerkleTree(chainId: number): Promise<MerkleTreeState | undefined>;
|
|
72
|
+
/**
|
|
73
|
+
* Persist merkle tree metadata for a chain.
|
|
74
|
+
*/
|
|
39
75
|
setMerkleTree(chainId: number, tree: MerkleTreeState): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Clear merkle tree metadata for a chain.
|
|
78
|
+
*/
|
|
40
79
|
clearMerkleTree(chainId: number): Promise<void>;
|
|
41
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Upsert entry memos and persist.
|
|
82
|
+
*/
|
|
83
|
+
upsertEntryMemos(memos: EntryMemoRecord[]): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* List entry memos with query filtering and pagination.
|
|
86
|
+
*/
|
|
42
87
|
listEntryMemos(query: ListEntryMemosQuery): Promise<{
|
|
43
88
|
total: number;
|
|
44
89
|
rows: EntryMemoRecord[];
|
|
45
90
|
}>;
|
|
91
|
+
/**
|
|
92
|
+
* Clear entry memo cache for a chain.
|
|
93
|
+
*/
|
|
46
94
|
clearEntryMemos(chainId: number): Promise<void>;
|
|
47
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Upsert entry nullifiers and persist.
|
|
97
|
+
*/
|
|
98
|
+
upsertEntryNullifiers(nullifiers: EntryNullifierRecord[]): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* List entry nullifiers with query filtering and pagination.
|
|
101
|
+
*/
|
|
48
102
|
listEntryNullifiers(query: ListEntryNullifiersQuery): Promise<{
|
|
49
103
|
total: number;
|
|
50
104
|
rows: EntryNullifierRecord[];
|
|
51
105
|
}>;
|
|
106
|
+
/**
|
|
107
|
+
* Clear entry nullifier cache for a chain.
|
|
108
|
+
*/
|
|
52
109
|
clearEntryNullifiers(chainId: number): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Get persisted merkle leaves for a chain.
|
|
112
|
+
*/
|
|
53
113
|
getMerkleLeaves(chainId: number): Promise<Array<{
|
|
54
114
|
cid: number;
|
|
55
115
|
commitment: Hex;
|
|
56
116
|
}> | undefined>;
|
|
117
|
+
/**
|
|
118
|
+
* Get a merkle leaf by cid.
|
|
119
|
+
*/
|
|
57
120
|
getMerkleLeaf(chainId: number, cid: number): Promise<{
|
|
58
121
|
chainId: number;
|
|
59
122
|
cid: number;
|
|
60
123
|
commitment: `0x${string}`;
|
|
61
124
|
} | undefined>;
|
|
125
|
+
/**
|
|
126
|
+
* Append contiguous merkle leaves and persist.
|
|
127
|
+
*/
|
|
62
128
|
appendMerkleLeaves(chainId: number, leaves: Array<{
|
|
63
129
|
cid: number;
|
|
64
130
|
commitment: Hex;
|
|
65
131
|
}>): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Clear merkle leaves for a chain.
|
|
134
|
+
*/
|
|
66
135
|
clearMerkleLeaves(chainId: number): Promise<void>;
|
|
136
|
+
/**
|
|
137
|
+
* Get persisted sync cursor for a chain.
|
|
138
|
+
*/
|
|
67
139
|
getSyncCursor(chainId: number): Promise<SyncCursor | undefined>;
|
|
140
|
+
/**
|
|
141
|
+
* Set persisted sync cursor for a chain.
|
|
142
|
+
*/
|
|
68
143
|
setSyncCursor(chainId: number, cursor: SyncCursor): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Upsert UTXOs and persist.
|
|
146
|
+
*/
|
|
69
147
|
upsertUtxos(utxos: UtxoRecord[]): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* List UTXOs with query filtering and pagination.
|
|
150
|
+
*/
|
|
70
151
|
listUtxos(query?: ListUtxosQuery): Promise<{
|
|
71
152
|
total: number;
|
|
72
153
|
rows: UtxoRecord[];
|
|
73
154
|
}>;
|
|
155
|
+
/**
|
|
156
|
+
* Mark UTXOs as spent by nullifier and persist.
|
|
157
|
+
*/
|
|
74
158
|
markSpent(input: {
|
|
75
159
|
chainId: number;
|
|
76
160
|
nullifiers: Hex[];
|
|
77
161
|
}): Promise<number>;
|
|
162
|
+
/**
|
|
163
|
+
* Create and persist an operation record.
|
|
164
|
+
*/
|
|
78
165
|
createOperation<TType extends OperationType>(input: Omit<StoredOperation<OperationDetailFor<TType>>, 'id' | 'createdAt' | 'status'> & Partial<Pick<StoredOperation<OperationDetailFor<TType>>, 'createdAt' | 'id' | 'status'>> & {
|
|
79
166
|
type: TType;
|
|
80
|
-
}):
|
|
81
|
-
|
|
167
|
+
}): {
|
|
168
|
+
id: string;
|
|
169
|
+
createdAt: number;
|
|
170
|
+
status: OperationStatus;
|
|
171
|
+
type: OperationType & TType;
|
|
172
|
+
chainId?: number | undefined;
|
|
173
|
+
tokenId?: string | undefined;
|
|
174
|
+
requestUrl?: string | undefined;
|
|
175
|
+
relayerTxHash?: `0x${string}` | undefined;
|
|
176
|
+
txHash?: `0x${string}` | undefined;
|
|
177
|
+
detail?: OperationDetailFor<TType> | undefined;
|
|
178
|
+
error?: string | undefined;
|
|
82
179
|
};
|
|
180
|
+
/**
|
|
181
|
+
* Update an operation record and persist.
|
|
182
|
+
*/
|
|
83
183
|
updateOperation(id: string, patch: Partial<StoredOperation>): void;
|
|
184
|
+
/**
|
|
185
|
+
* Delete an operation record and persist.
|
|
186
|
+
*/
|
|
84
187
|
deleteOperation(id: string): boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Clear all operations and persist.
|
|
190
|
+
*/
|
|
85
191
|
clearOperations(): void;
|
|
192
|
+
/**
|
|
193
|
+
* Prune operations to a maximum count and persist.
|
|
194
|
+
*/
|
|
86
195
|
pruneOperations(options?: {
|
|
87
196
|
max?: number;
|
|
88
197
|
}): number;
|
|
198
|
+
/**
|
|
199
|
+
* List operations with filtering/pagination.
|
|
200
|
+
*/
|
|
89
201
|
listOperations(input?: number | ListOperationsQuery): StoredOperation[];
|
|
90
202
|
}
|
|
91
203
|
|
|
92
|
-
export { EntryMemoRecord, EntryNullifierRecord, Hex, IndexedDbStore, type IndexedDbStoreOptions, ListEntryMemosQuery, ListEntryNullifiersQuery, ListOperationsQuery, ListUtxosQuery, MerkleNodeRecord, MerkleTreeState, OperationType, StorageAdapter, StoredOperation, SyncCursor, UtxoRecord };
|
|
204
|
+
export { EntryMemoRecord, EntryNullifierRecord, Hex, IndexedDbStore, type IndexedDbStoreOptions, ListEntryMemosQuery, ListEntryNullifiersQuery, ListOperationsQuery, ListUtxosQuery, MerkleNodeRecord, MerkleTreeState, OperationStatus, OperationType, StorageAdapter, StoredOperation, SyncCursor, UtxoRecord };
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as StorageAdapter, M as MerkleNodeRecord, a as MerkleTreeState, E as EntryMemoRecord, L as ListEntryMemosQuery, b as EntryNullifierRecord, c as ListEntryNullifiersQuery, H as Hex, d as SyncCursor, U as UtxoRecord, e as ListUtxosQuery, O as OperationType, f as StoredOperation, g as OperationDetailFor, h as ListOperationsQuery } from './index-
|
|
2
|
-
export { A as App_ABI,
|
|
1
|
+
import { S as StorageAdapter, M as MerkleNodeRecord, a as MerkleTreeState, E as EntryMemoRecord, L as ListEntryMemosQuery, b as EntryNullifierRecord, c as ListEntryNullifiersQuery, H as Hex, d as SyncCursor, U as UtxoRecord, e as ListUtxosQuery, O as OperationType, f as StoredOperation, g as OperationDetailFor, h as OperationStatus, i as ListOperationsQuery } from './index-CI7UllxU.js';
|
|
2
|
+
export { A as App_ABI, j as AssetOverrideEntry, k as AssetsOverride, B as BABYJUBJUB_SCALAR_FIELD, l as BASE_DEV, m as BASE_MAINNET, n as BSC_DEV, o as BSC_MAINNET, p as BSC_TESTNET, q as BSC_TESTNET_DEV, C as ChainConfigInput, r as CommitmentData, s as CryptoToolkit, D as DepositOperation, t as DepositOperationDetail, u as DummyFactory, v as ETH_DEV, w as ETH_MAINNET, K as KeyManager, x as KeyValueClient, y as KeyValueStore, z as KeyValueStoreOptions, F as LedgerInfo, G as MemoKit, I as MemoryStore, J as MerkleLeafRecord, N as OCashSdk, P as OCashSdkConfig, Q as OperationCreateInput, R as OpsApi, T as PlannerEstimateTransferResult, V as PlannerEstimateWithdrawResult, W as ProofResult, X as RedisStore, Y as RedisStoreOptions, Z as RelayerRequest, _ as SEPOLIA_DEV, $ as SEPOLIA_TESTNET, a0 as SdkEvent, a1 as SyncChainStatus, a2 as TokenMetadata, a3 as TransactionReceipt, a4 as TransferOperation, a5 as TransferOperationDetail, a6 as TransferWitnessInput, a7 as Utils, a8 as WalletSessionInput, a9 as WithdrawOperation, aa as WithdrawOperationDetail, ab as WithdrawWitnessInput, ac as WitnessBuildResult, ad as WitnessContext, ae as assertChainConfigInput, af as assertTokenList, ag as assertTokenMetadata, ah as calcTransferProofBinding, ai as calcWithdrawProofBinding, aj as createSdk, ak as default, al as defaultAssetsOverrideMainnet, am as defaultAssetsOverrideTestnet, an as fetchPoolTokensFromContract, ao as normalizeTokenMetadata } from './index-CI7UllxU.js';
|
|
3
3
|
import 'viem';
|
|
4
4
|
|
|
5
5
|
type IndexedDbStoreOptions = {
|
|
@@ -8,85 +8,197 @@ type IndexedDbStoreOptions = {
|
|
|
8
8
|
indexedDb?: IDBFactory;
|
|
9
9
|
maxOperations?: number;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* IndexedDB-backed StorageAdapter for browser environments.
|
|
13
|
+
*/
|
|
11
14
|
declare class IndexedDbStore implements StorageAdapter {
|
|
12
15
|
private readonly options;
|
|
16
|
+
private static readonly DB_VERSION;
|
|
13
17
|
private walletId;
|
|
14
18
|
private readonly cursors;
|
|
15
|
-
private readonly utxos;
|
|
16
19
|
private operations;
|
|
17
|
-
private merkleLeaves;
|
|
18
20
|
private merkleTrees;
|
|
19
|
-
private merkleNodes;
|
|
20
|
-
private entryMemos;
|
|
21
|
-
private entryNullifiers;
|
|
22
21
|
private db;
|
|
23
|
-
private saveChain;
|
|
24
22
|
private readonly maxOperations;
|
|
23
|
+
/**
|
|
24
|
+
* Create an IndexedDbStore with optional database settings.
|
|
25
|
+
*/
|
|
25
26
|
constructor(options?: IndexedDbStoreOptions);
|
|
27
|
+
/**
|
|
28
|
+
* Initialize store for a wallet id and load persisted state.
|
|
29
|
+
*/
|
|
26
30
|
init(options?: {
|
|
27
31
|
walletId?: string;
|
|
28
32
|
}): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Close the DB connection and clear handle.
|
|
35
|
+
*/
|
|
29
36
|
close(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve base object store name (default: ocash_store).
|
|
39
|
+
*/
|
|
30
40
|
private storeName;
|
|
41
|
+
private walletKey;
|
|
42
|
+
private storeDefs;
|
|
31
43
|
private openDb;
|
|
32
|
-
private
|
|
44
|
+
private storeNames;
|
|
45
|
+
private getAll;
|
|
46
|
+
private getAllByIndex;
|
|
47
|
+
private getByKey;
|
|
48
|
+
private getByKeys;
|
|
49
|
+
private putMany;
|
|
50
|
+
private deleteByKeys;
|
|
51
|
+
private deleteAllByIndex;
|
|
52
|
+
/**
|
|
53
|
+
* Load persisted state into memory and normalize it.
|
|
54
|
+
*/
|
|
33
55
|
private load;
|
|
34
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Get a merkle node by id.
|
|
58
|
+
*/
|
|
35
59
|
getMerkleNode(chainId: number, id: string): Promise<MerkleNodeRecord | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* Upsert merkle nodes and persist.
|
|
62
|
+
*/
|
|
36
63
|
upsertMerkleNodes(chainId: number, nodes: MerkleNodeRecord[]): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Clear merkle nodes for a chain.
|
|
66
|
+
*/
|
|
37
67
|
clearMerkleNodes(chainId: number): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Get persisted merkle tree metadata for a chain.
|
|
70
|
+
*/
|
|
38
71
|
getMerkleTree(chainId: number): Promise<MerkleTreeState | undefined>;
|
|
72
|
+
/**
|
|
73
|
+
* Persist merkle tree metadata for a chain.
|
|
74
|
+
*/
|
|
39
75
|
setMerkleTree(chainId: number, tree: MerkleTreeState): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Clear merkle tree metadata for a chain.
|
|
78
|
+
*/
|
|
40
79
|
clearMerkleTree(chainId: number): Promise<void>;
|
|
41
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Upsert entry memos and persist.
|
|
82
|
+
*/
|
|
83
|
+
upsertEntryMemos(memos: EntryMemoRecord[]): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* List entry memos with query filtering and pagination.
|
|
86
|
+
*/
|
|
42
87
|
listEntryMemos(query: ListEntryMemosQuery): Promise<{
|
|
43
88
|
total: number;
|
|
44
89
|
rows: EntryMemoRecord[];
|
|
45
90
|
}>;
|
|
91
|
+
/**
|
|
92
|
+
* Clear entry memo cache for a chain.
|
|
93
|
+
*/
|
|
46
94
|
clearEntryMemos(chainId: number): Promise<void>;
|
|
47
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Upsert entry nullifiers and persist.
|
|
97
|
+
*/
|
|
98
|
+
upsertEntryNullifiers(nullifiers: EntryNullifierRecord[]): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* List entry nullifiers with query filtering and pagination.
|
|
101
|
+
*/
|
|
48
102
|
listEntryNullifiers(query: ListEntryNullifiersQuery): Promise<{
|
|
49
103
|
total: number;
|
|
50
104
|
rows: EntryNullifierRecord[];
|
|
51
105
|
}>;
|
|
106
|
+
/**
|
|
107
|
+
* Clear entry nullifier cache for a chain.
|
|
108
|
+
*/
|
|
52
109
|
clearEntryNullifiers(chainId: number): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Get persisted merkle leaves for a chain.
|
|
112
|
+
*/
|
|
53
113
|
getMerkleLeaves(chainId: number): Promise<Array<{
|
|
54
114
|
cid: number;
|
|
55
115
|
commitment: Hex;
|
|
56
116
|
}> | undefined>;
|
|
117
|
+
/**
|
|
118
|
+
* Get a merkle leaf by cid.
|
|
119
|
+
*/
|
|
57
120
|
getMerkleLeaf(chainId: number, cid: number): Promise<{
|
|
58
121
|
chainId: number;
|
|
59
122
|
cid: number;
|
|
60
123
|
commitment: `0x${string}`;
|
|
61
124
|
} | undefined>;
|
|
125
|
+
/**
|
|
126
|
+
* Append contiguous merkle leaves and persist.
|
|
127
|
+
*/
|
|
62
128
|
appendMerkleLeaves(chainId: number, leaves: Array<{
|
|
63
129
|
cid: number;
|
|
64
130
|
commitment: Hex;
|
|
65
131
|
}>): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Clear merkle leaves for a chain.
|
|
134
|
+
*/
|
|
66
135
|
clearMerkleLeaves(chainId: number): Promise<void>;
|
|
136
|
+
/**
|
|
137
|
+
* Get persisted sync cursor for a chain.
|
|
138
|
+
*/
|
|
67
139
|
getSyncCursor(chainId: number): Promise<SyncCursor | undefined>;
|
|
140
|
+
/**
|
|
141
|
+
* Set persisted sync cursor for a chain.
|
|
142
|
+
*/
|
|
68
143
|
setSyncCursor(chainId: number, cursor: SyncCursor): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Upsert UTXOs and persist.
|
|
146
|
+
*/
|
|
69
147
|
upsertUtxos(utxos: UtxoRecord[]): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* List UTXOs with query filtering and pagination.
|
|
150
|
+
*/
|
|
70
151
|
listUtxos(query?: ListUtxosQuery): Promise<{
|
|
71
152
|
total: number;
|
|
72
153
|
rows: UtxoRecord[];
|
|
73
154
|
}>;
|
|
155
|
+
/**
|
|
156
|
+
* Mark UTXOs as spent by nullifier and persist.
|
|
157
|
+
*/
|
|
74
158
|
markSpent(input: {
|
|
75
159
|
chainId: number;
|
|
76
160
|
nullifiers: Hex[];
|
|
77
161
|
}): Promise<number>;
|
|
162
|
+
/**
|
|
163
|
+
* Create and persist an operation record.
|
|
164
|
+
*/
|
|
78
165
|
createOperation<TType extends OperationType>(input: Omit<StoredOperation<OperationDetailFor<TType>>, 'id' | 'createdAt' | 'status'> & Partial<Pick<StoredOperation<OperationDetailFor<TType>>, 'createdAt' | 'id' | 'status'>> & {
|
|
79
166
|
type: TType;
|
|
80
|
-
}):
|
|
81
|
-
|
|
167
|
+
}): {
|
|
168
|
+
id: string;
|
|
169
|
+
createdAt: number;
|
|
170
|
+
status: OperationStatus;
|
|
171
|
+
type: OperationType & TType;
|
|
172
|
+
chainId?: number | undefined;
|
|
173
|
+
tokenId?: string | undefined;
|
|
174
|
+
requestUrl?: string | undefined;
|
|
175
|
+
relayerTxHash?: `0x${string}` | undefined;
|
|
176
|
+
txHash?: `0x${string}` | undefined;
|
|
177
|
+
detail?: OperationDetailFor<TType> | undefined;
|
|
178
|
+
error?: string | undefined;
|
|
82
179
|
};
|
|
180
|
+
/**
|
|
181
|
+
* Update an operation record and persist.
|
|
182
|
+
*/
|
|
83
183
|
updateOperation(id: string, patch: Partial<StoredOperation>): void;
|
|
184
|
+
/**
|
|
185
|
+
* Delete an operation record and persist.
|
|
186
|
+
*/
|
|
84
187
|
deleteOperation(id: string): boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Clear all operations and persist.
|
|
190
|
+
*/
|
|
85
191
|
clearOperations(): void;
|
|
192
|
+
/**
|
|
193
|
+
* Prune operations to a maximum count and persist.
|
|
194
|
+
*/
|
|
86
195
|
pruneOperations(options?: {
|
|
87
196
|
max?: number;
|
|
88
197
|
}): number;
|
|
198
|
+
/**
|
|
199
|
+
* List operations with filtering/pagination.
|
|
200
|
+
*/
|
|
89
201
|
listOperations(input?: number | ListOperationsQuery): StoredOperation[];
|
|
90
202
|
}
|
|
91
203
|
|
|
92
|
-
export { EntryMemoRecord, EntryNullifierRecord, Hex, IndexedDbStore, type IndexedDbStoreOptions, ListEntryMemosQuery, ListEntryNullifiersQuery, ListOperationsQuery, ListUtxosQuery, MerkleNodeRecord, MerkleTreeState, OperationType, StorageAdapter, StoredOperation, SyncCursor, UtxoRecord };
|
|
204
|
+
export { EntryMemoRecord, EntryNullifierRecord, Hex, IndexedDbStore, type IndexedDbStoreOptions, ListEntryMemosQuery, ListEntryNullifiersQuery, ListOperationsQuery, ListUtxosQuery, MerkleNodeRecord, MerkleTreeState, OperationStatus, OperationType, StorageAdapter, StoredOperation, SyncCursor, UtxoRecord };
|