@lightprotocol/compressed-token 0.1.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,18 @@
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.0';
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';
18
11
  docs: [
19
- 'This instruction expects a mint account to be created in a separate token program instruction',
20
- 'with token authority as mint authority.',
21
- 'This instruction creates a token pool account for that mint owned by token authority.'
12
+ 'This instruction expects a mint account to be created in a separate',
13
+ 'token program instruction with token authority as mint authority. This',
14
+ 'instruction creates a token pool account for that mint owned by token',
15
+ 'authority.'
22
16
  ];
23
17
  accounts: [
24
18
  {
@@ -26,11 +20,6 @@ type LightCompressedToken = {
26
20
  isMut: true;
27
21
  isSigner: true;
28
22
  },
29
- {
30
- name: 'authority';
31
- isMut: true;
32
- isSigner: true;
33
- },
34
23
  {
35
24
  name: 'tokenPoolPda';
36
25
  isMut: true;
@@ -46,11 +35,6 @@ type LightCompressedToken = {
46
35
  isMut: true;
47
36
  isSigner: false;
48
37
  },
49
- {
50
- name: 'mintAuthorityPda';
51
- isMut: true;
52
- isSigner: false;
53
- },
54
38
  {
55
39
  name: 'tokenProgram';
56
40
  isMut: false;
@@ -66,6 +50,12 @@ type LightCompressedToken = {
66
50
  },
67
51
  {
68
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
+ ];
69
59
  accounts: [
70
60
  {
71
61
  name: 'feePayer';
@@ -74,12 +64,12 @@ type LightCompressedToken = {
74
64
  },
75
65
  {
76
66
  name: 'authority';
77
- isMut: true;
67
+ isMut: false;
78
68
  isSigner: true;
79
69
  },
80
70
  {
81
- name: 'mintAuthorityPda';
82
- isMut: true;
71
+ name: 'cpiAuthorityPda';
72
+ isMut: false;
83
73
  isSigner: false;
84
74
  },
85
75
  {
@@ -98,13 +88,13 @@ type LightCompressedToken = {
98
88
  isSigner: false;
99
89
  },
100
90
  {
101
- name: 'compressedPdaProgram';
91
+ name: 'lightSystemProgram';
102
92
  isMut: false;
103
93
  isSigner: false;
104
94
  },
105
95
  {
106
96
  name: 'registeredProgramPda';
107
- isMut: true;
97
+ isMut: false;
108
98
  isSigner: false;
109
99
  },
110
100
  {
@@ -114,7 +104,7 @@ type LightCompressedToken = {
114
104
  },
115
105
  {
116
106
  name: 'accountCompressionAuthority';
117
- isMut: true;
107
+ isMut: false;
118
108
  isSigner: false;
119
109
  },
120
110
  {
@@ -131,6 +121,11 @@ type LightCompressedToken = {
131
121
  name: 'selfProgram';
132
122
  isMut: false;
133
123
  isSigner: false;
124
+ },
125
+ {
126
+ name: 'systemProgram';
127
+ isMut: false;
128
+ isSigner: false;
134
129
  }
135
130
  ];
136
131
  args: [
@@ -141,19 +136,418 @@ type LightCompressedToken = {
141
136
  };
142
137
  },
143
138
  {
144
- name: 'amounts';
145
- type: {
146
- vec: 'u64';
147
- };
139
+ name: 'amounts';
140
+ type: {
141
+ vec: 'u64';
142
+ };
143
+ }
144
+ ];
145
+ },
146
+ {
147
+ name: 'transfer';
148
+ accounts: [
149
+ {
150
+ name: 'feePayer';
151
+ isMut: true;
152
+ isSigner: true;
153
+ },
154
+ {
155
+ name: 'authority';
156
+ isMut: false;
157
+ isSigner: true;
158
+ },
159
+ {
160
+ name: 'cpiAuthorityPda';
161
+ isMut: false;
162
+ isSigner: false;
163
+ },
164
+ {
165
+ name: 'lightSystemProgram';
166
+ isMut: false;
167
+ isSigner: false;
168
+ },
169
+ {
170
+ name: 'registeredProgramPda';
171
+ isMut: false;
172
+ isSigner: false;
173
+ },
174
+ {
175
+ name: 'noopProgram';
176
+ isMut: false;
177
+ isSigner: false;
178
+ },
179
+ {
180
+ name: 'accountCompressionAuthority';
181
+ isMut: false;
182
+ isSigner: false;
183
+ },
184
+ {
185
+ name: 'accountCompressionProgram';
186
+ isMut: false;
187
+ isSigner: false;
188
+ },
189
+ {
190
+ name: 'selfProgram';
191
+ isMut: false;
192
+ isSigner: false;
193
+ },
194
+ {
195
+ name: 'tokenPoolPda';
196
+ isMut: true;
197
+ isSigner: false;
198
+ isOptional: true;
199
+ },
200
+ {
201
+ name: 'compressOrDecompressTokenAccount';
202
+ isMut: true;
203
+ isSigner: false;
204
+ isOptional: true;
205
+ },
206
+ {
207
+ name: 'tokenProgram';
208
+ isMut: false;
209
+ isSigner: false;
210
+ isOptional: true;
211
+ },
212
+ {
213
+ name: 'systemProgram';
214
+ isMut: false;
215
+ isSigner: false;
216
+ }
217
+ ];
218
+ args: [
219
+ {
220
+ name: 'inputs';
221
+ type: 'bytes';
222
+ }
223
+ ];
224
+ },
225
+ {
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
+ ];
285
+ },
286
+ {
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
+ ];
346
+ },
347
+ {
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';
148
537
  }
149
538
  ];
150
539
  },
151
540
  {
152
- name: 'transfer';
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
+ ];
153
547
  accounts: [
154
548
  {
155
549
  name: 'feePayer';
156
- isMut: false;
550
+ isMut: true;
157
551
  isSigner: true;
158
552
  },
159
553
  {
@@ -167,7 +561,7 @@ type LightCompressedToken = {
167
561
  isSigner: false;
168
562
  },
169
563
  {
170
- name: 'compressedPdaProgram';
564
+ name: 'lightSystemProgram';
171
565
  isMut: false;
172
566
  isSigner: false;
173
567
  },
@@ -203,7 +597,7 @@ type LightCompressedToken = {
203
597
  isOptional: true;
204
598
  },
205
599
  {
206
- name: 'decompressTokenAccount';
600
+ name: 'compressOrDecompressTokenAccount';
207
601
  isMut: true;
208
602
  isSigner: false;
209
603
  isOptional: true;
@@ -213,87 +607,78 @@ type LightCompressedToken = {
213
607
  isMut: false;
214
608
  isSigner: false;
215
609
  isOptional: true;
610
+ },
611
+ {
612
+ name: 'systemProgram';
613
+ isMut: false;
614
+ isSigner: false;
216
615
  }
217
616
  ];
218
617
  args: [
219
618
  {
220
- name: 'inputs';
221
- type: 'bytes';
619
+ name: 'inputs1';
620
+ type: {
621
+ defined: 'CompressedTokenInstructionDataTransfer';
622
+ };
222
623
  },
223
624
  {
224
- name: 'cpiContext';
625
+ name: 'inputs2';
225
626
  type: {
226
- option: {
227
- defined: 'CompressedCpiContext';
228
- };
627
+ defined: 'TokenData';
229
628
  };
230
629
  }
231
630
  ];
232
631
  }
233
632
  ];
234
- types: [
633
+ accounts: [
235
634
  {
236
- name: 'CompressedAccountWithMerkleContext';
635
+ name: 'RegisteredProgram';
237
636
  type: {
238
637
  kind: 'struct';
239
638
  fields: [
240
639
  {
241
- name: 'compressedAccount';
242
- type: {
243
- defined: 'CompressedAccount';
244
- };
245
- },
246
- {
247
- name: 'merkleTreePubkeyIndex';
248
- type: 'u8';
249
- },
250
- {
251
- name: 'nullifierQueuePubkeyIndex';
252
- type: 'u8';
640
+ name: 'registeredProgramId';
641
+ type: 'publicKey';
253
642
  },
254
643
  {
255
- name: 'leafIndex';
256
- type: 'u32';
644
+ name: 'groupAuthorityPda';
645
+ type: 'publicKey';
257
646
  }
258
647
  ];
259
648
  };
260
- },
649
+ }
650
+ ];
651
+ types: [
261
652
  {
262
- name: 'MerkleContext';
653
+ name: 'AccessMetadata';
263
654
  type: {
264
655
  kind: 'struct';
265
656
  fields: [
266
657
  {
267
- name: 'merkleTreePubkey';
658
+ name: 'owner';
659
+ docs: ['Owner of the Merkle tree.'];
268
660
  type: 'publicKey';
269
661
  },
270
662
  {
271
- name: 'nullifierQueuePubkey';
663
+ name: 'programOwner';
664
+ docs: [
665
+ 'Delegate of the Merkle tree. This will be used for program owned Merkle trees.'
666
+ ];
272
667
  type: 'publicKey';
273
- },
274
- {
275
- name: 'leafIndex';
276
- type: 'u32';
277
668
  }
278
669
  ];
279
670
  };
280
671
  },
281
672
  {
282
- name: 'PackedMerkleContext';
673
+ name: 'AccountState';
283
674
  type: {
284
- kind: 'struct';
285
- fields: [
286
- {
287
- name: 'merkleTreePubkeyIndex';
288
- type: 'u8';
289
- },
675
+ kind: 'enum';
676
+ variants: [
290
677
  {
291
- name: 'nullifierQueuePubkeyIndex';
292
- type: 'u8';
678
+ name: 'Initialized';
293
679
  },
294
680
  {
295
- name: 'leafIndex';
296
- type: 'u32';
681
+ name: 'Frozen';
297
682
  }
298
683
  ];
299
684
  };
@@ -356,56 +741,81 @@ type LightCompressedToken = {
356
741
  },
357
742
  {
358
743
  name: 'CompressedCpiContext';
359
- docs: ['To spend multiple compressed'];
360
744
  type: {
361
745
  kind: 'struct';
362
746
  fields: [
363
747
  {
364
- name: 'cpiSignatureAccountIndex';
365
- docs: [
366
- 'index of the output state Merkle tree that will be used to store cpi signatures',
367
- 'The transaction will fail if this index is not consistent in your transaction.'
368
- ];
748
+ name: 'setContext';
749
+ type: 'bool';
750
+ },
751
+ {
752
+ name: 'cpiContextAccountIndex';
369
753
  type: 'u8';
754
+ }
755
+ ];
756
+ };
757
+ },
758
+ {
759
+ name: 'CompressedProof';
760
+ type: {
761
+ kind: 'struct';
762
+ fields: [
763
+ {
764
+ name: 'a';
765
+ type: {
766
+ array: ['u8', 32];
767
+ };
370
768
  },
371
769
  {
372
- name: 'execute';
373
- docs: [
374
- 'The final cpi of your program needs to set execute to true.',
375
- 'Execute compressed transaction will verify the proof and execute the transaction if this is true.',
376
- 'If this is false the transaction will be stored in the cpi signature account.'
377
- ];
378
- type: 'bool';
770
+ name: 'b';
771
+ type: {
772
+ array: ['u8', 64];
773
+ };
774
+ },
775
+ {
776
+ name: 'c';
777
+ type: {
778
+ array: ['u8', 32];
779
+ };
379
780
  }
380
781
  ];
381
782
  };
382
783
  },
383
784
  {
384
- name: 'PublicTransactionEvent';
785
+ name: 'CompressedTokenInstructionDataTransfer';
385
786
  type: {
386
787
  kind: 'struct';
387
788
  fields: [
388
789
  {
389
- name: 'inputCompressedAccountHashes';
790
+ name: 'proof';
390
791
  type: {
391
- vec: {
392
- array: ['u8', 32];
792
+ option: {
793
+ defined: 'CompressedProof';
393
794
  };
394
795
  };
395
796
  },
396
797
  {
397
- name: 'outputCompressedAccountHashes';
798
+ name: 'mint';
799
+ type: 'publicKey';
800
+ },
801
+ {
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
+ ];
398
808
  type: {
399
- vec: {
400
- array: ['u8', 32];
809
+ option: {
810
+ defined: 'DelegatedTransfer';
401
811
  };
402
812
  };
403
813
  },
404
814
  {
405
- name: 'inputCompressedAccounts';
815
+ name: 'inputTokenDataWithContext';
406
816
  type: {
407
817
  vec: {
408
- defined: 'CompressedAccountWithMerkleContext';
818
+ defined: 'InputTokenDataWithContext';
409
819
  };
410
820
  };
411
821
  },
@@ -413,53 +823,83 @@ type LightCompressedToken = {
413
823
  name: 'outputCompressedAccounts';
414
824
  type: {
415
825
  vec: {
416
- defined: 'CompressedAccount';
826
+ defined: 'PackedTokenTransferOutputData';
417
827
  };
418
828
  };
419
829
  },
420
830
  {
421
- name: 'outputStateMerkleTreeAccountIndices';
422
- type: 'bytes';
831
+ name: 'isCompress';
832
+ type: 'bool';
423
833
  },
424
834
  {
425
- name: 'outputLeafIndices';
835
+ name: 'compressOrDecompressAmount';
426
836
  type: {
427
- vec: 'u32';
837
+ option: 'u64';
428
838
  };
429
839
  },
430
840
  {
431
- name: 'relayFee';
841
+ name: 'cpiContext';
432
842
  type: {
433
- option: 'u64';
843
+ option: {
844
+ defined: 'CompressedCpiContext';
845
+ };
434
846
  };
847
+ }
848
+ ];
849
+ };
850
+ },
851
+ {
852
+ name: 'DelegatedTransfer';
853
+ type: {
854
+ kind: 'struct';
855
+ fields: [
856
+ {
857
+ name: 'owner';
858
+ type: 'publicKey';
435
859
  },
436
860
  {
437
- name: 'isCompress';
438
- type: 'bool';
861
+ name: 'delegateChangeAccountIndex';
862
+ type: 'u8';
863
+ }
864
+ ];
865
+ };
866
+ },
867
+ {
868
+ name: 'InputTokenDataWithContext';
869
+ type: {
870
+ kind: 'struct';
871
+ fields: [
872
+ {
873
+ name: 'amount';
874
+ type: 'u64';
439
875
  },
440
876
  {
441
- name: 'compressionLamports';
877
+ name: 'delegateIndex';
442
878
  type: {
443
- option: 'u64';
879
+ option: 'u8';
444
880
  };
445
881
  },
446
882
  {
447
- name: 'pubkeyArray';
883
+ name: 'isNative';
448
884
  type: {
449
- vec: 'publicKey';
885
+ option: 'u64';
450
886
  };
451
887
  },
452
888
  {
453
- name: 'message';
889
+ name: 'merkleContext';
454
890
  type: {
455
- option: 'bytes';
891
+ defined: 'PackedMerkleContext';
456
892
  };
893
+ },
894
+ {
895
+ name: 'rootIndex';
896
+ type: 'u16';
457
897
  }
458
898
  ];
459
899
  };
460
900
  },
461
901
  {
462
- name: 'InstructionDataTransfer';
902
+ name: 'InstructionDataInvoke';
463
903
  type: {
464
904
  kind: 'struct';
465
905
  fields: [
@@ -471,6 +911,28 @@ type LightCompressedToken = {
471
911
  };
472
912
  };
473
913
  },
914
+ {
915
+ name: 'inputCompressedAccountsWithMerkleContext';
916
+ type: {
917
+ vec: {
918
+ defined: 'PackedCompressedAccountWithMerkleContext';
919
+ };
920
+ };
921
+ },
922
+ {
923
+ name: 'outputCompressedAccounts';
924
+ type: {
925
+ vec: {
926
+ defined: 'OutputCompressedAccountWithPackedContext';
927
+ };
928
+ };
929
+ },
930
+ {
931
+ name: 'relayFee';
932
+ type: {
933
+ option: 'u64';
934
+ };
935
+ },
474
936
  {
475
937
  name: 'newAddressParams';
476
938
  type: {
@@ -480,33 +942,54 @@ type LightCompressedToken = {
480
942
  };
481
943
  },
482
944
  {
483
- name: 'inputRootIndices';
945
+ name: 'compressOrDecompressLamports';
484
946
  type: {
485
- vec: 'u16';
947
+ option: 'u64';
486
948
  };
487
949
  },
488
950
  {
489
- name: 'inputCompressedAccountsWithMerkleContext';
951
+ name: 'isCompress';
952
+ type: 'bool';
953
+ }
954
+ ];
955
+ };
956
+ },
957
+ {
958
+ name: 'InstructionDataInvokeCpi';
959
+ type: {
960
+ kind: 'struct';
961
+ fields: [
962
+ {
963
+ name: 'proof';
964
+ type: {
965
+ option: {
966
+ defined: 'CompressedProof';
967
+ };
968
+ };
969
+ },
970
+ {
971
+ name: 'newAddressParams';
490
972
  type: {
491
973
  vec: {
492
- defined: 'CompressedAccountWithMerkleContext';
974
+ defined: 'NewAddressParamsPacked';
493
975
  };
494
976
  };
495
977
  },
496
978
  {
497
- name: 'outputCompressedAccounts';
979
+ name: 'inputCompressedAccountsWithMerkleContext';
498
980
  type: {
499
981
  vec: {
500
- defined: 'CompressedAccount';
982
+ defined: 'PackedCompressedAccountWithMerkleContext';
501
983
  };
502
984
  };
503
985
  },
504
986
  {
505
- name: 'outputStateMerkleTreeAccountIndices';
506
- docs: [
507
- 'The indices of the accounts in the output state merkle tree.'
508
- ];
509
- type: 'bytes';
987
+ name: 'outputCompressedAccounts';
988
+ type: {
989
+ vec: {
990
+ defined: 'OutputCompressedAccountWithPackedContext';
991
+ };
992
+ };
510
993
  },
511
994
  {
512
995
  name: 'relayFee';
@@ -515,22 +998,72 @@ type LightCompressedToken = {
515
998
  };
516
999
  },
517
1000
  {
518
- name: 'compressionLamports';
1001
+ name: 'compressOrDecompressLamports';
519
1002
  type: {
520
1003
  option: 'u64';
521
1004
  };
522
1005
  },
523
1006
  {
524
- name: 'isCompress';
525
- type: 'bool';
1007
+ name: 'isCompress';
1008
+ type: 'bool';
1009
+ },
1010
+ {
1011
+ name: 'signerSeeds';
1012
+ type: {
1013
+ vec: 'bytes';
1014
+ };
1015
+ },
1016
+ {
1017
+ name: 'cpiContext';
1018
+ type: {
1019
+ option: {
1020
+ defined: 'CompressedCpiContext';
1021
+ };
1022
+ };
1023
+ }
1024
+ ];
1025
+ };
1026
+ },
1027
+ {
1028
+ name: 'MerkleTreeMetadata';
1029
+ type: {
1030
+ kind: 'struct';
1031
+ fields: [
1032
+ {
1033
+ name: 'accessMetadata';
1034
+ type: {
1035
+ defined: 'AccessMetadata';
1036
+ };
1037
+ },
1038
+ {
1039
+ name: 'rolloverMetadata';
1040
+ type: {
1041
+ defined: 'RolloverMetadata';
1042
+ };
1043
+ },
1044
+ {
1045
+ name: 'associatedQueue';
1046
+ type: 'publicKey';
1047
+ },
1048
+ {
1049
+ name: 'nextMerkleTree';
1050
+ type: 'publicKey';
1051
+ }
1052
+ ];
1053
+ };
1054
+ },
1055
+ {
1056
+ name: 'MerkleTreeSequenceNumber';
1057
+ type: {
1058
+ kind: 'struct';
1059
+ fields: [
1060
+ {
1061
+ name: 'pubkey';
1062
+ type: 'publicKey';
526
1063
  },
527
1064
  {
528
- name: 'signerSeeds';
529
- type: {
530
- option: {
531
- vec: 'bytes';
532
- };
533
- };
1065
+ name: 'seq';
1066
+ type: 'u64';
534
1067
  }
535
1068
  ];
536
1069
  };
@@ -562,240 +1095,221 @@ type LightCompressedToken = {
562
1095
  };
563
1096
  },
564
1097
  {
565
- name: 'NewAddressParams';
1098
+ name: 'OutputCompressedAccountWithPackedContext';
566
1099
  type: {
567
1100
  kind: 'struct';
568
1101
  fields: [
569
1102
  {
570
- name: 'seed';
1103
+ name: 'compressedAccount';
571
1104
  type: {
572
- array: ['u8', 32];
1105
+ defined: 'CompressedAccount';
573
1106
  };
574
1107
  },
575
1108
  {
576
- name: 'addressQueuePubkey';
577
- type: 'publicKey';
578
- },
579
- {
580
- name: 'addressMerkleTreePubkey';
581
- type: 'publicKey';
582
- },
583
- {
584
- name: 'addressMerkleTreeRootIndex';
585
- type: 'u16';
1109
+ name: 'merkleTreeIndex';
1110
+ type: 'u8';
586
1111
  }
587
1112
  ];
588
1113
  };
589
1114
  },
590
1115
  {
591
- name: 'CompressedProof';
1116
+ name: 'PackedCompressedAccountWithMerkleContext';
592
1117
  type: {
593
1118
  kind: 'struct';
594
1119
  fields: [
595
1120
  {
596
- name: 'a';
1121
+ name: 'compressedAccount';
597
1122
  type: {
598
- array: ['u8', 32];
1123
+ defined: 'CompressedAccount';
599
1124
  };
600
1125
  },
601
1126
  {
602
- name: 'b';
1127
+ name: 'merkleContext';
603
1128
  type: {
604
- array: ['u8', 64];
1129
+ defined: 'PackedMerkleContext';
605
1130
  };
606
1131
  },
607
1132
  {
608
- name: 'c';
609
- type: {
610
- array: ['u8', 32];
611
- };
1133
+ name: 'rootIndex';
1134
+ docs: [
1135
+ 'Index of root used in inclusion validity proof.'
1136
+ ];
1137
+ type: 'u16';
612
1138
  }
613
1139
  ];
614
1140
  };
615
1141
  },
616
1142
  {
617
- name: 'InputTokenDataWithContext';
1143
+ name: 'PackedMerkleContext';
618
1144
  type: {
619
1145
  kind: 'struct';
620
1146
  fields: [
621
1147
  {
622
- name: 'amount';
623
- type: 'u64';
1148
+ name: 'merkleTreePubkeyIndex';
1149
+ type: 'u8';
624
1150
  },
625
1151
  {
626
- name: 'delegateIndex';
627
- type: {
628
- option: 'u8';
629
- };
1152
+ name: 'nullifierQueuePubkeyIndex';
1153
+ type: 'u8';
630
1154
  },
631
1155
  {
632
- name: 'delegatedAmount';
633
- type: {
634
- option: 'u64';
635
- };
1156
+ name: 'leafIndex';
1157
+ type: 'u32';
1158
+ }
1159
+ ];
1160
+ };
1161
+ },
1162
+ {
1163
+ name: 'PackedTokenTransferOutputData';
1164
+ type: {
1165
+ kind: 'struct';
1166
+ fields: [
1167
+ {
1168
+ name: 'owner';
1169
+ type: 'publicKey';
636
1170
  },
637
1171
  {
638
- name: 'isNative';
1172
+ name: 'amount';
1173
+ type: 'u64';
1174
+ },
1175
+ {
1176
+ name: 'lamports';
639
1177
  type: {
640
1178
  option: 'u64';
641
1179
  };
642
1180
  },
643
1181
  {
644
- name: 'merkleTreePubkeyIndex';
645
- type: 'u8';
646
- },
647
- {
648
- name: 'nullifierQueuePubkeyIndex';
1182
+ name: 'merkleTreeIndex';
649
1183
  type: 'u8';
650
- },
651
- {
652
- name: 'leafIndex';
653
- type: 'u32';
654
1184
  }
655
1185
  ];
656
1186
  };
657
1187
  },
658
1188
  {
659
- name: 'CompressedTokenInstructionDataTransfer';
1189
+ name: 'PublicTransactionEvent';
660
1190
  type: {
661
1191
  kind: 'struct';
662
1192
  fields: [
663
1193
  {
664
- name: 'proof';
1194
+ name: 'inputCompressedAccountHashes';
665
1195
  type: {
666
- option: {
667
- defined: 'CompressedProof';
1196
+ vec: {
1197
+ array: ['u8', 32];
668
1198
  };
669
1199
  };
670
1200
  },
671
1201
  {
672
- name: 'rootIndices';
1202
+ name: 'outputCompressedAccountHashes';
673
1203
  type: {
674
- vec: 'u16';
1204
+ vec: {
1205
+ array: ['u8', 32];
1206
+ };
675
1207
  };
676
1208
  },
677
1209
  {
678
- name: 'mint';
679
- type: 'publicKey';
680
- },
681
- {
682
- name: 'signerIsDelegate';
683
- type: 'bool';
684
- },
685
- {
686
- name: 'inputTokenDataWithContext';
1210
+ name: 'outputCompressedAccounts';
687
1211
  type: {
688
1212
  vec: {
689
- defined: 'InputTokenDataWithContext';
1213
+ defined: 'OutputCompressedAccountWithPackedContext';
690
1214
  };
691
1215
  };
692
1216
  },
693
1217
  {
694
- name: 'outputCompressedAccounts';
1218
+ name: 'outputLeafIndices';
1219
+ type: {
1220
+ vec: 'u32';
1221
+ };
1222
+ },
1223
+ {
1224
+ name: 'sequenceNumbers';
695
1225
  type: {
696
1226
  vec: {
697
- defined: 'TokenTransferOutputData';
1227
+ defined: 'MerkleTreeSequenceNumber';
698
1228
  };
699
1229
  };
700
1230
  },
701
1231
  {
702
- name: 'outputStateMerkleTreeAccountIndices';
703
- type: 'bytes';
1232
+ name: 'relayFee';
1233
+ type: {
1234
+ option: 'u64';
1235
+ };
704
1236
  },
705
1237
  {
706
1238
  name: 'isCompress';
707
1239
  type: 'bool';
708
1240
  },
709
1241
  {
710
- name: 'compressionAmount';
1242
+ name: 'compressOrDecompressLamports';
711
1243
  type: {
712
1244
  option: 'u64';
713
1245
  };
714
- }
715
- ];
716
- };
717
- },
718
- {
719
- name: 'TokenTransferOutputData';
720
- type: {
721
- kind: 'struct';
722
- fields: [
723
- {
724
- name: 'owner';
725
- type: 'publicKey';
726
1246
  },
727
1247
  {
728
- name: 'amount';
729
- type: 'u64';
1248
+ name: 'pubkeyArray';
1249
+ type: {
1250
+ vec: 'publicKey';
1251
+ };
730
1252
  },
731
1253
  {
732
- name: 'lamports';
1254
+ name: 'message';
733
1255
  type: {
734
- option: 'u64';
1256
+ option: 'bytes';
735
1257
  };
736
1258
  }
737
1259
  ];
738
1260
  };
739
1261
  },
740
1262
  {
741
- name: 'TokenData';
1263
+ name: 'RolloverMetadata';
742
1264
  type: {
743
1265
  kind: 'struct';
744
1266
  fields: [
745
1267
  {
746
- name: 'mint';
747
- docs: ['The mint associated with this account'];
748
- type: 'publicKey';
749
- },
750
- {
751
- name: 'owner';
752
- docs: ['The owner of this account.'];
753
- type: 'publicKey';
1268
+ name: 'index';
1269
+ docs: ['Unique index.'];
1270
+ type: 'u64';
754
1271
  },
755
1272
  {
756
- name: 'amount';
757
- docs: ['The amount of tokens this account holds.'];
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
+ ];
758
1278
  type: 'u64';
759
1279
  },
760
1280
  {
761
- name: 'delegate';
1281
+ name: 'rolloverThreshold';
762
1282
  docs: [
763
- 'If `delegate` is `Some` then `delegated_amount` represents',
764
- 'the amount authorized by the delegate'
1283
+ 'The threshold in percentage points when the account should be rolled over (95 corresponds to 95% filled).'
765
1284
  ];
766
- type: {
767
- option: 'publicKey';
768
- };
1285
+ type: 'u64';
769
1286
  },
770
1287
  {
771
- name: 'state';
772
- docs: ["The account's state"];
773
- type: {
774
- defined: 'AccountState';
775
- };
1288
+ name: 'networkFee';
1289
+ docs: ['Tip for maintaining the account.'];
1290
+ type: 'u64';
776
1291
  },
777
1292
  {
778
- name: 'isNative';
1293
+ name: 'rolledoverSlot';
779
1294
  docs: [
780
- 'If is_some, this is a native token, and the value logs the rent-exempt',
781
- 'reserve. An Account is required to be rent-exempt, so the value is',
782
- 'used by the Processor to ensure that wrapped SOL accounts do not',
783
- 'drop below this threshold.'
1295
+ 'The slot when the account was rolled over, a rolled over account should not be written to.'
784
1296
  ];
785
- type: {
786
- option: 'u64';
787
- };
1297
+ type: 'u64';
788
1298
  },
789
1299
  {
790
- name: 'delegatedAmount';
791
- docs: ['The amount delegated'];
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
+ ];
792
1306
  type: 'u64';
793
1307
  }
794
1308
  ];
795
1309
  };
796
1310
  },
797
1311
  {
798
- name: 'TokenDataClient';
1312
+ name: 'TokenData';
799
1313
  type: {
800
1314
  kind: 'struct';
801
1315
  fields: [
@@ -827,7 +1341,9 @@ type LightCompressedToken = {
827
1341
  {
828
1342
  name: 'state';
829
1343
  docs: ["The account's state"];
830
- type: 'u8';
1344
+ type: {
1345
+ defined: 'AccountState';
1346
+ };
831
1347
  },
832
1348
  {
833
1349
  name: 'isNative';
@@ -840,106 +1356,245 @@ type LightCompressedToken = {
840
1356
  type: {
841
1357
  option: 'u64';
842
1358
  };
843
- },
844
- {
845
- name: 'delegatedAmount';
846
- docs: ['The amount delegated'];
847
- type: 'u64';
848
1359
  }
849
1360
  ];
850
1361
  };
1362
+ }
1363
+ ];
1364
+ errors: [
1365
+ {
1366
+ code: 6000;
1367
+ name: 'PublicKeyAmountMissmatch';
1368
+ msg: 'public keys and amounts must be of same length';
851
1369
  },
852
1370
  {
853
- name: 'AccountState';
854
- type: {
855
- kind: 'enum';
856
- variants: [
857
- {
858
- name: 'Uninitialized';
859
- },
860
- {
861
- name: 'Initialized';
862
- },
863
- {
864
- name: 'Frozen';
865
- }
866
- ];
867
- };
1371
+ code: 6001;
1372
+ name: 'SignerCheckFailed';
1373
+ msg: 'SignerCheckFailed';
868
1374
  },
869
1375
  {
870
- name: 'ErrorCode';
871
- type: {
872
- kind: 'enum';
873
- variants: [
874
- {
875
- name: 'PublicKeyAmountMissmatch';
876
- },
877
- {
878
- name: 'MissingNewAuthorityPda';
879
- },
880
- {
881
- name: 'SignerCheckFailed';
882
- },
883
- {
884
- name: 'MintCheckFailed';
885
- },
886
- {
887
- name: 'ComputeInputSumFailed';
888
- },
889
- {
890
- name: 'ComputeOutputSumFailed';
891
- },
892
- {
893
- name: 'ComputeCompressSumFailed';
894
- },
895
- {
896
- name: 'ComputeDecompressSumFailed';
897
- },
898
- {
899
- name: 'SumCheckFailed';
900
- },
901
- {
902
- name: 'DecompressRecipientUndefinedForDecompress';
903
- },
904
- {
905
- name: 'CompressedPdaUndefinedForDecompress';
906
- },
907
- {
908
- name: 'DeCompressAmountUndefinedForDecompress';
909
- },
910
- {
911
- name: 'CompressedPdaUndefinedForCompress';
912
- },
913
- {
914
- name: 'DeCompressAmountUndefinedForCompress';
915
- },
916
- {
917
- name: 'DelegateUndefined';
918
- }
919
- ];
920
- };
921
- }
922
- ];
923
- errors: [
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
+ },
924
1410
  {
925
- code: 6000;
926
- name: 'SignerCheckFailed';
927
- msg: 'Signer check failed';
1411
+ code: 6009;
1412
+ name: 'DeCompressAmountUndefinedForDecompress';
1413
+ msg: 'DeCompressAmountUndefinedForDecompress';
928
1414
  },
929
1415
  {
930
- code: 6001;
931
- name: 'CreateTransferInstructionFailed';
932
- msg: 'Create transfer instruction failed';
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';
933
1469
  }
934
1470
  ];
935
1471
  };
936
1472
  declare const IDL: LightCompressedToken;
937
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
+ };
1594
+
938
1595
  type PackCompressedTokenAccountsParams = {
939
1596
  /** Input state to be consumed */
940
1597
  inputCompressedTokenAccounts: ParsedTokenAccount[];
941
- /** Length of output compressed accounts */
942
- outputCompressedAccountsLength: number;
943
1598
  /**
944
1599
  * State trees that the output should be inserted into. Defaults to the 0th
945
1600
  * state tree of the input state. Gets padded to the length of
@@ -948,19 +1603,24 @@ type PackCompressedTokenAccountsParams = {
948
1603
  outputStateTrees?: PublicKey[] | PublicKey;
949
1604
  /** Optional remaining accounts to append to */
950
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[];
951
1612
  };
952
1613
  /**
953
1614
  * Packs Compressed Token Accounts.
954
1615
  */
955
1616
  declare function packCompressedTokenAccounts(params: PackCompressedTokenAccountsParams): {
956
1617
  inputTokenDataWithContext: InputTokenDataWithContext$1[];
957
- outputStateMerkleTreeIndices: number[];
958
1618
  remainingAccountMetas: AccountMeta[];
1619
+ packedOutputTokenData: PackedTokenTransferOutputData[];
959
1620
  };
960
1621
 
961
1622
  declare const POOL_SEED: Buffer;
962
1623
  declare const CPI_AUTHORITY_SEED: Buffer;
963
- declare const MINT_AUTHORITY_SEED: Uint8Array;
964
1624
  declare const SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE = 1461600;
965
1625
 
966
1626
  type CompressParams = {
@@ -989,9 +1649,10 @@ type CompressParams = {
989
1649
  */
990
1650
  amount: number | BN;
991
1651
  /**
992
- * 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.
993
1654
  */
994
- outputStateTree: PublicKey;
1655
+ outputStateTree?: PublicKey;
995
1656
  };
996
1657
  type DecompressParams = {
997
1658
  /**
@@ -1010,10 +1671,6 @@ type DecompressParams = {
1010
1671
  * amount of tokens to decompress.
1011
1672
  */
1012
1673
  amount: number | BN;
1013
- /**
1014
- * The state tree that the change tx output should be inserted into.
1015
- */
1016
- outputStateTree: PublicKey;
1017
1674
  /**
1018
1675
  * The recent state root indices of the input state. The expiry is tied to
1019
1676
  * the proof.
@@ -1024,6 +1681,11 @@ type DecompressParams = {
1024
1681
  * expires after n slots.
1025
1682
  */
1026
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;
1027
1689
  };
1028
1690
  type TransferParams = {
1029
1691
  /**
@@ -1060,46 +1722,141 @@ type TransferParams = {
1060
1722
  */
1061
1723
  outputStateTrees?: PublicKey[] | PublicKey;
1062
1724
  };
1063
- /** Create Mint account for compressed Tokens */
1725
+ /**
1726
+ * Create Mint account for compressed Tokens
1727
+ */
1064
1728
  type CreateMintParams = {
1065
- /** Tx feepayer */
1729
+ /**
1730
+ * Tx feepayer
1731
+ */
1066
1732
  feePayer: PublicKey;
1067
- /** Mint authority */
1733
+ /**
1734
+ * Mint authority
1735
+ */
1068
1736
  authority: PublicKey;
1069
- /** Mint public key */
1737
+ /**
1738
+ * Mint public key
1739
+ */
1070
1740
  mint: PublicKey;
1071
- /** Mint decimals */
1741
+ /**
1742
+ * Mint decimals
1743
+ */
1072
1744
  decimals: number;
1073
- /** Optional: freeze authority */
1745
+ /**
1746
+ * Optional: freeze authority
1747
+ */
1074
1748
  freezeAuthority: PublicKey | null;
1075
- /** lamport amount for mint account rent exemption */
1749
+ /**
1750
+ * lamport amount for mint account rent exemption
1751
+ */
1076
1752
  rentExemptBalance: number;
1077
1753
  };
1078
1754
  /**
1079
1755
  * Create compressed token accounts
1080
1756
  */
1081
1757
  type MintToParams = {
1082
- /** Tx feepayer */
1758
+ /**
1759
+ * Tx feepayer
1760
+ */
1083
1761
  feePayer: PublicKey;
1084
- /** Mint authority */
1762
+ /**
1763
+ * Mint authority
1764
+ */
1085
1765
  authority: PublicKey;
1086
- /** Mint public key */
1766
+ /**
1767
+ * Mint public key
1768
+ */
1087
1769
  mint: PublicKey;
1088
- /** The Solana Public Keys to mint to. Accepts batches */
1770
+ /**
1771
+ * The Solana Public Keys to mint to.
1772
+ */
1089
1773
  toPubkey: PublicKey[] | PublicKey;
1090
- /** The amount of compressed tokens to mint. Accepts batches */
1774
+ /**
1775
+ * The amount of compressed tokens to mint.
1776
+ */
1091
1777
  amount: BN | BN[] | number | number[];
1092
- /** Public key of the state tree to mint into. */
1093
- 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;
1783
+ };
1784
+ /**
1785
+ * Register an existing SPL mint account to the compressed token program
1786
+ * Creates an omnibus account for the mint
1787
+ */
1788
+ type RegisterMintParams = {
1789
+ /** Tx feepayer */
1790
+ feePayer: PublicKey;
1791
+ /** Mint public key */
1792
+ mint: PublicKey;
1793
+ };
1794
+ /**
1795
+ * Mint from existing SPL mint to compressed token accounts
1796
+ */
1797
+ type ApproveAndMintToParams = {
1798
+ /**
1799
+ * Tx feepayer
1800
+ */
1801
+ feePayer: PublicKey;
1802
+ /**
1803
+ * Mint authority
1804
+ */
1805
+ authority: PublicKey;
1806
+ /**
1807
+ * Mint authority (associated) token account
1808
+ */
1809
+ authorityTokenAccount: PublicKey;
1810
+ /**
1811
+ * Mint public key
1812
+ */
1813
+ mint: PublicKey;
1814
+ /**
1815
+ * The Solana Public Key to mint to.
1816
+ */
1817
+ toPubkey: PublicKey;
1818
+ /**
1819
+ * The amount of compressed tokens to mint.
1820
+ */
1821
+ amount: BN | number;
1822
+ /**
1823
+ * Public key of the state tree to mint into. Defaults to a public state
1824
+ * tree if unspecified.
1825
+ */
1826
+ merkleTree?: PublicKey;
1094
1827
  };
1828
+ /**
1829
+ * Sum up the token amounts of the compressed token accounts
1830
+ */
1095
1831
  declare const sumUpTokenAmount: (accounts: ParsedTokenAccount[]) => BN;
1832
+ /**
1833
+ * Validate that all the compressed token accounts are owned by the same owner.
1834
+ */
1096
1835
  declare const validateSameTokenOwner: (accounts: ParsedTokenAccount[]) => void;
1097
- declare const parseInputTokenData: (inputCompressedTokenAccounts: ParsedTokenAccount[]) => {
1836
+ /**
1837
+ * Parse compressed token accounts to get the mint, current owner and delegate.
1838
+ */
1839
+ declare const parseTokenData: (compressedTokenAccounts: ParsedTokenAccount[]) => {
1098
1840
  mint: PublicKey;
1099
1841
  currentOwner: PublicKey;
1100
1842
  delegate: PublicKey | null;
1101
1843
  };
1844
+ /**
1845
+ * Create the output state for a transfer transaction.
1846
+ * @param inputCompressedTokenAccounts Input state
1847
+ * @param toAddress Recipient address
1848
+ * @param amount Amount of tokens to transfer
1849
+ * @returns Output token data for the transfer
1850
+ * instruction
1851
+ */
1102
1852
  declare function createTransferOutputState(inputCompressedTokenAccounts: ParsedTokenAccount[], toAddress: PublicKey, amount: number | BN): TokenTransferOutputData$1[];
1853
+ /**
1854
+ * Create the output state for a compress transaction.
1855
+ * @param inputCompressedTokenAccounts Input state
1856
+ * @param amount Amount of tokens to compress
1857
+ * @returns Output token data for the compress
1858
+ * instruction
1859
+ */
1103
1860
  declare function createDecompressOutputState(inputCompressedTokenAccounts: ParsedTokenAccount[], amount: number | BN): TokenTransferOutputData$1[];
1104
1861
  declare class CompressedTokenProgram {
1105
1862
  /**
@@ -1111,56 +1868,65 @@ declare class CompressedTokenProgram {
1111
1868
  */
1112
1869
  static programId: PublicKey;
1113
1870
  private static _program;
1871
+ /** @internal */
1114
1872
  static get program(): Program<LightCompressedToken>;
1115
1873
  /**
1874
+ * @internal
1116
1875
  * Initializes the program statically if not already initialized.
1117
1876
  */
1118
1877
  private static initializeProgram;
1119
1878
  /** @internal */
1120
- static deriveMintAuthorityPda: (authority: PublicKey, mint: PublicKey) => PublicKey;
1121
- /** @internal */
1122
1879
  static deriveTokenPoolPda(mint: PublicKey): PublicKey;
1123
1880
  /** @internal */
1124
1881
  static get deriveCpiAuthorityPda(): PublicKey;
1882
+ /**
1883
+ * Construct createMint instruction for compressed tokens
1884
+ */
1125
1885
  static createMint(params: CreateMintParams): Promise<TransactionInstruction[]>;
1886
+ /**
1887
+ * Enable compression for an existing SPL mint, creating an omnibus account.
1888
+ * For new mints, use `CompressedTokenProgram.createMint`.
1889
+ */
1890
+ static registerMint(params: RegisterMintParams): Promise<TransactionInstruction>;
1891
+ /**
1892
+ * Construct mintTo instruction for compressed tokens
1893
+ */
1126
1894
  static mintTo(params: MintToParams): Promise<TransactionInstruction>;
1127
- static transfer(params: TransferParams): Promise<TransactionInstruction[]>;
1895
+ /**
1896
+ * Mint tokens from registed SPL mint account to a compressed account
1897
+ */
1898
+ static approveAndMintTo(params: ApproveAndMintToParams): Promise<TransactionInstruction[]>;
1899
+ /**
1900
+ * Construct transfer instruction for compressed tokens
1901
+ */
1902
+ static transfer(params: TransferParams): Promise<TransactionInstruction>;
1903
+ /**
1904
+ * Construct approve and compress instructions
1905
+ * @returns [approveInstruction, compressInstruction]
1906
+ */
1128
1907
  static compress(params: CompressParams): Promise<TransactionInstruction[]>;
1129
- static decompress(params: DecompressParams): Promise<TransactionInstruction[]>;
1908
+ /**
1909
+ * Construct decompress instruction
1910
+ */
1911
+ static decompress(params: DecompressParams): Promise<TransactionInstruction>;
1130
1912
  }
1131
1913
 
1132
- type TokenTransferOutputData = {
1133
- owner: PublicKey;
1134
- amount: BN;
1135
- lamports: BN | null;
1136
- };
1137
- type InputTokenDataWithContext = {
1138
- amount: BN;
1139
- delegateIndex: number | null;
1140
- delegatedAmount: BN | null;
1141
- isNative: BN | null;
1142
- merkleTreePubkeyIndex: number;
1143
- nullifierQueuePubkeyIndex: number;
1144
- leafIndex: number;
1145
- };
1146
- type CompressedTokenInstructionDataTransfer = {
1147
- proof: CompressedProof | null;
1148
- rootIndices: number[];
1149
- mint: PublicKey;
1150
- signerIsDelegate: boolean;
1151
- inputTokenDataWithContext: InputTokenDataWithContext[];
1152
- outputCompressedAccounts: TokenTransferOutputData[];
1153
- outputStateMerkleTreeAccountIndices: Buffer;
1154
- };
1155
- type TokenData = {
1156
- mint: PublicKey;
1157
- owner: PublicKey;
1158
- amount: BN;
1159
- delegate: PublicKey | null;
1160
- state: number;
1161
- isNative: BN | null;
1162
- delegatedAmount: BN;
1163
- };
1914
+ /**
1915
+ * Mint compressed tokens to a solana address from an external mint authority
1916
+ *
1917
+ * @param rpc Rpc to use
1918
+ * @param payer Payer of the transaction fees
1919
+ * @param mint Mint for the account
1920
+ * @param destination Address of the account to mint to
1921
+ * @param authority Minting authority
1922
+ * @param amount Amount to mint
1923
+ * @param merkleTree State tree account that the compressed tokens should be
1924
+ * part of. Defaults to the default state tree account.
1925
+ * @param confirmOptions Options for confirming the transaction
1926
+ *
1927
+ * @return Signature of the confirmed transaction
1928
+ */
1929
+ declare function approveAndMintTo(rpc: Rpc, payer: Signer, mint: PublicKey, destination: PublicKey, authority: Signer, amount: number | BN, merkleTree?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1164
1930
 
1165
1931
  /**
1166
1932
  * Compress SPL tokens
@@ -1207,14 +1973,14 @@ declare function decompress(rpc: Rpc, payer: Signer, mint: PublicKey, amount: nu
1207
1973
  *
1208
1974
  * @param rpc RPC to use
1209
1975
  * @param payer Payer of the transaction and initialization fees
1210
- * @param mintAuthority Account or multisig that will control minting. Is signer.
1976
+ * @param mintAuthority Account or multisig that will control minting
1211
1977
  * @param decimals Location of the decimal place
1212
1978
  * @param keypair Optional keypair, defaulting to a new random one
1213
1979
  * @param confirmOptions Options for confirming the transaction
1214
1980
  *
1215
1981
  * @return Address of the new mint and the transaction signature
1216
1982
  */
1217
- 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<{
1218
1984
  mint: PublicKey;
1219
1985
  transactionSignature: TransactionSignature;
1220
1986
  }>;
@@ -1234,8 +2000,20 @@ declare function createMint(rpc: Rpc, payer: Signer, mintAuthority: Signer, deci
1234
2000
  *
1235
2001
  * @return Signature of the confirmed transaction
1236
2002
  */
1237
- declare function mintTo(rpc: Rpc, payer: Signer, mint: PublicKey, destination: PublicKey, authority: Signer, amount: number | BN, merkleTree?: PublicKey, // DEFAULT IF NOT PROVIDED
1238
- 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>;
2004
+
2005
+ /**
2006
+ * Register an existing mint with the CompressedToken program
2007
+ *
2008
+ * @param rpc RPC to use
2009
+ * @param payer Payer of the transaction and initialization fees
2010
+ * @param mintAuthority Account or multisig that will control minting. Is signer.
2011
+ * @param mintAddress Address of the existing mint
2012
+ * @param confirmOptions Options for confirming the transaction
2013
+ *
2014
+ * @return transaction signature
2015
+ */
2016
+ declare function registerMint(rpc: Rpc, payer: Signer, mintAddress: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1239
2017
 
1240
2018
  /**
1241
2019
  * Transfer compressed tokens from one owner to another
@@ -1247,7 +2025,8 @@ confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1247
2025
  * @param owner Owner of the compressed tokens
1248
2026
  * @param toAddress Destination address of the recipient
1249
2027
  * @param merkleTree State tree account that the compressed tokens should be
1250
- * inserted into. Defaults to the default state tree account.
2028
+ * inserted into. Defaults to the default state tree
2029
+ * account.
1251
2030
  * @param confirmOptions Options for confirming the transaction
1252
2031
  *
1253
2032
  *
@@ -1267,4 +2046,4 @@ declare function selectMinCompressedTokenAccountsForTransfer(accounts: ParsedTok
1267
2046
  totalLamports: BN | null
1268
2047
  ];
1269
2048
 
1270
- export { CPI_AUTHORITY_SEED, type CompressedTokenInstructionDataTransfer, CompressedTokenProgram, type CreateMintParams, IDL, type InputTokenDataWithContext, type LightCompressedToken, MINT_AUTHORITY_SEED, type MintToParams, POOL_SEED, type PackCompressedTokenAccountsParams, SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE, type TokenData, type TokenTransferOutputData, type TransferParams, compress, createDecompressOutputState, createMint, createTransferOutputState, decompress, mintTo, packCompressedTokenAccounts, parseInputTokenData, 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 };