@lightprotocol/compressed-token 0.12.0 → 0.14.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.
- package/dist/cjs/browser/index.cjs +71 -114
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs +71 -114
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/es/browser/index.js +71 -115
- package/dist/es/browser/index.js.map +1 -1
- package/dist/types/index.d.ts +59 -115
- package/package.json +5 -4
package/dist/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { PublicKey, AccountMeta, TransactionInstruction, Signer, ConfirmOptions,
|
|
|
3
3
|
import { BN, Program } from '@coral-xyz/anchor';
|
|
4
4
|
|
|
5
5
|
type LightCompressedToken = {
|
|
6
|
-
version: '1.
|
|
6
|
+
version: '1.2.0';
|
|
7
7
|
name: 'light_compressed_token';
|
|
8
8
|
instructions: [
|
|
9
9
|
{
|
|
@@ -1553,128 +1553,23 @@ type LightCompressedToken = {
|
|
|
1553
1553
|
errors: [
|
|
1554
1554
|
{
|
|
1555
1555
|
code: 6000;
|
|
1556
|
-
name: '
|
|
1557
|
-
msg: '
|
|
1556
|
+
name: 'SignerCheckFailed';
|
|
1557
|
+
msg: 'Signer check failed';
|
|
1558
1558
|
},
|
|
1559
1559
|
{
|
|
1560
1560
|
code: 6001;
|
|
1561
|
-
name: '
|
|
1562
|
-
msg: '
|
|
1561
|
+
name: 'CreateTransferInstructionFailed';
|
|
1562
|
+
msg: 'Create transfer instruction failed';
|
|
1563
1563
|
},
|
|
1564
1564
|
{
|
|
1565
1565
|
code: 6002;
|
|
1566
|
-
name: '
|
|
1567
|
-
msg: '
|
|
1566
|
+
name: 'AccountNotFound';
|
|
1567
|
+
msg: 'Account not found';
|
|
1568
1568
|
},
|
|
1569
1569
|
{
|
|
1570
1570
|
code: 6003;
|
|
1571
|
-
name: '
|
|
1572
|
-
msg: '
|
|
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';
|
|
1657
|
-
},
|
|
1658
|
-
{
|
|
1659
|
-
code: 6021;
|
|
1660
|
-
name: 'TokenPoolPdaUndefined';
|
|
1661
|
-
},
|
|
1662
|
-
{
|
|
1663
|
-
code: 6022;
|
|
1664
|
-
name: 'IsTokenPoolPda';
|
|
1665
|
-
msg: 'Compress or decompress recipient is the same account as the token pool pda.';
|
|
1666
|
-
},
|
|
1667
|
-
{
|
|
1668
|
-
code: 6023;
|
|
1669
|
-
name: 'InvalidTokenPoolPda';
|
|
1670
|
-
},
|
|
1671
|
-
{
|
|
1672
|
-
code: 6024;
|
|
1673
|
-
name: 'NoInputTokenAccountsProvided';
|
|
1674
|
-
},
|
|
1675
|
-
{
|
|
1676
|
-
code: 6025;
|
|
1677
|
-
name: 'NoInputsProvided';
|
|
1571
|
+
name: 'SerializationError';
|
|
1572
|
+
msg: 'Serialization error';
|
|
1678
1573
|
}
|
|
1679
1574
|
];
|
|
1680
1575
|
};
|
|
@@ -1974,6 +1869,39 @@ type CreateMintParams = {
|
|
|
1974
1869
|
*/
|
|
1975
1870
|
rentExemptBalance: number;
|
|
1976
1871
|
};
|
|
1872
|
+
/**
|
|
1873
|
+
* Parameters for merging compressed token accounts
|
|
1874
|
+
*/
|
|
1875
|
+
type MergeTokenAccountsParams = {
|
|
1876
|
+
/**
|
|
1877
|
+
* Tx feepayer
|
|
1878
|
+
*/
|
|
1879
|
+
payer: PublicKey;
|
|
1880
|
+
/**
|
|
1881
|
+
* Owner of the token accounts to be merged
|
|
1882
|
+
*/
|
|
1883
|
+
owner: PublicKey;
|
|
1884
|
+
/**
|
|
1885
|
+
* Mint public key
|
|
1886
|
+
*/
|
|
1887
|
+
mint: PublicKey;
|
|
1888
|
+
/**
|
|
1889
|
+
* Array of compressed token accounts to merge
|
|
1890
|
+
*/
|
|
1891
|
+
inputCompressedTokenAccounts: ParsedTokenAccount[];
|
|
1892
|
+
/**
|
|
1893
|
+
* Optional: Public key of the state tree to merge into
|
|
1894
|
+
*/
|
|
1895
|
+
outputStateTree: PublicKey;
|
|
1896
|
+
/**
|
|
1897
|
+
* Optional: Recent validity proof for state inclusion
|
|
1898
|
+
*/
|
|
1899
|
+
recentValidityProof: CompressedProof;
|
|
1900
|
+
/**
|
|
1901
|
+
* Optional: Recent state root indices of the input state
|
|
1902
|
+
*/
|
|
1903
|
+
recentInputStateRootIndices: number[];
|
|
1904
|
+
};
|
|
1977
1905
|
/**
|
|
1978
1906
|
* Create compressed token accounts
|
|
1979
1907
|
*/
|
|
@@ -2161,6 +2089,7 @@ declare class CompressedTokenProgram {
|
|
|
2161
2089
|
* Construct decompress instruction
|
|
2162
2090
|
*/
|
|
2163
2091
|
static decompress(params: DecompressParams): Promise<TransactionInstruction>;
|
|
2092
|
+
static mergeTokenAccounts(params: MergeTokenAccountsParams): Promise<TransactionInstruction[]>;
|
|
2164
2093
|
}
|
|
2165
2094
|
|
|
2166
2095
|
/**
|
|
@@ -2256,6 +2185,21 @@ declare function createMint(rpc: Rpc, payer: Signer, mintAuthority: PublicKey, d
|
|
|
2256
2185
|
*/
|
|
2257
2186
|
declare function mintTo(rpc: Rpc, payer: Signer, mint: PublicKey, destination: PublicKey | PublicKey[], authority: Signer, amount: number | BN | number[] | BN[], merkleTree?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2258
2187
|
|
|
2188
|
+
/**
|
|
2189
|
+
* Merge multiple compressed token accounts for a given mint into a single
|
|
2190
|
+
* account
|
|
2191
|
+
*
|
|
2192
|
+
* @param rpc RPC to use
|
|
2193
|
+
* @param payer Payer of the transaction fees
|
|
2194
|
+
* @param mint Public key of the token's mint
|
|
2195
|
+
* @param owner Owner of the token accounts to be merged
|
|
2196
|
+
* @param merkleTree Optional merkle tree for compressed tokens
|
|
2197
|
+
* @param confirmOptions Options for confirming the transaction
|
|
2198
|
+
*
|
|
2199
|
+
* @return Array of transaction signatures
|
|
2200
|
+
*/
|
|
2201
|
+
declare function mergeTokenAccounts(rpc: Rpc, payer: Signer, mint: PublicKey, owner: Signer, merkleTree?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2202
|
+
|
|
2259
2203
|
/**
|
|
2260
2204
|
* Register an existing mint with the CompressedToken program
|
|
2261
2205
|
*
|
|
@@ -2318,4 +2262,4 @@ declare function createTokenProgramLookupTable(rpc: Rpc, payer: Signer, authorit
|
|
|
2318
2262
|
address: PublicKey;
|
|
2319
2263
|
}>;
|
|
2320
2264
|
|
|
2321
|
-
export { type ApproveAndMintToParams, CPI_AUTHORITY_SEED, type CompressedTokenInstructionDataInvoke, CompressedTokenProgram, type CreateMintParams, type CreateTokenProgramLookupTableParams, IDL, type InputTokenDataWithContext, type LightCompressedToken, type MintToParams, POOL_SEED, type PackCompressedTokenAccountsParams, type PackedTokenTransferOutputData, type RegisterMintParams, SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE, type TokenData, type TokenTransferOutputData, type TransferParams, approveAndMintTo, compress, createDecompressOutputState, createMint, createTokenPool, createTokenProgramLookupTable, createTransferOutputState, decompress, mintTo, packCompressedTokenAccounts, parseTokenData, selectMinCompressedTokenAccountsForTransfer, sumUpTokenAmount, transfer, validateSameTokenOwner };
|
|
2265
|
+
export { type ApproveAndMintToParams, CPI_AUTHORITY_SEED, type CompressedTokenInstructionDataInvoke, CompressedTokenProgram, type CreateMintParams, type CreateTokenProgramLookupTableParams, IDL, type InputTokenDataWithContext, type LightCompressedToken, type MergeTokenAccountsParams, type MintToParams, POOL_SEED, type PackCompressedTokenAccountsParams, type PackedTokenTransferOutputData, type RegisterMintParams, SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE, type TokenData, type TokenTransferOutputData, type TransferParams, approveAndMintTo, compress, createDecompressOutputState, createMint, createTokenPool, createTokenProgramLookupTable, createTransferOutputState, decompress, mergeTokenAccounts, mintTo, packCompressedTokenAccounts, parseTokenData, selectMinCompressedTokenAccountsForTransfer, sumUpTokenAmount, transfer, validateSameTokenOwner };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightprotocol/compressed-token",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "JS client to interact with the compressed-token program",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/node/index.cjs",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
],
|
|
37
37
|
"license": "Apache-2.0",
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@lightprotocol/stateless.js": "0.
|
|
39
|
+
"@lightprotocol/stateless.js": "0.14.1"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@coral-xyz/anchor": "0.29.0",
|
|
@@ -97,14 +97,15 @@
|
|
|
97
97
|
"test-all:verbose": "vitest run --reporter=verbose",
|
|
98
98
|
"test-validator": "./../../cli/test_bin/run test-validator",
|
|
99
99
|
"test:e2e:create-mint": "pnpm test-validator && vitest run tests/e2e/create-mint.test.ts",
|
|
100
|
-
"test:e2e:
|
|
100
|
+
"test:e2e:create-token-pool": "pnpm test-validator && vitest run tests/e2e/create-token-pool.test.ts",
|
|
101
101
|
"test:e2e:mint-to": "pnpm test-validator && vitest run tests/e2e/mint-to.test.ts --reporter=verbose",
|
|
102
102
|
"test:e2e:approve-and-mint-to": "pnpm test-validator && vitest run tests/e2e/approve-and-mint-to.test.ts --reporter=verbose",
|
|
103
|
+
"test:e2e:merge-token-accounts": "pnpm test-validator && vitest run tests/e2e/merge-token-accounts.test.ts --reporter=verbose",
|
|
103
104
|
"test:e2e:transfer": "pnpm test-validator && vitest run tests/e2e/transfer.test.ts --reporter=verbose",
|
|
104
105
|
"test:e2e:compress": "pnpm test-validator && vitest run tests/e2e/compress.test.ts --reporter=verbose",
|
|
105
106
|
"test:e2e:decompress": "pnpm test-validator && vitest run tests/e2e/decompress.test.ts --reporter=verbose",
|
|
106
107
|
"test:e2e:rpc-token-interop": "pnpm test-validator && vitest run tests/e2e/rpc-token-interop.test.ts --reporter=verbose",
|
|
107
|
-
"test:e2e:all": "pnpm test-validator && vitest run tests/e2e/create-mint.test.ts && vitest run tests/e2e/mint-to.test.ts && vitest run tests/e2e/transfer.test.ts && vitest run tests/e2e/compress.test.ts && vitest run tests/e2e/decompress.test.ts && vitest run tests/e2e/
|
|
108
|
+
"test:e2e:all": "pnpm test-validator && vitest run tests/e2e/create-mint.test.ts && vitest run tests/e2e/mint-to.test.ts && vitest run tests/e2e/transfer.test.ts && vitest run tests/e2e/compress.test.ts && vitest run tests/e2e/decompress.test.ts && vitest run tests/e2e/create-token-pool.test.ts && vitest run tests/e2e/approve-and-mint-to.test.ts && vitest run tests/e2e/rpc-token-interop.test.ts",
|
|
108
109
|
"pull-idl": "../../scripts/push-compressed-token-idl.sh",
|
|
109
110
|
"build": "rimraf dist && pnpm pull-idl && pnpm build:bundle",
|
|
110
111
|
"build:bundle": "rollup -c",
|