@lightprotocol/compressed-token 0.23.0-beta.5 → 0.23.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
1
  /// <reference types="node" />
2
- import * as _solana_web3_js from '@solana/web3.js';
3
- import { PublicKey, AccountInfo, Commitment, TransactionInstruction, Signer, AccountMeta, Keypair, ConfirmOptions, TransactionSignature, Connection } from '@solana/web3.js';
2
+ import { PublicKey, AccountInfo, Commitment, TransactionInstruction, AccountMeta, Signer, Keypair, ConfirmOptions, TransactionSignature, Connection } from '@solana/web3.js';
4
3
  import { MerkleContext, CompressedAccountWithMerkleContext, Rpc, ValidityProofWithContext, AddressTreeInfo, TreeInfo, ParsedTokenAccount, ValidityProof, TreeType, PackedMerkleContextLegacy, CompressedCpiContext, InputTokenDataWithContext as InputTokenDataWithContext$1, CompressedProof } from '@lightprotocol/stateless.js';
5
4
  export { ParsedTokenAccount } from '@lightprotocol/stateless.js';
6
5
  import { Account, Mint } from '@solana/spl-token';
@@ -865,6 +864,229 @@ declare function parseCTokenCold(address: PublicKey, compressedAccount: Compress
865
864
  */
866
865
  declare function getAccountInterface(rpc: Rpc, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<AccountInterface>;
867
866
 
867
+ /**
868
+ * SPL interface PDA info.
869
+ */
870
+ type SplInterfaceInfo = {
871
+ /**
872
+ * The mint of the SPL interface
873
+ */
874
+ mint: PublicKey;
875
+ /**
876
+ * The SPL interface address
877
+ */
878
+ splInterfacePda: PublicKey;
879
+ /**
880
+ * The token program of the SPL interface
881
+ */
882
+ tokenProgram: PublicKey;
883
+ /**
884
+ * count of txs and volume in the past 60 seconds.
885
+ */
886
+ activity?: {
887
+ txs: number;
888
+ amountAdded: BN;
889
+ amountRemoved: BN;
890
+ };
891
+ /**
892
+ * Whether the SPL interface is initialized
893
+ */
894
+ isInitialized: boolean;
895
+ /**
896
+ * The balance of the SPL interface
897
+ */
898
+ balance: BN;
899
+ /**
900
+ * The index of the SPL interface
901
+ */
902
+ poolIndex: number;
903
+ /**
904
+ * The bump used to derive the SPL interface PDA
905
+ */
906
+ bump: number;
907
+ };
908
+ /**
909
+ * @deprecated Use {@link SplInterfaceInfo} instead.
910
+ * This type maintains backward compatibility by including both tokenPoolPda and splInterfacePda.
911
+ * Both properties point to the same PublicKey value.
912
+ */
913
+ type TokenPoolInfo = {
914
+ /**
915
+ * The mint of the SPL interface
916
+ */
917
+ mint: PublicKey;
918
+ /**
919
+ * @deprecated Use splInterfacePda instead.
920
+ */
921
+ tokenPoolPda: PublicKey;
922
+ /**
923
+ * The SPL interface address (new name).
924
+ * For backward compatibility, tokenPoolPda is also available.
925
+ */
926
+ splInterfacePda: PublicKey;
927
+ /**
928
+ * The token program of the SPL interface
929
+ */
930
+ tokenProgram: PublicKey;
931
+ /**
932
+ * count of txs and volume in the past 60 seconds.
933
+ */
934
+ activity?: {
935
+ txs: number;
936
+ amountAdded: BN;
937
+ amountRemoved: BN;
938
+ };
939
+ /**
940
+ * Whether the SPL interface is initialized
941
+ */
942
+ isInitialized: boolean;
943
+ /**
944
+ * The balance of the SPL interface
945
+ */
946
+ balance: BN;
947
+ /**
948
+ * The index of the SPL interface
949
+ */
950
+ poolIndex: number;
951
+ /**
952
+ * The bump used to derive the SPL interface PDA
953
+ */
954
+ bump: number;
955
+ };
956
+ /**
957
+ * Convert SplInterfaceInfo to TokenPoolInfo for backward compatibility.
958
+ * @internal
959
+ */
960
+ declare function toTokenPoolInfo(info: SplInterfaceInfo): TokenPoolInfo;
961
+ /**
962
+ * Derive SplInterfaceInfo for an SPL interface that will be initialized in the
963
+ * same transaction. Use this when you need to create an SPL interface and
964
+ * compress in a single transaction.
965
+ *
966
+ * @param mint The mint of the SPL interface
967
+ * @param tokenProgramId The token program (TOKEN_PROGRAM_ID or TOKEN_2022_PROGRAM_ID)
968
+ * @param poolIndex The pool index. Default 0.
969
+ *
970
+ * @returns SplInterfaceInfo for the to-be-initialized interface
971
+ */
972
+ declare function deriveSplInterfaceInfo(mint: PublicKey, tokenProgramId: PublicKey, poolIndex?: number): SplInterfaceInfo;
973
+ /**
974
+ * Check if the SPL interface info is initialized and has a balance.
975
+ * @param mint The mint of the SPL interface
976
+ * @param splInterfaceInfo The SPL interface info (or TokenPoolInfo for backward compatibility)
977
+ * @returns True if the SPL interface info is initialized and has a balance
978
+ */
979
+ declare function checkSplInterfaceInfo(splInterfaceInfo: SplInterfaceInfo | TokenPoolInfo, mint: PublicKey): boolean;
980
+ /**
981
+ * Get the SPL interface infos for a given mint.
982
+ * @param rpc The RPC client
983
+ * @param mint The mint of the SPL interface
984
+ * @param commitment The commitment to use
985
+ *
986
+ * @returns The SPL interface infos
987
+ */
988
+ declare function getSplInterfaceInfos(rpc: Rpc, mint: PublicKey, commitment?: Commitment): Promise<SplInterfaceInfo[]>;
989
+ type SplInterfaceActivity = {
990
+ signature: string;
991
+ amount: BN;
992
+ action: Action;
993
+ };
994
+ /**
995
+ * @internal
996
+ */
997
+ declare enum Action {
998
+ Compress = 1,
999
+ Decompress = 2,
1000
+ Transfer = 3
1001
+ }
1002
+ /**
1003
+ * For `compress` and `mintTo` instructions only.
1004
+ * Select a random SPL interface info from the SPL interface infos.
1005
+ *
1006
+ * For `decompress`, use {@link selectSplInterfaceInfosForDecompression} instead.
1007
+ *
1008
+ * @param infos The SPL interface infos
1009
+ *
1010
+ * @returns A random SPL interface info
1011
+ */
1012
+ declare function selectSplInterfaceInfo(infos: SplInterfaceInfo[]): SplInterfaceInfo;
1013
+ /**
1014
+ * Select one or multiple SPL interface infos from the SPL interface infos.
1015
+ *
1016
+ * Use this function for `decompress`.
1017
+ *
1018
+ * For `compress`, `mintTo` use {@link selectSplInterfaceInfo} instead.
1019
+ *
1020
+ * @param infos The SPL interface infos
1021
+ * @param decompressAmount The amount of tokens to withdraw
1022
+ *
1023
+ * @returns Array with one or more SPL interface infos.
1024
+ */
1025
+ declare function selectSplInterfaceInfosForDecompression(infos: SplInterfaceInfo[], decompressAmount: number | BN): SplInterfaceInfo[];
1026
+ /**
1027
+ * @deprecated Use {@link SplInterfaceActivity} instead.
1028
+ */
1029
+ type TokenPoolActivity = SplInterfaceActivity;
1030
+ /**
1031
+ * @deprecated Use {@link deriveSplInterfaceInfo} instead.
1032
+ */
1033
+ declare function deriveTokenPoolInfo(mint: PublicKey, tokenProgramId: PublicKey, poolIndex?: number): TokenPoolInfo;
1034
+ /**
1035
+ * @deprecated Use {@link checkSplInterfaceInfo} instead.
1036
+ */
1037
+ declare function checkTokenPoolInfo(tokenPoolInfo: TokenPoolInfo, mint: PublicKey): boolean;
1038
+ /**
1039
+ * @deprecated Use {@link getSplInterfaceInfos} instead.
1040
+ */
1041
+ declare function getTokenPoolInfos(rpc: Rpc, mint: PublicKey, commitment?: Commitment): Promise<TokenPoolInfo[]>;
1042
+ /**
1043
+ * @deprecated Use {@link selectSplInterfaceInfo} instead.
1044
+ */
1045
+ declare function selectTokenPoolInfo(infos: TokenPoolInfo[]): TokenPoolInfo;
1046
+ /**
1047
+ * @deprecated Use {@link selectSplInterfaceInfosForDecompression} instead.
1048
+ */
1049
+ declare function selectTokenPoolInfosForDecompression(infos: TokenPoolInfo[], decompressAmount: number | BN): TokenPoolInfo[];
1050
+
1051
+ /**
1052
+ * Options for interface operations (load, transfer)
1053
+ */
1054
+ interface InterfaceOptions {
1055
+ /** SPL interface infos (fetched if not provided) */
1056
+ splInterfaceInfos?: SplInterfaceInfo[];
1057
+ }
1058
+ /**
1059
+ * Options for createTransferInterfaceInstructions.
1060
+ */
1061
+ interface TransferOptions extends InterfaceOptions {
1062
+ /** Include SPL/T22 wrapping to c-token ATA (unified path). Default: false. */
1063
+ wrap?: boolean;
1064
+ /** Token program ID. Default: LIGHT_TOKEN_PROGRAM_ID. */
1065
+ programId?: PublicKey;
1066
+ /**
1067
+ * Include an idempotent recipient ATA creation instruction in the
1068
+ * transfer transaction. No extra RPC fetch -- uses
1069
+ * createAssociatedTokenAccountInterfaceIdempotentInstruction which is
1070
+ * a no-op on-chain if the ATA already exists (~200 CU overhead).
1071
+ * Default: true.
1072
+ */
1073
+ ensureRecipientAta?: boolean;
1074
+ }
1075
+ /**
1076
+ * Splits the last element from an array.
1077
+ *
1078
+ * Useful for separating load transactions (parallel) from the final transfer
1079
+ * transaction (sequential) returned by `createTransferInterfaceInstructions`.
1080
+ *
1081
+ * @returns `{ rest, last }` where `rest` is everything before the last
1082
+ * element and `last` is the last element.
1083
+ * @throws if the input array is empty.
1084
+ */
1085
+ declare function sliceLast<T>(items: T[]): {
1086
+ rest: T[];
1087
+ last: T;
1088
+ };
1089
+
868
1090
  interface LayoutObject {
869
1091
  [key: string]: any;
870
1092
  }
@@ -1254,16 +1476,18 @@ declare function unpackMintData(data: Buffer$1 | Uint8Array): {
1254
1476
 
1255
1477
  /**
1256
1478
  * Create instruction for updating a compressed mint's mint authority.
1479
+ * Works for both compressed and decompressed mints.
1257
1480
  *
1258
1481
  * @param mintInterface MintInterface from getMintInterface() - must have merkleContext
1259
1482
  * @param currentMintAuthority Current mint authority public key (must sign)
1260
1483
  * @param newMintAuthority New mint authority (or null to revoke)
1261
1484
  * @param payer Fee payer public key
1262
- * @param validityProof Validity proof for the compressed mint
1485
+ * @param validityProof Validity proof for the compressed mint (null for decompressed mints)
1263
1486
  */
1264
- declare function createUpdateMintAuthorityInstruction(mintInterface: MintInterface, currentMintAuthority: PublicKey, newMintAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext): TransactionInstruction;
1487
+ declare function createUpdateMintAuthorityInstruction(mintInterface: MintInterface, currentMintAuthority: PublicKey, newMintAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext | null): TransactionInstruction;
1265
1488
  /**
1266
1489
  * Create instruction for updating a compressed mint's freeze authority.
1490
+ * Works for both compressed and decompressed mints.
1267
1491
  *
1268
1492
  * Output queue is automatically derived from mintInterface.merkleContext.treeInfo
1269
1493
  * (preferring nextTreeInfo.queue if available for rollover support).
@@ -1272,9 +1496,9 @@ declare function createUpdateMintAuthorityInstruction(mintInterface: MintInterfa
1272
1496
  * @param currentFreezeAuthority Current freeze authority public key (must sign)
1273
1497
  * @param newFreezeAuthority New freeze authority (or null to revoke)
1274
1498
  * @param payer Fee payer public key
1275
- * @param validityProof Validity proof for the compressed mint
1499
+ * @param validityProof Validity proof for the compressed mint (null for decompressed mints)
1276
1500
  */
1277
- declare function createUpdateFreezeAuthorityInstruction(mintInterface: MintInterface, currentFreezeAuthority: PublicKey, newFreezeAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext): TransactionInstruction;
1501
+ declare function createUpdateFreezeAuthorityInstruction(mintInterface: MintInterface, currentFreezeAuthority: PublicKey, newFreezeAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext | null): TransactionInstruction;
1278
1502
 
1279
1503
  /**
1280
1504
  * Create instruction for updating a compressed mint's metadata field.
@@ -1285,13 +1509,13 @@ declare function createUpdateFreezeAuthorityInstruction(mintInterface: MintInter
1285
1509
  * @param mintInterface MintInterface from getMintInterface() - must have merkleContext and tokenMetadata
1286
1510
  * @param authority Metadata update authority public key (must sign)
1287
1511
  * @param payer Fee payer public key
1288
- * @param validityProof Validity proof for the compressed mint
1512
+ * @param validityProof Validity proof for the compressed mint (null for decompressed mints)
1289
1513
  * @param fieldType Field to update: 'name', 'symbol', 'uri', or 'custom'
1290
1514
  * @param value New value for the field
1291
1515
  * @param customKey Custom key name (required if fieldType is 'custom')
1292
1516
  * @param extensionIndex Extension index (default: 0)
1293
1517
  */
1294
- declare function createUpdateMetadataFieldInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, fieldType: 'name' | 'symbol' | 'uri' | 'custom', value: string, customKey?: string, extensionIndex?: number): TransactionInstruction;
1518
+ declare function createUpdateMetadataFieldInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext | null, fieldType: 'name' | 'symbol' | 'uri' | 'custom', value: string, customKey?: string, extensionIndex?: number): TransactionInstruction;
1295
1519
  /**
1296
1520
  * Create instruction for updating a compressed mint's metadata authority.
1297
1521
  *
@@ -1302,10 +1526,10 @@ declare function createUpdateMetadataFieldInstruction(mintInterface: MintInterfa
1302
1526
  * @param currentAuthority Current metadata update authority public key (must sign)
1303
1527
  * @param newAuthority New metadata update authority public key
1304
1528
  * @param payer Fee payer public key
1305
- * @param validityProof Validity proof for the compressed mint
1529
+ * @param validityProof Validity proof for the compressed mint (null for decompressed mints)
1306
1530
  * @param extensionIndex Extension index (default: 0)
1307
1531
  */
1308
- declare function createUpdateMetadataAuthorityInstruction(mintInterface: MintInterface, currentAuthority: PublicKey, newAuthority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, extensionIndex?: number): TransactionInstruction;
1532
+ declare function createUpdateMetadataAuthorityInstruction(mintInterface: MintInterface, currentAuthority: PublicKey, newAuthority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext | null, extensionIndex?: number): TransactionInstruction;
1309
1533
  /**
1310
1534
  * Create instruction for removing a metadata key from a compressed mint.
1311
1535
  *
@@ -1315,12 +1539,12 @@ declare function createUpdateMetadataAuthorityInstruction(mintInterface: MintInt
1315
1539
  * @param mintInterface MintInterface from getMintInterface() - must have merkleContext and tokenMetadata
1316
1540
  * @param authority Metadata update authority public key (must sign)
1317
1541
  * @param payer Fee payer public key
1318
- * @param validityProof Validity proof for the compressed mint
1542
+ * @param validityProof Validity proof for the compressed mint (null for decompressed mints)
1319
1543
  * @param key Metadata key to remove
1320
1544
  * @param idempotent If true, don't error if key doesn't exist (default: false)
1321
1545
  * @param extensionIndex Extension index (default: 0)
1322
1546
  */
1323
- declare function createRemoveMetadataKeyInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, key: string, idempotent?: boolean, extensionIndex?: number): TransactionInstruction;
1547
+ declare function createRemoveMetadataKeyInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext | null, key: string, idempotent?: boolean, extensionIndex?: number): TransactionInstruction;
1324
1548
 
1325
1549
  interface CompressToPubkey {
1326
1550
  bump: number;
@@ -1335,8 +1559,7 @@ interface CompressibleConfig {
1335
1559
  compressToAccountPubkey?: CompressToPubkey | null;
1336
1560
  }
1337
1561
  interface CreateAssociatedCTokenAccountParams {
1338
- bump: number;
1339
- compressibleConfig?: CompressibleConfig;
1562
+ compressibleConfig?: CompressibleConfig | null;
1340
1563
  }
1341
1564
  /**
1342
1565
  * Default compressible config for c-token ATAs - matches Rust SDK defaults.
@@ -1381,7 +1604,7 @@ declare const DEFAULT_COMPRESSIBLE_CONFIG: CompressibleConfig;
1381
1604
  * @param configAccount Config account (defaults to LIGHT_TOKEN_CONFIG).
1382
1605
  * @param rentPayerPda Rent payer PDA (defaults to LIGHT_TOKEN_RENT_SPONSOR).
1383
1606
  */
1384
- declare function createAssociatedCTokenAccountInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
1607
+ declare function createAssociatedCTokenAccountInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig | null, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
1385
1608
  /**
1386
1609
  * Create idempotent instruction for creating an associated compressed token account.
1387
1610
  * Uses the default rent sponsor PDA by default.
@@ -1393,13 +1616,13 @@ declare function createAssociatedCTokenAccountInstruction(feePayer: PublicKey, o
1393
1616
  * @param configAccount Config account (defaults to LIGHT_TOKEN_CONFIG).
1394
1617
  * @param rentPayerPda Rent payer PDA (defaults to LIGHT_TOKEN_RENT_SPONSOR).
1395
1618
  */
1396
- declare function createAssociatedCTokenAccountIdempotentInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
1619
+ declare function createAssociatedCTokenAccountIdempotentInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig | null, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
1397
1620
 
1398
1621
  /**
1399
1622
  * c-token-specific config for createAssociatedTokenAccountInterfaceInstruction
1400
1623
  */
1401
1624
  interface CTokenConfig {
1402
- compressibleConfig?: CompressibleConfig;
1625
+ compressibleConfig?: CompressibleConfig | null;
1403
1626
  configAccount?: PublicKey;
1404
1627
  rentPayerPda?: PublicKey;
1405
1628
  }
@@ -1437,18 +1660,32 @@ declare function createAssociatedTokenAccountInterfaceIdempotentInstruction(paye
1437
1660
  declare const createAtaInterfaceIdempotentInstruction: typeof createAssociatedTokenAccountInterfaceIdempotentInstruction;
1438
1661
 
1439
1662
  /**
1440
- * Create instruction for minting compressed tokens to an onchain token account.
1663
+ * Parameters for creating a MintTo instruction.
1664
+ */
1665
+ interface CreateMintToInstructionParams {
1666
+ /** Mint account (CMint - decompressed compressed mint) */
1667
+ mint: PublicKey;
1668
+ /** Destination CToken account to mint to */
1669
+ destination: PublicKey;
1670
+ /** Amount of tokens to mint */
1671
+ amount: number | bigint;
1672
+ /** Mint authority (must be signer) */
1673
+ authority: PublicKey;
1674
+ /** Maximum lamports for rent and top-up combined. Transaction fails if exceeded. (0 = no limit) */
1675
+ maxTopUp?: number;
1676
+ /** Optional fee payer for rent top-ups. If not provided, authority pays. */
1677
+ feePayer?: PublicKey;
1678
+ }
1679
+ /**
1680
+ * Create instruction for minting tokens to a CToken account.
1441
1681
  *
1442
- * @param authority Mint authority public key.
1443
- * @param payer Fee payer public key.
1444
- * @param validityProof Validity proof for the compressed mint.
1445
- * @param merkleContext Merkle context of the compressed mint.
1446
- * @param mintData Mint instruction data.
1447
- * @param outputStateTreeInfo Output state tree info.
1448
- * @param recipientAccount Recipient onchain token account address.
1449
- * @param amount Amount to mint.
1682
+ * This is a simple 3-4 account instruction for minting to decompressed CToken accounts.
1683
+ * Uses discriminator 7 (CTokenMintTo).
1684
+ *
1685
+ * @param params - Mint instruction parameters
1686
+ * @returns TransactionInstruction for minting tokens
1450
1687
  */
1451
- declare function createMintToInstruction(authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, merkleContext: MerkleContext, mintData: MintInstructionData, outputStateTreeInfo: TreeInfo, recipientAccount: PublicKey, amount: number | bigint): TransactionInstruction;
1688
+ declare function createMintToInstruction(params: CreateMintToInstructionParams): TransactionInstruction;
1452
1689
 
1453
1690
  /** Default compressible config PDA (V1) */
1454
1691
  declare const LIGHT_TOKEN_CONFIG: PublicKey;
@@ -1542,21 +1779,23 @@ declare function createMintToCompressedInstruction(authority: PublicKey, payer:
1542
1779
  }>, outputStateTreeInfo?: TreeInfo, tokenAccountVersion?: TokenDataVersion): TransactionInstruction;
1543
1780
 
1544
1781
  /**
1545
- * Create mint-to instruction for SPL, Token-2022, or compressed token mints.
1782
+ * Create mint-to instruction for SPL, Token-2022, or CToken mints.
1546
1783
  * This instruction ONLY mints to decompressed/onchain token accounts.
1547
1784
  *
1548
- * @param mintInterface Mint interface (SPL, Token-2022, or compressed).
1785
+ * For CToken mints, the mint must be decompressed first (CMint account must exist on-chain).
1786
+ *
1787
+ * @param mintInterface Mint interface (SPL, Token-2022, or CToken).
1549
1788
  * @param destination Destination onchain token account address.
1550
1789
  * @param authority Mint authority public key.
1551
1790
  * @param payer Fee payer public key.
1552
1791
  * @param amount Amount to mint.
1553
- * @param validityProof Validity proof (required for compressed mints).
1554
- * @param multiSigners Multi-signature signer public keys.
1792
+ * @param validityProof Not used (legacy parameter, kept for compatibility).
1793
+ * @param multiSigners Multi-signature signer public keys (SPL/T22 only).
1555
1794
  */
1556
1795
  declare function createMintToInterfaceInstruction(mintInterface: MintInterface, destination: PublicKey, authority: PublicKey, payer: PublicKey, amount: number | bigint, validityProof?: ValidityProofWithContext, multiSigners?: PublicKey[]): TransactionInstruction;
1557
1796
 
1558
1797
  /**
1559
- * Create a c-token transfer instruction.
1798
+ * Create a Light token transfer instruction.
1560
1799
  *
1561
1800
  * For c-token accounts with compressible extension, the program needs
1562
1801
  * system_program and fee_payer to handle rent top-ups.
@@ -1566,204 +1805,9 @@ declare function createMintToInterfaceInstruction(mintInterface: MintInterface,
1566
1805
  * @param owner Owner of the source account (signer, also pays for compressible extension top-ups)
1567
1806
  * @param amount Amount to transfer
1568
1807
  * @param feePayer Optional fee payer for top-ups (defaults to owner)
1569
- * @returns Transaction instruction for c-token transfer
1808
+ * @returns Transaction instruction for Light token transfer
1570
1809
  */
1571
- declare function createCTokenTransferInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, feePayer?: PublicKey): TransactionInstruction;
1572
- /**
1573
- * Construct a transfer instruction for SPL/T22/c-token. Defaults to c-token
1574
- * program. For cross-program transfers (SPL <> c-token), use `wrap`/`unwrap`.
1575
- *
1576
- * @param source Source token account
1577
- * @param destination Destination token account
1578
- * @param owner Owner of the source account (signer)
1579
- * @param amount Amount to transfer
1580
- * @returns instruction for c-token transfer
1581
- */
1582
- declare function createTransferInterfaceInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, multiSigners?: (Signer | PublicKey)[], programId?: PublicKey): TransactionInstruction;
1583
-
1584
- /**
1585
- * SPL interface PDA info.
1586
- */
1587
- type SplInterfaceInfo = {
1588
- /**
1589
- * The mint of the SPL interface
1590
- */
1591
- mint: PublicKey;
1592
- /**
1593
- * The SPL interface address
1594
- */
1595
- splInterfacePda: PublicKey;
1596
- /**
1597
- * The token program of the SPL interface
1598
- */
1599
- tokenProgram: PublicKey;
1600
- /**
1601
- * count of txs and volume in the past 60 seconds.
1602
- */
1603
- activity?: {
1604
- txs: number;
1605
- amountAdded: BN;
1606
- amountRemoved: BN;
1607
- };
1608
- /**
1609
- * Whether the SPL interface is initialized
1610
- */
1611
- isInitialized: boolean;
1612
- /**
1613
- * The balance of the SPL interface
1614
- */
1615
- balance: BN;
1616
- /**
1617
- * The index of the SPL interface
1618
- */
1619
- poolIndex: number;
1620
- /**
1621
- * The bump used to derive the SPL interface PDA
1622
- */
1623
- bump: number;
1624
- };
1625
- /**
1626
- * @deprecated Use {@link SplInterfaceInfo} instead.
1627
- * This type maintains backward compatibility by including both tokenPoolPda and splInterfacePda.
1628
- * Both properties point to the same PublicKey value.
1629
- */
1630
- type TokenPoolInfo = {
1631
- /**
1632
- * The mint of the SPL interface
1633
- */
1634
- mint: PublicKey;
1635
- /**
1636
- * @deprecated Use splInterfacePda instead.
1637
- */
1638
- tokenPoolPda: PublicKey;
1639
- /**
1640
- * The SPL interface address (new name).
1641
- * For backward compatibility, tokenPoolPda is also available.
1642
- */
1643
- splInterfacePda: PublicKey;
1644
- /**
1645
- * The token program of the SPL interface
1646
- */
1647
- tokenProgram: PublicKey;
1648
- /**
1649
- * count of txs and volume in the past 60 seconds.
1650
- */
1651
- activity?: {
1652
- txs: number;
1653
- amountAdded: BN;
1654
- amountRemoved: BN;
1655
- };
1656
- /**
1657
- * Whether the SPL interface is initialized
1658
- */
1659
- isInitialized: boolean;
1660
- /**
1661
- * The balance of the SPL interface
1662
- */
1663
- balance: BN;
1664
- /**
1665
- * The index of the SPL interface
1666
- */
1667
- poolIndex: number;
1668
- /**
1669
- * The bump used to derive the SPL interface PDA
1670
- */
1671
- bump: number;
1672
- };
1673
- /**
1674
- * Convert SplInterfaceInfo to TokenPoolInfo for backward compatibility.
1675
- * @internal
1676
- */
1677
- declare function toTokenPoolInfo(info: SplInterfaceInfo): TokenPoolInfo;
1678
- /**
1679
- * Derive SplInterfaceInfo for an SPL interface that will be initialized in the
1680
- * same transaction. Use this when you need to create an SPL interface and
1681
- * compress in a single transaction.
1682
- *
1683
- * @param mint The mint of the SPL interface
1684
- * @param tokenProgramId The token program (TOKEN_PROGRAM_ID or TOKEN_2022_PROGRAM_ID)
1685
- * @param poolIndex The pool index. Default 0.
1686
- *
1687
- * @returns SplInterfaceInfo for the to-be-initialized interface
1688
- */
1689
- declare function deriveSplInterfaceInfo(mint: PublicKey, tokenProgramId: PublicKey, poolIndex?: number): SplInterfaceInfo;
1690
- /**
1691
- * Check if the SPL interface info is initialized and has a balance.
1692
- * @param mint The mint of the SPL interface
1693
- * @param splInterfaceInfo The SPL interface info (or TokenPoolInfo for backward compatibility)
1694
- * @returns True if the SPL interface info is initialized and has a balance
1695
- */
1696
- declare function checkSplInterfaceInfo(splInterfaceInfo: SplInterfaceInfo | TokenPoolInfo, mint: PublicKey): boolean;
1697
- /**
1698
- * Get the SPL interface infos for a given mint.
1699
- * @param rpc The RPC client
1700
- * @param mint The mint of the SPL interface
1701
- * @param commitment The commitment to use
1702
- *
1703
- * @returns The SPL interface infos
1704
- */
1705
- declare function getSplInterfaceInfos(rpc: Rpc, mint: PublicKey, commitment?: Commitment): Promise<SplInterfaceInfo[]>;
1706
- type SplInterfaceActivity = {
1707
- signature: string;
1708
- amount: BN;
1709
- action: Action;
1710
- };
1711
- /**
1712
- * @internal
1713
- */
1714
- declare enum Action {
1715
- Compress = 1,
1716
- Decompress = 2,
1717
- Transfer = 3
1718
- }
1719
- /**
1720
- * For `compress` and `mintTo` instructions only.
1721
- * Select a random SPL interface info from the SPL interface infos.
1722
- *
1723
- * For `decompress`, use {@link selectSplInterfaceInfosForDecompression} instead.
1724
- *
1725
- * @param infos The SPL interface infos
1726
- *
1727
- * @returns A random SPL interface info
1728
- */
1729
- declare function selectSplInterfaceInfo(infos: SplInterfaceInfo[]): SplInterfaceInfo;
1730
- /**
1731
- * Select one or multiple SPL interface infos from the SPL interface infos.
1732
- *
1733
- * Use this function for `decompress`.
1734
- *
1735
- * For `compress`, `mintTo` use {@link selectSplInterfaceInfo} instead.
1736
- *
1737
- * @param infos The SPL interface infos
1738
- * @param decompressAmount The amount of tokens to withdraw
1739
- *
1740
- * @returns Array with one or more SPL interface infos.
1741
- */
1742
- declare function selectSplInterfaceInfosForDecompression(infos: SplInterfaceInfo[], decompressAmount: number | BN): SplInterfaceInfo[];
1743
- /**
1744
- * @deprecated Use {@link SplInterfaceActivity} instead.
1745
- */
1746
- type TokenPoolActivity = SplInterfaceActivity;
1747
- /**
1748
- * @deprecated Use {@link deriveSplInterfaceInfo} instead.
1749
- */
1750
- declare function deriveTokenPoolInfo(mint: PublicKey, tokenProgramId: PublicKey, poolIndex?: number): TokenPoolInfo;
1751
- /**
1752
- * @deprecated Use {@link checkSplInterfaceInfo} instead.
1753
- */
1754
- declare function checkTokenPoolInfo(tokenPoolInfo: TokenPoolInfo, mint: PublicKey): boolean;
1755
- /**
1756
- * @deprecated Use {@link getSplInterfaceInfos} instead.
1757
- */
1758
- declare function getTokenPoolInfos(rpc: Rpc, mint: PublicKey, commitment?: Commitment): Promise<TokenPoolInfo[]>;
1759
- /**
1760
- * @deprecated Use {@link selectSplInterfaceInfo} instead.
1761
- */
1762
- declare function selectTokenPoolInfo(infos: TokenPoolInfo[]): TokenPoolInfo;
1763
- /**
1764
- * @deprecated Use {@link selectSplInterfaceInfosForDecompression} instead.
1765
- */
1766
- declare function selectTokenPoolInfosForDecompression(infos: TokenPoolInfo[], decompressAmount: number | BN): TokenPoolInfo[];
1810
+ declare function createLightTokenTransferInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, feePayer?: PublicKey): TransactionInstruction;
1767
1811
 
1768
1812
  /**
1769
1813
  * Create decompressInterface instruction using Transfer2.
@@ -1783,14 +1827,6 @@ declare function selectTokenPoolInfosForDecompression(infos: TokenPoolInfo[], de
1783
1827
  */
1784
1828
  declare function createDecompressInterfaceInstruction(payer: PublicKey, inputCompressedTokenAccounts: ParsedTokenAccount[], toAddress: PublicKey, amount: bigint, validityProof: ValidityProofWithContext, splInterfaceInfo: SplInterfaceInfo | undefined, decimals: number): TransactionInstruction;
1785
1829
 
1786
- /**
1787
- * Options for interface operations (load, transfer)
1788
- */
1789
- interface InterfaceOptions {
1790
- /** SPL interface infos (fetched if not provided) */
1791
- splInterfaceInfos?: SplInterfaceInfo[];
1792
- }
1793
-
1794
1830
  /**
1795
1831
  * Account info interface for compressible accounts.
1796
1832
  * Matches return structure of getAccountInterface/getAtaInterface.
@@ -1881,7 +1917,7 @@ interface LoadResult {
1881
1917
  * ```typescript
1882
1918
  * const poolInfo = await myProgram.fetchPoolState(rpc, poolAddress);
1883
1919
  * const vault0Ata = getAssociatedTokenAddressInterface(token0Mint, poolAddress);
1884
- * const vault0Info = await getAtaInterface(rpc, vault0Ata, poolAddress, token0Mint, undefined, CTOKEN_PROGRAM_ID);
1920
+ * const vault0Info = await getAtaInterface(rpc, vault0Ata, poolAddress, token0Mint, undefined, LIGHT_TOKEN_PROGRAM_ID);
1885
1921
  * const userAta = getAssociatedTokenAddressInterface(tokenMint, userWallet);
1886
1922
  * const userAtaInfo = await getAtaInterface(rpc, userAta, userWallet, tokenMint);
1887
1923
  *
@@ -1958,7 +1994,7 @@ declare function createUnwrapInstruction(source: PublicKey, destination: PublicK
1958
1994
  * @param decimals Location of the decimal place
1959
1995
  * @param keypair Mint keypair (defaults to a random keypair)
1960
1996
  * @param confirmOptions Confirm options
1961
- * @param programId Token program ID (defaults to CTOKEN_PROGRAM_ID)
1997
+ * @param programId Token program ID (defaults to LIGHT_TOKEN_PROGRAM_ID)
1962
1998
  * @param tokenMetadata Optional token metadata (c-token mints only)
1963
1999
  * @param outputStateTreeInfo Optional output state tree info (c-token mints only)
1964
2000
  * @param addressTreeInfo Optional address tree info (c-token mints only)
@@ -1972,6 +2008,7 @@ declare function createMintInterface(rpc: Rpc, payer: Signer, mintAuthority: Pub
1972
2008
 
1973
2009
  /**
1974
2010
  * Update the mint authority of a compressed token mint.
2011
+ * Works for both compressed and decompressed mints.
1975
2012
  *
1976
2013
  * @param rpc RPC connection
1977
2014
  * @param payer Fee payer (signer)
@@ -1983,6 +2020,7 @@ declare function createMintInterface(rpc: Rpc, payer: Signer, mintAuthority: Pub
1983
2020
  declare function updateMintAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, currentMintAuthority: Signer, newMintAuthority: PublicKey | null, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1984
2021
  /**
1985
2022
  * Update the freeze authority of a compressed token mint.
2023
+ * Works for both compressed and decompressed mints.
1986
2024
  *
1987
2025
  * @param rpc RPC connection
1988
2026
  * @param payer Fee payer (signer)
@@ -1995,6 +2033,7 @@ declare function updateFreezeAuthority(rpc: Rpc, payer: Signer, mint: PublicKey,
1995
2033
 
1996
2034
  /**
1997
2035
  * Update a metadata field on a compressed token mint.
2036
+ * Works for both compressed and decompressed mints.
1998
2037
  *
1999
2038
  * @param rpc RPC connection
2000
2039
  * @param payer Fee payer (signer)
@@ -2009,6 +2048,7 @@ declare function updateFreezeAuthority(rpc: Rpc, payer: Signer, mint: PublicKey,
2009
2048
  declare function updateMetadataField(rpc: Rpc, payer: Signer, mint: PublicKey, authority: Signer, fieldType: 'name' | 'symbol' | 'uri' | 'custom', value: string, customKey?: string, extensionIndex?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2010
2049
  /**
2011
2050
  * Update the metadata authority of a compressed token mint.
2051
+ * Works for both compressed and decompressed mints.
2012
2052
  *
2013
2053
  * @param rpc RPC connection
2014
2054
  * @param payer Fee payer (signer)
@@ -2021,6 +2061,7 @@ declare function updateMetadataField(rpc: Rpc, payer: Signer, mint: PublicKey, a
2021
2061
  declare function updateMetadataAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, currentAuthority: Signer, newAuthority: PublicKey, extensionIndex?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2022
2062
  /**
2023
2063
  * Remove a metadata key from a compressed token mint.
2064
+ * Works for both compressed and decompressed mints.
2024
2065
  *
2025
2066
  * @param rpc RPC connection
2026
2067
  * @param payer Fee payer (signer)
@@ -2044,7 +2085,7 @@ declare function removeMetadataKey(rpc: Rpc, payer: Signer, mint: PublicKey, aut
2044
2085
  * @param allowOwnerOffCurve Allow owner to be a PDA (default: false)
2045
2086
  * @param confirmOptions Options for confirming the transaction
2046
2087
  * @param programId Token program ID (default:
2047
- * CTOKEN_PROGRAM_ID)
2088
+ * LIGHT_TOKEN_PROGRAM_ID)
2048
2089
  * @param associatedTokenProgramId ATA program ID (auto-derived if not
2049
2090
  * provided)
2050
2091
  * @param ctokenConfig Optional rent config
@@ -2064,7 +2105,7 @@ declare function createAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, ow
2064
2105
  * @param allowOwnerOffCurve Allow owner to be a PDA (default: false)
2065
2106
  * @param confirmOptions Options for confirming the transaction
2066
2107
  * @param programId Token program ID (default:
2067
- * CTOKEN_PROGRAM_ID)
2108
+ * LIGHT_TOKEN_PROGRAM_ID)
2068
2109
  * @param associatedTokenProgramId ATA program ID (auto-derived if not
2069
2110
  * provided)
2070
2111
  * @param ctokenConfig Optional c-token-specific configuration
@@ -2073,7 +2114,23 @@ declare function createAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, ow
2073
2114
  */
2074
2115
  declare function createAtaInterfaceIdempotent(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey, ctokenConfig?: CTokenConfig): Promise<PublicKey>;
2075
2116
 
2076
- declare function mintTo$1(rpc: Rpc, payer: Signer, mint: PublicKey, recipientAccount: PublicKey, authority: Signer, amount: number | bigint, outputQueue?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2117
+ /**
2118
+ * Mint tokens to a CToken account.
2119
+ *
2120
+ * This is a simple mint instruction for minting to decompressed CToken accounts.
2121
+ * The mint must be decompressed (CMint account must exist on-chain).
2122
+ *
2123
+ * @param rpc - RPC connection
2124
+ * @param payer - Fee payer (signer)
2125
+ * @param mint - Mint address (CMint account)
2126
+ * @param destination - Destination CToken account
2127
+ * @param authority - Mint authority (signer)
2128
+ * @param amount - Amount to mint
2129
+ * @param maxTopUp - Optional maximum lamports for rent top-up
2130
+ * @param confirmOptions - Optional confirm options
2131
+ * @returns Transaction signature
2132
+ */
2133
+ declare function mintTo$1(rpc: Rpc, payer: Signer, mint: PublicKey, destination: PublicKey, authority: Signer, amount: number | bigint, maxTopUp?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2077
2134
 
2078
2135
  /**
2079
2136
  * Mint compressed tokens directly to compressed accounts.
@@ -2094,20 +2151,22 @@ declare function mintToCompressed(rpc: Rpc, payer: Signer, mint: PublicKey, auth
2094
2151
 
2095
2152
  /**
2096
2153
  * Mint tokens to a decompressed/onchain token account.
2097
- * Works with SPL, Token-2022, and compressed token (c-token) mints.
2154
+ * Works with SPL, Token-2022, and CToken mints.
2098
2155
  *
2099
2156
  * This function ONLY mints to decompressed onchain token accounts, never to compressed accounts.
2157
+ * For CToken mints, the mint must be decompressed first (CMint account must exist on-chain).
2158
+ *
2100
2159
  * The signature matches the standard SPL mintTo for simplicity and consistency.
2101
2160
  *
2102
2161
  * @param rpc - RPC connection to use
2103
2162
  * @param payer - Transaction fee payer
2104
- * @param mint - Mint address (SPL, Token-2022, or compressed mint)
2163
+ * @param mint - Mint address (SPL, Token-2022, or CToken mint)
2105
2164
  * @param destination - Destination token account address (must be an existing onchain token account)
2106
2165
  * @param authority - Mint authority (can be Signer or PublicKey if multiSigners provided)
2107
2166
  * @param amount - Amount to mint
2108
2167
  * @param multiSigners - Optional: Multi-signature signers (default: [])
2109
2168
  * @param confirmOptions - Optional: Transaction confirmation options
2110
- * @param programId - Optional: Token program ID (TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, or CTOKEN_PROGRAM_ID). If undefined, auto-detects.
2169
+ * @param programId - Optional: Token program ID. If undefined, auto-detects.
2111
2170
  *
2112
2171
  * @returns Transaction signature
2113
2172
  */
@@ -2165,22 +2224,6 @@ declare function decompressInterface(rpc: Rpc, payer: Signer, owner: Signer, min
2165
2224
  */
2166
2225
  declare function wrap(rpc: Rpc, payer: Signer, source: PublicKey, destination: PublicKey, owner: Signer, mint: PublicKey, amount: bigint, splInterfaceInfo?: SplInterfaceInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2167
2226
 
2168
- /**
2169
- * Unwrap c-tokens to SPL tokens.
2170
- *
2171
- * @param rpc RPC connection
2172
- * @param payer Fee payer
2173
- * @param destination Destination SPL/T22 token account
2174
- * @param owner Owner of the c-token (signer)
2175
- * @param mint Mint address
2176
- * @param amount Amount to unwrap (defaults to all)
2177
- * @param splInterfaceInfo SPL interface info
2178
- * @param confirmOptions Confirm options
2179
- *
2180
- * @returns Transaction signature
2181
- */
2182
- declare function unwrap(rpc: Rpc, payer: Signer, destination: PublicKey, owner: Signer, mint: PublicKey, amount?: number | bigint | BN, splInterfaceInfo?: SplInterfaceInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2183
-
2184
2227
  /**
2185
2228
  * Create instructions to load an ATA from its AccountInterface.
2186
2229
  *
@@ -5300,14 +5343,14 @@ declare class CompressedTokenProgram {
5300
5343
  * @param mintSize Optional: mint size. Default: MINT_SIZE
5301
5344
  *
5302
5345
  * @returns [createMintAccountInstruction, initializeMintInstruction,
5303
- * createTokenPoolInstruction]
5346
+ * createSplInterfaceInstruction]
5304
5347
  *
5305
- * Note that `createTokenPoolInstruction` must be executed after
5348
+ * Note that `createSplInterfaceInstruction` must be executed after
5306
5349
  * `initializeMintInstruction`.
5307
5350
  */
5308
5351
  static createMint({ feePayer, mint, authority, freezeAuthority, decimals, rentExemptBalance, tokenProgramId, mintSize, }: CreateMintParams): Promise<TransactionInstruction[]>;
5309
5352
  /**
5310
- * Enable compression for an existing SPL mint, creating an omnibus account.
5353
+ * Create SPL interface (omnibus account) for an existing SPL mint.
5311
5354
  * For new mints, use `CompressedTokenProgram.createMint`.
5312
5355
  *
5313
5356
  * @param feePayer Fee payer.
@@ -5315,12 +5358,16 @@ declare class CompressedTokenProgram {
5315
5358
  * @param tokenProgramId Optional: Token program ID. Default: SPL
5316
5359
  * Token Program ID
5317
5360
  *
5318
- * @returns The createTokenPool instruction
5361
+ * @returns The createSplInterface instruction
5319
5362
  */
5320
- static createTokenPool({ feePayer, mint, tokenProgramId, }: CreateSplInterfaceParams): Promise<TransactionInstruction>;
5363
+ static createSplInterface({ feePayer, mint, tokenProgramId, }: CreateSplInterfaceParams): Promise<TransactionInstruction>;
5364
+ /**
5365
+ * @deprecated Use {@link createSplInterface} instead.
5366
+ */
5367
+ static createTokenPool(params: CreateSplInterfaceParams): Promise<TransactionInstruction>;
5321
5368
  /**
5322
5369
  * Add a token pool to an existing SPL mint. For new mints, use
5323
- * {@link createTokenPool}.
5370
+ * {@link createSplInterface}.
5324
5371
  *
5325
5372
  * @param feePayer Fee payer.
5326
5373
  * @param mint SPL Mint address.
@@ -5484,6 +5531,13 @@ declare class CompressedTokenProgram {
5484
5531
  static revoke({ payer, inputCompressedTokenAccounts, recentValidityProof, recentInputStateRootIndices, }: RevokeParams): Promise<TransactionInstruction>;
5485
5532
  }
5486
5533
 
5534
+ /**
5535
+ * Exports for @lightprotocol/compressed-token/unified
5536
+ *
5537
+ * Import from `/unified` to get a single unified ATA for SPL/T22 and c-token
5538
+ * mints.
5539
+ */
5540
+
5487
5541
  /**
5488
5542
  * Get associated token account with unified balance
5489
5543
  *
@@ -5499,7 +5553,7 @@ declare function getAtaInterface(rpc: Rpc, ata: PublicKey, owner: PublicKey, min
5499
5553
  /**
5500
5554
  * Derive the canonical token ATA for SPL/T22/c-token in the unified path.
5501
5555
  *
5502
- * Enforces CTOKEN_PROGRAM_ID.
5556
+ * Enforces LIGHT_TOKEN_PROGRAM_ID.
5503
5557
  *
5504
5558
  * @param mint Mint public key
5505
5559
  * @param owner Owner public key
@@ -5511,7 +5565,7 @@ declare function getAtaInterface(rpc: Rpc, ata: PublicKey, owner: PublicKey, min
5511
5565
  */
5512
5566
  declare function getAssociatedTokenAddressInterface(mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, programId?: PublicKey, associatedTokenProgramId?: PublicKey): PublicKey;
5513
5567
  /**
5514
- * Create instructions to load ALL token balances into a c-token ATA.
5568
+ * Create instruction batches for loading ALL token balances into a c-token ATA.
5515
5569
  *
5516
5570
  * @param rpc RPC connection
5517
5571
  * @param ata Associated token address
@@ -5519,9 +5573,9 @@ declare function getAssociatedTokenAddressInterface(mint: PublicKey, owner: Publ
5519
5573
  * @param mint Mint public key
5520
5574
  * @param payer Fee payer (defaults to owner)
5521
5575
  * @param options Optional interface options
5522
- * @returns Array of instructions (empty if nothing to load)
5576
+ * @returns Instruction batches - each inner array is one transaction
5523
5577
  */
5524
- declare function createLoadAtaInstructions(rpc: Rpc, ata: PublicKey, owner: PublicKey, mint: PublicKey, payer?: PublicKey, options?: InterfaceOptions): Promise<_solana_web3_js.TransactionInstruction[]>;
5578
+ declare function createLoadAtaInstructions(rpc: Rpc, ata: PublicKey, owner: PublicKey, mint: PublicKey, payer?: PublicKey, options?: InterfaceOptions): Promise<TransactionInstruction[][]>;
5525
5579
  /**
5526
5580
  * Load all token balances into the c-token ATA.
5527
5581
  *
@@ -5542,7 +5596,7 @@ declare function loadAta(rpc: Rpc, ata: PublicKey, owner: Signer, mint: PublicKe
5542
5596
  /**
5543
5597
  * Transfer tokens using the unified ata interface.
5544
5598
  *
5545
- * Matches SPL Token's transferChecked signature order. Destination must exist.
5599
+ * Destination ATA must exist. Automatically wraps SPL/T22 to c-token ATA.
5546
5600
  *
5547
5601
  * @param rpc RPC connection
5548
5602
  * @param payer Fee payer (signer)
@@ -5551,16 +5605,15 @@ declare function loadAta(rpc: Rpc, ata: PublicKey, owner: Signer, mint: PublicKe
5551
5605
  * @param destination Destination c-token ATA address (must exist)
5552
5606
  * @param owner Source owner (signer)
5553
5607
  * @param amount Amount to transfer
5554
- * @param programId Token program ID (default: CTOKEN_PROGRAM_ID)
5555
5608
  * @param confirmOptions Optional confirm options
5556
5609
  * @param options Optional interface options
5557
5610
  * @returns Transaction signature
5558
5611
  */
5559
- declare function transferInterface(rpc: Rpc, payer: Signer, source: PublicKey, mint: PublicKey, destination: PublicKey, owner: Signer, amount: number | bigint | BN, programId?: PublicKey, confirmOptions?: ConfirmOptions, options?: InterfaceOptions): Promise<string>;
5612
+ declare function transferInterface(rpc: Rpc, payer: Signer, source: PublicKey, mint: PublicKey, destination: PublicKey, owner: Signer, amount: number | bigint | BN, confirmOptions?: ConfirmOptions, options?: InterfaceOptions): Promise<string>;
5560
5613
  /**
5561
5614
  * Get or create c-token ATA with unified balance detection and auto-loading.
5562
5615
  *
5563
- * Enforces CTOKEN_PROGRAM_ID. Aggregates balances from:
5616
+ * Enforces LIGHT_TOKEN_PROGRAM_ID. Aggregates balances from:
5564
5617
  * - c-token hot (on-chain) account
5565
5618
  * - c-token cold (compressed) accounts
5566
5619
  * - SPL token accounts (for unified wrapping)
@@ -5586,5 +5639,53 @@ declare function transferInterface(rpc: Rpc, payer: Signer, source: PublicKey, m
5586
5639
  * @returns AccountInterface with unified balance and source breakdown
5587
5640
  */
5588
5641
  declare function getOrCreateAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey | Signer, allowOwnerOffCurve?: boolean, commitment?: Commitment, confirmOptions?: ConfirmOptions): Promise<AccountInterface>;
5642
+ /**
5643
+ * Create transfer instructions for a unified token transfer.
5644
+ *
5645
+ * Unified variant: always wraps SPL/T22 to c-token ATA.
5646
+ *
5647
+ * Returns `TransactionInstruction[][]`. Send [0..n-2] in parallel, then [n-1].
5648
+ * Use `sliceLast` to separate the parallel prefix from the final transfer.
5649
+ *
5650
+ * @see createTransferInterfaceInstructions in v3/actions/transfer-interface.ts
5651
+ */
5652
+ declare function createTransferInterfaceInstructions(rpc: Rpc, payer: PublicKey, mint: PublicKey, amount: number | bigint | BN, sender: PublicKey, recipient: PublicKey, options?: Omit<TransferOptions, 'wrap'>): Promise<TransactionInstruction[][]>;
5653
+ /**
5654
+ * Build instruction batches for unwrapping c-tokens to SPL/T22.
5655
+ *
5656
+ * Unified variant: uses wrap=true for loading, so SPL/T22 balances are
5657
+ * consolidated before unwrapping.
5658
+ *
5659
+ * Returns `TransactionInstruction[][]`. Load batches (if any) come first,
5660
+ * followed by one final unwrap transaction.
5661
+ *
5662
+ * @param rpc RPC connection
5663
+ * @param destination Destination SPL/T22 token account (must exist)
5664
+ * @param owner Owner of the c-token
5665
+ * @param mint Mint address
5666
+ * @param amount Amount to unwrap (defaults to full balance)
5667
+ * @param payer Fee payer (defaults to owner)
5668
+ * @param splInterfaceInfo Optional: SPL interface info
5669
+ * @param interfaceOptions Optional: interface options for load
5670
+ * @returns Instruction batches - each inner array is one transaction
5671
+ */
5672
+ declare function createUnwrapInstructions(rpc: Rpc, destination: PublicKey, owner: PublicKey, mint: PublicKey, amount?: number | bigint | BN, payer?: PublicKey, splInterfaceInfo?: SplInterfaceInfo, interfaceOptions?: InterfaceOptions): Promise<TransactionInstruction[][]>;
5673
+ /**
5674
+ * Unwrap c-tokens to SPL tokens.
5675
+ *
5676
+ * Unified variant: loads all cold + SPL/T22 balances to c-token ATA first,
5677
+ * then unwraps to the destination SPL/T22 account.
5678
+ *
5679
+ * @param rpc RPC connection
5680
+ * @param payer Fee payer
5681
+ * @param destination Destination SPL/T22 token account
5682
+ * @param owner Owner of the c-token (signer)
5683
+ * @param mint Mint address
5684
+ * @param amount Amount to unwrap (defaults to all)
5685
+ * @param splInterfaceInfo SPL interface info
5686
+ * @param confirmOptions Confirm options
5687
+ * @returns Transaction signature of the unwrap transaction
5688
+ */
5689
+ declare function unwrap(rpc: Rpc, payer: Signer, destination: PublicKey, owner: Signer, mint: PublicKey, amount?: number | bigint | BN, splInterfaceInfo?: SplInterfaceInfo, confirmOptions?: ConfirmOptions): Promise<string>;
5589
5690
 
5590
- export { ADD_TOKEN_POOL_DISCRIMINATOR, APPROVE_DISCRIMINATOR, type AccountInterface, Action, type AddSplInterfaceParams, type AddTokenPoolParams, type ApproveAndMintToParams, type ApproveParams, BASE_RENT_PER_EPOCH, BATCH_COMPRESS_DISCRIMINATOR, type BaseMint, type BatchCompressInstructionData, COMPRESSED_MINT_SEED, COMPRESSIBLE_CTOKEN_ACCOUNT_SIZE, COMPRESSIBLE_CTOKEN_RENT_PER_EPOCH, COMPRESSION_COST, COMPRESSION_INCENTIVE, COMPRESS_SPL_TOKEN_ACCOUNT_DISCRIMINATOR, CPI_AUTHORITY_SEED, CREATE_TOKEN_POOL_DISCRIMINATOR, type CTokenConfig, type CompressParams, type CompressSplTokenAccountInstructionData, type CompressSplTokenAccountParams, type CompressedMint, type CompressedTokenInstructionDataApprove, CompressedTokenInstructionDataApproveLayout, type CompressedTokenInstructionDataRevoke, CompressedTokenInstructionDataRevokeLayout, type CompressedTokenInstructionDataTransfer, CompressedTokenInstructionDataTransferLayout, CompressedTokenProgram, type CompressibleAccountInput, type CompressibleConfig, type CompressibleLoadParams, CpiContextLayout, type CreateAssociatedCTokenAccountParams, type CreateMintParams, type CreateSplInterfaceParams, type CreateTokenPoolParams, type CreateTokenProgramLookupTableParams, DECOMPRESS_ACCOUNTS_IDEMPOTENT_DISCRIMINATOR, DEFAULT_COMPRESSIBLE_CONFIG, DEFAULT_PREPAY_EPOCHS, DEFAULT_WRITE_TOP_UP, type DecompressParams, type DelegatedTransfer, DelegatedTransferLayout, ERROR_MIXED_TREE_TYPES, ERROR_NO_ACCOUNTS_FOUND, ExtensionType, IDL, type InputTokenDataWithContext, type InterfaceOptions, LIGHT_TOKEN_CONFIG, LIGHT_TOKEN_RENT_SPONSOR, type LightCompressedToken, type LoadResult, MINT_TO_DISCRIMINATOR, type MergeTokenAccountsParams, type MintContext, type MintExtension, type MintInterface, type MintToInstructionData, type MintToParams, type OffChainTokenMetadata, type OffChainTokenMetadataJson, POOL_SEED, type PackCompressedTokenAccountsParams, type PackedCompressedAccount, type PackedTokenTransferOutputData, type ParsedAccountInfoInterface, RENT_PER_BYTE_PER_EPOCH, REVOKE_DISCRIMINATOR, type RevokeParams, SLOTS_PER_RENT_EPOCH, SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE, type SelectInputAccountsOptions, type SelectedAccountsResult, type SplInterfaceActivity, type SplInterfaceInfo, TOTAL_COMPRESSION_COST, TRANSFER_DISCRIMINATOR, type TokenAccountSource, type TokenData, TokenDataVersion, type TokenMetadata, type TokenMetadataInstructionData, type TokenPoolActivity, type TokenPoolInfo, type TokenTransferOutputData, type TransferParams, addSplInterfaces, addTokenPoolAccountsLayout, type addTokenPoolAccountsLayoutParams, addTokenPools, approve, approveAccountsLayout, type approveAccountsLayoutParams, approveAndMintTo, batchCompressLayout, calculateCompressibleLoadComputeUnits, calculateFeePayerCostAtCreation, checkMint, checkSplInterfaceInfo, checkTokenPoolInfo, compress, compressSplTokenAccount, compressSplTokenAccountInstructionDataLayout, convertTokenDataToAccount, createAssociatedCTokenAccountIdempotentInstruction, createAssociatedCTokenAccountInstruction, createAssociatedTokenAccountInterfaceIdempotentInstruction, createAssociatedTokenAccountInterfaceInstruction, createAtaInterface, createAtaInterfaceIdempotent, createAtaInterfaceIdempotentInstruction, createCTokenTransferInstruction, createDecompressInterfaceInstruction, createDecompressOutputState, createLoadAccountsParams, createLoadAtaInstructions, createLoadAtaInstructionsFromInterface, createMint, createMintInstruction, createMintInterface, createMintToCompressedInstruction, createMintToInstruction, createMintToInterfaceInstruction, createRemoveMetadataKeyInstruction, createSplInterface, createTokenMetadata, createTokenPool, createTokenPoolAccountsLayout, type createTokenPoolAccountsLayoutParams, createTokenProgramLookupTable, createTransferInterfaceInstruction, createTransferOutputState, createUnwrapInstruction, createUpdateFreezeAuthorityInstruction, createUpdateMetadataAuthorityInstruction, createUpdateMetadataFieldInstruction, createUpdateMintAuthorityInstruction, createWrapInstruction, decodeApproveInstructionData, decodeBatchCompressInstructionData, decodeCompressSplTokenAccountInstructionData, decodeMintToInstructionData, decodeRevokeInstructionData, decodeTokenMetadata, decodeTransferInstructionData, decompress, decompressDelegated, decompressInterface, deriveCMintAddress, deriveSplInterfaceInfo, deriveTokenPoolInfo, deserializeMint, encodeApproveInstructionData, encodeBatchCompressInstructionData, encodeCompressSplTokenAccountInstructionData, encodeMintToInstructionData, encodeRevokeInstructionData, encodeTokenMetadata, encodeTransferInstructionData, extractTokenMetadata, findMintAddress, freezeAccountsLayout, type freezeAccountsLayoutParams, getAccountInterface, getAssociatedCTokenAddress, getAssociatedCTokenAddressAndBump, getAssociatedTokenAddressInterface, getAtaInterface, getMintInterface, getOrCreateAtaInterface, getSplInterfaceInfos, getTokenPoolInfos, groupAccountsByTreeType, isSingleSplInterfaceInfo, isSingleTokenPoolInfo, loadAta, mergeTokenAccounts, mintTo, mintToAccountsLayout, type mintToAccountsLayoutParams, mintTo$1 as mintToCToken, mintToCompressed, mintToInterface, mintToLayout, packCompressedTokenAccounts, parseCTokenCold, parseCTokenHot, parseMaybeDelegatedTransfer, parseTokenData, removeMetadataKey, rentPerEpoch, revoke, revokeAccountsLayout, type revokeAccountsLayoutParams, selectAccountsByPreferredTreeType, selectMinCompressedTokenAccountsForDecompression, selectMinCompressedTokenAccountsForTransfer, selectMinCompressedTokenAccountsForTransferOrPartial, selectSmartCompressedTokenAccountsForTransfer, selectSmartCompressedTokenAccountsForTransferOrPartial, selectSplInterfaceInfo, selectSplInterfaceInfosForDecompression, selectTokenAccountsForApprove, selectTokenPoolInfo, selectTokenPoolInfosForDecompression, serializeMint, sumUpTokenAmount, thawAccountsLayout, type thawAccountsLayoutParams, toAccountInfo, toOffChainMetadataJson, toTokenPoolInfo, transfer, transferAccountsLayout, type transferAccountsLayoutParams, transferDelegated, transferInterface, unpackMintData, unpackMintInterface, unwrap, updateFreezeAuthority, updateMetadataAuthority, updateMetadataField, updateMintAuthority, validateSameTokenOwner, wrap };
5691
+ export { ADD_TOKEN_POOL_DISCRIMINATOR, APPROVE_DISCRIMINATOR, type AccountInterface, Action, type AddSplInterfaceParams, type AddTokenPoolParams, type ApproveAndMintToParams, type ApproveParams, BASE_RENT_PER_EPOCH, BATCH_COMPRESS_DISCRIMINATOR, type BaseMint, type BatchCompressInstructionData, COMPRESSED_MINT_SEED, COMPRESSIBLE_CTOKEN_ACCOUNT_SIZE, COMPRESSIBLE_CTOKEN_RENT_PER_EPOCH, COMPRESSION_COST, COMPRESSION_INCENTIVE, COMPRESS_SPL_TOKEN_ACCOUNT_DISCRIMINATOR, CPI_AUTHORITY_SEED, CREATE_TOKEN_POOL_DISCRIMINATOR, type CTokenConfig, type CompressParams, type CompressSplTokenAccountInstructionData, type CompressSplTokenAccountParams, type CompressedMint, type CompressedTokenInstructionDataApprove, CompressedTokenInstructionDataApproveLayout, type CompressedTokenInstructionDataRevoke, CompressedTokenInstructionDataRevokeLayout, type CompressedTokenInstructionDataTransfer, CompressedTokenInstructionDataTransferLayout, CompressedTokenProgram, type CompressibleAccountInput, type CompressibleConfig, type CompressibleLoadParams, CpiContextLayout, type CreateAssociatedCTokenAccountParams, type CreateMintParams, type CreateSplInterfaceParams, type CreateTokenPoolParams, type CreateTokenProgramLookupTableParams, DECOMPRESS_ACCOUNTS_IDEMPOTENT_DISCRIMINATOR, DEFAULT_COMPRESSIBLE_CONFIG, DEFAULT_PREPAY_EPOCHS, DEFAULT_WRITE_TOP_UP, type DecompressParams, type DelegatedTransfer, DelegatedTransferLayout, ERROR_MIXED_TREE_TYPES, ERROR_NO_ACCOUNTS_FOUND, ExtensionType, IDL, type InputTokenDataWithContext, type InterfaceOptions, LIGHT_TOKEN_CONFIG, LIGHT_TOKEN_RENT_SPONSOR, type LightCompressedToken, type LoadResult, MINT_TO_DISCRIMINATOR, type MergeTokenAccountsParams, type MintContext, type MintExtension, type MintInterface, type MintToInstructionData, type MintToParams, type OffChainTokenMetadata, type OffChainTokenMetadataJson, POOL_SEED, type PackCompressedTokenAccountsParams, type PackedCompressedAccount, type PackedTokenTransferOutputData, type ParsedAccountInfoInterface, RENT_PER_BYTE_PER_EPOCH, REVOKE_DISCRIMINATOR, type RevokeParams, SLOTS_PER_RENT_EPOCH, SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE, type SelectInputAccountsOptions, type SelectedAccountsResult, type SplInterfaceActivity, type SplInterfaceInfo, TOTAL_COMPRESSION_COST, TRANSFER_DISCRIMINATOR, type TokenAccountSource, type TokenData, TokenDataVersion, type TokenMetadata, type TokenMetadataInstructionData, type TokenPoolActivity, type TokenPoolInfo, type TokenTransferOutputData, type TransferOptions, type TransferParams, addSplInterfaces, addTokenPoolAccountsLayout, type addTokenPoolAccountsLayoutParams, addTokenPools, approve, approveAccountsLayout, type approveAccountsLayoutParams, approveAndMintTo, batchCompressLayout, calculateCompressibleLoadComputeUnits, calculateFeePayerCostAtCreation, checkMint, checkSplInterfaceInfo, checkTokenPoolInfo, compress, compressSplTokenAccount, compressSplTokenAccountInstructionDataLayout, convertTokenDataToAccount, createAssociatedCTokenAccountIdempotentInstruction, createAssociatedCTokenAccountInstruction, createAssociatedTokenAccountInterfaceIdempotentInstruction, createAssociatedTokenAccountInterfaceInstruction, createAtaInterface, createAtaInterfaceIdempotent, createAtaInterfaceIdempotentInstruction, createDecompressInterfaceInstruction, createDecompressOutputState, createLightTokenTransferInstruction, createLoadAccountsParams, createLoadAtaInstructions, createLoadAtaInstructionsFromInterface, createMint, createMintInstruction, createMintInterface, createMintToCompressedInstruction, createMintToInstruction, createMintToInterfaceInstruction, createRemoveMetadataKeyInstruction, createSplInterface, createTokenMetadata, createTokenPool, createTokenPoolAccountsLayout, type createTokenPoolAccountsLayoutParams, createTokenProgramLookupTable, createTransferInterfaceInstructions, createTransferOutputState, createUnwrapInstruction, createUnwrapInstructions, createUpdateFreezeAuthorityInstruction, createUpdateMetadataAuthorityInstruction, createUpdateMetadataFieldInstruction, createUpdateMintAuthorityInstruction, createWrapInstruction, decodeApproveInstructionData, decodeBatchCompressInstructionData, decodeCompressSplTokenAccountInstructionData, decodeMintToInstructionData, decodeRevokeInstructionData, decodeTokenMetadata, decodeTransferInstructionData, decompress, decompressDelegated, decompressInterface, deriveCMintAddress, deriveSplInterfaceInfo, deriveTokenPoolInfo, deserializeMint, encodeApproveInstructionData, encodeBatchCompressInstructionData, encodeCompressSplTokenAccountInstructionData, encodeMintToInstructionData, encodeRevokeInstructionData, encodeTokenMetadata, encodeTransferInstructionData, extractTokenMetadata, findMintAddress, freezeAccountsLayout, type freezeAccountsLayoutParams, getAccountInterface, getAssociatedCTokenAddress, getAssociatedCTokenAddressAndBump, getAssociatedTokenAddressInterface, getAtaInterface, getMintInterface, getOrCreateAtaInterface, getSplInterfaceInfos, getTokenPoolInfos, groupAccountsByTreeType, isSingleSplInterfaceInfo, isSingleTokenPoolInfo, loadAta, mergeTokenAccounts, mintTo, mintToAccountsLayout, type mintToAccountsLayoutParams, mintTo$1 as mintToCToken, mintToCompressed, mintToInterface, mintToLayout, packCompressedTokenAccounts, parseCTokenCold, parseCTokenHot, parseMaybeDelegatedTransfer, parseTokenData, removeMetadataKey, rentPerEpoch, revoke, revokeAccountsLayout, type revokeAccountsLayoutParams, selectAccountsByPreferredTreeType, selectMinCompressedTokenAccountsForDecompression, selectMinCompressedTokenAccountsForTransfer, selectMinCompressedTokenAccountsForTransferOrPartial, selectSmartCompressedTokenAccountsForTransfer, selectSmartCompressedTokenAccountsForTransferOrPartial, selectSplInterfaceInfo, selectSplInterfaceInfosForDecompression, selectTokenAccountsForApprove, selectTokenPoolInfo, selectTokenPoolInfosForDecompression, serializeMint, sliceLast, sumUpTokenAmount, thawAccountsLayout, type thawAccountsLayoutParams, toAccountInfo, toOffChainMetadataJson, toTokenPoolInfo, transfer, transferAccountsLayout, type transferAccountsLayoutParams, transferDelegated, transferInterface, unpackMintData, unpackMintInterface, unwrap, updateFreezeAuthority, updateMetadataAuthority, updateMetadataField, updateMintAuthority, validateSameTokenOwner, wrap };