@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.
@@ -6,22 +6,23 @@ var anchor = require('@coral-xyz/anchor');
6
6
  var require$$0 = require('buffer');
7
7
 
8
8
  const IDL = {
9
- version: '0.4.1',
9
+ version: '0.5.0',
10
10
  name: 'light_compressed_token',
11
11
  instructions: [
12
12
  {
13
13
  name: 'createTokenPool',
14
14
  docs: [
15
- 'This instruction expects a mint account to be created in a separate',
16
- 'token program instruction with token authority as mint authority. This',
17
- 'instruction creates a token pool account for that mint owned by token',
18
- 'authority.',
15
+ 'This instruction creates a token pool for a given mint. Every spl mint',
16
+ 'can have one token pool. When a token is compressed the tokens are',
17
+ 'transferrred to the token pool, and their compressed equivalent is',
18
+ 'minted into a Merkle tree.',
19
19
  ],
20
20
  accounts: [
21
21
  {
22
22
  name: 'feePayer',
23
23
  isMut: true,
24
24
  isSigner: true,
25
+ docs: ['UNCHECKED: only pays fees.'],
25
26
  },
26
27
  {
27
28
  name: 'tokenPoolPda',
@@ -57,13 +58,17 @@ const IDL = {
57
58
  'Mints tokens from an spl token mint to a list of compressed accounts.',
58
59
  'Minted tokens are transferred to a pool account owned by the compressed',
59
60
  'token program. The instruction creates one compressed output account for',
60
- 'every amount and pubkey input pair one output compressed account.',
61
+ 'every amount and pubkey input pair. A constant amount of lamports can be',
62
+ 'transferred to each output account to enable. A use case to add lamports',
63
+ 'to a compressed token account is to prevent spam. This is the only way',
64
+ 'to add lamports to a compressed token account.',
61
65
  ],
62
66
  accounts: [
63
67
  {
64
68
  name: 'feePayer',
65
69
  isMut: true,
66
70
  isSigner: true,
71
+ docs: ['UNCHECKED: only pays fees.'],
67
72
  },
68
73
  {
69
74
  name: 'authority',
@@ -84,6 +89,9 @@ const IDL = {
84
89
  name: 'tokenPoolPda',
85
90
  isMut: true,
86
91
  isSigner: false,
92
+ docs: [
93
+ 'account to a token account of a different mint will fail',
94
+ ],
87
95
  },
88
96
  {
89
97
  name: 'tokenProgram',
@@ -104,6 +112,7 @@ const IDL = {
104
112
  name: 'noopProgram',
105
113
  isMut: false,
106
114
  isSigner: false,
115
+ docs: ['programs'],
107
116
  },
108
117
  {
109
118
  name: 'accountCompressionAuthority',
@@ -130,6 +139,12 @@ const IDL = {
130
139
  isMut: false,
131
140
  isSigner: false,
132
141
  },
142
+ {
143
+ name: 'solPoolPda',
144
+ isMut: true,
145
+ isSigner: false,
146
+ isOptional: true,
147
+ },
133
148
  ],
134
149
  args: [
135
150
  {
@@ -144,20 +159,42 @@ const IDL = {
144
159
  vec: 'u64',
145
160
  },
146
161
  },
162
+ {
163
+ name: 'lamports',
164
+ type: {
165
+ option: 'u64',
166
+ },
167
+ },
147
168
  ],
148
169
  },
149
170
  {
150
171
  name: 'transfer',
172
+ docs: [
173
+ 'Transfers compressed tokens from one account to another. All accounts',
174
+ 'must be of the same mint. Additional spl tokens can be compressed or',
175
+ 'decompressed. In one transaction only compression or decompression is',
176
+ 'possible. Lamports can be transferred alongside tokens. If output token',
177
+ 'accounts specify less lamports than inputs the remaining lamports are',
178
+ 'transferred to an output compressed account. Signer must be owner or',
179
+ 'delegate. If a delegated token account is transferred the delegate is',
180
+ 'not preserved.',
181
+ ],
151
182
  accounts: [
152
183
  {
153
184
  name: 'feePayer',
154
185
  isMut: true,
155
186
  isSigner: true,
187
+ docs: ['UNCHECKED: only pays fees.'],
156
188
  },
157
189
  {
158
190
  name: 'authority',
159
191
  isMut: false,
160
192
  isSigner: true,
193
+ docs: [
194
+ 'Authority is verified through proof since both owner and delegate',
195
+ 'are included in the token data hash, which is a public input to the',
196
+ 'validity proof.',
197
+ ],
161
198
  },
162
199
  {
163
200
  name: 'cpiAuthorityPda',
@@ -193,6 +230,10 @@ const IDL = {
193
230
  name: 'selfProgram',
194
231
  isMut: false,
195
232
  isSigner: false,
233
+ docs: [
234
+ '(different program) checked in light system program to derive',
235
+ 'cpi_authority_pda and check that this program is the signer of the cpi.',
236
+ ],
196
237
  },
197
238
  {
198
239
  name: 'tokenPoolPda',
@@ -227,16 +268,30 @@ const IDL = {
227
268
  },
228
269
  {
229
270
  name: 'approve',
271
+ docs: [
272
+ 'Delegates an amount to a delegate. A compressed token account is either',
273
+ 'completely delegated or not. Prior delegates are not preserved. Cannot',
274
+ 'be called by a delegate.',
275
+ 'The instruction creates two output accounts:',
276
+ '1. one account with delegated amount',
277
+ '2. one account with remaining(change) amount',
278
+ ],
230
279
  accounts: [
231
280
  {
232
281
  name: 'feePayer',
233
282
  isMut: true,
234
283
  isSigner: true,
284
+ docs: ['UNCHECKED: only pays fees.'],
235
285
  },
236
286
  {
237
287
  name: 'authority',
238
288
  isMut: false,
239
289
  isSigner: true,
290
+ docs: [
291
+ 'Authority is verified through proof since both owner and delegate',
292
+ 'are included in the token data hash, which is a public input to the',
293
+ 'validity proof.',
294
+ ],
240
295
  },
241
296
  {
242
297
  name: 'cpiAuthorityPda',
@@ -272,6 +327,10 @@ const IDL = {
272
327
  name: 'selfProgram',
273
328
  isMut: false,
274
329
  isSigner: false,
330
+ docs: [
331
+ '(different program) checked in light system program to derive',
332
+ 'cpi_authority_pda and check that this program is the signer of the cpi.',
333
+ ],
275
334
  },
276
335
  {
277
336
  name: 'systemProgram',
@@ -288,16 +347,26 @@ const IDL = {
288
347
  },
289
348
  {
290
349
  name: 'revoke',
350
+ docs: [
351
+ 'Revokes a delegation. The instruction merges all inputs into one output',
352
+ 'account. Cannot be called by a delegate. Delegates are not preserved.',
353
+ ],
291
354
  accounts: [
292
355
  {
293
356
  name: 'feePayer',
294
357
  isMut: true,
295
358
  isSigner: true,
359
+ docs: ['UNCHECKED: only pays fees.'],
296
360
  },
297
361
  {
298
362
  name: 'authority',
299
363
  isMut: false,
300
364
  isSigner: true,
365
+ docs: [
366
+ 'Authority is verified through proof since both owner and delegate',
367
+ 'are included in the token data hash, which is a public input to the',
368
+ 'validity proof.',
369
+ ],
301
370
  },
302
371
  {
303
372
  name: 'cpiAuthorityPda',
@@ -333,6 +402,10 @@ const IDL = {
333
402
  name: 'selfProgram',
334
403
  isMut: false,
335
404
  isSigner: false,
405
+ docs: [
406
+ '(different program) checked in light system program to derive',
407
+ 'cpi_authority_pda and check that this program is the signer of the cpi.',
408
+ ],
336
409
  },
337
410
  {
338
411
  name: 'systemProgram',
@@ -349,11 +422,16 @@ const IDL = {
349
422
  },
350
423
  {
351
424
  name: 'freeze',
425
+ docs: [
426
+ 'Freezes compressed token accounts. Inputs must not be frozen. Creates as',
427
+ 'many outputs as inputs. Balances and delegates are preserved.',
428
+ ],
352
429
  accounts: [
353
430
  {
354
431
  name: 'feePayer',
355
432
  isMut: true,
356
433
  isSigner: true,
434
+ docs: ['UNCHECKED: only pays fees.'],
357
435
  },
358
436
  {
359
437
  name: 'authority',
@@ -394,6 +472,10 @@ const IDL = {
394
472
  name: 'selfProgram',
395
473
  isMut: false,
396
474
  isSigner: false,
475
+ docs: [
476
+ '(different program) checked in light system program to derive',
477
+ 'cpi_authority_pda and check that this program is the signer of the cpi.',
478
+ ],
397
479
  },
398
480
  {
399
481
  name: 'systemProgram',
@@ -415,11 +497,16 @@ const IDL = {
415
497
  },
416
498
  {
417
499
  name: 'thaw',
500
+ docs: [
501
+ 'Thaws frozen compressed token accounts. Inputs must be frozen. Creates',
502
+ 'as many outputs as inputs. Balances and delegates are preserved.',
503
+ ],
418
504
  accounts: [
419
505
  {
420
506
  name: 'feePayer',
421
507
  isMut: true,
422
508
  isSigner: true,
509
+ docs: ['UNCHECKED: only pays fees.'],
423
510
  },
424
511
  {
425
512
  name: 'authority',
@@ -460,6 +547,10 @@ const IDL = {
460
547
  name: 'selfProgram',
461
548
  isMut: false,
462
549
  isSigner: false,
550
+ docs: [
551
+ '(different program) checked in light system program to derive',
552
+ 'cpi_authority_pda and check that this program is the signer of the cpi.',
553
+ ],
463
554
  },
464
555
  {
465
556
  name: 'systemProgram',
@@ -481,22 +572,48 @@ const IDL = {
481
572
  },
482
573
  {
483
574
  name: 'burn',
575
+ docs: [
576
+ 'Burns compressed tokens and spl tokens from the pool account. Delegates',
577
+ 'can burn tokens. The output compressed token account remains delegated.',
578
+ 'Creates one output compressed token account.',
579
+ ],
484
580
  accounts: [
485
581
  {
486
582
  name: 'feePayer',
487
583
  isMut: true,
488
584
  isSigner: true,
585
+ docs: ['UNCHECKED: only pays fees.'],
489
586
  },
490
587
  {
491
588
  name: 'authority',
492
589
  isMut: false,
493
590
  isSigner: true,
591
+ docs: [
592
+ 'Authority is verified through proof since both owner and delegate',
593
+ 'are included in the token data hash, which is a public input to the',
594
+ 'validity proof.',
595
+ ],
494
596
  },
495
597
  {
496
598
  name: 'cpiAuthorityPda',
497
599
  isMut: false,
498
600
  isSigner: false,
499
601
  },
602
+ {
603
+ name: 'mint',
604
+ isMut: true,
605
+ isSigner: false,
606
+ },
607
+ {
608
+ name: 'tokenPoolPda',
609
+ isMut: true,
610
+ isSigner: false,
611
+ },
612
+ {
613
+ name: 'tokenProgram',
614
+ isMut: false,
615
+ isSigner: false,
616
+ },
500
617
  {
501
618
  name: 'lightSystemProgram',
502
619
  isMut: false,
@@ -552,11 +669,17 @@ const IDL = {
552
669
  name: 'feePayer',
553
670
  isMut: true,
554
671
  isSigner: true,
672
+ docs: ['UNCHECKED: only pays fees.'],
555
673
  },
556
674
  {
557
675
  name: 'authority',
558
676
  isMut: false,
559
677
  isSigner: true,
678
+ docs: [
679
+ 'Authority is verified through proof since both owner and delegate',
680
+ 'are included in the token data hash, which is a public input to the',
681
+ 'validity proof.',
682
+ ],
560
683
  },
561
684
  {
562
685
  name: 'cpiAuthorityPda',
@@ -592,6 +715,10 @@ const IDL = {
592
715
  name: 'selfProgram',
593
716
  isMut: false,
594
717
  isSigner: false,
718
+ docs: [
719
+ '(different program) checked in light system program to derive',
720
+ 'cpi_authority_pda and check that this program is the signer of the cpi.',
721
+ ],
595
722
  },
596
723
  {
597
724
  name: 'tokenPoolPda',
@@ -633,24 +760,6 @@ const IDL = {
633
760
  ],
634
761
  },
635
762
  ],
636
- accounts: [
637
- {
638
- name: 'RegisteredProgram',
639
- type: {
640
- kind: 'struct',
641
- fields: [
642
- {
643
- name: 'registeredProgramId',
644
- type: 'publicKey',
645
- },
646
- {
647
- name: 'groupAuthorityPda',
648
- type: 'publicKey',
649
- },
650
- ],
651
- },
652
- },
653
- ],
654
763
  types: [
655
764
  {
656
765
  name: 'AccessMetadata',
@@ -665,7 +774,7 @@ const IDL = {
665
774
  {
666
775
  name: 'programOwner',
667
776
  docs: [
668
- 'Delegate of the Merkle tree. This will be used for program owned Merkle trees.',
777
+ 'Program owner of the Merkle tree. This will be used for program owned Merkle trees.',
669
778
  ],
670
779
  type: 'publicKey',
671
780
  },
@@ -819,9 +928,9 @@ const IDL = {
819
928
  {
820
929
  name: 'delegatedTransfer',
821
930
  docs: [
822
- 'If the signer is a delegate, the delegate index is index 0 of remaining accounts.',
931
+ 'Is required if the signer is delegate,',
932
+ '-> delegate is authority account,',
823
933
  'owner = Some(owner) is the owner of the token account.',
824
- 'Is set if the signer is delegate',
825
934
  ],
826
935
  type: {
827
936
  option: {
@@ -863,11 +972,20 @@ const IDL = {
863
972
  },
864
973
  },
865
974
  },
975
+ {
976
+ name: 'lamportsChangeAccountMerkleTreeIndex',
977
+ type: {
978
+ option: 'u8',
979
+ },
980
+ },
866
981
  ],
867
982
  },
868
983
  },
869
984
  {
870
985
  name: 'DelegatedTransfer',
986
+ docs: [
987
+ 'Struct to provide the owner when the delegate is signer of the transaction.',
988
+ ],
871
989
  type: {
872
990
  kind: 'struct',
873
991
  fields: [
@@ -877,7 +995,15 @@ const IDL = {
877
995
  },
878
996
  {
879
997
  name: 'delegateChangeAccountIndex',
880
- type: 'u8',
998
+ docs: [
999
+ 'Index of change compressed account in output compressed accounts. In',
1000
+ "case that the delegate didn't spend the complete delegated compressed",
1001
+ 'account balance the change compressed account will be delegated to her',
1002
+ 'as well.',
1003
+ ],
1004
+ type: {
1005
+ option: 'u8',
1006
+ },
881
1007
  },
882
1008
  ],
883
1009
  },
@@ -913,6 +1039,15 @@ const IDL = {
913
1039
  option: 'u64',
914
1040
  },
915
1041
  },
1042
+ {
1043
+ name: 'tlv',
1044
+ docs: [
1045
+ 'Placeholder for TokenExtension tlv data (unimplemented)',
1046
+ ],
1047
+ type: {
1048
+ option: 'bytes',
1049
+ },
1050
+ },
916
1051
  ],
917
1052
  },
918
1053
  },
@@ -1174,6 +1309,18 @@ const IDL = {
1174
1309
  name: 'leafIndex',
1175
1310
  type: 'u32',
1176
1311
  },
1312
+ {
1313
+ name: 'queueIndex',
1314
+ docs: [
1315
+ 'Index of leaf in queue. Placeholder of batched Merkle tree updates',
1316
+ 'currently unimplemented.',
1317
+ ],
1318
+ type: {
1319
+ option: {
1320
+ defined: 'QueueIndex',
1321
+ },
1322
+ },
1323
+ },
1177
1324
  ],
1178
1325
  },
1179
1326
  },
@@ -1200,6 +1347,15 @@ const IDL = {
1200
1347
  name: 'merkleTreeIndex',
1201
1348
  type: 'u8',
1202
1349
  },
1350
+ {
1351
+ name: 'tlv',
1352
+ docs: [
1353
+ 'Placeholder for TokenExtension tlv data (unimplemented)',
1354
+ ],
1355
+ type: {
1356
+ option: 'bytes',
1357
+ },
1358
+ },
1203
1359
  ],
1204
1360
  },
1205
1361
  },
@@ -1277,6 +1433,24 @@ const IDL = {
1277
1433
  ],
1278
1434
  },
1279
1435
  },
1436
+ {
1437
+ name: 'QueueIndex',
1438
+ type: {
1439
+ kind: 'struct',
1440
+ fields: [
1441
+ {
1442
+ name: 'queueId',
1443
+ docs: ['Id of queue in queue account.'],
1444
+ type: 'u8',
1445
+ },
1446
+ {
1447
+ name: 'index',
1448
+ docs: ['Index of compressed account hash in queue.'],
1449
+ type: 'u16',
1450
+ },
1451
+ ],
1452
+ },
1453
+ },
1280
1454
  {
1281
1455
  name: 'RolloverMetadata',
1282
1456
  type: {
@@ -1363,6 +1537,15 @@ const IDL = {
1363
1537
  defined: 'AccountState',
1364
1538
  },
1365
1539
  },
1540
+ {
1541
+ name: 'tlv',
1542
+ docs: [
1543
+ 'Placeholder for TokenExtension tlv data (unimplemented)',
1544
+ ],
1545
+ type: {
1546
+ option: 'bytes',
1547
+ },
1548
+ },
1366
1549
  ],
1367
1550
  },
1368
1551
  },
@@ -1370,23 +1553,107 @@ const IDL = {
1370
1553
  errors: [
1371
1554
  {
1372
1555
  code: 6000,
1373
- name: 'SignerCheckFailed',
1374
- msg: 'Signer check failed',
1556
+ name: 'PublicKeyAmountMissmatch',
1557
+ msg: 'public keys and amounts must be of same length',
1375
1558
  },
1376
1559
  {
1377
1560
  code: 6001,
1378
- name: 'CreateTransferInstructionFailed',
1379
- msg: 'Create transfer instruction failed',
1561
+ name: 'ComputeInputSumFailed',
1562
+ msg: 'ComputeInputSumFailed',
1380
1563
  },
1381
1564
  {
1382
1565
  code: 6002,
1383
- name: 'AccountNotFound',
1384
- msg: 'Account not found',
1566
+ name: 'ComputeOutputSumFailed',
1567
+ msg: 'ComputeOutputSumFailed',
1385
1568
  },
1386
1569
  {
1387
1570
  code: 6003,
1388
- name: 'SerializationError',
1389
- msg: 'Serialization error',
1571
+ name: 'ComputeCompressSumFailed',
1572
+ msg: 'ComputeCompressSumFailed',
1573
+ },
1574
+ {
1575
+ code: 6004,
1576
+ name: 'ComputeDecompressSumFailed',
1577
+ msg: 'ComputeDecompressSumFailed',
1578
+ },
1579
+ {
1580
+ code: 6005,
1581
+ name: 'SumCheckFailed',
1582
+ msg: 'SumCheckFailed',
1583
+ },
1584
+ {
1585
+ code: 6006,
1586
+ name: 'DecompressRecipientUndefinedForDecompress',
1587
+ msg: 'DecompressRecipientUndefinedForDecompress',
1588
+ },
1589
+ {
1590
+ code: 6007,
1591
+ name: 'CompressedPdaUndefinedForDecompress',
1592
+ msg: 'CompressedPdaUndefinedForDecompress',
1593
+ },
1594
+ {
1595
+ code: 6008,
1596
+ name: 'DeCompressAmountUndefinedForDecompress',
1597
+ msg: 'DeCompressAmountUndefinedForDecompress',
1598
+ },
1599
+ {
1600
+ code: 6009,
1601
+ name: 'CompressedPdaUndefinedForCompress',
1602
+ msg: 'CompressedPdaUndefinedForCompress',
1603
+ },
1604
+ {
1605
+ code: 6010,
1606
+ name: 'DeCompressAmountUndefinedForCompress',
1607
+ msg: 'DeCompressAmountUndefinedForCompress',
1608
+ },
1609
+ {
1610
+ code: 6011,
1611
+ name: 'DelegateSignerCheckFailed',
1612
+ msg: 'DelegateSignerCheckFailed',
1613
+ },
1614
+ {
1615
+ code: 6012,
1616
+ name: 'MintTooLarge',
1617
+ msg: 'Minted amount greater than u64::MAX',
1618
+ },
1619
+ {
1620
+ code: 6013,
1621
+ name: 'SplTokenSupplyMismatch',
1622
+ msg: 'SplTokenSupplyMismatch',
1623
+ },
1624
+ {
1625
+ code: 6014,
1626
+ name: 'HeapMemoryCheckFailed',
1627
+ msg: 'HeapMemoryCheckFailed',
1628
+ },
1629
+ {
1630
+ code: 6015,
1631
+ name: 'InstructionNotCallable',
1632
+ msg: 'The instruction is not callable',
1633
+ },
1634
+ {
1635
+ code: 6016,
1636
+ name: 'ArithmeticUnderflow',
1637
+ msg: 'ArithmeticUnderflow',
1638
+ },
1639
+ {
1640
+ code: 6017,
1641
+ name: 'HashToFieldError',
1642
+ msg: 'HashToFieldError',
1643
+ },
1644
+ {
1645
+ code: 6018,
1646
+ name: 'InvalidAuthorityMint',
1647
+ msg: 'Expected the authority to be also a mint authority',
1648
+ },
1649
+ {
1650
+ code: 6019,
1651
+ name: 'InvalidFreezeAuthority',
1652
+ msg: 'Provided authority is not the freeze authority',
1653
+ },
1654
+ {
1655
+ code: 6020,
1656
+ name: 'InvalidDelegateIndex',
1390
1657
  },
1391
1658
  ],
1392
1659
  };
@@ -1417,11 +1684,13 @@ function packCompressedTokenAccounts(params) {
1417
1684
  merkleTreePubkeyIndex,
1418
1685
  nullifierQueuePubkeyIndex,
1419
1686
  leafIndex: account.compressedAccount.leafIndex,
1687
+ queueIndex: null,
1420
1688
  },
1421
1689
  rootIndex: rootIndices[index],
1422
1690
  lamports: account.compressedAccount.lamports.eq(stateless_js.bn(0))
1423
1691
  ? null
1424
1692
  : account.compressedAccount.lamports,
1693
+ tlv: null,
1425
1694
  });
1426
1695
  });
1427
1696
  /// pack output state trees
@@ -1437,6 +1706,7 @@ function packCompressedTokenAccounts(params) {
1437
1706
  ? null
1438
1707
  : tokenTransferOutputs[index].lamports,
1439
1708
  merkleTreeIndex,
1709
+ tlv: null,
1440
1710
  });
1441
1711
  });
1442
1712
  // to meta
@@ -3985,33 +4255,6 @@ function addSigners(keys, ownerOrAuthority, multiSigners) {
3985
4255
  return keys;
3986
4256
  }
3987
4257
 
3988
- /** TODO: docs */
3989
- const approveInstructionData = struct([u8('instruction'), u64('amount')]);
3990
- /**
3991
- * Construct an Approve instruction
3992
- *
3993
- * @param account Account to set the delegate for
3994
- * @param delegate Account authorized to transfer tokens from the account
3995
- * @param owner Owner of the account
3996
- * @param amount Maximum number of tokens the delegate may transfer
3997
- * @param multiSigners Signing accounts if `owner` is a multisig
3998
- * @param programId SPL Token program account
3999
- *
4000
- * @return Instruction to add to a transaction
4001
- */
4002
- function createApproveInstruction(account, delegate, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {
4003
- const keys = addSigners([
4004
- { pubkey: account, isSigner: false, isWritable: true },
4005
- { pubkey: delegate, isSigner: false, isWritable: false },
4006
- ], owner, multiSigners);
4007
- const data = Buffer.alloc(approveInstructionData.span);
4008
- approveInstructionData.encode({
4009
- instruction: TokenInstruction.Approve,
4010
- amount: BigInt(amount),
4011
- }, data);
4012
- return new web3_js.TransactionInstruction({ keys, programId, data });
4013
- }
4014
-
4015
4258
  var AccountType;
4016
4259
  (function (AccountType) {
4017
4260
  AccountType[AccountType["Uninitialized"] = 0] = "Uninitialized";
@@ -4335,6 +4578,7 @@ function createTransferOutputState(inputCompressedTokenAccounts, toAddress, amou
4335
4578
  owner: toAddress,
4336
4579
  amount,
4337
4580
  lamports: inputLamports,
4581
+ tlv: null,
4338
4582
  },
4339
4583
  ];
4340
4584
  }
@@ -4346,11 +4590,13 @@ function createTransferOutputState(inputCompressedTokenAccounts, toAddress, amou
4346
4590
  owner: inputCompressedTokenAccounts[0].parsed.owner,
4347
4591
  amount: changeAmount,
4348
4592
  lamports: inputLamports,
4593
+ tlv: null,
4349
4594
  },
4350
4595
  {
4351
4596
  owner: toAddress,
4352
4597
  amount,
4353
4598
  lamports: stateless_js.bn(0),
4599
+ tlv: null,
4354
4600
  },
4355
4601
  ];
4356
4602
  return outputCompressedAccounts;
@@ -4379,6 +4625,7 @@ function createDecompressOutputState(inputCompressedTokenAccounts, amount) {
4379
4625
  owner: inputCompressedTokenAccounts[0].parsed.owner,
4380
4626
  amount: changeAmount,
4381
4627
  lamports: inputLamports,
4628
+ tlv: null,
4382
4629
  },
4383
4630
  ];
4384
4631
  return tokenTransferOutputs;
@@ -4472,7 +4719,7 @@ class CompressedTokenProgram {
4472
4719
  const amounts = stateless_js.toArray(amount).map(amount => stateless_js.bn(amount));
4473
4720
  const toPubkeys = stateless_js.toArray(toPubkey);
4474
4721
  const instruction = await this.program.methods
4475
- .mintTo(toPubkeys, amounts)
4722
+ .mintTo(toPubkeys, amounts, null)
4476
4723
  .accounts({
4477
4724
  feePayer,
4478
4725
  authority,
@@ -4487,6 +4734,7 @@ class CompressedTokenProgram {
4487
4734
  accountCompressionProgram: systemKeys.accountCompressionProgram,
4488
4735
  merkleTree: merkleTree !== null && merkleTree !== void 0 ? merkleTree : stateless_js.defaultTestStateTreeAccounts().merkleTree,
4489
4736
  selfProgram: this.programId,
4737
+ solPoolPda: null,
4490
4738
  })
4491
4739
  .instruction();
4492
4740
  return instruction;
@@ -4501,7 +4749,7 @@ class CompressedTokenProgram {
4501
4749
  /// 1. Mint to existing ATA of mintAuthority.
4502
4750
  const splMintToInstruction = createMintToInstruction(mint, authorityTokenAccount, authority, amount);
4503
4751
  /// 2. Compress from mint authority ATA to recipient compressed account
4504
- const [approveInstruction, compressInstruction] = await this.compress({
4752
+ const compressInstruction = await this.compress({
4505
4753
  payer: feePayer,
4506
4754
  owner: authority,
4507
4755
  source: authorityTokenAccount,
@@ -4510,7 +4758,7 @@ class CompressedTokenProgram {
4510
4758
  amount: params.amount,
4511
4759
  outputStateTree: merkleTree,
4512
4760
  });
4513
- return [splMintToInstruction, approveInstruction, compressInstruction];
4761
+ return [splMintToInstruction, compressInstruction];
4514
4762
  }
4515
4763
  /**
4516
4764
  * Construct transfer instruction for compressed tokens
@@ -4534,6 +4782,7 @@ class CompressedTokenProgram {
4534
4782
  compressOrDecompressAmount: null,
4535
4783
  isCompress: false,
4536
4784
  cpiContext: null,
4785
+ lamportsChangeAccountMerkleTreeIndex: null,
4537
4786
  };
4538
4787
  const encodedData = this.program.coder.types.encode('CompressedTokenInstructionDataTransfer', data);
4539
4788
  const { accountCompressionAuthority, noopProgram, registeredProgramPda, accountCompressionProgram, } = stateless_js.defaultStaticAccountsStruct();
@@ -4558,8 +4807,8 @@ class CompressedTokenProgram {
4558
4807
  return instruction;
4559
4808
  }
4560
4809
  /**
4561
- * Construct approve and compress instructions
4562
- * @returns [approveInstruction, compressInstruction]
4810
+ * Construct compress instruction
4811
+ * @returns compressInstruction
4563
4812
  */
4564
4813
  static async compress(params) {
4565
4814
  const { payer, owner, source, toAddress, mint, outputStateTree } = params;
@@ -4569,6 +4818,7 @@ class CompressedTokenProgram {
4569
4818
  owner: toAddress,
4570
4819
  amount,
4571
4820
  lamports: stateless_js.bn(0),
4821
+ tlv: null,
4572
4822
  },
4573
4823
  ];
4574
4824
  const { inputTokenDataWithContext, packedOutputTokenData, remainingAccountMetas, } = packCompressedTokenAccounts({
@@ -4586,10 +4836,10 @@ class CompressedTokenProgram {
4586
4836
  compressOrDecompressAmount: amount,
4587
4837
  isCompress: true,
4588
4838
  cpiContext: null,
4839
+ lamportsChangeAccountMerkleTreeIndex: null,
4589
4840
  };
4590
4841
  const encodedData = this.program.coder.types.encode('CompressedTokenInstructionDataTransfer', data);
4591
4842
  const { accountCompressionAuthority, noopProgram, registeredProgramPda, accountCompressionProgram, } = stateless_js.defaultStaticAccountsStruct();
4592
- const approveInstruction = createApproveInstruction(source, this.deriveCpiAuthorityPda, owner, BigInt(amount.toString()));
4593
4843
  const instruction = await this.program.methods
4594
4844
  .transfer(encodedData)
4595
4845
  .accounts({
@@ -4608,7 +4858,7 @@ class CompressedTokenProgram {
4608
4858
  })
4609
4859
  .remainingAccounts(remainingAccountMetas)
4610
4860
  .instruction();
4611
- return [approveInstruction, instruction];
4861
+ return instruction;
4612
4862
  }
4613
4863
  /**
4614
4864
  * Construct decompress instruction
@@ -4634,6 +4884,7 @@ class CompressedTokenProgram {
4634
4884
  compressOrDecompressAmount: amount,
4635
4885
  isCompress: false,
4636
4886
  cpiContext: null,
4887
+ lamportsChangeAccountMerkleTreeIndex: null,
4637
4888
  };
4638
4889
  const encodedData = this.program.coder.types.encode('CompressedTokenInstructionDataTransfer', data);
4639
4890
  const { accountCompressionAuthority, noopProgram, registeredProgramPda, accountCompressionProgram, } = stateless_js.defaultStaticAccountsStruct();
@@ -4720,7 +4971,7 @@ async function approveAndMintTo(rpc, payer, mint, destination, authority, amount
4720
4971
  */
4721
4972
  async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toAddress, merkleTree, confirmOptions) {
4722
4973
  amount = stateless_js.bn(amount);
4723
- const [approveIx, compressIx] = await CompressedTokenProgram.compress({
4974
+ const compressIx = await CompressedTokenProgram.compress({
4724
4975
  payer: payer.publicKey,
4725
4976
  owner: owner.publicKey,
4726
4977
  source: sourceTokenAccount,
@@ -4735,7 +4986,6 @@ async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toA
4735
4986
  web3_js.ComputeBudgetProgram.setComputeUnitLimit({
4736
4987
  units: 1000000,
4737
4988
  }),
4738
- approveIx,
4739
4989
  compressIx,
4740
4990
  ], payer, blockhashCtx.blockhash, additionalSigners);
4741
4991
  const txId = await stateless_js.sendAndConfirmTx(rpc, signedTx, confirmOptions, blockhashCtx);