@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.
- package/dist/cjs/browser/index.cjs +17 -27
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs +17 -27
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/es/browser/index.js +18 -28
- package/dist/es/browser/index.js.map +1 -1
- package/dist/types/index.d.ts +15 -34
- package/package.json +2 -2
package/dist/cjs/node/index.cjs
CHANGED
|
@@ -6,11 +6,11 @@ var anchor = require('@coral-xyz/anchor');
|
|
|
6
6
|
var require$$0 = require('buffer');
|
|
7
7
|
|
|
8
8
|
const IDL = {
|
|
9
|
-
version: '0.4.
|
|
9
|
+
version: '0.4.1',
|
|
10
10
|
name: 'light_compressed_token',
|
|
11
11
|
instructions: [
|
|
12
12
|
{
|
|
13
|
-
name: '
|
|
13
|
+
name: 'createTokenPool',
|
|
14
14
|
docs: [
|
|
15
15
|
'This instruction expects a mint account to be created in a separate',
|
|
16
16
|
'token program instruction with token authority as mint authority. This',
|
|
@@ -882,12 +882,6 @@ const IDL = {
|
|
|
882
882
|
option: 'u8',
|
|
883
883
|
},
|
|
884
884
|
},
|
|
885
|
-
{
|
|
886
|
-
name: 'isNative',
|
|
887
|
-
type: {
|
|
888
|
-
option: 'u64',
|
|
889
|
-
},
|
|
890
|
-
},
|
|
891
885
|
{
|
|
892
886
|
name: 'merkleContext',
|
|
893
887
|
type: {
|
|
@@ -898,6 +892,12 @@ const IDL = {
|
|
|
898
892
|
name: 'rootIndex',
|
|
899
893
|
type: 'u16',
|
|
900
894
|
},
|
|
895
|
+
{
|
|
896
|
+
name: 'lamports',
|
|
897
|
+
type: {
|
|
898
|
+
option: 'u64',
|
|
899
|
+
},
|
|
900
|
+
},
|
|
901
901
|
],
|
|
902
902
|
},
|
|
903
903
|
},
|
|
@@ -1348,18 +1348,6 @@ const IDL = {
|
|
|
1348
1348
|
defined: 'AccountState',
|
|
1349
1349
|
},
|
|
1350
1350
|
},
|
|
1351
|
-
{
|
|
1352
|
-
name: 'isNative',
|
|
1353
|
-
docs: [
|
|
1354
|
-
'If is_some, this is a native token, and the value logs the rent-exempt',
|
|
1355
|
-
'reserve. An Account is required to be rent-exempt, so the value is',
|
|
1356
|
-
'used by the Processor to ensure that wrapped SOL accounts do not',
|
|
1357
|
-
'drop below this threshold.',
|
|
1358
|
-
],
|
|
1359
|
-
type: {
|
|
1360
|
-
option: 'u64',
|
|
1361
|
-
},
|
|
1362
|
-
},
|
|
1363
1351
|
],
|
|
1364
1352
|
},
|
|
1365
1353
|
},
|
|
@@ -1495,13 +1483,15 @@ function packCompressedTokenAccounts(params) {
|
|
|
1495
1483
|
packedInputTokenData.push({
|
|
1496
1484
|
amount: account.parsed.amount,
|
|
1497
1485
|
delegateIndex,
|
|
1498
|
-
isNative: account.parsed.isNative,
|
|
1499
1486
|
merkleContext: {
|
|
1500
1487
|
merkleTreePubkeyIndex,
|
|
1501
1488
|
nullifierQueuePubkeyIndex,
|
|
1502
1489
|
leafIndex: account.compressedAccount.leafIndex,
|
|
1503
1490
|
},
|
|
1504
1491
|
rootIndex: rootIndices[index],
|
|
1492
|
+
lamports: account.compressedAccount.lamports.eq(stateless_js.bn(0))
|
|
1493
|
+
? null
|
|
1494
|
+
: account.compressedAccount.lamports,
|
|
1505
1495
|
});
|
|
1506
1496
|
});
|
|
1507
1497
|
/// pack output state trees
|
|
@@ -4516,7 +4506,7 @@ class CompressedTokenProgram {
|
|
|
4516
4506
|
space: MINT_SIZE,
|
|
4517
4507
|
});
|
|
4518
4508
|
const initializeMintInstruction = createInitializeMint2Instruction(mint, params.decimals, authority, params.freezeAuthority, TOKEN_PROGRAM_ID);
|
|
4519
|
-
const ix = await this.
|
|
4509
|
+
const ix = await this.createTokenPool({
|
|
4520
4510
|
feePayer,
|
|
4521
4511
|
mint,
|
|
4522
4512
|
});
|
|
@@ -4526,11 +4516,11 @@ class CompressedTokenProgram {
|
|
|
4526
4516
|
* Enable compression for an existing SPL mint, creating an omnibus account.
|
|
4527
4517
|
* For new mints, use `CompressedTokenProgram.createMint`.
|
|
4528
4518
|
*/
|
|
4529
|
-
static async
|
|
4519
|
+
static async createTokenPool(params) {
|
|
4530
4520
|
const { mint, feePayer } = params;
|
|
4531
4521
|
const tokenPoolPda = this.deriveTokenPoolPda(mint);
|
|
4532
4522
|
const ix = await this.program.methods
|
|
4533
|
-
.
|
|
4523
|
+
.createTokenPool()
|
|
4534
4524
|
.accounts({
|
|
4535
4525
|
mint,
|
|
4536
4526
|
feePayer,
|
|
@@ -5007,8 +4997,8 @@ async function mintTo(rpc, payer, mint, destination, authority, amount, merkleTr
|
|
|
5007
4997
|
*
|
|
5008
4998
|
* @return transaction signature
|
|
5009
4999
|
*/
|
|
5010
|
-
async function
|
|
5011
|
-
const ix = await CompressedTokenProgram.
|
|
5000
|
+
async function createTokenPool(rpc, payer, mintAddress, confirmOptions) {
|
|
5001
|
+
const ix = await CompressedTokenProgram.createTokenPool({
|
|
5012
5002
|
feePayer: payer.publicKey,
|
|
5013
5003
|
mint: mintAddress,
|
|
5014
5004
|
});
|
|
@@ -5027,12 +5017,12 @@ exports.approveAndMintTo = approveAndMintTo;
|
|
|
5027
5017
|
exports.compress = compress;
|
|
5028
5018
|
exports.createDecompressOutputState = createDecompressOutputState;
|
|
5029
5019
|
exports.createMint = createMint;
|
|
5020
|
+
exports.createTokenPool = createTokenPool;
|
|
5030
5021
|
exports.createTransferOutputState = createTransferOutputState;
|
|
5031
5022
|
exports.decompress = decompress;
|
|
5032
5023
|
exports.mintTo = mintTo;
|
|
5033
5024
|
exports.packCompressedTokenAccounts = packCompressedTokenAccounts;
|
|
5034
5025
|
exports.parseTokenData = parseTokenData;
|
|
5035
|
-
exports.registerMint = registerMint;
|
|
5036
5026
|
exports.selectMinCompressedTokenAccountsForTransfer = selectMinCompressedTokenAccountsForTransfer;
|
|
5037
5027
|
exports.sumUpTokenAmount = sumUpTokenAmount;
|
|
5038
5028
|
exports.transfer = transfer;
|