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