Skip to content

Commit 2ac68f1

Browse files
chore: js, load, new call sigs, renames (#2316)
* 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 * unwrap consistent * remove createLoadAccountsParams * add uni err * fix * remove layout serde, add load-ata instruction * apply review fixes, simplify delegate and frozen reasoning * update freeze thaw * test upd * fix cold load delegate * fmt * fix ci * add test cov: tx size * rename ctoken full v3 * renames * wip * checked for all interface, pass decimals * use destination directly in transferinterface * format * fix lint * fix lint * fix transfer-interface.test.ts * address last remaining comment * add changelog: br change decimals * fix mds * apply review comments * format * lint * for unwrap/wrap ixns we should always do wrap=false * fixes * lint * fix version mismatch between formatter and linter * better errors for getAccountInterface and getMintInterface * format * granualr typed errs on accountInfoInterface * lint, changelog, tests * v2 gate for getaccountinfointerface tests
1 parent 69376e3 commit 2ac68f1

100 files changed

Lines changed: 9483 additions & 4925 deletions

File tree

Some content is hidden

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

.github/workflows/js-v2.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ jobs:
9797
done
9898
echo "Tests passed on attempt $attempt"
9999
100-
- name: Run compressed-token ctoken tests with V2
100+
- name: Run compressed-token lighttoken tests with V2
101101
run: |
102-
echo "Running compressed-token ctoken tests with retry logic (max 2 attempts)..."
102+
echo "Running compressed-token lighttoken tests with retry logic (max 2 attempts)..."
103103
attempt=1
104104
max_attempts=2
105105
cd js/compressed-token
106-
until LIGHT_PROTOCOL_VERSION=V2 pnpm test:e2e:ctoken:all; do
106+
until LIGHT_PROTOCOL_VERSION=V2 pnpm test:e2e:lighttoken:all; do
107107
attempt=$((attempt + 1))
108108
if [ $attempt -gt $max_attempts ]; then
109109
echo "Tests failed after $max_attempts attempts"

.github/workflows/lint.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ jobs:
3737
- name: Run linters
3838
run: |
3939
set -euxo pipefail
40-
rustup install nightly
41-
rustup target add x86_64-unknown-linux-gnu --toolchain nightly
42-
rustup component add --toolchain nightly rustfmt
43-
rustup component add --toolchain nightly clippy
40+
RUSTFMT_NIGHTLY_TOOLCHAIN=nightly-2025-10-26
41+
rustup install "$RUSTFMT_NIGHTLY_TOOLCHAIN"
42+
rustup target add x86_64-unknown-linux-gnu --toolchain "$RUSTFMT_NIGHTLY_TOOLCHAIN"
43+
rustup component add --toolchain "$RUSTFMT_NIGHTLY_TOOLCHAIN" rustfmt
44+
rustup component add --toolchain "$RUSTFMT_NIGHTLY_TOOLCHAIN" clippy
4445
rustup component add --toolchain 1.86-x86_64-unknown-linux-gnu clippy
46+
export RUSTFMT_NIGHTLY_TOOLCHAIN
4547
./scripts/lint.sh

js/compressed-token/CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
## [Unreleased]
2+
3+
### Breaking Changes
4+
5+
- **`transferInterface` and `createTransferInterfaceInstructions`**: `destination` is now the token account address (SPL-style), not the recipient wallet. `ensureRecipientAta` removed; caller must create the destination ATA before transfer via `getOrCreateAtaInterface` or `createAssociatedTokenAccountInterfaceIdempotentInstruction`.
6+
- **Action:** `transferInterface(rpc, payer, source, mint, destination, owner, amount, ...)``destination` is the token account (e.g. `getAssociatedTokenAddressInterface(mint, recipient.publicKey)`).
7+
- **Instruction builder:** `createTransferInterfaceInstructions(rpc, payer, mint, amount, sender, destination, decimals, options?)` — same `destination` semantics.
8+
- **`decimals` is now required** on `createTransferInterfaceInstructions` (instruction-level API). Fetch with `getMintInterface(rpc, mint).mint.decimals` if you were not already threading mint decimals.
9+
10+
- **Root export removed:** `createLoadAtaInstructionsFromInterface` is no longer exported from the package root. Use `createLoadAtaInstructions` (public API) and pass ATA/owner/mint directly.
11+
12+
- **Interface RPC error semantics are now strict (no silent downgrade to not-found).**
13+
- `getAccountInterface` / `getAtaInterface`: unexpected RPC failures (on-chain fetch, compressed fetch, parsing) now throw immediately instead of being silently ignored when another source produced data.
14+
- `getAccountInterface` light-token mode and SPL/T22 mode now surface `TokenInvalidAccountOwnerError` when an on-chain account exists at the queried address but is owned by a different program.
15+
- `getMintInterface` (decompressed light-mint branch) now validates the on-chain mint owner and throws `TokenInvalidAccountOwnerError` on mismatch; it also forwards the provided `commitment` to on-chain `getAccountInfo`.
16+
- **Migration impact:** callers that previously interpreted these paths as empty/not-found must now handle thrown errors explicitly (retry/backoff or surfacing RPC health).
17+
18+
## [0.23.0-beta.10]
19+
20+
### Breaking Changes
21+
22+
- **`decompressInterface` removed.** Use `loadAta` (action) or `createLoadAtaInstructions` (instruction builder) instead. `decompressInterface` did not support >8 compressed inputs and has been fully removed.
23+
- **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 light-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.
24+
- **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.
25+
26+
- **CToken → LightToken renames.** Instruction and type names updated for consistency: `createAssociatedCTokenAccountInstruction``createAssociatedLightTokenAccountInstruction`, `CTokenConfig``LightTokenConfig`, `parseCTokenHot``parseLightTokenHot`, `parseCTokenCold``parseLightTokenCold`, `mintToCToken``mintToLightToken` (and related), `CTOKEN_PROGRAM_ID``LIGHT_TOKEN_PROGRAM_ID`. Use the new LightToken names in all call sites.
27+
28+
- **Removed exports.** `createLoadAccountsParams`, `calculateCompressibleLoadComputeUnits`, and associated types are no longer exported. Use the batched `createLoadAtaInstructions` API and `calculateLoadBatchComputeUnits` where applicable.
29+
30+
- **New freeze/thaw instructions.** `createLightTokenFreezeAccountInstruction` and `createLightTokenThawAccountInstruction` are available for native freeze/thaw of decompressed light-token accounts (discriminators 10 and 11).
31+
32+
- **Synthetic delegate selection semantics updated.** In `getAtaInterface` / `getAccountInterface` synthetic account views:
33+
- If a hot source has a delegate, that hot delegate is always canonical. Cold delegates only contribute to `delegatedAmount` when they match the hot delegate.
34+
- If there is no hot delegate, canonical delegate is chosen from the most recent delegated cold source (source-order first), and `delegatedAmount` is the sum of all cold inputs for that delegate.
35+
136
## [0.23.0-beta.9]
237

338
### Fixed

0 commit comments

Comments
 (0)