@lightprotocol/compressed-token 0.23.0-beta.1 → 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.
- package/dist/cjs/browser/index.cjs +1 -1
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/browser/types-Csty9bc2.cjs +2 -0
- package/dist/cjs/browser/types-Csty9bc2.cjs.map +1 -0
- package/dist/cjs/browser/unified/index.cjs +1 -1
- package/dist/cjs/browser/unified/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs +1 -1
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/cjs/node/types-DgmOPYyc.cjs +2 -0
- package/dist/cjs/node/types-DgmOPYyc.cjs.map +1 -0
- package/dist/cjs/node/unified/index.cjs +1 -1
- package/dist/cjs/node/unified/index.cjs.map +1 -1
- package/dist/es/browser/index.js +1 -1
- package/dist/es/browser/index.js.map +1 -1
- package/dist/es/browser/types-e_5LjLhR.js +2 -0
- package/dist/es/browser/types-e_5LjLhR.js.map +1 -0
- package/dist/es/browser/unified/index.js +1 -1
- package/dist/es/browser/unified/index.js.map +1 -1
- package/dist/types/index.d.ts +498 -461
- package/dist/types/unified/index.d.ts +718 -664
- package/package.json +17 -11
- package/dist/cjs/browser/types-BYVvBJS4.cjs +0 -2
- package/dist/cjs/browser/types-BYVvBJS4.cjs.map +0 -1
- package/dist/cjs/node/types-C6bFjLLI.cjs +0 -2
- package/dist/cjs/node/types-C6bFjLLI.cjs.map +0 -1
- package/dist/es/browser/types-Z2gqWJ9V.js +0 -2
- package/dist/es/browser/types-Z2gqWJ9V.js.map +0 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { PublicKey, TransactionInstruction, Commitment, AccountInfo, Signer, ConfirmOptions, TransactionSignature,
|
|
3
|
-
import { ValidityProofWithContext, AddressTreeInfo, TreeInfo, MerkleContext, Rpc,
|
|
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
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
485
|
+
* @returns The deserialized light mint
|
|
485
486
|
*/
|
|
486
487
|
declare function deserializeMint(data: Buffer$1 | Uint8Array): CompressedMint;
|
|
487
488
|
/**
|
|
488
|
-
* Serialize a
|
|
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
|
|
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
|
|
555
|
+
/** Compression info for light-token mints */
|
|
555
556
|
compression?: CompressionInfo;
|
|
556
557
|
}
|
|
557
558
|
/**
|
|
558
|
-
* Get unified mint info for SPL/T22/
|
|
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/
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
674
|
-
|
|
675
|
-
compressibleConfig?: CompressibleConfig;
|
|
680
|
+
interface CreateAssociatedLightTokenAccountParams {
|
|
681
|
+
compressibleConfig?: CompressibleConfig | null;
|
|
676
682
|
}
|
|
677
683
|
/**
|
|
678
|
-
*
|
|
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
|
|
684
|
-
* @param configAccount
|
|
685
|
-
* @param rentPayerPda
|
|
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
|
|
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
|
|
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
|
|
695
|
-
* @param configAccount
|
|
696
|
-
* @param rentPayerPda
|
|
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
|
|
738
|
+
declare function createAssociatedLightTokenAccountIdempotentInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig | null, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
|
|
699
739
|
|
|
700
740
|
/**
|
|
701
|
-
*
|
|
741
|
+
* light-token-specific config for createAssociatedTokenAccountInterfaceInstruction
|
|
702
742
|
*/
|
|
703
|
-
interface
|
|
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
|
|
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
|
|
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,
|
|
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
|
|
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
|
|
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,
|
|
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
|
|
1635
|
+
* Create a light-token transfer instruction.
|
|
1616
1636
|
*
|
|
1617
|
-
*
|
|
1618
|
-
*
|
|
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
|
|
1622
|
-
* @param
|
|
1623
|
-
* @param
|
|
1624
|
-
* @param amount
|
|
1625
|
-
* @param
|
|
1626
|
-
* @
|
|
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
|
|
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
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
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
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
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
|
-
|
|
1667
|
-
declare function
|
|
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
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
/**
|
|
1676
|
-
|
|
1677
|
-
/**
|
|
1678
|
-
|
|
1679
|
-
|
|
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
|
-
*
|
|
1689
|
+
* Create instruction for minting tokens to a light-token account.
|
|
1693
1690
|
*
|
|
1694
|
-
*
|
|
1695
|
-
*
|
|
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
|
-
* @
|
|
1694
|
+
* @param params - Mint instruction parameters
|
|
1695
|
+
* @returns TransactionInstruction for minting tokens
|
|
1700
1696
|
*/
|
|
1701
|
-
declare function
|
|
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
|
-
*
|
|
1704
|
+
* Token data version enum - mirrors Rust TokenDataVersion
|
|
1705
|
+
* Used for compressed token account hashing strategy
|
|
1705
1706
|
*/
|
|
1706
|
-
|
|
1707
|
-
/**
|
|
1708
|
-
|
|
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
|
-
*
|
|
1712
|
-
*
|
|
1713
|
-
* Matches
|
|
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
|
|
1729
|
-
|
|
1731
|
+
declare const MAX_TOP_UP = 65535;
|
|
1730
1732
|
/**
|
|
1731
|
-
*
|
|
1732
|
-
*
|
|
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
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
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
|
-
*
|
|
1744
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
1755
|
+
* Calculate rent per epoch for a given account size.
|
|
1756
|
+
* Formula: base_rent + (bytes * lamports_per_byte_per_epoch)
|
|
1768
1757
|
*/
|
|
1769
|
-
|
|
1770
|
-
[key: string]: unknown;
|
|
1771
|
-
merkleContext: {
|
|
1772
|
-
merkleTreePubkeyIndex: number;
|
|
1773
|
-
queuePubkeyIndex: number;
|
|
1774
|
-
};
|
|
1775
|
-
}
|
|
1758
|
+
declare function rentPerEpoch(bytes: number): number;
|
|
1776
1759
|
/**
|
|
1777
|
-
*
|
|
1760
|
+
* Default rent per epoch for a compressible light token account (272 bytes).
|
|
1761
|
+
* = 128 + 272 = 400 lamports
|
|
1778
1762
|
*/
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
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
|
-
*
|
|
1769
|
+
* Calculate fee payer cost at ATA creation.
|
|
1770
|
+
* = compression_cost (11K) + (prepay_epochs * rent_per_epoch)
|
|
1793
1771
|
*/
|
|
1794
|
-
|
|
1795
|
-
|
|
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
|
|
1802
|
-
*
|
|
1803
|
-
*
|
|
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
|
-
*
|
|
1836
|
-
*
|
|
1837
|
-
*
|
|
1838
|
-
*
|
|
1839
|
-
*
|
|
1840
|
-
*
|
|
1841
|
-
*
|
|
1842
|
-
*
|
|
1843
|
-
*
|
|
1844
|
-
*
|
|
1845
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
1814
|
+
* light-token account.
|
|
1858
1815
|
*
|
|
1859
1816
|
* @param source Source SPL/T22 token account
|
|
1860
|
-
* @param destination Destination
|
|
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;
|
|
1870
1828
|
|
|
1871
1829
|
/**
|
|
1872
|
-
* Create
|
|
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;
|
|
1883
|
+
|
|
1884
|
+
/**
|
|
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
|
|
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
|
|
1882
|
-
* @param tokenMetadata Optional token metadata (
|
|
1883
|
-
* @param outputStateTreeInfo Optional output state tree info (
|
|
1884
|
-
* @param addressTreeInfo Optional address tree info (
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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/
|
|
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
|
-
*
|
|
1968
|
-
* @param associatedTokenProgramId
|
|
1969
|
-
* provided)
|
|
1970
|
-
* @param
|
|
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,
|
|
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/
|
|
1976
|
-
* to
|
|
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
|
-
*
|
|
1988
|
-
* @param associatedTokenProgramId
|
|
1989
|
-
* provided)
|
|
1990
|
-
* @param
|
|
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,
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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
|
|
2088
|
-
* @param destination Destination
|
|
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
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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
|
|
2196
|
+
* description: 'A light-token',
|
|
2195
2197
|
* image: 'https://example.com/image.png',
|
|
2196
2198
|
* });
|
|
2197
2199
|
* const uri = await umi.uploader.uploadJson(metadataJson);
|
|
@@ -5230,14 +5232,14 @@ declare class CompressedTokenProgram {
|
|
|
5230
5232
|
* @param mintSize Optional: mint size. Default: MINT_SIZE
|
|
5231
5233
|
*
|
|
5232
5234
|
* @returns [createMintAccountInstruction, initializeMintInstruction,
|
|
5233
|
-
*
|
|
5235
|
+
* createSplInterfaceInstruction]
|
|
5234
5236
|
*
|
|
5235
|
-
* Note that `
|
|
5237
|
+
* Note that `createSplInterfaceInstruction` must be executed after
|
|
5236
5238
|
* `initializeMintInstruction`.
|
|
5237
5239
|
*/
|
|
5238
5240
|
static createMint({ feePayer, mint, authority, freezeAuthority, decimals, rentExemptBalance, tokenProgramId, mintSize, }: CreateMintParams): Promise<TransactionInstruction[]>;
|
|
5239
5241
|
/**
|
|
5240
|
-
*
|
|
5242
|
+
* Create SPL interface (omnibus account) for an existing SPL mint.
|
|
5241
5243
|
* For new mints, use `CompressedTokenProgram.createMint`.
|
|
5242
5244
|
*
|
|
5243
5245
|
* @param feePayer Fee payer.
|
|
@@ -5245,12 +5247,16 @@ declare class CompressedTokenProgram {
|
|
|
5245
5247
|
* @param tokenProgramId Optional: Token program ID. Default: SPL
|
|
5246
5248
|
* Token Program ID
|
|
5247
5249
|
*
|
|
5248
|
-
* @returns The
|
|
5250
|
+
* @returns The createSplInterface instruction
|
|
5251
|
+
*/
|
|
5252
|
+
static createSplInterface({ feePayer, mint, tokenProgramId, }: CreateSplInterfaceParams): Promise<TransactionInstruction>;
|
|
5253
|
+
/**
|
|
5254
|
+
* @deprecated Use {@link createSplInterface} instead.
|
|
5249
5255
|
*/
|
|
5250
|
-
static createTokenPool(
|
|
5256
|
+
static createTokenPool(params: CreateSplInterfaceParams): Promise<TransactionInstruction>;
|
|
5251
5257
|
/**
|
|
5252
5258
|
* Add a token pool to an existing SPL mint. For new mints, use
|
|
5253
|
-
* {@link
|
|
5259
|
+
* {@link createSplInterface}.
|
|
5254
5260
|
*
|
|
5255
5261
|
* @param feePayer Fee payer.
|
|
5256
5262
|
* @param mint SPL Mint address.
|
|
@@ -5414,6 +5420,36 @@ declare class CompressedTokenProgram {
|
|
|
5414
5420
|
static revoke({ payer, inputCompressedTokenAccounts, recentValidityProof, recentInputStateRootIndices, }: RevokeParams): Promise<TransactionInstruction>;
|
|
5415
5421
|
}
|
|
5416
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
|
+
|
|
5417
5453
|
/**
|
|
5418
5454
|
* Retrieve associated token account for a given owner and mint.
|
|
5419
5455
|
*
|
|
@@ -5427,19 +5463,20 @@ declare class CompressedTokenProgram {
|
|
|
5427
5463
|
*/
|
|
5428
5464
|
declare function getAtaInterface(rpc: Rpc, ata: PublicKey, owner: PublicKey, mint: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<AccountInterface>;
|
|
5429
5465
|
/**
|
|
5430
|
-
* Create
|
|
5466
|
+
* Create instruction batches for loading token balances into an ATA.
|
|
5467
|
+
* Returns batches of instructions, each batch is one transaction.
|
|
5431
5468
|
*
|
|
5432
|
-
* @param rpc
|
|
5433
|
-
* @param ata
|
|
5434
|
-
* @param owner
|
|
5435
|
-
* @param mint
|
|
5436
|
-
* @param payer
|
|
5437
|
-
* @param options
|
|
5438
|
-
* @returns
|
|
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
|
|
5439
5476
|
*/
|
|
5440
|
-
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[][]>;
|
|
5441
5478
|
/**
|
|
5442
|
-
* Load token balances into a
|
|
5479
|
+
* Load token balances into a light-token ATA.
|
|
5443
5480
|
*
|
|
5444
5481
|
* @param rpc RPC connection
|
|
5445
5482
|
* @param ata Associated token address
|
|
@@ -5450,6 +5487,6 @@ declare function createLoadAtaInstructions(rpc: Rpc, ata: PublicKey, owner: Publ
|
|
|
5450
5487
|
* @param interfaceOptions Optional interface options
|
|
5451
5488
|
* @returns Transaction signature, or null if nothing to load
|
|
5452
5489
|
*/
|
|
5453
|
-
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>;
|
|
5454
5491
|
|
|
5455
|
-
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
|
|
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 };
|