@lightprotocol/stateless.js 0.23.0-beta.3 → 0.23.0-beta.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/compress.d.ts +14 -2
- package/dist/cjs/browser/actions/create-account.d.ts +25 -3
- package/dist/cjs/browser/actions/decompress.d.ts +13 -2
- package/dist/cjs/browser/actions/transfer.d.ts +14 -2
- package/dist/cjs/browser/constants.d.ts +67 -35
- package/dist/cjs/browser/errors.d.ts +40 -49
- package/dist/cjs/browser/index.cjs +11151 -1
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/browser/index.d.ts +0 -1
- package/dist/cjs/browser/programs/system/idl.d.ts +44 -44
- package/dist/cjs/browser/programs/system/layout.d.ts +50 -26
- package/dist/cjs/browser/programs/system/pack.d.ts +36 -7
- package/dist/cjs/browser/programs/system/program.d.ts +56 -9
- package/dist/cjs/browser/programs/system/select-compressed-accounts.d.ts +4 -1
- package/dist/cjs/browser/rpc-interface.d.ts +2918 -2226
- package/dist/cjs/browser/rpc.d.ts +198 -39
- package/dist/cjs/browser/state/BN254.d.ts +4 -1
- package/dist/cjs/browser/state/bn.d.ts +5 -1
- package/dist/cjs/browser/state/compressed-account.d.ts +42 -14
- package/dist/cjs/browser/state/types.d.ts +5 -2
- 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 +22 -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 +155 -35
- package/dist/cjs/browser/test-helpers/test-utils.d.ts +5 -1
- package/dist/cjs/browser/utils/address.d.ts +26 -6
- 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 +12 -4
- package/dist/cjs/browser/utils/dedupe-signer.d.ts +4 -1
- package/dist/cjs/browser/utils/get-state-tree-infos.d.ts +20 -5
- package/dist/cjs/browser/utils/instruction.d.ts +24 -7
- package/dist/cjs/browser/utils/pack-decompress.d.ts +9 -4
- 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/state-tree-lookup-table.d.ts +23 -3
- package/dist/cjs/browser/utils/validation.d.ts +24 -6
- package/dist/cjs/node/actions/compress.d.ts +14 -2
- package/dist/cjs/node/actions/create-account.d.ts +25 -3
- package/dist/cjs/node/actions/decompress.d.ts +13 -2
- package/dist/cjs/node/actions/transfer.d.ts +14 -2
- package/dist/cjs/node/constants.d.ts +67 -35
- package/dist/cjs/node/errors.d.ts +40 -49
- package/dist/cjs/node/index.cjs +9853 -1
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/cjs/node/index.d.ts +0 -1
- package/dist/cjs/node/programs/system/idl.d.ts +44 -44
- package/dist/cjs/node/programs/system/layout.d.ts +50 -26
- package/dist/cjs/node/programs/system/pack.d.ts +36 -7
- package/dist/cjs/node/programs/system/program.d.ts +56 -9
- package/dist/cjs/node/programs/system/select-compressed-accounts.d.ts +4 -1
- package/dist/cjs/node/rpc-interface.d.ts +2918 -2226
- package/dist/cjs/node/rpc.d.ts +198 -39
- package/dist/cjs/node/state/BN254.d.ts +4 -1
- package/dist/cjs/node/state/bn.d.ts +5 -1
- package/dist/cjs/node/state/compressed-account.d.ts +42 -14
- package/dist/cjs/node/state/types.d.ts +5 -2
- 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 +22 -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 +155 -35
- package/dist/cjs/node/test-helpers/test-utils.d.ts +5 -1
- package/dist/cjs/node/utils/address.d.ts +26 -6
- 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 +12 -4
- package/dist/cjs/node/utils/dedupe-signer.d.ts +4 -1
- package/dist/cjs/node/utils/get-state-tree-infos.d.ts +20 -5
- package/dist/cjs/node/utils/instruction.d.ts +24 -7
- package/dist/cjs/node/utils/pack-decompress.d.ts +9 -4
- 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/state-tree-lookup-table.d.ts +23 -3
- package/dist/cjs/node/utils/validation.d.ts +24 -6
- package/dist/es/browser/actions/compress.d.ts +14 -2
- package/dist/es/browser/actions/create-account.d.ts +25 -3
- package/dist/es/browser/actions/decompress.d.ts +13 -2
- package/dist/es/browser/actions/transfer.d.ts +14 -2
- package/dist/es/browser/constants.d.ts +67 -35
- package/dist/es/browser/errors.d.ts +40 -49
- package/dist/es/browser/index.d.ts +0 -1
- package/dist/es/browser/index.js +11159 -1
- package/dist/es/browser/index.js.map +1 -1
- package/dist/es/browser/programs/system/idl.d.ts +44 -44
- package/dist/es/browser/programs/system/layout.d.ts +50 -26
- package/dist/es/browser/programs/system/pack.d.ts +36 -7
- package/dist/es/browser/programs/system/program.d.ts +56 -9
- package/dist/es/browser/programs/system/select-compressed-accounts.d.ts +4 -1
- package/dist/es/browser/rpc-interface.d.ts +2918 -2226
- package/dist/es/browser/rpc.d.ts +198 -39
- package/dist/es/browser/state/BN254.d.ts +4 -1
- package/dist/es/browser/state/bn.d.ts +5 -1
- package/dist/es/browser/state/compressed-account.d.ts +42 -14
- package/dist/es/browser/state/types.d.ts +5 -2
- package/dist/es/browser/test-helpers/merkle-tree/indexed-array.d.ts +18 -4
- package/dist/es/browser/test-helpers/merkle-tree/merkle-tree.d.ts +19 -6
- package/dist/es/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +12 -3
- package/dist/es/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +22 -5
- package/dist/es/browser/test-helpers/test-rpc/get-parsed-events.d.ts +14 -4
- package/dist/es/browser/test-helpers/test-rpc/test-rpc.d.ts +155 -35
- package/dist/es/browser/test-helpers/test-utils.d.ts +5 -1
- package/dist/es/browser/utils/address.d.ts +26 -6
- package/dist/es/browser/utils/airdrop.d.ts +14 -2
- package/dist/es/browser/utils/calculate-compute-unit-price.d.ts +4 -1
- package/dist/es/browser/utils/conversion.d.ts +12 -4
- package/dist/es/browser/utils/dedupe-signer.d.ts +4 -1
- package/dist/es/browser/utils/get-state-tree-infos.d.ts +20 -5
- package/dist/es/browser/utils/instruction.d.ts +24 -7
- package/dist/es/browser/utils/pack-decompress.d.ts +9 -4
- package/dist/es/browser/utils/pipe.d.ts +4 -1
- package/dist/es/browser/utils/send-and-confirm.d.ts +42 -11
- package/dist/es/browser/utils/state-tree-lookup-table.d.ts +23 -3
- package/dist/es/browser/utils/validation.d.ts +24 -6
- package/dist/types/index.d.ts +4134 -2547
- package/package.json +1 -1
- package/dist/cjs/browser/devnet-compat.d.ts +0 -15
- package/dist/cjs/node/devnet-compat.d.ts +0 -15
- package/dist/es/browser/devnet-compat.d.ts +0 -15
package/dist/cjs/node/rpc.d.ts
CHANGED
|
@@ -1,13 +1,56 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
AccountInfo,
|
|
3
|
+
Commitment,
|
|
4
|
+
Connection,
|
|
5
|
+
ConnectionConfig,
|
|
6
|
+
GetAccountInfoConfig,
|
|
7
|
+
PublicKey,
|
|
8
|
+
SignaturesForAddressOptions,
|
|
9
|
+
} from '@solana/web3.js';
|
|
2
10
|
import { Buffer } from 'buffer';
|
|
3
|
-
import {
|
|
4
|
-
|
|
11
|
+
import {
|
|
12
|
+
ValidityProofWithContext,
|
|
13
|
+
CompressedTransaction,
|
|
14
|
+
CompressionApiInterface,
|
|
15
|
+
GetCompressedTokenAccountsByOwnerOrDelegateOptions,
|
|
16
|
+
HexInputsForProver,
|
|
17
|
+
ParsedTokenAccount,
|
|
18
|
+
SignatureWithMetadata,
|
|
19
|
+
LatestNonVotingSignatures,
|
|
20
|
+
LatestNonVotingSignaturesPaginated,
|
|
21
|
+
WithContext,
|
|
22
|
+
GetCompressedAccountsByOwnerConfig,
|
|
23
|
+
WithCursor,
|
|
24
|
+
AddressWithTree,
|
|
25
|
+
HashWithTree,
|
|
26
|
+
CompressedMintTokenHolders,
|
|
27
|
+
TokenBalance,
|
|
28
|
+
PaginatedOptions,
|
|
29
|
+
DerivationMode,
|
|
30
|
+
AddressWithTreeInfoV2,
|
|
31
|
+
SignaturesForAddressInterfaceResult,
|
|
32
|
+
UnifiedSignatureInfo,
|
|
33
|
+
UnifiedTokenBalance,
|
|
34
|
+
UnifiedBalance,
|
|
35
|
+
} from './rpc-interface';
|
|
36
|
+
import {
|
|
37
|
+
MerkleContextWithMerkleProof,
|
|
38
|
+
BN254,
|
|
39
|
+
CompressedAccountWithMerkleContext,
|
|
40
|
+
ValidityProof,
|
|
41
|
+
AddressTreeInfo,
|
|
42
|
+
MerkleContext,
|
|
43
|
+
} from './state';
|
|
5
44
|
import BN from 'bn.js';
|
|
6
45
|
import { ConfirmedSignatureInfo } from '@solana/web3.js';
|
|
7
46
|
import { LightWasm } from './test-helpers';
|
|
8
47
|
import { TreeInfo } from './state/types';
|
|
9
48
|
/** @internal */
|
|
10
|
-
export declare function parseAccountData({
|
|
49
|
+
export declare function parseAccountData({
|
|
50
|
+
discriminator,
|
|
51
|
+
data,
|
|
52
|
+
dataHash,
|
|
53
|
+
}: {
|
|
11
54
|
discriminator: BN;
|
|
12
55
|
data: string;
|
|
13
56
|
dataHash: BN;
|
|
@@ -26,7 +69,12 @@ export declare function parseAccountData({ discriminator, data, dataHash, }: {
|
|
|
26
69
|
* to endpoint
|
|
27
70
|
* @param connectionConfig Optional connection config
|
|
28
71
|
*/
|
|
29
|
-
export declare function createRpc(
|
|
72
|
+
export declare function createRpc(
|
|
73
|
+
endpointOrWeb3JsConnection?: string | Connection,
|
|
74
|
+
compressionApiEndpoint?: string,
|
|
75
|
+
proverEndpoint?: string,
|
|
76
|
+
config?: ConnectionConfig,
|
|
77
|
+
): Rpc;
|
|
30
78
|
/**
|
|
31
79
|
* Helper function to preprocess the response to wrap numbers as strings
|
|
32
80
|
* @param {string} text - The JSON string to preprocess
|
|
@@ -34,9 +82,21 @@ export declare function createRpc(endpointOrWeb3JsConnection?: string | Connecti
|
|
|
34
82
|
*/
|
|
35
83
|
export declare function wrapBigNumbersAsStrings(text: string): string;
|
|
36
84
|
/** @internal */
|
|
37
|
-
export declare const rpcRequest: (
|
|
85
|
+
export declare const rpcRequest: (
|
|
86
|
+
rpcEndpoint: string,
|
|
87
|
+
method: string,
|
|
88
|
+
params?: any,
|
|
89
|
+
convertToCamelCase?: boolean,
|
|
90
|
+
debug?: boolean,
|
|
91
|
+
) => Promise<any>;
|
|
38
92
|
/** @internal */
|
|
39
|
-
export declare const proverRequest: (
|
|
93
|
+
export declare const proverRequest: (
|
|
94
|
+
proverEndpoint: string,
|
|
95
|
+
method: 'inclusion' | 'new-address' | 'combined',
|
|
96
|
+
params?: any,
|
|
97
|
+
log?: boolean,
|
|
98
|
+
_publicInputHash?: BN | undefined,
|
|
99
|
+
) => Promise<ValidityProof>;
|
|
40
100
|
export type NonInclusionMerkleProofInputs = {
|
|
41
101
|
root: BN;
|
|
42
102
|
value: BN;
|
|
@@ -66,9 +126,18 @@ export type NonInclusionJsonStruct = {
|
|
|
66
126
|
leafHigherRangeValue: string;
|
|
67
127
|
nextIndex: number;
|
|
68
128
|
};
|
|
69
|
-
export declare function convertMerkleProofsWithContextToHex(
|
|
70
|
-
|
|
71
|
-
|
|
129
|
+
export declare function convertMerkleProofsWithContextToHex(
|
|
130
|
+
merkleProofsWithContext: MerkleContextWithMerkleProof[],
|
|
131
|
+
): HexInputsForProver[];
|
|
132
|
+
export declare function convertNonInclusionMerkleProofInputsToHex(
|
|
133
|
+
nonInclusionMerkleProofInputs: MerkleContextWithNewAddressProof[],
|
|
134
|
+
): NonInclusionJsonStruct[];
|
|
135
|
+
export declare function getPublicInputHash(
|
|
136
|
+
accountProofs: MerkleContextWithMerkleProof[],
|
|
137
|
+
accountHashes: BN254[],
|
|
138
|
+
newAddressProofs: MerkleContextWithNewAddressProof[],
|
|
139
|
+
lightWasm: LightWasm,
|
|
140
|
+
): BN;
|
|
72
141
|
export interface NullifierMetadata {
|
|
73
142
|
nullifier: BN254;
|
|
74
143
|
txHash: BN254;
|
|
@@ -78,7 +147,10 @@ export interface NullifierMetadata {
|
|
|
78
147
|
* Deduplicates by signature, tracking sources in the `sources` array.
|
|
79
148
|
* When a signature exists in both, uses Solana data (richer) but marks both sources.
|
|
80
149
|
*/
|
|
81
|
-
export declare function mergeSignatures(
|
|
150
|
+
export declare function mergeSignatures(
|
|
151
|
+
solanaSignatures: ConfirmedSignatureInfo[],
|
|
152
|
+
compressedSignatures: SignatureWithMetadata[],
|
|
153
|
+
): UnifiedSignatureInfo[];
|
|
82
154
|
/**
|
|
83
155
|
*
|
|
84
156
|
*/
|
|
@@ -89,7 +161,12 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
89
161
|
lastStateTreeFetchTime: number | null;
|
|
90
162
|
CACHE_TTL: number;
|
|
91
163
|
fetchPromise: Promise<TreeInfo[]> | null;
|
|
92
|
-
constructor(
|
|
164
|
+
constructor(
|
|
165
|
+
endpoint: string,
|
|
166
|
+
compressionApiEndpoint: string,
|
|
167
|
+
proverEndpoint: string,
|
|
168
|
+
config?: ConnectionConfig,
|
|
169
|
+
);
|
|
93
170
|
/**
|
|
94
171
|
* @deprecated Use {@link getStateTreeInfos} instead
|
|
95
172
|
*/
|
|
@@ -115,7 +192,10 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
115
192
|
/**
|
|
116
193
|
* Fetch the compressed account for the specified account address or hash
|
|
117
194
|
*/
|
|
118
|
-
getCompressedAccount(
|
|
195
|
+
getCompressedAccount(
|
|
196
|
+
address?: BN254,
|
|
197
|
+
hash?: BN254,
|
|
198
|
+
): Promise<CompressedAccountWithMerkleContext | null>;
|
|
119
199
|
/**
|
|
120
200
|
* Fetch the compressed balance for the specified account address or hash
|
|
121
201
|
*/
|
|
@@ -128,31 +208,46 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
128
208
|
* Fetch the latest merkle proof for the specified account hash from the
|
|
129
209
|
* cluster
|
|
130
210
|
*/
|
|
131
|
-
getCompressedAccountProof(
|
|
211
|
+
getCompressedAccountProof(
|
|
212
|
+
hash: BN254,
|
|
213
|
+
): Promise<MerkleContextWithMerkleProof>;
|
|
132
214
|
/**
|
|
133
215
|
* Fetch all the account info for multiple compressed accounts specified by
|
|
134
216
|
* an array of account hashes
|
|
135
217
|
*/
|
|
136
|
-
getMultipleCompressedAccounts(
|
|
218
|
+
getMultipleCompressedAccounts(
|
|
219
|
+
hashes: BN254[],
|
|
220
|
+
): Promise<CompressedAccountWithMerkleContext[]>;
|
|
137
221
|
/**
|
|
138
222
|
* Fetch the latest merkle proofs for multiple compressed accounts specified
|
|
139
223
|
* by an array account hashes
|
|
140
224
|
*/
|
|
141
|
-
getMultipleCompressedAccountProofs(
|
|
225
|
+
getMultipleCompressedAccountProofs(
|
|
226
|
+
hashes: BN254[],
|
|
227
|
+
): Promise<MerkleContextWithMerkleProof[]>;
|
|
142
228
|
/**
|
|
143
229
|
* Fetch all the compressed accounts owned by the specified public key.
|
|
144
230
|
* Owner can be a program or user account
|
|
145
231
|
*/
|
|
146
|
-
getCompressedAccountsByOwner(
|
|
232
|
+
getCompressedAccountsByOwner(
|
|
233
|
+
owner: PublicKey,
|
|
234
|
+
config?: GetCompressedAccountsByOwnerConfig | undefined,
|
|
235
|
+
): Promise<WithCursor<CompressedAccountWithMerkleContext[]>>;
|
|
147
236
|
/**
|
|
148
237
|
* Fetch all the compressed token accounts owned by the specified public
|
|
149
238
|
* key. Owner can be a program or user account
|
|
150
239
|
*/
|
|
151
|
-
getCompressedTokenAccountsByOwner(
|
|
240
|
+
getCompressedTokenAccountsByOwner(
|
|
241
|
+
owner: PublicKey,
|
|
242
|
+
options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions,
|
|
243
|
+
): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
152
244
|
/**
|
|
153
245
|
* Fetch all the compressed accounts delegated to the specified public key.
|
|
154
246
|
*/
|
|
155
|
-
getCompressedTokenAccountsByDelegate(
|
|
247
|
+
getCompressedTokenAccountsByDelegate(
|
|
248
|
+
delegate: PublicKey,
|
|
249
|
+
options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions,
|
|
250
|
+
): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
156
251
|
/**
|
|
157
252
|
* Fetch the compressed token balance for the specified account hash
|
|
158
253
|
*/
|
|
@@ -165,12 +260,18 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
165
260
|
* Fetch all the compressed token balances owned by the specified public
|
|
166
261
|
* key. Can filter by mint. Returns without context.
|
|
167
262
|
*/
|
|
168
|
-
getCompressedTokenBalancesByOwner(
|
|
263
|
+
getCompressedTokenBalancesByOwner(
|
|
264
|
+
owner: PublicKey,
|
|
265
|
+
options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions,
|
|
266
|
+
): Promise<WithCursor<TokenBalance[]>>;
|
|
169
267
|
/**
|
|
170
268
|
* Fetch the compressed token balances owned by the specified public
|
|
171
269
|
* key. Paginated. Can filter by mint. Returns with context.
|
|
172
270
|
*/
|
|
173
|
-
getCompressedTokenBalancesByOwnerV2(
|
|
271
|
+
getCompressedTokenBalancesByOwnerV2(
|
|
272
|
+
owner: PublicKey,
|
|
273
|
+
options?: GetCompressedTokenAccountsByOwnerOrDelegateOptions,
|
|
274
|
+
): Promise<WithContext<WithCursor<TokenBalance[]>>>;
|
|
174
275
|
/**
|
|
175
276
|
* Returns confirmed compression signatures for transactions involving the specified
|
|
176
277
|
* account hash forward in time from genesis to the most recent confirmed
|
|
@@ -178,19 +279,26 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
178
279
|
*
|
|
179
280
|
* @param hash queried account hash
|
|
180
281
|
*/
|
|
181
|
-
getCompressionSignaturesForAccount(
|
|
282
|
+
getCompressionSignaturesForAccount(
|
|
283
|
+
hash: BN254,
|
|
284
|
+
): Promise<SignatureWithMetadata[]>;
|
|
182
285
|
/**
|
|
183
286
|
* Fetch a confirmed or finalized transaction from the cluster. Return with
|
|
184
287
|
* CompressionInfo
|
|
185
288
|
*/
|
|
186
|
-
getTransactionWithCompressionInfo(
|
|
289
|
+
getTransactionWithCompressionInfo(
|
|
290
|
+
signature: string,
|
|
291
|
+
): Promise<CompressedTransaction | null>;
|
|
187
292
|
/**
|
|
188
293
|
* Returns confirmed signatures for transactions involving the specified
|
|
189
294
|
* address forward in time from genesis to the most recent confirmed block
|
|
190
295
|
*
|
|
191
296
|
* @param address queried compressed account address
|
|
192
297
|
*/
|
|
193
|
-
getCompressionSignaturesForAddress(
|
|
298
|
+
getCompressionSignaturesForAddress(
|
|
299
|
+
address: PublicKey,
|
|
300
|
+
options?: PaginatedOptions,
|
|
301
|
+
): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
194
302
|
/**
|
|
195
303
|
* Returns confirmed signatures for compression transactions involving the
|
|
196
304
|
* specified account owner forward in time from genesis to the
|
|
@@ -198,13 +306,19 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
198
306
|
*
|
|
199
307
|
* @param owner queried owner public key
|
|
200
308
|
*/
|
|
201
|
-
getCompressionSignaturesForOwner(
|
|
309
|
+
getCompressionSignaturesForOwner(
|
|
310
|
+
owner: PublicKey,
|
|
311
|
+
options?: PaginatedOptions,
|
|
312
|
+
): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
202
313
|
/**
|
|
203
314
|
* Returns confirmed signatures for compression transactions involving the
|
|
204
315
|
* specified token account owner forward in time from genesis to the most
|
|
205
316
|
* recent confirmed block
|
|
206
317
|
*/
|
|
207
|
-
getCompressionSignaturesForTokenOwner(
|
|
318
|
+
getCompressionSignaturesForTokenOwner(
|
|
319
|
+
owner: PublicKey,
|
|
320
|
+
options?: PaginatedOptions,
|
|
321
|
+
): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
208
322
|
/**
|
|
209
323
|
* Fetch the current indexer health status
|
|
210
324
|
*/
|
|
@@ -220,16 +334,25 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
220
334
|
/**
|
|
221
335
|
* Fetch all the compressed token holders for a given mint. Paginated.
|
|
222
336
|
*/
|
|
223
|
-
getCompressedMintTokenHolders(
|
|
337
|
+
getCompressedMintTokenHolders(
|
|
338
|
+
mint: PublicKey,
|
|
339
|
+
options?: PaginatedOptions,
|
|
340
|
+
): Promise<WithContext<WithCursor<CompressedMintTokenHolders[]>>>;
|
|
224
341
|
/**
|
|
225
342
|
* Fetch the latest compression signatures on the cluster. Results are
|
|
226
343
|
* paginated.
|
|
227
344
|
*/
|
|
228
|
-
getLatestCompressionSignatures(
|
|
345
|
+
getLatestCompressionSignatures(
|
|
346
|
+
cursor?: string,
|
|
347
|
+
limit?: number,
|
|
348
|
+
): Promise<LatestNonVotingSignaturesPaginated>;
|
|
229
349
|
/**
|
|
230
350
|
* Fetch all non-voting signatures
|
|
231
351
|
*/
|
|
232
|
-
getLatestNonVotingSignatures(
|
|
352
|
+
getLatestNonVotingSignatures(
|
|
353
|
+
limit?: number,
|
|
354
|
+
cursor?: string,
|
|
355
|
+
): Promise<LatestNonVotingSignatures>;
|
|
233
356
|
/**
|
|
234
357
|
* Fetch the latest address proofs for new unique addresses specified by an
|
|
235
358
|
* array of addresses.
|
|
@@ -239,7 +362,9 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
239
362
|
* @param addresses Array of BN254 new addresses
|
|
240
363
|
* @returns Array of validity proofs for new addresses
|
|
241
364
|
*/
|
|
242
|
-
getMultipleNewAddressProofs(
|
|
365
|
+
getMultipleNewAddressProofs(
|
|
366
|
+
addresses: BN254[],
|
|
367
|
+
): Promise<MerkleContextWithNewAddressProof[]>;
|
|
243
368
|
/**
|
|
244
369
|
* @deprecated use {@link getValidityProofV0} instead.
|
|
245
370
|
*
|
|
@@ -256,7 +381,10 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
256
381
|
* @param newAddresses Array of BN254 new addresses.
|
|
257
382
|
* @returns validity proof with context
|
|
258
383
|
*/
|
|
259
|
-
getValidityProof(
|
|
384
|
+
getValidityProof(
|
|
385
|
+
hashes?: BN254[],
|
|
386
|
+
newAddresses?: BN254[],
|
|
387
|
+
): Promise<ValidityProofWithContext>;
|
|
260
388
|
/**
|
|
261
389
|
* Fetch the latest validity proof for (1) compressed accounts specified by
|
|
262
390
|
* an array of account hashes. (2) new unique addresses specified by an
|
|
@@ -271,7 +399,10 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
271
399
|
* @param newAddresses Array of { address: BN254, tree: PublicKey, queue: PublicKey }.
|
|
272
400
|
* @returns validity proof with context
|
|
273
401
|
*/
|
|
274
|
-
getValidityProofV0(
|
|
402
|
+
getValidityProofV0(
|
|
403
|
+
hashes?: HashWithTree[],
|
|
404
|
+
newAddresses?: AddressWithTree[],
|
|
405
|
+
): Promise<ValidityProofWithContext>;
|
|
275
406
|
/**
|
|
276
407
|
* Fetch the latest validity proof for (1) compressed accounts specified by
|
|
277
408
|
* an array of account Merkle contexts, and (2) new unique addresses specified by
|
|
@@ -282,7 +413,11 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
282
413
|
* enable verification without recomputing the merkle proof path, thus
|
|
283
414
|
* lowering verification and data costs.
|
|
284
415
|
*/
|
|
285
|
-
getValidityProofV2(
|
|
416
|
+
getValidityProofV2(
|
|
417
|
+
accountMerkleContexts?: (MerkleContext | undefined)[],
|
|
418
|
+
newAddresses?: AddressWithTreeInfoV2[],
|
|
419
|
+
derivationMode?: DerivationMode,
|
|
420
|
+
): Promise<ValidityProofWithContext>;
|
|
286
421
|
/**
|
|
287
422
|
* Fetch the latest validity proof for (1) compressed accounts specified by
|
|
288
423
|
* an array of account hashes. (2) new unique addresses specified by an
|
|
@@ -299,7 +434,10 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
299
434
|
* state tree/queue.
|
|
300
435
|
* @returns validity proof with context
|
|
301
436
|
*/
|
|
302
|
-
getValidityProofAndRpcContext(
|
|
437
|
+
getValidityProofAndRpcContext(
|
|
438
|
+
hashes?: HashWithTree[],
|
|
439
|
+
newAddresses?: AddressWithTree[],
|
|
440
|
+
): Promise<WithContext<ValidityProofWithContext>>;
|
|
303
441
|
/**
|
|
304
442
|
* Fetch the account info for the specified public key. Returns metadata
|
|
305
443
|
* to load in case the account is cold.
|
|
@@ -317,7 +455,12 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
317
455
|
* if true the account must referenced in a
|
|
318
456
|
* load instruction before use.
|
|
319
457
|
*/
|
|
320
|
-
getAccountInfoInterface(
|
|
458
|
+
getAccountInfoInterface(
|
|
459
|
+
address: PublicKey,
|
|
460
|
+
programId: PublicKey,
|
|
461
|
+
commitmentOrConfig?: Commitment | GetAccountInfoConfig,
|
|
462
|
+
addressSpace?: TreeInfo,
|
|
463
|
+
): Promise<{
|
|
321
464
|
accountInfo: AccountInfo<Buffer>;
|
|
322
465
|
isCold: boolean;
|
|
323
466
|
loadContext?: MerkleContext;
|
|
@@ -330,7 +473,11 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
330
473
|
* @param compressedOptions Options for the compression getCompressionSignaturesForAddress call.
|
|
331
474
|
* @returns Unified signatures from both sources.
|
|
332
475
|
*/
|
|
333
|
-
getSignaturesForAddressInterface(
|
|
476
|
+
getSignaturesForAddressInterface(
|
|
477
|
+
address: PublicKey,
|
|
478
|
+
options?: SignaturesForAddressOptions,
|
|
479
|
+
compressedOptions?: PaginatedOptions,
|
|
480
|
+
): Promise<SignaturesForAddressInterfaceResult>;
|
|
334
481
|
/**
|
|
335
482
|
* Get signatures for an owner from both Solana and compression indexer.
|
|
336
483
|
*
|
|
@@ -339,7 +486,11 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
339
486
|
* @param compressedOptions Options for the compression getCompressionSignaturesForOwner call.
|
|
340
487
|
* @returns Unified signatures from both sources.
|
|
341
488
|
*/
|
|
342
|
-
getSignaturesForOwnerInterface(
|
|
489
|
+
getSignaturesForOwnerInterface(
|
|
490
|
+
owner: PublicKey,
|
|
491
|
+
options?: SignaturesForAddressOptions,
|
|
492
|
+
compressedOptions?: PaginatedOptions,
|
|
493
|
+
): Promise<SignaturesForAddressInterfaceResult>;
|
|
343
494
|
/**
|
|
344
495
|
* Get token account balance for an address, regardless of whether the token
|
|
345
496
|
* account is hot or cold.
|
|
@@ -350,7 +501,12 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
350
501
|
* @param commitment Commitment level for on-chain query.
|
|
351
502
|
* @returns Unified token balance from both sources.
|
|
352
503
|
*/
|
|
353
|
-
getTokenAccountBalanceInterface(
|
|
504
|
+
getTokenAccountBalanceInterface(
|
|
505
|
+
address: PublicKey,
|
|
506
|
+
owner: PublicKey,
|
|
507
|
+
mint: PublicKey,
|
|
508
|
+
commitment?: Commitment,
|
|
509
|
+
): Promise<UnifiedTokenBalance>;
|
|
354
510
|
/**
|
|
355
511
|
* Get SOL balance for an address, regardless of whether the account is hot or cold.
|
|
356
512
|
*
|
|
@@ -358,5 +514,8 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
358
514
|
* @param commitment Commitment level for on-chain query.
|
|
359
515
|
* @returns Unified SOL balance.
|
|
360
516
|
*/
|
|
361
|
-
getBalanceInterface(
|
|
517
|
+
getBalanceInterface(
|
|
518
|
+
address: PublicKey,
|
|
519
|
+
commitment?: Commitment,
|
|
520
|
+
): Promise<UnifiedBalance>;
|
|
362
521
|
}
|
|
@@ -8,6 +8,9 @@ import { Buffer } from 'buffer';
|
|
|
8
8
|
*/
|
|
9
9
|
export type BN254 = BN;
|
|
10
10
|
/** Create a bigint instance with <254-bit max size and base58 capabilities */
|
|
11
|
-
export declare const createBN254: (
|
|
11
|
+
export declare const createBN254: (
|
|
12
|
+
number: string | number | BN | Buffer | Uint8Array | number[],
|
|
13
|
+
base?: number | 'hex' | 'base58' | undefined,
|
|
14
|
+
) => BN254;
|
|
12
15
|
/** Convert <254-bit bigint to Base58 string. */
|
|
13
16
|
export declare function encodeBN254toBase58(bigintNumber: BN): string;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import BN from 'bn.js';
|
|
2
2
|
import { Buffer } from 'buffer';
|
|
3
|
-
export declare const bn: (
|
|
3
|
+
export declare const bn: (
|
|
4
|
+
number: string | number | BN | Buffer | Uint8Array | number[],
|
|
5
|
+
base?: number | 'hex' | undefined,
|
|
6
|
+
endian?: BN.Endianness | undefined,
|
|
7
|
+
) => BN;
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
CompressedAccountData,
|
|
4
|
+
CompressedAccountLegacy,
|
|
5
|
+
PackedMerkleContextLegacy,
|
|
6
|
+
TreeInfo,
|
|
7
|
+
} from './types';
|
|
3
8
|
import BN from 'bn.js';
|
|
4
9
|
import { BN254 } from './BN254';
|
|
5
10
|
/**
|
|
6
11
|
* @deprecated use {@link CompressedAccount} instead
|
|
7
12
|
*/
|
|
8
|
-
export type CompressedAccountWithMerkleContext = CompressedAccount &
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
export type CompressedAccountWithMerkleContext = CompressedAccount &
|
|
14
|
+
MerkleContext & {
|
|
15
|
+
readOnly: boolean;
|
|
16
|
+
};
|
|
11
17
|
/**
|
|
12
18
|
* @deprecated use {@link CompressedAccount} instead
|
|
13
19
|
*/
|
|
14
|
-
export type CompressedAccountWithMerkleContextLegacy = CompressedAccount &
|
|
20
|
+
export type CompressedAccountWithMerkleContextLegacy = CompressedAccount &
|
|
21
|
+
MerkleContext;
|
|
15
22
|
/**
|
|
16
23
|
* Compressed account + metadata about the state tree in which the account is
|
|
17
24
|
* stored.
|
|
@@ -34,11 +41,11 @@ export type CompressedAccount = {
|
|
|
34
41
|
*/
|
|
35
42
|
data: CompressedAccountData | null;
|
|
36
43
|
} & MerkleContext & {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
44
|
+
/**
|
|
45
|
+
* Read only.
|
|
46
|
+
*/
|
|
47
|
+
readOnly: boolean;
|
|
48
|
+
};
|
|
42
49
|
/**
|
|
43
50
|
* @deprecated use {@link MerkleContext} instead.
|
|
44
51
|
*
|
|
@@ -168,7 +175,12 @@ export type CompressedAccountMeta = {
|
|
|
168
175
|
* Create an output compressed account meta for a new account.
|
|
169
176
|
* Client-side only.
|
|
170
177
|
*/
|
|
171
|
-
export declare const createCompressedAccountMeta: (
|
|
178
|
+
export declare const createCompressedAccountMeta: (
|
|
179
|
+
treeInfo: PackedStateTreeInfo,
|
|
180
|
+
outputStateTreeIndex: number,
|
|
181
|
+
address?: number[],
|
|
182
|
+
lamports?: BN,
|
|
183
|
+
) => CompressedAccountMeta;
|
|
172
184
|
/**
|
|
173
185
|
* @deprecated Use {@link PackedStateTreeInfo} instead.
|
|
174
186
|
* Packed compressed account with merkle context.
|
|
@@ -194,12 +206,28 @@ export interface PackedCompressedAccountWithMerkleContext {
|
|
|
194
206
|
/**
|
|
195
207
|
* @deprecated use {@link createCompressedAccountMeta} instead.
|
|
196
208
|
*/
|
|
197
|
-
export declare const createCompressedAccountLegacy: (
|
|
209
|
+
export declare const createCompressedAccountLegacy: (
|
|
210
|
+
owner: PublicKey,
|
|
211
|
+
lamports?: BN,
|
|
212
|
+
data?: CompressedAccountData,
|
|
213
|
+
address?: number[],
|
|
214
|
+
) => CompressedAccountLegacy;
|
|
198
215
|
/**
|
|
199
216
|
* @deprecated.
|
|
200
217
|
*/
|
|
201
|
-
export declare const createCompressedAccountWithMerkleContextLegacy: (
|
|
218
|
+
export declare const createCompressedAccountWithMerkleContextLegacy: (
|
|
219
|
+
merkleContext: MerkleContext,
|
|
220
|
+
owner: PublicKey,
|
|
221
|
+
lamports?: BN,
|
|
222
|
+
data?: CompressedAccountData,
|
|
223
|
+
address?: number[],
|
|
224
|
+
) => CompressedAccountWithMerkleContext;
|
|
202
225
|
/**
|
|
203
226
|
* @deprecated use {@link createCompressedAccountMeta} instead.
|
|
204
227
|
*/
|
|
205
|
-
export declare const createMerkleContextLegacy: (
|
|
228
|
+
export declare const createMerkleContextLegacy: (
|
|
229
|
+
treeInfo: TreeInfo,
|
|
230
|
+
hash: BN254,
|
|
231
|
+
leafIndex: number,
|
|
232
|
+
proveByIndex?: boolean,
|
|
233
|
+
) => MerkleContext;
|
|
@@ -19,7 +19,7 @@ export declare enum TreeType {
|
|
|
19
19
|
/**
|
|
20
20
|
* v2 address merkle tree
|
|
21
21
|
*/
|
|
22
|
-
AddressV2 = 4
|
|
22
|
+
AddressV2 = 4,
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* @deprecated Use {@link TreeInfo} instead.
|
|
@@ -99,7 +99,10 @@ export type TreeInfo = {
|
|
|
99
99
|
* Address tree info, versioned via {@link TreeType}. The protocol
|
|
100
100
|
* stores PDAs in address trees.
|
|
101
101
|
*/
|
|
102
|
-
export type AddressTreeInfo = Omit<
|
|
102
|
+
export type AddressTreeInfo = Omit<
|
|
103
|
+
StateTreeInfo,
|
|
104
|
+
'cpiContext' | 'nextTreeInfo'
|
|
105
|
+
> & {
|
|
103
106
|
/**
|
|
104
107
|
* Next tree info.
|
|
105
108
|
*/
|
|
@@ -13,7 +13,11 @@ export declare class IndexedElementBundle {
|
|
|
13
13
|
newLowElement: IndexedElement;
|
|
14
14
|
newElement: IndexedElement;
|
|
15
15
|
newElementNextValue: BN;
|
|
16
|
-
constructor(
|
|
16
|
+
constructor(
|
|
17
|
+
newLowElement: IndexedElement,
|
|
18
|
+
newElement: IndexedElement,
|
|
19
|
+
newElementNextValue: BN,
|
|
20
|
+
);
|
|
17
21
|
}
|
|
18
22
|
/**
|
|
19
23
|
* This indexed array implementation mirrors the rust implementation of the
|
|
@@ -23,7 +27,11 @@ export declare class IndexedArray {
|
|
|
23
27
|
elements: Array<IndexedElement>;
|
|
24
28
|
currentNodeIndex: number;
|
|
25
29
|
highestElementIndex: number;
|
|
26
|
-
constructor(
|
|
30
|
+
constructor(
|
|
31
|
+
elements: Array<IndexedElement>,
|
|
32
|
+
currentNodeIndex: number,
|
|
33
|
+
highestElementIndex: number,
|
|
34
|
+
);
|
|
27
35
|
static default(): IndexedArray;
|
|
28
36
|
get(index: number): IndexedElement | undefined;
|
|
29
37
|
length(): number;
|
|
@@ -63,7 +71,10 @@ export declare class IndexedArray {
|
|
|
63
71
|
* @param value The value of the new element to append.
|
|
64
72
|
* @returns The new element and its updated low element.
|
|
65
73
|
*/
|
|
66
|
-
appendWithLowElementIndex(
|
|
74
|
+
appendWithLowElementIndex(
|
|
75
|
+
lowElementIndex: number,
|
|
76
|
+
value: BN,
|
|
77
|
+
): IndexedElementBundle;
|
|
67
78
|
/**
|
|
68
79
|
* Finds the lowest element in the array.
|
|
69
80
|
* @returns The lowest element or undefined if the array is empty.
|
|
@@ -75,7 +86,10 @@ export declare class IndexedArray {
|
|
|
75
86
|
* @param value The value for the new element.
|
|
76
87
|
* @returns A bundle containing the new element, the updated low element, and the value of the next element.
|
|
77
88
|
*/
|
|
78
|
-
newElementWithLowElementIndex(
|
|
89
|
+
newElementWithLowElementIndex(
|
|
90
|
+
lowElementIndex: number,
|
|
91
|
+
value: BN,
|
|
92
|
+
): IndexedElementBundle;
|
|
79
93
|
/**
|
|
80
94
|
* Creates a new element with the specified value by first finding the appropriate low element index.
|
|
81
95
|
* @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,9 +23,16 @@ export declare class MerkleTree {
|
|
|
23
23
|
_zeros: string[];
|
|
24
24
|
_layers: string[][];
|
|
25
25
|
_lightWasm: LightWasm;
|
|
26
|
-
constructor(
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
constructor(
|
|
27
|
+
levels: number,
|
|
28
|
+
lightWasm: LightWasm,
|
|
29
|
+
elements?: string[],
|
|
30
|
+
{
|
|
31
|
+
zeroElement,
|
|
32
|
+
}?: {
|
|
33
|
+
zeroElement?: string | undefined;
|
|
34
|
+
},
|
|
35
|
+
);
|
|
29
36
|
_rebuild(): void;
|
|
30
37
|
/**
|
|
31
38
|
* Get tree root
|
|
@@ -63,7 +70,10 @@ export declare class MerkleTree {
|
|
|
63
70
|
* @param comparator A function that checks leaf value equality
|
|
64
71
|
* @returns {number} Index if element is found, otherwise -1
|
|
65
72
|
*/
|
|
66
|
-
indexOf(
|
|
73
|
+
indexOf(
|
|
74
|
+
element: string,
|
|
75
|
+
comparator?: ((element: string, el: string) => boolean) | null,
|
|
76
|
+
): number;
|
|
67
77
|
/**
|
|
68
78
|
* Returns a copy of non-zero tree elements
|
|
69
79
|
* @returns {Object[]}
|
|
@@ -88,5 +98,8 @@ export declare class MerkleTree {
|
|
|
88
98
|
* @param hashFunction
|
|
89
99
|
* @returns {MerkleTree}
|
|
90
100
|
*/
|
|
91
|
-
static deserialize(
|
|
101
|
+
static deserialize(
|
|
102
|
+
data: any,
|
|
103
|
+
hashFunction: (left: string, right: string) => string,
|
|
104
|
+
): any;
|
|
92
105
|
}
|