@lightprotocol/compressed-token 0.22.1-alpha.2 → 0.22.1-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,59 +1,1438 @@
1
- import { Signer, PublicKey, ConfirmOptions, TransactionSignature, Commitment, Keypair, AccountMeta, TransactionInstruction, Connection } from '@solana/web3.js';
2
- import { Rpc, TreeInfo, ParsedTokenAccount, PackedMerkleContextLegacy, CompressedCpiContext, ValidityProof, InputTokenDataWithContext as InputTokenDataWithContext$1, CompressedProof } from '@lightprotocol/stateless.js';
3
- import BN from 'bn.js';
4
- import { Buffer } from 'buffer';
5
- import * as buffer_layout from 'buffer-layout';
1
+ /// <reference types="node" />
2
+ import { PublicKey, TransactionInstruction, Commitment, AccountInfo, Signer, ConfirmOptions, TransactionSignature, AccountMeta, Keypair, Connection } from '@solana/web3.js';
3
+ import { ValidityProofWithContext, AddressTreeInfo, TreeInfo, MerkleContext, Rpc, ParsedTokenAccount, CompressedAccountWithMerkleContext, ValidityProof, PackedMerkleContextLegacy, CompressedCpiContext, InputTokenDataWithContext as InputTokenDataWithContext$1, CompressedProof } from '@lightprotocol/stateless.js';
4
+ export { ParsedTokenAccount as ParsedTokenAccountInterface } from '@lightprotocol/stateless.js';
5
+ import { Mint, Account } from '@solana/spl-token';
6
+ export { Account, AccountState } from '@solana/spl-token';
6
7
 
8
+ declare class Buffer$1 extends Uint8Array {
9
+ length: number
10
+ write(string: string, offset?: number, length?: number, encoding?: string): number;
11
+ toString(encoding?: string, start?: number, end?: number): string;
12
+ toJSON(): { type: 'Buffer', data: any[] };
13
+ equals(otherBuffer: Buffer$1): boolean;
14
+ compare(otherBuffer: Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
15
+ copy(targetBuffer: Buffer$1, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
16
+ slice(start?: number, end?: number): Buffer$1;
17
+ writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
18
+ writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
19
+ writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
20
+ writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
21
+ readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
22
+ readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
23
+ readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
24
+ readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
25
+ readUInt8(offset: number, noAssert?: boolean): number;
26
+ readUInt16LE(offset: number, noAssert?: boolean): number;
27
+ readUInt16BE(offset: number, noAssert?: boolean): number;
28
+ readUInt32LE(offset: number, noAssert?: boolean): number;
29
+ readUInt32BE(offset: number, noAssert?: boolean): number;
30
+ readBigUInt64LE(offset: number): BigInt;
31
+ readBigUInt64BE(offset: number): BigInt;
32
+ readInt8(offset: number, noAssert?: boolean): number;
33
+ readInt16LE(offset: number, noAssert?: boolean): number;
34
+ readInt16BE(offset: number, noAssert?: boolean): number;
35
+ readInt32LE(offset: number, noAssert?: boolean): number;
36
+ readInt32BE(offset: number, noAssert?: boolean): number;
37
+ readBigInt64LE(offset: number): BigInt;
38
+ readBigInt64BE(offset: number): BigInt;
39
+ readFloatLE(offset: number, noAssert?: boolean): number;
40
+ readFloatBE(offset: number, noAssert?: boolean): number;
41
+ readDoubleLE(offset: number, noAssert?: boolean): number;
42
+ readDoubleBE(offset: number, noAssert?: boolean): number;
43
+ reverse(): this;
44
+ swap16(): Buffer$1;
45
+ swap32(): Buffer$1;
46
+ swap64(): Buffer$1;
47
+ writeUInt8(value: number, offset: number, noAssert?: boolean): number;
48
+ writeUInt16LE(value: number, offset: number, noAssert?: boolean): number;
49
+ writeUInt16BE(value: number, offset: number, noAssert?: boolean): number;
50
+ writeUInt32LE(value: number, offset: number, noAssert?: boolean): number;
51
+ writeUInt32BE(value: number, offset: number, noAssert?: boolean): number;
52
+ writeBigUInt64LE(value: number, offset: number): BigInt;
53
+ writeBigUInt64BE(value: number, offset: number): BigInt;
54
+ writeInt8(value: number, offset: number, noAssert?: boolean): number;
55
+ writeInt16LE(value: number, offset: number, noAssert?: boolean): number;
56
+ writeInt16BE(value: number, offset: number, noAssert?: boolean): number;
57
+ writeInt32LE(value: number, offset: number, noAssert?: boolean): number;
58
+ writeInt32BE(value: number, offset: number, noAssert?: boolean): number;
59
+ writeBigInt64LE(value: number, offset: number): BigInt;
60
+ writeBigInt64BE(value: number, offset: number): BigInt;
61
+ writeFloatLE(value: number, offset: number, noAssert?: boolean): number;
62
+ writeFloatBE(value: number, offset: number, noAssert?: boolean): number;
63
+ writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
64
+ writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
65
+ fill(value: any, offset?: number, end?: number): this;
66
+ indexOf(value: string | number | Buffer$1, byteOffset?: number, encoding?: string): number;
67
+ lastIndexOf(value: string | number | Buffer$1, byteOffset?: number, encoding?: string): number;
68
+ includes(value: string | number | Buffer$1, byteOffset?: number, encoding?: string): boolean;
69
+
70
+ /**
71
+ * Allocates a new buffer containing the given {str}.
72
+ *
73
+ * @param str String to store in buffer.
74
+ * @param encoding encoding to use, optional. Default is 'utf8'
75
+ */
76
+ constructor (str: string, encoding?: string);
77
+ /**
78
+ * Allocates a new buffer of {size} octets.
79
+ *
80
+ * @param size count of octets to allocate.
81
+ */
82
+ constructor (size: number);
83
+ /**
84
+ * Allocates a new buffer containing the given {array} of octets.
85
+ *
86
+ * @param array The octets to store.
87
+ */
88
+ constructor (array: Uint8Array);
89
+ /**
90
+ * Produces a Buffer backed by the same allocated memory as
91
+ * the given {ArrayBuffer}.
92
+ *
93
+ *
94
+ * @param arrayBuffer The ArrayBuffer with which to share memory.
95
+ */
96
+ constructor (arrayBuffer: ArrayBuffer);
97
+ /**
98
+ * Allocates a new buffer containing the given {array} of octets.
99
+ *
100
+ * @param array The octets to store.
101
+ */
102
+ constructor (array: any[]);
103
+ /**
104
+ * Copies the passed {buffer} data onto a new {Buffer} instance.
105
+ *
106
+ * @param buffer The buffer to copy.
107
+ */
108
+ constructor (buffer: Buffer$1);
109
+ prototype: Buffer$1;
110
+ /**
111
+ * Allocates a new Buffer using an {array} of octets.
112
+ *
113
+ * @param array
114
+ */
115
+ static from(array: any[]): Buffer$1;
116
+ /**
117
+ * When passed a reference to the .buffer property of a TypedArray instance,
118
+ * the newly created Buffer will share the same allocated memory as the TypedArray.
119
+ * The optional {byteOffset} and {length} arguments specify a memory range
120
+ * within the {arrayBuffer} that will be shared by the Buffer.
121
+ *
122
+ * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer()
123
+ * @param byteOffset
124
+ * @param length
125
+ */
126
+ static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer$1;
127
+ /**
128
+ * Copies the passed {buffer} data onto a new Buffer instance.
129
+ *
130
+ * @param buffer
131
+ */
132
+ static from(buffer: Buffer$1 | Uint8Array): Buffer$1;
133
+ /**
134
+ * Creates a new Buffer containing the given JavaScript string {str}.
135
+ * If provided, the {encoding} parameter identifies the character encoding.
136
+ * If not provided, {encoding} defaults to 'utf8'.
137
+ *
138
+ * @param str
139
+ */
140
+ static from(str: string, encoding?: string): Buffer$1;
141
+ /**
142
+ * Returns true if {obj} is a Buffer
143
+ *
144
+ * @param obj object to test.
145
+ */
146
+ static isBuffer(obj: any): obj is Buffer$1;
147
+ /**
148
+ * Returns true if {encoding} is a valid encoding argument.
149
+ * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
150
+ *
151
+ * @param encoding string to test.
152
+ */
153
+ static isEncoding(encoding: string): boolean;
154
+ /**
155
+ * Gives the actual byte length of a string. encoding defaults to 'utf8'.
156
+ * This is not the same as String.prototype.length since that returns the number of characters in a string.
157
+ *
158
+ * @param string string to test.
159
+ * @param encoding encoding used to evaluate (defaults to 'utf8')
160
+ */
161
+ static byteLength(string: string, encoding?: string): number;
162
+ /**
163
+ * Returns a buffer which is the result of concatenating all the buffers in the list together.
164
+ *
165
+ * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
166
+ * If the list has exactly one item, then the first item of the list is returned.
167
+ * If the list has more than one item, then a new Buffer is created.
168
+ *
169
+ * @param list An array of Buffer objects to concatenate
170
+ * @param totalLength Total length of the buffers when concatenated.
171
+ * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
172
+ */
173
+ static concat(list: Uint8Array[], totalLength?: number): Buffer$1;
174
+ /**
175
+ * The same as buf1.compare(buf2).
176
+ */
177
+ static compare(buf1: Uint8Array, buf2: Uint8Array): number;
178
+ /**
179
+ * Allocates a new buffer of {size} octets.
180
+ *
181
+ * @param size count of octets to allocate.
182
+ * @param fill if specified, buffer will be initialized by calling buf.fill(fill).
183
+ * If parameter is omitted, buffer will be filled with zeros.
184
+ * @param encoding encoding used for call to buf.fill while initializing
185
+ */
186
+ static alloc(size: number, fill?: string | Buffer$1 | number, encoding?: string): Buffer$1;
187
+ /**
188
+ * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
189
+ * of the newly created Buffer are unknown and may contain sensitive data.
190
+ *
191
+ * @param size count of octets to allocate
192
+ */
193
+ static allocUnsafe(size: number): Buffer$1;
194
+ /**
195
+ * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
196
+ * of the newly created Buffer are unknown and may contain sensitive data.
197
+ *
198
+ * @param size count of octets to allocate
199
+ */
200
+ static allocUnsafeSlow(size: number): Buffer$1;
201
+ }
202
+
203
+ interface LayoutObject {
204
+ [key: string]: any;
205
+ }
7
206
  /**
8
- * Approve a delegate to spend tokens
207
+ * Base class for layout objects.
9
208
  *
10
- * @param rpc Rpc to use
11
- * @param payer Fee payer
12
- * @param mint SPL Mint address
13
- * @param amount Number of tokens to delegate
14
- * @param owner Owner of the SPL token account.
15
- * @param delegate Address of the delegate
16
- * @param confirmOptions Options for confirming the transaction
209
+ * **NOTE** This is an abstract base class; you can create instances
210
+ * if it amuses you, but they won't support the {@link
211
+ * Layout#encode|encode} or {@link Layout#decode|decode} functions.
17
212
  *
18
- * @return Signature of the confirmed transaction
213
+ * @param {Number} span - Initializer for {@link Layout#span|span}. The
214
+ * parameter must be an integer; a negative value signifies that the
215
+ * span is {@link Layout#getSpan|value-specific}.
216
+ *
217
+ * @param {string} [property] - Initializer for {@link
218
+ * Layout#property|property}.
219
+ *
220
+ * @abstract
19
221
  */
20
- declare function approve(rpc: Rpc, payer: Signer, mint: PublicKey, amount: number | BN, owner: Signer, delegate: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
222
+ declare abstract class Layout<T> {
223
+ span: number;
224
+ property?: string;
225
+ boundConstructor_?: any;
226
+ constructor(span: number, property?: string);
227
+ /** Function to create an Object into which decoded properties will
228
+ * be written.
229
+ *
230
+ * Used only for layouts that {@link Layout#decode|decode} to Object
231
+ * instances, which means:
232
+ * * {@link Structure}
233
+ * * {@link Union}
234
+ * * {@link VariantLayout}
235
+ * * {@link BitStructure}
236
+ *
237
+ * If left undefined the JavaScript representation of these layouts
238
+ * will be Object instances.
239
+ *
240
+ * See {@link bindConstructorLayout}.
241
+ */
242
+ makeDestinationObject(): LayoutObject;
243
+ /**
244
+ * Decode from a Uint8Array into a JavaScript value.
245
+ *
246
+ * @param {Uint8Array} b - the buffer from which encoded data is read.
247
+ *
248
+ * @param {Number} [offset] - the offset at which the encoded data
249
+ * starts. If absent a zero offset is inferred.
250
+ *
251
+ * @returns {(Number|Array|Object)} - the value of the decoded data.
252
+ *
253
+ * @abstract
254
+ */
255
+ abstract decode(b: Uint8Array, offset?: number): T;
256
+ /**
257
+ * Encode a JavaScript value into a Uint8Array.
258
+ *
259
+ * @param {(Number|Array|Object)} src - the value to be encoded into
260
+ * the buffer. The type accepted depends on the (sub-)type of {@link
261
+ * Layout}.
262
+ *
263
+ * @param {Uint8Array} b - the buffer into which encoded data will be
264
+ * written.
265
+ *
266
+ * @param {Number} [offset] - the offset at which the encoded data
267
+ * starts. If absent a zero offset is inferred.
268
+ *
269
+ * @returns {Number} - the number of bytes encoded, including the
270
+ * space skipped for internal padding, but excluding data such as
271
+ * {@link Sequence#count|lengths} when stored {@link
272
+ * ExternalLayout|externally}. This is the adjustment to `offset`
273
+ * producing the offset where data for the next layout would be
274
+ * written.
275
+ *
276
+ * @abstract
277
+ */
278
+ abstract encode(src: T, b: Uint8Array, offset?: number): number;
279
+ /**
280
+ * Calculate the span of a specific instance of a layout.
281
+ *
282
+ * @param {Uint8Array} b - the buffer that contains an encoded instance.
283
+ *
284
+ * @param {Number} [offset] - the offset at which the encoded instance
285
+ * starts. If absent a zero offset is inferred.
286
+ *
287
+ * @return {Number} - the number of bytes covered by the layout
288
+ * instance. If this method is not overridden in a subclass the
289
+ * definition-time constant {@link Layout#span|span} will be
290
+ * returned.
291
+ *
292
+ * @throws {RangeError} - if the length of the value cannot be
293
+ * determined.
294
+ */
295
+ getSpan(b?: Uint8Array, offset?: number): number;
296
+ /**
297
+ * Replicate the layout using a new property.
298
+ *
299
+ * This function must be used to get a structurally-equivalent layout
300
+ * with a different name since all {@link Layout} instances are
301
+ * immutable.
302
+ *
303
+ * **NOTE** This is a shallow copy. All fields except {@link
304
+ * Layout#property|property} are strictly equal to the origin layout.
305
+ *
306
+ * @param {String} property - the value for {@link
307
+ * Layout#property|property} in the replica.
308
+ *
309
+ * @returns {Layout} - the copy with {@link Layout#property|property}
310
+ * set to `property`.
311
+ */
312
+ replicate(property: string): this;
313
+ /**
314
+ * Create an object from layout properties and an array of values.
315
+ *
316
+ * **NOTE** This function returns `undefined` if invoked on a layout
317
+ * that does not return its value as an Object. Objects are
318
+ * returned for things that are a {@link Structure}, which includes
319
+ * {@link VariantLayout|variant layouts} if they are structures, and
320
+ * excludes {@link Union}s. If you want this feature for a union
321
+ * you must use {@link Union.getVariant|getVariant} to select the
322
+ * desired layout.
323
+ *
324
+ * @param {Array} values - an array of values that correspond to the
325
+ * default order for properties. As with {@link Layout#decode|decode}
326
+ * layout elements that have no property name are skipped when
327
+ * iterating over the array values. Only the top-level properties are
328
+ * assigned; arguments are not assigned to properties of contained
329
+ * layouts. Any unused values are ignored.
330
+ *
331
+ * @return {(Object|undefined)}
332
+ */
333
+ fromArray(values: any[]): LayoutObject | undefined;
334
+ }
335
+
336
+ interface AdditionalMetadata {
337
+ key: Buffer$1;
338
+ value: Buffer$1;
339
+ }
21
340
 
22
341
  /**
23
- * Check if the token pool info is initialized and has a balance.
24
- * @param mint The mint of the token pool
25
- * @param tokenPoolInfo The token pool info
26
- * @returns True if the token pool info is initialized and has a balance
342
+ * Token metadata for creating a c-token mint.
27
343
  */
28
- declare function checkTokenPoolInfo(tokenPoolInfo: TokenPoolInfo, mint: PublicKey): boolean;
344
+ interface TokenMetadataInstructionData {
345
+ name: string;
346
+ symbol: string;
347
+ uri: string;
348
+ updateAuthority?: PublicKey | null;
349
+ additionalMetadata: AdditionalMetadata[] | null;
350
+ }
351
+ declare function createTokenMetadata(name: string, symbol: string, uri: string, updateAuthority?: PublicKey | null, additionalMetadata?: AdditionalMetadata[] | null): TokenMetadataInstructionData;
29
352
  /**
30
- * Get the token pool infos for a given mint.
31
- * @param rpc The RPC client
32
- * @param mint The mint of the token pool
33
- * @param commitment The commitment to use
353
+ * Create instruction for initializing a c-token mint.
34
354
  *
35
- * @returns The token pool infos
355
+ * @param mintSigner Mint signer keypair public key.
356
+ * @param decimals Number of decimals for the mint.
357
+ * @param mintAuthority Mint authority public key.
358
+ * @param freezeAuthority Optional freeze authority public key.
359
+ * @param payer Fee payer public key.
360
+ * @param validityProof Validity proof for the mint account.
361
+ * @param addressTreeInfo Address tree info for the mint.
362
+ * @param outputStateTreeInfo Output state tree info.
363
+ * @param metadata Optional token metadata.
36
364
  */
37
- declare function getTokenPoolInfos(rpc: Rpc, mint: PublicKey, commitment?: Commitment): Promise<TokenPoolInfo[]>;
38
- type TokenPoolActivity = {
39
- signature: string;
40
- amount: BN;
41
- action: Action;
365
+ declare function createMintInstruction(mintSigner: PublicKey, decimals: number, mintAuthority: PublicKey, freezeAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext, addressTreeInfo: AddressTreeInfo, outputStateTreeInfo: TreeInfo, metadata?: TokenMetadataInstructionData): TransactionInstruction;
366
+
367
+ /**
368
+ * SPL-compatible base mint structure
369
+ */
370
+ interface BaseMint {
371
+ /** Optional authority used to mint new tokens */
372
+ mintAuthority: PublicKey | null;
373
+ /** Total supply of tokens */
374
+ supply: bigint;
375
+ /** Number of base 10 digits to the right of the decimal place */
376
+ decimals: number;
377
+ /** Is initialized - for SPL compatibility */
378
+ isInitialized: boolean;
379
+ /** Optional authority to freeze token accounts */
380
+ freezeAuthority: PublicKey | null;
381
+ }
382
+ /**
383
+ * Compressed mint context (protocol version, SPL mint reference)
384
+ */
385
+ interface MintContext {
386
+ /** Protocol version for upgradability */
387
+ version: number;
388
+ /** Whether the compressed mint is decompressed to a CMint Solana account */
389
+ cmintDecompressed: boolean;
390
+ /** PDA of the associated SPL mint */
391
+ splMint: PublicKey;
392
+ }
393
+ /**
394
+ * Raw extension data as stored on-chain
395
+ */
396
+ interface MintExtension {
397
+ extensionType: number;
398
+ data: Uint8Array;
399
+ }
400
+ /**
401
+ * Parsed token metadata matching on-chain TokenMetadata extension.
402
+ * Fields: updateAuthority, mint, name, symbol, uri, additionalMetadata
403
+ */
404
+ interface TokenMetadata {
405
+ /** Authority that can update metadata (None if zero pubkey) */
406
+ updateAuthority?: PublicKey | null;
407
+ /** Associated mint pubkey */
408
+ mint: PublicKey;
409
+ /** Token name */
410
+ name: string;
411
+ /** Token symbol */
412
+ symbol: string;
413
+ /** URI pointing to off-chain metadata JSON */
414
+ uri: string;
415
+ /** Additional key-value metadata pairs */
416
+ additionalMetadata?: {
417
+ key: string;
418
+ value: string;
419
+ }[];
420
+ }
421
+ /**
422
+ * Complete compressed mint structure (raw format)
423
+ */
424
+ interface CompressedMint {
425
+ base: BaseMint;
426
+ mintContext: MintContext;
427
+ extensions: MintExtension[] | null;
428
+ }
429
+ /**
430
+ * Deserialize a compressed mint from buffer
431
+ * Uses SPL's MintLayout for BaseMint and buffer-layout struct for context
432
+ *
433
+ * @param data - The raw account data buffer
434
+ * @returns The deserialized CompressedMint
435
+ */
436
+ declare function deserializeMint(data: Buffer$1 | Uint8Array): CompressedMint;
437
+ /**
438
+ * Serialize a CompressedMint to buffer
439
+ * Uses SPL's MintLayout for BaseMint, helper functions for context/metadata
440
+ *
441
+ * @param mint - The CompressedMint to serialize
442
+ * @returns The serialized buffer
443
+ */
444
+ declare function serializeMint(mint: CompressedMint): Buffer$1;
445
+ /**
446
+ * Extension type constants
447
+ */
448
+ declare enum ExtensionType {
449
+ TokenMetadata = 19
450
+ }
451
+ /**
452
+ * Decode TokenMetadata from raw extension data using Borsh layout
453
+ * Extension format: updateAuthority (32) + mint (32) + name (Vec) + symbol (Vec) + uri (Vec) + additional (Vec)
454
+ */
455
+ declare function decodeTokenMetadata(data: Uint8Array): TokenMetadata | null;
456
+ /**
457
+ * Encode TokenMetadata to raw bytes using Borsh layout
458
+ * @param metadata - TokenMetadata to encode
459
+ * @returns Encoded buffer
460
+ */
461
+ declare function encodeTokenMetadata(metadata: TokenMetadata): Buffer$1;
462
+ /**
463
+ * Extract and parse TokenMetadata from extensions array
464
+ * @param extensions - Array of raw extensions
465
+ * @returns Parsed TokenMetadata or null if not found
466
+ */
467
+ declare function extractTokenMetadata(extensions: MintExtension[] | null): TokenMetadata | null;
468
+ /**
469
+ * Metadata portion of MintInstructionData
470
+ * Used for instruction encoding when metadata extension is present
471
+ */
472
+ interface MintMetadataField {
473
+ updateAuthority: PublicKey | null;
474
+ name: string;
475
+ symbol: string;
476
+ uri: string;
477
+ }
478
+ /**
479
+ * Flattened mint data structure for instruction encoding
480
+ * This is the format expected by mint action instructions
481
+ */
482
+ interface MintInstructionData {
483
+ supply: bigint;
484
+ decimals: number;
485
+ mintAuthority: PublicKey | null;
486
+ freezeAuthority: PublicKey | null;
487
+ splMint: PublicKey;
488
+ cmintDecompressed: boolean;
489
+ version: number;
490
+ metadata?: MintMetadataField;
491
+ }
492
+
493
+ interface MintInterface {
494
+ mint: Mint;
495
+ programId: PublicKey;
496
+ merkleContext?: MerkleContext;
497
+ mintContext?: MintContext;
498
+ tokenMetadata?: TokenMetadata;
499
+ extensions?: MintExtension[];
500
+ }
501
+ /**
502
+ * Get unified mint info for SPL/T22/c-token mints.
503
+ *
504
+ * @param rpc RPC connection
505
+ * @param address The mint address
506
+ * @param commitment Optional commitment level
507
+ * @param programId Token program ID. If not provided, tries all programs to
508
+ * auto-detect.
509
+ * @returns Object with mint, optional merkleContext, mintContext, and
510
+ * tokenMetadata
511
+ */
512
+ declare function getMintInterface(rpc: Rpc, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<MintInterface>;
513
+ /**
514
+ * Unpack mint info from raw account data for SPL/T22/c-token.
515
+ *
516
+ * @param address The mint pubkey
517
+ * @param data The raw account data or AccountInfo
518
+ * @param programId Token program ID. Default c-token.
519
+ * @returns Object with mint, optional mintContext and tokenMetadata.
520
+ */
521
+ declare function unpackMintInterface(address: PublicKey, data: Buffer$1 | Uint8Array | AccountInfo<Buffer$1>, programId?: PublicKey): Omit<MintInterface, 'merkleContext'>;
522
+ /**
523
+ * Unpack c-token mint context and metadata from raw account data
524
+ *
525
+ * @param data The raw account data
526
+ * @returns Object with mintContext, tokenMetadata, and extensions
527
+ */
528
+ declare function unpackMintData(data: Buffer$1 | Uint8Array): {
529
+ mintContext: MintContext;
530
+ tokenMetadata?: TokenMetadata;
531
+ extensions?: MintExtension[];
532
+ };
533
+
534
+ /**
535
+ * Create instruction for updating a compressed mint's mint authority.
536
+ *
537
+ * @param mintInterface MintInterface from getMintInterface() - must have merkleContext
538
+ * @param currentMintAuthority Current mint authority public key (must sign)
539
+ * @param newMintAuthority New mint authority (or null to revoke)
540
+ * @param payer Fee payer public key
541
+ * @param validityProof Validity proof for the compressed mint
542
+ */
543
+ declare function createUpdateMintAuthorityInstruction(mintInterface: MintInterface, currentMintAuthority: PublicKey, newMintAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext): TransactionInstruction;
544
+ /**
545
+ * Create instruction for updating a compressed mint's freeze authority.
546
+ *
547
+ * Output queue is automatically derived from mintInterface.merkleContext.treeInfo
548
+ * (preferring nextTreeInfo.queue if available for rollover support).
549
+ *
550
+ * @param mintInterface MintInterface from getMintInterface() - must have merkleContext
551
+ * @param currentFreezeAuthority Current freeze authority public key (must sign)
552
+ * @param newFreezeAuthority New freeze authority (or null to revoke)
553
+ * @param payer Fee payer public key
554
+ * @param validityProof Validity proof for the compressed mint
555
+ */
556
+ declare function createUpdateFreezeAuthorityInstruction(mintInterface: MintInterface, currentFreezeAuthority: PublicKey, newFreezeAuthority: PublicKey | null, payer: PublicKey, validityProof: ValidityProofWithContext): TransactionInstruction;
557
+
558
+ /**
559
+ * Create instruction for updating a compressed mint's metadata field.
560
+ *
561
+ * Output queue is automatically derived from mintInterface.merkleContext.treeInfo
562
+ * (preferring nextTreeInfo.queue if available for rollover support).
563
+ *
564
+ * @param mintInterface MintInterface from getMintInterface() - must have merkleContext and tokenMetadata
565
+ * @param authority Metadata update authority public key (must sign)
566
+ * @param payer Fee payer public key
567
+ * @param validityProof Validity proof for the compressed mint
568
+ * @param fieldType Field to update: 'name', 'symbol', 'uri', or 'custom'
569
+ * @param value New value for the field
570
+ * @param customKey Custom key name (required if fieldType is 'custom')
571
+ * @param extensionIndex Extension index (default: 0)
572
+ */
573
+ declare function createUpdateMetadataFieldInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, fieldType: 'name' | 'symbol' | 'uri' | 'custom', value: string, customKey?: string, extensionIndex?: number): TransactionInstruction;
574
+ /**
575
+ * Create instruction for updating a compressed mint's metadata authority.
576
+ *
577
+ * Output queue is automatically derived from mintInterface.merkleContext.treeInfo
578
+ * (preferring nextTreeInfo.queue if available for rollover support).
579
+ *
580
+ * @param mintInterface MintInterface from getMintInterface() - must have merkleContext and tokenMetadata
581
+ * @param currentAuthority Current metadata update authority public key (must sign)
582
+ * @param newAuthority New metadata update authority public key
583
+ * @param payer Fee payer public key
584
+ * @param validityProof Validity proof for the compressed mint
585
+ * @param extensionIndex Extension index (default: 0)
586
+ */
587
+ declare function createUpdateMetadataAuthorityInstruction(mintInterface: MintInterface, currentAuthority: PublicKey, newAuthority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, extensionIndex?: number): TransactionInstruction;
588
+ /**
589
+ * Create instruction for removing a metadata key from a compressed mint.
590
+ *
591
+ * Output queue is automatically derived from mintInterface.merkleContext.treeInfo
592
+ * (preferring nextTreeInfo.queue if available for rollover support).
593
+ *
594
+ * @param mintInterface MintInterface from getMintInterface() - must have merkleContext and tokenMetadata
595
+ * @param authority Metadata update authority public key (must sign)
596
+ * @param payer Fee payer public key
597
+ * @param validityProof Validity proof for the compressed mint
598
+ * @param key Metadata key to remove
599
+ * @param idempotent If true, don't error if key doesn't exist (default: false)
600
+ * @param extensionIndex Extension index (default: 0)
601
+ */
602
+ declare function createRemoveMetadataKeyInstruction(mintInterface: MintInterface, authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, key: string, idempotent?: boolean, extensionIndex?: number): TransactionInstruction;
603
+
604
+ interface CompressToPubkey {
605
+ bump: number;
606
+ programId: number[];
607
+ seeds: number[][];
608
+ }
609
+ interface CompressibleConfig {
610
+ tokenAccountVersion: number;
611
+ rentPayment: number;
612
+ hasTopUp: number;
613
+ compressionOnly: number;
614
+ writeTopUp: number;
615
+ compressToAccountPubkey?: CompressToPubkey | null;
616
+ }
617
+ interface CreateAssociatedCTokenAccountParams {
618
+ bump: number;
619
+ compressibleConfig?: CompressibleConfig;
620
+ }
621
+ /**
622
+ * Create instruction for creating an associated compressed token account.
623
+ *
624
+ * @param feePayer Fee payer public key.
625
+ * @param owner Owner of the associated token account.
626
+ * @param mint Mint address.
627
+ * @param compressibleConfig Optional compressible configuration.
628
+ * @param configAccount Optional config account.
629
+ * @param rentPayerPda Optional rent payer PDA.
630
+ */
631
+ declare function createAssociatedCTokenAccountInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
632
+ /**
633
+ * Create idempotent instruction for creating an associated compressed token account.
634
+ *
635
+ * @param feePayer Fee payer public key.
636
+ * @param owner Owner of the associated token account.
637
+ * @param mint Mint address.
638
+ * @param compressibleConfig Optional compressible configuration.
639
+ * @param configAccount Optional config account.
640
+ * @param rentPayerPda Optional rent payer PDA.
641
+ */
642
+ declare function createAssociatedCTokenAccountIdempotentInstruction(feePayer: PublicKey, owner: PublicKey, mint: PublicKey, compressibleConfig?: CompressibleConfig, configAccount?: PublicKey, rentPayerPda?: PublicKey): TransactionInstruction;
643
+
644
+ /**
645
+ * c-token-specific config for createAssociatedTokenAccountInterfaceInstruction
646
+ */
647
+ interface CTokenConfig {
648
+ compressibleConfig?: CompressibleConfig;
649
+ configAccount?: PublicKey;
650
+ rentPayerPda?: PublicKey;
651
+ }
652
+ /**
653
+ * Create instruction for creating an associated token account (SPL, Token-2022,
654
+ * or c-token). Follows SPL Token API signature with optional c-token config at the
655
+ * end.
656
+ *
657
+ * @param payer Fee payer public key.
658
+ * @param associatedToken Associated token account address.
659
+ * @param owner Owner of the associated token account.
660
+ * @param mint Mint address.
661
+ * @param programId Token program ID (default: TOKEN_PROGRAM_ID).
662
+ * @param associatedTokenProgramId Associated token program ID.
663
+ * @param ctokenConfig Optional c-token-specific configuration.
664
+ */
665
+ declare function createAssociatedTokenAccountInterfaceInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey, ctokenConfig?: CTokenConfig): TransactionInstruction;
666
+ /**
667
+ * Create idempotent instruction for creating an associated token account (SPL,
668
+ * Token-2022, or c-token). Follows SPL Token API signature with optional c-token
669
+ * config at the end.
670
+ *
671
+ * @param payer Fee payer public key.
672
+ * @param associatedToken Associated token account address.
673
+ * @param owner Owner of the associated token account.
674
+ * @param mint Mint address.
675
+ * @param programId Token program ID (default: TOKEN_PROGRAM_ID).
676
+ * @param associatedTokenProgramId Associated token program ID.
677
+ * @param ctokenConfig Optional c-token-specific configuration.
678
+ */
679
+ declare function createAssociatedTokenAccountInterfaceIdempotentInstruction(payer: PublicKey, associatedToken: PublicKey, owner: PublicKey, mint: PublicKey, programId?: PublicKey, associatedTokenProgramId?: PublicKey, ctokenConfig?: CTokenConfig): TransactionInstruction;
680
+ /**
681
+ * Short alias for createAssociatedTokenAccountInterfaceIdempotentInstruction.
682
+ */
683
+ declare const createAtaInterfaceIdempotentInstruction: typeof createAssociatedTokenAccountInterfaceIdempotentInstruction;
684
+
685
+ /**
686
+ * Create instruction for minting compressed tokens to an onchain token account.
687
+ *
688
+ * @param authority Mint authority public key.
689
+ * @param payer Fee payer public key.
690
+ * @param validityProof Validity proof for the compressed mint.
691
+ * @param merkleContext Merkle context of the compressed mint.
692
+ * @param mintData Mint instruction data.
693
+ * @param outputStateTreeInfo Output state tree info.
694
+ * @param recipientAccount Recipient onchain token account address.
695
+ * @param amount Amount to mint.
696
+ */
697
+ declare function createMintToInstruction(authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, merkleContext: MerkleContext, mintData: MintInstructionData, outputStateTreeInfo: TreeInfo, recipientAccount: PublicKey, amount: number | bigint): TransactionInstruction;
698
+
699
+ /**
700
+ * Token data version enum - mirrors Rust TokenDataVersion
701
+ * Used for compressed token account hashing strategy
702
+ */
703
+ declare enum TokenDataVersion {
704
+ /** V1: Poseidon hash with little-endian amount, discriminator [2,0,0,0,0,0,0,0] */
705
+ V1 = 1,
706
+ /** V2: Poseidon hash with big-endian amount, discriminator [0,0,0,0,0,0,0,3] */
707
+ V2 = 2,
708
+ /** ShaFlat: SHA256 hash of borsh-serialized data, discriminator [0,0,0,0,0,0,0,4] */
709
+ ShaFlat = 3
710
+ }
711
+ declare const POOL_SEED: Buffer$1<ArrayBuffer>;
712
+ declare const CPI_AUTHORITY_SEED: Buffer$1<ArrayBuffer>;
713
+ declare const SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE = 1461600;
714
+ declare const CREATE_TOKEN_POOL_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
715
+ declare const MINT_TO_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
716
+ declare const BATCH_COMPRESS_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
717
+ declare const TRANSFER_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
718
+ declare const COMPRESS_SPL_TOKEN_ACCOUNT_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
719
+ declare const APPROVE_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
720
+ declare const REVOKE_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
721
+ declare const ADD_TOKEN_POOL_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
722
+ declare const DECOMPRESS_ACCOUNTS_IDEMPOTENT_DISCRIMINATOR: Buffer$1<ArrayBuffer>;
723
+
724
+ /**
725
+ * Create instruction for minting tokens from a c-mint to compressed accounts.
726
+ * To mint to onchain token accounts across SPL/T22/c-mints, use
727
+ * {@link createMintToInterfaceInstruction} instead.
728
+ *
729
+ * @param authority Mint authority public key.
730
+ * @param payer Fee payer public key.
731
+ * @param validityProof Validity proof for the compressed mint.
732
+ * @param merkleContext Merkle context of the compressed mint.
733
+ * @param mintData Mint instruction data.
734
+ * @param recipients Array of recipients with amounts.
735
+ * @param outputStateTreeInfo Optional output state tree info. Uses merkle
736
+ * context queue if not provided.
737
+ * @param tokenAccountVersion Token account version (default:
738
+ * TokenDataVersion.ShaFlat).
739
+ */
740
+ declare function createMintToCompressedInstruction(authority: PublicKey, payer: PublicKey, validityProof: ValidityProofWithContext, merkleContext: MerkleContext, mintData: MintInstructionData, recipients: Array<{
741
+ recipient: PublicKey;
742
+ amount: number | bigint;
743
+ }>, outputStateTreeInfo?: TreeInfo, tokenAccountVersion?: TokenDataVersion): TransactionInstruction;
744
+
745
+ /**
746
+ * Create mint-to instruction for SPL, Token-2022, or compressed token mints.
747
+ * This instruction ONLY mints to decompressed/onchain token accounts.
748
+ *
749
+ * @param mintInterface Mint interface (SPL, Token-2022, or compressed).
750
+ * @param destination Destination onchain token account address.
751
+ * @param authority Mint authority public key.
752
+ * @param payer Fee payer public key.
753
+ * @param amount Amount to mint.
754
+ * @param validityProof Validity proof (required for compressed mints).
755
+ * @param multiSigners Multi-signature signer public keys.
756
+ */
757
+ declare function createMintToInterfaceInstruction(mintInterface: MintInterface, destination: PublicKey, authority: PublicKey, payer: PublicKey, amount: number | bigint, validityProof?: ValidityProofWithContext, multiSigners?: PublicKey[]): TransactionInstruction;
758
+
759
+ /**
760
+ * Create a c-token transfer instruction.
761
+ *
762
+ * @param source Source c-token account
763
+ * @param destination Destination c-token account
764
+ * @param owner Owner of the source account (signer, also pays for compressible extension top-ups)
765
+ * @param amount Amount to transfer
766
+ * @returns Transaction instruction for c-token transfer
767
+ */
768
+ declare function createCTokenTransferInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint): TransactionInstruction;
769
+ /**
770
+ * Construct a transfer instruction for SPL/T22/c-token. Defaults to c-token
771
+ * program. For cross-program transfers (SPL <> c-token), use `wrap`/`unwrap`.
772
+ *
773
+ * @param source Source token account
774
+ * @param destination Destination token account
775
+ * @param owner Owner of the source account (signer)
776
+ * @param amount Amount to transfer
777
+ * @returns instruction for c-token transfer
778
+ */
779
+ declare function createTransferInterfaceInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, amount: number | bigint, multiSigners?: (Signer | PublicKey)[], programId?: PublicKey): TransactionInstruction;
780
+
781
+ declare namespace BN {
782
+ type Endianness = "le" | "be";
783
+ type IPrimeName = "k256" | "p224" | "p192" | "p25519";
784
+
785
+ interface MPrime {
786
+ name: string;
787
+ p: BN;
788
+ n: number;
789
+ k: BN;
790
+ }
791
+
792
+ interface ReductionContext {
793
+ m: number;
794
+ prime: MPrime;
795
+ [key: string]: any;
796
+ }
797
+ }
798
+
799
+ declare class BN {
800
+ static BN: typeof BN;
801
+ static wordSize: 26;
802
+
803
+ constructor(
804
+ number: bigint | number | string | number[] | Uint8Array | Buffer | BN,
805
+ base?: number | "hex",
806
+ endian?: BN.Endianness,
807
+ );
808
+ constructor(
809
+ number: bigint | number | string | number[] | Uint8Array | Buffer | BN,
810
+ endian?: BN.Endianness,
811
+ );
812
+
813
+ /**
814
+ * @description create a reduction context
815
+ */
816
+ static red(reductionContext: BN | BN.IPrimeName): BN.ReductionContext;
817
+
818
+ /**
819
+ * @description create a reduction context with the Montgomery trick.
820
+ */
821
+ static mont(num: BN): BN.ReductionContext;
822
+
823
+ /**
824
+ * @description returns true if the supplied object is a BN.js instance
825
+ */
826
+ static isBN(b: any): b is BN;
827
+
828
+ /**
829
+ * @description returns the maximum of 2 BN instances.
830
+ */
831
+ static max(left: BN, right: BN): BN;
832
+
833
+ /**
834
+ * @description returns the minimum of 2 BN instances.
835
+ */
836
+ static min(left: BN, right: BN): BN;
837
+
838
+ /**
839
+ * @description Copy to dest number
840
+ */
841
+ copy(dest: BN): void;
842
+
843
+ /**
844
+ * @description clone number
845
+ */
846
+ clone(): BN;
847
+
848
+ /**
849
+ * @description convert to base-string and pad with zeroes
850
+ */
851
+ toString(base?: number | "hex", length?: number): string;
852
+
853
+ /**
854
+ * @description convert to Javascript Number (limited to 53 bits)
855
+ */
856
+ toNumber(): number;
857
+
858
+ /**
859
+ * @description convert to JSON compatible hex string (alias of toString(16))
860
+ */
861
+ toJSON(): string;
862
+
863
+ /**
864
+ * @description convert to byte Array, and optionally zero pad to length, throwing if already exceeding
865
+ */
866
+ toArray(endian?: BN.Endianness, length?: number): number[];
867
+
868
+ /**
869
+ * @description convert to an instance of `type`, which must behave like an Array
870
+ */
871
+ toArrayLike(
872
+ ArrayType: typeof Buffer,
873
+ endian?: BN.Endianness,
874
+ length?: number,
875
+ ): Buffer;
876
+
877
+ toArrayLike(
878
+ ArrayType: any[],
879
+ endian?: BN.Endianness,
880
+ length?: number,
881
+ ): any[];
882
+
883
+ /**
884
+ * @description convert to Node.js Buffer (if available). For compatibility with browserify and similar tools, use this instead: a.toArrayLike(Buffer, endian, length)
885
+ */
886
+ toBuffer(endian?: BN.Endianness, length?: number): Buffer;
887
+
888
+ /**
889
+ * @description get number of bits occupied
890
+ */
891
+ bitLength(): number;
892
+
893
+ /**
894
+ * @description return number of less-significant consequent zero bits (example: 1010000 has 4 zero bits)
895
+ */
896
+ zeroBits(): number;
897
+
898
+ /**
899
+ * @description return number of bytes occupied
900
+ */
901
+ byteLength(): number;
902
+
903
+ /**
904
+ * @description true if the number is negative
905
+ */
906
+ isNeg(): boolean;
907
+
908
+ /**
909
+ * @description check if value is even
910
+ */
911
+ isEven(): boolean;
912
+
913
+ /**
914
+ * @description check if value is odd
915
+ */
916
+ isOdd(): boolean;
917
+
918
+ /**
919
+ * @description check if value is zero
920
+ */
921
+ isZero(): boolean;
922
+
923
+ /**
924
+ * @description compare numbers and return `-1 (a < b)`, `0 (a == b)`, or `1 (a > b)` depending on the comparison result
925
+ */
926
+ cmp(b: BN): -1 | 0 | 1;
927
+
928
+ /**
929
+ * @description compare numbers and return `-1 (a < b)`, `0 (a == b)`, or `1 (a > b)` depending on the comparison result
930
+ */
931
+ ucmp(b: BN): -1 | 0 | 1;
932
+
933
+ /**
934
+ * @description compare numbers and return `-1 (a < b)`, `0 (a == b)`, or `1 (a > b)` depending on the comparison result
935
+ */
936
+ cmpn(b: number): -1 | 0 | 1;
937
+
938
+ /**
939
+ * @description a less than b
940
+ */
941
+ lt(b: BN): boolean;
942
+
943
+ /**
944
+ * @description a less than b
945
+ */
946
+ ltn(b: number): boolean;
947
+
948
+ /**
949
+ * @description a less than or equals b
950
+ */
951
+ lte(b: BN): boolean;
952
+
953
+ /**
954
+ * @description a less than or equals b
955
+ */
956
+ lten(b: number): boolean;
957
+
958
+ /**
959
+ * @description a greater than b
960
+ */
961
+ gt(b: BN): boolean;
962
+
963
+ /**
964
+ * @description a greater than b
965
+ */
966
+ gtn(b: number): boolean;
967
+
968
+ /**
969
+ * @description a greater than or equals b
970
+ */
971
+ gte(b: BN): boolean;
972
+
973
+ /**
974
+ * @description a greater than or equals b
975
+ */
976
+ gten(b: number): boolean;
977
+
978
+ /**
979
+ * @description a equals b
980
+ */
981
+ eq(b: BN): boolean;
982
+
983
+ /**
984
+ * @description a equals b
985
+ */
986
+ eqn(b: number): boolean;
987
+
988
+ /**
989
+ * @description convert to two's complement representation, where width is bit width
990
+ */
991
+ toTwos(width: number): BN;
992
+
993
+ /**
994
+ * @description convert from two's complement representation, where width is the bit width
995
+ */
996
+ fromTwos(width: number): BN;
997
+
998
+ /**
999
+ * @description negate sign
1000
+ */
1001
+ neg(): BN;
1002
+
1003
+ /**
1004
+ * @description negate sign
1005
+ */
1006
+ ineg(): BN;
1007
+
1008
+ /**
1009
+ * @description absolute value
1010
+ */
1011
+ abs(): BN;
1012
+
1013
+ /**
1014
+ * @description absolute value
1015
+ */
1016
+ iabs(): BN;
1017
+
1018
+ /**
1019
+ * @description addition
1020
+ */
1021
+ add(b: BN): BN;
1022
+
1023
+ /**
1024
+ * @description addition
1025
+ */
1026
+ iadd(b: BN): BN;
1027
+
1028
+ /**
1029
+ * @description addition
1030
+ */
1031
+ addn(b: number): BN;
1032
+
1033
+ /**
1034
+ * @description addition
1035
+ */
1036
+ iaddn(b: number): BN;
1037
+
1038
+ /**
1039
+ * @description subtraction
1040
+ */
1041
+ sub(b: BN): BN;
1042
+
1043
+ /**
1044
+ * @description subtraction
1045
+ */
1046
+ isub(b: BN): BN;
1047
+
1048
+ /**
1049
+ * @description subtraction
1050
+ */
1051
+ subn(b: number): BN;
1052
+
1053
+ /**
1054
+ * @description subtraction
1055
+ */
1056
+ isubn(b: number): BN;
1057
+
1058
+ /**
1059
+ * @description multiply
1060
+ */
1061
+ mul(b: BN): BN;
1062
+
1063
+ /**
1064
+ * @description multiply
1065
+ */
1066
+ imul(b: BN): BN;
1067
+
1068
+ /**
1069
+ * @description multiply
1070
+ */
1071
+ muln(b: number): BN;
1072
+
1073
+ /**
1074
+ * @description multiply
1075
+ */
1076
+ imuln(b: number): BN;
1077
+
1078
+ /**
1079
+ * @description square
1080
+ */
1081
+ sqr(): BN;
1082
+
1083
+ /**
1084
+ * @description square
1085
+ */
1086
+ isqr(): BN;
1087
+
1088
+ /**
1089
+ * @description raise `a` to the power of `b`
1090
+ */
1091
+ pow(b: BN): BN;
1092
+
1093
+ /**
1094
+ * @description divide
1095
+ */
1096
+ div(b: BN): BN;
1097
+
1098
+ /**
1099
+ * @description divide
1100
+ */
1101
+ divn(b: number): BN;
1102
+
1103
+ /**
1104
+ * @description divide
1105
+ */
1106
+ idivn(b: number): BN;
1107
+
1108
+ /**
1109
+ * @description division with remainder
1110
+ */
1111
+ divmod(b: BN, mode?: "div" | "mod", positive?: boolean): { div: BN; mod: BN };
1112
+
1113
+ /**
1114
+ * @description reduct
1115
+ */
1116
+ mod(b: BN): BN;
1117
+
1118
+ /**
1119
+ * @description reduct
1120
+ */
1121
+ umod(b: BN): BN;
1122
+
1123
+ /**
1124
+ * @deprecated
1125
+ * @description reduct
1126
+ */
1127
+ modn(b: number): number;
1128
+
1129
+ /**
1130
+ * @description reduct
1131
+ */
1132
+ modrn(b: number): number;
1133
+
1134
+ /**
1135
+ * @description rounded division
1136
+ */
1137
+ divRound(b: BN): BN;
1138
+
1139
+ /**
1140
+ * @description or
1141
+ */
1142
+ or(b: BN): BN;
1143
+
1144
+ /**
1145
+ * @description or
1146
+ */
1147
+ ior(b: BN): BN;
1148
+
1149
+ /**
1150
+ * @description or
1151
+ */
1152
+ uor(b: BN): BN;
1153
+
1154
+ /**
1155
+ * @description or
1156
+ */
1157
+ iuor(b: BN): BN;
1158
+
1159
+ /**
1160
+ * @description and
1161
+ */
1162
+ and(b: BN): BN;
1163
+
1164
+ /**
1165
+ * @description and
1166
+ */
1167
+ iand(b: BN): BN;
1168
+
1169
+ /**
1170
+ * @description and
1171
+ */
1172
+ uand(b: BN): BN;
1173
+
1174
+ /**
1175
+ * @description and
1176
+ */
1177
+ iuand(b: BN): BN;
1178
+
1179
+ /**
1180
+ * @description and (NOTE: `andln` is going to be replaced with `andn` in future)
1181
+ */
1182
+ andln(b: number): BN;
1183
+
1184
+ /**
1185
+ * @description xor
1186
+ */
1187
+ xor(b: BN): BN;
1188
+
1189
+ /**
1190
+ * @description xor
1191
+ */
1192
+ ixor(b: BN): BN;
1193
+
1194
+ /**
1195
+ * @description xor
1196
+ */
1197
+ uxor(b: BN): BN;
1198
+
1199
+ /**
1200
+ * @description xor
1201
+ */
1202
+ iuxor(b: BN): BN;
1203
+
1204
+ /**
1205
+ * @description set specified bit to value
1206
+ */
1207
+ setn(b: number, value: boolean | 0 | 1): BN;
1208
+
1209
+ /**
1210
+ * @description shift left
1211
+ */
1212
+ shln(b: number): BN;
1213
+
1214
+ /**
1215
+ * @description shift left
1216
+ */
1217
+ ishln(b: number): BN;
1218
+
1219
+ /**
1220
+ * @description shift left
1221
+ */
1222
+ ushln(b: number): BN;
1223
+
1224
+ /**
1225
+ * @description shift left
1226
+ */
1227
+ iushln(b: number): BN;
1228
+
1229
+ /**
1230
+ * @description shift right
1231
+ */
1232
+ shrn(b: number): BN;
1233
+
1234
+ /**
1235
+ * @description shift right (unimplemented https://github.com/indutny/bn.js/blob/master/lib/bn.js#L2086)
1236
+ */
1237
+ ishrn(b: number): BN;
1238
+
1239
+ /**
1240
+ * @description shift right
1241
+ */
1242
+ ushrn(b: number): BN;
1243
+ /**
1244
+ * @description shift right
1245
+ */
1246
+
1247
+ iushrn(b: number): BN;
1248
+ /**
1249
+ * @description test if specified bit is set
1250
+ */
1251
+
1252
+ testn(b: number): boolean;
1253
+ /**
1254
+ * @description clear bits with indexes higher or equal to `b`
1255
+ */
1256
+
1257
+ maskn(b: number): BN;
1258
+ /**
1259
+ * @description clear bits with indexes higher or equal to `b`
1260
+ */
1261
+
1262
+ imaskn(b: number): BN;
1263
+ /**
1264
+ * @description add `1 << b` to the number
1265
+ */
1266
+ bincn(b: number): BN;
1267
+
1268
+ /**
1269
+ * @description not (for the width specified by `w`)
1270
+ */
1271
+ notn(w: number): BN;
1272
+
1273
+ /**
1274
+ * @description not (for the width specified by `w`)
1275
+ */
1276
+ inotn(w: number): BN;
1277
+
1278
+ /**
1279
+ * @description GCD
1280
+ */
1281
+ gcd(b: BN): BN;
1282
+
1283
+ /**
1284
+ * @description Extended GCD results `({ a: ..., b: ..., gcd: ... })`
1285
+ */
1286
+ egcd(b: BN): { a: BN; b: BN; gcd: BN };
1287
+
1288
+ /**
1289
+ * @description inverse `a` modulo `b`
1290
+ */
1291
+ invm(b: BN): BN;
1292
+
1293
+ /**
1294
+ * @description Convert number to red
1295
+ */
1296
+ toRed(reductionContext: BN.ReductionContext): RedBN;
1297
+ }
1298
+
1299
+ /**
1300
+ * BN operations in a reduction context.
1301
+ */
1302
+ declare class RedBN extends BN {
1303
+ /**
1304
+ * @description Convert back a number using a reduction context
1305
+ */
1306
+ fromRed(): BN;
1307
+
1308
+ /**
1309
+ * @description modular addition
1310
+ */
1311
+ redAdd(b: RedBN): RedBN;
1312
+
1313
+ /**
1314
+ * @description in-place modular addition
1315
+ */
1316
+ redIAdd(b: RedBN): RedBN;
1317
+
1318
+ /**
1319
+ * @description modular subtraction
1320
+ */
1321
+ redSub(b: RedBN): RedBN;
1322
+
1323
+ /**
1324
+ * @description in-place modular subtraction
1325
+ */
1326
+ redISub(b: RedBN): RedBN;
1327
+
1328
+ /**
1329
+ * @description modular shift left
1330
+ */
1331
+ redShl(num: number): RedBN;
1332
+
1333
+ /**
1334
+ * @description modular multiplication
1335
+ */
1336
+ redMul(b: RedBN): RedBN;
1337
+
1338
+ /**
1339
+ * @description in-place modular multiplication
1340
+ */
1341
+ redIMul(b: RedBN): RedBN;
1342
+
1343
+ /**
1344
+ * @description modular square
1345
+ */
1346
+ redSqr(): RedBN;
1347
+
1348
+ /**
1349
+ * @description in-place modular square
1350
+ */
1351
+ redISqr(): RedBN;
1352
+
1353
+ /**
1354
+ * @description modular square root
1355
+ */
1356
+ redSqrt(): RedBN;
1357
+
1358
+ /**
1359
+ * @description modular inverse of the number
1360
+ */
1361
+ redInvm(): RedBN;
1362
+
1363
+ /**
1364
+ * @description modular negation
1365
+ */
1366
+ redNeg(): RedBN;
1367
+
1368
+ /**
1369
+ * @description modular exponentiation
1370
+ */
1371
+ redPow(b: BN): RedBN;
1372
+ }
1373
+
1374
+ /**
1375
+ * SPL interface PDA info.
1376
+ */
1377
+ type SplInterfaceInfo = {
1378
+ /**
1379
+ * The mint of the SPL interface
1380
+ */
1381
+ mint: PublicKey;
1382
+ /**
1383
+ * The SPL interface address
1384
+ */
1385
+ splInterfacePda: PublicKey;
1386
+ /**
1387
+ * The token program of the SPL interface
1388
+ */
1389
+ tokenProgram: PublicKey;
1390
+ /**
1391
+ * count of txs and volume in the past 60 seconds.
1392
+ */
1393
+ activity?: {
1394
+ txs: number;
1395
+ amountAdded: BN;
1396
+ amountRemoved: BN;
1397
+ };
1398
+ /**
1399
+ * Whether the SPL interface is initialized
1400
+ */
1401
+ isInitialized: boolean;
1402
+ /**
1403
+ * The balance of the SPL interface
1404
+ */
1405
+ balance: BN;
1406
+ /**
1407
+ * The index of the SPL interface
1408
+ */
1409
+ poolIndex: number;
1410
+ /**
1411
+ * The bump used to derive the SPL interface PDA
1412
+ */
1413
+ bump: number;
42
1414
  };
43
1415
  /**
44
- * Token pool pda info.
1416
+ * @deprecated Use {@link SplInterfaceInfo} instead.
1417
+ * This type maintains backward compatibility by including both tokenPoolPda and splInterfacePda.
1418
+ * Both properties point to the same PublicKey value.
45
1419
  */
46
1420
  type TokenPoolInfo = {
47
1421
  /**
48
- * The mint of the token pool
1422
+ * The mint of the SPL interface
49
1423
  */
50
1424
  mint: PublicKey;
51
1425
  /**
52
- * The token pool address
1426
+ * @deprecated Use splInterfacePda instead.
53
1427
  */
54
1428
  tokenPoolPda: PublicKey;
55
1429
  /**
56
- * The token program of the token pool
1430
+ * The SPL interface address (new name).
1431
+ * For backward compatibility, tokenPoolPda is also available.
1432
+ */
1433
+ splInterfacePda: PublicKey;
1434
+ /**
1435
+ * The token program of the SPL interface
57
1436
  */
58
1437
  tokenProgram: PublicKey;
59
1438
  /**
@@ -65,22 +1444,60 @@ type TokenPoolInfo = {
65
1444
  amountRemoved: BN;
66
1445
  };
67
1446
  /**
68
- * Whether the token pool is initialized
1447
+ * Whether the SPL interface is initialized
69
1448
  */
70
1449
  isInitialized: boolean;
71
1450
  /**
72
- * The balance of the token pool
1451
+ * The balance of the SPL interface
73
1452
  */
74
1453
  balance: BN;
75
1454
  /**
76
- * The index of the token pool
1455
+ * The index of the SPL interface
77
1456
  */
78
1457
  poolIndex: number;
79
1458
  /**
80
- * The bump used to derive the token pool pda
1459
+ * The bump used to derive the SPL interface PDA
81
1460
  */
82
1461
  bump: number;
83
1462
  };
1463
+ /**
1464
+ * Convert SplInterfaceInfo to TokenPoolInfo for backward compatibility.
1465
+ * @internal
1466
+ */
1467
+ declare function toTokenPoolInfo(info: SplInterfaceInfo): TokenPoolInfo;
1468
+ /**
1469
+ * Derive SplInterfaceInfo for an SPL interface that will be initialized in the
1470
+ * same transaction. Use this when you need to create an SPL interface and
1471
+ * compress in a single transaction.
1472
+ *
1473
+ * @param mint The mint of the SPL interface
1474
+ * @param tokenProgramId The token program (TOKEN_PROGRAM_ID or TOKEN_2022_PROGRAM_ID)
1475
+ * @param poolIndex The pool index. Default 0.
1476
+ *
1477
+ * @returns SplInterfaceInfo for the to-be-initialized interface
1478
+ */
1479
+ declare function deriveSplInterfaceInfo(mint: PublicKey, tokenProgramId: PublicKey, poolIndex?: number): SplInterfaceInfo;
1480
+ /**
1481
+ * Check if the SPL interface info is initialized and has a balance.
1482
+ * @param mint The mint of the SPL interface
1483
+ * @param splInterfaceInfo The SPL interface info (or TokenPoolInfo for backward compatibility)
1484
+ * @returns True if the SPL interface info is initialized and has a balance
1485
+ */
1486
+ declare function checkSplInterfaceInfo(splInterfaceInfo: SplInterfaceInfo | TokenPoolInfo, mint: PublicKey): boolean;
1487
+ /**
1488
+ * Get the SPL interface infos for a given mint.
1489
+ * @param rpc The RPC client
1490
+ * @param mint The mint of the SPL interface
1491
+ * @param commitment The commitment to use
1492
+ *
1493
+ * @returns The SPL interface infos
1494
+ */
1495
+ declare function getSplInterfaceInfos(rpc: Rpc, mint: PublicKey, commitment?: Commitment): Promise<SplInterfaceInfo[]>;
1496
+ type SplInterfaceActivity = {
1497
+ signature: string;
1498
+ amount: BN;
1499
+ action: Action;
1500
+ };
84
1501
  /**
85
1502
  * @internal
86
1503
  */
@@ -91,29 +1508,656 @@ declare enum Action {
91
1508
  }
92
1509
  /**
93
1510
  * For `compress` and `mintTo` instructions only.
94
- * Select a random token pool info from the token pool infos.
1511
+ * Select a random SPL interface info from the SPL interface infos.
95
1512
  *
96
- * For `decompress`, use {@link selectTokenPoolInfosForDecompression} instead.
1513
+ * For `decompress`, use {@link selectSplInterfaceInfosForDecompression} instead.
97
1514
  *
98
- * @param infos The token pool infos
1515
+ * @param infos The SPL interface infos
99
1516
  *
100
- * @returns A random token pool info
1517
+ * @returns A random SPL interface info
101
1518
  */
102
- declare function selectTokenPoolInfo(infos: TokenPoolInfo[]): TokenPoolInfo;
1519
+ declare function selectSplInterfaceInfo(infos: SplInterfaceInfo[]): SplInterfaceInfo;
103
1520
  /**
104
- * Select one or multiple token pool infos from the token pool infos.
1521
+ * Select one or multiple SPL interface infos from the SPL interface infos.
105
1522
  *
106
1523
  * Use this function for `decompress`.
107
1524
  *
108
- * For `compress`, `mintTo` use {@link selectTokenPoolInfo} instead.
1525
+ * For `compress`, `mintTo` use {@link selectSplInterfaceInfo} instead.
109
1526
  *
110
- * @param infos The token pool infos
1527
+ * @param infos The SPL interface infos
111
1528
  * @param decompressAmount The amount of tokens to withdraw
112
1529
  *
113
- * @returns Array with one or more token pool infos.
1530
+ * @returns Array with one or more SPL interface infos.
1531
+ */
1532
+ declare function selectSplInterfaceInfosForDecompression(infos: SplInterfaceInfo[], decompressAmount: number | BN): SplInterfaceInfo[];
1533
+ /**
1534
+ * @deprecated Use {@link SplInterfaceActivity} instead.
1535
+ */
1536
+ type TokenPoolActivity = SplInterfaceActivity;
1537
+ /**
1538
+ * @deprecated Use {@link deriveSplInterfaceInfo} instead.
1539
+ */
1540
+ declare function deriveTokenPoolInfo(mint: PublicKey, tokenProgramId: PublicKey, poolIndex?: number): TokenPoolInfo;
1541
+ /**
1542
+ * @deprecated Use {@link checkSplInterfaceInfo} instead.
1543
+ */
1544
+ declare function checkTokenPoolInfo(tokenPoolInfo: TokenPoolInfo, mint: PublicKey): boolean;
1545
+ /**
1546
+ * @deprecated Use {@link getSplInterfaceInfos} instead.
1547
+ */
1548
+ declare function getTokenPoolInfos(rpc: Rpc, mint: PublicKey, commitment?: Commitment): Promise<TokenPoolInfo[]>;
1549
+ /**
1550
+ * @deprecated Use {@link selectSplInterfaceInfo} instead.
1551
+ */
1552
+ declare function selectTokenPoolInfo(infos: TokenPoolInfo[]): TokenPoolInfo;
1553
+ /**
1554
+ * @deprecated Use {@link selectSplInterfaceInfosForDecompression} instead.
114
1555
  */
115
1556
  declare function selectTokenPoolInfosForDecompression(infos: TokenPoolInfo[], decompressAmount: number | BN): TokenPoolInfo[];
116
1557
 
1558
+ /**
1559
+ * Create decompressInterface instruction using Transfer2.
1560
+ *
1561
+ * Supports decompressing to both c-token accounts and SPL token accounts:
1562
+ * - For c-token destinations: No splInterfaceInfo needed
1563
+ * - For SPL destinations: Provide splInterfaceInfo (token pool info)
1564
+ *
1565
+ * @param payer Fee payer public key
1566
+ * @param inputCompressedTokenAccounts Input compressed token accounts
1567
+ * @param toAddress Destination token account address (c-token or SPL ATA)
1568
+ * @param amount Amount to decompress
1569
+ * @param validityProof Validity proof (contains compressedProof and rootIndices)
1570
+ * @param splInterfaceInfo Optional: SPL interface info for SPL destinations
1571
+ * @returns TransactionInstruction
1572
+ */
1573
+ declare function createDecompressInterfaceInstruction(payer: PublicKey, inputCompressedTokenAccounts: ParsedTokenAccount[], toAddress: PublicKey, amount: bigint, validityProof: ValidityProofWithContext, splInterfaceInfo?: SplInterfaceInfo): TransactionInstruction;
1574
+
1575
+ declare const TokenAccountSourceType: {
1576
+ readonly Spl: "spl";
1577
+ readonly Token2022: "token2022";
1578
+ readonly SplCold: "spl-cold";
1579
+ readonly Token2022Cold: "token2022-cold";
1580
+ readonly CTokenHot: "ctoken-hot";
1581
+ readonly CTokenCold: "ctoken-cold";
1582
+ };
1583
+ type TokenAccountSourceTypeValue = (typeof TokenAccountSourceType)[keyof typeof TokenAccountSourceType];
1584
+ /** @internal */
1585
+ interface TokenAccountSource {
1586
+ type: TokenAccountSourceTypeValue;
1587
+ address: PublicKey;
1588
+ amount: bigint;
1589
+ accountInfo: AccountInfo<Buffer$1>;
1590
+ loadContext?: MerkleContext;
1591
+ parsed: Account;
1592
+ }
1593
+ interface AccountInterface {
1594
+ accountInfo: AccountInfo<Buffer$1>;
1595
+ parsed: Account;
1596
+ isCold: boolean;
1597
+ loadContext?: MerkleContext;
1598
+ _sources?: TokenAccountSource[];
1599
+ _needsConsolidation?: boolean;
1600
+ _hasDelegate?: boolean;
1601
+ _anyFrozen?: boolean;
1602
+ /** True when fetched via getAtaInterface */
1603
+ _isAta?: boolean;
1604
+ /** ATA owner - set by getAtaInterface */
1605
+ _owner?: PublicKey;
1606
+ /** ATA mint - set by getAtaInterface */
1607
+ _mint?: PublicKey;
1608
+ }
1609
+ /** @internal */
1610
+ declare function convertTokenDataToAccount(address: PublicKey, tokenData: {
1611
+ mint: PublicKey;
1612
+ owner: PublicKey;
1613
+ amount: BN;
1614
+ delegate: PublicKey | null;
1615
+ state: number;
1616
+ tlv: Buffer$1 | null;
1617
+ }): Account;
1618
+ /** Convert compressed account to AccountInfo */
1619
+ declare function toAccountInfo(compressedAccount: CompressedAccountWithMerkleContext): AccountInfo<Buffer$1>;
1620
+ /** @internal */
1621
+ declare function parseCTokenHot(address: PublicKey, accountInfo: AccountInfo<Buffer$1>): {
1622
+ accountInfo: AccountInfo<Buffer$1>;
1623
+ loadContext: undefined;
1624
+ parsed: Account;
1625
+ isCold: false;
1626
+ };
1627
+ /** @internal */
1628
+ declare function parseCTokenCold(address: PublicKey, compressedAccount: CompressedAccountWithMerkleContext): {
1629
+ accountInfo: AccountInfo<Buffer$1>;
1630
+ loadContext: MerkleContext;
1631
+ parsed: Account;
1632
+ isCold: true;
1633
+ };
1634
+ /**
1635
+ * Retrieve information about a token account of SPL/T22/c-token.
1636
+ *
1637
+ * @param rpc RPC connection to use
1638
+ * @param address Token account address
1639
+ * @param commitment Desired level of commitment for querying the state
1640
+ * @param programId Token program ID. If not provided, tries all programs concurrently.
1641
+ *
1642
+ * @return Token account information with compression context if applicable
1643
+ */
1644
+ declare function getAccountInterface(rpc: Rpc, address: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<AccountInterface>;
1645
+
1646
+ /**
1647
+ * Options for interface operations (load, transfer)
1648
+ */
1649
+ interface InterfaceOptions {
1650
+ /** SPL interface infos (fetched if not provided) */
1651
+ splInterfaceInfos?: SplInterfaceInfo[];
1652
+ }
1653
+ /**
1654
+ * Transfer tokens using the c-token interface.
1655
+ *
1656
+ * Matches SPL Token's transferChecked signature order. Destination must exist.
1657
+ *
1658
+ * @param rpc RPC connection
1659
+ * @param payer Fee payer (signer)
1660
+ * @param source Source c-token ATA address
1661
+ * @param mint Mint address
1662
+ * @param destination Destination c-token ATA address (must exist)
1663
+ * @param owner Source owner (signer)
1664
+ * @param amount Amount to transfer
1665
+ * @param programId Token program ID (default: CTOKEN_PROGRAM_ID)
1666
+ * @param confirmOptions Optional confirm options
1667
+ * @param options Optional interface options
1668
+ * @param wrap Include SPL/T22 wrapping (default: false)
1669
+ * @returns Transaction signature
1670
+ */
1671
+ declare function transferInterface(rpc: Rpc, payer: Signer, source: PublicKey, mint: PublicKey, destination: PublicKey, owner: Signer, amount: number | bigint | BN, programId?: PublicKey, confirmOptions?: ConfirmOptions, options?: InterfaceOptions, wrap?: boolean): Promise<TransactionSignature>;
1672
+
1673
+ /**
1674
+ * Account info interface for compressible accounts.
1675
+ * Matches return structure of getAccountInterface/getAtaInterface.
1676
+ *
1677
+ * Integrating programs provide their own fetch/parse - this is just the data shape.
1678
+ */
1679
+ interface ParsedAccountInfoInterface<T = unknown> {
1680
+ /** Parsed account data (program-specific) */
1681
+ parsed: T;
1682
+ /** Load context - present if account is compressed (cold), undefined if hot */
1683
+ loadContext?: MerkleContext;
1684
+ }
1685
+ /**
1686
+ * Input for createLoadAccountsParams.
1687
+ * Supports both program PDAs and c-token vaults.
1688
+ *
1689
+ * The integrating program is responsible for fetching and parsing their accounts.
1690
+ * This helper just packs them for the decompressAccountsIdempotent instruction.
1691
+ */
1692
+ interface CompressibleAccountInput<T = unknown> {
1693
+ /** Account address */
1694
+ address: PublicKey;
1695
+ /**
1696
+ * Account type key for packing:
1697
+ * - For PDAs: program-specific type name (e.g., "poolState", "observationState")
1698
+ * - For c-token vaults: "cTokenData"
1699
+ */
1700
+ accountType: string;
1701
+ /**
1702
+ * Token variant - required when accountType is "cTokenData".
1703
+ * Examples: "lpVault", "token0Vault", "token1Vault"
1704
+ */
1705
+ tokenVariant?: string;
1706
+ /** Parsed account info (from program-specific fetch) */
1707
+ info: ParsedAccountInfoInterface<T>;
1708
+ }
1709
+ /**
1710
+ * Packed compressed account for decompressAccountsIdempotent instruction
1711
+ */
1712
+ interface PackedCompressedAccount {
1713
+ [key: string]: unknown;
1714
+ merkleContext: {
1715
+ merkleTreePubkeyIndex: number;
1716
+ queuePubkeyIndex: number;
1717
+ };
1718
+ }
1719
+ /**
1720
+ * Result from building load params
1721
+ */
1722
+ interface CompressibleLoadParams {
1723
+ /** Validity proof wrapped in option (null if all proveByIndex) */
1724
+ proofOption: {
1725
+ 0: ValidityProof | null;
1726
+ };
1727
+ /** Packed compressed accounts data for instruction */
1728
+ compressedAccounts: PackedCompressedAccount[];
1729
+ /** Offset to system accounts in remainingAccounts */
1730
+ systemAccountsOffset: number;
1731
+ /** Account metas for remaining accounts */
1732
+ remainingAccounts: AccountMeta[];
1733
+ }
1734
+ /**
1735
+ * Result from createLoadAccountsParams
1736
+ */
1737
+ interface LoadResult {
1738
+ /** Params for decompressAccountsIdempotent (null if no program accounts need decompressing) */
1739
+ decompressParams: CompressibleLoadParams | null;
1740
+ /** Instructions to load ATAs (create ATA, wrap SPL/T22, decompressInterface) */
1741
+ ataInstructions: TransactionInstruction[];
1742
+ }
1743
+ /**
1744
+ * Create params for loading program accounts and ATAs.
1745
+ *
1746
+ * Returns:
1747
+ * - decompressParams: for a caller program's standardized
1748
+ * decompressAccountsIdempotent instruction
1749
+ * - ataInstructions: for loading user ATAs
1750
+ *
1751
+ * @param rpc RPC connection
1752
+ * @param payer Fee payer (needed for ATA instructions)
1753
+ * @param programId Program ID for decompressAccountsIdempotent
1754
+ * @param programAccounts PDAs and vaults (caller pre-fetches)
1755
+ * @param atas User ATAs (fetched via getAtaInterface)
1756
+ * @param options Optional load options
1757
+ * @returns LoadResult with decompressParams and ataInstructions
1758
+ *
1759
+ * @example
1760
+ * ```typescript
1761
+ * const poolInfo = await myProgram.fetchPoolState(rpc, poolAddress);
1762
+ * const vault0Ata = getAssociatedTokenAddressInterface(token0Mint, poolAddress);
1763
+ * const vault0Info = await getAtaInterface(rpc, vault0Ata, poolAddress, token0Mint, undefined, CTOKEN_PROGRAM_ID);
1764
+ * const userAta = getAssociatedTokenAddressInterface(tokenMint, userWallet);
1765
+ * const userAtaInfo = await getAtaInterface(rpc, userAta, userWallet, tokenMint);
1766
+ *
1767
+ * const result = await createLoadAccountsParams(
1768
+ * rpc,
1769
+ * payer.publicKey,
1770
+ * programId,
1771
+ * [
1772
+ * { address: poolAddress, accountType: 'poolState', info: poolInfo },
1773
+ * { address: vault0, accountType: 'cTokenData', tokenVariant: 'token0Vault', info: vault0Info },
1774
+ * ],
1775
+ * [userAta],
1776
+ * );
1777
+ *
1778
+ * // Build transaction with both program decompress and ATA load
1779
+ * const instructions = [...result.ataInstructions];
1780
+ * if (result.decompressParams) {
1781
+ * instructions.push(await program.methods
1782
+ * .decompressAccountsIdempotent(
1783
+ * result.decompressParams.proofOption,
1784
+ * result.decompressParams.compressedAccounts,
1785
+ * result.decompressParams.systemAccountsOffset,
1786
+ * )
1787
+ * .remainingAccounts(result.decompressParams.remainingAccounts)
1788
+ * .instruction());
1789
+ * }
1790
+ * ```
1791
+ */
1792
+ declare function createLoadAccountsParams(rpc: Rpc, payer: PublicKey, programId: PublicKey, programAccounts?: CompressibleAccountInput[], atas?: AccountInterface[], options?: InterfaceOptions): Promise<LoadResult>;
1793
+ /**
1794
+ * Calculate compute units for compressible load operation
1795
+ */
1796
+ declare function calculateCompressibleLoadComputeUnits(compressedAccountCount: number, hasValidityProof: boolean): number;
1797
+
1798
+ /**
1799
+ * Create a wrap instruction that moves tokens from an SPL/T22 account to a
1800
+ * c-token account.
1801
+ *
1802
+ * @param source Source SPL/T22 token account
1803
+ * @param destination Destination c-token account
1804
+ * @param owner Owner of the source account (signer)
1805
+ * @param mint Mint address
1806
+ * @param amount Amount to wrap,
1807
+ * @param splInterfaceInfo SPL interface info for the compression
1808
+ * @param payer Fee payer (defaults to owner)
1809
+ * @returns Instruction to wrap tokens
1810
+ */
1811
+ declare function createWrapInstruction(source: PublicKey, destination: PublicKey, owner: PublicKey, mint: PublicKey, amount: bigint, splInterfaceInfo: SplInterfaceInfo, payer?: PublicKey): TransactionInstruction;
1812
+
1813
+ /**
1814
+ * Create and initialize a new mint for SPL/T22/c-token.
1815
+ *
1816
+ * @param rpc RPC connection to use
1817
+ * @param payer Fee payer
1818
+ * @param mintAuthority Account that will control minting (signer for c-token mints)
1819
+ * @param freezeAuthority Account that will control freeze and thaw (optional)
1820
+ * @param decimals Location of the decimal place
1821
+ * @param keypair Mint keypair (defaults to a random keypair)
1822
+ * @param confirmOptions Confirm options
1823
+ * @param programId Token program ID (defaults to CTOKEN_PROGRAM_ID)
1824
+ * @param tokenMetadata Optional token metadata (c-token mints only)
1825
+ * @param outputStateTreeInfo Optional output state tree info (c-token mints only)
1826
+ * @param addressTreeInfo Optional address tree info (c-token mints only)
1827
+ *
1828
+ * @returns Object with mint address and transaction signature
1829
+ */
1830
+ declare function createMintInterface(rpc: Rpc, payer: Signer, mintAuthority: PublicKey | Signer, freezeAuthority: PublicKey | Signer | null, decimals: number, keypair?: Keypair, confirmOptions?: ConfirmOptions, programId?: PublicKey, tokenMetadata?: TokenMetadataInstructionData, outputStateTreeInfo?: TreeInfo, addressTreeInfo?: AddressTreeInfo): Promise<{
1831
+ mint: PublicKey;
1832
+ transactionSignature: TransactionSignature;
1833
+ }>;
1834
+
1835
+ /**
1836
+ * Update the mint authority of a compressed token mint.
1837
+ *
1838
+ * @param rpc RPC connection
1839
+ * @param payer Fee payer (signer)
1840
+ * @param mint Mint address
1841
+ * @param currentMintAuthority Current mint authority (signer)
1842
+ * @param newMintAuthority New mint authority (or null to revoke)
1843
+ * @param confirmOptions Optional confirm options
1844
+ */
1845
+ declare function updateMintAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, currentMintAuthority: Signer, newMintAuthority: PublicKey | null, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1846
+ /**
1847
+ * Update the freeze authority of a compressed token mint.
1848
+ *
1849
+ * @param rpc RPC connection
1850
+ * @param payer Fee payer (signer)
1851
+ * @param mint Mint address
1852
+ * @param currentFreezeAuthority Current freeze authority (signer)
1853
+ * @param newFreezeAuthority New freeze authority (or null to revoke)
1854
+ * @param confirmOptions Optional confirm options
1855
+ */
1856
+ declare function updateFreezeAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, currentFreezeAuthority: Signer, newFreezeAuthority: PublicKey | null, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1857
+
1858
+ /**
1859
+ * Update a metadata field on a compressed token mint.
1860
+ *
1861
+ * @param rpc RPC connection
1862
+ * @param payer Fee payer (signer)
1863
+ * @param mint Mint address
1864
+ * @param authority Metadata update authority (signer)
1865
+ * @param fieldType Field to update: 'name', 'symbol', 'uri', or 'custom'
1866
+ * @param value New value for the field
1867
+ * @param customKey Custom key name (required if fieldType is 'custom')
1868
+ * @param extensionIndex Extension index (default: 0)
1869
+ * @param confirmOptions Optional confirm options
1870
+ */
1871
+ 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>;
1872
+ /**
1873
+ * Update the metadata authority of a compressed token mint.
1874
+ *
1875
+ * @param rpc RPC connection
1876
+ * @param payer Fee payer (signer)
1877
+ * @param mint Mint address
1878
+ * @param currentAuthority Current metadata update authority (signer)
1879
+ * @param newAuthority New metadata update authority
1880
+ * @param extensionIndex Extension index (default: 0)
1881
+ * @param confirmOptions Optional confirm options
1882
+ */
1883
+ declare function updateMetadataAuthority(rpc: Rpc, payer: Signer, mint: PublicKey, currentAuthority: Signer, newAuthority: PublicKey, extensionIndex?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1884
+ /**
1885
+ * Remove a metadata key from a compressed token mint.
1886
+ *
1887
+ * @param rpc RPC connection
1888
+ * @param payer Fee payer (signer)
1889
+ * @param mint Mint address
1890
+ * @param authority Metadata update authority (signer)
1891
+ * @param key Metadata key to remove
1892
+ * @param idempotent If true, don't error if key doesn't exist (default: false)
1893
+ * @param extensionIndex Extension index (default: 0)
1894
+ * @param confirmOptions Optional confirm options
1895
+ */
1896
+ declare function removeMetadataKey(rpc: Rpc, payer: Signer, mint: PublicKey, authority: Signer, key: string, idempotent?: boolean, extensionIndex?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1897
+
1898
+ /**
1899
+ * Create an associated token account for SPL/T22/c-token. Defaults to c-token
1900
+ * program.
1901
+ *
1902
+ * @param rpc RPC connection
1903
+ * @param payer Fee payer and transaction signer
1904
+ * @param mint Mint address
1905
+ * @param owner Owner of the associated token account
1906
+ * @param allowOwnerOffCurve Allow owner to be a PDA (default: false)
1907
+ * @param confirmOptions Options for confirming the transaction
1908
+ * @param programId Token program ID (default:
1909
+ * CTOKEN_PROGRAM_ID)
1910
+ * @param associatedTokenProgramId ATA program ID (auto-derived if not
1911
+ * provided)
1912
+ * @param ctokenConfig Optional rent config
1913
+ * @returns Address of the new associated token account
1914
+ */
1915
+ declare function createAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey, ctokenConfig?: CTokenConfig): Promise<PublicKey>;
1916
+ /**
1917
+ * Create an associated token account idempotently for SPL/T22/c-token. Defaults
1918
+ * to c-token program.
1919
+ *
1920
+ * If the account already exists, the instruction succeeds without error.
1921
+ *
1922
+ * @param rpc RPC connection
1923
+ * @param payer Fee payer and transaction signer
1924
+ * @param mint Mint address
1925
+ * @param owner Owner of the associated token account
1926
+ * @param allowOwnerOffCurve Allow owner to be a PDA (default: false)
1927
+ * @param confirmOptions Options for confirming the transaction
1928
+ * @param programId Token program ID (default:
1929
+ * CTOKEN_PROGRAM_ID)
1930
+ * @param associatedTokenProgramId ATA program ID (auto-derived if not
1931
+ * provided)
1932
+ * @param ctokenConfig Optional c-token-specific configuration
1933
+ *
1934
+ * @returns Address of the associated token account
1935
+ */
1936
+ declare function createAtaInterfaceIdempotent(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey, ctokenConfig?: CTokenConfig): Promise<PublicKey>;
1937
+
1938
+ declare function mintTo$1(rpc: Rpc, payer: Signer, mint: PublicKey, recipientAccount: PublicKey, authority: Signer, amount: number | bigint, outputQueue?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1939
+
1940
+ /**
1941
+ * Mint compressed tokens directly to compressed accounts.
1942
+ *
1943
+ * @param rpc RPC connection
1944
+ * @param payer Fee payer
1945
+ * @param mint Mint address
1946
+ * @param authority Mint authority (must sign)
1947
+ * @param recipients Array of recipients with amounts
1948
+ * @param outputStateTreeInfo Optional output state tree info (auto-fetched if not provided)
1949
+ * @param tokenAccountVersion Token account version (default: 3)
1950
+ * @param confirmOptions Optional confirm options
1951
+ */
1952
+ declare function mintToCompressed(rpc: Rpc, payer: Signer, mint: PublicKey, authority: Signer, recipients: Array<{
1953
+ recipient: PublicKey;
1954
+ amount: number | bigint;
1955
+ }>, outputStateTreeInfo?: TreeInfo, tokenAccountVersion?: number, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
1956
+
1957
+ /**
1958
+ * Mint tokens to a decompressed/onchain token account.
1959
+ * Works with SPL, Token-2022, and compressed token (c-token) mints.
1960
+ *
1961
+ * This function ONLY mints to decompressed onchain token accounts, never to compressed accounts.
1962
+ * The signature matches the standard SPL mintTo for simplicity and consistency.
1963
+ *
1964
+ * @param rpc - RPC connection to use
1965
+ * @param payer - Transaction fee payer
1966
+ * @param mint - Mint address (SPL, Token-2022, or compressed mint)
1967
+ * @param destination - Destination token account address (must be an existing onchain token account)
1968
+ * @param authority - Mint authority (can be Signer or PublicKey if multiSigners provided)
1969
+ * @param amount - Amount to mint
1970
+ * @param multiSigners - Optional: Multi-signature signers (default: [])
1971
+ * @param confirmOptions - Optional: Transaction confirmation options
1972
+ * @param programId - Optional: Token program ID (TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, or CTOKEN_PROGRAM_ID). If undefined, auto-detects.
1973
+ *
1974
+ * @returns Transaction signature
1975
+ */
1976
+ 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>;
1977
+
1978
+ /**
1979
+ * Retrieve the associated token account, or create it if it doesn't exist.
1980
+ *
1981
+ * @param rpc Connection to use
1982
+ * @param payer Payer of the transaction and initialization
1983
+ * fees.
1984
+ * @param mint Mint associated with the account to set or
1985
+ * verify.
1986
+ * @param owner Owner of the account. Pass Signer to
1987
+ * auto-load cold (compressed) tokens, or
1988
+ * PublicKey for read-only.
1989
+ * @param allowOwnerOffCurve Allow the owner account to be a PDA (Program
1990
+ * Derived Address).
1991
+ * @param commitment Desired level of commitment for querying the
1992
+ * state.
1993
+ * @param confirmOptions Options for confirming the transaction
1994
+ * @param programId Token program ID (defaults to
1995
+ * CTOKEN_PROGRAM_ID)
1996
+ * @param associatedTokenProgramId Associated token program ID (auto-derived if
1997
+ * not provided)
1998
+ *
1999
+ * @returns AccountInterface with aggregated balance and source breakdown
2000
+ */
2001
+ declare function getOrCreateAtaInterface(rpc: Rpc, payer: Signer, mint: PublicKey, owner: PublicKey | Signer, allowOwnerOffCurve?: boolean, commitment?: Commitment, confirmOptions?: ConfirmOptions, programId?: PublicKey, associatedTokenProgramId?: PublicKey): Promise<AccountInterface>;
2002
+
2003
+ /**
2004
+ * Decompress compressed (cold) tokens to an on-chain token account.
2005
+ *
2006
+ * For unified loading, use {@link loadAta} instead.
2007
+ *
2008
+ * @param rpc RPC connection
2009
+ * @param payer Fee payer (signer)
2010
+ * @param owner Owner of the compressed tokens (signer)
2011
+ * @param mint Mint address
2012
+ * @param amount Amount to decompress (defaults to all)
2013
+ * @param destinationAta Destination token account address
2014
+ * @param destinationOwner Owner of the destination ATA
2015
+ * @param splInterfaceInfo SPL interface info for SPL/T22 destinations
2016
+ * @param confirmOptions Confirm options
2017
+ * @returns Transaction signature, null if nothing to load.
2018
+ */
2019
+ 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>;
2020
+
2021
+ /**
2022
+ * Wrap tokens from an SPL/T22 account to a c-token account.
2023
+ *
2024
+ * This is an agnostic action that takes explicit account addresses (spl-token style).
2025
+ * Use getAssociatedTokenAddressSync() to derive ATA addresses if needed.
2026
+ *
2027
+ * @param rpc RPC connection
2028
+ * @param payer Fee payer
2029
+ * @param source Source SPL/T22 token account (any token account, not just ATA)
2030
+ * @param destination Destination c-token account
2031
+ * @param owner Owner/authority of the source account (must sign)
2032
+ * @param mint Mint address
2033
+ * @param amount Amount to wrap
2034
+ * @param splInterfaceInfo Optional: SPL interface info (will be fetched if not provided)
2035
+ * @param confirmOptions Optional: Confirm options
2036
+ *
2037
+ * @example
2038
+ * const splAta = getAssociatedTokenAddressSync(mint, owner.publicKey, false, TOKEN_PROGRAM_ID);
2039
+ * const ctokenAta = getAssociatedTokenAddressInterface(mint, owner.publicKey); // defaults to c-token
2040
+ *
2041
+ * await wrap(
2042
+ * rpc,
2043
+ * payer,
2044
+ * splAta,
2045
+ * ctokenAta,
2046
+ * owner,
2047
+ * mint,
2048
+ * 1000n,
2049
+ * );
2050
+ *
2051
+ * @returns Transaction signature
2052
+ */
2053
+ declare function wrap(rpc: Rpc, payer: Signer, source: PublicKey, destination: PublicKey, owner: Signer, mint: PublicKey, amount: bigint, splInterfaceInfo?: SplInterfaceInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2054
+
2055
+ /**
2056
+ * Create instructions to load an ATA from its AccountInterface.
2057
+ *
2058
+ * Behavior depends on `wrap` parameter:
2059
+ * - wrap=false (standard): Decompress compressed tokens to the target ATA type
2060
+ * (SPL ATA via pool, T22 ATA via pool, or c-token ATA direct)
2061
+ * - wrap=true (unified): Wrap SPL/T22 + decompress all to c-token ATA
2062
+ *
2063
+ * @param rpc RPC connection
2064
+ * @param payer Fee payer
2065
+ * @param ata AccountInterface from getAtaInterface (must have _isAta, _owner, _mint)
2066
+ * @param options Optional load options
2067
+ * @param wrap Unified mode: wrap SPL/T22 to c-token (default: false)
2068
+ * @param targetAta Target ATA address (used for type detection in standard mode)
2069
+ * @returns Array of instructions (empty if nothing to load)
2070
+ */
2071
+ declare function createLoadAtaInstructionsFromInterface(rpc: Rpc, payer: PublicKey, ata: AccountInterface, options?: InterfaceOptions, wrap?: boolean, targetAta?: PublicKey): Promise<TransactionInstruction[]>;
2072
+
2073
+ /**
2074
+ * Derive the canonical associated token address for any of SPL/T22/c-token.
2075
+ * Defaults to using c-token as the canonical ATA.
2076
+ *
2077
+ * @param mint Mint public key
2078
+ * @param owner Owner public key
2079
+ * @param allowOwnerOffCurve Allow owner to be a PDA. Default false.
2080
+ * @param programId Token program ID. Default c-token.
2081
+ *
2082
+ * @param associatedTokenProgramId Associated token program ID. Default
2083
+ * auto-detected.
2084
+ * @returns Associated token address.
2085
+ */
2086
+ declare function getAssociatedTokenAddressInterface(mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, programId?: PublicKey, associatedTokenProgramId?: PublicKey): PublicKey;
2087
+
2088
+ /**
2089
+ * Input for creating off-chain metadata JSON.
2090
+ * Compatible with Token-2022 and Metaplex standards.
2091
+ */
2092
+ interface OffChainTokenMetadata {
2093
+ /** Token name */
2094
+ name: string;
2095
+ /** Token symbol */
2096
+ symbol: string;
2097
+ /** Optional description */
2098
+ description?: string;
2099
+ /** Optional image URI */
2100
+ image?: string;
2101
+ /** Optional additional metadata key-value pairs */
2102
+ additionalMetadata?: Array<{
2103
+ key: string;
2104
+ value: string;
2105
+ }>;
2106
+ }
2107
+ /**
2108
+ * Off-chain JSON format for token metadata.
2109
+ * Standard format compatible with Token-2022 and Metaplex tooling.
2110
+ */
2111
+ interface OffChainTokenMetadataJson {
2112
+ name: string;
2113
+ symbol: string;
2114
+ description?: string;
2115
+ image?: string;
2116
+ additionalMetadata?: Array<{
2117
+ key: string;
2118
+ value: string;
2119
+ }>;
2120
+ }
2121
+ /**
2122
+ * Format metadata for off-chain storage.
2123
+ *
2124
+ * Returns a plain object ready to be uploaded using any storage provider
2125
+ * (umi uploader, custom IPFS/Arweave/S3 solution, etc.).
2126
+ *
2127
+ * @example
2128
+ * // With umi uploader
2129
+ * import { toOffChainMetadataJson } from '@lightprotocol/compressed-token';
2130
+ * import { irysUploader } from '@metaplex-foundation/umi-uploader-irys';
2131
+ *
2132
+ * const umi = createUmi(connection).use(irysUploader());
2133
+ * const metadataJson = toOffChainMetadataJson({
2134
+ * name: 'My Token',
2135
+ * symbol: 'MTK',
2136
+ * description: 'A compressed token',
2137
+ * image: 'https://example.com/image.png',
2138
+ * });
2139
+ * const uri = await umi.uploader.uploadJson(metadataJson);
2140
+ *
2141
+ * // Then use uri with createMint
2142
+ * await createMint(rpc, payer, { ...params, uri });
2143
+ */
2144
+ declare function toOffChainMetadataJson(meta: OffChainTokenMetadata): OffChainTokenMetadataJson;
2145
+
2146
+ /**
2147
+ * Approve a delegate to spend tokens
2148
+ *
2149
+ * @param rpc Rpc to use
2150
+ * @param payer Fee payer
2151
+ * @param mint SPL Mint address
2152
+ * @param amount Number of tokens to delegate
2153
+ * @param owner Owner of the SPL token account.
2154
+ * @param delegate Address of the delegate
2155
+ * @param confirmOptions Options for confirming the transaction
2156
+ *
2157
+ * @return Signature of the confirmed transaction
2158
+ */
2159
+ declare function approve(rpc: Rpc, payer: Signer, mint: PublicKey, amount: number | BN, owner: Signer, delegate: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2160
+
117
2161
  /**
118
2162
  * Mint compressed tokens to a solana address from an external mint authority
119
2163
  *
@@ -126,12 +2170,12 @@ declare function selectTokenPoolInfosForDecompression(infos: TokenPoolInfo[], de
126
2170
  * @param outputStateTreeInfo Optional: State tree account that the compressed
127
2171
  * tokens should be inserted into. Defaults to a
128
2172
  * shared state tree account.
129
- * @param tokenPoolInfo Optional: Token pool info.
2173
+ * @param splInterfaceInfo Optional: SPL interface info.
130
2174
  * @param confirmOptions Options for confirming the transaction
131
2175
  *
132
2176
  * @return Signature of the confirmed transaction
133
2177
  */
134
- declare function approveAndMintTo(rpc: Rpc, payer: Signer, mint: PublicKey, toPubkey: PublicKey, authority: Signer, amount: number | BN, outputStateTreeInfo?: TreeInfo, tokenPoolInfo?: TokenPoolInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2178
+ declare function approveAndMintTo(rpc: Rpc, payer: Signer, mint: PublicKey, toPubkey: PublicKey, authority: Signer, amount: number | BN, outputStateTreeInfo?: TreeInfo, splInterfaceInfo?: SplInterfaceInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
135
2179
 
136
2180
  /**
137
2181
  * Compress SPL tokens
@@ -146,12 +2190,12 @@ declare function approveAndMintTo(rpc: Rpc, payer: Signer, mint: PublicKey, toPu
146
2190
  * @param outputStateTreeInfo Optional: State tree account that the compressed
147
2191
  * tokens should be inserted into. Defaults to a
148
2192
  * shared state tree account.
149
- * @param tokenPoolInfo Optional: Token pool info.
2193
+ * @param splInterfaceInfo Optional: SPL interface info.
150
2194
  * @param confirmOptions Options for confirming the transaction
151
2195
  *
152
2196
  * @return Signature of the confirmed transaction
153
2197
  */
154
- declare function compress(rpc: Rpc, payer: Signer, mint: PublicKey, amount: number | BN | number[] | BN[], owner: Signer, sourceTokenAccount: PublicKey, toAddress: PublicKey | Array<PublicKey>, outputStateTreeInfo?: TreeInfo, tokenPoolInfo?: TokenPoolInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2198
+ declare function compress(rpc: Rpc, payer: Signer, mint: PublicKey, amount: number | BN | number[] | BN[], owner: Signer, sourceTokenAccount: PublicKey, toAddress: PublicKey | Array<PublicKey>, outputStateTreeInfo?: TreeInfo, splInterfaceInfo?: SplInterfaceInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
155
2199
 
156
2200
  /**
157
2201
  * Compress SPL tokens into compressed token format
@@ -165,16 +2209,18 @@ declare function compress(rpc: Rpc, payer: Signer, mint: PublicKey, amount: numb
165
2209
  * Default: 0
166
2210
  * @param outputStateTreeInfo Optional: State tree account that the compressed
167
2211
  * account into
168
- * @param tokenPoolInfo Optional: Token pool info.
2212
+ * @param splInterfaceInfo Optional: SPL interface info.
169
2213
  * @param confirmOptions Options for confirming the transaction
170
2214
 
171
2215
  *
172
2216
  * @return Signature of the confirmed transaction
173
2217
  */
174
- declare function compressSplTokenAccount(rpc: Rpc, payer: Signer, mint: PublicKey, owner: Signer, tokenAccount: PublicKey, remainingAmount?: BN, outputStateTreeInfo?: TreeInfo, tokenPoolInfo?: TokenPoolInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2218
+ declare function compressSplTokenAccount(rpc: Rpc, payer: Signer, mint: PublicKey, owner: Signer, tokenAccount: PublicKey, remainingAmount?: BN, outputStateTreeInfo?: TreeInfo, splInterfaceInfo?: SplInterfaceInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
175
2219
 
176
2220
  /**
177
- * Create and initialize a new compressed token mint
2221
+ * Create and initialize a new SPL token mint
2222
+ *
2223
+ * @deprecated Use {@link createMintInterface} instead, which supports both SPL and compressed mints.
178
2224
  *
179
2225
  * @param rpc RPC connection to use
180
2226
  * @param payer Fee payer
@@ -186,11 +2232,10 @@ declare function compressSplTokenAccount(rpc: Rpc, payer: Signer, mint: PublicKe
186
2232
  * @param tokenProgramId Optional: Program ID for the token. Defaults to
187
2233
  * TOKEN_PROGRAM_ID.
188
2234
  * @param freezeAuthority Optional: Account that will control freeze and thaw.
189
- * Defaults to none.
190
2235
  *
191
2236
  * @return Object with mint address and transaction signature
192
2237
  */
193
- declare function createMint(rpc: Rpc, payer: Signer, mintAuthority: PublicKey | Signer, decimals: number, keypair?: Keypair, confirmOptions?: ConfirmOptions, tokenProgramId?: PublicKey | boolean, freezeAuthority?: PublicKey | Signer): Promise<{
2238
+ declare function createMint(rpc: Rpc, payer: Signer, mintAuthority: PublicKey | Signer, decimals: number, keypair?: Keypair, confirmOptions?: ConfirmOptions, tokenProgramId?: PublicKey | boolean, freezeAuthority?: PublicKey | Signer | null): Promise<{
194
2239
  mint: PublicKey;
195
2240
  transactionSignature: TransactionSignature;
196
2241
  }>;
@@ -207,14 +2252,18 @@ declare function createMint(rpc: Rpc, payer: Signer, mintAuthority: PublicKey |
207
2252
  *
208
2253
  * @return transaction signature
209
2254
  */
210
- declare function createTokenPool(rpc: Rpc, payer: Signer, mint: PublicKey, confirmOptions?: ConfirmOptions, tokenProgramId?: PublicKey): Promise<TransactionSignature>;
2255
+ declare function createSplInterface(rpc: Rpc, payer: Signer, mint: PublicKey, confirmOptions?: ConfirmOptions, tokenProgramId?: PublicKey): Promise<TransactionSignature>;
211
2256
  /**
212
- * Create additional token pools for an existing mint
2257
+ * @deprecated Use {@link createSplInterface} instead.
2258
+ */
2259
+ declare const createTokenPool: typeof createSplInterface;
2260
+ /**
2261
+ * Create additional SPL interfaces for an existing mint
213
2262
  *
214
2263
  * @param rpc RPC connection to use
215
2264
  * @param payer Fee payer
216
2265
  * @param mint SPL Mint address
217
- * @param numMaxAdditionalPools Number of additional token pools to create. Max
2266
+ * @param numMaxAdditionalPools Number of additional SPL interfaces to create. Max
218
2267
  * 3.
219
2268
  * @param confirmOptions Optional: Options for confirming the transaction
220
2269
  * @param tokenProgramId Optional: Address of the token program. Default:
@@ -222,7 +2271,11 @@ declare function createTokenPool(rpc: Rpc, payer: Signer, mint: PublicKey, confi
222
2271
  *
223
2272
  * @return transaction signature
224
2273
  */
225
- declare function addTokenPools(rpc: Rpc, payer: Signer, mint: PublicKey, numMaxAdditionalPools: number, confirmOptions?: ConfirmOptions, tokenProgramId?: PublicKey): Promise<string>;
2274
+ declare function addSplInterfaces(rpc: Rpc, payer: Signer, mint: PublicKey, numMaxAdditionalPools: number, confirmOptions?: ConfirmOptions, tokenProgramId?: PublicKey): Promise<string>;
2275
+ /**
2276
+ * @deprecated Use {@link addSplInterfaces} instead.
2277
+ */
2278
+ declare const addTokenPools: typeof addSplInterfaces;
226
2279
 
227
2280
  /**
228
2281
  * Create a lookup table for the token program's default accounts
@@ -253,16 +2306,18 @@ declare function createTokenProgramLookupTable(rpc: Rpc, payer: Signer, authorit
253
2306
  * @param owner Owner of the compressed tokens
254
2307
  * @param toAddress Destination **uncompressed** token account
255
2308
  * address. (ATA)
256
- * @param tokenPoolInfos Optional: Token pool infos.
2309
+ * @param splInterfaceInfos Optional: SPL interface infos.
257
2310
  * @param confirmOptions Options for confirming the transaction
258
2311
  *
259
2312
  * @return confirmed transaction signature
260
2313
  */
261
- declare function decompress(rpc: Rpc, payer: Signer, mint: PublicKey, amount: number | BN, owner: Signer, toAddress: PublicKey, tokenPoolInfos?: TokenPoolInfo[], confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2314
+ declare function decompress(rpc: Rpc, payer: Signer, mint: PublicKey, amount: number | BN, owner: Signer, toAddress: PublicKey, splInterfaceInfos?: SplInterfaceInfo[], confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
262
2315
 
263
2316
  /**
264
- * Merge multiple compressed token accounts for a given mint into a single
265
- * account
2317
+ * Merge multiple compressed token accounts for a given mint into fewer
2318
+ * accounts. Each call merges up to 4 accounts (V1) or 8 accounts (V2) at a
2319
+ * time. Call repeatedly until only 1 account remains if full consolidation
2320
+ * is needed.
266
2321
  *
267
2322
  * @param rpc RPC connection to use
268
2323
  * @param payer Fee payer
@@ -289,12 +2344,12 @@ declare function mergeTokenAccounts(rpc: Rpc, payer: Signer, mint: PublicKey, ow
289
2344
  * @param outputStateTreeInfo Optional: State tree account that the compressed
290
2345
  * tokens should be part of. Defaults to the
291
2346
  * default state tree account.
292
- * @param tokenPoolInfo Optional: Token pool information
2347
+ * @param splInterfaceInfo Optional: SPL interface information
293
2348
  * @param confirmOptions Options for confirming the transaction
294
2349
  *
295
2350
  * @return Signature of the confirmed transaction
296
2351
  */
297
- declare function mintTo(rpc: Rpc, payer: Signer, mint: PublicKey, toPubkey: PublicKey | PublicKey[], authority: Signer, amount: number | BN | number[] | BN[], outputStateTreeInfo?: TreeInfo, tokenPoolInfo?: TokenPoolInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2352
+ declare function mintTo(rpc: Rpc, payer: Signer, mint: PublicKey, toPubkey: PublicKey | PublicKey[], authority: Signer, amount: number | BN | number[] | BN[], outputStateTreeInfo?: TreeInfo, splInterfaceInfo?: SplInterfaceInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
298
2353
 
299
2354
  /**
300
2355
  * Revoke one or more delegated token accounts
@@ -350,12 +2405,12 @@ declare function transferDelegated(rpc: Rpc, payer: Signer, mint: PublicKey, amo
350
2405
  * @param owner Owner of the compressed tokens
351
2406
  * @param toAddress Destination **uncompressed** token account
352
2407
  * address. (ATA)
353
- * @param tokenPoolInfos Optional: Token pool infos.
2408
+ * @param splInterfaceInfos Optional: SPL interface infos.
354
2409
  * @param confirmOptions Options for confirming the transaction
355
2410
  *
356
2411
  * @return Signature of the confirmed transaction
357
2412
  */
358
- declare function decompressDelegated(rpc: Rpc, payer: Signer, mint: PublicKey, amount: number | BN, owner: Signer, toAddress: PublicKey, tokenPoolInfos?: TokenPoolInfo[], confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2413
+ declare function decompressDelegated(rpc: Rpc, payer: Signer, mint: PublicKey, amount: number | BN, owner: Signer, toAddress: PublicKey, splInterfaceInfos?: SplInterfaceInfo[], confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
359
2414
 
360
2415
  declare const ERROR_NO_ACCOUNTS_FOUND = "Could not find accounts to select for transfer.";
361
2416
  /**
@@ -504,7 +2559,7 @@ type TokenTransferOutputData = {
504
2559
  /**
505
2560
  * TokenExtension tlv
506
2561
  */
507
- tlv: Buffer | null;
2562
+ tlv: Buffer$1 | null;
508
2563
  };
509
2564
  type PackedTokenTransferOutputData = {
510
2565
  /**
@@ -526,7 +2581,7 @@ type PackedTokenTransferOutputData = {
526
2581
  /**
527
2582
  * TokenExtension tlv
528
2583
  */
529
- tlv: Buffer | null;
2584
+ tlv: Buffer$1 | null;
530
2585
  };
531
2586
  type InputTokenDataWithContext = {
532
2587
  amount: BN;
@@ -534,7 +2589,7 @@ type InputTokenDataWithContext = {
534
2589
  merkleContext: PackedMerkleContextLegacy;
535
2590
  rootIndex: number;
536
2591
  lamports: BN | null;
537
- tlv: Buffer | null;
2592
+ tlv: Buffer$1 | null;
538
2593
  };
539
2594
  type DelegatedTransfer = {
540
2595
  owner: PublicKey;
@@ -558,7 +2613,11 @@ type CompressSplTokenAccountInstructionData = {
558
2613
  remainingAmount: BN | null;
559
2614
  cpiContext: CompressedCpiContext | null;
560
2615
  };
561
- declare function isSingleTokenPoolInfo(tokenPoolInfos: TokenPoolInfo | TokenPoolInfo[]): tokenPoolInfos is TokenPoolInfo;
2616
+ declare function isSingleSplInterfaceInfo(splInterfaceInfos: SplInterfaceInfo | SplInterfaceInfo[]): splInterfaceInfos is SplInterfaceInfo;
2617
+ /**
2618
+ * @deprecated Use {@link isSingleSplInterfaceInfo} instead.
2619
+ */
2620
+ declare const isSingleTokenPoolInfo: typeof isSingleSplInterfaceInfo;
562
2621
  type CompressedTokenInstructionDataTransfer = {
563
2622
  /**
564
2623
  * Validity proof
@@ -623,7 +2682,7 @@ type TokenData = {
623
2682
  /**
624
2683
  * TokenExtension tlv
625
2684
  */
626
- tlv: Buffer | null;
2685
+ tlv: Buffer$1 | null;
627
2686
  };
628
2687
  type CompressedTokenInstructionDataApprove = {
629
2688
  proof: ValidityProof | null;
@@ -680,18 +2739,6 @@ declare function packCompressedTokenAccounts(params: PackCompressedTokenAccounts
680
2739
  */
681
2740
  declare function checkMint(compressedTokenAccounts: ParsedTokenAccount[], mint: PublicKey): boolean;
682
2741
 
683
- declare const POOL_SEED: Buffer<ArrayBuffer>;
684
- declare const CPI_AUTHORITY_SEED: Buffer<ArrayBuffer>;
685
- declare const SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE = 1461600;
686
- declare const CREATE_TOKEN_POOL_DISCRIMINATOR: Buffer<ArrayBuffer>;
687
- declare const MINT_TO_DISCRIMINATOR: Buffer<ArrayBuffer>;
688
- declare const BATCH_COMPRESS_DISCRIMINATOR: Buffer<ArrayBuffer>;
689
- declare const TRANSFER_DISCRIMINATOR: Buffer<ArrayBuffer>;
690
- declare const COMPRESS_SPL_TOKEN_ACCOUNT_DISCRIMINATOR: Buffer<ArrayBuffer>;
691
- declare const APPROVE_DISCRIMINATOR: Buffer<ArrayBuffer>;
692
- declare const REVOKE_DISCRIMINATOR: Buffer<ArrayBuffer>;
693
- declare const ADD_TOKEN_POOL_DISCRIMINATOR: Buffer<ArrayBuffer>;
694
-
695
2742
  type LightCompressedToken = {
696
2743
  version: '1.2.0';
697
2744
  name: 'light_compressed_token';
@@ -2526,20 +4573,20 @@ type LightCompressedToken = {
2526
4573
  };
2527
4574
  declare const IDL: LightCompressedToken;
2528
4575
 
2529
- declare const DelegatedTransferLayout: buffer_layout.Layout<unknown>;
2530
- declare const CpiContextLayout: buffer_layout.Layout<unknown>;
2531
- declare const CompressedTokenInstructionDataTransferLayout: buffer_layout.Layout<unknown>;
2532
- declare const mintToLayout: buffer_layout.Layout<unknown>;
2533
- declare const batchCompressLayout: buffer_layout.Layout<unknown>;
2534
- declare const compressSplTokenAccountInstructionDataLayout: buffer_layout.Layout<unknown>;
2535
- declare function encodeMintToInstructionData(data: MintToInstructionData): Buffer;
2536
- declare function decodeMintToInstructionData(buffer: Buffer): MintToInstructionData;
2537
- declare function encodeBatchCompressInstructionData(data: BatchCompressInstructionData): Buffer;
2538
- declare function decodeBatchCompressInstructionData(buffer: Buffer): BatchCompressInstructionData;
2539
- declare function encodeCompressSplTokenAccountInstructionData(data: CompressSplTokenAccountInstructionData): Buffer;
2540
- declare function decodeCompressSplTokenAccountInstructionData(buffer: Buffer): CompressSplTokenAccountInstructionData;
2541
- declare function encodeTransferInstructionData(data: CompressedTokenInstructionDataTransfer): Buffer;
2542
- declare function decodeTransferInstructionData(buffer: Buffer): CompressedTokenInstructionDataTransfer;
4576
+ declare const DelegatedTransferLayout: Layout<unknown>;
4577
+ declare const CpiContextLayout: Layout<unknown>;
4578
+ declare const CompressedTokenInstructionDataTransferLayout: Layout<unknown>;
4579
+ declare const mintToLayout: Layout<unknown>;
4580
+ declare const batchCompressLayout: Layout<unknown>;
4581
+ declare const compressSplTokenAccountInstructionDataLayout: Layout<unknown>;
4582
+ declare function encodeMintToInstructionData(data: MintToInstructionData): Buffer$1;
4583
+ declare function decodeMintToInstructionData(buffer: Buffer$1): MintToInstructionData;
4584
+ declare function encodeBatchCompressInstructionData(data: BatchCompressInstructionData): Buffer$1;
4585
+ declare function decodeBatchCompressInstructionData(buffer: Buffer$1): BatchCompressInstructionData;
4586
+ declare function encodeCompressSplTokenAccountInstructionData(data: CompressSplTokenAccountInstructionData): Buffer$1;
4587
+ declare function decodeCompressSplTokenAccountInstructionData(buffer: Buffer$1): CompressSplTokenAccountInstructionData;
4588
+ declare function encodeTransferInstructionData(data: CompressedTokenInstructionDataTransfer): Buffer$1;
4589
+ declare function decodeTransferInstructionData(buffer: Buffer$1): CompressedTokenInstructionDataTransfer;
2543
4590
  interface BaseAccountsLayoutParams {
2544
4591
  feePayer: PublicKey;
2545
4592
  authority: PublicKey;
@@ -2589,12 +4636,12 @@ declare const approveAccountsLayout: (accounts: approveAccountsLayoutParams) =>
2589
4636
  declare const revokeAccountsLayout: (accounts: approveAccountsLayoutParams) => AccountMeta[];
2590
4637
  declare const freezeAccountsLayout: (accounts: freezeAccountsLayoutParams) => AccountMeta[];
2591
4638
  declare const thawAccountsLayout: (accounts: freezeAccountsLayoutParams) => AccountMeta[];
2592
- declare const CompressedTokenInstructionDataApproveLayout: buffer_layout.Layout<unknown>;
2593
- declare const CompressedTokenInstructionDataRevokeLayout: buffer_layout.Layout<unknown>;
2594
- declare function encodeApproveInstructionData(data: CompressedTokenInstructionDataApprove): Buffer;
2595
- declare function decodeApproveInstructionData(buffer: Buffer): CompressedTokenInstructionDataApprove;
2596
- declare function encodeRevokeInstructionData(data: CompressedTokenInstructionDataRevoke): Buffer;
2597
- declare function decodeRevokeInstructionData(buffer: Buffer): CompressedTokenInstructionDataRevoke;
4639
+ declare const CompressedTokenInstructionDataApproveLayout: Layout<unknown>;
4640
+ declare const CompressedTokenInstructionDataRevokeLayout: Layout<unknown>;
4641
+ declare function encodeApproveInstructionData(data: CompressedTokenInstructionDataApprove): Buffer$1;
4642
+ declare function decodeApproveInstructionData(buffer: Buffer$1): CompressedTokenInstructionDataApprove;
4643
+ declare function encodeRevokeInstructionData(data: CompressedTokenInstructionDataRevoke): Buffer$1;
4644
+ declare function decodeRevokeInstructionData(buffer: Buffer$1): CompressedTokenInstructionDataRevoke;
2598
4645
 
2599
4646
  type CompressParams = {
2600
4647
  /**
@@ -2628,7 +4675,7 @@ type CompressParams = {
2628
4675
  /**
2629
4676
  * Token pool
2630
4677
  */
2631
- tokenPoolInfo: TokenPoolInfo;
4678
+ tokenPoolInfo: TokenPoolInfo | SplInterfaceInfo;
2632
4679
  };
2633
4680
  type CompressSplTokenAccountParams = {
2634
4681
  /**
@@ -2658,7 +4705,7 @@ type CompressSplTokenAccountParams = {
2658
4705
  /**
2659
4706
  * Token pool
2660
4707
  */
2661
- tokenPoolInfo: TokenPoolInfo;
4708
+ tokenPoolInfo: TokenPoolInfo | SplInterfaceInfo;
2662
4709
  };
2663
4710
  type DecompressParams = {
2664
4711
  /**
@@ -2688,7 +4735,7 @@ type DecompressParams = {
2688
4735
  /**
2689
4736
  * Token pool(s)
2690
4737
  */
2691
- tokenPoolInfos: TokenPoolInfo | TokenPoolInfo[];
4738
+ tokenPoolInfos: TokenPoolInfo | TokenPoolInfo[] | SplInterfaceInfo | SplInterfaceInfo[];
2692
4739
  };
2693
4740
  type TransferParams = {
2694
4741
  /**
@@ -2857,13 +4904,13 @@ type MintToParams = {
2857
4904
  /**
2858
4905
  * Token pool
2859
4906
  */
2860
- tokenPoolInfo: TokenPoolInfo;
4907
+ tokenPoolInfo: TokenPoolInfo | SplInterfaceInfo;
2861
4908
  };
2862
4909
  /**
2863
- * Register an existing SPL mint account to the compressed token program
2864
- * Creates an omnibus account for the mint
4910
+ * Register an existing SPL mint account to the compressed token program.
4911
+ * Creates an omnibus account (SPL interface) for the mint.
2865
4912
  */
2866
- type CreateTokenPoolParams = {
4913
+ type CreateSplInterfaceParams = {
2867
4914
  /**
2868
4915
  * Fee payer
2869
4916
  */
@@ -2877,7 +4924,11 @@ type CreateTokenPoolParams = {
2877
4924
  */
2878
4925
  tokenProgramId?: PublicKey;
2879
4926
  };
2880
- type AddTokenPoolParams = {
4927
+ /**
4928
+ * @deprecated Use {@link CreateSplInterfaceParams} instead.
4929
+ */
4930
+ type CreateTokenPoolParams = CreateSplInterfaceParams;
4931
+ type AddSplInterfaceParams = {
2881
4932
  /**
2882
4933
  * Fee payer
2883
4934
  */
@@ -2887,7 +4938,7 @@ type AddTokenPoolParams = {
2887
4938
  */
2888
4939
  mint: PublicKey;
2889
4940
  /**
2890
- * Token pool index
4941
+ * SPL interface pool index
2891
4942
  */
2892
4943
  poolIndex: number;
2893
4944
  /**
@@ -2895,6 +4946,10 @@ type AddTokenPoolParams = {
2895
4946
  */
2896
4947
  tokenProgramId?: PublicKey;
2897
4948
  };
4949
+ /**
4950
+ * @deprecated Use {@link AddSplInterfaceParams} instead.
4951
+ */
4952
+ type AddTokenPoolParams = AddSplInterfaceParams;
2898
4953
  /**
2899
4954
  * Mint from existing SPL mint to compressed token accounts
2900
4955
  */
@@ -2930,7 +4985,7 @@ type ApproveAndMintToParams = {
2930
4985
  /**
2931
4986
  * Token pool
2932
4987
  */
2933
- tokenPoolInfo: TokenPoolInfo;
4988
+ tokenPoolInfo: TokenPoolInfo | SplInterfaceInfo;
2934
4989
  };
2935
4990
  type CreateTokenProgramLookupTableParams = {
2936
4991
  /**
@@ -3008,37 +5063,49 @@ declare class CompressedTokenProgram {
3008
5063
  */
3009
5064
  static setProgramId(programId: PublicKey | string): void;
3010
5065
  /**
3011
- * Derive the token pool pda.
3012
- * To derive the token pool pda with bump, use {@link deriveTokenPoolPdaWithIndex}.
5066
+ * Derive the SPL interface PDA.
5067
+ * To derive the SPL interface PDA with bump, use {@link deriveSplInterfacePdaWithIndex}.
3013
5068
  *
3014
- * @param mint The mint of the token pool
5069
+ * @param mint The mint of the SPL interface
3015
5070
  *
3016
- * @returns The token pool pda
5071
+ * @returns The SPL interface PDA
5072
+ */
5073
+ static deriveSplInterfacePda(mint: PublicKey): PublicKey;
5074
+ /**
5075
+ * @deprecated Use {@link deriveSplInterfacePda} instead.
3017
5076
  */
3018
5077
  static deriveTokenPoolPda(mint: PublicKey): PublicKey;
3019
5078
  /**
3020
- * Find the index and bump for a given token pool pda and mint.
5079
+ * Find the index and bump for a given SPL interface PDA and mint.
3021
5080
  *
3022
- * @param poolPda The token pool pda to find the index and bump for
3023
- * @param mint The mint of the token pool
5081
+ * @param poolPda The SPL interface PDA to find the index and bump for
5082
+ * @param mint The mint of the SPL interface
3024
5083
  *
3025
5084
  * @returns The index and bump number.
3026
5085
  */
5086
+ static findSplInterfaceIndexAndBump(poolPda: PublicKey, mint: PublicKey): [number, number];
5087
+ /**
5088
+ * @deprecated Use {@link findSplInterfaceIndexAndBump} instead.
5089
+ */
3027
5090
  static findTokenPoolIndexAndBump(poolPda: PublicKey, mint: PublicKey): [number, number];
3028
5091
  /**
3029
- * Derive the token pool pda with index.
5092
+ * Derive the SPL interface PDA with index.
3030
5093
  *
3031
- * @param mint The mint of the token pool
3032
- * @param index Index. starts at 0. The Protocol supports 4 indexes aka token pools
5094
+ * @param mint The mint of the SPL interface
5095
+ * @param index Index. starts at 0. The Protocol supports 4 indexes aka SPL interfaces
3033
5096
  * per mint.
3034
5097
  *
3035
- * @returns The token pool pda and bump.
5098
+ * @returns The SPL interface PDA and bump.
5099
+ */
5100
+ static deriveSplInterfacePdaWithIndex(mint: PublicKey, index: number): [PublicKey, number];
5101
+ /**
5102
+ * @deprecated Use {@link deriveSplInterfacePdaWithIndex} instead.
3036
5103
  */
3037
5104
  static deriveTokenPoolPdaWithIndex(mint: PublicKey, index: number): [PublicKey, number];
3038
5105
  /** @internal */
3039
5106
  static get deriveCpiAuthorityPda(): PublicKey;
3040
5107
  /**
3041
- * Construct createMint instruction for compressed tokens.
5108
+ * Construct createMint instruction for SPL tokens.
3042
5109
  *
3043
5110
  * @param feePayer Fee payer.
3044
5111
  * @param mint SPL Mint address.
@@ -3067,7 +5134,7 @@ declare class CompressedTokenProgram {
3067
5134
  *
3068
5135
  * @returns The createTokenPool instruction
3069
5136
  */
3070
- static createTokenPool({ feePayer, mint, tokenProgramId, }: CreateTokenPoolParams): Promise<TransactionInstruction>;
5137
+ static createTokenPool({ feePayer, mint, tokenProgramId, }: CreateSplInterfaceParams): Promise<TransactionInstruction>;
3071
5138
  /**
3072
5139
  * Add a token pool to an existing SPL mint. For new mints, use
3073
5140
  * {@link createTokenPool}.
@@ -3080,7 +5147,7 @@ declare class CompressedTokenProgram {
3080
5147
  *
3081
5148
  * @returns The addTokenPool instruction
3082
5149
  */
3083
- static addTokenPool({ feePayer, mint, poolIndex, tokenProgramId, }: AddTokenPoolParams): Promise<TransactionInstruction>;
5150
+ static addTokenPool({ feePayer, mint, poolIndex, tokenProgramId, }: AddSplInterfaceParams): Promise<TransactionInstruction>;
3084
5151
  /**
3085
5152
  * Construct mintTo instruction for compressed tokens
3086
5153
  *
@@ -3233,4 +5300,42 @@ declare class CompressedTokenProgram {
3233
5300
  static revoke({ payer, inputCompressedTokenAccounts, recentValidityProof, recentInputStateRootIndices, }: RevokeParams): Promise<TransactionInstruction>;
3234
5301
  }
3235
5302
 
3236
- export { ADD_TOKEN_POOL_DISCRIMINATOR, APPROVE_DISCRIMINATOR, Action, type AddTokenPoolParams, type ApproveAndMintToParams, type ApproveParams, BATCH_COMPRESS_DISCRIMINATOR, type BatchCompressInstructionData, COMPRESS_SPL_TOKEN_ACCOUNT_DISCRIMINATOR, CPI_AUTHORITY_SEED, CREATE_TOKEN_POOL_DISCRIMINATOR, type CompressParams, type CompressSplTokenAccountInstructionData, type CompressSplTokenAccountParams, type CompressedTokenInstructionDataApprove, CompressedTokenInstructionDataApproveLayout, type CompressedTokenInstructionDataRevoke, CompressedTokenInstructionDataRevokeLayout, type CompressedTokenInstructionDataTransfer, CompressedTokenInstructionDataTransferLayout, CompressedTokenProgram, CpiContextLayout, type CreateMintParams, type CreateTokenPoolParams, type CreateTokenProgramLookupTableParams, type DecompressParams, type DelegatedTransfer, DelegatedTransferLayout, ERROR_NO_ACCOUNTS_FOUND, IDL, type InputTokenDataWithContext, type LightCompressedToken, MINT_TO_DISCRIMINATOR, type MergeTokenAccountsParams, type MintToInstructionData, type MintToParams, POOL_SEED, type PackCompressedTokenAccountsParams, type PackedTokenTransferOutputData, REVOKE_DISCRIMINATOR, type RevokeParams, SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE, TRANSFER_DISCRIMINATOR, type TokenData, type TokenPoolActivity, type TokenPoolInfo, type TokenTransferOutputData, type TransferParams, addTokenPoolAccountsLayout, type addTokenPoolAccountsLayoutParams, addTokenPools, approve, approveAccountsLayout, type approveAccountsLayoutParams, approveAndMintTo, batchCompressLayout, checkMint, checkTokenPoolInfo, compress, compressSplTokenAccount, compressSplTokenAccountInstructionDataLayout, createDecompressOutputState, createMint, createTokenPool, createTokenPoolAccountsLayout, type createTokenPoolAccountsLayoutParams, createTokenProgramLookupTable, createTransferOutputState, decodeApproveInstructionData, decodeBatchCompressInstructionData, decodeCompressSplTokenAccountInstructionData, decodeMintToInstructionData, decodeRevokeInstructionData, decodeTransferInstructionData, decompress, decompressDelegated, encodeApproveInstructionData, encodeBatchCompressInstructionData, encodeCompressSplTokenAccountInstructionData, encodeMintToInstructionData, encodeRevokeInstructionData, encodeTransferInstructionData, freezeAccountsLayout, type freezeAccountsLayoutParams, getTokenPoolInfos, isSingleTokenPoolInfo, mergeTokenAccounts, mintTo, mintToAccountsLayout, type mintToAccountsLayoutParams, mintToLayout, packCompressedTokenAccounts, parseMaybeDelegatedTransfer, parseTokenData, revoke, revokeAccountsLayout, type revokeAccountsLayoutParams, selectMinCompressedTokenAccountsForDecompression, selectMinCompressedTokenAccountsForTransfer, selectMinCompressedTokenAccountsForTransferOrPartial, selectSmartCompressedTokenAccountsForTransfer, selectSmartCompressedTokenAccountsForTransferOrPartial, selectTokenAccountsForApprove, selectTokenPoolInfo, selectTokenPoolInfosForDecompression, sumUpTokenAmount, thawAccountsLayout, type thawAccountsLayoutParams, transfer, transferAccountsLayout, type transferAccountsLayoutParams, transferDelegated, validateSameTokenOwner };
5303
+ /**
5304
+ * Retrieve associated token account for a given owner and mint.
5305
+ *
5306
+ * @param rpc RPC connection
5307
+ * @param ata Associated token address
5308
+ * @param owner Owner public key
5309
+ * @param mint Mint public key
5310
+ * @param commitment Optional commitment level
5311
+ * @param programId Optional program ID
5312
+ * @returns AccountInterface with ATA metadata
5313
+ */
5314
+ declare function getAtaInterface(rpc: Rpc, ata: PublicKey, owner: PublicKey, mint: PublicKey, commitment?: Commitment, programId?: PublicKey): Promise<AccountInterface>;
5315
+ /**
5316
+ * Create instructions to load token balances into a c-token ATA.
5317
+ *
5318
+ * @param rpc RPC connection
5319
+ * @param ata Associated token address
5320
+ * @param owner Owner public key
5321
+ * @param mint Mint public key
5322
+ * @param payer Fee payer (defaults to owner)
5323
+ * @param options Optional load options
5324
+ * @returns Array of instructions (empty if nothing to load)
5325
+ */
5326
+ declare function createLoadAtaInstructions(rpc: Rpc, ata: PublicKey, owner: PublicKey, mint: PublicKey, payer?: PublicKey, options?: InterfaceOptions): Promise<TransactionInstruction[]>;
5327
+ /**
5328
+ * Load token balances into a c-token ATA.
5329
+ *
5330
+ * @param rpc RPC connection
5331
+ * @param ata Associated token address
5332
+ * @param owner Owner of the tokens (signer)
5333
+ * @param mint Mint public key
5334
+ * @param payer Fee payer (signer, defaults to owner)
5335
+ * @param confirmOptions Optional confirm options
5336
+ * @param interfaceOptions Optional interface options
5337
+ * @returns Transaction signature, or null if nothing to load
5338
+ */
5339
+ declare function loadAta(rpc: Rpc, ata: PublicKey, owner: Signer, mint: PublicKey, payer?: Signer, confirmOptions?: ConfirmOptions, interfaceOptions?: InterfaceOptions): Promise<TransactionSignature | null>;
5340
+
5341
+ export { ADD_TOKEN_POOL_DISCRIMINATOR, APPROVE_DISCRIMINATOR, type AccountInterface, Action, type AddSplInterfaceParams, type AddTokenPoolParams, type ApproveAndMintToParams, type ApproveParams, BATCH_COMPRESS_DISCRIMINATOR, type BaseMint, type BatchCompressInstructionData, COMPRESS_SPL_TOKEN_ACCOUNT_DISCRIMINATOR, CPI_AUTHORITY_SEED, CREATE_TOKEN_POOL_DISCRIMINATOR, type CTokenConfig, type CompressParams, type CompressSplTokenAccountInstructionData, type CompressSplTokenAccountParams, type CompressedMint, type CompressedTokenInstructionDataApprove, CompressedTokenInstructionDataApproveLayout, type CompressedTokenInstructionDataRevoke, CompressedTokenInstructionDataRevokeLayout, type CompressedTokenInstructionDataTransfer, CompressedTokenInstructionDataTransferLayout, CompressedTokenProgram, type CompressibleAccountInput, type CompressibleConfig, type CompressibleLoadParams, CpiContextLayout, type CreateAssociatedCTokenAccountParams, type CreateMintParams, type CreateSplInterfaceParams, type CreateTokenPoolParams, type CreateTokenProgramLookupTableParams, DECOMPRESS_ACCOUNTS_IDEMPOTENT_DISCRIMINATOR, type DecompressParams, type DelegatedTransfer, DelegatedTransferLayout, ERROR_NO_ACCOUNTS_FOUND, ExtensionType, IDL, type InputTokenDataWithContext, type InterfaceOptions, type LightCompressedToken, type LoadResult, MINT_TO_DISCRIMINATOR, type MergeTokenAccountsParams, type MintContext, type MintExtension, type MintInterface, type MintToInstructionData, type MintToParams, type OffChainTokenMetadata, type OffChainTokenMetadataJson, POOL_SEED, type PackCompressedTokenAccountsParams, type PackedCompressedAccount, type PackedTokenTransferOutputData, type ParsedAccountInfoInterface, REVOKE_DISCRIMINATOR, type RevokeParams, SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE, type SplInterfaceActivity, type SplInterfaceInfo, TRANSFER_DISCRIMINATOR, type TokenAccountSource, type TokenData, TokenDataVersion, type TokenMetadata, type TokenMetadataInstructionData, type TokenPoolActivity, type TokenPoolInfo, type TokenTransferOutputData, type TransferParams, addSplInterfaces, addTokenPoolAccountsLayout, type addTokenPoolAccountsLayoutParams, addTokenPools, approve, approveAccountsLayout, type approveAccountsLayoutParams, approveAndMintTo, batchCompressLayout, calculateCompressibleLoadComputeUnits, checkMint, checkSplInterfaceInfo, checkTokenPoolInfo, compress, compressSplTokenAccount, compressSplTokenAccountInstructionDataLayout, convertTokenDataToAccount, createAssociatedCTokenAccountIdempotentInstruction, createAssociatedCTokenAccountInstruction, createAssociatedTokenAccountInterfaceIdempotentInstruction, createAssociatedTokenAccountInterfaceInstruction, createAtaInterface, createAtaInterfaceIdempotent, createAtaInterfaceIdempotentInstruction, createCTokenTransferInstruction, createDecompressInterfaceInstruction, createDecompressOutputState, createLoadAccountsParams, createLoadAtaInstructions, createLoadAtaInstructionsFromInterface, createMint, createMintInstruction, createMintInterface, createMintToCompressedInstruction, createMintToInstruction, createMintToInterfaceInstruction, createRemoveMetadataKeyInstruction, createSplInterface, createTokenMetadata, createTokenPool, createTokenPoolAccountsLayout, type createTokenPoolAccountsLayoutParams, createTokenProgramLookupTable, createTransferInterfaceInstruction, createTransferOutputState, createUpdateFreezeAuthorityInstruction, createUpdateMetadataAuthorityInstruction, createUpdateMetadataFieldInstruction, createUpdateMintAuthorityInstruction, createWrapInstruction, decodeApproveInstructionData, decodeBatchCompressInstructionData, decodeCompressSplTokenAccountInstructionData, decodeMintToInstructionData, decodeRevokeInstructionData, decodeTokenMetadata, decodeTransferInstructionData, decompress, decompressDelegated, decompressInterface, deriveSplInterfaceInfo, deriveTokenPoolInfo, deserializeMint, encodeApproveInstructionData, encodeBatchCompressInstructionData, encodeCompressSplTokenAccountInstructionData, encodeMintToInstructionData, encodeRevokeInstructionData, encodeTokenMetadata, encodeTransferInstructionData, extractTokenMetadata, freezeAccountsLayout, type freezeAccountsLayoutParams, getAccountInterface, getAssociatedTokenAddressInterface, getAtaInterface, getMintInterface, getOrCreateAtaInterface, getSplInterfaceInfos, getTokenPoolInfos, isSingleSplInterfaceInfo, isSingleTokenPoolInfo, loadAta, mergeTokenAccounts, mintTo, mintToAccountsLayout, type mintToAccountsLayoutParams, mintTo$1 as mintToCToken, mintToCompressed, mintToInterface, mintToLayout, packCompressedTokenAccounts, parseCTokenCold, parseCTokenHot, parseMaybeDelegatedTransfer, parseTokenData, removeMetadataKey, revoke, revokeAccountsLayout, type revokeAccountsLayoutParams, selectMinCompressedTokenAccountsForDecompression, selectMinCompressedTokenAccountsForTransfer, selectMinCompressedTokenAccountsForTransferOrPartial, selectSmartCompressedTokenAccountsForTransfer, selectSmartCompressedTokenAccountsForTransferOrPartial, selectSplInterfaceInfo, selectSplInterfaceInfosForDecompression, selectTokenAccountsForApprove, selectTokenPoolInfo, selectTokenPoolInfosForDecompression, serializeMint, sumUpTokenAmount, thawAccountsLayout, type thawAccountsLayoutParams, toAccountInfo, toOffChainMetadataJson, toTokenPoolInfo, transfer, transferAccountsLayout, type transferAccountsLayoutParams, transferDelegated, transferInterface, unpackMintData, unpackMintInterface, updateFreezeAuthority, updateMetadataAuthority, updateMetadataField, updateMintAuthority, validateSameTokenOwner, wrap };