@lightprotocol/compressed-token 0.22.1-alpha.9 → 0.23.0-beta.10

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,6 @@
1
1
  /// <reference types="node" />
2
- import { PublicKey, TransactionInstruction, Commitment, AccountInfo, Signer, ConfirmOptions, TransactionSignature, AccountMeta, Keypair, Connection } from '@solana/web3.js';
3
- import { ValidityProofWithContext, AddressTreeInfo, TreeInfo, MerkleContext, Rpc, ParsedTokenAccount, CompressedAccountWithMerkleContext, ValidityProof, PackedMerkleContextLegacy, CompressedCpiContext, InputTokenDataWithContext as InputTokenDataWithContext$1, CompressedProof } from '@lightprotocol/stateless.js';
2
+ import { PublicKey, TransactionInstruction, Commitment, AccountInfo, Signer, ConfirmOptions, TransactionSignature, Keypair, AccountMeta, Connection } from '@solana/web3.js';
3
+ import { ValidityProofWithContext, AddressTreeInfo, TreeInfo, MerkleContext, Rpc, CompressedAccountWithMerkleContext, ParsedTokenAccount, TreeType, PackedMerkleContextLegacy, CompressedCpiContext, ValidityProof, InputTokenDataWithContext as InputTokenDataWithContext$1, CompressedProof } from '@lightprotocol/stateless.js';
4
4
  export { ParsedTokenAccount as ParsedTokenAccountInterface } from '@lightprotocol/stateless.js';
5
5
  import { Mint, Account } from '@solana/spl-token';
6
6
  export { Account, AccountState } from '@solana/spl-token';
@@ -339,7 +339,7 @@ interface AdditionalMetadata {
339
339
  }
340
340
 
341
341
  /**
342
- * Token metadata for creating a c-token mint.
342
+ * Token metadata for creating a light-token mint.
343
343
  */
344
344
  interface TokenMetadataInstructionData {
345
345
  name: string;
@@ -350,7 +350,7 @@ interface TokenMetadataInstructionData {
350
350
  }
351
351
  declare function createTokenMetadata(name: string, symbol: string, uri: string, updateAuthority?: PublicKey | null, additionalMetadata?: AdditionalMetadata[] | null): TokenMetadataInstructionData;
352
352
  /**
353
- * Create instruction for initializing a c-token mint.
353
+ * Create instruction for initializing a light-token mint.
354
354
  *
355
355
  * @param mintSigner Mint signer keypair public key.
356
356
  * @param decimals Number of decimals for the mint.
@@ -361,8 +361,9 @@ declare function createTokenMetadata(name: string, symbol: string, uri: string,
361
361
  * @param addressTreeInfo Address tree info for the mint.
362
362
  * @param outputStateTreeInfo Output state tree info.
363
363
  * @param metadata Optional token metadata.
364
+ * @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
364
365
  */
365
- declare function createMintInstruction(mintSigner: PublicKey, decimals: number, mintAuthority: PublicKey, freezeAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext, addressTreeInfo: AddressTreeInfo, outputStateTreeInfo: TreeInfo, metadata?: TokenMetadataInstructionData): TransactionInstruction;
366
+ declare function createMintInstruction(mintSigner: PublicKey, decimals: number, mintAuthority: PublicKey, freezeAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext, addressTreeInfo: AddressTreeInfo, outputStateTreeInfo: TreeInfo, metadata?: TokenMetadataInstructionData, maxTopUp?: number): TransactionInstruction;
366
367
 
367
368
  /**
368
369
  * SPL-compatible base mint structure
@@ -380,12 +381,12 @@ interface BaseMint {
380
381
  freezeAuthority: PublicKey | null;
381
382
  }
382
383
  /**
383
- * Compressed mint context (protocol version, SPL mint reference)
384
+ * Light mint context (protocol version, SPL mint reference)
384
385
  */
385
386
  interface MintContext {
386
387
  /** Protocol version for upgradability */
387
388
  version: number;
388
- /** Whether the compressed mint is decompressed to a CMint Solana account */
389
+ /** Whether the compressed light mint has been decompressed to a light mint account */
389
390
  cmintDecompressed: boolean;
390
391
  /** PDA of the associated SPL mint */
391
392
  splMint: PublicKey;
@@ -423,7 +424,7 @@ interface TokenMetadata {
423
424
  }[];
424
425
  }
425
426
  /**
426
- * Complete compressed mint structure (raw format)
427
+ * Complete light mint structure (raw format)
427
428
  */
428
429
  interface CompressedMint {
429
430
  base: BaseMint;
@@ -452,7 +453,7 @@ interface RentConfig {
452
453
  maxTopUp: number;
453
454
  }
454
455
  /**
455
- * Compression info embedded in CompressedMint
456
+ * Compression info embedded in light mint
456
457
  */
457
458
  interface CompressionInfo {
458
459
  /** Config account version (0 = uninitialized) */
@@ -477,18 +478,18 @@ interface CompressionInfo {
477
478
  rentConfig: RentConfig;
478
479
  }
479
480
  /**
480
- * Deserialize a compressed mint from buffer
481
+ * Deserialize a light mint from buffer
481
482
  * Uses SPL's MintLayout for BaseMint and buffer-layout struct for context
482
483
  *
483
484
  * @param data - The raw account data buffer
484
- * @returns The deserialized CompressedMint
485
+ * @returns The deserialized light mint
485
486
  */
486
487
  declare function deserializeMint(data: Buffer$1 | Uint8Array): CompressedMint;
487
488
  /**
488
- * Serialize a CompressedMint to buffer
489
+ * Serialize a light mint to buffer
489
490
  * Uses SPL's MintLayout for BaseMint, helper functions for context/metadata
490
491
  *
491
- * @param mint - The CompressedMint to serialize
492
+ * @param mint - The light mint to serialize
492
493
  * @returns The serialized buffer
493
494
  */
494
495
  declare function serializeMint(mint: CompressedMint): Buffer$1;
@@ -551,11 +552,11 @@ interface MintInterface {
551
552
  mintContext?: MintContext;
552
553
  tokenMetadata?: TokenMetadata;
553
554
  extensions?: MintExtension[];
554
- /** Compression info for c-token mints */
555
+ /** Compression info for light-token mints */
555
556
  compression?: CompressionInfo;
556
557
  }
557
558
  /**
558
- * Get unified mint info for SPL/T22/c-token mints.
559
+ * Get unified mint info for SPL/T22/light-token mints.
559
560
  *
560
561
  * @param rpc RPC connection
561
562
  * @param address The mint address
@@ -567,16 +568,16 @@ interface MintInterface {
567
568
  */
568
569
  declare function getMintInterface(rpc: Rpc, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<MintInterface>;
569
570
  /**
570
- * Unpack mint info from raw account data for SPL/T22/c-token.
571
+ * Unpack mint info from raw account data for SPL/T22/light-token.
571
572
  *
572
573
  * @param address The mint pubkey
573
574
  * @param data The raw account data or AccountInfo
574
- * @param programId Token program ID. Default c-token.
575
+ * @param programId Token program ID. Default light-token.
575
576
  * @returns Object with mint, optional mintContext and tokenMetadata.
576
577
  */
577
578
  declare function unpackMintInterface(address: PublicKey, data: Buffer$1 | Uint8Array | AccountInfo<Buffer$1>, programId?: PublicKey): Omit<MintInterface, 'merkleContext'>;
578
579
  /**
579
- * Unpack c-token mint context and metadata from raw account data
580
+ * Unpack light-token mint context and metadata from raw account data
580
581
  *
581
582
  * @param data The raw account data
582
583
  * @returns Object with mintContext, tokenMetadata, and extensions
@@ -588,17 +589,20 @@ declare function unpackMintData(data: Buffer$1 | Uint8Array): {
588
589
  };
589
590
 
590
591
  /**
591
- * Create instruction for updating a compressed mint's mint authority.
592
+ * Create instruction for updating a light mint's mint authority.
593
+ * Works for both compressed and decompressed light mints.
592
594
  *
593
595
  * @param mintInterface MintInterface from getMintInterface() - must have merkleContext
594
596
  * @param currentMintAuthority Current mint authority public key (must sign)
595
597
  * @param newMintAuthority New mint authority (or null to revoke)
596
598
  * @param payer Fee payer public key
597
- * @param validityProof Validity proof for the compressed mint
599
+ * @param validityProof Validity proof for the compressed light mint (null for decompressed light mints)
600
+ * @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
598
601
  */
599
- declare function createUpdateMintAuthorityInstruction(mintInterface: MintInterface, currentMintAuthority: PublicKey, newMintAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext): TransactionInstruction;
602
+ declare function createUpdateMintAuthorityInstruction(mintInterface: MintInterface, currentMintAuthority: PublicKey, newMintAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext | null, maxTopUp?: number): TransactionInstruction;
600
603
  /**
601
- * Create instruction for updating a compressed mint's freeze authority.
604
+ * Create instruction for updating a light mint's freeze authority.
605
+ * Works for both compressed and decompressed light mints.
602
606
  *
603
607
  * Output queue is automatically derived from mintInterface.merkleContext.treeInfo
604
608
  * (preferring nextTreeInfo.queue if available for rollover support).
@@ -607,12 +611,13 @@ declare function createUpdateMintAuthorityInstruction(mintInterface: MintInterfa
607
611
  * @param currentFreezeAuthority Current freeze authority public key (must sign)
608
612
  * @param newFreezeAuthority New freeze authority (or null to revoke)
609
613
  * @param payer Fee payer public key
610
- * @param validityProof Validity proof for the compressed mint
614
+ * @param validityProof Validity proof for the compressed light mint (null for decompressed light mints)
615
+ * @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
611
616
  */
612
- declare function createUpdateFreezeAuthorityInstruction(mintInterface: MintInterface, currentFreezeAuthority: PublicKey, newFreezeAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext): TransactionInstruction;
617
+ declare function createUpdateFreezeAuthorityInstruction(mintInterface: MintInterface, currentFreezeAuthority: PublicKey, newFreezeAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext | null, maxTopUp?: number): TransactionInstruction;
613
618
 
614
619
  /**
615
- * Create instruction for updating a compressed mint's metadata field.
620
+ * Create instruction for updating a light mint's metadata field.
616
621
  *
617
622
  * Output queue is automatically derived from mintInterface.merkleContext.treeInfo
618
623
  * (preferring nextTreeInfo.queue if available for rollover support).
@@ -620,15 +625,16 @@ declare function createUpdateFreezeAuthorityInstruction(mintInterface: MintInter
620
625
  * @param mintInterface MintInterface from getMintInterface() - must have merkleContext and tokenMetadata
621
626
  * @param authority Metadata update authority public key (must sign)
622
627
  * @param payer Fee payer public key
623
- * @param validityProof Validity proof for the compressed mint
628
+ * @param validityProof Validity proof for the light mint (null for decompressed light mints)
624
629
  * @param fieldType Field to update: 'name', 'symbol', 'uri', or 'custom'
625
630
  * @param value New value for the field
626
631
  * @param customKey Custom key name (required if fieldType is 'custom')
627
632
  * @param extensionIndex Extension index (default: 0)
633
+ * @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
628
634
  */
629
- declare function createUpdateMetadataFieldInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, fieldType: 'name' | 'symbol' | 'uri' | 'custom', value: string, customKey?: string, extensionIndex?: number): TransactionInstruction;
635
+ declare function createUpdateMetadataFieldInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext | null, fieldType: 'name' | 'symbol' | 'uri' | 'custom', value: string, customKey?: string, extensionIndex?: number, maxTopUp?: number): TransactionInstruction;
630
636
  /**
631
- * Create instruction for updating a compressed mint's metadata authority.
637
+ * Create instruction for updating a light mint's metadata authority.
632
638
  *
633
639
  * Output queue is automatically derived from mintInterface.merkleContext.treeInfo
634
640
  * (preferring nextTreeInfo.queue if available for rollover support).
@@ -637,12 +643,13 @@ declare function createUpdateMetadataFieldInstruction(mintInterface: MintInterfa
637
643
  * @param currentAuthority Current metadata update authority public key (must sign)
638
644
  * @param newAuthority New metadata update authority public key
639
645
  * @param payer Fee payer public key
640
- * @param validityProof Validity proof for the compressed mint
646
+ * @param validityProof Validity proof for the light mint (null for decompressed light mints)
641
647
  * @param extensionIndex Extension index (default: 0)
648
+ * @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
642
649
  */
643
- declare function createUpdateMetadataAuthorityInstruction(mintInterface: MintInterface, currentAuthority: PublicKey, newAuthority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, extensionIndex?: number): TransactionInstruction;
650
+ declare function createUpdateMetadataAuthorityInstruction(mintInterface: MintInterface, currentAuthority: PublicKey, newAuthority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext | null, extensionIndex?: number, maxTopUp?: number): TransactionInstruction;
644
651
  /**
645
- * Create instruction for removing a metadata key from a compressed mint.
652
+ * Create instruction for removing a metadata key from a light mint.
646
653
  *
647
654
  * Output queue is automatically derived from mintInterface.merkleContext.treeInfo
648
655
  * (preferring nextTreeInfo.queue if available for rollover support).
@@ -650,12 +657,13 @@ declare function createUpdateMetadataAuthorityInstruction(mintInterface: MintInt
650
657
  * @param mintInterface MintInterface from getMintInterface() - must have merkleContext and tokenMetadata
651
658
  * @param authority Metadata update authority public key (must sign)
652
659
  * @param payer Fee payer public key
653
- * @param validityProof Validity proof for the compressed mint
660
+ * @param validityProof Validity proof for the light mint (null for decompressed light mints)
654
661
  * @param key Metadata key to remove
655
662
  * @param idempotent If true, don't error if key doesn't exist (default: false)
656
663
  * @param extensionIndex Extension index (default: 0)
664
+ * @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
657
665
  */
658
- declare function createRemoveMetadataKeyInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, key: string, idempotent?: boolean, extensionIndex?: number): TransactionInstruction;
666
+ declare function createRemoveMetadataKeyInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext | null, key: string, idempotent?: boolean, extensionIndex?: number, maxTopUp?: number): TransactionInstruction;
659
667
 
660
668
  interface CompressToPubkey {
661
669
  bump: number;
@@ -665,49 +673,81 @@ interface CompressToPubkey {
665
673
  interface CompressibleConfig {
666
674
  tokenAccountVersion: number;
667
675
  rentPayment: number;
668
- hasTopUp: number;
669
676
  compressionOnly: number;
670
677
  writeTopUp: number;
671
678
  compressToAccountPubkey?: CompressToPubkey | null;
672
679
  }
673
- interface CreateAssociatedCTokenAccountParams {
674
- bump: number;
675
- compressibleConfig?: CompressibleConfig;
680
+ interface CreateAssociatedLightTokenAccountParams {
681
+ compressibleConfig?: CompressibleConfig | null;
676
682
  }
677
683
  /**
678
- * Create instruction for creating an associated compressed token account.
684
+ * Default compressible config for light-token ATAs - matches Rust SDK defaults.
685
+ *
686
+ * - tokenAccountVersion: 3 (ShaFlat) - latest hashing scheme
687
+ * - rentPayment: 16 - prepay 16 epochs (~24 hours rent)
688
+ * - compressionOnly: 1 - required for ATAs
689
+ * - writeTopUp: 766 - per-write top-up (~2 epochs rent) when rent < 2 epochs
690
+ * - compressToAccountPubkey: null - required for ATAs
691
+ *
692
+ * Cost breakdown at associated token account creation:
693
+ * - Rent sponsor PDA (LIGHT_TOKEN_RENT_SPONSOR) pays: rent exemption (~890,880 lamports)
694
+ * - Fee payer pays: compression_cost (11K) + 16 epochs rent (~6,400) = ~17,400 lamports + tx fees
695
+ *
696
+ * Per-write top-up (transfers):
697
+ * - When account rent is below 2 epochs, fee payer pays 766 lamports top-up
698
+ * - This keeps the account perpetually funded when actively used
699
+ *
700
+ * Rent calculation (272-byte compressible lightToken account):
701
+ * - rent_per_epoch = base_rent (128) + bytes * rent_per_byte (272 * 1) = 400 lamports
702
+ * - 16 epochs = 16 * 400 = 6,400 lamports (24 hours)
703
+ * - 2 epochs = 2 * 400 = 800 lamports (~3 hours, writeTopUp = 766 is conservative)
704
+ *
705
+ * Account size breakdown (272 bytes):
706
+ * - 165 bytes: SPL token base layout
707
+ * - 1 byte: account_type discriminator
708
+ * - 1 byte: Option discriminator for extensions
709
+ * - 4 bytes: Vec length prefix
710
+ * - 1 byte: extension type discriminant
711
+ * - 4 bytes: CompressibleExtension header (decimals_option, decimals, compression_only, is_ata)
712
+ * - 96 bytes: CompressionInfo struct
713
+ */
714
+ declare const DEFAULT_COMPRESSIBLE_CONFIG: CompressibleConfig;
715
+ /**
716
+ * Create instruction for creating an associated light-token account.
717
+ * Uses the default rent sponsor PDA by default.
679
718
  *
680
719
  * @param feePayer Fee payer public key.
681
720
  * @param owner Owner of the associated token account.
682
721
  * @param mint Mint address.
683
- * @param compressibleConfig Optional compressible configuration.
684
- * @param configAccount Optional config account.
685
- * @param rentPayerPda Optional rent payer PDA.
722
+ * @param compressibleConfig Compressible configuration (defaults to rent sponsor config).
723
+ * @param configAccount Config account (defaults to LIGHT_TOKEN_CONFIG).
724
+ * @param rentPayerPda Rent payer PDA (defaults to LIGHT_TOKEN_RENT_SPONSOR).
686
725
  */
687
- declare function createAssociatedCTokenAccountInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
726
+ declare function createAssociatedLightTokenAccountInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig | null, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
688
727
  /**
689
- * Create idempotent instruction for creating an associated compressed token account.
728
+ * Create idempotent instruction for creating an associated light-token account.
729
+ * Uses the default rent sponsor PDA by default.
690
730
  *
691
731
  * @param feePayer Fee payer public key.
692
732
  * @param owner Owner of the associated token account.
693
733
  * @param mint Mint address.
694
- * @param compressibleConfig Optional compressible configuration.
695
- * @param configAccount Optional config account.
696
- * @param rentPayerPda Optional rent payer PDA.
734
+ * @param compressibleConfig Compressible configuration (defaults to rent sponsor config).
735
+ * @param configAccount Config account (defaults to LIGHT_TOKEN_CONFIG).
736
+ * @param rentPayerPda Rent payer PDA (defaults to LIGHT_TOKEN_RENT_SPONSOR).
697
737
  */
698
- declare function createAssociatedCTokenAccountIdempotentInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
738
+ declare function createAssociatedLightTokenAccountIdempotentInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig | null, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
699
739
 
700
740
  /**
701
- * c-token-specific config for createAssociatedTokenAccountInterfaceInstruction
741
+ * light-token-specific config for createAssociatedTokenAccountInterfaceInstruction
702
742
  */
703
- interface CTokenConfig {
704
- compressibleConfig?: CompressibleConfig;
743
+ interface LightTokenConfig {
744
+ compressibleConfig?: CompressibleConfig | null;
705
745
  configAccount?: PublicKey;
706
746
  rentPayerPda?: PublicKey;
707
747
  }
708
748
  /**
709
749
  * Create instruction for creating an associated token account (SPL, Token-2022,
710
- * or c-token). Follows SPL Token API signature with optional c-token config at the
750
+ * or light-token). Follows SPL Token API signature with optional light-token config at the
711
751
  * end.
712
752
  *
713
753
  * @param payer Fee payer public key.
@@ -716,12 +756,12 @@ interface CTokenConfig {
716
756
  * @param mint Mint address.
717
757
  * @param programId Token program ID (default: TOKEN_PROGRAM_ID).
718
758
  * @param associatedTokenProgramId Associated token program ID.
719
- * @param ctokenConfig Optional c-token-specific configuration.
759
+ * @param lightTokenConfig Optional light-token-specific configuration.
720
760
  */
721
- declare function createAssociatedTokenAccountInterfaceInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey, ctokenConfig?: CTokenConfig): TransactionInstruction;
761
+ declare function createAssociatedTokenAccountInterfaceInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey, lightTokenConfig?: LightTokenConfig): TransactionInstruction;
722
762
  /**
723
763
  * Create idempotent instruction for creating an associated token account (SPL,
724
- * Token-2022, or c-token). Follows SPL Token API signature with optional c-token
764
+ * Token-2022, or light-token). Follows SPL Token API signature with optional light-token
725
765
  * config at the end.
726
766
  *
727
767
  * @param payer Fee payer public key.
@@ -730,110 +770,14 @@ declare function createAssociatedTokenAccountInterfaceInstruction(payer: PublicK
730
770
  * @param mint Mint address.
731
771
  * @param programId Token program ID (default: TOKEN_PROGRAM_ID).
732
772
  * @param associatedTokenProgramId Associated token program ID.
733
- * @param ctokenConfig Optional c-token-specific configuration.
773
+ * @param lightTokenConfig Optional light-token-specific configuration.
734
774
  */
735
- declare function createAssociatedTokenAccountInterfaceIdempotentInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey, ctokenConfig?: CTokenConfig): TransactionInstruction;
775
+ declare function createAssociatedTokenAccountInterfaceIdempotentInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey, lightTokenConfig?: LightTokenConfig): TransactionInstruction;
736
776
  /**
737
777
  * Short alias for createAssociatedTokenAccountInterfaceIdempotentInstruction.
738
778
  */
739
779
  declare const createAtaInterfaceIdempotentInstruction: typeof createAssociatedTokenAccountInterfaceIdempotentInstruction;
740
780
 
741
- /**
742
- * Create instruction for minting compressed tokens to an onchain token account.
743
- *
744
- * @param authority Mint authority public key.
745
- * @param payer Fee payer public key.
746
- * @param validityProof Validity proof for the compressed mint.
747
- * @param merkleContext Merkle context of the compressed mint.
748
- * @param mintData Mint instruction data.
749
- * @param outputStateTreeInfo Output state tree info.
750
- * @param recipientAccount Recipient onchain token account address.
751
- * @param amount Amount to mint.
752
- */
753
- declare function createMintToInstruction(authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, merkleContext: MerkleContext, mintData: MintInstructionData, outputStateTreeInfo: TreeInfo, recipientAccount: PublicKey, amount: number | bigint): TransactionInstruction;
754
-
755
- /**
756
- * Token data version enum - mirrors Rust TokenDataVersion
757
- * Used for compressed token account hashing strategy
758
- */
759
- declare enum TokenDataVersion {
760
- /** V1: Poseidon hash with little-endian amount, discriminator [2,0,0,0,0,0,0,0] */
761
- V1 = 1,
762
- /** V2: Poseidon hash with big-endian amount, discriminator [0,0,0,0,0,0,0,3] */
763
- V2 = 2,
764
- /** ShaFlat: SHA256 hash of borsh-serialized data, discriminator [0,0,0,0,0,0,0,4] */
765
- ShaFlat = 3
766
- }
767
- declare const POOL_SEED: Buffer$1<ArrayBuffer>;
768
- declare const CPI_AUTHORITY_SEED: Buffer$1<ArrayBuffer>;
769
- declare const SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE = 1461600;
770
- declare const CREATE_TOKEN_POOL_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
771
- declare const MINT_TO_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
772
- declare const BATCH_COMPRESS_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
773
- declare const TRANSFER_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
774
- declare const COMPRESS_SPL_TOKEN_ACCOUNT_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
775
- declare const APPROVE_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
776
- declare const REVOKE_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
777
- declare const ADD_TOKEN_POOL_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
778
- declare const DECOMPRESS_ACCOUNTS_IDEMPOTENT_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
779
-
780
- /**
781
- * Create instruction for minting tokens from a c-mint to compressed accounts.
782
- * To mint to onchain token accounts across SPL/T22/c-mints, use
783
- * {@link createMintToInterfaceInstruction} instead.
784
- *
785
- * @param authority Mint authority public key.
786
- * @param payer Fee payer public key.
787
- * @param validityProof Validity proof for the compressed mint.
788
- * @param merkleContext Merkle context of the compressed mint.
789
- * @param mintData Mint instruction data.
790
- * @param recipients Array of recipients with amounts.
791
- * @param outputStateTreeInfo Optional output state tree info. Uses merkle
792
- * context queue if not provided.
793
- * @param tokenAccountVersion Token account version (default:
794
- * TokenDataVersion.ShaFlat).
795
- */
796
- declare function createMintToCompressedInstruction(authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, merkleContext: MerkleContext, mintData: MintInstructionData, recipients: Array<{
797
- recipient: PublicKey;
798
- amount: number | bigint;
799
- }>, outputStateTreeInfo?: TreeInfo, tokenAccountVersion?: TokenDataVersion): TransactionInstruction;
800
-
801
- /**
802
- * Create mint-to instruction for SPL, Token-2022, or compressed token mints.
803
- * This instruction ONLY mints to decompressed/onchain token accounts.
804
- *
805
- * @param mintInterface Mint interface (SPL, Token-2022, or compressed).
806
- * @param destination Destination onchain token account address.
807
- * @param authority Mint authority public key.
808
- * @param payer Fee payer public key.
809
- * @param amount Amount to mint.
810
- * @param validityProof Validity proof (required for compressed mints).
811
- * @param multiSigners Multi-signature signer public keys.
812
- */
813
- declare function createMintToInterfaceInstruction(mintInterface: MintInterface, destination: PublicKey, authority: PublicKey, payer: PublicKey, amount: number | bigint, validityProof?: ValidityProofWithContext, multiSigners?: PublicKey[]): TransactionInstruction;
814
-
815
- /**
816
- * Create a c-token transfer instruction.
817
- *
818
- * @param source Source c-token account
819
- * @param destination Destination c-token account
820
- * @param owner Owner of the source account (signer, also pays for compressible extension top-ups)
821
- * @param amount Amount to transfer
822
- * @returns Transaction instruction for c-token transfer
823
- */
824
- declare function createCTokenTransferInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint): TransactionInstruction;
825
- /**
826
- * Construct a transfer instruction for SPL/T22/c-token. Defaults to c-token
827
- * program. For cross-program transfers (SPL <> c-token), use `wrap`/`unwrap`.
828
- *
829
- * @param source Source token account
830
- * @param destination Destination token account
831
- * @param owner Owner of the source account (signer)
832
- * @param amount Amount to transfer
833
- * @returns instruction for c-token transfer
834
- */
835
- declare function createTransferInterfaceInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, multiSigners?: (Signer | PublicKey)[], programId?: PublicKey): TransactionInstruction;
836
-
837
781
  declare namespace BN {
838
782
  type Endianness = "le" | "be";
839
783
  type IPrimeName = "k256" | "p224" | "p192" | "p25519";
@@ -1427,6 +1371,77 @@ declare class RedBN extends BN {
1427
1371
  redPow(b: BN): RedBN;
1428
1372
  }
1429
1373
 
1374
+ declare const TokenAccountSourceType: {
1375
+ readonly Spl: "spl";
1376
+ readonly Token2022: "token2022";
1377
+ readonly SplCold: "spl-cold";
1378
+ readonly Token2022Cold: "token2022-cold";
1379
+ readonly LightTokenHot: "light-token-hot";
1380
+ readonly LightTokenCold: "light-token-cold";
1381
+ };
1382
+ type TokenAccountSourceTypeValue = (typeof TokenAccountSourceType)[keyof typeof TokenAccountSourceType];
1383
+ /** @internal */
1384
+ interface TokenAccountSource {
1385
+ type: TokenAccountSourceTypeValue;
1386
+ address: PublicKey;
1387
+ amount: bigint;
1388
+ accountInfo: AccountInfo<Buffer$1>;
1389
+ loadContext?: MerkleContext;
1390
+ parsed: Account;
1391
+ }
1392
+ interface AccountInterface {
1393
+ accountInfo: AccountInfo<Buffer$1>;
1394
+ parsed: Account;
1395
+ isCold: boolean;
1396
+ loadContext?: MerkleContext;
1397
+ _sources?: TokenAccountSource[];
1398
+ _needsConsolidation?: boolean;
1399
+ _hasDelegate?: boolean;
1400
+ _anyFrozen?: boolean;
1401
+ /** True when fetched via getAtaInterface */
1402
+ _isAta?: boolean;
1403
+ /** Associated token account owner - set by getAtaInterface */
1404
+ _owner?: PublicKey;
1405
+ /** Associated token account mint - set by getAtaInterface */
1406
+ _mint?: PublicKey;
1407
+ }
1408
+ /** @internal */
1409
+ declare function convertTokenDataToAccount(address: PublicKey, tokenData: {
1410
+ mint: PublicKey;
1411
+ owner: PublicKey;
1412
+ amount: BN;
1413
+ delegate: PublicKey | null;
1414
+ state: number;
1415
+ tlv: Buffer$1 | null;
1416
+ }): Account;
1417
+ /** Convert compressed account to AccountInfo */
1418
+ declare function toAccountInfo(compressedAccount: CompressedAccountWithMerkleContext): AccountInfo<Buffer$1>;
1419
+ /** @internal */
1420
+ declare function parseLightTokenHot(address: PublicKey, accountInfo: AccountInfo<Buffer$1>): {
1421
+ accountInfo: AccountInfo<Buffer$1>;
1422
+ loadContext: undefined;
1423
+ parsed: Account;
1424
+ isCold: false;
1425
+ };
1426
+ /** @internal */
1427
+ declare function parseLightTokenCold(address: PublicKey, compressedAccount: CompressedAccountWithMerkleContext): {
1428
+ accountInfo: AccountInfo<Buffer$1>;
1429
+ loadContext: MerkleContext;
1430
+ parsed: Account;
1431
+ isCold: true;
1432
+ };
1433
+ /**
1434
+ * Retrieve information about a token account of SPL/T22/light-token.
1435
+ *
1436
+ * @param rpc RPC connection to use
1437
+ * @param address Token account address
1438
+ * @param commitment Desired level of commitment for querying the state
1439
+ * @param programId Token program ID. If not provided, tries all programs concurrently.
1440
+ *
1441
+ * @return Token account information with compression context if applicable
1442
+ */
1443
+ declare function getAccountInterface(rpc: Rpc, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<AccountInterface>;
1444
+
1430
1445
  /**
1431
1446
  * SPL interface PDA info.
1432
1447
  */
@@ -1611,277 +1626,275 @@ declare function selectTokenPoolInfo(infos: TokenPoolInfo[]): TokenPoolInfo;
1611
1626
  */
1612
1627
  declare function selectTokenPoolInfosForDecompression(infos: TokenPoolInfo[], decompressAmount: number | BN): TokenPoolInfo[];
1613
1628
 
1629
+ declare function sliceLast<T>(items: T[]): {
1630
+ rest: T[];
1631
+ last: T;
1632
+ };
1633
+
1614
1634
  /**
1615
- * Create decompressInterface instruction using Transfer2.
1635
+ * Create a light-token transfer instruction.
1616
1636
  *
1617
- * Supports decompressing to both c-token accounts and SPL token accounts:
1618
- * - For c-token destinations: No splInterfaceInfo needed
1619
- * - For SPL destinations: Provide splInterfaceInfo (token pool info) and decimals
1637
+ * For light-token accounts with compressible extension, the program needs
1638
+ * system_program and fee_payer to handle rent top-ups.
1620
1639
  *
1621
- * @param payer Fee payer public key
1622
- * @param inputCompressedTokenAccounts Input compressed token accounts
1623
- * @param toAddress Destination token account address (c-token or SPL ATA)
1624
- * @param amount Amount to decompress
1625
- * @param validityProof Validity proof (contains compressedProof and rootIndices)
1626
- * @param splInterfaceInfo Optional: SPL interface info for SPL destinations
1627
- * @param decimals Mint decimals (required for SPL destinations)
1628
- * @returns TransactionInstruction
1640
+ * @param source Source light-token account
1641
+ * @param destination Destination light-token account
1642
+ * @param owner Owner of the source account (signer, also pays for compressible extension top-ups)
1643
+ * @param amount Amount to transfer
1644
+ * @param feePayer Optional fee payer for top-ups (defaults to owner)
1645
+ * @returns Transaction instruction for light-token transfer
1629
1646
  */
1630
- declare function createDecompressInterfaceInstruction(payer: PublicKey, inputCompressedTokenAccounts: ParsedTokenAccount[], toAddress: PublicKey, amount: bigint, validityProof: ValidityProofWithContext, splInterfaceInfo: SplInterfaceInfo | undefined, decimals: number): TransactionInstruction;
1647
+ declare function createLightTokenTransferInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, feePayer?: PublicKey): TransactionInstruction;
1648
+ /**
1649
+ * Create a light-token transfer_checked instruction. Same semantics as SPL
1650
+ * TransferChecked.
1651
+ */
1652
+ declare function createLightTokenTransferCheckedInstruction(source: PublicKey, destination: PublicKey, mint: PublicKey, owner: PublicKey, amount: number | bigint, decimals: number, payer: PublicKey): TransactionInstruction;
1653
+ declare function createTransferInterfaceInstructions(rpc: Rpc, payer: PublicKey, mint: PublicKey, amount: number | bigint | BN, sender: PublicKey, destination: PublicKey, decimals: number, options?: TransferOptions): Promise<TransactionInstruction[][]>;
1631
1654
 
1632
- declare const TokenAccountSourceType: {
1633
- readonly Spl: "spl";
1634
- readonly Token2022: "token2022";
1635
- readonly SplCold: "spl-cold";
1636
- readonly Token2022Cold: "token2022-cold";
1637
- readonly CTokenHot: "ctoken-hot";
1638
- readonly CTokenCold: "ctoken-cold";
1639
- };
1640
- type TokenAccountSourceTypeValue = (typeof TokenAccountSourceType)[keyof typeof TokenAccountSourceType];
1641
- /** @internal */
1642
- interface TokenAccountSource {
1643
- type: TokenAccountSourceTypeValue;
1644
- address: PublicKey;
1645
- amount: bigint;
1646
- accountInfo: AccountInfo<Buffer$1>;
1647
- loadContext?: MerkleContext;
1648
- parsed: Account;
1655
+ interface InterfaceOptions {
1656
+ splInterfaceInfos?: SplInterfaceInfo[];
1657
+ /**
1658
+ * ATA owner (authority owner) used to derive the ATA when the signer is a
1659
+ * delegate. For owner-signed flows, omit this field.
1660
+ */
1661
+ owner?: PublicKey;
1649
1662
  }
1650
- interface AccountInterface {
1651
- accountInfo: AccountInfo<Buffer$1>;
1652
- parsed: Account;
1653
- isCold: boolean;
1654
- loadContext?: MerkleContext;
1655
- _sources?: TokenAccountSource[];
1656
- _needsConsolidation?: boolean;
1657
- _hasDelegate?: boolean;
1658
- _anyFrozen?: boolean;
1659
- /** True when fetched via getAtaInterface */
1660
- _isAta?: boolean;
1661
- /** ATA owner - set by getAtaInterface */
1662
- _owner?: PublicKey;
1663
- /** ATA mint - set by getAtaInterface */
1664
- _mint?: PublicKey;
1663
+ 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, wrap?: boolean, decimals?: number): Promise<TransactionSignature>;
1664
+ interface TransferOptions extends InterfaceOptions {
1665
+ wrap?: boolean;
1666
+ programId?: PublicKey;
1665
1667
  }
1666
- /** @internal */
1667
- declare function convertTokenDataToAccount(address: PublicKey, tokenData: {
1668
+
1669
+ declare function selectInputsForAmount(accounts: ParsedTokenAccount[], neededAmount: bigint): ParsedTokenAccount[];
1670
+
1671
+ /**
1672
+ * Parameters for creating a MintTo instruction.
1673
+ */
1674
+ interface CreateMintToInstructionParams {
1675
+ /** Light mint account (decompressed from compressed light mint) */
1668
1676
  mint: PublicKey;
1669
- owner: PublicKey;
1670
- amount: BN;
1671
- delegate: PublicKey | null;
1672
- state: number;
1673
- tlv: Buffer$1 | null;
1674
- }): Account;
1675
- /** Convert compressed account to AccountInfo */
1676
- declare function toAccountInfo(compressedAccount: CompressedAccountWithMerkleContext): AccountInfo<Buffer$1>;
1677
- /** @internal */
1678
- declare function parseCTokenHot(address: PublicKey, accountInfo: AccountInfo<Buffer$1>): {
1679
- accountInfo: AccountInfo<Buffer$1>;
1680
- loadContext: undefined;
1681
- parsed: Account;
1682
- isCold: false;
1683
- };
1684
- /** @internal */
1685
- declare function parseCTokenCold(address: PublicKey, compressedAccount: CompressedAccountWithMerkleContext): {
1686
- accountInfo: AccountInfo<Buffer$1>;
1687
- loadContext: MerkleContext;
1688
- parsed: Account;
1689
- isCold: true;
1690
- };
1677
+ /** Destination light-token account to mint to */
1678
+ destination: PublicKey;
1679
+ /** Amount of tokens to mint */
1680
+ amount: number | bigint;
1681
+ /** Mint authority (must be signer) */
1682
+ authority: PublicKey;
1683
+ /** Maximum lamports for rent and top-up combined. Transaction fails if exceeded. (u16::MAX = no limit, 0 = no top-ups allowed) */
1684
+ maxTopUp?: number;
1685
+ /** Optional fee payer for rent top-ups. If not provided, authority pays. */
1686
+ feePayer?: PublicKey;
1687
+ }
1691
1688
  /**
1692
- * Retrieve information about a token account of SPL/T22/c-token.
1689
+ * Create instruction for minting tokens to a light-token account.
1693
1690
  *
1694
- * @param rpc RPC connection to use
1695
- * @param address Token account address
1696
- * @param commitment Desired level of commitment for querying the state
1697
- * @param programId Token program ID. If not provided, tries all programs concurrently.
1691
+ * This is a simple 3-4 account instruction for minting to light-token associated token accounts (hot).
1692
+ * Uses discriminator 7 (LightTokenMintTo).
1698
1693
  *
1699
- * @return Token account information with compression context if applicable
1694
+ * @param params - Mint instruction parameters
1695
+ * @returns TransactionInstruction for minting tokens
1700
1696
  */
1701
- declare function getAccountInterface(rpc: Rpc, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<AccountInterface>;
1697
+ declare function createMintToInstruction(params: CreateMintToInstructionParams): TransactionInstruction;
1702
1698
 
1699
+ /** Default compressible config PDA (V1) */
1700
+ declare const LIGHT_TOKEN_CONFIG: PublicKey;
1701
+ /** Default rent sponsor PDA (V1) */
1702
+ declare const LIGHT_TOKEN_RENT_SPONSOR: PublicKey;
1703
1703
  /**
1704
- * Options for interface operations (load, transfer)
1704
+ * Token data version enum - mirrors Rust TokenDataVersion
1705
+ * Used for compressed token account hashing strategy
1705
1706
  */
1706
- interface InterfaceOptions {
1707
- /** SPL interface infos (fetched if not provided) */
1708
- splInterfaceInfos?: SplInterfaceInfo[];
1707
+ declare enum TokenDataVersion {
1708
+ /** V1: Poseidon hash with little-endian amount, discriminator [2,0,0,0,0,0,0,0] */
1709
+ V1 = 1,
1710
+ /** V2: Poseidon hash with big-endian amount, discriminator [0,0,0,0,0,0,0,3] */
1711
+ V2 = 2,
1712
+ /** ShaFlat: SHA256 hash of borsh-serialized data, discriminator [0,0,0,0,0,0,0,4] */
1713
+ ShaFlat = 3
1709
1714
  }
1715
+ declare const POOL_SEED: Buffer$1<ArrayBuffer>;
1716
+ declare const CPI_AUTHORITY_SEED: Buffer$1<ArrayBuffer>;
1717
+ declare const SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE = 1461600;
1718
+ declare const CREATE_TOKEN_POOL_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
1719
+ declare const MINT_TO_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
1720
+ declare const BATCH_COMPRESS_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
1721
+ declare const TRANSFER_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
1722
+ declare const COMPRESS_SPL_TOKEN_ACCOUNT_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
1723
+ declare const APPROVE_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
1724
+ declare const REVOKE_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
1725
+ declare const ADD_TOKEN_POOL_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
1710
1726
  /**
1711
- * Transfer tokens using the c-token interface.
1712
- *
1713
- * Matches SPL Token's transferChecked signature order. Destination must exist.
1714
- *
1715
- * @param rpc RPC connection
1716
- * @param payer Fee payer (signer)
1717
- * @param source Source c-token ATA address
1718
- * @param mint Mint address
1719
- * @param destination Destination c-token ATA address (must exist)
1720
- * @param owner Source owner (signer)
1721
- * @param amount Amount to transfer
1722
- * @param programId Token program ID (default: CTOKEN_PROGRAM_ID)
1723
- * @param confirmOptions Optional confirm options
1724
- * @param options Optional interface options
1725
- * @param wrap Include SPL/T22 wrapping (default: false)
1726
- * @returns Transaction signature
1727
+ * Maximum lamports for rent top-up in a single instruction.
1728
+ * u16::MAX = no limit; 0 = no top-ups allowed.
1729
+ * Matches Rust SDK (e.g. token-sdk create_mints uses u16::MAX for "no limit").
1727
1730
  */
1728
- 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, wrap?: boolean): Promise<TransactionSignature>;
1729
-
1731
+ declare const MAX_TOP_UP = 65535;
1730
1732
  /**
1731
- * Account info interface for compressible accounts.
1732
- * Matches return structure of getAccountInterface/getAtaInterface.
1733
- *
1734
- * Integrating programs provide their own fetch/parse - this is just the data shape.
1733
+ * Rent configuration constants for compressible light token accounts.
1734
+ * These match the Rust SDK defaults in program-libs/compressible/src/rent/config.rs
1735
1735
  */
1736
- interface ParsedAccountInfoInterface<T = unknown> {
1737
- /** Parsed account data (program-specific) */
1738
- parsed: T;
1739
- /** Load context - present if account is compressed (cold), undefined if hot */
1740
- loadContext?: MerkleContext;
1741
- }
1736
+ /** Base rent per epoch (lamports) */
1737
+ declare const BASE_RENT_PER_EPOCH = 128;
1738
+ /** Rent per byte per epoch (lamports) */
1739
+ declare const RENT_PER_BYTE_PER_EPOCH = 1;
1740
+ /** Slots per rent epoch (1.5 hours) */
1741
+ declare const SLOTS_PER_RENT_EPOCH = 13500;
1742
+ /** Compression cost (lamports) - paid at account creation */
1743
+ declare const COMPRESSION_COST = 10000;
1744
+ /** Compression incentive (lamports) - paid at account creation */
1745
+ declare const COMPRESSION_INCENTIVE = 1000;
1746
+ /** Total compression cost (COMPRESSION_COST + COMPRESSION_INCENTIVE) */
1747
+ declare const TOTAL_COMPRESSION_COST: number;
1742
1748
  /**
1743
- * Input for createLoadAccountsParams.
1744
- * Supports both program PDAs and c-token vaults.
1745
- *
1746
- * The integrating program is responsible for fetching and parsing their accounts.
1747
- * This helper just packs them for the decompressAccountsIdempotent instruction.
1749
+ * Compressible light token account size in bytes.
1750
+ * = 165 (base SPL token) + 1 (account_type) + 1 (Option) + 4 (Vec len) + 1 (ext disc) + 4 (ext header) + 96 (CompressionInfo) = 272
1751
+ * Source: program-libs/token-interface/src/state/token/top_up.rs MIN_SIZE_WITH_COMPRESSIBLE
1748
1752
  */
1749
- interface CompressibleAccountInput<T = unknown> {
1750
- /** Account address */
1751
- address: PublicKey;
1752
- /**
1753
- * Account type key for packing:
1754
- * - For PDAs: program-specific type name (e.g., "poolState", "observationState")
1755
- * - For c-token vaults: "cTokenData"
1756
- */
1757
- accountType: string;
1758
- /**
1759
- * Token variant - required when accountType is "cTokenData".
1760
- * Examples: "lpVault", "token0Vault", "token1Vault"
1761
- */
1762
- tokenVariant?: string;
1763
- /** Parsed account info (from program-specific fetch) */
1764
- info: ParsedAccountInfoInterface<T>;
1765
- }
1753
+ declare const COMPRESSIBLE_LIGHT_TOKEN_ACCOUNT_SIZE = 272;
1766
1754
  /**
1767
- * Packed compressed account for decompressAccountsIdempotent instruction
1755
+ * Calculate rent per epoch for a given account size.
1756
+ * Formula: base_rent + (bytes * lamports_per_byte_per_epoch)
1768
1757
  */
1769
- interface PackedCompressedAccount {
1770
- [key: string]: unknown;
1771
- merkleContext: {
1772
- merkleTreePubkeyIndex: number;
1773
- queuePubkeyIndex: number;
1774
- };
1775
- }
1758
+ declare function rentPerEpoch(bytes: number): number;
1776
1759
  /**
1777
- * Result from building load params
1760
+ * Default rent per epoch for a compressible light token account (272 bytes).
1761
+ * = 128 + 272 = 400 lamports
1778
1762
  */
1779
- interface CompressibleLoadParams {
1780
- /** Validity proof wrapped in option (null if all proveByIndex) */
1781
- proofOption: {
1782
- 0: ValidityProof | null;
1783
- };
1784
- /** Packed compressed accounts data for instruction */
1785
- compressedAccounts: PackedCompressedAccount[];
1786
- /** Offset to system accounts in remainingAccounts */
1787
- systemAccountsOffset: number;
1788
- /** Account metas for remaining accounts */
1789
- remainingAccounts: AccountMeta[];
1790
- }
1763
+ declare const COMPRESSIBLE_LIGHT_TOKEN_RENT_PER_EPOCH: number;
1764
+ /** Default prepaid epochs (24 hours = 16 epochs * 1.5h) */
1765
+ declare const DEFAULT_PREPAY_EPOCHS = 16;
1766
+ /** Default write top-up (lamports) - ~2 epochs rent */
1767
+ declare const DEFAULT_WRITE_TOP_UP = 766;
1791
1768
  /**
1792
- * Result from createLoadAccountsParams
1769
+ * Calculate fee payer cost at ATA creation.
1770
+ * = compression_cost (11K) + (prepay_epochs * rent_per_epoch)
1793
1771
  */
1794
- interface LoadResult {
1795
- /** Params for decompressAccountsIdempotent (null if no program accounts need decompressing) */
1796
- decompressParams: CompressibleLoadParams | null;
1797
- /** Instructions to load ATAs (create ATA, wrap SPL/T22, decompressInterface) */
1798
- ataInstructions: TransactionInstruction[];
1799
- }
1772
+ declare function calculateFeePayerCostAtCreation(prepayEpochs?: number, accountBytes?: number): number;
1773
+
1800
1774
  /**
1801
- * Create params for loading program accounts and ATAs.
1802
- *
1803
- * Returns:
1804
- * - decompressParams: for a caller program's standardized
1805
- * decompressAccountsIdempotent instruction
1806
- * - ataInstructions: for loading user ATAs
1807
- *
1808
- * @param rpc RPC connection
1809
- * @param payer Fee payer (needed for ATA instructions)
1810
- * @param programId Program ID for decompressAccountsIdempotent
1811
- * @param programAccounts PDAs and vaults (caller pre-fetches)
1812
- * @param atas User ATAs (fetched via getAtaInterface)
1813
- * @param options Optional load options
1814
- * @returns LoadResult with decompressParams and ataInstructions
1815
- *
1816
- * @example
1817
- * ```typescript
1818
- * const poolInfo = await myProgram.fetchPoolState(rpc, poolAddress);
1819
- * const vault0Ata = getAssociatedTokenAddressInterface(token0Mint, poolAddress);
1820
- * const vault0Info = await getAtaInterface(rpc, vault0Ata, poolAddress, token0Mint, undefined, CTOKEN_PROGRAM_ID);
1821
- * const userAta = getAssociatedTokenAddressInterface(tokenMint, userWallet);
1822
- * const userAtaInfo = await getAtaInterface(rpc, userAta, userWallet, tokenMint);
1823
- *
1824
- * const result = await createLoadAccountsParams(
1825
- * rpc,
1826
- * payer.publicKey,
1827
- * programId,
1828
- * [
1829
- * { address: poolAddress, accountType: 'poolState', info: poolInfo },
1830
- * { address: vault0, accountType: 'cTokenData', tokenVariant: 'token0Vault', info: vault0Info },
1831
- * ],
1832
- * [userAta],
1833
- * );
1775
+ * Create instruction for minting tokens from a light mint to compressed accounts.
1776
+ * To mint to light-token associated token accounts across SPL/T22/light mints, use
1777
+ * {@link createMintToInterfaceInstruction} instead.
1834
1778
  *
1835
- * // Build transaction with both program decompress and ATA load
1836
- * const instructions = [...result.ataInstructions];
1837
- * if (result.decompressParams) {
1838
- * instructions.push(await program.methods
1839
- * .decompressAccountsIdempotent(
1840
- * result.decompressParams.proofOption,
1841
- * result.decompressParams.compressedAccounts,
1842
- * result.decompressParams.systemAccountsOffset,
1843
- * )
1844
- * .remainingAccounts(result.decompressParams.remainingAccounts)
1845
- * .instruction());
1846
- * }
1847
- * ```
1779
+ * @param authority Mint authority public key.
1780
+ * @param payer Fee payer public key.
1781
+ * @param validityProof Validity proof for the light mint.
1782
+ * @param merkleContext Merkle context of the light mint.
1783
+ * @param mintData Mint instruction data.
1784
+ * @param recipients Array of recipients with amounts.
1785
+ * @param outputStateTreeInfo Optional output state tree info. Uses merkle
1786
+ * context queue if not provided.
1787
+ * @param tokenAccountVersion Token account version (default:
1788
+ * TokenDataVersion.ShaFlat).
1789
+ * @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
1848
1790
  */
1849
- declare function createLoadAccountsParams(rpc: Rpc, payer: PublicKey, programId: PublicKey, programAccounts?: CompressibleAccountInput[], atas?: AccountInterface[], options?: InterfaceOptions): Promise<LoadResult>;
1791
+ declare function createMintToCompressedInstruction(authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, merkleContext: MerkleContext, mintData: MintInstructionData, recipients: Array<{
1792
+ recipient: PublicKey;
1793
+ amount: number | bigint;
1794
+ }>, outputStateTreeInfo?: TreeInfo, tokenAccountVersion?: TokenDataVersion, maxTopUp?: number): TransactionInstruction;
1795
+
1850
1796
  /**
1851
- * Calculate compute units for compressible load operation
1797
+ * Create mint-to instruction for SPL, Token-2022, or light-token mints.
1798
+ * This instruction ONLY mints to light-token associated token accounts (hot).
1799
+ *
1800
+ * For light-token mints, the light mint account must exist (mint must be decompressed first).
1801
+ *
1802
+ * @param mintInterface Mint interface (SPL, Token-2022, or light-token).
1803
+ * @param destination Destination onchain token account address.
1804
+ * @param authority Mint authority public key.
1805
+ * @param payer Fee payer public key.
1806
+ * @param amount Amount to mint.
1807
+ * @param validityProof Not used (legacy parameter, kept for compatibility).
1808
+ * @param multiSigners Multi-signature signer public keys (SPL/T22 only).
1852
1809
  */
1853
- declare function calculateCompressibleLoadComputeUnits(compressedAccountCount: number, hasValidityProof: boolean): number;
1810
+ declare function createMintToInterfaceInstruction(mintInterface: MintInterface, destination: PublicKey, authority: PublicKey, payer: PublicKey, amount: number | bigint, validityProof?: ValidityProofWithContext, multiSigners?: PublicKey[]): TransactionInstruction;
1854
1811
 
1855
1812
  /**
1856
1813
  * Create a wrap instruction that moves tokens from an SPL/T22 account to a
1857
- * c-token account.
1814
+ * light-token account.
1858
1815
  *
1859
1816
  * @param source Source SPL/T22 token account
1860
- * @param destination Destination c-token account
1817
+ * @param destination Destination light-token account
1861
1818
  * @param owner Owner of the source account (signer)
1862
1819
  * @param mint Mint address
1863
1820
  * @param amount Amount to wrap,
1864
1821
  * @param splInterfaceInfo SPL interface info for the compression
1865
1822
  * @param decimals Mint decimals (required for transfer_checked)
1866
1823
  * @param payer Fee payer (defaults to owner)
1824
+ * @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
1867
1825
  * @returns Instruction to wrap tokens
1868
1826
  */
1869
- declare function createWrapInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, mint: PublicKey, amount: bigint, splInterfaceInfo: SplInterfaceInfo, decimals: number, payer?: PublicKey): TransactionInstruction;
1827
+ declare function createWrapInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, mint: PublicKey, amount: bigint, splInterfaceInfo: SplInterfaceInfo, decimals: number, payer?: PublicKey, maxTopUp?: number): TransactionInstruction;
1828
+
1829
+ /**
1830
+ * Create an unwrap instruction that moves tokens from a light-token account to an
1831
+ * SPL/T22 account.
1832
+ *
1833
+ * @param source Source light-token account
1834
+ * @param destination Destination SPL/T22 token account
1835
+ * @param owner Owner of the source account (signer)
1836
+ * @param mint Mint address
1837
+ * @param amount Amount to unwrap,
1838
+ * @param splInterfaceInfo SPL interface info for the decompression
1839
+ * @param decimals Mint decimals (required for transfer_checked)
1840
+ * @param payer Fee payer (defaults to owner if not provided)
1841
+ * @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
1842
+ * @returns TransactionInstruction to unwrap tokens
1843
+ */
1844
+ declare function createUnwrapInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, mint: PublicKey, amount: bigint, splInterfaceInfo: SplInterfaceInfo, decimals: number, payer?: PublicKey, maxTopUp?: number): TransactionInstruction;
1845
+ declare function createUnwrapInstructions(rpc: Rpc, destination: PublicKey, owner: PublicKey, mint: PublicKey, decimals: number, amount?: number | bigint | BN, payer?: PublicKey, splInterfaceInfo?: SplInterfaceInfo, maxTopUp?: number, interfaceOptions?: InterfaceOptions, wrap?: boolean): Promise<TransactionInstruction[][]>;
1846
+
1847
+ /**
1848
+ * Create an instruction to freeze a decompressed light-token account.
1849
+ *
1850
+ * Freezing sets the account state to AccountState::Frozen, preventing
1851
+ * transfers and other token operations. Only the mint's freeze_authority
1852
+ * can freeze accounts.
1853
+ *
1854
+ * Account order per program:
1855
+ * 0. token_account (mutable) - the light-token account to freeze
1856
+ * 1. mint (readonly) - the mint associated with the token account
1857
+ * 2. freeze_authority - must match mint.freeze_authority (signer)
1858
+ *
1859
+ * @param tokenAccount The light-token account to freeze (must be Initialized)
1860
+ * @param mint The mint of the light-token account
1861
+ * @param freezeAuthority The freeze authority of the mint (signer)
1862
+ * @returns TransactionInstruction
1863
+ */
1864
+ declare function createLightTokenFreezeAccountInstruction(tokenAccount: PublicKey, mint: PublicKey, freezeAuthority: PublicKey): TransactionInstruction;
1865
+ /**
1866
+ * Create an instruction to thaw (unfreeze) a frozen light-token account.
1867
+ *
1868
+ * Thawing restores the account state from AccountState::Frozen to
1869
+ * AccountState::Initialized, re-enabling token operations. Only the
1870
+ * mint's freeze_authority can thaw accounts.
1871
+ *
1872
+ * Account order per program:
1873
+ * 0. token_account (mutable) - the frozen light-token account to thaw
1874
+ * 1. mint (readonly) - the mint associated with the token account
1875
+ * 2. freeze_authority - must match mint.freeze_authority (signer)
1876
+ *
1877
+ * @param tokenAccount The frozen light-token account to thaw
1878
+ * @param mint The mint of the light-token account
1879
+ * @param freezeAuthority The freeze authority of the mint (signer)
1880
+ * @returns TransactionInstruction
1881
+ */
1882
+ declare function createLightTokenThawAccountInstruction(tokenAccount: PublicKey, mint: PublicKey, freezeAuthority: PublicKey): TransactionInstruction;
1870
1883
 
1871
1884
  /**
1872
- * Create and initialize a new mint for SPL/T22/c-token.
1885
+ * Create and initialize a new mint for SPL/T22/light-token.
1873
1886
  *
1874
1887
  * @param rpc RPC connection to use
1875
1888
  * @param payer Fee payer
1876
- * @param mintAuthority Account that will control minting (signer for c-token mints)
1889
+ * @param mintAuthority Account that will control minting (signer for light-token mints)
1877
1890
  * @param freezeAuthority Account that will control freeze and thaw (optional)
1878
1891
  * @param decimals Location of the decimal place
1879
1892
  * @param keypair Mint keypair (defaults to a random keypair)
1880
1893
  * @param confirmOptions Confirm options
1881
- * @param programId Token program ID (defaults to CTOKEN_PROGRAM_ID)
1882
- * @param tokenMetadata Optional token metadata (c-token mints only)
1883
- * @param outputStateTreeInfo Optional output state tree info (c-token mints only)
1884
- * @param addressTreeInfo Optional address tree info (c-token mints only)
1894
+ * @param programId Token program ID (defaults to LIGHT_TOKEN_PROGRAM_ID)
1895
+ * @param tokenMetadata Optional token metadata (light-token mints only)
1896
+ * @param outputStateTreeInfo Optional output state tree info (light-token mints only)
1897
+ * @param addressTreeInfo Optional address tree info (light-token mints only)
1885
1898
  *
1886
1899
  * @returns Object with mint address and transaction signature
1887
1900
  */
@@ -1891,7 +1904,8 @@ declare function createMintInterface(rpc: Rpc, payer: Signer, mintAuthority: Pub
1891
1904
  }>;
1892
1905
 
1893
1906
  /**
1894
- * Update the mint authority of a compressed token mint.
1907
+ * Update the mint authority of a light-token mint.
1908
+ * Works for both compressed and decompressed light mints.
1895
1909
  *
1896
1910
  * @param rpc RPC connection
1897
1911
  * @param payer Fee payer (signer)
@@ -1902,7 +1916,8 @@ declare function createMintInterface(rpc: Rpc, payer: Signer, mintAuthority: Pub
1902
1916
  */
1903
1917
  declare function updateMintAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, currentMintAuthority: Signer, newMintAuthority: PublicKey | null, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1904
1918
  /**
1905
- * Update the freeze authority of a compressed token mint.
1919
+ * Update the freeze authority of a light-token mint.
1920
+ * Works for both compressed and decompressed light mints.
1906
1921
  *
1907
1922
  * @param rpc RPC connection
1908
1923
  * @param payer Fee payer (signer)
@@ -1914,7 +1929,8 @@ declare function updateMintAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, c
1914
1929
  declare function updateFreezeAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, currentFreezeAuthority: Signer, newFreezeAuthority: PublicKey | null, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1915
1930
 
1916
1931
  /**
1917
- * Update a metadata field on a compressed token mint.
1932
+ * Update a metadata field on a light-token mint.
1933
+ * Works for both compressed and decompressed light mints.
1918
1934
  *
1919
1935
  * @param rpc RPC connection
1920
1936
  * @param payer Fee payer (signer)
@@ -1928,7 +1944,8 @@ declare function updateFreezeAuthority(rpc: Rpc, payer: Signer, mint: PublicKey,
1928
1944
  */
1929
1945
  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>;
1930
1946
  /**
1931
- * Update the metadata authority of a compressed token mint.
1947
+ * Update the metadata authority of a light-token mint.
1948
+ * Works for both compressed and decompressed light mints.
1932
1949
  *
1933
1950
  * @param rpc RPC connection
1934
1951
  * @param payer Fee payer (signer)
@@ -1940,7 +1957,8 @@ declare function updateMetadataField(rpc: Rpc, payer: Signer, mint: PublicKey, a
1940
1957
  */
1941
1958
  declare function updateMetadataAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, currentAuthority: Signer, newAuthority: PublicKey, extensionIndex?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1942
1959
  /**
1943
- * Remove a metadata key from a compressed token mint.
1960
+ * Remove a metadata key from a light-token mint.
1961
+ * Works for both compressed and decompressed light mints.
1944
1962
  *
1945
1963
  * @param rpc RPC connection
1946
1964
  * @param payer Fee payer (signer)
@@ -1954,8 +1972,8 @@ declare function updateMetadataAuthority(rpc: Rpc, payer: Signer, mint: PublicKe
1954
1972
  declare function removeMetadataKey(rpc: Rpc, payer: Signer, mint: PublicKey, authority: Signer, key: string, idempotent?: boolean, extensionIndex?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1955
1973
 
1956
1974
  /**
1957
- * Create an associated token account for SPL/T22/c-token. Defaults to c-token
1958
- * program.
1975
+ * Create an associated token account for SPL/T22/light-token. Defaults to
1976
+ * light-token program.
1959
1977
  *
1960
1978
  * @param rpc RPC connection
1961
1979
  * @param payer Fee payer and transaction signer
@@ -1964,16 +1982,16 @@ declare function removeMetadataKey(rpc: Rpc, payer: Signer, mint: PublicKey, aut
1964
1982
  * @param allowOwnerOffCurve Allow owner to be a PDA (default: false)
1965
1983
  * @param confirmOptions Options for confirming the transaction
1966
1984
  * @param programId Token program ID (default:
1967
- * CTOKEN_PROGRAM_ID)
1968
- * @param associatedTokenProgramId ATA program ID (auto-derived if not
1969
- * provided)
1970
- * @param ctokenConfig Optional rent config
1985
+ * LIGHT_TOKEN_PROGRAM_ID)
1986
+ * @param associatedTokenProgramId associated token account program ID
1987
+ * (auto-derived if not provided)
1988
+ * @param lightTokenConfig Optional rent config
1971
1989
  * @returns Address of the new associated token account
1972
1990
  */
1973
- declare function createAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey, ctokenConfig?: CTokenConfig): Promise<PublicKey>;
1991
+ declare function createAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey, lightTokenConfig?: LightTokenConfig): Promise<PublicKey>;
1974
1992
  /**
1975
- * Create an associated token account idempotently for SPL/T22/c-token. Defaults
1976
- * to c-token program.
1993
+ * Create an associated token account idempotently for SPL/T22/light-token.
1994
+ * Defaults to light-token program.
1977
1995
  *
1978
1996
  * If the account already exists, the instruction succeeds without error.
1979
1997
  *
@@ -1984,19 +2002,35 @@ declare function createAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, ow
1984
2002
  * @param allowOwnerOffCurve Allow owner to be a PDA (default: false)
1985
2003
  * @param confirmOptions Options for confirming the transaction
1986
2004
  * @param programId Token program ID (default:
1987
- * CTOKEN_PROGRAM_ID)
1988
- * @param associatedTokenProgramId ATA program ID (auto-derived if not
1989
- * provided)
1990
- * @param ctokenConfig Optional c-token-specific configuration
2005
+ * LIGHT_TOKEN_PROGRAM_ID)
2006
+ * @param associatedTokenProgramId associated token account program ID
2007
+ * (auto-derived if not provided)
2008
+ * @param lightTokenConfig Optional light-token-specific configuration
1991
2009
  *
1992
2010
  * @returns Address of the associated token account
1993
2011
  */
1994
- declare function createAtaInterfaceIdempotent(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey, ctokenConfig?: CTokenConfig): Promise<PublicKey>;
2012
+ declare function createAtaInterfaceIdempotent(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey, lightTokenConfig?: LightTokenConfig): Promise<PublicKey>;
1995
2013
 
1996
- declare function mintTo$1(rpc: Rpc, payer: Signer, mint: PublicKey, recipientAccount: PublicKey, authority: Signer, amount: number | bigint, outputQueue?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2014
+ /**
2015
+ * Mint tokens to a light-token account.
2016
+ *
2017
+ * This is a simple mint instruction for minting to light-token associated token accounts (hot).
2018
+ * The light mint account must exist (mint must be decompressed first).
2019
+ *
2020
+ * @param rpc - RPC connection
2021
+ * @param payer - Fee payer (signer)
2022
+ * @param mint - Mint address (light mint account)
2023
+ * @param destination - Destination light-token account
2024
+ * @param authority - Mint authority (signer)
2025
+ * @param amount - Amount to mint
2026
+ * @param maxTopUp - Optional maximum lamports for rent top-up
2027
+ * @param confirmOptions - Optional confirm options
2028
+ * @returns Transaction signature
2029
+ */
2030
+ declare function mintTo$1(rpc: Rpc, payer: Signer, mint: PublicKey, destination: PublicKey, authority: Signer, amount: number | bigint, maxTopUp?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1997
2031
 
1998
2032
  /**
1999
- * Mint compressed tokens directly to compressed accounts.
2033
+ * Mint light-tokens directly to compressed accounts.
2000
2034
  *
2001
2035
  * @param rpc RPC connection
2002
2036
  * @param payer Fee payer
@@ -2005,29 +2039,32 @@ declare function mintTo$1(rpc: Rpc, payer: Signer, mint: PublicKey, recipientAcc
2005
2039
  * @param recipients Array of recipients with amounts
2006
2040
  * @param outputStateTreeInfo Optional output state tree info (auto-fetched if not provided)
2007
2041
  * @param tokenAccountVersion Token account version (default: 3)
2042
+ * @param maxTopUp Optional: cap on rent top-up (units of 1k lamports; default no cap)
2008
2043
  * @param confirmOptions Optional confirm options
2009
2044
  */
2010
2045
  declare function mintToCompressed(rpc: Rpc, payer: Signer, mint: PublicKey, authority: Signer, recipients: Array<{
2011
2046
  recipient: PublicKey;
2012
2047
  amount: number | bigint;
2013
- }>, outputStateTreeInfo?: TreeInfo, tokenAccountVersion?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2048
+ }>, outputStateTreeInfo?: TreeInfo, tokenAccountVersion?: number, maxTopUp?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2014
2049
 
2015
2050
  /**
2016
2051
  * Mint tokens to a decompressed/onchain token account.
2017
- * Works with SPL, Token-2022, and compressed token (c-token) mints.
2052
+ * Works with SPL, Token-2022, and light-token mints.
2053
+ *
2054
+ * This function ONLY mints to light-token associated token accounts (hot), never to compressed light-token accounts (cold).
2055
+ * For light-token mints, the light mint account must exist (mint must be decompressed first).
2018
2056
  *
2019
- * This function ONLY mints to decompressed onchain token accounts, never to compressed accounts.
2020
2057
  * The signature matches the standard SPL mintTo for simplicity and consistency.
2021
2058
  *
2022
2059
  * @param rpc - RPC connection to use
2023
2060
  * @param payer - Transaction fee payer
2024
- * @param mint - Mint address (SPL, Token-2022, or compressed mint)
2061
+ * @param mint - Mint address (SPL, Token-2022, or light-token mint)
2025
2062
  * @param destination - Destination token account address (must be an existing onchain token account)
2026
2063
  * @param authority - Mint authority (can be Signer or PublicKey if multiSigners provided)
2027
2064
  * @param amount - Amount to mint
2028
2065
  * @param multiSigners - Optional: Multi-signature signers (default: [])
2029
2066
  * @param confirmOptions - Optional: Transaction confirmation options
2030
- * @param programId - Optional: Token program ID (TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, or CTOKEN_PROGRAM_ID). If undefined, auto-detects.
2067
+ * @param programId - Optional: Token program ID. If undefined, auto-detects.
2031
2068
  *
2032
2069
  * @returns Transaction signature
2033
2070
  */
@@ -2042,7 +2079,7 @@ declare function mintToInterface(rpc: Rpc, payer: Signer, mint: PublicKey, desti
2042
2079
  * @param mint Mint associated with the account to set or
2043
2080
  * verify.
2044
2081
  * @param owner Owner of the account. Pass Signer to
2045
- * auto-load cold (compressed) tokens, or
2082
+ * auto-load compressed light-tokens (cold balance), or
2046
2083
  * PublicKey for read-only.
2047
2084
  * @param allowOwnerOffCurve Allow the owner account to be a PDA (Program
2048
2085
  * Derived Address).
@@ -2050,7 +2087,7 @@ declare function mintToInterface(rpc: Rpc, payer: Signer, mint: PublicKey, desti
2050
2087
  * state.
2051
2088
  * @param confirmOptions Options for confirming the transaction
2052
2089
  * @param programId Token program ID (defaults to
2053
- * CTOKEN_PROGRAM_ID)
2090
+ * LIGHT_TOKEN_PROGRAM_ID)
2054
2091
  * @param associatedTokenProgramId Associated token program ID (auto-derived if
2055
2092
  * not provided)
2056
2093
  *
@@ -2059,48 +2096,31 @@ declare function mintToInterface(rpc: Rpc, payer: Signer, mint: PublicKey, desti
2059
2096
  declare function getOrCreateAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey | Signer, allowOwnerOffCurve?: boolean, commitment?: Commitment, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey): Promise<AccountInterface>;
2060
2097
 
2061
2098
  /**
2062
- * Decompress compressed (cold) tokens to an on-chain token account.
2063
- *
2064
- * For unified loading, use {@link loadAta} instead.
2065
- *
2066
- * @param rpc RPC connection
2067
- * @param payer Fee payer (signer)
2068
- * @param owner Owner of the compressed tokens (signer)
2069
- * @param mint Mint address
2070
- * @param amount Amount to decompress (defaults to all)
2071
- * @param destinationAta Destination token account address
2072
- * @param destinationOwner Owner of the destination ATA
2073
- * @param splInterfaceInfo SPL interface info for SPL/T22 destinations
2074
- * @param confirmOptions Confirm options
2075
- * @returns Transaction signature, null if nothing to load.
2076
- */
2077
- declare function decompressInterface(rpc: Rpc, payer: Signer, owner: Signer, mint: PublicKey, amount?: number | bigint | BN, destinationAta?: PublicKey, destinationOwner?: PublicKey, splInterfaceInfo?: SplInterfaceInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature | null>;
2078
-
2079
- /**
2080
- * Wrap tokens from an SPL/T22 account to a c-token account.
2099
+ * Wrap tokens from an SPL/T22 account to a light-token account.
2081
2100
  *
2082
2101
  * This is an agnostic action that takes explicit account addresses (spl-token style).
2083
- * Use getAssociatedTokenAddressSync() to derive ATA addresses if needed.
2102
+ * Use getAssociatedTokenAddressSync() to derive associated token account addresses if needed.
2084
2103
  *
2085
2104
  * @param rpc RPC connection
2086
2105
  * @param payer Fee payer
2087
- * @param source Source SPL/T22 token account (any token account, not just ATA)
2088
- * @param destination Destination c-token account
2106
+ * @param source Source SPL/T22 token account (any token account, not just associated token account)
2107
+ * @param destination Destination light-token account
2089
2108
  * @param owner Owner/authority of the source account (must sign)
2090
2109
  * @param mint Mint address
2091
2110
  * @param amount Amount to wrap
2092
2111
  * @param splInterfaceInfo Optional: SPL interface info (will be fetched if not provided)
2112
+ * @param maxTopUp Optional: cap on rent top-up (units of 1k lamports; default no cap)
2093
2113
  * @param confirmOptions Optional: Confirm options
2094
2114
  *
2095
2115
  * @example
2096
2116
  * const splAta = getAssociatedTokenAddressSync(mint, owner.publicKey, false, TOKEN_PROGRAM_ID);
2097
- * const ctokenAta = getAssociatedTokenAddressInterface(mint, owner.publicKey); // defaults to c-token
2117
+ * const lightTokenAta = getAssociatedTokenAddressInterface(mint, owner.publicKey); // defaults to light-token
2098
2118
  *
2099
2119
  * await wrap(
2100
2120
  * rpc,
2101
2121
  * payer,
2102
2122
  * splAta,
2103
- * ctokenAta,
2123
+ * lightTokenAta,
2104
2124
  * owner,
2105
2125
  * mint,
2106
2126
  * 1000n,
@@ -2108,34 +2128,16 @@ declare function decompressInterface(rpc: Rpc, payer: Signer, owner: Signer, min
2108
2128
  *
2109
2129
  * @returns Transaction signature
2110
2130
  */
2111
- declare function wrap(rpc: Rpc, payer: Signer, source: PublicKey, destination: PublicKey, owner: Signer, mint: PublicKey, amount: bigint, splInterfaceInfo?: SplInterfaceInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2131
+ declare function wrap(rpc: Rpc, payer: Signer, source: PublicKey, destination: PublicKey, owner: Signer, mint: PublicKey, amount: bigint, splInterfaceInfo?: SplInterfaceInfo, maxTopUp?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2112
2132
 
2113
2133
  /**
2114
- * Create instructions to load an ATA from its AccountInterface.
2115
- *
2116
- * Behavior depends on `wrap` parameter:
2117
- * - wrap=false (standard): Decompress compressed tokens to the target ATA type
2118
- * (SPL ATA via pool, T22 ATA via pool, or c-token ATA direct)
2119
- * - wrap=true (unified): Wrap SPL/T22 + decompress all to c-token ATA
2120
- *
2121
- * @param rpc RPC connection
2122
- * @param payer Fee payer
2123
- * @param ata AccountInterface from getAtaInterface (must have _isAta, _owner, _mint)
2124
- * @param options Optional load options
2125
- * @param wrap Unified mode: wrap SPL/T22 to c-token (default: false)
2126
- * @param targetAta Target ATA address (used for type detection in standard mode)
2127
- * @returns Array of instructions (empty if nothing to load)
2128
- */
2129
- declare function createLoadAtaInstructionsFromInterface(rpc: Rpc, payer: PublicKey, ata: AccountInterface, options?: InterfaceOptions, wrap?: boolean, targetAta?: PublicKey): Promise<TransactionInstruction[]>;
2130
-
2131
- /**
2132
- * Derive the canonical associated token address for any of SPL/T22/c-token.
2133
- * Defaults to using c-token as the canonical ATA.
2134
+ * Derive the canonical associated token address for any of SPL/T22/light-token.
2135
+ * Defaults to using light-token as the canonical associated token account.
2134
2136
  *
2135
2137
  * @param mint Mint public key
2136
2138
  * @param owner Owner public key
2137
2139
  * @param allowOwnerOffCurve Allow owner to be a PDA. Default false.
2138
- * @param programId Token program ID. Default c-token.
2140
+ * @param programId Token program ID. Default light-token.
2139
2141
  *
2140
2142
  * @param associatedTokenProgramId Associated token program ID. Default
2141
2143
  * auto-detected.
@@ -2191,7 +2193,7 @@ interface OffChainTokenMetadataJson {
2191
2193
  * const metadataJson = toOffChainMetadataJson({
2192
2194
  * name: 'My Token',
2193
2195
  * symbol: 'MTK',
2194
- * description: 'A compressed token',
2196
+ * description: 'A light-token',
2195
2197
  * image: 'https://example.com/image.png',
2196
2198
  * });
2197
2199
  * const uri = await umi.uploader.uploadJson(metadataJson);
@@ -2373,9 +2375,13 @@ declare function decompress(rpc: Rpc, payer: Signer, mint: PublicKey, amount: nu
2373
2375
 
2374
2376
  /**
2375
2377
  * Merge multiple compressed token accounts for a given mint into fewer
2376
- * accounts. Each call merges up to 4 accounts (V1) or 8 accounts (V2) at a
2377
- * time. Call repeatedly until only 1 account remains if full consolidation
2378
- * is needed.
2378
+ * accounts. Each call merges up to 4 accounts at a time.
2379
+ *
2380
+ * Supports automatic V1 -> V2 migration: when running in V2 mode,
2381
+ * merging V1 token accounts will produce a V2 output.
2382
+ *
2383
+ * IMPORTANT: Only accounts from the same tree type can be merged in one
2384
+ * transaction. If you have mixed V1+V2 accounts, merge them separately.
2379
2385
  *
2380
2386
  * @param rpc RPC connection to use
2381
2387
  * @param payer Fee payer
@@ -2415,6 +2421,7 @@ declare function mintTo(rpc: Rpc, payer: Signer, mint: PublicKey, toPubkey: Publ
2415
2421
  * @param rpc Rpc connection to use
2416
2422
  * @param payer Fee payer
2417
2423
  * @param accounts Delegated compressed token accounts to revoke
2424
+ * (must all be from the same tree type)
2418
2425
  * @param owner Owner of the compressed tokens
2419
2426
  * @param confirmOptions Options for confirming the transaction
2420
2427
  *
@@ -2423,7 +2430,10 @@ declare function mintTo(rpc: Rpc, payer: Signer, mint: PublicKey, toPubkey: Publ
2423
2430
  declare function revoke(rpc: Rpc, payer: Signer, accounts: ParsedTokenAccount[], owner: Signer, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2424
2431
 
2425
2432
  /**
2426
- * Transfer compressed tokens from one owner to another
2433
+ * Transfer compressed tokens from one owner to another.
2434
+ *
2435
+ * Supports automatic V1 -> V2 migration: when running in V2 mode,
2436
+ * V1 token inputs will produce V2 token outputs.
2427
2437
  *
2428
2438
  * @param rpc Rpc connection to use
2429
2439
  * @param payer Fee payer
@@ -2471,12 +2481,54 @@ declare function transferDelegated(rpc: Rpc, payer: Signer, mint: PublicKey, amo
2471
2481
  declare function decompressDelegated(rpc: Rpc, payer: Signer, mint: PublicKey, amount: number | BN, owner: Signer, toAddress: PublicKey, splInterfaceInfos?: SplInterfaceInfo[], confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2472
2482
 
2473
2483
  declare const ERROR_NO_ACCOUNTS_FOUND = "Could not find accounts to select for transfer.";
2484
+ declare const ERROR_MIXED_TREE_TYPES = "Cannot select accounts from different tree types (V1/V2) in the same batch. Filter accounts by tree type first.";
2485
+ /**
2486
+ * Options for input account selection
2487
+ */
2488
+ interface SelectInputAccountsOptions {
2489
+ /**
2490
+ * Filter accounts by tree type. If provided, only accounts in trees of
2491
+ * this type will be selected. This prevents mixed V1/V2 batches which
2492
+ * fail at proof generation.
2493
+ */
2494
+ treeType?: TreeType;
2495
+ }
2496
+ /**
2497
+ * Groups accounts by tree type for separate processing
2498
+ */
2499
+ declare function groupAccountsByTreeType(accounts: ParsedTokenAccount[]): Map<TreeType, ParsedTokenAccount[]>;
2500
+ /**
2501
+ * Result of selectAccountsByPreferredTreeType
2502
+ */
2503
+ interface SelectedAccountsResult {
2504
+ /** The selected accounts (all from the same tree type) */
2505
+ accounts: ParsedTokenAccount[];
2506
+ /** The tree type of the selected accounts */
2507
+ treeType: TreeType;
2508
+ /** Total balance of selected accounts */
2509
+ totalBalance: BN;
2510
+ }
2511
+ /**
2512
+ * Selects accounts by preferred tree type with automatic fallback.
2513
+ *
2514
+ * In V2 mode, prefers StateV2 accounts. Falls back to StateV1 if V2
2515
+ * has insufficient balance.
2516
+ *
2517
+ * This ensures all returned accounts are from the same tree type,
2518
+ * preventing mixed V1/V2 batch proof failures.
2519
+ *
2520
+ * @param accounts All available accounts (can be mixed V1/V2)
2521
+ * @param requiredAmount Minimum amount needed (optional - if not provided, returns all from preferred type)
2522
+ * @returns Selected accounts from a single tree type
2523
+ */
2524
+ declare function selectAccountsByPreferredTreeType(accounts: ParsedTokenAccount[], requiredAmount?: BN): SelectedAccountsResult;
2474
2525
  /**
2475
2526
  * Selects token accounts for approval, first trying to find an exact match, then falling back to minimum selection.
2476
2527
  *
2477
2528
  * @param {ParsedTokenAccount[]} accounts - Token accounts to choose from.
2478
2529
  * @param {BN} approveAmount - Amount to approve.
2479
2530
  * @param {number} [maxInputs=4] - Max accounts to select when falling back to minimum selection.
2531
+ * @param {SelectInputAccountsOptions} [options] - Optional selection options.
2480
2532
  * @returns {[
2481
2533
  * selectedAccounts: ParsedTokenAccount[],
2482
2534
  * total: BN,
@@ -2488,7 +2540,7 @@ declare const ERROR_NO_ACCOUNTS_FOUND = "Could not find accounts to select for t
2488
2540
  * - totalLamports: Total lamports from selected accounts.
2489
2541
  * - maxPossibleAmount: Max approvable amount given maxInputs.
2490
2542
  */
2491
- declare function selectTokenAccountsForApprove(accounts: ParsedTokenAccount[], approveAmount: BN, maxInputs?: number): [
2543
+ declare function selectTokenAccountsForApprove(accounts: ParsedTokenAccount[], approveAmount: BN, maxInputs?: number, options?: SelectInputAccountsOptions): [
2492
2544
  selectedAccounts: ParsedTokenAccount[],
2493
2545
  total: BN,
2494
2546
  totalLamports: BN | null,
@@ -2502,10 +2554,11 @@ declare function selectTokenAccountsForApprove(accounts: ParsedTokenAccount[], a
2502
2554
  * @param {BN} amount Amount to decompress.
2503
2555
  * @param {number} [maxInputs=4] Max accounts to select. Default
2504
2556
  * is 4.
2557
+ * @param {SelectInputAccountsOptions} [options] - Optional selection options.
2505
2558
  *
2506
2559
  * @returns Returns selected accounts and their totals.
2507
2560
  */
2508
- declare function selectMinCompressedTokenAccountsForDecompression(accounts: ParsedTokenAccount[], amount: BN, maxInputs?: number): {
2561
+ declare function selectMinCompressedTokenAccountsForDecompression(accounts: ParsedTokenAccount[], amount: BN, maxInputs?: number, options?: SelectInputAccountsOptions): {
2509
2562
  selectedAccounts: ParsedTokenAccount[];
2510
2563
  total: BN;
2511
2564
  totalLamports: BN | null;
@@ -2519,6 +2572,8 @@ declare function selectMinCompressedTokenAccountsForDecompression(accounts: Pars
2519
2572
  * @param {BN} transferAmount Amount to transfer or decompress.
2520
2573
  * @param {number} [maxInputs=4] Max accounts to select. Default
2521
2574
  * is 4.
2575
+ * @param {SelectInputAccountsOptions} [options] - Optional selection options.
2576
+ * Use treeType to filter by V1/V2.
2522
2577
  *
2523
2578
  * @returns Returns selected accounts and their totals. [
2524
2579
  * selectedAccounts: ParsedTokenAccount[],
@@ -2527,7 +2582,7 @@ declare function selectMinCompressedTokenAccountsForDecompression(accounts: Pars
2527
2582
  * maxPossibleAmount: BN
2528
2583
  * ]
2529
2584
  */
2530
- declare function selectMinCompressedTokenAccountsForTransfer(accounts: ParsedTokenAccount[], transferAmount: BN, maxInputs?: number): [
2585
+ declare function selectMinCompressedTokenAccountsForTransfer(accounts: ParsedTokenAccount[], transferAmount: BN, maxInputs?: number, options?: SelectInputAccountsOptions): [
2531
2586
  selectedAccounts: ParsedTokenAccount[],
2532
2587
  total: BN,
2533
2588
  totalLamports: BN | null,
@@ -2555,6 +2610,8 @@ declare function selectMinCompressedTokenAccountsForTransferOrPartial(accounts:
2555
2610
  * @param {ParsedTokenAccount[]} accounts - The list of token accounts to select from.
2556
2611
  * @param {BN} transferAmount - The token amount to be transferred.
2557
2612
  * @param {number} [maxInputs=4] - The maximum number of accounts to select. Default: 4.
2613
+ * @param {SelectInputAccountsOptions} [options] - Optional selection options.
2614
+ * Use treeType to filter by V1/V2.
2558
2615
  * @returns {[
2559
2616
  * selectedAccounts: ParsedTokenAccount[],
2560
2617
  * total: BN,
@@ -2583,7 +2640,7 @@ declare function selectMinCompressedTokenAccountsForTransferOrPartial(accounts:
2583
2640
  * console.log(totalLamports!.toString()); // '15'
2584
2641
  * console.log(maxPossibleAmount.toString()); // '150'
2585
2642
  */
2586
- declare function selectSmartCompressedTokenAccountsForTransfer(accounts: ParsedTokenAccount[], transferAmount: BN, maxInputs?: number): [
2643
+ declare function selectSmartCompressedTokenAccountsForTransfer(accounts: ParsedTokenAccount[], transferAmount: BN, maxInputs?: number, options?: SelectInputAccountsOptions): [
2587
2644
  selectedAccounts: ParsedTokenAccount[],
2588
2645
  total: BN,
2589
2646
  totalLamports: BN | null,
@@ -2765,9 +2822,9 @@ type PackCompressedTokenAccountsParams = {
2765
2822
  /** Input state to be consumed */
2766
2823
  inputCompressedTokenAccounts: ParsedTokenAccount[];
2767
2824
  /**
2768
- * State trees that the output should be inserted into. Defaults to the 0th
2769
- * state tree of the input state. Gets padded to the length of
2770
- * outputCompressedAccounts.
2825
+ * Output state tree. Required for mint/compress (no inputs).
2826
+ * For transfer/merge with V1 inputs: pass a V2 tree for migration.
2827
+ * If not provided with inputs, uses input tree.
2771
2828
  */
2772
2829
  outputStateTreeInfo?: TreeInfo;
2773
2830
  /** Optional remaining accounts to append to */
@@ -5175,14 +5232,14 @@ declare class CompressedTokenProgram {
5175
5232
  * @param mintSize Optional: mint size. Default: MINT_SIZE
5176
5233
  *
5177
5234
  * @returns [createMintAccountInstruction, initializeMintInstruction,
5178
- * createTokenPoolInstruction]
5235
+ * createSplInterfaceInstruction]
5179
5236
  *
5180
- * Note that `createTokenPoolInstruction` must be executed after
5237
+ * Note that `createSplInterfaceInstruction` must be executed after
5181
5238
  * `initializeMintInstruction`.
5182
5239
  */
5183
5240
  static createMint({ feePayer, mint, authority, freezeAuthority, decimals, rentExemptBalance, tokenProgramId, mintSize, }: CreateMintParams): Promise<TransactionInstruction[]>;
5184
5241
  /**
5185
- * Enable compression for an existing SPL mint, creating an omnibus account.
5242
+ * Create SPL interface (omnibus account) for an existing SPL mint.
5186
5243
  * For new mints, use `CompressedTokenProgram.createMint`.
5187
5244
  *
5188
5245
  * @param feePayer Fee payer.
@@ -5190,12 +5247,16 @@ declare class CompressedTokenProgram {
5190
5247
  * @param tokenProgramId Optional: Token program ID. Default: SPL
5191
5248
  * Token Program ID
5192
5249
  *
5193
- * @returns The createTokenPool instruction
5250
+ * @returns The createSplInterface instruction
5194
5251
  */
5195
- static createTokenPool({ feePayer, mint, tokenProgramId, }: CreateSplInterfaceParams): Promise<TransactionInstruction>;
5252
+ static createSplInterface({ feePayer, mint, tokenProgramId, }: CreateSplInterfaceParams): Promise<TransactionInstruction>;
5253
+ /**
5254
+ * @deprecated Use {@link createSplInterface} instead.
5255
+ */
5256
+ static createTokenPool(params: CreateSplInterfaceParams): Promise<TransactionInstruction>;
5196
5257
  /**
5197
5258
  * Add a token pool to an existing SPL mint. For new mints, use
5198
- * {@link createTokenPool}.
5259
+ * {@link createSplInterface}.
5199
5260
  *
5200
5261
  * @param feePayer Fee payer.
5201
5262
  * @param mint SPL Mint address.
@@ -5237,7 +5298,9 @@ declare class CompressedTokenProgram {
5237
5298
  */
5238
5299
  static approveAndMintTo({ feePayer, mint, authority, authorityTokenAccount, toPubkey, amount, outputStateTreeInfo, tokenPoolInfo, }: ApproveAndMintToParams): Promise<TransactionInstruction[]>;
5239
5300
  /**
5240
- * Construct transfer instruction for compressed tokens
5301
+ * Construct transfer instruction for compressed tokens.
5302
+ *
5303
+ * V1 inputs automatically migrate to V2 outputs when in V2 mode.
5241
5304
  *
5242
5305
  * @param payer Fee payer.
5243
5306
  * @param inputCompressedTokenAccounts Source compressed token accounts.
@@ -5296,7 +5359,7 @@ declare class CompressedTokenProgram {
5296
5359
  */
5297
5360
  static decompress({ payer, inputCompressedTokenAccounts, toAddress, amount, recentValidityProof, recentInputStateRootIndices, tokenPoolInfos, }: DecompressParams): Promise<TransactionInstruction>;
5298
5361
  /**
5299
- * Create `mergeTokenAccounts` instruction
5362
+ * Create `mergeTokenAccounts` instruction.
5300
5363
  *
5301
5364
  * @param payer Fee payer.
5302
5365
  * @param owner Owner of the compressed token
@@ -5305,7 +5368,6 @@ declare class CompressedTokenProgram {
5305
5368
  * @param mint SPL Token mint address.
5306
5369
  * @param recentValidityProof Recent validity proof.
5307
5370
  * @param recentInputStateRootIndices Recent state root indices.
5308
- *
5309
5371
  * @returns instruction
5310
5372
  */
5311
5373
  static mergeTokenAccounts({ payer, owner, inputCompressedTokenAccounts, mint, recentValidityProof, recentInputStateRootIndices, }: MergeTokenAccountsParams): Promise<TransactionInstruction[]>;
@@ -5358,6 +5420,36 @@ declare class CompressedTokenProgram {
5358
5420
  static revoke({ payer, inputCompressedTokenAccounts, recentValidityProof, recentInputStateRootIndices, }: RevokeParams): Promise<TransactionInstruction>;
5359
5421
  }
5360
5422
 
5423
+ /** Solana maximum transaction size in bytes. */
5424
+ declare const MAX_TRANSACTION_SIZE = 1232;
5425
+ /**
5426
+ * Conservative size budget for a combined batch (load + transfer + ATA).
5427
+ * Leaves headroom below MAX_TRANSACTION_SIZE for edge-case key counts.
5428
+ */
5429
+ declare const MAX_COMBINED_BATCH_BYTES = 900;
5430
+ /**
5431
+ * Conservative size budget for a load-only or setup-only batch.
5432
+ */
5433
+ declare const MAX_LOAD_ONLY_BATCH_BYTES = 1000;
5434
+ /**
5435
+ * Estimate the serialized byte size of a V0 VersionedTransaction built from
5436
+ * the given instructions and signer count.
5437
+ *
5438
+ * The estimate accounts for Solana's account-key deduplication: all unique
5439
+ * pubkeys across every instruction (keys + programIds) are collected into a
5440
+ * single set, matching the behaviour of
5441
+ * `TransactionMessage.compileToV0Message`.
5442
+ *
5443
+ * This intentionally does NOT use address lookup tables, so the result is an
5444
+ * upper bound. If lookup tables are used at send time the actual size will be
5445
+ * smaller.
5446
+ *
5447
+ * @param instructions The instructions that will be included in the tx.
5448
+ * @param numSigners Number of signers (determines signature count).
5449
+ * @returns Estimated byte size of the serialized transaction.
5450
+ */
5451
+ declare function estimateTransactionSize(instructions: TransactionInstruction[], numSigners: number): number;
5452
+
5361
5453
  /**
5362
5454
  * Retrieve associated token account for a given owner and mint.
5363
5455
  *
@@ -5371,19 +5463,20 @@ declare class CompressedTokenProgram {
5371
5463
  */
5372
5464
  declare function getAtaInterface(rpc: Rpc, ata: PublicKey, owner: PublicKey, mint: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<AccountInterface>;
5373
5465
  /**
5374
- * Create instructions to load token balances into a c-token ATA.
5466
+ * Create instruction batches for loading token balances into an ATA.
5467
+ * Returns batches of instructions, each batch is one transaction.
5375
5468
  *
5376
- * @param rpc RPC connection
5377
- * @param ata Associated token address
5378
- * @param owner Owner public key
5379
- * @param mint Mint public key
5380
- * @param payer Fee payer (defaults to owner)
5381
- * @param options Optional load options
5382
- * @returns Array of instructions (empty if nothing to load)
5469
+ * @param rpc RPC connection
5470
+ * @param ata Associated token address
5471
+ * @param owner Owner public key
5472
+ * @param mint Mint public key
5473
+ * @param payer Fee payer (defaults to owner)
5474
+ * @param options Optional load options
5475
+ * @returns Instruction batches - each inner array is one transaction
5383
5476
  */
5384
- declare function createLoadAtaInstructions(rpc: Rpc, ata: PublicKey, owner: PublicKey, mint: PublicKey, payer?: PublicKey, options?: InterfaceOptions): Promise<TransactionInstruction[]>;
5477
+ declare function createLoadAtaInstructions(rpc: Rpc, ata: PublicKey, owner: PublicKey, mint: PublicKey, payer?: PublicKey, options?: InterfaceOptions): Promise<TransactionInstruction[][]>;
5385
5478
  /**
5386
- * Load token balances into a c-token ATA.
5479
+ * Load token balances into a light-token ATA.
5387
5480
  *
5388
5481
  * @param rpc RPC connection
5389
5482
  * @param ata Associated token address
@@ -5394,6 +5487,6 @@ declare function createLoadAtaInstructions(rpc: Rpc, ata: PublicKey, owner: Publ
5394
5487
  * @param interfaceOptions Optional interface options
5395
5488
  * @returns Transaction signature, or null if nothing to load
5396
5489
  */
5397
- declare function loadAta(rpc: Rpc, ata: PublicKey, owner: Signer, mint: PublicKey, payer?: Signer, confirmOptions?: ConfirmOptions, interfaceOptions?: InterfaceOptions): Promise<TransactionSignature | null>;
5490
+ declare function loadAta(rpc: Rpc, ata: PublicKey, owner: Signer, mint: PublicKey, payer?: Signer, confirmOptions?: ConfirmOptions, interfaceOptions?: InterfaceOptions, decimals?: number): Promise<TransactionSignature | null>;
5398
5491
 
5399
- export { ADD_TOKEN_POOL_DISCRIMINATOR, APPROVE_DISCRIMINATOR, type AccountInterface, Action, type AddSplInterfaceParams, type AddTokenPoolParams, type ApproveAndMintToParams, type ApproveParams, BATCH_COMPRESS_DISCRIMINATOR, type BaseMint, type BatchCompressInstructionData, 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, type DecompressParams, type DelegatedTransfer, DelegatedTransferLayout, ERROR_NO_ACCOUNTS_FOUND, ExtensionType, IDL, type InputTokenDataWithContext, type InterfaceOptions, 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, REVOKE_DISCRIMINATOR, type RevokeParams, SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE, type SplInterfaceActivity, type SplInterfaceInfo, 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, 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, createUpdateFreezeAuthorityInstruction, createUpdateMetadataAuthorityInstruction, createUpdateMetadataFieldInstruction, createUpdateMintAuthorityInstruction, createWrapInstruction, decodeApproveInstructionData, decodeBatchCompressInstructionData, decodeCompressSplTokenAccountInstructionData, decodeMintToInstructionData, decodeRevokeInstructionData, decodeTokenMetadata, decodeTransferInstructionData, decompress, decompressDelegated, decompressInterface, deriveSplInterfaceInfo, deriveTokenPoolInfo, deserializeMint, encodeApproveInstructionData, encodeBatchCompressInstructionData, encodeCompressSplTokenAccountInstructionData, encodeMintToInstructionData, encodeRevokeInstructionData, encodeTokenMetadata, encodeTransferInstructionData, extractTokenMetadata, freezeAccountsLayout, type freezeAccountsLayoutParams, getAccountInterface, getAssociatedTokenAddressInterface, getAtaInterface, getMintInterface, getOrCreateAtaInterface, getSplInterfaceInfos, getTokenPoolInfos, isSingleSplInterfaceInfo, isSingleTokenPoolInfo, loadAta, mergeTokenAccounts, mintTo, mintToAccountsLayout, type mintToAccountsLayoutParams, mintTo$1 as mintToCToken, mintToCompressed, mintToInterface, mintToLayout, packCompressedTokenAccounts, parseCTokenCold, parseCTokenHot, parseMaybeDelegatedTransfer, parseTokenData, removeMetadataKey, revoke, revokeAccountsLayout, type revokeAccountsLayoutParams, 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, updateFreezeAuthority, updateMetadataAuthority, updateMetadataField, updateMintAuthority, validateSameTokenOwner, wrap };
5492
+ 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, COMPRESSIBLE_LIGHT_TOKEN_ACCOUNT_SIZE, COMPRESSIBLE_LIGHT_TOKEN_RENT_PER_EPOCH, COMPRESSION_COST, COMPRESSION_INCENTIVE, COMPRESS_SPL_TOKEN_ACCOUNT_DISCRIMINATOR, CPI_AUTHORITY_SEED, CREATE_TOKEN_POOL_DISCRIMINATOR, type CompressParams, type CompressSplTokenAccountInstructionData, type CompressSplTokenAccountParams, type CompressedMint, type CompressedTokenInstructionDataApprove, CompressedTokenInstructionDataApproveLayout, type CompressedTokenInstructionDataRevoke, CompressedTokenInstructionDataRevokeLayout, type CompressedTokenInstructionDataTransfer, CompressedTokenInstructionDataTransferLayout, CompressedTokenProgram, type CompressibleConfig, CpiContextLayout, type CreateAssociatedLightTokenAccountParams, type CreateMintParams, type CreateSplInterfaceParams, type CreateTokenPoolParams, type CreateTokenProgramLookupTableParams, 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 LightTokenConfig, CompressedTokenProgram as LightTokenProgram, MAX_COMBINED_BATCH_BYTES, MAX_LOAD_ONLY_BATCH_BYTES, MAX_TOP_UP, MAX_TRANSACTION_SIZE, MINT_TO_DISCRIMINATOR, type MergeTokenAccountsParams, type MintContext, type MintExtension, type MintInterface, type MintToInstructionData, type MintToParams, type OffChainTokenMetadata, type OffChainTokenMetadataJson, POOL_SEED, type PackCompressedTokenAccountsParams, type PackedTokenTransferOutputData, 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, calculateFeePayerCostAtCreation, checkMint, checkSplInterfaceInfo, checkTokenPoolInfo, compress, compressSplTokenAccount, compressSplTokenAccountInstructionDataLayout, convertTokenDataToAccount, createAssociatedLightTokenAccountIdempotentInstruction, createAssociatedLightTokenAccountInstruction, createAssociatedTokenAccountInterfaceIdempotentInstruction, createAssociatedTokenAccountInterfaceInstruction, createAtaInterface, createAtaInterfaceIdempotent, createAtaInterfaceIdempotentInstruction, createDecompressOutputState, createLightTokenFreezeAccountInstruction, createLightTokenThawAccountInstruction, createLightTokenTransferCheckedInstruction, createLightTokenTransferInstruction, createLoadAtaInstructions, 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, deriveSplInterfaceInfo, deriveTokenPoolInfo, deserializeMint, encodeApproveInstructionData, encodeBatchCompressInstructionData, encodeCompressSplTokenAccountInstructionData, encodeMintToInstructionData, encodeRevokeInstructionData, encodeTokenMetadata, encodeTransferInstructionData, estimateTransactionSize, extractTokenMetadata, freezeAccountsLayout, type freezeAccountsLayoutParams, getAccountInterface, getAssociatedTokenAddressInterface, getAtaInterface, getMintInterface, getOrCreateAtaInterface, getSplInterfaceInfos, getTokenPoolInfos, groupAccountsByTreeType, isSingleSplInterfaceInfo, isSingleTokenPoolInfo, loadAta, mergeTokenAccounts, mintTo, mintToAccountsLayout, type mintToAccountsLayoutParams, mintToCompressed, mintToInterface, mintToLayout, mintTo$1 as mintToLightToken, packCompressedTokenAccounts, parseLightTokenCold, parseLightTokenHot, parseMaybeDelegatedTransfer, parseTokenData, removeMetadataKey, rentPerEpoch, revoke, revokeAccountsLayout, type revokeAccountsLayoutParams, selectAccountsByPreferredTreeType, selectInputsForAmount, 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, updateFreezeAuthority, updateMetadataAuthority, updateMetadataField, updateMintAuthority, validateSameTokenOwner, wrap };