@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.
@@ -12,16 +12,17 @@ const IDL = {
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
  },
@@ -749,10 +858,25 @@ const IDL = {
749
858
  fields: [
750
859
  {
751
860
  name: 'setContext',
861
+ docs: [
862
+ 'Is set by the program that is invoking the CPI to signal that is should',
863
+ 'set the cpi context.',
864
+ ],
865
+ type: 'bool',
866
+ },
867
+ {
868
+ name: 'firstSetContext',
869
+ docs: [
870
+ 'Is set to wipe the cpi context since someone could have set it before',
871
+ 'with unrelated data.',
872
+ ],
752
873
  type: 'bool',
753
874
  },
754
875
  {
755
876
  name: 'cpiContextAccountIndex',
877
+ docs: [
878
+ 'Index of cpi context account in remaining accounts.',
879
+ ],
756
880
  type: 'u8',
757
881
  },
758
882
  ],
@@ -804,9 +928,9 @@ const IDL = {
804
928
  {
805
929
  name: 'delegatedTransfer',
806
930
  docs: [
807
- '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,',
808
933
  'owner = Some(owner) is the owner of the token account.',
809
- 'Is set if the signer is delegate',
810
934
  ],
811
935
  type: {
812
936
  option: {
@@ -848,11 +972,20 @@ const IDL = {
848
972
  },
849
973
  },
850
974
  },
975
+ {
976
+ name: 'lamportsChangeAccountMerkleTreeIndex',
977
+ type: {
978
+ option: 'u8',
979
+ },
980
+ },
851
981
  ],
852
982
  },
853
983
  },
854
984
  {
855
985
  name: 'DelegatedTransfer',
986
+ docs: [
987
+ 'Struct to provide the owner when the delegate is signer of the transaction.',
988
+ ],
856
989
  type: {
857
990
  kind: 'struct',
858
991
  fields: [
@@ -862,7 +995,15 @@ const IDL = {
862
995
  },
863
996
  {
864
997
  name: 'delegateChangeAccountIndex',
865
- 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
+ },
866
1007
  },
867
1008
  ],
868
1009
  },
@@ -898,6 +1039,15 @@ const IDL = {
898
1039
  option: 'u64',
899
1040
  },
900
1041
  },
1042
+ {
1043
+ name: 'tlv',
1044
+ docs: [
1045
+ 'Placeholder for TokenExtension tlv data (unimplemented)',
1046
+ ],
1047
+ type: {
1048
+ option: 'bytes',
1049
+ },
1050
+ },
901
1051
  ],
902
1052
  },
903
1053
  },
@@ -1159,6 +1309,18 @@ const IDL = {
1159
1309
  name: 'leafIndex',
1160
1310
  type: 'u32',
1161
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
+ },
1162
1324
  ],
1163
1325
  },
1164
1326
  },
@@ -1185,6 +1347,15 @@ const IDL = {
1185
1347
  name: 'merkleTreeIndex',
1186
1348
  type: 'u8',
1187
1349
  },
1350
+ {
1351
+ name: 'tlv',
1352
+ docs: [
1353
+ 'Placeholder for TokenExtension tlv data (unimplemented)',
1354
+ ],
1355
+ type: {
1356
+ option: 'bytes',
1357
+ },
1358
+ },
1188
1359
  ],
1189
1360
  },
1190
1361
  },
@@ -1262,6 +1433,24 @@ const IDL = {
1262
1433
  ],
1263
1434
  },
1264
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
+ },
1265
1454
  {
1266
1455
  name: 'RolloverMetadata',
1267
1456
  type: {
@@ -1348,6 +1537,15 @@ const IDL = {
1348
1537
  defined: 'AccountState',
1349
1538
  },
1350
1539
  },
1540
+ {
1541
+ name: 'tlv',
1542
+ docs: [
1543
+ 'Placeholder for TokenExtension tlv data (unimplemented)',
1544
+ ],
1545
+ type: {
1546
+ option: 'bytes',
1547
+ },
1548
+ },
1351
1549
  ],
1352
1550
  },
1353
1551
  },
@@ -1355,108 +1553,23 @@ const IDL = {
1355
1553
  errors: [
1356
1554
  {
1357
1555
  code: 6000,
1358
- name: 'PublicKeyAmountMissmatch',
1359
- msg: 'public keys and amounts must be of same length',
1556
+ name: 'SignerCheckFailed',
1557
+ msg: 'Signer check failed',
1360
1558
  },
1361
1559
  {
1362
1560
  code: 6001,
1363
- name: 'SignerCheckFailed',
1364
- msg: 'SignerCheckFailed',
1561
+ name: 'CreateTransferInstructionFailed',
1562
+ msg: 'Create transfer instruction failed',
1365
1563
  },
1366
1564
  {
1367
1565
  code: 6002,
1368
- name: 'ComputeInputSumFailed',
1369
- msg: 'ComputeInputSumFailed',
1566
+ name: 'AccountNotFound',
1567
+ msg: 'Account not found',
1370
1568
  },
1371
1569
  {
1372
1570
  code: 6003,
1373
- name: 'ComputeOutputSumFailed',
1374
- msg: 'ComputeOutputSumFailed',
1375
- },
1376
- {
1377
- code: 6004,
1378
- name: 'ComputeCompressSumFailed',
1379
- msg: 'ComputeCompressSumFailed',
1380
- },
1381
- {
1382
- code: 6005,
1383
- name: 'ComputeDecompressSumFailed',
1384
- msg: 'ComputeDecompressSumFailed',
1385
- },
1386
- {
1387
- code: 6006,
1388
- name: 'SumCheckFailed',
1389
- msg: 'SumCheckFailed',
1390
- },
1391
- {
1392
- code: 6007,
1393
- name: 'DecompressRecipientUndefinedForDecompress',
1394
- msg: 'DecompressRecipientUndefinedForDecompress',
1395
- },
1396
- {
1397
- code: 6008,
1398
- name: 'CompressedPdaUndefinedForDecompress',
1399
- msg: 'CompressedPdaUndefinedForDecompress',
1400
- },
1401
- {
1402
- code: 6009,
1403
- name: 'DeCompressAmountUndefinedForDecompress',
1404
- msg: 'DeCompressAmountUndefinedForDecompress',
1405
- },
1406
- {
1407
- code: 6010,
1408
- name: 'CompressedPdaUndefinedForCompress',
1409
- msg: 'CompressedPdaUndefinedForCompress',
1410
- },
1411
- {
1412
- code: 6011,
1413
- name: 'DeCompressAmountUndefinedForCompress',
1414
- msg: 'DeCompressAmountUndefinedForCompress',
1415
- },
1416
- {
1417
- code: 6012,
1418
- name: 'DelegateUndefined',
1419
- msg: 'DelegateUndefined while delegated amount is defined',
1420
- },
1421
- {
1422
- code: 6013,
1423
- name: 'DelegateSignerCheckFailed',
1424
- msg: 'DelegateSignerCheckFailed',
1425
- },
1426
- {
1427
- code: 6014,
1428
- name: 'SplTokenSupplyMismatch',
1429
- msg: 'SplTokenSupplyMismatch',
1430
- },
1431
- {
1432
- code: 6015,
1433
- name: 'HeapMemoryCheckFailed',
1434
- msg: 'HeapMemoryCheckFailed',
1435
- },
1436
- {
1437
- code: 6016,
1438
- name: 'InstructionNotCallable',
1439
- msg: 'The instruction is not callable',
1440
- },
1441
- {
1442
- code: 6017,
1443
- name: 'ArithmeticUnderflow',
1444
- msg: 'ArithmeticUnderflow',
1445
- },
1446
- {
1447
- code: 6018,
1448
- name: 'InvalidDelegate',
1449
- msg: 'InvalidDelegate',
1450
- },
1451
- {
1452
- code: 6019,
1453
- name: 'HashToFieldError',
1454
- msg: 'HashToFieldError',
1455
- },
1456
- {
1457
- code: 6020,
1458
- name: 'InvalidMint',
1459
- msg: 'InvalidMint',
1571
+ name: 'SerializationError',
1572
+ msg: 'Serialization error',
1460
1573
  },
1461
1574
  ],
1462
1575
  };
@@ -1487,11 +1600,13 @@ function packCompressedTokenAccounts(params) {
1487
1600
  merkleTreePubkeyIndex,
1488
1601
  nullifierQueuePubkeyIndex,
1489
1602
  leafIndex: account.compressedAccount.leafIndex,
1603
+ queueIndex: null,
1490
1604
  },
1491
1605
  rootIndex: rootIndices[index],
1492
1606
  lamports: account.compressedAccount.lamports.eq(stateless_js.bn(0))
1493
1607
  ? null
1494
1608
  : account.compressedAccount.lamports,
1609
+ tlv: null,
1495
1610
  });
1496
1611
  });
1497
1612
  /// pack output state trees
@@ -1507,6 +1622,7 @@ function packCompressedTokenAccounts(params) {
1507
1622
  ? null
1508
1623
  : tokenTransferOutputs[index].lamports,
1509
1624
  merkleTreeIndex,
1625
+ tlv: null,
1510
1626
  });
1511
1627
  });
1512
1628
  // to meta
@@ -4055,33 +4171,6 @@ function addSigners(keys, ownerOrAuthority, multiSigners) {
4055
4171
  return keys;
4056
4172
  }
4057
4173
 
4058
- /** TODO: docs */
4059
- const approveInstructionData = struct([u8('instruction'), u64('amount')]);
4060
- /**
4061
- * Construct an Approve instruction
4062
- *
4063
- * @param account Account to set the delegate for
4064
- * @param delegate Account authorized to transfer tokens from the account
4065
- * @param owner Owner of the account
4066
- * @param amount Maximum number of tokens the delegate may transfer
4067
- * @param multiSigners Signing accounts if `owner` is a multisig
4068
- * @param programId SPL Token program account
4069
- *
4070
- * @return Instruction to add to a transaction
4071
- */
4072
- function createApproveInstruction(account, delegate, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {
4073
- const keys = addSigners([
4074
- { pubkey: account, isSigner: false, isWritable: true },
4075
- { pubkey: delegate, isSigner: false, isWritable: false },
4076
- ], owner, multiSigners);
4077
- const data = Buffer.alloc(approveInstructionData.span);
4078
- approveInstructionData.encode({
4079
- instruction: TokenInstruction.Approve,
4080
- amount: BigInt(amount),
4081
- }, data);
4082
- return new web3_js.TransactionInstruction({ keys, programId, data });
4083
- }
4084
-
4085
4174
  var AccountType;
4086
4175
  (function (AccountType) {
4087
4176
  AccountType[AccountType["Uninitialized"] = 0] = "Uninitialized";
@@ -4405,6 +4494,7 @@ function createTransferOutputState(inputCompressedTokenAccounts, toAddress, amou
4405
4494
  owner: toAddress,
4406
4495
  amount,
4407
4496
  lamports: inputLamports,
4497
+ tlv: null,
4408
4498
  },
4409
4499
  ];
4410
4500
  }
@@ -4416,11 +4506,13 @@ function createTransferOutputState(inputCompressedTokenAccounts, toAddress, amou
4416
4506
  owner: inputCompressedTokenAccounts[0].parsed.owner,
4417
4507
  amount: changeAmount,
4418
4508
  lamports: inputLamports,
4509
+ tlv: null,
4419
4510
  },
4420
4511
  {
4421
4512
  owner: toAddress,
4422
4513
  amount,
4423
4514
  lamports: stateless_js.bn(0),
4515
+ tlv: null,
4424
4516
  },
4425
4517
  ];
4426
4518
  return outputCompressedAccounts;
@@ -4449,6 +4541,7 @@ function createDecompressOutputState(inputCompressedTokenAccounts, amount) {
4449
4541
  owner: inputCompressedTokenAccounts[0].parsed.owner,
4450
4542
  amount: changeAmount,
4451
4543
  lamports: inputLamports,
4544
+ tlv: null,
4452
4545
  },
4453
4546
  ];
4454
4547
  return tokenTransferOutputs;
@@ -4542,7 +4635,7 @@ class CompressedTokenProgram {
4542
4635
  const amounts = stateless_js.toArray(amount).map(amount => stateless_js.bn(amount));
4543
4636
  const toPubkeys = stateless_js.toArray(toPubkey);
4544
4637
  const instruction = await this.program.methods
4545
- .mintTo(toPubkeys, amounts)
4638
+ .mintTo(toPubkeys, amounts, null)
4546
4639
  .accounts({
4547
4640
  feePayer,
4548
4641
  authority,
@@ -4557,6 +4650,7 @@ class CompressedTokenProgram {
4557
4650
  accountCompressionProgram: systemKeys.accountCompressionProgram,
4558
4651
  merkleTree: merkleTree !== null && merkleTree !== void 0 ? merkleTree : stateless_js.defaultTestStateTreeAccounts().merkleTree,
4559
4652
  selfProgram: this.programId,
4653
+ solPoolPda: null,
4560
4654
  })
4561
4655
  .instruction();
4562
4656
  return instruction;
@@ -4571,7 +4665,7 @@ class CompressedTokenProgram {
4571
4665
  /// 1. Mint to existing ATA of mintAuthority.
4572
4666
  const splMintToInstruction = createMintToInstruction(mint, authorityTokenAccount, authority, amount);
4573
4667
  /// 2. Compress from mint authority ATA to recipient compressed account
4574
- const [approveInstruction, compressInstruction] = await this.compress({
4668
+ const compressInstruction = await this.compress({
4575
4669
  payer: feePayer,
4576
4670
  owner: authority,
4577
4671
  source: authorityTokenAccount,
@@ -4580,7 +4674,7 @@ class CompressedTokenProgram {
4580
4674
  amount: params.amount,
4581
4675
  outputStateTree: merkleTree,
4582
4676
  });
4583
- return [splMintToInstruction, approveInstruction, compressInstruction];
4677
+ return [splMintToInstruction, compressInstruction];
4584
4678
  }
4585
4679
  /**
4586
4680
  * Construct transfer instruction for compressed tokens
@@ -4604,6 +4698,7 @@ class CompressedTokenProgram {
4604
4698
  compressOrDecompressAmount: null,
4605
4699
  isCompress: false,
4606
4700
  cpiContext: null,
4701
+ lamportsChangeAccountMerkleTreeIndex: null,
4607
4702
  };
4608
4703
  const encodedData = this.program.coder.types.encode('CompressedTokenInstructionDataTransfer', data);
4609
4704
  const { accountCompressionAuthority, noopProgram, registeredProgramPda, accountCompressionProgram, } = stateless_js.defaultStaticAccountsStruct();
@@ -4628,8 +4723,8 @@ class CompressedTokenProgram {
4628
4723
  return instruction;
4629
4724
  }
4630
4725
  /**
4631
- * Construct approve and compress instructions
4632
- * @returns [approveInstruction, compressInstruction]
4726
+ * Construct compress instruction
4727
+ * @returns compressInstruction
4633
4728
  */
4634
4729
  static async compress(params) {
4635
4730
  const { payer, owner, source, toAddress, mint, outputStateTree } = params;
@@ -4639,6 +4734,7 @@ class CompressedTokenProgram {
4639
4734
  owner: toAddress,
4640
4735
  amount,
4641
4736
  lamports: stateless_js.bn(0),
4737
+ tlv: null,
4642
4738
  },
4643
4739
  ];
4644
4740
  const { inputTokenDataWithContext, packedOutputTokenData, remainingAccountMetas, } = packCompressedTokenAccounts({
@@ -4656,10 +4752,10 @@ class CompressedTokenProgram {
4656
4752
  compressOrDecompressAmount: amount,
4657
4753
  isCompress: true,
4658
4754
  cpiContext: null,
4755
+ lamportsChangeAccountMerkleTreeIndex: null,
4659
4756
  };
4660
4757
  const encodedData = this.program.coder.types.encode('CompressedTokenInstructionDataTransfer', data);
4661
4758
  const { accountCompressionAuthority, noopProgram, registeredProgramPda, accountCompressionProgram, } = stateless_js.defaultStaticAccountsStruct();
4662
- const approveInstruction = createApproveInstruction(source, this.deriveCpiAuthorityPda, owner, BigInt(amount.toString()));
4663
4759
  const instruction = await this.program.methods
4664
4760
  .transfer(encodedData)
4665
4761
  .accounts({
@@ -4678,7 +4774,7 @@ class CompressedTokenProgram {
4678
4774
  })
4679
4775
  .remainingAccounts(remainingAccountMetas)
4680
4776
  .instruction();
4681
- return [approveInstruction, instruction];
4777
+ return instruction;
4682
4778
  }
4683
4779
  /**
4684
4780
  * Construct decompress instruction
@@ -4704,6 +4800,7 @@ class CompressedTokenProgram {
4704
4800
  compressOrDecompressAmount: amount,
4705
4801
  isCompress: false,
4706
4802
  cpiContext: null,
4803
+ lamportsChangeAccountMerkleTreeIndex: null,
4707
4804
  };
4708
4805
  const encodedData = this.program.coder.types.encode('CompressedTokenInstructionDataTransfer', data);
4709
4806
  const { accountCompressionAuthority, noopProgram, registeredProgramPda, accountCompressionProgram, } = stateless_js.defaultStaticAccountsStruct();
@@ -4790,7 +4887,7 @@ async function approveAndMintTo(rpc, payer, mint, destination, authority, amount
4790
4887
  */
4791
4888
  async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toAddress, merkleTree, confirmOptions) {
4792
4889
  amount = stateless_js.bn(amount);
4793
- const [approveIx, compressIx] = await CompressedTokenProgram.compress({
4890
+ const compressIx = await CompressedTokenProgram.compress({
4794
4891
  payer: payer.publicKey,
4795
4892
  owner: owner.publicKey,
4796
4893
  source: sourceTokenAccount,
@@ -4805,7 +4902,6 @@ async function compress(rpc, payer, mint, amount, owner, sourceTokenAccount, toA
4805
4902
  web3_js.ComputeBudgetProgram.setComputeUnitLimit({
4806
4903
  units: 1000000,
4807
4904
  }),
4808
- approveIx,
4809
4905
  compressIx,
4810
4906
  ], payer, blockhashCtx.blockhash, additionalSigners);
4811
4907
  const txId = await stateless_js.sendAndConfirmTx(rpc, signedTx, confirmOptions, blockhashCtx);