@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,30 +1,8 @@
|
|
|
1
1
|
import { Connection, ConnectionConfig, PublicKey } from '@solana/web3.js';
|
|
2
2
|
import BN from 'bn.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
CompressedTransaction,
|
|
7
|
-
GetCompressedAccountsByOwnerConfig,
|
|
8
|
-
PaginatedOptions,
|
|
9
|
-
HashWithTree,
|
|
10
|
-
LatestNonVotingSignatures,
|
|
11
|
-
LatestNonVotingSignaturesPaginated,
|
|
12
|
-
SignatureWithMetadata,
|
|
13
|
-
WithContext,
|
|
14
|
-
WithCursor,
|
|
15
|
-
} from '../../rpc-interface';
|
|
16
|
-
import {
|
|
17
|
-
CompressedProofWithContext,
|
|
18
|
-
CompressionApiInterface,
|
|
19
|
-
GetCompressedTokenAccountsByOwnerOrDelegateOptions,
|
|
20
|
-
ParsedTokenAccount,
|
|
21
|
-
TokenBalance,
|
|
22
|
-
} from '../../rpc-interface';
|
|
23
|
-
import {
|
|
24
|
-
BN254,
|
|
25
|
-
CompressedAccountWithMerkleContext,
|
|
26
|
-
MerkleContextWithMerkleProof,
|
|
27
|
-
} from '../../state';
|
|
3
|
+
import { AddressWithTree, CompressedMintTokenHolders, CompressedTransaction, GetCompressedAccountsByOwnerConfig, PaginatedOptions, HashWithTree, LatestNonVotingSignatures, LatestNonVotingSignaturesPaginated, SignatureWithMetadata, WithContext, WithCursor } from '../../rpc-interface';
|
|
4
|
+
import { CompressedProofWithContext, CompressionApiInterface, GetCompressedTokenAccountsByOwnerOrDelegateOptions, ParsedTokenAccount, TokenBalance } from '../../rpc-interface';
|
|
5
|
+
import { BN254, CompressedAccountWithMerkleContext, MerkleContextWithMerkleProof } from '../../state';
|
|
28
6
|
import { MerkleContextWithNewAddressProof } from '../../rpc';
|
|
29
7
|
import { ActiveTreeBundle } from '../../state/types';
|
|
30
8
|
export interface TestRpcConfig {
|
|
@@ -77,16 +55,7 @@ export interface LightWasm {
|
|
|
77
55
|
* @param depth Depth of the merkle tree.
|
|
78
56
|
* @param log Log proof generation time.
|
|
79
57
|
*/
|
|
80
|
-
export declare function getTestRpc(
|
|
81
|
-
lightWasm: LightWasm,
|
|
82
|
-
endpoint?: string,
|
|
83
|
-
compressionApiEndpoint?: string,
|
|
84
|
-
proverEndpoint?: string,
|
|
85
|
-
merkleTreeAddress?: PublicKey,
|
|
86
|
-
nullifierQueueAddress?: PublicKey,
|
|
87
|
-
depth?: number,
|
|
88
|
-
log?: boolean,
|
|
89
|
-
): Promise<TestRpc>;
|
|
58
|
+
export declare function getTestRpc(lightWasm: LightWasm, endpoint?: string, compressionApiEndpoint?: string, proverEndpoint?: string, merkleTreeAddress?: PublicKey, nullifierQueueAddress?: PublicKey, depth?: number, log?: boolean): Promise<TestRpc>;
|
|
90
59
|
/**
|
|
91
60
|
* Simple mock rpc for unit tests that simulates the compression rpc interface.
|
|
92
61
|
* Fetches, parses events and builds merkletree on-demand, i.e. it does not persist state.
|
|
@@ -96,10 +65,7 @@ export declare function getTestRpc(
|
|
|
96
65
|
*
|
|
97
66
|
* For advanced testing use photon: https://github.com/helius-labs/photon
|
|
98
67
|
*/
|
|
99
|
-
export declare class TestRpc
|
|
100
|
-
extends Connection
|
|
101
|
-
implements CompressionApiInterface
|
|
102
|
-
{
|
|
68
|
+
export declare class TestRpc extends Connection implements CompressionApiInterface {
|
|
103
69
|
compressionApiEndpoint: string;
|
|
104
70
|
proverEndpoint: string;
|
|
105
71
|
merkleTreeAddress: PublicKey;
|
|
@@ -122,14 +88,7 @@ export declare class TestRpc
|
|
|
122
88
|
* @param connectionConfig Optional connection config
|
|
123
89
|
* @param testRpcConfig Config for the mock rpc
|
|
124
90
|
*/
|
|
125
|
-
constructor(
|
|
126
|
-
endpoint: string,
|
|
127
|
-
hasher: LightWasm,
|
|
128
|
-
compressionApiEndpoint: string,
|
|
129
|
-
proverEndpoint: string,
|
|
130
|
-
connectionConfig?: ConnectionConfig,
|
|
131
|
-
testRpcConfig?: TestRpcConfig,
|
|
132
|
-
);
|
|
91
|
+
constructor(endpoint: string, hasher: LightWasm, compressionApiEndpoint: string, proverEndpoint: string, connectionConfig?: ConnectionConfig, testRpcConfig?: TestRpcConfig);
|
|
133
92
|
/**
|
|
134
93
|
* Manually set state tree addresses
|
|
135
94
|
*/
|
|
@@ -145,10 +104,7 @@ export declare class TestRpc
|
|
|
145
104
|
/**
|
|
146
105
|
* Fetch the compressed account for the specified account hash
|
|
147
106
|
*/
|
|
148
|
-
getCompressedAccount(
|
|
149
|
-
address?: BN254,
|
|
150
|
-
hash?: BN254,
|
|
151
|
-
): Promise<CompressedAccountWithMerkleContext | null>;
|
|
107
|
+
getCompressedAccount(address?: BN254, hash?: BN254): Promise<CompressedAccountWithMerkleContext | null>;
|
|
152
108
|
/**
|
|
153
109
|
* Fetch the compressed balance for the specified account hash
|
|
154
110
|
*/
|
|
@@ -161,16 +117,12 @@ export declare class TestRpc
|
|
|
161
117
|
* Fetch the latest merkle proof for the specified account hash from the
|
|
162
118
|
* cluster
|
|
163
119
|
*/
|
|
164
|
-
getCompressedAccountProof(
|
|
165
|
-
hash: BN254,
|
|
166
|
-
): Promise<MerkleContextWithMerkleProof>;
|
|
120
|
+
getCompressedAccountProof(hash: BN254): Promise<MerkleContextWithMerkleProof>;
|
|
167
121
|
/**
|
|
168
122
|
* Fetch all the account info for multiple compressed accounts specified by
|
|
169
123
|
* an array of account hashes
|
|
170
124
|
*/
|
|
171
|
-
getMultipleCompressedAccounts(
|
|
172
|
-
hashes: BN254[],
|
|
173
|
-
): Promise<CompressedAccountWithMerkleContext[]>;
|
|
125
|
+
getMultipleCompressedAccounts(hashes: BN254[]): Promise<CompressedAccountWithMerkleContext[]>;
|
|
174
126
|
/**
|
|
175
127
|
* Ensure that the Compression Indexer has already indexed the transaction
|
|
176
128
|
*/
|
|
@@ -179,47 +131,31 @@ export declare class TestRpc
|
|
|
179
131
|
* Fetch the latest merkle proofs for multiple compressed accounts specified
|
|
180
132
|
* by an array account hashes
|
|
181
133
|
*/
|
|
182
|
-
getMultipleCompressedAccountProofs(
|
|
183
|
-
hashes: BN254[],
|
|
184
|
-
): Promise<MerkleContextWithMerkleProof[]>;
|
|
134
|
+
getMultipleCompressedAccountProofs(hashes: BN254[]): Promise<MerkleContextWithMerkleProof[]>;
|
|
185
135
|
/**
|
|
186
136
|
* Fetch all the compressed accounts owned by the specified public key.
|
|
187
137
|
* Owner can be a program or user account
|
|
188
138
|
*/
|
|
189
|
-
getCompressedAccountsByOwner(
|
|
190
|
-
owner: PublicKey,
|
|
191
|
-
_config?: GetCompressedAccountsByOwnerConfig,
|
|
192
|
-
): Promise<WithCursor<CompressedAccountWithMerkleContext[]>>;
|
|
139
|
+
getCompressedAccountsByOwner(owner: PublicKey, _config?: GetCompressedAccountsByOwnerConfig): Promise<WithCursor<CompressedAccountWithMerkleContext[]>>;
|
|
193
140
|
/**
|
|
194
141
|
* Fetch the latest compression signatures on the cluster. Results are
|
|
195
142
|
* paginated.
|
|
196
143
|
*/
|
|
197
|
-
getLatestCompressionSignatures(
|
|
198
|
-
_cursor?: string,
|
|
199
|
-
_limit?: number,
|
|
200
|
-
): Promise<LatestNonVotingSignaturesPaginated>;
|
|
144
|
+
getLatestCompressionSignatures(_cursor?: string, _limit?: number): Promise<LatestNonVotingSignaturesPaginated>;
|
|
201
145
|
/**
|
|
202
146
|
* Fetch the latest non-voting signatures on the cluster. Results are
|
|
203
147
|
* not paginated.
|
|
204
148
|
*/
|
|
205
|
-
getLatestNonVotingSignatures(
|
|
206
|
-
_limit?: number,
|
|
207
|
-
): Promise<LatestNonVotingSignatures>;
|
|
149
|
+
getLatestNonVotingSignatures(_limit?: number): Promise<LatestNonVotingSignatures>;
|
|
208
150
|
/**
|
|
209
151
|
* Fetch all the compressed token accounts owned by the specified public
|
|
210
152
|
* key. Owner can be a program or user account
|
|
211
153
|
*/
|
|
212
|
-
getCompressedTokenAccountsByOwner(
|
|
213
|
-
owner: PublicKey,
|
|
214
|
-
options: GetCompressedTokenAccountsByOwnerOrDelegateOptions,
|
|
215
|
-
): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
154
|
+
getCompressedTokenAccountsByOwner(owner: PublicKey, options: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
216
155
|
/**
|
|
217
156
|
* Fetch all the compressed accounts delegated to the specified public key.
|
|
218
157
|
*/
|
|
219
|
-
getCompressedTokenAccountsByDelegate(
|
|
220
|
-
delegate: PublicKey,
|
|
221
|
-
options: GetCompressedTokenAccountsByOwnerOrDelegateOptions,
|
|
222
|
-
): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
158
|
+
getCompressedTokenAccountsByDelegate(delegate: PublicKey, options: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
223
159
|
/**
|
|
224
160
|
* Fetch the compressed token balance for the specified account hash
|
|
225
161
|
*/
|
|
@@ -231,25 +167,15 @@ export declare class TestRpc
|
|
|
231
167
|
* Fetch all the compressed token balances owned by the specified public
|
|
232
168
|
* key. Can filter by mint.
|
|
233
169
|
*/
|
|
234
|
-
getCompressedTokenBalancesByOwner(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
WithCursor<
|
|
239
|
-
{
|
|
240
|
-
balance: BN;
|
|
241
|
-
mint: PublicKey;
|
|
242
|
-
}[]
|
|
243
|
-
>
|
|
244
|
-
>;
|
|
170
|
+
getCompressedTokenBalancesByOwner(publicKey: PublicKey, options: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<{
|
|
171
|
+
balance: BN;
|
|
172
|
+
mint: PublicKey;
|
|
173
|
+
}[]>>;
|
|
245
174
|
/**
|
|
246
175
|
* Fetch all the compressed token balances owned by the specified public
|
|
247
176
|
* key. Can filter by mint. Uses context.
|
|
248
177
|
*/
|
|
249
|
-
getCompressedTokenBalancesByOwnerV2(
|
|
250
|
-
publicKey: PublicKey,
|
|
251
|
-
options: GetCompressedTokenAccountsByOwnerOrDelegateOptions,
|
|
252
|
-
): Promise<WithContext<WithCursor<TokenBalance[]>>>;
|
|
178
|
+
getCompressedTokenBalancesByOwnerV2(publicKey: PublicKey, options: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithContext<WithCursor<TokenBalance[]>>>;
|
|
253
179
|
/**
|
|
254
180
|
* Returns confirmed signatures for transactions involving the specified
|
|
255
181
|
* account hash forward in time from genesis to the most recent confirmed
|
|
@@ -257,16 +183,12 @@ export declare class TestRpc
|
|
|
257
183
|
*
|
|
258
184
|
* @param hash queried account hash
|
|
259
185
|
*/
|
|
260
|
-
getCompressionSignaturesForAccount(
|
|
261
|
-
_hash: BN254,
|
|
262
|
-
): Promise<SignatureWithMetadata[]>;
|
|
186
|
+
getCompressionSignaturesForAccount(_hash: BN254): Promise<SignatureWithMetadata[]>;
|
|
263
187
|
/**
|
|
264
188
|
* Fetch a confirmed or finalized transaction from the cluster. Return with
|
|
265
189
|
* CompressionInfo
|
|
266
190
|
*/
|
|
267
|
-
getTransactionWithCompressionInfo(
|
|
268
|
-
_signature: string,
|
|
269
|
-
): Promise<CompressedTransaction | null>;
|
|
191
|
+
getTransactionWithCompressionInfo(_signature: string): Promise<CompressedTransaction | null>;
|
|
270
192
|
/**
|
|
271
193
|
* Returns confirmed signatures for transactions involving the specified
|
|
272
194
|
* address forward in time from genesis to the most recent confirmed
|
|
@@ -274,10 +196,7 @@ export declare class TestRpc
|
|
|
274
196
|
*
|
|
275
197
|
* @param address queried compressed account address
|
|
276
198
|
*/
|
|
277
|
-
getCompressionSignaturesForAddress(
|
|
278
|
-
_address: PublicKey,
|
|
279
|
-
_options?: PaginatedOptions,
|
|
280
|
-
): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
199
|
+
getCompressionSignaturesForAddress(_address: PublicKey, _options?: PaginatedOptions): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
281
200
|
/**
|
|
282
201
|
* Returns confirmed signatures for compression transactions involving the
|
|
283
202
|
* specified account owner forward in time from genesis to the
|
|
@@ -285,19 +204,13 @@ export declare class TestRpc
|
|
|
285
204
|
*
|
|
286
205
|
* @param owner queried owner public key
|
|
287
206
|
*/
|
|
288
|
-
getCompressionSignaturesForOwner(
|
|
289
|
-
_owner: PublicKey,
|
|
290
|
-
_options?: PaginatedOptions,
|
|
291
|
-
): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
207
|
+
getCompressionSignaturesForOwner(_owner: PublicKey, _options?: PaginatedOptions): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
292
208
|
/**
|
|
293
209
|
* Returns confirmed signatures for compression transactions involving the
|
|
294
210
|
* specified token account owner forward in time from genesis to the most
|
|
295
211
|
* recent confirmed block
|
|
296
212
|
*/
|
|
297
|
-
getCompressionSignaturesForTokenOwner(
|
|
298
|
-
_owner: PublicKey,
|
|
299
|
-
_options?: PaginatedOptions,
|
|
300
|
-
): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
213
|
+
getCompressionSignaturesForTokenOwner(_owner: PublicKey, _options?: PaginatedOptions): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
301
214
|
/**
|
|
302
215
|
* Fetch the current indexer health status
|
|
303
216
|
*/
|
|
@@ -314,13 +227,8 @@ export declare class TestRpc
|
|
|
314
227
|
* @param addresses Array of BN254 new addresses
|
|
315
228
|
* @returns Array of validity proofs for new addresses
|
|
316
229
|
*/
|
|
317
|
-
getMultipleNewAddressProofs(
|
|
318
|
-
|
|
319
|
-
): Promise<MerkleContextWithNewAddressProof[]>;
|
|
320
|
-
getCompressedMintTokenHolders(
|
|
321
|
-
_mint: PublicKey,
|
|
322
|
-
_options?: PaginatedOptions,
|
|
323
|
-
): Promise<WithContext<WithCursor<CompressedMintTokenHolders[]>>>;
|
|
230
|
+
getMultipleNewAddressProofs(addresses: BN254[]): Promise<MerkleContextWithNewAddressProof[]>;
|
|
231
|
+
getCompressedMintTokenHolders(_mint: PublicKey, _options?: PaginatedOptions): Promise<WithContext<WithCursor<CompressedMintTokenHolders[]>>>;
|
|
324
232
|
/**
|
|
325
233
|
* Advanced usage of getValidityProof: fetches ZKP directly from a custom
|
|
326
234
|
* non-rpcprover. Note: This uses the proverEndpoint specified in the
|
|
@@ -330,18 +238,12 @@ export declare class TestRpc
|
|
|
330
238
|
* Note: Use RPC class for forested trees. TestRpc is only for custom
|
|
331
239
|
* testing purposes.
|
|
332
240
|
*/
|
|
333
|
-
getValidityProofDirect(
|
|
334
|
-
hashes?: BN254[],
|
|
335
|
-
newAddresses?: BN254[],
|
|
336
|
-
): Promise<CompressedProofWithContext>;
|
|
241
|
+
getValidityProofDirect(hashes?: BN254[], newAddresses?: BN254[]): Promise<CompressedProofWithContext>;
|
|
337
242
|
/**
|
|
338
243
|
* @deprecated This method is not available for TestRpc. Please use
|
|
339
244
|
* {@link getValidityProof} instead.
|
|
340
245
|
*/
|
|
341
|
-
getValidityProofAndRpcContext(
|
|
342
|
-
hashes?: HashWithTree[],
|
|
343
|
-
newAddresses?: AddressWithTree[],
|
|
344
|
-
): Promise<WithContext<CompressedProofWithContext>>;
|
|
246
|
+
getValidityProofAndRpcContext(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<WithContext<CompressedProofWithContext>>;
|
|
345
247
|
/**
|
|
346
248
|
* Fetch the latest validity proof for (1) compressed accounts specified by
|
|
347
249
|
* an array of account hashes. (2) new unique addresses specified by an
|
|
@@ -356,12 +258,6 @@ export declare class TestRpc
|
|
|
356
258
|
* @param newAddresses Array of BN254 new addresses.
|
|
357
259
|
* @returns validity proof with context
|
|
358
260
|
*/
|
|
359
|
-
getValidityProof(
|
|
360
|
-
|
|
361
|
-
newAddresses?: BN254[],
|
|
362
|
-
): Promise<CompressedProofWithContext>;
|
|
363
|
-
getValidityProofV0(
|
|
364
|
-
hashes?: HashWithTree[],
|
|
365
|
-
newAddresses?: AddressWithTree[],
|
|
366
|
-
): Promise<CompressedProofWithContext>;
|
|
261
|
+
getValidityProof(hashes?: BN254[], newAddresses?: BN254[]): Promise<CompressedProofWithContext>;
|
|
262
|
+
getValidityProofV0(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<CompressedProofWithContext>;
|
|
367
263
|
}
|
|
@@ -20,11 +20,7 @@ export declare function deepEqual(ref: any, val: any): boolean;
|
|
|
20
20
|
* @param counter counter to use for generating the keypair.
|
|
21
21
|
* If undefined or >255, generates random keypair.
|
|
22
22
|
*/
|
|
23
|
-
export declare function newAccountWithLamports(
|
|
24
|
-
rpc: Rpc,
|
|
25
|
-
lamports?: number,
|
|
26
|
-
counter?: number | undefined,
|
|
27
|
-
): Promise<Signer>;
|
|
23
|
+
export declare function newAccountWithLamports(rpc: Rpc, lamports?: number, counter?: number | undefined): Promise<Signer>;
|
|
28
24
|
export declare function getConnection(): Connection;
|
|
29
25
|
/**
|
|
30
26
|
* For use in tests.
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
|
2
|
-
export declare function deriveAddressSeed(
|
|
3
|
-
seeds: Uint8Array[],
|
|
4
|
-
programId: PublicKey,
|
|
5
|
-
): Uint8Array;
|
|
2
|
+
export declare function deriveAddressSeed(seeds: Uint8Array[], programId: PublicKey): Uint8Array;
|
|
6
3
|
/**
|
|
7
4
|
* Derive an address for a compressed account from a seed and an address Merkle
|
|
8
5
|
* tree public key.
|
|
@@ -12,10 +9,7 @@ export declare function deriveAddressSeed(
|
|
|
12
9
|
* defaultTestStateTreeAccounts().addressTree
|
|
13
10
|
* @returns Derived address
|
|
14
11
|
*/
|
|
15
|
-
export declare function deriveAddress(
|
|
16
|
-
seed: Uint8Array,
|
|
17
|
-
addressMerkleTreePubkey?: PublicKey,
|
|
18
|
-
): PublicKey;
|
|
12
|
+
export declare function deriveAddress(seed: Uint8Array, addressMerkleTreePubkey?: PublicKey): PublicKey;
|
|
19
13
|
export interface NewAddressParams {
|
|
20
14
|
/**
|
|
21
15
|
* Seed for the compressed account. Must be seed used to derive
|
|
@@ -63,10 +57,7 @@ export interface NewAddressParamsPacked {
|
|
|
63
57
|
* @param remainingAccounts Remaining accounts
|
|
64
58
|
* @returns Packed new address params
|
|
65
59
|
*/
|
|
66
|
-
export declare function packNewAddressParams(
|
|
67
|
-
newAddressParams: NewAddressParams[],
|
|
68
|
-
remainingAccounts: PublicKey[],
|
|
69
|
-
): {
|
|
60
|
+
export declare function packNewAddressParams(newAddressParams: NewAddressParams[], remainingAccounts: PublicKey[]): {
|
|
70
61
|
newAddressParamsPacked: NewAddressParamsPacked[];
|
|
71
62
|
remainingAccounts: PublicKey[];
|
|
72
63
|
};
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
import { Commitment, Connection, PublicKey } from '@solana/web3.js';
|
|
2
|
-
export declare function airdropSol({
|
|
3
|
-
connection,
|
|
4
|
-
lamports,
|
|
5
|
-
recipientPublicKey,
|
|
6
|
-
}: {
|
|
2
|
+
export declare function airdropSol({ connection, lamports, recipientPublicKey, }: {
|
|
7
3
|
connection: Connection;
|
|
8
4
|
lamports: number;
|
|
9
5
|
recipientPublicKey: PublicKey;
|
|
10
6
|
}): Promise<string>;
|
|
11
|
-
export declare function confirmTransaction(
|
|
12
|
-
connection: Connection,
|
|
13
|
-
signature: string,
|
|
14
|
-
confirmation?: Commitment,
|
|
15
|
-
): Promise<
|
|
16
|
-
import('@solana/web3.js').RpcResponseAndContext<
|
|
17
|
-
import('@solana/web3.js').SignatureResult
|
|
18
|
-
>
|
|
19
|
-
>;
|
|
7
|
+
export declare function confirmTransaction(connection: Connection, signature: string, confirmation?: Commitment): Promise<import("@solana/web3.js").RpcResponseAndContext<import("@solana/web3.js").SignatureResult>>;
|
|
@@ -4,7 +4,4 @@
|
|
|
4
4
|
* @returns microLamports per compute unit (use in
|
|
5
5
|
* `ComputeBudgetProgram.setComputeUnitPrice`)
|
|
6
6
|
*/
|
|
7
|
-
export declare function calculateComputeUnitPrice(
|
|
8
|
-
targetLamports: number,
|
|
9
|
-
computeUnits: number,
|
|
10
|
-
): number;
|
|
7
|
+
export declare function calculateComputeUnitPrice(targetLamports: number, computeUnits: number): number;
|
|
@@ -9,6 +9,9 @@ export declare function byteArrayToKeypair(byteArray: number[]): Keypair;
|
|
|
9
9
|
export declare function toHex(bn: BN): string;
|
|
10
10
|
export declare const toArray: <T>(value: T | T[]) => T[];
|
|
11
11
|
export declare const bufToDecStr: (buf: Buffer) => string;
|
|
12
|
+
export declare function isSmallerThanBn254FieldSizeBe(bytes: Buffer): boolean;
|
|
13
|
+
export declare const toCamelCase: (object: any) => any;
|
|
14
|
+
/**
|
|
12
15
|
/**
|
|
13
16
|
* Hash the provided `bytes` with Keccak256 and ensure the result fits in the
|
|
14
17
|
* BN254 prime field by repeatedly hashing the inputs with various "bump seeds"
|
|
@@ -16,9 +19,7 @@ export declare const bufToDecStr: (buf: Buffer) => string;
|
|
|
16
19
|
*
|
|
17
20
|
* @deprecated Use `hashvToBn254FieldSizeBe` instead.
|
|
18
21
|
*/
|
|
19
|
-
export declare function hashToBn254FieldSizeBe(
|
|
20
|
-
bytes: Buffer,
|
|
21
|
-
): [Buffer, number] | null;
|
|
22
|
+
export declare function hashToBn254FieldSizeBe(bytes: Buffer): [Buffer, number] | null;
|
|
22
23
|
/**
|
|
23
24
|
* Hash the provided `bytes` with Keccak256 and ensure that the result fits in
|
|
24
25
|
* the BN254 prime field by truncating the resulting hash to 31 bytes.
|
|
@@ -27,11 +28,6 @@ export declare function hashToBn254FieldSizeBe(
|
|
|
27
28
|
*
|
|
28
29
|
* @returns Hash digest
|
|
29
30
|
*/
|
|
30
|
-
export declare function hashvToBn254FieldSizeBe(
|
|
31
|
-
bytes: Uint8Array[],
|
|
32
|
-
): Uint8Array;
|
|
31
|
+
export declare function hashvToBn254FieldSizeBe(bytes: Uint8Array[]): Uint8Array;
|
|
33
32
|
/** Mutates array in place */
|
|
34
33
|
export declare function pushUniqueItems<T>(items: T[], map: T[]): void;
|
|
35
|
-
export declare function toCamelCase(
|
|
36
|
-
obj: Array<any> | unknown | any,
|
|
37
|
-
): Array<any> | unknown | any;
|
|
@@ -10,12 +10,7 @@ import { ActiveTreeBundle } from '../state/types';
|
|
|
10
10
|
* @param authority - Keypair of the authority
|
|
11
11
|
* @param recentSlot - Slot of the recent block
|
|
12
12
|
*/
|
|
13
|
-
export declare function createStateTreeLookupTable({
|
|
14
|
-
connection,
|
|
15
|
-
payer,
|
|
16
|
-
authority,
|
|
17
|
-
recentSlot,
|
|
18
|
-
}: {
|
|
13
|
+
export declare function createStateTreeLookupTable({ connection, payer, authority, recentSlot, }: {
|
|
19
14
|
connection: Connection;
|
|
20
15
|
payer: Keypair;
|
|
21
16
|
authority: Keypair;
|
|
@@ -35,15 +30,7 @@ export declare function createStateTreeLookupTable({
|
|
|
35
30
|
* @param payer - Keypair of the payer
|
|
36
31
|
* @param authority - Keypair of the authority
|
|
37
32
|
*/
|
|
38
|
-
export declare function extendStateTreeLookupTable({
|
|
39
|
-
connection,
|
|
40
|
-
tableAddress,
|
|
41
|
-
newStateTreeAddresses,
|
|
42
|
-
newQueueAddresses,
|
|
43
|
-
newCpiContextAddresses,
|
|
44
|
-
payer,
|
|
45
|
-
authority,
|
|
46
|
-
}: {
|
|
33
|
+
export declare function extendStateTreeLookupTable({ connection, tableAddress, newStateTreeAddresses, newQueueAddresses, newCpiContextAddresses, payer, authority, }: {
|
|
47
34
|
connection: Connection;
|
|
48
35
|
tableAddress: PublicKey;
|
|
49
36
|
newStateTreeAddresses: PublicKey[];
|
|
@@ -68,14 +55,7 @@ export declare function extendStateTreeLookupTable({
|
|
|
68
55
|
* @param payer - Keypair of the payer
|
|
69
56
|
* @param authority - Keypair of the authority
|
|
70
57
|
*/
|
|
71
|
-
export declare function nullifyLookupTable({
|
|
72
|
-
connection,
|
|
73
|
-
fullStateTreeAddress,
|
|
74
|
-
nullifyTableAddress,
|
|
75
|
-
stateTreeLookupTableAddress,
|
|
76
|
-
payer,
|
|
77
|
-
authority,
|
|
78
|
-
}: {
|
|
58
|
+
export declare function nullifyLookupTable({ connection, fullStateTreeAddress, nullifyTableAddress, stateTreeLookupTableAddress, payer, authority, }: {
|
|
79
59
|
connection: Connection;
|
|
80
60
|
fullStateTreeAddress: PublicKey;
|
|
81
61
|
nullifyTableAddress: PublicKey;
|
|
@@ -89,11 +69,7 @@ export declare function nullifyLookupTable({
|
|
|
89
69
|
* Get most recent , active state tree data
|
|
90
70
|
* we store in lookup table for each public state tree
|
|
91
71
|
*/
|
|
92
|
-
export declare function getLightStateTreeInfo({
|
|
93
|
-
connection,
|
|
94
|
-
stateTreeLookupTableAddress,
|
|
95
|
-
nullifyTableAddress,
|
|
96
|
-
}: {
|
|
72
|
+
export declare function getLightStateTreeInfo({ connection, stateTreeLookupTableAddress, nullifyTableAddress, }: {
|
|
97
73
|
connection: Connection;
|
|
98
74
|
stateTreeLookupTableAddress: PublicKey;
|
|
99
75
|
nullifyTableAddress: PublicKey;
|
|
@@ -16,7 +16,5 @@ export declare const placeholderValidityProof: () => {
|
|
|
16
16
|
};
|
|
17
17
|
export declare const checkValidityProofShape: (proof: CompressedProof) => void;
|
|
18
18
|
export declare function proofFromJsonStruct(json: GnarkProofJson): ProofABC;
|
|
19
|
-
export declare function negateAndCompressProof(
|
|
20
|
-
proof: ProofABC,
|
|
21
|
-
): CompressedProof;
|
|
19
|
+
export declare function negateAndCompressProof(proof: ProofABC): CompressedProof;
|
|
22
20
|
export {};
|
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
/** pipe function */
|
|
2
|
-
export declare function pipe<T, R>(
|
|
3
|
-
initialFunction: (arg: T) => R,
|
|
4
|
-
...functions: ((arg: R) => R)[]
|
|
5
|
-
): (initialValue: T) => R;
|
|
2
|
+
export declare function pipe<T, R>(initialFunction: (arg: T) => R, ...functions: ((arg: R) => R)[]): (initialValue: T) => R;
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
VersionedTransaction,
|
|
3
|
-
SignatureResult,
|
|
4
|
-
RpcResponseAndContext,
|
|
5
|
-
Signer,
|
|
6
|
-
TransactionInstruction,
|
|
7
|
-
ConfirmOptions,
|
|
8
|
-
TransactionSignature,
|
|
9
|
-
PublicKey,
|
|
10
|
-
AddressLookupTableAccount,
|
|
11
|
-
} from '@solana/web3.js';
|
|
1
|
+
import { VersionedTransaction, SignatureResult, RpcResponseAndContext, Signer, TransactionInstruction, ConfirmOptions, TransactionSignature, PublicKey, AddressLookupTableAccount } from '@solana/web3.js';
|
|
12
2
|
import { Rpc } from '../rpc';
|
|
13
3
|
/**
|
|
14
4
|
* Builds a versioned Transaction from instructions.
|
|
@@ -20,12 +10,7 @@ import { Rpc } from '../rpc';
|
|
|
20
10
|
*
|
|
21
11
|
* @return VersionedTransaction
|
|
22
12
|
*/
|
|
23
|
-
export declare function buildTx(
|
|
24
|
-
instructions: TransactionInstruction[],
|
|
25
|
-
payerPublicKey: PublicKey,
|
|
26
|
-
blockhash: string,
|
|
27
|
-
lookupTableAccounts?: AddressLookupTableAccount[],
|
|
28
|
-
): VersionedTransaction;
|
|
13
|
+
export declare function buildTx(instructions: TransactionInstruction[], payerPublicKey: PublicKey, blockhash: string, lookupTableAccounts?: AddressLookupTableAccount[]): VersionedTransaction;
|
|
29
14
|
/**
|
|
30
15
|
* Sends a versioned transaction and confirms it.
|
|
31
16
|
*
|
|
@@ -36,15 +21,10 @@ export declare function buildTx(
|
|
|
36
21
|
*
|
|
37
22
|
* @return TransactionSignature
|
|
38
23
|
*/
|
|
39
|
-
export declare function sendAndConfirmTx(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
blockHashCtx?: {
|
|
44
|
-
blockhash: string;
|
|
45
|
-
lastValidBlockHeight: number;
|
|
46
|
-
},
|
|
47
|
-
): Promise<TransactionSignature>;
|
|
24
|
+
export declare function sendAndConfirmTx(rpc: Rpc, tx: VersionedTransaction, confirmOptions?: ConfirmOptions, blockHashCtx?: {
|
|
25
|
+
blockhash: string;
|
|
26
|
+
lastValidBlockHeight: number;
|
|
27
|
+
}): Promise<TransactionSignature>;
|
|
48
28
|
/**
|
|
49
29
|
* Confirms a transaction with a given txId.
|
|
50
30
|
*
|
|
@@ -54,15 +34,10 @@ export declare function sendAndConfirmTx(
|
|
|
54
34
|
* @param blockHashCtx blockhash context for confirmation
|
|
55
35
|
* @return SignatureResult
|
|
56
36
|
*/
|
|
57
|
-
export declare function confirmTx(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
blockHashCtx?: {
|
|
62
|
-
blockhash: string;
|
|
63
|
-
lastValidBlockHeight: number;
|
|
64
|
-
},
|
|
65
|
-
): Promise<RpcResponseAndContext<SignatureResult>>;
|
|
37
|
+
export declare function confirmTx(rpc: Rpc, txId: string, confirmOptions?: ConfirmOptions, blockHashCtx?: {
|
|
38
|
+
blockhash: string;
|
|
39
|
+
lastValidBlockHeight: number;
|
|
40
|
+
}): Promise<RpcResponseAndContext<SignatureResult>>;
|
|
66
41
|
/**
|
|
67
42
|
* Builds a versioned Transaction from instructions and signs it.
|
|
68
43
|
*
|
|
@@ -74,10 +49,4 @@ export declare function confirmTx(
|
|
|
74
49
|
* @param lookupTableAccounts lookup table accounts to include in the
|
|
75
50
|
* transaction
|
|
76
51
|
*/
|
|
77
|
-
export declare function buildAndSignTx(
|
|
78
|
-
instructions: TransactionInstruction[],
|
|
79
|
-
payer: Signer,
|
|
80
|
-
blockhash: string,
|
|
81
|
-
additionalSigners?: Signer[],
|
|
82
|
-
lookupTableAccounts?: AddressLookupTableAccount[],
|
|
83
|
-
): VersionedTransaction;
|
|
52
|
+
export declare function buildAndSignTx(instructions: TransactionInstruction[], payer: Signer, blockhash: string, additionalSigners?: Signer[], lookupTableAccounts?: AddressLookupTableAccount[]): VersionedTransaction;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import BN from 'bn.js';
|
|
2
|
-
import {
|
|
3
|
-
CompressedAccount,
|
|
4
|
-
CompressedAccountWithMerkleContext,
|
|
5
|
-
} from '../state';
|
|
2
|
+
import { CompressedAccount, CompressedAccountWithMerkleContext } from '../state';
|
|
6
3
|
export declare const validateSufficientBalance: (balance: BN) => void;
|
|
7
|
-
export declare const validateSameOwner: (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
) => void;
|
|
4
|
+
export declare const validateSameOwner: (compressedAccounts: CompressedAccount[] | CompressedAccountWithMerkleContext[]) => void;
|
|
5
|
+
export declare const validateNumbersForProof: (hashesLength: number, newAddressesLength: number) => void;
|
|
6
|
+
export declare const validateNumbersForInclusionProof: (hashesLength: number) => void;
|
|
7
|
+
export declare const validateNumbersForNonInclusionProof: (newAddressesLength: number) => void;
|
|
8
|
+
export declare const validateNumbers: (length: number, allowedNumbers: number[], type: string) => void;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { Signer } from '@solana/web3.js';
|
|
2
2
|
/** @internal remove signer from signers if part of signers */
|
|
3
|
-
export declare function dedupeSigner(
|
|
4
|
-
signer: Signer,
|
|
5
|
-
signers: Signer[],
|
|
6
|
-
): Signer[];
|
|
3
|
+
export declare function dedupeSigner(signer: Signer, signers: Signer[]): Signer[];
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConfirmOptions,
|
|
3
|
-
PublicKey,
|
|
4
|
-
Signer,
|
|
5
|
-
TransactionSignature,
|
|
6
|
-
} from '@solana/web3.js';
|
|
1
|
+
import { ConfirmOptions, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
|
7
2
|
import { Rpc } from '../rpc';
|
|
8
3
|
import BN from 'bn.js';
|
|
9
4
|
/**
|
|
@@ -18,11 +13,4 @@ import BN from 'bn.js';
|
|
|
18
13
|
*
|
|
19
14
|
* @return Transaction signature
|
|
20
15
|
*/
|
|
21
|
-
export declare function compress(
|
|
22
|
-
rpc: Rpc,
|
|
23
|
-
payer: Signer,
|
|
24
|
-
lamports: number | BN,
|
|
25
|
-
toAddress: PublicKey,
|
|
26
|
-
outputStateTree?: PublicKey,
|
|
27
|
-
confirmOptions?: ConfirmOptions,
|
|
28
|
-
): Promise<TransactionSignature>;
|
|
16
|
+
export declare function compress(rpc: Rpc, payer: Signer, lamports: number | BN, toAddress: PublicKey, outputStateTree?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConfirmOptions,
|
|
3
|
-
PublicKey,
|
|
4
|
-
Signer,
|
|
5
|
-
TransactionSignature,
|
|
6
|
-
} from '@solana/web3.js';
|
|
1
|
+
import { ConfirmOptions, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
|
|
7
2
|
import { Rpc } from '../rpc';
|
|
8
3
|
import BN from 'bn.js';
|
|
9
4
|
/**
|
|
@@ -23,16 +18,7 @@ import BN from 'bn.js';
|
|
|
23
18
|
*
|
|
24
19
|
* @return Transaction signature
|
|
25
20
|
*/
|
|
26
|
-
export declare function createAccount(
|
|
27
|
-
rpc: Rpc,
|
|
28
|
-
payer: Signer,
|
|
29
|
-
seeds: Uint8Array[],
|
|
30
|
-
programId: PublicKey,
|
|
31
|
-
addressTree?: PublicKey,
|
|
32
|
-
addressQueue?: PublicKey,
|
|
33
|
-
outputStateTree?: PublicKey,
|
|
34
|
-
confirmOptions?: ConfirmOptions,
|
|
35
|
-
): Promise<TransactionSignature>;
|
|
21
|
+
export declare function createAccount(rpc: Rpc, payer: Signer, seeds: Uint8Array[], programId: PublicKey, addressTree?: PublicKey, addressQueue?: PublicKey, outputStateTree?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|
|
36
22
|
/**
|
|
37
23
|
* Create compressed account with address and lamports
|
|
38
24
|
*
|
|
@@ -52,14 +38,4 @@ export declare function createAccount(
|
|
|
52
38
|
*
|
|
53
39
|
* @return Transaction signature
|
|
54
40
|
*/
|
|
55
|
-
export declare function createAccountWithLamports(
|
|
56
|
-
rpc: Rpc,
|
|
57
|
-
payer: Signer,
|
|
58
|
-
seeds: Uint8Array[],
|
|
59
|
-
lamports: number | BN,
|
|
60
|
-
programId: PublicKey,
|
|
61
|
-
addressTree?: PublicKey,
|
|
62
|
-
addressQueue?: PublicKey,
|
|
63
|
-
outputStateTree?: PublicKey,
|
|
64
|
-
confirmOptions?: ConfirmOptions,
|
|
65
|
-
): Promise<TransactionSignature>;
|
|
41
|
+
export declare function createAccountWithLamports(rpc: Rpc, payer: Signer, seeds: Uint8Array[], lamports: number | BN, programId: PublicKey, addressTree?: PublicKey, addressQueue?: PublicKey, outputStateTree?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
|