@ocash/sdk 0.1.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 +4 -0
- package/assets/.gitkeep +1 -0
- package/dist/browser.cjs +6422 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +92 -0
- package/dist/browser.d.ts +92 -0
- package/dist/browser.js +6363 -0
- package/dist/browser.js.map +1 -0
- package/dist/index-DgLBElAG.d.cts +1692 -0
- package/dist/index-DgLBElAG.d.ts +1692 -0
- package/dist/index.cjs +6054 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5996 -0
- package/dist/index.js.map +1 -0
- package/dist/node.cjs +6406 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +89 -0
- package/dist/node.d.ts +89 -0
- package/dist/node.js +6347 -0
- package/dist/node.js.map +1 -0
- package/package.json +86 -0
|
@@ -0,0 +1,92 @@
|
|
|
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-DgLBElAG.cjs';
|
|
2
|
+
export { A as App_ABI, i as AssetOverrideEntry, j as AssetsOverride, B as BABYJUBJUB_SCALAR_FIELD, C as ChainConfigInput, k as CommitmentData, l as CryptoToolkit, D as DepositOperation, m as DepositOperationDetail, n as DummyFactory, o as ERC20_ABI, K as KeyManager, p as KeyValueClient, q as KeyValueStore, r as KeyValueStoreOptions, s as LedgerInfo, t as MemoKit, u as MemoryStore, v as MerkleLeafRecord, w as OCashSdk, x as OCashSdkConfig, y as OperationCreateInput, z as OperationStatus, F as OpsApi, P as PlannerEstimateTransferResult, G as PlannerEstimateWithdrawResult, I as ProofResult, R as RedisStore, J as RedisStoreOptions, N as RelayerRequest, Q as SdkEvent, T as SqliteStore, V as SqliteStoreOptions, W as SyncChainStatus, X as TokenMetadata, Y as TransactionReceipt, Z as TransferOperation, _ as TransferOperationDetail, $ as TransferWitnessInput, a0 as Utils, a1 as WalletSessionInput, a2 as WithdrawOperation, a3 as WithdrawOperationDetail, a4 as WithdrawWitnessInput, a5 as WitnessBuildResult, a6 as WitnessContext, a7 as assertChainConfigInput, a8 as assertTokenList, a9 as assertTokenMetadata, aa as calcTransferProofBinding, ab as calcWithdrawProofBinding, ac as createSdk, ad as default, ae as defaultAssetsOverride, af as fetchPoolTokensFromContract, ag as normalizeTokenMetadata } from './index-DgLBElAG.cjs';
|
|
3
|
+
import 'viem';
|
|
4
|
+
|
|
5
|
+
type IndexedDbStoreOptions = {
|
|
6
|
+
dbName?: string;
|
|
7
|
+
storeName?: string;
|
|
8
|
+
indexedDb?: IDBFactory;
|
|
9
|
+
maxOperations?: number;
|
|
10
|
+
};
|
|
11
|
+
declare class IndexedDbStore implements StorageAdapter {
|
|
12
|
+
private readonly options;
|
|
13
|
+
private walletId;
|
|
14
|
+
private readonly cursors;
|
|
15
|
+
private readonly utxos;
|
|
16
|
+
private operations;
|
|
17
|
+
private merkleLeaves;
|
|
18
|
+
private merkleTrees;
|
|
19
|
+
private merkleNodes;
|
|
20
|
+
private entryMemos;
|
|
21
|
+
private entryNullifiers;
|
|
22
|
+
private db;
|
|
23
|
+
private saveChain;
|
|
24
|
+
private readonly maxOperations;
|
|
25
|
+
constructor(options?: IndexedDbStoreOptions);
|
|
26
|
+
init(options?: {
|
|
27
|
+
walletId?: string;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
close(): Promise<void>;
|
|
30
|
+
private storeName;
|
|
31
|
+
private openDb;
|
|
32
|
+
private stateId;
|
|
33
|
+
private load;
|
|
34
|
+
private save;
|
|
35
|
+
getMerkleNode(chainId: number, id: string): Promise<MerkleNodeRecord | undefined>;
|
|
36
|
+
upsertMerkleNodes(chainId: number, nodes: MerkleNodeRecord[]): Promise<void>;
|
|
37
|
+
clearMerkleNodes(chainId: number): Promise<void>;
|
|
38
|
+
getMerkleTree(chainId: number): Promise<MerkleTreeState | undefined>;
|
|
39
|
+
setMerkleTree(chainId: number, tree: MerkleTreeState): Promise<void>;
|
|
40
|
+
clearMerkleTree(chainId: number): Promise<void>;
|
|
41
|
+
upsertEntryMemos(memos: EntryMemoRecord[]): Promise<number>;
|
|
42
|
+
listEntryMemos(query: ListEntryMemosQuery): Promise<{
|
|
43
|
+
total: number;
|
|
44
|
+
rows: EntryMemoRecord[];
|
|
45
|
+
}>;
|
|
46
|
+
clearEntryMemos(chainId: number): Promise<void>;
|
|
47
|
+
upsertEntryNullifiers(nullifiers: EntryNullifierRecord[]): Promise<number>;
|
|
48
|
+
listEntryNullifiers(query: ListEntryNullifiersQuery): Promise<{
|
|
49
|
+
total: number;
|
|
50
|
+
rows: EntryNullifierRecord[];
|
|
51
|
+
}>;
|
|
52
|
+
clearEntryNullifiers(chainId: number): Promise<void>;
|
|
53
|
+
getMerkleLeaves(chainId: number): Promise<Array<{
|
|
54
|
+
cid: number;
|
|
55
|
+
commitment: Hex;
|
|
56
|
+
}> | undefined>;
|
|
57
|
+
getMerkleLeaf(chainId: number, cid: number): Promise<{
|
|
58
|
+
chainId: number;
|
|
59
|
+
cid: number;
|
|
60
|
+
commitment: `0x${string}`;
|
|
61
|
+
} | undefined>;
|
|
62
|
+
appendMerkleLeaves(chainId: number, leaves: Array<{
|
|
63
|
+
cid: number;
|
|
64
|
+
commitment: Hex;
|
|
65
|
+
}>): Promise<void>;
|
|
66
|
+
clearMerkleLeaves(chainId: number): Promise<void>;
|
|
67
|
+
getSyncCursor(chainId: number): Promise<SyncCursor | undefined>;
|
|
68
|
+
setSyncCursor(chainId: number, cursor: SyncCursor): Promise<void>;
|
|
69
|
+
upsertUtxos(utxos: UtxoRecord[]): Promise<void>;
|
|
70
|
+
listUtxos(query?: ListUtxosQuery): Promise<{
|
|
71
|
+
total: number;
|
|
72
|
+
rows: UtxoRecord[];
|
|
73
|
+
}>;
|
|
74
|
+
markSpent(input: {
|
|
75
|
+
chainId: number;
|
|
76
|
+
nullifiers: Hex[];
|
|
77
|
+
}): Promise<number>;
|
|
78
|
+
createOperation<TType extends OperationType>(input: Omit<StoredOperation<OperationDetailFor<TType>>, 'id' | 'createdAt' | 'status'> & Partial<Pick<StoredOperation<OperationDetailFor<TType>>, 'createdAt' | 'id' | 'status'>> & {
|
|
79
|
+
type: TType;
|
|
80
|
+
}): StoredOperation<OperationDetailFor<TType>> & {
|
|
81
|
+
type: TType;
|
|
82
|
+
};
|
|
83
|
+
updateOperation(id: string, patch: Partial<StoredOperation>): void;
|
|
84
|
+
deleteOperation(id: string): boolean;
|
|
85
|
+
clearOperations(): void;
|
|
86
|
+
pruneOperations(options?: {
|
|
87
|
+
max?: number;
|
|
88
|
+
}): number;
|
|
89
|
+
listOperations(input?: number | ListOperationsQuery): StoredOperation[];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { EntryMemoRecord, EntryNullifierRecord, Hex, IndexedDbStore, type IndexedDbStoreOptions, ListEntryMemosQuery, ListEntryNullifiersQuery, ListOperationsQuery, ListUtxosQuery, MerkleNodeRecord, MerkleTreeState, OperationType, StorageAdapter, StoredOperation, SyncCursor, UtxoRecord };
|
|
@@ -0,0 +1,92 @@
|
|
|
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-DgLBElAG.js';
|
|
2
|
+
export { A as App_ABI, i as AssetOverrideEntry, j as AssetsOverride, B as BABYJUBJUB_SCALAR_FIELD, C as ChainConfigInput, k as CommitmentData, l as CryptoToolkit, D as DepositOperation, m as DepositOperationDetail, n as DummyFactory, o as ERC20_ABI, K as KeyManager, p as KeyValueClient, q as KeyValueStore, r as KeyValueStoreOptions, s as LedgerInfo, t as MemoKit, u as MemoryStore, v as MerkleLeafRecord, w as OCashSdk, x as OCashSdkConfig, y as OperationCreateInput, z as OperationStatus, F as OpsApi, P as PlannerEstimateTransferResult, G as PlannerEstimateWithdrawResult, I as ProofResult, R as RedisStore, J as RedisStoreOptions, N as RelayerRequest, Q as SdkEvent, T as SqliteStore, V as SqliteStoreOptions, W as SyncChainStatus, X as TokenMetadata, Y as TransactionReceipt, Z as TransferOperation, _ as TransferOperationDetail, $ as TransferWitnessInput, a0 as Utils, a1 as WalletSessionInput, a2 as WithdrawOperation, a3 as WithdrawOperationDetail, a4 as WithdrawWitnessInput, a5 as WitnessBuildResult, a6 as WitnessContext, a7 as assertChainConfigInput, a8 as assertTokenList, a9 as assertTokenMetadata, aa as calcTransferProofBinding, ab as calcWithdrawProofBinding, ac as createSdk, ad as default, ae as defaultAssetsOverride, af as fetchPoolTokensFromContract, ag as normalizeTokenMetadata } from './index-DgLBElAG.js';
|
|
3
|
+
import 'viem';
|
|
4
|
+
|
|
5
|
+
type IndexedDbStoreOptions = {
|
|
6
|
+
dbName?: string;
|
|
7
|
+
storeName?: string;
|
|
8
|
+
indexedDb?: IDBFactory;
|
|
9
|
+
maxOperations?: number;
|
|
10
|
+
};
|
|
11
|
+
declare class IndexedDbStore implements StorageAdapter {
|
|
12
|
+
private readonly options;
|
|
13
|
+
private walletId;
|
|
14
|
+
private readonly cursors;
|
|
15
|
+
private readonly utxos;
|
|
16
|
+
private operations;
|
|
17
|
+
private merkleLeaves;
|
|
18
|
+
private merkleTrees;
|
|
19
|
+
private merkleNodes;
|
|
20
|
+
private entryMemos;
|
|
21
|
+
private entryNullifiers;
|
|
22
|
+
private db;
|
|
23
|
+
private saveChain;
|
|
24
|
+
private readonly maxOperations;
|
|
25
|
+
constructor(options?: IndexedDbStoreOptions);
|
|
26
|
+
init(options?: {
|
|
27
|
+
walletId?: string;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
close(): Promise<void>;
|
|
30
|
+
private storeName;
|
|
31
|
+
private openDb;
|
|
32
|
+
private stateId;
|
|
33
|
+
private load;
|
|
34
|
+
private save;
|
|
35
|
+
getMerkleNode(chainId: number, id: string): Promise<MerkleNodeRecord | undefined>;
|
|
36
|
+
upsertMerkleNodes(chainId: number, nodes: MerkleNodeRecord[]): Promise<void>;
|
|
37
|
+
clearMerkleNodes(chainId: number): Promise<void>;
|
|
38
|
+
getMerkleTree(chainId: number): Promise<MerkleTreeState | undefined>;
|
|
39
|
+
setMerkleTree(chainId: number, tree: MerkleTreeState): Promise<void>;
|
|
40
|
+
clearMerkleTree(chainId: number): Promise<void>;
|
|
41
|
+
upsertEntryMemos(memos: EntryMemoRecord[]): Promise<number>;
|
|
42
|
+
listEntryMemos(query: ListEntryMemosQuery): Promise<{
|
|
43
|
+
total: number;
|
|
44
|
+
rows: EntryMemoRecord[];
|
|
45
|
+
}>;
|
|
46
|
+
clearEntryMemos(chainId: number): Promise<void>;
|
|
47
|
+
upsertEntryNullifiers(nullifiers: EntryNullifierRecord[]): Promise<number>;
|
|
48
|
+
listEntryNullifiers(query: ListEntryNullifiersQuery): Promise<{
|
|
49
|
+
total: number;
|
|
50
|
+
rows: EntryNullifierRecord[];
|
|
51
|
+
}>;
|
|
52
|
+
clearEntryNullifiers(chainId: number): Promise<void>;
|
|
53
|
+
getMerkleLeaves(chainId: number): Promise<Array<{
|
|
54
|
+
cid: number;
|
|
55
|
+
commitment: Hex;
|
|
56
|
+
}> | undefined>;
|
|
57
|
+
getMerkleLeaf(chainId: number, cid: number): Promise<{
|
|
58
|
+
chainId: number;
|
|
59
|
+
cid: number;
|
|
60
|
+
commitment: `0x${string}`;
|
|
61
|
+
} | undefined>;
|
|
62
|
+
appendMerkleLeaves(chainId: number, leaves: Array<{
|
|
63
|
+
cid: number;
|
|
64
|
+
commitment: Hex;
|
|
65
|
+
}>): Promise<void>;
|
|
66
|
+
clearMerkleLeaves(chainId: number): Promise<void>;
|
|
67
|
+
getSyncCursor(chainId: number): Promise<SyncCursor | undefined>;
|
|
68
|
+
setSyncCursor(chainId: number, cursor: SyncCursor): Promise<void>;
|
|
69
|
+
upsertUtxos(utxos: UtxoRecord[]): Promise<void>;
|
|
70
|
+
listUtxos(query?: ListUtxosQuery): Promise<{
|
|
71
|
+
total: number;
|
|
72
|
+
rows: UtxoRecord[];
|
|
73
|
+
}>;
|
|
74
|
+
markSpent(input: {
|
|
75
|
+
chainId: number;
|
|
76
|
+
nullifiers: Hex[];
|
|
77
|
+
}): Promise<number>;
|
|
78
|
+
createOperation<TType extends OperationType>(input: Omit<StoredOperation<OperationDetailFor<TType>>, 'id' | 'createdAt' | 'status'> & Partial<Pick<StoredOperation<OperationDetailFor<TType>>, 'createdAt' | 'id' | 'status'>> & {
|
|
79
|
+
type: TType;
|
|
80
|
+
}): StoredOperation<OperationDetailFor<TType>> & {
|
|
81
|
+
type: TType;
|
|
82
|
+
};
|
|
83
|
+
updateOperation(id: string, patch: Partial<StoredOperation>): void;
|
|
84
|
+
deleteOperation(id: string): boolean;
|
|
85
|
+
clearOperations(): void;
|
|
86
|
+
pruneOperations(options?: {
|
|
87
|
+
max?: number;
|
|
88
|
+
}): number;
|
|
89
|
+
listOperations(input?: number | ListOperationsQuery): StoredOperation[];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { EntryMemoRecord, EntryNullifierRecord, Hex, IndexedDbStore, type IndexedDbStoreOptions, ListEntryMemosQuery, ListEntryNullifiersQuery, ListOperationsQuery, ListUtxosQuery, MerkleNodeRecord, MerkleTreeState, OperationType, StorageAdapter, StoredOperation, SyncCursor, UtxoRecord };
|