@lightprotocol/compressed-token 0.3.4 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,22 +5,23 @@ var web3_js = require('@solana/web3.js');
5
5
  var anchor = require('@coral-xyz/anchor');
6
6
 
7
7
  const IDL = {
8
- version: '0.4.1',
8
+ version: '0.5.0',
9
9
  name: 'light_compressed_token',
10
10
  instructions: [
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
  },
@@ -818,9 +927,9 @@ const IDL = {
818
927
  {
819
928
  name: 'delegatedTransfer',
820
929
  docs: [
821
- '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,',
822
932
  'owner = Some(owner) is the owner of the token account.',
823
- 'Is set if the signer is delegate',
824
933
  ],
825
934
  type: {
826
935
  option: {
@@ -862,11 +971,20 @@ const IDL = {
862
971
  },
863
972
  },
864
973
  },
974
+ {
975
+ name: 'lamportsChangeAccountMerkleTreeIndex',
976
+ type: {
977
+ option: 'u8',
978
+ },
979
+ },
865
980
  ],
866
981
  },
867
982
  },
868
983
  {
869
984
  name: 'DelegatedTransfer',
985
+ docs: [
986
+ 'Struct to provide the owner when the delegate is signer of the transaction.',
987
+ ],
870
988
  type: {
871
989
  kind: 'struct',
872
990
  fields: [
@@ -876,7 +994,15 @@ const IDL = {
876
994
  },
877
995
  {
878
996
  name: 'delegateChangeAccountIndex',
879
- 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
+ },
880
1006
  },
881
1007
  ],
882
1008
  },
@@ -912,6 +1038,15 @@ const IDL = {
912
1038
  option: 'u64',
913
1039
  },
914
1040
  },
1041
+ {
1042
+ name: 'tlv',
1043
+ docs: [
1044
+ 'Placeholder for TokenExtension tlv data (unimplemented)',
1045
+ ],
1046
+ type: {
1047
+ option: 'bytes',
1048
+ },
1049
+ },
915
1050
  ],
916
1051
  },
917
1052
  },
@@ -1173,6 +1308,18 @@ const IDL = {
1173
1308
  name: 'leafIndex',
1174
1309
  type: 'u32',
1175
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
+ },
1176
1323
  ],
1177
1324
  },
1178
1325
  },
@@ -1199,6 +1346,15 @@ const IDL = {
1199
1346
  name: 'merkleTreeIndex',
1200
1347
  type: 'u8',
1201
1348
  },
1349
+ {
1350
+ name: 'tlv',
1351
+ docs: [
1352
+ 'Placeholder for TokenExtension tlv data (unimplemented)',
1353
+ ],
1354
+ type: {
1355
+ option: 'bytes',
1356
+ },
1357
+ },
1202
1358
  ],
1203
1359
  },
1204
1360
  },
@@ -1276,6 +1432,24 @@ const IDL = {
1276
1432
  ],
1277
1433
  },
1278
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
+ },
1279
1453
  {
1280
1454
  name: 'RolloverMetadata',
1281
1455
  type: {
@@ -1362,6 +1536,15 @@ const IDL = {
1362
1536
  defined: 'AccountState',
1363
1537
  },
1364
1538
  },
1539
+ {
1540
+ name: 'tlv',
1541
+ docs: [
1542
+ 'Placeholder for TokenExtension tlv data (unimplemented)',
1543
+ ],
1544
+ type: {
1545
+ option: 'bytes',
1546
+ },
1547
+ },
1365
1548
  ],
1366
1549
  },
1367
1550
  },
@@ -1369,23 +1552,107 @@ const IDL = {
1369
1552
  errors: [
1370
1553
  {
1371
1554
  code: 6000,
1372
- name: 'SignerCheckFailed',
1373
- msg: 'Signer check failed',
1555
+ name: 'PublicKeyAmountMissmatch',
1556
+ msg: 'public keys and amounts must be of same length',
1374
1557
  },
1375
1558
  {
1376
1559
  code: 6001,
1377
- name: 'CreateTransferInstructionFailed',
1378
- msg: 'Create transfer instruction failed',
1560
+ name: 'ComputeInputSumFailed',
1561
+ msg: 'ComputeInputSumFailed',
1379
1562
  },
1380
1563
  {
1381
1564
  code: 6002,
1382
- name: 'AccountNotFound',
1383
- msg: 'Account not found',
1565
+ name: 'ComputeOutputSumFailed',
1566
+ msg: 'ComputeOutputSumFailed',
1384
1567
  },
1385
1568
  {
1386
1569
  code: 6003,
1387
- name: 'SerializationError',
1388
- msg: 'Serialization error',
1570
+ name: 'ComputeCompressSumFailed',
1571
+ msg: 'ComputeCompressSumFailed',
1572
+ },
1573
+ {
1574
+ code: 6004,
1575
+ name: 'ComputeDecompressSumFailed',
1576
+ msg: 'ComputeDecompressSumFailed',
1577
+ },
1578
+ {
1579
+ code: 6005,
1580
+ name: 'SumCheckFailed',
1581
+ msg: 'SumCheckFailed',
1582
+ },
1583
+ {
1584
+ code: 6006,
1585
+ name: 'DecompressRecipientUndefinedForDecompress',
1586
+ msg: 'DecompressRecipientUndefinedForDecompress',
1587
+ },
1588
+ {
1589
+ code: 6007,
1590
+ name: 'CompressedPdaUndefinedForDecompress',
1591
+ msg: 'CompressedPdaUndefinedForDecompress',
1592
+ },
1593
+ {
1594
+ code: 6008,
1595
+ name: 'DeCompressAmountUndefinedForDecompress',
1596
+ msg: 'DeCompressAmountUndefinedForDecompress',
1597
+ },
1598
+ {
1599
+ code: 6009,
1600
+ name: 'CompressedPdaUndefinedForCompress',
1601
+ msg: 'CompressedPdaUndefinedForCompress',
1602
+ },
1603
+ {
1604
+ code: 6010,
1605
+ name: 'DeCompressAmountUndefinedForCompress',
1606
+ msg: 'DeCompressAmountUndefinedForCompress',
1607
+ },
1608
+ {
1609
+ code: 6011,
1610
+ name: 'DelegateSignerCheckFailed',
1611
+ msg: 'DelegateSignerCheckFailed',
1612
+ },
1613
+ {
1614
+ code: 6012,
1615
+ name: 'MintTooLarge',
1616
+ msg: 'Minted amount greater than u64::MAX',
1617
+ },
1618
+ {
1619
+ code: 6013,
1620
+ name: 'SplTokenSupplyMismatch',
1621
+ msg: 'SplTokenSupplyMismatch',
1622
+ },
1623
+ {
1624
+ code: 6014,
1625
+ name: 'HeapMemoryCheckFailed',
1626
+ msg: 'HeapMemoryCheckFailed',
1627
+ },
1628
+ {
1629
+ code: 6015,
1630
+ name: 'InstructionNotCallable',
1631
+ msg: 'The instruction is not callable',
1632
+ },
1633
+ {
1634
+ code: 6016,
1635
+ name: 'ArithmeticUnderflow',
1636
+ msg: 'ArithmeticUnderflow',
1637
+ },
1638
+ {
1639
+ code: 6017,
1640
+ name: 'HashToFieldError',
1641
+ msg: 'HashToFieldError',
1642
+ },
1643
+ {
1644
+ code: 6018,
1645
+ name: 'InvalidAuthorityMint',
1646
+ msg: 'Expected the authority to be also a mint authority',
1647
+ },
1648
+ {
1649
+ code: 6019,
1650
+ name: 'InvalidFreezeAuthority',
1651
+ msg: 'Provided authority is not the freeze authority',
1652
+ },
1653
+ {
1654
+ code: 6020,
1655
+ name: 'InvalidDelegateIndex',
1389
1656
  },
1390
1657
  ],
1391
1658
  };
@@ -1416,11 +1683,13 @@ function packCompressedTokenAccounts(params) {
1416
1683
  merkleTreePubkeyIndex,
1417
1684
  nullifierQueuePubkeyIndex,
1418
1685
  leafIndex: account.compressedAccount.leafIndex,
1686
+ queueIndex: null,
1419
1687
  },
1420
1688
  rootIndex: rootIndices[index],
1421
1689
  lamports: account.compressedAccount.lamports.eq(stateless_js.bn(0))
1422
1690
  ? null
1423
1691
  : account.compressedAccount.lamports,
1692
+ tlv: null,
1424
1693
  });
1425
1694
  });
1426
1695
  /// pack output state trees
@@ -1436,6 +1705,7 @@ function packCompressedTokenAccounts(params) {
1436
1705
  ? null
1437
1706
  : tokenTransferOutputs[index].lamports,
1438
1707
  merkleTreeIndex,
1708
+ tlv: null,
1439
1709
  });
1440
1710
  });
1441
1711
  // to meta
@@ -6008,33 +6278,6 @@ function addSigners(keys, ownerOrAuthority, multiSigners) {
6008
6278
  return keys;
6009
6279
  }
6010
6280
 
6011
- /** TODO: docs */
6012
- const approveInstructionData = struct([u8('instruction'), u64('amount')]);
6013
- /**
6014
- * Construct an Approve instruction
6015
- *
6016
- * @param account Account to set the delegate for
6017
- * @param delegate Account authorized to transfer tokens from the account
6018
- * @param owner Owner of the account
6019
- * @param amount Maximum number of tokens the delegate may transfer
6020
- * @param multiSigners Signing accounts if `owner` is a multisig
6021
- * @param programId SPL Token program account
6022
- *
6023
- * @return Instruction to add to a transaction
6024
- */
6025
- function createApproveInstruction(account, delegate, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {
6026
- const keys = addSigners([
6027
- { pubkey: account, isSigner: false, isWritable: true },
6028
- { pubkey: delegate, isSigner: false, isWritable: false },
6029
- ], owner, multiSigners);
6030
- const data = Buffer.alloc(approveInstructionData.span);
6031
- approveInstructionData.encode({
6032
- instruction: TokenInstruction.Approve,
6033
- amount: BigInt(amount),
6034
- }, data);
6035
- return new web3_js.TransactionInstruction({ keys, programId, data });
6036
- }
6037
-
6038
6281
  var AccountType;
6039
6282
  (function (AccountType) {
6040
6283
  AccountType[AccountType["Uninitialized"] = 0] = "Uninitialized";
@@ -6358,6 +6601,7 @@ function createTransferOutputState(inputCompressedTokenAccounts, toAddress, amou
6358
6601
  owner: toAddress,
6359
6602
  amount,
6360
6603
  lamports: inputLamports,
6604
+ tlv: null,
6361
6605
  },
6362
6606
  ];
6363
6607
  }
@@ -6369,11 +6613,13 @@ function createTransferOutputState(inputCompressedTokenAccounts, toAddress, amou
6369
6613
  owner: inputCompressedTokenAccounts[0].parsed.owner,
6370
6614
  amount: changeAmount,
6371
6615
  lamports: inputLamports,
6616
+ tlv: null,
6372
6617
  },
6373
6618
  {
6374
6619
  owner: toAddress,
6375
6620
  amount,
6376
6621
  lamports: stateless_js.bn(0),
6622
+ tlv: null,
6377
6623
  },
6378
6624
  ];
6379
6625
  return outputCompressedAccounts;
@@ -6402,6 +6648,7 @@ function createDecompressOutputState(inputCompressedTokenAccounts, amount) {
6402
6648
  owner: inputCompressedTokenAccounts[0].parsed.owner,
6403
6649
  amount: changeAmount,
6404
6650
  lamports: inputLamports,
6651
+ tlv: null,
6405
6652
  },
6406
6653
  ];
6407
6654
  return tokenTransferOutputs;
@@ -6495,7 +6742,7 @@ class CompressedTokenProgram {
6495
6742
  const amounts = stateless_js.toArray(amount).map(amount => stateless_js.bn(amount));
6496
6743
  const toPubkeys = stateless_js.toArray(toPubkey);
6497
6744
  const instruction = await this.program.methods
6498
- .mintTo(toPubkeys, amounts)
6745
+ .mintTo(toPubkeys, amounts, null)
6499
6746
  .accounts({
6500
6747
  feePayer,
6501
6748
  authority,
@@ -6510,6 +6757,7 @@ class CompressedTokenProgram {
6510
6757
  accountCompressionProgram: systemKeys.accountCompressionProgram,
6511
6758
  merkleTree: merkleTree !== null && merkleTree !== void 0 ? merkleTree : stateless_js.defaultTestStateTreeAccounts().merkleTree,
6512
6759
  selfProgram: this.programId,
6760
+ solPoolPda: null,
6513
6761
  })
6514
6762
  .instruction();
6515
6763
  return instruction;
@@ -6524,7 +6772,7 @@ class CompressedTokenProgram {
6524
6772
  /// 1. Mint to existing ATA of mintAuthority.
6525
6773
  const splMintToInstruction = createMintToInstruction(mint, authorityTokenAccount, authority, amount);
6526
6774
  /// 2. Compress from mint authority ATA to recipient compressed account
6527
- const [approveInstruction, compressInstruction] = await this.compress({
6775
+ const compressInstruction = await this.compress({
6528
6776
  payer: feePayer,
6529
6777
  owner: authority,
6530
6778
  source: authorityTokenAccount,
@@ -6533,7 +6781,7 @@ class CompressedTokenProgram {
6533
6781
  amount: params.amount,
6534
6782
  outputStateTree: merkleTree,
6535
6783
  });
6536
- return [splMintToInstruction, approveInstruction, compressInstruction];
6784
+ return [splMintToInstruction, compressInstruction];
6537
6785
  }
6538
6786
  /**
6539
6787
  * Construct transfer instruction for compressed tokens
@@ -6557,6 +6805,7 @@ class CompressedTokenProgram {
6557
6805
  compressOrDecompressAmount: null,
6558
6806
  isCompress: false,
6559
6807
  cpiContext: null,
6808
+ lamportsChangeAccountMerkleTreeIndex: null,
6560
6809
  };
6561
6810
  const encodedData = this.program.coder.types.encode('CompressedTokenInstructionDataTransfer', data);
6562
6811
  const { accountCompressionAuthority, noopProgram, registeredProgramPda, accountCompressionProgram, } = stateless_js.defaultStaticAccountsStruct();
@@ -6581,8 +6830,8 @@ class CompressedTokenProgram {
6581
6830
  return instruction;
6582
6831
  }
6583
6832
  /**
6584
- * Construct approve and compress instructions
6585
- * @returns [approveInstruction, compressInstruction]
6833
+ * Construct compress instruction
6834
+ * @returns compressInstruction
6586
6835
  */
6587
6836
  static async compress(params) {
6588
6837
  const { payer, owner, source, toAddress, mint, outputStateTree } = params;
@@ -6592,6 +6841,7 @@ class CompressedTokenProgram {
6592
6841
  owner: toAddress,
6593
6842
  amount,
6594
6843
  lamports: stateless_js.bn(0),
6844
+ tlv: null,
6595
6845
  },
6596
6846
  ];
6597
6847
  const { inputTokenDataWithContext, packedOutputTokenData, remainingAccountMetas, } = packCompressedTokenAccounts({
@@ -6609,10 +6859,10 @@ class CompressedTokenProgram {
6609
6859
  compressOrDecompressAmount: amount,
6610
6860
  isCompress: true,
6611
6861
  cpiContext: null,
6862
+ lamportsChangeAccountMerkleTreeIndex: null,
6612
6863
  };
6613
6864
  const encodedData = this.program.coder.types.encode('CompressedTokenInstructionDataTransfer', data);
6614
6865
  const { accountCompressionAuthority, noopProgram, registeredProgramPda, accountCompressionProgram, } = stateless_js.defaultStaticAccountsStruct();
6615
- const approveInstruction = createApproveInstruction(source, this.deriveCpiAuthorityPda, owner, BigInt(amount.toString()));
6616
6866
  const instruction = await this.program.methods
6617
6867
  .transfer(encodedData)
6618
6868
  .accounts({
@@ -6631,7 +6881,7 @@ class CompressedTokenProgram {
6631
6881
  })
6632
6882
  .remainingAccounts(remainingAccountMetas)
6633
6883
  .instruction();
6634
- return [approveInstruction, instruction];
6884
+ return instruction;
6635
6885
  }
6636
6886
  /**
6637
6887
  * Construct decompress instruction
@@ -6657,6 +6907,7 @@ class CompressedTokenProgram {
6657
6907
  compressOrDecompressAmount: amount,
6658
6908
  isCompress: false,
6659
6909
  cpiContext: null,
6910
+ lamportsChangeAccountMerkleTreeIndex: null,
6660
6911
  };
6661
6912
  const encodedData = this.program.coder.types.encode('CompressedTokenInstructionDataTransfer', data);
6662
6913
  const { accountCompressionAuthority, noopProgram, registeredProgramPda, accountCompressionProgram, } = stateless_js.defaultStaticAccountsStruct();
@@ -6743,7 +6994,7 @@ async function approveAndMintTo(rpc, payer, mint, destination, authority, amount
6743
6994
  */
6744
6995
  async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toAddress, merkleTree, confirmOptions) {
6745
6996
  amount = stateless_js.bn(amount);
6746
- const [approveIx, compressIx] = await CompressedTokenProgram.compress({
6997
+ const compressIx = await CompressedTokenProgram.compress({
6747
6998
  payer: payer.publicKey,
6748
6999
  owner: owner.publicKey,
6749
7000
  source: sourceTokenAccount,
@@ -6758,7 +7009,6 @@ async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toA
6758
7009
  web3_js.ComputeBudgetProgram.setComputeUnitLimit({
6759
7010
  units: 1000000,
6760
7011
  }),
6761
- approveIx,
6762
7012
  compressIx,
6763
7013
  ], payer, blockhashCtx.blockhash, additionalSigners);
6764
7014
  const txId = await stateless_js.sendAndConfirmTx(rpc, signedTx, confirmOptions, blockhashCtx);