@lightprotocol/compressed-token 0.23.0-beta.8 → 0.23.0
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-DhKIduOJ.cjs +2 -0
- package/dist/cjs/browser/types-DhKIduOJ.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-eEaQmC1R.cjs +2 -0
- package/dist/cjs/node/types-eEaQmC1R.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-BRyuPsY_.js +2 -0
- package/dist/es/browser/types-BRyuPsY_.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 +487 -604
- package/dist/types/unified/index.d.ts +375 -400
- package/package.json +27 -22
- package/dist/cjs/browser/types-yDZoEoYW.cjs +0 -2
- package/dist/cjs/browser/types-yDZoEoYW.cjs.map +0 -1
- package/dist/cjs/node/types-n2UYeAW3.cjs +0 -2
- package/dist/cjs/node/types-n2UYeAW3.cjs.map +0 -1
- package/dist/es/browser/types-DGrEdIo3.js +0 -2
- package/dist/es/browser/types-DGrEdIo3.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { PublicKey, AccountInfo, Commitment, TransactionInstruction,
|
|
3
|
-
import { MerkleContext, CompressedAccountWithMerkleContext, Rpc, ValidityProofWithContext, AddressTreeInfo, TreeInfo, ParsedTokenAccount,
|
|
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';
|
|
4
4
|
export { ParsedTokenAccount } from '@lightprotocol/stateless.js';
|
|
5
5
|
import { Account, Mint } from '@solana/spl-token';
|
|
6
6
|
export { AccountState } from '@solana/spl-token';
|
|
@@ -798,8 +798,8 @@ declare const TokenAccountSourceType: {
|
|
|
798
798
|
readonly Token2022: "token2022";
|
|
799
799
|
readonly SplCold: "spl-cold";
|
|
800
800
|
readonly Token2022Cold: "token2022-cold";
|
|
801
|
-
readonly
|
|
802
|
-
readonly
|
|
801
|
+
readonly LightTokenHot: "light-token-hot";
|
|
802
|
+
readonly LightTokenCold: "light-token-cold";
|
|
803
803
|
};
|
|
804
804
|
type TokenAccountSourceTypeValue = (typeof TokenAccountSourceType)[keyof typeof TokenAccountSourceType];
|
|
805
805
|
/** @internal */
|
|
@@ -822,9 +822,9 @@ interface AccountInterface {
|
|
|
822
822
|
_anyFrozen?: boolean;
|
|
823
823
|
/** True when fetched via getAtaInterface */
|
|
824
824
|
_isAta?: boolean;
|
|
825
|
-
/**
|
|
825
|
+
/** Associated token account owner - set by getAtaInterface */
|
|
826
826
|
_owner?: PublicKey;
|
|
827
|
-
/**
|
|
827
|
+
/** Associated token account mint - set by getAtaInterface */
|
|
828
828
|
_mint?: PublicKey;
|
|
829
829
|
}
|
|
830
830
|
/** @internal */
|
|
@@ -839,21 +839,21 @@ declare function convertTokenDataToAccount(address: PublicKey, tokenData: {
|
|
|
839
839
|
/** Convert compressed account to AccountInfo */
|
|
840
840
|
declare function toAccountInfo(compressedAccount: CompressedAccountWithMerkleContext): AccountInfo<Buffer$1>;
|
|
841
841
|
/** @internal */
|
|
842
|
-
declare function
|
|
842
|
+
declare function parseLightTokenHot(address: PublicKey, accountInfo: AccountInfo<Buffer$1>): {
|
|
843
843
|
accountInfo: AccountInfo<Buffer$1>;
|
|
844
844
|
loadContext: undefined;
|
|
845
845
|
parsed: Account;
|
|
846
846
|
isCold: false;
|
|
847
847
|
};
|
|
848
848
|
/** @internal */
|
|
849
|
-
declare function
|
|
849
|
+
declare function parseLightTokenCold(address: PublicKey, compressedAccount: CompressedAccountWithMerkleContext): {
|
|
850
850
|
accountInfo: AccountInfo<Buffer$1>;
|
|
851
851
|
loadContext: MerkleContext;
|
|
852
852
|
parsed: Account;
|
|
853
853
|
isCold: true;
|
|
854
854
|
};
|
|
855
855
|
/**
|
|
856
|
-
* Retrieve information about a token account of SPL/T22/
|
|
856
|
+
* Retrieve information about a token account of SPL/T22/light-token.
|
|
857
857
|
*
|
|
858
858
|
* @param rpc RPC connection to use
|
|
859
859
|
* @param address Token account address
|
|
@@ -1048,45 +1048,6 @@ declare function selectTokenPoolInfo(infos: TokenPoolInfo[]): TokenPoolInfo;
|
|
|
1048
1048
|
*/
|
|
1049
1049
|
declare function selectTokenPoolInfosForDecompression(infos: TokenPoolInfo[], decompressAmount: number | BN): TokenPoolInfo[];
|
|
1050
1050
|
|
|
1051
|
-
/**
|
|
1052
|
-
* Options for interface operations (load, transfer)
|
|
1053
|
-
*/
|
|
1054
|
-
interface InterfaceOptions {
|
|
1055
|
-
/** SPL interface infos (fetched if not provided) */
|
|
1056
|
-
splInterfaceInfos?: SplInterfaceInfo[];
|
|
1057
|
-
}
|
|
1058
|
-
/**
|
|
1059
|
-
* Options for createTransferInterfaceInstructions.
|
|
1060
|
-
*/
|
|
1061
|
-
interface TransferOptions extends InterfaceOptions {
|
|
1062
|
-
/** Include SPL/T22 wrapping to c-token ATA (unified path). Default: false. */
|
|
1063
|
-
wrap?: boolean;
|
|
1064
|
-
/** Token program ID. Default: LIGHT_TOKEN_PROGRAM_ID. */
|
|
1065
|
-
programId?: PublicKey;
|
|
1066
|
-
/**
|
|
1067
|
-
* Include an idempotent recipient ATA creation instruction in the
|
|
1068
|
-
* transfer transaction. No extra RPC fetch -- uses
|
|
1069
|
-
* createAssociatedTokenAccountInterfaceIdempotentInstruction which is
|
|
1070
|
-
* a no-op on-chain if the ATA already exists (~200 CU overhead).
|
|
1071
|
-
* Default: true.
|
|
1072
|
-
*/
|
|
1073
|
-
ensureRecipientAta?: boolean;
|
|
1074
|
-
}
|
|
1075
|
-
/**
|
|
1076
|
-
* Splits the last element from an array.
|
|
1077
|
-
*
|
|
1078
|
-
* Useful for separating load transactions (parallel) from the final transfer
|
|
1079
|
-
* transaction (sequential) returned by `createTransferInterfaceInstructions`.
|
|
1080
|
-
*
|
|
1081
|
-
* @returns `{ rest, last }` where `rest` is everything before the last
|
|
1082
|
-
* element and `last` is the last element.
|
|
1083
|
-
* @throws if the input array is empty.
|
|
1084
|
-
*/
|
|
1085
|
-
declare function sliceLast<T>(items: T[]): {
|
|
1086
|
-
rest: T[];
|
|
1087
|
-
last: T;
|
|
1088
|
-
};
|
|
1089
|
-
|
|
1090
1051
|
interface LayoutObject {
|
|
1091
1052
|
[key: string]: any;
|
|
1092
1053
|
}
|
|
@@ -1226,7 +1187,7 @@ interface AdditionalMetadata {
|
|
|
1226
1187
|
}
|
|
1227
1188
|
|
|
1228
1189
|
/**
|
|
1229
|
-
* Token metadata for creating a
|
|
1190
|
+
* Token metadata for creating a light-token mint.
|
|
1230
1191
|
*/
|
|
1231
1192
|
interface TokenMetadataInstructionData {
|
|
1232
1193
|
name: string;
|
|
@@ -1237,7 +1198,7 @@ interface TokenMetadataInstructionData {
|
|
|
1237
1198
|
}
|
|
1238
1199
|
declare function createTokenMetadata(name: string, symbol: string, uri: string, updateAuthority?: PublicKey | null, additionalMetadata?: AdditionalMetadata[] | null): TokenMetadataInstructionData;
|
|
1239
1200
|
/**
|
|
1240
|
-
* Create instruction for initializing a
|
|
1201
|
+
* Create instruction for initializing a light-token mint.
|
|
1241
1202
|
*
|
|
1242
1203
|
* @param mintSigner Mint signer keypair public key.
|
|
1243
1204
|
* @param decimals Number of decimals for the mint.
|
|
@@ -1248,8 +1209,9 @@ declare function createTokenMetadata(name: string, symbol: string, uri: string,
|
|
|
1248
1209
|
* @param addressTreeInfo Address tree info for the mint.
|
|
1249
1210
|
* @param outputStateTreeInfo Output state tree info.
|
|
1250
1211
|
* @param metadata Optional token metadata.
|
|
1212
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1251
1213
|
*/
|
|
1252
|
-
declare function createMintInstruction(mintSigner: PublicKey, decimals: number, mintAuthority: PublicKey, freezeAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext, addressTreeInfo: AddressTreeInfo, outputStateTreeInfo: TreeInfo, metadata?: TokenMetadataInstructionData): TransactionInstruction;
|
|
1214
|
+
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;
|
|
1253
1215
|
|
|
1254
1216
|
/**
|
|
1255
1217
|
* SPL-compatible base mint structure
|
|
@@ -1267,12 +1229,12 @@ interface BaseMint {
|
|
|
1267
1229
|
freezeAuthority: PublicKey | null;
|
|
1268
1230
|
}
|
|
1269
1231
|
/**
|
|
1270
|
-
*
|
|
1232
|
+
* Light mint context (protocol version, SPL mint reference)
|
|
1271
1233
|
*/
|
|
1272
1234
|
interface MintContext {
|
|
1273
1235
|
/** Protocol version for upgradability */
|
|
1274
1236
|
version: number;
|
|
1275
|
-
/** Whether the compressed mint
|
|
1237
|
+
/** Whether the compressed light mint has been decompressed to a light mint account */
|
|
1276
1238
|
cmintDecompressed: boolean;
|
|
1277
1239
|
/** PDA of the associated SPL mint */
|
|
1278
1240
|
splMint: PublicKey;
|
|
@@ -1310,7 +1272,7 @@ interface TokenMetadata {
|
|
|
1310
1272
|
}[];
|
|
1311
1273
|
}
|
|
1312
1274
|
/**
|
|
1313
|
-
* Complete
|
|
1275
|
+
* Complete light mint structure (raw format)
|
|
1314
1276
|
*/
|
|
1315
1277
|
interface CompressedMint {
|
|
1316
1278
|
base: BaseMint;
|
|
@@ -1339,7 +1301,7 @@ interface RentConfig {
|
|
|
1339
1301
|
maxTopUp: number;
|
|
1340
1302
|
}
|
|
1341
1303
|
/**
|
|
1342
|
-
* Compression info embedded in
|
|
1304
|
+
* Compression info embedded in light mint
|
|
1343
1305
|
*/
|
|
1344
1306
|
interface CompressionInfo {
|
|
1345
1307
|
/** Config account version (0 = uninitialized) */
|
|
@@ -1364,18 +1326,18 @@ interface CompressionInfo {
|
|
|
1364
1326
|
rentConfig: RentConfig;
|
|
1365
1327
|
}
|
|
1366
1328
|
/**
|
|
1367
|
-
* Deserialize a
|
|
1329
|
+
* Deserialize a light mint from buffer
|
|
1368
1330
|
* Uses SPL's MintLayout for BaseMint and buffer-layout struct for context
|
|
1369
1331
|
*
|
|
1370
1332
|
* @param data - The raw account data buffer
|
|
1371
|
-
* @returns The deserialized
|
|
1333
|
+
* @returns The deserialized light mint
|
|
1372
1334
|
*/
|
|
1373
1335
|
declare function deserializeMint(data: Buffer$1 | Uint8Array): CompressedMint;
|
|
1374
1336
|
/**
|
|
1375
|
-
* Serialize a
|
|
1337
|
+
* Serialize a light mint to buffer
|
|
1376
1338
|
* Uses SPL's MintLayout for BaseMint, helper functions for context/metadata
|
|
1377
1339
|
*
|
|
1378
|
-
* @param mint - The
|
|
1340
|
+
* @param mint - The light mint to serialize
|
|
1379
1341
|
* @returns The serialized buffer
|
|
1380
1342
|
*/
|
|
1381
1343
|
declare function serializeMint(mint: CompressedMint): Buffer$1;
|
|
@@ -1438,11 +1400,11 @@ interface MintInterface {
|
|
|
1438
1400
|
mintContext?: MintContext;
|
|
1439
1401
|
tokenMetadata?: TokenMetadata;
|
|
1440
1402
|
extensions?: MintExtension[];
|
|
1441
|
-
/** Compression info for
|
|
1403
|
+
/** Compression info for light-token mints */
|
|
1442
1404
|
compression?: CompressionInfo;
|
|
1443
1405
|
}
|
|
1444
1406
|
/**
|
|
1445
|
-
* Get unified mint info for SPL/T22/
|
|
1407
|
+
* Get unified mint info for SPL/T22/light-token mints.
|
|
1446
1408
|
*
|
|
1447
1409
|
* @param rpc RPC connection
|
|
1448
1410
|
* @param address The mint address
|
|
@@ -1454,16 +1416,16 @@ interface MintInterface {
|
|
|
1454
1416
|
*/
|
|
1455
1417
|
declare function getMintInterface(rpc: Rpc, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<MintInterface>;
|
|
1456
1418
|
/**
|
|
1457
|
-
* Unpack mint info from raw account data for SPL/T22/
|
|
1419
|
+
* Unpack mint info from raw account data for SPL/T22/light-token.
|
|
1458
1420
|
*
|
|
1459
1421
|
* @param address The mint pubkey
|
|
1460
1422
|
* @param data The raw account data or AccountInfo
|
|
1461
|
-
* @param programId Token program ID. Default
|
|
1423
|
+
* @param programId Token program ID. Default light-token.
|
|
1462
1424
|
* @returns Object with mint, optional mintContext and tokenMetadata.
|
|
1463
1425
|
*/
|
|
1464
1426
|
declare function unpackMintInterface(address: PublicKey, data: Buffer$1 | Uint8Array | AccountInfo<Buffer$1>, programId?: PublicKey): Omit<MintInterface, 'merkleContext'>;
|
|
1465
1427
|
/**
|
|
1466
|
-
* Unpack
|
|
1428
|
+
* Unpack light-token mint context and metadata from raw account data
|
|
1467
1429
|
*
|
|
1468
1430
|
* @param data The raw account data
|
|
1469
1431
|
* @returns Object with mintContext, tokenMetadata, and extensions
|
|
@@ -1475,19 +1437,20 @@ declare function unpackMintData(data: Buffer$1 | Uint8Array): {
|
|
|
1475
1437
|
};
|
|
1476
1438
|
|
|
1477
1439
|
/**
|
|
1478
|
-
* Create instruction for updating a
|
|
1479
|
-
* Works for both compressed and decompressed mints.
|
|
1440
|
+
* Create instruction for updating a light mint's mint authority.
|
|
1441
|
+
* Works for both compressed and decompressed light mints.
|
|
1480
1442
|
*
|
|
1481
1443
|
* @param mintInterface MintInterface from getMintInterface() - must have merkleContext
|
|
1482
1444
|
* @param currentMintAuthority Current mint authority public key (must sign)
|
|
1483
1445
|
* @param newMintAuthority New mint authority (or null to revoke)
|
|
1484
1446
|
* @param payer Fee payer public key
|
|
1485
|
-
* @param validityProof Validity proof for the compressed mint (null for decompressed mints)
|
|
1447
|
+
* @param validityProof Validity proof for the compressed light mint (null for decompressed light mints)
|
|
1448
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1486
1449
|
*/
|
|
1487
|
-
declare function createUpdateMintAuthorityInstruction(mintInterface: MintInterface, currentMintAuthority: PublicKey, newMintAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext | null): TransactionInstruction;
|
|
1450
|
+
declare function createUpdateMintAuthorityInstruction(mintInterface: MintInterface, currentMintAuthority: PublicKey, newMintAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext | null, maxTopUp?: number): TransactionInstruction;
|
|
1488
1451
|
/**
|
|
1489
|
-
* Create instruction for updating a
|
|
1490
|
-
* Works for both compressed and decompressed mints.
|
|
1452
|
+
* Create instruction for updating a light mint's freeze authority.
|
|
1453
|
+
* Works for both compressed and decompressed light mints.
|
|
1491
1454
|
*
|
|
1492
1455
|
* Output queue is automatically derived from mintInterface.merkleContext.treeInfo
|
|
1493
1456
|
* (preferring nextTreeInfo.queue if available for rollover support).
|
|
@@ -1496,12 +1459,13 @@ declare function createUpdateMintAuthorityInstruction(mintInterface: MintInterfa
|
|
|
1496
1459
|
* @param currentFreezeAuthority Current freeze authority public key (must sign)
|
|
1497
1460
|
* @param newFreezeAuthority New freeze authority (or null to revoke)
|
|
1498
1461
|
* @param payer Fee payer public key
|
|
1499
|
-
* @param validityProof Validity proof for the compressed mint (null for decompressed mints)
|
|
1462
|
+
* @param validityProof Validity proof for the compressed light mint (null for decompressed light mints)
|
|
1463
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1500
1464
|
*/
|
|
1501
|
-
declare function createUpdateFreezeAuthorityInstruction(mintInterface: MintInterface, currentFreezeAuthority: PublicKey, newFreezeAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext | null): TransactionInstruction;
|
|
1465
|
+
declare function createUpdateFreezeAuthorityInstruction(mintInterface: MintInterface, currentFreezeAuthority: PublicKey, newFreezeAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext | null, maxTopUp?: number): TransactionInstruction;
|
|
1502
1466
|
|
|
1503
1467
|
/**
|
|
1504
|
-
* Create instruction for updating a
|
|
1468
|
+
* Create instruction for updating a light mint's metadata field.
|
|
1505
1469
|
*
|
|
1506
1470
|
* Output queue is automatically derived from mintInterface.merkleContext.treeInfo
|
|
1507
1471
|
* (preferring nextTreeInfo.queue if available for rollover support).
|
|
@@ -1509,15 +1473,16 @@ declare function createUpdateFreezeAuthorityInstruction(mintInterface: MintInter
|
|
|
1509
1473
|
* @param mintInterface MintInterface from getMintInterface() - must have merkleContext and tokenMetadata
|
|
1510
1474
|
* @param authority Metadata update authority public key (must sign)
|
|
1511
1475
|
* @param payer Fee payer public key
|
|
1512
|
-
* @param validityProof Validity proof for the
|
|
1476
|
+
* @param validityProof Validity proof for the light mint (null for decompressed light mints)
|
|
1513
1477
|
* @param fieldType Field to update: 'name', 'symbol', 'uri', or 'custom'
|
|
1514
1478
|
* @param value New value for the field
|
|
1515
1479
|
* @param customKey Custom key name (required if fieldType is 'custom')
|
|
1516
1480
|
* @param extensionIndex Extension index (default: 0)
|
|
1481
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1517
1482
|
*/
|
|
1518
|
-
declare function createUpdateMetadataFieldInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext | null, fieldType: 'name' | 'symbol' | 'uri' | 'custom', value: string, customKey?: string, extensionIndex?: number): TransactionInstruction;
|
|
1483
|
+
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;
|
|
1519
1484
|
/**
|
|
1520
|
-
* Create instruction for updating a
|
|
1485
|
+
* Create instruction for updating a light mint's metadata authority.
|
|
1521
1486
|
*
|
|
1522
1487
|
* Output queue is automatically derived from mintInterface.merkleContext.treeInfo
|
|
1523
1488
|
* (preferring nextTreeInfo.queue if available for rollover support).
|
|
@@ -1526,12 +1491,13 @@ declare function createUpdateMetadataFieldInstruction(mintInterface: MintInterfa
|
|
|
1526
1491
|
* @param currentAuthority Current metadata update authority public key (must sign)
|
|
1527
1492
|
* @param newAuthority New metadata update authority public key
|
|
1528
1493
|
* @param payer Fee payer public key
|
|
1529
|
-
* @param validityProof Validity proof for the
|
|
1494
|
+
* @param validityProof Validity proof for the light mint (null for decompressed light mints)
|
|
1530
1495
|
* @param extensionIndex Extension index (default: 0)
|
|
1496
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1531
1497
|
*/
|
|
1532
|
-
declare function createUpdateMetadataAuthorityInstruction(mintInterface: MintInterface, currentAuthority: PublicKey, newAuthority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext | null, extensionIndex?: number): TransactionInstruction;
|
|
1498
|
+
declare function createUpdateMetadataAuthorityInstruction(mintInterface: MintInterface, currentAuthority: PublicKey, newAuthority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext | null, extensionIndex?: number, maxTopUp?: number): TransactionInstruction;
|
|
1533
1499
|
/**
|
|
1534
|
-
* Create instruction for removing a metadata key from a
|
|
1500
|
+
* Create instruction for removing a metadata key from a light mint.
|
|
1535
1501
|
*
|
|
1536
1502
|
* Output queue is automatically derived from mintInterface.merkleContext.treeInfo
|
|
1537
1503
|
* (preferring nextTreeInfo.queue if available for rollover support).
|
|
@@ -1539,12 +1505,13 @@ declare function createUpdateMetadataAuthorityInstruction(mintInterface: MintInt
|
|
|
1539
1505
|
* @param mintInterface MintInterface from getMintInterface() - must have merkleContext and tokenMetadata
|
|
1540
1506
|
* @param authority Metadata update authority public key (must sign)
|
|
1541
1507
|
* @param payer Fee payer public key
|
|
1542
|
-
* @param validityProof Validity proof for the
|
|
1508
|
+
* @param validityProof Validity proof for the light mint (null for decompressed light mints)
|
|
1543
1509
|
* @param key Metadata key to remove
|
|
1544
1510
|
* @param idempotent If true, don't error if key doesn't exist (default: false)
|
|
1545
1511
|
* @param extensionIndex Extension index (default: 0)
|
|
1512
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1546
1513
|
*/
|
|
1547
|
-
declare function createRemoveMetadataKeyInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext | null, key: string, idempotent?: boolean, extensionIndex?: number): TransactionInstruction;
|
|
1514
|
+
declare function createRemoveMetadataKeyInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext | null, key: string, idempotent?: boolean, extensionIndex?: number, maxTopUp?: number): TransactionInstruction;
|
|
1548
1515
|
|
|
1549
1516
|
interface CompressToPubkey {
|
|
1550
1517
|
bump: number;
|
|
@@ -1558,11 +1525,11 @@ interface CompressibleConfig {
|
|
|
1558
1525
|
writeTopUp: number;
|
|
1559
1526
|
compressToAccountPubkey?: CompressToPubkey | null;
|
|
1560
1527
|
}
|
|
1561
|
-
interface
|
|
1528
|
+
interface CreateAssociatedLightTokenAccountParams {
|
|
1562
1529
|
compressibleConfig?: CompressibleConfig | null;
|
|
1563
1530
|
}
|
|
1564
1531
|
/**
|
|
1565
|
-
* Default compressible config for
|
|
1532
|
+
* Default compressible config for light-token ATAs - matches Rust SDK defaults.
|
|
1566
1533
|
*
|
|
1567
1534
|
* - tokenAccountVersion: 3 (ShaFlat) - latest hashing scheme
|
|
1568
1535
|
* - rentPayment: 16 - prepay 16 epochs (~24 hours rent)
|
|
@@ -1570,7 +1537,7 @@ interface CreateAssociatedCTokenAccountParams {
|
|
|
1570
1537
|
* - writeTopUp: 766 - per-write top-up (~2 epochs rent) when rent < 2 epochs
|
|
1571
1538
|
* - compressToAccountPubkey: null - required for ATAs
|
|
1572
1539
|
*
|
|
1573
|
-
* Cost breakdown at
|
|
1540
|
+
* Cost breakdown at associated token account creation:
|
|
1574
1541
|
* - Rent sponsor PDA (LIGHT_TOKEN_RENT_SPONSOR) pays: rent exemption (~890,880 lamports)
|
|
1575
1542
|
* - Fee payer pays: compression_cost (11K) + 16 epochs rent (~6,400) = ~17,400 lamports + tx fees
|
|
1576
1543
|
*
|
|
@@ -1578,7 +1545,7 @@ interface CreateAssociatedCTokenAccountParams {
|
|
|
1578
1545
|
* - When account rent is below 2 epochs, fee payer pays 766 lamports top-up
|
|
1579
1546
|
* - This keeps the account perpetually funded when actively used
|
|
1580
1547
|
*
|
|
1581
|
-
* Rent calculation (272-byte compressible
|
|
1548
|
+
* Rent calculation (272-byte compressible lightToken account):
|
|
1582
1549
|
* - rent_per_epoch = base_rent (128) + bytes * rent_per_byte (272 * 1) = 400 lamports
|
|
1583
1550
|
* - 16 epochs = 16 * 400 = 6,400 lamports (24 hours)
|
|
1584
1551
|
* - 2 epochs = 2 * 400 = 800 lamports (~3 hours, writeTopUp = 766 is conservative)
|
|
@@ -1594,7 +1561,7 @@ interface CreateAssociatedCTokenAccountParams {
|
|
|
1594
1561
|
*/
|
|
1595
1562
|
declare const DEFAULT_COMPRESSIBLE_CONFIG: CompressibleConfig;
|
|
1596
1563
|
/**
|
|
1597
|
-
* Create instruction for creating an associated
|
|
1564
|
+
* Create instruction for creating an associated light-token account.
|
|
1598
1565
|
* Uses the default rent sponsor PDA by default.
|
|
1599
1566
|
*
|
|
1600
1567
|
* @param feePayer Fee payer public key.
|
|
@@ -1604,9 +1571,9 @@ declare const DEFAULT_COMPRESSIBLE_CONFIG: CompressibleConfig;
|
|
|
1604
1571
|
* @param configAccount Config account (defaults to LIGHT_TOKEN_CONFIG).
|
|
1605
1572
|
* @param rentPayerPda Rent payer PDA (defaults to LIGHT_TOKEN_RENT_SPONSOR).
|
|
1606
1573
|
*/
|
|
1607
|
-
declare function
|
|
1574
|
+
declare function createAssociatedLightTokenAccountInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig | null, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
|
|
1608
1575
|
/**
|
|
1609
|
-
* Create idempotent instruction for creating an associated
|
|
1576
|
+
* Create idempotent instruction for creating an associated light-token account.
|
|
1610
1577
|
* Uses the default rent sponsor PDA by default.
|
|
1611
1578
|
*
|
|
1612
1579
|
* @param feePayer Fee payer public key.
|
|
@@ -1616,19 +1583,19 @@ declare function createAssociatedCTokenAccountInstruction(feePayer: PublicKey, o
|
|
|
1616
1583
|
* @param configAccount Config account (defaults to LIGHT_TOKEN_CONFIG).
|
|
1617
1584
|
* @param rentPayerPda Rent payer PDA (defaults to LIGHT_TOKEN_RENT_SPONSOR).
|
|
1618
1585
|
*/
|
|
1619
|
-
declare function
|
|
1586
|
+
declare function createAssociatedLightTokenAccountIdempotentInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig | null, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
|
|
1620
1587
|
|
|
1621
1588
|
/**
|
|
1622
|
-
*
|
|
1589
|
+
* light-token-specific config for createAssociatedTokenAccountInterfaceInstruction
|
|
1623
1590
|
*/
|
|
1624
|
-
interface
|
|
1591
|
+
interface LightTokenConfig {
|
|
1625
1592
|
compressibleConfig?: CompressibleConfig | null;
|
|
1626
1593
|
configAccount?: PublicKey;
|
|
1627
1594
|
rentPayerPda?: PublicKey;
|
|
1628
1595
|
}
|
|
1629
1596
|
/**
|
|
1630
1597
|
* Create instruction for creating an associated token account (SPL, Token-2022,
|
|
1631
|
-
* or
|
|
1598
|
+
* or light-token). Follows SPL Token API signature with optional light-token config at the
|
|
1632
1599
|
* end.
|
|
1633
1600
|
*
|
|
1634
1601
|
* @param payer Fee payer public key.
|
|
@@ -1637,12 +1604,12 @@ interface CTokenConfig {
|
|
|
1637
1604
|
* @param mint Mint address.
|
|
1638
1605
|
* @param programId Token program ID (default: TOKEN_PROGRAM_ID).
|
|
1639
1606
|
* @param associatedTokenProgramId Associated token program ID.
|
|
1640
|
-
* @param
|
|
1607
|
+
* @param lightTokenConfig Optional light-token-specific configuration.
|
|
1641
1608
|
*/
|
|
1642
|
-
declare function createAssociatedTokenAccountInterfaceInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey,
|
|
1609
|
+
declare function createAssociatedTokenAccountInterfaceInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey, lightTokenConfig?: LightTokenConfig): TransactionInstruction;
|
|
1643
1610
|
/**
|
|
1644
1611
|
* Create idempotent instruction for creating an associated token account (SPL,
|
|
1645
|
-
* Token-2022, or
|
|
1612
|
+
* Token-2022, or light-token). Follows SPL Token API signature with optional light-token
|
|
1646
1613
|
* config at the end.
|
|
1647
1614
|
*
|
|
1648
1615
|
* @param payer Fee payer public key.
|
|
@@ -1651,36 +1618,70 @@ declare function createAssociatedTokenAccountInterfaceInstruction(payer: PublicK
|
|
|
1651
1618
|
* @param mint Mint address.
|
|
1652
1619
|
* @param programId Token program ID (default: TOKEN_PROGRAM_ID).
|
|
1653
1620
|
* @param associatedTokenProgramId Associated token program ID.
|
|
1654
|
-
* @param
|
|
1621
|
+
* @param lightTokenConfig Optional light-token-specific configuration.
|
|
1655
1622
|
*/
|
|
1656
|
-
declare function createAssociatedTokenAccountInterfaceIdempotentInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey,
|
|
1623
|
+
declare function createAssociatedTokenAccountInterfaceIdempotentInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey, lightTokenConfig?: LightTokenConfig): TransactionInstruction;
|
|
1657
1624
|
/**
|
|
1658
1625
|
* Short alias for createAssociatedTokenAccountInterfaceIdempotentInstruction.
|
|
1659
1626
|
*/
|
|
1660
1627
|
declare const createAtaInterfaceIdempotentInstruction: typeof createAssociatedTokenAccountInterfaceIdempotentInstruction;
|
|
1661
1628
|
|
|
1629
|
+
declare function sliceLast<T>(items: T[]): {
|
|
1630
|
+
rest: T[];
|
|
1631
|
+
last: T;
|
|
1632
|
+
};
|
|
1633
|
+
|
|
1634
|
+
/**
|
|
1635
|
+
* Create a light-token transfer instruction.
|
|
1636
|
+
*
|
|
1637
|
+
* For light-token accounts with compressible extension, the program needs
|
|
1638
|
+
* system_program and fee_payer to handle rent top-ups.
|
|
1639
|
+
*
|
|
1640
|
+
* @param source Source light-token account
|
|
1641
|
+
* @param destination Destination light-token account
|
|
1642
|
+
* @param owner Owner of the source account (signer, also pays for compressible extension top-ups)
|
|
1643
|
+
* @param amount Amount to transfer
|
|
1644
|
+
* @param feePayer Optional fee payer for top-ups (defaults to owner)
|
|
1645
|
+
* @returns Transaction instruction for light-token transfer
|
|
1646
|
+
*/
|
|
1647
|
+
declare function createLightTokenTransferInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, feePayer?: PublicKey): TransactionInstruction;
|
|
1648
|
+
/**
|
|
1649
|
+
* Create a light-token transfer_checked instruction. Same semantics as SPL
|
|
1650
|
+
* TransferChecked.
|
|
1651
|
+
*/
|
|
1652
|
+
declare function createLightTokenTransferCheckedInstruction(source: PublicKey, destination: PublicKey, mint: PublicKey, owner: PublicKey, amount: number | bigint, decimals: number, payer: PublicKey): TransactionInstruction;
|
|
1653
|
+
|
|
1654
|
+
interface InterfaceOptions {
|
|
1655
|
+
splInterfaceInfos?: SplInterfaceInfo[];
|
|
1656
|
+
wrap?: boolean;
|
|
1657
|
+
/**
|
|
1658
|
+
* Delegate authority pubkey. For owner-signed flows, omit this field.
|
|
1659
|
+
*/
|
|
1660
|
+
delegatePubkey?: PublicKey;
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1662
1663
|
/**
|
|
1663
1664
|
* Parameters for creating a MintTo instruction.
|
|
1664
1665
|
*/
|
|
1665
1666
|
interface CreateMintToInstructionParams {
|
|
1666
|
-
/**
|
|
1667
|
+
/** Light mint account (decompressed from compressed light mint) */
|
|
1667
1668
|
mint: PublicKey;
|
|
1668
|
-
/** Destination
|
|
1669
|
+
/** Destination light-token account to mint to */
|
|
1669
1670
|
destination: PublicKey;
|
|
1670
1671
|
/** Amount of tokens to mint */
|
|
1671
1672
|
amount: number | bigint;
|
|
1672
1673
|
/** Mint authority (must be signer) */
|
|
1673
1674
|
authority: PublicKey;
|
|
1674
|
-
/** Maximum lamports for rent and top-up combined. Transaction fails if exceeded. (0 = no
|
|
1675
|
+
/** Maximum lamports for rent and top-up combined. Transaction fails if exceeded. (u16::MAX = no limit, 0 = no top-ups allowed) */
|
|
1675
1676
|
maxTopUp?: number;
|
|
1676
1677
|
/** Optional fee payer for rent top-ups. If not provided, authority pays. */
|
|
1677
1678
|
feePayer?: PublicKey;
|
|
1678
1679
|
}
|
|
1679
1680
|
/**
|
|
1680
|
-
* Create instruction for minting tokens to a
|
|
1681
|
+
* Create instruction for minting tokens to a light-token account.
|
|
1681
1682
|
*
|
|
1682
|
-
* This is a simple 3-4 account instruction for minting to
|
|
1683
|
-
* Uses discriminator 7 (
|
|
1683
|
+
* This is a simple 3-4 account instruction for minting to light-token associated token accounts (hot).
|
|
1684
|
+
* Uses discriminator 7 (LightTokenMintTo).
|
|
1684
1685
|
*
|
|
1685
1686
|
* @param params - Mint instruction parameters
|
|
1686
1687
|
* @returns TransactionInstruction for minting tokens
|
|
@@ -1714,9 +1715,14 @@ declare const COMPRESS_SPL_TOKEN_ACCOUNT_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
|
1714
1715
|
declare const APPROVE_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1715
1716
|
declare const REVOKE_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1716
1717
|
declare const ADD_TOKEN_POOL_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1717
|
-
declare const DECOMPRESS_ACCOUNTS_IDEMPOTENT_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
|
|
1718
1718
|
/**
|
|
1719
|
-
*
|
|
1719
|
+
* Maximum lamports for rent top-up in a single instruction.
|
|
1720
|
+
* u16::MAX = no limit; 0 = no top-ups allowed.
|
|
1721
|
+
* Matches Rust SDK (e.g. token-sdk create_mints uses u16::MAX for "no limit").
|
|
1722
|
+
*/
|
|
1723
|
+
declare const MAX_TOP_UP = 65535;
|
|
1724
|
+
/**
|
|
1725
|
+
* Rent configuration constants for compressible light token accounts.
|
|
1720
1726
|
* These match the Rust SDK defaults in program-libs/compressible/src/rent/config.rs
|
|
1721
1727
|
*/
|
|
1722
1728
|
/** Base rent per epoch (lamports) */
|
|
@@ -1732,21 +1738,21 @@ declare const COMPRESSION_INCENTIVE = 1000;
|
|
|
1732
1738
|
/** Total compression cost (COMPRESSION_COST + COMPRESSION_INCENTIVE) */
|
|
1733
1739
|
declare const TOTAL_COMPRESSION_COST: number;
|
|
1734
1740
|
/**
|
|
1735
|
-
* Compressible
|
|
1741
|
+
* Compressible light token account size in bytes.
|
|
1736
1742
|
* = 165 (base SPL token) + 1 (account_type) + 1 (Option) + 4 (Vec len) + 1 (ext disc) + 4 (ext header) + 96 (CompressionInfo) = 272
|
|
1737
1743
|
* Source: program-libs/token-interface/src/state/token/top_up.rs MIN_SIZE_WITH_COMPRESSIBLE
|
|
1738
1744
|
*/
|
|
1739
|
-
declare const
|
|
1745
|
+
declare const COMPRESSIBLE_LIGHT_TOKEN_ACCOUNT_SIZE = 272;
|
|
1740
1746
|
/**
|
|
1741
1747
|
* Calculate rent per epoch for a given account size.
|
|
1742
1748
|
* Formula: base_rent + (bytes * lamports_per_byte_per_epoch)
|
|
1743
1749
|
*/
|
|
1744
1750
|
declare function rentPerEpoch(bytes: number): number;
|
|
1745
1751
|
/**
|
|
1746
|
-
* Default rent per epoch for a compressible
|
|
1752
|
+
* Default rent per epoch for a compressible light token account (272 bytes).
|
|
1747
1753
|
* = 128 + 272 = 400 lamports
|
|
1748
1754
|
*/
|
|
1749
|
-
declare const
|
|
1755
|
+
declare const COMPRESSIBLE_LIGHT_TOKEN_RENT_PER_EPOCH: number;
|
|
1750
1756
|
/** Default prepaid epochs (24 hours = 16 epochs * 1.5h) */
|
|
1751
1757
|
declare const DEFAULT_PREPAY_EPOCHS = 16;
|
|
1752
1758
|
/** Default write top-up (lamports) - ~2 epochs rent */
|
|
@@ -1758,33 +1764,34 @@ declare const DEFAULT_WRITE_TOP_UP = 766;
|
|
|
1758
1764
|
declare function calculateFeePayerCostAtCreation(prepayEpochs?: number, accountBytes?: number): number;
|
|
1759
1765
|
|
|
1760
1766
|
/**
|
|
1761
|
-
* Create instruction for minting tokens from a
|
|
1762
|
-
* To mint to
|
|
1767
|
+
* Create instruction for minting tokens from a light mint to compressed accounts.
|
|
1768
|
+
* To mint to light-token associated token accounts across SPL/T22/light mints, use
|
|
1763
1769
|
* {@link createMintToInterfaceInstruction} instead.
|
|
1764
1770
|
*
|
|
1765
1771
|
* @param authority Mint authority public key.
|
|
1766
1772
|
* @param payer Fee payer public key.
|
|
1767
|
-
* @param validityProof Validity proof for the
|
|
1768
|
-
* @param merkleContext Merkle context of the
|
|
1773
|
+
* @param validityProof Validity proof for the light mint.
|
|
1774
|
+
* @param merkleContext Merkle context of the light mint.
|
|
1769
1775
|
* @param mintData Mint instruction data.
|
|
1770
1776
|
* @param recipients Array of recipients with amounts.
|
|
1771
1777
|
* @param outputStateTreeInfo Optional output state tree info. Uses merkle
|
|
1772
1778
|
* context queue if not provided.
|
|
1773
1779
|
* @param tokenAccountVersion Token account version (default:
|
|
1774
1780
|
* TokenDataVersion.ShaFlat).
|
|
1781
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1775
1782
|
*/
|
|
1776
1783
|
declare function createMintToCompressedInstruction(authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, merkleContext: MerkleContext, mintData: MintInstructionData, recipients: Array<{
|
|
1777
1784
|
recipient: PublicKey;
|
|
1778
1785
|
amount: number | bigint;
|
|
1779
|
-
}>, outputStateTreeInfo?: TreeInfo, tokenAccountVersion?: TokenDataVersion): TransactionInstruction;
|
|
1786
|
+
}>, outputStateTreeInfo?: TreeInfo, tokenAccountVersion?: TokenDataVersion, maxTopUp?: number): TransactionInstruction;
|
|
1780
1787
|
|
|
1781
1788
|
/**
|
|
1782
|
-
* Create mint-to instruction for SPL, Token-2022, or
|
|
1783
|
-
* This instruction ONLY mints to
|
|
1789
|
+
* Create mint-to instruction for SPL, Token-2022, or light-token mints.
|
|
1790
|
+
* This instruction ONLY mints to light-token associated token accounts (hot).
|
|
1784
1791
|
*
|
|
1785
|
-
* For
|
|
1792
|
+
* For light-token mints, the light mint account must exist (mint must be decompressed first).
|
|
1786
1793
|
*
|
|
1787
|
-
* @param mintInterface Mint interface (SPL, Token-2022, or
|
|
1794
|
+
* @param mintInterface Mint interface (SPL, Token-2022, or light-token).
|
|
1788
1795
|
* @param destination Destination onchain token account address.
|
|
1789
1796
|
* @param authority Mint authority public key.
|
|
1790
1797
|
* @param payer Fee payer public key.
|
|
@@ -1794,185 +1801,28 @@ declare function createMintToCompressedInstruction(authority: PublicKey, payer:
|
|
|
1794
1801
|
*/
|
|
1795
1802
|
declare function createMintToInterfaceInstruction(mintInterface: MintInterface, destination: PublicKey, authority: PublicKey, payer: PublicKey, amount: number | bigint, validityProof?: ValidityProofWithContext, multiSigners?: PublicKey[]): TransactionInstruction;
|
|
1796
1803
|
|
|
1797
|
-
/**
|
|
1798
|
-
* Create a Light token transfer instruction.
|
|
1799
|
-
*
|
|
1800
|
-
* For c-token accounts with compressible extension, the program needs
|
|
1801
|
-
* system_program and fee_payer to handle rent top-ups.
|
|
1802
|
-
*
|
|
1803
|
-
* @param source Source c-token account
|
|
1804
|
-
* @param destination Destination c-token account
|
|
1805
|
-
* @param owner Owner of the source account (signer, also pays for compressible extension top-ups)
|
|
1806
|
-
* @param amount Amount to transfer
|
|
1807
|
-
* @param feePayer Optional fee payer for top-ups (defaults to owner)
|
|
1808
|
-
* @returns Transaction instruction for Light token transfer
|
|
1809
|
-
*/
|
|
1810
|
-
declare function createLightTokenTransferInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, feePayer?: PublicKey): TransactionInstruction;
|
|
1811
|
-
|
|
1812
|
-
/**
|
|
1813
|
-
* Create decompressInterface instruction using Transfer2.
|
|
1814
|
-
*
|
|
1815
|
-
* Supports decompressing to both c-token accounts and SPL token accounts:
|
|
1816
|
-
* - For c-token destinations: No splInterfaceInfo needed
|
|
1817
|
-
* - For SPL destinations: Provide splInterfaceInfo (token pool info) and decimals
|
|
1818
|
-
*
|
|
1819
|
-
* @param payer Fee payer public key
|
|
1820
|
-
* @param inputCompressedTokenAccounts Input compressed token accounts
|
|
1821
|
-
* @param toAddress Destination token account address (c-token or SPL ATA)
|
|
1822
|
-
* @param amount Amount to decompress
|
|
1823
|
-
* @param validityProof Validity proof (contains compressedProof and rootIndices)
|
|
1824
|
-
* @param splInterfaceInfo Optional: SPL interface info for SPL destinations
|
|
1825
|
-
* @param decimals Mint decimals (required for SPL destinations)
|
|
1826
|
-
* @returns TransactionInstruction
|
|
1827
|
-
*/
|
|
1828
|
-
declare function createDecompressInterfaceInstruction(payer: PublicKey, inputCompressedTokenAccounts: ParsedTokenAccount[], toAddress: PublicKey, amount: bigint, validityProof: ValidityProofWithContext, splInterfaceInfo: SplInterfaceInfo | undefined, decimals: number): TransactionInstruction;
|
|
1829
|
-
|
|
1830
|
-
/**
|
|
1831
|
-
* Account info interface for compressible accounts.
|
|
1832
|
-
* Matches return structure of getAccountInterface/getAtaInterface.
|
|
1833
|
-
*
|
|
1834
|
-
* Integrating programs provide their own fetch/parse - this is just the data shape.
|
|
1835
|
-
*/
|
|
1836
|
-
interface ParsedAccountInfoInterface<T = unknown> {
|
|
1837
|
-
/** Parsed account data (program-specific) */
|
|
1838
|
-
parsed: T;
|
|
1839
|
-
/** Load context - present if account is compressed (cold), undefined if hot */
|
|
1840
|
-
loadContext?: MerkleContext;
|
|
1841
|
-
}
|
|
1842
|
-
/**
|
|
1843
|
-
* Input for createLoadAccountsParams.
|
|
1844
|
-
* Supports both program PDAs and c-token vaults.
|
|
1845
|
-
*
|
|
1846
|
-
* The integrating program is responsible for fetching and parsing their accounts.
|
|
1847
|
-
* This helper just packs them for the decompressAccountsIdempotent instruction.
|
|
1848
|
-
*/
|
|
1849
|
-
interface CompressibleAccountInput<T = unknown> {
|
|
1850
|
-
/** Account address */
|
|
1851
|
-
address: PublicKey;
|
|
1852
|
-
/**
|
|
1853
|
-
* Account type key for packing:
|
|
1854
|
-
* - For PDAs: program-specific type name (e.g., "poolState", "observationState")
|
|
1855
|
-
* - For c-token vaults: "cTokenData"
|
|
1856
|
-
*/
|
|
1857
|
-
accountType: string;
|
|
1858
|
-
/**
|
|
1859
|
-
* Token variant - required when accountType is "cTokenData".
|
|
1860
|
-
* Examples: "lpVault", "token0Vault", "token1Vault"
|
|
1861
|
-
*/
|
|
1862
|
-
tokenVariant?: string;
|
|
1863
|
-
/** Parsed account info (from program-specific fetch) */
|
|
1864
|
-
info: ParsedAccountInfoInterface<T>;
|
|
1865
|
-
}
|
|
1866
|
-
/**
|
|
1867
|
-
* Packed compressed account for decompressAccountsIdempotent instruction
|
|
1868
|
-
*/
|
|
1869
|
-
interface PackedCompressedAccount {
|
|
1870
|
-
[key: string]: unknown;
|
|
1871
|
-
merkleContext: {
|
|
1872
|
-
merkleTreePubkeyIndex: number;
|
|
1873
|
-
queuePubkeyIndex: number;
|
|
1874
|
-
};
|
|
1875
|
-
}
|
|
1876
|
-
/**
|
|
1877
|
-
* Result from building load params
|
|
1878
|
-
*/
|
|
1879
|
-
interface CompressibleLoadParams {
|
|
1880
|
-
/** Validity proof wrapped in option (null if all proveByIndex) */
|
|
1881
|
-
proofOption: {
|
|
1882
|
-
0: ValidityProof | null;
|
|
1883
|
-
};
|
|
1884
|
-
/** Packed compressed accounts data for instruction */
|
|
1885
|
-
compressedAccounts: PackedCompressedAccount[];
|
|
1886
|
-
/** Offset to system accounts in remainingAccounts */
|
|
1887
|
-
systemAccountsOffset: number;
|
|
1888
|
-
/** Account metas for remaining accounts */
|
|
1889
|
-
remainingAccounts: AccountMeta[];
|
|
1890
|
-
}
|
|
1891
|
-
/**
|
|
1892
|
-
* Result from createLoadAccountsParams
|
|
1893
|
-
*/
|
|
1894
|
-
interface LoadResult {
|
|
1895
|
-
/** Params for decompressAccountsIdempotent (null if no program accounts need decompressing) */
|
|
1896
|
-
decompressParams: CompressibleLoadParams | null;
|
|
1897
|
-
/** Instructions to load ATAs (create ATA, wrap SPL/T22, decompressInterface) */
|
|
1898
|
-
ataInstructions: TransactionInstruction[];
|
|
1899
|
-
}
|
|
1900
|
-
/**
|
|
1901
|
-
* Create params for loading program accounts and ATAs.
|
|
1902
|
-
*
|
|
1903
|
-
* Returns:
|
|
1904
|
-
* - decompressParams: for a caller program's standardized
|
|
1905
|
-
* decompressAccountsIdempotent instruction
|
|
1906
|
-
* - ataInstructions: for loading user ATAs
|
|
1907
|
-
*
|
|
1908
|
-
* @param rpc RPC connection
|
|
1909
|
-
* @param payer Fee payer (needed for ATA instructions)
|
|
1910
|
-
* @param programId Program ID for decompressAccountsIdempotent
|
|
1911
|
-
* @param programAccounts PDAs and vaults (caller pre-fetches)
|
|
1912
|
-
* @param atas User ATAs (fetched via getAtaInterface)
|
|
1913
|
-
* @param options Optional load options
|
|
1914
|
-
* @returns LoadResult with decompressParams and ataInstructions
|
|
1915
|
-
*
|
|
1916
|
-
* @example
|
|
1917
|
-
* ```typescript
|
|
1918
|
-
* const poolInfo = await myProgram.fetchPoolState(rpc, poolAddress);
|
|
1919
|
-
* const vault0Ata = getAssociatedTokenAddressInterface(token0Mint, poolAddress);
|
|
1920
|
-
* const vault0Info = await getAtaInterface(rpc, vault0Ata, poolAddress, token0Mint, undefined, LIGHT_TOKEN_PROGRAM_ID);
|
|
1921
|
-
* const userAta = getAssociatedTokenAddressInterface(tokenMint, userWallet);
|
|
1922
|
-
* const userAtaInfo = await getAtaInterface(rpc, userAta, userWallet, tokenMint);
|
|
1923
|
-
*
|
|
1924
|
-
* const result = await createLoadAccountsParams(
|
|
1925
|
-
* rpc,
|
|
1926
|
-
* payer.publicKey,
|
|
1927
|
-
* programId,
|
|
1928
|
-
* [
|
|
1929
|
-
* { address: poolAddress, accountType: 'poolState', info: poolInfo },
|
|
1930
|
-
* { address: vault0, accountType: 'cTokenData', tokenVariant: 'token0Vault', info: vault0Info },
|
|
1931
|
-
* ],
|
|
1932
|
-
* [userAta],
|
|
1933
|
-
* );
|
|
1934
|
-
*
|
|
1935
|
-
* // Build transaction with both program decompress and ATA load
|
|
1936
|
-
* const instructions = [...result.ataInstructions];
|
|
1937
|
-
* if (result.decompressParams) {
|
|
1938
|
-
* instructions.push(await program.methods
|
|
1939
|
-
* .decompressAccountsIdempotent(
|
|
1940
|
-
* result.decompressParams.proofOption,
|
|
1941
|
-
* result.decompressParams.compressedAccounts,
|
|
1942
|
-
* result.decompressParams.systemAccountsOffset,
|
|
1943
|
-
* )
|
|
1944
|
-
* .remainingAccounts(result.decompressParams.remainingAccounts)
|
|
1945
|
-
* .instruction());
|
|
1946
|
-
* }
|
|
1947
|
-
* ```
|
|
1948
|
-
*/
|
|
1949
|
-
declare function createLoadAccountsParams(rpc: Rpc, payer: PublicKey, programId: PublicKey, programAccounts?: CompressibleAccountInput[], atas?: AccountInterface[], options?: InterfaceOptions): Promise<LoadResult>;
|
|
1950
|
-
/**
|
|
1951
|
-
* Calculate compute units for compressible load operation
|
|
1952
|
-
*/
|
|
1953
|
-
declare function calculateCompressibleLoadComputeUnits(compressedAccountCount: number, hasValidityProof: boolean): number;
|
|
1954
|
-
|
|
1955
1804
|
/**
|
|
1956
1805
|
* Create a wrap instruction that moves tokens from an SPL/T22 account to a
|
|
1957
|
-
*
|
|
1806
|
+
* light-token account.
|
|
1958
1807
|
*
|
|
1959
1808
|
* @param source Source SPL/T22 token account
|
|
1960
|
-
* @param destination Destination
|
|
1809
|
+
* @param destination Destination light-token account
|
|
1961
1810
|
* @param owner Owner of the source account (signer)
|
|
1962
1811
|
* @param mint Mint address
|
|
1963
1812
|
* @param amount Amount to wrap,
|
|
1964
1813
|
* @param splInterfaceInfo SPL interface info for the compression
|
|
1965
1814
|
* @param decimals Mint decimals (required for transfer_checked)
|
|
1966
1815
|
* @param payer Fee payer (defaults to owner)
|
|
1816
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1967
1817
|
* @returns Instruction to wrap tokens
|
|
1968
1818
|
*/
|
|
1969
|
-
declare function createWrapInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, mint: PublicKey, amount: bigint, splInterfaceInfo: SplInterfaceInfo, decimals: number, payer?: PublicKey): TransactionInstruction;
|
|
1819
|
+
declare function createWrapInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, mint: PublicKey, amount: bigint, splInterfaceInfo: SplInterfaceInfo, decimals: number, payer?: PublicKey, maxTopUp?: number): TransactionInstruction;
|
|
1970
1820
|
|
|
1971
1821
|
/**
|
|
1972
|
-
* Create an unwrap instruction that moves tokens from a
|
|
1822
|
+
* Create an unwrap instruction that moves tokens from a light-token account to an
|
|
1973
1823
|
* SPL/T22 account.
|
|
1974
1824
|
*
|
|
1975
|
-
* @param source Source
|
|
1825
|
+
* @param source Source light-token account
|
|
1976
1826
|
* @param destination Destination SPL/T22 token account
|
|
1977
1827
|
* @param owner Owner of the source account (signer)
|
|
1978
1828
|
* @param mint Mint address
|
|
@@ -1980,24 +1830,96 @@ declare function createWrapInstruction(source: PublicKey, destination: PublicKey
|
|
|
1980
1830
|
* @param splInterfaceInfo SPL interface info for the decompression
|
|
1981
1831
|
* @param decimals Mint decimals (required for transfer_checked)
|
|
1982
1832
|
* @param payer Fee payer (defaults to owner if not provided)
|
|
1833
|
+
* @param maxTopUp Optional cap on rent top-up (units of 1k lamports; default no cap)
|
|
1983
1834
|
* @returns TransactionInstruction to unwrap tokens
|
|
1984
1835
|
*/
|
|
1985
|
-
declare function createUnwrapInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, mint: PublicKey, amount: bigint, splInterfaceInfo: SplInterfaceInfo, decimals: number, payer?: PublicKey): TransactionInstruction;
|
|
1836
|
+
declare function createUnwrapInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, mint: PublicKey, amount: bigint, splInterfaceInfo: SplInterfaceInfo, decimals: number, payer?: PublicKey, maxTopUp?: number): TransactionInstruction;
|
|
1837
|
+
|
|
1838
|
+
/**
|
|
1839
|
+
* Create an instruction to freeze a decompressed light-token account.
|
|
1840
|
+
*
|
|
1841
|
+
* Freezing sets the account state to AccountState::Frozen, preventing
|
|
1842
|
+
* transfers and other token operations. Only the mint's freeze_authority
|
|
1843
|
+
* can freeze accounts.
|
|
1844
|
+
*
|
|
1845
|
+
* Account order per program:
|
|
1846
|
+
* 0. token_account (mutable) - the light-token account to freeze
|
|
1847
|
+
* 1. mint (readonly) - the mint associated with the token account
|
|
1848
|
+
* 2. freeze_authority - must match mint.freeze_authority (signer)
|
|
1849
|
+
*
|
|
1850
|
+
* @param tokenAccount The light-token account to freeze (must be Initialized)
|
|
1851
|
+
* @param mint The mint of the light-token account
|
|
1852
|
+
* @param freezeAuthority The freeze authority of the mint (signer)
|
|
1853
|
+
* @returns TransactionInstruction
|
|
1854
|
+
*/
|
|
1855
|
+
declare function createLightTokenFreezeAccountInstruction(tokenAccount: PublicKey, mint: PublicKey, freezeAuthority: PublicKey): TransactionInstruction;
|
|
1856
|
+
/**
|
|
1857
|
+
* Create an instruction to thaw (unfreeze) a frozen light-token account.
|
|
1858
|
+
*
|
|
1859
|
+
* Thawing restores the account state from AccountState::Frozen to
|
|
1860
|
+
* AccountState::Initialized, re-enabling token operations. Only the
|
|
1861
|
+
* mint's freeze_authority can thaw accounts.
|
|
1862
|
+
*
|
|
1863
|
+
* Account order per program:
|
|
1864
|
+
* 0. token_account (mutable) - the frozen light-token account to thaw
|
|
1865
|
+
* 1. mint (readonly) - the mint associated with the token account
|
|
1866
|
+
* 2. freeze_authority - must match mint.freeze_authority (signer)
|
|
1867
|
+
*
|
|
1868
|
+
* @param tokenAccount The frozen light-token account to thaw
|
|
1869
|
+
* @param mint The mint of the light-token account
|
|
1870
|
+
* @param freezeAuthority The freeze authority of the mint (signer)
|
|
1871
|
+
* @returns TransactionInstruction
|
|
1872
|
+
*/
|
|
1873
|
+
declare function createLightTokenThawAccountInstruction(tokenAccount: PublicKey, mint: PublicKey, freezeAuthority: PublicKey): TransactionInstruction;
|
|
1874
|
+
|
|
1875
|
+
/**
|
|
1876
|
+
* Create an instruction to approve a delegate for a light-token account.
|
|
1877
|
+
*
|
|
1878
|
+
* Account order per program:
|
|
1879
|
+
* 0. token_account (mutable) - the light-token account
|
|
1880
|
+
* 1. delegate (readonly) - the delegate to approve
|
|
1881
|
+
* 2. owner (signer) - owner of the token account
|
|
1882
|
+
* 3. system_program (readonly) - for rent top-ups via CPI
|
|
1883
|
+
* 4. fee_payer (mutable, signer) - pays for rent top-ups
|
|
1884
|
+
*
|
|
1885
|
+
* @param tokenAccount The light-token account to set delegation on
|
|
1886
|
+
* @param delegate The delegate to approve
|
|
1887
|
+
* @param owner Owner of the token account (signer)
|
|
1888
|
+
* @param amount Amount of tokens to delegate
|
|
1889
|
+
* @param feePayer Optional fee payer for rent top-ups (defaults to owner)
|
|
1890
|
+
* @returns TransactionInstruction
|
|
1891
|
+
*/
|
|
1892
|
+
declare function createLightTokenApproveInstruction(tokenAccount: PublicKey, delegate: PublicKey, owner: PublicKey, amount: number | bigint, feePayer?: PublicKey): TransactionInstruction;
|
|
1893
|
+
/**
|
|
1894
|
+
* Create an instruction to revoke delegation for a light-token account.
|
|
1895
|
+
*
|
|
1896
|
+
* Account order per program:
|
|
1897
|
+
* 0. token_account (mutable) - the light-token account
|
|
1898
|
+
* 1. owner (signer) - owner of the token account
|
|
1899
|
+
* 2. system_program (readonly) - for rent top-ups via CPI
|
|
1900
|
+
* 3. fee_payer (mutable, signer) - pays for rent top-ups
|
|
1901
|
+
*
|
|
1902
|
+
* @param tokenAccount The light-token account to revoke delegation on
|
|
1903
|
+
* @param owner Owner of the token account (signer)
|
|
1904
|
+
* @param feePayer Optional fee payer for rent top-ups (defaults to owner)
|
|
1905
|
+
* @returns TransactionInstruction
|
|
1906
|
+
*/
|
|
1907
|
+
declare function createLightTokenRevokeInstruction(tokenAccount: PublicKey, owner: PublicKey, feePayer?: PublicKey): TransactionInstruction;
|
|
1986
1908
|
|
|
1987
1909
|
/**
|
|
1988
|
-
* Create and initialize a new mint for SPL/T22/
|
|
1910
|
+
* Create and initialize a new mint for SPL/T22/light-token.
|
|
1989
1911
|
*
|
|
1990
1912
|
* @param rpc RPC connection to use
|
|
1991
1913
|
* @param payer Fee payer
|
|
1992
|
-
* @param mintAuthority Account that will control minting (signer for
|
|
1914
|
+
* @param mintAuthority Account that will control minting (signer for light-token mints)
|
|
1993
1915
|
* @param freezeAuthority Account that will control freeze and thaw (optional)
|
|
1994
1916
|
* @param decimals Location of the decimal place
|
|
1995
1917
|
* @param keypair Mint keypair (defaults to a random keypair)
|
|
1996
1918
|
* @param confirmOptions Confirm options
|
|
1997
1919
|
* @param programId Token program ID (defaults to LIGHT_TOKEN_PROGRAM_ID)
|
|
1998
|
-
* @param tokenMetadata Optional token metadata (
|
|
1999
|
-
* @param outputStateTreeInfo Optional output state tree info (
|
|
2000
|
-
* @param addressTreeInfo Optional address tree info (
|
|
1920
|
+
* @param tokenMetadata Optional token metadata (light-token mints only)
|
|
1921
|
+
* @param outputStateTreeInfo Optional output state tree info (light-token mints only)
|
|
1922
|
+
* @param addressTreeInfo Optional address tree info (light-token mints only)
|
|
2001
1923
|
*
|
|
2002
1924
|
* @returns Object with mint address and transaction signature
|
|
2003
1925
|
*/
|
|
@@ -2007,8 +1929,8 @@ declare function createMintInterface(rpc: Rpc, payer: Signer, mintAuthority: Pub
|
|
|
2007
1929
|
}>;
|
|
2008
1930
|
|
|
2009
1931
|
/**
|
|
2010
|
-
* Update the mint authority of a
|
|
2011
|
-
* Works for both compressed and decompressed mints.
|
|
1932
|
+
* Update the mint authority of a light-token mint.
|
|
1933
|
+
* Works for both compressed and decompressed light mints.
|
|
2012
1934
|
*
|
|
2013
1935
|
* @param rpc RPC connection
|
|
2014
1936
|
* @param payer Fee payer (signer)
|
|
@@ -2019,8 +1941,8 @@ declare function createMintInterface(rpc: Rpc, payer: Signer, mintAuthority: Pub
|
|
|
2019
1941
|
*/
|
|
2020
1942
|
declare function updateMintAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, currentMintAuthority: Signer, newMintAuthority: PublicKey | null, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2021
1943
|
/**
|
|
2022
|
-
* Update the freeze authority of a
|
|
2023
|
-
* Works for both compressed and decompressed mints.
|
|
1944
|
+
* Update the freeze authority of a light-token mint.
|
|
1945
|
+
* Works for both compressed and decompressed light mints.
|
|
2024
1946
|
*
|
|
2025
1947
|
* @param rpc RPC connection
|
|
2026
1948
|
* @param payer Fee payer (signer)
|
|
@@ -2032,8 +1954,8 @@ declare function updateMintAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, c
|
|
|
2032
1954
|
declare function updateFreezeAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, currentFreezeAuthority: Signer, newFreezeAuthority: PublicKey | null, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2033
1955
|
|
|
2034
1956
|
/**
|
|
2035
|
-
* Update a metadata field on a
|
|
2036
|
-
* Works for both compressed and decompressed mints.
|
|
1957
|
+
* Update a metadata field on a light-token mint.
|
|
1958
|
+
* Works for both compressed and decompressed light mints.
|
|
2037
1959
|
*
|
|
2038
1960
|
* @param rpc RPC connection
|
|
2039
1961
|
* @param payer Fee payer (signer)
|
|
@@ -2047,8 +1969,8 @@ declare function updateFreezeAuthority(rpc: Rpc, payer: Signer, mint: PublicKey,
|
|
|
2047
1969
|
*/
|
|
2048
1970
|
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>;
|
|
2049
1971
|
/**
|
|
2050
|
-
* Update the metadata authority of a
|
|
2051
|
-
* Works for both compressed and decompressed mints.
|
|
1972
|
+
* Update the metadata authority of a light-token mint.
|
|
1973
|
+
* Works for both compressed and decompressed light mints.
|
|
2052
1974
|
*
|
|
2053
1975
|
* @param rpc RPC connection
|
|
2054
1976
|
* @param payer Fee payer (signer)
|
|
@@ -2060,8 +1982,8 @@ declare function updateMetadataField(rpc: Rpc, payer: Signer, mint: PublicKey, a
|
|
|
2060
1982
|
*/
|
|
2061
1983
|
declare function updateMetadataAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, currentAuthority: Signer, newAuthority: PublicKey, extensionIndex?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2062
1984
|
/**
|
|
2063
|
-
* Remove a metadata key from a
|
|
2064
|
-
* Works for both compressed and decompressed mints.
|
|
1985
|
+
* Remove a metadata key from a light-token mint.
|
|
1986
|
+
* Works for both compressed and decompressed light mints.
|
|
2065
1987
|
*
|
|
2066
1988
|
* @param rpc RPC connection
|
|
2067
1989
|
* @param payer Fee payer (signer)
|
|
@@ -2075,8 +1997,8 @@ declare function updateMetadataAuthority(rpc: Rpc, payer: Signer, mint: PublicKe
|
|
|
2075
1997
|
declare function removeMetadataKey(rpc: Rpc, payer: Signer, mint: PublicKey, authority: Signer, key: string, idempotent?: boolean, extensionIndex?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2076
1998
|
|
|
2077
1999
|
/**
|
|
2078
|
-
* Create an associated token account for SPL/T22/
|
|
2079
|
-
* program.
|
|
2000
|
+
* Create an associated token account for SPL/T22/light-token. Defaults to
|
|
2001
|
+
* light-token program.
|
|
2080
2002
|
*
|
|
2081
2003
|
* @param rpc RPC connection
|
|
2082
2004
|
* @param payer Fee payer and transaction signer
|
|
@@ -2086,15 +2008,15 @@ declare function removeMetadataKey(rpc: Rpc, payer: Signer, mint: PublicKey, aut
|
|
|
2086
2008
|
* @param confirmOptions Options for confirming the transaction
|
|
2087
2009
|
* @param programId Token program ID (default:
|
|
2088
2010
|
* LIGHT_TOKEN_PROGRAM_ID)
|
|
2089
|
-
* @param associatedTokenProgramId
|
|
2090
|
-
* provided)
|
|
2091
|
-
* @param
|
|
2011
|
+
* @param associatedTokenProgramId associated token account program ID
|
|
2012
|
+
* (auto-derived if not provided)
|
|
2013
|
+
* @param lightTokenConfig Optional rent config
|
|
2092
2014
|
* @returns Address of the new associated token account
|
|
2093
2015
|
*/
|
|
2094
|
-
declare function createAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey,
|
|
2016
|
+
declare function createAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey, lightTokenConfig?: LightTokenConfig): Promise<PublicKey>;
|
|
2095
2017
|
/**
|
|
2096
|
-
* Create an associated token account idempotently for SPL/T22/
|
|
2097
|
-
* to
|
|
2018
|
+
* Create an associated token account idempotently for SPL/T22/light-token.
|
|
2019
|
+
* Defaults to light-token program.
|
|
2098
2020
|
*
|
|
2099
2021
|
* If the account already exists, the instruction succeeds without error.
|
|
2100
2022
|
*
|
|
@@ -2106,24 +2028,24 @@ declare function createAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, ow
|
|
|
2106
2028
|
* @param confirmOptions Options for confirming the transaction
|
|
2107
2029
|
* @param programId Token program ID (default:
|
|
2108
2030
|
* LIGHT_TOKEN_PROGRAM_ID)
|
|
2109
|
-
* @param associatedTokenProgramId
|
|
2110
|
-
* provided)
|
|
2111
|
-
* @param
|
|
2031
|
+
* @param associatedTokenProgramId associated token account program ID
|
|
2032
|
+
* (auto-derived if not provided)
|
|
2033
|
+
* @param lightTokenConfig Optional light-token-specific configuration
|
|
2112
2034
|
*
|
|
2113
2035
|
* @returns Address of the associated token account
|
|
2114
2036
|
*/
|
|
2115
|
-
declare function createAtaInterfaceIdempotent(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey,
|
|
2037
|
+
declare function createAtaInterfaceIdempotent(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey, lightTokenConfig?: LightTokenConfig): Promise<PublicKey>;
|
|
2116
2038
|
|
|
2117
2039
|
/**
|
|
2118
|
-
* Mint tokens to a
|
|
2040
|
+
* Mint tokens to a light-token account.
|
|
2119
2041
|
*
|
|
2120
|
-
* This is a simple mint instruction for minting to
|
|
2121
|
-
* The mint must
|
|
2042
|
+
* This is a simple mint instruction for minting to light-token associated token accounts (hot).
|
|
2043
|
+
* The light mint account must exist (mint must be decompressed first).
|
|
2122
2044
|
*
|
|
2123
2045
|
* @param rpc - RPC connection
|
|
2124
2046
|
* @param payer - Fee payer (signer)
|
|
2125
|
-
* @param mint - Mint address (
|
|
2126
|
-
* @param destination - Destination
|
|
2047
|
+
* @param mint - Mint address (light mint account)
|
|
2048
|
+
* @param destination - Destination light-token account
|
|
2127
2049
|
* @param authority - Mint authority (signer)
|
|
2128
2050
|
* @param amount - Amount to mint
|
|
2129
2051
|
* @param maxTopUp - Optional maximum lamports for rent top-up
|
|
@@ -2133,7 +2055,7 @@ declare function createAtaInterfaceIdempotent(rpc: Rpc, payer: Signer, mint: Pub
|
|
|
2133
2055
|
declare function mintTo$1(rpc: Rpc, payer: Signer, mint: PublicKey, destination: PublicKey, authority: Signer, amount: number | bigint, maxTopUp?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2134
2056
|
|
|
2135
2057
|
/**
|
|
2136
|
-
* Mint
|
|
2058
|
+
* Mint light-tokens directly to compressed accounts.
|
|
2137
2059
|
*
|
|
2138
2060
|
* @param rpc RPC connection
|
|
2139
2061
|
* @param payer Fee payer
|
|
@@ -2142,25 +2064,26 @@ declare function mintTo$1(rpc: Rpc, payer: Signer, mint: PublicKey, destination:
|
|
|
2142
2064
|
* @param recipients Array of recipients with amounts
|
|
2143
2065
|
* @param outputStateTreeInfo Optional output state tree info (auto-fetched if not provided)
|
|
2144
2066
|
* @param tokenAccountVersion Token account version (default: 3)
|
|
2067
|
+
* @param maxTopUp Optional: cap on rent top-up (units of 1k lamports; default no cap)
|
|
2145
2068
|
* @param confirmOptions Optional confirm options
|
|
2146
2069
|
*/
|
|
2147
2070
|
declare function mintToCompressed(rpc: Rpc, payer: Signer, mint: PublicKey, authority: Signer, recipients: Array<{
|
|
2148
2071
|
recipient: PublicKey;
|
|
2149
2072
|
amount: number | bigint;
|
|
2150
|
-
}>, outputStateTreeInfo?: TreeInfo, tokenAccountVersion?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2073
|
+
}>, outputStateTreeInfo?: TreeInfo, tokenAccountVersion?: number, maxTopUp?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2151
2074
|
|
|
2152
2075
|
/**
|
|
2153
2076
|
* Mint tokens to a decompressed/onchain token account.
|
|
2154
|
-
* Works with SPL, Token-2022, and
|
|
2077
|
+
* Works with SPL, Token-2022, and light-token mints.
|
|
2155
2078
|
*
|
|
2156
|
-
* This function ONLY mints to
|
|
2157
|
-
* For
|
|
2079
|
+
* This function ONLY mints to light-token associated token accounts (hot), never to compressed light-token accounts (cold).
|
|
2080
|
+
* For light-token mints, the light mint account must exist (mint must be decompressed first).
|
|
2158
2081
|
*
|
|
2159
2082
|
* The signature matches the standard SPL mintTo for simplicity and consistency.
|
|
2160
2083
|
*
|
|
2161
2084
|
* @param rpc - RPC connection to use
|
|
2162
2085
|
* @param payer - Transaction fee payer
|
|
2163
|
-
* @param mint - Mint address (SPL, Token-2022, or
|
|
2086
|
+
* @param mint - Mint address (SPL, Token-2022, or light-token mint)
|
|
2164
2087
|
* @param destination - Destination token account address (must be an existing onchain token account)
|
|
2165
2088
|
* @param authority - Mint authority (can be Signer or PublicKey if multiSigners provided)
|
|
2166
2089
|
* @param amount - Amount to mint
|
|
@@ -2173,48 +2096,31 @@ declare function mintToCompressed(rpc: Rpc, payer: Signer, mint: PublicKey, auth
|
|
|
2173
2096
|
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>;
|
|
2174
2097
|
|
|
2175
2098
|
/**
|
|
2176
|
-
*
|
|
2177
|
-
*
|
|
2178
|
-
* For unified loading, use {@link loadAta} instead.
|
|
2179
|
-
*
|
|
2180
|
-
* @param rpc RPC connection
|
|
2181
|
-
* @param payer Fee payer (signer)
|
|
2182
|
-
* @param owner Owner of the compressed tokens (signer)
|
|
2183
|
-
* @param mint Mint address
|
|
2184
|
-
* @param amount Amount to decompress (defaults to all)
|
|
2185
|
-
* @param destinationAta Destination token account address
|
|
2186
|
-
* @param destinationOwner Owner of the destination ATA
|
|
2187
|
-
* @param splInterfaceInfo SPL interface info for SPL/T22 destinations
|
|
2188
|
-
* @param confirmOptions Confirm options
|
|
2189
|
-
* @returns Transaction signature, null if nothing to load.
|
|
2190
|
-
*/
|
|
2191
|
-
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>;
|
|
2192
|
-
|
|
2193
|
-
/**
|
|
2194
|
-
* Wrap tokens from an SPL/T22 account to a c-token account.
|
|
2099
|
+
* Wrap tokens from an SPL/T22 account to a light-token account.
|
|
2195
2100
|
*
|
|
2196
2101
|
* This is an agnostic action that takes explicit account addresses (spl-token style).
|
|
2197
|
-
* Use getAssociatedTokenAddressSync() to derive
|
|
2102
|
+
* Use getAssociatedTokenAddressSync() to derive associated token account addresses if needed.
|
|
2198
2103
|
*
|
|
2199
2104
|
* @param rpc RPC connection
|
|
2200
2105
|
* @param payer Fee payer
|
|
2201
|
-
* @param source Source SPL/T22 token account (any token account, not just
|
|
2202
|
-
* @param destination Destination
|
|
2106
|
+
* @param source Source SPL/T22 token account (any token account, not just associated token account)
|
|
2107
|
+
* @param destination Destination light-token account
|
|
2203
2108
|
* @param owner Owner/authority of the source account (must sign)
|
|
2204
2109
|
* @param mint Mint address
|
|
2205
2110
|
* @param amount Amount to wrap
|
|
2206
2111
|
* @param splInterfaceInfo Optional: SPL interface info (will be fetched if not provided)
|
|
2112
|
+
* @param maxTopUp Optional: cap on rent top-up (units of 1k lamports; default no cap)
|
|
2207
2113
|
* @param confirmOptions Optional: Confirm options
|
|
2208
2114
|
*
|
|
2209
2115
|
* @example
|
|
2210
2116
|
* const splAta = getAssociatedTokenAddressSync(mint, owner.publicKey, false, TOKEN_PROGRAM_ID);
|
|
2211
|
-
* const
|
|
2117
|
+
* const lightTokenAta = getAssociatedTokenAddressInterface(mint, owner.publicKey); // defaults to light-token
|
|
2212
2118
|
*
|
|
2213
2119
|
* await wrap(
|
|
2214
2120
|
* rpc,
|
|
2215
2121
|
* payer,
|
|
2216
2122
|
* splAta,
|
|
2217
|
-
*
|
|
2123
|
+
* lightTokenAta,
|
|
2218
2124
|
* owner,
|
|
2219
2125
|
* mint,
|
|
2220
2126
|
* 1000n,
|
|
@@ -2222,25 +2128,7 @@ declare function decompressInterface(rpc: Rpc, payer: Signer, owner: Signer, min
|
|
|
2222
2128
|
*
|
|
2223
2129
|
* @returns Transaction signature
|
|
2224
2130
|
*/
|
|
2225
|
-
declare function wrap(rpc: Rpc, payer: Signer, source: PublicKey, destination: PublicKey, owner: Signer, mint: PublicKey, amount: bigint, splInterfaceInfo?: SplInterfaceInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2226
|
-
|
|
2227
|
-
/**
|
|
2228
|
-
* Create instructions to load an ATA from its AccountInterface.
|
|
2229
|
-
*
|
|
2230
|
-
* Behavior depends on `wrap` parameter:
|
|
2231
|
-
* - wrap=false (standard): Decompress compressed tokens to the target ATA type
|
|
2232
|
-
* (SPL ATA via pool, T22 ATA via pool, or c-token ATA direct)
|
|
2233
|
-
* - wrap=true (unified): Wrap SPL/T22 + decompress all to c-token ATA
|
|
2234
|
-
*
|
|
2235
|
-
* @param rpc RPC connection
|
|
2236
|
-
* @param payer Fee payer
|
|
2237
|
-
* @param ata AccountInterface from getAtaInterface (must have _isAta, _owner, _mint)
|
|
2238
|
-
* @param options Optional load options
|
|
2239
|
-
* @param wrap Unified mode: wrap SPL/T22 to c-token (default: false)
|
|
2240
|
-
* @param targetAta Target ATA address (used for type detection in standard mode)
|
|
2241
|
-
* @returns Array of instructions (empty if nothing to load)
|
|
2242
|
-
*/
|
|
2243
|
-
declare function createLoadAtaInstructionsFromInterface(rpc: Rpc, payer: PublicKey, ata: AccountInterface, options?: InterfaceOptions, wrap?: boolean, targetAta?: PublicKey): Promise<TransactionInstruction[]>;
|
|
2131
|
+
declare function wrap(rpc: Rpc, payer: Signer, source: PublicKey, destination: PublicKey, owner: Signer, mint: PublicKey, amount: bigint, splInterfaceInfo?: SplInterfaceInfo, maxTopUp?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
2244
2132
|
|
|
2245
2133
|
/**
|
|
2246
2134
|
* Input for creating off-chain metadata JSON.
|
|
@@ -2290,7 +2178,7 @@ interface OffChainTokenMetadataJson {
|
|
|
2290
2178
|
* const metadataJson = toOffChainMetadataJson({
|
|
2291
2179
|
* name: 'My Token',
|
|
2292
2180
|
* symbol: 'MTK',
|
|
2293
|
-
* description: 'A
|
|
2181
|
+
* description: 'A light-token',
|
|
2294
2182
|
* image: 'https://example.com/image.png',
|
|
2295
2183
|
* });
|
|
2296
2184
|
* const uri = await umi.uploader.uploadJson(metadataJson);
|
|
@@ -2301,18 +2189,30 @@ interface OffChainTokenMetadataJson {
|
|
|
2301
2189
|
declare function toOffChainMetadataJson(meta: OffChainTokenMetadata): OffChainTokenMetadataJson;
|
|
2302
2190
|
|
|
2303
2191
|
/**
|
|
2304
|
-
* Returns the
|
|
2192
|
+
* Returns the light mint address as bytes.
|
|
2193
|
+
* @internal
|
|
2305
2194
|
*/
|
|
2306
2195
|
declare function deriveCMintAddress(mintSeed: PublicKey, addressTreeInfo: TreeInfo): number[];
|
|
2307
2196
|
declare const COMPRESSED_MINT_SEED: Buffer$1;
|
|
2308
2197
|
/**
|
|
2309
|
-
* Finds the SPL mint PDA for a
|
|
2198
|
+
* Finds the SPL mint PDA for a light-token mint.
|
|
2310
2199
|
* @param mintSeed The mint seed public key.
|
|
2311
2200
|
* @returns [PDA, bump]
|
|
2201
|
+
* @internal
|
|
2312
2202
|
*/
|
|
2313
2203
|
declare function findMintAddress(mintSigner: PublicKey): [PublicKey, number];
|
|
2314
|
-
|
|
2315
|
-
|
|
2204
|
+
/**
|
|
2205
|
+
* Same as "getAssociatedTokenAddress" but returns the bump as well.
|
|
2206
|
+
* Uses light-token program ID.
|
|
2207
|
+
* @internal
|
|
2208
|
+
*/
|
|
2209
|
+
declare function getAssociatedLightTokenAddressAndBump(owner: PublicKey, mint: PublicKey): [PublicKey, number];
|
|
2210
|
+
/**
|
|
2211
|
+
* Same as "getAssociatedTokenAddress", returning just the associated token address.
|
|
2212
|
+
* Uses light-token program ID.
|
|
2213
|
+
* @internal
|
|
2214
|
+
*/
|
|
2215
|
+
declare function getAssociatedLightTokenAddress(owner: PublicKey, mint: PublicKey): PublicKey;
|
|
2316
2216
|
|
|
2317
2217
|
/**
|
|
2318
2218
|
* Approve a delegate to spend tokens
|
|
@@ -5534,7 +5434,7 @@ declare class CompressedTokenProgram {
|
|
|
5534
5434
|
/**
|
|
5535
5435
|
* Exports for @lightprotocol/compressed-token/unified
|
|
5536
5436
|
*
|
|
5537
|
-
* Import from `/unified` to get a single unified
|
|
5437
|
+
* Import from `/unified` to get a single unified associated token account for SPL/T22 and light-token
|
|
5538
5438
|
* mints.
|
|
5539
5439
|
*/
|
|
5540
5440
|
|
|
@@ -5551,21 +5451,21 @@ declare class CompressedTokenProgram {
|
|
|
5551
5451
|
*/
|
|
5552
5452
|
declare function getAtaInterface(rpc: Rpc, ata: PublicKey, owner: PublicKey, mint: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<AccountInterface>;
|
|
5553
5453
|
/**
|
|
5554
|
-
* Derive the canonical token
|
|
5454
|
+
* Derive the canonical token associated token account for SPL/T22/light-token in the unified path.
|
|
5555
5455
|
*
|
|
5556
5456
|
* Enforces LIGHT_TOKEN_PROGRAM_ID.
|
|
5557
5457
|
*
|
|
5558
5458
|
* @param mint Mint public key
|
|
5559
5459
|
* @param owner Owner public key
|
|
5560
5460
|
* @param allowOwnerOffCurve Allow owner to be a PDA. Default false.
|
|
5561
|
-
* @param programId Token program ID. Default
|
|
5461
|
+
* @param programId Token program ID. Default light-token.
|
|
5562
5462
|
* @param associatedTokenProgramId Associated token program ID. Default
|
|
5563
5463
|
* auto-detected.
|
|
5564
5464
|
* @returns Associated token address.
|
|
5565
5465
|
*/
|
|
5566
5466
|
declare function getAssociatedTokenAddressInterface(mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, programId?: PublicKey, associatedTokenProgramId?: PublicKey): PublicKey;
|
|
5567
5467
|
/**
|
|
5568
|
-
* Create instruction batches for loading ALL token balances into a
|
|
5468
|
+
* Create instruction batches for loading ALL token balances into a light-token associated token account.
|
|
5569
5469
|
*
|
|
5570
5470
|
* @param rpc RPC connection
|
|
5571
5471
|
* @param ata Associated token address
|
|
@@ -5577,14 +5477,14 @@ declare function getAssociatedTokenAddressInterface(mint: PublicKey, owner: Publ
|
|
|
5577
5477
|
*/
|
|
5578
5478
|
declare function createLoadAtaInstructions(rpc: Rpc, ata: PublicKey, owner: PublicKey, mint: PublicKey, payer?: PublicKey, options?: InterfaceOptions): Promise<TransactionInstruction[][]>;
|
|
5579
5479
|
/**
|
|
5580
|
-
* Load all token balances into the
|
|
5480
|
+
* Load all token balances into the light-token associated token account.
|
|
5581
5481
|
*
|
|
5582
|
-
* Wraps SPL/Token-2022 balances and decompresses compressed
|
|
5583
|
-
* into the on-chain
|
|
5482
|
+
* Wraps SPL/Token-2022 balances and decompresses compressed light-tokens
|
|
5483
|
+
* into the on-chain light-token associated token account. If no balances exist and the associated token account doesn't
|
|
5584
5484
|
* exist, creates an empty ATA (idempotent).
|
|
5585
5485
|
*
|
|
5586
5486
|
* @param rpc RPC connection
|
|
5587
|
-
* @param ata Associated token address (
|
|
5487
|
+
* @param ata Associated token address (light-token)
|
|
5588
5488
|
* @param owner Owner of the tokens (signer)
|
|
5589
5489
|
* @param mint Mint public key
|
|
5590
5490
|
* @param payer Fee payer (signer, defaults to owner)
|
|
@@ -5592,37 +5492,45 @@ declare function createLoadAtaInstructions(rpc: Rpc, ata: PublicKey, owner: Publ
|
|
|
5592
5492
|
* @param interfaceOptions Optional interface options
|
|
5593
5493
|
* @returns Transaction signature, or null if ATA exists and nothing to load
|
|
5594
5494
|
*/
|
|
5595
|
-
declare function loadAta(rpc: Rpc, ata: PublicKey, owner: Signer, mint: PublicKey, payer?: Signer, confirmOptions?: ConfirmOptions, interfaceOptions?: InterfaceOptions): Promise<string | null>;
|
|
5495
|
+
declare function loadAta(rpc: Rpc, ata: PublicKey, owner: Signer, mint: PublicKey, payer?: Signer, confirmOptions?: ConfirmOptions, interfaceOptions?: InterfaceOptions, decimals?: number): Promise<string | null>;
|
|
5596
5496
|
/**
|
|
5597
5497
|
* Transfer tokens using the unified ata interface.
|
|
5598
5498
|
*
|
|
5599
|
-
* Destination ATA
|
|
5499
|
+
* Destination ATA is derived from `recipient` and created idempotently.
|
|
5500
|
+
* Automatically wraps SPL/T22 to light-token associated token account.
|
|
5600
5501
|
*
|
|
5601
5502
|
* @param rpc RPC connection
|
|
5602
5503
|
* @param payer Fee payer (signer)
|
|
5603
|
-
* @param source Source
|
|
5504
|
+
* @param source Source light-token associated token account address
|
|
5604
5505
|
* @param mint Mint address
|
|
5605
|
-
* @param
|
|
5606
|
-
* @param owner Source owner
|
|
5506
|
+
* @param recipient Destination owner wallet address
|
|
5507
|
+
* @param owner Source account owner pubkey
|
|
5508
|
+
* @param authority Signing authority (owner or approved delegate)
|
|
5607
5509
|
* @param amount Amount to transfer
|
|
5608
5510
|
* @param confirmOptions Optional confirm options
|
|
5609
5511
|
* @param options Optional interface options
|
|
5610
5512
|
* @returns Transaction signature
|
|
5611
5513
|
*/
|
|
5612
|
-
declare function transferInterface(rpc: Rpc, payer: Signer, source: PublicKey, mint: PublicKey,
|
|
5514
|
+
declare function transferInterface(rpc: Rpc, payer: Signer, source: PublicKey, mint: PublicKey, recipient: PublicKey, owner: PublicKey, authority: Signer, amount: number | bigint | BN, confirmOptions?: ConfirmOptions, options?: InterfaceOptions, decimals?: number): Promise<string>;
|
|
5515
|
+
/**
|
|
5516
|
+
* Transfer tokens to an explicit destination token account.
|
|
5517
|
+
*
|
|
5518
|
+
* Use this for advanced routing to non-ATA destinations.
|
|
5519
|
+
*/
|
|
5520
|
+
declare function transferToAccountInterface(rpc: Rpc, payer: Signer, source: PublicKey, mint: PublicKey, destination: PublicKey, owner: PublicKey, authority: Signer, amount: number | bigint | BN, confirmOptions?: ConfirmOptions, options?: InterfaceOptions, decimals?: number): Promise<string>;
|
|
5613
5521
|
/**
|
|
5614
|
-
* Get or create
|
|
5522
|
+
* Get or create light-token ATA with unified balance detection and auto-loading.
|
|
5615
5523
|
*
|
|
5616
5524
|
* Enforces LIGHT_TOKEN_PROGRAM_ID. Aggregates balances from:
|
|
5617
|
-
* -
|
|
5618
|
-
* -
|
|
5525
|
+
* - light-token associated token account (hot balance)
|
|
5526
|
+
* - compressed light-token accounts (cold balance)
|
|
5619
5527
|
* - SPL token accounts (for unified wrapping)
|
|
5620
5528
|
* - Token-2022 accounts (for unified wrapping)
|
|
5621
5529
|
*
|
|
5622
5530
|
* When owner is a Signer:
|
|
5623
5531
|
* - Creates hot ATA if it doesn't exist
|
|
5624
5532
|
* - Loads cold (compressed) tokens into hot ATA
|
|
5625
|
-
* - Wraps SPL/T22 tokens into
|
|
5533
|
+
* - Wraps SPL/T22 tokens into light-token associated token account
|
|
5626
5534
|
* - Returns account with all tokens ready to use
|
|
5627
5535
|
*
|
|
5628
5536
|
* When owner is a PublicKey:
|
|
@@ -5642,26 +5550,34 @@ declare function getOrCreateAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKe
|
|
|
5642
5550
|
/**
|
|
5643
5551
|
* Create transfer instructions for a unified token transfer.
|
|
5644
5552
|
*
|
|
5645
|
-
* Unified variant: always wraps SPL/T22 to
|
|
5553
|
+
* Unified variant: always wraps SPL/T22 to light-token associated token account.
|
|
5554
|
+
* Recipient must be an on-curve wallet address. For PDA/off-curve owners,
|
|
5555
|
+
* use createTransferToAccountInterfaceInstructions with an explicit destination ATA.
|
|
5646
5556
|
*
|
|
5647
5557
|
* Returns `TransactionInstruction[][]`. Send [0..n-2] in parallel, then [n-1].
|
|
5648
5558
|
* Use `sliceLast` to separate the parallel prefix from the final transfer.
|
|
5649
5559
|
*
|
|
5650
5560
|
* @see createTransferInterfaceInstructions in v3/actions/transfer-interface.ts
|
|
5651
5561
|
*/
|
|
5652
|
-
declare function createTransferInterfaceInstructions(rpc: Rpc, payer: PublicKey, mint: PublicKey, amount: number | bigint | BN,
|
|
5562
|
+
declare function createTransferInterfaceInstructions(rpc: Rpc, payer: PublicKey, mint: PublicKey, amount: number | bigint | BN, owner: PublicKey, recipient: PublicKey, options?: InterfaceOptions): Promise<TransactionInstruction[][]>;
|
|
5563
|
+
/**
|
|
5564
|
+
* Create transfer instructions that route to an explicit destination token
|
|
5565
|
+
* account.
|
|
5566
|
+
*/
|
|
5567
|
+
declare function createTransferToAccountInterfaceInstructions(rpc: Rpc, payer: PublicKey, mint: PublicKey, amount: number | bigint | BN, owner: PublicKey, destination: PublicKey, options?: InterfaceOptions): Promise<TransactionInstruction[][]>;
|
|
5653
5568
|
/**
|
|
5654
|
-
* Build instruction batches for unwrapping
|
|
5569
|
+
* Build instruction batches for unwrapping light-tokens to SPL/T22.
|
|
5655
5570
|
*
|
|
5656
|
-
*
|
|
5657
|
-
*
|
|
5571
|
+
* Load batches (cold -> hot) come first if needed; unwrap is bundled into the
|
|
5572
|
+
* final batch.
|
|
5573
|
+
* SPL/T22 balances are not consolidated; only light ATA (hot + cold) is unwrapped.
|
|
5658
5574
|
*
|
|
5659
|
-
* Returns `TransactionInstruction[][]`. Load batches (if any) come first
|
|
5660
|
-
*
|
|
5575
|
+
* Returns `TransactionInstruction[][]`. Load-only batches (if any) come first;
|
|
5576
|
+
* the last batch contains unwrap.
|
|
5661
5577
|
*
|
|
5662
5578
|
* @param rpc RPC connection
|
|
5663
5579
|
* @param destination Destination SPL/T22 token account (must exist)
|
|
5664
|
-
* @param owner Owner of the
|
|
5580
|
+
* @param owner Owner of the light-token
|
|
5665
5581
|
* @param mint Mint address
|
|
5666
5582
|
* @param amount Amount to unwrap (defaults to full balance)
|
|
5667
5583
|
* @param payer Fee payer (defaults to owner)
|
|
@@ -5671,21 +5587,80 @@ declare function createTransferInterfaceInstructions(rpc: Rpc, payer: PublicKey,
|
|
|
5671
5587
|
*/
|
|
5672
5588
|
declare function createUnwrapInstructions(rpc: Rpc, destination: PublicKey, owner: PublicKey, mint: PublicKey, amount?: number | bigint | BN, payer?: PublicKey, splInterfaceInfo?: SplInterfaceInfo, interfaceOptions?: InterfaceOptions): Promise<TransactionInstruction[][]>;
|
|
5673
5589
|
/**
|
|
5674
|
-
* Unwrap
|
|
5590
|
+
* Unwrap light-tokens to SPL tokens.
|
|
5675
5591
|
*
|
|
5676
|
-
*
|
|
5677
|
-
*
|
|
5592
|
+
* Loads cold into hot if needed, then unwraps from light ATA to destination SPL/T22.
|
|
5593
|
+
* SPL/T22 balances are not consolidated; only light ATA balance is unwrapped.
|
|
5678
5594
|
*
|
|
5679
5595
|
* @param rpc RPC connection
|
|
5680
5596
|
* @param payer Fee payer
|
|
5681
5597
|
* @param destination Destination SPL/T22 token account
|
|
5682
|
-
* @param owner Owner of the
|
|
5598
|
+
* @param owner Owner of the light-token (signer)
|
|
5683
5599
|
* @param mint Mint address
|
|
5684
5600
|
* @param amount Amount to unwrap (defaults to all)
|
|
5685
5601
|
* @param splInterfaceInfo SPL interface info
|
|
5686
5602
|
* @param confirmOptions Confirm options
|
|
5687
5603
|
* @returns Transaction signature of the unwrap transaction
|
|
5688
5604
|
*/
|
|
5689
|
-
declare function unwrap(rpc: Rpc, payer: Signer, destination: PublicKey, owner: Signer, mint: PublicKey, amount?: number | bigint | BN, splInterfaceInfo?: SplInterfaceInfo, confirmOptions?: ConfirmOptions): Promise<string>;
|
|
5605
|
+
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>;
|
|
5606
|
+
/**
|
|
5607
|
+
* Approve a delegate for an associated token account.
|
|
5608
|
+
*
|
|
5609
|
+
* Auto-detects mint type (light-token, SPL, or Token-2022) and dispatches
|
|
5610
|
+
* to the appropriate instruction.
|
|
5611
|
+
*
|
|
5612
|
+
* @remarks For light-token mints, all cold (compressed) balances are loaded
|
|
5613
|
+
* into the hot ATA, not just the delegation amount. The `amount` parameter
|
|
5614
|
+
* only controls the delegate's spending limit.
|
|
5615
|
+
*
|
|
5616
|
+
* @param rpc RPC connection
|
|
5617
|
+
* @param payer Fee payer (signer)
|
|
5618
|
+
* @param tokenAccount ATA address
|
|
5619
|
+
* @param mint Mint address
|
|
5620
|
+
* @param delegate Delegate to approve
|
|
5621
|
+
* @param amount Amount to delegate
|
|
5622
|
+
* @param owner Owner of the token account (signer)
|
|
5623
|
+
* @param confirmOptions Optional confirm options
|
|
5624
|
+
* @returns Transaction signature
|
|
5625
|
+
*/
|
|
5626
|
+
declare function approveInterface(rpc: Rpc, payer: Signer, tokenAccount: PublicKey, mint: PublicKey, delegate: PublicKey, amount: number | bigint | BN, owner: Signer, confirmOptions?: ConfirmOptions, options?: InterfaceOptions, decimals?: number): Promise<string>;
|
|
5627
|
+
/**
|
|
5628
|
+
* Build instruction batches for approving a delegate on an ATA.
|
|
5629
|
+
*
|
|
5630
|
+
* Auto-detects mint type (light-token, SPL, or Token-2022).
|
|
5631
|
+
*
|
|
5632
|
+
* @remarks For light-token mints, all cold (compressed) balances are loaded
|
|
5633
|
+
* into the hot ATA before the approve instruction. The `amount` parameter
|
|
5634
|
+
* only controls the delegate's spending limit, not the number of accounts
|
|
5635
|
+
* loaded.
|
|
5636
|
+
*/
|
|
5637
|
+
declare function createApproveInterfaceInstructions(rpc: Rpc, payer: PublicKey, mint: PublicKey, tokenAccount: PublicKey, delegate: PublicKey, amount: number | bigint | BN, owner: PublicKey, decimals?: number, options?: InterfaceOptions): Promise<TransactionInstruction[][]>;
|
|
5638
|
+
/**
|
|
5639
|
+
* Revoke delegation for an associated token account.
|
|
5640
|
+
*
|
|
5641
|
+
* Auto-detects mint type (light-token, SPL, or Token-2022) and dispatches
|
|
5642
|
+
* to the appropriate instruction.
|
|
5643
|
+
*
|
|
5644
|
+
* @remarks For light-token mints, all cold (compressed) balances are loaded
|
|
5645
|
+
* into the hot ATA before the revoke instruction.
|
|
5646
|
+
*
|
|
5647
|
+
* @param rpc RPC connection
|
|
5648
|
+
* @param payer Fee payer (signer)
|
|
5649
|
+
* @param tokenAccount ATA address
|
|
5650
|
+
* @param mint Mint address
|
|
5651
|
+
* @param owner Owner of the token account (signer)
|
|
5652
|
+
* @param confirmOptions Optional confirm options
|
|
5653
|
+
* @returns Transaction signature
|
|
5654
|
+
*/
|
|
5655
|
+
declare function revokeInterface(rpc: Rpc, payer: Signer, tokenAccount: PublicKey, mint: PublicKey, owner: Signer, confirmOptions?: ConfirmOptions, options?: InterfaceOptions, decimals?: number): Promise<string>;
|
|
5656
|
+
/**
|
|
5657
|
+
* Build instruction batches for revoking delegation on an ATA.
|
|
5658
|
+
*
|
|
5659
|
+
* Auto-detects mint type (light-token, SPL, or Token-2022).
|
|
5660
|
+
*
|
|
5661
|
+
* @remarks For light-token mints, all cold (compressed) balances are loaded
|
|
5662
|
+
* into the hot ATA before the revoke instruction.
|
|
5663
|
+
*/
|
|
5664
|
+
declare function createRevokeInterfaceInstructions(rpc: Rpc, payer: PublicKey, mint: PublicKey, tokenAccount: PublicKey, owner: PublicKey, decimals?: number, options?: InterfaceOptions): Promise<TransactionInstruction[][]>;
|
|
5690
5665
|
|
|
5691
|
-
export { ADD_TOKEN_POOL_DISCRIMINATOR, APPROVE_DISCRIMINATOR, type AccountInterface, Action, type AddSplInterfaceParams, type AddTokenPoolParams, type ApproveAndMintToParams, type ApproveParams, BASE_RENT_PER_EPOCH, BATCH_COMPRESS_DISCRIMINATOR, type BaseMint, type BatchCompressInstructionData, COMPRESSED_MINT_SEED,
|
|
5666
|
+
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 TransferParams, addSplInterfaces, addTokenPoolAccountsLayout, type addTokenPoolAccountsLayoutParams, addTokenPools, approve, approveAccountsLayout, type approveAccountsLayoutParams, approveAndMintTo, approveInterface, batchCompressLayout, calculateFeePayerCostAtCreation, checkMint, checkSplInterfaceInfo, checkTokenPoolInfo, compress, compressSplTokenAccount, compressSplTokenAccountInstructionDataLayout, convertTokenDataToAccount, createApproveInterfaceInstructions, createAssociatedLightTokenAccountIdempotentInstruction, createAssociatedLightTokenAccountInstruction, createAssociatedTokenAccountInterfaceIdempotentInstruction, createAssociatedTokenAccountInterfaceInstruction, createAtaInterface, createAtaInterfaceIdempotent, createAtaInterfaceIdempotentInstruction, createDecompressOutputState, createLightTokenApproveInstruction, createLightTokenFreezeAccountInstruction, createLightTokenRevokeInstruction, createLightTokenThawAccountInstruction, createLightTokenTransferCheckedInstruction, createLightTokenTransferInstruction, createLoadAtaInstructions, createMint, createMintInstruction, createMintInterface, createMintToCompressedInstruction, createMintToInstruction, createMintToInterfaceInstruction, createRemoveMetadataKeyInstruction, createRevokeInterfaceInstructions, createSplInterface, createTokenMetadata, createTokenPool, createTokenPoolAccountsLayout, type createTokenPoolAccountsLayoutParams, createTokenProgramLookupTable, createTransferInterfaceInstructions, createTransferOutputState, createTransferToAccountInterfaceInstructions, 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, revokeInterface, 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, transferToAccountInterface, unpackMintData, unpackMintInterface, unwrap, updateFreezeAuthority, updateMetadataAuthority, updateMetadataField, updateMintAuthority, validateSameTokenOwner, wrap };
|