@lightprotocol/stateless.js 0.20.3 → 0.20.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/browser/actions/common.d.ts +1 -4
- package/dist/cjs/browser/actions/compress.d.ts +2 -14
- package/dist/cjs/browser/actions/create-account.d.ts +3 -27
- package/dist/cjs/browser/actions/decompress.d.ts +2 -14
- package/dist/cjs/browser/actions/transfer.d.ts +2 -15
- package/dist/cjs/browser/constants.d.ts +15 -30
- package/dist/cjs/browser/errors.d.ts +49 -40
- package/dist/cjs/browser/idl.d.ts +45 -45
- package/dist/cjs/browser/index.cjs +1 -9611
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/browser/instruction/pack-compressed-accounts.d.ts +5 -24
- package/dist/cjs/browser/programs/layout.d.ts +17 -39
- package/dist/cjs/browser/programs/system.d.ts +10 -61
- package/dist/cjs/browser/rpc-interface.d.ts +871 -1127
- package/dist/cjs/browser/rpc.d.ts +34 -158
- package/dist/cjs/browser/state/BN254.d.ts +2 -9
- package/dist/cjs/browser/state/compressed-account.d.ts +6 -23
- package/dist/cjs/browser/state/types.d.ts +1 -1
- package/dist/cjs/browser/test-helpers/merkle-tree/indexed-array.d.ts +4 -18
- package/dist/cjs/browser/test-helpers/merkle-tree/merkle-tree.d.ts +6 -19
- package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +3 -12
- package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +5 -21
- package/dist/cjs/browser/test-helpers/test-rpc/get-parsed-events.d.ts +4 -14
- package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +31 -135
- package/dist/cjs/browser/test-helpers/test-utils.d.ts +1 -5
- package/dist/cjs/browser/utils/address.d.ts +3 -12
- package/dist/cjs/browser/utils/airdrop.d.ts +2 -14
- package/dist/cjs/browser/utils/calculate-compute-unit-price.d.ts +1 -4
- package/dist/cjs/browser/utils/conversion.d.ts +5 -9
- package/dist/cjs/browser/utils/get-light-state-tree-info.d.ts +4 -28
- package/dist/cjs/browser/utils/parse-validity-proof.d.ts +1 -3
- package/dist/cjs/browser/utils/pipe.d.ts +1 -4
- package/dist/cjs/browser/utils/send-and-confirm.d.ts +11 -42
- package/dist/cjs/browser/utils/validation.d.ts +6 -9
- package/dist/cjs/node/actions/common.d.ts +1 -4
- package/dist/cjs/node/actions/compress.d.ts +2 -14
- package/dist/cjs/node/actions/create-account.d.ts +3 -27
- package/dist/cjs/node/actions/decompress.d.ts +2 -14
- package/dist/cjs/node/actions/transfer.d.ts +2 -15
- package/dist/cjs/node/constants.d.ts +15 -30
- package/dist/cjs/node/errors.d.ts +49 -40
- package/dist/cjs/node/idl.d.ts +45 -45
- package/dist/cjs/node/index.cjs +1 -8310
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/cjs/node/instruction/pack-compressed-accounts.d.ts +5 -24
- package/dist/cjs/node/programs/layout.d.ts +17 -39
- package/dist/cjs/node/programs/system.d.ts +10 -61
- package/dist/cjs/node/rpc-interface.d.ts +871 -1127
- package/dist/cjs/node/rpc.d.ts +34 -158
- package/dist/cjs/node/state/BN254.d.ts +2 -9
- package/dist/cjs/node/state/compressed-account.d.ts +6 -23
- package/dist/cjs/node/state/types.d.ts +1 -1
- package/dist/cjs/node/test-helpers/merkle-tree/indexed-array.d.ts +4 -18
- package/dist/cjs/node/test-helpers/merkle-tree/merkle-tree.d.ts +6 -19
- package/dist/cjs/node/test-helpers/test-rpc/get-compressed-accounts.d.ts +3 -12
- package/dist/cjs/node/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +5 -21
- package/dist/cjs/node/test-helpers/test-rpc/get-parsed-events.d.ts +4 -14
- package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +31 -135
- package/dist/cjs/node/test-helpers/test-utils.d.ts +1 -5
- package/dist/cjs/node/utils/address.d.ts +3 -12
- package/dist/cjs/node/utils/airdrop.d.ts +2 -14
- package/dist/cjs/node/utils/calculate-compute-unit-price.d.ts +1 -4
- package/dist/cjs/node/utils/conversion.d.ts +5 -9
- package/dist/cjs/node/utils/get-light-state-tree-info.d.ts +4 -28
- package/dist/cjs/node/utils/parse-validity-proof.d.ts +1 -3
- package/dist/cjs/node/utils/pipe.d.ts +1 -4
- package/dist/cjs/node/utils/send-and-confirm.d.ts +11 -42
- package/dist/cjs/node/utils/validation.d.ts +6 -9
- package/dist/types/index.d.ts +1131 -2097
- package/package.json +2 -1
|
@@ -1,39 +1,12 @@
|
|
|
1
1
|
import { Connection, ConnectionConfig, PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { Buffer } from 'buffer';
|
|
3
|
-
import {
|
|
4
|
-
|
|
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 'bn.js';
|
|
29
6
|
import { LightWasm } from './test-helpers';
|
|
30
7
|
import { ActiveTreeBundle } from './state/types';
|
|
31
8
|
/** @internal */
|
|
32
|
-
export declare function parseAccountData({
|
|
33
|
-
discriminator,
|
|
34
|
-
data,
|
|
35
|
-
dataHash,
|
|
36
|
-
}: {
|
|
9
|
+
export declare function parseAccountData({ discriminator, data, dataHash, }: {
|
|
37
10
|
discriminator: BN;
|
|
38
11
|
data: string;
|
|
39
12
|
dataHash: BN;
|
|
@@ -52,12 +25,7 @@ export declare function parseAccountData({
|
|
|
52
25
|
* to endpoint
|
|
53
26
|
* @param connectionConfig Optional connection config
|
|
54
27
|
*/
|
|
55
|
-
export declare function createRpc(
|
|
56
|
-
endpointOrWeb3JsConnection?: string | Connection,
|
|
57
|
-
compressionApiEndpoint?: string,
|
|
58
|
-
proverEndpoint?: string,
|
|
59
|
-
config?: ConnectionConfig,
|
|
60
|
-
): Rpc;
|
|
28
|
+
export declare function createRpc(endpointOrWeb3JsConnection?: string | Connection, compressionApiEndpoint?: string, proverEndpoint?: string, config?: ConnectionConfig): Rpc;
|
|
61
29
|
/**
|
|
62
30
|
* Helper function to preprocess the response to wrap numbers as strings
|
|
63
31
|
* @param {string} text - The JSON string to preprocess
|
|
@@ -65,21 +33,9 @@ export declare function createRpc(
|
|
|
65
33
|
*/
|
|
66
34
|
export declare function wrapBigNumbersAsStrings(text: string): string;
|
|
67
35
|
/** @internal */
|
|
68
|
-
export declare const rpcRequest: (
|
|
69
|
-
rpcEndpoint: string,
|
|
70
|
-
method: string,
|
|
71
|
-
params?: any,
|
|
72
|
-
convertToCamelCase?: boolean,
|
|
73
|
-
debug?: boolean,
|
|
74
|
-
) => Promise<any>;
|
|
36
|
+
export declare const rpcRequest: (rpcEndpoint: string, method: string, params?: any, convertToCamelCase?: boolean, debug?: boolean) => Promise<any>;
|
|
75
37
|
/** @internal */
|
|
76
|
-
export declare const proverRequest: (
|
|
77
|
-
proverEndpoint: string,
|
|
78
|
-
method: 'inclusion' | 'new-address' | 'combined',
|
|
79
|
-
params?: any,
|
|
80
|
-
log?: boolean,
|
|
81
|
-
publicInputHash?: BN | undefined,
|
|
82
|
-
) => Promise<CompressedProof>;
|
|
38
|
+
export declare const proverRequest: (proverEndpoint: string, method: "inclusion" | "new-address" | "combined", params?: any, log?: boolean, publicInputHash?: BN | undefined) => Promise<CompressedProof>;
|
|
83
39
|
export type NonInclusionMerkleProofInputs = {
|
|
84
40
|
root: BN;
|
|
85
41
|
value: BN;
|
|
@@ -110,18 +66,9 @@ export type NonInclusionJsonStruct = {
|
|
|
110
66
|
leafHigherRangeValue: string;
|
|
111
67
|
nextIndex: number;
|
|
112
68
|
};
|
|
113
|
-
export declare function convertMerkleProofsWithContextToHex(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
export declare function convertNonInclusionMerkleProofInputsToHex(
|
|
117
|
-
nonInclusionMerkleProofInputs: MerkleContextWithNewAddressProof[],
|
|
118
|
-
): NonInclusionJsonStruct[];
|
|
119
|
-
export declare function getPublicInputHash(
|
|
120
|
-
accountProofs: MerkleContextWithMerkleProof[],
|
|
121
|
-
accountHashes: BN254[],
|
|
122
|
-
newAddressProofs: MerkleContextWithNewAddressProof[],
|
|
123
|
-
lightWasm: LightWasm,
|
|
124
|
-
): BN;
|
|
69
|
+
export declare function convertMerkleProofsWithContextToHex(merkleProofsWithContext: MerkleContextWithMerkleProof[]): HexInputsForProver[];
|
|
70
|
+
export declare function convertNonInclusionMerkleProofInputsToHex(nonInclusionMerkleProofInputs: MerkleContextWithNewAddressProof[]): NonInclusionJsonStruct[];
|
|
71
|
+
export declare function getPublicInputHash(accountProofs: MerkleContextWithMerkleProof[], accountHashes: BN254[], newAddressProofs: MerkleContextWithNewAddressProof[], lightWasm: LightWasm): BN;
|
|
125
72
|
/**
|
|
126
73
|
* Get the queue for a given tree
|
|
127
74
|
*
|
|
@@ -129,10 +76,7 @@ export declare function getPublicInputHash(
|
|
|
129
76
|
* @param tree - The tree to get the queue for
|
|
130
77
|
* @returns The queue for the given tree, or undefined if not found
|
|
131
78
|
*/
|
|
132
|
-
export declare function getQueueForTree(
|
|
133
|
-
info: ActiveTreeBundle[],
|
|
134
|
-
tree: PublicKey,
|
|
135
|
-
): PublicKey;
|
|
79
|
+
export declare function getQueueForTree(info: ActiveTreeBundle[], tree: PublicKey): PublicKey;
|
|
136
80
|
/**
|
|
137
81
|
* Get the tree for a given queue
|
|
138
82
|
*
|
|
@@ -140,10 +84,7 @@ export declare function getQueueForTree(
|
|
|
140
84
|
* @param queue - The queue to get the tree for
|
|
141
85
|
* @returns The tree for the given queue, or undefined if not found
|
|
142
86
|
*/
|
|
143
|
-
export declare function getTreeForQueue(
|
|
144
|
-
info: ActiveTreeBundle[],
|
|
145
|
-
queue: PublicKey,
|
|
146
|
-
): PublicKey;
|
|
87
|
+
export declare function getTreeForQueue(info: ActiveTreeBundle[], queue: PublicKey): PublicKey;
|
|
147
88
|
/**
|
|
148
89
|
* Get a random tree and queue from the active state tree addresses.
|
|
149
90
|
*
|
|
@@ -163,12 +104,7 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
163
104
|
compressionApiEndpoint: string;
|
|
164
105
|
proverEndpoint: string;
|
|
165
106
|
activeStateTreeInfo: ActiveTreeBundle[] | null;
|
|
166
|
-
constructor(
|
|
167
|
-
endpoint: string,
|
|
168
|
-
compressionApiEndpoint: string,
|
|
169
|
-
proverEndpoint: string,
|
|
170
|
-
config?: ConnectionConfig,
|
|
171
|
-
);
|
|
107
|
+
constructor(endpoint: string, compressionApiEndpoint: string, proverEndpoint: string, config?: ConnectionConfig);
|
|
172
108
|
/**
|
|
173
109
|
* Manually set state tree addresses
|
|
174
110
|
*/
|
|
@@ -185,10 +121,7 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
185
121
|
/**
|
|
186
122
|
* Fetch the compressed account for the specified account address or hash
|
|
187
123
|
*/
|
|
188
|
-
getCompressedAccount(
|
|
189
|
-
address?: BN254,
|
|
190
|
-
hash?: BN254,
|
|
191
|
-
): Promise<CompressedAccountWithMerkleContext | null>;
|
|
124
|
+
getCompressedAccount(address?: BN254, hash?: BN254): Promise<CompressedAccountWithMerkleContext | null>;
|
|
192
125
|
/**
|
|
193
126
|
* Fetch the compressed balance for the specified account address or hash
|
|
194
127
|
*/
|
|
@@ -201,46 +134,31 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
201
134
|
* Fetch the latest merkle proof for the specified account hash from the
|
|
202
135
|
* cluster
|
|
203
136
|
*/
|
|
204
|
-
getCompressedAccountProof(
|
|
205
|
-
hash: BN254,
|
|
206
|
-
): Promise<MerkleContextWithMerkleProof>;
|
|
137
|
+
getCompressedAccountProof(hash: BN254): Promise<MerkleContextWithMerkleProof>;
|
|
207
138
|
/**
|
|
208
139
|
* Fetch all the account info for multiple compressed accounts specified by
|
|
209
140
|
* an array of account hashes
|
|
210
141
|
*/
|
|
211
|
-
getMultipleCompressedAccounts(
|
|
212
|
-
hashes: BN254[],
|
|
213
|
-
): Promise<CompressedAccountWithMerkleContext[]>;
|
|
142
|
+
getMultipleCompressedAccounts(hashes: BN254[]): Promise<CompressedAccountWithMerkleContext[]>;
|
|
214
143
|
/**
|
|
215
144
|
* Fetch the latest merkle proofs for multiple compressed accounts specified
|
|
216
145
|
* by an array account hashes
|
|
217
146
|
*/
|
|
218
|
-
getMultipleCompressedAccountProofs(
|
|
219
|
-
hashes: BN254[],
|
|
220
|
-
): Promise<MerkleContextWithMerkleProof[]>;
|
|
147
|
+
getMultipleCompressedAccountProofs(hashes: BN254[]): Promise<MerkleContextWithMerkleProof[]>;
|
|
221
148
|
/**
|
|
222
149
|
* Fetch all the compressed accounts owned by the specified public key.
|
|
223
150
|
* Owner can be a program or user account
|
|
224
151
|
*/
|
|
225
|
-
getCompressedAccountsByOwner(
|
|
226
|
-
owner: PublicKey,
|
|
227
|
-
config?: GetCompressedAccountsByOwnerConfig | undefined,
|
|
228
|
-
): Promise<WithCursor<CompressedAccountWithMerkleContext[]>>;
|
|
152
|
+
getCompressedAccountsByOwner(owner: PublicKey, config?: GetCompressedAccountsByOwnerConfig | undefined): Promise<WithCursor<CompressedAccountWithMerkleContext[]>>;
|
|
229
153
|
/**
|
|
230
154
|
* Fetch all the compressed token accounts owned by the specified public
|
|
231
155
|
* key. Owner can be a program or user account
|
|
232
156
|
*/
|
|
233
|
-
getCompressedTokenAccountsByOwner(
|
|
234
|
-
owner: PublicKey,
|
|
235
|
-
options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions,
|
|
236
|
-
): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
157
|
+
getCompressedTokenAccountsByOwner(owner: PublicKey, options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
237
158
|
/**
|
|
238
159
|
* Fetch all the compressed accounts delegated to the specified public key.
|
|
239
160
|
*/
|
|
240
|
-
getCompressedTokenAccountsByDelegate(
|
|
241
|
-
delegate: PublicKey,
|
|
242
|
-
options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions,
|
|
243
|
-
): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
161
|
+
getCompressedTokenAccountsByDelegate(delegate: PublicKey, options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
244
162
|
/**
|
|
245
163
|
* Fetch the compressed token balance for the specified account hash
|
|
246
164
|
*/
|
|
@@ -253,18 +171,12 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
253
171
|
* Fetch all the compressed token balances owned by the specified public
|
|
254
172
|
* key. Can filter by mint. Returns without context.
|
|
255
173
|
*/
|
|
256
|
-
getCompressedTokenBalancesByOwner(
|
|
257
|
-
owner: PublicKey,
|
|
258
|
-
options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions,
|
|
259
|
-
): Promise<WithCursor<TokenBalance[]>>;
|
|
174
|
+
getCompressedTokenBalancesByOwner(owner: PublicKey, options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<TokenBalance[]>>;
|
|
260
175
|
/**
|
|
261
176
|
* Fetch the compressed token balances owned by the specified public
|
|
262
177
|
* key. Paginated. Can filter by mint. Returns with context.
|
|
263
178
|
*/
|
|
264
|
-
getCompressedTokenBalancesByOwnerV2(
|
|
265
|
-
owner: PublicKey,
|
|
266
|
-
options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions,
|
|
267
|
-
): Promise<WithContext<WithCursor<TokenBalance[]>>>;
|
|
179
|
+
getCompressedTokenBalancesByOwnerV2(owner: PublicKey, options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithContext<WithCursor<TokenBalance[]>>>;
|
|
268
180
|
/**
|
|
269
181
|
* Returns confirmed compression signatures for transactions involving the specified
|
|
270
182
|
* account hash forward in time from genesis to the most recent confirmed
|
|
@@ -272,26 +184,19 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
272
184
|
*
|
|
273
185
|
* @param hash queried account hash
|
|
274
186
|
*/
|
|
275
|
-
getCompressionSignaturesForAccount(
|
|
276
|
-
hash: BN254,
|
|
277
|
-
): Promise<SignatureWithMetadata[]>;
|
|
187
|
+
getCompressionSignaturesForAccount(hash: BN254): Promise<SignatureWithMetadata[]>;
|
|
278
188
|
/**
|
|
279
189
|
* Fetch a confirmed or finalized transaction from the cluster. Return with
|
|
280
190
|
* CompressionInfo
|
|
281
191
|
*/
|
|
282
|
-
getTransactionWithCompressionInfo(
|
|
283
|
-
signature: string,
|
|
284
|
-
): Promise<CompressedTransaction | null>;
|
|
192
|
+
getTransactionWithCompressionInfo(signature: string): Promise<CompressedTransaction | null>;
|
|
285
193
|
/**
|
|
286
194
|
* Returns confirmed signatures for transactions involving the specified
|
|
287
195
|
* address forward in time from genesis to the most recent confirmed block
|
|
288
196
|
*
|
|
289
197
|
* @param address queried compressed account address
|
|
290
198
|
*/
|
|
291
|
-
getCompressionSignaturesForAddress(
|
|
292
|
-
address: PublicKey,
|
|
293
|
-
options?: PaginatedOptions,
|
|
294
|
-
): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
199
|
+
getCompressionSignaturesForAddress(address: PublicKey, options?: PaginatedOptions): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
295
200
|
/**
|
|
296
201
|
* Returns confirmed signatures for compression transactions involving the
|
|
297
202
|
* specified account owner forward in time from genesis to the
|
|
@@ -299,19 +204,13 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
299
204
|
*
|
|
300
205
|
* @param owner queried owner public key
|
|
301
206
|
*/
|
|
302
|
-
getCompressionSignaturesForOwner(
|
|
303
|
-
owner: PublicKey,
|
|
304
|
-
options?: PaginatedOptions,
|
|
305
|
-
): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
207
|
+
getCompressionSignaturesForOwner(owner: PublicKey, options?: PaginatedOptions): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
306
208
|
/**
|
|
307
209
|
* Returns confirmed signatures for compression transactions involving the
|
|
308
210
|
* specified token account owner forward in time from genesis to the most
|
|
309
211
|
* recent confirmed block
|
|
310
212
|
*/
|
|
311
|
-
getCompressionSignaturesForTokenOwner(
|
|
312
|
-
owner: PublicKey,
|
|
313
|
-
options?: PaginatedOptions,
|
|
314
|
-
): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
213
|
+
getCompressionSignaturesForTokenOwner(owner: PublicKey, options?: PaginatedOptions): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
315
214
|
/**
|
|
316
215
|
* Fetch the current indexer health status
|
|
317
216
|
*/
|
|
@@ -327,25 +226,16 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
327
226
|
/**
|
|
328
227
|
* Fetch all the compressed token holders for a given mint. Paginated.
|
|
329
228
|
*/
|
|
330
|
-
getCompressedMintTokenHolders(
|
|
331
|
-
mint: PublicKey,
|
|
332
|
-
options?: PaginatedOptions,
|
|
333
|
-
): Promise<WithContext<WithCursor<CompressedMintTokenHolders[]>>>;
|
|
229
|
+
getCompressedMintTokenHolders(mint: PublicKey, options?: PaginatedOptions): Promise<WithContext<WithCursor<CompressedMintTokenHolders[]>>>;
|
|
334
230
|
/**
|
|
335
231
|
* Fetch the latest compression signatures on the cluster. Results are
|
|
336
232
|
* paginated.
|
|
337
233
|
*/
|
|
338
|
-
getLatestCompressionSignatures(
|
|
339
|
-
cursor?: string,
|
|
340
|
-
limit?: number,
|
|
341
|
-
): Promise<LatestNonVotingSignaturesPaginated>;
|
|
234
|
+
getLatestCompressionSignatures(cursor?: string, limit?: number): Promise<LatestNonVotingSignaturesPaginated>;
|
|
342
235
|
/**
|
|
343
236
|
* Fetch all non-voting signatures
|
|
344
237
|
*/
|
|
345
|
-
getLatestNonVotingSignatures(
|
|
346
|
-
limit?: number,
|
|
347
|
-
cursor?: string,
|
|
348
|
-
): Promise<LatestNonVotingSignatures>;
|
|
238
|
+
getLatestNonVotingSignatures(limit?: number, cursor?: string): Promise<LatestNonVotingSignatures>;
|
|
349
239
|
/**
|
|
350
240
|
* Fetch the latest address proofs for new unique addresses specified by an
|
|
351
241
|
* array of addresses.
|
|
@@ -355,9 +245,7 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
355
245
|
* @param addresses Array of BN254 new addresses
|
|
356
246
|
* @returns Array of validity proofs for new addresses
|
|
357
247
|
*/
|
|
358
|
-
getMultipleNewAddressProofs(
|
|
359
|
-
addresses: BN254[],
|
|
360
|
-
): Promise<MerkleContextWithNewAddressProof[]>;
|
|
248
|
+
getMultipleNewAddressProofs(addresses: BN254[]): Promise<MerkleContextWithNewAddressProof[]>;
|
|
361
249
|
/**
|
|
362
250
|
* Advanced usage of getValidityProof: fetches ZKP directly from a custom
|
|
363
251
|
* non-rpcprover. Note: This uses the proverEndpoint specified in the
|
|
@@ -377,10 +265,7 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
377
265
|
* @param newAddresses Array of BN254 new addresses.
|
|
378
266
|
* @returns validity proof with context
|
|
379
267
|
*/
|
|
380
|
-
getValidityProofDirect(
|
|
381
|
-
hashes?: BN254[],
|
|
382
|
-
newAddresses?: BN254[],
|
|
383
|
-
): Promise<CompressedProofWithContext>;
|
|
268
|
+
getValidityProofDirect(hashes?: BN254[], newAddresses?: BN254[]): Promise<CompressedProofWithContext>;
|
|
384
269
|
/**
|
|
385
270
|
* @deprecated use {@link getValidityProofV0} instead.
|
|
386
271
|
*
|
|
@@ -399,10 +284,7 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
399
284
|
* @param newAddresses Array of BN254 new addresses.
|
|
400
285
|
* @returns validity proof with context
|
|
401
286
|
*/
|
|
402
|
-
getValidityProof(
|
|
403
|
-
hashes?: BN254[],
|
|
404
|
-
newAddresses?: BN254[],
|
|
405
|
-
): Promise<CompressedProofWithContext>;
|
|
287
|
+
getValidityProof(hashes?: BN254[], newAddresses?: BN254[]): Promise<CompressedProofWithContext>;
|
|
406
288
|
/**
|
|
407
289
|
* Fetch the latest validity proof for (1) compressed accounts specified by
|
|
408
290
|
* an array of account hashes. (2) new unique addresses specified by an
|
|
@@ -417,10 +299,7 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
417
299
|
* @param newAddresses Array of { address: BN254, tree: PublicKey, queue: PublicKey }.
|
|
418
300
|
* @returns validity proof with context
|
|
419
301
|
*/
|
|
420
|
-
getValidityProofV0(
|
|
421
|
-
hashes?: HashWithTree[],
|
|
422
|
-
newAddresses?: AddressWithTree[],
|
|
423
|
-
): Promise<CompressedProofWithContext>;
|
|
302
|
+
getValidityProofV0(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<CompressedProofWithContext>;
|
|
424
303
|
/**
|
|
425
304
|
* Fetch the latest validity proof for (1) compressed accounts specified by
|
|
426
305
|
* an array of account hashes. (2) new unique addresses specified by an
|
|
@@ -437,8 +316,5 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
437
316
|
* state tree/queue.
|
|
438
317
|
* @returns validity proof with context
|
|
439
318
|
*/
|
|
440
|
-
getValidityProofAndRpcContext(
|
|
441
|
-
hashes?: HashWithTree[],
|
|
442
|
-
newAddresses?: AddressWithTree[],
|
|
443
|
-
): Promise<WithContext<CompressedProofWithContext>>;
|
|
319
|
+
getValidityProofAndRpcContext(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<WithContext<CompressedProofWithContext>>;
|
|
444
320
|
}
|
|
@@ -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 'bn.js';
|
|
|
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
|
-
|
|
7
|
-
|
|
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
|
-
|
|
32
|
-
|
|
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 =
|
|
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
|
-
|
|
28
|
-
|
|
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 'bn.js';
|
|
3
3
|
import { Rpc } from '../../rpc';
|
|
4
4
|
import { CompressedAccountWithMerkleContext } from '../../state';
|
|
5
|
-
export declare function getCompressedAccountsByOwnerTest(
|
|
6
|
-
|
|
7
|
-
|
|
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[]>;
|
|
@@ -22,10 +22,7 @@ export type EventWithParsedTokenTlvData = {
|
|
|
22
22
|
* @param compressedAccount - The compressed account
|
|
23
23
|
* @returns The parsed token data
|
|
24
24
|
*/
|
|
25
|
-
export declare function parseTokenLayoutWithIdl(
|
|
26
|
-
compressedAccount: CompressedAccount,
|
|
27
|
-
programId?: PublicKey,
|
|
28
|
-
): TokenData | null;
|
|
25
|
+
export declare function parseTokenLayoutWithIdl(compressedAccount: CompressedAccount, programId?: PublicKey): TokenData | null;
|
|
29
26
|
/**
|
|
30
27
|
* Retrieves all compressed token accounts for a given mint and owner.
|
|
31
28
|
*
|
|
@@ -35,22 +32,9 @@ export declare function parseTokenLayoutWithIdl(
|
|
|
35
32
|
* @param owner PublicKey of the token owner
|
|
36
33
|
* @param mint PublicKey of the token mint
|
|
37
34
|
*/
|
|
38
|
-
export declare function getCompressedTokenAccounts(
|
|
39
|
-
events: PublicTransactionEvent[],
|
|
40
|
-
): Promise<ParsedTokenAccount[]>;
|
|
35
|
+
export declare function getCompressedTokenAccounts(events: PublicTransactionEvent[]): Promise<ParsedTokenAccount[]>;
|
|
41
36
|
/** @internal */
|
|
42
|
-
export declare function getCompressedTokenAccountsByOwnerTest(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
mint: PublicKey,
|
|
46
|
-
): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
47
|
-
export declare function getCompressedTokenAccountsByDelegateTest(
|
|
48
|
-
rpc: Rpc,
|
|
49
|
-
delegate: PublicKey,
|
|
50
|
-
mint: PublicKey,
|
|
51
|
-
): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
52
|
-
export declare function getCompressedTokenAccountByHashTest(
|
|
53
|
-
rpc: Rpc,
|
|
54
|
-
hash: BN,
|
|
55
|
-
): Promise<ParsedTokenAccount>;
|
|
37
|
+
export declare function getCompressedTokenAccountsByOwnerTest(rpc: Rpc, owner: PublicKey, mint: PublicKey): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
38
|
+
export declare function getCompressedTokenAccountsByDelegateTest(rpc: Rpc, delegate: PublicKey, mint: PublicKey): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
39
|
+
export declare function getCompressedTokenAccountByHashTest(rpc: Rpc, hash: BN): Promise<ParsedTokenAccount>;
|
|
56
40
|
export {};
|
|
@@ -8,18 +8,8 @@ type Deserializer<T> = (data: Buffer, tx: ParsedTransactionWithMeta) => T;
|
|
|
8
8
|
* Returns newest first.
|
|
9
9
|
*
|
|
10
10
|
* */
|
|
11
|
-
export declare function getParsedEvents(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export declare
|
|
15
|
-
indexerEventsTransactions: (ParsedTransactionWithMeta | null)[],
|
|
16
|
-
deserializeFn: Deserializer<T>,
|
|
17
|
-
) => NonNullable<T>[];
|
|
18
|
-
export declare const parsePublicTransactionEventWithIdl: (
|
|
19
|
-
data: Buffer,
|
|
20
|
-
) => PublicTransactionEvent | null;
|
|
21
|
-
export declare function parseLightTransaction(
|
|
22
|
-
dataVec: Uint8Array[],
|
|
23
|
-
accountKeys: PublicKey[][],
|
|
24
|
-
): PublicTransactionEvent | null | undefined;
|
|
11
|
+
export declare function getParsedEvents(rpc: Rpc): Promise<PublicTransactionEvent[]>;
|
|
12
|
+
export declare const parseEvents: <T>(indexerEventsTransactions: (ParsedTransactionWithMeta | null)[], deserializeFn: Deserializer<T>) => NonNullable<T>[];
|
|
13
|
+
export declare const parsePublicTransactionEventWithIdl: (data: Buffer) => PublicTransactionEvent | null;
|
|
14
|
+
export declare function parseLightTransaction(dataVec: Uint8Array[], accountKeys: PublicKey[][]): PublicTransactionEvent | null | undefined;
|
|
25
15
|
export {};
|