@lightprotocol/stateless.js 0.17.2-alpha.1 → 0.17.2-alpha.2
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/constants.d.ts +2 -0
- package/dist/cjs/browser/idl.d.ts +1015 -0
- package/dist/cjs/browser/index.cjs +1 -1
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/browser/index.d.ts +1 -0
- package/dist/cjs/browser/rpc-interface.d.ts +107 -114
- package/dist/cjs/browser/state/types.d.ts +5 -0
- package/dist/cjs/browser/utils/test-utils.d.ts +8 -0
- package/dist/cjs/node/constants.d.ts +2 -0
- package/dist/cjs/node/idl.d.ts +1015 -0
- package/dist/cjs/node/index.cjs +1 -1
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/cjs/node/index.d.ts +1 -0
- package/dist/cjs/node/rpc-interface.d.ts +107 -114
- package/dist/cjs/node/state/types.d.ts +5 -0
- package/dist/cjs/node/utils/test-utils.d.ts +8 -0
- package/dist/types/index.d.ts +1032 -9
- package/package.json +6 -5
- package/dist/es/browser/actions/common.d.ts +0 -3
- package/dist/es/browser/actions/compress.d.ts +0 -16
- package/dist/es/browser/actions/create-account.d.ts +0 -41
- package/dist/es/browser/actions/decompress.d.ts +0 -16
- package/dist/es/browser/actions/index.d.ts +0 -5
- package/dist/es/browser/actions/transfer.d.ts +0 -20
- package/dist/es/browser/constants.d.ts +0 -63
- package/dist/es/browser/errors.d.ts +0 -74
- package/dist/es/browser/index.d.ts +0 -10
- package/dist/es/browser/index.js +0 -2
- package/dist/es/browser/index.js.map +0 -1
- package/dist/es/browser/instruction/index.d.ts +0 -1
- package/dist/es/browser/instruction/pack-compressed-accounts.d.ts +0 -35
- package/dist/es/browser/programs/index.d.ts +0 -2
- package/dist/es/browser/programs/layout.d.ts +0 -25
- package/dist/es/browser/programs/system.d.ts +0 -199
- package/dist/es/browser/rpc-interface.d.ts +0 -1179
- package/dist/es/browser/rpc.d.ts +0 -275
- package/dist/es/browser/state/BN254.d.ts +0 -14
- package/dist/es/browser/state/compressed-account.d.ts +0 -31
- package/dist/es/browser/state/index.d.ts +0 -3
- package/dist/es/browser/state/types.d.ts +0 -91
- package/dist/es/browser/test-helpers/index.d.ts +0 -2
- package/dist/es/browser/test-helpers/merkle-tree/index.d.ts +0 -2
- package/dist/es/browser/test-helpers/merkle-tree/indexed-array.d.ts +0 -85
- package/dist/es/browser/test-helpers/merkle-tree/merkle-tree.d.ts +0 -92
- package/dist/es/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +0 -7
- package/dist/es/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +0 -40
- package/dist/es/browser/test-helpers/test-rpc/get-parsed-events.d.ts +0 -13
- package/dist/es/browser/test-helpers/test-rpc/index.d.ts +0 -3
- package/dist/es/browser/test-helpers/test-rpc/test-rpc.d.ts +0 -249
- package/dist/es/browser/utils/address.d.ts +0 -63
- package/dist/es/browser/utils/airdrop.d.ts +0 -7
- package/dist/es/browser/utils/calculate-compute-unit-price.d.ts +0 -7
- package/dist/es/browser/utils/conversion.d.ts +0 -31
- package/dist/es/browser/utils/index.d.ts +0 -10
- package/dist/es/browser/utils/parse-validity-proof.d.ts +0 -20
- package/dist/es/browser/utils/pipe.d.ts +0 -2
- package/dist/es/browser/utils/send-and-confirm.d.ts +0 -52
- package/dist/es/browser/utils/sleep.d.ts +0 -1
- package/dist/es/browser/utils/test-utils.d.ts +0 -23
- package/dist/es/browser/utils/validation.d.ts +0 -4
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import { Connection, ConnectionConfig, PublicKey } from '@solana/web3.js';
|
|
2
|
-
import BN from 'bn.js';
|
|
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';
|
|
6
|
-
import { MerkleContextWithNewAddressProof } from '../../rpc';
|
|
7
|
-
export interface TestRpcConfig {
|
|
8
|
-
/**
|
|
9
|
-
* Address of the state tree to index. Default: public default test state
|
|
10
|
-
* tree.
|
|
11
|
-
*/
|
|
12
|
-
merkleTreeAddress?: PublicKey;
|
|
13
|
-
/**
|
|
14
|
-
* Nullifier queue associated with merkleTreeAddress
|
|
15
|
-
*/
|
|
16
|
-
nullifierQueueAddress?: PublicKey;
|
|
17
|
-
/**
|
|
18
|
-
* Depth of state tree. Defaults to the public default test state tree depth
|
|
19
|
-
*/
|
|
20
|
-
depth?: number;
|
|
21
|
-
/**
|
|
22
|
-
* Log proof generation time
|
|
23
|
-
*/
|
|
24
|
-
log?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Address of the address tree to index. Default: public default test
|
|
27
|
-
* address tree.
|
|
28
|
-
*/
|
|
29
|
-
addressTreeAddress?: PublicKey;
|
|
30
|
-
/**
|
|
31
|
-
* Address queue associated with addressTreeAddress
|
|
32
|
-
*/
|
|
33
|
-
addressQueueAddress?: PublicKey;
|
|
34
|
-
}
|
|
35
|
-
export type ClientSubscriptionId = number;
|
|
36
|
-
export interface LightWasm {
|
|
37
|
-
blakeHash(input: string | Uint8Array, hashLength: number): Uint8Array;
|
|
38
|
-
poseidonHash(input: string[] | BN[]): Uint8Array;
|
|
39
|
-
poseidonHashString(input: string[] | BN[]): string;
|
|
40
|
-
poseidonHashBN(input: string[] | BN[]): BN;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Returns a mock RPC instance for use in unit tests.
|
|
44
|
-
*
|
|
45
|
-
* @param lightWasm Wasm hasher instance.
|
|
46
|
-
* @param endpoint RPC endpoint URL. Defaults to
|
|
47
|
-
* 'http://127.0.0.1:8899'.
|
|
48
|
-
* @param proverEndpoint Prover server endpoint URL. Defaults to
|
|
49
|
-
* 'http://localhost:3001'.
|
|
50
|
-
* @param merkleTreeAddress Address of the merkle tree to index. Defaults
|
|
51
|
-
* to the public default test state tree.
|
|
52
|
-
* @param nullifierQueueAddress Optional address of the associated nullifier
|
|
53
|
-
* queue.
|
|
54
|
-
* @param depth Depth of the merkle tree.
|
|
55
|
-
* @param log Log proof generation time.
|
|
56
|
-
*/
|
|
57
|
-
export declare function getTestRpc(lightWasm: LightWasm, endpoint?: string, compressionApiEndpoint?: string, proverEndpoint?: string, merkleTreeAddress?: PublicKey, nullifierQueueAddress?: PublicKey, depth?: number, log?: boolean): Promise<TestRpc>;
|
|
58
|
-
/**
|
|
59
|
-
* Simple mock rpc for unit tests that simulates the compression rpc interface.
|
|
60
|
-
* Fetches, parses events and builds merkletree on-demand, i.e. it does not persist state.
|
|
61
|
-
* Constraints:
|
|
62
|
-
* - Can only index 1 merkletree
|
|
63
|
-
* - Can only index up to 1000 transactions
|
|
64
|
-
*
|
|
65
|
-
* For advanced testing use photon: https://github.com/helius-labs/photon
|
|
66
|
-
*/
|
|
67
|
-
export declare class TestRpc extends Connection implements CompressionApiInterface {
|
|
68
|
-
compressionApiEndpoint: string;
|
|
69
|
-
proverEndpoint: string;
|
|
70
|
-
merkleTreeAddress: PublicKey;
|
|
71
|
-
nullifierQueueAddress: PublicKey;
|
|
72
|
-
addressTreeAddress: PublicKey;
|
|
73
|
-
addressQueueAddress: PublicKey;
|
|
74
|
-
lightWasm: LightWasm;
|
|
75
|
-
depth: number;
|
|
76
|
-
log: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Establish a Compression-compatible JSON RPC mock-connection
|
|
79
|
-
*
|
|
80
|
-
* @param endpoint endpoint to the solana cluster (use for
|
|
81
|
-
* localnet only)
|
|
82
|
-
* @param hasher light wasm hasher instance
|
|
83
|
-
* @param compressionApiEndpoint Endpoint to the compression server.
|
|
84
|
-
* @param proverEndpoint Endpoint to the prover server. defaults
|
|
85
|
-
* to endpoint
|
|
86
|
-
* @param connectionConfig Optional connection config
|
|
87
|
-
* @param testRpcConfig Config for the mock rpc
|
|
88
|
-
*/
|
|
89
|
-
constructor(endpoint: string, hasher: LightWasm, compressionApiEndpoint: string, proverEndpoint: string, connectionConfig?: ConnectionConfig, testRpcConfig?: TestRpcConfig);
|
|
90
|
-
/**
|
|
91
|
-
* Fetch the compressed account for the specified account hash
|
|
92
|
-
*/
|
|
93
|
-
getCompressedAccount(address?: BN254, hash?: BN254): Promise<CompressedAccountWithMerkleContext | null>;
|
|
94
|
-
/**
|
|
95
|
-
* Fetch the compressed balance for the specified account hash
|
|
96
|
-
*/
|
|
97
|
-
getCompressedBalance(address?: BN254, hash?: BN254): Promise<BN>;
|
|
98
|
-
/**
|
|
99
|
-
* Fetch the total compressed balance for the specified owner public key
|
|
100
|
-
*/
|
|
101
|
-
getCompressedBalanceByOwner(owner: PublicKey): Promise<BN>;
|
|
102
|
-
/**
|
|
103
|
-
* Fetch the latest merkle proof for the specified account hash from the
|
|
104
|
-
* cluster
|
|
105
|
-
*/
|
|
106
|
-
getCompressedAccountProof(hash: BN254): Promise<MerkleContextWithMerkleProof>;
|
|
107
|
-
/**
|
|
108
|
-
* Fetch all the account info for multiple compressed accounts specified by
|
|
109
|
-
* an array of account hashes
|
|
110
|
-
*/
|
|
111
|
-
getMultipleCompressedAccounts(hashes: BN254[]): Promise<CompressedAccountWithMerkleContext[]>;
|
|
112
|
-
/**
|
|
113
|
-
* Ensure that the Compression Indexer has already indexed the transaction
|
|
114
|
-
*/
|
|
115
|
-
confirmTransactionIndexed(_slot: number): Promise<boolean>;
|
|
116
|
-
/**
|
|
117
|
-
* Fetch the latest merkle proofs for multiple compressed accounts specified
|
|
118
|
-
* by an array account hashes
|
|
119
|
-
*/
|
|
120
|
-
getMultipleCompressedAccountProofs(hashes: BN254[]): Promise<MerkleContextWithMerkleProof[]>;
|
|
121
|
-
/**
|
|
122
|
-
* Fetch all the compressed accounts owned by the specified public key.
|
|
123
|
-
* Owner can be a program or user account
|
|
124
|
-
*/
|
|
125
|
-
getCompressedAccountsByOwner(owner: PublicKey, _config?: GetCompressedAccountsByOwnerConfig): Promise<WithCursor<CompressedAccountWithMerkleContext[]>>;
|
|
126
|
-
/**
|
|
127
|
-
* Fetch the latest compression signatures on the cluster. Results are
|
|
128
|
-
* paginated.
|
|
129
|
-
*/
|
|
130
|
-
getLatestCompressionSignatures(_cursor?: string, _limit?: number): Promise<LatestNonVotingSignaturesPaginated>;
|
|
131
|
-
/**
|
|
132
|
-
* Fetch the latest non-voting signatures on the cluster. Results are
|
|
133
|
-
* not paginated.
|
|
134
|
-
*/
|
|
135
|
-
getLatestNonVotingSignatures(_limit?: number): Promise<LatestNonVotingSignatures>;
|
|
136
|
-
/**
|
|
137
|
-
* Fetch all the compressed token accounts owned by the specified public
|
|
138
|
-
* key. Owner can be a program or user account
|
|
139
|
-
*/
|
|
140
|
-
getCompressedTokenAccountsByOwner(owner: PublicKey, options: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
141
|
-
/**
|
|
142
|
-
* Fetch all the compressed accounts delegated to the specified public key.
|
|
143
|
-
*/
|
|
144
|
-
getCompressedTokenAccountsByDelegate(delegate: PublicKey, options: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
145
|
-
/**
|
|
146
|
-
* Fetch the compressed token balance for the specified account hash
|
|
147
|
-
*/
|
|
148
|
-
getCompressedTokenAccountBalance(hash: BN254): Promise<{
|
|
149
|
-
amount: BN;
|
|
150
|
-
}>;
|
|
151
|
-
/**
|
|
152
|
-
* @deprecated use {@link getCompressedTokenBalancesByOwnerV2}.
|
|
153
|
-
* Fetch all the compressed token balances owned by the specified public
|
|
154
|
-
* key. Can filter by mint.
|
|
155
|
-
*/
|
|
156
|
-
getCompressedTokenBalancesByOwner(publicKey: PublicKey, options: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<{
|
|
157
|
-
balance: BN;
|
|
158
|
-
mint: PublicKey;
|
|
159
|
-
}[]>>;
|
|
160
|
-
/**
|
|
161
|
-
* Fetch all the compressed token balances owned by the specified public
|
|
162
|
-
* key. Can filter by mint. Uses context.
|
|
163
|
-
*/
|
|
164
|
-
getCompressedTokenBalancesByOwnerV2(publicKey: PublicKey, options: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithContext<WithCursor<TokenBalance[]>>>;
|
|
165
|
-
/**
|
|
166
|
-
* Returns confirmed signatures for transactions involving the specified
|
|
167
|
-
* account hash forward in time from genesis to the most recent confirmed
|
|
168
|
-
* block
|
|
169
|
-
*
|
|
170
|
-
* @param hash queried account hash
|
|
171
|
-
*/
|
|
172
|
-
getCompressionSignaturesForAccount(_hash: BN254): Promise<SignatureWithMetadata[]>;
|
|
173
|
-
/**
|
|
174
|
-
* Fetch a confirmed or finalized transaction from the cluster. Return with
|
|
175
|
-
* CompressionInfo
|
|
176
|
-
*/
|
|
177
|
-
getTransactionWithCompressionInfo(_signature: string): Promise<CompressedTransaction | null>;
|
|
178
|
-
/**
|
|
179
|
-
* Returns confirmed signatures for transactions involving the specified
|
|
180
|
-
* address forward in time from genesis to the most recent confirmed
|
|
181
|
-
* block
|
|
182
|
-
*
|
|
183
|
-
* @param address queried compressed account address
|
|
184
|
-
*/
|
|
185
|
-
getCompressionSignaturesForAddress(_address: PublicKey, _options?: PaginatedOptions): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
186
|
-
/**
|
|
187
|
-
* Returns confirmed signatures for compression transactions involving the
|
|
188
|
-
* specified account owner forward in time from genesis to the
|
|
189
|
-
* most recent confirmed block
|
|
190
|
-
*
|
|
191
|
-
* @param owner queried owner public key
|
|
192
|
-
*/
|
|
193
|
-
getCompressionSignaturesForOwner(_owner: PublicKey, _options?: PaginatedOptions): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
194
|
-
/**
|
|
195
|
-
* Returns confirmed signatures for compression transactions involving the
|
|
196
|
-
* specified token account owner forward in time from genesis to the most
|
|
197
|
-
* recent confirmed block
|
|
198
|
-
*/
|
|
199
|
-
getCompressionSignaturesForTokenOwner(_owner: PublicKey, _options?: PaginatedOptions): Promise<WithCursor<SignatureWithMetadata[]>>;
|
|
200
|
-
/**
|
|
201
|
-
* Fetch the current indexer health status
|
|
202
|
-
*/
|
|
203
|
-
getIndexerHealth(): Promise<string>;
|
|
204
|
-
/**
|
|
205
|
-
* Fetch the current slot that the node is processing
|
|
206
|
-
*/
|
|
207
|
-
getIndexerSlot(): Promise<number>;
|
|
208
|
-
/**
|
|
209
|
-
* Fetch the latest address proofs for new unique addresses specified by an
|
|
210
|
-
* array of addresses.
|
|
211
|
-
*
|
|
212
|
-
* the proof states that said address have not yet been created in respective address tree.
|
|
213
|
-
* @param addresses Array of BN254 new addresses
|
|
214
|
-
* @returns Array of validity proofs for new addresses
|
|
215
|
-
*/
|
|
216
|
-
getMultipleNewAddressProofs(addresses: BN254[]): Promise<MerkleContextWithNewAddressProof[]>;
|
|
217
|
-
getCompressedMintTokenHolders(_mint: PublicKey, _options?: PaginatedOptions): Promise<WithContext<WithCursor<CompressedMintTokenHolders[]>>>;
|
|
218
|
-
/**
|
|
219
|
-
* Advanced usage of getValidityProof: fetches ZKP directly from a custom
|
|
220
|
-
* non-rpcprover. Note: This uses the proverEndpoint specified in the
|
|
221
|
-
* constructor. For normal usage, please use {@link getValidityProof}
|
|
222
|
-
* instead.
|
|
223
|
-
*
|
|
224
|
-
* Note: Use RPC class for forested trees. TestRpc is only for custom
|
|
225
|
-
* testing purposes.
|
|
226
|
-
*/
|
|
227
|
-
getValidityProofDirect(hashes?: BN254[], newAddresses?: BN254[]): Promise<CompressedProofWithContext>;
|
|
228
|
-
/**
|
|
229
|
-
* @deprecated This method is not available for TestRpc. Please use
|
|
230
|
-
* {@link getValidityProof} instead.
|
|
231
|
-
*/
|
|
232
|
-
getValidityProofAndRpcContext(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<WithContext<CompressedProofWithContext>>;
|
|
233
|
-
/**
|
|
234
|
-
* Fetch the latest validity proof for (1) compressed accounts specified by
|
|
235
|
-
* an array of account hashes. (2) new unique addresses specified by an
|
|
236
|
-
* array of addresses.
|
|
237
|
-
*
|
|
238
|
-
* Validity proofs prove the presence of compressed accounts in state trees
|
|
239
|
-
* and the non-existence of addresses in address trees, respectively. They
|
|
240
|
-
* enable verification without recomputing the merkle proof path, thus
|
|
241
|
-
* lowering verification and data costs.
|
|
242
|
-
*
|
|
243
|
-
* @param hashes Array of BN254 hashes.
|
|
244
|
-
* @param newAddresses Array of BN254 new addresses.
|
|
245
|
-
* @returns validity proof with context
|
|
246
|
-
*/
|
|
247
|
-
getValidityProof(hashes?: BN254[], newAddresses?: BN254[]): Promise<CompressedProofWithContext>;
|
|
248
|
-
getValidityProofV0(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<CompressedProofWithContext>;
|
|
249
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { PublicKey } from '@solana/web3.js';
|
|
2
|
-
export declare function deriveAddressSeed(seeds: Uint8Array[], programId: PublicKey): Uint8Array;
|
|
3
|
-
/**
|
|
4
|
-
* Derive an address for a compressed account from a seed and an address Merkle
|
|
5
|
-
* tree public key.
|
|
6
|
-
*
|
|
7
|
-
* @param seed Seed to derive the address from
|
|
8
|
-
* @param addressMerkleTreePubkey Merkle tree public key. Defaults to
|
|
9
|
-
* defaultTestStateTreeAccounts().addressTree
|
|
10
|
-
* @returns Derived address
|
|
11
|
-
*/
|
|
12
|
-
export declare function deriveAddress(seed: Uint8Array, addressMerkleTreePubkey?: PublicKey): PublicKey;
|
|
13
|
-
export interface NewAddressParams {
|
|
14
|
-
/**
|
|
15
|
-
* Seed for the compressed account. Must be seed used to derive
|
|
16
|
-
* newAccountAddress
|
|
17
|
-
*/
|
|
18
|
-
seed: Uint8Array;
|
|
19
|
-
/**
|
|
20
|
-
* Recent state root index of the address tree. The expiry is tied to the
|
|
21
|
-
* validity proof.
|
|
22
|
-
*/
|
|
23
|
-
addressMerkleTreeRootIndex: number;
|
|
24
|
-
/**
|
|
25
|
-
* Address tree pubkey. Must be base pubkey used to derive new address
|
|
26
|
-
*/
|
|
27
|
-
addressMerkleTreePubkey: PublicKey;
|
|
28
|
-
/**
|
|
29
|
-
* Address space queue pubkey. Associated with the state tree.
|
|
30
|
-
*/
|
|
31
|
-
addressQueuePubkey: PublicKey;
|
|
32
|
-
}
|
|
33
|
-
export interface NewAddressParamsPacked {
|
|
34
|
-
/**
|
|
35
|
-
* Seed for the compressed account. Must be seed used to derive
|
|
36
|
-
* newAccountAddress
|
|
37
|
-
*/
|
|
38
|
-
seed: number[];
|
|
39
|
-
/**
|
|
40
|
-
* Recent state root index of the address tree. The expiry is tied to the
|
|
41
|
-
* validity proof.
|
|
42
|
-
*/
|
|
43
|
-
addressMerkleTreeRootIndex: number;
|
|
44
|
-
/**
|
|
45
|
-
* Index of the address merkle tree account in the remaining accounts array
|
|
46
|
-
*/
|
|
47
|
-
addressMerkleTreeAccountIndex: number;
|
|
48
|
-
/**
|
|
49
|
-
* Index of the address queue account in the remaining accounts array
|
|
50
|
-
*/
|
|
51
|
-
addressQueueAccountIndex: number;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Packs new address params for instruction data in TypeScript clients
|
|
55
|
-
*
|
|
56
|
-
* @param newAddressParams New address params
|
|
57
|
-
* @param remainingAccounts Remaining accounts
|
|
58
|
-
* @returns Packed new address params
|
|
59
|
-
*/
|
|
60
|
-
export declare function packNewAddressParams(newAddressParams: NewAddressParams[], remainingAccounts: PublicKey[]): {
|
|
61
|
-
newAddressParamsPacked: NewAddressParamsPacked[];
|
|
62
|
-
remainingAccounts: PublicKey[];
|
|
63
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Commitment, Connection, PublicKey } from '@solana/web3.js';
|
|
2
|
-
export declare function airdropSol({ connection, lamports, recipientPublicKey, }: {
|
|
3
|
-
connection: Connection;
|
|
4
|
-
lamports: number;
|
|
5
|
-
recipientPublicKey: PublicKey;
|
|
6
|
-
}): Promise<string>;
|
|
7
|
-
export declare function confirmTransaction(connection: Connection, signature: string, confirmation?: Commitment): Promise<import("@solana/web3.js").RpcResponseAndContext<import("@solana/web3.js").SignatureResult>>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param targetLamports - Target priority fee in lamports
|
|
3
|
-
* @param computeUnits - Expected compute units used by the transaction
|
|
4
|
-
* @returns microLamports per compute unit (use in
|
|
5
|
-
* `ComputeBudgetProgram.setComputeUnitPrice`)
|
|
6
|
-
*/
|
|
7
|
-
export declare function calculateComputeUnitPrice(targetLamports: number, computeUnits: number): number;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Buffer } from 'buffer';
|
|
2
|
-
import { Keypair } from '@solana/web3.js';
|
|
3
|
-
import BN from 'bn.js';
|
|
4
|
-
export declare function byteArrayToKeypair(byteArray: number[]): Keypair;
|
|
5
|
-
/**
|
|
6
|
-
* @internal
|
|
7
|
-
* convert BN to hex with '0x' prefix
|
|
8
|
-
*/
|
|
9
|
-
export declare function toHex(bn: BN): string;
|
|
10
|
-
export declare const toArray: <T>(value: T | T[]) => T[];
|
|
11
|
-
export declare const bufToDecStr: (buf: Buffer) => string;
|
|
12
|
-
/**
|
|
13
|
-
* Hash the provided `bytes` with Keccak256 and ensure the result fits in the
|
|
14
|
-
* BN254 prime field by repeatedly hashing the inputs with various "bump seeds"
|
|
15
|
-
* and truncating the resulting hash to 31 bytes.
|
|
16
|
-
*
|
|
17
|
-
* @deprecated Use `hashvToBn254FieldSizeBe` instead.
|
|
18
|
-
*/
|
|
19
|
-
export declare function hashToBn254FieldSizeBe(bytes: Buffer): [Buffer, number] | null;
|
|
20
|
-
/**
|
|
21
|
-
* Hash the provided `bytes` with Keccak256 and ensure that the result fits in
|
|
22
|
-
* the BN254 prime field by truncating the resulting hash to 31 bytes.
|
|
23
|
-
*
|
|
24
|
-
* @param bytes Input bytes
|
|
25
|
-
*
|
|
26
|
-
* @returns Hash digest
|
|
27
|
-
*/
|
|
28
|
-
export declare function hashvToBn254FieldSizeBe(bytes: Uint8Array[]): Uint8Array;
|
|
29
|
-
/** Mutates array in place */
|
|
30
|
-
export declare function pushUniqueItems<T>(items: T[], map: T[]): void;
|
|
31
|
-
export declare function toCamelCase(obj: Array<any> | unknown | any): Array<any> | unknown | any;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './address';
|
|
2
|
-
export * from './airdrop';
|
|
3
|
-
export * from './conversion';
|
|
4
|
-
export * from './parse-validity-proof';
|
|
5
|
-
export * from './pipe';
|
|
6
|
-
export * from './send-and-confirm';
|
|
7
|
-
export * from './sleep';
|
|
8
|
-
export * from './test-utils';
|
|
9
|
-
export * from './validation';
|
|
10
|
-
export * from './calculate-compute-unit-price';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { CompressedProof } from '../state';
|
|
2
|
-
interface GnarkProofJson {
|
|
3
|
-
ar: string[];
|
|
4
|
-
bs: string[][];
|
|
5
|
-
krs: string[];
|
|
6
|
-
}
|
|
7
|
-
type ProofABC = {
|
|
8
|
-
a: Uint8Array;
|
|
9
|
-
b: Uint8Array;
|
|
10
|
-
c: Uint8Array;
|
|
11
|
-
};
|
|
12
|
-
export declare const placeholderValidityProof: () => {
|
|
13
|
-
a: number[];
|
|
14
|
-
b: number[];
|
|
15
|
-
c: number[];
|
|
16
|
-
};
|
|
17
|
-
export declare const checkValidityProofShape: (proof: CompressedProof) => void;
|
|
18
|
-
export declare function proofFromJsonStruct(json: GnarkProofJson): ProofABC;
|
|
19
|
-
export declare function negateAndCompressProof(proof: ProofABC): CompressedProof;
|
|
20
|
-
export {};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { VersionedTransaction, SignatureResult, RpcResponseAndContext, Signer, TransactionInstruction, ConfirmOptions, TransactionSignature, PublicKey, AddressLookupTableAccount } from '@solana/web3.js';
|
|
2
|
-
import { Rpc } from '../rpc';
|
|
3
|
-
/**
|
|
4
|
-
* Builds a versioned Transaction from instructions.
|
|
5
|
-
*
|
|
6
|
-
* @param instructions instructions to include
|
|
7
|
-
* @param payerPublicKey fee payer public key
|
|
8
|
-
* @param blockhash blockhash to use
|
|
9
|
-
* @param lookupTableAccounts lookup table accounts to include
|
|
10
|
-
*
|
|
11
|
-
* @return VersionedTransaction
|
|
12
|
-
*/
|
|
13
|
-
export declare function buildTx(instructions: TransactionInstruction[], payerPublicKey: PublicKey, blockhash: string, lookupTableAccounts?: AddressLookupTableAccount[]): VersionedTransaction;
|
|
14
|
-
/**
|
|
15
|
-
* Sends a versioned transaction and confirms it.
|
|
16
|
-
*
|
|
17
|
-
* @param rpc connection to use
|
|
18
|
-
* @param tx versioned transaction to send
|
|
19
|
-
* @param confirmOptions confirmation options
|
|
20
|
-
* @param blockHashCtx blockhash context for confirmation
|
|
21
|
-
*
|
|
22
|
-
* @return TransactionSignature
|
|
23
|
-
*/
|
|
24
|
-
export declare function sendAndConfirmTx(rpc: Rpc, tx: VersionedTransaction, confirmOptions?: ConfirmOptions, blockHashCtx?: {
|
|
25
|
-
blockhash: string;
|
|
26
|
-
lastValidBlockHeight: number;
|
|
27
|
-
}): Promise<TransactionSignature>;
|
|
28
|
-
/**
|
|
29
|
-
* Confirms a transaction with a given txId.
|
|
30
|
-
*
|
|
31
|
-
* @param rpc connection to use
|
|
32
|
-
* @param txId transaction signature to confirm
|
|
33
|
-
* @param confirmOptions confirmation options
|
|
34
|
-
* @param blockHashCtx blockhash context for confirmation
|
|
35
|
-
* @return SignatureResult
|
|
36
|
-
*/
|
|
37
|
-
export declare function confirmTx(rpc: Rpc, txId: string, confirmOptions?: ConfirmOptions, blockHashCtx?: {
|
|
38
|
-
blockhash: string;
|
|
39
|
-
lastValidBlockHeight: number;
|
|
40
|
-
}): Promise<RpcResponseAndContext<SignatureResult>>;
|
|
41
|
-
/**
|
|
42
|
-
* Builds a versioned Transaction from instructions and signs it.
|
|
43
|
-
*
|
|
44
|
-
* @param instructions instructions to include in the transaction
|
|
45
|
-
* @param payer payer of the transaction
|
|
46
|
-
* @param blockhash recent blockhash to use in the transaction
|
|
47
|
-
* @param additionalSigners non-feepayer signers to include in the
|
|
48
|
-
* transaction
|
|
49
|
-
* @param lookupTableAccounts lookup table accounts to include in the
|
|
50
|
-
* transaction
|
|
51
|
-
*/
|
|
52
|
-
export declare function buildAndSignTx(instructions: TransactionInstruction[], payer: Signer, blockhash: string, additionalSigners?: Signer[], lookupTableAccounts?: AddressLookupTableAccount[]): VersionedTransaction;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function sleep(ms: number): Promise<void>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Connection, Keypair, Signer } from '@solana/web3.js';
|
|
2
|
-
import { Rpc } from '../rpc';
|
|
3
|
-
export declare const ALICE: Keypair;
|
|
4
|
-
export declare const BOB: Keypair;
|
|
5
|
-
export declare const CHARLIE: Keypair;
|
|
6
|
-
export declare const DAVE: Keypair;
|
|
7
|
-
/**
|
|
8
|
-
* Create a new account and airdrop lamports to it
|
|
9
|
-
*
|
|
10
|
-
* @param rpc connection to use
|
|
11
|
-
* @param lamports amount of lamports to airdrop
|
|
12
|
-
* @param counter counter to use for generating the keypair.
|
|
13
|
-
* If undefined or >255, generates random keypair.
|
|
14
|
-
*/
|
|
15
|
-
export declare function newAccountWithLamports(rpc: Rpc, lamports?: number, counter?: number | undefined): Promise<Signer>;
|
|
16
|
-
export declare function getConnection(): Connection;
|
|
17
|
-
/**
|
|
18
|
-
* For use in tests.
|
|
19
|
-
* Generate a unique keypair by passing in a counter <255. If no counter
|
|
20
|
-
* is supplied, it uses and increments a global counter.
|
|
21
|
-
* if counter > 255, generates random keypair
|
|
22
|
-
*/
|
|
23
|
-
export declare function getTestKeypair(counter?: number | undefined): Keypair;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import BN from 'bn.js';
|
|
2
|
-
import { CompressedAccount, CompressedAccountWithMerkleContext } from '../state';
|
|
3
|
-
export declare const validateSufficientBalance: (balance: BN) => void;
|
|
4
|
-
export declare const validateSameOwner: (compressedAccounts: CompressedAccount[] | CompressedAccountWithMerkleContext[]) => void;
|