@lightprotocol/compressed-token 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,10 @@
1
- import { ParsedTokenAccount, InputTokenDataWithContext as InputTokenDataWithContext$1, CompressedProof, TokenTransferOutputData as TokenTransferOutputData$1, Rpc } from '@lightprotocol/stateless.js';
1
+ import { CompressedProof, ParsedTokenAccount, TokenTransferOutputData as TokenTransferOutputData$1, InputTokenDataWithContext as InputTokenDataWithContext$1, Rpc } from '@lightprotocol/stateless.js';
2
2
  import { PublicKey, AccountMeta, TransactionInstruction, Signer, ConfirmOptions, TransactionSignature, Keypair } from '@solana/web3.js';
3
3
  import { BN, Program } from '@coral-xyz/anchor';
4
4
 
5
5
  type LightCompressedToken = {
6
- version: '0.3.1';
6
+ version: '0.4.0';
7
7
  name: 'light_compressed_token';
8
- constants: [
9
- {
10
- name: 'PROGRAM_ID';
11
- type: 'string';
12
- value: '"9sixVEthz2kMSKfeApZXHwuboT6DZuT6crAYJTciUCqE"';
13
- }
14
- ];
15
8
  instructions: [
16
9
  {
17
10
  name: 'createMint';
@@ -27,11 +20,6 @@ type LightCompressedToken = {
27
20
  isMut: true;
28
21
  isSigner: true;
29
22
  },
30
- {
31
- name: 'authority';
32
- isMut: true;
33
- isSigner: true;
34
- },
35
23
  {
36
24
  name: 'tokenPoolPda';
37
25
  isMut: true;
@@ -47,11 +35,6 @@ type LightCompressedToken = {
47
35
  isMut: true;
48
36
  isSigner: false;
49
37
  },
50
- {
51
- name: 'mintAuthorityPda';
52
- isMut: true;
53
- isSigner: false;
54
- },
55
38
  {
56
39
  name: 'tokenProgram';
57
40
  isMut: false;
@@ -67,6 +50,12 @@ type LightCompressedToken = {
67
50
  },
68
51
  {
69
52
  name: 'mintTo';
53
+ docs: [
54
+ 'Mints tokens from an spl token mint to a list of compressed accounts.',
55
+ 'Minted tokens are transferred to a pool account owned by the compressed',
56
+ 'token program. The instruction creates one compressed output account for',
57
+ 'every amount and pubkey input pair one output compressed account.'
58
+ ];
70
59
  accounts: [
71
60
  {
72
61
  name: 'feePayer';
@@ -75,12 +64,12 @@ type LightCompressedToken = {
75
64
  },
76
65
  {
77
66
  name: 'authority';
78
- isMut: true;
67
+ isMut: false;
79
68
  isSigner: true;
80
69
  },
81
70
  {
82
- name: 'mintAuthorityPda';
83
- isMut: true;
71
+ name: 'cpiAuthorityPda';
72
+ isMut: false;
84
73
  isSigner: false;
85
74
  },
86
75
  {
@@ -105,7 +94,7 @@ type LightCompressedToken = {
105
94
  },
106
95
  {
107
96
  name: 'registeredProgramPda';
108
- isMut: true;
97
+ isMut: false;
109
98
  isSigner: false;
110
99
  },
111
100
  {
@@ -115,7 +104,7 @@ type LightCompressedToken = {
115
104
  },
116
105
  {
117
106
  name: 'accountCompressionAuthority';
118
- isMut: true;
107
+ isMut: false;
119
108
  isSigner: false;
120
109
  },
121
110
  {
@@ -151,10 +140,6 @@ type LightCompressedToken = {
151
140
  type: {
152
141
  vec: 'u64';
153
142
  };
154
- },
155
- {
156
- name: 'bump';
157
- type: 'u8';
158
143
  }
159
144
  ];
160
145
  },
@@ -213,7 +198,7 @@ type LightCompressedToken = {
213
198
  isOptional: true;
214
199
  },
215
200
  {
216
- name: 'decompressTokenAccount';
201
+ name: 'compressOrDecompressTokenAccount';
217
202
  isMut: true;
218
203
  isSigner: false;
219
204
  isOptional: true;
@@ -236,136 +221,546 @@ type LightCompressedToken = {
236
221
  type: 'bytes';
237
222
  }
238
223
  ];
239
- }
240
- ];
241
- types: [
242
- {
243
- name: 'InstructionDataInvoke';
244
- type: {
245
- kind: 'struct';
246
- fields: [
247
- {
248
- name: 'proof';
249
- type: {
250
- option: {
251
- defined: 'CompressedProof';
252
- };
253
- };
254
- },
255
- {
256
- name: 'inputRootIndices';
257
- type: {
258
- vec: 'u16';
259
- };
260
- },
261
- {
262
- name: 'inputCompressedAccountsWithMerkleContext';
263
- type: {
264
- vec: {
265
- defined: 'PackedCompressedAccountWithMerkleContext';
266
- };
267
- };
268
- },
269
- {
270
- name: 'outputCompressedAccounts';
271
- type: {
272
- vec: {
273
- defined: 'CompressedAccount';
274
- };
275
- };
276
- },
277
- {
278
- name: 'outputStateMerkleTreeAccountIndices';
279
- docs: [
280
- 'The indices of the accounts in the output state merkle tree.'
281
- ];
282
- type: 'bytes';
283
- },
284
- {
285
- name: 'relayFee';
286
- type: {
287
- option: 'u64';
288
- };
289
- },
290
- {
291
- name: 'newAddressParams';
292
- type: {
293
- vec: {
294
- defined: 'NewAddressParamsPacked';
295
- };
296
- };
297
- },
298
- {
299
- name: 'compressionLamports';
300
- type: {
301
- option: 'u64';
302
- };
303
- },
304
- {
305
- name: 'isCompress';
306
- type: 'bool';
307
- }
308
- ];
309
- };
310
224
  },
311
225
  {
312
- name: 'NewAddressParamsPacked';
313
- type: {
314
- kind: 'struct';
315
- fields: [
316
- {
317
- name: 'seed';
318
- type: {
319
- array: ['u8', 32];
320
- };
321
- },
322
- {
323
- name: 'addressQueueAccountIndex';
324
- type: 'u8';
325
- },
326
- {
327
- name: 'addressMerkleTreeAccountIndex';
328
- type: 'u8';
329
- },
330
- {
331
- name: 'addressMerkleTreeRootIndex';
332
- type: 'u16';
333
- }
334
- ];
335
- };
226
+ name: 'approve';
227
+ accounts: [
228
+ {
229
+ name: 'feePayer';
230
+ isMut: true;
231
+ isSigner: true;
232
+ },
233
+ {
234
+ name: 'authority';
235
+ isMut: false;
236
+ isSigner: true;
237
+ },
238
+ {
239
+ name: 'cpiAuthorityPda';
240
+ isMut: false;
241
+ isSigner: false;
242
+ },
243
+ {
244
+ name: 'lightSystemProgram';
245
+ isMut: false;
246
+ isSigner: false;
247
+ },
248
+ {
249
+ name: 'registeredProgramPda';
250
+ isMut: false;
251
+ isSigner: false;
252
+ },
253
+ {
254
+ name: 'noopProgram';
255
+ isMut: false;
256
+ isSigner: false;
257
+ },
258
+ {
259
+ name: 'accountCompressionAuthority';
260
+ isMut: false;
261
+ isSigner: false;
262
+ },
263
+ {
264
+ name: 'accountCompressionProgram';
265
+ isMut: false;
266
+ isSigner: false;
267
+ },
268
+ {
269
+ name: 'selfProgram';
270
+ isMut: false;
271
+ isSigner: false;
272
+ },
273
+ {
274
+ name: 'systemProgram';
275
+ isMut: false;
276
+ isSigner: false;
277
+ }
278
+ ];
279
+ args: [
280
+ {
281
+ name: 'inputs';
282
+ type: 'bytes';
283
+ }
284
+ ];
336
285
  },
337
286
  {
338
- name: 'NewAddressParams';
339
- type: {
340
- kind: 'struct';
341
- fields: [
342
- {
343
- name: 'seed';
344
- type: {
345
- array: ['u8', 32];
346
- };
347
- },
348
- {
349
- name: 'addressQueuePubkey';
350
- type: 'publicKey';
351
- },
352
- {
353
- name: 'addressMerkleTreePubkey';
354
- type: 'publicKey';
355
- },
356
- {
357
- name: 'addressMerkleTreeRootIndex';
358
- type: 'u16';
359
- }
360
- ];
361
- };
287
+ name: 'revoke';
288
+ accounts: [
289
+ {
290
+ name: 'feePayer';
291
+ isMut: true;
292
+ isSigner: true;
293
+ },
294
+ {
295
+ name: 'authority';
296
+ isMut: false;
297
+ isSigner: true;
298
+ },
299
+ {
300
+ name: 'cpiAuthorityPda';
301
+ isMut: false;
302
+ isSigner: false;
303
+ },
304
+ {
305
+ name: 'lightSystemProgram';
306
+ isMut: false;
307
+ isSigner: false;
308
+ },
309
+ {
310
+ name: 'registeredProgramPda';
311
+ isMut: false;
312
+ isSigner: false;
313
+ },
314
+ {
315
+ name: 'noopProgram';
316
+ isMut: false;
317
+ isSigner: false;
318
+ },
319
+ {
320
+ name: 'accountCompressionAuthority';
321
+ isMut: false;
322
+ isSigner: false;
323
+ },
324
+ {
325
+ name: 'accountCompressionProgram';
326
+ isMut: false;
327
+ isSigner: false;
328
+ },
329
+ {
330
+ name: 'selfProgram';
331
+ isMut: false;
332
+ isSigner: false;
333
+ },
334
+ {
335
+ name: 'systemProgram';
336
+ isMut: false;
337
+ isSigner: false;
338
+ }
339
+ ];
340
+ args: [
341
+ {
342
+ name: 'inputs';
343
+ type: 'bytes';
344
+ }
345
+ ];
362
346
  },
363
347
  {
364
- name: 'CompressedProof';
365
- type: {
366
- kind: 'struct';
367
- fields: [
368
- {
348
+ name: 'freeze';
349
+ accounts: [
350
+ {
351
+ name: 'feePayer';
352
+ isMut: true;
353
+ isSigner: true;
354
+ },
355
+ {
356
+ name: 'authority';
357
+ isMut: false;
358
+ isSigner: true;
359
+ },
360
+ {
361
+ name: 'cpiAuthorityPda';
362
+ isMut: false;
363
+ isSigner: false;
364
+ },
365
+ {
366
+ name: 'lightSystemProgram';
367
+ isMut: false;
368
+ isSigner: false;
369
+ },
370
+ {
371
+ name: 'registeredProgramPda';
372
+ isMut: false;
373
+ isSigner: false;
374
+ },
375
+ {
376
+ name: 'noopProgram';
377
+ isMut: false;
378
+ isSigner: false;
379
+ },
380
+ {
381
+ name: 'accountCompressionAuthority';
382
+ isMut: false;
383
+ isSigner: false;
384
+ },
385
+ {
386
+ name: 'accountCompressionProgram';
387
+ isMut: false;
388
+ isSigner: false;
389
+ },
390
+ {
391
+ name: 'selfProgram';
392
+ isMut: false;
393
+ isSigner: false;
394
+ },
395
+ {
396
+ name: 'systemProgram';
397
+ isMut: false;
398
+ isSigner: false;
399
+ },
400
+ {
401
+ name: 'mint';
402
+ isMut: false;
403
+ isSigner: false;
404
+ }
405
+ ];
406
+ args: [
407
+ {
408
+ name: 'inputs';
409
+ type: 'bytes';
410
+ }
411
+ ];
412
+ },
413
+ {
414
+ name: 'thaw';
415
+ accounts: [
416
+ {
417
+ name: 'feePayer';
418
+ isMut: true;
419
+ isSigner: true;
420
+ },
421
+ {
422
+ name: 'authority';
423
+ isMut: false;
424
+ isSigner: true;
425
+ },
426
+ {
427
+ name: 'cpiAuthorityPda';
428
+ isMut: false;
429
+ isSigner: false;
430
+ },
431
+ {
432
+ name: 'lightSystemProgram';
433
+ isMut: false;
434
+ isSigner: false;
435
+ },
436
+ {
437
+ name: 'registeredProgramPda';
438
+ isMut: false;
439
+ isSigner: false;
440
+ },
441
+ {
442
+ name: 'noopProgram';
443
+ isMut: false;
444
+ isSigner: false;
445
+ },
446
+ {
447
+ name: 'accountCompressionAuthority';
448
+ isMut: false;
449
+ isSigner: false;
450
+ },
451
+ {
452
+ name: 'accountCompressionProgram';
453
+ isMut: false;
454
+ isSigner: false;
455
+ },
456
+ {
457
+ name: 'selfProgram';
458
+ isMut: false;
459
+ isSigner: false;
460
+ },
461
+ {
462
+ name: 'systemProgram';
463
+ isMut: false;
464
+ isSigner: false;
465
+ },
466
+ {
467
+ name: 'mint';
468
+ isMut: false;
469
+ isSigner: false;
470
+ }
471
+ ];
472
+ args: [
473
+ {
474
+ name: 'inputs';
475
+ type: 'bytes';
476
+ }
477
+ ];
478
+ },
479
+ {
480
+ name: 'burn';
481
+ accounts: [
482
+ {
483
+ name: 'feePayer';
484
+ isMut: true;
485
+ isSigner: true;
486
+ },
487
+ {
488
+ name: 'authority';
489
+ isMut: false;
490
+ isSigner: true;
491
+ },
492
+ {
493
+ name: 'cpiAuthorityPda';
494
+ isMut: false;
495
+ isSigner: false;
496
+ },
497
+ {
498
+ name: 'lightSystemProgram';
499
+ isMut: false;
500
+ isSigner: false;
501
+ },
502
+ {
503
+ name: 'registeredProgramPda';
504
+ isMut: false;
505
+ isSigner: false;
506
+ },
507
+ {
508
+ name: 'noopProgram';
509
+ isMut: false;
510
+ isSigner: false;
511
+ },
512
+ {
513
+ name: 'accountCompressionAuthority';
514
+ isMut: false;
515
+ isSigner: false;
516
+ },
517
+ {
518
+ name: 'accountCompressionProgram';
519
+ isMut: false;
520
+ isSigner: false;
521
+ },
522
+ {
523
+ name: 'selfProgram';
524
+ isMut: false;
525
+ isSigner: false;
526
+ },
527
+ {
528
+ name: 'systemProgram';
529
+ isMut: false;
530
+ isSigner: false;
531
+ }
532
+ ];
533
+ args: [
534
+ {
535
+ name: 'inputs';
536
+ type: 'bytes';
537
+ }
538
+ ];
539
+ },
540
+ {
541
+ name: 'stubIdlBuild';
542
+ docs: [
543
+ 'This function is a stub to allow Anchor to include the input types in',
544
+ 'the IDL. It should not be included in production builds nor be called in',
545
+ 'practice.'
546
+ ];
547
+ accounts: [
548
+ {
549
+ name: 'feePayer';
550
+ isMut: true;
551
+ isSigner: true;
552
+ },
553
+ {
554
+ name: 'authority';
555
+ isMut: false;
556
+ isSigner: true;
557
+ },
558
+ {
559
+ name: 'cpiAuthorityPda';
560
+ isMut: false;
561
+ isSigner: false;
562
+ },
563
+ {
564
+ name: 'lightSystemProgram';
565
+ isMut: false;
566
+ isSigner: false;
567
+ },
568
+ {
569
+ name: 'registeredProgramPda';
570
+ isMut: false;
571
+ isSigner: false;
572
+ },
573
+ {
574
+ name: 'noopProgram';
575
+ isMut: false;
576
+ isSigner: false;
577
+ },
578
+ {
579
+ name: 'accountCompressionAuthority';
580
+ isMut: false;
581
+ isSigner: false;
582
+ },
583
+ {
584
+ name: 'accountCompressionProgram';
585
+ isMut: false;
586
+ isSigner: false;
587
+ },
588
+ {
589
+ name: 'selfProgram';
590
+ isMut: false;
591
+ isSigner: false;
592
+ },
593
+ {
594
+ name: 'tokenPoolPda';
595
+ isMut: true;
596
+ isSigner: false;
597
+ isOptional: true;
598
+ },
599
+ {
600
+ name: 'compressOrDecompressTokenAccount';
601
+ isMut: true;
602
+ isSigner: false;
603
+ isOptional: true;
604
+ },
605
+ {
606
+ name: 'tokenProgram';
607
+ isMut: false;
608
+ isSigner: false;
609
+ isOptional: true;
610
+ },
611
+ {
612
+ name: 'systemProgram';
613
+ isMut: false;
614
+ isSigner: false;
615
+ }
616
+ ];
617
+ args: [
618
+ {
619
+ name: 'inputs1';
620
+ type: {
621
+ defined: 'CompressedTokenInstructionDataTransfer';
622
+ };
623
+ },
624
+ {
625
+ name: 'inputs2';
626
+ type: {
627
+ defined: 'TokenData';
628
+ };
629
+ }
630
+ ];
631
+ }
632
+ ];
633
+ accounts: [
634
+ {
635
+ name: 'RegisteredProgram';
636
+ type: {
637
+ kind: 'struct';
638
+ fields: [
639
+ {
640
+ name: 'registeredProgramId';
641
+ type: 'publicKey';
642
+ },
643
+ {
644
+ name: 'groupAuthorityPda';
645
+ type: 'publicKey';
646
+ }
647
+ ];
648
+ };
649
+ }
650
+ ];
651
+ types: [
652
+ {
653
+ name: 'AccessMetadata';
654
+ type: {
655
+ kind: 'struct';
656
+ fields: [
657
+ {
658
+ name: 'owner';
659
+ docs: ['Owner of the Merkle tree.'];
660
+ type: 'publicKey';
661
+ },
662
+ {
663
+ name: 'programOwner';
664
+ docs: [
665
+ 'Delegate of the Merkle tree. This will be used for program owned Merkle trees.'
666
+ ];
667
+ type: 'publicKey';
668
+ }
669
+ ];
670
+ };
671
+ },
672
+ {
673
+ name: 'AccountState';
674
+ type: {
675
+ kind: 'enum';
676
+ variants: [
677
+ {
678
+ name: 'Initialized';
679
+ },
680
+ {
681
+ name: 'Frozen';
682
+ }
683
+ ];
684
+ };
685
+ },
686
+ {
687
+ name: 'CompressedAccount';
688
+ type: {
689
+ kind: 'struct';
690
+ fields: [
691
+ {
692
+ name: 'owner';
693
+ type: 'publicKey';
694
+ },
695
+ {
696
+ name: 'lamports';
697
+ type: 'u64';
698
+ },
699
+ {
700
+ name: 'address';
701
+ type: {
702
+ option: {
703
+ array: ['u8', 32];
704
+ };
705
+ };
706
+ },
707
+ {
708
+ name: 'data';
709
+ type: {
710
+ option: {
711
+ defined: 'CompressedAccountData';
712
+ };
713
+ };
714
+ }
715
+ ];
716
+ };
717
+ },
718
+ {
719
+ name: 'CompressedAccountData';
720
+ type: {
721
+ kind: 'struct';
722
+ fields: [
723
+ {
724
+ name: 'discriminator';
725
+ type: {
726
+ array: ['u8', 8];
727
+ };
728
+ },
729
+ {
730
+ name: 'data';
731
+ type: 'bytes';
732
+ },
733
+ {
734
+ name: 'dataHash';
735
+ type: {
736
+ array: ['u8', 32];
737
+ };
738
+ }
739
+ ];
740
+ };
741
+ },
742
+ {
743
+ name: 'CompressedCpiContext';
744
+ type: {
745
+ kind: 'struct';
746
+ fields: [
747
+ {
748
+ name: 'setContext';
749
+ type: 'bool';
750
+ },
751
+ {
752
+ name: 'cpiContextAccountIndex';
753
+ type: 'u8';
754
+ }
755
+ ];
756
+ };
757
+ },
758
+ {
759
+ name: 'CompressedProof';
760
+ type: {
761
+ kind: 'struct';
762
+ fields: [
763
+ {
369
764
  name: 'a';
370
765
  type: {
371
766
  array: ['u8', 32];
@@ -387,7 +782,7 @@ type LightCompressedToken = {
387
782
  };
388
783
  },
389
784
  {
390
- name: 'InstructionDataInvokeCpi';
785
+ name: 'CompressedTokenInstructionDataTransfer';
391
786
  type: {
392
787
  kind: 'struct';
393
788
  fields: [
@@ -400,24 +795,27 @@ type LightCompressedToken = {
400
795
  };
401
796
  },
402
797
  {
403
- name: 'newAddressParams';
404
- type: {
405
- vec: {
406
- defined: 'NewAddressParamsPacked';
407
- };
408
- };
798
+ name: 'mint';
799
+ type: 'publicKey';
409
800
  },
410
801
  {
411
- name: 'inputRootIndices';
802
+ name: 'delegatedTransfer';
803
+ docs: [
804
+ 'If the signer is a delegate, the delegate index is index 0 of remaining accounts.',
805
+ 'owner = Some(owner) is the owner of the token account.',
806
+ 'Is set if the signer is delegate'
807
+ ];
412
808
  type: {
413
- vec: 'u16';
809
+ option: {
810
+ defined: 'DelegatedTransfer';
811
+ };
414
812
  };
415
813
  },
416
814
  {
417
- name: 'inputCompressedAccountsWithMerkleContext';
815
+ name: 'inputTokenDataWithContext';
418
816
  type: {
419
817
  vec: {
420
- defined: 'PackedCompressedAccountWithMerkleContext';
818
+ defined: 'InputTokenDataWithContext';
421
819
  };
422
820
  };
423
821
  },
@@ -425,37 +823,18 @@ type LightCompressedToken = {
425
823
  name: 'outputCompressedAccounts';
426
824
  type: {
427
825
  vec: {
428
- defined: 'CompressedAccount';
826
+ defined: 'PackedTokenTransferOutputData';
429
827
  };
430
828
  };
431
829
  },
432
- {
433
- name: 'outputStateMerkleTreeAccountIndices';
434
- docs: [
435
- 'The indices of the accounts in the output state merkle tree.'
436
- ];
437
- type: 'bytes';
438
- },
439
- {
440
- name: 'relayFee';
441
- type: {
442
- option: 'u64';
443
- };
444
- },
445
- {
446
- name: 'compressionLamports';
447
- type: {
448
- option: 'u64';
449
- };
450
- },
451
830
  {
452
831
  name: 'isCompress';
453
832
  type: 'bool';
454
833
  },
455
834
  {
456
- name: 'signerSeeds';
835
+ name: 'compressOrDecompressAmount';
457
836
  type: {
458
- vec: 'bytes';
837
+ option: 'u64';
459
838
  };
460
839
  },
461
840
  {
@@ -470,111 +849,175 @@ type LightCompressedToken = {
470
849
  };
471
850
  },
472
851
  {
473
- name: 'PackedCompressedAccountWithMerkleContext';
852
+ name: 'DelegatedTransfer';
474
853
  type: {
475
854
  kind: 'struct';
476
855
  fields: [
477
856
  {
478
- name: 'compressedAccount';
479
- type: {
480
- defined: 'CompressedAccount';
481
- };
857
+ name: 'owner';
858
+ type: 'publicKey';
482
859
  },
483
860
  {
484
- name: 'merkleContext';
485
- type: {
486
- defined: 'PackedMerkleContext';
487
- };
861
+ name: 'delegateChangeAccountIndex';
862
+ type: 'u8';
488
863
  }
489
864
  ];
490
865
  };
491
866
  },
492
867
  {
493
- name: 'CompressedAccountWithMerkleContext';
868
+ name: 'InputTokenDataWithContext';
494
869
  type: {
495
870
  kind: 'struct';
496
871
  fields: [
497
872
  {
498
- name: 'compressedAccount';
873
+ name: 'amount';
874
+ type: 'u64';
875
+ },
876
+ {
877
+ name: 'delegateIndex';
499
878
  type: {
500
- defined: 'CompressedAccount';
879
+ option: 'u8';
880
+ };
881
+ },
882
+ {
883
+ name: 'isNative';
884
+ type: {
885
+ option: 'u64';
501
886
  };
502
887
  },
503
888
  {
504
889
  name: 'merkleContext';
505
890
  type: {
506
- defined: 'MerkleContext';
891
+ defined: 'PackedMerkleContext';
507
892
  };
893
+ },
894
+ {
895
+ name: 'rootIndex';
896
+ type: 'u16';
508
897
  }
509
898
  ];
510
899
  };
511
900
  },
512
901
  {
513
- name: 'MerkleContext';
902
+ name: 'InstructionDataInvoke';
514
903
  type: {
515
904
  kind: 'struct';
516
905
  fields: [
517
906
  {
518
- name: 'merkleTreePubkey';
519
- type: 'publicKey';
907
+ name: 'proof';
908
+ type: {
909
+ option: {
910
+ defined: 'CompressedProof';
911
+ };
912
+ };
520
913
  },
521
914
  {
522
- name: 'nullifierQueuePubkey';
523
- type: 'publicKey';
915
+ name: 'inputCompressedAccountsWithMerkleContext';
916
+ type: {
917
+ vec: {
918
+ defined: 'PackedCompressedAccountWithMerkleContext';
919
+ };
920
+ };
524
921
  },
525
922
  {
526
- name: 'leafIndex';
527
- type: 'u32';
528
- }
529
- ];
530
- };
531
- },
532
- {
533
- name: 'PackedMerkleContext';
534
- type: {
535
- kind: 'struct';
536
- fields: [
923
+ name: 'outputCompressedAccounts';
924
+ type: {
925
+ vec: {
926
+ defined: 'OutputCompressedAccountWithPackedContext';
927
+ };
928
+ };
929
+ },
537
930
  {
538
- name: 'merkleTreePubkeyIndex';
539
- type: 'u8';
931
+ name: 'relayFee';
932
+ type: {
933
+ option: 'u64';
934
+ };
540
935
  },
541
936
  {
542
- name: 'nullifierQueuePubkeyIndex';
543
- type: 'u8';
937
+ name: 'newAddressParams';
938
+ type: {
939
+ vec: {
940
+ defined: 'NewAddressParamsPacked';
941
+ };
942
+ };
544
943
  },
545
944
  {
546
- name: 'leafIndex';
547
- type: 'u32';
945
+ name: 'compressOrDecompressLamports';
946
+ type: {
947
+ option: 'u64';
948
+ };
949
+ },
950
+ {
951
+ name: 'isCompress';
952
+ type: 'bool';
548
953
  }
549
954
  ];
550
955
  };
551
956
  },
552
957
  {
553
- name: 'CompressedAccount';
958
+ name: 'InstructionDataInvokeCpi';
554
959
  type: {
555
960
  kind: 'struct';
556
961
  fields: [
557
962
  {
558
- name: 'owner';
559
- type: 'publicKey';
963
+ name: 'proof';
964
+ type: {
965
+ option: {
966
+ defined: 'CompressedProof';
967
+ };
968
+ };
560
969
  },
561
970
  {
562
- name: 'lamports';
563
- type: 'u64';
971
+ name: 'newAddressParams';
972
+ type: {
973
+ vec: {
974
+ defined: 'NewAddressParamsPacked';
975
+ };
976
+ };
564
977
  },
565
978
  {
566
- name: 'address';
979
+ name: 'inputCompressedAccountsWithMerkleContext';
567
980
  type: {
568
- option: {
569
- array: ['u8', 32];
981
+ vec: {
982
+ defined: 'PackedCompressedAccountWithMerkleContext';
570
983
  };
571
984
  };
572
985
  },
573
986
  {
574
- name: 'data';
987
+ name: 'outputCompressedAccounts';
988
+ type: {
989
+ vec: {
990
+ defined: 'OutputCompressedAccountWithPackedContext';
991
+ };
992
+ };
993
+ },
994
+ {
995
+ name: 'relayFee';
996
+ type: {
997
+ option: 'u64';
998
+ };
999
+ },
1000
+ {
1001
+ name: 'compressOrDecompressLamports';
1002
+ type: {
1003
+ option: 'u64';
1004
+ };
1005
+ },
1006
+ {
1007
+ name: 'isCompress';
1008
+ type: 'bool';
1009
+ },
1010
+ {
1011
+ name: 'signerSeeds';
1012
+ type: {
1013
+ vec: 'bytes';
1014
+ };
1015
+ },
1016
+ {
1017
+ name: 'cpiContext';
575
1018
  type: {
576
1019
  option: {
577
- defined: 'CompressedAccountData';
1020
+ defined: 'CompressedCpiContext';
578
1021
  };
579
1022
  };
580
1023
  }
@@ -582,237 +1025,285 @@ type LightCompressedToken = {
582
1025
  };
583
1026
  },
584
1027
  {
585
- name: 'CompressedAccountData';
1028
+ name: 'MerkleTreeMetadata';
586
1029
  type: {
587
1030
  kind: 'struct';
588
1031
  fields: [
589
1032
  {
590
- name: 'discriminator';
1033
+ name: 'accessMetadata';
591
1034
  type: {
592
- array: ['u8', 8];
1035
+ defined: 'AccessMetadata';
593
1036
  };
594
1037
  },
595
1038
  {
596
- name: 'data';
597
- type: 'bytes';
598
- },
599
- {
600
- name: 'dataHash';
1039
+ name: 'rolloverMetadata';
601
1040
  type: {
602
- array: ['u8', 32];
1041
+ defined: 'RolloverMetadata';
603
1042
  };
1043
+ },
1044
+ {
1045
+ name: 'associatedQueue';
1046
+ type: 'publicKey';
1047
+ },
1048
+ {
1049
+ name: 'nextMerkleTree';
1050
+ type: 'publicKey';
604
1051
  }
605
1052
  ];
606
1053
  };
607
1054
  },
608
1055
  {
609
- name: 'PublicTransactionEvent';
1056
+ name: 'MerkleTreeSequenceNumber';
610
1057
  type: {
611
1058
  kind: 'struct';
612
1059
  fields: [
613
1060
  {
614
- name: 'inputCompressedAccountHashes';
615
- type: {
616
- vec: {
617
- array: ['u8', 32];
618
- };
619
- };
1061
+ name: 'pubkey';
1062
+ type: 'publicKey';
620
1063
  },
621
1064
  {
622
- name: 'outputCompressedAccountHashes';
623
- type: {
624
- vec: {
625
- array: ['u8', 32];
626
- };
627
- };
628
- },
1065
+ name: 'seq';
1066
+ type: 'u64';
1067
+ }
1068
+ ];
1069
+ };
1070
+ },
1071
+ {
1072
+ name: 'NewAddressParamsPacked';
1073
+ type: {
1074
+ kind: 'struct';
1075
+ fields: [
629
1076
  {
630
- name: 'outputCompressedAccounts';
1077
+ name: 'seed';
631
1078
  type: {
632
- vec: {
633
- defined: 'CompressedAccount';
634
- };
1079
+ array: ['u8', 32];
635
1080
  };
636
1081
  },
637
1082
  {
638
- name: 'outputStateMerkleTreeAccountIndices';
639
- type: 'bytes';
1083
+ name: 'addressQueueAccountIndex';
1084
+ type: 'u8';
640
1085
  },
641
1086
  {
642
- name: 'outputLeafIndices';
643
- type: {
644
- vec: 'u32';
645
- };
1087
+ name: 'addressMerkleTreeAccountIndex';
1088
+ type: 'u8';
646
1089
  },
647
1090
  {
648
- name: 'relayFee';
1091
+ name: 'addressMerkleTreeRootIndex';
1092
+ type: 'u16';
1093
+ }
1094
+ ];
1095
+ };
1096
+ },
1097
+ {
1098
+ name: 'OutputCompressedAccountWithPackedContext';
1099
+ type: {
1100
+ kind: 'struct';
1101
+ fields: [
1102
+ {
1103
+ name: 'compressedAccount';
649
1104
  type: {
650
- option: 'u64';
1105
+ defined: 'CompressedAccount';
651
1106
  };
652
1107
  },
653
1108
  {
654
- name: 'isCompress';
655
- type: 'bool';
656
- },
1109
+ name: 'merkleTreeIndex';
1110
+ type: 'u8';
1111
+ }
1112
+ ];
1113
+ };
1114
+ },
1115
+ {
1116
+ name: 'PackedCompressedAccountWithMerkleContext';
1117
+ type: {
1118
+ kind: 'struct';
1119
+ fields: [
657
1120
  {
658
- name: 'compressionLamports';
1121
+ name: 'compressedAccount';
659
1122
  type: {
660
- option: 'u64';
1123
+ defined: 'CompressedAccount';
661
1124
  };
662
1125
  },
663
1126
  {
664
- name: 'pubkeyArray';
1127
+ name: 'merkleContext';
665
1128
  type: {
666
- vec: 'publicKey';
1129
+ defined: 'PackedMerkleContext';
667
1130
  };
668
1131
  },
669
1132
  {
670
- name: 'message';
671
- type: {
672
- option: 'bytes';
673
- };
1133
+ name: 'rootIndex';
1134
+ docs: [
1135
+ 'Index of root used in inclusion validity proof.'
1136
+ ];
1137
+ type: 'u16';
674
1138
  }
675
1139
  ];
676
1140
  };
677
1141
  },
678
1142
  {
679
- name: 'CompressedCpiContext';
1143
+ name: 'PackedMerkleContext';
680
1144
  type: {
681
1145
  kind: 'struct';
682
1146
  fields: [
683
1147
  {
684
- name: 'setContext';
685
- type: 'bool';
1148
+ name: 'merkleTreePubkeyIndex';
1149
+ type: 'u8';
686
1150
  },
687
1151
  {
688
- name: 'cpiContextAccountIndex';
1152
+ name: 'nullifierQueuePubkeyIndex';
689
1153
  type: 'u8';
1154
+ },
1155
+ {
1156
+ name: 'leafIndex';
1157
+ type: 'u32';
690
1158
  }
691
1159
  ];
692
1160
  };
693
1161
  },
694
1162
  {
695
- name: 'InputTokenDataWithContext';
1163
+ name: 'PackedTokenTransferOutputData';
696
1164
  type: {
697
1165
  kind: 'struct';
698
1166
  fields: [
699
1167
  {
700
- name: 'amount';
701
- type: 'u64';
702
- },
703
- {
704
- name: 'delegateIndex';
705
- type: {
706
- option: 'u8';
707
- };
1168
+ name: 'owner';
1169
+ type: 'publicKey';
708
1170
  },
709
1171
  {
710
- name: 'delegatedAmount';
711
- type: {
712
- option: 'u64';
713
- };
1172
+ name: 'amount';
1173
+ type: 'u64';
714
1174
  },
715
1175
  {
716
- name: 'isNative';
1176
+ name: 'lamports';
717
1177
  type: {
718
1178
  option: 'u64';
719
1179
  };
720
1180
  },
721
1181
  {
722
- name: 'merkleContext';
723
- type: {
724
- defined: 'PackedMerkleContext';
725
- };
1182
+ name: 'merkleTreeIndex';
1183
+ type: 'u8';
726
1184
  }
727
1185
  ];
728
1186
  };
729
1187
  },
730
1188
  {
731
- name: 'CompressedTokenInstructionDataTransfer';
1189
+ name: 'PublicTransactionEvent';
732
1190
  type: {
733
1191
  kind: 'struct';
734
1192
  fields: [
735
1193
  {
736
- name: 'proof';
1194
+ name: 'inputCompressedAccountHashes';
737
1195
  type: {
738
- option: {
739
- defined: 'CompressedProof';
1196
+ vec: {
1197
+ array: ['u8', 32];
740
1198
  };
741
1199
  };
742
1200
  },
743
1201
  {
744
- name: 'rootIndices';
1202
+ name: 'outputCompressedAccountHashes';
745
1203
  type: {
746
- vec: 'u16';
1204
+ vec: {
1205
+ array: ['u8', 32];
1206
+ };
747
1207
  };
748
1208
  },
749
1209
  {
750
- name: 'mint';
751
- type: 'publicKey';
752
- },
753
- {
754
- name: 'signerIsDelegate';
755
- type: 'bool';
756
- },
757
- {
758
- name: 'inputTokenDataWithContext';
1210
+ name: 'outputCompressedAccounts';
759
1211
  type: {
760
1212
  vec: {
761
- defined: 'InputTokenDataWithContext';
1213
+ defined: 'OutputCompressedAccountWithPackedContext';
762
1214
  };
763
1215
  };
764
1216
  },
765
1217
  {
766
- name: 'outputCompressedAccounts';
1218
+ name: 'outputLeafIndices';
1219
+ type: {
1220
+ vec: 'u32';
1221
+ };
1222
+ },
1223
+ {
1224
+ name: 'sequenceNumbers';
767
1225
  type: {
768
1226
  vec: {
769
- defined: 'TokenTransferOutputData';
1227
+ defined: 'MerkleTreeSequenceNumber';
770
1228
  };
771
1229
  };
772
1230
  },
773
1231
  {
774
- name: 'outputStateMerkleTreeAccountIndices';
775
- type: 'bytes';
1232
+ name: 'relayFee';
1233
+ type: {
1234
+ option: 'u64';
1235
+ };
776
1236
  },
777
1237
  {
778
1238
  name: 'isCompress';
779
1239
  type: 'bool';
780
1240
  },
781
1241
  {
782
- name: 'compressionAmount';
1242
+ name: 'compressOrDecompressLamports';
783
1243
  type: {
784
1244
  option: 'u64';
785
1245
  };
786
1246
  },
787
1247
  {
788
- name: 'cpiContext';
1248
+ name: 'pubkeyArray';
789
1249
  type: {
790
- option: {
791
- defined: 'CompressedCpiContext';
792
- };
1250
+ vec: 'publicKey';
1251
+ };
1252
+ },
1253
+ {
1254
+ name: 'message';
1255
+ type: {
1256
+ option: 'bytes';
793
1257
  };
794
1258
  }
795
1259
  ];
796
1260
  };
797
1261
  },
798
1262
  {
799
- name: 'TokenTransferOutputData';
1263
+ name: 'RolloverMetadata';
800
1264
  type: {
801
1265
  kind: 'struct';
802
1266
  fields: [
803
1267
  {
804
- name: 'owner';
805
- type: 'publicKey';
1268
+ name: 'index';
1269
+ docs: ['Unique index.'];
1270
+ type: 'u64';
806
1271
  },
807
1272
  {
808
- name: 'amount';
1273
+ name: 'rolloverFee';
1274
+ docs: [
1275
+ 'This fee is used for rent for the next account.',
1276
+ 'It accumulates in the account so that once the corresponding Merkle tree account is full it can be rolled over'
1277
+ ];
809
1278
  type: 'u64';
810
1279
  },
811
1280
  {
812
- name: 'lamports';
813
- type: {
814
- option: 'u64';
815
- };
1281
+ name: 'rolloverThreshold';
1282
+ docs: [
1283
+ 'The threshold in percentage points when the account should be rolled over (95 corresponds to 95% filled).'
1284
+ ];
1285
+ type: 'u64';
1286
+ },
1287
+ {
1288
+ name: 'networkFee';
1289
+ docs: ['Tip for maintaining the account.'];
1290
+ type: 'u64';
1291
+ },
1292
+ {
1293
+ name: 'rolledoverSlot';
1294
+ docs: [
1295
+ 'The slot when the account was rolled over, a rolled over account should not be written to.'
1296
+ ];
1297
+ type: 'u64';
1298
+ },
1299
+ {
1300
+ name: 'closeThreshold';
1301
+ docs: [
1302
+ 'If current slot is greater than rolledover_slot + close_threshold and',
1303
+ "the account is empty it can be closed. No 'close' functionality has been",
1304
+ 'implemented yet.'
1305
+ ];
1306
+ type: 'u64';
816
1307
  }
817
1308
  ];
818
1309
  };
@@ -865,78 +1356,6 @@ type LightCompressedToken = {
865
1356
  type: {
866
1357
  option: 'u64';
867
1358
  };
868
- },
869
- {
870
- name: 'delegatedAmount';
871
- docs: ['The amount delegated'];
872
- type: 'u64';
873
- }
874
- ];
875
- };
876
- },
877
- {
878
- name: 'AccountState';
879
- type: {
880
- kind: 'enum';
881
- variants: [
882
- {
883
- name: 'Initialized';
884
- },
885
- {
886
- name: 'Frozen';
887
- }
888
- ];
889
- };
890
- },
891
- {
892
- name: 'ErrorCode';
893
- type: {
894
- kind: 'enum';
895
- variants: [
896
- {
897
- name: 'PublicKeyAmountMissmatch';
898
- },
899
- {
900
- name: 'MissingNewAuthorityPda';
901
- },
902
- {
903
- name: 'SignerCheckFailed';
904
- },
905
- {
906
- name: 'MintCheckFailed';
907
- },
908
- {
909
- name: 'ComputeInputSumFailed';
910
- },
911
- {
912
- name: 'ComputeOutputSumFailed';
913
- },
914
- {
915
- name: 'ComputeCompressSumFailed';
916
- },
917
- {
918
- name: 'ComputeDecompressSumFailed';
919
- },
920
- {
921
- name: 'SumCheckFailed';
922
- },
923
- {
924
- name: 'DecompressRecipientUndefinedForDecompress';
925
- },
926
- {
927
- name: 'CompressedPdaUndefinedForDecompress';
928
- },
929
- {
930
- name: 'DeCompressAmountUndefinedForDecompress';
931
- },
932
- {
933
- name: 'CompressedPdaUndefinedForCompress';
934
- },
935
- {
936
- name: 'DeCompressAmountUndefinedForCompress';
937
- },
938
- {
939
- name: 'DelegateUndefined';
940
1359
  }
941
1360
  ];
942
1361
  };
@@ -945,23 +1364,237 @@ type LightCompressedToken = {
945
1364
  errors: [
946
1365
  {
947
1366
  code: 6000;
948
- name: 'SignerCheckFailed';
949
- msg: 'Signer check failed';
1367
+ name: 'PublicKeyAmountMissmatch';
1368
+ msg: 'public keys and amounts must be of same length';
950
1369
  },
951
1370
  {
952
1371
  code: 6001;
953
- name: 'CreateTransferInstructionFailed';
954
- msg: 'Create transfer instruction failed';
1372
+ name: 'SignerCheckFailed';
1373
+ msg: 'SignerCheckFailed';
1374
+ },
1375
+ {
1376
+ code: 6002;
1377
+ name: 'ComputeInputSumFailed';
1378
+ msg: 'ComputeInputSumFailed';
1379
+ },
1380
+ {
1381
+ code: 6003;
1382
+ name: 'ComputeOutputSumFailed';
1383
+ msg: 'ComputeOutputSumFailed';
1384
+ },
1385
+ {
1386
+ code: 6004;
1387
+ name: 'ComputeCompressSumFailed';
1388
+ msg: 'ComputeCompressSumFailed';
1389
+ },
1390
+ {
1391
+ code: 6005;
1392
+ name: 'ComputeDecompressSumFailed';
1393
+ msg: 'ComputeDecompressSumFailed';
1394
+ },
1395
+ {
1396
+ code: 6006;
1397
+ name: 'SumCheckFailed';
1398
+ msg: 'SumCheckFailed';
1399
+ },
1400
+ {
1401
+ code: 6007;
1402
+ name: 'DecompressRecipientUndefinedForDecompress';
1403
+ msg: 'DecompressRecipientUndefinedForDecompress';
1404
+ },
1405
+ {
1406
+ code: 6008;
1407
+ name: 'CompressedPdaUndefinedForDecompress';
1408
+ msg: 'CompressedPdaUndefinedForDecompress';
1409
+ },
1410
+ {
1411
+ code: 6009;
1412
+ name: 'DeCompressAmountUndefinedForDecompress';
1413
+ msg: 'DeCompressAmountUndefinedForDecompress';
1414
+ },
1415
+ {
1416
+ code: 6010;
1417
+ name: 'CompressedPdaUndefinedForCompress';
1418
+ msg: 'CompressedPdaUndefinedForCompress';
1419
+ },
1420
+ {
1421
+ code: 6011;
1422
+ name: 'DeCompressAmountUndefinedForCompress';
1423
+ msg: 'DeCompressAmountUndefinedForCompress';
1424
+ },
1425
+ {
1426
+ code: 6012;
1427
+ name: 'DelegateUndefined';
1428
+ msg: 'DelegateUndefined while delegated amount is defined';
1429
+ },
1430
+ {
1431
+ code: 6013;
1432
+ name: 'DelegateSignerCheckFailed';
1433
+ msg: 'DelegateSignerCheckFailed';
1434
+ },
1435
+ {
1436
+ code: 6014;
1437
+ name: 'SplTokenSupplyMismatch';
1438
+ msg: 'SplTokenSupplyMismatch';
1439
+ },
1440
+ {
1441
+ code: 6015;
1442
+ name: 'HeapMemoryCheckFailed';
1443
+ msg: 'HeapMemoryCheckFailed';
1444
+ },
1445
+ {
1446
+ code: 6016;
1447
+ name: 'InstructionNotCallable';
1448
+ msg: 'The instruction is not callable';
1449
+ },
1450
+ {
1451
+ code: 6017;
1452
+ name: 'ArithmeticUnderflow';
1453
+ msg: 'ArithmeticUnderflow';
1454
+ },
1455
+ {
1456
+ code: 6018;
1457
+ name: 'InvalidDelegate';
1458
+ msg: 'InvalidDelegate';
1459
+ },
1460
+ {
1461
+ code: 6019;
1462
+ name: 'HashToFieldError';
1463
+ msg: 'HashToFieldError';
1464
+ },
1465
+ {
1466
+ code: 6020;
1467
+ name: 'InvalidMint';
1468
+ msg: 'InvalidMint';
955
1469
  }
956
1470
  ];
957
1471
  };
958
- declare const IDL: LightCompressedToken;
1472
+ declare const IDL: LightCompressedToken;
1473
+
1474
+ type TokenTransferOutputData = {
1475
+ /**
1476
+ * The owner of the output token account
1477
+ */
1478
+ owner: PublicKey;
1479
+ /**
1480
+ * The amount of tokens of the output token account
1481
+ */
1482
+ amount: BN;
1483
+ /**
1484
+ * lamports associated with the output token account
1485
+ */
1486
+ lamports: BN | null;
1487
+ };
1488
+ type PackedTokenTransferOutputData = {
1489
+ /**
1490
+ * The owner of the output token account
1491
+ */
1492
+ owner: PublicKey;
1493
+ /**
1494
+ * The amount of tokens of the output token account
1495
+ */
1496
+ amount: BN;
1497
+ /**
1498
+ * lamports associated with the output token account
1499
+ */
1500
+ lamports: BN | null;
1501
+ /**
1502
+ * Merkle tree pubkey index in remaining accounts
1503
+ */
1504
+ merkleTreeIndex: number;
1505
+ };
1506
+ type InputTokenDataWithContext = {
1507
+ /**
1508
+ * The amount of tokens to transfer
1509
+ */
1510
+ amount: BN;
1511
+ /**
1512
+ * Optional: The index of the delegate in remaining accounts
1513
+ */
1514
+ delegateIndex: number | null;
1515
+ /**
1516
+ * Optional: Whether the token is native (wSOL)
1517
+ */
1518
+ isNative: BN | null;
1519
+ /**
1520
+ * The index of the merkle tree address in remaining accounts
1521
+ */
1522
+ merkleTreePubkeyIndex: number;
1523
+ /**
1524
+ * The index of the nullifier queue address in remaining accounts
1525
+ */
1526
+ nullifierQueuePubkeyIndex: number;
1527
+ /**
1528
+ * The index of the leaf in the merkle tree
1529
+ */
1530
+ leafIndex: number;
1531
+ };
1532
+ type CompressedTokenInstructionDataInvoke = {
1533
+ /**
1534
+ * Validity proof
1535
+ */
1536
+ proof: CompressedProof | null;
1537
+ /**
1538
+ * The root indices of the transfer
1539
+ */
1540
+ rootIndices: number[];
1541
+ /**
1542
+ * The mint of the transfer
1543
+ */
1544
+ mint: PublicKey;
1545
+ /**
1546
+ * Whether the signer is a delegate
1547
+ * TODO: implement delegated transfer struct
1548
+ */
1549
+ delegatedTransfer: null;
1550
+ /**
1551
+ * Input token data with packed merkle context
1552
+ */
1553
+ inputTokenDataWithContext: InputTokenDataWithContext[];
1554
+ /**
1555
+ * Data of the output token accounts
1556
+ */
1557
+ outputCompressedAccounts: TokenTransferOutputData[];
1558
+ /**
1559
+ * The indices of the output state merkle tree accounts in 'remaining
1560
+ * accounts'
1561
+ */
1562
+ outputStateMerkleTreeAccountIndices: Buffer;
1563
+ };
1564
+ type TokenData = {
1565
+ /**
1566
+ * The mint associated with this account
1567
+ */
1568
+ mint: PublicKey;
1569
+ /**
1570
+ * The owner of this account
1571
+ */
1572
+ owner: PublicKey;
1573
+ /**
1574
+ * The amount of tokens this account holds
1575
+ */
1576
+ amount: BN;
1577
+ /**
1578
+ * If `delegate` is `Some` then `delegated_amount` represents the amount
1579
+ * authorized by the delegate
1580
+ */
1581
+ delegate: PublicKey | null;
1582
+ /**
1583
+ * The account's state
1584
+ */
1585
+ state: number;
1586
+ /**
1587
+ * If is_some, this is a native token, and the value logs the rent-exempt
1588
+ * reserve. An Account is required to be rent-exempt, so the value is used
1589
+ * by the Processor to ensure that wrapped SOL accounts do not drop below
1590
+ * this threshold.
1591
+ */
1592
+ isNative: BN | null;
1593
+ };
959
1594
 
960
1595
  type PackCompressedTokenAccountsParams = {
961
1596
  /** Input state to be consumed */
962
1597
  inputCompressedTokenAccounts: ParsedTokenAccount[];
963
- /** Length of output compressed accounts */
964
- outputCompressedAccountsLength: number;
965
1598
  /**
966
1599
  * State trees that the output should be inserted into. Defaults to the 0th
967
1600
  * state tree of the input state. Gets padded to the length of
@@ -970,19 +1603,24 @@ type PackCompressedTokenAccountsParams = {
970
1603
  outputStateTrees?: PublicKey[] | PublicKey;
971
1604
  /** Optional remaining accounts to append to */
972
1605
  remainingAccounts?: PublicKey[];
1606
+ /**
1607
+ * Root indices that are used on-chain to fetch the correct root
1608
+ * from the state Merkle tree account for validity proof verification.
1609
+ */
1610
+ rootIndices: number[];
1611
+ tokenTransferOutputs: TokenTransferOutputData$1[];
973
1612
  };
974
1613
  /**
975
1614
  * Packs Compressed Token Accounts.
976
1615
  */
977
1616
  declare function packCompressedTokenAccounts(params: PackCompressedTokenAccountsParams): {
978
1617
  inputTokenDataWithContext: InputTokenDataWithContext$1[];
979
- outputStateMerkleTreeIndices: number[];
980
1618
  remainingAccountMetas: AccountMeta[];
1619
+ packedOutputTokenData: PackedTokenTransferOutputData[];
981
1620
  };
982
1621
 
983
1622
  declare const POOL_SEED: Buffer;
984
1623
  declare const CPI_AUTHORITY_SEED: Buffer;
985
- declare const MINT_AUTHORITY_SEED: Uint8Array;
986
1624
  declare const SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE = 1461600;
987
1625
 
988
1626
  type CompressParams = {
@@ -1011,9 +1649,10 @@ type CompressParams = {
1011
1649
  */
1012
1650
  amount: number | BN;
1013
1651
  /**
1014
- * The state tree that the tx output should be inserted into.
1652
+ * The state tree that the tx output should be inserted into. Defaults to a
1653
+ * public state tree if unspecified.
1015
1654
  */
1016
- outputStateTree: PublicKey;
1655
+ outputStateTree?: PublicKey;
1017
1656
  };
1018
1657
  type DecompressParams = {
1019
1658
  /**
@@ -1032,10 +1671,6 @@ type DecompressParams = {
1032
1671
  * amount of tokens to decompress.
1033
1672
  */
1034
1673
  amount: number | BN;
1035
- /**
1036
- * The state tree that the change tx output should be inserted into.
1037
- */
1038
- outputStateTree: PublicKey;
1039
1674
  /**
1040
1675
  * The recent state root indices of the input state. The expiry is tied to
1041
1676
  * the proof.
@@ -1046,6 +1681,11 @@ type DecompressParams = {
1046
1681
  * expires after n slots.
1047
1682
  */
1048
1683
  recentValidityProof: CompressedProof;
1684
+ /**
1685
+ * The state tree that the change tx output should be inserted into.
1686
+ * Defaults to a public state tree if unspecified.
1687
+ */
1688
+ outputStateTree?: PublicKey;
1049
1689
  };
1050
1690
  type TransferParams = {
1051
1691
  /**
@@ -1086,35 +1726,60 @@ type TransferParams = {
1086
1726
  * Create Mint account for compressed Tokens
1087
1727
  */
1088
1728
  type CreateMintParams = {
1089
- /** Tx feepayer */
1729
+ /**
1730
+ * Tx feepayer
1731
+ */
1090
1732
  feePayer: PublicKey;
1091
- /** Mint authority */
1733
+ /**
1734
+ * Mint authority
1735
+ */
1092
1736
  authority: PublicKey;
1093
- /** Mint public key */
1737
+ /**
1738
+ * Mint public key
1739
+ */
1094
1740
  mint: PublicKey;
1095
- /** Mint decimals */
1741
+ /**
1742
+ * Mint decimals
1743
+ */
1096
1744
  decimals: number;
1097
- /** Optional: freeze authority */
1745
+ /**
1746
+ * Optional: freeze authority
1747
+ */
1098
1748
  freezeAuthority: PublicKey | null;
1099
- /** lamport amount for mint account rent exemption */
1749
+ /**
1750
+ * lamport amount for mint account rent exemption
1751
+ */
1100
1752
  rentExemptBalance: number;
1101
1753
  };
1102
1754
  /**
1103
1755
  * Create compressed token accounts
1104
1756
  */
1105
1757
  type MintToParams = {
1106
- /** Tx feepayer */
1758
+ /**
1759
+ * Tx feepayer
1760
+ */
1107
1761
  feePayer: PublicKey;
1108
- /** Mint authority */
1762
+ /**
1763
+ * Mint authority
1764
+ */
1109
1765
  authority: PublicKey;
1110
- /** Mint public key */
1766
+ /**
1767
+ * Mint public key
1768
+ */
1111
1769
  mint: PublicKey;
1112
- /** The Solana Public Keys to mint to. Accepts batches */
1770
+ /**
1771
+ * The Solana Public Keys to mint to.
1772
+ */
1113
1773
  toPubkey: PublicKey[] | PublicKey;
1114
- /** The amount of compressed tokens to mint. Accepts batches */
1774
+ /**
1775
+ * The amount of compressed tokens to mint.
1776
+ */
1115
1777
  amount: BN | BN[] | number | number[];
1116
- /** Public key of the state tree to mint into. */
1117
- merkleTree: PublicKey;
1778
+ /**
1779
+ * Public key of the state tree to mint into. Defaults to a public state
1780
+ * tree if unspecified.
1781
+ */
1782
+ merkleTree?: PublicKey;
1118
1783
  };
1119
1784
  /**
1120
1785
  * Register an existing SPL mint account to the compressed token program
@@ -1123,8 +1788,6 @@ type MintToParams = {
1123
1788
  type RegisterMintParams = {
1124
1789
  /** Tx feepayer */
1125
1790
  feePayer: PublicKey;
1126
- /** Mint authority */
1127
- authority: PublicKey;
1128
1791
  /** Mint public key */
1129
1792
  mint: PublicKey;
1130
1793
  };
@@ -1132,20 +1795,35 @@ type RegisterMintParams = {
1132
1795
  * Mint from existing SPL mint to compressed token accounts
1133
1796
  */
1134
1797
  type ApproveAndMintToParams = {
1135
- /** Tx feepayer */
1798
+ /**
1799
+ * Tx feepayer
1800
+ */
1136
1801
  feePayer: PublicKey;
1137
- /** Mint authority */
1802
+ /**
1803
+ * Mint authority
1804
+ */
1138
1805
  authority: PublicKey;
1139
- /** Mint authority (associated) token account */
1806
+ /**
1807
+ * Mint authority (associated) token account
1808
+ */
1140
1809
  authorityTokenAccount: PublicKey;
1141
- /** Mint public key */
1810
+ /**
1811
+ * Mint public key
1812
+ */
1142
1813
  mint: PublicKey;
1143
- /** The Solana Public Key to mint to. */
1814
+ /**
1815
+ * The Solana Public Key to mint to.
1816
+ */
1144
1817
  toPubkey: PublicKey;
1145
- /** The amount of compressed tokens to mint. */
1818
+ /**
1819
+ * The amount of compressed tokens to mint.
1820
+ */
1146
1821
  amount: BN | number;
1147
- /** Public key of the state tree to mint into. */
1148
- merkleTree: PublicKey;
1822
+ /**
1823
+ * Public key of the state tree to mint into. Defaults to a public state
1824
+ * tree if unspecified.
1825
+ */
1826
+ merkleTree?: PublicKey;
1149
1827
  };
1150
1828
  /**
1151
1829
  * Sum up the token amounts of the compressed token accounts
@@ -1198,8 +1876,6 @@ declare class CompressedTokenProgram {
1198
1876
  */
1199
1877
  private static initializeProgram;
1200
1878
  /** @internal */
1201
- static deriveMintAuthorityPda: (authority: PublicKey, mint: PublicKey) => [PublicKey, number];
1202
- /** @internal */
1203
1879
  static deriveTokenPoolPda(mint: PublicKey): PublicKey;
1204
1880
  /** @internal */
1205
1881
  static get deriveCpiAuthorityPda(): PublicKey;
@@ -1211,7 +1887,7 @@ declare class CompressedTokenProgram {
1211
1887
  * Enable compression for an existing SPL mint, creating an omnibus account.
1212
1888
  * For new mints, use `CompressedTokenProgram.createMint`.
1213
1889
  */
1214
- static registerMint(params: RegisterMintParams): Promise<TransactionInstruction[]>;
1890
+ static registerMint(params: RegisterMintParams): Promise<TransactionInstruction>;
1215
1891
  /**
1216
1892
  * Construct mintTo instruction for compressed tokens
1217
1893
  */
@@ -1235,116 +1911,6 @@ declare class CompressedTokenProgram {
1235
1911
  static decompress(params: DecompressParams): Promise<TransactionInstruction>;
1236
1912
  }
1237
1913
 
1238
- type TokenTransferOutputData = {
1239
- /**
1240
- * The owner of the output token account
1241
- */
1242
- owner: PublicKey;
1243
- /**
1244
- * The amount of tokens of the output token account
1245
- */
1246
- amount: BN;
1247
- /**
1248
- * lamports associated with the output token account
1249
- */
1250
- lamports: BN | null;
1251
- };
1252
- type InputTokenDataWithContext = {
1253
- /**
1254
- * The amount of tokens to transfer
1255
- */
1256
- amount: BN;
1257
- /**
1258
- * Optional: The index of the delegate in remaining accounts
1259
- */
1260
- delegateIndex: number | null;
1261
- /**
1262
- * Optional: The amount of delegated tokens
1263
- */
1264
- delegatedAmount: BN | null;
1265
- /**
1266
- * Optional: Whether the token is native (wSOL)
1267
- */
1268
- isNative: BN | null;
1269
- /**
1270
- * The index of the merkle tree address in remaining accounts
1271
- */
1272
- merkleTreePubkeyIndex: number;
1273
- /**
1274
- * The index of the nullifier queue address in remaining accounts
1275
- */
1276
- nullifierQueuePubkeyIndex: number;
1277
- /**
1278
- * The index of the leaf in the merkle tree
1279
- */
1280
- leafIndex: number;
1281
- };
1282
- type CompressedTokenInstructionDataInvoke = {
1283
- /**
1284
- * Validity proof
1285
- */
1286
- proof: CompressedProof | null;
1287
- /**
1288
- * The root indices of the transfer
1289
- */
1290
- rootIndices: number[];
1291
- /**
1292
- * The mint of the transfer
1293
- */
1294
- mint: PublicKey;
1295
- /**
1296
- * Whether the signer is a delegate
1297
- */
1298
- signerIsDelegate: boolean;
1299
- /**
1300
- * Input token data with packed merkle context
1301
- */
1302
- inputTokenDataWithContext: InputTokenDataWithContext[];
1303
- /**
1304
- * Data of the output token accounts
1305
- */
1306
- outputCompressedAccounts: TokenTransferOutputData[];
1307
- /**
1308
- * The indices of the output state merkle tree accounts in 'remaining
1309
- * accounts'
1310
- */
1311
- outputStateMerkleTreeAccountIndices: Buffer;
1312
- };
1313
- type TokenData = {
1314
- /**
1315
- * The mint associated with this account
1316
- */
1317
- mint: PublicKey;
1318
- /**
1319
- * The owner of this account
1320
- */
1321
- owner: PublicKey;
1322
- /**
1323
- * The amount of tokens this account holds
1324
- */
1325
- amount: BN;
1326
- /**
1327
- * If `delegate` is `Some` then `delegated_amount` represents the amount
1328
- * authorized by the delegate
1329
- */
1330
- delegate: PublicKey | null;
1331
- /**
1332
- * The account's state
1333
- */
1334
- state: number;
1335
- /**
1336
- * If is_some, this is a native token, and the value logs the rent-exempt
1337
- * reserve. An Account is required to be rent-exempt, so the value is used
1338
- * by the Processor to ensure that wrapped SOL accounts do not drop below
1339
- * this threshold.
1340
- */
1341
- isNative: BN | null;
1342
- /**
1343
- * The amount delegated
1344
- */
1345
- delegatedAmount: BN;
1346
- };
1347
-
1348
1914
  /**
1349
1915
  * Mint compressed tokens to a solana address from an external mint authority
1350
1916
  *
@@ -1407,14 +1973,14 @@ declare function decompress(rpc: Rpc, payer: Signer, mint: PublicKey, amount: nu
1407
1973
  *
1408
1974
  * @param rpc RPC to use
1409
1975
  * @param payer Payer of the transaction and initialization fees
1410
- * @param mintAuthority Account or multisig that will control minting. Is signer.
1976
+ * @param mintAuthority Account or multisig that will control minting
1411
1977
  * @param decimals Location of the decimal place
1412
1978
  * @param keypair Optional keypair, defaulting to a new random one
1413
1979
  * @param confirmOptions Options for confirming the transaction
1414
1980
  *
1415
1981
  * @return Address of the new mint and the transaction signature
1416
1982
  */
1417
- declare function createMint(rpc: Rpc, payer: Signer, mintAuthority: Signer, decimals: number, keypair?: Keypair, confirmOptions?: ConfirmOptions): Promise<{
1983
+ declare function createMint(rpc: Rpc, payer: Signer, mintAuthority: PublicKey, decimals: number, keypair?: Keypair, confirmOptions?: ConfirmOptions): Promise<{
1418
1984
  mint: PublicKey;
1419
1985
  transactionSignature: TransactionSignature;
1420
1986
  }>;
@@ -1434,8 +2000,7 @@ declare function createMint(rpc: Rpc, payer: Signer, mintAuthority: Signer, deci
1434
2000
  *
1435
2001
  * @return Signature of the confirmed transaction
1436
2002
  */
1437
- declare function mintTo(rpc: Rpc, payer: Signer, mint: PublicKey, destination: PublicKey, authority: Signer, amount: number | BN, merkleTree?: PublicKey, // DEFAULT IF NOT PROVIDED
1438
- confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2003
+ declare function mintTo(rpc: Rpc, payer: Signer, mint: PublicKey, destination: PublicKey, authority: Signer, amount: number | BN, merkleTree?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1439
2004
 
1440
2005
  /**
1441
2006
  * Register an existing mint with the CompressedToken program
@@ -1448,7 +2013,7 @@ confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1448
2013
  *
1449
2014
  * @return transaction signature
1450
2015
  */
1451
- declare function registerMint(rpc: Rpc, payer: Signer, mintAuthority: Signer, mintAddress: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2016
+ declare function registerMint(rpc: Rpc, payer: Signer, mintAddress: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1452
2017
 
1453
2018
  /**
1454
2019
  * Transfer compressed tokens from one owner to another
@@ -1460,7 +2025,8 @@ declare function registerMint(rpc: Rpc, payer: Signer, mintAuthority: Signer, mi
1460
2025
  * @param owner Owner of the compressed tokens
1461
2026
  * @param toAddress Destination address of the recipient
1462
2027
  * @param merkleTree State tree account that the compressed tokens should be
1463
- * inserted into. Defaults to the default state tree account.
2028
+ * inserted into. Defaults to the default state tree
2029
+ * account.
1464
2030
  * @param confirmOptions Options for confirming the transaction
1465
2031
  *
1466
2032
  *
@@ -1480,4 +2046,4 @@ declare function selectMinCompressedTokenAccountsForTransfer(accounts: ParsedTok
1480
2046
  totalLamports: BN | null
1481
2047
  ];
1482
2048
 
1483
- export { type ApproveAndMintToParams, CPI_AUTHORITY_SEED, type CompressedTokenInstructionDataInvoke, CompressedTokenProgram, type CreateMintParams, IDL, type InputTokenDataWithContext, type LightCompressedToken, MINT_AUTHORITY_SEED, type MintToParams, POOL_SEED, type PackCompressedTokenAccountsParams, type RegisterMintParams, SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE, type TokenData, type TokenTransferOutputData, type TransferParams, approveAndMintTo, compress, createDecompressOutputState, createMint, createTransferOutputState, decompress, mintTo, packCompressedTokenAccounts, parseTokenData, registerMint, selectMinCompressedTokenAccountsForTransfer, sumUpTokenAmount, transfer, validateSameTokenOwner };
2049
+ export { type ApproveAndMintToParams, CPI_AUTHORITY_SEED, type CompressedTokenInstructionDataInvoke, CompressedTokenProgram, type CreateMintParams, IDL, type InputTokenDataWithContext, type LightCompressedToken, type MintToParams, POOL_SEED, type PackCompressedTokenAccountsParams, type PackedTokenTransferOutputData, type RegisterMintParams, SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE, type TokenData, type TokenTransferOutputData, type TransferParams, approveAndMintTo, compress, createDecompressOutputState, createMint, createTransferOutputState, decompress, mintTo, packCompressedTokenAccounts, parseTokenData, registerMint, selectMinCompressedTokenAccountsForTransfer, sumUpTokenAmount, transfer, validateSameTokenOwner };