Skip to content

Commit eb3c45c

Browse files
tilo-14tilo-14
andauthored
chore: rename c-token/cmint to light-token/light mint in comments (#2299)
Rename terminology in JSDoc, comments, and error strings: - c-token → light-token - cmint/CMint → light mint - compressed mint → light mint (where referring to the type) - compressed/decompressed (state) → preserved as-is - ATA → associated token account (expanded) - via pool → via interface PDA - hot/cold terminology for token accounts and mints Co-authored-by: tilo-14 <tilo@luminouslabs.com>
1 parent b2d4fc1 commit eb3c45c

45 files changed

Lines changed: 350 additions & 350 deletions

Some content is hidden

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
import { getAssociatedCTokenAddress } from '../derivation';
1919

2020
/**
21-
* Create an associated c-token account.
21+
* Create an associated light-token account.
2222
*
2323
* @param rpc RPC connection
2424
* @param payer Fee payer
@@ -65,7 +65,7 @@ export async function createAssociatedCTokenAccount(
6565
}
6666

6767
/**
68-
* Create an associated compressed token account idempotently.
68+
* Create an associated light-token account idempotently.
6969
*
7070
* @param rpc RPC connection
7171
* @param payer Fee payer

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import { getAssociatedTokenAddressInterface } from '../get-associated-token-addr
2525
export type { CTokenConfig };
2626

2727
/**
28-
* Create an associated token account for SPL/T22/c-token. Defaults to c-token
29-
* program.
28+
* Create an associated token account for SPL/T22/light-token. Defaults to
29+
* light-token program.
3030
*
3131
* @param rpc RPC connection
3232
* @param payer Fee payer and transaction signer
@@ -36,8 +36,8 @@ export type { CTokenConfig };
3636
* @param confirmOptions Options for confirming the transaction
3737
* @param programId Token program ID (default:
3838
* LIGHT_TOKEN_PROGRAM_ID)
39-
* @param associatedTokenProgramId ATA program ID (auto-derived if not
40-
* provided)
39+
* @param associatedTokenProgramId associated token account program ID
40+
* (auto-derived if not provided)
4141
* @param ctokenConfig Optional rent config
4242
* @returns Address of the new associated token account
4343
*/
@@ -98,8 +98,8 @@ export async function createAtaInterface(
9898
}
9999

100100
/**
101-
* Create an associated token account idempotently for SPL/T22/c-token. Defaults
102-
* to c-token program.
101+
* Create an associated token account idempotently for SPL/T22/light-token.
102+
* Defaults to light-token program.
103103
*
104104
* If the account already exists, the instruction succeeds without error.
105105
*
@@ -111,9 +111,9 @@ export async function createAtaInterface(
111111
* @param confirmOptions Options for confirming the transaction
112112
* @param programId Token program ID (default:
113113
* LIGHT_TOKEN_PROGRAM_ID)
114-
* @param associatedTokenProgramId ATA program ID (auto-derived if not
115-
* provided)
116-
* @param ctokenConfig Optional c-token-specific configuration
114+
* @param associatedTokenProgramId associated token account program ID
115+
* (auto-derived if not provided)
116+
* @param ctokenConfig Optional light-token-specific configuration
117117
*
118118
* @returns Address of the associated token account
119119
*/

js/compressed-token/src/v3/actions/create-mint-interface.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ import { createMint } from '../../actions/create-mint';
3131
export { TokenMetadataInstructionData };
3232

3333
/**
34-
* Create and initialize a new mint for SPL/T22/c-token.
34+
* Create and initialize a new mint for SPL/T22/light-token.
3535
*
3636
* @param rpc RPC connection to use
3737
* @param payer Fee payer
38-
* @param mintAuthority Account that will control minting (signer for c-token mints)
38+
* @param mintAuthority Account that will control minting (signer for light-token mints)
3939
* @param freezeAuthority Account that will control freeze and thaw (optional)
4040
* @param decimals Location of the decimal place
4141
* @param keypair Mint keypair (defaults to a random keypair)
4242
* @param confirmOptions Confirm options
4343
* @param programId Token program ID (defaults to LIGHT_TOKEN_PROGRAM_ID)
44-
* @param tokenMetadata Optional token metadata (c-token mints only)
45-
* @param outputStateTreeInfo Optional output state tree info (c-token mints only)
46-
* @param addressTreeInfo Optional address tree info (c-token mints only)
44+
* @param tokenMetadata Optional token metadata (light-token mints only)
45+
* @param outputStateTreeInfo Optional output state tree info (light-token mints only)
46+
* @param addressTreeInfo Optional address tree info (light-token mints only)
4747
*
4848
* @returns Object with mint address and transaction signature
4949
*/
@@ -79,10 +79,10 @@ export async function createMintInterface(
7979
);
8080
}
8181

82-
// Default: compressed token mint creation
82+
// Default: light-token mint creation
8383
if (!('secretKey' in mintAuthority)) {
8484
throw new Error(
85-
'mintAuthority must be a Signer for compressed token mints',
85+
'mintAuthority must be a Signer for light-token mints',
8686
);
8787
}
8888
if (

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ import { LIGHT_TOKEN_PROGRAM_ID } from '@lightprotocol/stateless.js';
2727
import { SplInterfaceInfo } from '../../utils/get-token-pool-infos';
2828

2929
/**
30-
* Decompress compressed (cold) tokens to an on-chain token account.
30+
* Decompress compressed light-tokens (cold balance) to a light-token associated token account (hot balance).
3131
*
3232
* For unified loading, use {@link loadAta} instead.
3333
*
3434
* @param rpc RPC connection
3535
* @param payer Fee payer (signer)
36-
* @param owner Owner of the compressed tokens (signer)
36+
* @param owner Owner of the light-tokens (signer)
3737
* @param mint Mint address
3838
* @param amount Amount to decompress (defaults to all)
3939
* @param destinationAta Destination token account address
40-
* @param destinationOwner Owner of the destination ATA
40+
* @param destinationOwner Owner of the destination associated token account
4141
* @param splInterfaceInfo SPL interface info for SPL/T22 destinations
4242
* @param confirmOptions Confirm options
4343
* @returns Transaction signature, null if nothing to load.
@@ -55,10 +55,10 @@ export async function decompressInterface(
5555
): Promise<TransactionSignature | null> {
5656
assertBetaEnabled();
5757

58-
// Determine if this is SPL or c-token destination
58+
// Determine if this is SPL or light-token destination
5959
const isSplDestination = splInterfaceInfo !== undefined;
6060

61-
// Get compressed token accounts
61+
// Get compressed light-token accounts (cold balance)
6262
const compressedResult = await rpc.getCompressedTokenAccountsByOwner(
6363
owner.publicKey,
6464
{ mint },
@@ -104,12 +104,12 @@ export async function decompressInterface(
104104
})),
105105
);
106106

107-
// Determine destination ATA based on token program
107+
// Determine destination associated token account based on token program
108108
const ataOwner = destinationOwner ?? owner.publicKey;
109109
let destinationAtaAddress: PublicKey;
110110

111111
if (isSplDestination) {
112-
// SPL destination - use SPL ATA
112+
// SPL destination - use SPL associated token account
113113
destinationAtaAddress =
114114
destinationAta ??
115115
(await getAssociatedTokenAddress(
@@ -119,7 +119,7 @@ export async function decompressInterface(
119119
splInterfaceInfo.tokenProgram,
120120
));
121121
} else {
122-
// c-token destination - use c-token ATA
122+
// light-token destination - use light-token associated token account
123123
destinationAtaAddress =
124124
destinationAta ??
125125
getAssociatedTokenAddressInterface(mint, ataOwner);
@@ -128,11 +128,11 @@ export async function decompressInterface(
128128
// Build instructions
129129
const instructions = [];
130130

131-
// Create ATA if needed (idempotent)
131+
// Create associated token account if needed (idempotent)
132132
const ataInfo = await rpc.getAccountInfo(destinationAtaAddress);
133133
if (!ataInfo) {
134134
if (isSplDestination) {
135-
// Create SPL ATA
135+
// Create SPL associated token account
136136
instructions.push(
137137
createAssociatedTokenAccountIdempotentInstruction(
138138
payer.publicKey,
@@ -143,7 +143,7 @@ export async function decompressInterface(
143143
),
144144
);
145145
} else {
146-
// Create c-token ATA
146+
// Create light-token associated token account
147147
instructions.push(
148148
createAssociatedTokenAccountInterfaceIdempotentInstruction(
149149
payer.publicKey,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ export interface DecompressMintParams {
3131
}
3232

3333
/**
34-
* Decompress a compressed mint to create the CMint Solana account.
34+
* Decompress a compressed light mint to create the light mint account.
3535
*
36-
* This makes the mint available on-chain, which is required before creating
37-
* CToken associated token accounts. DecompressMint is **permissionless** -
36+
* This creates the light mint account, which is required before creating
37+
* light-token associated token accounts. DecompressMint is **permissionless** -
3838
* any account can call it.
3939
*
4040
* @param rpc - RPC connection

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import { loadAta } from './load-ata';
4646
* @param mint Mint associated with the account to set or
4747
* verify.
4848
* @param owner Owner of the account. Pass Signer to
49-
* auto-load cold (compressed) tokens, or
49+
* auto-load compressed light-tokens (cold balance), or
5050
* PublicKey for read-only.
5151
* @param allowOwnerOffCurve Allow the owner account to be a PDA (Program
5252
* Derived Address).
@@ -131,7 +131,7 @@ export async function _getOrCreateAtaInterface(
131131
associatedTokenProgramId,
132132
);
133133

134-
// For c-token, use getAtaInterface which properly aggregates hot+cold balances
134+
// For light-token, use getAtaInterface which properly aggregates hot+cold balances
135135
// When wrap=true (unified path), also includes SPL/T22 balances
136136
if (programId.equals(LIGHT_TOKEN_PROGRAM_ID)) {
137137
return getOrCreateCTokenAta(
@@ -162,14 +162,14 @@ export async function _getOrCreateAtaInterface(
162162
}
163163

164164
/**
165-
* Get or create c-token ATA with proper cold balance handling.
165+
* Get or create light-token associated token account with proper compressed balance handling.
166166
*
167167
* Like SPL's getOrCreateAssociatedTokenAccount, this is a write operation:
168-
* 1. Creates hot ATA if it doesn't exist
169-
* 2. If owner is Signer: loads cold (compressed) tokens into hot ATA
168+
* 1. Creates hot associated token account if it doesn't exist
169+
* 2. If owner is Signer: loads compressed light-tokens (cold balance) into light-token associated token account
170170
* 3. When wrap=true and owner is Signer: also wraps SPL/T22 tokens
171171
*
172-
* After this call (with Signer owner), all tokens are in the hot ATA and ready
172+
* After this call (with Signer owner), all tokens are in the hot associated token account and ready
173173
* to use.
174174
*
175175
* @internal
@@ -215,7 +215,7 @@ async function getOrCreateCTokenAta(
215215
error instanceof TokenAccountNotFoundError ||
216216
error instanceof TokenInvalidAccountOwnerError
217217
) {
218-
// No account found (neither hot nor cold), create hot ATA
218+
// No account found (neither hot nor cold), create hot associated token account
219219
await createCTokenAtaIdempotent(
220220
rpc,
221221
payer,
@@ -242,7 +242,7 @@ async function getOrCreateCTokenAta(
242242
}
243243
}
244244

245-
// If we only have cold balance (no hot ATA), create the hot ATA first
245+
// If we only have cold balance (no hot associated token account), create the hot associated token account first
246246
if (!hasHotAccount) {
247247
await createCTokenAtaIdempotent(
248248
rpc,
@@ -257,7 +257,7 @@ async function getOrCreateCTokenAta(
257257
// Only auto-load if owner is a Signer (we can sign the load transaction)
258258
// Use direct type guard in the if condition for proper type narrowing
259259
if (isSigner(owner)) {
260-
// Check if we need to load tokens into the hot ATA
260+
// Check if we need to load tokens into the hot associated token account
261261
// Load if: cold balance exists, or (wrap=true and SPL/T22 balance exists)
262262
const sources = accountInterface._sources ?? [];
263263
const hasCold = sources.some(
@@ -285,7 +285,7 @@ async function getOrCreateCTokenAta(
285285
);
286286
}
287287

288-
// Load all tokens into hot ATA (decompress cold, wrap SPL/T22 if
288+
// Load all tokens into hot associated token account (decompress cold, wrap SPL/T22 if
289289
// wrap=true)
290290
await loadAta(
291291
rpc,
@@ -321,7 +321,7 @@ async function getOrCreateCTokenAta(
321321
}
322322

323323
/**
324-
* Create c-token ATA idempotently.
324+
* Create light-token associated token account idempotently.
325325
* @internal
326326
*/
327327
async function createCTokenAtaIdempotent(
@@ -351,12 +351,12 @@ async function createCTokenAtaIdempotent(
351351

352352
await sendAndConfirmTx(rpc, tx, confirmOptions);
353353
} catch {
354-
// Ignore errors - ATA may already exist
354+
// Ignore errors - associated token account may already exist
355355
}
356356
}
357357

358358
/**
359-
* Get or create SPL/T22 ATA.
359+
* Get or create SPL/T22 associated token account.
360360
* @internal
361361
*/
362362
async function getOrCreateSplAta(

0 commit comments

Comments
 (0)