@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.
- 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 +568 -475
- package/dist/types/unified/index.d.ts +776 -666
- package/package.json +28 -42
- package/dist/cjs/browser/types-DiKZshjI.cjs +0 -2
- package/dist/cjs/browser/types-DiKZshjI.cjs.map +0 -1
- package/dist/cjs/node/types-DaJDA3il.cjs +0 -2
- package/dist/cjs/node/types-DaJDA3il.cjs.map +0 -1
- package/dist/es/browser/types-f0sdegvS.js +0 -2
- package/dist/es/browser/types-f0sdegvS.js.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { MerkleContext, CompressedAccountWithMerkleContext, Rpc, ValidityProofWithContext, AddressTreeInfo, TreeInfo, ParsedTokenAccount, ValidityProof, PackedMerkleContextLegacy, CompressedCpiContext, InputTokenDataWithContext as InputTokenDataWithContext$1, CompressedProof } from '@lightprotocol/stateless.js';
|
|
2
|
+
import { PublicKey, AccountInfo, Commitment, TransactionInstruction, Signer, Keypair, ConfirmOptions, TransactionSignature, AccountMeta, Connection } from '@solana/web3.js';
|
|
3
|
+
import { MerkleContext, CompressedAccountWithMerkleContext, Rpc, ValidityProofWithContext, AddressTreeInfo, TreeInfo, ParsedTokenAccount, TreeType, PackedMerkleContextLegacy, CompressedCpiContext, ValidityProof, InputTokenDataWithContext as InputTokenDataWithContext$1, CompressedProof } from '@lightprotocol/stateless.js';
|
|
5
4
|
export { ParsedTokenAccount } from '@lightprotocol/stateless.js';
|
|
6
5
|
import { Account, Mint } from '@solana/spl-token';
|
|
7
6
|
export { AccountState } from '@solana/spl-token';
|
|
@@ -799,8 +798,8 @@ declare const TokenAccountSourceType: {
|
|
|
799
798
|
readonly Token2022: "token2022";
|
|
800
799
|
readonly SplCold: "spl-cold";
|
|
801
800
|
readonly Token2022Cold: "token2022-cold";
|
|
802
|
-
readonly
|
|
803
|
-
readonly
|
|
801
|
+
readonly LightTokenHot: "light-token-hot";
|
|
802
|
+
readonly LightTokenCold: "light-token-cold";
|
|
804
803
|
};
|
|
805
804
|
type TokenAccountSourceTypeValue = (typeof TokenAccountSourceType)[keyof typeof TokenAccountSourceType];
|
|
806
805
|
/** @internal */
|
|
@@ -823,9 +822,9 @@ interface AccountInterface {
|
|
|
823
822
|
_anyFrozen?: boolean;
|
|
824
823
|
/** True when fetched via getAtaInterface */
|
|
825
824
|
_isAta?: boolean;
|
|
826
|
-
/**
|
|
825
|
+
/** Associated token account owner - set by getAtaInterface */
|
|
827
826
|
_owner?: PublicKey;
|
|
828
|
-
/**
|
|
827
|
+
/** Associated token account mint - set by getAtaInterface */
|
|
829
828
|
_mint?: PublicKey;
|
|
830
829
|
}
|
|
831
830
|
/** @internal */
|
|
@@ -840,21 +839,21 @@ declare function convertTokenDataToAccount(address: PublicKey, tokenData: {
|
|
|
840
839
|
/** Convert compressed account to AccountInfo */
|
|
841
840
|
declare function toAccountInfo(compressedAccount: CompressedAccountWithMerkleContext): AccountInfo<Buffer$1>;
|
|
842
841
|
/** @internal */
|
|
843
|
-
declare function
|
|
842
|
+
declare function parseLightTokenHot(address: PublicKey, accountInfo: AccountInfo<Buffer$1>): {
|
|
844
843
|
accountInfo: AccountInfo<Buffer$1>;
|
|
845
844
|
loadContext: undefined;
|
|
846
845
|
parsed: Account;
|
|
847
846
|
isCold: false;
|
|
848
847
|
};
|
|
849
848
|
/** @internal */
|
|
850
|
-
declare function
|
|
849
|
+
declare function parseLightTokenCold(address: PublicKey, compressedAccount: CompressedAccountWithMerkleContext): {
|
|
851
850
|
accountInfo: AccountInfo<Buffer$1>;
|
|
852
851
|
loadContext: MerkleContext;
|
|
853
852
|
parsed: Account;
|
|
854
853
|
isCold: true;
|
|
855
854
|
};
|
|
856
855
|
/**
|
|
857
|
-
* Retrieve information about a token account of SPL/T22/
|
|
856
|
+
* Retrieve information about a token account of SPL/T22/light-token.
|
|
858
857
|
*
|
|
859
858
|
* @param rpc RPC connection to use
|
|
860
859
|
* @param address Token account address
|
|
@@ -865,6 +864,228 @@ declare function parseCTokenCold(address: PublicKey, compressedAccount: Compress
|
|
|
865
864
|
*/
|
|
866
865
|
declare function getAccountInterface(rpc: Rpc, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<AccountInterface>;
|
|
867
866
|
|
|
867
|
+
/**
|
|
868
|
+
* SPL interface PDA info.
|
|
869
|
+
*/
|
|
870
|
+
type SplInterfaceInfo = {
|
|
871
|
+
/**
|
|
872
|
+
* The mint of the SPL interface
|
|
873
|
+
*/
|
|
874
|
+
mint: PublicKey;
|
|
875
|
+
/**
|
|
876
|
+
* The SPL interface address
|
|
877
|
+
*/
|
|
878
|
+
splInterfacePda: PublicKey;
|
|
879
|
+
/**
|
|
880
|
+
* The token program of the SPL interface
|
|
881
|
+
*/
|
|
882
|
+
tokenProgram: PublicKey;
|
|
883
|
+
/**
|
|
884
|
+
* count of txs and volume in the past 60 seconds.
|
|
885
|
+
*/
|
|
886
|
+
activity?: {
|
|
887
|
+
txs: number;
|
|
888
|
+
amountAdded: BN;
|
|
889
|
+
amountRemoved: BN;
|
|
890
|
+
};
|
|
891
|
+
/**
|
|
892
|
+
* Whether the SPL interface is initialized
|
|
893
|
+
*/
|
|
894
|
+
isInitialized: boolean;
|
|
895
|
+
/**
|
|
896
|
+
* The balance of the SPL interface
|
|
897
|
+
*/
|
|
898
|
+
balance: BN;
|
|
899
|
+
/**
|
|
900
|
+
* The index of the SPL interface
|
|
901
|
+
*/
|
|
902
|
+
poolIndex: number;
|
|
903
|
+
/**
|
|
904
|
+
* The bump used to derive the SPL interface PDA
|
|
905
|
+
*/
|
|
906
|
+
bump: number;
|
|
907
|
+
};
|
|
908
|
+
/**
|
|
909
|
+
* @deprecated Use {@link SplInterfaceInfo} instead.
|
|
910
|
+
* This type maintains backward compatibility by including both tokenPoolPda and splInterfacePda.
|
|
911
|
+
* Both properties point to the same PublicKey value.
|
|
912
|
+
*/
|
|
913
|
+
type TokenPoolInfo = {
|
|
914
|
+
/**
|
|
915
|
+
* The mint of the SPL interface
|
|
916
|
+
*/
|
|
917
|
+
mint: PublicKey;
|
|
918
|
+
/**
|
|
919
|
+
* @deprecated Use splInterfacePda instead.
|
|
920
|
+
*/
|
|
921
|
+
tokenPoolPda: PublicKey;
|
|
922
|
+
/**
|
|
923
|
+
* The SPL interface address (new name).
|
|
924
|
+
* For backward compatibility, tokenPoolPda is also available.
|
|
925
|
+
*/
|
|
926
|
+
splInterfacePda: PublicKey;
|
|
927
|
+
/**
|
|
928
|
+
* The token program of the SPL interface
|
|
929
|
+
*/
|
|
930
|
+
tokenProgram: PublicKey;
|
|
931
|
+
/**
|
|
932
|
+
* count of txs and volume in the past 60 seconds.
|
|
933
|
+
*/
|
|
934
|
+
activity?: {
|
|
935
|
+
txs: number;
|
|
936
|
+
amountAdded: BN;
|
|
937
|
+
amountRemoved: BN;
|
|
938
|
+
};
|
|
939
|
+
/**
|
|
940
|
+
* Whether the SPL interface is initialized
|
|
941
|
+
*/
|
|
942
|
+
isInitialized: boolean;
|
|
943
|
+
/**
|
|
944
|
+
* The balance of the SPL interface
|
|
945
|
+
*/
|
|
946
|
+
balance: BN;
|
|
947
|
+
/**
|
|
948
|
+
* The index of the SPL interface
|
|
949
|
+
*/
|
|
950
|
+
poolIndex: number;
|
|
951
|
+
/**
|
|
952
|
+
* The bump used to derive the SPL interface PDA
|
|
953
|
+
*/
|
|
954
|
+
bump: number;
|
|
955
|
+
};
|
|
956
|
+
/**
|
|
957
|
+
* Convert SplInterfaceInfo to TokenPoolInfo for backward compatibility.
|
|
958
|
+
* @internal
|
|
959
|
+
*/
|
|
960
|
+
declare function toTokenPoolInfo(info: SplInterfaceInfo): TokenPoolInfo;
|
|
961
|
+
/**
|
|
962
|
+
* Derive SplInterfaceInfo for an SPL interface that will be initialized in the
|
|
963
|
+
* same transaction. Use this when you need to create an SPL interface and
|
|
964
|
+
* compress in a single transaction.
|
|
965
|
+
*
|
|
966
|
+
* @param mint The mint of the SPL interface
|
|
967
|
+
* @param tokenProgramId The token program (TOKEN_PROGRAM_ID or TOKEN_2022_PROGRAM_ID)
|
|
968
|
+
* @param poolIndex The pool index. Default 0.
|
|
969
|
+
*
|
|
970
|
+
* @returns SplInterfaceInfo for the to-be-initialized interface
|
|
971
|
+
*/
|
|
972
|
+
declare function deriveSplInterfaceInfo(mint: PublicKey, tokenProgramId: PublicKey, poolIndex?: number): SplInterfaceInfo;
|
|
973
|
+
/**
|
|
974
|
+
* Check if the SPL interface info is initialized and has a balance.
|
|
975
|
+
* @param mint The mint of the SPL interface
|
|
976
|
+
* @param splInterfaceInfo The SPL interface info (or TokenPoolInfo for backward compatibility)
|
|
977
|
+
* @returns True if the SPL interface info is initialized and has a balance
|
|
978
|
+
*/
|
|
979
|
+
declare function checkSplInterfaceInfo(splInterfaceInfo: SplInterfaceInfo | TokenPoolInfo, mint: PublicKey): boolean;
|
|
980
|
+
/**
|
|
981
|
+
* Get the SPL interface infos for a given mint.
|
|
982
|
+
* @param rpc The RPC client
|
|
983
|
+
* @param mint The mint of the SPL interface
|
|
984
|
+
* @param commitment The commitment to use
|
|
985
|
+
*
|
|
986
|
+
* @returns The SPL interface infos
|
|
987
|
+
*/
|
|
988
|
+
declare function getSplInterfaceInfos(rpc: Rpc, mint: PublicKey, commitment?: Commitment): Promise<SplInterfaceInfo[]>;
|
|
989
|
+
type SplInterfaceActivity = {
|
|
990
|
+
signature: string;
|
|
991
|
+
amount: BN;
|
|
992
|
+
action: Action;
|
|
993
|
+
};
|
|
994
|
+
/**
|
|
995
|
+
* @internal
|
|
996
|
+
*/
|
|
997
|
+
declare enum Action {
|
|
998
|
+
Compress = 1,
|
|
999
|
+
Decompress = 2,
|
|
1000
|
+
Transfer = 3
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* For `compress` and `mintTo` instructions only.
|
|
1004
|
+
* Select a random SPL interface info from the SPL interface infos.
|
|
1005
|
+
*
|
|
1006
|
+
* For `decompress`, use {@link selectSplInterfaceInfosForDecompression} instead.
|
|
1007
|
+
*
|
|
1008
|
+
* @param infos The SPL interface infos
|
|
1009
|
+
*
|
|
1010
|
+
* @returns A random SPL interface info
|
|
1011
|
+
*/
|
|
1012
|
+
declare function selectSplInterfaceInfo(infos: SplInterfaceInfo[]): SplInterfaceInfo;
|
|
1013
|
+
/**
|
|
1014
|
+
* Select one or multiple SPL interface infos from the SPL interface infos.
|
|
1015
|
+
*
|
|
1016
|
+
* Use this function for `decompress`.
|
|
1017
|
+
*
|
|
1018
|
+
* For `compress`, `mintTo` use {@link selectSplInterfaceInfo} instead.
|
|
1019
|
+
*
|
|
1020
|
+
* @param infos The SPL interface infos
|
|
1021
|
+
* @param decompressAmount The amount of tokens to withdraw
|
|
1022
|
+
*
|
|
1023
|
+
* @returns Array with one or more SPL interface infos.
|
|
1024
|
+
*/
|
|
1025
|
+
declare function selectSplInterfaceInfosForDecompression(infos: SplInterfaceInfo[], decompressAmount: number | BN): SplInterfaceInfo[];
|
|
1026
|
+
/**
|
|
1027
|
+
* @deprecated Use {@link SplInterfaceActivity} instead.
|
|
1028
|
+
*/
|
|
1029
|
+
type TokenPoolActivity = SplInterfaceActivity;
|
|
1030
|
+
/**
|
|
1031
|
+
* @deprecated Use {@link deriveSplInterfaceInfo} instead.
|
|
1032
|
+
*/
|
|
1033
|
+
declare function deriveTokenPoolInfo(mint: PublicKey, tokenProgramId: PublicKey, poolIndex?: number): TokenPoolInfo;
|
|
1034
|
+
/**
|
|
1035
|
+
* @deprecated Use {@link checkSplInterfaceInfo} instead.
|
|
1036
|
+
*/
|
|
1037
|
+
declare function checkTokenPoolInfo(tokenPoolInfo: TokenPoolInfo, mint: PublicKey): boolean;
|
|
1038
|
+
/**
|
|
1039
|
+
* @deprecated Use {@link getSplInterfaceInfos} instead.
|
|
1040
|
+
*/
|
|
1041
|
+
declare function getTokenPoolInfos(rpc: Rpc, mint: PublicKey, commitment?: Commitment): Promise<TokenPoolInfo[]>;
|
|
1042
|
+
/**
|
|
1043
|
+
* @deprecated Use {@link selectSplInterfaceInfo} instead.
|
|
1044
|
+
*/
|
|
1045
|
+
declare function selectTokenPoolInfo(infos: TokenPoolInfo[]): TokenPoolInfo;
|
|
1046
|
+
/**
|
|
1047
|
+
* @deprecated Use {@link selectSplInterfaceInfosForDecompression} instead.
|
|
1048
|
+
*/
|
|
1049
|
+
declare function selectTokenPoolInfosForDecompression(infos: TokenPoolInfo[], decompressAmount: number | BN): TokenPoolInfo[];
|
|
1050
|
+
|
|
1051
|
+
declare function sliceLast<T>(items: T[]): {
|
|
1052
|
+
rest: T[];
|
|
1053
|
+
last: T;
|
|
1054
|
+
};
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* Create a light-token transfer instruction.
|
|
1058
|
+
*
|
|
1059
|
+
* For light-token accounts with compressible extension, the program needs
|
|
1060
|
+
* system_program and fee_payer to handle rent top-ups.
|
|
1061
|
+
*
|
|
1062
|
+
* @param source Source light-token account
|
|
1063
|
+
* @param destination Destination light-token account
|
|
1064
|
+
* @param owner Owner of the source account (signer, also pays for compressible extension top-ups)
|
|
1065
|
+
* @param amount Amount to transfer
|
|
1066
|
+
* @param feePayer Optional fee payer for top-ups (defaults to owner)
|
|
1067
|
+
* @returns Transaction instruction for light-token transfer
|
|
1068
|
+
*/
|
|
1069
|
+
declare function createLightTokenTransferInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, feePayer?: PublicKey): TransactionInstruction;
|
|
1070
|
+
/**
|
|
1071
|
+
* Create a light-token transfer_checked instruction. Same semantics as SPL
|
|
1072
|
+
* TransferChecked.
|
|
1073
|
+
*/
|
|
1074
|
+
declare function createLightTokenTransferCheckedInstruction(source: PublicKey, destination: PublicKey, mint: PublicKey, owner: PublicKey, amount: number | bigint, decimals: number, payer: PublicKey): TransactionInstruction;
|
|
1075
|
+
|
|
1076
|
+
interface InterfaceOptions {
|
|
1077
|
+
splInterfaceInfos?: SplInterfaceInfo[];
|
|
1078
|
+
/**
|
|
1079
|
+
* ATA owner (authority owner) used to derive the ATA when the signer is a
|
|
1080
|
+
* delegate. For owner-signed flows, omit this field.
|
|
1081
|
+
*/
|
|
1082
|
+
owner?: PublicKey;
|
|
1083
|
+
}
|
|
1084
|
+
interface TransferOptions extends InterfaceOptions {
|
|
1085
|
+
wrap?: boolean;
|
|
1086
|
+
programId?: PublicKey;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
868
1089
|
interface LayoutObject {
|
|
869
1090
|
[key: string]: any;
|
|
870
1091
|
}
|
|
@@ -1004,7 +1225,7 @@ interface AdditionalMetadata {
|
|
|
1004
1225
|
}
|
|
1005
1226
|
|
|
1006
1227
|
/**
|
|
1007
|
-
* Token metadata for creating a
|
|
1228
|
+
* Token metadata for creating a light-token mint.
|
|
1008
1229
|
*/
|
|
1009
1230
|
interface TokenMetadataInstructionData {
|
|
1010
1231
|
name: string;
|
|
@@ -1015,7 +1236,7 @@ interface TokenMetadataInstructionData {
|
|
|
1015
1236
|
}
|
|
1016
1237
|
declare function createTokenMetadata(name: string, symbol: string, uri: string, updateAuthority?: PublicKey | null, additionalMetadata?: AdditionalMetadata[] | null): TokenMetadataInstructionData;
|
|
1017
1238
|
/**
|
|
1018
|
-
* Create instruction for initializing a
|
|
1239
|
+
* Create instruction for initializing a light-token mint.
|
|
1019
1240
|
*
|
|
1020
1241
|
* @param mintSigner Mint signer keypair public key.
|
|
1021
1242
|
* @param decimals Number of decimals for the mint.
|
|
@@ -1026,8 +1247,9 @@ declare function createTokenMetadata(name: string, symbol: string, uri: string,
|
|
|
1026
1247
|
* @param addressTreeInfo Address tree info for the mint.
|
|
1027
1248
|
* @param outputStateTreeInfo Output state tree info.
|
|
1028
1249
|
* @param metadata Optional token metadata.
|
|
1250
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1029
1251
|
*/
|
|
1030
|
-
declare function createMintInstruction(mintSigner: PublicKey, decimals: number, mintAuthority: PublicKey, freezeAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext, addressTreeInfo: AddressTreeInfo, outputStateTreeInfo: TreeInfo, metadata?: TokenMetadataInstructionData): TransactionInstruction;
|
|
1252
|
+
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;
|
|
1031
1253
|
|
|
1032
1254
|
/**
|
|
1033
1255
|
* SPL-compatible base mint structure
|
|
@@ -1045,12 +1267,12 @@ interface BaseMint {
|
|
|
1045
1267
|
freezeAuthority: PublicKey | null;
|
|
1046
1268
|
}
|
|
1047
1269
|
/**
|
|
1048
|
-
*
|
|
1270
|
+
* Light mint context (protocol version, SPL mint reference)
|
|
1049
1271
|
*/
|
|
1050
1272
|
interface MintContext {
|
|
1051
1273
|
/** Protocol version for upgradability */
|
|
1052
1274
|
version: number;
|
|
1053
|
-
/** Whether the compressed mint
|
|
1275
|
+
/** Whether the compressed light mint has been decompressed to a light mint account */
|
|
1054
1276
|
cmintDecompressed: boolean;
|
|
1055
1277
|
/** PDA of the associated SPL mint */
|
|
1056
1278
|
splMint: PublicKey;
|
|
@@ -1088,7 +1310,7 @@ interface TokenMetadata {
|
|
|
1088
1310
|
}[];
|
|
1089
1311
|
}
|
|
1090
1312
|
/**
|
|
1091
|
-
* Complete
|
|
1313
|
+
* Complete light mint structure (raw format)
|
|
1092
1314
|
*/
|
|
1093
1315
|
interface CompressedMint {
|
|
1094
1316
|
base: BaseMint;
|
|
@@ -1117,7 +1339,7 @@ interface RentConfig {
|
|
|
1117
1339
|
maxTopUp: number;
|
|
1118
1340
|
}
|
|
1119
1341
|
/**
|
|
1120
|
-
* Compression info embedded in
|
|
1342
|
+
* Compression info embedded in light mint
|
|
1121
1343
|
*/
|
|
1122
1344
|
interface CompressionInfo {
|
|
1123
1345
|
/** Config account version (0 = uninitialized) */
|
|
@@ -1142,18 +1364,18 @@ interface CompressionInfo {
|
|
|
1142
1364
|
rentConfig: RentConfig;
|
|
1143
1365
|
}
|
|
1144
1366
|
/**
|
|
1145
|
-
* Deserialize a
|
|
1367
|
+
* Deserialize a light mint from buffer
|
|
1146
1368
|
* Uses SPL's MintLayout for BaseMint and buffer-layout struct for context
|
|
1147
1369
|
*
|
|
1148
1370
|
* @param data - The raw account data buffer
|
|
1149
|
-
* @returns The deserialized
|
|
1371
|
+
* @returns The deserialized light mint
|
|
1150
1372
|
*/
|
|
1151
1373
|
declare function deserializeMint(data: Buffer$1 | Uint8Array): CompressedMint;
|
|
1152
1374
|
/**
|
|
1153
|
-
* Serialize a
|
|
1375
|
+
* Serialize a light mint to buffer
|
|
1154
1376
|
* Uses SPL's MintLayout for BaseMint, helper functions for context/metadata
|
|
1155
1377
|
*
|
|
1156
|
-
* @param mint - The
|
|
1378
|
+
* @param mint - The light mint to serialize
|
|
1157
1379
|
* @returns The serialized buffer
|
|
1158
1380
|
*/
|
|
1159
1381
|
declare function serializeMint(mint: CompressedMint): Buffer$1;
|
|
@@ -1216,11 +1438,11 @@ interface MintInterface {
|
|
|
1216
1438
|
mintContext?: MintContext;
|
|
1217
1439
|
tokenMetadata?: TokenMetadata;
|
|
1218
1440
|
extensions?: MintExtension[];
|
|
1219
|
-
/** Compression info for
|
|
1441
|
+
/** Compression info for light-token mints */
|
|
1220
1442
|
compression?: CompressionInfo;
|
|
1221
1443
|
}
|
|
1222
1444
|
/**
|
|
1223
|
-
* Get unified mint info for SPL/T22/
|
|
1445
|
+
* Get unified mint info for SPL/T22/light-token mints.
|
|
1224
1446
|
*
|
|
1225
1447
|
* @param rpc RPC connection
|
|
1226
1448
|
* @param address The mint address
|
|
@@ -1232,16 +1454,16 @@ interface MintInterface {
|
|
|
1232
1454
|
*/
|
|
1233
1455
|
declare function getMintInterface(rpc: Rpc, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<MintInterface>;
|
|
1234
1456
|
/**
|
|
1235
|
-
* Unpack mint info from raw account data for SPL/T22/
|
|
1457
|
+
* Unpack mint info from raw account data for SPL/T22/light-token.
|
|
1236
1458
|
*
|
|
1237
1459
|
* @param address The mint pubkey
|
|
1238
1460
|
* @param data The raw account data or AccountInfo
|
|
1239
|
-
* @param programId Token program ID. Default
|
|
1461
|
+
* @param programId Token program ID. Default light-token.
|
|
1240
1462
|
* @returns Object with mint, optional mintContext and tokenMetadata.
|
|
1241
1463
|
*/
|
|
1242
1464
|
declare function unpackMintInterface(address: PublicKey, data: Buffer$1 | Uint8Array | AccountInfo<Buffer$1>, programId?: PublicKey): Omit<MintInterface, 'merkleContext'>;
|
|
1243
1465
|
/**
|
|
1244
|
-
* Unpack
|
|
1466
|
+
* Unpack light-token mint context and metadata from raw account data
|
|
1245
1467
|
*
|
|
1246
1468
|
* @param data The raw account data
|
|
1247
1469
|
* @returns Object with mintContext, tokenMetadata, and extensions
|
|
@@ -1253,17 +1475,20 @@ declare function unpackMintData(data: Buffer$1 | Uint8Array): {
|
|
|
1253
1475
|
};
|
|
1254
1476
|
|
|
1255
1477
|
/**
|
|
1256
|
-
* Create instruction for updating a
|
|
1478
|
+
* Create instruction for updating a light mint's mint authority.
|
|
1479
|
+
* Works for both compressed and decompressed light mints.
|
|
1257
1480
|
*
|
|
1258
1481
|
* @param mintInterface MintInterface from getMintInterface() - must have merkleContext
|
|
1259
1482
|
* @param currentMintAuthority Current mint authority public key (must sign)
|
|
1260
1483
|
* @param newMintAuthority New mint authority (or null to revoke)
|
|
1261
1484
|
* @param payer Fee payer public key
|
|
1262
|
-
* @param validityProof Validity proof for the compressed mint
|
|
1485
|
+
* @param validityProof Validity proof for the compressed light mint (null for decompressed light mints)
|
|
1486
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1263
1487
|
*/
|
|
1264
|
-
declare function createUpdateMintAuthorityInstruction(mintInterface: MintInterface, currentMintAuthority: PublicKey, newMintAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext): TransactionInstruction;
|
|
1488
|
+
declare function createUpdateMintAuthorityInstruction(mintInterface: MintInterface, currentMintAuthority: PublicKey, newMintAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext | null, maxTopUp?: number): TransactionInstruction;
|
|
1265
1489
|
/**
|
|
1266
|
-
* Create instruction for updating a
|
|
1490
|
+
* Create instruction for updating a light mint's freeze authority.
|
|
1491
|
+
* Works for both compressed and decompressed light mints.
|
|
1267
1492
|
*
|
|
1268
1493
|
* Output queue is automatically derived from mintInterface.merkleContext.treeInfo
|
|
1269
1494
|
* (preferring nextTreeInfo.queue if available for rollover support).
|
|
@@ -1272,12 +1497,13 @@ declare function createUpdateMintAuthorityInstruction(mintInterface: MintInterfa
|
|
|
1272
1497
|
* @param currentFreezeAuthority Current freeze authority public key (must sign)
|
|
1273
1498
|
* @param newFreezeAuthority New freeze authority (or null to revoke)
|
|
1274
1499
|
* @param payer Fee payer public key
|
|
1275
|
-
* @param validityProof Validity proof for the compressed mint
|
|
1500
|
+
* @param validityProof Validity proof for the compressed light mint (null for decompressed light mints)
|
|
1501
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1276
1502
|
*/
|
|
1277
|
-
declare function createUpdateFreezeAuthorityInstruction(mintInterface: MintInterface, currentFreezeAuthority: PublicKey, newFreezeAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext): TransactionInstruction;
|
|
1503
|
+
declare function createUpdateFreezeAuthorityInstruction(mintInterface: MintInterface, currentFreezeAuthority: PublicKey, newFreezeAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext | null, maxTopUp?: number): TransactionInstruction;
|
|
1278
1504
|
|
|
1279
1505
|
/**
|
|
1280
|
-
* Create instruction for updating a
|
|
1506
|
+
* Create instruction for updating a light mint's metadata field.
|
|
1281
1507
|
*
|
|
1282
1508
|
* Output queue is automatically derived from mintInterface.merkleContext.treeInfo
|
|
1283
1509
|
* (preferring nextTreeInfo.queue if available for rollover support).
|
|
@@ -1285,15 +1511,16 @@ declare function createUpdateFreezeAuthorityInstruction(mintInterface: MintInter
|
|
|
1285
1511
|
* @param mintInterface MintInterface from getMintInterface() - must have merkleContext and tokenMetadata
|
|
1286
1512
|
* @param authority Metadata update authority public key (must sign)
|
|
1287
1513
|
* @param payer Fee payer public key
|
|
1288
|
-
* @param validityProof Validity proof for the
|
|
1514
|
+
* @param validityProof Validity proof for the light mint (null for decompressed light mints)
|
|
1289
1515
|
* @param fieldType Field to update: 'name', 'symbol', 'uri', or 'custom'
|
|
1290
1516
|
* @param value New value for the field
|
|
1291
1517
|
* @param customKey Custom key name (required if fieldType is 'custom')
|
|
1292
1518
|
* @param extensionIndex Extension index (default: 0)
|
|
1519
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1293
1520
|
*/
|
|
1294
|
-
declare function createUpdateMetadataFieldInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, fieldType: 'name' | 'symbol' | 'uri' | 'custom', value: string, customKey?: string, extensionIndex?: number): TransactionInstruction;
|
|
1521
|
+
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;
|
|
1295
1522
|
/**
|
|
1296
|
-
* Create instruction for updating a
|
|
1523
|
+
* Create instruction for updating a light mint's metadata authority.
|
|
1297
1524
|
*
|
|
1298
1525
|
* Output queue is automatically derived from mintInterface.merkleContext.treeInfo
|
|
1299
1526
|
* (preferring nextTreeInfo.queue if available for rollover support).
|
|
@@ -1302,559 +1529,304 @@ declare function createUpdateMetadataFieldInstruction(mintInterface: MintInterfa
|
|
|
1302
1529
|
* @param currentAuthority Current metadata update authority public key (must sign)
|
|
1303
1530
|
* @param newAuthority New metadata update authority public key
|
|
1304
1531
|
* @param payer Fee payer public key
|
|
1305
|
-
* @param validityProof Validity proof for the
|
|
1306
|
-
* @param extensionIndex Extension index (default: 0)
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
*
|
|
1312
|
-
* Output queue is automatically derived from mintInterface.merkleContext.treeInfo
|
|
1313
|
-
* (preferring nextTreeInfo.queue if available for rollover support).
|
|
1314
|
-
*
|
|
1315
|
-
* @param mintInterface MintInterface from getMintInterface() - must have merkleContext and tokenMetadata
|
|
1316
|
-
* @param authority Metadata update authority public key (must sign)
|
|
1317
|
-
* @param payer Fee payer public key
|
|
1318
|
-
* @param validityProof Validity proof for the compressed mint
|
|
1319
|
-
* @param key Metadata key to remove
|
|
1320
|
-
* @param idempotent If true, don't error if key doesn't exist (default: false)
|
|
1321
|
-
* @param extensionIndex Extension index (default: 0)
|
|
1322
|
-
*/
|
|
1323
|
-
declare function createRemoveMetadataKeyInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, key: string, idempotent?: boolean, extensionIndex?: number): TransactionInstruction;
|
|
1324
|
-
|
|
1325
|
-
interface CompressToPubkey {
|
|
1326
|
-
bump: number;
|
|
1327
|
-
programId: number[];
|
|
1328
|
-
seeds: number[][];
|
|
1329
|
-
}
|
|
1330
|
-
interface CompressibleConfig {
|
|
1331
|
-
tokenAccountVersion: number;
|
|
1332
|
-
rentPayment: number;
|
|
1333
|
-
hasTopUp: number;
|
|
1334
|
-
compressionOnly: number;
|
|
1335
|
-
writeTopUp: number;
|
|
1336
|
-
compressToAccountPubkey?: CompressToPubkey | null;
|
|
1337
|
-
}
|
|
1338
|
-
interface CreateAssociatedCTokenAccountParams {
|
|
1339
|
-
bump: number;
|
|
1340
|
-
compressibleConfig?: CompressibleConfig;
|
|
1341
|
-
}
|
|
1342
|
-
/**
|
|
1343
|
-
* Create instruction for creating an associated compressed token account.
|
|
1344
|
-
*
|
|
1345
|
-
* @param feePayer Fee payer public key.
|
|
1346
|
-
* @param owner Owner of the associated token account.
|
|
1347
|
-
* @param mint Mint address.
|
|
1348
|
-
* @param compressibleConfig Optional compressible configuration.
|
|
1349
|
-
* @param configAccount Optional config account.
|
|
1350
|
-
* @param rentPayerPda Optional rent payer PDA.
|
|
1351
|
-
*/
|
|
1352
|
-
declare function createAssociatedCTokenAccountInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
|
|
1353
|
-
/**
|
|
1354
|
-
* Create idempotent instruction for creating an associated compressed token account.
|
|
1355
|
-
*
|
|
1356
|
-
* @param feePayer Fee payer public key.
|
|
1357
|
-
* @param owner Owner of the associated token account.
|
|
1358
|
-
* @param mint Mint address.
|
|
1359
|
-
* @param compressibleConfig Optional compressible configuration.
|
|
1360
|
-
* @param configAccount Optional config account.
|
|
1361
|
-
* @param rentPayerPda Optional rent payer PDA.
|
|
1362
|
-
*/
|
|
1363
|
-
declare function createAssociatedCTokenAccountIdempotentInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
|
|
1364
|
-
|
|
1365
|
-
/**
|
|
1366
|
-
* c-token-specific config for createAssociatedTokenAccountInterfaceInstruction
|
|
1367
|
-
*/
|
|
1368
|
-
interface CTokenConfig {
|
|
1369
|
-
compressibleConfig?: CompressibleConfig;
|
|
1370
|
-
configAccount?: PublicKey;
|
|
1371
|
-
rentPayerPda?: PublicKey;
|
|
1372
|
-
}
|
|
1373
|
-
/**
|
|
1374
|
-
* Create instruction for creating an associated token account (SPL, Token-2022,
|
|
1375
|
-
* or c-token). Follows SPL Token API signature with optional c-token config at the
|
|
1376
|
-
* end.
|
|
1377
|
-
*
|
|
1378
|
-
* @param payer Fee payer public key.
|
|
1379
|
-
* @param associatedToken Associated token account address.
|
|
1380
|
-
* @param owner Owner of the associated token account.
|
|
1381
|
-
* @param mint Mint address.
|
|
1382
|
-
* @param programId Token program ID (default: TOKEN_PROGRAM_ID).
|
|
1383
|
-
* @param associatedTokenProgramId Associated token program ID.
|
|
1384
|
-
* @param ctokenConfig Optional c-token-specific configuration.
|
|
1385
|
-
*/
|
|
1386
|
-
declare function createAssociatedTokenAccountInterfaceInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey, ctokenConfig?: CTokenConfig): TransactionInstruction;
|
|
1387
|
-
/**
|
|
1388
|
-
* Create idempotent instruction for creating an associated token account (SPL,
|
|
1389
|
-
* Token-2022, or c-token). Follows SPL Token API signature with optional c-token
|
|
1390
|
-
* config at the end.
|
|
1391
|
-
*
|
|
1392
|
-
* @param payer Fee payer public key.
|
|
1393
|
-
* @param associatedToken Associated token account address.
|
|
1394
|
-
* @param owner Owner of the associated token account.
|
|
1395
|
-
* @param mint Mint address.
|
|
1396
|
-
* @param programId Token program ID (default: TOKEN_PROGRAM_ID).
|
|
1397
|
-
* @param associatedTokenProgramId Associated token program ID.
|
|
1398
|
-
* @param ctokenConfig Optional c-token-specific configuration.
|
|
1399
|
-
*/
|
|
1400
|
-
declare function createAssociatedTokenAccountInterfaceIdempotentInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey, ctokenConfig?: CTokenConfig): TransactionInstruction;
|
|
1401
|
-
/**
|
|
1402
|
-
* Short alias for createAssociatedTokenAccountInterfaceIdempotentInstruction.
|
|
1403
|
-
*/
|
|
1404
|
-
declare const createAtaInterfaceIdempotentInstruction: typeof createAssociatedTokenAccountInterfaceIdempotentInstruction;
|
|
1405
|
-
|
|
1406
|
-
/**
|
|
1407
|
-
* Create instruction for minting compressed tokens to an onchain token account.
|
|
1408
|
-
*
|
|
1409
|
-
* @param authority Mint authority public key.
|
|
1410
|
-
* @param payer Fee payer public key.
|
|
1411
|
-
* @param validityProof Validity proof for the compressed mint.
|
|
1412
|
-
* @param merkleContext Merkle context of the compressed mint.
|
|
1413
|
-
* @param mintData Mint instruction data.
|
|
1414
|
-
* @param outputStateTreeInfo Output state tree info.
|
|
1415
|
-
* @param recipientAccount Recipient onchain token account address.
|
|
1416
|
-
* @param amount Amount to mint.
|
|
1417
|
-
*/
|
|
1418
|
-
declare function createMintToInstruction(authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, merkleContext: MerkleContext, mintData: MintInstructionData, outputStateTreeInfo: TreeInfo, recipientAccount: PublicKey, amount: number | bigint): TransactionInstruction;
|
|
1419
|
-
|
|
1420
|
-
/**
|
|
1421
|
-
* Token data version enum - mirrors Rust TokenDataVersion
|
|
1422
|
-
* Used for compressed token account hashing strategy
|
|
1423
|
-
*/
|
|
1424
|
-
declare enum TokenDataVersion {
|
|
1425
|
-
/** V1: Poseidon hash with little-endian amount, discriminator [2,0,0,0,0,0,0,0] */
|
|
1426
|
-
V1 = 1,
|
|
1427
|
-
/** V2: Poseidon hash with big-endian amount, discriminator [0,0,0,0,0,0,0,3] */
|
|
1428
|
-
V2 = 2,
|
|
1429
|
-
/** ShaFlat: SHA256 hash of borsh-serialized data, discriminator [0,0,0,0,0,0,0,4] */
|
|
1430
|
-
ShaFlat = 3
|
|
1431
|
-
}
|
|
1432
|
-
declare const POOL_SEED: Buffer$1<ArrayBuffer>;
|
|
1433
|
-
declare const CPI_AUTHORITY_SEED: Buffer$1<ArrayBuffer>;
|
|
1434
|
-
declare const SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE = 1461600;
|
|
1435
|
-
declare const CREATE_TOKEN_POOL_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1436
|
-
declare const MINT_TO_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1437
|
-
declare const BATCH_COMPRESS_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1438
|
-
declare const TRANSFER_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1439
|
-
declare const COMPRESS_SPL_TOKEN_ACCOUNT_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1440
|
-
declare const APPROVE_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1441
|
-
declare const REVOKE_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1442
|
-
declare const ADD_TOKEN_POOL_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1443
|
-
declare const DECOMPRESS_ACCOUNTS_IDEMPOTENT_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1444
|
-
|
|
1445
|
-
/**
|
|
1446
|
-
* Create instruction for minting tokens from a c-mint to compressed accounts.
|
|
1447
|
-
* To mint to onchain token accounts across SPL/T22/c-mints, use
|
|
1448
|
-
* {@link createMintToInterfaceInstruction} instead.
|
|
1449
|
-
*
|
|
1450
|
-
* @param authority Mint authority public key.
|
|
1451
|
-
* @param payer Fee payer public key.
|
|
1452
|
-
* @param validityProof Validity proof for the compressed mint.
|
|
1453
|
-
* @param merkleContext Merkle context of the compressed mint.
|
|
1454
|
-
* @param mintData Mint instruction data.
|
|
1455
|
-
* @param recipients Array of recipients with amounts.
|
|
1456
|
-
* @param outputStateTreeInfo Optional output state tree info. Uses merkle
|
|
1457
|
-
* context queue if not provided.
|
|
1458
|
-
* @param tokenAccountVersion Token account version (default:
|
|
1459
|
-
* TokenDataVersion.ShaFlat).
|
|
1460
|
-
*/
|
|
1461
|
-
declare function createMintToCompressedInstruction(authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, merkleContext: MerkleContext, mintData: MintInstructionData, recipients: Array<{
|
|
1462
|
-
recipient: PublicKey;
|
|
1463
|
-
amount: number | bigint;
|
|
1464
|
-
}>, outputStateTreeInfo?: TreeInfo, tokenAccountVersion?: TokenDataVersion): TransactionInstruction;
|
|
1465
|
-
|
|
1466
|
-
/**
|
|
1467
|
-
* Create mint-to instruction for SPL, Token-2022, or compressed token mints.
|
|
1468
|
-
* This instruction ONLY mints to decompressed/onchain token accounts.
|
|
1469
|
-
*
|
|
1470
|
-
* @param mintInterface Mint interface (SPL, Token-2022, or compressed).
|
|
1471
|
-
* @param destination Destination onchain token account address.
|
|
1472
|
-
* @param authority Mint authority public key.
|
|
1473
|
-
* @param payer Fee payer public key.
|
|
1474
|
-
* @param amount Amount to mint.
|
|
1475
|
-
* @param validityProof Validity proof (required for compressed mints).
|
|
1476
|
-
* @param multiSigners Multi-signature signer public keys.
|
|
1477
|
-
*/
|
|
1478
|
-
declare function createMintToInterfaceInstruction(mintInterface: MintInterface, destination: PublicKey, authority: PublicKey, payer: PublicKey, amount: number | bigint, validityProof?: ValidityProofWithContext, multiSigners?: PublicKey[]): TransactionInstruction;
|
|
1479
|
-
|
|
1480
|
-
/**
|
|
1481
|
-
* Create a c-token transfer instruction.
|
|
1482
|
-
*
|
|
1483
|
-
* @param source Source c-token account
|
|
1484
|
-
* @param destination Destination c-token account
|
|
1485
|
-
* @param owner Owner of the source account (signer, also pays for compressible extension top-ups)
|
|
1486
|
-
* @param amount Amount to transfer
|
|
1487
|
-
* @returns Transaction instruction for c-token transfer
|
|
1488
|
-
*/
|
|
1489
|
-
declare function createCTokenTransferInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint): TransactionInstruction;
|
|
1490
|
-
/**
|
|
1491
|
-
* Construct a transfer instruction for SPL/T22/c-token. Defaults to c-token
|
|
1492
|
-
* program. For cross-program transfers (SPL <> c-token), use `wrap`/`unwrap`.
|
|
1493
|
-
*
|
|
1494
|
-
* @param source Source token account
|
|
1495
|
-
* @param destination Destination token account
|
|
1496
|
-
* @param owner Owner of the source account (signer)
|
|
1497
|
-
* @param amount Amount to transfer
|
|
1498
|
-
* @returns instruction for c-token transfer
|
|
1499
|
-
*/
|
|
1500
|
-
declare function createTransferInterfaceInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, multiSigners?: (Signer | PublicKey)[], programId?: PublicKey): TransactionInstruction;
|
|
1501
|
-
|
|
1502
|
-
/**
|
|
1503
|
-
* SPL interface PDA info.
|
|
1504
|
-
*/
|
|
1505
|
-
type SplInterfaceInfo = {
|
|
1506
|
-
/**
|
|
1507
|
-
* The mint of the SPL interface
|
|
1508
|
-
*/
|
|
1509
|
-
mint: PublicKey;
|
|
1510
|
-
/**
|
|
1511
|
-
* The SPL interface address
|
|
1512
|
-
*/
|
|
1513
|
-
splInterfacePda: PublicKey;
|
|
1514
|
-
/**
|
|
1515
|
-
* The token program of the SPL interface
|
|
1516
|
-
*/
|
|
1517
|
-
tokenProgram: PublicKey;
|
|
1518
|
-
/**
|
|
1519
|
-
* count of txs and volume in the past 60 seconds.
|
|
1520
|
-
*/
|
|
1521
|
-
activity?: {
|
|
1522
|
-
txs: number;
|
|
1523
|
-
amountAdded: BN;
|
|
1524
|
-
amountRemoved: BN;
|
|
1525
|
-
};
|
|
1526
|
-
/**
|
|
1527
|
-
* Whether the SPL interface is initialized
|
|
1528
|
-
*/
|
|
1529
|
-
isInitialized: boolean;
|
|
1530
|
-
/**
|
|
1531
|
-
* The balance of the SPL interface
|
|
1532
|
-
*/
|
|
1533
|
-
balance: BN;
|
|
1534
|
-
/**
|
|
1535
|
-
* The index of the SPL interface
|
|
1536
|
-
*/
|
|
1537
|
-
poolIndex: number;
|
|
1538
|
-
/**
|
|
1539
|
-
* The bump used to derive the SPL interface PDA
|
|
1540
|
-
*/
|
|
1541
|
-
bump: number;
|
|
1542
|
-
};
|
|
1543
|
-
/**
|
|
1544
|
-
* @deprecated Use {@link SplInterfaceInfo} instead.
|
|
1545
|
-
* This type maintains backward compatibility by including both tokenPoolPda and splInterfacePda.
|
|
1546
|
-
* Both properties point to the same PublicKey value.
|
|
1547
|
-
*/
|
|
1548
|
-
type TokenPoolInfo = {
|
|
1549
|
-
/**
|
|
1550
|
-
* The mint of the SPL interface
|
|
1551
|
-
*/
|
|
1552
|
-
mint: PublicKey;
|
|
1553
|
-
/**
|
|
1554
|
-
* @deprecated Use splInterfacePda instead.
|
|
1555
|
-
*/
|
|
1556
|
-
tokenPoolPda: PublicKey;
|
|
1557
|
-
/**
|
|
1558
|
-
* The SPL interface address (new name).
|
|
1559
|
-
* For backward compatibility, tokenPoolPda is also available.
|
|
1560
|
-
*/
|
|
1561
|
-
splInterfacePda: PublicKey;
|
|
1562
|
-
/**
|
|
1563
|
-
* The token program of the SPL interface
|
|
1564
|
-
*/
|
|
1565
|
-
tokenProgram: PublicKey;
|
|
1566
|
-
/**
|
|
1567
|
-
* count of txs and volume in the past 60 seconds.
|
|
1568
|
-
*/
|
|
1569
|
-
activity?: {
|
|
1570
|
-
txs: number;
|
|
1571
|
-
amountAdded: BN;
|
|
1572
|
-
amountRemoved: BN;
|
|
1573
|
-
};
|
|
1574
|
-
/**
|
|
1575
|
-
* Whether the SPL interface is initialized
|
|
1576
|
-
*/
|
|
1577
|
-
isInitialized: boolean;
|
|
1578
|
-
/**
|
|
1579
|
-
* The balance of the SPL interface
|
|
1580
|
-
*/
|
|
1581
|
-
balance: BN;
|
|
1582
|
-
/**
|
|
1583
|
-
* The index of the SPL interface
|
|
1584
|
-
*/
|
|
1585
|
-
poolIndex: number;
|
|
1586
|
-
/**
|
|
1587
|
-
* The bump used to derive the SPL interface PDA
|
|
1588
|
-
*/
|
|
1589
|
-
bump: number;
|
|
1590
|
-
};
|
|
1591
|
-
/**
|
|
1592
|
-
* Convert SplInterfaceInfo to TokenPoolInfo for backward compatibility.
|
|
1593
|
-
* @internal
|
|
1594
|
-
*/
|
|
1595
|
-
declare function toTokenPoolInfo(info: SplInterfaceInfo): TokenPoolInfo;
|
|
1596
|
-
/**
|
|
1597
|
-
* Derive SplInterfaceInfo for an SPL interface that will be initialized in the
|
|
1598
|
-
* same transaction. Use this when you need to create an SPL interface and
|
|
1599
|
-
* compress in a single transaction.
|
|
1600
|
-
*
|
|
1601
|
-
* @param mint The mint of the SPL interface
|
|
1602
|
-
* @param tokenProgramId The token program (TOKEN_PROGRAM_ID or TOKEN_2022_PROGRAM_ID)
|
|
1603
|
-
* @param poolIndex The pool index. Default 0.
|
|
1604
|
-
*
|
|
1605
|
-
* @returns SplInterfaceInfo for the to-be-initialized interface
|
|
1606
|
-
*/
|
|
1607
|
-
declare function deriveSplInterfaceInfo(mint: PublicKey, tokenProgramId: PublicKey, poolIndex?: number): SplInterfaceInfo;
|
|
1608
|
-
/**
|
|
1609
|
-
* Check if the SPL interface info is initialized and has a balance.
|
|
1610
|
-
* @param mint The mint of the SPL interface
|
|
1611
|
-
* @param splInterfaceInfo The SPL interface info (or TokenPoolInfo for backward compatibility)
|
|
1612
|
-
* @returns True if the SPL interface info is initialized and has a balance
|
|
1613
|
-
*/
|
|
1614
|
-
declare function checkSplInterfaceInfo(splInterfaceInfo: SplInterfaceInfo | TokenPoolInfo, mint: PublicKey): boolean;
|
|
1615
|
-
/**
|
|
1616
|
-
* Get the SPL interface infos for a given mint.
|
|
1617
|
-
* @param rpc The RPC client
|
|
1618
|
-
* @param mint The mint of the SPL interface
|
|
1619
|
-
* @param commitment The commitment to use
|
|
1620
|
-
*
|
|
1621
|
-
* @returns The SPL interface infos
|
|
1622
|
-
*/
|
|
1623
|
-
declare function getSplInterfaceInfos(rpc: Rpc, mint: PublicKey, commitment?: Commitment): Promise<SplInterfaceInfo[]>;
|
|
1624
|
-
type SplInterfaceActivity = {
|
|
1625
|
-
signature: string;
|
|
1626
|
-
amount: BN;
|
|
1627
|
-
action: Action;
|
|
1628
|
-
};
|
|
1629
|
-
/**
|
|
1630
|
-
* @internal
|
|
1631
|
-
*/
|
|
1632
|
-
declare enum Action {
|
|
1633
|
-
Compress = 1,
|
|
1634
|
-
Decompress = 2,
|
|
1635
|
-
Transfer = 3
|
|
1636
|
-
}
|
|
1637
|
-
/**
|
|
1638
|
-
* For `compress` and `mintTo` instructions only.
|
|
1639
|
-
* Select a random SPL interface info from the SPL interface infos.
|
|
1640
|
-
*
|
|
1641
|
-
* For `decompress`, use {@link selectSplInterfaceInfosForDecompression} instead.
|
|
1532
|
+
* @param validityProof Validity proof for the light mint (null for decompressed light mints)
|
|
1533
|
+
* @param extensionIndex Extension index (default: 0)
|
|
1534
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1535
|
+
*/
|
|
1536
|
+
declare function createUpdateMetadataAuthorityInstruction(mintInterface: MintInterface, currentAuthority: PublicKey, newAuthority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext | null, extensionIndex?: number, maxTopUp?: number): TransactionInstruction;
|
|
1537
|
+
/**
|
|
1538
|
+
* Create instruction for removing a metadata key from a light mint.
|
|
1642
1539
|
*
|
|
1643
|
-
*
|
|
1540
|
+
* Output queue is automatically derived from mintInterface.merkleContext.treeInfo
|
|
1541
|
+
* (preferring nextTreeInfo.queue if available for rollover support).
|
|
1644
1542
|
*
|
|
1645
|
-
* @
|
|
1543
|
+
* @param mintInterface MintInterface from getMintInterface() - must have merkleContext and tokenMetadata
|
|
1544
|
+
* @param authority Metadata update authority public key (must sign)
|
|
1545
|
+
* @param payer Fee payer public key
|
|
1546
|
+
* @param validityProof Validity proof for the light mint (null for decompressed light mints)
|
|
1547
|
+
* @param key Metadata key to remove
|
|
1548
|
+
* @param idempotent If true, don't error if key doesn't exist (default: false)
|
|
1549
|
+
* @param extensionIndex Extension index (default: 0)
|
|
1550
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1646
1551
|
*/
|
|
1647
|
-
declare function
|
|
1552
|
+
declare function createRemoveMetadataKeyInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext | null, key: string, idempotent?: boolean, extensionIndex?: number, maxTopUp?: number): TransactionInstruction;
|
|
1553
|
+
|
|
1554
|
+
interface CompressToPubkey {
|
|
1555
|
+
bump: number;
|
|
1556
|
+
programId: number[];
|
|
1557
|
+
seeds: number[][];
|
|
1558
|
+
}
|
|
1559
|
+
interface CompressibleConfig {
|
|
1560
|
+
tokenAccountVersion: number;
|
|
1561
|
+
rentPayment: number;
|
|
1562
|
+
compressionOnly: number;
|
|
1563
|
+
writeTopUp: number;
|
|
1564
|
+
compressToAccountPubkey?: CompressToPubkey | null;
|
|
1565
|
+
}
|
|
1566
|
+
interface CreateAssociatedLightTokenAccountParams {
|
|
1567
|
+
compressibleConfig?: CompressibleConfig | null;
|
|
1568
|
+
}
|
|
1648
1569
|
/**
|
|
1649
|
-
*
|
|
1570
|
+
* Default compressible config for light-token ATAs - matches Rust SDK defaults.
|
|
1650
1571
|
*
|
|
1651
|
-
*
|
|
1572
|
+
* - tokenAccountVersion: 3 (ShaFlat) - latest hashing scheme
|
|
1573
|
+
* - rentPayment: 16 - prepay 16 epochs (~24 hours rent)
|
|
1574
|
+
* - compressionOnly: 1 - required for ATAs
|
|
1575
|
+
* - writeTopUp: 766 - per-write top-up (~2 epochs rent) when rent < 2 epochs
|
|
1576
|
+
* - compressToAccountPubkey: null - required for ATAs
|
|
1652
1577
|
*
|
|
1653
|
-
*
|
|
1578
|
+
* Cost breakdown at associated token account creation:
|
|
1579
|
+
* - Rent sponsor PDA (LIGHT_TOKEN_RENT_SPONSOR) pays: rent exemption (~890,880 lamports)
|
|
1580
|
+
* - Fee payer pays: compression_cost (11K) + 16 epochs rent (~6,400) = ~17,400 lamports + tx fees
|
|
1654
1581
|
*
|
|
1655
|
-
*
|
|
1656
|
-
*
|
|
1582
|
+
* Per-write top-up (transfers):
|
|
1583
|
+
* - When account rent is below 2 epochs, fee payer pays 766 lamports top-up
|
|
1584
|
+
* - This keeps the account perpetually funded when actively used
|
|
1657
1585
|
*
|
|
1658
|
-
*
|
|
1586
|
+
* Rent calculation (272-byte compressible lightToken account):
|
|
1587
|
+
* - rent_per_epoch = base_rent (128) + bytes * rent_per_byte (272 * 1) = 400 lamports
|
|
1588
|
+
* - 16 epochs = 16 * 400 = 6,400 lamports (24 hours)
|
|
1589
|
+
* - 2 epochs = 2 * 400 = 800 lamports (~3 hours, writeTopUp = 766 is conservative)
|
|
1590
|
+
*
|
|
1591
|
+
* Account size breakdown (272 bytes):
|
|
1592
|
+
* - 165 bytes: SPL token base layout
|
|
1593
|
+
* - 1 byte: account_type discriminator
|
|
1594
|
+
* - 1 byte: Option discriminator for extensions
|
|
1595
|
+
* - 4 bytes: Vec length prefix
|
|
1596
|
+
* - 1 byte: extension type discriminant
|
|
1597
|
+
* - 4 bytes: CompressibleExtension header (decimals_option, decimals, compression_only, is_ata)
|
|
1598
|
+
* - 96 bytes: CompressionInfo struct
|
|
1659
1599
|
*/
|
|
1660
|
-
declare
|
|
1600
|
+
declare const DEFAULT_COMPRESSIBLE_CONFIG: CompressibleConfig;
|
|
1661
1601
|
/**
|
|
1662
|
-
*
|
|
1602
|
+
* Create instruction for creating an associated light-token account.
|
|
1603
|
+
* Uses the default rent sponsor PDA by default.
|
|
1604
|
+
*
|
|
1605
|
+
* @param feePayer Fee payer public key.
|
|
1606
|
+
* @param owner Owner of the associated token account.
|
|
1607
|
+
* @param mint Mint address.
|
|
1608
|
+
* @param compressibleConfig Compressible configuration (defaults to rent sponsor config).
|
|
1609
|
+
* @param configAccount Config account (defaults to LIGHT_TOKEN_CONFIG).
|
|
1610
|
+
* @param rentPayerPda Rent payer PDA (defaults to LIGHT_TOKEN_RENT_SPONSOR).
|
|
1663
1611
|
*/
|
|
1664
|
-
|
|
1612
|
+
declare function createAssociatedLightTokenAccountInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig | null, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
|
|
1665
1613
|
/**
|
|
1666
|
-
*
|
|
1614
|
+
* Create idempotent instruction for creating an associated light-token account.
|
|
1615
|
+
* Uses the default rent sponsor PDA by default.
|
|
1616
|
+
*
|
|
1617
|
+
* @param feePayer Fee payer public key.
|
|
1618
|
+
* @param owner Owner of the associated token account.
|
|
1619
|
+
* @param mint Mint address.
|
|
1620
|
+
* @param compressibleConfig Compressible configuration (defaults to rent sponsor config).
|
|
1621
|
+
* @param configAccount Config account (defaults to LIGHT_TOKEN_CONFIG).
|
|
1622
|
+
* @param rentPayerPda Rent payer PDA (defaults to LIGHT_TOKEN_RENT_SPONSOR).
|
|
1667
1623
|
*/
|
|
1668
|
-
declare function
|
|
1624
|
+
declare function createAssociatedLightTokenAccountIdempotentInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig | null, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
|
|
1625
|
+
|
|
1669
1626
|
/**
|
|
1670
|
-
*
|
|
1627
|
+
* light-token-specific config for createAssociatedTokenAccountInterfaceInstruction
|
|
1671
1628
|
*/
|
|
1672
|
-
|
|
1629
|
+
interface LightTokenConfig {
|
|
1630
|
+
compressibleConfig?: CompressibleConfig | null;
|
|
1631
|
+
configAccount?: PublicKey;
|
|
1632
|
+
rentPayerPda?: PublicKey;
|
|
1633
|
+
}
|
|
1673
1634
|
/**
|
|
1674
|
-
*
|
|
1635
|
+
* Create instruction for creating an associated token account (SPL, Token-2022,
|
|
1636
|
+
* or light-token). Follows SPL Token API signature with optional light-token config at the
|
|
1637
|
+
* end.
|
|
1638
|
+
*
|
|
1639
|
+
* @param payer Fee payer public key.
|
|
1640
|
+
* @param associatedToken Associated token account address.
|
|
1641
|
+
* @param owner Owner of the associated token account.
|
|
1642
|
+
* @param mint Mint address.
|
|
1643
|
+
* @param programId Token program ID (default: TOKEN_PROGRAM_ID).
|
|
1644
|
+
* @param associatedTokenProgramId Associated token program ID.
|
|
1645
|
+
* @param lightTokenConfig Optional light-token-specific configuration.
|
|
1675
1646
|
*/
|
|
1676
|
-
declare function
|
|
1647
|
+
declare function createAssociatedTokenAccountInterfaceInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey, lightTokenConfig?: LightTokenConfig): TransactionInstruction;
|
|
1677
1648
|
/**
|
|
1678
|
-
*
|
|
1649
|
+
* Create idempotent instruction for creating an associated token account (SPL,
|
|
1650
|
+
* Token-2022, or light-token). Follows SPL Token API signature with optional light-token
|
|
1651
|
+
* config at the end.
|
|
1652
|
+
*
|
|
1653
|
+
* @param payer Fee payer public key.
|
|
1654
|
+
* @param associatedToken Associated token account address.
|
|
1655
|
+
* @param owner Owner of the associated token account.
|
|
1656
|
+
* @param mint Mint address.
|
|
1657
|
+
* @param programId Token program ID (default: TOKEN_PROGRAM_ID).
|
|
1658
|
+
* @param associatedTokenProgramId Associated token program ID.
|
|
1659
|
+
* @param lightTokenConfig Optional light-token-specific configuration.
|
|
1679
1660
|
*/
|
|
1680
|
-
declare function
|
|
1661
|
+
declare function createAssociatedTokenAccountInterfaceIdempotentInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey, lightTokenConfig?: LightTokenConfig): TransactionInstruction;
|
|
1681
1662
|
/**
|
|
1682
|
-
*
|
|
1663
|
+
* Short alias for createAssociatedTokenAccountInterfaceIdempotentInstruction.
|
|
1683
1664
|
*/
|
|
1684
|
-
declare
|
|
1665
|
+
declare const createAtaInterfaceIdempotentInstruction: typeof createAssociatedTokenAccountInterfaceIdempotentInstruction;
|
|
1685
1666
|
|
|
1686
1667
|
/**
|
|
1687
|
-
*
|
|
1668
|
+
* Parameters for creating a MintTo instruction.
|
|
1669
|
+
*/
|
|
1670
|
+
interface CreateMintToInstructionParams {
|
|
1671
|
+
/** Light mint account (decompressed from compressed light mint) */
|
|
1672
|
+
mint: PublicKey;
|
|
1673
|
+
/** Destination light-token account to mint to */
|
|
1674
|
+
destination: PublicKey;
|
|
1675
|
+
/** Amount of tokens to mint */
|
|
1676
|
+
amount: number | bigint;
|
|
1677
|
+
/** Mint authority (must be signer) */
|
|
1678
|
+
authority: PublicKey;
|
|
1679
|
+
/** Maximum lamports for rent and top-up combined. Transaction fails if exceeded. (u16::MAX = no limit, 0 = no top-ups allowed) */
|
|
1680
|
+
maxTopUp?: number;
|
|
1681
|
+
/** Optional fee payer for rent top-ups. If not provided, authority pays. */
|
|
1682
|
+
feePayer?: PublicKey;
|
|
1683
|
+
}
|
|
1684
|
+
/**
|
|
1685
|
+
* Create instruction for minting tokens to a light-token account.
|
|
1688
1686
|
*
|
|
1689
|
-
*
|
|
1690
|
-
*
|
|
1691
|
-
* - For SPL destinations: Provide splInterfaceInfo (token pool info) and decimals
|
|
1687
|
+
* This is a simple 3-4 account instruction for minting to light-token associated token accounts (hot).
|
|
1688
|
+
* Uses discriminator 7 (LightTokenMintTo).
|
|
1692
1689
|
*
|
|
1693
|
-
* @param
|
|
1694
|
-
* @
|
|
1695
|
-
* @param toAddress Destination token account address (c-token or SPL ATA)
|
|
1696
|
-
* @param amount Amount to decompress
|
|
1697
|
-
* @param validityProof Validity proof (contains compressedProof and rootIndices)
|
|
1698
|
-
* @param splInterfaceInfo Optional: SPL interface info for SPL destinations
|
|
1699
|
-
* @param decimals Mint decimals (required for SPL destinations)
|
|
1700
|
-
* @returns TransactionInstruction
|
|
1690
|
+
* @param params - Mint instruction parameters
|
|
1691
|
+
* @returns TransactionInstruction for minting tokens
|
|
1701
1692
|
*/
|
|
1702
|
-
declare function
|
|
1693
|
+
declare function createMintToInstruction(params: CreateMintToInstructionParams): TransactionInstruction;
|
|
1703
1694
|
|
|
1695
|
+
/** Default compressible config PDA (V1) */
|
|
1696
|
+
declare const LIGHT_TOKEN_CONFIG: PublicKey;
|
|
1697
|
+
/** Default rent sponsor PDA (V1) */
|
|
1698
|
+
declare const LIGHT_TOKEN_RENT_SPONSOR: PublicKey;
|
|
1704
1699
|
/**
|
|
1705
|
-
*
|
|
1700
|
+
* Token data version enum - mirrors Rust TokenDataVersion
|
|
1701
|
+
* Used for compressed token account hashing strategy
|
|
1706
1702
|
*/
|
|
1707
|
-
|
|
1708
|
-
/**
|
|
1709
|
-
|
|
1703
|
+
declare enum TokenDataVersion {
|
|
1704
|
+
/** V1: Poseidon hash with little-endian amount, discriminator [2,0,0,0,0,0,0,0] */
|
|
1705
|
+
V1 = 1,
|
|
1706
|
+
/** V2: Poseidon hash with big-endian amount, discriminator [0,0,0,0,0,0,0,3] */
|
|
1707
|
+
V2 = 2,
|
|
1708
|
+
/** ShaFlat: SHA256 hash of borsh-serialized data, discriminator [0,0,0,0,0,0,0,4] */
|
|
1709
|
+
ShaFlat = 3
|
|
1710
1710
|
}
|
|
1711
|
-
|
|
1711
|
+
declare const POOL_SEED: Buffer$1<ArrayBuffer>;
|
|
1712
|
+
declare const CPI_AUTHORITY_SEED: Buffer$1<ArrayBuffer>;
|
|
1713
|
+
declare const SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE = 1461600;
|
|
1714
|
+
declare const CREATE_TOKEN_POOL_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1715
|
+
declare const MINT_TO_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1716
|
+
declare const BATCH_COMPRESS_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1717
|
+
declare const TRANSFER_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1718
|
+
declare const COMPRESS_SPL_TOKEN_ACCOUNT_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1719
|
+
declare const APPROVE_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1720
|
+
declare const REVOKE_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1721
|
+
declare const ADD_TOKEN_POOL_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1712
1722
|
/**
|
|
1713
|
-
*
|
|
1714
|
-
*
|
|
1715
|
-
*
|
|
1716
|
-
* Integrating programs provide their own fetch/parse - this is just the data shape.
|
|
1723
|
+
* Maximum lamports for rent top-up in a single instruction.
|
|
1724
|
+
* u16::MAX = no limit; 0 = no top-ups allowed.
|
|
1725
|
+
* Matches Rust SDK (e.g. token-sdk create_mints uses u16::MAX for "no limit").
|
|
1717
1726
|
*/
|
|
1718
|
-
|
|
1719
|
-
/** Parsed account data (program-specific) */
|
|
1720
|
-
parsed: T;
|
|
1721
|
-
/** Load context - present if account is compressed (cold), undefined if hot */
|
|
1722
|
-
loadContext?: MerkleContext;
|
|
1723
|
-
}
|
|
1727
|
+
declare const MAX_TOP_UP = 65535;
|
|
1724
1728
|
/**
|
|
1725
|
-
*
|
|
1726
|
-
*
|
|
1727
|
-
*
|
|
1728
|
-
* The integrating program is responsible for fetching and parsing their accounts.
|
|
1729
|
-
* This helper just packs them for the decompressAccountsIdempotent instruction.
|
|
1729
|
+
* Rent configuration constants for compressible light token accounts.
|
|
1730
|
+
* These match the Rust SDK defaults in program-libs/compressible/src/rent/config.rs
|
|
1730
1731
|
*/
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
*/
|
|
1744
|
-
tokenVariant?: string;
|
|
1745
|
-
/** Parsed account info (from program-specific fetch) */
|
|
1746
|
-
info: ParsedAccountInfoInterface<T>;
|
|
1747
|
-
}
|
|
1732
|
+
/** Base rent per epoch (lamports) */
|
|
1733
|
+
declare const BASE_RENT_PER_EPOCH = 128;
|
|
1734
|
+
/** Rent per byte per epoch (lamports) */
|
|
1735
|
+
declare const RENT_PER_BYTE_PER_EPOCH = 1;
|
|
1736
|
+
/** Slots per rent epoch (1.5 hours) */
|
|
1737
|
+
declare const SLOTS_PER_RENT_EPOCH = 13500;
|
|
1738
|
+
/** Compression cost (lamports) - paid at account creation */
|
|
1739
|
+
declare const COMPRESSION_COST = 10000;
|
|
1740
|
+
/** Compression incentive (lamports) - paid at account creation */
|
|
1741
|
+
declare const COMPRESSION_INCENTIVE = 1000;
|
|
1742
|
+
/** Total compression cost (COMPRESSION_COST + COMPRESSION_INCENTIVE) */
|
|
1743
|
+
declare const TOTAL_COMPRESSION_COST: number;
|
|
1748
1744
|
/**
|
|
1749
|
-
*
|
|
1745
|
+
* Compressible light token account size in bytes.
|
|
1746
|
+
* = 165 (base SPL token) + 1 (account_type) + 1 (Option) + 4 (Vec len) + 1 (ext disc) + 4 (ext header) + 96 (CompressionInfo) = 272
|
|
1747
|
+
* Source: program-libs/token-interface/src/state/token/top_up.rs MIN_SIZE_WITH_COMPRESSIBLE
|
|
1750
1748
|
*/
|
|
1751
|
-
|
|
1752
|
-
[key: string]: unknown;
|
|
1753
|
-
merkleContext: {
|
|
1754
|
-
merkleTreePubkeyIndex: number;
|
|
1755
|
-
queuePubkeyIndex: number;
|
|
1756
|
-
};
|
|
1757
|
-
}
|
|
1749
|
+
declare const COMPRESSIBLE_LIGHT_TOKEN_ACCOUNT_SIZE = 272;
|
|
1758
1750
|
/**
|
|
1759
|
-
*
|
|
1751
|
+
* Calculate rent per epoch for a given account size.
|
|
1752
|
+
* Formula: base_rent + (bytes * lamports_per_byte_per_epoch)
|
|
1760
1753
|
*/
|
|
1761
|
-
|
|
1762
|
-
/** Validity proof wrapped in option (null if all proveByIndex) */
|
|
1763
|
-
proofOption: {
|
|
1764
|
-
0: ValidityProof | null;
|
|
1765
|
-
};
|
|
1766
|
-
/** Packed compressed accounts data for instruction */
|
|
1767
|
-
compressedAccounts: PackedCompressedAccount[];
|
|
1768
|
-
/** Offset to system accounts in remainingAccounts */
|
|
1769
|
-
systemAccountsOffset: number;
|
|
1770
|
-
/** Account metas for remaining accounts */
|
|
1771
|
-
remainingAccounts: AccountMeta[];
|
|
1772
|
-
}
|
|
1754
|
+
declare function rentPerEpoch(bytes: number): number;
|
|
1773
1755
|
/**
|
|
1774
|
-
*
|
|
1756
|
+
* Default rent per epoch for a compressible light token account (272 bytes).
|
|
1757
|
+
* = 128 + 272 = 400 lamports
|
|
1775
1758
|
*/
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
}
|
|
1759
|
+
declare const COMPRESSIBLE_LIGHT_TOKEN_RENT_PER_EPOCH: number;
|
|
1760
|
+
/** Default prepaid epochs (24 hours = 16 epochs * 1.5h) */
|
|
1761
|
+
declare const DEFAULT_PREPAY_EPOCHS = 16;
|
|
1762
|
+
/** Default write top-up (lamports) - ~2 epochs rent */
|
|
1763
|
+
declare const DEFAULT_WRITE_TOP_UP = 766;
|
|
1782
1764
|
/**
|
|
1783
|
-
*
|
|
1784
|
-
*
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
*
|
|
1790
|
-
*
|
|
1791
|
-
* @
|
|
1792
|
-
* @param programId Program ID for decompressAccountsIdempotent
|
|
1793
|
-
* @param programAccounts PDAs and vaults (caller pre-fetches)
|
|
1794
|
-
* @param atas User ATAs (fetched via getAtaInterface)
|
|
1795
|
-
* @param options Optional load options
|
|
1796
|
-
* @returns LoadResult with decompressParams and ataInstructions
|
|
1797
|
-
*
|
|
1798
|
-
* @example
|
|
1799
|
-
* ```typescript
|
|
1800
|
-
* const poolInfo = await myProgram.fetchPoolState(rpc, poolAddress);
|
|
1801
|
-
* const vault0Ata = getAssociatedTokenAddressInterface(token0Mint, poolAddress);
|
|
1802
|
-
* const vault0Info = await getAtaInterface(rpc, vault0Ata, poolAddress, token0Mint, undefined, CTOKEN_PROGRAM_ID);
|
|
1803
|
-
* const userAta = getAssociatedTokenAddressInterface(tokenMint, userWallet);
|
|
1804
|
-
* const userAtaInfo = await getAtaInterface(rpc, userAta, userWallet, tokenMint);
|
|
1805
|
-
*
|
|
1806
|
-
* const result = await createLoadAccountsParams(
|
|
1807
|
-
* rpc,
|
|
1808
|
-
* payer.publicKey,
|
|
1809
|
-
* programId,
|
|
1810
|
-
* [
|
|
1811
|
-
* { address: poolAddress, accountType: 'poolState', info: poolInfo },
|
|
1812
|
-
* { address: vault0, accountType: 'cTokenData', tokenVariant: 'token0Vault', info: vault0Info },
|
|
1813
|
-
* ],
|
|
1814
|
-
* [userAta],
|
|
1815
|
-
* );
|
|
1765
|
+
* Calculate fee payer cost at ATA creation.
|
|
1766
|
+
* = compression_cost (11K) + (prepay_epochs * rent_per_epoch)
|
|
1767
|
+
*/
|
|
1768
|
+
declare function calculateFeePayerCostAtCreation(prepayEpochs?: number, accountBytes?: number): number;
|
|
1769
|
+
|
|
1770
|
+
/**
|
|
1771
|
+
* Create instruction for minting tokens from a light mint to compressed accounts.
|
|
1772
|
+
* To mint to light-token associated token accounts across SPL/T22/light mints, use
|
|
1773
|
+
* {@link createMintToInterfaceInstruction} instead.
|
|
1816
1774
|
*
|
|
1817
|
-
*
|
|
1818
|
-
*
|
|
1819
|
-
*
|
|
1820
|
-
*
|
|
1821
|
-
*
|
|
1822
|
-
*
|
|
1823
|
-
*
|
|
1824
|
-
*
|
|
1825
|
-
*
|
|
1826
|
-
*
|
|
1827
|
-
*
|
|
1828
|
-
* }
|
|
1829
|
-
* ```
|
|
1775
|
+
* @param authority Mint authority public key.
|
|
1776
|
+
* @param payer Fee payer public key.
|
|
1777
|
+
* @param validityProof Validity proof for the light mint.
|
|
1778
|
+
* @param merkleContext Merkle context of the light mint.
|
|
1779
|
+
* @param mintData Mint instruction data.
|
|
1780
|
+
* @param recipients Array of recipients with amounts.
|
|
1781
|
+
* @param outputStateTreeInfo Optional output state tree info. Uses merkle
|
|
1782
|
+
* context queue if not provided.
|
|
1783
|
+
* @param tokenAccountVersion Token account version (default:
|
|
1784
|
+
* TokenDataVersion.ShaFlat).
|
|
1785
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1830
1786
|
*/
|
|
1831
|
-
declare function
|
|
1787
|
+
declare function createMintToCompressedInstruction(authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, merkleContext: MerkleContext, mintData: MintInstructionData, recipients: Array<{
|
|
1788
|
+
recipient: PublicKey;
|
|
1789
|
+
amount: number | bigint;
|
|
1790
|
+
}>, outputStateTreeInfo?: TreeInfo, tokenAccountVersion?: TokenDataVersion, maxTopUp?: number): TransactionInstruction;
|
|
1791
|
+
|
|
1832
1792
|
/**
|
|
1833
|
-
*
|
|
1793
|
+
* Create mint-to instruction for SPL, Token-2022, or light-token mints.
|
|
1794
|
+
* This instruction ONLY mints to light-token associated token accounts (hot).
|
|
1795
|
+
*
|
|
1796
|
+
* For light-token mints, the light mint account must exist (mint must be decompressed first).
|
|
1797
|
+
*
|
|
1798
|
+
* @param mintInterface Mint interface (SPL, Token-2022, or light-token).
|
|
1799
|
+
* @param destination Destination onchain token account address.
|
|
1800
|
+
* @param authority Mint authority public key.
|
|
1801
|
+
* @param payer Fee payer public key.
|
|
1802
|
+
* @param amount Amount to mint.
|
|
1803
|
+
* @param validityProof Not used (legacy parameter, kept for compatibility).
|
|
1804
|
+
* @param multiSigners Multi-signature signer public keys (SPL/T22 only).
|
|
1834
1805
|
*/
|
|
1835
|
-
declare function
|
|
1806
|
+
declare function createMintToInterfaceInstruction(mintInterface: MintInterface, destination: PublicKey, authority: PublicKey, payer: PublicKey, amount: number | bigint, validityProof?: ValidityProofWithContext, multiSigners?: PublicKey[]): TransactionInstruction;
|
|
1836
1807
|
|
|
1837
1808
|
/**
|
|
1838
1809
|
* Create a wrap instruction that moves tokens from an SPL/T22 account to a
|
|
1839
|
-
*
|
|
1810
|
+
* light-token account.
|
|
1840
1811
|
*
|
|
1841
1812
|
* @param source Source SPL/T22 token account
|
|
1842
|
-
* @param destination Destination
|
|
1813
|
+
* @param destination Destination light-token account
|
|
1843
1814
|
* @param owner Owner of the source account (signer)
|
|
1844
1815
|
* @param mint Mint address
|
|
1845
1816
|
* @param amount Amount to wrap,
|
|
1846
1817
|
* @param splInterfaceInfo SPL interface info for the compression
|
|
1847
1818
|
* @param decimals Mint decimals (required for transfer_checked)
|
|
1848
1819
|
* @param payer Fee payer (defaults to owner)
|
|
1820
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1849
1821
|
* @returns Instruction to wrap tokens
|
|
1850
1822
|
*/
|
|
1851
|
-
declare function createWrapInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, mint: PublicKey, amount: bigint, splInterfaceInfo: SplInterfaceInfo, decimals: number, payer?: PublicKey): TransactionInstruction;
|
|
1823
|
+
declare function createWrapInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, mint: PublicKey, amount: bigint, splInterfaceInfo: SplInterfaceInfo, decimals: number, payer?: PublicKey, maxTopUp?: number): TransactionInstruction;
|
|
1852
1824
|
|
|
1853
1825
|
/**
|
|
1854
|
-
* Create an unwrap instruction that moves tokens from a
|
|
1826
|
+
* Create an unwrap instruction that moves tokens from a light-token account to an
|
|
1855
1827
|
* SPL/T22 account.
|
|
1856
1828
|
*
|
|
1857
|
-
* @param source Source
|
|
1829
|
+
* @param source Source light-token account
|
|
1858
1830
|
* @param destination Destination SPL/T22 token account
|
|
1859
1831
|
* @param owner Owner of the source account (signer)
|
|
1860
1832
|
* @param mint Mint address
|
|
@@ -1862,24 +1834,62 @@ declare function createWrapInstruction(source: PublicKey, destination: PublicKey
|
|
|
1862
1834
|
* @param splInterfaceInfo SPL interface info for the decompression
|
|
1863
1835
|
* @param decimals Mint decimals (required for transfer_checked)
|
|
1864
1836
|
* @param payer Fee payer (defaults to owner if not provided)
|
|
1837
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1865
1838
|
* @returns TransactionInstruction to unwrap tokens
|
|
1866
1839
|
*/
|
|
1867
|
-
declare function createUnwrapInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, mint: PublicKey, amount: bigint, splInterfaceInfo: SplInterfaceInfo, decimals: number, payer?: PublicKey): TransactionInstruction;
|
|
1840
|
+
declare function createUnwrapInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, mint: PublicKey, amount: bigint, splInterfaceInfo: SplInterfaceInfo, decimals: number, payer?: PublicKey, maxTopUp?: number): TransactionInstruction;
|
|
1841
|
+
|
|
1842
|
+
/**
|
|
1843
|
+
* Create an instruction to freeze a decompressed light-token account.
|
|
1844
|
+
*
|
|
1845
|
+
* Freezing sets the account state to AccountState::Frozen, preventing
|
|
1846
|
+
* transfers and other token operations. Only the mint's freeze_authority
|
|
1847
|
+
* can freeze accounts.
|
|
1848
|
+
*
|
|
1849
|
+
* Account order per program:
|
|
1850
|
+
* 0. token_account (mutable) - the light-token account to freeze
|
|
1851
|
+
* 1. mint (readonly) - the mint associated with the token account
|
|
1852
|
+
* 2. freeze_authority - must match mint.freeze_authority (signer)
|
|
1853
|
+
*
|
|
1854
|
+
* @param tokenAccount The light-token account to freeze (must be Initialized)
|
|
1855
|
+
* @param mint The mint of the light-token account
|
|
1856
|
+
* @param freezeAuthority The freeze authority of the mint (signer)
|
|
1857
|
+
* @returns TransactionInstruction
|
|
1858
|
+
*/
|
|
1859
|
+
declare function createLightTokenFreezeAccountInstruction(tokenAccount: PublicKey, mint: PublicKey, freezeAuthority: PublicKey): TransactionInstruction;
|
|
1860
|
+
/**
|
|
1861
|
+
* Create an instruction to thaw (unfreeze) a frozen light-token account.
|
|
1862
|
+
*
|
|
1863
|
+
* Thawing restores the account state from AccountState::Frozen to
|
|
1864
|
+
* AccountState::Initialized, re-enabling token operations. Only the
|
|
1865
|
+
* mint's freeze_authority can thaw accounts.
|
|
1866
|
+
*
|
|
1867
|
+
* Account order per program:
|
|
1868
|
+
* 0. token_account (mutable) - the frozen light-token account to thaw
|
|
1869
|
+
* 1. mint (readonly) - the mint associated with the token account
|
|
1870
|
+
* 2. freeze_authority - must match mint.freeze_authority (signer)
|
|
1871
|
+
*
|
|
1872
|
+
* @param tokenAccount The frozen light-token account to thaw
|
|
1873
|
+
* @param mint The mint of the light-token account
|
|
1874
|
+
* @param freezeAuthority The freeze authority of the mint (signer)
|
|
1875
|
+
* @returns TransactionInstruction
|
|
1876
|
+
*/
|
|
1877
|
+
declare function createLightTokenThawAccountInstruction(tokenAccount: PublicKey, mint: PublicKey, freezeAuthority: PublicKey): TransactionInstruction;
|
|
1868
1878
|
|
|
1869
1879
|
/**
|
|
1870
|
-
* Create and initialize a new mint for SPL/T22/
|
|
1880
|
+
* Create and initialize a new mint for SPL/T22/light-token.
|
|
1871
1881
|
*
|
|
1872
1882
|
* @param rpc RPC connection to use
|
|
1873
1883
|
* @param payer Fee payer
|
|
1874
|
-
* @param mintAuthority Account that will control minting (signer for
|
|
1884
|
+
* @param mintAuthority Account that will control minting (signer for light-token mints)
|
|
1875
1885
|
* @param freezeAuthority Account that will control freeze and thaw (optional)
|
|
1876
1886
|
* @param decimals Location of the decimal place
|
|
1877
1887
|
* @param keypair Mint keypair (defaults to a random keypair)
|
|
1878
1888
|
* @param confirmOptions Confirm options
|
|
1879
|
-
* @param programId Token program ID (defaults to
|
|
1880
|
-
* @param tokenMetadata Optional token metadata (
|
|
1881
|
-
* @param outputStateTreeInfo Optional output state tree info (
|
|
1882
|
-
* @param addressTreeInfo Optional address tree info (
|
|
1889
|
+
* @param programId Token program ID (defaults to LIGHT_TOKEN_PROGRAM_ID)
|
|
1890
|
+
* @param tokenMetadata Optional token metadata (light-token mints only)
|
|
1891
|
+
* @param outputStateTreeInfo Optional output state tree info (light-token mints only)
|
|
1892
|
+
* @param addressTreeInfo Optional address tree info (light-token mints only)
|
|
1883
1893
|
*
|
|
1884
1894
|
* @returns Object with mint address and transaction signature
|
|
1885
1895
|
*/
|
|
@@ -1889,7 +1899,8 @@ declare function createMintInterface(rpc: Rpc, payer: Signer, mintAuthority: Pub
|
|
|
1889
1899
|
}>;
|
|
1890
1900
|
|
|
1891
1901
|
/**
|
|
1892
|
-
* Update the mint authority of a
|
|
1902
|
+
* Update the mint authority of a light-token mint.
|
|
1903
|
+
* Works for both compressed and decompressed light mints.
|
|
1893
1904
|
*
|
|
1894
1905
|
* @param rpc RPC connection
|
|
1895
1906
|
* @param payer Fee payer (signer)
|
|
@@ -1900,7 +1911,8 @@ declare function createMintInterface(rpc: Rpc, payer: Signer, mintAuthority: Pub
|
|
|
1900
1911
|
*/
|
|
1901
1912
|
declare function updateMintAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, currentMintAuthority: Signer, newMintAuthority: PublicKey | null, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
1902
1913
|
/**
|
|
1903
|
-
* Update the freeze authority of a
|
|
1914
|
+
* Update the freeze authority of a light-token mint.
|
|
1915
|
+
* Works for both compressed and decompressed light mints.
|
|
1904
1916
|
*
|
|
1905
1917
|
* @param rpc RPC connection
|
|
1906
1918
|
* @param payer Fee payer (signer)
|
|
@@ -1912,7 +1924,8 @@ declare function updateMintAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, c
|
|
|
1912
1924
|
declare function updateFreezeAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, currentFreezeAuthority: Signer, newFreezeAuthority: PublicKey | null, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
1913
1925
|
|
|
1914
1926
|
/**
|
|
1915
|
-
* Update a metadata field on a
|
|
1927
|
+
* Update a metadata field on a light-token mint.
|
|
1928
|
+
* Works for both compressed and decompressed light mints.
|
|
1916
1929
|
*
|
|
1917
1930
|
* @param rpc RPC connection
|
|
1918
1931
|
* @param payer Fee payer (signer)
|
|
@@ -1926,7 +1939,8 @@ declare function updateFreezeAuthority(rpc: Rpc, payer: Signer, mint: PublicKey,
|
|
|
1926
1939
|
*/
|
|
1927
1940
|
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>;
|
|
1928
1941
|
/**
|
|
1929
|
-
* Update the metadata authority of a
|
|
1942
|
+
* Update the metadata authority of a light-token mint.
|
|
1943
|
+
* Works for both compressed and decompressed light mints.
|
|
1930
1944
|
*
|
|
1931
1945
|
* @param rpc RPC connection
|
|
1932
1946
|
* @param payer Fee payer (signer)
|
|
@@ -1938,7 +1952,8 @@ declare function updateMetadataField(rpc: Rpc, payer: Signer, mint: PublicKey, a
|
|
|
1938
1952
|
*/
|
|
1939
1953
|
declare function updateMetadataAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, currentAuthority: Signer, newAuthority: PublicKey, extensionIndex?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
1940
1954
|
/**
|
|
1941
|
-
* Remove a metadata key from a
|
|
1955
|
+
* Remove a metadata key from a light-token mint.
|
|
1956
|
+
* Works for both compressed and decompressed light mints.
|
|
1942
1957
|
*
|
|
1943
1958
|
* @param rpc RPC connection
|
|
1944
1959
|
* @param payer Fee payer (signer)
|
|
@@ -1952,8 +1967,8 @@ declare function updateMetadataAuthority(rpc: Rpc, payer: Signer, mint: PublicKe
|
|
|
1952
1967
|
declare function removeMetadataKey(rpc: Rpc, payer: Signer, mint: PublicKey, authority: Signer, key: string, idempotent?: boolean, extensionIndex?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
1953
1968
|
|
|
1954
1969
|
/**
|
|
1955
|
-
* Create an associated token account for SPL/T22/
|
|
1956
|
-
* program.
|
|
1970
|
+
* Create an associated token account for SPL/T22/light-token. Defaults to
|
|
1971
|
+
* light-token program.
|
|
1957
1972
|
*
|
|
1958
1973
|
* @param rpc RPC connection
|
|
1959
1974
|
* @param payer Fee payer and transaction signer
|
|
@@ -1962,16 +1977,16 @@ declare function removeMetadataKey(rpc: Rpc, payer: Signer, mint: PublicKey, aut
|
|
|
1962
1977
|
* @param allowOwnerOffCurve Allow owner to be a PDA (default: false)
|
|
1963
1978
|
* @param confirmOptions Options for confirming the transaction
|
|
1964
1979
|
* @param programId Token program ID (default:
|
|
1965
|
-
*
|
|
1966
|
-
* @param associatedTokenProgramId
|
|
1967
|
-
* provided)
|
|
1968
|
-
* @param
|
|
1980
|
+
* LIGHT_TOKEN_PROGRAM_ID)
|
|
1981
|
+
* @param associatedTokenProgramId associated token account program ID
|
|
1982
|
+
* (auto-derived if not provided)
|
|
1983
|
+
* @param lightTokenConfig Optional rent config
|
|
1969
1984
|
* @returns Address of the new associated token account
|
|
1970
1985
|
*/
|
|
1971
|
-
declare function createAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey,
|
|
1986
|
+
declare function createAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey, lightTokenConfig?: LightTokenConfig): Promise<PublicKey>;
|
|
1972
1987
|
/**
|
|
1973
|
-
* Create an associated token account idempotently for SPL/T22/
|
|
1974
|
-
* to
|
|
1988
|
+
* Create an associated token account idempotently for SPL/T22/light-token.
|
|
1989
|
+
* Defaults to light-token program.
|
|
1975
1990
|
*
|
|
1976
1991
|
* If the account already exists, the instruction succeeds without error.
|
|
1977
1992
|
*
|
|
@@ -1982,19 +1997,35 @@ declare function createAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, ow
|
|
|
1982
1997
|
* @param allowOwnerOffCurve Allow owner to be a PDA (default: false)
|
|
1983
1998
|
* @param confirmOptions Options for confirming the transaction
|
|
1984
1999
|
* @param programId Token program ID (default:
|
|
1985
|
-
*
|
|
1986
|
-
* @param associatedTokenProgramId
|
|
1987
|
-
* provided)
|
|
1988
|
-
* @param
|
|
2000
|
+
* LIGHT_TOKEN_PROGRAM_ID)
|
|
2001
|
+
* @param associatedTokenProgramId associated token account program ID
|
|
2002
|
+
* (auto-derived if not provided)
|
|
2003
|
+
* @param lightTokenConfig Optional light-token-specific configuration
|
|
1989
2004
|
*
|
|
1990
2005
|
* @returns Address of the associated token account
|
|
1991
2006
|
*/
|
|
1992
|
-
declare function createAtaInterfaceIdempotent(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey,
|
|
2007
|
+
declare function createAtaInterfaceIdempotent(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey, lightTokenConfig?: LightTokenConfig): Promise<PublicKey>;
|
|
1993
2008
|
|
|
1994
|
-
|
|
2009
|
+
/**
|
|
2010
|
+
* Mint tokens to a light-token account.
|
|
2011
|
+
*
|
|
2012
|
+
* This is a simple mint instruction for minting to light-token associated token accounts (hot).
|
|
2013
|
+
* The light mint account must exist (mint must be decompressed first).
|
|
2014
|
+
*
|
|
2015
|
+
* @param rpc - RPC connection
|
|
2016
|
+
* @param payer - Fee payer (signer)
|
|
2017
|
+
* @param mint - Mint address (light mint account)
|
|
2018
|
+
* @param destination - Destination light-token account
|
|
2019
|
+
* @param authority - Mint authority (signer)
|
|
2020
|
+
* @param amount - Amount to mint
|
|
2021
|
+
* @param maxTopUp - Optional maximum lamports for rent top-up
|
|
2022
|
+
* @param confirmOptions - Optional confirm options
|
|
2023
|
+
* @returns Transaction signature
|
|
2024
|
+
*/
|
|
2025
|
+
declare function mintTo$1(rpc: Rpc, payer: Signer, mint: PublicKey, destination: PublicKey, authority: Signer, amount: number | bigint, maxTopUp?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
1995
2026
|
|
|
1996
2027
|
/**
|
|
1997
|
-
* Mint
|
|
2028
|
+
* Mint light-tokens directly to compressed accounts.
|
|
1998
2029
|
*
|
|
1999
2030
|
* @param rpc RPC connection
|
|
2000
2031
|
* @param payer Fee payer
|
|
@@ -2003,77 +2034,63 @@ declare function mintTo$1(rpc: Rpc, payer: Signer, mint: PublicKey, recipientAcc
|
|
|
2003
2034
|
* @param recipients Array of recipients with amounts
|
|
2004
2035
|
* @param outputStateTreeInfo Optional output state tree info (auto-fetched if not provided)
|
|
2005
2036
|
* @param tokenAccountVersion Token account version (default: 3)
|
|
2037
|
+
* @param maxTopUp Optional: cap on rent top-up (units of 1k lamports; default no cap)
|
|
2006
2038
|
* @param confirmOptions Optional confirm options
|
|
2007
2039
|
*/
|
|
2008
2040
|
declare function mintToCompressed(rpc: Rpc, payer: Signer, mint: PublicKey, authority: Signer, recipients: Array<{
|
|
2009
2041
|
recipient: PublicKey;
|
|
2010
2042
|
amount: number | bigint;
|
|
2011
|
-
}>, outputStateTreeInfo?: TreeInfo, tokenAccountVersion?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2043
|
+
}>, outputStateTreeInfo?: TreeInfo, tokenAccountVersion?: number, maxTopUp?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2012
2044
|
|
|
2013
2045
|
/**
|
|
2014
2046
|
* Mint tokens to a decompressed/onchain token account.
|
|
2015
|
-
* Works with SPL, Token-2022, and
|
|
2047
|
+
* Works with SPL, Token-2022, and light-token mints.
|
|
2048
|
+
*
|
|
2049
|
+
* This function ONLY mints to light-token associated token accounts (hot), never to compressed light-token accounts (cold).
|
|
2050
|
+
* For light-token mints, the light mint account must exist (mint must be decompressed first).
|
|
2016
2051
|
*
|
|
2017
|
-
* This function ONLY mints to decompressed onchain token accounts, never to compressed accounts.
|
|
2018
2052
|
* The signature matches the standard SPL mintTo for simplicity and consistency.
|
|
2019
2053
|
*
|
|
2020
2054
|
* @param rpc - RPC connection to use
|
|
2021
2055
|
* @param payer - Transaction fee payer
|
|
2022
|
-
* @param mint - Mint address (SPL, Token-2022, or
|
|
2056
|
+
* @param mint - Mint address (SPL, Token-2022, or light-token mint)
|
|
2023
2057
|
* @param destination - Destination token account address (must be an existing onchain token account)
|
|
2024
2058
|
* @param authority - Mint authority (can be Signer or PublicKey if multiSigners provided)
|
|
2025
2059
|
* @param amount - Amount to mint
|
|
2026
2060
|
* @param multiSigners - Optional: Multi-signature signers (default: [])
|
|
2027
2061
|
* @param confirmOptions - Optional: Transaction confirmation options
|
|
2028
|
-
* @param programId - Optional: Token program ID
|
|
2062
|
+
* @param programId - Optional: Token program ID. If undefined, auto-detects.
|
|
2029
2063
|
*
|
|
2030
2064
|
* @returns Transaction signature
|
|
2031
2065
|
*/
|
|
2032
2066
|
declare function mintToInterface(rpc: Rpc, payer: Signer, mint: PublicKey, destination: PublicKey, authority: Signer | PublicKey, amount: number | bigint, multiSigners?: Signer[], confirmOptions?: ConfirmOptions, programId?: PublicKey): Promise<TransactionSignature>;
|
|
2033
2067
|
|
|
2034
2068
|
/**
|
|
2035
|
-
*
|
|
2036
|
-
*
|
|
2037
|
-
* For unified loading, use {@link loadAta} instead.
|
|
2038
|
-
*
|
|
2039
|
-
* @param rpc RPC connection
|
|
2040
|
-
* @param payer Fee payer (signer)
|
|
2041
|
-
* @param owner Owner of the compressed tokens (signer)
|
|
2042
|
-
* @param mint Mint address
|
|
2043
|
-
* @param amount Amount to decompress (defaults to all)
|
|
2044
|
-
* @param destinationAta Destination token account address
|
|
2045
|
-
* @param destinationOwner Owner of the destination ATA
|
|
2046
|
-
* @param splInterfaceInfo SPL interface info for SPL/T22 destinations
|
|
2047
|
-
* @param confirmOptions Confirm options
|
|
2048
|
-
* @returns Transaction signature, null if nothing to load.
|
|
2049
|
-
*/
|
|
2050
|
-
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>;
|
|
2051
|
-
|
|
2052
|
-
/**
|
|
2053
|
-
* Wrap tokens from an SPL/T22 account to a c-token account.
|
|
2069
|
+
* Wrap tokens from an SPL/T22 account to a light-token account.
|
|
2054
2070
|
*
|
|
2055
2071
|
* This is an agnostic action that takes explicit account addresses (spl-token style).
|
|
2056
|
-
* Use getAssociatedTokenAddressSync() to derive
|
|
2072
|
+
* Use getAssociatedTokenAddressSync() to derive associated token account addresses if needed.
|
|
2057
2073
|
*
|
|
2058
2074
|
* @param rpc RPC connection
|
|
2059
2075
|
* @param payer Fee payer
|
|
2060
|
-
* @param source Source SPL/T22 token account (any token account, not just
|
|
2061
|
-
* @param destination Destination
|
|
2076
|
+
* @param source Source SPL/T22 token account (any token account, not just associated token account)
|
|
2077
|
+
* @param destination Destination light-token account
|
|
2062
2078
|
* @param owner Owner/authority of the source account (must sign)
|
|
2063
2079
|
* @param mint Mint address
|
|
2064
2080
|
* @param amount Amount to wrap
|
|
2065
2081
|
* @param splInterfaceInfo Optional: SPL interface info (will be fetched if not provided)
|
|
2082
|
+
* @param maxTopUp Optional: cap on rent top-up (units of 1k lamports; default no cap)
|
|
2066
2083
|
* @param confirmOptions Optional: Confirm options
|
|
2067
2084
|
*
|
|
2068
2085
|
* @example
|
|
2069
2086
|
* const splAta = getAssociatedTokenAddressSync(mint, owner.publicKey, false, TOKEN_PROGRAM_ID);
|
|
2070
|
-
* const
|
|
2087
|
+
* const lightTokenAta = getAssociatedTokenAddressInterface(mint, owner.publicKey); // defaults to light-token
|
|
2071
2088
|
*
|
|
2072
2089
|
* await wrap(
|
|
2073
2090
|
* rpc,
|
|
2074
2091
|
* payer,
|
|
2075
2092
|
* splAta,
|
|
2076
|
-
*
|
|
2093
|
+
* lightTokenAta,
|
|
2077
2094
|
* owner,
|
|
2078
2095
|
* mint,
|
|
2079
2096
|
* 1000n,
|
|
@@ -2081,41 +2098,7 @@ declare function decompressInterface(rpc: Rpc, payer: Signer, owner: Signer, min
|
|
|
2081
2098
|
*
|
|
2082
2099
|
* @returns Transaction signature
|
|
2083
2100
|
*/
|
|
2084
|
-
declare function wrap(rpc: Rpc, payer: Signer, source: PublicKey, destination: PublicKey, owner: Signer, mint: PublicKey, amount: bigint, splInterfaceInfo?: SplInterfaceInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2085
|
-
|
|
2086
|
-
/**
|
|
2087
|
-
* Unwrap c-tokens to SPL tokens.
|
|
2088
|
-
*
|
|
2089
|
-
* @param rpc RPC connection
|
|
2090
|
-
* @param payer Fee payer
|
|
2091
|
-
* @param destination Destination SPL/T22 token account
|
|
2092
|
-
* @param owner Owner of the c-token (signer)
|
|
2093
|
-
* @param mint Mint address
|
|
2094
|
-
* @param amount Amount to unwrap (defaults to all)
|
|
2095
|
-
* @param splInterfaceInfo SPL interface info
|
|
2096
|
-
* @param confirmOptions Confirm options
|
|
2097
|
-
*
|
|
2098
|
-
* @returns Transaction signature
|
|
2099
|
-
*/
|
|
2100
|
-
declare function unwrap(rpc: Rpc, payer: Signer, destination: PublicKey, owner: Signer, mint: PublicKey, amount?: number | bigint | BN, splInterfaceInfo?: SplInterfaceInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2101
|
-
|
|
2102
|
-
/**
|
|
2103
|
-
* Create instructions to load an ATA from its AccountInterface.
|
|
2104
|
-
*
|
|
2105
|
-
* Behavior depends on `wrap` parameter:
|
|
2106
|
-
* - wrap=false (standard): Decompress compressed tokens to the target ATA type
|
|
2107
|
-
* (SPL ATA via pool, T22 ATA via pool, or c-token ATA direct)
|
|
2108
|
-
* - wrap=true (unified): Wrap SPL/T22 + decompress all to c-token ATA
|
|
2109
|
-
*
|
|
2110
|
-
* @param rpc RPC connection
|
|
2111
|
-
* @param payer Fee payer
|
|
2112
|
-
* @param ata AccountInterface from getAtaInterface (must have _isAta, _owner, _mint)
|
|
2113
|
-
* @param options Optional load options
|
|
2114
|
-
* @param wrap Unified mode: wrap SPL/T22 to c-token (default: false)
|
|
2115
|
-
* @param targetAta Target ATA address (used for type detection in standard mode)
|
|
2116
|
-
* @returns Array of instructions (empty if nothing to load)
|
|
2117
|
-
*/
|
|
2118
|
-
declare function createLoadAtaInstructionsFromInterface(rpc: Rpc, payer: PublicKey, ata: AccountInterface, options?: InterfaceOptions, wrap?: boolean, targetAta?: PublicKey): Promise<TransactionInstruction[]>;
|
|
2101
|
+
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>;
|
|
2119
2102
|
|
|
2120
2103
|
/**
|
|
2121
2104
|
* Input for creating off-chain metadata JSON.
|
|
@@ -2165,7 +2148,7 @@ interface OffChainTokenMetadataJson {
|
|
|
2165
2148
|
* const metadataJson = toOffChainMetadataJson({
|
|
2166
2149
|
* name: 'My Token',
|
|
2167
2150
|
* symbol: 'MTK',
|
|
2168
|
-
* description: 'A
|
|
2151
|
+
* description: 'A light-token',
|
|
2169
2152
|
* image: 'https://example.com/image.png',
|
|
2170
2153
|
* });
|
|
2171
2154
|
* const uri = await umi.uploader.uploadJson(metadataJson);
|
|
@@ -2176,18 +2159,30 @@ interface OffChainTokenMetadataJson {
|
|
|
2176
2159
|
declare function toOffChainMetadataJson(meta: OffChainTokenMetadata): OffChainTokenMetadataJson;
|
|
2177
2160
|
|
|
2178
2161
|
/**
|
|
2179
|
-
* Returns the
|
|
2162
|
+
* Returns the light mint address as bytes.
|
|
2163
|
+
* @internal
|
|
2180
2164
|
*/
|
|
2181
2165
|
declare function deriveCMintAddress(mintSeed: PublicKey, addressTreeInfo: TreeInfo): number[];
|
|
2182
2166
|
declare const COMPRESSED_MINT_SEED: Buffer$1;
|
|
2183
2167
|
/**
|
|
2184
|
-
* Finds the SPL mint PDA for a
|
|
2168
|
+
* Finds the SPL mint PDA for a light-token mint.
|
|
2185
2169
|
* @param mintSeed The mint seed public key.
|
|
2186
2170
|
* @returns [PDA, bump]
|
|
2171
|
+
* @internal
|
|
2187
2172
|
*/
|
|
2188
2173
|
declare function findMintAddress(mintSigner: PublicKey): [PublicKey, number];
|
|
2189
|
-
|
|
2190
|
-
|
|
2174
|
+
/**
|
|
2175
|
+
* Same as "getAssociatedTokenAddress" but returns the bump as well.
|
|
2176
|
+
* Uses light-token program ID.
|
|
2177
|
+
* @internal
|
|
2178
|
+
*/
|
|
2179
|
+
declare function getAssociatedLightTokenAddressAndBump(owner: PublicKey, mint: PublicKey): [PublicKey, number];
|
|
2180
|
+
/**
|
|
2181
|
+
* Same as "getAssociatedTokenAddress", returning just the associated token address.
|
|
2182
|
+
* Uses light-token program ID.
|
|
2183
|
+
* @internal
|
|
2184
|
+
*/
|
|
2185
|
+
declare function getAssociatedLightTokenAddress(owner: PublicKey, mint: PublicKey): PublicKey;
|
|
2191
2186
|
|
|
2192
2187
|
/**
|
|
2193
2188
|
* Approve a delegate to spend tokens
|
|
@@ -2361,9 +2356,13 @@ declare function decompress(rpc: Rpc, payer: Signer, mint: PublicKey, amount: nu
|
|
|
2361
2356
|
|
|
2362
2357
|
/**
|
|
2363
2358
|
* Merge multiple compressed token accounts for a given mint into fewer
|
|
2364
|
-
* accounts. Each call merges up to 4 accounts
|
|
2365
|
-
*
|
|
2366
|
-
*
|
|
2359
|
+
* accounts. Each call merges up to 4 accounts at a time.
|
|
2360
|
+
*
|
|
2361
|
+
* Supports automatic V1 -> V2 migration: when running in V2 mode,
|
|
2362
|
+
* merging V1 token accounts will produce a V2 output.
|
|
2363
|
+
*
|
|
2364
|
+
* IMPORTANT: Only accounts from the same tree type can be merged in one
|
|
2365
|
+
* transaction. If you have mixed V1+V2 accounts, merge them separately.
|
|
2367
2366
|
*
|
|
2368
2367
|
* @param rpc RPC connection to use
|
|
2369
2368
|
* @param payer Fee payer
|
|
@@ -2403,6 +2402,7 @@ declare function mintTo(rpc: Rpc, payer: Signer, mint: PublicKey, toPubkey: Publ
|
|
|
2403
2402
|
* @param rpc Rpc connection to use
|
|
2404
2403
|
* @param payer Fee payer
|
|
2405
2404
|
* @param accounts Delegated compressed token accounts to revoke
|
|
2405
|
+
* (must all be from the same tree type)
|
|
2406
2406
|
* @param owner Owner of the compressed tokens
|
|
2407
2407
|
* @param confirmOptions Options for confirming the transaction
|
|
2408
2408
|
*
|
|
@@ -2411,7 +2411,10 @@ declare function mintTo(rpc: Rpc, payer: Signer, mint: PublicKey, toPubkey: Publ
|
|
|
2411
2411
|
declare function revoke(rpc: Rpc, payer: Signer, accounts: ParsedTokenAccount[], owner: Signer, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2412
2412
|
|
|
2413
2413
|
/**
|
|
2414
|
-
* Transfer compressed tokens from one owner to another
|
|
2414
|
+
* Transfer compressed tokens from one owner to another.
|
|
2415
|
+
*
|
|
2416
|
+
* Supports automatic V1 -> V2 migration: when running in V2 mode,
|
|
2417
|
+
* V1 token inputs will produce V2 token outputs.
|
|
2415
2418
|
*
|
|
2416
2419
|
* @param rpc Rpc connection to use
|
|
2417
2420
|
* @param payer Fee payer
|
|
@@ -2459,12 +2462,54 @@ declare function transferDelegated(rpc: Rpc, payer: Signer, mint: PublicKey, amo
|
|
|
2459
2462
|
declare function decompressDelegated(rpc: Rpc, payer: Signer, mint: PublicKey, amount: number | BN, owner: Signer, toAddress: PublicKey, splInterfaceInfos?: SplInterfaceInfo[], confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2460
2463
|
|
|
2461
2464
|
declare const ERROR_NO_ACCOUNTS_FOUND = "Could not find accounts to select for transfer.";
|
|
2465
|
+
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.";
|
|
2466
|
+
/**
|
|
2467
|
+
* Options for input account selection
|
|
2468
|
+
*/
|
|
2469
|
+
interface SelectInputAccountsOptions {
|
|
2470
|
+
/**
|
|
2471
|
+
* Filter accounts by tree type. If provided, only accounts in trees of
|
|
2472
|
+
* this type will be selected. This prevents mixed V1/V2 batches which
|
|
2473
|
+
* fail at proof generation.
|
|
2474
|
+
*/
|
|
2475
|
+
treeType?: TreeType;
|
|
2476
|
+
}
|
|
2477
|
+
/**
|
|
2478
|
+
* Groups accounts by tree type for separate processing
|
|
2479
|
+
*/
|
|
2480
|
+
declare function groupAccountsByTreeType(accounts: ParsedTokenAccount[]): Map<TreeType, ParsedTokenAccount[]>;
|
|
2481
|
+
/**
|
|
2482
|
+
* Result of selectAccountsByPreferredTreeType
|
|
2483
|
+
*/
|
|
2484
|
+
interface SelectedAccountsResult {
|
|
2485
|
+
/** The selected accounts (all from the same tree type) */
|
|
2486
|
+
accounts: ParsedTokenAccount[];
|
|
2487
|
+
/** The tree type of the selected accounts */
|
|
2488
|
+
treeType: TreeType;
|
|
2489
|
+
/** Total balance of selected accounts */
|
|
2490
|
+
totalBalance: BN;
|
|
2491
|
+
}
|
|
2492
|
+
/**
|
|
2493
|
+
* Selects accounts by preferred tree type with automatic fallback.
|
|
2494
|
+
*
|
|
2495
|
+
* In V2 mode, prefers StateV2 accounts. Falls back to StateV1 if V2
|
|
2496
|
+
* has insufficient balance.
|
|
2497
|
+
*
|
|
2498
|
+
* This ensures all returned accounts are from the same tree type,
|
|
2499
|
+
* preventing mixed V1/V2 batch proof failures.
|
|
2500
|
+
*
|
|
2501
|
+
* @param accounts All available accounts (can be mixed V1/V2)
|
|
2502
|
+
* @param requiredAmount Minimum amount needed (optional - if not provided, returns all from preferred type)
|
|
2503
|
+
* @returns Selected accounts from a single tree type
|
|
2504
|
+
*/
|
|
2505
|
+
declare function selectAccountsByPreferredTreeType(accounts: ParsedTokenAccount[], requiredAmount?: BN): SelectedAccountsResult;
|
|
2462
2506
|
/**
|
|
2463
2507
|
* Selects token accounts for approval, first trying to find an exact match, then falling back to minimum selection.
|
|
2464
2508
|
*
|
|
2465
2509
|
* @param {ParsedTokenAccount[]} accounts - Token accounts to choose from.
|
|
2466
2510
|
* @param {BN} approveAmount - Amount to approve.
|
|
2467
2511
|
* @param {number} [maxInputs=4] - Max accounts to select when falling back to minimum selection.
|
|
2512
|
+
* @param {SelectInputAccountsOptions} [options] - Optional selection options.
|
|
2468
2513
|
* @returns {[
|
|
2469
2514
|
* selectedAccounts: ParsedTokenAccount[],
|
|
2470
2515
|
* total: BN,
|
|
@@ -2476,7 +2521,7 @@ declare const ERROR_NO_ACCOUNTS_FOUND = "Could not find accounts to select for t
|
|
|
2476
2521
|
* - totalLamports: Total lamports from selected accounts.
|
|
2477
2522
|
* - maxPossibleAmount: Max approvable amount given maxInputs.
|
|
2478
2523
|
*/
|
|
2479
|
-
declare function selectTokenAccountsForApprove(accounts: ParsedTokenAccount[], approveAmount: BN, maxInputs?: number): [
|
|
2524
|
+
declare function selectTokenAccountsForApprove(accounts: ParsedTokenAccount[], approveAmount: BN, maxInputs?: number, options?: SelectInputAccountsOptions): [
|
|
2480
2525
|
selectedAccounts: ParsedTokenAccount[],
|
|
2481
2526
|
total: BN,
|
|
2482
2527
|
totalLamports: BN | null,
|
|
@@ -2490,10 +2535,11 @@ declare function selectTokenAccountsForApprove(accounts: ParsedTokenAccount[], a
|
|
|
2490
2535
|
* @param {BN} amount Amount to decompress.
|
|
2491
2536
|
* @param {number} [maxInputs=4] Max accounts to select. Default
|
|
2492
2537
|
* is 4.
|
|
2538
|
+
* @param {SelectInputAccountsOptions} [options] - Optional selection options.
|
|
2493
2539
|
*
|
|
2494
2540
|
* @returns Returns selected accounts and their totals.
|
|
2495
2541
|
*/
|
|
2496
|
-
declare function selectMinCompressedTokenAccountsForDecompression(accounts: ParsedTokenAccount[], amount: BN, maxInputs?: number): {
|
|
2542
|
+
declare function selectMinCompressedTokenAccountsForDecompression(accounts: ParsedTokenAccount[], amount: BN, maxInputs?: number, options?: SelectInputAccountsOptions): {
|
|
2497
2543
|
selectedAccounts: ParsedTokenAccount[];
|
|
2498
2544
|
total: BN;
|
|
2499
2545
|
totalLamports: BN | null;
|
|
@@ -2507,6 +2553,8 @@ declare function selectMinCompressedTokenAccountsForDecompression(accounts: Pars
|
|
|
2507
2553
|
* @param {BN} transferAmount Amount to transfer or decompress.
|
|
2508
2554
|
* @param {number} [maxInputs=4] Max accounts to select. Default
|
|
2509
2555
|
* is 4.
|
|
2556
|
+
* @param {SelectInputAccountsOptions} [options] - Optional selection options.
|
|
2557
|
+
* Use treeType to filter by V1/V2.
|
|
2510
2558
|
*
|
|
2511
2559
|
* @returns Returns selected accounts and their totals. [
|
|
2512
2560
|
* selectedAccounts: ParsedTokenAccount[],
|
|
@@ -2515,7 +2563,7 @@ declare function selectMinCompressedTokenAccountsForDecompression(accounts: Pars
|
|
|
2515
2563
|
* maxPossibleAmount: BN
|
|
2516
2564
|
* ]
|
|
2517
2565
|
*/
|
|
2518
|
-
declare function selectMinCompressedTokenAccountsForTransfer(accounts: ParsedTokenAccount[], transferAmount: BN, maxInputs?: number): [
|
|
2566
|
+
declare function selectMinCompressedTokenAccountsForTransfer(accounts: ParsedTokenAccount[], transferAmount: BN, maxInputs?: number, options?: SelectInputAccountsOptions): [
|
|
2519
2567
|
selectedAccounts: ParsedTokenAccount[],
|
|
2520
2568
|
total: BN,
|
|
2521
2569
|
totalLamports: BN | null,
|
|
@@ -2543,6 +2591,8 @@ declare function selectMinCompressedTokenAccountsForTransferOrPartial(accounts:
|
|
|
2543
2591
|
* @param {ParsedTokenAccount[]} accounts - The list of token accounts to select from.
|
|
2544
2592
|
* @param {BN} transferAmount - The token amount to be transferred.
|
|
2545
2593
|
* @param {number} [maxInputs=4] - The maximum number of accounts to select. Default: 4.
|
|
2594
|
+
* @param {SelectInputAccountsOptions} [options] - Optional selection options.
|
|
2595
|
+
* Use treeType to filter by V1/V2.
|
|
2546
2596
|
* @returns {[
|
|
2547
2597
|
* selectedAccounts: ParsedTokenAccount[],
|
|
2548
2598
|
* total: BN,
|
|
@@ -2571,7 +2621,7 @@ declare function selectMinCompressedTokenAccountsForTransferOrPartial(accounts:
|
|
|
2571
2621
|
* console.log(totalLamports!.toString()); // '15'
|
|
2572
2622
|
* console.log(maxPossibleAmount.toString()); // '150'
|
|
2573
2623
|
*/
|
|
2574
|
-
declare function selectSmartCompressedTokenAccountsForTransfer(accounts: ParsedTokenAccount[], transferAmount: BN, maxInputs?: number): [
|
|
2624
|
+
declare function selectSmartCompressedTokenAccountsForTransfer(accounts: ParsedTokenAccount[], transferAmount: BN, maxInputs?: number, options?: SelectInputAccountsOptions): [
|
|
2575
2625
|
selectedAccounts: ParsedTokenAccount[],
|
|
2576
2626
|
total: BN,
|
|
2577
2627
|
totalLamports: BN | null,
|
|
@@ -2753,9 +2803,9 @@ type PackCompressedTokenAccountsParams = {
|
|
|
2753
2803
|
/** Input state to be consumed */
|
|
2754
2804
|
inputCompressedTokenAccounts: ParsedTokenAccount[];
|
|
2755
2805
|
/**
|
|
2756
|
-
*
|
|
2757
|
-
*
|
|
2758
|
-
*
|
|
2806
|
+
* Output state tree. Required for mint/compress (no inputs).
|
|
2807
|
+
* For transfer/merge with V1 inputs: pass a V2 tree for migration.
|
|
2808
|
+
* If not provided with inputs, uses input tree.
|
|
2759
2809
|
*/
|
|
2760
2810
|
outputStateTreeInfo?: TreeInfo;
|
|
2761
2811
|
/** Optional remaining accounts to append to */
|
|
@@ -5163,14 +5213,14 @@ declare class CompressedTokenProgram {
|
|
|
5163
5213
|
* @param mintSize Optional: mint size. Default: MINT_SIZE
|
|
5164
5214
|
*
|
|
5165
5215
|
* @returns [createMintAccountInstruction, initializeMintInstruction,
|
|
5166
|
-
*
|
|
5216
|
+
* createSplInterfaceInstruction]
|
|
5167
5217
|
*
|
|
5168
|
-
* Note that `
|
|
5218
|
+
* Note that `createSplInterfaceInstruction` must be executed after
|
|
5169
5219
|
* `initializeMintInstruction`.
|
|
5170
5220
|
*/
|
|
5171
5221
|
static createMint({ feePayer, mint, authority, freezeAuthority, decimals, rentExemptBalance, tokenProgramId, mintSize, }: CreateMintParams): Promise<TransactionInstruction[]>;
|
|
5172
5222
|
/**
|
|
5173
|
-
*
|
|
5223
|
+
* Create SPL interface (omnibus account) for an existing SPL mint.
|
|
5174
5224
|
* For new mints, use `CompressedTokenProgram.createMint`.
|
|
5175
5225
|
*
|
|
5176
5226
|
* @param feePayer Fee payer.
|
|
@@ -5178,12 +5228,16 @@ declare class CompressedTokenProgram {
|
|
|
5178
5228
|
* @param tokenProgramId Optional: Token program ID. Default: SPL
|
|
5179
5229
|
* Token Program ID
|
|
5180
5230
|
*
|
|
5181
|
-
* @returns The
|
|
5231
|
+
* @returns The createSplInterface instruction
|
|
5182
5232
|
*/
|
|
5183
|
-
static
|
|
5233
|
+
static createSplInterface({ feePayer, mint, tokenProgramId, }: CreateSplInterfaceParams): Promise<TransactionInstruction>;
|
|
5234
|
+
/**
|
|
5235
|
+
* @deprecated Use {@link createSplInterface} instead.
|
|
5236
|
+
*/
|
|
5237
|
+
static createTokenPool(params: CreateSplInterfaceParams): Promise<TransactionInstruction>;
|
|
5184
5238
|
/**
|
|
5185
5239
|
* Add a token pool to an existing SPL mint. For new mints, use
|
|
5186
|
-
* {@link
|
|
5240
|
+
* {@link createSplInterface}.
|
|
5187
5241
|
*
|
|
5188
5242
|
* @param feePayer Fee payer.
|
|
5189
5243
|
* @param mint SPL Mint address.
|
|
@@ -5225,7 +5279,9 @@ declare class CompressedTokenProgram {
|
|
|
5225
5279
|
*/
|
|
5226
5280
|
static approveAndMintTo({ feePayer, mint, authority, authorityTokenAccount, toPubkey, amount, outputStateTreeInfo, tokenPoolInfo, }: ApproveAndMintToParams): Promise<TransactionInstruction[]>;
|
|
5227
5281
|
/**
|
|
5228
|
-
* Construct transfer instruction for compressed tokens
|
|
5282
|
+
* Construct transfer instruction for compressed tokens.
|
|
5283
|
+
*
|
|
5284
|
+
* V1 inputs automatically migrate to V2 outputs when in V2 mode.
|
|
5229
5285
|
*
|
|
5230
5286
|
* @param payer Fee payer.
|
|
5231
5287
|
* @param inputCompressedTokenAccounts Source compressed token accounts.
|
|
@@ -5284,7 +5340,7 @@ declare class CompressedTokenProgram {
|
|
|
5284
5340
|
*/
|
|
5285
5341
|
static decompress({ payer, inputCompressedTokenAccounts, toAddress, amount, recentValidityProof, recentInputStateRootIndices, tokenPoolInfos, }: DecompressParams): Promise<TransactionInstruction>;
|
|
5286
5342
|
/**
|
|
5287
|
-
* Create `mergeTokenAccounts` instruction
|
|
5343
|
+
* Create `mergeTokenAccounts` instruction.
|
|
5288
5344
|
*
|
|
5289
5345
|
* @param payer Fee payer.
|
|
5290
5346
|
* @param owner Owner of the compressed token
|
|
@@ -5293,7 +5349,6 @@ declare class CompressedTokenProgram {
|
|
|
5293
5349
|
* @param mint SPL Token mint address.
|
|
5294
5350
|
* @param recentValidityProof Recent validity proof.
|
|
5295
5351
|
* @param recentInputStateRootIndices Recent state root indices.
|
|
5296
|
-
*
|
|
5297
5352
|
* @returns instruction
|
|
5298
5353
|
*/
|
|
5299
5354
|
static mergeTokenAccounts({ payer, owner, inputCompressedTokenAccounts, mint, recentValidityProof, recentInputStateRootIndices, }: MergeTokenAccountsParams): Promise<TransactionInstruction[]>;
|
|
@@ -5346,6 +5401,13 @@ declare class CompressedTokenProgram {
|
|
|
5346
5401
|
static revoke({ payer, inputCompressedTokenAccounts, recentValidityProof, recentInputStateRootIndices, }: RevokeParams): Promise<TransactionInstruction>;
|
|
5347
5402
|
}
|
|
5348
5403
|
|
|
5404
|
+
/**
|
|
5405
|
+
* Exports for @lightprotocol/compressed-token/unified
|
|
5406
|
+
*
|
|
5407
|
+
* Import from `/unified` to get a single unified associated token account for SPL/T22 and light-token
|
|
5408
|
+
* mints.
|
|
5409
|
+
*/
|
|
5410
|
+
|
|
5349
5411
|
/**
|
|
5350
5412
|
* Get associated token account with unified balance
|
|
5351
5413
|
*
|
|
@@ -5359,21 +5421,21 @@ declare class CompressedTokenProgram {
|
|
|
5359
5421
|
*/
|
|
5360
5422
|
declare function getAtaInterface(rpc: Rpc, ata: PublicKey, owner: PublicKey, mint: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<AccountInterface>;
|
|
5361
5423
|
/**
|
|
5362
|
-
* Derive the canonical token
|
|
5424
|
+
* Derive the canonical token associated token account for SPL/T22/light-token in the unified path.
|
|
5363
5425
|
*
|
|
5364
|
-
* Enforces
|
|
5426
|
+
* Enforces LIGHT_TOKEN_PROGRAM_ID.
|
|
5365
5427
|
*
|
|
5366
5428
|
* @param mint Mint public key
|
|
5367
5429
|
* @param owner Owner public key
|
|
5368
5430
|
* @param allowOwnerOffCurve Allow owner to be a PDA. Default false.
|
|
5369
|
-
* @param programId Token program ID. Default
|
|
5431
|
+
* @param programId Token program ID. Default light-token.
|
|
5370
5432
|
* @param associatedTokenProgramId Associated token program ID. Default
|
|
5371
5433
|
* auto-detected.
|
|
5372
5434
|
* @returns Associated token address.
|
|
5373
5435
|
*/
|
|
5374
5436
|
declare function getAssociatedTokenAddressInterface(mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, programId?: PublicKey, associatedTokenProgramId?: PublicKey): PublicKey;
|
|
5375
5437
|
/**
|
|
5376
|
-
* Create
|
|
5438
|
+
* Create instruction batches for loading ALL token balances into a light-token associated token account.
|
|
5377
5439
|
*
|
|
5378
5440
|
* @param rpc RPC connection
|
|
5379
5441
|
* @param ata Associated token address
|
|
@@ -5381,18 +5443,18 @@ declare function getAssociatedTokenAddressInterface(mint: PublicKey, owner: Publ
|
|
|
5381
5443
|
* @param mint Mint public key
|
|
5382
5444
|
* @param payer Fee payer (defaults to owner)
|
|
5383
5445
|
* @param options Optional interface options
|
|
5384
|
-
* @returns
|
|
5446
|
+
* @returns Instruction batches - each inner array is one transaction
|
|
5385
5447
|
*/
|
|
5386
|
-
declare function createLoadAtaInstructions(rpc: Rpc, ata: PublicKey, owner: PublicKey, mint: PublicKey, payer?: PublicKey, options?: InterfaceOptions): Promise<
|
|
5448
|
+
declare function createLoadAtaInstructions(rpc: Rpc, ata: PublicKey, owner: PublicKey, mint: PublicKey, payer?: PublicKey, options?: InterfaceOptions): Promise<TransactionInstruction[][]>;
|
|
5387
5449
|
/**
|
|
5388
|
-
* Load all token balances into the
|
|
5450
|
+
* Load all token balances into the light-token associated token account.
|
|
5389
5451
|
*
|
|
5390
|
-
* Wraps SPL/Token-2022 balances and decompresses compressed
|
|
5391
|
-
* into the on-chain
|
|
5452
|
+
* Wraps SPL/Token-2022 balances and decompresses compressed light-tokens
|
|
5453
|
+
* into the on-chain light-token associated token account. If no balances exist and the associated token account doesn't
|
|
5392
5454
|
* exist, creates an empty ATA (idempotent).
|
|
5393
5455
|
*
|
|
5394
5456
|
* @param rpc RPC connection
|
|
5395
|
-
* @param ata Associated token address (
|
|
5457
|
+
* @param ata Associated token address (light-token)
|
|
5396
5458
|
* @param owner Owner of the tokens (signer)
|
|
5397
5459
|
* @param mint Mint public key
|
|
5398
5460
|
* @param payer Fee payer (signer, defaults to owner)
|
|
@@ -5400,38 +5462,37 @@ declare function createLoadAtaInstructions(rpc: Rpc, ata: PublicKey, owner: Publ
|
|
|
5400
5462
|
* @param interfaceOptions Optional interface options
|
|
5401
5463
|
* @returns Transaction signature, or null if ATA exists and nothing to load
|
|
5402
5464
|
*/
|
|
5403
|
-
declare function loadAta(rpc: Rpc, ata: PublicKey, owner: Signer, mint: PublicKey, payer?: Signer, confirmOptions?: ConfirmOptions, interfaceOptions?: InterfaceOptions): Promise<string | null>;
|
|
5465
|
+
declare function loadAta(rpc: Rpc, ata: PublicKey, owner: Signer, mint: PublicKey, payer?: Signer, confirmOptions?: ConfirmOptions, interfaceOptions?: InterfaceOptions, decimals?: number): Promise<string | null>;
|
|
5404
5466
|
/**
|
|
5405
5467
|
* Transfer tokens using the unified ata interface.
|
|
5406
5468
|
*
|
|
5407
|
-
*
|
|
5469
|
+
* Destination associated token account must exist. Automatically wraps SPL/T22 to light-token associated token account.
|
|
5408
5470
|
*
|
|
5409
5471
|
* @param rpc RPC connection
|
|
5410
5472
|
* @param payer Fee payer (signer)
|
|
5411
|
-
* @param source Source
|
|
5473
|
+
* @param source Source light-token associated token account address
|
|
5412
5474
|
* @param mint Mint address
|
|
5413
|
-
* @param destination Destination
|
|
5475
|
+
* @param destination Destination token account address (must exist; derive via getAssociatedTokenAddressInterface)
|
|
5414
5476
|
* @param owner Source owner (signer)
|
|
5415
5477
|
* @param amount Amount to transfer
|
|
5416
|
-
* @param programId Token program ID (default: CTOKEN_PROGRAM_ID)
|
|
5417
5478
|
* @param confirmOptions Optional confirm options
|
|
5418
5479
|
* @param options Optional interface options
|
|
5419
5480
|
* @returns Transaction signature
|
|
5420
5481
|
*/
|
|
5421
|
-
declare function transferInterface(rpc: Rpc, payer: Signer, source: PublicKey, mint: PublicKey, destination: PublicKey, owner: Signer, amount: number | bigint | BN,
|
|
5482
|
+
declare function transferInterface(rpc: Rpc, payer: Signer, source: PublicKey, mint: PublicKey, destination: PublicKey, owner: Signer, amount: number | bigint | BN, confirmOptions?: ConfirmOptions, options?: InterfaceOptions, decimals?: number): Promise<string>;
|
|
5422
5483
|
/**
|
|
5423
|
-
* Get or create
|
|
5484
|
+
* Get or create light-token ATA with unified balance detection and auto-loading.
|
|
5424
5485
|
*
|
|
5425
|
-
* Enforces
|
|
5426
|
-
* -
|
|
5427
|
-
* -
|
|
5486
|
+
* Enforces LIGHT_TOKEN_PROGRAM_ID. Aggregates balances from:
|
|
5487
|
+
* - light-token associated token account (hot balance)
|
|
5488
|
+
* - compressed light-token accounts (cold balance)
|
|
5428
5489
|
* - SPL token accounts (for unified wrapping)
|
|
5429
5490
|
* - Token-2022 accounts (for unified wrapping)
|
|
5430
5491
|
*
|
|
5431
5492
|
* When owner is a Signer:
|
|
5432
5493
|
* - Creates hot ATA if it doesn't exist
|
|
5433
5494
|
* - Loads cold (compressed) tokens into hot ATA
|
|
5434
|
-
* - Wraps SPL/T22 tokens into
|
|
5495
|
+
* - Wraps SPL/T22 tokens into light-token associated token account
|
|
5435
5496
|
* - Returns account with all tokens ready to use
|
|
5436
5497
|
*
|
|
5437
5498
|
* When owner is a PublicKey:
|
|
@@ -5448,5 +5509,54 @@ declare function transferInterface(rpc: Rpc, payer: Signer, source: PublicKey, m
|
|
|
5448
5509
|
* @returns AccountInterface with unified balance and source breakdown
|
|
5449
5510
|
*/
|
|
5450
5511
|
declare function getOrCreateAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey | Signer, allowOwnerOffCurve?: boolean, commitment?: Commitment, confirmOptions?: ConfirmOptions): Promise<AccountInterface>;
|
|
5512
|
+
/**
|
|
5513
|
+
* Create transfer instructions for a unified token transfer.
|
|
5514
|
+
*
|
|
5515
|
+
* Unified variant: always wraps SPL/T22 to light-token associated token account.
|
|
5516
|
+
*
|
|
5517
|
+
* Returns `TransactionInstruction[][]`. Send [0..n-2] in parallel, then [n-1].
|
|
5518
|
+
* Use `sliceLast` to separate the parallel prefix from the final transfer.
|
|
5519
|
+
*
|
|
5520
|
+
* @see createTransferInterfaceInstructions in v3/actions/transfer-interface.ts
|
|
5521
|
+
*/
|
|
5522
|
+
declare function createTransferInterfaceInstructions(rpc: Rpc, payer: PublicKey, mint: PublicKey, amount: number | bigint | BN, sender: PublicKey, destination: PublicKey, options?: Omit<TransferOptions, 'wrap'>): Promise<TransactionInstruction[][]>;
|
|
5523
|
+
/**
|
|
5524
|
+
* Build instruction batches for unwrapping light-tokens to SPL/T22.
|
|
5525
|
+
*
|
|
5526
|
+
* Load batches (cold -> hot) come first if needed; unwrap is bundled into the
|
|
5527
|
+
* final batch.
|
|
5528
|
+
* SPL/T22 balances are not consolidated; only light ATA (hot + cold) is unwrapped.
|
|
5529
|
+
*
|
|
5530
|
+
* Returns `TransactionInstruction[][]`. Load-only batches (if any) come first;
|
|
5531
|
+
* the last batch contains unwrap.
|
|
5532
|
+
*
|
|
5533
|
+
* @param rpc RPC connection
|
|
5534
|
+
* @param destination Destination SPL/T22 token account (must exist)
|
|
5535
|
+
* @param owner Owner of the light-token
|
|
5536
|
+
* @param mint Mint address
|
|
5537
|
+
* @param amount Amount to unwrap (defaults to full balance)
|
|
5538
|
+
* @param payer Fee payer (defaults to owner)
|
|
5539
|
+
* @param splInterfaceInfo Optional: SPL interface info
|
|
5540
|
+
* @param interfaceOptions Optional: interface options for load
|
|
5541
|
+
* @returns Instruction batches - each inner array is one transaction
|
|
5542
|
+
*/
|
|
5543
|
+
declare function createUnwrapInstructions(rpc: Rpc, destination: PublicKey, owner: PublicKey, mint: PublicKey, amount?: number | bigint | BN, payer?: PublicKey, splInterfaceInfo?: SplInterfaceInfo, interfaceOptions?: InterfaceOptions): Promise<TransactionInstruction[][]>;
|
|
5544
|
+
/**
|
|
5545
|
+
* Unwrap light-tokens to SPL tokens.
|
|
5546
|
+
*
|
|
5547
|
+
* Loads cold into hot if needed, then unwraps from light ATA to destination SPL/T22.
|
|
5548
|
+
* SPL/T22 balances are not consolidated; only light ATA balance is unwrapped.
|
|
5549
|
+
*
|
|
5550
|
+
* @param rpc RPC connection
|
|
5551
|
+
* @param payer Fee payer
|
|
5552
|
+
* @param destination Destination SPL/T22 token account
|
|
5553
|
+
* @param owner Owner of the light-token (signer)
|
|
5554
|
+
* @param mint Mint address
|
|
5555
|
+
* @param amount Amount to unwrap (defaults to all)
|
|
5556
|
+
* @param splInterfaceInfo SPL interface info
|
|
5557
|
+
* @param confirmOptions Confirm options
|
|
5558
|
+
* @returns Transaction signature of the unwrap transaction
|
|
5559
|
+
*/
|
|
5560
|
+
declare function unwrap(rpc: Rpc, payer: Signer, destination: PublicKey, owner: Signer, mint: PublicKey, amount?: number | bigint | BN, splInterfaceInfo?: SplInterfaceInfo, confirmOptions?: ConfirmOptions, decimals?: number): Promise<string>;
|
|
5451
5561
|
|
|
5452
|
-
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, COMPRESSED_MINT_SEED, COMPRESS_SPL_TOKEN_ACCOUNT_DISCRIMINATOR, CPI_AUTHORITY_SEED, CREATE_TOKEN_POOL_DISCRIMINATOR, type
|
|
5562
|
+
export { ADD_TOKEN_POOL_DISCRIMINATOR, APPROVE_DISCRIMINATOR, type AccountInterface, Action, type AddSplInterfaceParams, type AddTokenPoolParams, type ApproveAndMintToParams, type ApproveParams, BASE_RENT_PER_EPOCH, BATCH_COMPRESS_DISCRIMINATOR, type BaseMint, type BatchCompressInstructionData, COMPRESSED_MINT_SEED, COMPRESSIBLE_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, MAX_TOP_UP, 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 TransferOptions, 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, deriveCMintAddress, deriveSplInterfaceInfo, deriveTokenPoolInfo, deserializeMint, encodeApproveInstructionData, encodeBatchCompressInstructionData, encodeCompressSplTokenAccountInstructionData, encodeMintToInstructionData, encodeRevokeInstructionData, encodeTokenMetadata, encodeTransferInstructionData, extractTokenMetadata, findMintAddress, freezeAccountsLayout, type freezeAccountsLayoutParams, getAccountInterface, getAssociatedLightTokenAddress, getAssociatedLightTokenAddressAndBump, 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, selectMinCompressedTokenAccountsForDecompression, selectMinCompressedTokenAccountsForTransfer, selectMinCompressedTokenAccountsForTransferOrPartial, selectSmartCompressedTokenAccountsForTransfer, selectSmartCompressedTokenAccountsForTransferOrPartial, selectSplInterfaceInfo, selectSplInterfaceInfosForDecompression, selectTokenAccountsForApprove, selectTokenPoolInfo, selectTokenPoolInfosForDecompression, serializeMint, sliceLast, sumUpTokenAmount, thawAccountsLayout, type thawAccountsLayoutParams, toAccountInfo, toOffChainMetadataJson, toTokenPoolInfo, transfer, transferAccountsLayout, type transferAccountsLayoutParams, transferDelegated, transferInterface, unpackMintData, unpackMintInterface, unwrap, updateFreezeAuthority, updateMetadataAuthority, updateMetadataField, updateMintAuthority, validateSameTokenOwner, wrap };
|