@veil-cash/sdk 0.6.2 → 0.6.4

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/index.d.cts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Buffer } from 'buffer';
1
2
  import MerkleTree from 'fixed-merkle-tree-legacy';
2
3
 
3
4
  /**
@@ -73,6 +74,80 @@ declare class Utxo {
73
74
  static decrypt(data: string, keypair: Keypair): Utxo;
74
75
  }
75
76
 
77
+ /**
78
+ * ZK Proof generation for Veil SDK
79
+ * Uses snarkjs groth16 to generate proofs for transactions
80
+ */
81
+ /**
82
+ * Input data for ZK proof generation
83
+ */
84
+ interface ProofInput {
85
+ root: bigint;
86
+ inputNullifier: bigint[];
87
+ outputCommitment: bigint[];
88
+ publicAmount: string;
89
+ extDataHash: bigint;
90
+ inAmount: bigint[];
91
+ inPrivateKey: (string | null)[];
92
+ inBlinding: bigint[];
93
+ inPathIndices: number[];
94
+ inPathElements: (bigint | number)[][];
95
+ outAmount: bigint[];
96
+ outBlinding: bigint[];
97
+ outPubkey: bigint[];
98
+ }
99
+ /**
100
+ * Directory/base URL where proving keys are hosted, or a resolver that returns
101
+ * the circuit base path without the `.wasm` / `.zkey` extension.
102
+ */
103
+ type ProvingKeyPath = string | ((circuitName: string) => string);
104
+ interface ProveOptions {
105
+ /**
106
+ * Proving key location.
107
+ *
108
+ * In Node this defaults to the package/source `keys` directory. In browsers
109
+ * this defaults to `/keys`, so apps can serve `/keys/transaction2.wasm` and
110
+ * `/keys/transaction2.zkey` from their own origin.
111
+ */
112
+ provingKeyPath?: ProvingKeyPath;
113
+ /** Force snarkjs single-threaded proving. Defaults to true. */
114
+ singleThread?: boolean;
115
+ }
116
+ /**
117
+ * Generate a ZK proof for a transaction
118
+ *
119
+ * @param input - Proof input data
120
+ * @param circuitName - Circuit name (e.g., 'transaction2' or 'transaction16')
121
+ * @returns Serialized proof as hex string
122
+ *
123
+ * @example
124
+ * ```typescript
125
+ * const proof = await prove(proofInput, 'transaction2');
126
+ * // Returns: 0x1234...abcd (256 bytes hex)
127
+ * ```
128
+ */
129
+ declare function prove(input: ProofInput, circuitName: string, options?: ProveOptions): Promise<string>;
130
+ /**
131
+ * Get the supported circuit names and their max input counts
132
+ */
133
+ declare const CIRCUIT_CONFIG: {
134
+ readonly transaction2: {
135
+ readonly maxInputs: 2;
136
+ readonly maxOutputs: 2;
137
+ };
138
+ readonly transaction16: {
139
+ readonly maxInputs: 16;
140
+ readonly maxOutputs: 2;
141
+ };
142
+ };
143
+ /**
144
+ * Select the appropriate circuit based on input count
145
+ *
146
+ * @param inputCount - Number of input UTXOs
147
+ * @returns Circuit name to use
148
+ */
149
+ declare function selectCircuit(inputCount: number): string;
150
+
76
151
  /**
77
152
  * Type definitions for Veil SDK
78
153
  */
@@ -274,6 +349,13 @@ interface BuildWithdrawProofOptions {
274
349
  pool?: RelayPool;
275
350
  /** Optional RPC URL */
276
351
  rpcUrl?: string;
352
+ /**
353
+ * Optional proving key directory/base URL or resolver.
354
+ *
355
+ * Browsers default to `/keys`, expecting files like
356
+ * `/keys/transaction2.wasm` and `/keys/transaction2.zkey`.
357
+ */
358
+ provingKeyPath?: ProvingKeyPath;
277
359
  /** Progress callback */
278
360
  onProgress?: (stage: string, detail?: string) => void;
279
361
  }
@@ -291,6 +373,13 @@ interface BuildTransferProofOptions {
291
373
  pool?: RelayPool;
292
374
  /** Optional RPC URL */
293
375
  rpcUrl?: string;
376
+ /**
377
+ * Optional proving key directory/base URL or resolver.
378
+ *
379
+ * Browsers default to `/keys`, expecting files like
380
+ * `/keys/transaction2.wasm` and `/keys/transaction2.zkey`.
381
+ */
382
+ provingKeyPath?: ProvingKeyPath;
294
383
  /** Progress callback */
295
384
  onProgress?: (stage: string, detail?: string) => void;
296
385
  }
@@ -485,6 +574,13 @@ interface SubaccountMergeOptions {
485
574
  rpcUrl?: string;
486
575
  /** Optional relay URL */
487
576
  relayUrl?: string;
577
+ /**
578
+ * Optional proving key directory/base URL or resolver.
579
+ *
580
+ * Browsers default to `/keys`, expecting files like
581
+ * `/keys/transaction2.wasm` and `/keys/transaction2.zkey`.
582
+ */
583
+ provingKeyPath?: ProvingKeyPath;
488
584
  /** Progress callback */
489
585
  onProgress?: (stage: string, detail?: string) => void;
490
586
  }
@@ -818,6 +914,31 @@ declare function getQueueBalance(options: {
818
914
  rpcUrl?: string;
819
915
  onProgress?: ProgressCallback;
820
916
  }): Promise<QueueBalanceResult>;
917
+ /**
918
+ * Get remaining daily free deposits for an address.
919
+ * Returns 0 if the queue contract has not been upgraded to V3 yet
920
+ * or if the daily free feature is disabled.
921
+ *
922
+ * @param options - Query options
923
+ * @param options.address - Depositor address to check
924
+ * @param options.pool - Pool identifier ('eth' or 'usdc', default: 'eth')
925
+ * @param options.rpcUrl - Optional RPC URL
926
+ * @returns Number of free deposits remaining today
927
+ *
928
+ * @example
929
+ * ```typescript
930
+ * const remaining = await getDailyFreeRemaining({
931
+ * address: '0x...',
932
+ * pool: 'eth',
933
+ * });
934
+ * console.log(`Free deposits left today: ${remaining}`);
935
+ * ```
936
+ */
937
+ declare function getDailyFreeRemaining(options: {
938
+ address: `0x${string}`;
939
+ pool?: RelayPool;
940
+ rpcUrl?: string;
941
+ }): Promise<number>;
821
942
  /**
822
943
  * Get private balance from the Pool contract
823
944
  * Decrypts all encrypted outputs, calculates nullifiers, and checks spent status
@@ -906,11 +1027,6 @@ declare function buildWithdrawProof(options: BuildWithdrawProofOptions): Promise
906
1027
  */
907
1028
  declare function withdraw(options: BuildWithdrawProofOptions): Promise<WithdrawResult>;
908
1029
 
909
- /**
910
- * Transfer functions for Veil SDK
911
- * Build ZK proofs to transfer funds privately within the pool
912
- */
913
-
914
1030
  /**
915
1031
  * Check if a recipient is registered and get their deposit key
916
1032
  *
@@ -997,6 +1113,7 @@ declare function mergeUtxos(options: {
997
1113
  keypair: Keypair;
998
1114
  pool?: RelayPool;
999
1115
  rpcUrl?: string;
1116
+ provingKeyPath?: ProvingKeyPath;
1000
1117
  onProgress?: (stage: string, detail?: string) => void;
1001
1118
  }): Promise<TransferResult>;
1002
1119
 
@@ -1052,6 +1169,8 @@ interface PrepareTransactionParams {
1052
1169
  relayer?: string | bigint | number;
1053
1170
  /** Optional progress callback */
1054
1171
  onProgress?: (stage: string, detail?: string) => void;
1172
+ /** Optional proving key directory/base URL or circuit path resolver */
1173
+ provingKeyPath?: ProvingKeyPath;
1055
1174
  }
1056
1175
  /**
1057
1176
  * Prepare a transaction (withdrawal or transfer)
@@ -1083,7 +1202,7 @@ interface PrepareTransactionParams {
1083
1202
  * });
1084
1203
  * ```
1085
1204
  */
1086
- declare function prepareTransaction({ commitments, inputs, outputs, fee, recipient, relayer, onProgress, }: PrepareTransactionParams): Promise<TransactionResult>;
1205
+ declare function prepareTransaction({ commitments, inputs, outputs, fee, recipient, relayer, onProgress, provingKeyPath, }: PrepareTransactionParams): Promise<TransactionResult>;
1087
1206
 
1088
1207
  /**
1089
1208
  * Merkle tree utilities for Veil SDK
@@ -1121,63 +1240,6 @@ declare function getMerklePath(tree: MerkleTree, commitment: bigint | string): {
1121
1240
  pathIndices: number;
1122
1241
  };
1123
1242
 
1124
- /**
1125
- * ZK Proof generation for Veil SDK
1126
- * Uses snarkjs groth16 to generate proofs for transactions
1127
- */
1128
- /**
1129
- * Input data for ZK proof generation
1130
- */
1131
- interface ProofInput {
1132
- root: bigint;
1133
- inputNullifier: bigint[];
1134
- outputCommitment: bigint[];
1135
- publicAmount: string;
1136
- extDataHash: bigint;
1137
- inAmount: bigint[];
1138
- inPrivateKey: (string | null)[];
1139
- inBlinding: bigint[];
1140
- inPathIndices: number[];
1141
- inPathElements: (bigint | number)[][];
1142
- outAmount: bigint[];
1143
- outBlinding: bigint[];
1144
- outPubkey: bigint[];
1145
- }
1146
- /**
1147
- * Generate a ZK proof for a transaction
1148
- *
1149
- * @param input - Proof input data
1150
- * @param circuitName - Circuit name (e.g., 'transaction2' or 'transaction16')
1151
- * @returns Serialized proof as hex string
1152
- *
1153
- * @example
1154
- * ```typescript
1155
- * const proof = await prove(proofInput, 'transaction2');
1156
- * // Returns: 0x1234...abcd (256 bytes hex)
1157
- * ```
1158
- */
1159
- declare function prove(input: ProofInput, circuitName: string): Promise<string>;
1160
- /**
1161
- * Get the supported circuit names and their max input counts
1162
- */
1163
- declare const CIRCUIT_CONFIG: {
1164
- readonly transaction2: {
1165
- readonly maxInputs: 2;
1166
- readonly maxOutputs: 2;
1167
- };
1168
- readonly transaction16: {
1169
- readonly maxInputs: 16;
1170
- readonly maxOutputs: 2;
1171
- };
1172
- };
1173
- /**
1174
- * Select the appropriate circuit based on input count
1175
- *
1176
- * @param inputCount - Number of input UTXOs
1177
- * @returns Circuit name to use
1178
- */
1179
- declare function selectCircuit(inputCount: number): string;
1180
-
1181
1243
  /**
1182
1244
  * Contract addresses for Veil on Base
1183
1245
  */
@@ -1648,6 +1710,18 @@ declare const QUEUE_ABI: readonly [{
1648
1710
  }];
1649
1711
  readonly stateMutability: "view";
1650
1712
  readonly type: "function";
1713
+ }, {
1714
+ readonly inputs: readonly [{
1715
+ readonly name: "_depositor";
1716
+ readonly type: "address";
1717
+ }];
1718
+ readonly name: "getDailyFreeRemaining";
1719
+ readonly outputs: readonly [{
1720
+ readonly name: "remaining";
1721
+ readonly type: "uint256";
1722
+ }];
1723
+ readonly stateMutability: "view";
1724
+ readonly type: "function";
1651
1725
  }];
1652
1726
  /**
1653
1727
  * ETH Pool Contract ABI
@@ -2714,6 +2788,7 @@ declare function mergeSubaccount(options: SubaccountMergeOptions): Promise<Subac
2714
2788
  * Crypto utilities for Veil SDK
2715
2789
  * Poseidon hash, hex conversion, and random number generation
2716
2790
  */
2791
+
2717
2792
  /**
2718
2793
  * SNARK scalar field size
2719
2794
  */
@@ -2779,4 +2854,4 @@ declare function getExtDataHash(extData: ExtDataInput): bigint;
2779
2854
  */
2780
2855
  declare function shuffle<T>(array: T[]): T[];
2781
2856
 
2782
- export { ADDRESSES, type BuildTransferProofOptions, type BuildWithdrawProofOptions, CIRCUIT_CONFIG, type DepositTxOptions, ENTRY_ABI, ERC20_ABI, type EncryptedMessage, type ExtData, type ExtDataInput, FIELD_SIZE, FORWARDER_ABI, FORWARDER_CONTRACT_VERSION, FORWARDER_FACTORY_ABI, Keypair, MAX_SUBACCOUNT_SLOTS, MERKLE_TREE_HEIGHT, type MessageSigner, type NetworkAddresses, POOL_ABI, POOL_CONFIG, type PendingDeposit, type PoolConfig, type PrepareTransactionParams, type PrivateBalanceResult, type ProgressCallback, type ProofArgs, type ProofBuildResult, type ProofInput, QUEUE_ABI, type QueueBalanceResult, type RegisterTxOptions, RelayError, type RelayErrorResponse, type RelayExtData, type RelayMetadata, type RelayPool, type RelayProofArgs, type RelayRequest, type RelayResponse, type RelayType, type SubaccountAsset, type SubaccountAssetBalance, type SubaccountBalances, type SubaccountDeployRequest, type SubaccountMergeOptions, type SubaccountMergeResult, type SubaccountPrivateBalanceStatus, type SubaccountPrivateBalances, type SubaccountQueueStatus, type SubaccountRecoveryResult, type SubaccountRelayResult, type SubaccountSlot, type SubaccountStatusResult, type SubaccountSweepRequest, type SubaccountWithdrawTypedData, type SubmitRelayOptions, type Token, type TransactionData, type TransactionResult, type TransferResult, Utxo, type UtxoInfo, type UtxoParams, type UtxoSelectionResult, VEIL_SIGNED_MESSAGE, type WithdrawResult, buildApproveUSDCTx, buildChangeDepositKeyTx, buildDepositETHTx, buildDepositTx, buildDepositUSDCTx, buildMerkleTree, buildRegisterTx, buildSubaccountRecoveryTx, buildSubaccountWithdrawTypedData, buildTransferProof, buildWithdrawProof, checkRecipientRegistration, checkRelayHealth, deploySubaccountForwarder, deriveSubaccountChildDepositKey, deriveSubaccountChildOwner, deriveSubaccountChildPrivateKey, deriveSubaccountSalt, deriveSubaccountSlot, findNextSubaccountWithdrawNonce, getAddresses, getExtDataHash, getForwarderFactoryAddress, getMerklePath, getPoolAddress, getPrivateBalance, getQueueAddress, getQueueBalance, getRelayInfo, getRelayUrl, getSubaccountPrivateBalance, getSubaccountStatus, isSubaccountForwarderDeployed, isSubaccountWithdrawNonceUsed, mergeSubaccount, mergeUtxos, packEncryptedMessage, poseidonHash, poseidonHash2, predictSubaccountForwarder, prepareTransaction, prove, randomBN, selectCircuit, selectUtxosForWithdraw, shuffle, signSubaccountWithdraw, submitRelay, sweepSubaccountForwarder, toBuffer, toFixedHex, transfer, unpackEncryptedMessage, withdraw };
2857
+ export { ADDRESSES, type BuildTransferProofOptions, type BuildWithdrawProofOptions, CIRCUIT_CONFIG, type DepositTxOptions, ENTRY_ABI, ERC20_ABI, type EncryptedMessage, type ExtData, type ExtDataInput, FIELD_SIZE, FORWARDER_ABI, FORWARDER_CONTRACT_VERSION, FORWARDER_FACTORY_ABI, Keypair, MAX_SUBACCOUNT_SLOTS, MERKLE_TREE_HEIGHT, type MessageSigner, type NetworkAddresses, POOL_ABI, POOL_CONFIG, type PendingDeposit, type PoolConfig, type PrepareTransactionParams, type PrivateBalanceResult, type ProgressCallback, type ProofArgs, type ProofBuildResult, type ProofInput, type ProveOptions, type ProvingKeyPath, QUEUE_ABI, type QueueBalanceResult, type RegisterTxOptions, RelayError, type RelayErrorResponse, type RelayExtData, type RelayMetadata, type RelayPool, type RelayProofArgs, type RelayRequest, type RelayResponse, type RelayType, type SubaccountAsset, type SubaccountAssetBalance, type SubaccountBalances, type SubaccountDeployRequest, type SubaccountMergeOptions, type SubaccountMergeResult, type SubaccountPrivateBalanceStatus, type SubaccountPrivateBalances, type SubaccountQueueStatus, type SubaccountRecoveryResult, type SubaccountRelayResult, type SubaccountSlot, type SubaccountStatusResult, type SubaccountSweepRequest, type SubaccountWithdrawTypedData, type SubmitRelayOptions, type Token, type TransactionData, type TransactionResult, type TransferResult, Utxo, type UtxoInfo, type UtxoParams, type UtxoSelectionResult, VEIL_SIGNED_MESSAGE, type WithdrawResult, buildApproveUSDCTx, buildChangeDepositKeyTx, buildDepositETHTx, buildDepositTx, buildDepositUSDCTx, buildMerkleTree, buildRegisterTx, buildSubaccountRecoveryTx, buildSubaccountWithdrawTypedData, buildTransferProof, buildWithdrawProof, checkRecipientRegistration, checkRelayHealth, deploySubaccountForwarder, deriveSubaccountChildDepositKey, deriveSubaccountChildOwner, deriveSubaccountChildPrivateKey, deriveSubaccountSalt, deriveSubaccountSlot, findNextSubaccountWithdrawNonce, getAddresses, getDailyFreeRemaining, getExtDataHash, getForwarderFactoryAddress, getMerklePath, getPoolAddress, getPrivateBalance, getQueueAddress, getQueueBalance, getRelayInfo, getRelayUrl, getSubaccountPrivateBalance, getSubaccountStatus, isSubaccountForwarderDeployed, isSubaccountWithdrawNonceUsed, mergeSubaccount, mergeUtxos, packEncryptedMessage, poseidonHash, poseidonHash2, predictSubaccountForwarder, prepareTransaction, prove, randomBN, selectCircuit, selectUtxosForWithdraw, shuffle, signSubaccountWithdraw, submitRelay, sweepSubaccountForwarder, toBuffer, toFixedHex, transfer, unpackEncryptedMessage, withdraw };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Buffer } from 'buffer';
1
2
  import MerkleTree from 'fixed-merkle-tree-legacy';
2
3
 
3
4
  /**
@@ -73,6 +74,80 @@ declare class Utxo {
73
74
  static decrypt(data: string, keypair: Keypair): Utxo;
74
75
  }
75
76
 
77
+ /**
78
+ * ZK Proof generation for Veil SDK
79
+ * Uses snarkjs groth16 to generate proofs for transactions
80
+ */
81
+ /**
82
+ * Input data for ZK proof generation
83
+ */
84
+ interface ProofInput {
85
+ root: bigint;
86
+ inputNullifier: bigint[];
87
+ outputCommitment: bigint[];
88
+ publicAmount: string;
89
+ extDataHash: bigint;
90
+ inAmount: bigint[];
91
+ inPrivateKey: (string | null)[];
92
+ inBlinding: bigint[];
93
+ inPathIndices: number[];
94
+ inPathElements: (bigint | number)[][];
95
+ outAmount: bigint[];
96
+ outBlinding: bigint[];
97
+ outPubkey: bigint[];
98
+ }
99
+ /**
100
+ * Directory/base URL where proving keys are hosted, or a resolver that returns
101
+ * the circuit base path without the `.wasm` / `.zkey` extension.
102
+ */
103
+ type ProvingKeyPath = string | ((circuitName: string) => string);
104
+ interface ProveOptions {
105
+ /**
106
+ * Proving key location.
107
+ *
108
+ * In Node this defaults to the package/source `keys` directory. In browsers
109
+ * this defaults to `/keys`, so apps can serve `/keys/transaction2.wasm` and
110
+ * `/keys/transaction2.zkey` from their own origin.
111
+ */
112
+ provingKeyPath?: ProvingKeyPath;
113
+ /** Force snarkjs single-threaded proving. Defaults to true. */
114
+ singleThread?: boolean;
115
+ }
116
+ /**
117
+ * Generate a ZK proof for a transaction
118
+ *
119
+ * @param input - Proof input data
120
+ * @param circuitName - Circuit name (e.g., 'transaction2' or 'transaction16')
121
+ * @returns Serialized proof as hex string
122
+ *
123
+ * @example
124
+ * ```typescript
125
+ * const proof = await prove(proofInput, 'transaction2');
126
+ * // Returns: 0x1234...abcd (256 bytes hex)
127
+ * ```
128
+ */
129
+ declare function prove(input: ProofInput, circuitName: string, options?: ProveOptions): Promise<string>;
130
+ /**
131
+ * Get the supported circuit names and their max input counts
132
+ */
133
+ declare const CIRCUIT_CONFIG: {
134
+ readonly transaction2: {
135
+ readonly maxInputs: 2;
136
+ readonly maxOutputs: 2;
137
+ };
138
+ readonly transaction16: {
139
+ readonly maxInputs: 16;
140
+ readonly maxOutputs: 2;
141
+ };
142
+ };
143
+ /**
144
+ * Select the appropriate circuit based on input count
145
+ *
146
+ * @param inputCount - Number of input UTXOs
147
+ * @returns Circuit name to use
148
+ */
149
+ declare function selectCircuit(inputCount: number): string;
150
+
76
151
  /**
77
152
  * Type definitions for Veil SDK
78
153
  */
@@ -274,6 +349,13 @@ interface BuildWithdrawProofOptions {
274
349
  pool?: RelayPool;
275
350
  /** Optional RPC URL */
276
351
  rpcUrl?: string;
352
+ /**
353
+ * Optional proving key directory/base URL or resolver.
354
+ *
355
+ * Browsers default to `/keys`, expecting files like
356
+ * `/keys/transaction2.wasm` and `/keys/transaction2.zkey`.
357
+ */
358
+ provingKeyPath?: ProvingKeyPath;
277
359
  /** Progress callback */
278
360
  onProgress?: (stage: string, detail?: string) => void;
279
361
  }
@@ -291,6 +373,13 @@ interface BuildTransferProofOptions {
291
373
  pool?: RelayPool;
292
374
  /** Optional RPC URL */
293
375
  rpcUrl?: string;
376
+ /**
377
+ * Optional proving key directory/base URL or resolver.
378
+ *
379
+ * Browsers default to `/keys`, expecting files like
380
+ * `/keys/transaction2.wasm` and `/keys/transaction2.zkey`.
381
+ */
382
+ provingKeyPath?: ProvingKeyPath;
294
383
  /** Progress callback */
295
384
  onProgress?: (stage: string, detail?: string) => void;
296
385
  }
@@ -485,6 +574,13 @@ interface SubaccountMergeOptions {
485
574
  rpcUrl?: string;
486
575
  /** Optional relay URL */
487
576
  relayUrl?: string;
577
+ /**
578
+ * Optional proving key directory/base URL or resolver.
579
+ *
580
+ * Browsers default to `/keys`, expecting files like
581
+ * `/keys/transaction2.wasm` and `/keys/transaction2.zkey`.
582
+ */
583
+ provingKeyPath?: ProvingKeyPath;
488
584
  /** Progress callback */
489
585
  onProgress?: (stage: string, detail?: string) => void;
490
586
  }
@@ -818,6 +914,31 @@ declare function getQueueBalance(options: {
818
914
  rpcUrl?: string;
819
915
  onProgress?: ProgressCallback;
820
916
  }): Promise<QueueBalanceResult>;
917
+ /**
918
+ * Get remaining daily free deposits for an address.
919
+ * Returns 0 if the queue contract has not been upgraded to V3 yet
920
+ * or if the daily free feature is disabled.
921
+ *
922
+ * @param options - Query options
923
+ * @param options.address - Depositor address to check
924
+ * @param options.pool - Pool identifier ('eth' or 'usdc', default: 'eth')
925
+ * @param options.rpcUrl - Optional RPC URL
926
+ * @returns Number of free deposits remaining today
927
+ *
928
+ * @example
929
+ * ```typescript
930
+ * const remaining = await getDailyFreeRemaining({
931
+ * address: '0x...',
932
+ * pool: 'eth',
933
+ * });
934
+ * console.log(`Free deposits left today: ${remaining}`);
935
+ * ```
936
+ */
937
+ declare function getDailyFreeRemaining(options: {
938
+ address: `0x${string}`;
939
+ pool?: RelayPool;
940
+ rpcUrl?: string;
941
+ }): Promise<number>;
821
942
  /**
822
943
  * Get private balance from the Pool contract
823
944
  * Decrypts all encrypted outputs, calculates nullifiers, and checks spent status
@@ -906,11 +1027,6 @@ declare function buildWithdrawProof(options: BuildWithdrawProofOptions): Promise
906
1027
  */
907
1028
  declare function withdraw(options: BuildWithdrawProofOptions): Promise<WithdrawResult>;
908
1029
 
909
- /**
910
- * Transfer functions for Veil SDK
911
- * Build ZK proofs to transfer funds privately within the pool
912
- */
913
-
914
1030
  /**
915
1031
  * Check if a recipient is registered and get their deposit key
916
1032
  *
@@ -997,6 +1113,7 @@ declare function mergeUtxos(options: {
997
1113
  keypair: Keypair;
998
1114
  pool?: RelayPool;
999
1115
  rpcUrl?: string;
1116
+ provingKeyPath?: ProvingKeyPath;
1000
1117
  onProgress?: (stage: string, detail?: string) => void;
1001
1118
  }): Promise<TransferResult>;
1002
1119
 
@@ -1052,6 +1169,8 @@ interface PrepareTransactionParams {
1052
1169
  relayer?: string | bigint | number;
1053
1170
  /** Optional progress callback */
1054
1171
  onProgress?: (stage: string, detail?: string) => void;
1172
+ /** Optional proving key directory/base URL or circuit path resolver */
1173
+ provingKeyPath?: ProvingKeyPath;
1055
1174
  }
1056
1175
  /**
1057
1176
  * Prepare a transaction (withdrawal or transfer)
@@ -1083,7 +1202,7 @@ interface PrepareTransactionParams {
1083
1202
  * });
1084
1203
  * ```
1085
1204
  */
1086
- declare function prepareTransaction({ commitments, inputs, outputs, fee, recipient, relayer, onProgress, }: PrepareTransactionParams): Promise<TransactionResult>;
1205
+ declare function prepareTransaction({ commitments, inputs, outputs, fee, recipient, relayer, onProgress, provingKeyPath, }: PrepareTransactionParams): Promise<TransactionResult>;
1087
1206
 
1088
1207
  /**
1089
1208
  * Merkle tree utilities for Veil SDK
@@ -1121,63 +1240,6 @@ declare function getMerklePath(tree: MerkleTree, commitment: bigint | string): {
1121
1240
  pathIndices: number;
1122
1241
  };
1123
1242
 
1124
- /**
1125
- * ZK Proof generation for Veil SDK
1126
- * Uses snarkjs groth16 to generate proofs for transactions
1127
- */
1128
- /**
1129
- * Input data for ZK proof generation
1130
- */
1131
- interface ProofInput {
1132
- root: bigint;
1133
- inputNullifier: bigint[];
1134
- outputCommitment: bigint[];
1135
- publicAmount: string;
1136
- extDataHash: bigint;
1137
- inAmount: bigint[];
1138
- inPrivateKey: (string | null)[];
1139
- inBlinding: bigint[];
1140
- inPathIndices: number[];
1141
- inPathElements: (bigint | number)[][];
1142
- outAmount: bigint[];
1143
- outBlinding: bigint[];
1144
- outPubkey: bigint[];
1145
- }
1146
- /**
1147
- * Generate a ZK proof for a transaction
1148
- *
1149
- * @param input - Proof input data
1150
- * @param circuitName - Circuit name (e.g., 'transaction2' or 'transaction16')
1151
- * @returns Serialized proof as hex string
1152
- *
1153
- * @example
1154
- * ```typescript
1155
- * const proof = await prove(proofInput, 'transaction2');
1156
- * // Returns: 0x1234...abcd (256 bytes hex)
1157
- * ```
1158
- */
1159
- declare function prove(input: ProofInput, circuitName: string): Promise<string>;
1160
- /**
1161
- * Get the supported circuit names and their max input counts
1162
- */
1163
- declare const CIRCUIT_CONFIG: {
1164
- readonly transaction2: {
1165
- readonly maxInputs: 2;
1166
- readonly maxOutputs: 2;
1167
- };
1168
- readonly transaction16: {
1169
- readonly maxInputs: 16;
1170
- readonly maxOutputs: 2;
1171
- };
1172
- };
1173
- /**
1174
- * Select the appropriate circuit based on input count
1175
- *
1176
- * @param inputCount - Number of input UTXOs
1177
- * @returns Circuit name to use
1178
- */
1179
- declare function selectCircuit(inputCount: number): string;
1180
-
1181
1243
  /**
1182
1244
  * Contract addresses for Veil on Base
1183
1245
  */
@@ -1648,6 +1710,18 @@ declare const QUEUE_ABI: readonly [{
1648
1710
  }];
1649
1711
  readonly stateMutability: "view";
1650
1712
  readonly type: "function";
1713
+ }, {
1714
+ readonly inputs: readonly [{
1715
+ readonly name: "_depositor";
1716
+ readonly type: "address";
1717
+ }];
1718
+ readonly name: "getDailyFreeRemaining";
1719
+ readonly outputs: readonly [{
1720
+ readonly name: "remaining";
1721
+ readonly type: "uint256";
1722
+ }];
1723
+ readonly stateMutability: "view";
1724
+ readonly type: "function";
1651
1725
  }];
1652
1726
  /**
1653
1727
  * ETH Pool Contract ABI
@@ -2714,6 +2788,7 @@ declare function mergeSubaccount(options: SubaccountMergeOptions): Promise<Subac
2714
2788
  * Crypto utilities for Veil SDK
2715
2789
  * Poseidon hash, hex conversion, and random number generation
2716
2790
  */
2791
+
2717
2792
  /**
2718
2793
  * SNARK scalar field size
2719
2794
  */
@@ -2779,4 +2854,4 @@ declare function getExtDataHash(extData: ExtDataInput): bigint;
2779
2854
  */
2780
2855
  declare function shuffle<T>(array: T[]): T[];
2781
2856
 
2782
- export { ADDRESSES, type BuildTransferProofOptions, type BuildWithdrawProofOptions, CIRCUIT_CONFIG, type DepositTxOptions, ENTRY_ABI, ERC20_ABI, type EncryptedMessage, type ExtData, type ExtDataInput, FIELD_SIZE, FORWARDER_ABI, FORWARDER_CONTRACT_VERSION, FORWARDER_FACTORY_ABI, Keypair, MAX_SUBACCOUNT_SLOTS, MERKLE_TREE_HEIGHT, type MessageSigner, type NetworkAddresses, POOL_ABI, POOL_CONFIG, type PendingDeposit, type PoolConfig, type PrepareTransactionParams, type PrivateBalanceResult, type ProgressCallback, type ProofArgs, type ProofBuildResult, type ProofInput, QUEUE_ABI, type QueueBalanceResult, type RegisterTxOptions, RelayError, type RelayErrorResponse, type RelayExtData, type RelayMetadata, type RelayPool, type RelayProofArgs, type RelayRequest, type RelayResponse, type RelayType, type SubaccountAsset, type SubaccountAssetBalance, type SubaccountBalances, type SubaccountDeployRequest, type SubaccountMergeOptions, type SubaccountMergeResult, type SubaccountPrivateBalanceStatus, type SubaccountPrivateBalances, type SubaccountQueueStatus, type SubaccountRecoveryResult, type SubaccountRelayResult, type SubaccountSlot, type SubaccountStatusResult, type SubaccountSweepRequest, type SubaccountWithdrawTypedData, type SubmitRelayOptions, type Token, type TransactionData, type TransactionResult, type TransferResult, Utxo, type UtxoInfo, type UtxoParams, type UtxoSelectionResult, VEIL_SIGNED_MESSAGE, type WithdrawResult, buildApproveUSDCTx, buildChangeDepositKeyTx, buildDepositETHTx, buildDepositTx, buildDepositUSDCTx, buildMerkleTree, buildRegisterTx, buildSubaccountRecoveryTx, buildSubaccountWithdrawTypedData, buildTransferProof, buildWithdrawProof, checkRecipientRegistration, checkRelayHealth, deploySubaccountForwarder, deriveSubaccountChildDepositKey, deriveSubaccountChildOwner, deriveSubaccountChildPrivateKey, deriveSubaccountSalt, deriveSubaccountSlot, findNextSubaccountWithdrawNonce, getAddresses, getExtDataHash, getForwarderFactoryAddress, getMerklePath, getPoolAddress, getPrivateBalance, getQueueAddress, getQueueBalance, getRelayInfo, getRelayUrl, getSubaccountPrivateBalance, getSubaccountStatus, isSubaccountForwarderDeployed, isSubaccountWithdrawNonceUsed, mergeSubaccount, mergeUtxos, packEncryptedMessage, poseidonHash, poseidonHash2, predictSubaccountForwarder, prepareTransaction, prove, randomBN, selectCircuit, selectUtxosForWithdraw, shuffle, signSubaccountWithdraw, submitRelay, sweepSubaccountForwarder, toBuffer, toFixedHex, transfer, unpackEncryptedMessage, withdraw };
2857
+ export { ADDRESSES, type BuildTransferProofOptions, type BuildWithdrawProofOptions, CIRCUIT_CONFIG, type DepositTxOptions, ENTRY_ABI, ERC20_ABI, type EncryptedMessage, type ExtData, type ExtDataInput, FIELD_SIZE, FORWARDER_ABI, FORWARDER_CONTRACT_VERSION, FORWARDER_FACTORY_ABI, Keypair, MAX_SUBACCOUNT_SLOTS, MERKLE_TREE_HEIGHT, type MessageSigner, type NetworkAddresses, POOL_ABI, POOL_CONFIG, type PendingDeposit, type PoolConfig, type PrepareTransactionParams, type PrivateBalanceResult, type ProgressCallback, type ProofArgs, type ProofBuildResult, type ProofInput, type ProveOptions, type ProvingKeyPath, QUEUE_ABI, type QueueBalanceResult, type RegisterTxOptions, RelayError, type RelayErrorResponse, type RelayExtData, type RelayMetadata, type RelayPool, type RelayProofArgs, type RelayRequest, type RelayResponse, type RelayType, type SubaccountAsset, type SubaccountAssetBalance, type SubaccountBalances, type SubaccountDeployRequest, type SubaccountMergeOptions, type SubaccountMergeResult, type SubaccountPrivateBalanceStatus, type SubaccountPrivateBalances, type SubaccountQueueStatus, type SubaccountRecoveryResult, type SubaccountRelayResult, type SubaccountSlot, type SubaccountStatusResult, type SubaccountSweepRequest, type SubaccountWithdrawTypedData, type SubmitRelayOptions, type Token, type TransactionData, type TransactionResult, type TransferResult, Utxo, type UtxoInfo, type UtxoParams, type UtxoSelectionResult, VEIL_SIGNED_MESSAGE, type WithdrawResult, buildApproveUSDCTx, buildChangeDepositKeyTx, buildDepositETHTx, buildDepositTx, buildDepositUSDCTx, buildMerkleTree, buildRegisterTx, buildSubaccountRecoveryTx, buildSubaccountWithdrawTypedData, buildTransferProof, buildWithdrawProof, checkRecipientRegistration, checkRelayHealth, deploySubaccountForwarder, deriveSubaccountChildDepositKey, deriveSubaccountChildOwner, deriveSubaccountChildPrivateKey, deriveSubaccountSalt, deriveSubaccountSlot, findNextSubaccountWithdrawNonce, getAddresses, getDailyFreeRemaining, getExtDataHash, getForwarderFactoryAddress, getMerklePath, getPoolAddress, getPrivateBalance, getQueueAddress, getQueueBalance, getRelayInfo, getRelayUrl, getSubaccountPrivateBalance, getSubaccountStatus, isSubaccountForwarderDeployed, isSubaccountWithdrawNonceUsed, mergeSubaccount, mergeUtxos, packEncryptedMessage, poseidonHash, poseidonHash2, predictSubaccountForwarder, prepareTransaction, prove, randomBN, selectCircuit, selectUtxosForWithdraw, shuffle, signSubaccountWithdraw, submitRelay, sweepSubaccountForwarder, toBuffer, toFixedHex, transfer, unpackEncryptedMessage, withdraw };