@veil-cash/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.
@@ -0,0 +1,2099 @@
1
+ import MerkleTree from 'fixed-merkle-tree-legacy';
2
+
3
+ /**
4
+ * UTXO (Unspent Transaction Output) class for Veil SDK
5
+ * Represents a private balance entry that can be spent
6
+ */
7
+
8
+ interface UtxoParams {
9
+ amount?: bigint | number | string;
10
+ keypair?: Keypair;
11
+ blinding?: bigint;
12
+ index?: number;
13
+ }
14
+ /**
15
+ * UTXO class - represents a private balance entry
16
+ *
17
+ * A UTXO contains:
18
+ * - amount: The value in wei
19
+ * - blinding: Random value for privacy
20
+ * - keypair: The owner's keypair
21
+ * - index: Position in the merkle tree (needed for nullifier calculation)
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * // Decrypt an encrypted output
26
+ * const utxo = Utxo.decrypt(encryptedOutput, keypair);
27
+ * utxo.index = 5; // Set the merkle tree index
28
+ *
29
+ * // Check if spent
30
+ * const nullifier = utxo.getNullifier();
31
+ * const isSpent = await pool.isSpent(nullifier);
32
+ * ```
33
+ */
34
+ declare class Utxo {
35
+ amount: bigint;
36
+ blinding: bigint;
37
+ keypair: Keypair;
38
+ index?: number;
39
+ private _commitment?;
40
+ private _nullifier?;
41
+ /**
42
+ * Create a new UTXO
43
+ * @param params - UTXO parameters
44
+ */
45
+ constructor(params?: UtxoParams);
46
+ /**
47
+ * Get the commitment for this UTXO
48
+ * commitment = poseidonHash([amount, pubkey, blinding])
49
+ * @returns Commitment as bigint
50
+ */
51
+ getCommitment(): bigint;
52
+ /**
53
+ * Get the nullifier for this UTXO
54
+ * Requires index and private key to be set
55
+ * nullifier = poseidonHash([commitment, index, signature])
56
+ * @returns Nullifier as bigint
57
+ */
58
+ getNullifier(): bigint;
59
+ /**
60
+ * Encrypt UTXO data using the keypair
61
+ * @returns Encrypted data as 0x-prefixed hex string
62
+ */
63
+ encrypt(): string;
64
+ /**
65
+ * Decrypt an encrypted output to create a UTXO
66
+ * Only succeeds if the keypair owns this UTXO
67
+ *
68
+ * @param data - Encrypted output as hex string
69
+ * @param keypair - Keypair to decrypt with
70
+ * @returns Decrypted UTXO
71
+ * @throws If decryption fails (wrong keypair)
72
+ */
73
+ static decrypt(data: string, keypair: Keypair): Utxo;
74
+ }
75
+
76
+ /**
77
+ * Type definitions for Veil SDK
78
+ */
79
+ /**
80
+ * Supported tokens
81
+ */
82
+ type Token = 'ETH' | 'USDC';
83
+ /**
84
+ * Encrypted message format (x25519-xsalsa20-poly1305)
85
+ */
86
+ interface EncryptedMessage {
87
+ version: string;
88
+ nonce: string;
89
+ ephemPublicKey: string;
90
+ ciphertext: string;
91
+ }
92
+ /**
93
+ * Contract addresses for a network
94
+ */
95
+ interface NetworkAddresses {
96
+ entry: `0x${string}`;
97
+ ethPool: `0x${string}`;
98
+ ethQueue: `0x${string}`;
99
+ usdcPool: `0x${string}`;
100
+ usdcQueue: `0x${string}`;
101
+ usdcToken: `0x${string}`;
102
+ chainId: number;
103
+ relayUrl: string;
104
+ }
105
+ /**
106
+ * Options for building a register transaction
107
+ */
108
+ interface RegisterTxOptions {
109
+ depositKey: string;
110
+ }
111
+ /**
112
+ * Options for building a deposit transaction
113
+ */
114
+ interface DepositTxOptions {
115
+ depositKey: string;
116
+ fallbackReceiver: `0x${string}`;
117
+ amount: string;
118
+ token?: Token;
119
+ }
120
+ /**
121
+ * Transaction data returned by build functions
122
+ */
123
+ interface TransactionData {
124
+ to: `0x${string}`;
125
+ data: `0x${string}`;
126
+ value?: bigint;
127
+ }
128
+ /**
129
+ * Pool configuration
130
+ */
131
+ interface PoolConfig {
132
+ decimals: number;
133
+ displayDecimals: number;
134
+ symbol: string;
135
+ name: string;
136
+ }
137
+ /**
138
+ * Pending deposit from queue contract
139
+ */
140
+ interface PendingDeposit {
141
+ nonce: string;
142
+ status: 'pending' | 'accepted' | 'rejected' | 'refunded';
143
+ amount: string;
144
+ amountWei: string;
145
+ timestamp: string;
146
+ }
147
+ /**
148
+ * Result from getQueueBalance
149
+ */
150
+ interface QueueBalanceResult {
151
+ address: string;
152
+ queueBalance: string;
153
+ queueBalanceWei: string;
154
+ pendingDeposits: PendingDeposit[];
155
+ pendingCount: number;
156
+ }
157
+ /**
158
+ * UTXO info for private balance
159
+ */
160
+ interface UtxoInfo {
161
+ index: number;
162
+ amount: string;
163
+ amountWei: string;
164
+ isSpent: boolean;
165
+ }
166
+ /**
167
+ * Result from getPrivateBalance
168
+ */
169
+ interface PrivateBalanceResult {
170
+ privateBalance: string;
171
+ privateBalanceWei: string;
172
+ utxoCount: number;
173
+ spentCount: number;
174
+ unspentCount: number;
175
+ utxos: UtxoInfo[];
176
+ }
177
+ /**
178
+ * Pool type for relay operations
179
+ */
180
+ type RelayPool = 'eth' | 'usdc';
181
+ /**
182
+ * Type of relay transaction
183
+ */
184
+ type RelayType = 'withdraw' | 'transfer';
185
+ /**
186
+ * Proof arguments for relay transaction
187
+ */
188
+ interface RelayProofArgs {
189
+ proof: string;
190
+ root: string;
191
+ inputNullifiers: string[];
192
+ outputCommitments: [string, string];
193
+ publicAmount: string;
194
+ extDataHash: string;
195
+ }
196
+ /**
197
+ * External data for relay transaction
198
+ */
199
+ interface RelayExtData {
200
+ recipient: string;
201
+ extAmount: string;
202
+ relayer: string;
203
+ fee: string;
204
+ encryptedOutput1: string;
205
+ encryptedOutput2: string;
206
+ }
207
+ /**
208
+ * Metadata for relay transaction (optional)
209
+ */
210
+ interface RelayMetadata {
211
+ amount?: string;
212
+ recipient?: string;
213
+ inputUtxoCount?: number;
214
+ outputUtxoCount?: number;
215
+ }
216
+ /**
217
+ * Request body for relay service
218
+ */
219
+ interface RelayRequest {
220
+ type: RelayType;
221
+ proofArgs: RelayProofArgs;
222
+ extData: RelayExtData;
223
+ metadata?: RelayMetadata;
224
+ }
225
+ /**
226
+ * Response from relay service
227
+ */
228
+ interface RelayResponse {
229
+ success: boolean;
230
+ transactionHash: string;
231
+ blockNumber: string;
232
+ gasUsed: string;
233
+ status: string;
234
+ network: string;
235
+ }
236
+ /**
237
+ * Error response from relay service
238
+ */
239
+ interface RelayErrorResponse {
240
+ error: string;
241
+ message?: string;
242
+ retryAfter?: number;
243
+ network?: string;
244
+ }
245
+ /**
246
+ * Options for submitRelay function
247
+ */
248
+ interface SubmitRelayOptions {
249
+ /** Type of transaction: 'withdraw' or 'transfer' */
250
+ type: RelayType;
251
+ /** Pool to use: 'eth' or 'usdc' */
252
+ pool?: RelayPool;
253
+ /** Proof arguments generated by ZK prover */
254
+ proofArgs: RelayProofArgs;
255
+ /** External data for the transaction */
256
+ extData: RelayExtData;
257
+ /** Optional metadata */
258
+ metadata?: RelayMetadata;
259
+ /** Custom relay URL (overrides default) */
260
+ relayUrl?: string;
261
+ }
262
+ /**
263
+ * Options for building a withdrawal proof
264
+ */
265
+ interface BuildWithdrawProofOptions {
266
+ /** Amount to withdraw (human readable, e.g., "0.1") */
267
+ amount: string;
268
+ /** Recipient address for withdrawal */
269
+ recipient: `0x${string}`;
270
+ /** User's keypair for signing */
271
+ keypair: Keypair;
272
+ /** Optional RPC URL */
273
+ rpcUrl?: string;
274
+ /** Progress callback */
275
+ onProgress?: (stage: string, detail?: string) => void;
276
+ }
277
+ /**
278
+ * Options for building a transfer proof
279
+ */
280
+ interface BuildTransferProofOptions {
281
+ /** Amount to transfer (human readable, e.g., "0.1") */
282
+ amount: string;
283
+ /** Recipient's address (must be registered) */
284
+ recipientAddress: `0x${string}`;
285
+ /** Sender's keypair */
286
+ senderKeypair: Keypair;
287
+ /** Optional RPC URL */
288
+ rpcUrl?: string;
289
+ /** Progress callback */
290
+ onProgress?: (stage: string, detail?: string) => void;
291
+ }
292
+ /**
293
+ * Result from building a withdrawal or transfer proof
294
+ */
295
+ interface ProofBuildResult {
296
+ /** Proof arguments for on-chain verification */
297
+ proofArgs: RelayProofArgs;
298
+ /** External data for transaction */
299
+ extData: RelayExtData;
300
+ /** Number of input UTXOs used */
301
+ inputCount: number;
302
+ /** Number of output UTXOs created */
303
+ outputCount: number;
304
+ /** Amount being withdrawn/transferred */
305
+ amount: string;
306
+ }
307
+ /**
308
+ * Result from executing a withdrawal
309
+ */
310
+ interface WithdrawResult {
311
+ /** Whether the withdrawal was successful */
312
+ success: boolean;
313
+ /** Transaction hash */
314
+ transactionHash: string;
315
+ /** Block number of the transaction */
316
+ blockNumber: string;
317
+ /** Amount withdrawn */
318
+ amount: string;
319
+ /** Recipient address */
320
+ recipient: string;
321
+ }
322
+ /**
323
+ * Result from executing a transfer
324
+ */
325
+ interface TransferResult {
326
+ /** Whether the transfer was successful */
327
+ success: boolean;
328
+ /** Transaction hash */
329
+ transactionHash: string;
330
+ /** Block number of the transaction */
331
+ blockNumber: string;
332
+ /** Amount transferred */
333
+ amount: string;
334
+ /** Recipient address */
335
+ recipient: string;
336
+ }
337
+ /**
338
+ * UTXO selection result
339
+ */
340
+ interface UtxoSelectionResult {
341
+ /** Selected UTXOs */
342
+ selectedUtxos: Utxo[];
343
+ /** Total amount of selected UTXOs (wei) */
344
+ totalSelected: bigint;
345
+ /** Change amount to return to sender (wei) */
346
+ changeAmount: bigint;
347
+ }
348
+
349
+ /**
350
+ * Veil Keypair class
351
+ * Generates and manages keypairs for Veil deposits
352
+ */
353
+
354
+ /**
355
+ * Pack encrypted message into hex string
356
+ */
357
+ declare function packEncryptedMessage(encryptedMessage: EncryptedMessage): string;
358
+ /**
359
+ * Unpack hex string into encrypted message
360
+ */
361
+ declare function unpackEncryptedMessage(encryptedMessage: string): EncryptedMessage;
362
+ /**
363
+ * Veil Keypair for deposits
364
+ *
365
+ * A keypair consists of:
366
+ * - Private key: Random 32-byte Ethereum-style key
367
+ * - Public key: Poseidon hash of the private key
368
+ * - Encryption key: x25519 public key for encrypted outputs
369
+ *
370
+ * The deposit key (used for registration) is: pubkey + encryptionKey
371
+ *
372
+ * @example
373
+ * ```typescript
374
+ * // Generate new keypair
375
+ * const keypair = new Keypair();
376
+ * console.log(keypair.depositKey()); // Register this on-chain
377
+ * console.log(keypair.privkey); // Store securely!
378
+ *
379
+ * // Restore from existing private key
380
+ * const restored = new Keypair(savedPrivkey);
381
+ * ```
382
+ */
383
+ declare class Keypair {
384
+ /** Private key (null if created from public deposit key only) */
385
+ privkey: string | null;
386
+ /** Public key (Poseidon hash of private key) */
387
+ pubkey: bigint;
388
+ /** x25519 encryption public key */
389
+ encryptionKey: string;
390
+ /**
391
+ * Create a new Keypair
392
+ * @param privkey - Optional private key. If not provided, generates a random one.
393
+ */
394
+ constructor(privkey?: string);
395
+ /**
396
+ * Get the deposit key for this keypair
397
+ * This is what you register on-chain
398
+ * @returns Deposit key as hex string (130 chars with 0x prefix)
399
+ */
400
+ toString(): string;
401
+ /**
402
+ * Alias for toString() - returns the deposit key
403
+ * @returns Deposit key as hex string
404
+ */
405
+ depositKey(): string;
406
+ /**
407
+ * Create a Keypair from a public deposit key (without private key)
408
+ * Useful for sending transfers to other users
409
+ * @param str - Deposit key (128 or 130 hex chars)
410
+ * @returns Keypair instance (privkey will be null)
411
+ */
412
+ static fromString(str: string): Keypair;
413
+ /**
414
+ * Sign a message using the private key
415
+ * @param commitment - Commitment hash
416
+ * @param merklePath - Merkle path
417
+ * @returns Signature as bigint
418
+ */
419
+ sign(commitment: string | number | bigint, merklePath: string | number | bigint): bigint;
420
+ /**
421
+ * Encrypt data using the encryption key
422
+ * @param bytes - Data to encrypt
423
+ * @returns Encrypted data as hex string
424
+ */
425
+ encrypt(bytes: Buffer): string;
426
+ /**
427
+ * Decrypt data using the private key
428
+ * @param data - Encrypted data as hex string
429
+ * @returns Decrypted data as Buffer
430
+ */
431
+ decrypt(data: string): Buffer;
432
+ }
433
+
434
+ /**
435
+ * Deposit functions for Veil SDK
436
+ * Build transactions for registration and deposits
437
+ */
438
+
439
+ /**
440
+ * Build a transaction to register a deposit key
441
+ * This is a one-time operation that links your address to your keypair
442
+ *
443
+ * @param depositKey - Deposit key from Keypair.depositKey()
444
+ * @param ownerAddress - Address that will own this deposit key
445
+ * @returns Transaction data to send
446
+ *
447
+ * @example
448
+ * ```typescript
449
+ * const keypair = new Keypair();
450
+ * const tx = buildRegisterTx(keypair.depositKey(), '0x...');
451
+ * // Send tx using your wallet (viem, ethers, etc.)
452
+ * ```
453
+ */
454
+ declare function buildRegisterTx(depositKey: string, ownerAddress: `0x${string}`): TransactionData;
455
+ /**
456
+ * Build a transaction to deposit ETH
457
+ *
458
+ * @param options - Deposit options
459
+ * @param options.depositKey - Deposit key from Keypair.depositKey()
460
+ * @param options.amount - Amount to deposit (human readable, e.g., '0.1')
461
+ * @returns Transaction data including value to send
462
+ *
463
+ * @example
464
+ * ```typescript
465
+ * const tx = buildDepositETHTx({
466
+ * depositKey: keypair.depositKey(),
467
+ * amount: '0.1',
468
+ * });
469
+ * // Send tx with tx.value as the ETH amount
470
+ * ```
471
+ */
472
+ declare function buildDepositETHTx(options: {
473
+ depositKey: string;
474
+ amount: string;
475
+ }): TransactionData;
476
+ /**
477
+ * Build a transaction to approve USDC for deposit
478
+ * Must be called before depositUSDC if allowance is insufficient
479
+ *
480
+ * @param options - Approval options
481
+ * @param options.amount - Amount to approve (human readable, e.g., '100')
482
+ * @returns Transaction data
483
+ */
484
+ declare function buildApproveUSDCTx(options: {
485
+ amount: string;
486
+ }): TransactionData;
487
+ /**
488
+ * Build a transaction to deposit USDC
489
+ * Note: You must approve USDC first using buildApproveUSDCTx
490
+ *
491
+ * @param options - Deposit options
492
+ * @param options.depositKey - Deposit key from Keypair.depositKey()
493
+ * @param options.amount - Amount to deposit (human readable, e.g., '100')
494
+ * @returns Transaction data
495
+ */
496
+ declare function buildDepositUSDCTx(options: {
497
+ depositKey: string;
498
+ amount: string;
499
+ }): TransactionData;
500
+ /**
501
+ * Build a deposit transaction (ETH or USDC)
502
+ * Convenience function that routes to the correct builder
503
+ *
504
+ * @param options - Deposit options
505
+ * @returns Transaction data
506
+ *
507
+ * @example
508
+ * ```typescript
509
+ * // ETH deposit
510
+ * const ethTx = buildDepositTx({
511
+ * depositKey: keypair.depositKey(),
512
+ * amount: '0.1',
513
+ * token: 'ETH',
514
+ * });
515
+ *
516
+ * // USDC deposit (remember to approve first!)
517
+ * const usdcTx = buildDepositTx({
518
+ * depositKey: keypair.depositKey(),
519
+ * amount: '100',
520
+ * token: 'USDC',
521
+ * });
522
+ * ```
523
+ */
524
+ declare function buildDepositTx(options: {
525
+ depositKey: string;
526
+ amount: string;
527
+ token?: Token;
528
+ }): TransactionData;
529
+
530
+ /**
531
+ * Balance functions for Veil SDK
532
+ * Query queue and private balances directly from blockchain
533
+ */
534
+
535
+ /**
536
+ * Progress callback type
537
+ */
538
+ type ProgressCallback = (stage: string, detail?: string) => void;
539
+ /**
540
+ * Get queue balance and pending deposits for an address
541
+ * Queries the Queue contract directly (no API dependency)
542
+ *
543
+ * @param options - Query options
544
+ * @param options.address - Address to check
545
+ * @param options.rpcUrl - Optional RPC URL (uses default if not provided)
546
+ * @param options.onProgress - Optional progress callback
547
+ * @returns Queue balance and pending deposits
548
+ *
549
+ * @example
550
+ * ```typescript
551
+ * const result = await getQueueBalance({
552
+ * address: '0x...',
553
+ * onProgress: (stage, detail) => console.log(stage, detail),
554
+ * });
555
+ *
556
+ * console.log(`Queue balance: ${result.queueBalance} ETH`);
557
+ * console.log(`Pending deposits: ${result.pendingCount}`);
558
+ * ```
559
+ */
560
+ declare function getQueueBalance(options: {
561
+ address: `0x${string}`;
562
+ rpcUrl?: string;
563
+ onProgress?: ProgressCallback;
564
+ }): Promise<QueueBalanceResult>;
565
+ /**
566
+ * Get private balance from the Pool contract
567
+ * Decrypts all encrypted outputs, calculates nullifiers, and checks spent status
568
+ *
569
+ * @param options - Query options
570
+ * @param options.keypair - Keypair to decrypt UTXOs with
571
+ * @param options.rpcUrl - Optional RPC URL (uses default if not provided)
572
+ * @param options.onProgress - Optional progress callback
573
+ * @returns Private balance and UTXO details
574
+ *
575
+ * @example
576
+ * ```typescript
577
+ * const keypair = new Keypair(process.env.VEIL_KEY);
578
+ * const result = await getPrivateBalance({
579
+ * keypair,
580
+ * onProgress: (stage, detail) => console.log(stage, detail),
581
+ * });
582
+ *
583
+ * console.log(`Private balance: ${result.privateBalance} ETH`);
584
+ * console.log(`Unspent UTXOs: ${result.unspentCount}`);
585
+ * ```
586
+ */
587
+ declare function getPrivateBalance(options: {
588
+ keypair: Keypair;
589
+ rpcUrl?: string;
590
+ onProgress?: ProgressCallback;
591
+ }): Promise<PrivateBalanceResult>;
592
+
593
+ /**
594
+ * Withdrawal functions for Veil SDK
595
+ * Build ZK proofs to withdraw funds from the pool to a public address
596
+ */
597
+
598
+ /**
599
+ * Select UTXOs for withdrawal using largest-first algorithm
600
+ *
601
+ * @param utxos - Available unspent UTXOs
602
+ * @param amount - Amount to withdraw (human readable)
603
+ * @param decimals - Token decimals (default: 18 for ETH)
604
+ * @returns Selected UTXOs and change amount
605
+ */
606
+ declare function selectUtxosForWithdraw(utxos: Utxo[], amount: string, decimals?: number): UtxoSelectionResult;
607
+ /**
608
+ * Build a withdrawal proof
609
+ *
610
+ * This function:
611
+ * 1. Fetches the user's unspent UTXOs
612
+ * 2. Selects UTXOs to cover the withdrawal amount
613
+ * 3. Fetches all commitments from the pool
614
+ * 4. Builds the ZK proof
615
+ *
616
+ * @param options - Withdrawal options
617
+ * @returns Proof data ready for relay submission
618
+ *
619
+ * @example
620
+ * ```typescript
621
+ * const keypair = new Keypair(process.env.VEIL_KEY);
622
+ * const proof = await buildWithdrawProof({
623
+ * amount: '0.1',
624
+ * recipient: '0x1234...',
625
+ * keypair,
626
+ * onProgress: (stage, detail) => console.log(stage, detail),
627
+ * });
628
+ * ```
629
+ */
630
+ declare function buildWithdrawProof(options: BuildWithdrawProofOptions): Promise<ProofBuildResult>;
631
+ /**
632
+ * Execute a withdrawal by building proof and submitting to relay
633
+ *
634
+ * @param options - Withdrawal options
635
+ * @returns Withdrawal result with transaction hash
636
+ *
637
+ * @example
638
+ * ```typescript
639
+ * const keypair = new Keypair(process.env.VEIL_KEY);
640
+ * const result = await withdraw({
641
+ * amount: '0.1',
642
+ * recipient: '0x1234...',
643
+ * keypair,
644
+ * });
645
+ *
646
+ * console.log(`Withdrawal tx: ${result.transactionHash}`);
647
+ * ```
648
+ */
649
+ declare function withdraw(options: BuildWithdrawProofOptions): Promise<WithdrawResult>;
650
+
651
+ /**
652
+ * Transfer functions for Veil SDK
653
+ * Build ZK proofs to transfer funds privately within the pool
654
+ */
655
+
656
+ /**
657
+ * Check if a recipient is registered and get their deposit key
658
+ *
659
+ * @param address - Address to check
660
+ * @param rpcUrl - Optional RPC URL
661
+ * @returns Whether registered and their deposit key if so
662
+ *
663
+ * @example
664
+ * ```typescript
665
+ * const { isRegistered, depositKey } = await checkRecipientRegistration('0x1234...');
666
+ * if (!isRegistered) {
667
+ * console.log('Recipient needs to register first');
668
+ * }
669
+ * ```
670
+ */
671
+ declare function checkRecipientRegistration(address: `0x${string}`, rpcUrl?: string): Promise<{
672
+ isRegistered: boolean;
673
+ depositKey?: string;
674
+ }>;
675
+ /**
676
+ * Build a transfer proof
677
+ *
678
+ * This function:
679
+ * 1. Verifies the recipient is registered
680
+ * 2. Fetches the sender's unspent UTXOs
681
+ * 3. Selects UTXOs to cover the transfer amount
682
+ * 4. Creates output UTXOs for recipient and change
683
+ * 5. Builds the ZK proof
684
+ *
685
+ * @param options - Transfer options
686
+ * @returns Proof data ready for relay submission
687
+ *
688
+ * @example
689
+ * ```typescript
690
+ * const senderKeypair = new Keypair(process.env.VEIL_KEY);
691
+ * const proof = await buildTransferProof({
692
+ * amount: '0.1',
693
+ * recipientAddress: '0x1234...',
694
+ * senderKeypair,
695
+ * });
696
+ * ```
697
+ */
698
+ declare function buildTransferProof(options: BuildTransferProofOptions): Promise<ProofBuildResult>;
699
+ /**
700
+ * Execute a transfer by building proof and submitting to relay
701
+ *
702
+ * @param options - Transfer options
703
+ * @returns Transfer result with transaction hash
704
+ *
705
+ * @example
706
+ * ```typescript
707
+ * const senderKeypair = new Keypair(process.env.VEIL_KEY);
708
+ * const result = await transfer({
709
+ * amount: '0.1',
710
+ * recipientAddress: '0x1234...',
711
+ * senderKeypair,
712
+ * });
713
+ *
714
+ * console.log(`Transfer tx: ${result.transactionHash}`);
715
+ * ```
716
+ */
717
+ declare function transfer(options: BuildTransferProofOptions): Promise<TransferResult>;
718
+ /**
719
+ * Merge UTXOs by doing a self-transfer
720
+ * This consolidates multiple small UTXOs into fewer larger ones
721
+ *
722
+ * Unlike regular transfers, merge doesn't need a recipient address -
723
+ * it uses the sender's keypair directly to create the output UTXO.
724
+ *
725
+ * @param options - Merge options
726
+ * @returns Transfer result
727
+ *
728
+ * @example
729
+ * ```typescript
730
+ * const keypair = new Keypair(process.env.VEIL_KEY);
731
+ * const result = await mergeUtxos({
732
+ * amount: '0.5', // Total amount to consolidate
733
+ * keypair,
734
+ * });
735
+ * ```
736
+ */
737
+ declare function mergeUtxos(options: {
738
+ amount: string;
739
+ keypair: Keypair;
740
+ rpcUrl?: string;
741
+ onProgress?: (stage: string, detail?: string) => void;
742
+ }): Promise<TransferResult>;
743
+
744
+ /**
745
+ * Transaction preparation for Veil SDK
746
+ * Core function to build ZK proofs for withdrawals and transfers
747
+ */
748
+
749
+ /**
750
+ * External data for a transaction (sent alongside proof)
751
+ */
752
+ interface ExtData {
753
+ recipient: string;
754
+ extAmount: string;
755
+ relayer: string;
756
+ fee: string;
757
+ encryptedOutput1: string;
758
+ encryptedOutput2: string;
759
+ }
760
+ /**
761
+ * Proof arguments for on-chain verification
762
+ */
763
+ interface ProofArgs {
764
+ proof: string;
765
+ root: string;
766
+ inputNullifiers: string[];
767
+ outputCommitments: string[];
768
+ publicAmount: string;
769
+ extDataHash: string;
770
+ }
771
+ /**
772
+ * Result of preparing a transaction
773
+ */
774
+ interface TransactionResult {
775
+ args: ProofArgs;
776
+ extData: ExtData;
777
+ }
778
+ /**
779
+ * Parameters for preparing a transaction
780
+ */
781
+ interface PrepareTransactionParams {
782
+ /** All commitments from the merkle tree (from pool contract) */
783
+ commitments: (string | bigint)[];
784
+ /** Input UTXOs to spend */
785
+ inputs?: Utxo[];
786
+ /** Output UTXOs to create */
787
+ outputs?: Utxo[];
788
+ /** Transaction fee (usually 0 for relay) */
789
+ fee?: bigint | number;
790
+ /** Recipient address for withdrawals (0x0 for transfers) */
791
+ recipient?: string | bigint | number;
792
+ /** Relayer address (0x0 for now) */
793
+ relayer?: string | bigint | number;
794
+ /** Optional progress callback */
795
+ onProgress?: (stage: string, detail?: string) => void;
796
+ }
797
+ /**
798
+ * Prepare a transaction (withdrawal or transfer)
799
+ * Builds the ZK proof and external data needed for on-chain execution
800
+ *
801
+ * @param params - Transaction parameters
802
+ * @returns Proof arguments and external data
803
+ *
804
+ * @example
805
+ * ```typescript
806
+ * // Withdrawal: send funds to external address
807
+ * const result = await prepareTransaction({
808
+ * commitments: poolCommitments,
809
+ * inputs: [utxo1, utxo2],
810
+ * outputs: [changeUtxo], // Just change
811
+ * recipient: '0x1234...', // Withdrawal address
812
+ * fee: 0,
813
+ * relayer: '0x0000...',
814
+ * });
815
+ *
816
+ * // Transfer: move funds to another Veil user
817
+ * const result = await prepareTransaction({
818
+ * commitments: poolCommitments,
819
+ * inputs: [utxo1],
820
+ * outputs: [recipientUtxo, changeUtxo],
821
+ * recipient: 0, // No external recipient
822
+ * fee: 0,
823
+ * relayer: '0x0000...',
824
+ * });
825
+ * ```
826
+ */
827
+ declare function prepareTransaction({ commitments, inputs, outputs, fee, recipient, relayer, onProgress, }: PrepareTransactionParams): Promise<TransactionResult>;
828
+
829
+ /**
830
+ * Merkle tree utilities for Veil SDK
831
+ * Build merkle trees from UTXO commitments for ZK proofs
832
+ */
833
+
834
+ /**
835
+ * Height of the merkle tree (matches on-chain contract)
836
+ */
837
+ declare const MERKLE_TREE_HEIGHT = 23;
838
+ /**
839
+ * Build a merkle tree from UTXO commitments
840
+ * Uses Poseidon hash function compatible with on-chain verification
841
+ *
842
+ * @param commitments - Array of commitment hashes (hex strings or bigints)
843
+ * @returns MerkleTree instance
844
+ *
845
+ * @example
846
+ * ```typescript
847
+ * const commitments = await poolContract.getCommitments(0, 1000);
848
+ * const tree = await buildMerkleTree(commitments);
849
+ * const root = tree.root();
850
+ * ```
851
+ */
852
+ declare function buildMerkleTree(commitments: (string | bigint)[]): Promise<MerkleTree>;
853
+ /**
854
+ * Get merkle path for a commitment
855
+ *
856
+ * @param tree - Merkle tree instance
857
+ * @param commitment - Commitment to get path for
858
+ * @returns Path elements and indices
859
+ */
860
+ declare function getMerklePath(tree: MerkleTree, commitment: bigint | string): {
861
+ pathElements: bigint[];
862
+ pathIndices: number;
863
+ };
864
+
865
+ /**
866
+ * ZK Proof generation for Veil SDK
867
+ * Uses snarkjs groth16 to generate proofs for transactions
868
+ */
869
+ /**
870
+ * Input data for ZK proof generation
871
+ */
872
+ interface ProofInput {
873
+ root: bigint;
874
+ inputNullifier: bigint[];
875
+ outputCommitment: bigint[];
876
+ publicAmount: string;
877
+ extDataHash: bigint;
878
+ inAmount: bigint[];
879
+ inPrivateKey: (string | null)[];
880
+ inBlinding: bigint[];
881
+ inPathIndices: number[];
882
+ inPathElements: (bigint | number)[][];
883
+ outAmount: bigint[];
884
+ outBlinding: bigint[];
885
+ outPubkey: bigint[];
886
+ }
887
+ /**
888
+ * Generate a ZK proof for a transaction
889
+ *
890
+ * @param input - Proof input data
891
+ * @param circuitName - Circuit name (e.g., 'transaction2' or 'transaction16')
892
+ * @returns Serialized proof as hex string
893
+ *
894
+ * @example
895
+ * ```typescript
896
+ * const proof = await prove(proofInput, 'transaction2');
897
+ * // Returns: 0x1234...abcd (256 bytes hex)
898
+ * ```
899
+ */
900
+ declare function prove(input: ProofInput, circuitName: string): Promise<string>;
901
+ /**
902
+ * Get the supported circuit names and their max input counts
903
+ */
904
+ declare const CIRCUIT_CONFIG: {
905
+ readonly transaction2: {
906
+ readonly maxInputs: 2;
907
+ readonly maxOutputs: 2;
908
+ };
909
+ readonly transaction16: {
910
+ readonly maxInputs: 16;
911
+ readonly maxOutputs: 2;
912
+ };
913
+ };
914
+ /**
915
+ * Select the appropriate circuit based on input count
916
+ *
917
+ * @param inputCount - Number of input UTXOs
918
+ * @returns Circuit name to use
919
+ */
920
+ declare function selectCircuit(inputCount: number): string;
921
+
922
+ /**
923
+ * Contract addresses for Veil on Base
924
+ */
925
+
926
+ /**
927
+ * Contract addresses for Base mainnet
928
+ */
929
+ declare const ADDRESSES: NetworkAddresses;
930
+ /**
931
+ * Pool configuration (decimals, symbols, etc.)
932
+ */
933
+ declare const POOL_CONFIG: {
934
+ readonly eth: {
935
+ readonly decimals: 18;
936
+ readonly displayDecimals: 4;
937
+ readonly symbol: "ETH";
938
+ readonly name: "Ethereum";
939
+ };
940
+ readonly usdc: {
941
+ readonly decimals: 6;
942
+ readonly displayDecimals: 2;
943
+ readonly symbol: "USDC";
944
+ readonly name: "USD Coin";
945
+ };
946
+ };
947
+ /**
948
+ * Get contract addresses
949
+ * @returns Contract addresses for Base mainnet
950
+ */
951
+ declare function getAddresses(): NetworkAddresses;
952
+ /**
953
+ * Get Relay URL
954
+ * @returns Relay URL for Base mainnet
955
+ */
956
+ declare function getRelayUrl(): string;
957
+
958
+ /**
959
+ * Relay functions for submitting withdrawals and transfers
960
+ *
961
+ * The relay service handles transaction submission for privacy-preserving
962
+ * withdrawals and transfers from Veil pools.
963
+ *
964
+ * Note: Public API is rate limited to 5 requests per minute per IP.
965
+ *
966
+ * @example
967
+ * ```typescript
968
+ * import { submitRelay } from '@veil-cash/sdk';
969
+ *
970
+ * const result = await submitRelay({
971
+ * type: 'withdraw',
972
+ * pool: 'eth',
973
+ * proofArgs: { ... },
974
+ * extData: { ... },
975
+ * metadata: { amount: '0.1' }
976
+ * });
977
+ *
978
+ * console.log(result.transactionHash);
979
+ * ```
980
+ */
981
+
982
+ /**
983
+ * Error thrown when relay request fails
984
+ */
985
+ declare class RelayError extends Error {
986
+ /** HTTP status code */
987
+ statusCode: number;
988
+ /** Seconds until rate limit resets (only for 429 errors) */
989
+ retryAfter?: number;
990
+ /** Network the error occurred on */
991
+ network?: string;
992
+ constructor(message: string, statusCode: number, retryAfter?: number, network?: string);
993
+ }
994
+ /**
995
+ * Submit a withdrawal or transfer to the relay service
996
+ *
997
+ * The relay service submits the transaction on behalf of the user,
998
+ * allowing for privacy-preserving withdrawals and transfers.
999
+ *
1000
+ * Rate limit: 5 requests per minute per IP (public API)
1001
+ *
1002
+ * @param options - Relay options including type, pool, proofArgs, extData
1003
+ * @returns Promise resolving to relay response with transaction hash
1004
+ * @throws RelayError if the request fails
1005
+ *
1006
+ * @example
1007
+ * ```typescript
1008
+ * // Withdraw ETH
1009
+ * const result = await submitRelay({
1010
+ * type: 'withdraw',
1011
+ * pool: 'eth',
1012
+ * proofArgs: proofData.args,
1013
+ * extData: proofData.extData,
1014
+ * metadata: { amount: '0.1', recipient: '0x...' }
1015
+ * });
1016
+ *
1017
+ * // Transfer USDC
1018
+ * const result = await submitRelay({
1019
+ * type: 'transfer',
1020
+ * pool: 'usdc',
1021
+ * proofArgs: proofData.args,
1022
+ * extData: proofData.extData,
1023
+ * metadata: { amount: '100' }
1024
+ * });
1025
+ * ```
1026
+ */
1027
+ declare function submitRelay(options: SubmitRelayOptions): Promise<RelayResponse>;
1028
+ /**
1029
+ * Check if relay service is healthy
1030
+ *
1031
+ * @param relayUrl - Optional custom relay URL
1032
+ * @returns Promise resolving to health status
1033
+ *
1034
+ * @example
1035
+ * ```typescript
1036
+ * const health = await checkRelayHealth();
1037
+ * console.log(health.status); // 'ok'
1038
+ * console.log(health.network); // 'base'
1039
+ * ```
1040
+ */
1041
+ declare function checkRelayHealth(relayUrl?: string): Promise<{
1042
+ status: string;
1043
+ service: string;
1044
+ network: string;
1045
+ timestamp: string;
1046
+ }>;
1047
+ /**
1048
+ * Get relay service info
1049
+ *
1050
+ * @param relayUrl - Optional custom relay URL
1051
+ * @returns Promise resolving to service info including rate limit config
1052
+ *
1053
+ * @example
1054
+ * ```typescript
1055
+ * const info = await getRelayInfo();
1056
+ * console.log(info.rateLimit.limit); // 5
1057
+ * console.log(info.rateLimit.windowMs); // 60000
1058
+ * ```
1059
+ */
1060
+ declare function getRelayInfo(relayUrl?: string): Promise<{
1061
+ service: string;
1062
+ version: string;
1063
+ network: string;
1064
+ endpoints: Record<string, string>;
1065
+ rateLimit: {
1066
+ limit: number;
1067
+ windowMs: number;
1068
+ note: string;
1069
+ };
1070
+ }>;
1071
+
1072
+ /**
1073
+ * Veil Entry Contract ABI
1074
+ */
1075
+ declare const ENTRY_ABI: readonly [{
1076
+ readonly inputs: readonly [];
1077
+ readonly name: "DepositsDisabled";
1078
+ readonly type: "error";
1079
+ }, {
1080
+ readonly inputs: readonly [];
1081
+ readonly name: "FeeTransferFailed";
1082
+ readonly type: "error";
1083
+ }, {
1084
+ readonly inputs: readonly [];
1085
+ readonly name: "InvalidDepositKey";
1086
+ readonly type: "error";
1087
+ }, {
1088
+ readonly inputs: readonly [];
1089
+ readonly name: "InvalidDepositKeyForUser";
1090
+ readonly type: "error";
1091
+ }, {
1092
+ readonly inputs: readonly [];
1093
+ readonly name: "InvalidInitialization";
1094
+ readonly type: "error";
1095
+ }, {
1096
+ readonly inputs: readonly [];
1097
+ readonly name: "MinimumDepositNotMet";
1098
+ readonly type: "error";
1099
+ }, {
1100
+ readonly inputs: readonly [];
1101
+ readonly name: "NotAllowedToDeposit";
1102
+ readonly type: "error";
1103
+ }, {
1104
+ readonly inputs: readonly [];
1105
+ readonly name: "NotInitializing";
1106
+ readonly type: "error";
1107
+ }, {
1108
+ readonly inputs: readonly [];
1109
+ readonly name: "OnlyOperatorAllowed";
1110
+ readonly type: "error";
1111
+ }, {
1112
+ readonly inputs: readonly [];
1113
+ readonly name: "OnlyOwnerCanRegister";
1114
+ readonly type: "error";
1115
+ }, {
1116
+ readonly inputs: readonly [];
1117
+ readonly name: "OnlyQueueContractAllowed";
1118
+ readonly type: "error";
1119
+ }, {
1120
+ readonly inputs: readonly [{
1121
+ readonly name: "owner";
1122
+ readonly type: "address";
1123
+ }];
1124
+ readonly name: "OwnableInvalidOwner";
1125
+ readonly type: "error";
1126
+ }, {
1127
+ readonly inputs: readonly [{
1128
+ readonly name: "account";
1129
+ readonly type: "address";
1130
+ }];
1131
+ readonly name: "OwnableUnauthorizedAccount";
1132
+ readonly type: "error";
1133
+ }, {
1134
+ readonly inputs: readonly [];
1135
+ readonly name: "ReentrancyGuardReentrantCall";
1136
+ readonly type: "error";
1137
+ }, {
1138
+ readonly inputs: readonly [];
1139
+ readonly name: "USDCTransferFailed";
1140
+ readonly type: "error";
1141
+ }, {
1142
+ readonly inputs: readonly [];
1143
+ readonly name: "UserAlreadyRegistered";
1144
+ readonly type: "error";
1145
+ }, {
1146
+ readonly inputs: readonly [];
1147
+ readonly name: "UserNotRegistered";
1148
+ readonly type: "error";
1149
+ }, {
1150
+ readonly anonymous: false;
1151
+ readonly inputs: readonly [{
1152
+ readonly indexed: true;
1153
+ readonly name: "owner";
1154
+ readonly type: "address";
1155
+ }, {
1156
+ readonly indexed: false;
1157
+ readonly name: "key";
1158
+ readonly type: "bytes";
1159
+ }];
1160
+ readonly name: "DepositKey";
1161
+ readonly type: "event";
1162
+ }, {
1163
+ readonly anonymous: false;
1164
+ readonly inputs: readonly [{
1165
+ readonly indexed: true;
1166
+ readonly name: "depositor";
1167
+ readonly type: "address";
1168
+ }, {
1169
+ readonly indexed: false;
1170
+ readonly name: "amount";
1171
+ readonly type: "uint256";
1172
+ }];
1173
+ readonly name: "DepositedETH";
1174
+ readonly type: "event";
1175
+ }, {
1176
+ readonly inputs: readonly [{
1177
+ readonly components: readonly [{
1178
+ readonly name: "owner";
1179
+ readonly type: "address";
1180
+ }, {
1181
+ readonly name: "depositKey";
1182
+ readonly type: "bytes";
1183
+ }];
1184
+ readonly name: "_account";
1185
+ readonly type: "tuple";
1186
+ }];
1187
+ readonly name: "register";
1188
+ readonly outputs: readonly [];
1189
+ readonly stateMutability: "nonpayable";
1190
+ readonly type: "function";
1191
+ }, {
1192
+ readonly inputs: readonly [{
1193
+ readonly name: "_depositKey";
1194
+ readonly type: "bytes";
1195
+ }];
1196
+ readonly name: "queueETH";
1197
+ readonly outputs: readonly [];
1198
+ readonly stateMutability: "payable";
1199
+ readonly type: "function";
1200
+ }, {
1201
+ readonly inputs: readonly [{
1202
+ readonly name: "_amount";
1203
+ readonly type: "uint256";
1204
+ }, {
1205
+ readonly name: "_depositKey";
1206
+ readonly type: "bytes";
1207
+ }];
1208
+ readonly name: "queueUSDC";
1209
+ readonly outputs: readonly [];
1210
+ readonly stateMutability: "nonpayable";
1211
+ readonly type: "function";
1212
+ }, {
1213
+ readonly inputs: readonly [{
1214
+ readonly name: "";
1215
+ readonly type: "address";
1216
+ }];
1217
+ readonly name: "depositKeys";
1218
+ readonly outputs: readonly [{
1219
+ readonly name: "";
1220
+ readonly type: "bytes";
1221
+ }];
1222
+ readonly stateMutability: "view";
1223
+ readonly type: "function";
1224
+ }, {
1225
+ readonly inputs: readonly [];
1226
+ readonly name: "depositETHEnabled";
1227
+ readonly outputs: readonly [{
1228
+ readonly name: "";
1229
+ readonly type: "bool";
1230
+ }];
1231
+ readonly stateMutability: "view";
1232
+ readonly type: "function";
1233
+ }, {
1234
+ readonly inputs: readonly [];
1235
+ readonly name: "depositFee";
1236
+ readonly outputs: readonly [{
1237
+ readonly name: "";
1238
+ readonly type: "uint256";
1239
+ }];
1240
+ readonly stateMutability: "view";
1241
+ readonly type: "function";
1242
+ }, {
1243
+ readonly inputs: readonly [];
1244
+ readonly name: "minimumDeposit";
1245
+ readonly outputs: readonly [{
1246
+ readonly name: "";
1247
+ readonly type: "uint256";
1248
+ }];
1249
+ readonly stateMutability: "view";
1250
+ readonly type: "function";
1251
+ }, {
1252
+ readonly inputs: readonly [{
1253
+ readonly name: "_totalAmount";
1254
+ readonly type: "uint256";
1255
+ }];
1256
+ readonly name: "getFeeAndNetDeposit";
1257
+ readonly outputs: readonly [{
1258
+ readonly name: "netDeposit";
1259
+ readonly type: "uint256";
1260
+ }, {
1261
+ readonly name: "fee";
1262
+ readonly type: "uint256";
1263
+ }];
1264
+ readonly stateMutability: "view";
1265
+ readonly type: "function";
1266
+ }, {
1267
+ readonly inputs: readonly [{
1268
+ readonly name: "_netDepositAmount";
1269
+ readonly type: "uint256";
1270
+ }];
1271
+ readonly name: "getDepositAmountWithFee";
1272
+ readonly outputs: readonly [{
1273
+ readonly name: "";
1274
+ readonly type: "uint256";
1275
+ }];
1276
+ readonly stateMutability: "view";
1277
+ readonly type: "function";
1278
+ }, {
1279
+ readonly inputs: readonly [{
1280
+ readonly name: "_depositor";
1281
+ readonly type: "address";
1282
+ }];
1283
+ readonly name: "isAllowedDepositor";
1284
+ readonly outputs: readonly [{
1285
+ readonly name: "";
1286
+ readonly type: "bool";
1287
+ }];
1288
+ readonly stateMutability: "view";
1289
+ readonly type: "function";
1290
+ }];
1291
+ /**
1292
+ * Queue Contract ABI (for balance queries)
1293
+ */
1294
+ declare const QUEUE_ABI: readonly [{
1295
+ readonly inputs: readonly [];
1296
+ readonly name: "getPendingDeposits";
1297
+ readonly outputs: readonly [{
1298
+ readonly name: "nonces";
1299
+ readonly type: "uint256[]";
1300
+ }];
1301
+ readonly stateMutability: "view";
1302
+ readonly type: "function";
1303
+ }, {
1304
+ readonly inputs: readonly [{
1305
+ readonly name: "_nonce";
1306
+ readonly type: "uint256";
1307
+ }];
1308
+ readonly name: "getDeposit";
1309
+ readonly outputs: readonly [{
1310
+ readonly components: readonly [{
1311
+ readonly name: "fallbackReceiver";
1312
+ readonly type: "address";
1313
+ }, {
1314
+ readonly name: "amountIn";
1315
+ readonly type: "uint256";
1316
+ }, {
1317
+ readonly name: "fee";
1318
+ readonly type: "uint256";
1319
+ }, {
1320
+ readonly name: "shieldAmount";
1321
+ readonly type: "uint256";
1322
+ }, {
1323
+ readonly name: "timestamp";
1324
+ readonly type: "uint256";
1325
+ }, {
1326
+ readonly name: "status";
1327
+ readonly type: "uint8";
1328
+ }, {
1329
+ readonly name: "depositKey";
1330
+ readonly type: "bytes";
1331
+ }];
1332
+ readonly name: "deposit";
1333
+ readonly type: "tuple";
1334
+ }];
1335
+ readonly stateMutability: "view";
1336
+ readonly type: "function";
1337
+ }, {
1338
+ readonly inputs: readonly [];
1339
+ readonly name: "depositQueueNonce";
1340
+ readonly outputs: readonly [{
1341
+ readonly name: "";
1342
+ readonly type: "uint256";
1343
+ }];
1344
+ readonly stateMutability: "view";
1345
+ readonly type: "function";
1346
+ }, {
1347
+ readonly inputs: readonly [];
1348
+ readonly name: "getPendingCount";
1349
+ readonly outputs: readonly [{
1350
+ readonly name: "count";
1351
+ readonly type: "uint256";
1352
+ }];
1353
+ readonly stateMutability: "view";
1354
+ readonly type: "function";
1355
+ }];
1356
+ /**
1357
+ * ETH Pool Contract ABI
1358
+ */
1359
+ declare const POOL_ABI: readonly [{
1360
+ readonly inputs: readonly [];
1361
+ readonly name: "CannotWithdrawToZeroAddress";
1362
+ readonly type: "error";
1363
+ }, {
1364
+ readonly inputs: readonly [];
1365
+ readonly name: "ETHTransferFailed";
1366
+ readonly type: "error";
1367
+ }, {
1368
+ readonly inputs: readonly [];
1369
+ readonly name: "IncorrectExternalDataHash";
1370
+ readonly type: "error";
1371
+ }, {
1372
+ readonly inputs: readonly [];
1373
+ readonly name: "InputAlreadySpent";
1374
+ readonly type: "error";
1375
+ }, {
1376
+ readonly inputs: readonly [];
1377
+ readonly name: "InvalidExtAmount";
1378
+ readonly type: "error";
1379
+ }, {
1380
+ readonly inputs: readonly [];
1381
+ readonly name: "InvalidFee";
1382
+ readonly type: "error";
1383
+ }, {
1384
+ readonly inputs: readonly [];
1385
+ readonly name: "InvalidMerkleRoot";
1386
+ readonly type: "error";
1387
+ }, {
1388
+ readonly inputs: readonly [];
1389
+ readonly name: "InvalidPublicAmount";
1390
+ readonly type: "error";
1391
+ }, {
1392
+ readonly inputs: readonly [];
1393
+ readonly name: "InvalidRange";
1394
+ readonly type: "error";
1395
+ }, {
1396
+ readonly inputs: readonly [];
1397
+ readonly name: "InvalidTransactionProof";
1398
+ readonly type: "error";
1399
+ }, {
1400
+ readonly inputs: readonly [];
1401
+ readonly name: "OnlyForDeposits";
1402
+ readonly type: "error";
1403
+ }, {
1404
+ readonly inputs: readonly [];
1405
+ readonly name: "OnlyForTransfers";
1406
+ readonly type: "error";
1407
+ }, {
1408
+ readonly inputs: readonly [];
1409
+ readonly name: "OnlyForWithdrawals";
1410
+ readonly type: "error";
1411
+ }, {
1412
+ readonly inputs: readonly [];
1413
+ readonly name: "OnlyValidatorContractAllowed";
1414
+ readonly type: "error";
1415
+ }, {
1416
+ readonly inputs: readonly [];
1417
+ readonly name: "OnlyWETHContractAllowed";
1418
+ readonly type: "error";
1419
+ }, {
1420
+ readonly inputs: readonly [{
1421
+ readonly name: "owner";
1422
+ readonly type: "address";
1423
+ }];
1424
+ readonly name: "OwnableInvalidOwner";
1425
+ readonly type: "error";
1426
+ }, {
1427
+ readonly inputs: readonly [{
1428
+ readonly name: "account";
1429
+ readonly type: "address";
1430
+ }];
1431
+ readonly name: "OwnableUnauthorizedAccount";
1432
+ readonly type: "error";
1433
+ }, {
1434
+ readonly inputs: readonly [];
1435
+ readonly name: "ProofAmountMismatch";
1436
+ readonly type: "error";
1437
+ }, {
1438
+ readonly inputs: readonly [];
1439
+ readonly name: "ReentrancyGuardReentrantCall";
1440
+ readonly type: "error";
1441
+ }, {
1442
+ readonly inputs: readonly [];
1443
+ readonly name: "UnsupportedInputCount";
1444
+ readonly type: "error";
1445
+ }, {
1446
+ readonly inputs: readonly [];
1447
+ readonly name: "WETHDepositFailed";
1448
+ readonly type: "error";
1449
+ }, {
1450
+ readonly inputs: readonly [];
1451
+ readonly name: "WETHUnwrapFailed";
1452
+ readonly type: "error";
1453
+ }, {
1454
+ readonly anonymous: false;
1455
+ readonly inputs: readonly [{
1456
+ readonly indexed: false;
1457
+ readonly name: "commitment";
1458
+ readonly type: "bytes32";
1459
+ }, {
1460
+ readonly indexed: false;
1461
+ readonly name: "index";
1462
+ readonly type: "uint256";
1463
+ }, {
1464
+ readonly indexed: false;
1465
+ readonly name: "encryptedOutput";
1466
+ readonly type: "bytes";
1467
+ }];
1468
+ readonly name: "NewCommitment";
1469
+ readonly type: "event";
1470
+ }, {
1471
+ readonly anonymous: false;
1472
+ readonly inputs: readonly [{
1473
+ readonly indexed: false;
1474
+ readonly name: "nullifier";
1475
+ readonly type: "bytes32";
1476
+ }];
1477
+ readonly name: "NewNullifier";
1478
+ readonly type: "event";
1479
+ }, {
1480
+ readonly anonymous: false;
1481
+ readonly inputs: readonly [{
1482
+ readonly indexed: true;
1483
+ readonly name: "previousOwner";
1484
+ readonly type: "address";
1485
+ }, {
1486
+ readonly indexed: true;
1487
+ readonly name: "newOwner";
1488
+ readonly type: "address";
1489
+ }];
1490
+ readonly name: "OwnershipTransferred";
1491
+ readonly type: "event";
1492
+ }, {
1493
+ readonly anonymous: false;
1494
+ readonly inputs: readonly [{
1495
+ readonly indexed: true;
1496
+ readonly name: "newValidatorContract";
1497
+ readonly type: "address";
1498
+ }];
1499
+ readonly name: "ValidatorContractUpdated";
1500
+ readonly type: "event";
1501
+ }, {
1502
+ readonly inputs: readonly [];
1503
+ readonly name: "FIELD_SIZE";
1504
+ readonly outputs: readonly [{
1505
+ readonly name: "";
1506
+ readonly type: "uint256";
1507
+ }];
1508
+ readonly stateMutability: "view";
1509
+ readonly type: "function";
1510
+ }, {
1511
+ readonly inputs: readonly [];
1512
+ readonly name: "ROOT_HISTORY_SIZE";
1513
+ readonly outputs: readonly [{
1514
+ readonly name: "";
1515
+ readonly type: "uint32";
1516
+ }];
1517
+ readonly stateMutability: "view";
1518
+ readonly type: "function";
1519
+ }, {
1520
+ readonly inputs: readonly [];
1521
+ readonly name: "ZERO_VALUE";
1522
+ readonly outputs: readonly [{
1523
+ readonly name: "";
1524
+ readonly type: "uint256";
1525
+ }];
1526
+ readonly stateMutability: "view";
1527
+ readonly type: "function";
1528
+ }, {
1529
+ readonly inputs: readonly [{
1530
+ readonly name: "";
1531
+ readonly type: "uint256";
1532
+ }];
1533
+ readonly name: "commitments";
1534
+ readonly outputs: readonly [{
1535
+ readonly name: "";
1536
+ readonly type: "bytes32";
1537
+ }];
1538
+ readonly stateMutability: "view";
1539
+ readonly type: "function";
1540
+ }, {
1541
+ readonly inputs: readonly [];
1542
+ readonly name: "currentRootIndex";
1543
+ readonly outputs: readonly [{
1544
+ readonly name: "";
1545
+ readonly type: "uint32";
1546
+ }];
1547
+ readonly stateMutability: "view";
1548
+ readonly type: "function";
1549
+ }, {
1550
+ readonly inputs: readonly [{
1551
+ readonly name: "";
1552
+ readonly type: "uint256";
1553
+ }];
1554
+ readonly name: "encryptedOutputs";
1555
+ readonly outputs: readonly [{
1556
+ readonly name: "";
1557
+ readonly type: "bytes";
1558
+ }];
1559
+ readonly stateMutability: "view";
1560
+ readonly type: "function";
1561
+ }, {
1562
+ readonly inputs: readonly [{
1563
+ readonly name: "";
1564
+ readonly type: "uint256";
1565
+ }];
1566
+ readonly name: "filledSubtrees";
1567
+ readonly outputs: readonly [{
1568
+ readonly name: "";
1569
+ readonly type: "bytes32";
1570
+ }];
1571
+ readonly stateMutability: "view";
1572
+ readonly type: "function";
1573
+ }, {
1574
+ readonly inputs: readonly [{
1575
+ readonly name: "startIndex";
1576
+ readonly type: "uint256";
1577
+ }, {
1578
+ readonly name: "endIndex";
1579
+ readonly type: "uint256";
1580
+ }];
1581
+ readonly name: "getCommitments";
1582
+ readonly outputs: readonly [{
1583
+ readonly name: "";
1584
+ readonly type: "bytes32[]";
1585
+ }];
1586
+ readonly stateMutability: "view";
1587
+ readonly type: "function";
1588
+ }, {
1589
+ readonly inputs: readonly [{
1590
+ readonly name: "startIndex";
1591
+ readonly type: "uint256";
1592
+ }, {
1593
+ readonly name: "endIndex";
1594
+ readonly type: "uint256";
1595
+ }];
1596
+ readonly name: "getEncryptedOutputs";
1597
+ readonly outputs: readonly [{
1598
+ readonly name: "";
1599
+ readonly type: "bytes[]";
1600
+ }];
1601
+ readonly stateMutability: "view";
1602
+ readonly type: "function";
1603
+ }, {
1604
+ readonly inputs: readonly [];
1605
+ readonly name: "getLastRoot";
1606
+ readonly outputs: readonly [{
1607
+ readonly name: "";
1608
+ readonly type: "bytes32";
1609
+ }];
1610
+ readonly stateMutability: "view";
1611
+ readonly type: "function";
1612
+ }, {
1613
+ readonly inputs: readonly [{
1614
+ readonly name: "_left";
1615
+ readonly type: "bytes32";
1616
+ }, {
1617
+ readonly name: "_right";
1618
+ readonly type: "bytes32";
1619
+ }];
1620
+ readonly name: "hashLeftRight";
1621
+ readonly outputs: readonly [{
1622
+ readonly name: "";
1623
+ readonly type: "bytes32";
1624
+ }];
1625
+ readonly stateMutability: "view";
1626
+ readonly type: "function";
1627
+ }, {
1628
+ readonly inputs: readonly [];
1629
+ readonly name: "hasher";
1630
+ readonly outputs: readonly [{
1631
+ readonly name: "";
1632
+ readonly type: "address";
1633
+ }];
1634
+ readonly stateMutability: "view";
1635
+ readonly type: "function";
1636
+ }, {
1637
+ readonly inputs: readonly [{
1638
+ readonly name: "_root";
1639
+ readonly type: "bytes32";
1640
+ }];
1641
+ readonly name: "isKnownRoot";
1642
+ readonly outputs: readonly [{
1643
+ readonly name: "";
1644
+ readonly type: "bool";
1645
+ }];
1646
+ readonly stateMutability: "view";
1647
+ readonly type: "function";
1648
+ }, {
1649
+ readonly inputs: readonly [{
1650
+ readonly name: "_nullifierHash";
1651
+ readonly type: "bytes32";
1652
+ }];
1653
+ readonly name: "isSpent";
1654
+ readonly outputs: readonly [{
1655
+ readonly name: "";
1656
+ readonly type: "bool";
1657
+ }];
1658
+ readonly stateMutability: "view";
1659
+ readonly type: "function";
1660
+ }, {
1661
+ readonly inputs: readonly [];
1662
+ readonly name: "levels";
1663
+ readonly outputs: readonly [{
1664
+ readonly name: "";
1665
+ readonly type: "uint32";
1666
+ }];
1667
+ readonly stateMutability: "view";
1668
+ readonly type: "function";
1669
+ }, {
1670
+ readonly inputs: readonly [];
1671
+ readonly name: "nextIndex";
1672
+ readonly outputs: readonly [{
1673
+ readonly name: "";
1674
+ readonly type: "uint32";
1675
+ }];
1676
+ readonly stateMutability: "view";
1677
+ readonly type: "function";
1678
+ }, {
1679
+ readonly inputs: readonly [{
1680
+ readonly name: "";
1681
+ readonly type: "bytes32";
1682
+ }];
1683
+ readonly name: "nullifierHashes";
1684
+ readonly outputs: readonly [{
1685
+ readonly name: "";
1686
+ readonly type: "bool";
1687
+ }];
1688
+ readonly stateMutability: "view";
1689
+ readonly type: "function";
1690
+ }, {
1691
+ readonly inputs: readonly [];
1692
+ readonly name: "owner";
1693
+ readonly outputs: readonly [{
1694
+ readonly name: "";
1695
+ readonly type: "address";
1696
+ }];
1697
+ readonly stateMutability: "view";
1698
+ readonly type: "function";
1699
+ }, {
1700
+ readonly inputs: readonly [{
1701
+ readonly name: "";
1702
+ readonly type: "uint256";
1703
+ }];
1704
+ readonly name: "roots";
1705
+ readonly outputs: readonly [{
1706
+ readonly name: "";
1707
+ readonly type: "bytes32";
1708
+ }];
1709
+ readonly stateMutability: "view";
1710
+ readonly type: "function";
1711
+ }, {
1712
+ readonly inputs: readonly [];
1713
+ readonly name: "validatorContract";
1714
+ readonly outputs: readonly [{
1715
+ readonly name: "";
1716
+ readonly type: "address";
1717
+ }];
1718
+ readonly stateMutability: "view";
1719
+ readonly type: "function";
1720
+ }, {
1721
+ readonly inputs: readonly [];
1722
+ readonly name: "verifier16";
1723
+ readonly outputs: readonly [{
1724
+ readonly name: "";
1725
+ readonly type: "address";
1726
+ }];
1727
+ readonly stateMutability: "view";
1728
+ readonly type: "function";
1729
+ }, {
1730
+ readonly inputs: readonly [];
1731
+ readonly name: "verifier2";
1732
+ readonly outputs: readonly [{
1733
+ readonly name: "";
1734
+ readonly type: "address";
1735
+ }];
1736
+ readonly stateMutability: "view";
1737
+ readonly type: "function";
1738
+ }, {
1739
+ readonly inputs: readonly [];
1740
+ readonly name: "weth";
1741
+ readonly outputs: readonly [{
1742
+ readonly name: "";
1743
+ readonly type: "address";
1744
+ }];
1745
+ readonly stateMutability: "view";
1746
+ readonly type: "function";
1747
+ }, {
1748
+ readonly inputs: readonly [{
1749
+ readonly name: "i";
1750
+ readonly type: "uint256";
1751
+ }];
1752
+ readonly name: "zeros";
1753
+ readonly outputs: readonly [{
1754
+ readonly name: "";
1755
+ readonly type: "bytes32";
1756
+ }];
1757
+ readonly stateMutability: "pure";
1758
+ readonly type: "function";
1759
+ }, {
1760
+ readonly inputs: readonly [{
1761
+ readonly name: "_extAmount";
1762
+ readonly type: "int256";
1763
+ }, {
1764
+ readonly name: "_fee";
1765
+ readonly type: "uint256";
1766
+ }];
1767
+ readonly name: "calculatePublicAmount";
1768
+ readonly outputs: readonly [{
1769
+ readonly name: "";
1770
+ readonly type: "uint256";
1771
+ }];
1772
+ readonly stateMutability: "pure";
1773
+ readonly type: "function";
1774
+ }, {
1775
+ readonly inputs: readonly [{
1776
+ readonly components: readonly [{
1777
+ readonly name: "proof";
1778
+ readonly type: "bytes";
1779
+ }, {
1780
+ readonly name: "root";
1781
+ readonly type: "bytes32";
1782
+ }, {
1783
+ readonly name: "inputNullifiers";
1784
+ readonly type: "bytes32[]";
1785
+ }, {
1786
+ readonly name: "outputCommitments";
1787
+ readonly type: "bytes32[2]";
1788
+ }, {
1789
+ readonly name: "publicAmount";
1790
+ readonly type: "uint256";
1791
+ }, {
1792
+ readonly name: "extDataHash";
1793
+ readonly type: "bytes32";
1794
+ }];
1795
+ readonly name: "_args";
1796
+ readonly type: "tuple";
1797
+ }, {
1798
+ readonly components: readonly [{
1799
+ readonly name: "recipient";
1800
+ readonly type: "address";
1801
+ }, {
1802
+ readonly name: "extAmount";
1803
+ readonly type: "int256";
1804
+ }, {
1805
+ readonly name: "relayer";
1806
+ readonly type: "address";
1807
+ }, {
1808
+ readonly name: "fee";
1809
+ readonly type: "uint256";
1810
+ }, {
1811
+ readonly name: "encryptedOutput1";
1812
+ readonly type: "bytes";
1813
+ }, {
1814
+ readonly name: "encryptedOutput2";
1815
+ readonly type: "bytes";
1816
+ }];
1817
+ readonly name: "_extData";
1818
+ readonly type: "tuple";
1819
+ }];
1820
+ readonly name: "depositETH";
1821
+ readonly outputs: readonly [];
1822
+ readonly stateMutability: "payable";
1823
+ readonly type: "function";
1824
+ }, {
1825
+ readonly inputs: readonly [{
1826
+ readonly components: readonly [{
1827
+ readonly name: "proof";
1828
+ readonly type: "bytes";
1829
+ }, {
1830
+ readonly name: "root";
1831
+ readonly type: "bytes32";
1832
+ }, {
1833
+ readonly name: "inputNullifiers";
1834
+ readonly type: "bytes32[]";
1835
+ }, {
1836
+ readonly name: "outputCommitments";
1837
+ readonly type: "bytes32[2]";
1838
+ }, {
1839
+ readonly name: "publicAmount";
1840
+ readonly type: "uint256";
1841
+ }, {
1842
+ readonly name: "extDataHash";
1843
+ readonly type: "bytes32";
1844
+ }];
1845
+ readonly name: "_args";
1846
+ readonly type: "tuple";
1847
+ }, {
1848
+ readonly components: readonly [{
1849
+ readonly name: "recipient";
1850
+ readonly type: "address";
1851
+ }, {
1852
+ readonly name: "extAmount";
1853
+ readonly type: "int256";
1854
+ }, {
1855
+ readonly name: "relayer";
1856
+ readonly type: "address";
1857
+ }, {
1858
+ readonly name: "fee";
1859
+ readonly type: "uint256";
1860
+ }, {
1861
+ readonly name: "encryptedOutput1";
1862
+ readonly type: "bytes";
1863
+ }, {
1864
+ readonly name: "encryptedOutput2";
1865
+ readonly type: "bytes";
1866
+ }];
1867
+ readonly name: "_extData";
1868
+ readonly type: "tuple";
1869
+ }];
1870
+ readonly name: "transactETH";
1871
+ readonly outputs: readonly [];
1872
+ readonly stateMutability: "nonpayable";
1873
+ readonly type: "function";
1874
+ }, {
1875
+ readonly inputs: readonly [{
1876
+ readonly components: readonly [{
1877
+ readonly name: "proof";
1878
+ readonly type: "bytes";
1879
+ }, {
1880
+ readonly name: "root";
1881
+ readonly type: "bytes32";
1882
+ }, {
1883
+ readonly name: "inputNullifiers";
1884
+ readonly type: "bytes32[]";
1885
+ }, {
1886
+ readonly name: "outputCommitments";
1887
+ readonly type: "bytes32[2]";
1888
+ }, {
1889
+ readonly name: "publicAmount";
1890
+ readonly type: "uint256";
1891
+ }, {
1892
+ readonly name: "extDataHash";
1893
+ readonly type: "bytes32";
1894
+ }];
1895
+ readonly name: "_args";
1896
+ readonly type: "tuple";
1897
+ }, {
1898
+ readonly components: readonly [{
1899
+ readonly name: "recipient";
1900
+ readonly type: "address";
1901
+ }, {
1902
+ readonly name: "extAmount";
1903
+ readonly type: "int256";
1904
+ }, {
1905
+ readonly name: "relayer";
1906
+ readonly type: "address";
1907
+ }, {
1908
+ readonly name: "fee";
1909
+ readonly type: "uint256";
1910
+ }, {
1911
+ readonly name: "encryptedOutput1";
1912
+ readonly type: "bytes";
1913
+ }, {
1914
+ readonly name: "encryptedOutput2";
1915
+ readonly type: "bytes";
1916
+ }];
1917
+ readonly name: "_extData";
1918
+ readonly type: "tuple";
1919
+ }];
1920
+ readonly name: "withdrawETH";
1921
+ readonly outputs: readonly [];
1922
+ readonly stateMutability: "nonpayable";
1923
+ readonly type: "function";
1924
+ }, {
1925
+ readonly inputs: readonly [{
1926
+ readonly components: readonly [{
1927
+ readonly name: "proof";
1928
+ readonly type: "bytes";
1929
+ }, {
1930
+ readonly name: "root";
1931
+ readonly type: "bytes32";
1932
+ }, {
1933
+ readonly name: "inputNullifiers";
1934
+ readonly type: "bytes32[]";
1935
+ }, {
1936
+ readonly name: "outputCommitments";
1937
+ readonly type: "bytes32[2]";
1938
+ }, {
1939
+ readonly name: "publicAmount";
1940
+ readonly type: "uint256";
1941
+ }, {
1942
+ readonly name: "extDataHash";
1943
+ readonly type: "bytes32";
1944
+ }];
1945
+ readonly name: "_args";
1946
+ readonly type: "tuple";
1947
+ }];
1948
+ readonly name: "verifyProof";
1949
+ readonly outputs: readonly [{
1950
+ readonly name: "";
1951
+ readonly type: "bool";
1952
+ }];
1953
+ readonly stateMutability: "view";
1954
+ readonly type: "function";
1955
+ }, {
1956
+ readonly inputs: readonly [];
1957
+ readonly name: "renounceOwnership";
1958
+ readonly outputs: readonly [];
1959
+ readonly stateMutability: "nonpayable";
1960
+ readonly type: "function";
1961
+ }, {
1962
+ readonly inputs: readonly [{
1963
+ readonly name: "newOwner";
1964
+ readonly type: "address";
1965
+ }];
1966
+ readonly name: "transferOwnership";
1967
+ readonly outputs: readonly [];
1968
+ readonly stateMutability: "nonpayable";
1969
+ readonly type: "function";
1970
+ }, {
1971
+ readonly inputs: readonly [{
1972
+ readonly name: "_newValidator";
1973
+ readonly type: "address";
1974
+ }];
1975
+ readonly name: "updateValidatorContract";
1976
+ readonly outputs: readonly [];
1977
+ readonly stateMutability: "nonpayable";
1978
+ readonly type: "function";
1979
+ }, {
1980
+ readonly stateMutability: "payable";
1981
+ readonly type: "receive";
1982
+ }];
1983
+ /**
1984
+ * ERC20 ABI (for USDC approval)
1985
+ */
1986
+ declare const ERC20_ABI: readonly [{
1987
+ readonly inputs: readonly [{
1988
+ readonly name: "spender";
1989
+ readonly type: "address";
1990
+ }, {
1991
+ readonly name: "amount";
1992
+ readonly type: "uint256";
1993
+ }];
1994
+ readonly name: "approve";
1995
+ readonly outputs: readonly [{
1996
+ readonly name: "";
1997
+ readonly type: "bool";
1998
+ }];
1999
+ readonly stateMutability: "nonpayable";
2000
+ readonly type: "function";
2001
+ }, {
2002
+ readonly inputs: readonly [{
2003
+ readonly name: "account";
2004
+ readonly type: "address";
2005
+ }];
2006
+ readonly name: "balanceOf";
2007
+ readonly outputs: readonly [{
2008
+ readonly name: "";
2009
+ readonly type: "uint256";
2010
+ }];
2011
+ readonly stateMutability: "view";
2012
+ readonly type: "function";
2013
+ }, {
2014
+ readonly inputs: readonly [{
2015
+ readonly name: "owner";
2016
+ readonly type: "address";
2017
+ }, {
2018
+ readonly name: "spender";
2019
+ readonly type: "address";
2020
+ }];
2021
+ readonly name: "allowance";
2022
+ readonly outputs: readonly [{
2023
+ readonly name: "";
2024
+ readonly type: "uint256";
2025
+ }];
2026
+ readonly stateMutability: "view";
2027
+ readonly type: "function";
2028
+ }];
2029
+
2030
+ /**
2031
+ * Crypto utilities for Veil SDK
2032
+ * Poseidon hash, hex conversion, and random number generation
2033
+ */
2034
+ /**
2035
+ * SNARK scalar field size
2036
+ */
2037
+ declare const FIELD_SIZE: bigint;
2038
+ /**
2039
+ * Compute Poseidon hash of items
2040
+ * @param items - Array of values to hash (bigint, string, or number)
2041
+ * @returns Poseidon hash as bigint
2042
+ */
2043
+ declare const poseidonHash: (items: (bigint | string | number)[]) => bigint;
2044
+ /**
2045
+ * Compute Poseidon hash of two items
2046
+ * @param a - First value
2047
+ * @param b - Second value
2048
+ * @returns Poseidon hash as bigint
2049
+ */
2050
+ declare const poseidonHash2: (a: bigint | string | number, b: bigint | string | number) => bigint;
2051
+ /**
2052
+ * Generate random bigint of specified byte length
2053
+ * @param nbytes - Number of bytes (default: 31)
2054
+ * @returns Random bigint
2055
+ */
2056
+ declare const randomBN: (nbytes?: number) => bigint;
2057
+ /**
2058
+ * Convert bigint/string/number/Buffer to fixed-length hex string
2059
+ * @param number - Value to convert
2060
+ * @param length - Output byte length (default: 32)
2061
+ * @returns Hex string with 0x prefix
2062
+ */
2063
+ declare function toFixedHex(number: bigint | string | number | Buffer, length?: number): string;
2064
+ /**
2065
+ * Convert value to Buffer of specified byte length
2066
+ * @param value - Value to convert
2067
+ * @param length - Output byte length
2068
+ * @returns Buffer
2069
+ */
2070
+ declare const toBuffer: (value: bigint | string | number, length: number) => Buffer;
2071
+ /**
2072
+ * External data input for hash calculation
2073
+ */
2074
+ interface ExtDataInput {
2075
+ recipient: string | bigint;
2076
+ extAmount: bigint;
2077
+ relayer: string | bigint;
2078
+ fee: bigint;
2079
+ encryptedOutput1: string;
2080
+ encryptedOutput2: string;
2081
+ }
2082
+ /**
2083
+ * Calculate hash of external data for ZK proof
2084
+ * Uses Solidity-compatible ABI encoding and keccak256 hash
2085
+ *
2086
+ * @param extData - External data to hash
2087
+ * @returns Hash as bigint (mod FIELD_SIZE)
2088
+ */
2089
+ declare function getExtDataHash(extData: ExtDataInput): bigint;
2090
+ /**
2091
+ * Shuffle an array using Fisher-Yates algorithm
2092
+ * Used to randomize input/output order for privacy
2093
+ *
2094
+ * @param array - Array to shuffle
2095
+ * @returns Shuffled array (mutates and returns same array)
2096
+ */
2097
+ declare function shuffle<T>(array: T[]): T[];
2098
+
2099
+ export { ADDRESSES, type BuildTransferProofOptions, type BuildWithdrawProofOptions, CIRCUIT_CONFIG, type DepositTxOptions, ENTRY_ABI, ERC20_ABI, type EncryptedMessage, type ExtData, type ExtDataInput, FIELD_SIZE, Keypair, MERKLE_TREE_HEIGHT, 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 SubmitRelayOptions, type Token, type TransactionData, type TransactionResult, type TransferResult, Utxo, type UtxoInfo, type UtxoParams, type UtxoSelectionResult, type WithdrawResult, buildApproveUSDCTx, buildDepositETHTx, buildDepositTx, buildDepositUSDCTx, buildMerkleTree, buildRegisterTx, buildTransferProof, buildWithdrawProof, checkRecipientRegistration, checkRelayHealth, getAddresses, getExtDataHash, getMerklePath, getPrivateBalance, getQueueBalance, getRelayInfo, getRelayUrl, mergeUtxos, packEncryptedMessage, poseidonHash, poseidonHash2, prepareTransaction, prove, randomBN, selectCircuit, selectUtxosForWithdraw, shuffle, submitRelay, toBuffer, toFixedHex, transfer, unpackEncryptedMessage, withdraw };