@lightprotocol/stateless.js 0.20.9 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/cjs/browser/actions/compress.d.ts +9 -7
  2. package/dist/cjs/browser/actions/create-account.d.ts +25 -28
  3. package/dist/cjs/browser/actions/decompress.d.ts +6 -7
  4. package/dist/cjs/browser/actions/index.d.ts +1 -1
  5. package/dist/cjs/browser/actions/transfer.d.ts +8 -11
  6. package/dist/cjs/browser/constants.d.ts +16 -6
  7. package/dist/cjs/browser/index.cjs +1 -1
  8. package/dist/cjs/browser/index.cjs.map +1 -1
  9. package/dist/cjs/browser/index.d.ts +2 -2
  10. package/dist/cjs/browser/instruction/pack-compressed-accounts.d.ts +15 -17
  11. package/dist/cjs/browser/programs/layout.d.ts +27 -0
  12. package/dist/cjs/browser/programs/system.d.ts +18 -27
  13. package/dist/cjs/browser/rpc-interface.d.ts +92 -27
  14. package/dist/cjs/browser/rpc.d.ts +21 -41
  15. package/dist/cjs/browser/state/BN254.d.ts +0 -1
  16. package/dist/cjs/browser/state/bn.d.ts +3 -0
  17. package/dist/cjs/browser/state/compressed-account.d.ts +53 -13
  18. package/dist/cjs/browser/state/index.d.ts +1 -0
  19. package/dist/cjs/browser/state/types.d.ts +87 -12
  20. package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +10 -1
  21. package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +1 -1
  22. package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +15 -19
  23. package/dist/cjs/browser/utils/get-state-tree-infos.d.ts +41 -0
  24. package/dist/cjs/browser/utils/index.d.ts +5 -2
  25. package/dist/cjs/browser/utils/parse-validity-proof.d.ts +3 -3
  26. package/dist/cjs/browser/utils/state-tree-lookup-table.d.ts +68 -0
  27. package/dist/cjs/node/actions/compress.d.ts +9 -7
  28. package/dist/cjs/node/actions/create-account.d.ts +25 -28
  29. package/dist/cjs/node/actions/decompress.d.ts +6 -7
  30. package/dist/cjs/node/actions/index.d.ts +1 -1
  31. package/dist/cjs/node/actions/transfer.d.ts +8 -11
  32. package/dist/cjs/node/constants.d.ts +16 -6
  33. package/dist/cjs/node/index.cjs +1 -1
  34. package/dist/cjs/node/index.cjs.map +1 -1
  35. package/dist/cjs/node/index.d.ts +2 -2
  36. package/dist/cjs/node/instruction/pack-compressed-accounts.d.ts +15 -17
  37. package/dist/cjs/node/programs/layout.d.ts +27 -0
  38. package/dist/cjs/node/programs/system.d.ts +18 -27
  39. package/dist/cjs/node/rpc-interface.d.ts +92 -27
  40. package/dist/cjs/node/rpc.d.ts +21 -41
  41. package/dist/cjs/node/state/BN254.d.ts +0 -1
  42. package/dist/cjs/node/state/bn.d.ts +3 -0
  43. package/dist/cjs/node/state/compressed-account.d.ts +53 -13
  44. package/dist/cjs/node/state/index.d.ts +1 -0
  45. package/dist/cjs/node/state/types.d.ts +87 -12
  46. package/dist/cjs/node/test-helpers/test-rpc/get-compressed-accounts.d.ts +10 -1
  47. package/dist/cjs/node/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +1 -1
  48. package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +15 -19
  49. package/dist/cjs/node/utils/get-state-tree-infos.d.ts +41 -0
  50. package/dist/cjs/node/utils/index.d.ts +5 -2
  51. package/dist/cjs/node/utils/parse-validity-proof.d.ts +3 -3
  52. package/dist/cjs/node/utils/state-tree-lookup-table.d.ts +68 -0
  53. package/dist/types/index.d.ts +565 -358
  54. package/package.json +4 -3
  55. package/dist/cjs/browser/utils/get-light-state-tree-info.d.ts +0 -76
  56. package/dist/cjs/node/utils/get-light-state-tree-info.d.ts +0 -76
  57. /package/dist/cjs/browser/{actions/common.d.ts → utils/dedupe-signer.d.ts} +0 -0
  58. /package/dist/cjs/node/{actions/common.d.ts → utils/dedupe-signer.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
1
  import * as _solana_web3_js from '@solana/web3.js';
2
- import { PublicKey, Connection, Commitment, Keypair, TransactionInstruction, AddressLookupTableAccount, VersionedTransaction, ConfirmOptions, TransactionSignature, RpcResponseAndContext, SignatureResult, Signer, DataSlice, MemcmpFilter, ConnectionConfig, ParsedTransactionWithMeta, AccountMeta } from '@solana/web3.js';
2
+ import { PublicKey, Connection, Commitment, Keypair, Signer, ConfirmOptions, TransactionInstruction, AddressLookupTableAccount, VersionedTransaction, TransactionSignature, RpcResponseAndContext, SignatureResult, DataSlice, MemcmpFilter, ConnectionConfig, ParsedTransactionWithMeta, AccountMeta } from '@solana/web3.js';
3
3
  import { Buffer as Buffer$1 } from 'buffer';
4
4
  import { Struct } from 'superstruct';
5
5
  import BN from 'bn.js';
@@ -13,12 +13,13 @@ import { Layout } from '@coral-xyz/borsh';
13
13
  * are used to from working with the web3.js PublicKey type.
14
14
  */
15
15
  type BN254 = BN;
16
- declare const bn: (number: string | number | BN | Buffer$1 | Uint8Array | number[], base?: number | "hex" | undefined, endian?: BN.Endianness | undefined) => BN;
17
16
  /** Create a bigint instance with <254-bit max size and base58 capabilities */
18
17
  declare const createBN254: (number: string | number | BN | Buffer$1 | Uint8Array | number[], base?: number | "hex" | "base58" | undefined) => BN254;
19
18
  /** Convert <254-bit bigint to Base58 string. */
20
19
  declare function encodeBN254toBase58(bigintNumber: BN): string;
21
20
 
21
+ declare const bn: (number: string | number | BN | Buffer$1 | Uint8Array | number[], base?: number | "hex" | undefined, endian?: BN.Endianness | undefined) => BN;
22
+
22
23
  declare function deriveAddressSeed(seeds: Uint8Array[], programId: PublicKey): Uint8Array;
23
24
  /**
24
25
  * Derive an address for a compressed account from a seed and an address Merkle
@@ -89,6 +90,14 @@ declare function airdropSol({ connection, lamports, recipientPublicKey, }: {
89
90
  }): Promise<string>;
90
91
  declare function confirmTransaction(connection: Connection, signature: string, confirmation?: Commitment): Promise<_solana_web3_js.RpcResponseAndContext<_solana_web3_js.SignatureResult>>;
91
92
 
93
+ /**
94
+ * @param targetLamports - Target priority fee in lamports
95
+ * @param computeUnits - Expected compute units used by the transaction
96
+ * @returns microLamports per compute unit (use in
97
+ * `ComputeBudgetProgram.setComputeUnitPrice`)
98
+ */
99
+ declare function calculateComputeUnitPrice(targetLamports: number, computeUnits: number): number;
100
+
92
101
  declare function byteArrayToKeypair(byteArray: number[]): Keypair;
93
102
  /**
94
103
  * @internal
@@ -120,6 +129,162 @@ declare function hashvToBn254FieldSizeBe(bytes: Uint8Array[]): Uint8Array;
120
129
  /** Mutates array in place */
121
130
  declare function pushUniqueItems<T>(items: T[], map: T[]): void;
122
131
 
132
+ /** @internal remove signer from signers if part of signers */
133
+ declare function dedupeSigner(signer: Signer, signers: Signer[]): Signer[];
134
+
135
+ declare const FIELD_SIZE: BN;
136
+ declare const HIGHEST_ADDRESS_PLUS_ONE: BN;
137
+ declare const COMPUTE_BUDGET_PATTERN: number[];
138
+ declare const INVOKE_DISCRIMINATOR: Buffer$1;
139
+ declare const INVOKE_CPI_DISCRIMINATOR: Buffer$1;
140
+ declare const INSERT_INTO_QUEUES_DISCRIMINATOR: Buffer$1;
141
+ declare const noopProgram = "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV";
142
+ declare const lightProgram = "SySTEM1eSU2p4BGQfQpimFEWWSC1XDFeun3Nqzz3rT7";
143
+ declare const accountCompressionProgram = "compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq";
144
+ declare const getRegisteredProgramPda: () => PublicKey;
145
+ declare const getAccountCompressionAuthority: () => PublicKey;
146
+ declare const defaultStaticAccounts: () => PublicKey[];
147
+ declare const defaultStaticAccountsStruct: () => {
148
+ registeredProgramPda: PublicKey;
149
+ noopProgram: PublicKey;
150
+ accountCompressionProgram: PublicKey;
151
+ accountCompressionAuthority: PublicKey;
152
+ cpiSignatureAccount: null;
153
+ };
154
+ type StateTreeLUTPair = {
155
+ stateTreeLookupTable: PublicKey;
156
+ nullifyLookupTable: PublicKey;
157
+ };
158
+ /**
159
+ * Returns the Default Public State Tree LUTs for Devnet and Mainnet-Beta.
160
+ */
161
+ declare const defaultStateTreeLookupTables: () => {
162
+ mainnet: StateTreeLUTPair[];
163
+ devnet: StateTreeLUTPair[];
164
+ };
165
+ /**
166
+ * @internal
167
+ */
168
+ declare const isLocalTest: (url: string) => boolean;
169
+ /**
170
+ * @internal
171
+ */
172
+ declare const localTestActiveStateTreeInfo: () => StateTreeInfo[];
173
+ declare const getDefaultAddressTreeInfo: () => {
174
+ tree: PublicKey;
175
+ queue: PublicKey;
176
+ cpiContext: null;
177
+ treeType: TreeType;
178
+ nextTreeInfo: null;
179
+ };
180
+ /**
181
+ * @deprecated use {@link rpc.getStateTreeInfos} and {@link selectStateTreeInfo} instead.
182
+ * for address trees, use {@link getDefaultAddressTreeInfo} instead.
183
+ * Use only with Localnet testing.
184
+ * For public networks, fetch via {@link defaultStateTreeLookupTables} and {@link getAllStateTreeInfos}.
185
+ */
186
+ declare const defaultTestStateTreeAccounts: () => {
187
+ nullifierQueue: PublicKey;
188
+ merkleTree: PublicKey;
189
+ merkleTreeHeight: number;
190
+ addressTree: PublicKey;
191
+ addressQueue: PublicKey;
192
+ };
193
+ /**
194
+ * @internal testing only
195
+ */
196
+ declare const defaultTestStateTreeAccounts2: () => {
197
+ nullifierQueue2: PublicKey;
198
+ merkleTree2: PublicKey;
199
+ };
200
+ declare const COMPRESSED_TOKEN_PROGRAM_ID: PublicKey;
201
+ declare const stateTreeLookupTableMainnet = "7i86eQs3GSqHjN47WdWLTCGMW6gde1q96G2EVnUyK2st";
202
+ declare const nullifiedStateTreeLookupTableMainnet = "H9QD4u1fG7KmkAzn2tDXhheushxFe1EcrjGGyEFXeMqT";
203
+ declare const stateTreeLookupTableDevnet = "Dk9mNkbiZXJZ4By8DfSP6HEE4ojZzRvucwpawLeuwq8q";
204
+ declare const nullifiedStateTreeLookupTableDevnet = "AXbHzp1NgjLvpfnD6JRTTovXZ7APUCdtWZFCRr5tCxse";
205
+ declare const nullifierQueuePubkey = "nfq1NvQDJ2GEgnS8zt9prAe8rjjpAW1zFkrvZoBR148";
206
+ declare const cpiContextPubkey = "cpi1uHzrEhBG733DoEJNgHCyRS3XmmyVNZx5fonubE4";
207
+ declare const merkletreePubkey = "smt1NamzXdq4AMqS2fS2F1i5KTYPZRhoHgWx38d8WsT";
208
+ declare const addressTree = "amt1Ayt45jfbdw5YSo7iz6WZxUmnZsQTYXy82hVwyC2";
209
+ declare const addressQueue = "aq1S9z4reTSQAdgWHGD2zDaS39sjGrAxbR31vxJ2F4F";
210
+ declare const merkleTree2Pubkey = "smt2rJAFdyJJupwMKAqTNAJwvjhmiZ4JYGZmbVRw1Ho";
211
+ declare const nullifierQueue2Pubkey = "nfq2hgS7NYemXsFaFUCe3EMXSDSfnZnAe27jC6aPP1X";
212
+ declare const cpiContext2Pubkey = "cpi2cdhkH5roePvcudTgUL8ppEBfTay1desGh8G8QxK";
213
+ declare const confirmConfig: ConfirmOptions;
214
+ declare const DEFAULT_MERKLE_TREE_HEIGHT = 26;
215
+ declare const DEFAULT_MERKLE_TREE_ROOTS = 2800;
216
+ /** Threshold (per asset) at which new in-UTXOs get merged, in order to reduce UTXO pool size */
217
+ declare const UTXO_MERGE_THRESHOLD = 20;
218
+ declare const UTXO_MERGE_MAXIMUM = 10;
219
+ /**
220
+ * Treshold after which the currently used transaction Merkle tree is switched
221
+ * to the next one
222
+ */
223
+ declare const TRANSACTION_MERKLE_TREE_ROLLOVER_THRESHOLD: BN;
224
+ /**
225
+ * Fee to provide continous funding for the state Merkle tree.
226
+ * Once the state Merkle tree is at 95% capacity the accumulated fees
227
+ * will be used to fund the next state Merkle tree with the same parameters.
228
+ *
229
+ * Is charged per output compressed account.
230
+ */
231
+ declare const STATE_MERKLE_TREE_ROLLOVER_FEE: BN;
232
+ /**
233
+ * Fee to provide continous funding for the address queue and address Merkle tree.
234
+ * Once the address Merkle tree is at 95% capacity the accumulated fees
235
+ * will be used to fund the next address queue and address tree with the same parameters.
236
+ *
237
+ * Is charged per newly created address.
238
+ */
239
+ declare const ADDRESS_QUEUE_ROLLOVER_FEE: BN;
240
+ /**
241
+ * Is charged if the transaction nullifies at least one compressed account.
242
+ */
243
+ declare const STATE_MERKLE_TREE_NETWORK_FEE: BN;
244
+ /**
245
+ * Is charged if the transaction creates at least one address.
246
+ */
247
+ declare const ADDRESS_TREE_NETWORK_FEE: BN;
248
+
249
+ /**
250
+ * @deprecated use {@link selectStateTreeInfo} instead.
251
+ *
252
+ * Get a random tree and queue from a set of provided state tree infos.
253
+ *
254
+ * @param infos Set of state tree infos
255
+ * @returns A random tree and queue
256
+ */
257
+ declare function pickRandomTreeAndQueue(infos: StateTreeInfo[]): {
258
+ tree: PublicKey;
259
+ queue: PublicKey;
260
+ };
261
+ /**
262
+ * Get a pseudo-random active state tree info from the set of provided state
263
+ * tree infos.
264
+ *
265
+ * Using this mitigates write lock contention on state trees.
266
+ *
267
+ * @param infos Set of state tree infos
268
+ * @param treeType The type of tree. Defaults to `TreeType.StateV1`
269
+ * @param useMaxConcurrency If true, return all infos. If false, return at
270
+ * most {@link MAX_HOTSPOTS}. Defaults to `false`.
271
+ *
272
+ * @returns A pseudo-randomly selected tree info
273
+ */
274
+ declare function selectStateTreeInfo(infos: StateTreeInfo[], treeType?: TreeType, useMaxConcurrency?: boolean): StateTreeInfo;
275
+ /**
276
+ * Get active state tree infos from LUTs.
277
+ *
278
+ * @param connection The connection to the cluster
279
+ * @param stateTreeLUTPairs The state tree lookup table pairs
280
+ *
281
+ * @returns The active state tree infos
282
+ */
283
+ declare function getAllStateTreeInfos({ connection, stateTreeLUTPairs, }: {
284
+ connection: Connection;
285
+ stateTreeLUTPairs: StateTreeLUTPair[];
286
+ }): Promise<StateTreeInfo[]>;
287
+
123
288
  interface GnarkProofJson {
124
289
  ar: string[];
125
290
  bs: string[][];
@@ -135,9 +300,9 @@ declare const placeholderValidityProof: () => {
135
300
  b: number[];
136
301
  c: number[];
137
302
  };
138
- declare const checkValidityProofShape: (proof: CompressedProof) => void;
303
+ declare const checkValidityProofShape: (proof: ValidityProof) => void;
139
304
  declare function proofFromJsonStruct(json: GnarkProofJson): ProofABC;
140
- declare function negateAndCompressProof(proof: ProofABC): CompressedProof;
305
+ declare function negateAndCompressProof(proof: ProofABC): ValidityProof;
141
306
 
142
307
  /** pipe function */
143
308
  declare function pipe<T, R>(initialFunction: (arg: T) => R, ...functions: ((arg: R) => R)[]): (initialValue: T) => R;
@@ -195,30 +360,15 @@ declare function buildAndSignTx(instructions: TransactionInstruction[], payer: S
195
360
 
196
361
  declare function sleep(ms: number): Promise<void>;
197
362
 
198
- declare const validateSufficientBalance: (balance: BN) => void;
199
- declare const validateSameOwner: (compressedAccounts: CompressedAccount[] | CompressedAccountWithMerkleContext[]) => void;
200
- declare const validateNumbersForProof: (hashesLength: number, newAddressesLength: number) => void;
201
- declare const validateNumbersForInclusionProof: (hashesLength: number) => void;
202
- declare const validateNumbersForNonInclusionProof: (newAddressesLength: number) => void;
203
- declare const validateNumbers: (length: number, allowedNumbers: number[], type: string) => void;
204
-
205
- /**
206
- * @param targetLamports - Target priority fee in lamports
207
- * @param computeUnits - Expected compute units used by the transaction
208
- * @returns microLamports per compute unit (use in
209
- * `ComputeBudgetProgram.setComputeUnitPrice`)
210
- */
211
- declare function calculateComputeUnitPrice(targetLamports: number, computeUnits: number): number;
212
-
213
363
  /**
214
364
  * Create two lookup tables storing all public state tree and queue addresses
215
365
  * returns lookup table addresses and txId
216
366
  *
217
367
  * @internal
218
- * @param connection - Connection to the Solana network
219
- * @param payer - Keypair of the payer
220
- * @param authority - Keypair of the authority
221
- * @param recentSlot - Slot of the recent block
368
+ * @param connection Connection to the Solana network
369
+ * @param payer Keypair of the payer
370
+ * @param authority Keypair of the authority
371
+ * @param recentSlot Slot of the recent block
222
372
  */
223
373
  declare function createStateTreeLookupTable({ connection, payer, authority, recentSlot, }: {
224
374
  connection: Connection;
@@ -231,14 +381,15 @@ declare function createStateTreeLookupTable({ connection, payer, authority, rece
231
381
  }>;
232
382
  /**
233
383
  * Extend state tree lookup table with new state tree and queue addresses
384
+ *
234
385
  * @internal
235
- * @param connection - Connection to the Solana network
236
- * @param tableAddress - Address of the lookup table to extend
237
- * @param newStateTreeAddresses - Addresses of the new state trees to add
238
- * @param newQueueAddresses - Addresses of the new queues to add
239
- * @param newCpiContextAddresses - Addresses of the new cpi contexts to add
240
- * @param payer - Keypair of the payer
241
- * @param authority - Keypair of the authority
386
+ * @param connection Connection to the Solana network
387
+ * @param tableAddress Address of the lookup table to extend
388
+ * @param newStateTreeAddresses Addresses of the new state trees to add
389
+ * @param newQueueAddresses Addresses of the new queues to add
390
+ * @param newCpiContextAddresses Addresses of the new cpi contexts to add
391
+ * @param payer Keypair of the payer
392
+ * @param authority Keypair of the authority
242
393
  */
243
394
  declare function extendStateTreeLookupTable({ connection, tableAddress, newStateTreeAddresses, newQueueAddresses, newCpiContextAddresses, payer, authority, }: {
244
395
  connection: Connection;
@@ -255,60 +406,112 @@ declare function extendStateTreeLookupTable({ connection, tableAddress, newState
255
406
  /**
256
407
  * Adds state tree address to lookup table. Acts as nullifier lookup for rolled
257
408
  * over state trees.
409
+ *
258
410
  * @internal
259
- * @param connection - Connection to the Solana network
260
- * @param stateTreeAddress - Address of the state tree to nullify
261
- * @param nullifyTableAddress - Address of the nullifier lookup table to store
262
- * address in
263
- * @param stateTreeLookupTableAddress - lookup table storing all state tree
264
- * addresses
265
- * @param payer - Keypair of the payer
266
- * @param authority - Keypair of the authority
267
- */
268
- declare function nullifyLookupTable({ connection, fullStateTreeAddress, nullifyTableAddress, stateTreeLookupTableAddress, payer, authority, }: {
411
+ * @param connection Connection to the Solana network
412
+ * @param stateTreeAddress Address of the state tree to nullify
413
+ * @param nullifyLookupTableAddress Address of the nullifier lookup table to
414
+ * store address in
415
+ * @param stateTreeLookupTableAddress lookup table storing all state tree
416
+ * addresses
417
+ * @param payer Keypair of the payer
418
+ * @param authority Keypair of the authority
419
+ */
420
+ declare function nullifyLookupTable({ connection, fullStateTreeAddress, nullifyLookupTableAddress, stateTreeLookupTableAddress, payer, authority, }: {
269
421
  connection: Connection;
270
422
  fullStateTreeAddress: PublicKey;
271
- nullifyTableAddress: PublicKey;
423
+ nullifyLookupTableAddress: PublicKey;
272
424
  stateTreeLookupTableAddress: PublicKey;
273
425
  payer: Keypair;
274
426
  authority: Keypair;
275
427
  }): Promise<{
276
428
  txId: string;
277
429
  }>;
278
- /**
279
- * Get most recent , active state tree data
280
- * we store in lookup table for each public state tree
281
- */
282
- declare function getLightStateTreeInfo({ connection, stateTreeLookupTableAddress, nullifyTableAddress, }: {
283
- connection: Connection;
284
- stateTreeLookupTableAddress: PublicKey;
285
- nullifyTableAddress: PublicKey;
286
- }): Promise<ActiveTreeBundle[]>;
430
+
431
+ declare const validateSufficientBalance: (balance: BN) => void;
432
+ declare const validateSameOwner: (compressedAccounts: CompressedAccount[] | CompressedAccountWithMerkleContext[]) => void;
433
+ declare const validateNumbersForProof: (hashesLength: number, newAddressesLength: number) => void;
434
+ declare const validateNumbersForInclusionProof: (hashesLength: number) => void;
435
+ declare const validateNumbersForNonInclusionProof: (newAddressesLength: number) => void;
436
+ declare const validateNumbers: (length: number, allowedNumbers: number[], type: string) => void;
287
437
 
288
438
  declare enum TreeType {
289
439
  /**
290
440
  * v1 state merkle tree
291
441
  */
292
- State = 0,
442
+ StateV1 = 1,
293
443
  /**
294
444
  * v1 address merkle tree
295
445
  */
296
- Address = 1,
446
+ AddressV1 = 2,
297
447
  /**
298
448
  * v2 state merkle tree
299
449
  */
300
- BatchedState = 2,
450
+ StateV2 = 3,
301
451
  /**
302
452
  * v2 address merkle tree
303
453
  */
304
- BatchedAddress = 3
454
+ AddressV2 = 4
305
455
  }
456
+ /**
457
+ * @deprecated Use {@link StateTreeInfo} instead.
458
+ *
459
+ * A bundle of active trees for a given tree type.
460
+ */
306
461
  type ActiveTreeBundle = {
307
462
  tree: PublicKey;
308
463
  queue: PublicKey | null;
309
464
  cpiContext: PublicKey | null;
310
465
  treeType: TreeType;
311
466
  };
467
+ /**
468
+ * State tree info, versioned via {@link TreeType}. The protocol
469
+ * stores compressed accounts in state trees.
470
+ *
471
+ * Onchain Accounts are subject to Solana's write-lock limits.
472
+ *
473
+ * To load balance transactions, use {@link selectStateTreeInfo} to
474
+ * select a random tree from a range of active trees.
475
+ *
476
+ * Example:
477
+ * ```typescript
478
+ * const infos = await rpc.getStateTreeInfos();
479
+ * const info = selectStateTreeInfo(infos);
480
+ * const ix = await CompressedTokenProgram.compress({
481
+ * // ...
482
+ * outputStateTreeInfo: info
483
+ * });
484
+ * ```
485
+ */
486
+ type StateTreeInfo = {
487
+ /**
488
+ * Pubkey of the tree account.
489
+ */
490
+ tree: PublicKey;
491
+ /**
492
+ * Pubkey of the queue account associated with the tree.
493
+ */
494
+ queue: PublicKey;
495
+ /**
496
+ * The type of tree. One of {@link TreeType}.
497
+ */
498
+ treeType: TreeType;
499
+ /**
500
+ * Optional compressed cpi context account.
501
+ */
502
+ cpiContext?: PublicKey;
503
+ /**
504
+ * Optional next tree info if the tree is full.
505
+ */
506
+ nextTreeInfo: StateTreeInfo | null;
507
+ };
508
+ /**
509
+ * Address tree info, versioned via {@link TreeType}. The protocol
510
+ * stores PDAs in address trees.
511
+ */
512
+ type AddressTreeInfo = Omit<StateTreeInfo, 'cpiContext' | 'nextTreeInfo'> & {
513
+ nextTreeInfo: AddressTreeInfo | null;
514
+ };
312
515
  interface PackedCompressedAccountWithMerkleContext {
313
516
  compressedAccount: CompressedAccount;
314
517
  merkleContext: PackedMerkleContext;
@@ -330,22 +533,27 @@ interface QueueIndex {
330
533
  * compressed account.
331
534
  * */
332
535
  interface CompressedAccount {
333
- /** Public key of program or user that owns the account */
536
+ /**
537
+ * Public key of program or user owning the account.
538
+ */
334
539
  owner: PublicKey;
335
- /** Lamports attached to the account */
540
+ /**
541
+ * Lamports attached to the account.
542
+ */
336
543
  lamports: BN;
337
544
  /**
338
- * TODO: use PublicKey. Optional unique account ID that is persistent across
339
- * transactions.
545
+ * Optional unique account ID that is persistent across transactions.
340
546
  */
341
547
  address: number[] | null;
342
- /** Optional data attached to the account */
548
+ /**
549
+ * Optional data attached to the account.
550
+ */
343
551
  data: CompressedAccountData | null;
344
552
  }
345
553
  /**
346
554
  * Describe the generic compressed account details applicable to every
347
555
  * compressed account.
348
- * */
556
+ */
349
557
  interface OutputCompressedAccountWithPackedContext {
350
558
  compressedAccount: CompressedAccount;
351
559
  merkleTreeIndex: number;
@@ -372,7 +580,7 @@ interface PublicTransactionEvent {
372
580
  message: Uint8Array | null;
373
581
  }
374
582
  interface InstructionDataInvoke {
375
- proof: CompressedProof | null;
583
+ proof: ValidityProof | null;
376
584
  inputCompressedAccountsWithMerkleContext: PackedCompressedAccountWithMerkleContext[];
377
585
  outputCompressedAccounts: OutputCompressedAccountWithPackedContext[];
378
586
  relayFee: BN | null;
@@ -381,7 +589,7 @@ interface InstructionDataInvoke {
381
589
  isCompress: boolean;
382
590
  }
383
591
  interface InstructionDataInvokeCpi {
384
- proof: CompressedProof | null;
592
+ proof: ValidityProof | null;
385
593
  inputCompressedAccountsWithMerkleContext: PackedCompressedAccountWithMerkleContext[];
386
594
  outputCompressedAccounts: OutputCompressedAccountWithPackedContext[];
387
595
  relayFee: BN | null;
@@ -395,11 +603,28 @@ interface CompressedCpiContext {
395
603
  first_set_context: boolean;
396
604
  cpi_context_account_index: number;
397
605
  }
606
+ /**
607
+ * @deprecated Use {@link ValidityProof} instead.
608
+ */
398
609
  interface CompressedProof {
399
610
  a: number[];
400
611
  b: number[];
401
612
  c: number[];
402
613
  }
614
+ /**
615
+ * Validity proof.
616
+ *
617
+ * You can request proofs via `rpc.getValidityProof` or
618
+ * `rpc.getValidityProofV0`.
619
+ *
620
+ * One proof is 128 bytes large, and can prove the existence of N compressed
621
+ * accounts or the uniqueness of N PDAs.
622
+ */
623
+ interface ValidityProof {
624
+ a: number[];
625
+ b: number[];
626
+ c: number[];
627
+ }
403
628
  interface InputTokenDataWithContext {
404
629
  amount: BN;
405
630
  delegateIndex: number | null;
@@ -421,29 +646,69 @@ type CompressedAccountWithMerkleContext = CompressedAccount & MerkleContext & {
421
646
  readOnly: boolean;
422
647
  };
423
648
  /**
424
- * Context for compressed account inserted into a state Merkle tree
425
- * */
426
- type MerkleContext = {
427
- /** State Merkle tree */
649
+ * @deprecated use {@link MerkleContext} instead.
650
+ *
651
+ * Legacy MerkleContext
652
+ */
653
+ type MerkleContextLegacy = {
654
+ /**
655
+ * State tree
656
+ */
428
657
  merkleTree: PublicKey;
429
- /** The state nullfier queue belonging to merkleTree */
658
+ /**
659
+ * Nullifier queue
660
+ */
430
661
  nullifierQueue: PublicKey;
431
- /** Poseidon hash of the utxo preimage. Is a leaf in state merkle tree */
662
+ /**
663
+ * Poseidon hash of the account. Stored as leaf in state tree
664
+ */
432
665
  hash: number[];
433
- /** 'hash' position within the Merkle tree */
666
+ /**
667
+ * Position of `hash` in the State tree
668
+ */
434
669
  leafIndex: number;
435
670
  };
671
+ /**
672
+ * Context for compressed account stored in a state tree
673
+ */
674
+ type MerkleContext = {
675
+ /**
676
+ * Tree info
677
+ */
678
+ treeInfo: StateTreeInfo;
679
+ /**
680
+ * Poseidon hash of the account. Stored as leaf in state tree
681
+ */
682
+ hash: BN;
683
+ /**
684
+ * Position of `hash` in the State tree
685
+ */
686
+ leafIndex: number;
687
+ /**
688
+ * Whether the account can be proven by index or by merkle proof
689
+ */
690
+ proveByIndex: boolean;
691
+ };
692
+ /**
693
+ * MerkleContext with merkle proof
694
+ */
436
695
  type MerkleContextWithMerkleProof = MerkleContext & {
437
- /** Recent valid 'hash' proof path, expires after n slots */
696
+ /**
697
+ * Recent valid 'hash' proof path, expires after n slots
698
+ */
438
699
  merkleProof: BN254[];
439
- /** Index of state root the merkleproof is valid for, expires after n slots */
700
+ /**
701
+ * Index of state root the merkleproof is valid for, expires after n slots
702
+ */
440
703
  rootIndex: number;
441
- /** Current root */
704
+ /**
705
+ * Current root
706
+ */
442
707
  root: BN254;
443
708
  };
444
709
  declare const createCompressedAccount: (owner: PublicKey, lamports?: BN, data?: CompressedAccountData, address?: number[]) => CompressedAccount;
445
710
  declare const createCompressedAccountWithMerkleContext: (merkleContext: MerkleContext, owner: PublicKey, lamports?: BN, data?: CompressedAccountData, address?: number[]) => CompressedAccountWithMerkleContext;
446
- declare const createMerkleContext: (merkleTree: PublicKey, nullifierQueue: PublicKey, hash: number[], leafIndex: number) => MerkleContext;
711
+ declare const createMerkleContext: (treeInfo: StateTreeInfo, hash: BN254, leafIndex: number, proveByIndex?: boolean) => MerkleContext;
447
712
 
448
713
  interface LatestNonVotingSignatures {
449
714
  context: {
@@ -486,6 +751,19 @@ interface SignatureWithMetadata {
486
751
  signature: string;
487
752
  slot: number;
488
753
  }
754
+ /**
755
+ * Account hash and associated state tree info.
756
+ */
757
+ interface HashWithTreeInfo {
758
+ /**
759
+ * Account hash.
760
+ */
761
+ hash: BN254;
762
+ /**
763
+ * State tree info.
764
+ */
765
+ stateTreeInfo: StateTreeInfo;
766
+ }
489
767
  interface HashWithTree {
490
768
  hash: BN254;
491
769
  tree: PublicKey;
@@ -496,6 +774,23 @@ interface AddressWithTree {
496
774
  tree: PublicKey;
497
775
  queue: PublicKey;
498
776
  }
777
+ /**
778
+ * Address and associated address tree info.
779
+ */
780
+ interface AddressWithTreeInfo {
781
+ /**
782
+ * Address.
783
+ */
784
+ address: BN254;
785
+ /**
786
+ * Address tree info.
787
+ */
788
+ addressTreeInfo: AddressTreeInfo;
789
+ }
790
+ interface AddressWithTreeInfo {
791
+ address: BN254;
792
+ treeInfo: AddressTreeInfo;
793
+ }
499
794
  interface CompressedTransaction {
500
795
  compressionInfo: {
501
796
  closedAccounts: {
@@ -528,6 +823,41 @@ interface HexInputsForProver {
528
823
  pathElements: string[];
529
824
  leaf: string;
530
825
  }
826
+ /**
827
+ * Validity proof with context.
828
+ *
829
+ * You can request proofs via `rpc.getValidityProof` or
830
+ * `rpc.getValidityProofV0`.
831
+ */
832
+ type ValidityProofWithContext = {
833
+ /**
834
+ * Validity proof.
835
+ */
836
+ compressedProof: ValidityProof;
837
+ /**
838
+ * Roots.
839
+ */
840
+ roots: BN[];
841
+ /**
842
+ * Root indices.
843
+ */
844
+ rootIndices: number[];
845
+ /**
846
+ * Leaf indices.
847
+ */
848
+ leafIndices: number[];
849
+ /**
850
+ * Leaves.
851
+ */
852
+ leaves: BN[];
853
+ /**
854
+ * Tree infos.
855
+ */
856
+ treeInfos: StateTreeInfo[];
857
+ };
858
+ /**
859
+ * @deprecated use {@link ValidityProofWithContext} instead
860
+ */
531
861
  type CompressedProofWithContext = {
532
862
  compressedProof: CompressedProof;
533
863
  roots: BN[];
@@ -607,6 +937,7 @@ declare function jsonRpcResultAndContext<T, U>(value: Struct<T, U>): Struct<RpcR
607
937
  */
608
938
  declare const CompressedAccountResult: Struct<{
609
939
  lamports: BN;
940
+ tree: PublicKey;
610
941
  data: {
611
942
  data: string;
612
943
  dataHash: BN;
@@ -616,7 +947,6 @@ declare const CompressedAccountResult: Struct<{
616
947
  hash: BN;
617
948
  owner: PublicKey;
618
949
  leafIndex: number;
619
- tree: PublicKey;
620
950
  seq: BN | null;
621
951
  slotCreated: BN;
622
952
  }, {
@@ -664,6 +994,7 @@ declare const CompressedTokenAccountResult: Struct<{
664
994
  };
665
995
  account: {
666
996
  lamports: BN;
997
+ tree: PublicKey;
667
998
  data: {
668
999
  data: string;
669
1000
  dataHash: BN;
@@ -673,7 +1004,6 @@ declare const CompressedTokenAccountResult: Struct<{
673
1004
  hash: BN;
674
1005
  owner: PublicKey;
675
1006
  leafIndex: number;
676
- tree: PublicKey;
677
1007
  seq: BN | null;
678
1008
  slotCreated: BN;
679
1009
  };
@@ -693,6 +1023,7 @@ declare const CompressedTokenAccountResult: Struct<{
693
1023
  }>;
694
1024
  account: Struct<{
695
1025
  lamports: BN;
1026
+ tree: PublicKey;
696
1027
  data: {
697
1028
  data: string;
698
1029
  dataHash: BN;
@@ -702,7 +1033,6 @@ declare const CompressedTokenAccountResult: Struct<{
702
1033
  hash: BN;
703
1034
  owner: PublicKey;
704
1035
  leafIndex: number;
705
- tree: PublicKey;
706
1036
  seq: BN | null;
707
1037
  slotCreated: BN;
708
1038
  }, {
@@ -731,6 +1061,7 @@ declare const CompressedTokenAccountResult: Struct<{
731
1061
  declare const MultipleCompressedAccountsResult: Struct<{
732
1062
  items: {
733
1063
  lamports: BN;
1064
+ tree: PublicKey;
734
1065
  data: {
735
1066
  data: string;
736
1067
  dataHash: BN;
@@ -740,13 +1071,13 @@ declare const MultipleCompressedAccountsResult: Struct<{
740
1071
  hash: BN;
741
1072
  owner: PublicKey;
742
1073
  leafIndex: number;
743
- tree: PublicKey;
744
1074
  seq: BN | null;
745
1075
  slotCreated: BN;
746
1076
  }[];
747
1077
  }, {
748
1078
  items: Struct<{
749
1079
  lamports: BN;
1080
+ tree: PublicKey;
750
1081
  data: {
751
1082
  data: string;
752
1083
  dataHash: BN;
@@ -756,11 +1087,11 @@ declare const MultipleCompressedAccountsResult: Struct<{
756
1087
  hash: BN;
757
1088
  owner: PublicKey;
758
1089
  leafIndex: number;
759
- tree: PublicKey;
760
1090
  seq: BN | null;
761
1091
  slotCreated: BN;
762
1092
  }[], Struct<{
763
1093
  lamports: BN;
1094
+ tree: PublicKey;
764
1095
  data: {
765
1096
  data: string;
766
1097
  dataHash: BN;
@@ -770,7 +1101,6 @@ declare const MultipleCompressedAccountsResult: Struct<{
770
1101
  hash: BN;
771
1102
  owner: PublicKey;
772
1103
  leafIndex: number;
773
- tree: PublicKey;
774
1104
  seq: BN | null;
775
1105
  slotCreated: BN;
776
1106
  }, {
@@ -799,6 +1129,7 @@ declare const MultipleCompressedAccountsResult: Struct<{
799
1129
  declare const CompressedAccountsByOwnerResult: Struct<{
800
1130
  items: {
801
1131
  lamports: BN;
1132
+ tree: PublicKey;
802
1133
  data: {
803
1134
  data: string;
804
1135
  dataHash: BN;
@@ -808,7 +1139,6 @@ declare const CompressedAccountsByOwnerResult: Struct<{
808
1139
  hash: BN;
809
1140
  owner: PublicKey;
810
1141
  leafIndex: number;
811
- tree: PublicKey;
812
1142
  seq: BN | null;
813
1143
  slotCreated: BN;
814
1144
  }[];
@@ -816,6 +1146,7 @@ declare const CompressedAccountsByOwnerResult: Struct<{
816
1146
  }, {
817
1147
  items: Struct<{
818
1148
  lamports: BN;
1149
+ tree: PublicKey;
819
1150
  data: {
820
1151
  data: string;
821
1152
  dataHash: BN;
@@ -825,11 +1156,11 @@ declare const CompressedAccountsByOwnerResult: Struct<{
825
1156
  hash: BN;
826
1157
  owner: PublicKey;
827
1158
  leafIndex: number;
828
- tree: PublicKey;
829
1159
  seq: BN | null;
830
1160
  slotCreated: BN;
831
1161
  }[], Struct<{
832
1162
  lamports: BN;
1163
+ tree: PublicKey;
833
1164
  data: {
834
1165
  data: string;
835
1166
  dataHash: BN;
@@ -839,7 +1170,6 @@ declare const CompressedAccountsByOwnerResult: Struct<{
839
1170
  hash: BN;
840
1171
  owner: PublicKey;
841
1172
  leafIndex: number;
842
- tree: PublicKey;
843
1173
  seq: BN | null;
844
1174
  slotCreated: BN;
845
1175
  }, {
@@ -877,6 +1207,7 @@ declare const CompressedTokenAccountsByOwnerOrDelegateResult: Struct<{
877
1207
  };
878
1208
  account: {
879
1209
  lamports: BN;
1210
+ tree: PublicKey;
880
1211
  data: {
881
1212
  data: string;
882
1213
  dataHash: BN;
@@ -886,7 +1217,6 @@ declare const CompressedTokenAccountsByOwnerOrDelegateResult: Struct<{
886
1217
  hash: BN;
887
1218
  owner: PublicKey;
888
1219
  leafIndex: number;
889
- tree: PublicKey;
890
1220
  seq: BN | null;
891
1221
  slotCreated: BN;
892
1222
  };
@@ -903,6 +1233,7 @@ declare const CompressedTokenAccountsByOwnerOrDelegateResult: Struct<{
903
1233
  };
904
1234
  account: {
905
1235
  lamports: BN;
1236
+ tree: PublicKey;
906
1237
  data: {
907
1238
  data: string;
908
1239
  dataHash: BN;
@@ -912,7 +1243,6 @@ declare const CompressedTokenAccountsByOwnerOrDelegateResult: Struct<{
912
1243
  hash: BN;
913
1244
  owner: PublicKey;
914
1245
  leafIndex: number;
915
- tree: PublicKey;
916
1246
  seq: BN | null;
917
1247
  slotCreated: BN;
918
1248
  };
@@ -926,6 +1256,7 @@ declare const CompressedTokenAccountsByOwnerOrDelegateResult: Struct<{
926
1256
  };
927
1257
  account: {
928
1258
  lamports: BN;
1259
+ tree: PublicKey;
929
1260
  data: {
930
1261
  data: string;
931
1262
  dataHash: BN;
@@ -935,7 +1266,6 @@ declare const CompressedTokenAccountsByOwnerOrDelegateResult: Struct<{
935
1266
  hash: BN;
936
1267
  owner: PublicKey;
937
1268
  leafIndex: number;
938
- tree: PublicKey;
939
1269
  seq: BN | null;
940
1270
  slotCreated: BN;
941
1271
  };
@@ -955,6 +1285,7 @@ declare const CompressedTokenAccountsByOwnerOrDelegateResult: Struct<{
955
1285
  }>;
956
1286
  account: Struct<{
957
1287
  lamports: BN;
1288
+ tree: PublicKey;
958
1289
  data: {
959
1290
  data: string;
960
1291
  dataHash: BN;
@@ -964,7 +1295,6 @@ declare const CompressedTokenAccountsByOwnerOrDelegateResult: Struct<{
964
1295
  hash: BN;
965
1296
  owner: PublicKey;
966
1297
  leafIndex: number;
967
- tree: PublicKey;
968
1298
  seq: BN | null;
969
1299
  slotCreated: BN;
970
1300
  }, {
@@ -1280,6 +1610,7 @@ declare const CompressedTransactionResult: Struct<{
1280
1610
  closedAccounts: {
1281
1611
  account: {
1282
1612
  lamports: BN;
1613
+ tree: PublicKey;
1283
1614
  data: {
1284
1615
  data: string;
1285
1616
  dataHash: BN;
@@ -1289,7 +1620,6 @@ declare const CompressedTransactionResult: Struct<{
1289
1620
  hash: BN;
1290
1621
  owner: PublicKey;
1291
1622
  leafIndex: number;
1292
- tree: PublicKey;
1293
1623
  seq: BN | null;
1294
1624
  slotCreated: BN;
1295
1625
  };
@@ -1304,6 +1634,7 @@ declare const CompressedTransactionResult: Struct<{
1304
1634
  openedAccounts: {
1305
1635
  account: {
1306
1636
  lamports: BN;
1637
+ tree: PublicKey;
1307
1638
  data: {
1308
1639
  data: string;
1309
1640
  dataHash: BN;
@@ -1313,7 +1644,6 @@ declare const CompressedTransactionResult: Struct<{
1313
1644
  hash: BN;
1314
1645
  owner: PublicKey;
1315
1646
  leafIndex: number;
1316
- tree: PublicKey;
1317
1647
  seq: BN | null;
1318
1648
  slotCreated: BN;
1319
1649
  };
@@ -1332,6 +1662,7 @@ declare const CompressedTransactionResult: Struct<{
1332
1662
  closedAccounts: {
1333
1663
  account: {
1334
1664
  lamports: BN;
1665
+ tree: PublicKey;
1335
1666
  data: {
1336
1667
  data: string;
1337
1668
  dataHash: BN;
@@ -1341,7 +1672,6 @@ declare const CompressedTransactionResult: Struct<{
1341
1672
  hash: BN;
1342
1673
  owner: PublicKey;
1343
1674
  leafIndex: number;
1344
- tree: PublicKey;
1345
1675
  seq: BN | null;
1346
1676
  slotCreated: BN;
1347
1677
  };
@@ -1356,6 +1686,7 @@ declare const CompressedTransactionResult: Struct<{
1356
1686
  openedAccounts: {
1357
1687
  account: {
1358
1688
  lamports: BN;
1689
+ tree: PublicKey;
1359
1690
  data: {
1360
1691
  data: string;
1361
1692
  dataHash: BN;
@@ -1365,7 +1696,6 @@ declare const CompressedTransactionResult: Struct<{
1365
1696
  hash: BN;
1366
1697
  owner: PublicKey;
1367
1698
  leafIndex: number;
1368
- tree: PublicKey;
1369
1699
  seq: BN | null;
1370
1700
  slotCreated: BN;
1371
1701
  };
@@ -1381,6 +1711,7 @@ declare const CompressedTransactionResult: Struct<{
1381
1711
  closedAccounts: Struct<{
1382
1712
  account: {
1383
1713
  lamports: BN;
1714
+ tree: PublicKey;
1384
1715
  data: {
1385
1716
  data: string;
1386
1717
  dataHash: BN;
@@ -1390,7 +1721,6 @@ declare const CompressedTransactionResult: Struct<{
1390
1721
  hash: BN;
1391
1722
  owner: PublicKey;
1392
1723
  leafIndex: number;
1393
- tree: PublicKey;
1394
1724
  seq: BN | null;
1395
1725
  slotCreated: BN;
1396
1726
  };
@@ -1404,6 +1734,7 @@ declare const CompressedTransactionResult: Struct<{
1404
1734
  }[], Struct<{
1405
1735
  account: {
1406
1736
  lamports: BN;
1737
+ tree: PublicKey;
1407
1738
  data: {
1408
1739
  data: string;
1409
1740
  dataHash: BN;
@@ -1413,7 +1744,6 @@ declare const CompressedTransactionResult: Struct<{
1413
1744
  hash: BN;
1414
1745
  owner: PublicKey;
1415
1746
  leafIndex: number;
1416
- tree: PublicKey;
1417
1747
  seq: BN | null;
1418
1748
  slotCreated: BN;
1419
1749
  };
@@ -1427,6 +1757,7 @@ declare const CompressedTransactionResult: Struct<{
1427
1757
  }, {
1428
1758
  account: Struct<{
1429
1759
  lamports: BN;
1760
+ tree: PublicKey;
1430
1761
  data: {
1431
1762
  data: string;
1432
1763
  dataHash: BN;
@@ -1436,7 +1767,6 @@ declare const CompressedTransactionResult: Struct<{
1436
1767
  hash: BN;
1437
1768
  owner: PublicKey;
1438
1769
  leafIndex: number;
1439
- tree: PublicKey;
1440
1770
  seq: BN | null;
1441
1771
  slotCreated: BN;
1442
1772
  }, {
@@ -1475,6 +1805,7 @@ declare const CompressedTransactionResult: Struct<{
1475
1805
  openedAccounts: Struct<{
1476
1806
  account: {
1477
1807
  lamports: BN;
1808
+ tree: PublicKey;
1478
1809
  data: {
1479
1810
  data: string;
1480
1811
  dataHash: BN;
@@ -1484,7 +1815,6 @@ declare const CompressedTransactionResult: Struct<{
1484
1815
  hash: BN;
1485
1816
  owner: PublicKey;
1486
1817
  leafIndex: number;
1487
- tree: PublicKey;
1488
1818
  seq: BN | null;
1489
1819
  slotCreated: BN;
1490
1820
  };
@@ -1498,6 +1828,7 @@ declare const CompressedTransactionResult: Struct<{
1498
1828
  }[], Struct<{
1499
1829
  account: {
1500
1830
  lamports: BN;
1831
+ tree: PublicKey;
1501
1832
  data: {
1502
1833
  data: string;
1503
1834
  dataHash: BN;
@@ -1507,7 +1838,6 @@ declare const CompressedTransactionResult: Struct<{
1507
1838
  hash: BN;
1508
1839
  owner: PublicKey;
1509
1840
  leafIndex: number;
1510
- tree: PublicKey;
1511
1841
  seq: BN | null;
1512
1842
  slotCreated: BN;
1513
1843
  };
@@ -1521,6 +1851,7 @@ declare const CompressedTransactionResult: Struct<{
1521
1851
  }, {
1522
1852
  account: Struct<{
1523
1853
  lamports: BN;
1854
+ tree: PublicKey;
1524
1855
  data: {
1525
1856
  data: string;
1526
1857
  dataHash: BN;
@@ -1530,7 +1861,6 @@ declare const CompressedTransactionResult: Struct<{
1530
1861
  hash: BN;
1531
1862
  owner: PublicKey;
1532
1863
  leafIndex: number;
1533
- tree: PublicKey;
1534
1864
  seq: BN | null;
1535
1865
  slotCreated: BN;
1536
1866
  }, {
@@ -1576,9 +1906,9 @@ interface CompressionApiInterface {
1576
1906
  getCompressedAccountProof(hash: BN254): Promise<MerkleContextWithMerkleProof>;
1577
1907
  getMultipleCompressedAccounts(hashes: BN254[]): Promise<CompressedAccountWithMerkleContext[]>;
1578
1908
  getMultipleCompressedAccountProofs(hashes: BN254[]): Promise<MerkleContextWithMerkleProof[]>;
1579
- getValidityProof(hashes: BN254[], newAddresses: BN254[]): Promise<CompressedProofWithContext>;
1580
- getValidityProofV0(hashes: HashWithTree[], newAddresses: AddressWithTree[]): Promise<CompressedProofWithContext>;
1581
- getValidityProofAndRpcContext(hashes: HashWithTree[], newAddresses: AddressWithTree[]): Promise<WithContext<CompressedProofWithContext>>;
1909
+ getValidityProof(hashes: BN254[], newAddresses: BN254[]): Promise<ValidityProofWithContext>;
1910
+ getValidityProofV0(hashes: HashWithTree[], newAddresses: AddressWithTree[]): Promise<ValidityProofWithContext>;
1911
+ getValidityProofAndRpcContext(hashes: HashWithTree[], newAddresses: AddressWithTree[]): Promise<WithContext<ValidityProofWithContext>>;
1582
1912
  getCompressedAccountsByOwner(owner: PublicKey, config?: GetCompressedAccountsByOwnerConfig): Promise<WithCursor<CompressedAccountWithMerkleContext[]>>;
1583
1913
  getCompressedMintTokenHolders(mint: PublicKey, options?: PaginatedOptions): Promise<WithContext<WithCursor<CompressedMintTokenHolders[]>>>;
1584
1914
  getCompressedTokenAccountsByOwner(publicKey: PublicKey, options: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<ParsedTokenAccount[]>>;
@@ -1664,7 +1994,7 @@ interface LightWasm {
1664
1994
  * @param depth Depth of the merkle tree.
1665
1995
  * @param log Log proof generation time.
1666
1996
  */
1667
- declare function getTestRpc(lightWasm: LightWasm, endpoint?: string, compressionApiEndpoint?: string, proverEndpoint?: string, merkleTreeAddress?: PublicKey, nullifierQueueAddress?: PublicKey, depth?: number, log?: boolean): Promise<TestRpc>;
1997
+ declare function getTestRpc(lightWasm: LightWasm, endpoint?: string, compressionApiEndpoint?: string, proverEndpoint?: string, depth?: number, log?: boolean): Promise<TestRpc>;
1668
1998
  /**
1669
1999
  * Simple mock rpc for unit tests that simulates the compression rpc interface.
1670
2000
  * Fetches, parses events and builds merkletree on-demand, i.e. it does not persist state.
@@ -1677,14 +2007,13 @@ declare function getTestRpc(lightWasm: LightWasm, endpoint?: string, compression
1677
2007
  declare class TestRpc extends Connection implements CompressionApiInterface {
1678
2008
  compressionApiEndpoint: string;
1679
2009
  proverEndpoint: string;
1680
- merkleTreeAddress: PublicKey;
1681
- nullifierQueueAddress: PublicKey;
1682
- addressTreeAddress: PublicKey;
1683
- addressQueueAddress: PublicKey;
1684
2010
  lightWasm: LightWasm;
1685
2011
  depth: number;
1686
2012
  log: boolean;
1687
- activeStateTreeInfo: ActiveTreeBundle[] | null;
2013
+ allStateTreeInfos: StateTreeInfo[] | null;
2014
+ lastStateTreeFetchTime: number | null;
2015
+ fetchPromise: Promise<StateTreeInfo[]> | null;
2016
+ CACHE_TTL: number;
1688
2017
  /**
1689
2018
  * Establish a Compression-compatible JSON RPC mock-connection
1690
2019
  *
@@ -1699,17 +2028,14 @@ declare class TestRpc extends Connection implements CompressionApiInterface {
1699
2028
  */
1700
2029
  constructor(endpoint: string, hasher: LightWasm, compressionApiEndpoint: string, proverEndpoint: string, connectionConfig?: ConnectionConfig, testRpcConfig?: TestRpcConfig);
1701
2030
  /**
1702
- * Manually set state tree addresses
1703
- */
1704
- setStateTreeInfo(info: ActiveTreeBundle[]): void;
1705
- /**
1706
- * Returns local test state trees.
2031
+ * @deprecated Use {@link getStateTreeInfos} instead
1707
2032
  */
1708
- getCachedActiveStateTreeInfo(): Promise<ActiveTreeBundle[]>;
2033
+ getCachedActiveStateTreeInfos(): Promise<void>;
1709
2034
  /**
1710
2035
  * Returns local test state trees.
1711
2036
  */
1712
- getLatestActiveStateTreeInfo(): Promise<ActiveTreeBundle[]>;
2037
+ getStateTreeInfos(): Promise<StateTreeInfo[]>;
2038
+ doFetch(): Promise<StateTreeInfo[]>;
1713
2039
  /**
1714
2040
  * Fetch the compressed account for the specified account hash
1715
2041
  */
@@ -1847,12 +2173,12 @@ declare class TestRpc extends Connection implements CompressionApiInterface {
1847
2173
  * Note: Use RPC class for forested trees. TestRpc is only for custom
1848
2174
  * testing purposes.
1849
2175
  */
1850
- getValidityProofDirect(hashes?: BN254[], newAddresses?: BN254[]): Promise<CompressedProofWithContext>;
2176
+ getValidityProofDirect(hashes?: BN254[], newAddresses?: BN254[]): Promise<ValidityProofWithContext>;
1851
2177
  /**
1852
2178
  * @deprecated This method is not available for TestRpc. Please use
1853
2179
  * {@link getValidityProof} instead.
1854
2180
  */
1855
- getValidityProofAndRpcContext(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<WithContext<CompressedProofWithContext>>;
2181
+ getValidityProofAndRpcContext(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<WithContext<ValidityProofWithContext>>;
1856
2182
  /**
1857
2183
  * Fetch the latest validity proof for (1) compressed accounts specified by
1858
2184
  * an array of account hashes. (2) new unique addresses specified by an
@@ -1867,8 +2193,8 @@ declare class TestRpc extends Connection implements CompressionApiInterface {
1867
2193
  * @param newAddresses Array of BN254 new addresses.
1868
2194
  * @returns validity proof with context
1869
2195
  */
1870
- getValidityProof(hashes?: BN254[], newAddresses?: BN254[]): Promise<CompressedProofWithContext>;
1871
- getValidityProofV0(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<CompressedProofWithContext>;
2196
+ getValidityProof(hashes?: BN254[], newAddresses?: BN254[]): Promise<ValidityProofWithContext>;
2197
+ getValidityProofV0(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<ValidityProofWithContext>;
1872
2198
  }
1873
2199
 
1874
2200
  declare class IndexedElement {
@@ -2086,7 +2412,7 @@ declare function parseTokenLayoutWithIdl(compressedAccount: CompressedAccount, p
2086
2412
  * @param owner PublicKey of the token owner
2087
2413
  * @param mint PublicKey of the token mint
2088
2414
  */
2089
- declare function getCompressedTokenAccounts(events: PublicTransactionEvent[]): Promise<ParsedTokenAccount[]>;
2415
+ declare function getCompressedTokenAccounts(events: PublicTransactionEvent[], rpc: Rpc): Promise<ParsedTokenAccount[]>;
2090
2416
  /** @internal */
2091
2417
  declare function getCompressedTokenAccountsByOwnerTest(rpc: Rpc, owner: PublicKey, mint: PublicKey): Promise<WithCursor<ParsedTokenAccount[]>>;
2092
2418
  declare function getCompressedTokenAccountsByDelegateTest(rpc: Rpc, delegate: PublicKey, mint: PublicKey): Promise<WithCursor<ParsedTokenAccount[]>>;
@@ -2152,7 +2478,7 @@ declare function wrapBigNumbersAsStrings(text: string): string;
2152
2478
  /** @internal */
2153
2479
  declare const rpcRequest: (rpcEndpoint: string, method: string, params?: any, convertToCamelCase?: boolean, debug?: boolean) => Promise<any>;
2154
2480
  /** @internal */
2155
- declare const proverRequest: (proverEndpoint: string, method: "inclusion" | "new-address" | "combined", params?: any, log?: boolean, publicInputHash?: BN | undefined) => Promise<CompressedProof>;
2481
+ declare const proverRequest: (proverEndpoint: string, method: "inclusion" | "new-address" | "combined", params?: any, log?: boolean, publicInputHash?: BN | undefined) => Promise<ValidityProof>;
2156
2482
  type NonInclusionMerkleProofInputs = {
2157
2483
  root: BN;
2158
2484
  value: BN;
@@ -2171,8 +2497,7 @@ type MerkleContextWithNewAddressProof = {
2171
2497
  nextIndex: BN;
2172
2498
  merkleProofHashedIndexedElementLeaf: BN[];
2173
2499
  indexHashedIndexedElementLeaf: BN;
2174
- merkleTree: PublicKey;
2175
- nullifierQueue: PublicKey;
2500
+ treeInfo: AddressTreeInfo;
2176
2501
  };
2177
2502
  type NonInclusionJsonStruct = {
2178
2503
  root: string;
@@ -2186,14 +2511,6 @@ type NonInclusionJsonStruct = {
2186
2511
  declare function convertMerkleProofsWithContextToHex(merkleProofsWithContext: MerkleContextWithMerkleProof[]): HexInputsForProver[];
2187
2512
  declare function convertNonInclusionMerkleProofInputsToHex(nonInclusionMerkleProofInputs: MerkleContextWithNewAddressProof[]): NonInclusionJsonStruct[];
2188
2513
  declare function getPublicInputHash(accountProofs: MerkleContextWithMerkleProof[], accountHashes: BN254[], newAddressProofs: MerkleContextWithNewAddressProof[], lightWasm: LightWasm): BN;
2189
- /**
2190
- * Get the queue for a given tree
2191
- *
2192
- * @param info - The active state tree addresses
2193
- * @param tree - The tree to get the queue for
2194
- * @returns The queue for the given tree, or undefined if not found
2195
- */
2196
- declare function getQueueForTree(info: ActiveTreeBundle[], tree: PublicKey): PublicKey;
2197
2514
  /**
2198
2515
  * Get the tree for a given queue
2199
2516
  *
@@ -2201,40 +2518,31 @@ declare function getQueueForTree(info: ActiveTreeBundle[], tree: PublicKey): Pub
2201
2518
  * @param queue - The queue to get the tree for
2202
2519
  * @returns The tree for the given queue, or undefined if not found
2203
2520
  */
2204
- declare function getTreeForQueue(info: ActiveTreeBundle[], queue: PublicKey): PublicKey;
2205
- /**
2206
- * Get a random tree and queue from the active state tree addresses.
2207
- *
2208
- * Prevents write lock contention on state trees.
2209
- *
2210
- * @param info - The active state tree addresses
2211
- * @returns A random tree and queue
2212
- */
2213
- declare function pickRandomTreeAndQueue(info: ActiveTreeBundle[]): {
2214
- tree: PublicKey;
2215
- queue: PublicKey;
2216
- };
2521
+ declare function getTreeForQueue(info: StateTreeInfo[], queue: PublicKey): PublicKey;
2217
2522
  /**
2218
2523
  *
2219
2524
  */
2220
2525
  declare class Rpc extends Connection implements CompressionApiInterface {
2221
2526
  compressionApiEndpoint: string;
2222
2527
  proverEndpoint: string;
2223
- activeStateTreeInfo: ActiveTreeBundle[] | null;
2528
+ allStateTreeInfos: StateTreeInfo[] | null;
2529
+ lastStateTreeFetchTime: number | null;
2530
+ CACHE_TTL: number;
2531
+ fetchPromise: Promise<StateTreeInfo[]> | null;
2224
2532
  constructor(endpoint: string, compressionApiEndpoint: string, proverEndpoint: string, config?: ConnectionConfig);
2225
2533
  /**
2226
- * Manually set state tree addresses
2534
+ * @deprecated Use {@link getStateTreeInfos} instead
2227
2535
  */
2228
- setStateTreeInfo(info: ActiveTreeBundle[]): void;
2536
+ getCachedActiveStateTreeInfos(): Promise<void>;
2229
2537
  /**
2230
- * Get the active state tree addresses from the cluster.
2231
- * If not already cached, fetches from the cluster.
2538
+ * Get a list of all state tree infos. If not already cached, fetches from
2539
+ * the cluster.
2232
2540
  */
2233
- getCachedActiveStateTreeInfo(): Promise<ActiveTreeBundle[]>;
2541
+ getStateTreeInfos(): Promise<StateTreeInfo[]>;
2234
2542
  /**
2235
- * Fetch the latest state tree addresses from the cluster.
2543
+ * @internal
2236
2544
  */
2237
- getLatestActiveStateTreeInfo(): Promise<ActiveTreeBundle[]>;
2545
+ doFetch(): Promise<StateTreeInfo[]>;
2238
2546
  /**
2239
2547
  * Fetch the compressed account for the specified account address or hash
2240
2548
  */
@@ -2382,12 +2690,10 @@ declare class Rpc extends Connection implements CompressionApiInterface {
2382
2690
  * @param newAddresses Array of BN254 new addresses.
2383
2691
  * @returns validity proof with context
2384
2692
  */
2385
- getValidityProofDirect(hashes?: BN254[], newAddresses?: BN254[]): Promise<CompressedProofWithContext>;
2693
+ getValidityProofDirect(hashes?: BN254[], newAddresses?: BN254[]): Promise<ValidityProofWithContext>;
2386
2694
  /**
2387
2695
  * @deprecated use {@link getValidityProofV0} instead.
2388
2696
  *
2389
- *
2390
- *
2391
2697
  * Fetch the latest validity proof for (1) compressed accounts specified by
2392
2698
  * an array of account hashes. (2) new unique addresses specified by an
2393
2699
  * array of addresses.
@@ -2401,7 +2707,7 @@ declare class Rpc extends Connection implements CompressionApiInterface {
2401
2707
  * @param newAddresses Array of BN254 new addresses.
2402
2708
  * @returns validity proof with context
2403
2709
  */
2404
- getValidityProof(hashes?: BN254[], newAddresses?: BN254[]): Promise<CompressedProofWithContext>;
2710
+ getValidityProof(hashes?: BN254[], newAddresses?: BN254[]): Promise<ValidityProofWithContext>;
2405
2711
  /**
2406
2712
  * Fetch the latest validity proof for (1) compressed accounts specified by
2407
2713
  * an array of account hashes. (2) new unique addresses specified by an
@@ -2416,7 +2722,7 @@ declare class Rpc extends Connection implements CompressionApiInterface {
2416
2722
  * @param newAddresses Array of { address: BN254, tree: PublicKey, queue: PublicKey }.
2417
2723
  * @returns validity proof with context
2418
2724
  */
2419
- getValidityProofV0(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<CompressedProofWithContext>;
2725
+ getValidityProofV0(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<ValidityProofWithContext>;
2420
2726
  /**
2421
2727
  * Fetch the latest validity proof for (1) compressed accounts specified by
2422
2728
  * an array of account hashes. (2) new unique addresses specified by an
@@ -2433,96 +2739,85 @@ declare class Rpc extends Connection implements CompressionApiInterface {
2433
2739
  * state tree/queue.
2434
2740
  * @returns validity proof with context
2435
2741
  */
2436
- getValidityProofAndRpcContext(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<WithContext<CompressedProofWithContext>>;
2742
+ getValidityProofAndRpcContext(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<WithContext<ValidityProofWithContext>>;
2437
2743
  }
2438
2744
 
2439
2745
  /**
2440
2746
  * Compress lamports to a solana address
2441
2747
  *
2442
- * @param rpc RPC to use
2443
- * @param payer Payer of the transaction and initialization fees
2444
- * @param lamports Amount of lamports to compress
2445
- * @param toAddress Address of the recipient compressed account
2446
- * @param outputStateTree Optional output state tree. Defaults to a current shared state tree.
2447
- * @param confirmOptions Options for confirming the transaction
2748
+ * @param rpc RPC to use
2749
+ * @param payer Payer of the transaction and initialization fees
2750
+ * @param lamports Amount of lamports to compress
2751
+ * @param toAddress Address of the recipient compressed account
2752
+ * @param outputStateTreeInfo Optional output state tree. If not provided,
2753
+ * fetches a random active state tree.
2754
+ * @param confirmOptions Options for confirming the transaction
2448
2755
  *
2449
2756
  * @return Transaction signature
2450
2757
  */
2451
- declare function compress(rpc: Rpc, payer: Signer, lamports: number | BN, toAddress: PublicKey, outputStateTree?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2758
+ declare function compress(rpc: Rpc, payer: Signer, lamports: number | BN, toAddress: PublicKey, outputStateTreeInfo?: StateTreeInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2452
2759
 
2453
2760
  /**
2454
2761
  * Create compressed account with address
2455
2762
  *
2456
- * @param rpc RPC to use
2457
- * @param payer Payer of the transaction and initialization fees
2458
- * @param seeds Seeds to derive the new account address
2459
- * @param programId Owner of the new account
2460
- * @param addressTree Optional address tree. Defaults to a current shared
2461
- * address tree.
2462
- * @param addressQueue Optional address queue. Defaults to a current shared
2463
- * address queue.
2464
- * @param outputStateTree Optional output state tree. Defaults to a current
2465
- * shared state tree.
2466
- * @param confirmOptions Options for confirming the transaction
2763
+ * @param rpc RPC to use
2764
+ * @param payer Payer of the transaction and initialization fees
2765
+ * @param seeds Seeds to derive the new account address
2766
+ * @param programId Owner of the new account
2767
+ * @param addressTreeInfo Optional address tree info. Defaults to a current
2768
+ * shared address tree.
2769
+ * @param outputStateTreeInfo Optional output state tree. Defaults to fetching
2770
+ * a current shared state tree.
2771
+ * @param confirmOptions Options for confirming the transaction
2467
2772
  *
2468
- * @return Transaction signature
2773
+ * @return Transaction signature
2469
2774
  */
2470
- declare function createAccount(rpc: Rpc, payer: Signer, seeds: Uint8Array[], programId: PublicKey, addressTree?: PublicKey, addressQueue?: PublicKey, outputStateTree?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2775
+ declare function createAccount(rpc: Rpc, payer: Signer, seeds: Uint8Array[], programId: PublicKey, addressTreeInfo?: AddressTreeInfo, outputStateTreeInfo?: StateTreeInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2471
2776
  /**
2472
2777
  * Create compressed account with address and lamports
2473
2778
  *
2474
- * @param rpc RPC to use
2475
- * @param payer Payer of the transaction and initialization fees
2476
- * @param seeds Seeds to derive the new account address
2477
- * @param lamports Number of compressed lamports to initialize the
2478
- * account with
2479
- * @param programId Owner of the new account
2480
- * @param addressTree Optional address tree. Defaults to a current shared
2481
- * address tree.
2482
- * @param addressQueue Optional address queue. Defaults to a current shared
2483
- * address queue.
2484
- * @param outputStateTree Optional output state tree. Defaults to a current
2485
- * shared state tree.
2486
- * @param confirmOptions Options for confirming the transaction
2779
+ * @param rpc RPC to use
2780
+ * @param payer Payer of the transaction and initialization fees
2781
+ * @param seeds Seeds to derive the new account address
2782
+ * @param lamports Number of compressed lamports to initialize the
2783
+ * account with
2784
+ * @param programId Owner of the new account
2785
+ * @param addressTreeInfo Optional address tree info. Defaults to a
2786
+ * current shared address tree.
2787
+ * @param outputStateTreeInfo Optional output state tree. Defaults to a
2788
+ * current shared state tree.
2789
+ * @param confirmOptions Options for confirming the transaction
2487
2790
  *
2488
- * @return Transaction signature
2791
+ * @return Transaction signature
2489
2792
  */
2490
- declare function createAccountWithLamports(rpc: Rpc, payer: Signer, seeds: Uint8Array[], lamports: number | BN, programId: PublicKey, addressTree?: PublicKey, addressQueue?: PublicKey, outputStateTree?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2793
+ declare function createAccountWithLamports(rpc: Rpc, payer: Signer, seeds: Uint8Array[], lamports: number | BN, programId: PublicKey, addressTreeInfo?: AddressTreeInfo, outputStateTreeInfo?: StateTreeInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2491
2794
 
2492
2795
  /**
2493
2796
  * Decompress lamports into a solana account
2494
2797
  *
2495
- * @param rpc RPC to use
2496
- * @param payer Payer of the transaction and initialization fees
2497
- * @param lamports Amount of lamports to compress
2498
- * @param toAddress Address of the recipient compressed account
2499
- * @param outputStateTree Optional output state tree. Defaults to a current shared state tree.
2500
- * @param confirmOptions Options for confirming the transaction
2798
+ * @param rpc RPC to use
2799
+ * @param payer Payer of the transaction and initialization fees
2800
+ * @param lamports Amount of lamports to compress
2801
+ * @param toAddress Address of the recipient compressed account
2802
+ * @param confirmOptions Options for confirming the transaction
2501
2803
  *
2502
2804
  * @return Transaction signature
2503
2805
  */
2504
- declare function decompress(rpc: Rpc, payer: Signer, lamports: number | BN, recipient: PublicKey, outputStateTree?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2505
-
2506
- /** @internal remove signer from signers if part of signers */
2507
- declare function dedupeSigner(signer: Signer, signers: Signer[]): Signer[];
2806
+ declare function decompress(rpc: Rpc, payer: Signer, lamports: number | BN, recipient: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2508
2807
 
2509
2808
  /**
2510
2809
  * Transfer compressed lamports from one owner to another
2511
2810
  *
2512
- * @param rpc Rpc to use
2513
- * @param payer Payer of transaction fees
2514
- * @param lamports Number of lamports to transfer
2515
- * @param owner Owner of the compressed lamports
2516
- * @param toAddress Destination address of the recipient
2517
- * @param merkleTree State tree account that the compressed lamports should be
2518
- * inserted into. Defaults to the default state tree account.
2519
- * @param confirmOptions Options for confirming the transaction
2520
- * @param config Configuration for fetching compressed accounts
2521
- *
2811
+ * @param rpc Rpc to use
2812
+ * @param payer Payer of transaction fees
2813
+ * @param lamports Number of lamports to transfer
2814
+ * @param owner Owner of the compressed lamports
2815
+ * @param toAddress Destination address of the recipient
2816
+ * @param confirmOptions Options for confirming the transaction
2522
2817
  *
2523
2818
  * @return Signature of the confirmed transaction
2524
2819
  */
2525
- declare function transfer(rpc: Rpc, payer: Signer, lamports: number | BN, owner: Signer, toAddress: PublicKey, merkleTree?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2820
+ declare function transfer(rpc: Rpc, payer: Signer, lamports: number | BN, owner: Signer, toAddress: PublicKey, outputStateTreeInfo?: StateTreeInfo, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
2526
2821
 
2527
2822
  /**
2528
2823
  * @internal Finds the index of a PublicKey in an array, or adds it if not
@@ -2533,19 +2828,19 @@ declare function getIndexOrAdd(accountsArray: PublicKey[], key: PublicKey): numb
2533
2828
  * @internal
2534
2829
  * Pads output state trees with the 0th state tree of the input state.
2535
2830
  *
2536
- * @param outputStateMerkleTrees Optional output state trees to be
2537
- * inserted into the output state.
2538
- * Defaults to the 0th state tree of
2539
- * the input state. Gets padded to the
2540
- * length of outputCompressedAccounts.
2541
- * @param numberOfOutputCompressedAccounts The number of output compressed
2542
- * accounts.
2543
- * @param inputCompressedAccountsWithMerkleContext The input compressed accounts
2544
- * with merkle context.
2831
+ * @param outputStateMerkleTrees Optional output state trees
2832
+ * to be inserted into the
2833
+ * output state. Defaults to
2834
+ * the 0th state tree of the
2835
+ * input state. Gets padded to
2836
+ * the length of
2837
+ * outputCompressedAccounts.
2838
+ * @param numberOfOutputCompressedAccounts The number of output
2839
+ * compressed accounts.
2545
2840
  *
2546
2841
  * @returns Padded output state trees.
2547
2842
  */
2548
- declare function padOutputStateMerkleTrees(outputStateMerkleTrees: PublicKey[] | PublicKey | undefined, numberOfOutputCompressedAccounts: number, inputCompressedAccountsWithMerkleContext: CompressedAccountWithMerkleContext[]): PublicKey[];
2843
+ declare function padOutputStateMerkleTrees(outputStateMerkleTrees: PublicKey, numberOfOutputCompressedAccounts: number): PublicKey[];
2549
2844
  declare function toAccountMetas(remainingAccounts: PublicKey[]): AccountMeta[];
2550
2845
  /**
2551
2846
  * Packs Compressed Accounts.
@@ -2558,16 +2853,14 @@ declare function toAccountMetas(remainingAccounts: PublicKey[]): AccountMeta[];
2558
2853
  * input state. The expiry is tied to
2559
2854
  * the proof.
2560
2855
  * @param outputCompressedAccounts Ix output state to be created
2561
- * @param outputStateMerkleTrees Optional output state trees to be
2562
- * inserted into the output state.
2563
- * Defaults to the 0th state tree of
2564
- * the input state. Gets padded to the
2565
- * length of outputCompressedAccounts.
2856
+ * @param outputStateTreeInfo The output state tree info. Gets
2857
+ * padded to the length of
2858
+ * outputCompressedAccounts.
2566
2859
  *
2567
2860
  * @param remainingAccounts Optional existing array of accounts
2568
2861
  * to append to.
2569
2862
  **/
2570
- declare function packCompressedAccounts(inputCompressedAccounts: CompressedAccountWithMerkleContext[], inputStateRootIndices: number[], outputCompressedAccounts: CompressedAccount[], outputStateMerkleTrees?: PublicKey[] | PublicKey, remainingAccounts?: PublicKey[]): {
2863
+ declare function packCompressedAccounts(inputCompressedAccounts: CompressedAccountWithMerkleContext[], inputStateRootIndices: number[], outputCompressedAccounts: CompressedAccount[], outputStateTreeInfo?: StateTreeInfo, remainingAccounts?: PublicKey[]): {
2571
2864
  packedInputCompressedAccounts: PackedCompressedAccountWithMerkleContext[];
2572
2865
  packedOutputCompressedAccounts: OutputCompressedAccountWithPackedContext[];
2573
2866
  remainingAccounts: PublicKey[];
@@ -2583,21 +2876,24 @@ type CreateAccountWithSeedParams = {
2583
2876
  */
2584
2877
  payer: PublicKey;
2585
2878
  /**
2586
- * Address params for the new compressed account
2879
+ * Address params for the new compressed account.
2587
2880
  */
2588
2881
  newAddressParams: NewAddressParams;
2882
+ /**
2883
+ * Address of the new compressed account
2884
+ */
2589
2885
  newAddress: number[];
2590
2886
  /**
2591
2887
  * Recent validity proof proving that there's no existing compressed account
2592
2888
  * registered with newAccountAddress
2593
2889
  */
2594
- recentValidityProof: CompressedProof;
2890
+ recentValidityProof: ValidityProof;
2595
2891
  /**
2596
2892
  * State tree pubkey. Defaults to a public state tree if unspecified.
2597
2893
  */
2598
- outputStateTree?: PublicKey;
2894
+ outputStateTreeInfo?: StateTreeInfo;
2599
2895
  /**
2600
- * Public key of the program to assign as the owner of the created account
2896
+ * Public key of the program to assign as the owner of the created account.
2601
2897
  */
2602
2898
  programId?: PublicKey;
2603
2899
  /**
@@ -2628,11 +2924,11 @@ type TransferParams = {
2628
2924
  */
2629
2925
  inputCompressedAccounts: CompressedAccountWithMerkleContext[];
2630
2926
  /**
2631
- * Recipient address
2927
+ * Recipient address.
2632
2928
  */
2633
2929
  toAddress: PublicKey;
2634
2930
  /**
2635
- * amount of lamports to transfer.
2931
+ * Amount of lamports to transfer.
2636
2932
  */
2637
2933
  lamports: number | BN;
2638
2934
  /**
@@ -2646,13 +2942,7 @@ type TransferParams = {
2646
2942
  * The recent validity proof for state inclusion of the input state. It
2647
2943
  * expires after n slots.
2648
2944
  */
2649
- recentValidityProof: CompressedProof;
2650
- /**
2651
- * The state trees that the tx output should be inserted into. This can be a
2652
- * single PublicKey or an array of PublicKey. Defaults to the 0th state tree
2653
- * of input state.
2654
- */
2655
- outputStateTrees?: PublicKey[] | PublicKey;
2945
+ recentValidityProof: ValidityProof;
2656
2946
  };
2657
2947
  /**
2658
2948
  * Defines the parameters for the transfer method
@@ -2674,7 +2964,7 @@ type CompressParams = {
2674
2964
  * The state tree that the tx output should be inserted into. Defaults to a
2675
2965
  * public state tree if unspecified.
2676
2966
  */
2677
- outputStateTree?: PublicKey;
2967
+ outputStateTreeInfo: StateTreeInfo;
2678
2968
  };
2679
2969
  /**
2680
2970
  * Defines the parameters for the transfer method
@@ -2707,13 +2997,7 @@ type DecompressParams = {
2707
2997
  * The recent validity proof for state inclusion of the input state. It
2708
2998
  * expires after n slots.
2709
2999
  */
2710
- recentValidityProof: CompressedProof;
2711
- /**
2712
- * The state trees that the tx output should be inserted into. This can be a
2713
- * single PublicKey or an array of PublicKey. Defaults to the 0th state tree
2714
- * of input state.
2715
- */
2716
- outputStateTree?: PublicKey;
3000
+ recentValidityProof: ValidityProof;
2717
3001
  };
2718
3002
  declare class LightSystemProgram$1 {
2719
3003
  /**
@@ -2721,7 +3005,7 @@ declare class LightSystemProgram$1 {
2721
3005
  */
2722
3006
  constructor();
2723
3007
  /**
2724
- * Public key that identifies the CompressedPda program
3008
+ * The LightSystemProgram program ID.
2725
3009
  */
2726
3010
  static programId: PublicKey;
2727
3011
  /**
@@ -2742,22 +3026,22 @@ declare class LightSystemProgram$1 {
2742
3026
  *
2743
3027
  * TODO: support transfer of lamports to the new account.
2744
3028
  */
2745
- static createAccount({ payer, newAddressParams, newAddress, recentValidityProof, outputStateTree, inputCompressedAccounts, inputStateRootIndices, lamports, }: CreateAccountWithSeedParams): Promise<TransactionInstruction>;
3029
+ static createAccount({ payer, newAddressParams, newAddress, recentValidityProof, outputStateTreeInfo, inputCompressedAccounts, inputStateRootIndices, lamports, }: CreateAccountWithSeedParams): Promise<TransactionInstruction>;
2746
3030
  /**
2747
3031
  * Creates a transaction instruction that transfers compressed lamports from
2748
3032
  * one owner to another.
2749
3033
  */
2750
- static transfer({ payer, inputCompressedAccounts, toAddress, lamports, recentInputStateRootIndices, recentValidityProof, outputStateTrees, }: TransferParams): Promise<TransactionInstruction>;
3034
+ static transfer({ payer, inputCompressedAccounts, toAddress, lamports, recentInputStateRootIndices, recentValidityProof, }: TransferParams): Promise<TransactionInstruction>;
2751
3035
  /**
2752
3036
  * Creates a transaction instruction that transfers compressed lamports from
2753
3037
  * one owner to another.
2754
3038
  */
2755
- static compress({ payer, toAddress, lamports, outputStateTree, }: CompressParams): Promise<TransactionInstruction>;
3039
+ static compress({ payer, toAddress, lamports, outputStateTreeInfo, }: CompressParams): Promise<TransactionInstruction>;
2756
3040
  /**
2757
3041
  * Creates a transaction instruction that transfers compressed lamports from
2758
3042
  * one owner to another.
2759
3043
  */
2760
- static decompress({ payer, inputCompressedAccounts, toAddress, lamports, recentInputStateRootIndices, recentValidityProof, outputStateTree, }: DecompressParams): Promise<TransactionInstruction>;
3044
+ static decompress({ payer, inputCompressedAccounts, toAddress, lamports, recentInputStateRootIndices, recentValidityProof, }: DecompressParams): Promise<TransactionInstruction>;
2761
3045
  }
2762
3046
  /**
2763
3047
  * Selects the minimal number of compressed SOL accounts for a transfer.
@@ -2777,14 +3061,41 @@ declare const InstructionDataInvokeCpiLayout: Layout<InstructionDataInvokeCpi>;
2777
3061
  declare function decodeInstructionDataInvoke(buffer: Buffer$1): InstructionDataInvoke;
2778
3062
  declare function decodeInstructionDataInvokeCpi(buffer: Buffer$1): InstructionDataInvokeCpi;
2779
3063
  type invokeAccountsLayoutParams = {
3064
+ /**
3065
+ * Fee payer.
3066
+ */
2780
3067
  feePayer: PublicKey;
3068
+ /**
3069
+ * Authority.
3070
+ */
2781
3071
  authority: PublicKey;
3072
+ /**
3073
+ * The registered program pda
3074
+ */
2782
3075
  registeredProgramPda: PublicKey;
3076
+ /**
3077
+ * Noop program.
3078
+ */
2783
3079
  noopProgram: PublicKey;
3080
+ /**
3081
+ * Account compression authority.
3082
+ */
2784
3083
  accountCompressionAuthority: PublicKey;
3084
+ /**
3085
+ * Account compression program.
3086
+ */
2785
3087
  accountCompressionProgram: PublicKey;
3088
+ /**
3089
+ * Solana pool pda. Some() if compression or decompression is done.
3090
+ */
2786
3091
  solPoolPda: PublicKey | null;
3092
+ /**
3093
+ * Decompression recipient.
3094
+ */
2787
3095
  decompressionRecipient: PublicKey | null;
3096
+ /**
3097
+ * Solana system program.
3098
+ */
2788
3099
  systemProgram: PublicKey;
2789
3100
  };
2790
3101
  declare const invokeAccountsLayout: (accounts: invokeAccountsLayoutParams) => AccountMeta[];
@@ -2806,110 +3117,6 @@ declare function deserializeAppendNullifyCreateAddressInputsIndexer(buffer: Buff
2806
3117
  };
2807
3118
  declare function convertToPublicTransactionEvent(decoded: any, remainingAccounts: PublicKey[], invokeData: InstructionDataInvoke): PublicTransactionEvent;
2808
3119
 
2809
- declare const FIELD_SIZE: BN;
2810
- declare const HIGHEST_ADDRESS_PLUS_ONE: BN;
2811
- declare const COMPUTE_BUDGET_PATTERN: number[];
2812
- declare const INVOKE_DISCRIMINATOR: Buffer$1;
2813
- declare const INVOKE_CPI_DISCRIMINATOR: Buffer$1;
2814
- declare const INSERT_INTO_QUEUES_DISCRIMINATOR: Buffer$1;
2815
- declare const noopProgram = "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV";
2816
- declare const lightProgram = "SySTEM1eSU2p4BGQfQpimFEWWSC1XDFeun3Nqzz3rT7";
2817
- declare const accountCompressionProgram = "compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq";
2818
- declare const getRegisteredProgramPda: () => PublicKey;
2819
- declare const getAccountCompressionAuthority: () => PublicKey;
2820
- declare const defaultStaticAccounts: () => PublicKey[];
2821
- declare const defaultStaticAccountsStruct: () => {
2822
- registeredProgramPda: PublicKey;
2823
- noopProgram: PublicKey;
2824
- accountCompressionProgram: PublicKey;
2825
- accountCompressionAuthority: PublicKey;
2826
- cpiSignatureAccount: null;
2827
- };
2828
- type StateTreeLUTPair = {
2829
- stateTreeLookupTable: PublicKey;
2830
- nullifyTable: PublicKey;
2831
- };
2832
- /**
2833
- * Returns the Default Public State Tree LUTs for Devnet and Mainnet-Beta.
2834
- */
2835
- declare const defaultStateTreeLookupTables: () => {
2836
- mainnet: StateTreeLUTPair[];
2837
- devnet: StateTreeLUTPair[];
2838
- };
2839
- /**
2840
- * @internal
2841
- */
2842
- declare const isLocalTest: (url: string) => boolean;
2843
- /**
2844
- * @internal
2845
- */
2846
- declare const localTestActiveStateTreeInfo: () => ActiveTreeBundle[];
2847
- /**
2848
- * Use only with Localnet testing.
2849
- * For public networks, fetch via {@link defaultStateTreeLookupTables} and {@link getLightStateTreeInfo}.
2850
- */
2851
- declare const defaultTestStateTreeAccounts: () => {
2852
- nullifierQueue: PublicKey;
2853
- merkleTree: PublicKey;
2854
- merkleTreeHeight: number;
2855
- addressTree: PublicKey;
2856
- addressQueue: PublicKey;
2857
- };
2858
- /**
2859
- * @internal testing only
2860
- */
2861
- declare const defaultTestStateTreeAccounts2: () => {
2862
- nullifierQueue2: PublicKey;
2863
- merkleTree2: PublicKey;
2864
- };
2865
- declare const stateTreeLookupTableMainnet = "7i86eQs3GSqHjN47WdWLTCGMW6gde1q96G2EVnUyK2st";
2866
- declare const nullifiedStateTreeLookupTableMainnet = "H9QD4u1fG7KmkAzn2tDXhheushxFe1EcrjGGyEFXeMqT";
2867
- declare const stateTreeLookupTableDevnet = "8n8rH2bFRVA6cSGNDpgqcKHCndbFCT1bXxAQG89ejVsh";
2868
- declare const nullifiedStateTreeLookupTableDevnet = "5dhaJLBjnVBQFErr8oiCJmcVsx3Zj6xDekGB2zULPsnP";
2869
- declare const nullifierQueuePubkey = "nfq1NvQDJ2GEgnS8zt9prAe8rjjpAW1zFkrvZoBR148";
2870
- declare const cpiContextPubkey = "cpi1uHzrEhBG733DoEJNgHCyRS3XmmyVNZx5fonubE4";
2871
- declare const merkletreePubkey = "smt1NamzXdq4AMqS2fS2F1i5KTYPZRhoHgWx38d8WsT";
2872
- declare const addressTree = "amt1Ayt45jfbdw5YSo7iz6WZxUmnZsQTYXy82hVwyC2";
2873
- declare const addressQueue = "aq1S9z4reTSQAdgWHGD2zDaS39sjGrAxbR31vxJ2F4F";
2874
- declare const merkleTree2Pubkey = "smt2rJAFdyJJupwMKAqTNAJwvjhmiZ4JYGZmbVRw1Ho";
2875
- declare const nullifierQueue2Pubkey = "nfq2hgS7NYemXsFaFUCe3EMXSDSfnZnAe27jC6aPP1X";
2876
- declare const cpiContext2Pubkey = "cpi2cdhkH5roePvcudTgUL8ppEBfTay1desGh8G8QxK";
2877
- declare const confirmConfig: ConfirmOptions;
2878
- declare const DEFAULT_MERKLE_TREE_HEIGHT = 26;
2879
- declare const DEFAULT_MERKLE_TREE_ROOTS = 2800;
2880
- /** Threshold (per asset) at which new in-UTXOs get merged, in order to reduce UTXO pool size */
2881
- declare const UTXO_MERGE_THRESHOLD = 20;
2882
- declare const UTXO_MERGE_MAXIMUM = 10;
2883
- /**
2884
- * Treshold after which the currently used transaction Merkle tree is switched
2885
- * to the next one
2886
- */
2887
- declare const TRANSACTION_MERKLE_TREE_ROLLOVER_THRESHOLD: BN;
2888
- /**
2889
- * Fee to provide continous funding for the state Merkle tree.
2890
- * Once the state Merkle tree is at 95% capacity the accumulated fees
2891
- * will be used to fund the next state Merkle tree with the same parameters.
2892
- *
2893
- * Is charged per output compressed account.
2894
- */
2895
- declare const STATE_MERKLE_TREE_ROLLOVER_FEE: BN;
2896
- /**
2897
- * Fee to provide continous funding for the address queue and address Merkle tree.
2898
- * Once the address Merkle tree is at 95% capacity the accumulated fees
2899
- * will be used to fund the next address queue and address tree with the same parameters.
2900
- *
2901
- * Is charged per newly created address.
2902
- */
2903
- declare const ADDRESS_QUEUE_ROLLOVER_FEE: BN;
2904
- /**
2905
- * Is charged if the transaction nullifies at least one compressed account.
2906
- */
2907
- declare const STATE_MERKLE_TREE_NETWORK_FEE: BN;
2908
- /**
2909
- * Is charged if the transaction creates at least one address.
2910
- */
2911
- declare const ADDRESS_TREE_NETWORK_FEE: BN;
2912
-
2913
3120
  declare enum UtxoErrorCode {
2914
3121
  NEGATIVE_LAMPORTS = "NEGATIVE_LAMPORTS",
2915
3122
  NOT_U64 = "NOT_U64",
@@ -4004,4 +4211,4 @@ type LightSystemProgram = {
4004
4211
  };
4005
4212
  declare const IDL: LightSystemProgram;
4006
4213
 
4007
- export { ADDRESS_QUEUE_ROLLOVER_FEE, ADDRESS_TREE_NETWORK_FEE, ALICE, AccountProofResult, type ActiveTreeBundle, type AddressWithTree, AppendLeavesInputLayout, AppendNullifyCreateAddressInputsMetaLayout, type BN254, BOB, BalanceResult, CHARLIE, COMPUTE_BUDGET_PATTERN, type ClientSubscriptionId, type CompressedAccount, type CompressedAccountData, CompressedAccountLayout, CompressedAccountResult, type CompressedAccountWithMerkleContext, CompressedAccountsByOwnerResult, type CompressedCpiContext, type CompressedMintTokenHolders, CompressedMintTokenHoldersResult, type CompressedProof, type CompressedProofWithContext, CompressedTokenAccountResult, CompressedTokenAccountsByOwnerOrDelegateResult, type CompressedTransaction, CompressedTransactionResult, type CompressionApiInterface, CreateUtxoError, CreateUtxoErrorCode, DAVE, DEFAULT_MERKLE_TREE_HEIGHT, DEFAULT_MERKLE_TREE_ROOTS, DEFAULT_ZERO, type EventWithParsedTokenTlvData, FIELD_SIZE, type GetCompressedAccountConfig, type GetCompressedAccountsByOwnerConfig, type GetCompressedAccountsConfig, type GetCompressedAccountsFilter, type GetCompressedTokenAccountsByOwnerOrDelegateOptions, HIGHEST_ADDRESS_PLUS_ONE, HashError, HashErrorCode, type HashWithTree, HealthResult, type HexBatchInputsForProver, type HexInputsForProver, IDL, INSERT_INTO_QUEUES_DISCRIMINATOR, INVOKE_CPI_DISCRIMINATOR, INVOKE_DISCRIMINATOR, IndexedArray, IndexedElement, IndexedElementBundle, type InputTokenDataWithContext, InsertAddressInputLayout, InsertNullifierInputLayout, type InstructionDataInvoke, type InstructionDataInvokeCpi, InstructionDataInvokeCpiLayout, InstructionDataInvokeLayout, type LatestNonVotingSignatures, type LatestNonVotingSignaturesPaginated, LatestNonVotingSignaturesResult, LatestNonVotingSignaturesResultPaginated, LightSystemProgram$1 as LightSystemProgram, type LightSystemProgram as LightSystemProgramIDL, type LightWasm, LookupTableError, LookupTableErrorCode, MerkeProofResult, type MerkleContext, MerkleContextLayout, type MerkleContextWithMerkleProof, type MerkleContextWithNewAddressProof, MerkleTree, MerkleTreeError, MerkleTreeErrorCode, type MerkleTreeSequenceNumber, MerkleTreeSequenceNumberLayout, MultipleCompressedAccountsResult, MultipleMerkleProofsResult, NativeBalanceResult, type NewAddressParams, NewAddressParamsLayout, type NewAddressParamsPacked, NewAddressProofResult, type NonInclusionJsonStruct, type NonInclusionMerkleProofInputs, type OutputCompressedAccountWithPackedContext, type PackedCompressedAccountWithMerkleContext, type PackedMerkleContext, type PaginatedOptions, type ParsedTokenAccount, ProofError, ProofErrorCode, type PublicTransactionEvent, PublicTransactionEventLayout, type QueueIndex, Rpc, RpcError, RpcErrorCode, type RpcResult, type RpcResultError, type RpcResultSuccess, STATE_MERKLE_TREE_NETWORK_FEE, STATE_MERKLE_TREE_ROLLOVER_FEE, SelectInUtxosError, SelectInUtxosErrorCode, SignatureListResult, SignatureListWithCursorResult, type SignatureWithMetadata, SlotResult, type StateTreeLUTPair, TRANSACTION_MERKLE_TREE_ROLLOVER_THRESHOLD, TestRpc, type TestRpcConfig, type TokenBalance, TokenBalanceListResult, TokenBalanceListResultV2, TokenBalanceResult, type TokenData$1 as TokenData, TokenDataLayout, TokenDataResult, TreeType, UTXO_MERGE_MAXIMUM, UTXO_MERGE_THRESHOLD, UtilsError, UtilsErrorCode, UtxoError, UtxoErrorCode, ValidityProofResult, type WithContext, type WithCursor, type WithRpcContext, accountCompressionProgram, addressQueue, addressTree, airdropSol, bn, bufToDecStr, buildAndSignTx, buildTx, byteArrayToKeypair, calculateComputeUnitPrice, checkValidityProofShape, compress, confirmConfig, confirmTransaction, confirmTx, convertMerkleProofsWithContextToHex, convertNonInclusionMerkleProofInputsToHex, convertToPublicTransactionEvent, cpiContext2Pubkey, cpiContextPubkey, createAccount, createAccountWithLamports, createBN254, createCompressedAccount, createCompressedAccountWithMerkleContext, createMerkleContext, createRpc, createRpcResult, createStateTreeLookupTable, decodeInstructionDataInvoke, decodeInstructionDataInvokeCpi, decodePublicTransactionEvent, decompress, dedupeSigner, deepEqual, defaultStateTreeLookupTables, defaultStaticAccounts, defaultStaticAccountsStruct, defaultTestStateTreeAccounts, defaultTestStateTreeAccounts2, deriveAddress, deriveAddressSeed, deserializeAppendNullifyCreateAddressInputsIndexer, encodeBN254toBase58, encodeInstructionDataInvoke, encodePublicTransactionEvent, extendStateTreeLookupTable, getAccountCompressionAuthority, getCompressedTokenAccountByHashTest, getCompressedTokenAccounts, getCompressedTokenAccountsByDelegateTest, getCompressedTokenAccountsByOwnerTest, getConnection, getIndexOrAdd, getLightStateTreeInfo, getParsedEvents, getPublicInputHash, getQueueForTree, getRegisteredProgramPda, getTestKeypair, getTestRpc, getTreeForQueue, hashToBn254FieldSizeBe, hashvToBn254FieldSizeBe, invokeAccountsLayout, type invokeAccountsLayoutParams, isLocalTest, isSmallerThanBn254FieldSizeBe, jsonRpcResult, jsonRpcResultAndContext, lightProgram, localTestActiveStateTreeInfo, merkleTree2Pubkey, merkletreePubkey, negateAndCompressProof, newAccountWithLamports, noopProgram, nullifiedStateTreeLookupTableDevnet, nullifiedStateTreeLookupTableMainnet, nullifierQueue2Pubkey, nullifierQueuePubkey, nullifyLookupTable, packCompressedAccounts, packNewAddressParams, padOutputStateMerkleTrees, parseAccountData, parseEvents, parseLightTransaction, parsePublicTransactionEventWithIdl, parseTokenLayoutWithIdl, pickRandomTreeAndQueue, pipe, placeholderValidityProof, proofFromJsonStruct, proverRequest, pushUniqueItems, rpcRequest, selectMinCompressedSolAccountsForTransfer, sendAndConfirmTx, sleep, stateTreeLookupTableDevnet, stateTreeLookupTableMainnet, sumUpLamports, toAccountMetas, toArray, toCamelCase, toHex, toUnixTimestamp, transfer, validateNumbers, validateNumbersForInclusionProof, validateNumbersForNonInclusionProof, validateNumbersForProof, validateSameOwner, validateSufficientBalance, wrapBigNumbersAsStrings };
4214
+ export { ADDRESS_QUEUE_ROLLOVER_FEE, ADDRESS_TREE_NETWORK_FEE, ALICE, AccountProofResult, type ActiveTreeBundle, type AddressTreeInfo, type AddressWithTree, type AddressWithTreeInfo, AppendLeavesInputLayout, AppendNullifyCreateAddressInputsMetaLayout, type BN254, BOB, BalanceResult, CHARLIE, COMPRESSED_TOKEN_PROGRAM_ID, COMPUTE_BUDGET_PATTERN, type ClientSubscriptionId, type CompressedAccount, type CompressedAccountData, CompressedAccountLayout, CompressedAccountResult, type CompressedAccountWithMerkleContext, CompressedAccountsByOwnerResult, type CompressedCpiContext, type CompressedMintTokenHolders, CompressedMintTokenHoldersResult, type CompressedProof, type CompressedProofWithContext, CompressedTokenAccountResult, CompressedTokenAccountsByOwnerOrDelegateResult, type CompressedTransaction, CompressedTransactionResult, type CompressionApiInterface, CreateUtxoError, CreateUtxoErrorCode, DAVE, DEFAULT_MERKLE_TREE_HEIGHT, DEFAULT_MERKLE_TREE_ROOTS, DEFAULT_ZERO, type EventWithParsedTokenTlvData, FIELD_SIZE, type GetCompressedAccountConfig, type GetCompressedAccountsByOwnerConfig, type GetCompressedAccountsConfig, type GetCompressedAccountsFilter, type GetCompressedTokenAccountsByOwnerOrDelegateOptions, HIGHEST_ADDRESS_PLUS_ONE, HashError, HashErrorCode, type HashWithTree, type HashWithTreeInfo, HealthResult, type HexBatchInputsForProver, type HexInputsForProver, IDL, INSERT_INTO_QUEUES_DISCRIMINATOR, INVOKE_CPI_DISCRIMINATOR, INVOKE_DISCRIMINATOR, IndexedArray, IndexedElement, IndexedElementBundle, type InputTokenDataWithContext, InsertAddressInputLayout, InsertNullifierInputLayout, type InstructionDataInvoke, type InstructionDataInvokeCpi, InstructionDataInvokeCpiLayout, InstructionDataInvokeLayout, type LatestNonVotingSignatures, type LatestNonVotingSignaturesPaginated, LatestNonVotingSignaturesResult, LatestNonVotingSignaturesResultPaginated, LightSystemProgram$1 as LightSystemProgram, type LightSystemProgram as LightSystemProgramIDL, type LightWasm, LookupTableError, LookupTableErrorCode, MerkeProofResult, type MerkleContext, MerkleContextLayout, type MerkleContextLegacy, type MerkleContextWithMerkleProof, type MerkleContextWithNewAddressProof, MerkleTree, MerkleTreeError, MerkleTreeErrorCode, type MerkleTreeSequenceNumber, MerkleTreeSequenceNumberLayout, MultipleCompressedAccountsResult, MultipleMerkleProofsResult, NativeBalanceResult, type NewAddressParams, NewAddressParamsLayout, type NewAddressParamsPacked, NewAddressProofResult, type NonInclusionJsonStruct, type NonInclusionMerkleProofInputs, type OutputCompressedAccountWithPackedContext, type PackedCompressedAccountWithMerkleContext, type PackedMerkleContext, type PaginatedOptions, type ParsedTokenAccount, ProofError, ProofErrorCode, type PublicTransactionEvent, PublicTransactionEventLayout, type QueueIndex, Rpc, RpcError, RpcErrorCode, type RpcResult, type RpcResultError, type RpcResultSuccess, STATE_MERKLE_TREE_NETWORK_FEE, STATE_MERKLE_TREE_ROLLOVER_FEE, SelectInUtxosError, SelectInUtxosErrorCode, SignatureListResult, SignatureListWithCursorResult, type SignatureWithMetadata, SlotResult, type StateTreeInfo, type StateTreeLUTPair, TRANSACTION_MERKLE_TREE_ROLLOVER_THRESHOLD, TestRpc, type TestRpcConfig, type TokenBalance, TokenBalanceListResult, TokenBalanceListResultV2, TokenBalanceResult, type TokenData$1 as TokenData, TokenDataLayout, TokenDataResult, TreeType, UTXO_MERGE_MAXIMUM, UTXO_MERGE_THRESHOLD, UtilsError, UtilsErrorCode, UtxoError, UtxoErrorCode, type ValidityProof, ValidityProofResult, type ValidityProofWithContext, type WithContext, type WithCursor, type WithRpcContext, accountCompressionProgram, addressQueue, addressTree, airdropSol, bn, bufToDecStr, buildAndSignTx, buildTx, byteArrayToKeypair, calculateComputeUnitPrice, checkValidityProofShape, compress, confirmConfig, confirmTransaction, confirmTx, convertMerkleProofsWithContextToHex, convertNonInclusionMerkleProofInputsToHex, convertToPublicTransactionEvent, cpiContext2Pubkey, cpiContextPubkey, createAccount, createAccountWithLamports, createBN254, createCompressedAccount, createCompressedAccountWithMerkleContext, createMerkleContext, createRpc, createRpcResult, createStateTreeLookupTable, decodeInstructionDataInvoke, decodeInstructionDataInvokeCpi, decodePublicTransactionEvent, decompress, dedupeSigner, deepEqual, defaultStateTreeLookupTables, defaultStaticAccounts, defaultStaticAccountsStruct, defaultTestStateTreeAccounts, defaultTestStateTreeAccounts2, deriveAddress, deriveAddressSeed, deserializeAppendNullifyCreateAddressInputsIndexer, encodeBN254toBase58, encodeInstructionDataInvoke, encodePublicTransactionEvent, extendStateTreeLookupTable, getAccountCompressionAuthority, getAllStateTreeInfos, getCompressedTokenAccountByHashTest, getCompressedTokenAccounts, getCompressedTokenAccountsByDelegateTest, getCompressedTokenAccountsByOwnerTest, getConnection, getDefaultAddressTreeInfo, getIndexOrAdd, getParsedEvents, getPublicInputHash, getRegisteredProgramPda, getTestKeypair, getTestRpc, getTreeForQueue, hashToBn254FieldSizeBe, hashvToBn254FieldSizeBe, invokeAccountsLayout, type invokeAccountsLayoutParams, isLocalTest, isSmallerThanBn254FieldSizeBe, jsonRpcResult, jsonRpcResultAndContext, lightProgram, localTestActiveStateTreeInfo, merkleTree2Pubkey, merkletreePubkey, negateAndCompressProof, newAccountWithLamports, noopProgram, nullifiedStateTreeLookupTableDevnet, nullifiedStateTreeLookupTableMainnet, nullifierQueue2Pubkey, nullifierQueuePubkey, nullifyLookupTable, packCompressedAccounts, packNewAddressParams, padOutputStateMerkleTrees, parseAccountData, parseEvents, parseLightTransaction, parsePublicTransactionEventWithIdl, parseTokenLayoutWithIdl, pickRandomTreeAndQueue, pipe, placeholderValidityProof, proofFromJsonStruct, proverRequest, pushUniqueItems, rpcRequest, selectMinCompressedSolAccountsForTransfer, selectStateTreeInfo, sendAndConfirmTx, sleep, stateTreeLookupTableDevnet, stateTreeLookupTableMainnet, sumUpLamports, toAccountMetas, toArray, toCamelCase, toHex, toUnixTimestamp, transfer, validateNumbers, validateNumbersForInclusionProof, validateNumbersForNonInclusionProof, validateNumbersForProof, validateSameOwner, validateSufficientBalance, wrapBigNumbersAsStrings };