@lightprotocol/compressed-token 0.17.1 → 0.17.2-alpha.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.
@@ -1,1800 +1,12 @@
1
- import { CompressedProof, ParsedTokenAccount, TokenTransferOutputData as TokenTransferOutputData$1, InputTokenDataWithContext as InputTokenDataWithContext$1, Rpc } from '@lightprotocol/stateless.js';
1
+ import { PackedMerkleContext, CompressedProof, ParsedTokenAccount, InputTokenDataWithContext as InputTokenDataWithContext$1, Rpc } from '@lightprotocol/stateless.js';
2
2
  import { PublicKey, AccountMeta, TransactionInstruction, Connection, Signer, ConfirmOptions, TransactionSignature, Keypair } from '@solana/web3.js';
3
- import { BN, Program } from '@coral-xyz/anchor';
3
+ import BN from 'bn.js';
4
4
 
5
- type LightCompressedToken = {
6
- version: '1.2.0';
7
- name: 'light_compressed_token';
8
- instructions: [
9
- {
10
- name: 'createTokenPool';
11
- docs: [
12
- 'This instruction creates a token pool for a given mint. Every spl mint',
13
- 'can have one token pool. When a token is compressed the tokens are',
14
- 'transferrred to the token pool, and their compressed equivalent is',
15
- 'minted into a Merkle tree.'
16
- ];
17
- accounts: [
18
- {
19
- name: 'feePayer';
20
- isMut: true;
21
- isSigner: true;
22
- docs: ['UNCHECKED: only pays fees.'];
23
- },
24
- {
25
- name: 'tokenPoolPda';
26
- isMut: true;
27
- isSigner: false;
28
- },
29
- {
30
- name: 'systemProgram';
31
- isMut: false;
32
- isSigner: false;
33
- },
34
- {
35
- name: 'mint';
36
- isMut: true;
37
- isSigner: false;
38
- },
39
- {
40
- name: 'tokenProgram';
41
- isMut: false;
42
- isSigner: false;
43
- },
44
- {
45
- name: 'cpiAuthorityPda';
46
- isMut: false;
47
- isSigner: false;
48
- }
49
- ];
50
- args: [];
51
- },
52
- {
53
- name: 'mintTo';
54
- docs: [
55
- 'Mints tokens from an spl token mint to a list of compressed accounts.',
56
- 'Minted tokens are transferred to a pool account owned by the compressed',
57
- 'token program. The instruction creates one compressed output account for',
58
- 'every amount and pubkey input pair. A constant amount of lamports can be',
59
- 'transferred to each output account to enable. A use case to add lamports',
60
- 'to a compressed token account is to prevent spam. This is the only way',
61
- 'to add lamports to a compressed token account.'
62
- ];
63
- accounts: [
64
- {
65
- name: 'feePayer';
66
- isMut: true;
67
- isSigner: true;
68
- docs: ['UNCHECKED: only pays fees.'];
69
- },
70
- {
71
- name: 'authority';
72
- isMut: false;
73
- isSigner: true;
74
- },
75
- {
76
- name: 'cpiAuthorityPda';
77
- isMut: false;
78
- isSigner: false;
79
- },
80
- {
81
- name: 'mint';
82
- isMut: true;
83
- isSigner: false;
84
- },
85
- {
86
- name: 'tokenPoolPda';
87
- isMut: true;
88
- isSigner: false;
89
- },
90
- {
91
- name: 'tokenProgram';
92
- isMut: false;
93
- isSigner: false;
94
- },
95
- {
96
- name: 'lightSystemProgram';
97
- isMut: false;
98
- isSigner: false;
99
- },
100
- {
101
- name: 'registeredProgramPda';
102
- isMut: false;
103
- isSigner: false;
104
- },
105
- {
106
- name: 'noopProgram';
107
- isMut: false;
108
- isSigner: false;
109
- docs: ['programs'];
110
- },
111
- {
112
- name: 'accountCompressionAuthority';
113
- isMut: false;
114
- isSigner: false;
115
- },
116
- {
117
- name: 'accountCompressionProgram';
118
- isMut: false;
119
- isSigner: false;
120
- },
121
- {
122
- name: 'merkleTree';
123
- isMut: true;
124
- isSigner: false;
125
- },
126
- {
127
- name: 'selfProgram';
128
- isMut: false;
129
- isSigner: false;
130
- },
131
- {
132
- name: 'systemProgram';
133
- isMut: false;
134
- isSigner: false;
135
- },
136
- {
137
- name: 'solPoolPda';
138
- isMut: true;
139
- isSigner: false;
140
- isOptional: true;
141
- }
142
- ];
143
- args: [
144
- {
145
- name: 'publicKeys';
146
- type: {
147
- vec: 'publicKey';
148
- };
149
- },
150
- {
151
- name: 'amounts';
152
- type: {
153
- vec: 'u64';
154
- };
155
- },
156
- {
157
- name: 'lamports';
158
- type: {
159
- option: 'u64';
160
- };
161
- }
162
- ];
163
- },
164
- {
165
- name: 'compressSplTokenAccount';
166
- docs: [
167
- 'Compresses the balance of an spl token account sub an optional remaining',
168
- 'amount. This instruction does not close the spl token account. To close',
169
- 'the account bundle a close spl account instruction in your transaction.'
170
- ];
171
- accounts: [
172
- {
173
- name: 'feePayer';
174
- isMut: true;
175
- isSigner: true;
176
- docs: ['UNCHECKED: only pays fees.'];
177
- },
178
- {
179
- name: 'authority';
180
- isMut: false;
181
- isSigner: true;
182
- docs: [
183
- 'Authority is verified through proof since both owner and delegate',
184
- 'are included in the token data hash, which is a public input to the',
185
- 'validity proof.'
186
- ];
187
- },
188
- {
189
- name: 'cpiAuthorityPda';
190
- isMut: false;
191
- isSigner: false;
192
- },
193
- {
194
- name: 'lightSystemProgram';
195
- isMut: false;
196
- isSigner: false;
197
- },
198
- {
199
- name: 'registeredProgramPda';
200
- isMut: false;
201
- isSigner: false;
202
- },
203
- {
204
- name: 'noopProgram';
205
- isMut: false;
206
- isSigner: false;
207
- },
208
- {
209
- name: 'accountCompressionAuthority';
210
- isMut: false;
211
- isSigner: false;
212
- },
213
- {
214
- name: 'accountCompressionProgram';
215
- isMut: false;
216
- isSigner: false;
217
- },
218
- {
219
- name: 'selfProgram';
220
- isMut: false;
221
- isSigner: false;
222
- docs: ['this program is the signer of the cpi.'];
223
- },
224
- {
225
- name: 'tokenPoolPda';
226
- isMut: true;
227
- isSigner: false;
228
- isOptional: true;
229
- },
230
- {
231
- name: 'compressOrDecompressTokenAccount';
232
- isMut: true;
233
- isSigner: false;
234
- isOptional: true;
235
- },
236
- {
237
- name: 'tokenProgram';
238
- isMut: false;
239
- isSigner: false;
240
- isOptional: true;
241
- },
242
- {
243
- name: 'systemProgram';
244
- isMut: false;
245
- isSigner: false;
246
- }
247
- ];
248
- args: [
249
- {
250
- name: 'owner';
251
- type: 'publicKey';
252
- },
253
- {
254
- name: 'remainingAmount';
255
- type: {
256
- option: 'u64';
257
- };
258
- },
259
- {
260
- name: 'cpiContext';
261
- type: {
262
- option: {
263
- defined: 'CompressedCpiContext';
264
- };
265
- };
266
- }
267
- ];
268
- },
269
- {
270
- name: 'transfer';
271
- docs: [
272
- 'Transfers compressed tokens from one account to another. All accounts',
273
- 'must be of the same mint. Additional spl tokens can be compressed or',
274
- 'decompressed. In one transaction only compression or decompression is',
275
- 'possible. Lamports can be transferred alongside tokens. If output token',
276
- 'accounts specify less lamports than inputs the remaining lamports are',
277
- 'transferred to an output compressed account. Signer must be owner or',
278
- 'delegate. If a delegated token account is transferred the delegate is',
279
- 'not preserved.'
280
- ];
281
- accounts: [
282
- {
283
- name: 'feePayer';
284
- isMut: true;
285
- isSigner: true;
286
- docs: ['UNCHECKED: only pays fees.'];
287
- },
288
- {
289
- name: 'authority';
290
- isMut: false;
291
- isSigner: true;
292
- docs: [
293
- 'Authority is verified through proof since both owner and delegate',
294
- 'are included in the token data hash, which is a public input to the',
295
- 'validity proof.'
296
- ];
297
- },
298
- {
299
- name: 'cpiAuthorityPda';
300
- isMut: false;
301
- isSigner: false;
302
- },
303
- {
304
- name: 'lightSystemProgram';
305
- isMut: false;
306
- isSigner: false;
307
- },
308
- {
309
- name: 'registeredProgramPda';
310
- isMut: false;
311
- isSigner: false;
312
- },
313
- {
314
- name: 'noopProgram';
315
- isMut: false;
316
- isSigner: false;
317
- },
318
- {
319
- name: 'accountCompressionAuthority';
320
- isMut: false;
321
- isSigner: false;
322
- },
323
- {
324
- name: 'accountCompressionProgram';
325
- isMut: false;
326
- isSigner: false;
327
- },
328
- {
329
- name: 'selfProgram';
330
- isMut: false;
331
- isSigner: false;
332
- docs: ['this program is the signer of the cpi.'];
333
- },
334
- {
335
- name: 'tokenPoolPda';
336
- isMut: true;
337
- isSigner: false;
338
- isOptional: true;
339
- },
340
- {
341
- name: 'compressOrDecompressTokenAccount';
342
- isMut: true;
343
- isSigner: false;
344
- isOptional: true;
345
- },
346
- {
347
- name: 'tokenProgram';
348
- isMut: false;
349
- isSigner: false;
350
- isOptional: true;
351
- },
352
- {
353
- name: 'systemProgram';
354
- isMut: false;
355
- isSigner: false;
356
- }
357
- ];
358
- args: [
359
- {
360
- name: 'inputs';
361
- type: 'bytes';
362
- }
363
- ];
364
- },
365
- {
366
- name: 'approve';
367
- docs: [
368
- 'Delegates an amount to a delegate. A compressed token account is either',
369
- 'completely delegated or not. Prior delegates are not preserved. Cannot',
370
- 'be called by a delegate.',
371
- 'The instruction creates two output accounts:',
372
- '1. one account with delegated amount',
373
- '2. one account with remaining(change) amount'
374
- ];
375
- accounts: [
376
- {
377
- name: 'feePayer';
378
- isMut: true;
379
- isSigner: true;
380
- docs: ['UNCHECKED: only pays fees.'];
381
- },
382
- {
383
- name: 'authority';
384
- isMut: false;
385
- isSigner: true;
386
- docs: [
387
- 'Authority is verified through proof since both owner and delegate',
388
- 'are included in the token data hash, which is a public input to the',
389
- 'validity proof.'
390
- ];
391
- },
392
- {
393
- name: 'cpiAuthorityPda';
394
- isMut: false;
395
- isSigner: false;
396
- },
397
- {
398
- name: 'lightSystemProgram';
399
- isMut: false;
400
- isSigner: false;
401
- },
402
- {
403
- name: 'registeredProgramPda';
404
- isMut: false;
405
- isSigner: false;
406
- },
407
- {
408
- name: 'noopProgram';
409
- isMut: false;
410
- isSigner: false;
411
- },
412
- {
413
- name: 'accountCompressionAuthority';
414
- isMut: false;
415
- isSigner: false;
416
- },
417
- {
418
- name: 'accountCompressionProgram';
419
- isMut: false;
420
- isSigner: false;
421
- },
422
- {
423
- name: 'selfProgram';
424
- isMut: false;
425
- isSigner: false;
426
- docs: ['this program is the signer of the cpi.'];
427
- },
428
- {
429
- name: 'systemProgram';
430
- isMut: false;
431
- isSigner: false;
432
- }
433
- ];
434
- args: [
435
- {
436
- name: 'inputs';
437
- type: 'bytes';
438
- }
439
- ];
440
- },
441
- {
442
- name: 'revoke';
443
- docs: [
444
- 'Revokes a delegation. The instruction merges all inputs into one output',
445
- 'account. Cannot be called by a delegate. Delegates are not preserved.'
446
- ];
447
- accounts: [
448
- {
449
- name: 'feePayer';
450
- isMut: true;
451
- isSigner: true;
452
- docs: ['UNCHECKED: only pays fees.'];
453
- },
454
- {
455
- name: 'authority';
456
- isMut: false;
457
- isSigner: true;
458
- docs: [
459
- 'Authority is verified through proof since both owner and delegate',
460
- 'are included in the token data hash, which is a public input to the',
461
- 'validity proof.'
462
- ];
463
- },
464
- {
465
- name: 'cpiAuthorityPda';
466
- isMut: false;
467
- isSigner: false;
468
- },
469
- {
470
- name: 'lightSystemProgram';
471
- isMut: false;
472
- isSigner: false;
473
- },
474
- {
475
- name: 'registeredProgramPda';
476
- isMut: false;
477
- isSigner: false;
478
- },
479
- {
480
- name: 'noopProgram';
481
- isMut: false;
482
- isSigner: false;
483
- },
484
- {
485
- name: 'accountCompressionAuthority';
486
- isMut: false;
487
- isSigner: false;
488
- },
489
- {
490
- name: 'accountCompressionProgram';
491
- isMut: false;
492
- isSigner: false;
493
- },
494
- {
495
- name: 'selfProgram';
496
- isMut: false;
497
- isSigner: false;
498
- docs: ['this program is the signer of the cpi.'];
499
- },
500
- {
501
- name: 'systemProgram';
502
- isMut: false;
503
- isSigner: false;
504
- }
505
- ];
506
- args: [
507
- {
508
- name: 'inputs';
509
- type: 'bytes';
510
- }
511
- ];
512
- },
513
- {
514
- name: 'freeze';
515
- docs: [
516
- 'Freezes compressed token accounts. Inputs must not be frozen. Creates as',
517
- 'many outputs as inputs. Balances and delegates are preserved.'
518
- ];
519
- accounts: [
520
- {
521
- name: 'feePayer';
522
- isMut: true;
523
- isSigner: true;
524
- docs: ['UNCHECKED: only pays fees.'];
525
- },
526
- {
527
- name: 'authority';
528
- isMut: false;
529
- isSigner: true;
530
- },
531
- {
532
- name: 'cpiAuthorityPda';
533
- isMut: false;
534
- isSigner: false;
535
- },
536
- {
537
- name: 'lightSystemProgram';
538
- isMut: false;
539
- isSigner: false;
540
- },
541
- {
542
- name: 'registeredProgramPda';
543
- isMut: false;
544
- isSigner: false;
545
- },
546
- {
547
- name: 'noopProgram';
548
- isMut: false;
549
- isSigner: false;
550
- },
551
- {
552
- name: 'accountCompressionAuthority';
553
- isMut: false;
554
- isSigner: false;
555
- },
556
- {
557
- name: 'accountCompressionProgram';
558
- isMut: false;
559
- isSigner: false;
560
- },
561
- {
562
- name: 'selfProgram';
563
- isMut: false;
564
- isSigner: false;
565
- docs: ['that this program is the signer of the cpi.'];
566
- },
567
- {
568
- name: 'systemProgram';
569
- isMut: false;
570
- isSigner: false;
571
- },
572
- {
573
- name: 'mint';
574
- isMut: false;
575
- isSigner: false;
576
- }
577
- ];
578
- args: [
579
- {
580
- name: 'inputs';
581
- type: 'bytes';
582
- }
583
- ];
584
- },
585
- {
586
- name: 'thaw';
587
- docs: [
588
- 'Thaws frozen compressed token accounts. Inputs must be frozen. Creates',
589
- 'as many outputs as inputs. Balances and delegates are preserved.'
590
- ];
591
- accounts: [
592
- {
593
- name: 'feePayer';
594
- isMut: true;
595
- isSigner: true;
596
- docs: ['UNCHECKED: only pays fees.'];
597
- },
598
- {
599
- name: 'authority';
600
- isMut: false;
601
- isSigner: true;
602
- },
603
- {
604
- name: 'cpiAuthorityPda';
605
- isMut: false;
606
- isSigner: false;
607
- },
608
- {
609
- name: 'lightSystemProgram';
610
- isMut: false;
611
- isSigner: false;
612
- },
613
- {
614
- name: 'registeredProgramPda';
615
- isMut: false;
616
- isSigner: false;
617
- },
618
- {
619
- name: 'noopProgram';
620
- isMut: false;
621
- isSigner: false;
622
- },
623
- {
624
- name: 'accountCompressionAuthority';
625
- isMut: false;
626
- isSigner: false;
627
- },
628
- {
629
- name: 'accountCompressionProgram';
630
- isMut: false;
631
- isSigner: false;
632
- },
633
- {
634
- name: 'selfProgram';
635
- isMut: false;
636
- isSigner: false;
637
- docs: ['that this program is the signer of the cpi.'];
638
- },
639
- {
640
- name: 'systemProgram';
641
- isMut: false;
642
- isSigner: false;
643
- },
644
- {
645
- name: 'mint';
646
- isMut: false;
647
- isSigner: false;
648
- }
649
- ];
650
- args: [
651
- {
652
- name: 'inputs';
653
- type: 'bytes';
654
- }
655
- ];
656
- },
657
- {
658
- name: 'burn';
659
- docs: [
660
- 'Burns compressed tokens and spl tokens from the pool account. Delegates',
661
- 'can burn tokens. The output compressed token account remains delegated.',
662
- 'Creates one output compressed token account.'
663
- ];
664
- accounts: [
665
- {
666
- name: 'feePayer';
667
- isMut: true;
668
- isSigner: true;
669
- docs: ['UNCHECKED: only pays fees.'];
670
- },
671
- {
672
- name: 'authority';
673
- isMut: false;
674
- isSigner: true;
675
- docs: [
676
- 'Authority is verified through proof since both owner and delegate',
677
- 'are included in the token data hash, which is a public input to the',
678
- 'validity proof.'
679
- ];
680
- },
681
- {
682
- name: 'cpiAuthorityPda';
683
- isMut: false;
684
- isSigner: false;
685
- },
686
- {
687
- name: 'mint';
688
- isMut: true;
689
- isSigner: false;
690
- },
691
- {
692
- name: 'tokenPoolPda';
693
- isMut: true;
694
- isSigner: false;
695
- },
696
- {
697
- name: 'tokenProgram';
698
- isMut: false;
699
- isSigner: false;
700
- },
701
- {
702
- name: 'lightSystemProgram';
703
- isMut: false;
704
- isSigner: false;
705
- },
706
- {
707
- name: 'registeredProgramPda';
708
- isMut: false;
709
- isSigner: false;
710
- },
711
- {
712
- name: 'noopProgram';
713
- isMut: false;
714
- isSigner: false;
715
- },
716
- {
717
- name: 'accountCompressionAuthority';
718
- isMut: false;
719
- isSigner: false;
720
- },
721
- {
722
- name: 'accountCompressionProgram';
723
- isMut: false;
724
- isSigner: false;
725
- },
726
- {
727
- name: 'selfProgram';
728
- isMut: false;
729
- isSigner: false;
730
- },
731
- {
732
- name: 'systemProgram';
733
- isMut: false;
734
- isSigner: false;
735
- }
736
- ];
737
- args: [
738
- {
739
- name: 'inputs';
740
- type: 'bytes';
741
- }
742
- ];
743
- },
744
- {
745
- name: 'stubIdlBuild';
746
- docs: [
747
- 'This function is a stub to allow Anchor to include the input types in',
748
- 'the IDL. It should not be included in production builds nor be called in',
749
- 'practice.'
750
- ];
751
- accounts: [
752
- {
753
- name: 'feePayer';
754
- isMut: true;
755
- isSigner: true;
756
- docs: ['UNCHECKED: only pays fees.'];
757
- },
758
- {
759
- name: 'authority';
760
- isMut: false;
761
- isSigner: true;
762
- docs: [
763
- 'Authority is verified through proof since both owner and delegate',
764
- 'are included in the token data hash, which is a public input to the',
765
- 'validity proof.'
766
- ];
767
- },
768
- {
769
- name: 'cpiAuthorityPda';
770
- isMut: false;
771
- isSigner: false;
772
- },
773
- {
774
- name: 'lightSystemProgram';
775
- isMut: false;
776
- isSigner: false;
777
- },
778
- {
779
- name: 'registeredProgramPda';
780
- isMut: false;
781
- isSigner: false;
782
- },
783
- {
784
- name: 'noopProgram';
785
- isMut: false;
786
- isSigner: false;
787
- },
788
- {
789
- name: 'accountCompressionAuthority';
790
- isMut: false;
791
- isSigner: false;
792
- },
793
- {
794
- name: 'accountCompressionProgram';
795
- isMut: false;
796
- isSigner: false;
797
- },
798
- {
799
- name: 'selfProgram';
800
- isMut: false;
801
- isSigner: false;
802
- docs: ['this program is the signer of the cpi.'];
803
- },
804
- {
805
- name: 'tokenPoolPda';
806
- isMut: true;
807
- isSigner: false;
808
- isOptional: true;
809
- },
810
- {
811
- name: 'compressOrDecompressTokenAccount';
812
- isMut: true;
813
- isSigner: false;
814
- isOptional: true;
815
- },
816
- {
817
- name: 'tokenProgram';
818
- isMut: false;
819
- isSigner: false;
820
- isOptional: true;
821
- },
822
- {
823
- name: 'systemProgram';
824
- isMut: false;
825
- isSigner: false;
826
- }
827
- ];
828
- args: [
829
- {
830
- name: 'inputs1';
831
- type: {
832
- defined: 'CompressedTokenInstructionDataTransfer';
833
- };
834
- },
835
- {
836
- name: 'inputs2';
837
- type: {
838
- defined: 'TokenData';
839
- };
840
- }
841
- ];
842
- }
843
- ];
844
- types: [
845
- {
846
- name: 'AccessMetadata';
847
- type: {
848
- kind: 'struct';
849
- fields: [
850
- {
851
- name: 'owner';
852
- docs: ['Owner of the Merkle tree.'];
853
- type: 'publicKey';
854
- },
855
- {
856
- name: 'programOwner';
857
- docs: [
858
- 'Program owner of the Merkle tree. This will be used for program owned Merkle trees.'
859
- ];
860
- type: 'publicKey';
861
- },
862
- {
863
- name: 'forester';
864
- docs: [
865
- 'Optional privileged forester pubkey, can be set for custom Merkle trees',
866
- 'without a network fee. Merkle trees without network fees are not',
867
- 'forested by light foresters. The variable is not used in the account',
868
- 'compression program but the registry program. The registry program',
869
- 'implements access control to prevent contention during forester. The',
870
- 'forester pubkey specified in this struct can bypass contention checks.'
871
- ];
872
- type: 'publicKey';
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: 'CompressedAccount';
893
- type: {
894
- kind: 'struct';
895
- fields: [
896
- {
897
- name: 'owner';
898
- type: 'publicKey';
899
- },
900
- {
901
- name: 'lamports';
902
- type: 'u64';
903
- },
904
- {
905
- name: 'address';
906
- type: {
907
- option: {
908
- array: ['u8', 32];
909
- };
910
- };
911
- },
912
- {
913
- name: 'data';
914
- type: {
915
- option: {
916
- defined: 'CompressedAccountData';
917
- };
918
- };
919
- }
920
- ];
921
- };
922
- },
923
- {
924
- name: 'CompressedAccountData';
925
- type: {
926
- kind: 'struct';
927
- fields: [
928
- {
929
- name: 'discriminator';
930
- type: {
931
- array: ['u8', 8];
932
- };
933
- },
934
- {
935
- name: 'data';
936
- type: 'bytes';
937
- },
938
- {
939
- name: 'dataHash';
940
- type: {
941
- array: ['u8', 32];
942
- };
943
- }
944
- ];
945
- };
946
- },
947
- {
948
- name: 'CompressedCpiContext';
949
- type: {
950
- kind: 'struct';
951
- fields: [
952
- {
953
- name: 'setContext';
954
- docs: [
955
- 'Is set by the program that is invoking the CPI to signal that is should',
956
- 'set the cpi context.'
957
- ];
958
- type: 'bool';
959
- },
960
- {
961
- name: 'firstSetContext';
962
- docs: [
963
- 'Is set to wipe the cpi context since someone could have set it before',
964
- 'with unrelated data.'
965
- ];
966
- type: 'bool';
967
- },
968
- {
969
- name: 'cpiContextAccountIndex';
970
- docs: [
971
- 'Index of cpi context account in remaining accounts.'
972
- ];
973
- type: 'u8';
974
- }
975
- ];
976
- };
977
- },
978
- {
979
- name: 'CompressedProof';
980
- type: {
981
- kind: 'struct';
982
- fields: [
983
- {
984
- name: 'a';
985
- type: {
986
- array: ['u8', 32];
987
- };
988
- },
989
- {
990
- name: 'b';
991
- type: {
992
- array: ['u8', 64];
993
- };
994
- },
995
- {
996
- name: 'c';
997
- type: {
998
- array: ['u8', 32];
999
- };
1000
- }
1001
- ];
1002
- };
1003
- },
1004
- {
1005
- name: 'CompressedTokenInstructionDataTransfer';
1006
- type: {
1007
- kind: 'struct';
1008
- fields: [
1009
- {
1010
- name: 'proof';
1011
- type: {
1012
- option: {
1013
- defined: 'CompressedProof';
1014
- };
1015
- };
1016
- },
1017
- {
1018
- name: 'mint';
1019
- type: 'publicKey';
1020
- },
1021
- {
1022
- name: 'delegatedTransfer';
1023
- docs: [
1024
- 'Is required if the signer is delegate,',
1025
- '-> delegate is authority account,',
1026
- 'owner = Some(owner) is the owner of the token account.'
1027
- ];
1028
- type: {
1029
- option: {
1030
- defined: 'DelegatedTransfer';
1031
- };
1032
- };
1033
- },
1034
- {
1035
- name: 'inputTokenDataWithContext';
1036
- type: {
1037
- vec: {
1038
- defined: 'InputTokenDataWithContext';
1039
- };
1040
- };
1041
- },
1042
- {
1043
- name: 'outputCompressedAccounts';
1044
- type: {
1045
- vec: {
1046
- defined: 'PackedTokenTransferOutputData';
1047
- };
1048
- };
1049
- },
1050
- {
1051
- name: 'isCompress';
1052
- type: 'bool';
1053
- },
1054
- {
1055
- name: 'compressOrDecompressAmount';
1056
- type: {
1057
- option: 'u64';
1058
- };
1059
- },
1060
- {
1061
- name: 'cpiContext';
1062
- type: {
1063
- option: {
1064
- defined: 'CompressedCpiContext';
1065
- };
1066
- };
1067
- },
1068
- {
1069
- name: 'lamportsChangeAccountMerkleTreeIndex';
1070
- type: {
1071
- option: 'u8';
1072
- };
1073
- }
1074
- ];
1075
- };
1076
- },
1077
- {
1078
- name: 'DelegatedTransfer';
1079
- docs: [
1080
- 'Struct to provide the owner when the delegate is signer of the transaction.'
1081
- ];
1082
- type: {
1083
- kind: 'struct';
1084
- fields: [
1085
- {
1086
- name: 'owner';
1087
- type: 'publicKey';
1088
- },
1089
- {
1090
- name: 'delegateChangeAccountIndex';
1091
- docs: [
1092
- 'Index of change compressed account in output compressed accounts. In',
1093
- "case that the delegate didn't spend the complete delegated compressed",
1094
- 'account balance the change compressed account will be delegated to her',
1095
- 'as well.'
1096
- ];
1097
- type: {
1098
- option: 'u8';
1099
- };
1100
- }
1101
- ];
1102
- };
1103
- },
1104
- {
1105
- name: 'InputTokenDataWithContext';
1106
- type: {
1107
- kind: 'struct';
1108
- fields: [
1109
- {
1110
- name: 'amount';
1111
- type: 'u64';
1112
- },
1113
- {
1114
- name: 'delegateIndex';
1115
- type: {
1116
- option: 'u8';
1117
- };
1118
- },
1119
- {
1120
- name: 'merkleContext';
1121
- type: {
1122
- defined: 'PackedMerkleContext';
1123
- };
1124
- },
1125
- {
1126
- name: 'rootIndex';
1127
- type: 'u16';
1128
- },
1129
- {
1130
- name: 'lamports';
1131
- type: {
1132
- option: 'u64';
1133
- };
1134
- },
1135
- {
1136
- name: 'tlv';
1137
- docs: [
1138
- 'Placeholder for TokenExtension tlv data (unimplemented)'
1139
- ];
1140
- type: {
1141
- option: 'bytes';
1142
- };
1143
- }
1144
- ];
1145
- };
1146
- },
1147
- {
1148
- name: 'InstructionDataInvoke';
1149
- type: {
1150
- kind: 'struct';
1151
- fields: [
1152
- {
1153
- name: 'proof';
1154
- type: {
1155
- option: {
1156
- defined: 'CompressedProof';
1157
- };
1158
- };
1159
- },
1160
- {
1161
- name: 'inputCompressedAccountsWithMerkleContext';
1162
- type: {
1163
- vec: {
1164
- defined: 'PackedCompressedAccountWithMerkleContext';
1165
- };
1166
- };
1167
- },
1168
- {
1169
- name: 'outputCompressedAccounts';
1170
- type: {
1171
- vec: {
1172
- defined: 'OutputCompressedAccountWithPackedContext';
1173
- };
1174
- };
1175
- },
1176
- {
1177
- name: 'relayFee';
1178
- type: {
1179
- option: 'u64';
1180
- };
1181
- },
1182
- {
1183
- name: 'newAddressParams';
1184
- type: {
1185
- vec: {
1186
- defined: 'NewAddressParamsPacked';
1187
- };
1188
- };
1189
- },
1190
- {
1191
- name: 'compressOrDecompressLamports';
1192
- type: {
1193
- option: 'u64';
1194
- };
1195
- },
1196
- {
1197
- name: 'isCompress';
1198
- type: 'bool';
1199
- }
1200
- ];
1201
- };
1202
- },
1203
- {
1204
- name: 'InstructionDataInvokeCpi';
1205
- type: {
1206
- kind: 'struct';
1207
- fields: [
1208
- {
1209
- name: 'proof';
1210
- type: {
1211
- option: {
1212
- defined: 'CompressedProof';
1213
- };
1214
- };
1215
- },
1216
- {
1217
- name: 'newAddressParams';
1218
- type: {
1219
- vec: {
1220
- defined: 'NewAddressParamsPacked';
1221
- };
1222
- };
1223
- },
1224
- {
1225
- name: 'inputCompressedAccountsWithMerkleContext';
1226
- type: {
1227
- vec: {
1228
- defined: 'PackedCompressedAccountWithMerkleContext';
1229
- };
1230
- };
1231
- },
1232
- {
1233
- name: 'outputCompressedAccounts';
1234
- type: {
1235
- vec: {
1236
- defined: 'OutputCompressedAccountWithPackedContext';
1237
- };
1238
- };
1239
- },
1240
- {
1241
- name: 'relayFee';
1242
- type: {
1243
- option: 'u64';
1244
- };
1245
- },
1246
- {
1247
- name: 'compressOrDecompressLamports';
1248
- type: {
1249
- option: 'u64';
1250
- };
1251
- },
1252
- {
1253
- name: 'isCompress';
1254
- type: 'bool';
1255
- },
1256
- {
1257
- name: 'cpiContext';
1258
- type: {
1259
- option: {
1260
- defined: 'CompressedCpiContext';
1261
- };
1262
- };
1263
- }
1264
- ];
1265
- };
1266
- },
1267
- {
1268
- name: 'MerkleTreeMetadata';
1269
- type: {
1270
- kind: 'struct';
1271
- fields: [
1272
- {
1273
- name: 'accessMetadata';
1274
- type: {
1275
- defined: 'AccessMetadata';
1276
- };
1277
- },
1278
- {
1279
- name: 'rolloverMetadata';
1280
- type: {
1281
- defined: 'RolloverMetadata';
1282
- };
1283
- },
1284
- {
1285
- name: 'associatedQueue';
1286
- type: 'publicKey';
1287
- },
1288
- {
1289
- name: 'nextMerkleTree';
1290
- type: 'publicKey';
1291
- }
1292
- ];
1293
- };
1294
- },
1295
- {
1296
- name: 'MerkleTreeSequenceNumber';
1297
- type: {
1298
- kind: 'struct';
1299
- fields: [
1300
- {
1301
- name: 'pubkey';
1302
- type: 'publicKey';
1303
- },
1304
- {
1305
- name: 'seq';
1306
- type: 'u64';
1307
- }
1308
- ];
1309
- };
1310
- },
1311
- {
1312
- name: 'NewAddressParamsPacked';
1313
- type: {
1314
- kind: 'struct';
1315
- fields: [
1316
- {
1317
- name: 'seed';
1318
- type: {
1319
- array: ['u8', 32];
1320
- };
1321
- },
1322
- {
1323
- name: 'addressQueueAccountIndex';
1324
- type: 'u8';
1325
- },
1326
- {
1327
- name: 'addressMerkleTreeAccountIndex';
1328
- type: 'u8';
1329
- },
1330
- {
1331
- name: 'addressMerkleTreeRootIndex';
1332
- type: 'u16';
1333
- }
1334
- ];
1335
- };
1336
- },
1337
- {
1338
- name: 'OutputCompressedAccountWithPackedContext';
1339
- type: {
1340
- kind: 'struct';
1341
- fields: [
1342
- {
1343
- name: 'compressedAccount';
1344
- type: {
1345
- defined: 'CompressedAccount';
1346
- };
1347
- },
1348
- {
1349
- name: 'merkleTreeIndex';
1350
- type: 'u8';
1351
- }
1352
- ];
1353
- };
1354
- },
1355
- {
1356
- name: 'PackedCompressedAccountWithMerkleContext';
1357
- type: {
1358
- kind: 'struct';
1359
- fields: [
1360
- {
1361
- name: 'compressedAccount';
1362
- type: {
1363
- defined: 'CompressedAccount';
1364
- };
1365
- },
1366
- {
1367
- name: 'merkleContext';
1368
- type: {
1369
- defined: 'PackedMerkleContext';
1370
- };
1371
- },
1372
- {
1373
- name: 'rootIndex';
1374
- docs: [
1375
- 'Index of root used in inclusion validity proof.'
1376
- ];
1377
- type: 'u16';
1378
- },
1379
- {
1380
- name: 'readOnly';
1381
- docs: [
1382
- 'Placeholder to mark accounts read-only unimplemented set to false.'
1383
- ];
1384
- type: 'bool';
1385
- }
1386
- ];
1387
- };
1388
- },
1389
- {
1390
- name: 'PackedMerkleContext';
1391
- type: {
1392
- kind: 'struct';
1393
- fields: [
1394
- {
1395
- name: 'merkleTreePubkeyIndex';
1396
- type: 'u8';
1397
- },
1398
- {
1399
- name: 'nullifierQueuePubkeyIndex';
1400
- type: 'u8';
1401
- },
1402
- {
1403
- name: 'leafIndex';
1404
- type: 'u32';
1405
- },
1406
- {
1407
- name: 'queueIndex';
1408
- docs: [
1409
- 'Index of leaf in queue. Placeholder of batched Merkle tree updates',
1410
- 'currently unimplemented.'
1411
- ];
1412
- type: {
1413
- option: {
1414
- defined: 'QueueIndex';
1415
- };
1416
- };
1417
- }
1418
- ];
1419
- };
1420
- },
1421
- {
1422
- name: 'PackedTokenTransferOutputData';
1423
- type: {
1424
- kind: 'struct';
1425
- fields: [
1426
- {
1427
- name: 'owner';
1428
- type: 'publicKey';
1429
- },
1430
- {
1431
- name: 'amount';
1432
- type: 'u64';
1433
- },
1434
- {
1435
- name: 'lamports';
1436
- type: {
1437
- option: 'u64';
1438
- };
1439
- },
1440
- {
1441
- name: 'merkleTreeIndex';
1442
- type: 'u8';
1443
- },
1444
- {
1445
- name: 'tlv';
1446
- docs: [
1447
- 'Placeholder for TokenExtension tlv data (unimplemented)'
1448
- ];
1449
- type: {
1450
- option: 'bytes';
1451
- };
1452
- }
1453
- ];
1454
- };
1455
- },
1456
- {
1457
- name: 'PublicTransactionEvent';
1458
- type: {
1459
- kind: 'struct';
1460
- fields: [
1461
- {
1462
- name: 'inputCompressedAccountHashes';
1463
- type: {
1464
- vec: {
1465
- array: ['u8', 32];
1466
- };
1467
- };
1468
- },
1469
- {
1470
- name: 'outputCompressedAccountHashes';
1471
- type: {
1472
- vec: {
1473
- array: ['u8', 32];
1474
- };
1475
- };
1476
- },
1477
- {
1478
- name: 'outputCompressedAccounts';
1479
- type: {
1480
- vec: {
1481
- defined: 'OutputCompressedAccountWithPackedContext';
1482
- };
1483
- };
1484
- },
1485
- {
1486
- name: 'outputLeafIndices';
1487
- type: {
1488
- vec: 'u32';
1489
- };
1490
- },
1491
- {
1492
- name: 'sequenceNumbers';
1493
- type: {
1494
- vec: {
1495
- defined: 'MerkleTreeSequenceNumber';
1496
- };
1497
- };
1498
- },
1499
- {
1500
- name: 'relayFee';
1501
- type: {
1502
- option: 'u64';
1503
- };
1504
- },
1505
- {
1506
- name: 'isCompress';
1507
- type: 'bool';
1508
- },
1509
- {
1510
- name: 'compressOrDecompressLamports';
1511
- type: {
1512
- option: 'u64';
1513
- };
1514
- },
1515
- {
1516
- name: 'pubkeyArray';
1517
- type: {
1518
- vec: 'publicKey';
1519
- };
1520
- },
1521
- {
1522
- name: 'message';
1523
- type: {
1524
- option: 'bytes';
1525
- };
1526
- }
1527
- ];
1528
- };
1529
- },
1530
- {
1531
- name: 'QueueIndex';
1532
- type: {
1533
- kind: 'struct';
1534
- fields: [
1535
- {
1536
- name: 'queueId';
1537
- docs: ['Id of queue in queue account.'];
1538
- type: 'u8';
1539
- },
1540
- {
1541
- name: 'index';
1542
- docs: ['Index of compressed account hash in queue.'];
1543
- type: 'u16';
1544
- }
1545
- ];
1546
- };
1547
- },
1548
- {
1549
- name: 'RolloverMetadata';
1550
- type: {
1551
- kind: 'struct';
1552
- fields: [
1553
- {
1554
- name: 'index';
1555
- docs: ['Unique index.'];
1556
- type: 'u64';
1557
- },
1558
- {
1559
- name: 'rolloverFee';
1560
- docs: [
1561
- 'This fee is used for rent for the next account.',
1562
- 'It accumulates in the account so that once the corresponding Merkle tree account is full it can be rolled over'
1563
- ];
1564
- type: 'u64';
1565
- },
1566
- {
1567
- name: 'rolloverThreshold';
1568
- docs: [
1569
- 'The threshold in percentage points when the account should be rolled over (95 corresponds to 95% filled).'
1570
- ];
1571
- type: 'u64';
1572
- },
1573
- {
1574
- name: 'networkFee';
1575
- docs: ['Tip for maintaining the account.'];
1576
- type: 'u64';
1577
- },
1578
- {
1579
- name: 'rolledoverSlot';
1580
- docs: [
1581
- 'The slot when the account was rolled over, a rolled over account should not be written to.'
1582
- ];
1583
- type: 'u64';
1584
- },
1585
- {
1586
- name: 'closeThreshold';
1587
- docs: [
1588
- 'If current slot is greater than rolledover_slot + close_threshold and',
1589
- "the account is empty it can be closed. No 'close' functionality has been",
1590
- 'implemented yet.'
1591
- ];
1592
- type: 'u64';
1593
- },
1594
- {
1595
- name: 'additionalBytes';
1596
- docs: [
1597
- 'Placeholder for bytes of additional accounts which are tied to the',
1598
- 'Merkle trees operation and need to be rolled over as well.'
1599
- ];
1600
- type: 'u64';
1601
- }
1602
- ];
1603
- };
1604
- },
1605
- {
1606
- name: 'TokenData';
1607
- type: {
1608
- kind: 'struct';
1609
- fields: [
1610
- {
1611
- name: 'mint';
1612
- docs: ['The mint associated with this account'];
1613
- type: 'publicKey';
1614
- },
1615
- {
1616
- name: 'owner';
1617
- docs: ['The owner of this account.'];
1618
- type: 'publicKey';
1619
- },
1620
- {
1621
- name: 'amount';
1622
- docs: ['The amount of tokens this account holds.'];
1623
- type: 'u64';
1624
- },
1625
- {
1626
- name: 'delegate';
1627
- docs: [
1628
- 'If `delegate` is `Some` then `delegated_amount` represents',
1629
- 'the amount authorized by the delegate'
1630
- ];
1631
- type: {
1632
- option: 'publicKey';
1633
- };
1634
- },
1635
- {
1636
- name: 'state';
1637
- docs: ["The account's state"];
1638
- type: {
1639
- defined: 'AccountState';
1640
- };
1641
- },
1642
- {
1643
- name: 'tlv';
1644
- docs: [
1645
- 'Placeholder for TokenExtension tlv data (unimplemented)'
1646
- ];
1647
- type: {
1648
- option: 'bytes';
1649
- };
1650
- }
1651
- ];
1652
- };
1653
- }
1654
- ];
1655
- errors: [
1656
- {
1657
- code: 6000;
1658
- name: 'PublicKeyAmountMissmatch';
1659
- msg: 'public keys and amounts must be of same length';
1660
- },
1661
- {
1662
- code: 6001;
1663
- name: 'ComputeInputSumFailed';
1664
- msg: 'ComputeInputSumFailed';
1665
- },
1666
- {
1667
- code: 6002;
1668
- name: 'ComputeOutputSumFailed';
1669
- msg: 'ComputeOutputSumFailed';
1670
- },
1671
- {
1672
- code: 6003;
1673
- name: 'ComputeCompressSumFailed';
1674
- msg: 'ComputeCompressSumFailed';
1675
- },
1676
- {
1677
- code: 6004;
1678
- name: 'ComputeDecompressSumFailed';
1679
- msg: 'ComputeDecompressSumFailed';
1680
- },
1681
- {
1682
- code: 6005;
1683
- name: 'SumCheckFailed';
1684
- msg: 'SumCheckFailed';
1685
- },
1686
- {
1687
- code: 6006;
1688
- name: 'DecompressRecipientUndefinedForDecompress';
1689
- msg: 'DecompressRecipientUndefinedForDecompress';
1690
- },
1691
- {
1692
- code: 6007;
1693
- name: 'CompressedPdaUndefinedForDecompress';
1694
- msg: 'CompressedPdaUndefinedForDecompress';
1695
- },
1696
- {
1697
- code: 6008;
1698
- name: 'DeCompressAmountUndefinedForDecompress';
1699
- msg: 'DeCompressAmountUndefinedForDecompress';
1700
- },
1701
- {
1702
- code: 6009;
1703
- name: 'CompressedPdaUndefinedForCompress';
1704
- msg: 'CompressedPdaUndefinedForCompress';
1705
- },
1706
- {
1707
- code: 6010;
1708
- name: 'DeCompressAmountUndefinedForCompress';
1709
- msg: 'DeCompressAmountUndefinedForCompress';
1710
- },
1711
- {
1712
- code: 6011;
1713
- name: 'DelegateSignerCheckFailed';
1714
- msg: 'DelegateSignerCheckFailed';
1715
- },
1716
- {
1717
- code: 6012;
1718
- name: 'MintTooLarge';
1719
- msg: 'Minted amount greater than u64::MAX';
1720
- },
1721
- {
1722
- code: 6013;
1723
- name: 'SplTokenSupplyMismatch';
1724
- msg: 'SplTokenSupplyMismatch';
1725
- },
1726
- {
1727
- code: 6014;
1728
- name: 'HeapMemoryCheckFailed';
1729
- msg: 'HeapMemoryCheckFailed';
1730
- },
1731
- {
1732
- code: 6015;
1733
- name: 'InstructionNotCallable';
1734
- msg: 'The instruction is not callable';
1735
- },
1736
- {
1737
- code: 6016;
1738
- name: 'ArithmeticUnderflow';
1739
- msg: 'ArithmeticUnderflow';
1740
- },
1741
- {
1742
- code: 6017;
1743
- name: 'HashToFieldError';
1744
- msg: 'HashToFieldError';
1745
- },
1746
- {
1747
- code: 6018;
1748
- name: 'InvalidAuthorityMint';
1749
- msg: 'Expected the authority to be also a mint authority';
1750
- },
1751
- {
1752
- code: 6019;
1753
- name: 'InvalidFreezeAuthority';
1754
- msg: 'Provided authority is not the freeze authority';
1755
- },
1756
- {
1757
- code: 6020;
1758
- name: 'InvalidDelegateIndex';
1759
- },
1760
- {
1761
- code: 6021;
1762
- name: 'TokenPoolPdaUndefined';
1763
- },
1764
- {
1765
- code: 6022;
1766
- name: 'IsTokenPoolPda';
1767
- msg: 'Compress or decompress recipient is the same account as the token pool pda.';
1768
- },
1769
- {
1770
- code: 6023;
1771
- name: 'InvalidTokenPoolPda';
1772
- },
1773
- {
1774
- code: 6024;
1775
- name: 'NoInputTokenAccountsProvided';
1776
- },
1777
- {
1778
- code: 6025;
1779
- name: 'NoInputsProvided';
1780
- },
1781
- {
1782
- code: 6026;
1783
- name: 'MintHasNoFreezeAuthority';
1784
- },
1785
- {
1786
- code: 6027;
1787
- name: 'MintWithInvalidExtension';
1788
- },
1789
- {
1790
- code: 6028;
1791
- name: 'InsufficientTokenAccountBalance';
1792
- msg: 'The token account balance is less than the remaining amount.';
1793
- }
1794
- ];
5
+ type CompressedCpiContext = {
6
+ setContext: boolean;
7
+ firstSetContext: boolean;
8
+ cpiContextAccountIndex: number;
1795
9
  };
1796
- declare const IDL: LightCompressedToken;
1797
-
1798
10
  type TokenTransferOutputData = {
1799
11
  /**
1800
12
  * The owner of the output token account
@@ -1836,44 +48,22 @@ type PackedTokenTransferOutputData = {
1836
48
  tlv: Buffer | null;
1837
49
  };
1838
50
  type InputTokenDataWithContext = {
1839
- /**
1840
- * The amount of tokens to transfer
1841
- */
1842
51
  amount: BN;
1843
- /**
1844
- * Optional: The index of the delegate in remaining accounts
1845
- */
1846
52
  delegateIndex: number | null;
1847
- /**
1848
- * The index of the merkle tree address in remaining accounts
1849
- */
1850
- merkleTreePubkeyIndex: number;
1851
- /**
1852
- * The index of the nullifier queue address in remaining accounts
1853
- */
1854
- nullifierQueuePubkeyIndex: number;
1855
- /**
1856
- * The index of the leaf in the merkle tree
1857
- */
1858
- leafIndex: number;
1859
- /**
1860
- * Lamports in the input token account.
1861
- */
53
+ merkleContext: PackedMerkleContext;
54
+ rootIndex: number;
1862
55
  lamports: BN | null;
1863
- /**
1864
- * TokenExtension tlv
1865
- */
1866
56
  tlv: Buffer | null;
1867
57
  };
1868
- type CompressedTokenInstructionDataInvoke = {
58
+ type DelegatedTransfer = {
59
+ owner: PublicKey;
60
+ delegateChangeAccountIndex: number | null;
61
+ };
62
+ type CompressedTokenInstructionDataTransfer = {
1869
63
  /**
1870
64
  * Validity proof
1871
65
  */
1872
66
  proof: CompressedProof | null;
1873
- /**
1874
- * The root indices of the transfer
1875
- */
1876
- rootIndices: number[];
1877
67
  /**
1878
68
  * The mint of the transfer
1879
69
  */
@@ -1882,7 +72,7 @@ type CompressedTokenInstructionDataInvoke = {
1882
72
  * Whether the signer is a delegate
1883
73
  * TODO: implement delegated transfer struct
1884
74
  */
1885
- delegatedTransfer: null;
75
+ delegatedTransfer: DelegatedTransfer | null;
1886
76
  /**
1887
77
  * Input token data with packed merkle context
1888
78
  */
@@ -1890,12 +80,20 @@ type CompressedTokenInstructionDataInvoke = {
1890
80
  /**
1891
81
  * Data of the output token accounts
1892
82
  */
1893
- outputCompressedAccounts: TokenTransferOutputData[];
83
+ outputCompressedAccounts: PackedTokenTransferOutputData[];
84
+ /**
85
+ * Whether it's a compress or decompress action if compressOrDecompressAmount is non-null
86
+ */
87
+ isCompress: boolean;
88
+ /**
89
+ * If null, it's a transfer.
90
+ * If some, the amount that is being deposited into (compress) or withdrawn from (decompress) the token escrow
91
+ */
92
+ compressOrDecompressAmount: BN | null;
1894
93
  /**
1895
- * The indices of the output state merkle tree accounts in 'remaining
1896
- * accounts'
94
+ * CPI context if
1897
95
  */
1898
- outputStateMerkleTreeAccountIndices: Buffer;
96
+ cpiContext: CompressedCpiContext | null;
1899
97
  /**
1900
98
  * The index of the Merkle tree for a lamport change account.
1901
99
  */
@@ -1945,7 +143,7 @@ type PackCompressedTokenAccountsParams = {
1945
143
  * from the state Merkle tree account for validity proof verification.
1946
144
  */
1947
145
  rootIndices: number[];
1948
- tokenTransferOutputs: TokenTransferOutputData$1[];
146
+ tokenTransferOutputs: TokenTransferOutputData[];
1949
147
  };
1950
148
  /**
1951
149
  * Packs Compressed Token Accounts.
@@ -2300,7 +498,7 @@ declare const parseTokenData: (compressedTokenAccounts: ParsedTokenAccount[]) =>
2300
498
  * @returns Output token data for the transfer
2301
499
  * instruction
2302
500
  */
2303
- declare function createTransferOutputState(inputCompressedTokenAccounts: ParsedTokenAccount[], toAddress: PublicKey, amount: number | BN): TokenTransferOutputData$1[];
501
+ declare function createTransferOutputState(inputCompressedTokenAccounts: ParsedTokenAccount[], toAddress: PublicKey, amount: number | BN): TokenTransferOutputData[];
2304
502
  /**
2305
503
  * Create the output state for a compress transaction.
2306
504
  * @param inputCompressedTokenAccounts Input state
@@ -2308,7 +506,7 @@ declare function createTransferOutputState(inputCompressedTokenAccounts: ParsedT
2308
506
  * @returns Output token data for the compress
2309
507
  * instruction
2310
508
  */
2311
- declare function createDecompressOutputState(inputCompressedTokenAccounts: ParsedTokenAccount[], amount: number | BN): TokenTransferOutputData$1[];
509
+ declare function createDecompressOutputState(inputCompressedTokenAccounts: ParsedTokenAccount[], amount: number | BN): TokenTransferOutputData[];
2312
510
  declare class CompressedTokenProgram {
2313
511
  /**
2314
512
  * @internal
@@ -2325,14 +523,6 @@ declare class CompressedTokenProgram {
2325
523
  * Use this only if you know what you are doing.
2326
524
  */
2327
525
  static setProgramId(programId: PublicKey | string): void;
2328
- private static _program;
2329
- /** @internal */
2330
- static get program(): Program<LightCompressedToken>;
2331
- /**
2332
- * @internal
2333
- * Initializes the program statically if not already initialized.
2334
- */
2335
- private static initializeProgram;
2336
526
  /** @internal */
2337
527
  static deriveTokenPoolPda(mint: PublicKey): PublicKey;
2338
528
  /** @internal */
@@ -2569,4 +759,4 @@ declare function createTokenProgramLookupTable(rpc: Rpc, payer: Signer, authorit
2569
759
  */
2570
760
  declare function compressSplTokenAccount(rpc: Rpc, payer: Signer, mint: PublicKey, owner: Signer, tokenAccount: PublicKey, outputStateTree: PublicKey, remainingAmount?: BN, confirmOptions?: ConfirmOptions, tokenProgramId?: PublicKey): Promise<TransactionSignature>;
2571
761
 
2572
- export { type ApproveAndMintToParams, CPI_AUTHORITY_SEED, type CompressParams, type CompressSplTokenAccountParams, type CompressedTokenInstructionDataInvoke, CompressedTokenProgram, type CreateMintParams, type CreateTokenProgramLookupTableParams, type DecompressParams, IDL, type InputTokenDataWithContext, type LightCompressedToken, type MergeTokenAccountsParams, type MintToParams, POOL_SEED, type PackCompressedTokenAccountsParams, type PackedTokenTransferOutputData, type RegisterMintParams, SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE, type TokenData, type TokenTransferOutputData, type TransferParams, approveAndMintTo, compress, compressSplTokenAccount, createDecompressOutputState, createMint, createTokenPool, createTokenProgramLookupTable, createTransferOutputState, decompress, mergeTokenAccounts, mintTo, packCompressedTokenAccounts, parseTokenData, selectMinCompressedTokenAccountsForTransfer, sumUpTokenAmount, transfer, validateSameTokenOwner };
762
+ export { type ApproveAndMintToParams, CPI_AUTHORITY_SEED, type CompressParams, type CompressSplTokenAccountParams, type CompressedCpiContext, type CompressedTokenInstructionDataTransfer, CompressedTokenProgram, type CreateMintParams, type CreateTokenProgramLookupTableParams, type DecompressParams, type DelegatedTransfer, type InputTokenDataWithContext, type MergeTokenAccountsParams, type MintToParams, POOL_SEED, type PackCompressedTokenAccountsParams, type PackedTokenTransferOutputData, type RegisterMintParams, SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE, type TokenData, type TokenTransferOutputData, type TransferParams, approveAndMintTo, compress, compressSplTokenAccount, createDecompressOutputState, createMint, createTokenPool, createTokenProgramLookupTable, createTransferOutputState, decompress, mergeTokenAccounts, mintTo, packCompressedTokenAccounts, parseTokenData, selectMinCompressedTokenAccountsForTransfer, sumUpTokenAmount, transfer, validateSameTokenOwner };