@lightprotocol/compressed-token 0.3.3 → 0.4.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.
@@ -11,16 +11,17 @@ const IDL = {
11
11
  {
12
12
  name: 'createTokenPool',
13
13
  docs: [
14
- 'This instruction expects a mint account to be created in a separate',
15
- 'token program instruction with token authority as mint authority. This',
16
- 'instruction creates a token pool account for that mint owned by token',
17
- 'authority.',
14
+ 'This instruction creates a token pool for a given mint. Every spl mint',
15
+ 'can have one token pool. When a token is compressed the tokens are',
16
+ 'transferrred to the token pool, and their compressed equivalent is',
17
+ 'minted into a Merkle tree.',
18
18
  ],
19
19
  accounts: [
20
20
  {
21
21
  name: 'feePayer',
22
22
  isMut: true,
23
23
  isSigner: true,
24
+ docs: ['UNCHECKED: only pays fees.'],
24
25
  },
25
26
  {
26
27
  name: 'tokenPoolPda',
@@ -56,13 +57,17 @@ const IDL = {
56
57
  'Mints tokens from an spl token mint to a list of compressed accounts.',
57
58
  'Minted tokens are transferred to a pool account owned by the compressed',
58
59
  'token program. The instruction creates one compressed output account for',
59
- 'every amount and pubkey input pair one output compressed account.',
60
+ 'every amount and pubkey input pair. A constant amount of lamports can be',
61
+ 'transferred to each output account to enable. A use case to add lamports',
62
+ 'to a compressed token account is to prevent spam. This is the only way',
63
+ 'to add lamports to a compressed token account.',
60
64
  ],
61
65
  accounts: [
62
66
  {
63
67
  name: 'feePayer',
64
68
  isMut: true,
65
69
  isSigner: true,
70
+ docs: ['UNCHECKED: only pays fees.'],
66
71
  },
67
72
  {
68
73
  name: 'authority',
@@ -83,6 +88,9 @@ const IDL = {
83
88
  name: 'tokenPoolPda',
84
89
  isMut: true,
85
90
  isSigner: false,
91
+ docs: [
92
+ 'account to a token account of a different mint will fail',
93
+ ],
86
94
  },
87
95
  {
88
96
  name: 'tokenProgram',
@@ -103,6 +111,7 @@ const IDL = {
103
111
  name: 'noopProgram',
104
112
  isMut: false,
105
113
  isSigner: false,
114
+ docs: ['programs'],
106
115
  },
107
116
  {
108
117
  name: 'accountCompressionAuthority',
@@ -129,6 +138,12 @@ const IDL = {
129
138
  isMut: false,
130
139
  isSigner: false,
131
140
  },
141
+ {
142
+ name: 'solPoolPda',
143
+ isMut: true,
144
+ isSigner: false,
145
+ isOptional: true,
146
+ },
132
147
  ],
133
148
  args: [
134
149
  {
@@ -143,20 +158,42 @@ const IDL = {
143
158
  vec: 'u64',
144
159
  },
145
160
  },
161
+ {
162
+ name: 'lamports',
163
+ type: {
164
+ option: 'u64',
165
+ },
166
+ },
146
167
  ],
147
168
  },
148
169
  {
149
170
  name: 'transfer',
171
+ docs: [
172
+ 'Transfers compressed tokens from one account to another. All accounts',
173
+ 'must be of the same mint. Additional spl tokens can be compressed or',
174
+ 'decompressed. In one transaction only compression or decompression is',
175
+ 'possible. Lamports can be transferred alongside tokens. If output token',
176
+ 'accounts specify less lamports than inputs the remaining lamports are',
177
+ 'transferred to an output compressed account. Signer must be owner or',
178
+ 'delegate. If a delegated token account is transferred the delegate is',
179
+ 'not preserved.',
180
+ ],
150
181
  accounts: [
151
182
  {
152
183
  name: 'feePayer',
153
184
  isMut: true,
154
185
  isSigner: true,
186
+ docs: ['UNCHECKED: only pays fees.'],
155
187
  },
156
188
  {
157
189
  name: 'authority',
158
190
  isMut: false,
159
191
  isSigner: true,
192
+ docs: [
193
+ 'Authority is verified through proof since both owner and delegate',
194
+ 'are included in the token data hash, which is a public input to the',
195
+ 'validity proof.',
196
+ ],
160
197
  },
161
198
  {
162
199
  name: 'cpiAuthorityPda',
@@ -192,6 +229,10 @@ const IDL = {
192
229
  name: 'selfProgram',
193
230
  isMut: false,
194
231
  isSigner: false,
232
+ docs: [
233
+ '(different program) checked in light system program to derive',
234
+ 'cpi_authority_pda and check that this program is the signer of the cpi.',
235
+ ],
195
236
  },
196
237
  {
197
238
  name: 'tokenPoolPda',
@@ -226,16 +267,30 @@ const IDL = {
226
267
  },
227
268
  {
228
269
  name: 'approve',
270
+ docs: [
271
+ 'Delegates an amount to a delegate. A compressed token account is either',
272
+ 'completely delegated or not. Prior delegates are not preserved. Cannot',
273
+ 'be called by a delegate.',
274
+ 'The instruction creates two output accounts:',
275
+ '1. one account with delegated amount',
276
+ '2. one account with remaining(change) amount',
277
+ ],
229
278
  accounts: [
230
279
  {
231
280
  name: 'feePayer',
232
281
  isMut: true,
233
282
  isSigner: true,
283
+ docs: ['UNCHECKED: only pays fees.'],
234
284
  },
235
285
  {
236
286
  name: 'authority',
237
287
  isMut: false,
238
288
  isSigner: true,
289
+ docs: [
290
+ 'Authority is verified through proof since both owner and delegate',
291
+ 'are included in the token data hash, which is a public input to the',
292
+ 'validity proof.',
293
+ ],
239
294
  },
240
295
  {
241
296
  name: 'cpiAuthorityPda',
@@ -271,6 +326,10 @@ const IDL = {
271
326
  name: 'selfProgram',
272
327
  isMut: false,
273
328
  isSigner: false,
329
+ docs: [
330
+ '(different program) checked in light system program to derive',
331
+ 'cpi_authority_pda and check that this program is the signer of the cpi.',
332
+ ],
274
333
  },
275
334
  {
276
335
  name: 'systemProgram',
@@ -287,16 +346,26 @@ const IDL = {
287
346
  },
288
347
  {
289
348
  name: 'revoke',
349
+ docs: [
350
+ 'Revokes a delegation. The instruction merges all inputs into one output',
351
+ 'account. Cannot be called by a delegate. Delegates are not preserved.',
352
+ ],
290
353
  accounts: [
291
354
  {
292
355
  name: 'feePayer',
293
356
  isMut: true,
294
357
  isSigner: true,
358
+ docs: ['UNCHECKED: only pays fees.'],
295
359
  },
296
360
  {
297
361
  name: 'authority',
298
362
  isMut: false,
299
363
  isSigner: true,
364
+ docs: [
365
+ 'Authority is verified through proof since both owner and delegate',
366
+ 'are included in the token data hash, which is a public input to the',
367
+ 'validity proof.',
368
+ ],
300
369
  },
301
370
  {
302
371
  name: 'cpiAuthorityPda',
@@ -332,6 +401,10 @@ const IDL = {
332
401
  name: 'selfProgram',
333
402
  isMut: false,
334
403
  isSigner: false,
404
+ docs: [
405
+ '(different program) checked in light system program to derive',
406
+ 'cpi_authority_pda and check that this program is the signer of the cpi.',
407
+ ],
335
408
  },
336
409
  {
337
410
  name: 'systemProgram',
@@ -348,11 +421,16 @@ const IDL = {
348
421
  },
349
422
  {
350
423
  name: 'freeze',
424
+ docs: [
425
+ 'Freezes compressed token accounts. Inputs must not be frozen. Creates as',
426
+ 'many outputs as inputs. Balances and delegates are preserved.',
427
+ ],
351
428
  accounts: [
352
429
  {
353
430
  name: 'feePayer',
354
431
  isMut: true,
355
432
  isSigner: true,
433
+ docs: ['UNCHECKED: only pays fees.'],
356
434
  },
357
435
  {
358
436
  name: 'authority',
@@ -393,6 +471,10 @@ const IDL = {
393
471
  name: 'selfProgram',
394
472
  isMut: false,
395
473
  isSigner: false,
474
+ docs: [
475
+ '(different program) checked in light system program to derive',
476
+ 'cpi_authority_pda and check that this program is the signer of the cpi.',
477
+ ],
396
478
  },
397
479
  {
398
480
  name: 'systemProgram',
@@ -414,11 +496,16 @@ const IDL = {
414
496
  },
415
497
  {
416
498
  name: 'thaw',
499
+ docs: [
500
+ 'Thaws frozen compressed token accounts. Inputs must be frozen. Creates',
501
+ 'as many outputs as inputs. Balances and delegates are preserved.',
502
+ ],
417
503
  accounts: [
418
504
  {
419
505
  name: 'feePayer',
420
506
  isMut: true,
421
507
  isSigner: true,
508
+ docs: ['UNCHECKED: only pays fees.'],
422
509
  },
423
510
  {
424
511
  name: 'authority',
@@ -459,6 +546,10 @@ const IDL = {
459
546
  name: 'selfProgram',
460
547
  isMut: false,
461
548
  isSigner: false,
549
+ docs: [
550
+ '(different program) checked in light system program to derive',
551
+ 'cpi_authority_pda and check that this program is the signer of the cpi.',
552
+ ],
462
553
  },
463
554
  {
464
555
  name: 'systemProgram',
@@ -480,22 +571,48 @@ const IDL = {
480
571
  },
481
572
  {
482
573
  name: 'burn',
574
+ docs: [
575
+ 'Burns compressed tokens and spl tokens from the pool account. Delegates',
576
+ 'can burn tokens. The output compressed token account remains delegated.',
577
+ 'Creates one output compressed token account.',
578
+ ],
483
579
  accounts: [
484
580
  {
485
581
  name: 'feePayer',
486
582
  isMut: true,
487
583
  isSigner: true,
584
+ docs: ['UNCHECKED: only pays fees.'],
488
585
  },
489
586
  {
490
587
  name: 'authority',
491
588
  isMut: false,
492
589
  isSigner: true,
590
+ docs: [
591
+ 'Authority is verified through proof since both owner and delegate',
592
+ 'are included in the token data hash, which is a public input to the',
593
+ 'validity proof.',
594
+ ],
493
595
  },
494
596
  {
495
597
  name: 'cpiAuthorityPda',
496
598
  isMut: false,
497
599
  isSigner: false,
498
600
  },
601
+ {
602
+ name: 'mint',
603
+ isMut: true,
604
+ isSigner: false,
605
+ },
606
+ {
607
+ name: 'tokenPoolPda',
608
+ isMut: true,
609
+ isSigner: false,
610
+ },
611
+ {
612
+ name: 'tokenProgram',
613
+ isMut: false,
614
+ isSigner: false,
615
+ },
499
616
  {
500
617
  name: 'lightSystemProgram',
501
618
  isMut: false,
@@ -551,11 +668,17 @@ const IDL = {
551
668
  name: 'feePayer',
552
669
  isMut: true,
553
670
  isSigner: true,
671
+ docs: ['UNCHECKED: only pays fees.'],
554
672
  },
555
673
  {
556
674
  name: 'authority',
557
675
  isMut: false,
558
676
  isSigner: true,
677
+ docs: [
678
+ 'Authority is verified through proof since both owner and delegate',
679
+ 'are included in the token data hash, which is a public input to the',
680
+ 'validity proof.',
681
+ ],
559
682
  },
560
683
  {
561
684
  name: 'cpiAuthorityPda',
@@ -591,6 +714,10 @@ const IDL = {
591
714
  name: 'selfProgram',
592
715
  isMut: false,
593
716
  isSigner: false,
717
+ docs: [
718
+ '(different program) checked in light system program to derive',
719
+ 'cpi_authority_pda and check that this program is the signer of the cpi.',
720
+ ],
594
721
  },
595
722
  {
596
723
  name: 'tokenPoolPda',
@@ -632,24 +759,6 @@ const IDL = {
632
759
  ],
633
760
  },
634
761
  ],
635
- accounts: [
636
- {
637
- name: 'RegisteredProgram',
638
- type: {
639
- kind: 'struct',
640
- fields: [
641
- {
642
- name: 'registeredProgramId',
643
- type: 'publicKey',
644
- },
645
- {
646
- name: 'groupAuthorityPda',
647
- type: 'publicKey',
648
- },
649
- ],
650
- },
651
- },
652
- ],
653
762
  types: [
654
763
  {
655
764
  name: 'AccessMetadata',
@@ -664,7 +773,7 @@ const IDL = {
664
773
  {
665
774
  name: 'programOwner',
666
775
  docs: [
667
- 'Delegate of the Merkle tree. This will be used for program owned Merkle trees.',
776
+ 'Program owner of the Merkle tree. This will be used for program owned Merkle trees.',
668
777
  ],
669
778
  type: 'publicKey',
670
779
  },
@@ -748,10 +857,25 @@ const IDL = {
748
857
  fields: [
749
858
  {
750
859
  name: 'setContext',
860
+ docs: [
861
+ 'Is set by the program that is invoking the CPI to signal that is should',
862
+ 'set the cpi context.',
863
+ ],
864
+ type: 'bool',
865
+ },
866
+ {
867
+ name: 'firstSetContext',
868
+ docs: [
869
+ 'Is set to wipe the cpi context since someone could have set it before',
870
+ 'with unrelated data.',
871
+ ],
751
872
  type: 'bool',
752
873
  },
753
874
  {
754
875
  name: 'cpiContextAccountIndex',
876
+ docs: [
877
+ 'Index of cpi context account in remaining accounts.',
878
+ ],
755
879
  type: 'u8',
756
880
  },
757
881
  ],
@@ -803,9 +927,9 @@ const IDL = {
803
927
  {
804
928
  name: 'delegatedTransfer',
805
929
  docs: [
806
- 'If the signer is a delegate, the delegate index is index 0 of remaining accounts.',
930
+ 'Is required if the signer is delegate,',
931
+ '-> delegate is authority account,',
807
932
  'owner = Some(owner) is the owner of the token account.',
808
- 'Is set if the signer is delegate',
809
933
  ],
810
934
  type: {
811
935
  option: {
@@ -847,11 +971,20 @@ const IDL = {
847
971
  },
848
972
  },
849
973
  },
974
+ {
975
+ name: 'lamportsChangeAccountMerkleTreeIndex',
976
+ type: {
977
+ option: 'u8',
978
+ },
979
+ },
850
980
  ],
851
981
  },
852
982
  },
853
983
  {
854
984
  name: 'DelegatedTransfer',
985
+ docs: [
986
+ 'Struct to provide the owner when the delegate is signer of the transaction.',
987
+ ],
855
988
  type: {
856
989
  kind: 'struct',
857
990
  fields: [
@@ -861,7 +994,15 @@ const IDL = {
861
994
  },
862
995
  {
863
996
  name: 'delegateChangeAccountIndex',
864
- type: 'u8',
997
+ docs: [
998
+ 'Index of change compressed account in output compressed accounts. In',
999
+ "case that the delegate didn't spend the complete delegated compressed",
1000
+ 'account balance the change compressed account will be delegated to her',
1001
+ 'as well.',
1002
+ ],
1003
+ type: {
1004
+ option: 'u8',
1005
+ },
865
1006
  },
866
1007
  ],
867
1008
  },
@@ -897,6 +1038,15 @@ const IDL = {
897
1038
  option: 'u64',
898
1039
  },
899
1040
  },
1041
+ {
1042
+ name: 'tlv',
1043
+ docs: [
1044
+ 'Placeholder for TokenExtension tlv data (unimplemented)',
1045
+ ],
1046
+ type: {
1047
+ option: 'bytes',
1048
+ },
1049
+ },
900
1050
  ],
901
1051
  },
902
1052
  },
@@ -1158,6 +1308,18 @@ const IDL = {
1158
1308
  name: 'leafIndex',
1159
1309
  type: 'u32',
1160
1310
  },
1311
+ {
1312
+ name: 'queueIndex',
1313
+ docs: [
1314
+ 'Index of leaf in queue. Placeholder of batched Merkle tree updates',
1315
+ 'currently unimplemented.',
1316
+ ],
1317
+ type: {
1318
+ option: {
1319
+ defined: 'QueueIndex',
1320
+ },
1321
+ },
1322
+ },
1161
1323
  ],
1162
1324
  },
1163
1325
  },
@@ -1184,6 +1346,15 @@ const IDL = {
1184
1346
  name: 'merkleTreeIndex',
1185
1347
  type: 'u8',
1186
1348
  },
1349
+ {
1350
+ name: 'tlv',
1351
+ docs: [
1352
+ 'Placeholder for TokenExtension tlv data (unimplemented)',
1353
+ ],
1354
+ type: {
1355
+ option: 'bytes',
1356
+ },
1357
+ },
1187
1358
  ],
1188
1359
  },
1189
1360
  },
@@ -1261,6 +1432,24 @@ const IDL = {
1261
1432
  ],
1262
1433
  },
1263
1434
  },
1435
+ {
1436
+ name: 'QueueIndex',
1437
+ type: {
1438
+ kind: 'struct',
1439
+ fields: [
1440
+ {
1441
+ name: 'queueId',
1442
+ docs: ['Id of queue in queue account.'],
1443
+ type: 'u8',
1444
+ },
1445
+ {
1446
+ name: 'index',
1447
+ docs: ['Index of compressed account hash in queue.'],
1448
+ type: 'u16',
1449
+ },
1450
+ ],
1451
+ },
1452
+ },
1264
1453
  {
1265
1454
  name: 'RolloverMetadata',
1266
1455
  type: {
@@ -1347,6 +1536,15 @@ const IDL = {
1347
1536
  defined: 'AccountState',
1348
1537
  },
1349
1538
  },
1539
+ {
1540
+ name: 'tlv',
1541
+ docs: [
1542
+ 'Placeholder for TokenExtension tlv data (unimplemented)',
1543
+ ],
1544
+ type: {
1545
+ option: 'bytes',
1546
+ },
1547
+ },
1350
1548
  ],
1351
1549
  },
1352
1550
  },
@@ -1354,108 +1552,23 @@ const IDL = {
1354
1552
  errors: [
1355
1553
  {
1356
1554
  code: 6000,
1357
- name: 'PublicKeyAmountMissmatch',
1358
- msg: 'public keys and amounts must be of same length',
1555
+ name: 'SignerCheckFailed',
1556
+ msg: 'Signer check failed',
1359
1557
  },
1360
1558
  {
1361
1559
  code: 6001,
1362
- name: 'SignerCheckFailed',
1363
- msg: 'SignerCheckFailed',
1560
+ name: 'CreateTransferInstructionFailed',
1561
+ msg: 'Create transfer instruction failed',
1364
1562
  },
1365
1563
  {
1366
1564
  code: 6002,
1367
- name: 'ComputeInputSumFailed',
1368
- msg: 'ComputeInputSumFailed',
1565
+ name: 'AccountNotFound',
1566
+ msg: 'Account not found',
1369
1567
  },
1370
1568
  {
1371
1569
  code: 6003,
1372
- name: 'ComputeOutputSumFailed',
1373
- msg: 'ComputeOutputSumFailed',
1374
- },
1375
- {
1376
- code: 6004,
1377
- name: 'ComputeCompressSumFailed',
1378
- msg: 'ComputeCompressSumFailed',
1379
- },
1380
- {
1381
- code: 6005,
1382
- name: 'ComputeDecompressSumFailed',
1383
- msg: 'ComputeDecompressSumFailed',
1384
- },
1385
- {
1386
- code: 6006,
1387
- name: 'SumCheckFailed',
1388
- msg: 'SumCheckFailed',
1389
- },
1390
- {
1391
- code: 6007,
1392
- name: 'DecompressRecipientUndefinedForDecompress',
1393
- msg: 'DecompressRecipientUndefinedForDecompress',
1394
- },
1395
- {
1396
- code: 6008,
1397
- name: 'CompressedPdaUndefinedForDecompress',
1398
- msg: 'CompressedPdaUndefinedForDecompress',
1399
- },
1400
- {
1401
- code: 6009,
1402
- name: 'DeCompressAmountUndefinedForDecompress',
1403
- msg: 'DeCompressAmountUndefinedForDecompress',
1404
- },
1405
- {
1406
- code: 6010,
1407
- name: 'CompressedPdaUndefinedForCompress',
1408
- msg: 'CompressedPdaUndefinedForCompress',
1409
- },
1410
- {
1411
- code: 6011,
1412
- name: 'DeCompressAmountUndefinedForCompress',
1413
- msg: 'DeCompressAmountUndefinedForCompress',
1414
- },
1415
- {
1416
- code: 6012,
1417
- name: 'DelegateUndefined',
1418
- msg: 'DelegateUndefined while delegated amount is defined',
1419
- },
1420
- {
1421
- code: 6013,
1422
- name: 'DelegateSignerCheckFailed',
1423
- msg: 'DelegateSignerCheckFailed',
1424
- },
1425
- {
1426
- code: 6014,
1427
- name: 'SplTokenSupplyMismatch',
1428
- msg: 'SplTokenSupplyMismatch',
1429
- },
1430
- {
1431
- code: 6015,
1432
- name: 'HeapMemoryCheckFailed',
1433
- msg: 'HeapMemoryCheckFailed',
1434
- },
1435
- {
1436
- code: 6016,
1437
- name: 'InstructionNotCallable',
1438
- msg: 'The instruction is not callable',
1439
- },
1440
- {
1441
- code: 6017,
1442
- name: 'ArithmeticUnderflow',
1443
- msg: 'ArithmeticUnderflow',
1444
- },
1445
- {
1446
- code: 6018,
1447
- name: 'InvalidDelegate',
1448
- msg: 'InvalidDelegate',
1449
- },
1450
- {
1451
- code: 6019,
1452
- name: 'HashToFieldError',
1453
- msg: 'HashToFieldError',
1454
- },
1455
- {
1456
- code: 6020,
1457
- name: 'InvalidMint',
1458
- msg: 'InvalidMint',
1570
+ name: 'SerializationError',
1571
+ msg: 'Serialization error',
1459
1572
  },
1460
1573
  ],
1461
1574
  };
@@ -1486,11 +1599,13 @@ function packCompressedTokenAccounts(params) {
1486
1599
  merkleTreePubkeyIndex,
1487
1600
  nullifierQueuePubkeyIndex,
1488
1601
  leafIndex: account.compressedAccount.leafIndex,
1602
+ queueIndex: null,
1489
1603
  },
1490
1604
  rootIndex: rootIndices[index],
1491
1605
  lamports: account.compressedAccount.lamports.eq(stateless_js.bn(0))
1492
1606
  ? null
1493
1607
  : account.compressedAccount.lamports,
1608
+ tlv: null,
1494
1609
  });
1495
1610
  });
1496
1611
  /// pack output state trees
@@ -1506,6 +1621,7 @@ function packCompressedTokenAccounts(params) {
1506
1621
  ? null
1507
1622
  : tokenTransferOutputs[index].lamports,
1508
1623
  merkleTreeIndex,
1624
+ tlv: null,
1509
1625
  });
1510
1626
  });
1511
1627
  // to meta
@@ -6078,33 +6194,6 @@ function addSigners(keys, ownerOrAuthority, multiSigners) {
6078
6194
  return keys;
6079
6195
  }
6080
6196
 
6081
- /** TODO: docs */
6082
- const approveInstructionData = struct([u8('instruction'), u64('amount')]);
6083
- /**
6084
- * Construct an Approve instruction
6085
- *
6086
- * @param account Account to set the delegate for
6087
- * @param delegate Account authorized to transfer tokens from the account
6088
- * @param owner Owner of the account
6089
- * @param amount Maximum number of tokens the delegate may transfer
6090
- * @param multiSigners Signing accounts if `owner` is a multisig
6091
- * @param programId SPL Token program account
6092
- *
6093
- * @return Instruction to add to a transaction
6094
- */
6095
- function createApproveInstruction(account, delegate, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {
6096
- const keys = addSigners([
6097
- { pubkey: account, isSigner: false, isWritable: true },
6098
- { pubkey: delegate, isSigner: false, isWritable: false },
6099
- ], owner, multiSigners);
6100
- const data = Buffer.alloc(approveInstructionData.span);
6101
- approveInstructionData.encode({
6102
- instruction: TokenInstruction.Approve,
6103
- amount: BigInt(amount),
6104
- }, data);
6105
- return new web3_js.TransactionInstruction({ keys, programId, data });
6106
- }
6107
-
6108
6197
  var AccountType;
6109
6198
  (function (AccountType) {
6110
6199
  AccountType[AccountType["Uninitialized"] = 0] = "Uninitialized";
@@ -6428,6 +6517,7 @@ function createTransferOutputState(inputCompressedTokenAccounts, toAddress, amou
6428
6517
  owner: toAddress,
6429
6518
  amount,
6430
6519
  lamports: inputLamports,
6520
+ tlv: null,
6431
6521
  },
6432
6522
  ];
6433
6523
  }
@@ -6439,11 +6529,13 @@ function createTransferOutputState(inputCompressedTokenAccounts, toAddress, amou
6439
6529
  owner: inputCompressedTokenAccounts[0].parsed.owner,
6440
6530
  amount: changeAmount,
6441
6531
  lamports: inputLamports,
6532
+ tlv: null,
6442
6533
  },
6443
6534
  {
6444
6535
  owner: toAddress,
6445
6536
  amount,
6446
6537
  lamports: stateless_js.bn(0),
6538
+ tlv: null,
6447
6539
  },
6448
6540
  ];
6449
6541
  return outputCompressedAccounts;
@@ -6472,6 +6564,7 @@ function createDecompressOutputState(inputCompressedTokenAccounts, amount) {
6472
6564
  owner: inputCompressedTokenAccounts[0].parsed.owner,
6473
6565
  amount: changeAmount,
6474
6566
  lamports: inputLamports,
6567
+ tlv: null,
6475
6568
  },
6476
6569
  ];
6477
6570
  return tokenTransferOutputs;
@@ -6565,7 +6658,7 @@ class CompressedTokenProgram {
6565
6658
  const amounts = stateless_js.toArray(amount).map(amount => stateless_js.bn(amount));
6566
6659
  const toPubkeys = stateless_js.toArray(toPubkey);
6567
6660
  const instruction = await this.program.methods
6568
- .mintTo(toPubkeys, amounts)
6661
+ .mintTo(toPubkeys, amounts, null)
6569
6662
  .accounts({
6570
6663
  feePayer,
6571
6664
  authority,
@@ -6580,6 +6673,7 @@ class CompressedTokenProgram {
6580
6673
  accountCompressionProgram: systemKeys.accountCompressionProgram,
6581
6674
  merkleTree: merkleTree !== null && merkleTree !== void 0 ? merkleTree : stateless_js.defaultTestStateTreeAccounts().merkleTree,
6582
6675
  selfProgram: this.programId,
6676
+ solPoolPda: null,
6583
6677
  })
6584
6678
  .instruction();
6585
6679
  return instruction;
@@ -6594,7 +6688,7 @@ class CompressedTokenProgram {
6594
6688
  /// 1. Mint to existing ATA of mintAuthority.
6595
6689
  const splMintToInstruction = createMintToInstruction(mint, authorityTokenAccount, authority, amount);
6596
6690
  /// 2. Compress from mint authority ATA to recipient compressed account
6597
- const [approveInstruction, compressInstruction] = await this.compress({
6691
+ const compressInstruction = await this.compress({
6598
6692
  payer: feePayer,
6599
6693
  owner: authority,
6600
6694
  source: authorityTokenAccount,
@@ -6603,7 +6697,7 @@ class CompressedTokenProgram {
6603
6697
  amount: params.amount,
6604
6698
  outputStateTree: merkleTree,
6605
6699
  });
6606
- return [splMintToInstruction, approveInstruction, compressInstruction];
6700
+ return [splMintToInstruction, compressInstruction];
6607
6701
  }
6608
6702
  /**
6609
6703
  * Construct transfer instruction for compressed tokens
@@ -6627,6 +6721,7 @@ class CompressedTokenProgram {
6627
6721
  compressOrDecompressAmount: null,
6628
6722
  isCompress: false,
6629
6723
  cpiContext: null,
6724
+ lamportsChangeAccountMerkleTreeIndex: null,
6630
6725
  };
6631
6726
  const encodedData = this.program.coder.types.encode('CompressedTokenInstructionDataTransfer', data);
6632
6727
  const { accountCompressionAuthority, noopProgram, registeredProgramPda, accountCompressionProgram, } = stateless_js.defaultStaticAccountsStruct();
@@ -6651,8 +6746,8 @@ class CompressedTokenProgram {
6651
6746
  return instruction;
6652
6747
  }
6653
6748
  /**
6654
- * Construct approve and compress instructions
6655
- * @returns [approveInstruction, compressInstruction]
6749
+ * Construct compress instruction
6750
+ * @returns compressInstruction
6656
6751
  */
6657
6752
  static async compress(params) {
6658
6753
  const { payer, owner, source, toAddress, mint, outputStateTree } = params;
@@ -6662,6 +6757,7 @@ class CompressedTokenProgram {
6662
6757
  owner: toAddress,
6663
6758
  amount,
6664
6759
  lamports: stateless_js.bn(0),
6760
+ tlv: null,
6665
6761
  },
6666
6762
  ];
6667
6763
  const { inputTokenDataWithContext, packedOutputTokenData, remainingAccountMetas, } = packCompressedTokenAccounts({
@@ -6679,10 +6775,10 @@ class CompressedTokenProgram {
6679
6775
  compressOrDecompressAmount: amount,
6680
6776
  isCompress: true,
6681
6777
  cpiContext: null,
6778
+ lamportsChangeAccountMerkleTreeIndex: null,
6682
6779
  };
6683
6780
  const encodedData = this.program.coder.types.encode('CompressedTokenInstructionDataTransfer', data);
6684
6781
  const { accountCompressionAuthority, noopProgram, registeredProgramPda, accountCompressionProgram, } = stateless_js.defaultStaticAccountsStruct();
6685
- const approveInstruction = createApproveInstruction(source, this.deriveCpiAuthorityPda, owner, BigInt(amount.toString()));
6686
6782
  const instruction = await this.program.methods
6687
6783
  .transfer(encodedData)
6688
6784
  .accounts({
@@ -6701,7 +6797,7 @@ class CompressedTokenProgram {
6701
6797
  })
6702
6798
  .remainingAccounts(remainingAccountMetas)
6703
6799
  .instruction();
6704
- return [approveInstruction, instruction];
6800
+ return instruction;
6705
6801
  }
6706
6802
  /**
6707
6803
  * Construct decompress instruction
@@ -6727,6 +6823,7 @@ class CompressedTokenProgram {
6727
6823
  compressOrDecompressAmount: amount,
6728
6824
  isCompress: false,
6729
6825
  cpiContext: null,
6826
+ lamportsChangeAccountMerkleTreeIndex: null,
6730
6827
  };
6731
6828
  const encodedData = this.program.coder.types.encode('CompressedTokenInstructionDataTransfer', data);
6732
6829
  const { accountCompressionAuthority, noopProgram, registeredProgramPda, accountCompressionProgram, } = stateless_js.defaultStaticAccountsStruct();
@@ -6813,7 +6910,7 @@ async function approveAndMintTo(rpc, payer, mint, destination, authority, amount
6813
6910
  */
6814
6911
  async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toAddress, merkleTree, confirmOptions) {
6815
6912
  amount = stateless_js.bn(amount);
6816
- const [approveIx, compressIx] = await CompressedTokenProgram.compress({
6913
+ const compressIx = await CompressedTokenProgram.compress({
6817
6914
  payer: payer.publicKey,
6818
6915
  owner: owner.publicKey,
6819
6916
  source: sourceTokenAccount,
@@ -6828,7 +6925,6 @@ async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toA
6828
6925
  web3_js.ComputeBudgetProgram.setComputeUnitLimit({
6829
6926
  units: 1000000,
6830
6927
  }),
6831
- approveIx,
6832
6928
  compressIx,
6833
6929
  ], payer, blockhashCtx.blockhash, additionalSigners);
6834
6930
  const txId = await stateless_js.sendAndConfirmTx(rpc, signedTx, confirmOptions, blockhashCtx);