Skip to content

Commit 1b34488

Browse files
rm decompressinterface
test cov: offcurve, zero-amounts test cov: dupe hash failure, v1 reject at ixn boundary more test cov load, add freeze thaw, extend test cov add tests lint frozen handling more tests mark internals rm _tryfetchctokencoldbyaddress cleanups fmt
1 parent 12bec0c commit 1b34488

44 files changed

Lines changed: 5051 additions & 1219 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

js/compressed-token/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## [0.23.0-beta.10]
2+
3+
### Breaking Changes
4+
5+
- **`decompressInterface` removed.** Use `loadAta` (action) or `createLoadAtaInstructions` (instruction builder) instead. `decompressInterface` did not support >8 compressed inputs and has been fully removed.
6+
- **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.
7+
- **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.
8+
19
## [0.23.0-beta.9]
210

311
### Fixed

js/compressed-token/docs/interface.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Concise reference for the v3 interface surface: reads (`getAtaInterface`), loads
1010
| `getOrCreateAtaInterface` | v3 | Create ATA if missing, return interface |
1111
| `createLoadAtaInstructions` | v3 | Instruction batches for loading cold/wrap into ATA |
1212
| `loadAta` | v3 | Action: execute load, return signature |
13+
| `createLoadAccountsParams` | v3 | Build load params for program PDAs + ATAs |
1314
| `createTransferInterfaceInstructions` | v3 | Instruction builder for transfers |
1415
| `transferInterface` | v3 | Action: load + transfer, creates recipient ATA |
1516
| `createLightTokenTransferInstruction` | v3/instructions | Raw c-token transfer ix (no load/wrap) |

js/compressed-token/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
"test:unit:all": "EXCLUDE_E2E=true vitest run",
9999
"test:unit:all:v1": "LIGHT_PROTOCOL_VERSION=V1 vitest run tests/unit --reporter=verbose",
100100
"test:unit:all:v2": "LIGHT_PROTOCOL_VERSION=V2 vitest run tests/unit --reporter=verbose",
101+
"test:unit:delegate-merge-semantics": "vitest run tests/unit/delegate-merge-semantics.test.ts --reporter=verbose",
101102
"test-all:verbose": "vitest run --reporter=verbose",
102103
"test-validator": "./../../cli/test_bin/run test-validator",
103104
"test-validator-skip-prover": "./../../cli/test_bin/run test-validator --skip-prover",
@@ -138,8 +139,10 @@
138139
"test:e2e:load-ata-unified": "pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-unified.test.ts --reporter=verbose",
139140
"test:e2e:load-ata-combined": "pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-combined.test.ts --reporter=verbose",
140141
"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",
142+
"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",
141143
"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",
142-
"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",
144+
"test:e2e:load-ata-freeze": "pnpm test-validator && LIGHT_PROTOCOL_BETA=true vitest run tests/e2e/load-ata-freeze.test.ts --reporter=verbose",
145+
"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",
143146
"test:e2e:all": "pnpm test:e2e:legacy:all && pnpm test:e2e:ctoken:all",
144147
"pull-idl": "../../scripts/push-compressed-token-idl.sh",
145148
"build": "if [ \"$LIGHT_PROTOCOL_VERSION\" = \"V2\" ]; then LIGHT_PROTOCOL_VERSION=V2 pnpm build:bundle; else LIGHT_PROTOCOL_VERSION=V1 pnpm build:bundle; fi",

js/compressed-token/src/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export { CompressedTokenProgram as LightTokenProgram } from './program';
2323
export * from './types';
2424
import {
2525
createLoadAccountsParams,
26-
createLoadAtaInstructionsFromInterface,
2726
createLoadAtaInstructions as _createLoadAtaInstructions,
2827
loadAta as _loadAta,
2928
calculateCompressibleLoadComputeUnits,
@@ -37,7 +36,6 @@ import {
3736

3837
export {
3938
createLoadAccountsParams,
40-
createLoadAtaInstructionsFromInterface,
4139
calculateCompressibleLoadComputeUnits,
4240
selectInputsForAmount,
4341
CompressibleAccountInput,
@@ -75,7 +73,8 @@ export {
7573
createWrapInstruction,
7674
createUnwrapInstruction,
7775
createUnwrapInstructions,
78-
createDecompressInterfaceInstruction,
76+
createCTokenFreezeAccountInstruction,
77+
createCTokenThawAccountInstruction,
7978
createLightTokenTransferInstruction,
8079
// Types
8180
TokenMetadataInstructionData,
@@ -93,7 +92,6 @@ export {
9392
transferInterface,
9493
createTransferInterfaceInstructions,
9594
sliceLast,
96-
decompressInterface,
9795
wrap,
9896
mintTo as mintToCToken,
9997
mintToCompressed,

js/compressed-token/src/v3/actions/create-associated-ctoken.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { getAssociatedCTokenAddress } from '../derivation';
2929
* @param rentPayerPda Optional rent payer PDA
3030
* @param confirmOptions Optional confirm options
3131
* @returns Address of the new associated token account
32+
* @internal
3233
*/
3334
export async function createAssociatedCTokenAccount(
3435
rpc: Rpc,
@@ -76,6 +77,7 @@ export async function createAssociatedCTokenAccount(
7677
* @param rentPayerPda Optional rent payer PDA
7778
* @param confirmOptions Optional confirm options
7879
* @returns Address of the associated token account
80+
* @internal
7981
*/
8082
export async function createAssociatedCTokenAccountIdempotent(
8183
rpc: Rpc,

js/compressed-token/src/v3/actions/decompress-interface.ts

Lines changed: 0 additions & 214 deletions
This file was deleted.

js/compressed-token/src/v3/actions/get-or-create-ata-interface.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export async function getOrCreateAtaInterface(
8787
);
8888
}
8989

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

104-
/** Helper to get PublicKey from owner (which may be Signer or PublicKey) */
104+
/** @internal */
105105
function getOwnerPublicKey(owner: PublicKey | Signer): PublicKey {
106106
return isSigner(owner) ? owner.publicKey : owner;
107107
}

js/compressed-token/src/v3/actions/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export * from './mint-to-compressed';
99
export * from './mint-to-interface';
1010
export * from './get-or-create-ata-interface';
1111
export * from './transfer-interface';
12-
export * from './decompress-interface';
1312
export * from './wrap';
1413
export * from './unwrap';
1514
export * from './load-ata';

0 commit comments

Comments
 (0)