@lightprotocol/compressed-token 0.3.1 → 0.3.3

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.
@@ -1,13 +1,13 @@
1
- import { getIndexOrAdd, padOutputStateMerkleTrees, bn, useWallet, confirmConfig, defaultStaticAccountsStruct, toArray, LightSystemProgram, defaultTestStateTreeAccounts, sumUpLamports, validateSufficientBalance, validateSameOwner, dedupeSigner, buildAndSignTx, sendAndConfirmTx } from '@lightprotocol/stateless.js';
1
+ import { getIndexOrAdd, bn, padOutputStateMerkleTrees, useWallet, confirmConfig, defaultStaticAccountsStruct, toArray, LightSystemProgram, defaultTestStateTreeAccounts, sumUpLamports, validateSufficientBalance, validateSameOwner, dedupeSigner, buildAndSignTx, sendAndConfirmTx } from '@lightprotocol/stateless.js';
2
2
  import { PublicKey, TransactionInstruction, SystemProgram, Transaction, sendAndConfirmTransaction, Keypair, Connection, ComputeBudgetProgram } from '@solana/web3.js';
3
3
  import { AnchorProvider, setProvider, Program } from '@coral-xyz/anchor';
4
4
 
5
5
  const IDL = {
6
- version: '0.4.0',
6
+ version: '0.4.1',
7
7
  name: 'light_compressed_token',
8
8
  instructions: [
9
9
  {
10
- name: 'createMint',
10
+ name: 'createTokenPool',
11
11
  docs: [
12
12
  'This instruction expects a mint account to be created in a separate',
13
13
  'token program instruction with token authority as mint authority. This',
@@ -879,12 +879,6 @@ const IDL = {
879
879
  option: 'u8',
880
880
  },
881
881
  },
882
- {
883
- name: 'isNative',
884
- type: {
885
- option: 'u64',
886
- },
887
- },
888
882
  {
889
883
  name: 'merkleContext',
890
884
  type: {
@@ -895,6 +889,12 @@ const IDL = {
895
889
  name: 'rootIndex',
896
890
  type: 'u16',
897
891
  },
892
+ {
893
+ name: 'lamports',
894
+ type: {
895
+ option: 'u64',
896
+ },
897
+ },
898
898
  ],
899
899
  },
900
900
  },
@@ -1345,18 +1345,6 @@ const IDL = {
1345
1345
  defined: 'AccountState',
1346
1346
  },
1347
1347
  },
1348
- {
1349
- name: 'isNative',
1350
- docs: [
1351
- 'If is_some, this is a native token, and the value logs the rent-exempt',
1352
- 'reserve. An Account is required to be rent-exempt, so the value is',
1353
- 'used by the Processor to ensure that wrapped SOL accounts do not',
1354
- 'drop below this threshold.',
1355
- ],
1356
- type: {
1357
- option: 'u64',
1358
- },
1359
- },
1360
1348
  ],
1361
1349
  },
1362
1350
  },
@@ -1492,13 +1480,15 @@ function packCompressedTokenAccounts(params) {
1492
1480
  packedInputTokenData.push({
1493
1481
  amount: account.parsed.amount,
1494
1482
  delegateIndex,
1495
- isNative: account.parsed.isNative,
1496
1483
  merkleContext: {
1497
1484
  merkleTreePubkeyIndex,
1498
1485
  nullifierQueuePubkeyIndex,
1499
1486
  leafIndex: account.compressedAccount.leafIndex,
1500
1487
  },
1501
1488
  rootIndex: rootIndices[index],
1489
+ lamports: account.compressedAccount.lamports.eq(bn(0))
1490
+ ? null
1491
+ : account.compressedAccount.lamports,
1502
1492
  });
1503
1493
  });
1504
1494
  /// pack output state trees
@@ -6541,7 +6531,7 @@ class CompressedTokenProgram {
6541
6531
  space: MINT_SIZE,
6542
6532
  });
6543
6533
  const initializeMintInstruction = createInitializeMint2Instruction(mint, params.decimals, authority, params.freezeAuthority, TOKEN_PROGRAM_ID);
6544
- const ix = await this.registerMint({
6534
+ const ix = await this.createTokenPool({
6545
6535
  feePayer,
6546
6536
  mint,
6547
6537
  });
@@ -6551,11 +6541,11 @@ class CompressedTokenProgram {
6551
6541
  * Enable compression for an existing SPL mint, creating an omnibus account.
6552
6542
  * For new mints, use `CompressedTokenProgram.createMint`.
6553
6543
  */
6554
- static async registerMint(params) {
6544
+ static async createTokenPool(params) {
6555
6545
  const { mint, feePayer } = params;
6556
6546
  const tokenPoolPda = this.deriveTokenPoolPda(mint);
6557
6547
  const ix = await this.program.methods
6558
- .createMint()
6548
+ .createTokenPool()
6559
6549
  .accounts({
6560
6550
  mint,
6561
6551
  feePayer,
@@ -7027,8 +7017,8 @@ async function mintTo(rpc, payer, mint, destination, authority, amount, merkleTr
7027
7017
  *
7028
7018
  * @return transaction signature
7029
7019
  */
7030
- async function registerMint(rpc, payer, mintAddress, confirmOptions) {
7031
- const ix = await CompressedTokenProgram.registerMint({
7020
+ async function createTokenPool(rpc, payer, mintAddress, confirmOptions) {
7021
+ const ix = await CompressedTokenProgram.createTokenPool({
7032
7022
  feePayer: payer.publicKey,
7033
7023
  mint: mintAddress,
7034
7024
  });
@@ -7038,5 +7028,5 @@ async function registerMint(rpc, payer, mintAddress, confirmOptions) {
7038
7028
  return txId;
7039
7029
  }
7040
7030
 
7041
- export { CPI_AUTHORITY_SEED, CompressedTokenProgram, IDL, POOL_SEED, SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE, approveAndMintTo, compress, createDecompressOutputState, createMint, createTransferOutputState, decompress, mintTo, packCompressedTokenAccounts, parseTokenData, registerMint, selectMinCompressedTokenAccountsForTransfer, sumUpTokenAmount, transfer, validateSameTokenOwner };
7031
+ export { CPI_AUTHORITY_SEED, CompressedTokenProgram, IDL, POOL_SEED, SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE, approveAndMintTo, compress, createDecompressOutputState, createMint, createTokenPool, createTransferOutputState, decompress, mintTo, packCompressedTokenAccounts, parseTokenData, selectMinCompressedTokenAccountsForTransfer, sumUpTokenAmount, transfer, validateSameTokenOwner };
7042
7032
  //# sourceMappingURL=index.js.map