@lightprotocol/stateless.js 0.17.2-alpha.0 → 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.
Files changed (67) hide show
  1. package/dist/cjs/browser/constants.d.ts +2 -0
  2. package/dist/cjs/browser/idl.d.ts +1015 -0
  3. package/dist/cjs/browser/index.cjs +1 -1
  4. package/dist/cjs/browser/index.cjs.map +1 -1
  5. package/dist/cjs/browser/index.d.ts +1 -0
  6. package/dist/cjs/browser/rpc-interface.d.ts +110 -117
  7. package/dist/cjs/browser/rpc.d.ts +2 -57
  8. package/dist/cjs/browser/state/types.d.ts +5 -0
  9. package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +2 -3
  10. package/dist/cjs/browser/utils/test-utils.d.ts +8 -0
  11. package/dist/cjs/node/constants.d.ts +2 -0
  12. package/dist/cjs/node/idl.d.ts +1015 -0
  13. package/dist/cjs/node/index.cjs +1 -1
  14. package/dist/cjs/node/index.cjs.map +1 -1
  15. package/dist/cjs/node/index.d.ts +1 -0
  16. package/dist/cjs/node/rpc-interface.d.ts +110 -117
  17. package/dist/cjs/node/rpc.d.ts +2 -57
  18. package/dist/cjs/node/state/types.d.ts +5 -0
  19. package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +2 -3
  20. package/dist/cjs/node/utils/test-utils.d.ts +8 -0
  21. package/dist/types/index.d.ts +1036 -193
  22. package/package.json +9 -8
  23. package/dist/cjs/browser/connection-interface.d.ts +0 -125
  24. package/dist/cjs/node/connection-interface.d.ts +0 -125
  25. package/dist/es/browser/actions/common.d.ts +0 -3
  26. package/dist/es/browser/actions/compress.d.ts +0 -16
  27. package/dist/es/browser/actions/create-account.d.ts +0 -41
  28. package/dist/es/browser/actions/decompress.d.ts +0 -16
  29. package/dist/es/browser/actions/index.d.ts +0 -5
  30. package/dist/es/browser/actions/transfer.d.ts +0 -20
  31. package/dist/es/browser/connection-interface.d.ts +0 -125
  32. package/dist/es/browser/constants.d.ts +0 -63
  33. package/dist/es/browser/errors.d.ts +0 -74
  34. package/dist/es/browser/index.d.ts +0 -10
  35. package/dist/es/browser/index.js +0 -2
  36. package/dist/es/browser/index.js.map +0 -1
  37. package/dist/es/browser/instruction/index.d.ts +0 -1
  38. package/dist/es/browser/instruction/pack-compressed-accounts.d.ts +0 -35
  39. package/dist/es/browser/programs/index.d.ts +0 -2
  40. package/dist/es/browser/programs/layout.d.ts +0 -25
  41. package/dist/es/browser/programs/system.d.ts +0 -199
  42. package/dist/es/browser/rpc-interface.d.ts +0 -1179
  43. package/dist/es/browser/rpc.d.ts +0 -330
  44. package/dist/es/browser/state/BN254.d.ts +0 -14
  45. package/dist/es/browser/state/compressed-account.d.ts +0 -31
  46. package/dist/es/browser/state/index.d.ts +0 -3
  47. package/dist/es/browser/state/types.d.ts +0 -91
  48. package/dist/es/browser/test-helpers/index.d.ts +0 -2
  49. package/dist/es/browser/test-helpers/merkle-tree/index.d.ts +0 -2
  50. package/dist/es/browser/test-helpers/merkle-tree/indexed-array.d.ts +0 -85
  51. package/dist/es/browser/test-helpers/merkle-tree/merkle-tree.d.ts +0 -92
  52. package/dist/es/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +0 -7
  53. package/dist/es/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +0 -40
  54. package/dist/es/browser/test-helpers/test-rpc/get-parsed-events.d.ts +0 -13
  55. package/dist/es/browser/test-helpers/test-rpc/index.d.ts +0 -3
  56. package/dist/es/browser/test-helpers/test-rpc/test-rpc.d.ts +0 -250
  57. package/dist/es/browser/utils/address.d.ts +0 -63
  58. package/dist/es/browser/utils/airdrop.d.ts +0 -7
  59. package/dist/es/browser/utils/calculate-compute-unit-price.d.ts +0 -7
  60. package/dist/es/browser/utils/conversion.d.ts +0 -31
  61. package/dist/es/browser/utils/index.d.ts +0 -10
  62. package/dist/es/browser/utils/parse-validity-proof.d.ts +0 -20
  63. package/dist/es/browser/utils/pipe.d.ts +0 -2
  64. package/dist/es/browser/utils/send-and-confirm.d.ts +0 -52
  65. package/dist/es/browser/utils/sleep.d.ts +0 -1
  66. package/dist/es/browser/utils/test-utils.d.ts +0 -23
  67. package/dist/es/browser/utils/validation.d.ts +0 -4
@@ -1,40 +0,0 @@
1
- import { PublicKey } from '@solana/web3.js';
2
- import BN from 'bn.js';
3
- import { Rpc } from '../../rpc';
4
- import { ParsedTokenAccount, WithCursor } from '../../rpc-interface';
5
- import { CompressedAccount, PublicTransactionEvent } from '../../state';
6
- import { Layout } from '@coral-xyz/borsh';
7
- type TokenData = {
8
- mint: PublicKey;
9
- owner: PublicKey;
10
- amount: BN;
11
- delegate: PublicKey | null;
12
- state: number;
13
- tlv: Buffer | null;
14
- };
15
- export declare const TokenDataLayout: Layout<TokenData>;
16
- export type EventWithParsedTokenTlvData = {
17
- inputCompressedAccountHashes: number[][];
18
- outputCompressedAccounts: ParsedTokenAccount[];
19
- };
20
- /**
21
- * Manually parse the compressed token layout for a given compressed account.
22
- * @param compressedAccount - The compressed account
23
- * @returns The parsed token data
24
- */
25
- export declare function parseTokenLayoutWithIdl(compressedAccount: CompressedAccount, programId?: PublicKey): TokenData | null;
26
- /**
27
- * Retrieves all compressed token accounts for a given mint and owner.
28
- *
29
- * Note: This function is intended for testing purposes only. For production, use rpc.getCompressedTokenAccounts.
30
- *
31
- * @param events Public transaction events
32
- * @param owner PublicKey of the token owner
33
- * @param mint PublicKey of the token mint
34
- */
35
- export declare function getCompressedTokenAccounts(events: PublicTransactionEvent[]): Promise<ParsedTokenAccount[]>;
36
- /** @internal */
37
- export declare function getCompressedTokenAccountsByOwnerTest(rpc: Rpc, owner: PublicKey, mint: PublicKey): Promise<WithCursor<ParsedTokenAccount[]>>;
38
- export declare function getCompressedTokenAccountsByDelegateTest(rpc: Rpc, delegate: PublicKey, mint: PublicKey): Promise<WithCursor<ParsedTokenAccount[]>>;
39
- export declare function getCompressedTokenAccountByHashTest(rpc: Rpc, hash: BN): Promise<ParsedTokenAccount>;
40
- export {};
@@ -1,13 +0,0 @@
1
- import { ParsedTransactionWithMeta } from '@solana/web3.js';
2
- import { Rpc } from '../../rpc';
3
- import { PublicTransactionEvent } from '../../state';
4
- type Deserializer<T> = (data: Buffer, tx: ParsedTransactionWithMeta) => T;
5
- /**
6
- * @internal
7
- * Returns newest first.
8
- *
9
- * */
10
- export declare function getParsedEvents(rpc: Rpc): Promise<PublicTransactionEvent[]>;
11
- export declare const parseEvents: <T>(indexerEventsTransactions: (ParsedTransactionWithMeta | null)[], deserializeFn: Deserializer<T>) => NonNullable<T>[];
12
- export declare const parsePublicTransactionEventWithIdl: (data: Buffer) => PublicTransactionEvent | null;
13
- export {};
@@ -1,3 +0,0 @@
1
- export * from './test-rpc';
2
- export * from './get-parsed-events';
3
- export * from './get-compressed-token-accounts';
@@ -1,250 +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, Rpc } 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<Rpc>;
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
- connection: Connection;
69
- compressionApiEndpoint: string;
70
- proverEndpoint: string;
71
- merkleTreeAddress: PublicKey;
72
- nullifierQueueAddress: PublicKey;
73
- addressTreeAddress: PublicKey;
74
- addressQueueAddress: PublicKey;
75
- lightWasm: LightWasm;
76
- depth: number;
77
- log: boolean;
78
- /**
79
- * Establish a Compression-compatible JSON RPC mock-connection
80
- *
81
- * @param endpoint endpoint to the solana cluster (use for
82
- * localnet only)
83
- * @param hasher light wasm hasher instance
84
- * @param compressionApiEndpoint Endpoint to the compression server.
85
- * @param proverEndpoint Endpoint to the prover server. defaults
86
- * to endpoint
87
- * @param connectionConfig Optional connection config
88
- * @param testRpcConfig Config for the mock rpc
89
- */
90
- constructor(endpoint: string, hasher: LightWasm, compressionApiEndpoint: string, proverEndpoint: string, connectionConfig?: ConnectionConfig, testRpcConfig?: TestRpcConfig);
91
- /**
92
- * Fetch the compressed account for the specified account hash
93
- */
94
- getCompressedAccount(address?: BN254, hash?: BN254): Promise<CompressedAccountWithMerkleContext | null>;
95
- /**
96
- * Fetch the compressed balance for the specified account hash
97
- */
98
- getCompressedBalance(address?: BN254, hash?: BN254): Promise<BN>;
99
- /**
100
- * Fetch the total compressed balance for the specified owner public key
101
- */
102
- getCompressedBalanceByOwner(owner: PublicKey): Promise<BN>;
103
- /**
104
- * Fetch the latest merkle proof for the specified account hash from the
105
- * cluster
106
- */
107
- getCompressedAccountProof(hash: BN254): Promise<MerkleContextWithMerkleProof>;
108
- /**
109
- * Fetch all the account info for multiple compressed accounts specified by
110
- * an array of account hashes
111
- */
112
- getMultipleCompressedAccounts(hashes: BN254[]): Promise<CompressedAccountWithMerkleContext[]>;
113
- /**
114
- * Ensure that the Compression Indexer has already indexed the transaction
115
- */
116
- confirmTransactionIndexed(_slot: number): Promise<boolean>;
117
- /**
118
- * Fetch the latest merkle proofs for multiple compressed accounts specified
119
- * by an array account hashes
120
- */
121
- getMultipleCompressedAccountProofs(hashes: BN254[]): Promise<MerkleContextWithMerkleProof[]>;
122
- /**
123
- * Fetch all the compressed accounts owned by the specified public key.
124
- * Owner can be a program or user account
125
- */
126
- getCompressedAccountsByOwner(owner: PublicKey, _config?: GetCompressedAccountsByOwnerConfig): Promise<WithCursor<CompressedAccountWithMerkleContext[]>>;
127
- /**
128
- * Fetch the latest compression signatures on the cluster. Results are
129
- * paginated.
130
- */
131
- getLatestCompressionSignatures(_cursor?: string, _limit?: number): Promise<LatestNonVotingSignaturesPaginated>;
132
- /**
133
- * Fetch the latest non-voting signatures on the cluster. Results are
134
- * not paginated.
135
- */
136
- getLatestNonVotingSignatures(_limit?: number): Promise<LatestNonVotingSignatures>;
137
- /**
138
- * Fetch all the compressed token accounts owned by the specified public
139
- * key. Owner can be a program or user account
140
- */
141
- getCompressedTokenAccountsByOwner(owner: PublicKey, options: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<ParsedTokenAccount[]>>;
142
- /**
143
- * Fetch all the compressed accounts delegated to the specified public key.
144
- */
145
- getCompressedTokenAccountsByDelegate(delegate: PublicKey, options: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<ParsedTokenAccount[]>>;
146
- /**
147
- * Fetch the compressed token balance for the specified account hash
148
- */
149
- getCompressedTokenAccountBalance(hash: BN254): Promise<{
150
- amount: BN;
151
- }>;
152
- /**
153
- * @deprecated use {@link getCompressedTokenBalancesByOwnerV2}.
154
- * Fetch all the compressed token balances owned by the specified public
155
- * key. Can filter by mint.
156
- */
157
- getCompressedTokenBalancesByOwner(publicKey: PublicKey, options: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithCursor<{
158
- balance: BN;
159
- mint: PublicKey;
160
- }[]>>;
161
- /**
162
- * Fetch all the compressed token balances owned by the specified public
163
- * key. Can filter by mint. Uses context.
164
- */
165
- getCompressedTokenBalancesByOwnerV2(publicKey: PublicKey, options: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<WithContext<WithCursor<TokenBalance[]>>>;
166
- /**
167
- * Returns confirmed signatures for transactions involving the specified
168
- * account hash forward in time from genesis to the most recent confirmed
169
- * block
170
- *
171
- * @param hash queried account hash
172
- */
173
- getCompressionSignaturesForAccount(_hash: BN254): Promise<SignatureWithMetadata[]>;
174
- /**
175
- * Fetch a confirmed or finalized transaction from the cluster. Return with
176
- * CompressionInfo
177
- */
178
- getTransactionWithCompressionInfo(_signature: string): Promise<CompressedTransaction | null>;
179
- /**
180
- * Returns confirmed signatures for transactions involving the specified
181
- * address forward in time from genesis to the most recent confirmed
182
- * block
183
- *
184
- * @param address queried compressed account address
185
- */
186
- getCompressionSignaturesForAddress(_address: PublicKey, _options?: PaginatedOptions): Promise<WithCursor<SignatureWithMetadata[]>>;
187
- /**
188
- * Returns confirmed signatures for compression transactions involving the
189
- * specified account owner forward in time from genesis to the
190
- * most recent confirmed block
191
- *
192
- * @param owner queried owner public key
193
- */
194
- getCompressionSignaturesForOwner(_owner: PublicKey, _options?: PaginatedOptions): Promise<WithCursor<SignatureWithMetadata[]>>;
195
- /**
196
- * Returns confirmed signatures for compression transactions involving the
197
- * specified token account owner forward in time from genesis to the most
198
- * recent confirmed block
199
- */
200
- getCompressionSignaturesForTokenOwner(_owner: PublicKey, _options?: PaginatedOptions): Promise<WithCursor<SignatureWithMetadata[]>>;
201
- /**
202
- * Fetch the current indexer health status
203
- */
204
- getIndexerHealth(): Promise<string>;
205
- /**
206
- * Fetch the current slot that the node is processing
207
- */
208
- getIndexerSlot(): Promise<number>;
209
- /**
210
- * Fetch the latest address proofs for new unique addresses specified by an
211
- * array of addresses.
212
- *
213
- * the proof states that said address have not yet been created in respective address tree.
214
- * @param addresses Array of BN254 new addresses
215
- * @returns Array of validity proofs for new addresses
216
- */
217
- getMultipleNewAddressProofs(addresses: BN254[]): Promise<MerkleContextWithNewAddressProof[]>;
218
- getCompressedMintTokenHolders(_mint: PublicKey, _options?: PaginatedOptions): Promise<WithContext<WithCursor<CompressedMintTokenHolders[]>>>;
219
- /**
220
- * Advanced usage of getValidityProof: fetches ZKP directly from a custom
221
- * non-rpcprover. Note: This uses the proverEndpoint specified in the
222
- * constructor. For normal usage, please use {@link getValidityProof}
223
- * instead.
224
- *
225
- * Note: Use RPC class for forested trees. TestRpc is only for custom
226
- * testing purposes.
227
- */
228
- getValidityProofDirect(hashes?: BN254[], newAddresses?: BN254[]): Promise<CompressedProofWithContext>;
229
- /**
230
- * @deprecated This method is not available for TestRpc. Please use
231
- * {@link getValidityProof} instead.
232
- */
233
- getValidityProofAndRpcContext(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<WithContext<CompressedProofWithContext>>;
234
- /**
235
- * Fetch the latest validity proof for (1) compressed accounts specified by
236
- * an array of account hashes. (2) new unique addresses specified by an
237
- * array of addresses.
238
- *
239
- * Validity proofs prove the presence of compressed accounts in state trees
240
- * and the non-existence of addresses in address trees, respectively. They
241
- * enable verification without recomputing the merkle proof path, thus
242
- * lowering verification and data costs.
243
- *
244
- * @param hashes Array of BN254 hashes.
245
- * @param newAddresses Array of BN254 new addresses.
246
- * @returns validity proof with context
247
- */
248
- getValidityProof(hashes?: BN254[], newAddresses?: BN254[]): Promise<CompressedProofWithContext>;
249
- getValidityProofV0(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<CompressedProofWithContext>;
250
- }
@@ -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,2 +0,0 @@
1
- /** pipe function */
2
- export declare function pipe<T, R>(initialFunction: (arg: T) => R, ...functions: ((arg: R) => R)[]): (initialValue: T) => R;
@@ -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;