@lightprotocol/stateless.js 0.22.0 → 0.22.1-alpha.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 (39) hide show
  1. package/README.md +10 -10
  2. package/dist/cjs/browser/compressible/action.d.ts +77 -0
  3. package/dist/cjs/browser/compressible/index.d.ts +13 -0
  4. package/dist/cjs/browser/compressible/instruction.d.ts +177 -0
  5. package/dist/cjs/browser/compressible/layout.d.ts +47 -0
  6. package/dist/cjs/browser/compressible/types.d.ts +112 -0
  7. package/dist/cjs/browser/compressible/utils.d.ts +16 -0
  8. package/dist/cjs/browser/constants.d.ts +7 -5
  9. package/dist/cjs/browser/index.cjs +1 -1
  10. package/dist/cjs/browser/index.cjs.map +1 -1
  11. package/dist/cjs/browser/index.d.ts +1 -0
  12. package/dist/cjs/browser/programs/system/pack.d.ts +79 -10
  13. package/dist/cjs/browser/rpc-interface.d.ts +47 -47
  14. package/dist/cjs/browser/rpc.d.ts +17 -3
  15. package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +6 -2
  16. package/dist/cjs/browser/utils/address.d.ts +13 -0
  17. package/dist/cjs/browser/utils/conversion.d.ts +1 -0
  18. package/dist/cjs/browser/utils/index.d.ts +1 -0
  19. package/dist/cjs/browser/utils/packed-accounts.d.ts +161 -0
  20. package/dist/cjs/node/compressible/action.d.ts +77 -0
  21. package/dist/cjs/node/compressible/index.d.ts +13 -0
  22. package/dist/cjs/node/compressible/instruction.d.ts +177 -0
  23. package/dist/cjs/node/compressible/layout.d.ts +47 -0
  24. package/dist/cjs/node/compressible/types.d.ts +112 -0
  25. package/dist/cjs/node/compressible/utils.d.ts +16 -0
  26. package/dist/cjs/node/constants.d.ts +7 -5
  27. package/dist/cjs/node/index.cjs +1 -1
  28. package/dist/cjs/node/index.cjs.map +1 -1
  29. package/dist/cjs/node/index.d.ts +1 -0
  30. package/dist/cjs/node/programs/system/pack.d.ts +79 -10
  31. package/dist/cjs/node/rpc-interface.d.ts +47 -47
  32. package/dist/cjs/node/rpc.d.ts +17 -3
  33. package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +6 -2
  34. package/dist/cjs/node/utils/address.d.ts +13 -0
  35. package/dist/cjs/node/utils/conversion.d.ts +1 -0
  36. package/dist/cjs/node/utils/index.d.ts +1 -0
  37. package/dist/cjs/node/utils/packed-accounts.d.ts +161 -0
  38. package/dist/types/index.d.ts +665 -45
  39. package/package.json +1 -1
package/README.md CHANGED
@@ -32,18 +32,18 @@ For a more detailed documentation on usage, please check [the respective section
32
32
 
33
33
  For example implementations, including web and Node, refer to the respective repositories:
34
34
 
35
- - [Web application example implementation](https://github.com/Lightprotocol/example-web-client)
35
+ - [Web application example implementation](https://github.com/Lightprotocol/example-web-client)
36
36
 
37
- - [Node server example implementation](https://github.com/Lightprotocol/example-nodejs-client)
37
+ - [Node server example implementation](https://github.com/Lightprotocol/example-nodejs-client)
38
38
 
39
39
  ## Troubleshooting
40
40
 
41
41
  Have a question or a problem?
42
42
  Feel free to ask in the [Light](https://discord.gg/CYvjBgzRFP) and [Helius](https://discord.gg/Uzzf6a7zKr) developer Discord servers. Please, include the following information:
43
43
 
44
- - A detailed description or context of the issue or what you are trying to achieve.
45
- - A code example that we can use to test and debug (if possible). Use [CodeSandbox](https://codesandbox.io/p/sandbox/vanilla-ts) or any other live environment provider.
46
- - A description or context of any errors you are encountering with stacktraces if available.
44
+ - A detailed description or context of the issue or what you are trying to achieve.
45
+ - A code example that we can use to test and debug (if possible). Use [CodeSandbox](https://codesandbox.io/p/sandbox/vanilla-ts) or any other live environment provider.
46
+ - A description or context of any errors you are encountering with stacktraces if available.
47
47
 
48
48
  ### Source Maps
49
49
 
@@ -57,14 +57,14 @@ We provide `index.js.map` for debugging. Exclude in production:
57
57
 
58
58
  Light and ZK Compression are open source protocols and very much welcome contributions. If you have a contribution, do not hesitate to send a PR to the respective repository or discuss in the linked developer Discord servers.
59
59
 
60
- - 🐞 For bugs or feature requests, please open an
61
- [issue](https://github.com/lightprotocol/light-protocol/issues/new).
62
- - 🔒 For security vulnerabilities, please follow the [security policy](https://github.com/Lightprotocol/light-protocol/blob/main/SECURITY.md).
60
+ - 🐞 For bugs or feature requests, please open an
61
+ [issue](https://github.com/lightprotocol/light-protocol/issues/new).
62
+ - 🔒 For security vulnerabilities, please follow the [security policy](https://github.com/Lightprotocol/light-protocol/blob/main/SECURITY.md).
63
63
 
64
64
  ## Additional Resources
65
65
 
66
- - [Light Protocol Repository](https://github.com/Lightprotocol/light-protocol)
67
- - [ZK Compression Official Documentation](https://www.zkcompression.com/)
66
+ - [Light Protocol Repository](https://github.com/Lightprotocol/light-protocol)
67
+ - [ZK Compression Official Documentation](https://www.zkcompression.com/)
68
68
 
69
69
  ## Disclaimer
70
70
 
@@ -0,0 +1,77 @@
1
+ import { ConfirmOptions, PublicKey, Signer, TransactionSignature, AccountMeta } from '@solana/web3.js';
2
+ import { Rpc } from '../rpc';
3
+ import { ValidityProof } from '../state/types';
4
+ import { CompressedAccountMeta } from '../state/compressed-account';
5
+ import { CompressedAccountData } from './types';
6
+ /**
7
+ * Initialize a compression config for a compressible program
8
+ *
9
+ * @param rpc RPC connection to use
10
+ * @param payer Fee payer
11
+ * @param programId Program ID for the compressible program
12
+ * @param authority Program upgrade authority
13
+ * @param compressionDelay Compression delay (in slots)
14
+ * @param rentRecipient Rent recipient public key
15
+ * @param addressSpace Array of address space public keys
16
+ * @param configBump Optional config bump (defaults to 0)
17
+ * @param discriminator Optional custom discriminator (defaults to standard)
18
+ * @param confirmOptions Options for confirming the transaction
19
+ *
20
+ * @return Signature of the confirmed transaction
21
+ */
22
+ export declare function initializeCompressionConfig(rpc: Rpc, payer: Signer, programId: PublicKey, authority: Signer, compressionDelay: number, rentRecipient: PublicKey, addressSpace: PublicKey[], configBump?: number | null, discriminator?: Uint8Array | number[], confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
23
+ /**
24
+ * Update a compression config for a compressible program
25
+ *
26
+ * @param rpc RPC connection to use
27
+ * @param payer Fee payer
28
+ * @param programId Program ID for the compressible program
29
+ * @param authority Current config authority
30
+ * @param newCompressionDelay Optional new compression delay
31
+ * @param newRentRecipient Optional new rent recipient
32
+ * @param newAddressSpace Optional new address space array
33
+ * @param newUpdateAuthority Optional new update authority
34
+ * @param discriminator Optional custom discriminator (defaults to standard)
35
+ * @param confirmOptions Options for confirming the transaction
36
+ *
37
+ * @return Signature of the confirmed transaction
38
+ */
39
+ export declare function updateCompressionConfig(rpc: Rpc, payer: Signer, programId: PublicKey, authority: Signer, newCompressionDelay?: number | null, newRentRecipient?: PublicKey | null, newAddressSpace?: PublicKey[] | null, newUpdateAuthority?: PublicKey | null, discriminator?: Uint8Array | number[], confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
40
+ /**
41
+ * Compress a generic compressible account
42
+ *
43
+ * @param rpc RPC connection to use
44
+ * @param payer Fee payer and signer
45
+ * @param programId Program ID for the compressible program
46
+ * @param pdaToCompress PDA to compress
47
+ * @param rentRecipient Rent recipient public key
48
+ * @param compressedAccountMeta Compressed account metadata
49
+ * @param validityProof Validity proof for compression
50
+ * @param systemAccounts Additional system accounts (trees, queues, etc.)
51
+ * @param discriminator Custom instruction discriminator (8 bytes)
52
+ * @param confirmOptions Options for confirming the transaction
53
+ *
54
+ * @return Signature of the confirmed transaction
55
+ */
56
+ export declare function compressAccount(rpc: Rpc, payer: Signer, programId: PublicKey, pdaToCompress: PublicKey, rentRecipient: PublicKey, compressedAccountMeta: CompressedAccountMeta, validityProof: ValidityProof, systemAccounts: AccountMeta[], discriminator: Uint8Array | number[], confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
57
+ /**
58
+ * Decompress one or more compressed accounts idempotently
59
+ *
60
+ * @param rpc RPC connection to use
61
+ * @param payer Fee payer
62
+ * @param programId Program ID for the compressible program
63
+ * @param feePayer Fee payer (can be same as payer)
64
+ * @param rentPayer Rent payer
65
+ * @param solanaAccounts Array of PDA accounts to decompress
66
+ * @param compressedAccountsData Array of compressed account data
67
+ * @param bumps Array of PDA bumps
68
+ * @param validityProof Validity proof for decompression
69
+ * @param systemAccounts Additional system accounts (trees, queues, etc.)
70
+ * @param dataSchema Borsh schema for account data serialization
71
+ * @param discriminator Optional custom discriminator (defaults to standard)
72
+ * @param confirmOptions Options for confirming the transaction
73
+ *
74
+ * @return Signature of the confirmed transaction
75
+ */
76
+ export declare function decompressAccountsIdempotent<T = any>(rpc: Rpc, payer: Signer, programId: PublicKey, feePayer: Signer, rentPayer: Signer, solanaAccounts: PublicKey[], compressedAccountsData: CompressedAccountData<T>[], bumps: number[], validityProof: ValidityProof, systemAccounts: AccountMeta[], dataSchema: any, // borsh.Layout<T>
77
+ discriminator?: Uint8Array | number[], confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
@@ -0,0 +1,13 @@
1
+ export { COMPRESSIBLE_DISCRIMINATORS, DecompressMultipleAccountsIdempotentData, UpdateCompressionConfigData, GenericCompressAccountInstruction, } from './types';
2
+ export { UpdateCompressionConfigSchema, ValidityProofSchema, PackedStateTreeInfoSchema, CompressedAccountMetaSchema, GenericCompressAccountInstructionSchema, createCompressedAccountDataSchema, createDecompressMultipleAccountsIdempotentDataSchema, serializeInstructionData, } from './layout';
3
+ export { createInitializeCompressionConfigInstruction, createUpdateCompressionConfigInstruction, createCompressAccountInstruction, createDecompressAccountsIdempotentInstruction, CompressibleInstruction, } from './instruction';
4
+ export { initializeCompressionConfig, updateCompressionConfig, compressAccount, decompressAccountsIdempotent, } from './action';
5
+ export { deriveCompressionConfigAddress, getProgramDataAccount, checkProgramUpdateAuthority, } from './utils';
6
+ export { serializeInitializeCompressionConfigData } from './layout';
7
+ import { CompressedAccount } from '../state/compressed-account';
8
+ import { CompressedAccountData } from './types';
9
+ /**
10
+ * Convert a compressed account to the format expected by instruction builders
11
+ */
12
+ export declare function createCompressedAccountData<T>(compressedAccount: CompressedAccount, data: T, seeds: Uint8Array[], outputStateTreeIndex: number): CompressedAccountData<T>;
13
+ export { CompressibleInstruction as compressibleInstruction } from './instruction';
@@ -0,0 +1,177 @@
1
+ import { PublicKey, TransactionInstruction, AccountMeta } from '@solana/web3.js';
2
+ import { CompressedAccountData } from './types';
3
+ import { CompressedAccount } from '../state/compressed-account';
4
+ /**
5
+ * Create an instruction to initialize a compression config.
6
+ *
7
+ * @param programId Program ID for the compressible program
8
+ * @param discriminator Instruction discriminator (8 bytes)
9
+ * @param payer Fee payer
10
+ * @param authority Program upgrade authority
11
+ * @param compressionDelay Compression delay (in slots)
12
+ * @param rentRecipient Rent recipient public key
13
+ * @param addressSpace Array of address space public keys
14
+ * @param configBump Optional config bump (defaults to 0)
15
+ * @returns TransactionInstruction
16
+ */
17
+ export declare function createInitializeCompressionConfigInstruction(programId: PublicKey, discriminator: Uint8Array | number[], payer: PublicKey, authority: PublicKey, compressionDelay: number, rentRecipient: PublicKey, addressSpace: PublicKey[], configBump?: number | null): TransactionInstruction;
18
+ /**
19
+ * Create an instruction to update a compression config.
20
+ *
21
+ * @param programId Program ID for the compressible program
22
+ * @param discriminator Instruction discriminator (8 bytes)
23
+ * @param authority Current config authority
24
+ * @param newCompressionDelay Optional new compression delay
25
+ * @param newRentRecipient Optional new rent recipient
26
+ * @param newAddressSpace Optional new address space array
27
+ * @param newUpdateAuthority Optional new update authority
28
+ * @returns TransactionInstruction
29
+ */
30
+ export declare function createUpdateCompressionConfigInstruction(programId: PublicKey, discriminator: Uint8Array | number[], authority: PublicKey, newCompressionDelay?: number | null, newRentRecipient?: PublicKey | null, newAddressSpace?: PublicKey[] | null, newUpdateAuthority?: PublicKey | null): TransactionInstruction;
31
+ /**
32
+ * Create an instruction to compress a generic compressible account.
33
+ *
34
+ * @param programId Program ID for the compressible program
35
+ * @param discriminator Instruction discriminator (8 bytes)
36
+ * @param payer Fee payer
37
+ * @param pdaToCompress PDA to compress
38
+ * @param rentRecipient Rent recipient public key
39
+ * @param compressedAccountMeta Compressed account metadata
40
+ * @param validityProof Validity proof for compression
41
+ * @param systemAccounts Additional system accounts (optional)
42
+ * @returns TransactionInstruction
43
+ */
44
+ export declare function createCompressAccountInstruction(programId: PublicKey, discriminator: Uint8Array | number[], payer: PublicKey, pdaToCompress: PublicKey, rentRecipient: PublicKey, compressedAccountMeta: import('../state/compressed-account').CompressedAccountMeta, validityProof: import('../state/types').ValidityProof, systemAccounts?: AccountMeta[]): TransactionInstruction;
45
+ /**
46
+ * Create an instruction to decompress one or more compressed accounts idempotently.
47
+ *
48
+ * @param programId Program ID for the compressible program
49
+ * @param discriminator Instruction discriminator (8 bytes)
50
+ * @param feePayer Fee payer
51
+ * @param rentPayer Rent payer
52
+ * @param solanaAccounts Array of PDA accounts to decompress
53
+ * @param compressedAccountsData Array of compressed account data
54
+ * @param bumps Array of PDA bumps
55
+ * @param validityProof Validity proof for decompression
56
+ * @param systemAccounts Additional system accounts (optional)
57
+ * @param coder Borsh schema for account data
58
+ * @returns TransactionInstruction
59
+ */
60
+ export declare function createDecompressAccountsIdempotentInstruction<T = any>(programId: PublicKey, discriminator: Uint8Array | number[], feePayer: PublicKey, rentPayer: PublicKey, solanaAccounts: PublicKey[], compressedAccountsData: import('./types').CompressedAccountData<T>[], bumps: number[], validityProof: import('../state/types').ValidityProof, systemAccounts: AccountMeta[] | undefined, coder: (data: any) => Buffer): TransactionInstruction;
61
+ /**
62
+ * Instruction builders for compressible accounts, following Solana SDK patterns.
63
+ */
64
+ export declare class CompressibleInstruction {
65
+ /**
66
+ * Create an instruction to initialize a compression config.
67
+ *
68
+ * @param programId Program ID for the compressible program
69
+ * @param discriminator Instruction discriminator (8 bytes)
70
+ * @param payer Fee payer
71
+ * @param authority Program upgrade authority
72
+ * @param compressionDelay Compression delay (in slots)
73
+ * @param rentRecipient Rent recipient public key
74
+ * @param addressSpace Array of address space public keys
75
+ * @param configBump Optional config bump (defaults to 0)
76
+ * @returns TransactionInstruction
77
+ */
78
+ static initializeCompressionConfig(programId: PublicKey, discriminator: Uint8Array | number[], payer: PublicKey, authority: PublicKey, compressionDelay: number, rentRecipient: PublicKey, addressSpace: PublicKey[], configBump?: number | null): TransactionInstruction;
79
+ /**
80
+ * Create an instruction to update a compression config.
81
+ *
82
+ * @param programId Program ID for the compressible program
83
+ * @param discriminator Instruction discriminator (8 bytes)
84
+ * @param authority Current config authority
85
+ * @param newCompressionDelay Optional new compression delay
86
+ * @param newRentRecipient Optional new rent recipient
87
+ * @param newAddressSpace Optional new address space array
88
+ * @param newUpdateAuthority Optional new update authority
89
+ * @returns TransactionInstruction
90
+ */
91
+ static updateCompressionConfig(programId: PublicKey, discriminator: Uint8Array | number[], authority: PublicKey, newCompressionDelay?: number | null, newRentRecipient?: PublicKey | null, newAddressSpace?: PublicKey[] | null, newUpdateAuthority?: PublicKey | null): TransactionInstruction;
92
+ /**
93
+ * Create an instruction to compress a generic compressible account.
94
+ *
95
+ * @param programId Program ID for the compressible program
96
+ * @param discriminator Instruction discriminator (8 bytes)
97
+ * @param payer Fee payer
98
+ * @param pdaToCompress PDA to compress
99
+ * @param rentRecipient Rent recipient public key
100
+ * @param compressedAccountMeta Compressed account metadata
101
+ * @param validityProof Validity proof for compression
102
+ * @param systemAccounts Additional system accounts (optional)
103
+ * @returns TransactionInstruction
104
+ */
105
+ static compressAccount(programId: PublicKey, discriminator: Uint8Array | number[], payer: PublicKey, pdaToCompress: PublicKey, rentRecipient: PublicKey, compressedAccountMeta: import('../state/compressed-account').CompressedAccountMeta, validityProof: import('../state/types').ValidityProof, systemAccounts?: AccountMeta[]): TransactionInstruction;
106
+ /**
107
+ * Create an instruction to decompress one or more compressed accounts idempotently.
108
+ *
109
+ * @param programId Program ID for the compressible program
110
+ * @param discriminator Instruction discriminator (8 bytes)
111
+ * @param feePayer Fee payer
112
+ * @param rentPayer Rent payer
113
+ * @param solanaAccounts Array of PDA accounts to decompress
114
+ * @param compressedAccountsData Array of compressed account data
115
+ * @param bumps Array of PDA bumps
116
+ * @param validityProof Validity proof for decompression
117
+ * @param systemAccounts Additional system accounts (optional)
118
+ * @param dataSchema Borsh schema for account data
119
+ * @returns TransactionInstruction
120
+ */
121
+ static decompressAccountsIdempotent<T = any>(programId: PublicKey, discriminator: Uint8Array | number[], feePayer: PublicKey, rentPayer: PublicKey, solanaAccounts: PublicKey[], compressedAccountsData: import('./types').CompressedAccountData<T>[], bumps: number[], validityProof: import('../state/types').ValidityProof, systemAccounts?: AccountMeta[], dataSchema?: any): TransactionInstruction;
122
+ /**
123
+ * Standard instruction discriminators for compressible instructions
124
+ */
125
+ static readonly DISCRIMINATORS: {
126
+ readonly INITIALIZE_COMPRESSION_CONFIG: readonly [133, 228, 12, 169, 56, 76, 222, 61];
127
+ readonly UPDATE_COMPRESSION_CONFIG: readonly [135, 215, 243, 81, 163, 146, 33, 70];
128
+ readonly DECOMPRESS_ACCOUNTS_IDEMPOTENT: readonly [114, 67, 61, 123, 234, 31, 1, 112];
129
+ };
130
+ /**
131
+ * Derive the compression config PDA address
132
+ *
133
+ * @param programId Program ID for the compressible program
134
+ * @param configIndex Config index (defaults to 0)
135
+ * @returns [PDA address, bump seed]
136
+ */
137
+ static deriveCompressionConfigAddress(programId: PublicKey, configIndex?: number): [PublicKey, number];
138
+ /**
139
+ * Get the program data account address and its raw data for a given program
140
+ *
141
+ * @param programId Program ID
142
+ * @param connection Solana connection
143
+ * @returns Program data address and account info
144
+ */
145
+ static getProgramDataAccount(programId: PublicKey, connection: import('@solana/web3.js').Connection): Promise<{
146
+ programDataAddress: PublicKey;
147
+ programDataAccountInfo: import('@solana/web3.js').AccountInfo<Buffer>;
148
+ }>;
149
+ /**
150
+ * Check that the provided authority matches the program's upgrade authority
151
+ *
152
+ * @param programDataAccountInfo Program data account info
153
+ * @param providedAuthority Authority to validate
154
+ * @throws Error if authority doesn't match
155
+ */
156
+ static checkProgramUpdateAuthority(programDataAccountInfo: import('@solana/web3.js').AccountInfo<Buffer>, providedAuthority: PublicKey): void;
157
+ /**
158
+ * Serialize instruction data for initializeCompressionConfig using Borsh
159
+ *
160
+ * @param compressionDelay Compression delay (in slots)
161
+ * @param rentRecipient Rent recipient public key
162
+ * @param addressSpace Array of address space public keys
163
+ * @param configBump Optional config bump
164
+ * @returns Serialized instruction data with discriminator
165
+ */
166
+ static serializeInitializeCompressionConfigData(compressionDelay: number, rentRecipient: PublicKey, addressSpace: PublicKey[], configBump: number | null): Buffer;
167
+ /**
168
+ * Convert a compressed account to the format expected by instruction builders
169
+ *
170
+ * @param compressedAccount Compressed account from state
171
+ * @param data Program-specific account data
172
+ * @param seeds PDA seeds (without bump)
173
+ * @param outputStateTreeIndex Output state tree index
174
+ * @returns Compressed account data for instructions
175
+ */
176
+ static createCompressedAccountData<T>(compressedAccount: CompressedAccount, data: T, seeds: Uint8Array[], outputStateTreeIndex: number): CompressedAccountData<T>;
177
+ }
@@ -0,0 +1,47 @@
1
+ import * as borsh from '@coral-xyz/borsh';
2
+ import { ValidityProof } from '../state/types';
3
+ import { PackedStateTreeInfo, CompressedAccountMeta } from '../state/compressed-account';
4
+ import { CompressionConfigIxData, UpdateCompressionConfigData, GenericCompressAccountInstruction, CompressedAccountData, DecompressMultipleAccountsIdempotentData } from './types';
5
+ /**
6
+ * Borsh schema for initializeCompressionConfig instruction data
7
+ * Note: This is also available from '@lightprotocol/stateless.js' main exports
8
+ */
9
+ export declare const InitializeCompressionConfigSchema: borsh.Layout<CompressionConfigIxData>;
10
+ /**
11
+ * Borsh schema for updateCompressionConfig instruction data
12
+ */
13
+ export declare const UpdateCompressionConfigSchema: borsh.Layout<UpdateCompressionConfigData>;
14
+ /**
15
+ * Borsh schema for ValidityProof
16
+ */
17
+ export declare const ValidityProofSchema: borsh.Layout<ValidityProof>;
18
+ /**
19
+ * Borsh schema for PackedStateTreeInfo
20
+ */
21
+ export declare const PackedStateTreeInfoSchema: borsh.Layout<PackedStateTreeInfo>;
22
+ /**
23
+ * Borsh schema for CompressedAccountMeta
24
+ */
25
+ export declare const CompressedAccountMetaSchema: borsh.Layout<CompressedAccountMeta>;
26
+ /**
27
+ * Borsh schema for GenericCompressAccountInstruction
28
+ */
29
+ export declare const GenericCompressAccountInstructionSchema: borsh.Layout<GenericCompressAccountInstruction>;
30
+ /**
31
+ * Helper function to create borsh schema for CompressedAccountData
32
+ * This is generic to work with any data type T
33
+ */
34
+ export declare function createCompressedAccountDataSchema<T>(dataSchema: borsh.Layout<T>): borsh.Layout<CompressedAccountData<T>>;
35
+ /**
36
+ * Helper function to create borsh schema for DecompressMultipleAccountsIdempotentData
37
+ * This is generic to work with any data type T
38
+ */
39
+ export declare function createDecompressMultipleAccountsIdempotentDataSchema<T>(dataSchema: borsh.Layout<T>): borsh.Layout<DecompressMultipleAccountsIdempotentData<T>>;
40
+ /**
41
+ * Serialize instruction data with custom discriminator
42
+ */
43
+ export declare function serializeInstructionData<T>(schema: borsh.Layout<T>, data: T, discriminator: Uint8Array | number[]): Buffer;
44
+ /**
45
+ * Serialize instruction data for initializeCompressionConfig using Borsh
46
+ */
47
+ export declare function serializeInitializeCompressionConfigData(compressionDelay: number, rentRecipient: import('@solana/web3.js').PublicKey, addressSpace: import('@solana/web3.js').PublicKey[], configBump: number | null): Buffer;
@@ -0,0 +1,112 @@
1
+ import { PublicKey, AccountMeta } from '@solana/web3.js';
2
+ import { ValidityProof } from '../state/types';
3
+ import { CompressedAccountMeta } from '../state/compressed-account';
4
+ /**
5
+ * Standard instruction discriminators for compressible instructions
6
+ * These match the Rust implementation discriminators
7
+ */
8
+ export declare const COMPRESSIBLE_DISCRIMINATORS: {
9
+ readonly INITIALIZE_COMPRESSION_CONFIG: readonly [133, 228, 12, 169, 56, 76, 222, 61];
10
+ readonly UPDATE_COMPRESSION_CONFIG: readonly [135, 215, 243, 81, 163, 146, 33, 70];
11
+ readonly DECOMPRESS_ACCOUNTS_IDEMPOTENT: readonly [114, 67, 61, 123, 234, 31, 1, 112];
12
+ };
13
+ /**
14
+ * Generic compressed account data structure for decompress operations
15
+ * This is generic over the account variant type, allowing programs to use their specific enums
16
+ */
17
+ export type CompressedAccountData<T = any> = {
18
+ /** The compressed account metadata containing tree info, address, and output index */
19
+ meta: CompressedAccountMeta;
20
+ /** Program-specific account variant enum */
21
+ data: T;
22
+ /** PDA seeds (without bump) used to derive the PDA address */
23
+ seeds: Uint8Array[];
24
+ };
25
+ /**
26
+ * Instruction data structure for decompress_accounts_idempotent
27
+ * This matches the exact format expected by Anchor programs
28
+ */
29
+ export type DecompressMultipleAccountsIdempotentData<T = any> = {
30
+ proof: ValidityProof;
31
+ compressedAccounts: CompressedAccountData<T>[];
32
+ bumps: number[];
33
+ systemAccountsOffset: number;
34
+ };
35
+ /**
36
+ * Instruction data for update compression config
37
+ */
38
+ export type UpdateCompressionConfigData = {
39
+ newCompressionDelay: number | null;
40
+ newRentRecipient: PublicKey | null;
41
+ newAddressSpace: PublicKey[] | null;
42
+ newUpdateAuthority: PublicKey | null;
43
+ };
44
+ /**
45
+ * Generic instruction data for compress account
46
+ * This matches the expected format for compress account instructions
47
+ */
48
+ export type GenericCompressAccountInstruction = {
49
+ proof: ValidityProof;
50
+ compressedAccountMeta: CompressedAccountMeta;
51
+ };
52
+ /**
53
+ * Existing CompressionConfigIxData type (re-exported for compatibility)
54
+ */
55
+ export type CompressionConfigIxData = {
56
+ compressionDelay: number;
57
+ rentRecipient: PublicKey;
58
+ addressSpace: PublicKey[];
59
+ configBump: number | null;
60
+ };
61
+ /**
62
+ * Common instruction builder parameters
63
+ */
64
+ export type InstructionBuilderParams = {
65
+ programId: PublicKey;
66
+ discriminator: Uint8Array | number[];
67
+ };
68
+ /**
69
+ * Initialize compression config instruction parameters
70
+ */
71
+ export type InitializeCompressionConfigParams = InstructionBuilderParams & {
72
+ payer: PublicKey;
73
+ authority: PublicKey;
74
+ compressionDelay: number;
75
+ rentRecipient: PublicKey;
76
+ addressSpace: PublicKey[];
77
+ configBump?: number | null;
78
+ };
79
+ /**
80
+ * Update compression config instruction parameters
81
+ */
82
+ export type UpdateCompressionConfigParams = InstructionBuilderParams & {
83
+ authority: PublicKey;
84
+ newCompressionDelay?: number | null;
85
+ newRentRecipient?: PublicKey | null;
86
+ newAddressSpace?: PublicKey[] | null;
87
+ newUpdateAuthority?: PublicKey | null;
88
+ };
89
+ /**
90
+ * Compress account instruction parameters
91
+ */
92
+ export type CompressAccountParams = InstructionBuilderParams & {
93
+ payer: PublicKey;
94
+ pdaToCompress: PublicKey;
95
+ rentRecipient: PublicKey;
96
+ compressedAccountMeta: CompressedAccountMeta;
97
+ validityProof: ValidityProof;
98
+ systemAccounts?: AccountMeta[];
99
+ };
100
+ /**
101
+ * Decompress accounts idempotent instruction parameters
102
+ */
103
+ export type DecompressAccountsIdempotentParams<T = any> = InstructionBuilderParams & {
104
+ feePayer: PublicKey;
105
+ rentPayer: PublicKey;
106
+ solanaAccounts: PublicKey[];
107
+ compressedAccountsData: CompressedAccountData<T>[];
108
+ bumps: number[];
109
+ validityProof: ValidityProof;
110
+ systemAccounts?: AccountMeta[];
111
+ dataSchema?: any;
112
+ };
@@ -0,0 +1,16 @@
1
+ import { Connection, PublicKey, AccountInfo } from '@solana/web3.js';
2
+ /**
3
+ * Derive the compression config PDA address
4
+ */
5
+ export declare function deriveCompressionConfigAddress(programId: PublicKey, configIndex?: number): [PublicKey, number];
6
+ /**
7
+ * Get the program data account address and its raw data for a given program.
8
+ */
9
+ export declare function getProgramDataAccount(programId: PublicKey, connection: Connection): Promise<{
10
+ programDataAddress: PublicKey;
11
+ programDataAccountInfo: AccountInfo<Buffer>;
12
+ }>;
13
+ /**
14
+ * Check that the provided authority matches the program's upgrade authority.
15
+ */
16
+ export declare function checkProgramUpdateAuthority(programDataAccountInfo: AccountInfo<Buffer>, providedAuthority: PublicKey): void;
@@ -24,11 +24,11 @@ export declare const versionedEndpoint: (base: string) => string;
24
24
  export declare const FIELD_SIZE: BN;
25
25
  export declare const HIGHEST_ADDRESS_PLUS_ONE: BN;
26
26
  export declare const COMPUTE_BUDGET_PATTERN: number[];
27
- export declare const INVOKE_DISCRIMINATOR: Buffer;
28
- export declare const INVOKE_CPI_DISCRIMINATOR: Buffer;
29
- export declare const INVOKE_CPI_WITH_READ_ONLY_DISCRIMINATOR: Buffer;
30
- export declare const INVOKE_CPI_WITH_ACCOUNT_INFO_DISCRIMINATOR: Buffer;
31
- export declare const INSERT_INTO_QUEUES_DISCRIMINATOR: Buffer;
27
+ export declare const INVOKE_DISCRIMINATOR: Buffer<ArrayBuffer>;
28
+ export declare const INVOKE_CPI_DISCRIMINATOR: Buffer<ArrayBuffer>;
29
+ export declare const INVOKE_CPI_WITH_READ_ONLY_DISCRIMINATOR: Buffer<ArrayBuffer>;
30
+ export declare const INVOKE_CPI_WITH_ACCOUNT_INFO_DISCRIMINATOR: Buffer<ArrayBuffer>;
31
+ export declare const INSERT_INTO_QUEUES_DISCRIMINATOR: Buffer<ArrayBuffer>;
32
32
  export declare const noopProgram = "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV";
33
33
  export declare const lightSystemProgram = "SySTEM1eSU2p4BGQfQpimFEWWSC1XDFeun3Nqzz3rT7";
34
34
  export declare const accountCompressionProgram = "compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq";
@@ -98,11 +98,13 @@ export declare const cpiContextPubkey = "cpi1uHzrEhBG733DoEJNgHCyRS3XmmyVNZx5fon
98
98
  export declare const merkletreePubkey = "smt1NamzXdq4AMqS2fS2F1i5KTYPZRhoHgWx38d8WsT";
99
99
  export declare const addressTree = "amt1Ayt45jfbdw5YSo7iz6WZxUmnZsQTYXy82hVwyC2";
100
100
  export declare const addressQueue = "aq1S9z4reTSQAdgWHGD2zDaS39sjGrAxbR31vxJ2F4F";
101
+ export declare const addressTreeV2: PublicKey;
101
102
  export declare const merkleTree2Pubkey = "smt2rJAFdyJJupwMKAqTNAJwvjhmiZ4JYGZmbVRw1Ho";
102
103
  export declare const nullifierQueue2Pubkey = "nfq2hgS7NYemXsFaFUCe3EMXSDSfnZnAe27jC6aPP1X";
103
104
  export declare const cpiContext2Pubkey = "cpi2cdhkH5roePvcudTgUL8ppEBfTay1desGh8G8QxK";
104
105
  export declare const batchMerkleTree = "HLKs5NJ8FXkJg8BrzJt56adFYYuwg5etzDtBbQYTsixu";
105
106
  export declare const batchQueue = "6L7SzhYB3anwEQ9cphpJ1U7Scwj57bx2xueReg7R9cKU";
107
+ export declare const batchCpiContext = "7Hp52chxaew8bW1ApR4fck2bh6Y8qA1pu3qwH6N9zaLj";
106
108
  export declare const confirmConfig: ConfirmOptions;
107
109
  export declare const DEFAULT_MERKLE_TREE_HEIGHT = 26;
108
110
  export declare const DEFAULT_MERKLE_TREE_ROOTS = 2800;