@lightprotocol/compressed-token 0.10.0 → 0.11.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 +99 -114
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs +99 -114
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/es/browser/index.js +100 -116
- package/dist/es/browser/index.js.map +1 -1
- package/dist/types/index.d.ts +62 -110
- package/package.json +5 -5
package/dist/types/index.d.ts
CHANGED
|
@@ -1559,120 +1559,23 @@ type LightCompressedToken = {
|
|
|
1559
1559
|
errors: [
|
|
1560
1560
|
{
|
|
1561
1561
|
code: 6000;
|
|
1562
|
-
name: '
|
|
1563
|
-
msg: '
|
|
1562
|
+
name: 'SignerCheckFailed';
|
|
1563
|
+
msg: 'Signer check failed';
|
|
1564
1564
|
},
|
|
1565
1565
|
{
|
|
1566
1566
|
code: 6001;
|
|
1567
|
-
name: '
|
|
1568
|
-
msg: '
|
|
1567
|
+
name: 'CreateTransferInstructionFailed';
|
|
1568
|
+
msg: 'Create transfer instruction failed';
|
|
1569
1569
|
},
|
|
1570
1570
|
{
|
|
1571
1571
|
code: 6002;
|
|
1572
|
-
name: '
|
|
1573
|
-
msg: '
|
|
1572
|
+
name: 'AccountNotFound';
|
|
1573
|
+
msg: 'Account not found';
|
|
1574
1574
|
},
|
|
1575
1575
|
{
|
|
1576
1576
|
code: 6003;
|
|
1577
|
-
name: '
|
|
1578
|
-
msg: '
|
|
1579
|
-
},
|
|
1580
|
-
{
|
|
1581
|
-
code: 6004;
|
|
1582
|
-
name: 'ComputeDecompressSumFailed';
|
|
1583
|
-
msg: 'ComputeDecompressSumFailed';
|
|
1584
|
-
},
|
|
1585
|
-
{
|
|
1586
|
-
code: 6005;
|
|
1587
|
-
name: 'SumCheckFailed';
|
|
1588
|
-
msg: 'SumCheckFailed';
|
|
1589
|
-
},
|
|
1590
|
-
{
|
|
1591
|
-
code: 6006;
|
|
1592
|
-
name: 'DecompressRecipientUndefinedForDecompress';
|
|
1593
|
-
msg: 'DecompressRecipientUndefinedForDecompress';
|
|
1594
|
-
},
|
|
1595
|
-
{
|
|
1596
|
-
code: 6007;
|
|
1597
|
-
name: 'CompressedPdaUndefinedForDecompress';
|
|
1598
|
-
msg: 'CompressedPdaUndefinedForDecompress';
|
|
1599
|
-
},
|
|
1600
|
-
{
|
|
1601
|
-
code: 6008;
|
|
1602
|
-
name: 'DeCompressAmountUndefinedForDecompress';
|
|
1603
|
-
msg: 'DeCompressAmountUndefinedForDecompress';
|
|
1604
|
-
},
|
|
1605
|
-
{
|
|
1606
|
-
code: 6009;
|
|
1607
|
-
name: 'CompressedPdaUndefinedForCompress';
|
|
1608
|
-
msg: 'CompressedPdaUndefinedForCompress';
|
|
1609
|
-
},
|
|
1610
|
-
{
|
|
1611
|
-
code: 6010;
|
|
1612
|
-
name: 'DeCompressAmountUndefinedForCompress';
|
|
1613
|
-
msg: 'DeCompressAmountUndefinedForCompress';
|
|
1614
|
-
},
|
|
1615
|
-
{
|
|
1616
|
-
code: 6011;
|
|
1617
|
-
name: 'DelegateSignerCheckFailed';
|
|
1618
|
-
msg: 'DelegateSignerCheckFailed';
|
|
1619
|
-
},
|
|
1620
|
-
{
|
|
1621
|
-
code: 6012;
|
|
1622
|
-
name: 'MintTooLarge';
|
|
1623
|
-
msg: 'Minted amount greater than u64::MAX';
|
|
1624
|
-
},
|
|
1625
|
-
{
|
|
1626
|
-
code: 6013;
|
|
1627
|
-
name: 'SplTokenSupplyMismatch';
|
|
1628
|
-
msg: 'SplTokenSupplyMismatch';
|
|
1629
|
-
},
|
|
1630
|
-
{
|
|
1631
|
-
code: 6014;
|
|
1632
|
-
name: 'HeapMemoryCheckFailed';
|
|
1633
|
-
msg: 'HeapMemoryCheckFailed';
|
|
1634
|
-
},
|
|
1635
|
-
{
|
|
1636
|
-
code: 6015;
|
|
1637
|
-
name: 'InstructionNotCallable';
|
|
1638
|
-
msg: 'The instruction is not callable';
|
|
1639
|
-
},
|
|
1640
|
-
{
|
|
1641
|
-
code: 6016;
|
|
1642
|
-
name: 'ArithmeticUnderflow';
|
|
1643
|
-
msg: 'ArithmeticUnderflow';
|
|
1644
|
-
},
|
|
1645
|
-
{
|
|
1646
|
-
code: 6017;
|
|
1647
|
-
name: 'HashToFieldError';
|
|
1648
|
-
msg: 'HashToFieldError';
|
|
1649
|
-
},
|
|
1650
|
-
{
|
|
1651
|
-
code: 6018;
|
|
1652
|
-
name: 'InvalidAuthorityMint';
|
|
1653
|
-
msg: 'Expected the authority to be also a mint authority';
|
|
1654
|
-
},
|
|
1655
|
-
{
|
|
1656
|
-
code: 6019;
|
|
1657
|
-
name: 'InvalidFreezeAuthority';
|
|
1658
|
-
msg: 'Provided authority is not the freeze authority';
|
|
1659
|
-
},
|
|
1660
|
-
{
|
|
1661
|
-
code: 6020;
|
|
1662
|
-
name: 'InvalidDelegateIndex';
|
|
1663
|
-
},
|
|
1664
|
-
{
|
|
1665
|
-
code: 6021;
|
|
1666
|
-
name: 'TokenPoolPdaUndefined';
|
|
1667
|
-
},
|
|
1668
|
-
{
|
|
1669
|
-
code: 6022;
|
|
1670
|
-
name: 'IsTokenPoolPda';
|
|
1671
|
-
msg: 'Compress or decompress recipient is the same account as the token pool pda.';
|
|
1672
|
-
},
|
|
1673
|
-
{
|
|
1674
|
-
code: 6023;
|
|
1675
|
-
name: 'InvalidTokenPoolPda';
|
|
1577
|
+
name: 'SerializationError';
|
|
1578
|
+
msg: 'Serialization error';
|
|
1676
1579
|
}
|
|
1677
1580
|
];
|
|
1678
1581
|
};
|
|
@@ -2046,6 +1949,28 @@ type ApproveAndMintToParams = {
|
|
|
2046
1949
|
*/
|
|
2047
1950
|
merkleTree?: PublicKey;
|
|
2048
1951
|
};
|
|
1952
|
+
type CreateTokenProgramLookupTableParams = {
|
|
1953
|
+
/**
|
|
1954
|
+
* The payer of the transaction.
|
|
1955
|
+
*/
|
|
1956
|
+
payer: PublicKey;
|
|
1957
|
+
/**
|
|
1958
|
+
* The authority of the transaction.
|
|
1959
|
+
*/
|
|
1960
|
+
authority: PublicKey;
|
|
1961
|
+
/**
|
|
1962
|
+
* Recently finalized Solana slot.
|
|
1963
|
+
*/
|
|
1964
|
+
recentSlot: number;
|
|
1965
|
+
/**
|
|
1966
|
+
* Optional Mint addresses to store in the lookup table.
|
|
1967
|
+
*/
|
|
1968
|
+
mints?: PublicKey[];
|
|
1969
|
+
/**
|
|
1970
|
+
* Optional additional addresses to store in the lookup table.
|
|
1971
|
+
*/
|
|
1972
|
+
remainingAccounts?: PublicKey[];
|
|
1973
|
+
};
|
|
2049
1974
|
/**
|
|
2050
1975
|
* Sum up the token amounts of the compressed token accounts
|
|
2051
1976
|
*/
|
|
@@ -2122,7 +2047,14 @@ declare class CompressedTokenProgram {
|
|
|
2122
2047
|
*/
|
|
2123
2048
|
static transfer(params: TransferParams): Promise<TransactionInstruction>;
|
|
2124
2049
|
/**
|
|
2125
|
-
*
|
|
2050
|
+
* Create lookup table instructions for the token program's default accounts.
|
|
2051
|
+
*/
|
|
2052
|
+
static createTokenProgramLookupTable(params: CreateTokenProgramLookupTableParams): Promise<{
|
|
2053
|
+
instructions: TransactionInstruction[];
|
|
2054
|
+
address: PublicKey;
|
|
2055
|
+
}>;
|
|
2056
|
+
/**
|
|
2057
|
+
* Create compress instruction
|
|
2126
2058
|
* @returns compressInstruction
|
|
2127
2059
|
*/
|
|
2128
2060
|
static compress(params: CompressParams): Promise<TransactionInstruction>;
|
|
@@ -2212,16 +2144,18 @@ declare function createMint(rpc: Rpc, payer: Signer, mintAuthority: PublicKey, d
|
|
|
2212
2144
|
* @param rpc Rpc to use
|
|
2213
2145
|
* @param payer Payer of the transaction fees
|
|
2214
2146
|
* @param mint Mint for the account
|
|
2215
|
-
* @param destination Address of the account to mint to
|
|
2147
|
+
* @param destination Address of the account to mint to. Can be an array of
|
|
2148
|
+
* addresses if the amount is an array of amounts.
|
|
2216
2149
|
* @param authority Minting authority
|
|
2217
|
-
* @param amount Amount to mint
|
|
2150
|
+
* @param amount Amount to mint. Can be an array of amounts if the
|
|
2151
|
+
* destination is an array of addresses.
|
|
2218
2152
|
* @param merkleTree State tree account that the compressed tokens should be
|
|
2219
2153
|
* part of. Defaults to the default state tree account.
|
|
2220
2154
|
* @param confirmOptions Options for confirming the transaction
|
|
2221
2155
|
*
|
|
2222
2156
|
* @return Signature of the confirmed transaction
|
|
2223
2157
|
*/
|
|
2224
|
-
declare function mintTo(rpc: Rpc, payer: Signer, mint: PublicKey, destination: PublicKey, authority: Signer, amount: number | BN, merkleTree?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2158
|
+
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>;
|
|
2225
2159
|
|
|
2226
2160
|
/**
|
|
2227
2161
|
* Register an existing mint with the CompressedToken program
|
|
@@ -2267,4 +2201,22 @@ declare function selectMinCompressedTokenAccountsForTransfer(accounts: ParsedTok
|
|
|
2267
2201
|
totalLamports: BN | null
|
|
2268
2202
|
];
|
|
2269
2203
|
|
|
2270
|
-
|
|
2204
|
+
/**
|
|
2205
|
+
* Create a lookup table for the token program's default accounts
|
|
2206
|
+
*
|
|
2207
|
+
* @param rpc Rpc connection to use
|
|
2208
|
+
* @param payer Payer of the transaction fees
|
|
2209
|
+
* @param authority Authority of the lookup table
|
|
2210
|
+
* @param mints Optional array of mint public keys to include in
|
|
2211
|
+
* the lookup table
|
|
2212
|
+
* @param additionalAccounts Optional array of additional account public keys
|
|
2213
|
+
* to include in the lookup table
|
|
2214
|
+
*
|
|
2215
|
+
* @return Transaction signatures and the address of the created lookup table
|
|
2216
|
+
*/
|
|
2217
|
+
declare function createTokenProgramLookupTable(rpc: Rpc, payer: Signer, authority: Signer, mints?: PublicKey[], additionalAccounts?: PublicKey[]): Promise<{
|
|
2218
|
+
txIds: TransactionSignature[];
|
|
2219
|
+
address: PublicKey;
|
|
2220
|
+
}>;
|
|
2221
|
+
|
|
2222
|
+
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightprotocol/compressed-token",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.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",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"license": "Apache-2.0",
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@solana/web3.js": "^1.95.0",
|
|
40
|
-
"@lightprotocol/stateless.js": "0.
|
|
40
|
+
"@lightprotocol/stateless.js": "0.11.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@coral-xyz/anchor": "0.29.0",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"tslib": "^2.6.2",
|
|
76
76
|
"typescript": "^5.5.3",
|
|
77
77
|
"vitest": "^1.6.0",
|
|
78
|
-
"@lightprotocol/
|
|
79
|
-
"@lightprotocol/
|
|
78
|
+
"@lightprotocol/hasher.rs": "0.2.0",
|
|
79
|
+
"@lightprotocol/programs": "0.3.0"
|
|
80
80
|
},
|
|
81
81
|
"nx": {
|
|
82
82
|
"targets": {
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"test:e2e:compress": "pnpm test-validator && vitest run tests/e2e/compress.test.ts --reporter=verbose",
|
|
104
104
|
"test:e2e:decompress": "pnpm test-validator && vitest run tests/e2e/decompress.test.ts --reporter=verbose",
|
|
105
105
|
"test:e2e:rpc-token-interop": "pnpm test-validator && vitest run tests/e2e/rpc-token-interop.test.ts --reporter=verbose",
|
|
106
|
-
"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/register-mint.test.ts && vitest run tests/e2e/approve-and-mint-to.test.ts
|
|
106
|
+
"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/register-mint.test.ts && vitest run tests/e2e/approve-and-mint-to.test.ts",
|
|
107
107
|
"pull-idl": "../../scripts/push-compressed-token-idl.sh",
|
|
108
108
|
"build": "rimraf dist && pnpm pull-idl && pnpm build:bundle",
|
|
109
109
|
"build:bundle": "rollup -c",
|