diff --git a/cli/package.json b/cli/package.json index 4f780bf567..3ccad6ba34 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,6 +1,6 @@ { "name": "@lightprotocol/zk-compression-cli", - "version": "0.28.0-beta.12", + "version": "0.28.0", "description": "ZK Compression: Secure Scaling on Solana", "maintainers": [ { diff --git a/js/compressed-token/CHANGELOG.md b/js/compressed-token/CHANGELOG.md index 05fbc5c78e..b6f041e8c8 100644 --- a/js/compressed-token/CHANGELOG.md +++ b/js/compressed-token/CHANGELOG.md @@ -1,3 +1,111 @@ +## [0.23.0] - 2026-03-24 + +Stable release. It supersedes the **`0.23.0-beta.x`** line and is intended for production use with **ZK Compression V2**. Upgrade from **`0.22.x`** or any beta version requires addressing the breaking changes listed below. + +### Highlights + +- **V2 is the default for npm consumers:** **`@lightprotocol/compressed-token@0.23.0`** pairs with **`@lightprotocol/stateless.js@0.23.0`**. You do **not** need **`LIGHT_PROTOCOL_VERSION=V2`** in app code for published packages. Set **`LIGHT_PROTOCOL_VERSION=V1`** only when **building these packages from source** and you need V1 artifacts. +- **Light token surface:** Public names are **LightToken** / **`LIGHT_TOKEN_PROGRAM_ID`** (replacing CToken / **`CTOKEN_PROGRAM_ID`**). +- **Interface transfers & loads:** The new token API is much closer to spl-token now, and uses the same Account types. Changes include: Recipient wallet vs explicit destination account, **owner pubkey + signing authority** split for delegates, batched **`TransactionInstruction[][]`**, and **`loadAta`** / **`createLoadAtaInstructions`** replacing **`decompressInterface`**. + +### Breaking changes (since 0.22.0) + +**Transfers (actions)** + +- **`transferInterface`**: `recipient` is the **recipient wallet** `PublicKey` (not a pre-derived ATA). Signature: + + `transferInterface(rpc, payer, source, mint, recipient, owner, authority, amount, programId?, confirmOptions?, options?, decimals?)` + - **`owner`**: source token-account **owner** pubkey (for ATA derivation / source checks). + - **`authority`**: **`Signer`** — use **`owner`** for owner-signed flows (`owner.publicKey` + `owner`), or **`delegate`** for delegated flows (`owner.publicKey` + `delegate`). + +- **`transferToAccountInterface`**: explicit **`destination`** token account; same **`owner` / `authority`** split: + + `transferToAccountInterface(rpc, payer, source, mint, destination, owner, authority, amount, programId?, confirmOptions?, options?, decimals?)` + +- **Multiple transactions:** for large cold-input fan-in, these actions may send **parallel load transactions** followed by a **final transfer** (Solana size / proof limits). Instruction builders expose the same as **`TransactionInstruction[][]`**. + +**Transfers (instruction builders)** + +- **`createTransferInterfaceInstructions`**: returns **`TransactionInstruction[][]`** (one inner array per transaction). Wallet recipient; embeds idempotent recipient ATA creation in the final batch. + + `createTransferInterfaceInstructions(rpc, payer, mint, amount, owner, recipient, decimals, options?, programId?)` + +- **`createTransferToAccountInterfaceInstructions`**: same batching shape; **`destination`** is the token account address. + + `createTransferToAccountInterfaceInstructions(rpc, payer, mint, amount, owner, destination, decimals, options?, programId?)` + +- **`InterfaceOptions`**: **`wrap`** and related options are nested here; **`programId`** is **not** inside `InterfaceOptions` (flat parameter, SPL-style). **`InterfaceOptions.owner` was removed** — use flat **`owner`** args and, for delegated **planning**, **`options.delegatePubkey`**. + +- **`decimals`** is required on these v3 builders unless you use a higher-level wrapper that resolves decimals for you. + +**Load / decompress** + +- **`decompressInterface`** removed. Use **`loadAta`** (action) or **`createLoadAtaInstructions`** (builder). **`createLoadAtaInstructions`** returns **`TransactionInstruction[][]`**, not a flat instruction array. + +- **Delegated loads:** flat args still pass the token-account **`owner`** pubkey; when the **`Signer`** is a **delegate**, set **`interfaceOptions.delegatePubkey`** to the delegate’s pubkey (do not stuff the owner into removed **`InterfaceOptions.owner`**). + +- **`createLoadAtaInstructionsFromInterface`** is **not** exported from the package root; use **`createLoadAtaInstructions`**. + +**Renames (CToken → LightToken)** + +- Examples: **`CTOKEN_PROGRAM_ID` → `LIGHT_TOKEN_PROGRAM_ID`**, **`createAssociatedCTokenAccountInstruction` → `createAssociatedLightTokenAccountInstruction`**, **`parseCTokenHot` / `parseCTokenCold` → `parseLightTokenHot` / `parseLightTokenCold`**, **`mintToCToken` → `mintToLightToken`**, **`createCTokenTransferInstruction` → `createLightTokenTransferInstruction`**. + +**`createLightTokenTransferInstruction`** + +- Instruction **data layout** (9-byte) and **account metas** changed: includes **`system_program`** and **`fee_payer`**; **`owner` is writable** (compressible rent top-ups). + +**`createDecompressInterfaceInstruction`** + +- **`decimals: number`** required after **`splInterfaceInfo`** where applicable for SPL destination decompression. + +**Deprecated dispatcher** + +- **`createTransferInterfaceInstruction`** (monolithic multi-program helper): deprecated; use **`createLightTokenTransferInstruction`** or SPL **`createTransferCheckedInstruction`** as appropriate. + +**Token pool / SPL interface** + +- Prefer **`CompressedTokenProgram.createSplInterface`**; **`createTokenPool`** is deprecated. + +**Removed exports** + +- **`createLoadAccountsParams`**, **`calculateCompressibleLoadComputeUnits`**, and related types — use **`createLoadAtaInstructions`** and **`calculateLoadBatchComputeUnits`**. + +**`mintToCompressed`** + +- **`maxTopUp`** was inserted **before** optional **`confirmOptions`** — update positional call sites. + +**RPC / typing strictness** + +- **`getAccountInterface`**, **`getAtaInterface`**, **`getMintInterface`**: unexpected failures and wrong-program owners surface as **errors** instead of being treated like empty/not-found in several cases. + +**Synthetic delegate views** + +- In **`getAtaInterface` / `getAccountInterface`**, canonical delegate and **`delegatedAmount`** aggregation follow updated rules (hot delegate preferred; cold delegates aligned with hot). + +### New APIs (consumer-visible) + +- **`approveInterface`**, **`revokeInterface`**; builders **`createApproveInterfaceInstructions`**, **`createRevokeInterfaceInstructions`**; **`createLightTokenApproveInstruction`**, **`createLightTokenRevokeInstruction`**. +- **`createUnwrapInstructions`**, **`selectInputsForAmount`**. +- **`createLightTokenFreezeAccountInstruction`**, **`createLightTokenThawAccountInstruction`**. +- **`MAX_TOP_UP`** and **`maxTopUp`** on compressible instruction builders and selected actions. +- **`sliceLast`**, **`chunkAccountsByTreeVersion`**, **`assertUniqueInputHashes`** for batch orchestration. +- **`assertV2Only`** on load/decompress paths — V1 compressed inputs fail fast with a clear error. +- **`LightTokenProgram`** alias for **`CompressedTokenProgram`**. +- **`getOrCreateAtaInterface`** / create-mint flows: decompressed mint handling integrated where documented so typical flows do not require a separate **`decompressMint`** before ATAs. + +### Changed / fixed (summary) + +- **`approveInterface` / `revokeInterface`**: optional **`InterfaceOptions`** (incl. **`wrap`**) and trailing **`decimals`**; unified approve/revoke entrypoints match the same options pattern. + +- **`@lightprotocol/compressed-token/unified`**: transfer-related entrypoints keep **`wrap: true`**; use the non-unified exports for explicit **`programId`** / no-wrap SPL Token-2022 style flows. + +- **`loadAta`**: may send **parallel** load batches; frozen-source handling and SPL interface error propagation improved. +- **`maxTopUp`** default **`MAX_TOP_UP` (65535)** so rent top-ups are not silently blocked. +- **Browser bundles:** minified output keeps **`AccountMeta`** **`isSigner` / `isWritable`** as real **booleans** (Terser; see **`@lightprotocol/stateless.js`** changelog). +- **`delegatedAmount`** parsed from CompressedOnly TLV where applicable. + +--- + ## [0.23.0-beta.11] ### Added diff --git a/js/compressed-token/package.json b/js/compressed-token/package.json index 61d3a3be90..96fddf90c8 100644 --- a/js/compressed-token/package.json +++ b/js/compressed-token/package.json @@ -1,6 +1,6 @@ { "name": "@lightprotocol/compressed-token", - "version": "0.23.0-beta.12", + "version": "0.23.0", "description": "JS client to interact with the compressed-token program", "sideEffects": false, "main": "dist/cjs/node/index.cjs", diff --git a/js/stateless.js/CHANGELOG.md b/js/stateless.js/CHANGELOG.md index 550e352001..0ef3f01869 100644 --- a/js/stateless.js/CHANGELOG.md +++ b/js/stateless.js/CHANGELOG.md @@ -1,5 +1,36 @@ # Changelog +## [0.23.0] - 2026-03-24 + +Stable release. It supersedes the **`0.23.0-beta.x`** line and pairs with **`@lightprotocol/compressed-token@0.23.0`** for production ZK Compression **V2** workflows. + +### Highlights + +- **V2 is the default** for **published npm packages** (no app-level env required). When **building this repo from source**, `pnpm build` / `pnpm build-ci` and Rollup-injected **`__BUILD_VERSION__`** target **V2** when **`LIGHT_PROTOCOL_VERSION`** is unset. Set **`LIGHT_PROTOCOL_VERSION=V1`** to produce V1 bundles and tests. +- **Runtime:** when not using a pre-built bundle, **`featureFlags`** defaults to **V2** if the env var is unset (see `src/constants.ts`). +- **Stricter compressed account fetch:** **`getAccountInfoInterface`** surfaces **RPC errors** when no definitive account result is available, instead of returning **`null`** on some failure paths. + +### Breaking / migration (since 0.22.0 stable) + +- **Build default (new in 0.23 betas, stable here):** consumers who relied on implicit **V1** builds must set **`LIGHT_PROTOCOL_VERSION=V1`** for installs/scripts, or they will get **V2** artifacts. +- **Compression RPC method names:** in **V2** mode, **`Rpc`** uses V2-suffixed JSON-RPC methods for many calls (e.g. **`getCompressedAccountV2`**) via **`versionedEndpoint`**. Your **Photon / compression** endpoint must support the V2 surface. +- **`getAccountInfoInterface`:** treat **thrown / rejected RPC errors** as first-class; do not assume “null means missing account” on all failures. + +### Added / changed + +- **Minified browser builds:** Terser no longer uses **`booleans_as_integers`**, so **`AccountMeta`** flags stay boolean-compatible with **`@solana/web3.js`**. +- **`PackedAccounts`:** **`addPreAccountsMeta`** / **`insertOrGetConfig`** normalize signer and writable flags so **`0`/`1`** from callers are handled consistently. + +### Deprecated (compatibility) + +- **`featureFlags.isBeta`**, **`enableBeta`**, **`disableBeta`**: deprecated no-ops; versioning is driven by **V2 default** / **`LIGHT_PROTOCOL_VERSION`** (source builds) and **`assertV2Enabled`** in **`@lightprotocol/compressed-token`**. + +### If you are on 0.22.x + +You already applied the **0.22.0** breaking change (**`transfer`** no longer takes **`stateTreeInfo`**). **0.23.0** adds the **V2-default build**, runtime **V2 default**, stricter **`getAccountInfoInterface`**, and the minification fixes above. + +--- + ## [0.23.0-beta.11] ### Fixed diff --git a/js/stateless.js/package.json b/js/stateless.js/package.json index 64ad45e54f..ca426c414e 100644 --- a/js/stateless.js/package.json +++ b/js/stateless.js/package.json @@ -1,6 +1,6 @@ { "name": "@lightprotocol/stateless.js", - "version": "0.23.0-beta.12", + "version": "0.23.0", "description": "JavaScript API for Light & ZK Compression", "sideEffects": false, "main": "dist/cjs/node/index.cjs", diff --git a/js/stateless.js/src/constants.ts b/js/stateless.js/src/constants.ts index 04f56fcd79..32a29701ee 100644 --- a/js/stateless.js/src/constants.ts +++ b/js/stateless.js/src/constants.ts @@ -28,15 +28,15 @@ export const featureFlags = { isV2: () => featureFlags.version.replace(/['"]/g, '').toUpperCase() === 'V2', /** - * @deprecated Interface methods are production-ready; beta gating is ignored. + * @deprecated Legacy compatibility; always false. Published packages default to V2. */ - isBeta: (): boolean => true, + isBeta: (): boolean => false, /** - * @deprecated Interface methods are production-ready; beta gating is ignored. + * @deprecated No-op. Retained for backward compatibility. */ enableBeta: (): void => {}, /** - * @deprecated Interface methods are production-ready; beta gating is ignored. + * @deprecated No-op. Retained for backward compatibility. */ disableBeta: (): void => {}, }; @@ -45,7 +45,7 @@ export const featureFlags = { * Error message for V2-only interface methods. */ export const V2_REQUIRED_ERROR = - 'Interface methods require V2. Set LIGHT_PROTOCOL_VERSION=V2.'; + 'Interface methods require V2. Use @lightprotocol/stateless.js and @lightprotocol/compressed-token ^0.23.0 (V2 default), or set LIGHT_PROTOCOL_VERSION=V2 when building from source.'; /** * Assert that V2 interface methods are enabled.