@lightprotocol/compressed-token 0.15.0 → 0.15.2

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.
@@ -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: [
@@ -2031,6 +2131,32 @@ declare function createTransferOutputState(inputCompressedTokenAccounts: ParsedT
2031
2131
  * instruction
2032
2132
  */
2033
2133
  declare function createDecompressOutputState(inputCompressedTokenAccounts: ParsedTokenAccount[], amount: number | BN): TokenTransferOutputData$1[];
2134
+ type CompressSplTokenAccountParams = {
2135
+ /**
2136
+ * Tx feepayer
2137
+ */
2138
+ feePayer: PublicKey;
2139
+ /**
2140
+ * Authority that owns the token account
2141
+ */
2142
+ authority: PublicKey;
2143
+ /**
2144
+ * Token account to compress
2145
+ */
2146
+ tokenAccount: PublicKey;
2147
+ /**
2148
+ * Mint public key
2149
+ */
2150
+ mint: PublicKey;
2151
+ /**
2152
+ * Optional: remaining amount to leave in token account. Default: 0
2153
+ */
2154
+ remainingAmount?: BN;
2155
+ /**
2156
+ * The state tree that the compressed token account should be inserted into.
2157
+ */
2158
+ outputStateTree: PublicKey;
2159
+ };
2034
2160
  declare class CompressedTokenProgram {
2035
2161
  /**
2036
2162
  * @internal
@@ -2090,6 +2216,7 @@ declare class CompressedTokenProgram {
2090
2216
  */
2091
2217
  static decompress(params: DecompressParams): Promise<TransactionInstruction>;
2092
2218
  static mergeTokenAccounts(params: MergeTokenAccountsParams): Promise<TransactionInstruction[]>;
2219
+ static compressSplTokenAccount(params: CompressSplTokenAccountParams): Promise<TransactionInstruction>;
2093
2220
  }
2094
2221
 
2095
2222
  /**
@@ -2262,4 +2389,20 @@ declare function createTokenProgramLookupTable(rpc: Rpc, payer: Signer, authorit
2262
2389
  address: PublicKey;
2263
2390
  }>;
2264
2391
 
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 };
2392
+ /**
2393
+ * Compress SPL tokens into compressed token format
2394
+ *
2395
+ * @param rpc Rpc connection to use
2396
+ * @param payer Payer of the transaction fees
2397
+ * @param mint Mint of the token to compress
2398
+ * @param owner Owner of the token account
2399
+ * @param tokenAccount Token account to compress
2400
+ * @param outputStateTree State tree to insert the compressed token account into
2401
+ * @param remainingAmount Optional: amount to leave in token account. Default: 0
2402
+ * @param confirmOptions Options for confirming the transaction
2403
+ *
2404
+ * @return Signature of the confirmed transaction
2405
+ */
2406
+ declare function compressSplTokenAccount(rpc: Rpc, payer: Signer, mint: PublicKey, owner: Signer, tokenAccount: PublicKey, outputStateTree: PublicKey, remainingAmount?: BN, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2407
+
2408
+ export { type ApproveAndMintToParams, CPI_AUTHORITY_SEED, type CompressSplTokenAccountParams, 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, 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.0",
3
+ "version": "0.15.2",
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.0"
39
+ "@lightprotocol/stateless.js": "0.15.1"
40
40
  },
41
41
  "dependencies": {
42
42
  "@coral-xyz/anchor": "0.29.0",
@@ -103,9 +103,10 @@
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: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",
109
+ "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",
109
110
  "pull-idl": "../../scripts/push-compressed-token-idl.sh",
110
111
  "build": "rimraf dist && pnpm pull-idl && pnpm build:bundle",
111
112
  "build:bundle": "rollup -c",