@lightprotocol/stateless.js 0.16.0 → 0.17.1

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 (113) hide show
  1. package/dist/cjs/browser/actions/common.d.ts +1 -4
  2. package/dist/cjs/browser/actions/compress.d.ts +2 -14
  3. package/dist/cjs/browser/actions/create-account.d.ts +3 -27
  4. package/dist/cjs/browser/actions/decompress.d.ts +2 -14
  5. package/dist/cjs/browser/actions/transfer.d.ts +2 -15
  6. package/dist/cjs/browser/constants.d.ts +7 -14
  7. package/dist/cjs/browser/errors.d.ts +49 -40
  8. package/dist/cjs/browser/idls/account_compression.d.ts +56 -56
  9. package/dist/cjs/browser/idls/index.d.ts +4 -22
  10. package/dist/cjs/browser/idls/light_compressed_token.d.ts +209 -89
  11. package/dist/cjs/browser/idls/light_registry.d.ts +60 -60
  12. package/dist/cjs/browser/idls/light_system_program.d.ts +55 -55
  13. package/dist/cjs/browser/index.cjs +3223 -4792
  14. package/dist/cjs/browser/index.cjs.map +1 -1
  15. package/dist/cjs/browser/instruction/pack-compressed-accounts.d.ts +5 -24
  16. package/dist/cjs/browser/programs/system.d.ts +10 -61
  17. package/dist/cjs/browser/rpc-interface.d.ts +871 -1127
  18. package/dist/cjs/browser/rpc.d.ts +31 -143
  19. package/dist/cjs/browser/state/BN254.d.ts +2 -9
  20. package/dist/cjs/browser/state/compressed-account.d.ts +6 -23
  21. package/dist/cjs/browser/test-helpers/merkle-tree/indexed-array.d.ts +4 -18
  22. package/dist/cjs/browser/test-helpers/merkle-tree/merkle-tree.d.ts +6 -19
  23. package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +3 -12
  24. package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +5 -21
  25. package/dist/cjs/browser/test-helpers/test-rpc/get-parsed-events.d.ts +3 -10
  26. package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +31 -135
  27. package/dist/cjs/browser/utils/address.d.ts +3 -12
  28. package/dist/cjs/browser/utils/airdrop.d.ts +2 -14
  29. package/dist/cjs/browser/utils/calculate-compute-unit-price.d.ts +1 -4
  30. package/dist/cjs/browser/utils/conversion.d.ts +3 -9
  31. package/dist/cjs/browser/utils/parse-validity-proof.d.ts +1 -3
  32. package/dist/cjs/browser/utils/pipe.d.ts +1 -4
  33. package/dist/cjs/browser/utils/send-and-confirm.d.ts +11 -42
  34. package/dist/cjs/browser/utils/test-utils.d.ts +1 -5
  35. package/dist/cjs/browser/utils/validation.d.ts +2 -9
  36. package/dist/cjs/browser/wallet/interface.d.ts +4 -15
  37. package/dist/cjs/browser/wallet/use-wallet.d.ts +5 -20
  38. package/dist/cjs/node/actions/common.d.ts +1 -4
  39. package/dist/cjs/node/actions/compress.d.ts +2 -14
  40. package/dist/cjs/node/actions/create-account.d.ts +3 -27
  41. package/dist/cjs/node/actions/decompress.d.ts +2 -14
  42. package/dist/cjs/node/actions/transfer.d.ts +2 -15
  43. package/dist/cjs/node/constants.d.ts +7 -14
  44. package/dist/cjs/node/errors.d.ts +49 -40
  45. package/dist/cjs/node/idls/account_compression.d.ts +56 -56
  46. package/dist/cjs/node/idls/index.d.ts +4 -22
  47. package/dist/cjs/node/idls/light_compressed_token.d.ts +209 -89
  48. package/dist/cjs/node/idls/light_registry.d.ts +60 -60
  49. package/dist/cjs/node/idls/light_system_program.d.ts +55 -55
  50. package/dist/cjs/node/index.cjs +1070 -2329
  51. package/dist/cjs/node/index.cjs.map +1 -1
  52. package/dist/cjs/node/instruction/pack-compressed-accounts.d.ts +5 -24
  53. package/dist/cjs/node/programs/system.d.ts +10 -61
  54. package/dist/cjs/node/rpc-interface.d.ts +871 -1127
  55. package/dist/cjs/node/rpc.d.ts +31 -143
  56. package/dist/cjs/node/state/BN254.d.ts +2 -9
  57. package/dist/cjs/node/state/compressed-account.d.ts +6 -23
  58. package/dist/cjs/node/test-helpers/merkle-tree/indexed-array.d.ts +4 -18
  59. package/dist/cjs/node/test-helpers/merkle-tree/merkle-tree.d.ts +6 -19
  60. package/dist/cjs/node/test-helpers/test-rpc/get-compressed-accounts.d.ts +3 -12
  61. package/dist/cjs/node/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +5 -21
  62. package/dist/cjs/node/test-helpers/test-rpc/get-parsed-events.d.ts +3 -10
  63. package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +31 -135
  64. package/dist/cjs/node/utils/address.d.ts +3 -12
  65. package/dist/cjs/node/utils/airdrop.d.ts +2 -14
  66. package/dist/cjs/node/utils/calculate-compute-unit-price.d.ts +1 -4
  67. package/dist/cjs/node/utils/conversion.d.ts +3 -9
  68. package/dist/cjs/node/utils/parse-validity-proof.d.ts +1 -3
  69. package/dist/cjs/node/utils/pipe.d.ts +1 -4
  70. package/dist/cjs/node/utils/send-and-confirm.d.ts +11 -42
  71. package/dist/cjs/node/utils/test-utils.d.ts +1 -5
  72. package/dist/cjs/node/utils/validation.d.ts +2 -9
  73. package/dist/cjs/node/wallet/interface.d.ts +4 -15
  74. package/dist/cjs/node/wallet/use-wallet.d.ts +5 -20
  75. package/dist/es/browser/actions/common.d.ts +1 -4
  76. package/dist/es/browser/actions/compress.d.ts +2 -14
  77. package/dist/es/browser/actions/create-account.d.ts +3 -27
  78. package/dist/es/browser/actions/decompress.d.ts +2 -14
  79. package/dist/es/browser/actions/transfer.d.ts +2 -15
  80. package/dist/es/browser/constants.d.ts +7 -14
  81. package/dist/es/browser/errors.d.ts +49 -40
  82. package/dist/es/browser/idls/account_compression.d.ts +56 -56
  83. package/dist/es/browser/idls/index.d.ts +4 -22
  84. package/dist/es/browser/idls/light_compressed_token.d.ts +209 -89
  85. package/dist/es/browser/idls/light_registry.d.ts +60 -60
  86. package/dist/es/browser/idls/light_system_program.d.ts +55 -55
  87. package/dist/es/browser/index.js +3209 -4698
  88. package/dist/es/browser/index.js.map +1 -1
  89. package/dist/es/browser/instruction/pack-compressed-accounts.d.ts +5 -24
  90. package/dist/es/browser/programs/system.d.ts +10 -61
  91. package/dist/es/browser/rpc-interface.d.ts +871 -1127
  92. package/dist/es/browser/rpc.d.ts +31 -143
  93. package/dist/es/browser/state/BN254.d.ts +2 -9
  94. package/dist/es/browser/state/compressed-account.d.ts +6 -23
  95. package/dist/es/browser/test-helpers/merkle-tree/indexed-array.d.ts +4 -18
  96. package/dist/es/browser/test-helpers/merkle-tree/merkle-tree.d.ts +6 -19
  97. package/dist/es/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +3 -12
  98. package/dist/es/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +5 -21
  99. package/dist/es/browser/test-helpers/test-rpc/get-parsed-events.d.ts +3 -10
  100. package/dist/es/browser/test-helpers/test-rpc/test-rpc.d.ts +31 -135
  101. package/dist/es/browser/utils/address.d.ts +3 -12
  102. package/dist/es/browser/utils/airdrop.d.ts +2 -14
  103. package/dist/es/browser/utils/calculate-compute-unit-price.d.ts +1 -4
  104. package/dist/es/browser/utils/conversion.d.ts +3 -9
  105. package/dist/es/browser/utils/parse-validity-proof.d.ts +1 -3
  106. package/dist/es/browser/utils/pipe.d.ts +1 -4
  107. package/dist/es/browser/utils/send-and-confirm.d.ts +11 -42
  108. package/dist/es/browser/utils/test-utils.d.ts +1 -5
  109. package/dist/es/browser/utils/validation.d.ts +2 -9
  110. package/dist/es/browser/wallet/interface.d.ts +4 -15
  111. package/dist/es/browser/wallet/use-wallet.d.ts +5 -20
  112. package/dist/types/index.d.ts +1433 -2192
  113. package/package.json +1 -1
@@ -1,37 +1,10 @@
1
1
  import { Connection, ConnectionConfig, PublicKey } from '@solana/web3.js';
2
2
  import { Buffer } from 'buffer';
3
- import {
4
- CompressedProofWithContext,
5
- CompressedTransaction,
6
- CompressionApiInterface,
7
- GetCompressedTokenAccountsByOwnerOrDelegateOptions,
8
- HexInputsForProver,
9
- ParsedTokenAccount,
10
- SignatureWithMetadata,
11
- LatestNonVotingSignatures,
12
- LatestNonVotingSignaturesPaginated,
13
- WithContext,
14
- GetCompressedAccountsByOwnerConfig,
15
- WithCursor,
16
- AddressWithTree,
17
- HashWithTree,
18
- CompressedMintTokenHolders,
19
- TokenBalance,
20
- PaginatedOptions,
21
- } from './rpc-interface';
22
- import {
23
- MerkleContextWithMerkleProof,
24
- BN254,
25
- CompressedAccountWithMerkleContext,
26
- CompressedProof,
27
- } from './state';
3
+ import { CompressedProofWithContext, CompressedTransaction, CompressionApiInterface, GetCompressedTokenAccountsByOwnerOrDelegateOptions, HexInputsForProver, ParsedTokenAccount, SignatureWithMetadata, LatestNonVotingSignatures, LatestNonVotingSignaturesPaginated, WithContext, GetCompressedAccountsByOwnerConfig, WithCursor, AddressWithTree, HashWithTree, CompressedMintTokenHolders, TokenBalance, PaginatedOptions } from './rpc-interface';
4
+ import { MerkleContextWithMerkleProof, BN254, CompressedAccountWithMerkleContext, CompressedProof } from './state';
28
5
  import { BN } from '@coral-xyz/anchor';
29
6
  /** @internal */
30
- export declare function parseAccountData({
31
- discriminator,
32
- data,
33
- dataHash,
34
- }: {
7
+ export declare function parseAccountData({ discriminator, data, dataHash, }: {
35
8
  discriminator: BN;
36
9
  data: string;
37
10
  dataHash: BN;
@@ -50,27 +23,11 @@ export declare function parseAccountData({
50
23
  * to endpoint
51
24
  * @param connectionConfig Optional connection config
52
25
  */
53
- export declare function createRpc(
54
- endpointOrWeb3JsConnection?: string | Connection,
55
- compressionApiEndpoint?: string,
56
- proverEndpoint?: string,
57
- config?: ConnectionConfig,
58
- ): Rpc;
26
+ export declare function createRpc(endpointOrWeb3JsConnection?: string | Connection, compressionApiEndpoint?: string, proverEndpoint?: string, config?: ConnectionConfig): Rpc;
59
27
  /** @internal */
60
- export declare const rpcRequest: (
61
- rpcEndpoint: string,
62
- method: string,
63
- params?: any,
64
- convertToCamelCase?: boolean,
65
- debug?: boolean,
66
- ) => Promise<any>;
28
+ export declare const rpcRequest: (rpcEndpoint: string, method: string, params?: any, convertToCamelCase?: boolean, debug?: boolean) => Promise<any>;
67
29
  /** @internal */
68
- export declare const proverRequest: (
69
- proverEndpoint: string,
70
- method: 'inclusion' | 'new-address' | 'combined',
71
- params?: any,
72
- log?: boolean,
73
- ) => Promise<CompressedProof>;
30
+ export declare const proverRequest: (proverEndpoint: string, method: "inclusion" | "new-address" | "combined", params?: any, log?: boolean) => Promise<CompressedProof>;
74
31
  export type NonInclusionMerkleProofInputs = {
75
32
  root: BN;
76
33
  value: BN;
@@ -101,12 +58,8 @@ export type NonInclusionJsonStruct = {
101
58
  leafHigherRangeValue: string;
102
59
  nextIndex: number;
103
60
  };
104
- export declare function convertMerkleProofsWithContextToHex(
105
- merkleProofsWithContext: MerkleContextWithMerkleProof[],
106
- ): HexInputsForProver[];
107
- export declare function convertNonInclusionMerkleProofInputsToHex(
108
- nonInclusionMerkleProofInputs: MerkleContextWithNewAddressProof[],
109
- ): NonInclusionJsonStruct[];
61
+ export declare function convertMerkleProofsWithContextToHex(merkleProofsWithContext: MerkleContextWithMerkleProof[]): HexInputsForProver[];
62
+ export declare function convertNonInclusionMerkleProofInputsToHex(nonInclusionMerkleProofInputs: MerkleContextWithNewAddressProof[]): NonInclusionJsonStruct[];
110
63
  /**
111
64
  *
112
65
  */
@@ -121,19 +74,11 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
121
74
  * @param proverEndpoint Endpoint to the prover server.
122
75
  * @param connectionConfig Optional connection config
123
76
  */
124
- constructor(
125
- endpoint: string,
126
- compressionApiEndpoint: string,
127
- proverEndpoint: string,
128
- config?: ConnectionConfig,
129
- );
77
+ constructor(endpoint: string, compressionApiEndpoint: string, proverEndpoint: string, config?: ConnectionConfig);
130
78
  /**
131
79
  * Fetch the compressed account for the specified account address or hash
132
80
  */
133
- getCompressedAccount(
134
- address?: BN254,
135
- hash?: BN254,
136
- ): Promise<CompressedAccountWithMerkleContext | null>;
81
+ getCompressedAccount(address?: BN254, hash?: BN254): Promise<CompressedAccountWithMerkleContext | null>;
137
82
  /**
138
83
  * Fetch the compressed balance for the specified account address or hash
139
84
  */
@@ -146,46 +91,31 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
146
91
  * Fetch the latest merkle proof for the specified account hash from the
147
92
  * cluster
148
93
  */
149
- getCompressedAccountProof(
150
- hash: BN254,
151
- ): Promise<MerkleContextWithMerkleProof>;
94
+ getCompressedAccountProof(hash: BN254): Promise<MerkleContextWithMerkleProof>;
152
95
  /**
153
96
  * Fetch all the account info for multiple compressed accounts specified by
154
97
  * an array of account hashes
155
98
  */
156
- getMultipleCompressedAccounts(
157
- hashes: BN254[],
158
- ): Promise<CompressedAccountWithMerkleContext[]>;
99
+ getMultipleCompressedAccounts(hashes: BN254[]): Promise<CompressedAccountWithMerkleContext[]>;
159
100
  /**
160
101
  * Fetch the latest merkle proofs for multiple compressed accounts specified
161
102
  * by an array account hashes
162
103
  */
163
- getMultipleCompressedAccountProofs(
164
- hashes: BN254[],
165
- ): Promise<MerkleContextWithMerkleProof[]>;
104
+ getMultipleCompressedAccountProofs(hashes: BN254[]): Promise<MerkleContextWithMerkleProof[]>;
166
105
  /**
167
106
  * Fetch all the compressed accounts owned by the specified public key.
168
107
  * Owner can be a program or user account
169
108
  */
170
- getCompressedAccountsByOwner(
171
- owner: PublicKey,
172
- config?: GetCompressedAccountsByOwnerConfig | undefined,
173
- ): Promise<WithCursor<CompressedAccountWithMerkleContext[]>>;
109
+ getCompressedAccountsByOwner(owner: PublicKey, config?: GetCompressedAccountsByOwnerConfig | undefined): Promise<WithCursor<CompressedAccountWithMerkleContext[]>>;
174
110
  /**
175
111
  * Fetch all the compressed token accounts owned by the specified public
176
112
  * key. Owner can be a program or user account
177
113
  */
178
- getCompressedTokenAccountsByOwner(
179
- owner: PublicKey,
180
- options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions,
181
- ): Promise<WithCursor<ParsedTokenAccount[]>>;
114
+ getCompressedTokenAccountsByOwner(owner: PublicKey, options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<ParsedTokenAccount[]>>;
182
115
  /**
183
116
  * Fetch all the compressed accounts delegated to the specified public key.
184
117
  */
185
- getCompressedTokenAccountsByDelegate(
186
- delegate: PublicKey,
187
- options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions,
188
- ): Promise<WithCursor<ParsedTokenAccount[]>>;
118
+ getCompressedTokenAccountsByDelegate(delegate: PublicKey, options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<ParsedTokenAccount[]>>;
189
119
  /**
190
120
  * Fetch the compressed token balance for the specified account hash
191
121
  */
@@ -198,18 +128,12 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
198
128
  * Fetch all the compressed token balances owned by the specified public
199
129
  * key. Can filter by mint. Returns without context.
200
130
  */
201
- getCompressedTokenBalancesByOwner(
202
- owner: PublicKey,
203
- options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions,
204
- ): Promise<WithCursor<TokenBalance[]>>;
131
+ getCompressedTokenBalancesByOwner(owner: PublicKey, options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<TokenBalance[]>>;
205
132
  /**
206
133
  * Fetch the compressed token balances owned by the specified public
207
134
  * key. Paginated. Can filter by mint. Returns with context.
208
135
  */
209
- getCompressedTokenBalancesByOwnerV2(
210
- owner: PublicKey,
211
- options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions,
212
- ): Promise<WithContext<WithCursor<TokenBalance[]>>>;
136
+ getCompressedTokenBalancesByOwnerV2(owner: PublicKey, options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithContext<WithCursor<TokenBalance[]>>>;
213
137
  /**
214
138
  * Returns confirmed compression signatures for transactions involving the specified
215
139
  * account hash forward in time from genesis to the most recent confirmed
@@ -217,26 +141,19 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
217
141
  *
218
142
  * @param hash queried account hash
219
143
  */
220
- getCompressionSignaturesForAccount(
221
- hash: BN254,
222
- ): Promise<SignatureWithMetadata[]>;
144
+ getCompressionSignaturesForAccount(hash: BN254): Promise<SignatureWithMetadata[]>;
223
145
  /**
224
146
  * Fetch a confirmed or finalized transaction from the cluster. Return with
225
147
  * CompressionInfo
226
148
  */
227
- getTransactionWithCompressionInfo(
228
- signature: string,
229
- ): Promise<CompressedTransaction | null>;
149
+ getTransactionWithCompressionInfo(signature: string): Promise<CompressedTransaction | null>;
230
150
  /**
231
151
  * Returns confirmed signatures for transactions involving the specified
232
152
  * address forward in time from genesis to the most recent confirmed block
233
153
  *
234
154
  * @param address queried compressed account address
235
155
  */
236
- getCompressionSignaturesForAddress(
237
- address: PublicKey,
238
- options?: PaginatedOptions,
239
- ): Promise<WithCursor<SignatureWithMetadata[]>>;
156
+ getCompressionSignaturesForAddress(address: PublicKey, options?: PaginatedOptions): Promise<WithCursor<SignatureWithMetadata[]>>;
240
157
  /**
241
158
  * Returns confirmed signatures for compression transactions involving the
242
159
  * specified account owner forward in time from genesis to the
@@ -244,19 +161,13 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
244
161
  *
245
162
  * @param owner queried owner public key
246
163
  */
247
- getCompressionSignaturesForOwner(
248
- owner: PublicKey,
249
- options?: PaginatedOptions,
250
- ): Promise<WithCursor<SignatureWithMetadata[]>>;
164
+ getCompressionSignaturesForOwner(owner: PublicKey, options?: PaginatedOptions): Promise<WithCursor<SignatureWithMetadata[]>>;
251
165
  /**
252
166
  * Returns confirmed signatures for compression transactions involving the
253
167
  * specified token account owner forward in time from genesis to the most
254
168
  * recent confirmed block
255
169
  */
256
- getCompressionSignaturesForTokenOwner(
257
- owner: PublicKey,
258
- options?: PaginatedOptions,
259
- ): Promise<WithCursor<SignatureWithMetadata[]>>;
170
+ getCompressionSignaturesForTokenOwner(owner: PublicKey, options?: PaginatedOptions): Promise<WithCursor<SignatureWithMetadata[]>>;
260
171
  /**
261
172
  * Fetch the current indexer health status
262
173
  */
@@ -272,25 +183,16 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
272
183
  /**
273
184
  * Fetch all the compressed token holders for a given mint. Paginated.
274
185
  */
275
- getCompressedMintTokenHolders(
276
- mint: PublicKey,
277
- options?: PaginatedOptions,
278
- ): Promise<WithContext<WithCursor<CompressedMintTokenHolders[]>>>;
186
+ getCompressedMintTokenHolders(mint: PublicKey, options?: PaginatedOptions): Promise<WithContext<WithCursor<CompressedMintTokenHolders[]>>>;
279
187
  /**
280
188
  * Fetch the latest compression signatures on the cluster. Results are
281
189
  * paginated.
282
190
  */
283
- getLatestCompressionSignatures(
284
- cursor?: string,
285
- limit?: number,
286
- ): Promise<LatestNonVotingSignaturesPaginated>;
191
+ getLatestCompressionSignatures(cursor?: string, limit?: number): Promise<LatestNonVotingSignaturesPaginated>;
287
192
  /**
288
193
  * Fetch all non-voting signatures
289
194
  */
290
- getLatestNonVotingSignatures(
291
- limit?: number,
292
- cursor?: string,
293
- ): Promise<LatestNonVotingSignatures>;
195
+ getLatestNonVotingSignatures(limit?: number, cursor?: string): Promise<LatestNonVotingSignatures>;
294
196
  /**
295
197
  * Fetch the latest address proofs for new unique addresses specified by an
296
198
  * array of addresses.
@@ -300,9 +202,7 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
300
202
  * @param addresses Array of BN254 new addresses
301
203
  * @returns Array of validity proofs for new addresses
302
204
  */
303
- getMultipleNewAddressProofs(
304
- addresses: BN254[],
305
- ): Promise<MerkleContextWithNewAddressProof[]>;
205
+ getMultipleNewAddressProofs(addresses: BN254[]): Promise<MerkleContextWithNewAddressProof[]>;
306
206
  /**
307
207
  * Advanced usage of getValidityProof: fetches ZKP directly from a custom
308
208
  * non-rpcprover. Note: This uses the proverEndpoint specified in the
@@ -322,10 +222,7 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
322
222
  * @param newAddresses Array of BN254 new addresses.
323
223
  * @returns validity proof with context
324
224
  */
325
- getValidityProofDirect(
326
- hashes?: BN254[],
327
- newAddresses?: BN254[],
328
- ): Promise<CompressedProofWithContext>;
225
+ getValidityProofDirect(hashes?: BN254[], newAddresses?: BN254[]): Promise<CompressedProofWithContext>;
329
226
  /**
330
227
  * Fetch the latest validity proof for (1) compressed accounts specified by
331
228
  * an array of account hashes. (2) new unique addresses specified by an
@@ -340,10 +237,7 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
340
237
  * @param newAddresses Array of BN254 new addresses.
341
238
  * @returns validity proof with context
342
239
  */
343
- getValidityProof(
344
- hashes?: BN254[],
345
- newAddresses?: BN254[],
346
- ): Promise<CompressedProofWithContext>;
240
+ getValidityProof(hashes?: BN254[], newAddresses?: BN254[]): Promise<CompressedProofWithContext>;
347
241
  /**
348
242
  * Fetch the latest validity proof for (1) compressed accounts specified by
349
243
  * an array of account hashes. (2) new unique addresses specified by an
@@ -358,10 +252,7 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
358
252
  * @param newAddresses Array of { address: BN254, tree: PublicKey, queue: PublicKey }.
359
253
  * @returns validity proof with context
360
254
  */
361
- getValidityProofV0(
362
- hashes?: HashWithTree[],
363
- newAddresses?: AddressWithTree[],
364
- ): Promise<CompressedProofWithContext>;
255
+ getValidityProofV0(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<CompressedProofWithContext>;
365
256
  /**
366
257
  * Fetch the latest validity proof for (1) compressed accounts specified by
367
258
  * an array of account hashes. (2) new unique addresses specified by an
@@ -378,8 +269,5 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
378
269
  * state tree/queue.
379
270
  * @returns validity proof with context
380
271
  */
381
- getValidityProofAndRpcContext(
382
- hashes?: HashWithTree[],
383
- newAddresses?: AddressWithTree[],
384
- ): Promise<WithContext<CompressedProofWithContext>>;
272
+ getValidityProofAndRpcContext(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<WithContext<CompressedProofWithContext>>;
385
273
  }
@@ -7,15 +7,8 @@ import { Buffer } from 'buffer';
7
7
  * are used to from working with the web3.js PublicKey type.
8
8
  */
9
9
  export type BN254 = BN;
10
- export declare const bn: (
11
- number: string | number | BN | Buffer | Uint8Array | number[],
12
- base?: number | 'hex' | undefined,
13
- endian?: BN.Endianness | undefined,
14
- ) => BN;
10
+ export declare const bn: (number: string | number | BN | Buffer | Uint8Array | number[], base?: number | "hex" | undefined, endian?: BN.Endianness | undefined) => BN;
15
11
  /** Create a bigint instance with <254-bit max size and base58 capabilities */
16
- export declare const createBN254: (
17
- number: string | number | BN | Buffer | Uint8Array | number[],
18
- base?: number | 'hex' | 'base58' | undefined,
19
- ) => BN254;
12
+ export declare const createBN254: (number: string | number | BN | Buffer | Uint8Array | number[], base?: number | "hex" | "base58" | undefined) => BN254;
20
13
  /** Convert <254-bit bigint to Base58 string. */
21
14
  export declare function encodeBN254toBase58(bigintNumber: BN): string;
@@ -2,10 +2,9 @@ import { BN } from '@coral-xyz/anchor';
2
2
  import { PublicKey } from '@solana/web3.js';
3
3
  import { CompressedAccount, CompressedAccountData } from './types';
4
4
  import { BN254 } from './BN254';
5
- export type CompressedAccountWithMerkleContext = CompressedAccount &
6
- MerkleContext & {
7
- readOnly: boolean;
8
- };
5
+ export type CompressedAccountWithMerkleContext = CompressedAccount & MerkleContext & {
6
+ readOnly: boolean;
7
+ };
9
8
  /**
10
9
  * Context for compressed account inserted into a state Merkle tree
11
10
  * */
@@ -27,22 +26,6 @@ export type MerkleContextWithMerkleProof = MerkleContext & {
27
26
  /** Current root */
28
27
  root: BN254;
29
28
  };
30
- export declare const createCompressedAccount: (
31
- owner: PublicKey,
32
- lamports?: BN,
33
- data?: CompressedAccountData,
34
- address?: number[],
35
- ) => CompressedAccount;
36
- export declare const createCompressedAccountWithMerkleContext: (
37
- merkleContext: MerkleContext,
38
- owner: PublicKey,
39
- lamports?: BN,
40
- data?: CompressedAccountData,
41
- address?: number[],
42
- ) => CompressedAccountWithMerkleContext;
43
- export declare const createMerkleContext: (
44
- merkleTree: PublicKey,
45
- nullifierQueue: PublicKey,
46
- hash: number[],
47
- leafIndex: number,
48
- ) => MerkleContext;
29
+ export declare const createCompressedAccount: (owner: PublicKey, lamports?: BN, data?: CompressedAccountData, address?: number[]) => CompressedAccount;
30
+ export declare const createCompressedAccountWithMerkleContext: (merkleContext: MerkleContext, owner: PublicKey, lamports?: BN, data?: CompressedAccountData, address?: number[]) => CompressedAccountWithMerkleContext;
31
+ export declare const createMerkleContext: (merkleTree: PublicKey, nullifierQueue: PublicKey, hash: number[], leafIndex: number) => MerkleContext;
@@ -13,11 +13,7 @@ export declare class IndexedElementBundle {
13
13
  newLowElement: IndexedElement;
14
14
  newElement: IndexedElement;
15
15
  newElementNextValue: BN;
16
- constructor(
17
- newLowElement: IndexedElement,
18
- newElement: IndexedElement,
19
- newElementNextValue: BN,
20
- );
16
+ constructor(newLowElement: IndexedElement, newElement: IndexedElement, newElementNextValue: BN);
21
17
  }
22
18
  /**
23
19
  * This indexed array implementation mirrors the rust implementation of the
@@ -27,11 +23,7 @@ export declare class IndexedArray {
27
23
  elements: Array<IndexedElement>;
28
24
  currentNodeIndex: number;
29
25
  highestElementIndex: number;
30
- constructor(
31
- elements: Array<IndexedElement>,
32
- currentNodeIndex: number,
33
- highestElementIndex: number,
34
- );
26
+ constructor(elements: Array<IndexedElement>, currentNodeIndex: number, highestElementIndex: number);
35
27
  static default(): IndexedArray;
36
28
  get(index: number): IndexedElement | undefined;
37
29
  length(): number;
@@ -71,10 +63,7 @@ export declare class IndexedArray {
71
63
  * @param value The value of the new element to append.
72
64
  * @returns The new element and its updated low element.
73
65
  */
74
- appendWithLowElementIndex(
75
- lowElementIndex: number,
76
- value: BN,
77
- ): IndexedElementBundle;
66
+ appendWithLowElementIndex(lowElementIndex: number, value: BN): IndexedElementBundle;
78
67
  /**
79
68
  * Finds the lowest element in the array.
80
69
  * @returns The lowest element or undefined if the array is empty.
@@ -86,10 +75,7 @@ export declare class IndexedArray {
86
75
  * @param value The value for the new element.
87
76
  * @returns A bundle containing the new element, the updated low element, and the value of the next element.
88
77
  */
89
- newElementWithLowElementIndex(
90
- lowElementIndex: number,
91
- value: BN,
92
- ): IndexedElementBundle;
78
+ newElementWithLowElementIndex(lowElementIndex: number, value: BN): IndexedElementBundle;
93
79
  /**
94
80
  * Creates a new element with the specified value by first finding the appropriate low element index.
95
81
  * @param value The value for the new element.
@@ -1,5 +1,5 @@
1
1
  import { LightWasm } from '../test-rpc/test-rpc';
2
- export declare const DEFAULT_ZERO = '0';
2
+ export declare const DEFAULT_ZERO = "0";
3
3
  /**
4
4
  * @callback hashFunction
5
5
  * @param left Left leaf
@@ -23,16 +23,9 @@ export declare class MerkleTree {
23
23
  _zeros: string[];
24
24
  _layers: string[][];
25
25
  _lightWasm: LightWasm;
26
- constructor(
27
- levels: number,
28
- lightWasm: LightWasm,
29
- elements?: string[],
30
- {
31
- zeroElement,
32
- }?: {
33
- zeroElement?: string | undefined;
34
- },
35
- );
26
+ constructor(levels: number, lightWasm: LightWasm, elements?: string[], { zeroElement }?: {
27
+ zeroElement?: string | undefined;
28
+ });
36
29
  _rebuild(): void;
37
30
  /**
38
31
  * Get tree root
@@ -70,10 +63,7 @@ export declare class MerkleTree {
70
63
  * @param comparator A function that checks leaf value equality
71
64
  * @returns {number} Index if element is found, otherwise -1
72
65
  */
73
- indexOf(
74
- element: string,
75
- comparator?: ((element: string, el: string) => boolean) | null,
76
- ): number;
66
+ indexOf(element: string, comparator?: ((element: string, el: string) => boolean) | null): number;
77
67
  /**
78
68
  * Returns a copy of non-zero tree elements
79
69
  * @returns {Object[]}
@@ -98,8 +88,5 @@ export declare class MerkleTree {
98
88
  * @param hashFunction
99
89
  * @returns {MerkleTree}
100
90
  */
101
- static deserialize(
102
- data: any,
103
- hashFunction: (left: string, right: string) => string,
104
- ): any;
91
+ static deserialize(data: any, hashFunction: (left: string, right: string) => string): any;
105
92
  }
@@ -2,15 +2,6 @@ import { PublicKey } from '@solana/web3.js';
2
2
  import { BN } from '@coral-xyz/anchor';
3
3
  import { Rpc } from '../../rpc';
4
4
  import { CompressedAccountWithMerkleContext } from '../../state';
5
- export declare function getCompressedAccountsByOwnerTest(
6
- rpc: Rpc,
7
- owner: PublicKey,
8
- ): Promise<CompressedAccountWithMerkleContext[]>;
9
- export declare function getCompressedAccountByHashTest(
10
- rpc: Rpc,
11
- hash: BN,
12
- ): Promise<CompressedAccountWithMerkleContext | undefined>;
13
- export declare function getMultipleCompressedAccountsByHashTest(
14
- rpc: Rpc,
15
- hashes: BN[],
16
- ): Promise<CompressedAccountWithMerkleContext[]>;
5
+ export declare function getCompressedAccountsByOwnerTest(rpc: Rpc, owner: PublicKey): Promise<CompressedAccountWithMerkleContext[]>;
6
+ export declare function getCompressedAccountByHashTest(rpc: Rpc, hash: BN): Promise<CompressedAccountWithMerkleContext | undefined>;
7
+ export declare function getMultipleCompressedAccountsByHashTest(rpc: Rpc, hashes: BN[]): Promise<CompressedAccountWithMerkleContext[]>;
@@ -20,10 +20,7 @@ export type EventWithParsedTokenTlvData = {
20
20
  * @param compressedAccount - The compressed account
21
21
  * @returns The parsed token data
22
22
  */
23
- export declare function parseTokenLayoutWithIdl(
24
- compressedAccount: CompressedAccount,
25
- programId?: PublicKey,
26
- ): TokenData | null;
23
+ export declare function parseTokenLayoutWithIdl(compressedAccount: CompressedAccount, programId?: PublicKey): TokenData | null;
27
24
  /**
28
25
  * Retrieves all compressed token accounts for a given mint and owner.
29
26
  *
@@ -33,22 +30,9 @@ export declare function parseTokenLayoutWithIdl(
33
30
  * @param owner PublicKey of the token owner
34
31
  * @param mint PublicKey of the token mint
35
32
  */
36
- export declare function getCompressedTokenAccounts(
37
- events: PublicTransactionEvent[],
38
- ): Promise<ParsedTokenAccount[]>;
33
+ export declare function getCompressedTokenAccounts(events: PublicTransactionEvent[]): Promise<ParsedTokenAccount[]>;
39
34
  /** @internal */
40
- export declare function getCompressedTokenAccountsByOwnerTest(
41
- rpc: Rpc,
42
- owner: PublicKey,
43
- mint: PublicKey,
44
- ): Promise<WithCursor<ParsedTokenAccount[]>>;
45
- export declare function getCompressedTokenAccountsByDelegateTest(
46
- rpc: Rpc,
47
- delegate: PublicKey,
48
- mint: PublicKey,
49
- ): Promise<WithCursor<ParsedTokenAccount[]>>;
50
- export declare function getCompressedTokenAccountByHashTest(
51
- rpc: Rpc,
52
- hash: BN,
53
- ): Promise<ParsedTokenAccount>;
35
+ export declare function getCompressedTokenAccountsByOwnerTest(rpc: Rpc, owner: PublicKey, mint: PublicKey): Promise<WithCursor<ParsedTokenAccount[]>>;
36
+ export declare function getCompressedTokenAccountsByDelegateTest(rpc: Rpc, delegate: PublicKey, mint: PublicKey): Promise<WithCursor<ParsedTokenAccount[]>>;
37
+ export declare function getCompressedTokenAccountByHashTest(rpc: Rpc, hash: BN): Promise<ParsedTokenAccount>;
54
38
  export {};
@@ -7,14 +7,7 @@ type Deserializer<T> = (data: Buffer, tx: ParsedTransactionWithMeta) => T;
7
7
  * Returns newest first.
8
8
  *
9
9
  * */
10
- export declare function getParsedEvents(
11
- rpc: Rpc,
12
- ): Promise<PublicTransactionEvent[]>;
13
- export declare const parseEvents: <T>(
14
- indexerEventsTransactions: (ParsedTransactionWithMeta | null)[],
15
- deserializeFn: Deserializer<T>,
16
- ) => NonNullable<T>[];
17
- export declare const parsePublicTransactionEventWithIdl: (
18
- data: Buffer,
19
- ) => PublicTransactionEvent | null;
10
+ export declare function getParsedEvents(rpc: Rpc): Promise<PublicTransactionEvent[]>;
11
+ export declare const parseEvents: <T>(indexerEventsTransactions: (ParsedTransactionWithMeta | null)[], deserializeFn: Deserializer<T>) => NonNullable<T>[];
12
+ export declare const parsePublicTransactionEventWithIdl: (data: Buffer) => PublicTransactionEvent | null;
20
13
  export {};