diff --git a/js/compressed-token/src/v3/actions/create-associated-ctoken.ts b/js/compressed-token/src/v3/actions/create-associated-ctoken.ts index 7d7dc7ecd0..4c4bd211b5 100644 --- a/js/compressed-token/src/v3/actions/create-associated-ctoken.ts +++ b/js/compressed-token/src/v3/actions/create-associated-ctoken.ts @@ -18,7 +18,7 @@ import { import { getAssociatedCTokenAddress } from '../derivation'; /** - * Create an associated c-token account. + * Create an associated light-token account. * * @param rpc RPC connection * @param payer Fee payer @@ -65,7 +65,7 @@ export async function createAssociatedCTokenAccount( } /** - * Create an associated compressed token account idempotently. + * Create an associated light-token account idempotently. * * @param rpc RPC connection * @param payer Fee payer diff --git a/js/compressed-token/src/v3/actions/create-ata-interface.ts b/js/compressed-token/src/v3/actions/create-ata-interface.ts index b55bae7d8e..de11d8eea4 100644 --- a/js/compressed-token/src/v3/actions/create-ata-interface.ts +++ b/js/compressed-token/src/v3/actions/create-ata-interface.ts @@ -25,8 +25,8 @@ import { getAssociatedTokenAddressInterface } from '../get-associated-token-addr export type { CTokenConfig }; /** - * Create an associated token account for SPL/T22/c-token. Defaults to c-token - * program. + * Create an associated token account for SPL/T22/light-token. Defaults to + * light-token program. * * @param rpc RPC connection * @param payer Fee payer and transaction signer @@ -36,8 +36,8 @@ export type { CTokenConfig }; * @param confirmOptions Options for confirming the transaction * @param programId Token program ID (default: * LIGHT_TOKEN_PROGRAM_ID) - * @param associatedTokenProgramId ATA program ID (auto-derived if not - * provided) + * @param associatedTokenProgramId associated token account program ID + * (auto-derived if not provided) * @param ctokenConfig Optional rent config * @returns Address of the new associated token account */ @@ -98,8 +98,8 @@ export async function createAtaInterface( } /** - * Create an associated token account idempotently for SPL/T22/c-token. Defaults - * to c-token program. + * Create an associated token account idempotently for SPL/T22/light-token. + * Defaults to light-token program. * * If the account already exists, the instruction succeeds without error. * @@ -111,9 +111,9 @@ export async function createAtaInterface( * @param confirmOptions Options for confirming the transaction * @param programId Token program ID (default: * LIGHT_TOKEN_PROGRAM_ID) - * @param associatedTokenProgramId ATA program ID (auto-derived if not - * provided) - * @param ctokenConfig Optional c-token-specific configuration + * @param associatedTokenProgramId associated token account program ID + * (auto-derived if not provided) + * @param ctokenConfig Optional light-token-specific configuration * * @returns Address of the associated token account */ diff --git a/js/compressed-token/src/v3/actions/create-mint-interface.ts b/js/compressed-token/src/v3/actions/create-mint-interface.ts index 602de54695..757c38a6b7 100644 --- a/js/compressed-token/src/v3/actions/create-mint-interface.ts +++ b/js/compressed-token/src/v3/actions/create-mint-interface.ts @@ -31,19 +31,19 @@ import { createMint } from '../../actions/create-mint'; export { TokenMetadataInstructionData }; /** - * Create and initialize a new mint for SPL/T22/c-token. + * Create and initialize a new mint for SPL/T22/light-token. * * @param rpc RPC connection to use * @param payer Fee payer - * @param mintAuthority Account that will control minting (signer for c-token mints) + * @param mintAuthority Account that will control minting (signer for light-token mints) * @param freezeAuthority Account that will control freeze and thaw (optional) * @param decimals Location of the decimal place * @param keypair Mint keypair (defaults to a random keypair) * @param confirmOptions Confirm options * @param programId Token program ID (defaults to LIGHT_TOKEN_PROGRAM_ID) - * @param tokenMetadata Optional token metadata (c-token mints only) - * @param outputStateTreeInfo Optional output state tree info (c-token mints only) - * @param addressTreeInfo Optional address tree info (c-token mints only) + * @param tokenMetadata Optional token metadata (light-token mints only) + * @param outputStateTreeInfo Optional output state tree info (light-token mints only) + * @param addressTreeInfo Optional address tree info (light-token mints only) * * @returns Object with mint address and transaction signature */ @@ -79,10 +79,10 @@ export async function createMintInterface( ); } - // Default: compressed token mint creation + // Default: light-token mint creation if (!('secretKey' in mintAuthority)) { throw new Error( - 'mintAuthority must be a Signer for compressed token mints', + 'mintAuthority must be a Signer for light-token mints', ); } if ( diff --git a/js/compressed-token/src/v3/actions/decompress-interface.ts b/js/compressed-token/src/v3/actions/decompress-interface.ts index 31b0a432c5..dde4327e67 100644 --- a/js/compressed-token/src/v3/actions/decompress-interface.ts +++ b/js/compressed-token/src/v3/actions/decompress-interface.ts @@ -27,17 +27,17 @@ import { LIGHT_TOKEN_PROGRAM_ID } from '@lightprotocol/stateless.js'; import { SplInterfaceInfo } from '../../utils/get-token-pool-infos'; /** - * Decompress compressed (cold) tokens to an on-chain token account. + * Decompress compressed light-tokens (cold balance) to a light-token associated token account (hot balance). * * For unified loading, use {@link loadAta} instead. * * @param rpc RPC connection * @param payer Fee payer (signer) - * @param owner Owner of the compressed tokens (signer) + * @param owner Owner of the light-tokens (signer) * @param mint Mint address * @param amount Amount to decompress (defaults to all) * @param destinationAta Destination token account address - * @param destinationOwner Owner of the destination ATA + * @param destinationOwner Owner of the destination associated token account * @param splInterfaceInfo SPL interface info for SPL/T22 destinations * @param confirmOptions Confirm options * @returns Transaction signature, null if nothing to load. @@ -55,10 +55,10 @@ export async function decompressInterface( ): Promise { assertBetaEnabled(); - // Determine if this is SPL or c-token destination + // Determine if this is SPL or light-token destination const isSplDestination = splInterfaceInfo !== undefined; - // Get compressed token accounts + // Get compressed light-token accounts (cold balance) const compressedResult = await rpc.getCompressedTokenAccountsByOwner( owner.publicKey, { mint }, @@ -104,12 +104,12 @@ export async function decompressInterface( })), ); - // Determine destination ATA based on token program + // Determine destination associated token account based on token program const ataOwner = destinationOwner ?? owner.publicKey; let destinationAtaAddress: PublicKey; if (isSplDestination) { - // SPL destination - use SPL ATA + // SPL destination - use SPL associated token account destinationAtaAddress = destinationAta ?? (await getAssociatedTokenAddress( @@ -119,7 +119,7 @@ export async function decompressInterface( splInterfaceInfo.tokenProgram, )); } else { - // c-token destination - use c-token ATA + // light-token destination - use light-token associated token account destinationAtaAddress = destinationAta ?? getAssociatedTokenAddressInterface(mint, ataOwner); @@ -128,11 +128,11 @@ export async function decompressInterface( // Build instructions const instructions = []; - // Create ATA if needed (idempotent) + // Create associated token account if needed (idempotent) const ataInfo = await rpc.getAccountInfo(destinationAtaAddress); if (!ataInfo) { if (isSplDestination) { - // Create SPL ATA + // Create SPL associated token account instructions.push( createAssociatedTokenAccountIdempotentInstruction( payer.publicKey, @@ -143,7 +143,7 @@ export async function decompressInterface( ), ); } else { - // Create c-token ATA + // Create light-token associated token account instructions.push( createAssociatedTokenAccountInterfaceIdempotentInstruction( payer.publicKey, diff --git a/js/compressed-token/src/v3/actions/decompress-mint.ts b/js/compressed-token/src/v3/actions/decompress-mint.ts index ba2f8a0d9b..5d78dd2e1f 100644 --- a/js/compressed-token/src/v3/actions/decompress-mint.ts +++ b/js/compressed-token/src/v3/actions/decompress-mint.ts @@ -31,10 +31,10 @@ export interface DecompressMintParams { } /** - * Decompress a compressed mint to create the CMint Solana account. + * Decompress a compressed light mint to create the light mint account. * - * This makes the mint available on-chain, which is required before creating - * CToken associated token accounts. DecompressMint is **permissionless** - + * This creates the light mint account, which is required before creating + * light-token associated token accounts. DecompressMint is **permissionless** - * any account can call it. * * @param rpc - RPC connection diff --git a/js/compressed-token/src/v3/actions/get-or-create-ata-interface.ts b/js/compressed-token/src/v3/actions/get-or-create-ata-interface.ts index 28a840ce16..31b8fb6cef 100644 --- a/js/compressed-token/src/v3/actions/get-or-create-ata-interface.ts +++ b/js/compressed-token/src/v3/actions/get-or-create-ata-interface.ts @@ -46,7 +46,7 @@ import { loadAta } from './load-ata'; * @param mint Mint associated with the account to set or * verify. * @param owner Owner of the account. Pass Signer to - * auto-load cold (compressed) tokens, or + * auto-load compressed light-tokens (cold balance), or * PublicKey for read-only. * @param allowOwnerOffCurve Allow the owner account to be a PDA (Program * Derived Address). @@ -131,7 +131,7 @@ export async function _getOrCreateAtaInterface( associatedTokenProgramId, ); - // For c-token, use getAtaInterface which properly aggregates hot+cold balances + // For light-token, use getAtaInterface which properly aggregates hot+cold balances // When wrap=true (unified path), also includes SPL/T22 balances if (programId.equals(LIGHT_TOKEN_PROGRAM_ID)) { return getOrCreateCTokenAta( @@ -162,14 +162,14 @@ export async function _getOrCreateAtaInterface( } /** - * Get or create c-token ATA with proper cold balance handling. + * Get or create light-token associated token account with proper compressed balance handling. * * Like SPL's getOrCreateAssociatedTokenAccount, this is a write operation: - * 1. Creates hot ATA if it doesn't exist - * 2. If owner is Signer: loads cold (compressed) tokens into hot ATA + * 1. Creates hot associated token account if it doesn't exist + * 2. If owner is Signer: loads compressed light-tokens (cold balance) into light-token associated token account * 3. When wrap=true and owner is Signer: also wraps SPL/T22 tokens * - * After this call (with Signer owner), all tokens are in the hot ATA and ready + * After this call (with Signer owner), all tokens are in the hot associated token account and ready * to use. * * @internal @@ -215,7 +215,7 @@ async function getOrCreateCTokenAta( error instanceof TokenAccountNotFoundError || error instanceof TokenInvalidAccountOwnerError ) { - // No account found (neither hot nor cold), create hot ATA + // No account found (neither hot nor cold), create hot associated token account await createCTokenAtaIdempotent( rpc, payer, @@ -242,7 +242,7 @@ async function getOrCreateCTokenAta( } } - // If we only have cold balance (no hot ATA), create the hot ATA first + // If we only have cold balance (no hot associated token account), create the hot associated token account first if (!hasHotAccount) { await createCTokenAtaIdempotent( rpc, @@ -257,7 +257,7 @@ async function getOrCreateCTokenAta( // Only auto-load if owner is a Signer (we can sign the load transaction) // Use direct type guard in the if condition for proper type narrowing if (isSigner(owner)) { - // Check if we need to load tokens into the hot ATA + // Check if we need to load tokens into the hot associated token account // Load if: cold balance exists, or (wrap=true and SPL/T22 balance exists) const sources = accountInterface._sources ?? []; const hasCold = sources.some( @@ -285,7 +285,7 @@ async function getOrCreateCTokenAta( ); } - // Load all tokens into hot ATA (decompress cold, wrap SPL/T22 if + // Load all tokens into hot associated token account (decompress cold, wrap SPL/T22 if // wrap=true) await loadAta( rpc, @@ -321,7 +321,7 @@ async function getOrCreateCTokenAta( } /** - * Create c-token ATA idempotently. + * Create light-token associated token account idempotently. * @internal */ async function createCTokenAtaIdempotent( @@ -351,12 +351,12 @@ async function createCTokenAtaIdempotent( await sendAndConfirmTx(rpc, tx, confirmOptions); } catch { - // Ignore errors - ATA may already exist + // Ignore errors - associated token account may already exist } } /** - * Get or create SPL/T22 ATA. + * Get or create SPL/T22 associated token account. * @internal */ async function getOrCreateSplAta( diff --git a/js/compressed-token/src/v3/actions/load-ata.ts b/js/compressed-token/src/v3/actions/load-ata.ts index c0cc00f5a9..aeb8281248 100644 --- a/js/compressed-token/src/v3/actions/load-ata.ts +++ b/js/compressed-token/src/v3/actions/load-ata.ts @@ -78,7 +78,7 @@ function chunkArray(array: T[], chunkSize: number): T[][] { * (no padding beyond the amount-needed count). * - Returns [] when `neededAmount <= 0` or `accounts` is empty. * - * @param accounts Cold compressed token accounts available for loading. + * @param accounts Cold light-token accounts available for loading. * @param neededAmount Amount that must be covered by selected inputs. * @returns Subset of `accounts`, sorted largest-first. */ @@ -140,7 +140,7 @@ function assertUniqueInputHashes(chunks: ParsedTokenAccount[][]): void { * @param rpc RPC connection * @param payer Fee payer * @param compressedAccounts Compressed accounts to decompress (max 8) - * @param destinationAta Destination ATA address + * @param destinationAta Destination associated token account address * @param splInterfaceInfo Optional SPL interface info (for SPL/T22 decompression) * @param decimals Mint decimals * @returns Single decompress instruction @@ -196,7 +196,7 @@ async function createDecompressInstructionForAccounts( * @param rpc RPC connection * @param payer Fee payer * @param compressedAccounts All compressed accounts to decompress - * @param destinationAta Destination ATA address + * @param destinationAta Destination associated token account address * @param splInterfaceInfo Optional SPL interface info (for SPL/T22 decompression) * @param decimals Mint decimals * @returns Array of decompress instructions (one per chunk of 8 accounts) @@ -341,19 +341,19 @@ export { export { AtaType } from '../ata-utils'; /** - * Create instructions to load an ATA from its AccountInterface. + * Create instructions to load an associated token account from its AccountInterface. * * Behavior depends on `wrap` parameter: - * - wrap=false (standard): Decompress compressed tokens to the target ATA type - * (SPL ATA via pool, T22 ATA via pool, or c-token ATA direct) - * - wrap=true (unified): Wrap SPL/T22 + decompress all to c-token ATA + * - wrap=false (standard): Decompress compressed light-tokens to the target associated token account type + * (SPL associated token account via interface PDA, T22 associated token account via interface PDA, or light-token associated token account direct) + * - wrap=true (unified): Wrap SPL/T22 + decompress all to light-token associated token account * * @param rpc RPC connection * @param payer Fee payer * @param ata AccountInterface from getAtaInterface (must have _isAta, _owner, _mint) * @param options Optional load options - * @param wrap Unified mode: wrap SPL/T22 to c-token (default: false) - * @param targetAta Target ATA address (used for type detection in standard mode) + * @param wrap Unified mode: wrap SPL/T22 to light-token (default: false) + * @param targetAta Target associated token account address (used for type detection in standard mode) * @returns Array of instructions (empty if nothing to load) */ export async function createLoadAtaInstructionsFromInterface( @@ -396,7 +396,7 @@ export async function createLoadAtaInstructionsFromInterface( getAtaProgramId(TOKEN_2022_PROGRAM_ID), ); - // Validate and detect target ATA type + // Validate and detect target associated token account type // If called via createLoadAtaInstructions, validation already happened in getAtaInterface. // If called directly, this validates the targetAta is correct. let ataType: AtaType = 'ctoken'; @@ -404,10 +404,10 @@ export async function createLoadAtaInstructionsFromInterface( const validation = checkAtaAddress(targetAta, mint, owner); ataType = validation.type; - // For wrap=true, must be c-token ATA + // For wrap=true, must be light-token associated token account if (wrap && ataType !== 'ctoken') { throw new Error( - `For wrap=true, targetAta must be c-token ATA. Got ${ataType} ATA.`, + `For wrap=true, targetAta must be light-token associated token account. Got ${ataType} associated token account.`, ); } } @@ -475,9 +475,9 @@ export async function createLoadAtaInstructionsFromInterface( } if (wrap) { - // UNIFIED MODE: Everything goes to c-token ATA + // UNIFIED MODE: Everything goes to light-token associated token account - // 1. Create c-token ATA if needed + // 1. Create light-token associated token account if needed if (!ctokenHotSource) { instructions.push( createAssociatedTokenAccountInterfaceIdempotentInstruction( @@ -490,7 +490,7 @@ export async function createLoadAtaInstructionsFromInterface( ); } - // 2. Wrap SPL tokens to c-token + // 2. Wrap SPL tokens to light-token if (splBalance > BigInt(0) && splInterfaceInfo) { instructions.push( createWrapInstruction( @@ -506,7 +506,7 @@ export async function createLoadAtaInstructionsFromInterface( ); } - // 3. Wrap T22 tokens to c-token + // 3. Wrap T22 tokens to light-token if (t22Balance > BigInt(0) && splInterfaceInfo) { instructions.push( createWrapInstruction( @@ -522,7 +522,7 @@ export async function createLoadAtaInstructionsFromInterface( ); } - // 4. Decompress compressed tokens to c-token ATA + // 4. Decompress compressed light-tokens to light-token associated token account // Note: v3 interface only supports V2 trees // Handles >8 accounts via chunking into multiple instructions if (coldBalance > BigInt(0) && coldSources.length > 0) { @@ -535,14 +535,14 @@ export async function createLoadAtaInstructionsFromInterface( payer, compressedAccounts, ctokenAtaAddress, - undefined, // No SPL interface for c-token direct + undefined, // No SPL interface for light-token direct decimals, ); instructions.push(...decompressIxs); } } } else { - // STANDARD MODE: Decompress to target ATA type + // STANDARD MODE: Decompress to target associated token account type // Handles >8 accounts via chunking into multiple instructions if (coldBalance > BigInt(0) && coldSources.length > 0) { @@ -551,7 +551,7 @@ export async function createLoadAtaInstructionsFromInterface( if (compressedAccounts.length > 0) { if (ataType === 'ctoken') { - // Decompress to c-token ATA (direct) + // Decompress to light-token associated token account (direct) if (!ctokenHotSource) { instructions.push( createAssociatedTokenAccountInterfaceIdempotentInstruction( @@ -569,13 +569,13 @@ export async function createLoadAtaInstructionsFromInterface( payer, compressedAccounts, ctokenAtaAddress, - undefined, // No SPL interface for c-token direct + undefined, // No SPL interface for light-token direct decimals, ); instructions.push(...decompressIxs); } else if (ataType === 'spl' && splInterfaceInfo) { - // Decompress to SPL ATA via token pool - // Create SPL ATA if needed + // Decompress to SPL associated token account via interface PDA + // Create SPL associated token account if needed if (!splSource) { instructions.push( createAssociatedTokenAccountIdempotentInstruction( @@ -598,8 +598,8 @@ export async function createLoadAtaInstructionsFromInterface( ); instructions.push(...decompressIxs); } else if (ataType === 'token2022' && splInterfaceInfo) { - // Decompress to T22 ATA via token pool - // Create T22 ATA if needed + // Decompress to T22 associated token account via interface PDA + // Create T22 associated token account if needed if (!t22Source) { instructions.push( createAssociatedTokenAccountIdempotentInstruction( @@ -630,7 +630,7 @@ export async function createLoadAtaInstructionsFromInterface( } /** - * Create instruction batches for loading token balances into an ATA. + * Create instruction batches for loading token balances into an associated token account. * Handles >8 compressed accounts by returning multiple transaction batches. * * IMPORTANT: Each batch must be sent as a SEPARATE transaction because @@ -638,12 +638,12 @@ export async function createLoadAtaInstructionsFromInterface( * (the Merkle tree root changes after each decompress). * * @param rpc RPC connection - * @param ata Associated token address (SPL, T22, or c-token) + * @param ata Associated token address (SPL, T22, or light-token) * @param owner Owner public key * @param mint Mint public key * @param payer Fee payer public key (defaults to owner) * @param interfaceOptions Optional interface options - * @param wrap Unified mode: wrap SPL/T22 to c-token (default: false) + * @param wrap Unified mode: wrap SPL/T22 to light-token (default: false) * @returns Instruction batches - each inner array is one transaction */ export async function createLoadAtaInstructions( @@ -658,7 +658,7 @@ export async function createLoadAtaInstructions( assertBetaEnabled(); payer ??= owner; - // Fetch account state (pass wrap so c-token ATA is validated before RPC) + // Fetch account state (pass wrap so light-token associated token account is validated before RPC) let accountInterface: AccountInterface; try { accountInterface = await _getAtaInterface( @@ -678,7 +678,7 @@ export async function createLoadAtaInstructions( } // Delegate to _buildLoadBatches which handles wrapping, decompression, - // ATA creation, and parallel-safe batching. + // associated token account creation, and parallel-safe batching. const internalBatches = await _buildLoadBatches( rpc, payer, @@ -707,7 +707,7 @@ export interface InternalLoadBatch { * Calculate compute units for a load batch with 30% buffer. * * Heuristics: - * - ATA creation: ~30k CU + * - Associated token account creation: ~30k CU * - Wrap operation: ~50k CU each * - Decompress base cost (CPI overhead, hash computation): ~50k CU * - Full proof verification (when any input is NOT proveByIndex): ~100k CU @@ -751,10 +751,10 @@ export function calculateLoadBatchComputeUnits( * Build load instruction batches for parallel sending. * * Returns one or more batches: - * - Batch 0: setup (ATA creation, wraps) + first decompress chunk - * - Batch 1..N: idempotent ATA creation + decompress chunk 1..N + * - Batch 0: setup (associated token account creation, wraps) + first decompress chunk + * - Batch 1..N: idempotent associated token account creation + decompress chunk 1..N * - * Each batch is independent and can be sent in parallel. Idempotent ATA + * Each batch is independent and can be sent in parallel. Idempotent associated token account * creation is included in every batch so they can land in any order. * * @internal @@ -799,13 +799,13 @@ export async function _buildLoadBatches( getAtaProgramId(TOKEN_2022_PROGRAM_ID), ); - // Validate target ATA type + // Validate target associated token account type let ataType: AtaType = 'ctoken'; const validation = checkAtaAddress(targetAta, mint, owner); ataType = validation.type; if (wrap && ataType !== 'ctoken') { throw new Error( - `For wrap=true, targetAta must be c-token ATA. Got ${ataType} ATA.`, + `For wrap=true, targetAta must be light-token associated token account. Got ${ataType} associated token account.`, ); } @@ -869,7 +869,7 @@ export async function _buildLoadBatches( } } - // Build setup instructions (ATA creation + wraps) + // Build setup instructions (associated token account creation + wraps) const setupInstructions: TransactionInstruction[] = []; let wrapCount = 0; let needsAtaCreation = false; @@ -1051,7 +1051,7 @@ export async function _buildLoadBatches( }), ); - // Build idempotent ATA creation instruction for subsequent batches + // Build idempotent associated token account creation instruction for subsequent batches const idempotentAtaIx = (() => { if (wrap || ataType === 'ctoken') { return createAssociatedTokenAccountInterfaceIdempotentInstruction( @@ -1096,12 +1096,12 @@ export async function _buildLoadBatches( let batchHasAtaCreation = false; if (i === 0) { - // First batch includes all setup (ATA creation + wraps) + // First batch includes all setup (associated token account creation + wraps) batchIxs.push(...setupInstructions); batchWrapCount = wrapCount; batchHasAtaCreation = needsAtaCreation; } else { - // Subsequent batches: include idempotent ATA creation so + // Subsequent batches: include idempotent associated token account creation so // batches can land in any order batchIxs.push(idempotentAtaIx); batchHasAtaCreation = true; @@ -1131,28 +1131,28 @@ export async function _buildLoadBatches( } /** - * Load token balances into an ATA. + * Load token balances into an associated token account. * * Behavior depends on `wrap` parameter: - * - wrap=false (standard): Decompress compressed tokens to the target ATA. - * ATA can be SPL (via pool), T22 (via pool), or c-token (direct). - * - wrap=true (unified): Wrap SPL/T22 + decompress all to c-token ATA. + * - wrap=false (standard): Decompress compressed light-tokens to the target associated token account. + * Target can be SPL (via interface PDA), T22 (via interface PDA), or light-token (direct). + * - wrap=true (unified): Wrap SPL/T22 + decompress all to light-token associated token account. * * Handles any number of compressed accounts by building per-chunk batches * (max 8 inputs per decompress instruction) and sending all batches in - * parallel. Each batch includes idempotent ATA creation so landing order + * parallel. Each batch includes idempotent associated token account creation so landing order * does not matter. * * Idempotent: returns null if nothing to load. * * @param rpc RPC connection - * @param ata Associated token address (SPL, T22, or c-token) + * @param ata Associated token address (SPL, T22, or light-token) * @param owner Owner of the tokens (signer) * @param mint Mint public key * @param payer Fee payer (signer, defaults to owner) * @param confirmOptions Optional confirm options * @param interfaceOptions Optional interface options - * @param wrap Unified mode: wrap SPL/T22 to c-token (default: false) + * @param wrap Unified mode: wrap SPL/T22 to light-token (default: false) * @returns Last transaction signature, or null if nothing to load */ export async function loadAta( diff --git a/js/compressed-token/src/v3/actions/mint-to-compressed.ts b/js/compressed-token/src/v3/actions/mint-to-compressed.ts index 1e67c7652d..8131e5bdf4 100644 --- a/js/compressed-token/src/v3/actions/mint-to-compressed.ts +++ b/js/compressed-token/src/v3/actions/mint-to-compressed.ts @@ -20,7 +20,7 @@ import { createMintToCompressedInstruction } from '../instructions/mint-to-compr import { getMintInterface } from '../get-mint-interface'; /** - * Mint compressed tokens directly to compressed accounts. + * Mint light-tokens directly to compressed accounts. * * @param rpc RPC connection * @param payer Fee payer diff --git a/js/compressed-token/src/v3/actions/mint-to-interface.ts b/js/compressed-token/src/v3/actions/mint-to-interface.ts index 43eead0a6c..6a69223a49 100644 --- a/js/compressed-token/src/v3/actions/mint-to-interface.ts +++ b/js/compressed-token/src/v3/actions/mint-to-interface.ts @@ -16,16 +16,16 @@ import { getMintInterface } from '../get-mint-interface'; /** * Mint tokens to a decompressed/onchain token account. - * Works with SPL, Token-2022, and CToken mints. + * Works with SPL, Token-2022, and light-token mints. * - * This function ONLY mints to decompressed onchain token accounts, never to compressed accounts. - * For CToken mints, the mint must be decompressed first (CMint account must exist on-chain). + * This function ONLY mints to light-token associated token accounts (hot), never to compressed light-token accounts (cold). + * For light-token mints, the light mint account must exist (mint must be decompressed first). * * The signature matches the standard SPL mintTo for simplicity and consistency. * * @param rpc - RPC connection to use * @param payer - Transaction fee payer - * @param mint - Mint address (SPL, Token-2022, or CToken mint) + * @param mint - Mint address (SPL, Token-2022, or light-token mint) * @param destination - Destination token account address (must be an existing onchain token account) * @param authority - Mint authority (can be Signer or PublicKey if multiSigners provided) * @param amount - Amount to mint diff --git a/js/compressed-token/src/v3/actions/mint-to.ts b/js/compressed-token/src/v3/actions/mint-to.ts index 4ca02c812d..c51e16c6cc 100644 --- a/js/compressed-token/src/v3/actions/mint-to.ts +++ b/js/compressed-token/src/v3/actions/mint-to.ts @@ -15,15 +15,15 @@ import { MAX_TOP_UP } from '../../constants'; import { createMintToInstruction } from '../instructions/mint-to'; /** - * Mint tokens to a CToken account. + * Mint tokens to a light-token account. * - * This is a simple mint instruction for minting to decompressed CToken accounts. - * The mint must be decompressed (CMint account must exist on-chain). + * This is a simple mint instruction for minting to light-token associated token accounts (hot). + * The light mint account must exist (mint must be decompressed first). * * @param rpc - RPC connection * @param payer - Fee payer (signer) - * @param mint - Mint address (CMint account) - * @param destination - Destination CToken account + * @param mint - Mint address (light mint account) + * @param destination - Destination light-token account * @param authority - Mint authority (signer) * @param amount - Amount to mint * @param maxTopUp - Optional maximum lamports for rent top-up diff --git a/js/compressed-token/src/v3/actions/transfer-interface.ts b/js/compressed-token/src/v3/actions/transfer-interface.ts index 22204c890d..5a7c0bc18a 100644 --- a/js/compressed-token/src/v3/actions/transfer-interface.ts +++ b/js/compressed-token/src/v3/actions/transfer-interface.ts @@ -51,16 +51,16 @@ export interface InterfaceOptions { } /** - * Transfer tokens using the c-token interface. + * Transfer tokens using the light-token interface. * * High-level action: resolves balances, builds all instructions (load + - * transfer), signs, and sends. Creates the recipient ATA if it does not exist. + * transfer), signs, and sends. Creates the recipient associated token account if it does not exist. * * For instruction-level control, use `createTransferInterfaceInstructions`. * * @param rpc RPC connection * @param payer Fee payer (signer) - * @param source Source c-token ATA address + * @param source Source light-token associated token account address * @param mint Mint address * @param destination Recipient wallet public key * @param owner Source owner (signer) @@ -102,7 +102,7 @@ export async function transferInterface( const amountBigInt = BigInt(amount.toString()); // Build all instruction batches. ensureRecipientAta: true (default) - // includes idempotent ATA creation in the transfer tx -- no extra RPC + // includes idempotent associated token account creation in the transfer tx -- no extra RPC // fetch needed. const batches = await createTransferInterfaceInstructions( rpc, @@ -144,15 +144,15 @@ export async function transferInterface( * Options for createTransferInterfaceInstructions. */ export interface TransferOptions extends InterfaceOptions { - /** Include SPL/T22 wrapping to c-token ATA (unified path). Default: false. */ + /** Include SPL/T22 wrapping to light-token associated token account (unified path). Default: false. */ wrap?: boolean; /** Token program ID. Default: LIGHT_TOKEN_PROGRAM_ID. */ programId?: PublicKey; /** - * Include an idempotent recipient ATA creation instruction in the + * Include an idempotent recipient associated token account creation instruction in the * transfer transaction. No extra RPC fetch -- uses * createAssociatedTokenAccountInterfaceIdempotentInstruction which is - * a no-op on-chain if the ATA already exists (~200 CU overhead). + * a no-op on-chain if the associated token account already exists (~200 CU overhead). * Default: true. */ ensureRecipientAta?: boolean; @@ -179,7 +179,7 @@ export function sliceLast(items: T[]): { rest: T[]; last: T } { * Compute units for the transfer transaction (load chunk + transfer). */ function calculateTransferCU(loadBatch: InternalLoadBatch | null): number { - let cu = 10_000; // c-token transfer base + let cu = 10_000; // light-token transfer base if (loadBatch) { if (loadBatch.hasAtaCreation) cu += 30_000; @@ -223,7 +223,7 @@ function assertTxSize( } /** - * Create instructions for a c-token transfer. + * Create instructions for a light-token transfer. * * Returns `TransactionInstruction[][]` -- an array of transaction instruction * arrays. Each inner array is one transaction to sign and send. @@ -239,10 +239,10 @@ function assertTxSize( * const { rest, last } = sliceLast(batches); * ``` * - * When `ensureRecipientAta` is true (the default), an idempotent ATA creation + * When `ensureRecipientAta` is true (the default), an idempotent associated token account creation * instruction is included in the transfer (last) transaction. No extra RPC - * fetch -- the instruction is a no-op on-chain if the ATA already exists. - * Set `ensureRecipientAta: false` if you manage recipient ATAs yourself. + * fetch -- the instruction is a no-op on-chain if the associated token account already exists. + * Set `ensureRecipientAta: false` if you manage recipient associated token accounts yourself. * * All transactions require payer + sender as signers. * @@ -284,11 +284,11 @@ export async function createTransferInterfaceInstructions( ...interfaceOptions } = options ?? {}; - // Validate recipient is a wallet (on-curve), not an ATA or PDA. - // Passing an ATA here would derive an ATA-of-ATA and lose funds. + // Validate recipient is a wallet (on-curve), not a PDA or associated token account. + // Passing an associated token account here would derive an associated token account of associated token account and lose funds. if (!PublicKey.isOnCurve(recipient.toBytes())) { throw new Error( - `Recipient must be a wallet public key (on-curve), not a PDA or ATA. ` + + `Recipient must be a wallet public key (on-curve), not a PDA or associated token account. ` + `Got: ${recipient.toBase58()}`, ); } @@ -297,7 +297,7 @@ export async function createTransferInterfaceInstructions( programId.equals(TOKEN_PROGRAM_ID) || programId.equals(TOKEN_2022_PROGRAM_ID); - // Derive ATAs + // Derive associated token accounts const senderAta = getAssociatedTokenAddressInterface( mint, sender, @@ -398,7 +398,7 @@ export async function createTransferInterfaceInstructions( ); } - // Create Recipient ATA idempotently. Optional. + // Create recipient associated token account idempotently. Optional. const recipientAtaIxs: TransactionInstruction[] = []; if (ensureRecipientAta) { recipientAtaIxs.push( @@ -422,7 +422,7 @@ export async function createTransferInterfaceInstructions( // Assemble result: TransactionInstruction[][] // Last element is always the transfer tx. Preceding elements are // load txs that can be sent in parallel. - // Load txs include budgeting and ATA creation too. + // Load txs include budgeting and associated token account creation too. if (internalBatches.length === 0) { // Sender is hot: single transfer tx const cu = calculateTransferCU(null); diff --git a/js/compressed-token/src/v3/actions/unwrap.ts b/js/compressed-token/src/v3/actions/unwrap.ts index 416c85853c..9ea7b1ff84 100644 --- a/js/compressed-token/src/v3/actions/unwrap.ts +++ b/js/compressed-token/src/v3/actions/unwrap.ts @@ -33,7 +33,7 @@ import { } from '../utils/estimate-tx-size'; /** - * Build instruction batches for unwrapping c-tokens to SPL/T22 tokens. + * Build instruction batches for unwrapping light-tokens to SPL/T22 tokens. * * Returns `TransactionInstruction[][]` with the same shape as * `createLoadAtaInstructions` and `createTransferInterfaceInstructions`: @@ -45,7 +45,7 @@ import { * * @param rpc RPC connection * @param destination Destination SPL/T22 token account (must exist) - * @param owner Owner of the c-token + * @param owner Owner of the light-token * @param mint Mint address * @param amount Amount to unwrap (defaults to full balance) * @param payer Fee payer (defaults to owner) @@ -97,7 +97,7 @@ export async function createUnwrapInstructions( ); } - // 3. Derive c-token ATA and get account interface + // 3. Derive light-token associated token account and get account interface const ctokenAta = getAssociatedTokenAddressInterface(mint, owner); let accountInterface: AccountInterface; @@ -113,7 +113,7 @@ export async function createUnwrapInstructions( ); } catch (error) { if (error instanceof TokenAccountNotFoundError) { - throw new Error('No c-token balance to unwrap'); + throw new Error('No light-token balance to unwrap'); } throw error; } @@ -125,9 +125,9 @@ export async function createUnwrapInstructions( if (unfrozenBalance === BigInt(0)) { if (totalBalance > BigInt(0)) { - throw new Error('All c-token balance is frozen'); + throw new Error('All light-token balance is frozen'); } - throw new Error('No c-token balance to unwrap'); + throw new Error('No light-token balance to unwrap'); } const unwrapAmount = @@ -139,7 +139,7 @@ export async function createUnwrapInstructions( ? ` (${totalBalance - unfrozenBalance} frozen, not usable)` : ''; throw new Error( - `Insufficient c-token balance. Requested: ${unwrapAmount}, Available: ${unfrozenBalance}${frozenNote}`, + `Insufficient light-token balance. Requested: ${unwrapAmount}, Available: ${unfrozenBalance}${frozenNote}`, ); } @@ -219,15 +219,15 @@ function assertUnwrapTxSize( } /** - * Unwrap c-tokens to SPL tokens. + * Unwrap light-tokens to SPL tokens. * - * Loads cold state to the c-token ATA, then unwraps to the destination + * Loads cold state to the light-token associated token account, then unwraps to the destination * SPL/T22 token account. Uses `createUnwrapInstructions` internally. * * @param rpc RPC connection * @param payer Fee payer * @param destination Destination SPL/T22 token account - * @param owner Owner of the c-token (signer) + * @param owner Owner of the light-token (signer) * @param mint Mint address * @param amount Amount to unwrap (defaults to all) * @param splInterfaceInfo SPL interface info diff --git a/js/compressed-token/src/v3/actions/update-metadata.ts b/js/compressed-token/src/v3/actions/update-metadata.ts index 0f4254eb52..6234c74a9d 100644 --- a/js/compressed-token/src/v3/actions/update-metadata.ts +++ b/js/compressed-token/src/v3/actions/update-metadata.ts @@ -22,8 +22,8 @@ import { import { getMintInterface } from '../get-mint-interface'; /** - * Update a metadata field on a compressed token mint. - * Works for both compressed and decompressed mints. + * Update a metadata field on a light-token mint. + * Works for both compressed and decompressed light mints. * * @param rpc RPC connection * @param payer Fee payer (signer) @@ -59,7 +59,7 @@ export async function updateMetadataField( throw new Error('Mint does not have TokenMetadata extension'); } - // When mint is decompressed, no validity proof needed - program reads from CMint account + // When light mint account exists (decompressed), no validity proof needed - program reads from light mint account const isDecompressed = mintInterface.mintContext?.cmintDecompressed ?? false; const validityProof = isDecompressed @@ -104,8 +104,8 @@ export async function updateMetadataField( } /** - * Update the metadata authority of a compressed token mint. - * Works for both compressed and decompressed mints. + * Update the metadata authority of a light-token mint. + * Works for both compressed and decompressed light mints. * * @param rpc RPC connection * @param payer Fee payer (signer) @@ -137,7 +137,7 @@ export async function updateMetadataAuthority( throw new Error('Mint does not have TokenMetadata extension'); } - // When mint is decompressed, no validity proof needed - program reads from CMint account + // When light mint account exists (decompressed), no validity proof needed - program reads from light mint account const isDecompressed = mintInterface.mintContext?.cmintDecompressed ?? false; const validityProof = isDecompressed @@ -180,8 +180,8 @@ export async function updateMetadataAuthority( } /** - * Remove a metadata key from a compressed token mint. - * Works for both compressed and decompressed mints. + * Remove a metadata key from a light-token mint. + * Works for both compressed and decompressed light mints. * * @param rpc RPC connection * @param payer Fee payer (signer) @@ -215,7 +215,7 @@ export async function removeMetadataKey( throw new Error('Mint does not have TokenMetadata extension'); } - // When mint is decompressed, no validity proof needed - program reads from CMint account + // When light mint account exists (decompressed), no validity proof needed - program reads from light mint account const isDecompressed = mintInterface.mintContext?.cmintDecompressed ?? false; const validityProof = isDecompressed diff --git a/js/compressed-token/src/v3/actions/update-mint.ts b/js/compressed-token/src/v3/actions/update-mint.ts index 03b3f07f34..411637cb8e 100644 --- a/js/compressed-token/src/v3/actions/update-mint.ts +++ b/js/compressed-token/src/v3/actions/update-mint.ts @@ -21,8 +21,8 @@ import { import { getMintInterface } from '../get-mint-interface'; /** - * Update the mint authority of a compressed token mint. - * Works for both compressed and decompressed mints. + * Update the mint authority of a light-token mint. + * Works for both compressed and decompressed light mints. * * @param rpc RPC connection * @param payer Fee payer (signer) @@ -52,7 +52,7 @@ export async function updateMintAuthority( throw new Error('Mint does not have MerkleContext'); } - // When mint is decompressed, no validity proof needed - program reads from CMint account + // When light mint account exists (decompressed), no validity proof needed - program reads from light mint account const isDecompressed = mintInterface.mintContext?.cmintDecompressed ?? false; const validityProof = isDecompressed @@ -96,8 +96,8 @@ export async function updateMintAuthority( } /** - * Update the freeze authority of a compressed token mint. - * Works for both compressed and decompressed mints. + * Update the freeze authority of a light-token mint. + * Works for both compressed and decompressed light mints. * * @param rpc RPC connection * @param payer Fee payer (signer) @@ -127,7 +127,7 @@ export async function updateFreezeAuthority( throw new Error('Mint does not have MerkleContext'); } - // When mint is decompressed, no validity proof needed - program reads from CMint account + // When light mint account exists (decompressed), no validity proof needed - program reads from light mint account const isDecompressed = mintInterface.mintContext?.cmintDecompressed ?? false; const validityProof = isDecompressed diff --git a/js/compressed-token/src/v3/actions/wrap.ts b/js/compressed-token/src/v3/actions/wrap.ts index b5d7cbc540..fd7eef3111 100644 --- a/js/compressed-token/src/v3/actions/wrap.ts +++ b/js/compressed-token/src/v3/actions/wrap.ts @@ -20,15 +20,15 @@ import { } from '../../utils/get-token-pool-infos'; /** - * Wrap tokens from an SPL/T22 account to a c-token account. + * Wrap tokens from an SPL/T22 account to a light-token account. * * This is an agnostic action that takes explicit account addresses (spl-token style). - * Use getAssociatedTokenAddressSync() to derive ATA addresses if needed. + * Use getAssociatedTokenAddressSync() to derive associated token account addresses if needed. * * @param rpc RPC connection * @param payer Fee payer - * @param source Source SPL/T22 token account (any token account, not just ATA) - * @param destination Destination c-token account + * @param source Source SPL/T22 token account (any token account, not just associated token account) + * @param destination Destination light-token account * @param owner Owner/authority of the source account (must sign) * @param mint Mint address * @param amount Amount to wrap @@ -38,7 +38,7 @@ import { * * @example * const splAta = getAssociatedTokenAddressSync(mint, owner.publicKey, false, TOKEN_PROGRAM_ID); - * const ctokenAta = getAssociatedTokenAddressInterface(mint, owner.publicKey); // defaults to c-token + * const ctokenAta = getAssociatedTokenAddressInterface(mint, owner.publicKey); // defaults to light-token * * await wrap( * rpc, diff --git a/js/compressed-token/src/v3/ata-utils.ts b/js/compressed-token/src/v3/ata-utils.ts index cb73fda281..90a24db411 100644 --- a/js/compressed-token/src/v3/ata-utils.ts +++ b/js/compressed-token/src/v3/ata-utils.ts @@ -8,9 +8,9 @@ import { LIGHT_TOKEN_PROGRAM_ID } from '@lightprotocol/stateless.js'; import { PublicKey } from '@solana/web3.js'; /** - * Get ATA program ID for a token program ID + * Get associated token account program ID for a token program ID * @param tokenProgramId Token program ID - * @returns ATA program ID + * @returns associated token account program ID */ export function getAtaProgramId(tokenProgramId: PublicKey): PublicKey { if (tokenProgramId.equals(LIGHT_TOKEN_PROGRAM_ID)) { @@ -19,10 +19,10 @@ export function getAtaProgramId(tokenProgramId: PublicKey): PublicKey { return ASSOCIATED_TOKEN_PROGRAM_ID; } -/** ATA type for validation result */ +/** associated token account type for validation result */ export type AtaType = 'spl' | 'token2022' | 'ctoken'; -/** Result of ATA validation */ +/** Result of associated token account validation */ export interface AtaValidationResult { valid: true; type: AtaType; @@ -30,14 +30,14 @@ export interface AtaValidationResult { } /** - * Check if an ATA address matches the expected derivation from mint+owner. + * Check if an associated token account address matches the expected derivation from mint+owner. * * Pass programId for fast path. * - * @param ata ATA address to check + * @param ata associated token account address to check * @param mint Mint address * @param owner Owner address - * @param programId Optional: if known, only check this program's ATA + * @param programId Optional: if known, only check this program's associated token account * @param allowOwnerOffCurve Allow the owner to be off-curve (PDA) * @returns Result with detected type, or throws on mismatch */ @@ -74,7 +74,7 @@ export function checkAtaAddress( let splExpected: PublicKey; let t22Expected: PublicKey; - // c-token + // light-token ctokenExpected = getAssociatedTokenAddressSync( mint, owner, @@ -122,7 +122,7 @@ export function checkAtaAddress( throw new Error( `ATA address does not match any valid derivation from mint+owner. ` + `Got: ${ata.toBase58()}, expected one of: ` + - `c-token=${ctokenExpected.toBase58()}, ` + + `light-token=${ctokenExpected.toBase58()}, ` + `SPL=${splExpected.toBase58()}, ` + `T22=${t22Expected.toBase58()}`, ); diff --git a/js/compressed-token/src/v3/derivation.ts b/js/compressed-token/src/v3/derivation.ts index bf4b276306..d4d670ba83 100644 --- a/js/compressed-token/src/v3/derivation.ts +++ b/js/compressed-token/src/v3/derivation.ts @@ -7,14 +7,14 @@ import { PublicKey } from '@solana/web3.js'; import { Buffer } from 'buffer'; /** - * Returns the compressed mint address as bytes. + * Returns the light mint address as bytes. */ export function deriveCMintAddress( mintSeed: PublicKey, addressTreeInfo: TreeInfo, ) { - // find_mint_address returns [CMint, bump], we want CMint - // In JS, just use the mintSeed directly as the CMint address + // find_mint_address returns [light mint, bump], we want light mint + // In JS, just use the mintSeed directly as the light mint address const address = deriveAddressV2( findMintAddress(mintSeed)[0].toBytes(), addressTreeInfo.tree, @@ -29,7 +29,7 @@ export const COMPRESSED_MINT_SEED: Buffer = Buffer.from([ ]); /** - * Finds the SPL mint PDA for a c-token mint. + * Finds the SPL mint PDA for a light-token mint. * @param mintSeed The mint seed public key. * @returns [PDA, bump] */ @@ -42,7 +42,7 @@ export function findMintAddress(mintSigner: PublicKey): [PublicKey, number] { } /// Same as "getAssociatedTokenAddress" but returns the bump as well. -/// Uses c-token program ID. +/// Uses light-token program ID. export function getAssociatedCTokenAddressAndBump( owner: PublicKey, mint: PublicKey, @@ -53,7 +53,7 @@ export function getAssociatedCTokenAddressAndBump( ); } -/// Same as "getAssociatedTokenAddress" but with c-token program ID. +/// Same as "getAssociatedTokenAddress" but with light-token program ID. export function getAssociatedCTokenAddress(owner: PublicKey, mint: PublicKey) { return PublicKey.findProgramAddressSync( [owner.toBuffer(), LIGHT_TOKEN_PROGRAM_ID.toBuffer(), mint.toBuffer()], diff --git a/js/compressed-token/src/v3/get-account-interface.ts b/js/compressed-token/src/v3/get-account-interface.ts index e9fce763b3..0410cee519 100644 --- a/js/compressed-token/src/v3/get-account-interface.ts +++ b/js/compressed-token/src/v3/get-account-interface.ts @@ -57,9 +57,9 @@ export interface AccountInterface { _anyFrozen?: boolean; /** True when fetched via getAtaInterface */ _isAta?: boolean; - /** ATA owner - set by getAtaInterface */ + /** Associated token account owner - set by getAtaInterface */ _owner?: PublicKey; - /** ATA mint - set by getAtaInterface */ + /** Associated token account mint - set by getAtaInterface */ _mint?: PublicKey; } @@ -261,7 +261,7 @@ export function parseCTokenHot( parsed: Account; isCold: false; } { - // Hot c-token accounts use SPL-compatible layout with 4-byte COption tags. + // Hot light-token accounts use SPL-compatible layout with 4-byte COption tags. // unpackAccountSPL correctly parses all fields including delegatedAmount, // isNative, and closeAuthority. const parsed = unpackAccountSPL( @@ -302,7 +302,7 @@ export function parseCTokenCold( }; } /** - * Retrieve information about a token account of SPL/T22/c-token. + * Retrieve information about a token account of SPL/T22/light-token. * * @param rpc RPC connection to use * @param address Token account address @@ -333,7 +333,7 @@ export async function getAccountInterface( * @param programId Optional program ID * @param wrap Include SPL/T22 balances (default: false) * @param allowOwnerOffCurve Allow owner to be off-curve (PDA) - * @returns AccountInterface with ATA metadata + * @returns AccountInterface with associated token account metadata */ export async function getAtaInterface( rpc: Rpc, @@ -349,7 +349,7 @@ export async function getAtaInterface( // Invariant: ata MUST match a valid derivation from mint+owner. // Hot path: if programId provided, only validate against that program. - // For wrap=true, additionally require c-token ATA. + // For wrap=true, additionally require light-token associated token account. const validation = checkAtaAddress( ata, mint, @@ -360,13 +360,13 @@ export async function getAtaInterface( if (wrap && validation.type !== 'ctoken') { throw new Error( - `For wrap=true, ata must be the c-token ATA. Got ${validation.type} ATA instead.`, + `For wrap=true, ata must be the light-token ATA. Got ${validation.type} ATA instead.`, ); } // Pass both ata address AND fetchByOwner for proper lookups: // - address is used for on-chain account fetching - // - fetchByOwner is used for compressed token lookup by owner+mint + // - fetchByOwner is used for light-token lookup by owner+mint const result = await _getAccountInterface( rpc, ata, @@ -476,17 +476,17 @@ async function _tryFetchCTokenColdByOwner( const compressedAccount = result.items.length > 0 ? result.items[0].compressedAccount : null; if (!compressedAccount?.data?.data.length) { - throw new Error('Not a compressed token account'); + throw new Error('Not a light-token account'); } if (!compressedAccount.owner.equals(LIGHT_TOKEN_PROGRAM_ID)) { - throw new Error('Invalid owner for compressed token'); + throw new Error('Invalid owner for light-token'); } return parseCTokenCold(ataAddress, compressedAccount); } /** * @internal - * Fetch compressed token account by deriving its compressed address from the on-chain address. + * Fetch light-token account by deriving its compressed address from the on-chain address. * Uses deriveAddressV2(address, addressTree, LIGHT_TOKEN_PROGRAM_ID) to get the compressed address. * * Note: This only works for accounts that were **compressed from on-chain** (via compress_accounts_idempotent). @@ -516,21 +516,21 @@ async function _tryFetchCTokenColdByAddress( if (!compressedAccount?.data?.data.length) { throw new Error( - 'Compressed token account not found at derived address. ' + + 'Light-token account not found at derived address. ' + 'Note: getAccountInterface only finds compressed accounts that were ' + 'compressed from on-chain (via compress_accounts_idempotent). ' + 'For tokens minted compressed (via mintTo), use getAtaInterface with owner+mint.', ); } if (!compressedAccount.owner.equals(LIGHT_TOKEN_PROGRAM_ID)) { - throw new Error('Invalid owner for compressed token'); + throw new Error('Invalid owner for light-token'); } return parseCTokenCold(address, compressedAccount); } /** * @internal - * Retrieve information about a token account SPL/T22/c-token. + * Retrieve information about a token account SPL/T22/light-token. */ async function _getAccountInterface( rpc: Rpc, @@ -545,13 +545,13 @@ async function _getAccountInterface( ): Promise { // At least one of address or fetchByOwner is required. // Both can be provided: address for on-chain lookup, fetchByOwner for - // compressed token lookup by owner+mint (useful for PDA owners where + // light-token lookup by owner+mint (useful for PDA owners where // address derivation might not work with standard allowOwnerOffCurve=false). if (!address && !fetchByOwner) { throw new Error('One of address or fetchByOwner is required'); } - // Unified mode (auto-detect: c-token + optional SPL/T22) + // Unified mode (auto-detect: light-token + optional SPL/T22) if (!programId) { return getUnifiedAccountInterface( rpc, @@ -562,7 +562,7 @@ async function _getAccountInterface( ); } - // c-token-only mode + // light-token-only mode if (programId.equals(LIGHT_TOKEN_PROGRAM_ID)) { return getCTokenAccountInterface( rpc, @@ -596,7 +596,7 @@ async function getUnifiedAccountInterface( fetchByOwner: { owner: PublicKey; mint: PublicKey } | undefined, wrap: boolean, ): Promise { - // Canonical address for unified mode is always the c-token ATA + // Canonical address for unified mode is always the light-token associated token account const cTokenAta = address ?? getAssociatedTokenAddressSync( @@ -616,7 +616,7 @@ async function getUnifiedAccountInterface( const fetchTypes: TokenAccountSource['type'][] = []; const fetchAddresses: PublicKey[] = []; - // c-token hot + // light-token hot fetchPromises.push(_tryFetchCTokenHot(rpc, cTokenAta, commitment)); fetchTypes.push(TokenAccountSourceType.CTokenHot); fetchAddresses.push(cTokenAta); @@ -624,7 +624,7 @@ async function getUnifiedAccountInterface( // SPL / Token-2022 (only when wrap is enabled) if (wrap) { // Always derive SPL/T22 addresses from owner+mint, not from the passed - // c-token address. SPL and T22 ATAs are different from c-token ATAs. + // light-token address. SPL and T22 associated token accounts are different from light-token associated token accounts. if (!fetchByOwner) { throw new Error( 'fetchByOwner is required for wrap=true to derive SPL/T22 addresses', @@ -654,7 +654,7 @@ async function getUnifiedAccountInterface( fetchAddresses.push(token2022Ata); } - // Fetch ALL cold c-token accounts (not just one) - important for V1/V2 detection + // Fetch ALL cold light-token accounts (not just one) - important for V1/V2 detection const coldAccountsPromise = fetchByOwner ? rpc.getCompressedTokenAccountsByOwner(fetchByOwner.owner, { mint: fetchByOwner.mint, @@ -684,7 +684,7 @@ async function getUnifiedAccountInterface( } } - // Add ALL cold c-token accounts (handles both V1 and V2) + // Add ALL cold light-token accounts (handles both V1 and V2) for (const item of coldResult.items) { const compressedAccount = item.compressedAccount; if ( @@ -710,7 +710,7 @@ async function getUnifiedAccountInterface( throw new TokenAccountNotFoundError(); } - // priority order: c-token hot > c-token cold > SPL/T22 + // priority order: light-token hot > light-token cold > SPL/T22 const priority: TokenAccountSource['type'][] = [ TokenAccountSourceType.CTokenHot, TokenAccountSourceType.CTokenCold, @@ -749,7 +749,7 @@ async function getCTokenAccountInterface( const [onchainResult, compressedResult] = await Promise.allSettled([ rpc.getAccountInfo(address, commitment), - // Fetch compressed: by owner+mint for ATAs, by address for non-ATAs + // Fetch compressed: by owner+mint for associated token accounts, by address for non-ATAs fetchByOwner ? rpc.getCompressedTokenAccountsByOwner(fetchByOwner.owner, { mint: fetchByOwner.mint, @@ -766,7 +766,7 @@ async function getCTokenAccountInterface( const sources: TokenAccountSource[] = []; - // Collect hot (decompressed) c-token account + // Collect light-token associated token account (hot balance) if (onchainAccount && onchainAccount.owner.equals(LIGHT_TOKEN_PROGRAM_ID)) { const parsed = parseCTokenHot(address, onchainAccount); sources.push({ @@ -778,7 +778,7 @@ async function getCTokenAccountInterface( }); } - // Collect cold (compressed) c-token accounts + // Collect compressed light-token accounts (cold balance) for (const compressedAccount of compressedAccounts) { if ( compressedAccount && diff --git a/js/compressed-token/src/v3/get-associated-token-address-interface.ts b/js/compressed-token/src/v3/get-associated-token-address-interface.ts index 7d1238b0ff..6bbe60f76b 100644 --- a/js/compressed-token/src/v3/get-associated-token-address-interface.ts +++ b/js/compressed-token/src/v3/get-associated-token-address-interface.ts @@ -4,13 +4,13 @@ import { LIGHT_TOKEN_PROGRAM_ID } from '@lightprotocol/stateless.js'; import { getAtaProgramId } from './ata-utils'; /** - * Derive the canonical associated token address for any of SPL/T22/c-token. - * Defaults to using c-token as the canonical ATA. + * Derive the canonical associated token address for any of SPL/T22/light-token. + * Defaults to using light-token as the canonical associated token account. * * @param mint Mint public key * @param owner Owner public key * @param allowOwnerOffCurve Allow owner to be a PDA. Default false. - * @param programId Token program ID. Default c-token. + * @param programId Token program ID. Default light-token. * * @param associatedTokenProgramId Associated token program ID. Default * auto-detected. @@ -26,7 +26,7 @@ export function getAssociatedTokenAddressInterface( const effectiveAssociatedProgramId = associatedTokenProgramId ?? getAtaProgramId(programId); - // by passing program id, user indicates preference for the canonical ATA. + // by passing program id, user indicates preference for the canonical associated token account. return getAssociatedTokenAddressSync( mint, owner, diff --git a/js/compressed-token/src/v3/get-mint-interface.ts b/js/compressed-token/src/v3/get-mint-interface.ts index cd2b89f4c2..aeffe71611 100644 --- a/js/compressed-token/src/v3/get-mint-interface.ts +++ b/js/compressed-token/src/v3/get-mint-interface.ts @@ -33,12 +33,12 @@ export interface MintInterface { mintContext?: MintContext; tokenMetadata?: TokenMetadata; extensions?: MintExtension[]; - /** Compression info for c-token mints */ + /** Compression info for light-token mints */ compression?: CompressionInfo; } /** - * Get unified mint info for SPL/T22/c-token mints. + * Get unified mint info for SPL/T22/light-token mints. * * @param rpc RPC connection * @param address The mint address @@ -104,26 +104,26 @@ export async function getMintInterface( if (!compressedAccount?.data?.data) { throw new Error( - `Compressed mint not found for ${address.toString()}`, + `Light mint not found for ${address.toString()}`, ); } const compressedData = Buffer.from(compressedAccount.data.data); // After decompressMint, the compressed account contains sentinel data (just hash ~32 bytes). - // The actual mint data lives on-chain in the CMint account. - // Minimum compressed mint size is 82 (base) + 34 (context) + 33 (signer+bump) = 149+ bytes. + // The actual mint data lives in the light mint account. + // Minimum light mint size is 82 (base) + 34 (context) + 33 (signer+bump) = 149+ bytes. const SENTINEL_THRESHOLD = 64; const isDecompressed = compressedData.length < SENTINEL_THRESHOLD; let compressedMintData: CompressedMint; if (isDecompressed) { - // Mint is decompressed - read from on-chain CMint account + // Light mint account exists - read from light mint account const cmintAccountInfo = await rpc.getAccountInfo(address); if (!cmintAccountInfo?.data) { throw new Error( - `Decompressed CMint account not found on-chain for ${address.toString()}`, + `Decompressed light mint account not found on-chain for ${address.toString()}`, ); } compressedMintData = deserializeMint( @@ -168,12 +168,12 @@ export async function getMintInterface( if (programId.equals(LIGHT_TOKEN_PROGRAM_ID)) { if (!result.merkleContext) { throw new Error( - `Invalid compressed mint: merkleContext is required for LIGHT_TOKEN_PROGRAM_ID`, + `Invalid light mint: merkleContext is required for LIGHT_TOKEN_PROGRAM_ID`, ); } if (!result.mintContext) { throw new Error( - `Invalid compressed mint: mintContext is required for LIGHT_TOKEN_PROGRAM_ID`, + `Invalid light mint: mintContext is required for LIGHT_TOKEN_PROGRAM_ID`, ); } } @@ -187,11 +187,11 @@ export async function getMintInterface( } /** - * Unpack mint info from raw account data for SPL/T22/c-token. + * Unpack mint info from raw account data for SPL/T22/light-token. * * @param address The mint pubkey * @param data The raw account data or AccountInfo - * @param programId Token program ID. Default c-token. + * @param programId Token program ID. Default light-token. * @returns Object with mint, optional mintContext and tokenMetadata. */ export function unpackMintInterface( @@ -206,7 +206,7 @@ export function unpackMintInterface( ? Buffer.from(data) : data.data; - // If compressed token program, deserialize as compressed mint + // If light-token program, deserialize as light mint if (programId.equals(LIGHT_TOKEN_PROGRAM_ID)) { const compressedMintData = deserializeMint(buffer); @@ -238,7 +238,7 @@ export function unpackMintInterface( if (programId.equals(LIGHT_TOKEN_PROGRAM_ID)) { if (!result.mintContext) { throw new Error( - `Invalid compressed mint: mintContext is required for LIGHT_TOKEN_PROGRAM_ID`, + `Invalid light mint: mintContext is required for LIGHT_TOKEN_PROGRAM_ID`, ); } } @@ -253,7 +253,7 @@ export function unpackMintInterface( } /** - * Unpack c-token mint context and metadata from raw account data + * Unpack light-token mint context and metadata from raw account data * * @param data The raw account data * @returns Object with mintContext, tokenMetadata, and extensions diff --git a/js/compressed-token/src/v3/instructions/create-associated-ctoken.ts b/js/compressed-token/src/v3/instructions/create-associated-ctoken.ts index 0bb8921fee..17c2ce7da8 100644 --- a/js/compressed-token/src/v3/instructions/create-associated-ctoken.ts +++ b/js/compressed-token/src/v3/instructions/create-associated-ctoken.ts @@ -53,7 +53,7 @@ export interface CreateAssociatedCTokenAccountParams { } /** - * Default compressible config for c-token ATAs - matches Rust SDK defaults. + * Default compressible config for light-token ATAs - matches Rust SDK defaults. * * - tokenAccountVersion: 3 (ShaFlat) - latest hashing scheme * - rentPayment: 16 - prepay 16 epochs (~24 hours rent) @@ -61,7 +61,7 @@ export interface CreateAssociatedCTokenAccountParams { * - writeTopUp: 766 - per-write top-up (~2 epochs rent) when rent < 2 epochs * - compressToAccountPubkey: null - required for ATAs * - * Cost breakdown at ATA creation: + * Cost breakdown at associated token account creation: * - Rent sponsor PDA (LIGHT_TOKEN_RENT_SPONSOR) pays: rent exemption (~890,880 lamports) * - Fee payer pays: compression_cost (11K) + 16 epochs rent (~6,400) = ~17,400 lamports + tx fees * @@ -130,7 +130,7 @@ export interface CreateAssociatedCTokenAccountInstructionParams { } /** - * Create instruction for creating an associated compressed token account. + * Create instruction for creating an associated light-token account. * Uses the default rent sponsor PDA by default. * * @param feePayer Fee payer public key. @@ -202,7 +202,7 @@ export function createAssociatedCTokenAccountInstruction( } /** - * Create idempotent instruction for creating an associated compressed token account. + * Create idempotent instruction for creating an associated light-token account. * Uses the default rent sponsor PDA by default. * * @param feePayer Fee payer public key. diff --git a/js/compressed-token/src/v3/instructions/create-ata-interface.ts b/js/compressed-token/src/v3/instructions/create-ata-interface.ts index 4141106391..fae3f50955 100644 --- a/js/compressed-token/src/v3/instructions/create-ata-interface.ts +++ b/js/compressed-token/src/v3/instructions/create-ata-interface.ts @@ -17,7 +17,7 @@ import { export { DEFAULT_COMPRESSIBLE_CONFIG }; /** - * c-token-specific config for createAssociatedTokenAccountInterfaceInstruction + * light-token-specific config for createAssociatedTokenAccountInterfaceInstruction */ export interface CTokenConfig { compressibleConfig?: CompressibleConfig | null; @@ -40,7 +40,7 @@ export interface CreateAssociatedTokenAccountInterfaceInstructionParams { /** * Create instruction for creating an associated token account (SPL, Token-2022, - * or c-token). Follows SPL Token API signature with optional c-token config at the + * or light-token). Follows SPL Token API signature with optional light-token config at the * end. * * @param payer Fee payer public key. @@ -49,7 +49,7 @@ export interface CreateAssociatedTokenAccountInterfaceInstructionParams { * @param mint Mint address. * @param programId Token program ID (default: TOKEN_PROGRAM_ID). * @param associatedTokenProgramId Associated token program ID. - * @param ctokenConfig Optional c-token-specific configuration. + * @param ctokenConfig Optional light-token-specific configuration. */ export function createAssociatedTokenAccountInterfaceInstruction( payer: PublicKey, @@ -86,7 +86,7 @@ export function createAssociatedTokenAccountInterfaceInstruction( /** * Create idempotent instruction for creating an associated token account (SPL, - * Token-2022, or c-token). Follows SPL Token API signature with optional c-token + * Token-2022, or light-token). Follows SPL Token API signature with optional light-token * config at the end. * * @param payer Fee payer public key. @@ -95,7 +95,7 @@ export function createAssociatedTokenAccountInterfaceInstruction( * @param mint Mint address. * @param programId Token program ID (default: TOKEN_PROGRAM_ID). * @param associatedTokenProgramId Associated token program ID. - * @param ctokenConfig Optional c-token-specific configuration. + * @param ctokenConfig Optional light-token-specific configuration. */ export function createAssociatedTokenAccountInterfaceIdempotentInstruction( payer: PublicKey, diff --git a/js/compressed-token/src/v3/instructions/create-decompress-interface-instruction.ts b/js/compressed-token/src/v3/instructions/create-decompress-interface-instruction.ts index b0193c1bd7..4c93ebd6cf 100644 --- a/js/compressed-token/src/v3/instructions/create-decompress-interface-instruction.ts +++ b/js/compressed-token/src/v3/instructions/create-decompress-interface-instruction.ts @@ -94,13 +94,13 @@ function buildInputTokenData( /** * Create decompressInterface instruction using Transfer2. * - * Supports decompressing to both c-token accounts and SPL token accounts: - * - For c-token destinations: No splInterfaceInfo needed + * Supports decompressing to both light-token accounts and SPL token accounts: + * - For light-token destinations: No splInterfaceInfo needed * - For SPL destinations: Provide splInterfaceInfo (token pool info) and decimals * * @param payer Fee payer public key - * @param inputCompressedTokenAccounts Input compressed token accounts - * @param toAddress Destination token account address (c-token or SPL ATA) + * @param inputCompressedTokenAccounts Input light-token accounts + * @param toAddress Destination token account address (light-token or SPL associated token account) * @param amount Amount to decompress * @param validityProof Validity proof (contains compressedProof and rootIndices) * @param splInterfaceInfo Optional: SPL interface info for SPL destinations @@ -119,14 +119,14 @@ export function createDecompressInterfaceInstruction( maxTopUp?: number, ): TransactionInstruction { if (inputCompressedTokenAccounts.length === 0) { - throw new Error('No input compressed token accounts provided'); + throw new Error('No input light-token accounts provided'); } const mint = inputCompressedTokenAccounts[0].parsed.mint; const owner = inputCompressedTokenAccounts[0].parsed.owner; // Build packed accounts map - // Order: trees/queues first, then mint, owner, c-token account, c-token program + // Order: trees/queues first, then mint, owner, light-token account, light-token program const packedAccountIndices = new Map(); const packedAccounts: PublicKey[] = []; @@ -165,7 +165,7 @@ export function createDecompressInterfaceInstruction( packedAccountIndices.set(owner.toBase58(), ownerIndex); packedAccounts.push(owner); - // Add destination token account (c-token or SPL) + // Add destination token account (light-token or SPL) const destinationIndex = packedAccounts.length; packedAccountIndices.set(toAddress.toBase58(), destinationIndex); packedAccounts.push(toAddress); @@ -248,7 +248,7 @@ export function createDecompressInterfaceInstruction( } // Build decompress compression - // For c-token: pool values are 0 (unused) + // For light-token: pool values are 0 (unused) // For SPL: pool values point to SPL interface PDA const compressions: Compression[] = [ { diff --git a/js/compressed-token/src/v3/instructions/create-load-accounts-params.ts b/js/compressed-token/src/v3/instructions/create-load-accounts-params.ts index edd9dfd5da..f985fbe688 100644 --- a/js/compressed-token/src/v3/instructions/create-load-accounts-params.ts +++ b/js/compressed-token/src/v3/instructions/create-load-accounts-params.ts @@ -28,7 +28,7 @@ export interface ParsedAccountInfoInterface { /** * Input for createLoadAccountsParams. - * Supports both program PDAs and c-token vaults. + * Supports both program PDAs and light-token vaults. * * The integrating program is responsible for fetching and parsing their accounts. * This helper just packs them for the decompressAccountsIdempotent instruction. @@ -39,7 +39,7 @@ export interface CompressibleAccountInput { /** * Account type key for packing: * - For PDAs: program-specific type name (e.g., "poolState", "observationState") - * - For c-token vaults: "cTokenData" + * - For light-token vaults: "cTokenData" */ accountType: string; /** @@ -82,7 +82,7 @@ export interface CompressibleLoadParams { export interface LoadResult { /** Params for decompressAccountsIdempotent (null if no program accounts need decompressing) */ decompressParams: CompressibleLoadParams | null; - /** Instructions to load ATAs (create ATA, wrap SPL/T22, decompressInterface) */ + /** Instructions to load ATAs (create associated token account, wrap SPL/T22, decompressInterface) */ ataInstructions: TransactionInstruction[]; } @@ -95,7 +95,7 @@ export interface LoadResult { * - ataInstructions: for loading user ATAs * * @param rpc RPC connection - * @param payer Fee payer (needed for ATA instructions) + * @param payer Fee payer (needed for associated token account instructions) * @param programId Program ID for decompressAccountsIdempotent * @param programAccounts PDAs and vaults (caller pre-fetches) * @param atas User ATAs (fetched via getAtaInterface) @@ -121,7 +121,7 @@ export interface LoadResult { * [userAta], * ); * - * // Build transaction with both program decompress and ATA load + * // Build transaction with both program decompress and associated token account load * const instructions = [...result.ataInstructions]; * if (result.decompressParams) { * instructions.push(await program.methods diff --git a/js/compressed-token/src/v3/instructions/create-mint.ts b/js/compressed-token/src/v3/instructions/create-mint.ts index f3d839a772..18ce00c2c9 100644 --- a/js/compressed-token/src/v3/instructions/create-mint.ts +++ b/js/compressed-token/src/v3/instructions/create-mint.ts @@ -29,7 +29,7 @@ import { } from '../../constants'; /** - * Token metadata for creating a c-token mint. + * Token metadata for creating a light-token mint. */ export interface TokenMetadataInstructionData { name: string; @@ -174,7 +174,7 @@ export interface CreateMintInstructionParams { } /** - * Create instruction for initializing a c-token mint. + * Create instruction for initializing a light-token mint. * * @param mintSigner Mint signer keypair public key. * @param decimals Number of decimals for the mint. diff --git a/js/compressed-token/src/v3/instructions/decompress-mint.ts b/js/compressed-token/src/v3/instructions/decompress-mint.ts index a757c9562d..9655218775 100644 --- a/js/compressed-token/src/v3/instructions/decompress-mint.ts +++ b/js/compressed-token/src/v3/instructions/decompress-mint.ts @@ -103,7 +103,7 @@ export interface DecompressMintInstructionParams { authority: PublicKey; /** Fee payer public key */ payer: PublicKey; - /** Validity proof for the compressed mint */ + /** Validity proof for the light mint */ validityProof: ValidityProofWithContext; /** Number of epochs to prepay rent (minimum 2) */ rentPayment?: number; @@ -118,10 +118,10 @@ export interface DecompressMintInstructionParams { } /** - * Create instruction for decompressing a compressed mint. + * Create instruction for decompressing a light mint. * - * This creates the CMint Solana account from a compressed mint, making - * the mint available on-chain. This is required before creating CToken + * This creates the light mint Solana account from a light mint, making + * the light mint account. This is required before creating light-token * associated token accounts. * * DecompressMint is **permissionless** - any account can call it. The @@ -146,12 +146,12 @@ export function createDecompressMintInstruction( if (!mintInterface.merkleContext) { throw new Error( - 'MintInterface must have merkleContext for compressed mint operations', + 'MintInterface must have merkleContext for light mint operations', ); } if (!mintInterface.mintContext) { throw new Error( - 'MintInterface must have mintContext for compressed mint operations', + 'MintInterface must have mintContext for light mint operations', ); } diff --git a/js/compressed-token/src/v3/instructions/mint-to-compressed.ts b/js/compressed-token/src/v3/instructions/mint-to-compressed.ts index c49575514c..7368df1715 100644 --- a/js/compressed-token/src/v3/instructions/mint-to-compressed.ts +++ b/js/compressed-token/src/v3/instructions/mint-to-compressed.ts @@ -43,7 +43,7 @@ function encodeCompressedMintToInstructionData( ); } - // When mint is decompressed, the program reads mint data from the CMint + // When mint is decompressed, the program reads mint data from the light mint // Solana account. Setting mint to null signals this to the program. const isDecompressed = params.mintData.cmintDecompressed; @@ -101,14 +101,14 @@ export interface CreateMintToCompressedInstructionParams { } /** - * Create instruction for minting tokens from a c-mint to compressed accounts. - * To mint to onchain token accounts across SPL/T22/c-mints, use + * Create instruction for minting tokens from a light mint to compressed accounts. + * To mint to light-token associated token accounts across SPL/T22/light mints, use * {@link createMintToInterfaceInstruction} instead. * * @param authority Mint authority public key. * @param payer Fee payer public key. - * @param validityProof Validity proof for the compressed mint. - * @param merkleContext Merkle context of the compressed mint. + * @param validityProof Validity proof for the light mint. + * @param merkleContext Merkle context of the light mint. * @param mintData Mint instruction data. * @param recipients Array of recipients with amounts. * @param outputStateTreeInfo Optional output state tree info. Uses merkle @@ -153,7 +153,7 @@ export function createMintToCompressedInstruction( isWritable: false, }, { pubkey: authority, isSigner: true, isWritable: false }, - // CMint account when decompressed (must come before payer for correct account ordering) + // light mint account when decompressed (must come before payer for correct account ordering) ...(isDecompressed ? [ { diff --git a/js/compressed-token/src/v3/instructions/mint-to-interface.ts b/js/compressed-token/src/v3/instructions/mint-to-interface.ts index 5f9f568ea4..a09874d761 100644 --- a/js/compressed-token/src/v3/instructions/mint-to-interface.ts +++ b/js/compressed-token/src/v3/instructions/mint-to-interface.ts @@ -16,12 +16,12 @@ export interface CreateMintToInterfaceInstructionParams { } /** - * Create mint-to instruction for SPL, Token-2022, or CToken mints. - * This instruction ONLY mints to decompressed/onchain token accounts. + * Create mint-to instruction for SPL, Token-2022, or light-token mints. + * This instruction ONLY mints to light-token associated token accounts (hot). * - * For CToken mints, the mint must be decompressed first (CMint account must exist on-chain). + * For light-token mints, the light mint account must exist (mint must be decompressed first). * - * @param mintInterface Mint interface (SPL, Token-2022, or CToken). + * @param mintInterface Mint interface (SPL, Token-2022, or light-token). * @param destination Destination onchain token account address. * @param authority Mint authority public key. * @param payer Fee payer public key. @@ -53,10 +53,10 @@ export function createMintToInterfaceInstruction( ); } - // CToken (compressed token) - use simple CTokenMintTo instruction - // The mint must be decompressed for this to work (CMint account must exist on-chain) + // light-token (light-token) - use simple CTokenMintTo instruction + // The light mint account must exist for this to work (mint must be decompressed first) if (!mintInterface.mintContext) { - throw new Error('mintContext required for CToken mint-to'); + throw new Error('mintContext required for light-token mint-to'); } // Use payer as fee payer for top-ups if different from authority diff --git a/js/compressed-token/src/v3/instructions/mint-to.ts b/js/compressed-token/src/v3/instructions/mint-to.ts index 29e2fcd84c..4ab5e4bf33 100644 --- a/js/compressed-token/src/v3/instructions/mint-to.ts +++ b/js/compressed-token/src/v3/instructions/mint-to.ts @@ -10,9 +10,9 @@ import { LIGHT_TOKEN_PROGRAM_ID } from '@lightprotocol/stateless.js'; * Parameters for creating a MintTo instruction. */ export interface CreateMintToInstructionParams { - /** Mint account (CMint - decompressed compressed mint) */ + /** Light mint account (decompressed from compressed light mint) */ mint: PublicKey; - /** Destination CToken account to mint to */ + /** Destination light-token account to mint to */ destination: PublicKey; /** Amount of tokens to mint */ amount: number | bigint; @@ -25,9 +25,9 @@ export interface CreateMintToInstructionParams { } /** - * Create instruction for minting tokens to a CToken account. + * Create instruction for minting tokens to a light-token account. * - * This is a simple 3-4 account instruction for minting to decompressed CToken accounts. + * This is a simple 3-4 account instruction for minting to light-token associated token accounts (hot). * Uses discriminator 7 (CTokenMintTo). * * @param params - Mint instruction parameters diff --git a/js/compressed-token/src/v3/instructions/transfer-interface.ts b/js/compressed-token/src/v3/instructions/transfer-interface.ts index 9f05e3106f..f17ae911b0 100644 --- a/js/compressed-token/src/v3/instructions/transfer-interface.ts +++ b/js/compressed-token/src/v3/instructions/transfer-interface.ts @@ -11,17 +11,17 @@ import { LIGHT_TOKEN_PROGRAM_ID } from '@lightprotocol/stateless.js'; const LIGHT_TOKEN_TRANSFER_DISCRIMINATOR = 3; /** - * Create a Light token transfer instruction. + * Create a light-token transfer instruction. * - * For c-token accounts with compressible extension, the program needs + * For light-token accounts with compressible extension, the program needs * system_program and fee_payer to handle rent top-ups. * - * @param source Source c-token account - * @param destination Destination c-token account + * @param source Source light-token account + * @param destination Destination light-token account * @param owner Owner of the source account (signer, also pays for compressible extension top-ups) * @param amount Amount to transfer * @param feePayer Optional fee payer for top-ups (defaults to owner) - * @returns Transaction instruction for Light token transfer + * @returns Transaction instruction for light-token transfer */ export function createLightTokenTransferInstruction( source: PublicKey, diff --git a/js/compressed-token/src/v3/instructions/unwrap.ts b/js/compressed-token/src/v3/instructions/unwrap.ts index 76bdec252a..118c783f18 100644 --- a/js/compressed-token/src/v3/instructions/unwrap.ts +++ b/js/compressed-token/src/v3/instructions/unwrap.ts @@ -16,10 +16,10 @@ import { } from '../layout/layout-transfer2'; /** - * Create an unwrap instruction that moves tokens from a c-token account to an + * Create an unwrap instruction that moves tokens from a light-token account to an * SPL/T22 account. * - * @param source Source c-token account + * @param source Source light-token account * @param destination Destination SPL/T22 token account * @param owner Owner of the source account (signer) * @param mint Mint address @@ -49,7 +49,7 @@ export function createUnwrapInstruction( const _SPL_TOKEN_PROGRAM_INDEX = 5; const CTOKEN_PROGRAM_INDEX = 6; - // Unwrap flow: compress from c-token, decompress to SPL + // Unwrap flow: compress from light-token, decompress to SPL const compressions: Compression[] = [ createCompressCtoken( amount, diff --git a/js/compressed-token/src/v3/instructions/update-metadata.ts b/js/compressed-token/src/v3/instructions/update-metadata.ts index ce9dcef3c0..3024a23d21 100644 --- a/js/compressed-token/src/v3/instructions/update-metadata.ts +++ b/js/compressed-token/src/v3/instructions/update-metadata.ts @@ -91,7 +91,7 @@ function encodeUpdateMetadataInstructionData( ); } - // When mint is decompressed (cmintDecompressed=true), the program reads from CMint account + // When mint is decompressed (cmintDecompressed=true), the program reads from light mint account // so we don't need to include mint data in the instruction const isDecompressed = mintInterface.mintContext?.cmintDecompressed ?? false; @@ -155,12 +155,12 @@ function createUpdateMetadataInstruction( ): TransactionInstruction { if (!mintInterface.merkleContext) { throw new Error( - 'MintInterface must have merkleContext for compressed mint operations', + 'MintInterface must have merkleContext for light mint operations', ); } if (!mintInterface.mintContext) { throw new Error( - 'MintInterface must have mintContext for compressed mint operations', + 'MintInterface must have mintContext for light mint operations', ); } if (!mintInterface.tokenMetadata) { @@ -193,7 +193,7 @@ function createUpdateMetadataInstruction( isWritable: false, }, { pubkey: authority, isSigner: true, isWritable: false }, - // CMint account when decompressed (must come before payer for correct account ordering) + // light mint account when decompressed (must come before payer for correct account ordering) ...(isDecompressed ? [ { @@ -246,7 +246,7 @@ function createUpdateMetadataInstruction( } /** - * Create instruction for updating a compressed mint's metadata field. + * Create instruction for updating a light mint's metadata field. * * Output queue is automatically derived from mintInterface.merkleContext.treeInfo * (preferring nextTreeInfo.queue if available for rollover support). @@ -254,7 +254,7 @@ function createUpdateMetadataInstruction( * @param mintInterface MintInterface from getMintInterface() - must have merkleContext and tokenMetadata * @param authority Metadata update authority public key (must sign) * @param payer Fee payer public key - * @param validityProof Validity proof for the compressed mint (null for decompressed mints) + * @param validityProof Validity proof for the light mint (null for decompressed light mints) * @param fieldType Field to update: 'name', 'symbol', 'uri', or 'custom' * @param value New value for the field * @param customKey Custom key name (required if fieldType is 'custom') @@ -298,7 +298,7 @@ export function createUpdateMetadataFieldInstruction( } /** - * Create instruction for updating a compressed mint's metadata authority. + * Create instruction for updating a light mint's metadata authority. * * Output queue is automatically derived from mintInterface.merkleContext.treeInfo * (preferring nextTreeInfo.queue if available for rollover support). @@ -307,7 +307,7 @@ export function createUpdateMetadataFieldInstruction( * @param currentAuthority Current metadata update authority public key (must sign) * @param newAuthority New metadata update authority public key * @param payer Fee payer public key - * @param validityProof Validity proof for the compressed mint (null for decompressed mints) + * @param validityProof Validity proof for the light mint (null for decompressed light mints) * @param extensionIndex Extension index (default: 0) * @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap) */ @@ -337,7 +337,7 @@ export function createUpdateMetadataAuthorityInstruction( } /** - * Create instruction for removing a metadata key from a compressed mint. + * Create instruction for removing a metadata key from a light mint. * * Output queue is automatically derived from mintInterface.merkleContext.treeInfo * (preferring nextTreeInfo.queue if available for rollover support). @@ -345,7 +345,7 @@ export function createUpdateMetadataAuthorityInstruction( * @param mintInterface MintInterface from getMintInterface() - must have merkleContext and tokenMetadata * @param authority Metadata update authority public key (must sign) * @param payer Fee payer public key - * @param validityProof Validity proof for the compressed mint (null for decompressed mints) + * @param validityProof Validity proof for the light mint (null for decompressed light mints) * @param key Metadata key to remove * @param idempotent If true, don't error if key doesn't exist (default: false) * @param extensionIndex Extension index (default: 0) diff --git a/js/compressed-token/src/v3/instructions/update-mint.ts b/js/compressed-token/src/v3/instructions/update-mint.ts index e7fd6645d3..1accbd5687 100644 --- a/js/compressed-token/src/v3/instructions/update-mint.ts +++ b/js/compressed-token/src/v3/instructions/update-mint.ts @@ -44,7 +44,7 @@ function encodeUpdateMintInstructionData( ? { updateMintAuthority: { newAuthority: params.newAuthority } } : { updateFreezeAuthority: { newAuthority: params.newAuthority } }; - // When mint is decompressed (cmintDecompressed=true), the program reads from CMint account + // When mint is decompressed (cmintDecompressed=true), the program reads from light mint account // so we don't need to include mint data in the instruction const isDecompressed = params.mintInterface.mintContext?.cmintDecompressed ?? false; @@ -103,14 +103,14 @@ function encodeUpdateMintInstructionData( } /** - * Create instruction for updating a compressed mint's mint authority. - * Works for both compressed and decompressed mints. + * Create instruction for updating a light mint's mint authority. + * Works for both compressed and decompressed light mints. * * @param mintInterface MintInterface from getMintInterface() - must have merkleContext * @param currentMintAuthority Current mint authority public key (must sign) * @param newMintAuthority New mint authority (or null to revoke) * @param payer Fee payer public key - * @param validityProof Validity proof for the compressed mint (null for decompressed mints) + * @param validityProof Validity proof for the compressed light mint (null for decompressed light mints) * @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap) */ export function createUpdateMintAuthorityInstruction( @@ -123,12 +123,12 @@ export function createUpdateMintAuthorityInstruction( ): TransactionInstruction { if (!mintInterface.merkleContext) { throw new Error( - 'MintInterface must have merkleContext for compressed mint operations', + 'MintInterface must have merkleContext for light mint operations', ); } if (!mintInterface.mintContext) { throw new Error( - 'MintInterface must have mintContext for compressed mint operations', + 'MintInterface must have mintContext for light mint operations', ); } @@ -158,7 +158,7 @@ export function createUpdateMintAuthorityInstruction( isWritable: false, }, { pubkey: currentMintAuthority, isSigner: true, isWritable: false }, - // CMint account when decompressed (must come before payer for correct account ordering) + // light mint account when decompressed (must come before payer for correct account ordering) ...(isDecompressed ? [ { @@ -211,8 +211,8 @@ export function createUpdateMintAuthorityInstruction( } /** - * Create instruction for updating a compressed mint's freeze authority. - * Works for both compressed and decompressed mints. + * Create instruction for updating a light mint's freeze authority. + * Works for both compressed and decompressed light mints. * * Output queue is automatically derived from mintInterface.merkleContext.treeInfo * (preferring nextTreeInfo.queue if available for rollover support). @@ -221,7 +221,7 @@ export function createUpdateMintAuthorityInstruction( * @param currentFreezeAuthority Current freeze authority public key (must sign) * @param newFreezeAuthority New freeze authority (or null to revoke) * @param payer Fee payer public key - * @param validityProof Validity proof for the compressed mint (null for decompressed mints) + * @param validityProof Validity proof for the compressed light mint (null for decompressed light mints) * @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap) */ export function createUpdateFreezeAuthorityInstruction( @@ -234,12 +234,12 @@ export function createUpdateFreezeAuthorityInstruction( ): TransactionInstruction { if (!mintInterface.merkleContext) { throw new Error( - 'MintInterface must have merkleContext for compressed mint operations', + 'MintInterface must have merkleContext for light mint operations', ); } if (!mintInterface.mintContext) { throw new Error( - 'MintInterface must have mintContext for compressed mint operations', + 'MintInterface must have mintContext for light mint operations', ); } @@ -269,7 +269,7 @@ export function createUpdateFreezeAuthorityInstruction( isWritable: false, }, { pubkey: currentFreezeAuthority, isSigner: true, isWritable: false }, - // CMint account when decompressed (must come before payer for correct account ordering) + // light mint account when decompressed (must come before payer for correct account ordering) ...(isDecompressed ? [ { diff --git a/js/compressed-token/src/v3/instructions/wrap.ts b/js/compressed-token/src/v3/instructions/wrap.ts index ed9e969621..ed04c51ef1 100644 --- a/js/compressed-token/src/v3/instructions/wrap.ts +++ b/js/compressed-token/src/v3/instructions/wrap.ts @@ -17,10 +17,10 @@ import { /** * Create a wrap instruction that moves tokens from an SPL/T22 account to a - * c-token account. + * light-token account. * * @param source Source SPL/T22 token account - * @param destination Destination c-token account + * @param destination Destination light-token account * @param owner Owner of the source account (signer) * @param mint Mint address * @param amount Amount to wrap, diff --git a/js/compressed-token/src/v3/layout/layout-mint.ts b/js/compressed-token/src/v3/layout/layout-mint.ts index 8227d8dcd1..2f2fc942cb 100644 --- a/js/compressed-token/src/v3/layout/layout-mint.ts +++ b/js/compressed-token/src/v3/layout/layout-mint.ts @@ -28,12 +28,12 @@ export interface BaseMint { } /** - * Compressed mint context (protocol version, SPL mint reference) + * Light mint context (protocol version, SPL mint reference) */ export interface MintContext { /** Protocol version for upgradability */ version: number; - /** Whether the compressed mint is decompressed to a CMint Solana account */ + /** Whether the compressed light mint has been decompressed to a light mint account */ cmintDecompressed: boolean; /** PDA of the associated SPL mint */ splMint: PublicKey; @@ -84,7 +84,7 @@ export const TokenMetadataLayout = borshStruct([ ]); /** - * Complete compressed mint structure (raw format) + * Complete light mint structure (raw format) */ export interface CompressedMint { base: BaseMint; @@ -128,7 +128,7 @@ export const RESERVED_SIZE = 16; /** Account type discriminator size */ export const ACCOUNT_TYPE_SIZE = 1; -/** Account type value for CMint */ +/** Account type value for light mint */ export const ACCOUNT_TYPE_MINT = 1; /** @@ -151,7 +151,7 @@ export interface RentConfig { export const RENT_CONFIG_SIZE = 8; // 2 + 2 + 1 + 1 + 2 /** - * Compression info embedded in CompressedMint + * Compression info embedded in light mint */ export interface CompressionInfo { /** Config account version (0 = uninitialized) */ @@ -314,11 +314,11 @@ function deserializeCompressionInfo( } /** - * Deserialize a compressed mint from buffer + * Deserialize a light mint from buffer * Uses SPL's MintLayout for BaseMint and buffer-layout struct for context * * @param data - The raw account data buffer - * @returns The deserialized CompressedMint + * @returns The deserialized light mint */ export function deserializeMint(data: Buffer | Uint8Array): CompressedMint { const buffer = data instanceof Buffer ? data : Buffer.from(data); @@ -469,10 +469,10 @@ function serializeCompressionInfo(compression: CompressionInfo): Buffer { } /** - * Serialize a CompressedMint to buffer + * Serialize a light mint to buffer * Uses SPL's MintLayout for BaseMint, helper functions for context/metadata * - * @param mint - The CompressedMint to serialize + * @param mint - The light mint to serialize * @returns The serialized buffer */ export function serializeMint(mint: CompressedMint): Buffer { @@ -702,10 +702,10 @@ export interface MintInstructionDataWithMetadata extends MintInstructionData { } /** - * Convert a deserialized CompressedMint to MintInstructionData format + * Convert a deserialized light mint to MintInstructionData format * This extracts and flattens the data structure for instruction encoding * - * @param compressedMint - Deserialized CompressedMint from account data + * @param compressedMint - Deserialized light mint from account data * @returns Flattened MintInstructionData for instruction encoding */ export function toMintInstructionData( @@ -739,10 +739,10 @@ export function toMintInstructionData( } /** - * Convert a deserialized CompressedMint to MintInstructionDataWithMetadata + * Convert a deserialized light mint to MintInstructionDataWithMetadata * Throws if the mint doesn't have metadata extension * - * @param compressedMint - Deserialized CompressedMint from account data + * @param compressedMint - Deserialized light mint from account data * @returns MintInstructionDataWithMetadata for metadata update instructions * @throws Error if metadata extension is not present */ @@ -752,7 +752,7 @@ export function toMintInstructionDataWithMetadata( const data = toMintInstructionData(compressedMint); if (!data.metadata) { - throw new Error('CompressedMint does not have TokenMetadata extension'); + throw new Error('light mint does not have TokenMetadata extension'); } return data as MintInstructionDataWithMetadata; diff --git a/js/compressed-token/src/v3/layout/layout-token-metadata.ts b/js/compressed-token/src/v3/layout/layout-token-metadata.ts index 59f95fd004..b31a9c2968 100644 --- a/js/compressed-token/src/v3/layout/layout-token-metadata.ts +++ b/js/compressed-token/src/v3/layout/layout-token-metadata.ts @@ -42,7 +42,7 @@ export interface OffChainTokenMetadataJson { * const metadataJson = toOffChainMetadataJson({ * name: 'My Token', * symbol: 'MTK', - * description: 'A compressed token', + * description: 'A light-token', * image: 'https://example.com/image.png', * }); * const uri = await umi.uploader.uploadJson(metadataJson); diff --git a/js/compressed-token/src/v3/layout/layout-transfer2.ts b/js/compressed-token/src/v3/layout/layout-transfer2.ts index 293aee4007..56717c6050 100644 --- a/js/compressed-token/src/v3/layout/layout-transfer2.ts +++ b/js/compressed-token/src/v3/layout/layout-transfer2.ts @@ -141,9 +141,9 @@ export interface Transfer2InstructionData { outTokenData: MultiTokenTransferOutputData[]; inLamports: bigint[] | null; outLamports: bigint[] | null; - /** Extensions for input compressed token accounts (one array per input account) */ + /** Extensions for input light-token accounts (one array per input account) */ inTlv: Transfer2ExtensionData[][] | null; - /** Extensions for output compressed token accounts (one array per output account) */ + /** Extensions for output light-token accounts (one array per output account) */ outTlv: Transfer2ExtensionData[][] | null; } @@ -445,8 +445,8 @@ export function encodeTransfer2InstructionData( } /** - * Create a compression struct for wrapping SPL tokens to c-token - * (compress from SPL ATA) + * Create a compression struct for wrapping SPL tokens to light-token + * (compress from SPL associated token account) */ export function createCompressSpl( amount: bigint, @@ -472,11 +472,11 @@ export function createCompressSpl( } /** - * Create a compression struct for decompressing to c-token ATA + * Create a compression struct for decompressing to light-token associated token account * @param amount - Amount to decompress * @param mintIndex - Index of mint in packed accounts - * @param recipientIndex - Index of recipient c-token account in packed accounts - * @param tokenProgramIndex - Index of c-token program in packed accounts (for CPI) + * @param recipientIndex - Index of recipient light-token account in packed accounts + * @param tokenProgramIndex - Index of light-token program in packed accounts (for CPI) */ export function createDecompressCtoken( amount: bigint, @@ -498,13 +498,13 @@ export function createDecompressCtoken( } /** - * Create a compression struct for compressing c-token (burn from c-token ATA) - * Used in unwrap flow: c-token ATA -> pool -> SPL ATA - * @param amount - Amount to compress (burn from c-token) + * Create a compression struct for compressing light-token (burn from light-token associated token account) + * Used in unwrap flow: light-token associated token account -> pool -> SPL associated token account + * @param amount - Amount to compress (burn from light-token) * @param mintIndex - Index of mint in packed accounts - * @param sourceIndex - Index of source c-token account in packed accounts + * @param sourceIndex - Index of source light-token account in packed accounts * @param authorityIndex - Index of authority/owner in packed accounts (must sign) - * @param tokenProgramIndex - Index of c-token program in packed accounts (for CPI) + * @param tokenProgramIndex - Index of light-token program in packed accounts (for CPI) */ export function createCompressCtoken( amount: bigint, diff --git a/js/compressed-token/src/v3/unified/index.ts b/js/compressed-token/src/v3/unified/index.ts index 2f6138b82c..8f3f66590e 100644 --- a/js/compressed-token/src/v3/unified/index.ts +++ b/js/compressed-token/src/v3/unified/index.ts @@ -1,7 +1,7 @@ /** * Exports for @lightprotocol/compressed-token/unified * - * Import from `/unified` to get a single unified ATA for SPL/T22 and c-token + * Import from `/unified` to get a single unified associated token account for SPL/T22 and light-token * mints. */ import { @@ -67,14 +67,14 @@ export async function getAtaInterface( } /** - * Derive the canonical token ATA for SPL/T22/c-token in the unified path. + * Derive the canonical token associated token account for SPL/T22/light-token in the unified path. * * Enforces LIGHT_TOKEN_PROGRAM_ID. * * @param mint Mint public key * @param owner Owner public key * @param allowOwnerOffCurve Allow owner to be a PDA. Default false. - * @param programId Token program ID. Default c-token. + * @param programId Token program ID. Default light-token. * @param associatedTokenProgramId Associated token program ID. Default * auto-detected. * @returns Associated token address. @@ -88,7 +88,7 @@ export function getAssociatedTokenAddressInterface( ): PublicKey { if (!programId.equals(LIGHT_TOKEN_PROGRAM_ID)) { throw new Error( - 'Please derive the unified ATA from the c-token program; balances across SPL, T22, and c-token are unified under the canonical c-token ATA.', + 'Please derive the unified ATA from the light-token program; balances across SPL, T22, and light-token are unified under the canonical light-token ATA.', ); } @@ -102,7 +102,7 @@ export function getAssociatedTokenAddressInterface( } /** - * Create instruction batches for loading ALL token balances into a c-token ATA. + * Create instruction batches for loading ALL token balances into a light-token associated token account. * * @param rpc RPC connection * @param ata Associated token address @@ -132,14 +132,14 @@ export async function createLoadAtaInstructions( } /** - * Load all token balances into the c-token ATA. + * Load all token balances into the light-token associated token account. * - * Wraps SPL/Token-2022 balances and decompresses compressed c-tokens - * into the on-chain c-token ATA. If no balances exist and the ATA doesn't + * Wraps SPL/Token-2022 balances and decompresses compressed light-tokens + * into the on-chain light-token associated token account. If no balances exist and the associated token account doesn't * exist, creates an empty ATA (idempotent). * * @param rpc RPC connection - * @param ata Associated token address (c-token) + * @param ata Associated token address (light-token) * @param owner Owner of the tokens (signer) * @param mint Mint public key * @param payer Fee payer (signer, defaults to owner) @@ -201,13 +201,13 @@ export async function loadAta( /** * Transfer tokens using the unified ata interface. * - * Destination ATA must exist. Automatically wraps SPL/T22 to c-token ATA. + * Destination associated token account must exist. Automatically wraps SPL/T22 to light-token associated token account. * * @param rpc RPC connection * @param payer Fee payer (signer) - * @param source Source c-token ATA address + * @param source Source light-token associated token account address * @param mint Mint address - * @param destination Destination c-token ATA address (must exist) + * @param destination Destination light-token associated token account address (must exist) * @param owner Source owner (signer) * @param amount Amount to transfer * @param confirmOptions Optional confirm options @@ -241,18 +241,18 @@ export async function transferInterface( } /** - * Get or create c-token ATA with unified balance detection and auto-loading. + * Get or create light-token ATA with unified balance detection and auto-loading. * * Enforces LIGHT_TOKEN_PROGRAM_ID. Aggregates balances from: - * - c-token hot (on-chain) account - * - c-token cold (compressed) accounts + * - light-token associated token account (hot balance) + * - compressed light-token accounts (cold balance) * - SPL token accounts (for unified wrapping) * - Token-2022 accounts (for unified wrapping) * * When owner is a Signer: * - Creates hot ATA if it doesn't exist * - Loads cold (compressed) tokens into hot ATA - * - Wraps SPL/T22 tokens into c-token ATA + * - Wraps SPL/T22 tokens into light-token associated token account * - Returns account with all tokens ready to use * * When owner is a PublicKey: @@ -294,7 +294,7 @@ export async function getOrCreateAtaInterface( /** * Create transfer instructions for a unified token transfer. * - * Unified variant: always wraps SPL/T22 to c-token ATA. + * Unified variant: always wraps SPL/T22 to light-token associated token account. * * Returns `TransactionInstruction[][]`. Send [0..n-2] in parallel, then [n-1]. * Use `sliceLast` to separate the parallel prefix from the final transfer. @@ -325,7 +325,7 @@ export async function createTransferInterfaceInstructions( } /** - * Build instruction batches for unwrapping c-tokens to SPL/T22. + * Build instruction batches for unwrapping light-tokens to SPL/T22. * * Unified variant: uses wrap=true for loading, so SPL/T22 balances are * consolidated before unwrapping. @@ -335,7 +335,7 @@ export async function createTransferInterfaceInstructions( * * @param rpc RPC connection * @param destination Destination SPL/T22 token account (must exist) - * @param owner Owner of the c-token + * @param owner Owner of the light-token * @param mint Mint address * @param amount Amount to unwrap (defaults to full balance) * @param payer Fee payer (defaults to owner) @@ -368,15 +368,15 @@ export async function createUnwrapInstructions( } /** - * Unwrap c-tokens to SPL tokens. + * Unwrap light-tokens to SPL tokens. * - * Unified variant: loads all cold + SPL/T22 balances to c-token ATA first, + * Unified variant: loads all cold + SPL/T22 balances to light-token associated token account first, * then unwraps to the destination SPL/T22 account. * * @param rpc RPC connection * @param payer Fee payer * @param destination Destination SPL/T22 token account - * @param owner Owner of the c-token (signer) + * @param owner Owner of the light-token (signer) * @param mint Mint address * @param amount Amount to unwrap (defaults to all) * @param splInterfaceInfo SPL interface info diff --git a/js/compressed-token/tests/e2e/create-mint-interface.test.ts b/js/compressed-token/tests/e2e/create-mint-interface.test.ts index 9b94b7da59..50274ac0f4 100644 --- a/js/compressed-token/tests/e2e/create-mint-interface.test.ts +++ b/js/compressed-token/tests/e2e/create-mint-interface.test.ts @@ -152,7 +152,7 @@ describe('createMintInterface', () => { mintSigner, ), ).rejects.toThrow( - 'mintAuthority must be a Signer for compressed token mints', + 'mintAuthority must be a Signer for light-token mints', ); }); }); diff --git a/js/compressed-token/tests/e2e/decompress2.test.ts b/js/compressed-token/tests/e2e/decompress2.test.ts index 7b2b71b6b7..b05082e788 100644 --- a/js/compressed-token/tests/e2e/decompress2.test.ts +++ b/js/compressed-token/tests/e2e/decompress2.test.ts @@ -475,7 +475,7 @@ describe('decompressInterface', () => { undefined, TEST_TOKEN_DECIMALS, ), - ).toThrow('No input compressed token accounts provided'); + ).toThrow('No input light-token accounts provided'); }); it('should handle multiple input accounts', async () => { diff --git a/js/compressed-token/tests/e2e/get-mint-interface.test.ts b/js/compressed-token/tests/e2e/get-mint-interface.test.ts index ff0f29db4c..c4d957fe7b 100644 --- a/js/compressed-token/tests/e2e/get-mint-interface.test.ts +++ b/js/compressed-token/tests/e2e/get-mint-interface.test.ts @@ -167,7 +167,7 @@ describe('getMintInterface', () => { undefined, LIGHT_TOKEN_PROGRAM_ID, ), - ).rejects.toThrow('Compressed mint not found'); + ).rejects.toThrow('Light mint not found'); }); }); diff --git a/js/compressed-token/tests/e2e/load-ata-unified.test.ts b/js/compressed-token/tests/e2e/load-ata-unified.test.ts index 08984b3a4f..06ec9faa1f 100644 --- a/js/compressed-token/tests/e2e/load-ata-unified.test.ts +++ b/js/compressed-token/tests/e2e/load-ata-unified.test.ts @@ -412,7 +412,7 @@ describe('loadAta - Unified Path (wrap=true)', () => { mint, owner.publicKey, ), - ).rejects.toThrow('For wrap=true, ata must be the c-token ATA'); + ).rejects.toThrow('For wrap=true, ata must be the light-token ATA'); }); it('should build instructions for SPL + cold balance', async () => { diff --git a/js/compressed-token/tests/unit/layout-mint.test.ts b/js/compressed-token/tests/unit/layout-mint.test.ts index 55f199809f..3efabb26a0 100644 --- a/js/compressed-token/tests/unit/layout-mint.test.ts +++ b/js/compressed-token/tests/unit/layout-mint.test.ts @@ -500,7 +500,7 @@ describe('layout-mint', () => { expect(() => toMintInstructionDataWithMetadata(compressedMint), - ).toThrow('CompressedMint does not have TokenMetadata extension'); + ).toThrow('light mint does not have TokenMetadata extension'); }); }); }); diff --git a/js/compressed-token/tests/unit/serde.test.ts b/js/compressed-token/tests/unit/serde.test.ts index 233418de2d..deae90c7ce 100644 --- a/js/compressed-token/tests/unit/serde.test.ts +++ b/js/compressed-token/tests/unit/serde.test.ts @@ -1314,7 +1314,7 @@ describe('serde', () => { expect(() => toMintInstructionDataWithMetadata(compressedMint), - ).toThrow('CompressedMint does not have TokenMetadata extension'); + ).toThrow('light mint does not have TokenMetadata extension'); }); it('should throw if extensions array is empty', () => { @@ -1336,7 +1336,7 @@ describe('serde', () => { expect(() => toMintInstructionDataWithMetadata(compressedMint), - ).toThrow('CompressedMint does not have TokenMetadata extension'); + ).toThrow('light mint does not have TokenMetadata extension'); }); }); diff --git a/js/compressed-token/tests/unit/unified-guards.test.ts b/js/compressed-token/tests/unit/unified-guards.test.ts index 227159a5be..1a3543a9c9 100644 --- a/js/compressed-token/tests/unit/unified-guards.test.ts +++ b/js/compressed-token/tests/unit/unified-guards.test.ts @@ -17,7 +17,7 @@ import { } from '../../src/v3/unified'; describe('unified guards', () => { - it('throws when unified getAssociatedTokenAddressInterface uses non c-token program', () => { + it('throws when unified getAssociatedTokenAddressInterface uses non light-token program', () => { const mint = Keypair.generate().publicKey; const owner = Keypair.generate().publicKey; @@ -29,11 +29,11 @@ describe('unified guards', () => { TOKEN_PROGRAM_ID, ), ).toThrow( - 'Please derive the unified ATA from the c-token program; balances across SPL, T22, and c-token are unified under the canonical c-token ATA.', + 'Please derive the unified ATA from the light-token program; balances across SPL, T22, and light-token are unified under the canonical light-token ATA.', ); }); - it('allows unified getAssociatedTokenAddressInterface with c-token program', () => { + it('allows unified getAssociatedTokenAddressInterface with light-token program', () => { const mint = Keypair.generate().publicKey; const owner = Keypair.generate().publicKey; @@ -49,7 +49,7 @@ describe('unified guards', () => { // Skip unless V2+beta - createLoadAtaInstructions is a V2-only interface method requiring beta it.skipIf(!featureFlags.isV2() || !featureFlags.isBeta())( - 'throws when unified createLoadAtaInstructions receives non c-token ATA', + 'throws when unified createLoadAtaInstructions receives non light-token ATA', async () => { const rpc = {} as Rpc; const owner = Keypair.generate().publicKey; @@ -73,7 +73,7 @@ describe('unified guards', () => { owner, ), ).rejects.toThrow( - 'For wrap=true, ata must be the c-token ATA. Got spl ATA instead.', + 'For wrap=true, ata must be the light-token ATA. Got spl ATA instead.', ); }, );