@lightprotocol/compressed-token 0.15.1 → 0.15.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/README.md +0 -1
- package/dist/cjs/browser/index.cjs +180 -0
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs +180 -0
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/es/browser/index.js +180 -1
- package/dist/es/browser/index.js.map +1 -1
- package/dist/types/index.d.ts +151 -1
- package/package.json +7 -5
package/dist/types/index.d.ts
CHANGED
|
@@ -164,6 +164,106 @@ type LightCompressedToken = {
|
|
|
164
164
|
}
|
|
165
165
|
];
|
|
166
166
|
},
|
|
167
|
+
{
|
|
168
|
+
name: 'compressSplTokenAccount';
|
|
169
|
+
accounts: [
|
|
170
|
+
{
|
|
171
|
+
name: 'feePayer';
|
|
172
|
+
isMut: true;
|
|
173
|
+
isSigner: true;
|
|
174
|
+
docs: ['UNCHECKED: only pays fees.'];
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: 'authority';
|
|
178
|
+
isMut: false;
|
|
179
|
+
isSigner: true;
|
|
180
|
+
docs: [
|
|
181
|
+
'Authority is verified through proof since both owner and delegate',
|
|
182
|
+
'are included in the token data hash, which is a public input to the',
|
|
183
|
+
'validity proof.'
|
|
184
|
+
];
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: 'cpiAuthorityPda';
|
|
188
|
+
isMut: false;
|
|
189
|
+
isSigner: false;
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: 'lightSystemProgram';
|
|
193
|
+
isMut: false;
|
|
194
|
+
isSigner: false;
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: 'registeredProgramPda';
|
|
198
|
+
isMut: false;
|
|
199
|
+
isSigner: false;
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: 'noopProgram';
|
|
203
|
+
isMut: false;
|
|
204
|
+
isSigner: false;
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
name: 'accountCompressionAuthority';
|
|
208
|
+
isMut: false;
|
|
209
|
+
isSigner: false;
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: 'accountCompressionProgram';
|
|
213
|
+
isMut: false;
|
|
214
|
+
isSigner: false;
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: 'selfProgram';
|
|
218
|
+
isMut: false;
|
|
219
|
+
isSigner: false;
|
|
220
|
+
docs: ['this program is the signer of the cpi.'];
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: 'tokenPoolPda';
|
|
224
|
+
isMut: true;
|
|
225
|
+
isSigner: false;
|
|
226
|
+
isOptional: true;
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
name: 'compressOrDecompressTokenAccount';
|
|
230
|
+
isMut: true;
|
|
231
|
+
isSigner: false;
|
|
232
|
+
isOptional: true;
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: 'tokenProgram';
|
|
236
|
+
isMut: false;
|
|
237
|
+
isSigner: false;
|
|
238
|
+
isOptional: true;
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: 'systemProgram';
|
|
242
|
+
isMut: false;
|
|
243
|
+
isSigner: false;
|
|
244
|
+
}
|
|
245
|
+
];
|
|
246
|
+
args: [
|
|
247
|
+
{
|
|
248
|
+
name: 'owner';
|
|
249
|
+
type: 'publicKey';
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: 'remainingAmount';
|
|
253
|
+
type: {
|
|
254
|
+
option: 'u64';
|
|
255
|
+
};
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
name: 'cpiContext';
|
|
259
|
+
type: {
|
|
260
|
+
option: {
|
|
261
|
+
defined: 'CompressedCpiContext';
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
];
|
|
266
|
+
},
|
|
167
267
|
{
|
|
168
268
|
name: 'transfer';
|
|
169
269
|
docs: [
|
|
@@ -1772,6 +1872,32 @@ type CompressParams = {
|
|
|
1772
1872
|
*/
|
|
1773
1873
|
outputStateTree?: PublicKey;
|
|
1774
1874
|
};
|
|
1875
|
+
type CompressSplTokenAccountParams = {
|
|
1876
|
+
/**
|
|
1877
|
+
* Tx feepayer
|
|
1878
|
+
*/
|
|
1879
|
+
feePayer: PublicKey;
|
|
1880
|
+
/**
|
|
1881
|
+
* Authority that owns the token account
|
|
1882
|
+
*/
|
|
1883
|
+
authority: PublicKey;
|
|
1884
|
+
/**
|
|
1885
|
+
* Token account to compress
|
|
1886
|
+
*/
|
|
1887
|
+
tokenAccount: PublicKey;
|
|
1888
|
+
/**
|
|
1889
|
+
* Mint public key
|
|
1890
|
+
*/
|
|
1891
|
+
mint: PublicKey;
|
|
1892
|
+
/**
|
|
1893
|
+
* Optional: remaining amount to leave in token account. Default: 0
|
|
1894
|
+
*/
|
|
1895
|
+
remainingAmount?: BN;
|
|
1896
|
+
/**
|
|
1897
|
+
* The state tree that the compressed token account should be inserted into.
|
|
1898
|
+
*/
|
|
1899
|
+
outputStateTree: PublicKey;
|
|
1900
|
+
};
|
|
1775
1901
|
type DecompressParams = {
|
|
1776
1902
|
/**
|
|
1777
1903
|
* The payer of the transaction.
|
|
@@ -2040,6 +2166,13 @@ declare class CompressedTokenProgram {
|
|
|
2040
2166
|
* Public key that identifies the CompressedPda program
|
|
2041
2167
|
*/
|
|
2042
2168
|
static programId: PublicKey;
|
|
2169
|
+
/**
|
|
2170
|
+
* Set a custom programId via PublicKey or base58 encoded string.
|
|
2171
|
+
* This method is not required for regular usage.
|
|
2172
|
+
*
|
|
2173
|
+
* Use this only if you know what you are doing.
|
|
2174
|
+
*/
|
|
2175
|
+
static setProgramId(programId: PublicKey | string): void;
|
|
2043
2176
|
private static _program;
|
|
2044
2177
|
/** @internal */
|
|
2045
2178
|
static get program(): Program<LightCompressedToken>;
|
|
@@ -2090,6 +2223,7 @@ declare class CompressedTokenProgram {
|
|
|
2090
2223
|
*/
|
|
2091
2224
|
static decompress(params: DecompressParams): Promise<TransactionInstruction>;
|
|
2092
2225
|
static mergeTokenAccounts(params: MergeTokenAccountsParams): Promise<TransactionInstruction[]>;
|
|
2226
|
+
static compressSplTokenAccount(params: CompressSplTokenAccountParams): Promise<TransactionInstruction>;
|
|
2093
2227
|
}
|
|
2094
2228
|
|
|
2095
2229
|
/**
|
|
@@ -2262,4 +2396,20 @@ declare function createTokenProgramLookupTable(rpc: Rpc, payer: Signer, authorit
|
|
|
2262
2396
|
address: PublicKey;
|
|
2263
2397
|
}>;
|
|
2264
2398
|
|
|
2265
|
-
|
|
2399
|
+
/**
|
|
2400
|
+
* Compress SPL tokens into compressed token format
|
|
2401
|
+
*
|
|
2402
|
+
* @param rpc Rpc connection to use
|
|
2403
|
+
* @param payer Payer of the transaction fees
|
|
2404
|
+
* @param mint Mint of the token to compress
|
|
2405
|
+
* @param owner Owner of the token account
|
|
2406
|
+
* @param tokenAccount Token account to compress
|
|
2407
|
+
* @param outputStateTree State tree to insert the compressed token account into
|
|
2408
|
+
* @param remainingAmount Optional: amount to leave in token account. Default: 0
|
|
2409
|
+
* @param confirmOptions Options for confirming the transaction
|
|
2410
|
+
*
|
|
2411
|
+
* @return Signature of the confirmed transaction
|
|
2412
|
+
*/
|
|
2413
|
+
declare function compressSplTokenAccount(rpc: Rpc, payer: Signer, mint: PublicKey, owner: Signer, tokenAccount: PublicKey, outputStateTree: PublicKey, remainingAmount?: BN, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2414
|
+
|
|
2415
|
+
export { type ApproveAndMintToParams, CPI_AUTHORITY_SEED, type CompressParams, type CompressSplTokenAccountParams, type CompressedTokenInstructionDataInvoke, CompressedTokenProgram, type CreateMintParams, type CreateTokenProgramLookupTableParams, type DecompressParams, 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, compressSplTokenAccount, 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.15.
|
|
3
|
+
"version": "0.15.3",
|
|
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.15.
|
|
39
|
+
"@lightprotocol/stateless.js": "0.15.2"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@coral-xyz/anchor": "0.29.0",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"tslib": "^2.7.0",
|
|
77
77
|
"typescript": "^5.6.2",
|
|
78
78
|
"vitest": "^2.1.1",
|
|
79
|
-
"@lightprotocol/
|
|
80
|
-
"@lightprotocol/
|
|
79
|
+
"@lightprotocol/programs": "0.3.0",
|
|
80
|
+
"@lightprotocol/hasher.rs": "0.2.0"
|
|
81
81
|
},
|
|
82
82
|
"nx": {
|
|
83
83
|
"targets": {
|
|
@@ -103,9 +103,11 @@
|
|
|
103
103
|
"test:e2e:merge-token-accounts": "pnpm test-validator && vitest run tests/e2e/merge-token-accounts.test.ts --reporter=verbose",
|
|
104
104
|
"test:e2e:transfer": "pnpm test-validator && vitest run tests/e2e/transfer.test.ts --reporter=verbose",
|
|
105
105
|
"test:e2e:compress": "pnpm test-validator && vitest run tests/e2e/compress.test.ts --reporter=verbose",
|
|
106
|
+
"test:e2e:compress-spl-token-account": "pnpm test-validator && vitest run tests/e2e/compress-spl-token-account.test.ts --reporter=verbose",
|
|
106
107
|
"test:e2e:decompress": "pnpm test-validator && vitest run tests/e2e/decompress.test.ts --reporter=verbose",
|
|
107
108
|
"test:e2e:rpc-token-interop": "pnpm test-validator && vitest run tests/e2e/rpc-token-interop.test.ts --reporter=verbose",
|
|
108
|
-
"test:e2e:
|
|
109
|
+
"test:e2e:custom-program-id": "vitest run tests/e2e/custom-program-id.test.ts --reporter=verbose",
|
|
110
|
+
"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/compress-spl-token-account.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 && vitest run tests/e2e/custom-program-id.test.ts",
|
|
109
111
|
"pull-idl": "../../scripts/push-compressed-token-idl.sh",
|
|
110
112
|
"build": "rimraf dist && pnpm pull-idl && pnpm build:bundle",
|
|
111
113
|
"build:bundle": "rollup -c",
|