@lightprotocol/compressed-token 0.3.1 → 0.3.2

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,11 +5,11 @@ 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.0',
8
+ version: '0.4.1',
9
9
  name: 'light_compressed_token',
10
10
  instructions: [
11
11
  {
12
- name: 'createMint',
12
+ name: 'createTokenPool',
13
13
  docs: [
14
14
  'This instruction expects a mint account to be created in a separate',
15
15
  'token program instruction with token authority as mint authority. This',
@@ -881,12 +881,6 @@ const IDL = {
881
881
  option: 'u8',
882
882
  },
883
883
  },
884
- {
885
- name: 'isNative',
886
- type: {
887
- option: 'u64',
888
- },
889
- },
890
884
  {
891
885
  name: 'merkleContext',
892
886
  type: {
@@ -897,6 +891,12 @@ const IDL = {
897
891
  name: 'rootIndex',
898
892
  type: 'u16',
899
893
  },
894
+ {
895
+ name: 'lamports',
896
+ type: {
897
+ option: 'u64',
898
+ },
899
+ },
900
900
  ],
901
901
  },
902
902
  },
@@ -1347,18 +1347,6 @@ const IDL = {
1347
1347
  defined: 'AccountState',
1348
1348
  },
1349
1349
  },
1350
- {
1351
- name: 'isNative',
1352
- docs: [
1353
- 'If is_some, this is a native token, and the value logs the rent-exempt',
1354
- 'reserve. An Account is required to be rent-exempt, so the value is',
1355
- 'used by the Processor to ensure that wrapped SOL accounts do not',
1356
- 'drop below this threshold.',
1357
- ],
1358
- type: {
1359
- option: 'u64',
1360
- },
1361
- },
1362
1350
  ],
1363
1351
  },
1364
1352
  },
@@ -1366,108 +1354,23 @@ const IDL = {
1366
1354
  errors: [
1367
1355
  {
1368
1356
  code: 6000,
1369
- name: 'PublicKeyAmountMissmatch',
1370
- msg: 'public keys and amounts must be of same length',
1357
+ name: 'SignerCheckFailed',
1358
+ msg: 'Signer check failed',
1371
1359
  },
1372
1360
  {
1373
1361
  code: 6001,
1374
- name: 'SignerCheckFailed',
1375
- msg: 'SignerCheckFailed',
1362
+ name: 'CreateTransferInstructionFailed',
1363
+ msg: 'Create transfer instruction failed',
1376
1364
  },
1377
1365
  {
1378
1366
  code: 6002,
1379
- name: 'ComputeInputSumFailed',
1380
- msg: 'ComputeInputSumFailed',
1367
+ name: 'AccountNotFound',
1368
+ msg: 'Account not found',
1381
1369
  },
1382
1370
  {
1383
1371
  code: 6003,
1384
- name: 'ComputeOutputSumFailed',
1385
- msg: 'ComputeOutputSumFailed',
1386
- },
1387
- {
1388
- code: 6004,
1389
- name: 'ComputeCompressSumFailed',
1390
- msg: 'ComputeCompressSumFailed',
1391
- },
1392
- {
1393
- code: 6005,
1394
- name: 'ComputeDecompressSumFailed',
1395
- msg: 'ComputeDecompressSumFailed',
1396
- },
1397
- {
1398
- code: 6006,
1399
- name: 'SumCheckFailed',
1400
- msg: 'SumCheckFailed',
1401
- },
1402
- {
1403
- code: 6007,
1404
- name: 'DecompressRecipientUndefinedForDecompress',
1405
- msg: 'DecompressRecipientUndefinedForDecompress',
1406
- },
1407
- {
1408
- code: 6008,
1409
- name: 'CompressedPdaUndefinedForDecompress',
1410
- msg: 'CompressedPdaUndefinedForDecompress',
1411
- },
1412
- {
1413
- code: 6009,
1414
- name: 'DeCompressAmountUndefinedForDecompress',
1415
- msg: 'DeCompressAmountUndefinedForDecompress',
1416
- },
1417
- {
1418
- code: 6010,
1419
- name: 'CompressedPdaUndefinedForCompress',
1420
- msg: 'CompressedPdaUndefinedForCompress',
1421
- },
1422
- {
1423
- code: 6011,
1424
- name: 'DeCompressAmountUndefinedForCompress',
1425
- msg: 'DeCompressAmountUndefinedForCompress',
1426
- },
1427
- {
1428
- code: 6012,
1429
- name: 'DelegateUndefined',
1430
- msg: 'DelegateUndefined while delegated amount is defined',
1431
- },
1432
- {
1433
- code: 6013,
1434
- name: 'DelegateSignerCheckFailed',
1435
- msg: 'DelegateSignerCheckFailed',
1436
- },
1437
- {
1438
- code: 6014,
1439
- name: 'SplTokenSupplyMismatch',
1440
- msg: 'SplTokenSupplyMismatch',
1441
- },
1442
- {
1443
- code: 6015,
1444
- name: 'HeapMemoryCheckFailed',
1445
- msg: 'HeapMemoryCheckFailed',
1446
- },
1447
- {
1448
- code: 6016,
1449
- name: 'InstructionNotCallable',
1450
- msg: 'The instruction is not callable',
1451
- },
1452
- {
1453
- code: 6017,
1454
- name: 'ArithmeticUnderflow',
1455
- msg: 'ArithmeticUnderflow',
1456
- },
1457
- {
1458
- code: 6018,
1459
- name: 'InvalidDelegate',
1460
- msg: 'InvalidDelegate',
1461
- },
1462
- {
1463
- code: 6019,
1464
- name: 'HashToFieldError',
1465
- msg: 'HashToFieldError',
1466
- },
1467
- {
1468
- code: 6020,
1469
- name: 'InvalidMint',
1470
- msg: 'InvalidMint',
1372
+ name: 'SerializationError',
1373
+ msg: 'Serialization error',
1471
1374
  },
1472
1375
  ],
1473
1376
  };
@@ -1494,13 +1397,15 @@ function packCompressedTokenAccounts(params) {
1494
1397
  packedInputTokenData.push({
1495
1398
  amount: account.parsed.amount,
1496
1399
  delegateIndex,
1497
- isNative: account.parsed.isNative,
1498
1400
  merkleContext: {
1499
1401
  merkleTreePubkeyIndex,
1500
1402
  nullifierQueuePubkeyIndex,
1501
1403
  leafIndex: account.compressedAccount.leafIndex,
1502
1404
  },
1503
1405
  rootIndex: rootIndices[index],
1406
+ lamports: account.compressedAccount.lamports.eq(stateless_js.bn(0))
1407
+ ? null
1408
+ : account.compressedAccount.lamports,
1504
1409
  });
1505
1410
  });
1506
1411
  /// pack output state trees
@@ -6539,7 +6444,7 @@ class CompressedTokenProgram {
6539
6444
  space: MINT_SIZE,
6540
6445
  });
6541
6446
  const initializeMintInstruction = createInitializeMint2Instruction(mint, params.decimals, authority, params.freezeAuthority, TOKEN_PROGRAM_ID);
6542
- const ix = await this.registerMint({
6447
+ const ix = await this.createTokenPool({
6543
6448
  feePayer,
6544
6449
  mint,
6545
6450
  });
@@ -6549,11 +6454,11 @@ class CompressedTokenProgram {
6549
6454
  * Enable compression for an existing SPL mint, creating an omnibus account.
6550
6455
  * For new mints, use `CompressedTokenProgram.createMint`.
6551
6456
  */
6552
- static async registerMint(params) {
6457
+ static async createTokenPool(params) {
6553
6458
  const { mint, feePayer } = params;
6554
6459
  const tokenPoolPda = this.deriveTokenPoolPda(mint);
6555
6460
  const ix = await this.program.methods
6556
- .createMint()
6461
+ .createTokenPool()
6557
6462
  .accounts({
6558
6463
  mint,
6559
6464
  feePayer,
@@ -7030,8 +6935,8 @@ async function mintTo(rpc, payer, mint, destination, authority, amount, merkleTr
7030
6935
  *
7031
6936
  * @return transaction signature
7032
6937
  */
7033
- async function registerMint(rpc, payer, mintAddress, confirmOptions) {
7034
- const ix = await CompressedTokenProgram.registerMint({
6938
+ async function createTokenPool(rpc, payer, mintAddress, confirmOptions) {
6939
+ const ix = await CompressedTokenProgram.createTokenPool({
7035
6940
  feePayer: payer.publicKey,
7036
6941
  mint: mintAddress,
7037
6942
  });
@@ -7050,12 +6955,12 @@ exports.approveAndMintTo = approveAndMintTo;
7050
6955
  exports.compress = compress;
7051
6956
  exports.createDecompressOutputState = createDecompressOutputState;
7052
6957
  exports.createMint = createMint;
6958
+ exports.createTokenPool = createTokenPool;
7053
6959
  exports.createTransferOutputState = createTransferOutputState;
7054
6960
  exports.decompress = decompress;
7055
6961
  exports.mintTo = mintTo;
7056
6962
  exports.packCompressedTokenAccounts = packCompressedTokenAccounts;
7057
6963
  exports.parseTokenData = parseTokenData;
7058
- exports.registerMint = registerMint;
7059
6964
  exports.selectMinCompressedTokenAccountsForTransfer = selectMinCompressedTokenAccountsForTransfer;
7060
6965
  exports.sumUpTokenAmount = sumUpTokenAmount;
7061
6966
  exports.transfer = transfer;