@hula-privacy/mixer 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/idl.ts ADDED
@@ -0,0 +1,838 @@
1
+ const HulaPrivacyIdl = {
2
+ "address": "tnJ9AAxNau3BRBTe7NzXpv8DeYyiogvGd8YPnCiuarA",
3
+ "metadata": {
4
+ "name": "hula_privacy",
5
+ "version": "0.1.0",
6
+ "spec": "0.1.0",
7
+ "description": "Privacy wallet for Solana using ZK proofs"
8
+ },
9
+ "instructions": [
10
+ {
11
+ "name": "initialize_new_tree",
12
+ "docs": [
13
+ "Initialize a new merkle tree when the current one is full"
14
+ ],
15
+ "discriminator": [
16
+ 42,
17
+ 154,
18
+ 29,
19
+ 105,
20
+ 242,
21
+ 162,
22
+ 191,
23
+ 224
24
+ ],
25
+ "accounts": [
26
+ {
27
+ "name": "payer",
28
+ "docs": [
29
+ "The payer for account creation"
30
+ ],
31
+ "writable": true,
32
+ "signer": true
33
+ },
34
+ {
35
+ "name": "pool",
36
+ "docs": [
37
+ "Global privacy pool account"
38
+ ],
39
+ "writable": true,
40
+ "pda": {
41
+ "seeds": [
42
+ {
43
+ "kind": "const",
44
+ "value": [
45
+ 104,
46
+ 117,
47
+ 108,
48
+ 97,
49
+ 95,
50
+ 112,
51
+ 111,
52
+ 111,
53
+ 108
54
+ ]
55
+ }
56
+ ]
57
+ }
58
+ },
59
+ {
60
+ "name": "current_tree",
61
+ "docs": [
62
+ "The current (full) merkle tree"
63
+ ],
64
+ "pda": {
65
+ "seeds": [
66
+ {
67
+ "kind": "const",
68
+ "value": [
69
+ 109,
70
+ 101,
71
+ 114,
72
+ 107,
73
+ 108,
74
+ 101,
75
+ 95,
76
+ 116,
77
+ 114,
78
+ 101,
79
+ 101
80
+ ]
81
+ },
82
+ {
83
+ "kind": "account",
84
+ "path": "pool.current_tree_index",
85
+ "account": "PrivacyPool"
86
+ }
87
+ ]
88
+ }
89
+ },
90
+ {
91
+ "name": "new_tree",
92
+ "docs": [
93
+ "New merkle tree account (PDA with tree_index)"
94
+ ],
95
+ "writable": true,
96
+ "pda": {
97
+ "seeds": [
98
+ {
99
+ "kind": "const",
100
+ "value": [
101
+ 109,
102
+ 101,
103
+ 114,
104
+ 107,
105
+ 108,
106
+ 101,
107
+ 95,
108
+ 116,
109
+ 114,
110
+ 101,
111
+ 101
112
+ ]
113
+ },
114
+ {
115
+ "kind": "arg",
116
+ "path": "tree_index"
117
+ }
118
+ ]
119
+ }
120
+ },
121
+ {
122
+ "name": "system_program",
123
+ "docs": [
124
+ "System program"
125
+ ],
126
+ "address": "11111111111111111111111111111111"
127
+ }
128
+ ],
129
+ "args": [
130
+ {
131
+ "name": "tree_index",
132
+ "type": "u32"
133
+ }
134
+ ]
135
+ },
136
+ {
137
+ "name": "initialize_pool",
138
+ "docs": [
139
+ "Initialize the global privacy pool"
140
+ ],
141
+ "discriminator": [
142
+ 95,
143
+ 180,
144
+ 10,
145
+ 172,
146
+ 84,
147
+ 174,
148
+ 232,
149
+ 40
150
+ ],
151
+ "accounts": [
152
+ {
153
+ "name": "authority",
154
+ "docs": [
155
+ "The authority creating the pool (pays for account creation)"
156
+ ],
157
+ "writable": true,
158
+ "signer": true
159
+ },
160
+ {
161
+ "name": "pool",
162
+ "docs": [
163
+ "Global privacy pool account (PDA)"
164
+ ],
165
+ "writable": true,
166
+ "pda": {
167
+ "seeds": [
168
+ {
169
+ "kind": "const",
170
+ "value": [
171
+ 104,
172
+ 117,
173
+ 108,
174
+ 97,
175
+ 95,
176
+ 112,
177
+ 111,
178
+ 111,
179
+ 108
180
+ ]
181
+ }
182
+ ]
183
+ }
184
+ },
185
+ {
186
+ "name": "merkle_tree",
187
+ "docs": [
188
+ "Merkle tree account (PDA with tree index 0)"
189
+ ],
190
+ "writable": true,
191
+ "pda": {
192
+ "seeds": [
193
+ {
194
+ "kind": "const",
195
+ "value": [
196
+ 109,
197
+ 101,
198
+ 114,
199
+ 107,
200
+ 108,
201
+ 101,
202
+ 95,
203
+ 116,
204
+ 114,
205
+ 101,
206
+ 101
207
+ ]
208
+ },
209
+ {
210
+ "kind": "const",
211
+ "value": [
212
+ 0,
213
+ 0,
214
+ 0,
215
+ 0
216
+ ]
217
+ }
218
+ ]
219
+ }
220
+ },
221
+ {
222
+ "name": "system_program",
223
+ "docs": [
224
+ "System program"
225
+ ],
226
+ "address": "11111111111111111111111111111111"
227
+ }
228
+ ],
229
+ "args": []
230
+ },
231
+ {
232
+ "name": "transact",
233
+ "docs": [
234
+ "Execute a private transaction"
235
+ ],
236
+ "discriminator": [
237
+ 217,
238
+ 149,
239
+ 130,
240
+ 143,
241
+ 221,
242
+ 52,
243
+ 252,
244
+ 119
245
+ ],
246
+ "accounts": [
247
+ {
248
+ "name": "payer",
249
+ "writable": true,
250
+ "signer": true
251
+ },
252
+ {
253
+ "name": "mint"
254
+ },
255
+ {
256
+ "name": "pool",
257
+ "writable": true,
258
+ "pda": {
259
+ "seeds": [
260
+ {
261
+ "kind": "const",
262
+ "value": [
263
+ 104,
264
+ 117,
265
+ 108,
266
+ 97,
267
+ 95,
268
+ 112,
269
+ 111,
270
+ 111,
271
+ 108
272
+ ]
273
+ }
274
+ ]
275
+ }
276
+ },
277
+ {
278
+ "name": "input_tree",
279
+ "docs": [
280
+ "Input tree - where the input UTXOs come from (for merkle root verification)",
281
+ "If None, defaults to current tree"
282
+ ],
283
+ "pda": {
284
+ "seeds": [
285
+ {
286
+ "kind": "const",
287
+ "value": [
288
+ 109,
289
+ 101,
290
+ 114,
291
+ 107,
292
+ 108,
293
+ 101,
294
+ 95,
295
+ 116,
296
+ 114,
297
+ 101,
298
+ 101
299
+ ]
300
+ },
301
+ {
302
+ "kind": "arg",
303
+ "path": "input_tree_index.unwrap_or(pool.current_tree_index)"
304
+ }
305
+ ]
306
+ }
307
+ },
308
+ {
309
+ "name": "merkle_tree",
310
+ "docs": [
311
+ "Output tree - where new commitments will be inserted (current active tree)"
312
+ ],
313
+ "writable": true,
314
+ "pda": {
315
+ "seeds": [
316
+ {
317
+ "kind": "const",
318
+ "value": [
319
+ 109,
320
+ 101,
321
+ 114,
322
+ 107,
323
+ 108,
324
+ 101,
325
+ 95,
326
+ 116,
327
+ 114,
328
+ 101,
329
+ 101
330
+ ]
331
+ },
332
+ {
333
+ "kind": "account",
334
+ "path": "pool.current_tree_index",
335
+ "account": "PrivacyPool"
336
+ }
337
+ ]
338
+ }
339
+ },
340
+ {
341
+ "name": "vault",
342
+ "docs": [
343
+ "Vault for this mint (created if needed)"
344
+ ],
345
+ "writable": true,
346
+ "pda": {
347
+ "seeds": [
348
+ {
349
+ "kind": "const",
350
+ "value": [
351
+ 118,
352
+ 97,
353
+ 117,
354
+ 108,
355
+ 116
356
+ ]
357
+ },
358
+ {
359
+ "kind": "account",
360
+ "path": "mint"
361
+ }
362
+ ]
363
+ }
364
+ },
365
+ {
366
+ "name": "depositor_token_account",
367
+ "docs": [
368
+ "Depositor's token account (optional)"
369
+ ],
370
+ "writable": true,
371
+ "optional": true
372
+ },
373
+ {
374
+ "name": "depositor",
375
+ "signer": true,
376
+ "optional": true
377
+ },
378
+ {
379
+ "name": "recipient_token_account",
380
+ "docs": [
381
+ "Recipient's token account (optional)"
382
+ ],
383
+ "writable": true,
384
+ "optional": true
385
+ },
386
+ {
387
+ "name": "fee_recipient_token_account",
388
+ "docs": [
389
+ "Fee recipient's token account (optional)"
390
+ ],
391
+ "writable": true,
392
+ "optional": true
393
+ },
394
+ {
395
+ "name": "nullifier_account_0",
396
+ "docs": [
397
+ "Nullifier account 0 (optional - for first input UTXO)"
398
+ ],
399
+ "writable": true,
400
+ "optional": true
401
+ },
402
+ {
403
+ "name": "nullifier_account_1",
404
+ "docs": [
405
+ "Nullifier account 1 (optional - for second input UTXO)"
406
+ ],
407
+ "writable": true,
408
+ "optional": true
409
+ },
410
+ {
411
+ "name": "token_program",
412
+ "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
413
+ },
414
+ {
415
+ "name": "system_program",
416
+ "address": "11111111111111111111111111111111"
417
+ }
418
+ ],
419
+ "args": [
420
+ {
421
+ "name": "input_tree_index",
422
+ "type": {
423
+ "option": "u32"
424
+ }
425
+ },
426
+ {
427
+ "name": "proof",
428
+ "type": {
429
+ "array": [
430
+ "u8",
431
+ 256
432
+ ]
433
+ }
434
+ },
435
+ {
436
+ "name": "public_inputs",
437
+ "type": {
438
+ "defined": {
439
+ "name": "PublicInputs"
440
+ }
441
+ }
442
+ },
443
+ {
444
+ "name": "encrypted_notes",
445
+ "type": {
446
+ "vec": "bytes"
447
+ }
448
+ }
449
+ ]
450
+ }
451
+ ],
452
+ "accounts": [
453
+ {
454
+ "name": "MerkleTreeAccount",
455
+ "discriminator": [
456
+ 147,
457
+ 200,
458
+ 34,
459
+ 248,
460
+ 131,
461
+ 187,
462
+ 248,
463
+ 253
464
+ ]
465
+ },
466
+ {
467
+ "name": "PrivacyPool",
468
+ "discriminator": [
469
+ 133,
470
+ 184,
471
+ 191,
472
+ 79,
473
+ 252,
474
+ 142,
475
+ 190,
476
+ 150
477
+ ]
478
+ }
479
+ ],
480
+ "errors": [
481
+ {
482
+ "code": 6000,
483
+ "name": "Groth16MulFailed",
484
+ "msg": "Groth16 multiplication failed"
485
+ },
486
+ {
487
+ "code": 6001,
488
+ "name": "Groth16AddFailed",
489
+ "msg": "Groth16 addition failed"
490
+ },
491
+ {
492
+ "code": 6002,
493
+ "name": "Groth16PairingFailed",
494
+ "msg": "Groth16 pairing failed"
495
+ },
496
+ {
497
+ "code": 6003,
498
+ "name": "InvalidPublicInputs",
499
+ "msg": "Invalid public inputs"
500
+ },
501
+ {
502
+ "code": 6004,
503
+ "name": "ProofVerificationFailed",
504
+ "msg": "Proof verification failed"
505
+ },
506
+ {
507
+ "code": 6005,
508
+ "name": "PoolPaused",
509
+ "msg": "Pool is paused"
510
+ },
511
+ {
512
+ "code": 6006,
513
+ "name": "InvalidMint",
514
+ "msg": "Invalid mint"
515
+ },
516
+ {
517
+ "code": 6007,
518
+ "name": "Unauthorized",
519
+ "msg": "Unauthorized"
520
+ },
521
+ {
522
+ "code": 6008,
523
+ "name": "TreeFull",
524
+ "msg": "Merkle tree is full"
525
+ },
526
+ {
527
+ "code": 6009,
528
+ "name": "InvalidRoot",
529
+ "msg": "Invalid merkle root"
530
+ },
531
+ {
532
+ "code": 6010,
533
+ "name": "NullifierAlreadySpent",
534
+ "msg": "Nullifier already spent"
535
+ },
536
+ {
537
+ "code": 6011,
538
+ "name": "NullifierAlreadyUsed",
539
+ "msg": "Nullifier already used - double spend attempt"
540
+ },
541
+ {
542
+ "code": 6012,
543
+ "name": "MissingNullifierAccount",
544
+ "msg": "Missing nullifier account"
545
+ },
546
+ {
547
+ "code": 6013,
548
+ "name": "InvalidNullifierAccount",
549
+ "msg": "Invalid nullifier account"
550
+ },
551
+ {
552
+ "code": 6014,
553
+ "name": "InvalidPublicAmount",
554
+ "msg": "Invalid public amount"
555
+ },
556
+ {
557
+ "code": 6015,
558
+ "name": "ArithmeticOverflow",
559
+ "msg": "Arithmetic overflow"
560
+ },
561
+ {
562
+ "code": 6016,
563
+ "name": "InvalidRecipient",
564
+ "msg": "Invalid recipient"
565
+ },
566
+ {
567
+ "code": 6017,
568
+ "name": "InvalidFee",
569
+ "msg": "Invalid fee"
570
+ },
571
+ {
572
+ "code": 6018,
573
+ "name": "TreeNotFull",
574
+ "msg": "Tree is not full yet"
575
+ },
576
+ {
577
+ "code": 6019,
578
+ "name": "InvalidTreeIndex",
579
+ "msg": "Invalid tree index"
580
+ }
581
+ ],
582
+ "types": [
583
+ {
584
+ "name": "MerkleTreeAccount",
585
+ "docs": [
586
+ "Incremental Merkle Tree for UTXO commitments",
587
+ "Uses a sparse representation - only stores filled subtrees"
588
+ ],
589
+ "type": {
590
+ "kind": "struct",
591
+ "fields": [
592
+ {
593
+ "name": "pool",
594
+ "docs": [
595
+ "The privacy pool this tree belongs to"
596
+ ],
597
+ "type": "pubkey"
598
+ },
599
+ {
600
+ "name": "tree_index",
601
+ "docs": [
602
+ "Tree index (which tree in the sequence)"
603
+ ],
604
+ "type": "u32"
605
+ },
606
+ {
607
+ "name": "next_index",
608
+ "docs": [
609
+ "Current number of leaves inserted"
610
+ ],
611
+ "type": "u32"
612
+ },
613
+ {
614
+ "name": "root",
615
+ "docs": [
616
+ "Current root of the tree"
617
+ ],
618
+ "type": {
619
+ "array": [
620
+ "u8",
621
+ 32
622
+ ]
623
+ }
624
+ },
625
+ {
626
+ "name": "filled_subtrees",
627
+ "docs": [
628
+ "Filled subtrees at each level (for incremental insertion)",
629
+ "filled_subtrees[i] = the rightmost filled node at level i"
630
+ ],
631
+ "type": {
632
+ "array": [
633
+ {
634
+ "array": [
635
+ "u8",
636
+ 32
637
+ ]
638
+ },
639
+ 10
640
+ ]
641
+ }
642
+ },
643
+ {
644
+ "name": "root_history",
645
+ "docs": [
646
+ "Historical roots for verification (ring buffer)",
647
+ "Allows verifying proofs against recent roots"
648
+ ],
649
+ "type": {
650
+ "array": [
651
+ {
652
+ "array": [
653
+ "u8",
654
+ 32
655
+ ]
656
+ },
657
+ 32
658
+ ]
659
+ }
660
+ },
661
+ {
662
+ "name": "root_history_index",
663
+ "docs": [
664
+ "Current position in root history ring buffer"
665
+ ],
666
+ "type": "u8"
667
+ },
668
+ {
669
+ "name": "bump",
670
+ "docs": [
671
+ "Bump seed for PDA"
672
+ ],
673
+ "type": "u8"
674
+ }
675
+ ]
676
+ }
677
+ },
678
+ {
679
+ "name": "PrivacyPool",
680
+ "docs": [
681
+ "Global Privacy Pool Account",
682
+ "Single pool for all tokens - vaults are created per mint lazily"
683
+ ],
684
+ "type": {
685
+ "kind": "struct",
686
+ "fields": [
687
+ {
688
+ "name": "authority",
689
+ "docs": [
690
+ "Authority that can update pool settings"
691
+ ],
692
+ "type": "pubkey"
693
+ },
694
+ {
695
+ "name": "commitment_count",
696
+ "docs": [
697
+ "Total number of commitments across all trees"
698
+ ],
699
+ "type": "u64"
700
+ },
701
+ {
702
+ "name": "merkle_root",
703
+ "docs": [
704
+ "Current merkle root (of the active tree)"
705
+ ],
706
+ "type": {
707
+ "array": [
708
+ "u8",
709
+ 32
710
+ ]
711
+ }
712
+ },
713
+ {
714
+ "name": "bump",
715
+ "docs": [
716
+ "Pool bump seed"
717
+ ],
718
+ "type": "u8"
719
+ },
720
+ {
721
+ "name": "paused",
722
+ "docs": [
723
+ "Whether the pool is paused"
724
+ ],
725
+ "type": "bool"
726
+ },
727
+ {
728
+ "name": "current_tree_index",
729
+ "docs": [
730
+ "Current active tree index (0-based)"
731
+ ],
732
+ "type": "u32"
733
+ },
734
+ {
735
+ "name": "_reserved",
736
+ "docs": [
737
+ "Reserved for future use"
738
+ ],
739
+ "type": "bytes"
740
+ }
741
+ ]
742
+ }
743
+ },
744
+ {
745
+ "name": "PublicInputs",
746
+ "docs": [
747
+ "Public inputs for the transaction circuit"
748
+ ],
749
+ "type": {
750
+ "kind": "struct",
751
+ "fields": [
752
+ {
753
+ "name": "merkle_root",
754
+ "type": {
755
+ "array": [
756
+ "u8",
757
+ 32
758
+ ]
759
+ }
760
+ },
761
+ {
762
+ "name": "nullifiers",
763
+ "type": {
764
+ "array": [
765
+ {
766
+ "array": [
767
+ "u8",
768
+ 32
769
+ ]
770
+ },
771
+ 2
772
+ ]
773
+ }
774
+ },
775
+ {
776
+ "name": "output_commitments",
777
+ "type": {
778
+ "array": [
779
+ {
780
+ "array": [
781
+ "u8",
782
+ 32
783
+ ]
784
+ },
785
+ 2
786
+ ]
787
+ }
788
+ },
789
+ {
790
+ "name": "public_deposit",
791
+ "type": "u64"
792
+ },
793
+ {
794
+ "name": "public_withdraw",
795
+ "type": "u64"
796
+ },
797
+ {
798
+ "name": "recipient",
799
+ "type": "pubkey"
800
+ },
801
+ {
802
+ "name": "mint_token_address",
803
+ "type": "pubkey"
804
+ },
805
+ {
806
+ "name": "fee",
807
+ "type": "u64"
808
+ }
809
+ ]
810
+ }
811
+ }
812
+ ],
813
+ "constants": [
814
+ {
815
+ "name": "MERKLE_TREE_SEED",
816
+ "type": "bytes",
817
+ "value": "[109, 101, 114, 107, 108, 101, 95, 116, 114, 101, 101]"
818
+ },
819
+ {
820
+ "name": "NULLIFIER_SEED",
821
+ "type": "bytes",
822
+ "value": "[110, 117, 108, 108, 105, 102, 105, 101, 114]"
823
+ },
824
+ {
825
+ "name": "POOL_SEED",
826
+ "type": "bytes",
827
+ "value": "[104, 117, 108, 97, 95, 112, 111, 111, 108]"
828
+ },
829
+ {
830
+ "name": "VAULT_SEED",
831
+ "type": "bytes",
832
+ "value": "[118, 97, 117, 108, 116]"
833
+ }
834
+ ]
835
+ } as const;
836
+
837
+ export default HulaPrivacyIdl;
838
+ export type HulaPrivacyIDL = typeof HulaPrivacyIdl;