@lightprotocol/stateless.js 0.22.1-alpha.0 → 0.22.1-alpha.2

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 (96) hide show
  1. package/README.md +4 -1
  2. package/dist/cjs/browser/constants.d.ts +41 -7
  3. package/dist/cjs/browser/index.cjs +1 -1
  4. package/dist/cjs/browser/index.cjs.map +1 -1
  5. package/dist/cjs/browser/index.d.ts +0 -1
  6. package/dist/cjs/browser/programs/system/pack.d.ts +10 -79
  7. package/dist/cjs/browser/rpc-interface.d.ts +371 -277
  8. package/dist/cjs/browser/rpc.d.ts +79 -12
  9. package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +0 -2
  10. package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +12 -6
  11. package/dist/cjs/browser/utils/address.d.ts +7 -19
  12. package/dist/cjs/browser/utils/conversion.d.ts +1 -1
  13. package/dist/cjs/browser/utils/get-state-tree-infos.d.ts +15 -0
  14. package/dist/cjs/browser/utils/index.d.ts +2 -1
  15. package/dist/cjs/browser/utils/instruction.d.ts +35 -0
  16. package/dist/cjs/browser/utils/pack-decompress.d.ts +31 -0
  17. package/dist/cjs/node/constants.d.ts +41 -7
  18. package/dist/cjs/node/index.cjs +1 -1
  19. package/dist/cjs/node/index.cjs.map +1 -1
  20. package/dist/cjs/node/index.d.ts +0 -1
  21. package/dist/cjs/node/programs/system/pack.d.ts +10 -79
  22. package/dist/cjs/node/rpc-interface.d.ts +371 -277
  23. package/dist/cjs/node/rpc.d.ts +79 -12
  24. package/dist/cjs/node/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +0 -2
  25. package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +12 -6
  26. package/dist/cjs/node/utils/address.d.ts +7 -19
  27. package/dist/cjs/node/utils/conversion.d.ts +1 -1
  28. package/dist/cjs/node/utils/get-state-tree-infos.d.ts +15 -0
  29. package/dist/cjs/node/utils/index.d.ts +2 -1
  30. package/dist/cjs/node/utils/instruction.d.ts +35 -0
  31. package/dist/cjs/node/utils/pack-decompress.d.ts +31 -0
  32. package/dist/es/browser/actions/compress.d.ts +18 -0
  33. package/dist/es/browser/actions/create-account.d.ts +38 -0
  34. package/dist/es/browser/actions/decompress.d.ts +15 -0
  35. package/dist/es/browser/actions/index.d.ts +5 -0
  36. package/dist/es/browser/actions/transfer.d.ts +16 -0
  37. package/dist/es/browser/constants.d.ts +176 -0
  38. package/dist/es/browser/errors.d.ts +74 -0
  39. package/dist/es/browser/index.d.ts +9 -0
  40. package/dist/es/browser/index.js +2 -0
  41. package/dist/es/browser/index.js.map +1 -0
  42. package/dist/es/browser/programs/index.d.ts +1 -0
  43. package/dist/es/browser/programs/system/idl.d.ts +997 -0
  44. package/dist/es/browser/programs/system/index.d.ts +5 -0
  45. package/dist/es/browser/programs/system/layout.d.ts +77 -0
  46. package/dist/es/browser/programs/system/pack.d.ts +74 -0
  47. package/dist/es/browser/programs/system/program.d.ts +175 -0
  48. package/dist/es/browser/programs/system/select-compressed-accounts.d.ts +10 -0
  49. package/dist/es/browser/rpc-interface.d.ts +2873 -0
  50. package/dist/es/browser/rpc.d.ts +361 -0
  51. package/dist/es/browser/state/BN254.d.ts +13 -0
  52. package/dist/es/browser/state/bn.d.ts +3 -0
  53. package/dist/es/browser/state/compressed-account.d.ts +205 -0
  54. package/dist/es/browser/state/index.d.ts +4 -0
  55. package/dist/es/browser/state/types.d.ts +449 -0
  56. package/dist/es/browser/test-helpers/index.d.ts +3 -0
  57. package/dist/es/browser/test-helpers/merkle-tree/index.d.ts +2 -0
  58. package/dist/es/browser/test-helpers/merkle-tree/indexed-array.d.ts +85 -0
  59. package/dist/es/browser/test-helpers/merkle-tree/merkle-tree.d.ts +92 -0
  60. package/dist/es/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +7 -0
  61. package/dist/es/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +38 -0
  62. package/dist/es/browser/test-helpers/test-rpc/get-parsed-events.d.ts +15 -0
  63. package/dist/es/browser/test-helpers/test-rpc/index.d.ts +3 -0
  64. package/dist/es/browser/test-helpers/test-rpc/test-rpc.d.ts +245 -0
  65. package/dist/es/browser/test-helpers/test-utils.d.ts +31 -0
  66. package/dist/es/browser/utils/address.d.ts +64 -0
  67. package/dist/es/browser/utils/airdrop.d.ts +7 -0
  68. package/dist/es/browser/utils/calculate-compute-unit-price.d.ts +7 -0
  69. package/dist/es/browser/utils/conversion.d.ts +36 -0
  70. package/dist/es/browser/utils/dedupe-signer.d.ts +3 -0
  71. package/dist/es/browser/utils/get-state-tree-infos.d.ts +63 -0
  72. package/dist/es/browser/utils/index.d.ts +14 -0
  73. package/dist/es/browser/utils/instruction.d.ts +35 -0
  74. package/dist/es/browser/utils/pack-decompress.d.ts +31 -0
  75. package/dist/es/browser/utils/parse-validity-proof.d.ts +20 -0
  76. package/dist/es/browser/utils/pipe.d.ts +2 -0
  77. package/dist/es/browser/utils/send-and-confirm.d.ts +52 -0
  78. package/dist/es/browser/utils/sleep.d.ts +1 -0
  79. package/dist/es/browser/utils/state-tree-lookup-table.d.ts +68 -0
  80. package/dist/es/browser/utils/validation.d.ts +8 -0
  81. package/dist/types/index.d.ts +340 -661
  82. package/package.json +18 -10
  83. package/dist/cjs/browser/compressible/action.d.ts +0 -77
  84. package/dist/cjs/browser/compressible/index.d.ts +0 -13
  85. package/dist/cjs/browser/compressible/instruction.d.ts +0 -177
  86. package/dist/cjs/browser/compressible/layout.d.ts +0 -47
  87. package/dist/cjs/browser/compressible/types.d.ts +0 -112
  88. package/dist/cjs/browser/compressible/utils.d.ts +0 -16
  89. package/dist/cjs/browser/utils/packed-accounts.d.ts +0 -161
  90. package/dist/cjs/node/compressible/action.d.ts +0 -77
  91. package/dist/cjs/node/compressible/index.d.ts +0 -13
  92. package/dist/cjs/node/compressible/instruction.d.ts +0 -177
  93. package/dist/cjs/node/compressible/layout.d.ts +0 -47
  94. package/dist/cjs/node/compressible/types.d.ts +0 -112
  95. package/dist/cjs/node/compressible/utils.d.ts +0 -16
  96. package/dist/cjs/node/utils/packed-accounts.d.ts +0 -161
@@ -1,8 +1,9 @@
1
- import { AccountInfo, Connection, ConnectionConfig, PublicKey } from '@solana/web3.js';
1
+ import { AccountInfo, Commitment, Connection, ConnectionConfig, GetAccountInfoConfig, PublicKey, SignaturesForAddressOptions } from '@solana/web3.js';
2
2
  import { Buffer } from 'buffer';
3
- import { ValidityProofWithContext, CompressedTransaction, CompressionApiInterface, GetCompressedTokenAccountsByOwnerOrDelegateOptions, HexInputsForProver, ParsedTokenAccount, SignatureWithMetadata, LatestNonVotingSignatures, LatestNonVotingSignaturesPaginated, WithContext, GetCompressedAccountsByOwnerConfig, WithCursor, AddressWithTree, HashWithTree, CompressedMintTokenHolders, TokenBalance, PaginatedOptions } from './rpc-interface';
3
+ import { ValidityProofWithContext, CompressedTransaction, CompressionApiInterface, GetCompressedTokenAccountsByOwnerOrDelegateOptions, HexInputsForProver, ParsedTokenAccount, SignatureWithMetadata, LatestNonVotingSignatures, LatestNonVotingSignaturesPaginated, WithContext, GetCompressedAccountsByOwnerConfig, WithCursor, AddressWithTree, HashWithTree, CompressedMintTokenHolders, TokenBalance, PaginatedOptions, DerivationMode, AddressWithTreeInfoV2, SignaturesForAddressInterfaceResult, UnifiedSignatureInfo, UnifiedTokenBalance, UnifiedBalance } from './rpc-interface';
4
4
  import { MerkleContextWithMerkleProof, BN254, CompressedAccountWithMerkleContext, ValidityProof, AddressTreeInfo, MerkleContext } from './state';
5
5
  import BN from 'bn.js';
6
+ import { ConfirmedSignatureInfo } from '@solana/web3.js';
6
7
  import { LightWasm } from './test-helpers';
7
8
  import { TreeInfo } from './state/types';
8
9
  /** @internal */
@@ -72,6 +73,12 @@ export interface NullifierMetadata {
72
73
  nullifier: BN254;
73
74
  txHash: BN254;
74
75
  }
76
+ /**
77
+ * Merge signatures from Solana RPC and compression indexer.
78
+ * Deduplicates by signature, tracking sources in the `sources` array.
79
+ * When a signature exists in both, uses Solana data (richer) but marks both sources.
80
+ */
81
+ export declare function mergeSignatures(solanaSignatures: ConfirmedSignatureInfo[], compressedSignatures: SignatureWithMetadata[]): UnifiedSignatureInfo[];
75
82
  /**
76
83
  *
77
84
  */
@@ -100,6 +107,10 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
100
107
  * @internal
101
108
  */
102
109
  doFetch(): Promise<TreeInfo[]>;
110
+ /**
111
+ * Get a V2 address tree info.
112
+ */
113
+ getAddressTreeInfoV2(): Promise<TreeInfo>;
103
114
  /**
104
115
  * Fetch the compressed account for the specified account address or hash
105
116
  */
@@ -260,6 +271,17 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
260
271
  * @returns validity proof with context
261
272
  */
262
273
  getValidityProofV0(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<ValidityProofWithContext>;
274
+ /**
275
+ * Fetch the latest validity proof for (1) compressed accounts specified by
276
+ * an array of account Merkle contexts, and (2) new unique addresses specified by
277
+ * an array of address objects with tree info.
278
+ *
279
+ * Validity proofs prove the presence of compressed accounts in state trees
280
+ * and the non-existence of addresses in address trees, respectively. They
281
+ * enable verification without recomputing the merkle proof path, thus
282
+ * lowering verification and data costs.
283
+ */
284
+ getValidityProofV2(accountMerkleContexts?: (MerkleContext | undefined)[], newAddresses?: AddressWithTreeInfoV2[], derivationMode?: DerivationMode): Promise<ValidityProofWithContext>;
263
285
  /**
264
286
  * Fetch the latest validity proof for (1) compressed accounts specified by
265
287
  * an array of account hashes. (2) new unique addresses specified by an
@@ -278,17 +300,62 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
278
300
  */
279
301
  getValidityProofAndRpcContext(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<WithContext<ValidityProofWithContext>>;
280
302
  /**
281
- * Get account info from either compressed or onchain storage.
282
- * @param address The account address to fetch.
283
- * @param programId The owner program ID.
284
- * @param addressTreeInfo The address tree info used to store the account.
285
- * @param rpc The RPC client to use.
303
+ * Fetch the account info for the specified public key. Returns metadata
304
+ * to load in case the account is cold.
305
+ * @param address The account address to fetch.
306
+ * @param programId The owner program ID.
307
+ * @param commitmentOrConfig Optional. The commitment or config to use
308
+ * for the onchain account fetch.
309
+ * @param addressSpace Optional. The address space info that was
310
+ * used at init.
286
311
  *
287
- * @returns Account info with compression info, or null if account
288
- * doesn't exist.
289
- */
290
- getCompressibleAccountInfo(address: PublicKey, programId: PublicKey, addressTreeInfo: TreeInfo, rpc: Rpc): Promise<{
312
+ * @returns Account info with load info, or null if
313
+ * account doesn't exist. LoadContext is always
314
+ * some if the account is compressible. isCold
315
+ * indicates the current state of the account,
316
+ * if true the account must referenced in a
317
+ * load instruction before use.
318
+ */
319
+ getAccountInfoInterface(address: PublicKey, programId: PublicKey, commitmentOrConfig?: Commitment | GetAccountInfoConfig, addressSpace?: TreeInfo): Promise<{
291
320
  accountInfo: AccountInfo<Buffer>;
292
- merkleContext?: MerkleContext;
321
+ isCold: boolean;
322
+ loadContext?: MerkleContext;
293
323
  } | null>;
324
+ /**
325
+ * Get signatures for an address from both Solana and compression indexer.
326
+ *
327
+ * @param address Address to fetch signatures for.
328
+ * @param options Options for the Solana getSignaturesForAddress call.
329
+ * @param compressedOptions Options for the compression getCompressionSignaturesForAddress call.
330
+ * @returns Unified signatures from both sources.
331
+ */
332
+ getSignaturesForAddressInterface(address: PublicKey, options?: SignaturesForAddressOptions, compressedOptions?: PaginatedOptions): Promise<SignaturesForAddressInterfaceResult>;
333
+ /**
334
+ * Get signatures for an owner from both Solana and compression indexer.
335
+ *
336
+ * @param owner Owner address to fetch signatures for.
337
+ * @param options Options for the Solana getSignaturesForAddress call.
338
+ * @param compressedOptions Options for the compression getCompressionSignaturesForOwner call.
339
+ * @returns Unified signatures from both sources.
340
+ */
341
+ getSignaturesForOwnerInterface(owner: PublicKey, options?: SignaturesForAddressOptions, compressedOptions?: PaginatedOptions): Promise<SignaturesForAddressInterfaceResult>;
342
+ /**
343
+ * Get token account balance for an address, regardless of whether the token
344
+ * account is hot or cold.
345
+ *
346
+ * @param address Token account address.
347
+ * @param owner Owner public key.
348
+ * @param mint Mint public key.
349
+ * @param commitment Commitment level for on-chain query.
350
+ * @returns Unified token balance from both sources.
351
+ */
352
+ getTokenAccountBalanceInterface(address: PublicKey, owner: PublicKey, mint: PublicKey, commitment?: Commitment): Promise<UnifiedTokenBalance>;
353
+ /**
354
+ * Get SOL balance for an address, regardless of whether the account is hot or cold.
355
+ *
356
+ * @param address Address to fetch balance for.
357
+ * @param commitment Commitment level for on-chain query.
358
+ * @returns Unified SOL balance.
359
+ */
360
+ getBalanceInterface(address: PublicKey, commitment?: Commitment): Promise<UnifiedBalance>;
294
361
  }
@@ -3,7 +3,6 @@ import BN from 'bn.js';
3
3
  import { Rpc } from '../../rpc';
4
4
  import { ParsedTokenAccount, WithCursor } from '../../rpc-interface';
5
5
  import { PublicTransactionEvent, CompressedAccountLegacy } from '../../state';
6
- import { Layout } from '@coral-xyz/borsh';
7
6
  type TokenData = {
8
7
  mint: PublicKey;
9
8
  owner: PublicKey;
@@ -12,7 +11,6 @@ type TokenData = {
12
11
  state: number;
13
12
  tlv: Buffer | null;
14
13
  };
15
- export declare const TokenDataLayout: Layout<TokenData>;
16
14
  export type EventWithParsedTokenTlvData = {
17
15
  inputCompressedAccountHashes: number[][];
18
16
  outputCompressedAccounts: ParsedTokenAccount[];
@@ -1,8 +1,8 @@
1
- import { AccountInfo, Connection, ConnectionConfig, PublicKey } from '@solana/web3.js';
1
+ import { Connection, ConnectionConfig, PublicKey } from '@solana/web3.js';
2
2
  import BN from 'bn.js';
3
3
  import { AddressWithTree, CompressedMintTokenHolders, CompressedTransaction, GetCompressedAccountsByOwnerConfig, PaginatedOptions, HashWithTree, LatestNonVotingSignatures, LatestNonVotingSignaturesPaginated, SignatureWithMetadata, WithContext, WithCursor } from '../../rpc-interface';
4
4
  import { ValidityProofWithContext, CompressionApiInterface, GetCompressedTokenAccountsByOwnerOrDelegateOptions, ParsedTokenAccount, TokenBalance } from '../../rpc-interface';
5
- import { BN254, CompressedAccountWithMerkleContext, MerkleContext, MerkleContextWithMerkleProof } from '../../state';
5
+ import { BN254, CompressedAccountWithMerkleContext, MerkleContextWithMerkleProof } from '../../state';
6
6
  import { MerkleContextWithNewAddressProof } from '../../rpc';
7
7
  import { TreeInfo } from '../../state/types';
8
8
  export interface TestRpcConfig {
@@ -83,6 +83,10 @@ export declare class TestRpc extends Connection implements CompressionApiInterfa
83
83
  */
84
84
  getStateTreeInfos(): Promise<TreeInfo[]>;
85
85
  doFetch(): Promise<TreeInfo[]>;
86
+ /**
87
+ * Get a V2 address tree info.
88
+ */
89
+ getAddressTreeInfoV2(): Promise<TreeInfo>;
86
90
  /**
87
91
  * Fetch the compressed account for the specified account hash
88
92
  */
@@ -232,8 +236,10 @@ export declare class TestRpc extends Connection implements CompressionApiInterfa
232
236
  */
233
237
  getValidityProof(hashes?: BN254[], newAddresses?: BN254[]): Promise<ValidityProofWithContext>;
234
238
  getValidityProofV0(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<ValidityProofWithContext>;
235
- getCompressibleAccountInfo(address: PublicKey, programId: PublicKey, addressTreeInfo: TreeInfo, rpc: TestRpc): Promise<{
236
- accountInfo: AccountInfo<Buffer>;
237
- merkleContext?: MerkleContext;
238
- } | null>;
239
+ getValidityProofV2(accountMerkleContexts?: any[], newAddresses?: any[], derivationMode?: any): Promise<ValidityProofWithContext>;
240
+ getAccountInfoInterface(_address: PublicKey, _programId: PublicKey, _addressSpaceInfo: any): Promise<any>;
241
+ getSignaturesForAddressInterface(_address: PublicKey, _options?: any, _compressedOptions?: PaginatedOptions): Promise<any>;
242
+ getSignaturesForOwnerInterface(_owner: PublicKey, _options?: any, _compressedOptions?: PaginatedOptions): Promise<any>;
243
+ getTokenAccountBalanceInterface(_address: PublicKey, _owner: PublicKey, _mint: PublicKey, _commitment?: any): Promise<any>;
244
+ getBalanceInterface(_address: PublicKey, _commitment?: any): Promise<any>;
239
245
  }
@@ -1,28 +1,16 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
- /**
3
- * Derive an address for a compressed account from a seed and an address Merkle
4
- * tree public key.
5
- *
6
- * @param seed 32 bytes seed to derive the address from
7
- * @param addressMerkleTreePubkey Address Merkle tree public key as bytes.
8
- * @param programIdBytes Program ID bytes.
9
- * @returns Derived address as bytes
10
- */
11
- export declare function deriveAddressV2(seed: Uint8Array, addressMerkleTreePubkey: Uint8Array, programIdBytes: Uint8Array): Uint8Array;
12
- export declare function hashVWithBumpSeed(bytes: Uint8Array[]): Uint8Array;
13
2
  export declare function deriveAddressSeed(seeds: Uint8Array[], programId: PublicKey): Uint8Array;
3
+ export declare function deriveAddress(seed: Uint8Array, addressMerkleTreePubkey?: PublicKey): PublicKey;
4
+ export declare function deriveAddressSeedV2(seeds: Uint8Array[]): Uint8Array;
14
5
  /**
15
- * @deprecated Use {@link deriveAddressV2} instead, unless you're using v1.
16
- *
17
- * Derive an address for a compressed account from a seed and an address Merkle
18
- * tree public key.
6
+ * Derives an address from a seed using the v2 method (matching Rust's derive_address_from_seed)
19
7
  *
20
- * @param seed Seed to derive the address from
21
- * @param addressMerkleTreePubkey Merkle tree public key. Defaults to
22
- * defaultTestStateTreeAccounts().addressTree
8
+ * @param addressSeed The address seed (32 bytes)
9
+ * @param addressMerkleTreePubkey Merkle tree public key
10
+ * @param programId Program ID
23
11
  * @returns Derived address
24
12
  */
25
- export declare function deriveAddress(seed: Uint8Array, addressMerkleTreePubkey?: PublicKey): PublicKey;
13
+ export declare function deriveAddressV2(addressSeed: Uint8Array, addressMerkleTreePubkey: PublicKey, programId: PublicKey): PublicKey;
26
14
  export interface NewAddressParams {
27
15
  /**
28
16
  * Seed for the compressed account. Must be seed used to derive
@@ -21,8 +21,8 @@ export declare const toCamelCase: (object: any) => any;
21
21
  * @deprecated Use `hashvToBn254FieldSizeBe` instead.
22
22
  */
23
23
  export declare function hashToBn254FieldSizeBe(bytes: Buffer): [Buffer, number] | null;
24
+ export declare function hashvToBn254FieldSizeBeU8Array(bytes: Uint8Array[]): Uint8Array;
24
25
  /**
25
- * TODO: make consistent with latest rust. (use u8::max bumpseed)
26
26
  * Hash the provided `bytes` with Keccak256 and ensure that the result fits in
27
27
  * the BN254 prime field by truncating the resulting hash to 31 bytes.
28
28
  *
@@ -1,6 +1,21 @@
1
1
  import { Connection, PublicKey } from '@solana/web3.js';
2
2
  import { TreeInfo, TreeType } from '../state/types';
3
+ import { MerkleContext } from '../state/compressed-account';
3
4
  import { StateTreeLUTPair } from '../constants';
5
+ /**
6
+ * Get the currently active output queue from a merkle context.
7
+ *
8
+ * @param merkleContext The merkle context to get the output queue from
9
+ * @returns The output queue public key
10
+ */
11
+ export declare function getOutputQueue(merkleContext: MerkleContext): PublicKey;
12
+ /**
13
+ * Get the currently active output tree info from a merkle context.
14
+ *
15
+ * @param merkleContext The merkle context to get the output tree info from
16
+ * @returns The output tree info
17
+ */
18
+ export declare function getOutputTreeInfo(merkleContext: MerkleContext): TreeInfo;
4
19
  /**
5
20
  * @deprecated use {@link getTreeInfoByPubkey} instead
6
21
  */
@@ -3,6 +3,7 @@ export * from './airdrop';
3
3
  export * from './calculate-compute-unit-price';
4
4
  export * from './conversion';
5
5
  export * from './dedupe-signer';
6
+ export * from './instruction';
6
7
  export * from './parse-validity-proof';
7
8
  export * from './pipe';
8
9
  export * from './send-and-confirm';
@@ -10,4 +11,4 @@ export * from './sleep';
10
11
  export * from './validation';
11
12
  export * from './state-tree-lookup-table';
12
13
  export * from './get-state-tree-infos';
13
- export * from './packed-accounts';
14
+ export * from './pack-decompress';
@@ -0,0 +1,35 @@
1
+ import { AccountMeta, PublicKey } from '@solana/web3.js';
2
+ export declare class PackedAccounts {
3
+ private preAccounts;
4
+ private systemAccounts;
5
+ private nextIndex;
6
+ private map;
7
+ static newWithSystemAccounts(config: SystemAccountMetaConfig): PackedAccounts;
8
+ static newWithSystemAccountsV2(config: SystemAccountMetaConfig): PackedAccounts;
9
+ addPreAccountsSigner(pubkey: PublicKey): void;
10
+ addPreAccountsSignerMut(pubkey: PublicKey): void;
11
+ addPreAccountsMeta(accountMeta: AccountMeta): void;
12
+ addSystemAccounts(config: SystemAccountMetaConfig): void;
13
+ addSystemAccountsV2(config: SystemAccountMetaConfig): void;
14
+ insertOrGet(pubkey: PublicKey): number;
15
+ insertOrGetReadOnly(pubkey: PublicKey): number;
16
+ insertOrGetConfig(pubkey: PublicKey, isSigner: boolean, isWritable: boolean): number;
17
+ private hashSetAccountsToMetas;
18
+ private getOffsets;
19
+ toAccountMetas(): {
20
+ remainingAccounts: AccountMeta[];
21
+ systemStart: number;
22
+ packedStart: number;
23
+ };
24
+ }
25
+ export declare class SystemAccountMetaConfig {
26
+ selfProgram: PublicKey;
27
+ cpiContext?: PublicKey;
28
+ solCompressionRecipient?: PublicKey;
29
+ solPoolPda?: PublicKey;
30
+ private constructor();
31
+ static new(selfProgram: PublicKey): SystemAccountMetaConfig;
32
+ static newWithCpiContext(selfProgram: PublicKey, cpiContext: PublicKey): SystemAccountMetaConfig;
33
+ }
34
+ export declare function getLightSystemAccountMetas(config: SystemAccountMetaConfig): AccountMeta[];
35
+ export declare function getLightSystemAccountMetasV2(config: SystemAccountMetaConfig): AccountMeta[];
@@ -0,0 +1,31 @@
1
+ import { PublicKey, AccountMeta } from '@solana/web3.js';
2
+ import { ValidityProof } from '../state';
3
+ import { TreeInfo } from '../state/types';
4
+ export interface AccountDataWithTreeInfo {
5
+ key: string;
6
+ data: any;
7
+ treeInfo: TreeInfo;
8
+ }
9
+ export interface PackedDecompressResult {
10
+ proofOption: {
11
+ 0: ValidityProof | null;
12
+ };
13
+ compressedAccounts: any[];
14
+ systemAccountsOffset: number;
15
+ remainingAccounts: AccountMeta[];
16
+ }
17
+ /**
18
+ * Pack accounts and proof for decompressAccountsIdempotent instruction.
19
+ * This function prepares compressed account data, validity proof, and remaining accounts
20
+ * for idempotent decompression operations.
21
+ *
22
+ * @param programId - The program ID
23
+ * @param proof - The validity proof with context
24
+ * @param accountsData - Array of account data with tree info
25
+ * @param addresses - Array of account addresses
26
+ * @returns Packed instruction parameters
27
+ */
28
+ export declare function packDecompressAccountsIdempotent(programId: PublicKey, proof: {
29
+ compressedProof: ValidityProof | null;
30
+ treeInfos: TreeInfo[];
31
+ }, accountsData: AccountDataWithTreeInfo[], addresses: PublicKey[]): Promise<PackedDecompressResult>;
@@ -61,10 +61,24 @@ export declare const isLocalTest: (url: string) => boolean;
61
61
  * @internal
62
62
  */
63
63
  export declare const localTestActiveStateTreeInfos: () => TreeInfo[];
64
+ export declare const getDefaultAddressSpace: () => {
65
+ tree: PublicKey;
66
+ queue: PublicKey;
67
+ cpiContext: undefined;
68
+ treeType: TreeType;
69
+ nextTreeInfo: null;
70
+ };
64
71
  export declare const getDefaultAddressTreeInfo: () => {
65
72
  tree: PublicKey;
66
73
  queue: PublicKey;
67
- cpiContext: null;
74
+ cpiContext: undefined;
75
+ treeType: TreeType;
76
+ nextTreeInfo: null;
77
+ };
78
+ export declare const getBatchAddressTreeInfo: () => {
79
+ tree: PublicKey;
80
+ queue: PublicKey;
81
+ cpiContext: undefined;
68
82
  treeType: TreeType;
69
83
  nextTreeInfo: null;
70
84
  };
@@ -89,6 +103,7 @@ export declare const defaultTestStateTreeAccounts2: () => {
89
103
  merkleTree2: PublicKey;
90
104
  };
91
105
  export declare const COMPRESSED_TOKEN_PROGRAM_ID: PublicKey;
106
+ export declare const CTOKEN_PROGRAM_ID: PublicKey;
92
107
  export declare const stateTreeLookupTableMainnet = "7i86eQs3GSqHjN47WdWLTCGMW6gde1q96G2EVnUyK2st";
93
108
  export declare const nullifiedStateTreeLookupTableMainnet = "H9QD4u1fG7KmkAzn2tDXhheushxFe1EcrjGGyEFXeMqT";
94
109
  export declare const stateTreeLookupTableDevnet = "Dk9mNkbiZXJZ4By8DfSP6HEE4ojZzRvucwpawLeuwq8q";
@@ -98,13 +113,28 @@ export declare const cpiContextPubkey = "cpi1uHzrEhBG733DoEJNgHCyRS3XmmyVNZx5fon
98
113
  export declare const merkletreePubkey = "smt1NamzXdq4AMqS2fS2F1i5KTYPZRhoHgWx38d8WsT";
99
114
  export declare const addressTree = "amt1Ayt45jfbdw5YSo7iz6WZxUmnZsQTYXy82hVwyC2";
100
115
  export declare const addressQueue = "aq1S9z4reTSQAdgWHGD2zDaS39sjGrAxbR31vxJ2F4F";
101
- export declare const addressTreeV2: PublicKey;
102
116
  export declare const merkleTree2Pubkey = "smt2rJAFdyJJupwMKAqTNAJwvjhmiZ4JYGZmbVRw1Ho";
103
117
  export declare const nullifierQueue2Pubkey = "nfq2hgS7NYemXsFaFUCe3EMXSDSfnZnAe27jC6aPP1X";
104
118
  export declare const cpiContext2Pubkey = "cpi2cdhkH5roePvcudTgUL8ppEBfTay1desGh8G8QxK";
105
- export declare const batchMerkleTree = "HLKs5NJ8FXkJg8BrzJt56adFYYuwg5etzDtBbQYTsixu";
106
- export declare const batchQueue = "6L7SzhYB3anwEQ9cphpJ1U7Scwj57bx2xueReg7R9cKU";
107
- export declare const batchCpiContext = "7Hp52chxaew8bW1ApR4fck2bh6Y8qA1pu3qwH6N9zaLj";
119
+ export declare const batchMerkleTree1 = "bmt1LryLZUMmF7ZtqESaw7wifBXLfXHQYoE4GAmrahU";
120
+ export declare const batchQueue1 = "oq1na8gojfdUhsfCpyjNt6h4JaDWtHf1yQj4koBWfto";
121
+ export declare const batchCpiContext1 = "cpi15BoVPKgEPw5o8wc2T816GE7b378nMXnhH3Xbq4y";
122
+ export declare const batchMerkleTree2 = "bmt2UxoBxB9xWev4BkLvkGdapsz6sZGkzViPNph7VFi";
123
+ export declare const batchQueue2 = "oq2UkeMsJLfXt2QHzim242SUi3nvjJs8Pn7Eac9H9vg";
124
+ export declare const batchCpiContext2 = "cpi2yGapXUR3As5SjnHBAVvmApNiLsbeZpF3euWnW6B";
125
+ export declare const batchMerkleTree3 = "bmt3ccLd4bqSVZVeCJnH1F6C8jNygAhaDfxDwePyyGb";
126
+ export declare const batchQueue3 = "oq3AxjekBWgo64gpauB6QtuZNesuv19xrhaC1ZM1THQ";
127
+ export declare const batchCpiContext3 = "cpi3mbwMpSX8FAGMZVP85AwxqCaQMfEk9Em1v8QK9Rf";
128
+ export declare const batchMerkleTree4 = "bmt4d3p1a4YQgk9PeZv5s4DBUmbF5NxqYpk9HGjQsd8";
129
+ export declare const batchQueue4 = "oq4ypwvVGzCUMoiKKHWh4S1SgZJ9vCvKpcz6RT6A8dq";
130
+ export declare const batchCpiContext4 = "cpi4yyPDc4bCgHAnsenunGA8Y77j3XEDyjgfyCKgcoc";
131
+ export declare const batchMerkleTree5 = "bmt5yU97jC88YXTuSukYHa8Z5Bi2ZDUtmzfkDTA2mG2";
132
+ export declare const batchQueue5 = "oq5oh5ZR3yGomuQgFduNDzjtGvVWfDRGLuDVjv9a96P";
133
+ export declare const batchCpiContext5 = "cpi5ZTjdgYpZ1Xr7B1cMLLUE81oTtJbNNAyKary2nV6";
134
+ export declare const batchAddressTree = "amt2kaJA14v3urZbZvnc5v2np8jqvc4Z8zDep5wbtzx";
135
+ export declare const testBatchAddressTree = "EzKE84aVTkCUhDHLELqyJaq1Y7UVVmqxXqZjVHwHY3rK";
136
+ export declare const batchMerkleTree = "bmt1LryLZUMmF7ZtqESaw7wifBXLfXHQYoE4GAmrahU";
137
+ export declare const batchQueue = "oq1na8gojfdUhsfCpyjNt6h4JaDWtHf1yQj4koBWfto";
108
138
  export declare const confirmConfig: ConfirmOptions;
109
139
  export declare const DEFAULT_MERKLE_TREE_HEIGHT = 26;
110
140
  export declare const DEFAULT_MERKLE_TREE_ROOTS = 2800;
@@ -137,6 +167,10 @@ export declare const ADDRESS_QUEUE_ROLLOVER_FEE: BN;
137
167
  */
138
168
  export declare const STATE_MERKLE_TREE_NETWORK_FEE: BN;
139
169
  /**
140
- * Is charged if the transaction creates at least one address.
170
+ * Is charged per address the transaction creates.
171
+ */
172
+ export declare const ADDRESS_TREE_NETWORK_FEE_V1: BN;
173
+ /**
174
+ * Is charged per address the transaction creates.
141
175
  */
142
- export declare const ADDRESS_TREE_NETWORK_FEE: BN;
176
+ export declare const ADDRESS_TREE_NETWORK_FEE_V2: BN;