Skip to content
Open
8 changes: 8 additions & 0 deletions js/compressed-token/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## [0.23.0-beta.10]

### Breaking Changes

- **`decompressInterface` removed.** Use `loadAta` (action) or `createLoadAtaInstructions` (instruction builder) instead. `decompressInterface` did not support >8 compressed inputs and has been fully removed.
- **Action (send transaction):** Replace `decompressInterface(rpc, payer, owner, mint, amount?, destinationAta?, destinationOwner?, splInterfaceInfo?, confirmOptions?)` with `loadAta(rpc, ata, owner, mint, payer?, confirmOptions?, interfaceOptions?, wrap?)`. Derive the target ATA with `getAssociatedTokenAddressInterface(mint, owner)` for c-token, or pass the SPL/T22 ATA to decompress to that program. `loadAta` loads all cold balance into the given ATA (no partial amount); it supports >8 inputs via batched transactions and creates the ATA if needed.
- **Instruction-level:** Use `createLoadAtaInstructions(rpc, ata, owner, mint, payer?, interfaceOptions?, wrap?)` to get `TransactionInstruction[][]` and send batches yourself. The single-instruction primitive is no longer exported; use the batched API only.

## [0.23.0-beta.9]

### Fixed
Expand Down
5 changes: 4 additions & 1 deletion js/compressed-token/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"test:unit:all": "EXCLUDE_E2E=true vitest run",
"test:unit:all:v1": "LIGHT_PROTOCOL_VERSION=V1 vitest run tests/unit --reporter=verbose",
"test:unit:all:v2": "LIGHT_PROTOCOL_VERSION=V2 vitest run tests/unit --reporter=verbose",
"test:unit:delegate-merge-semantics": "vitest run tests/unit/delegate-merge-semantics.test.ts --reporter=verbose",
"test-all:verbose": "vitest run --reporter=verbose",
"test-validator": "./../../cli/test_bin/run test-validator",
"test-validator-skip-prover": "./../../cli/test_bin/run test-validator --skip-prover",
Expand Down Expand Up @@ -138,8 +139,10 @@
"test:e2e:load-ata-unified": "pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-unified.test.ts --reporter=verbose",
"test:e2e:load-ata-combined": "pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-combined.test.ts --reporter=verbose",
"test:e2e:load-ata-spl-t22": "pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-spl-t22.test.ts --reporter=verbose",
"test:e2e:multi-cold-inputs-batching": "pnpm test-validator && LIGHT_PROTOCOL_VERSION=V2 LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/multi-cold-inputs-batching.test.ts -t \"instruction-level|hash uniqueness|ensureRecipientAta\" --reporter=verbose && pnpm test-validator && LIGHT_PROTOCOL_VERSION=V2 LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/multi-cold-inputs-batching.test.ts -t \"parallel multi-tx\" --reporter=verbose",
"test:e2e:load-ata:all": "pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-standard.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-unified.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-combined.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-spl-t22.test.ts --bail=1",
"test:e2e:ctoken:all": "pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/create-compressed-mint.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/create-associated-ctoken.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/mint-to-ctoken.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/mint-to-compressed.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/mint-to-interface.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/mint-workflow.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/update-mint.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/update-metadata.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/compressible-load.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/wrap.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/get-mint-interface.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/get-account-interface.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/create-mint-interface.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/create-ata-interface.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/get-or-create-ata-interface.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/transfer-interface.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/unwrap.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/decompress2.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/payment-flows.test.ts --bail=1 && pnpm test-validator && vitest run tests/e2e/v1-v2-migration.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-standard.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-unified.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-combined.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-spl-t22.test.ts --bail=1",
"test:e2e:load-ata-freeze": "pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-freeze.test.ts --reporter=verbose",
"test:e2e:ctoken:all": "pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/create-compressed-mint.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/create-associated-ctoken.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/mint-to-ctoken.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/mint-to-compressed.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/mint-to-interface.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/mint-workflow.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/update-mint.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/update-metadata.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/compressible-load.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/wrap.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/get-mint-interface.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/get-account-interface.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/create-mint-interface.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/create-ata-interface.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/get-or-create-ata-interface.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/transfer-interface.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/unwrap.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/decompress2.test.ts --bail=1 && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/payment-flows.test.ts --bail=1 && pnpm test-validator && vitest run tests/e2e/v1-v2-migration.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-standard.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-unified.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-combined.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-freeze.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-spl-t22.test.ts --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_VERSION=V2 LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/multi-cold-inputs-batching.test.ts -t \"instruction-level|hash uniqueness|ensureRecipientAta\" --bail=1 && pnpm test-validator && LIGHT_PROTOCOL_VERSION=V2 LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/multi-cold-inputs-batching.test.ts -t \"parallel multi-tx\" --bail=1",
"test:e2e:all": "pnpm test:e2e:legacy:all && pnpm test:e2e:ctoken:all",
"pull-idl": "../../scripts/push-compressed-token-idl.sh",
"build": "if [ \"$LIGHT_PROTOCOL_VERSION\" = \"V2\" ]; then LIGHT_PROTOCOL_VERSION=V2 pnpm build:bundle; else LIGHT_PROTOCOL_VERSION=V1 pnpm build:bundle; fi",
Expand Down
2 changes: 0 additions & 2 deletions js/compressed-token/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ export const ADD_TOKEN_POOL_DISCRIMINATOR = Buffer.from([
114, 143, 210, 73, 96, 115, 1, 228,
]);

export const DECOMPRESS_ACCOUNTS_IDEMPOTENT_DISCRIMINATOR = Buffer.from([107]);

/**
* Maximum lamports for rent top-up in a single instruction.
* u16::MAX = no limit; 0 = no top-ups allowed.
Expand Down
24 changes: 3 additions & 21 deletions js/compressed-token/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,12 @@ export * from './program';
export { CompressedTokenProgram as LightTokenProgram } from './program';
export * from './types';
import {
createLoadAccountsParams,
createLoadAtaInstructionsFromInterface,
createLoadAtaInstructions as _createLoadAtaInstructions,
loadAta as _loadAta,
calculateCompressibleLoadComputeUnits,
selectInputsForAmount,
CompressibleAccountInput,
ParsedAccountInfoInterface,
CompressibleLoadParams,
PackedCompressedAccount,
LoadResult,
} from './v3/actions/load-ata';

export {
createLoadAccountsParams,
createLoadAtaInstructionsFromInterface,
calculateCompressibleLoadComputeUnits,
selectInputsForAmount,
CompressibleAccountInput,
ParsedAccountInfoInterface,
CompressibleLoadParams,
PackedCompressedAccount,
LoadResult,
};
export { selectInputsForAmount };

export {
estimateTransactionSize,
Expand Down Expand Up @@ -75,7 +57,8 @@ export {
createWrapInstruction,
createUnwrapInstruction,
createUnwrapInstructions,
createDecompressInterfaceInstruction,
createCTokenFreezeAccountInstruction,
createCTokenThawAccountInstruction,
createLightTokenTransferInstruction,
// Types
TokenMetadataInstructionData,
Expand All @@ -93,7 +76,6 @@ export {
transferInterface,
createTransferInterfaceInstructions,
sliceLast,
decompressInterface,
wrap,
mintTo as mintToCToken,
mintToCompressed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { getAssociatedCTokenAddress } from '../derivation';
* @param rentPayerPda Optional rent payer PDA
* @param confirmOptions Optional confirm options
* @returns Address of the new associated token account
* @internal
*/
export async function createAssociatedCTokenAccount(
rpc: Rpc,
Expand Down Expand Up @@ -76,6 +77,7 @@ export async function createAssociatedCTokenAccount(
* @param rentPayerPda Optional rent payer PDA
* @param confirmOptions Optional confirm options
* @returns Address of the associated token account
* @internal
*/
export async function createAssociatedCTokenAccountIdempotent(
rpc: Rpc,
Expand Down
214 changes: 0 additions & 214 deletions js/compressed-token/src/v3/actions/decompress-interface.ts

This file was deleted.

3 changes: 2 additions & 1 deletion js/compressed-token/src/v3/actions/decompress-mint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from '@lightprotocol/stateless.js';
import { createDecompressMintInstruction } from '../instructions/decompress-mint';
import { getMintInterface } from '../get-mint-interface';
import { ERR_MINT_MISSING_MERKLE_CONTEXT } from '../errors';

export interface DecompressMintParams {
/** Number of epochs to prepay rent (minimum 2, default: 16 for ~24 hours) */
Expand Down Expand Up @@ -66,7 +67,7 @@ export async function decompressMint(
);

if (!mintInterface.merkleContext) {
throw new Error('Mint does not have MerkleContext');
throw new Error(ERR_MINT_MISSING_MERKLE_CONTEXT);
}

// Already decompressed (e.g. createMintInterface now does it atomically).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export async function getOrCreateAtaInterface(
);
}

/** Helper to check if owner is a Signer (has both publicKey and secretKey) */
/** @internal */
function isSigner(owner: PublicKey | Signer): owner is Signer {
// Check for both publicKey and secretKey properties
// A proper Signer (like Keypair) has secretKey as Uint8Array
Expand All @@ -101,7 +101,7 @@ function isSigner(owner: PublicKey | Signer): owner is Signer {
);
}

/** Helper to get PublicKey from owner (which may be Signer or PublicKey) */
/** @internal */
function getOwnerPublicKey(owner: PublicKey | Signer): PublicKey {
return isSigner(owner) ? owner.publicKey : owner;
}
Expand Down
1 change: 0 additions & 1 deletion js/compressed-token/src/v3/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export * from './mint-to-compressed';
export * from './mint-to-interface';
export * from './get-or-create-ata-interface';
export * from './transfer-interface';
export * from './decompress-interface';
export * from './wrap';
export * from './unwrap';
export * from './load-ata';
Loading