@lightprotocol/stateless.js 0.20.3 → 0.20.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/cjs/browser/actions/common.d.ts +1 -4
  2. package/dist/cjs/browser/actions/compress.d.ts +2 -14
  3. package/dist/cjs/browser/actions/create-account.d.ts +3 -27
  4. package/dist/cjs/browser/actions/decompress.d.ts +2 -14
  5. package/dist/cjs/browser/actions/transfer.d.ts +2 -15
  6. package/dist/cjs/browser/constants.d.ts +15 -30
  7. package/dist/cjs/browser/errors.d.ts +49 -40
  8. package/dist/cjs/browser/idl.d.ts +45 -45
  9. package/dist/cjs/browser/index.cjs +1 -9611
  10. package/dist/cjs/browser/index.cjs.map +1 -1
  11. package/dist/cjs/browser/instruction/pack-compressed-accounts.d.ts +5 -24
  12. package/dist/cjs/browser/programs/layout.d.ts +17 -39
  13. package/dist/cjs/browser/programs/system.d.ts +10 -61
  14. package/dist/cjs/browser/rpc-interface.d.ts +871 -1127
  15. package/dist/cjs/browser/rpc.d.ts +34 -158
  16. package/dist/cjs/browser/state/BN254.d.ts +2 -9
  17. package/dist/cjs/browser/state/compressed-account.d.ts +6 -23
  18. package/dist/cjs/browser/state/types.d.ts +1 -1
  19. package/dist/cjs/browser/test-helpers/merkle-tree/indexed-array.d.ts +4 -18
  20. package/dist/cjs/browser/test-helpers/merkle-tree/merkle-tree.d.ts +6 -19
  21. package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +3 -12
  22. package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +5 -21
  23. package/dist/cjs/browser/test-helpers/test-rpc/get-parsed-events.d.ts +4 -14
  24. package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +31 -135
  25. package/dist/cjs/browser/test-helpers/test-utils.d.ts +1 -5
  26. package/dist/cjs/browser/utils/address.d.ts +3 -12
  27. package/dist/cjs/browser/utils/airdrop.d.ts +2 -14
  28. package/dist/cjs/browser/utils/calculate-compute-unit-price.d.ts +1 -4
  29. package/dist/cjs/browser/utils/conversion.d.ts +5 -9
  30. package/dist/cjs/browser/utils/get-light-state-tree-info.d.ts +4 -28
  31. package/dist/cjs/browser/utils/parse-validity-proof.d.ts +1 -3
  32. package/dist/cjs/browser/utils/pipe.d.ts +1 -4
  33. package/dist/cjs/browser/utils/send-and-confirm.d.ts +11 -42
  34. package/dist/cjs/browser/utils/validation.d.ts +6 -9
  35. package/dist/cjs/node/actions/common.d.ts +1 -4
  36. package/dist/cjs/node/actions/compress.d.ts +2 -14
  37. package/dist/cjs/node/actions/create-account.d.ts +3 -27
  38. package/dist/cjs/node/actions/decompress.d.ts +2 -14
  39. package/dist/cjs/node/actions/transfer.d.ts +2 -15
  40. package/dist/cjs/node/constants.d.ts +15 -30
  41. package/dist/cjs/node/errors.d.ts +49 -40
  42. package/dist/cjs/node/idl.d.ts +45 -45
  43. package/dist/cjs/node/index.cjs +1 -8310
  44. package/dist/cjs/node/index.cjs.map +1 -1
  45. package/dist/cjs/node/instruction/pack-compressed-accounts.d.ts +5 -24
  46. package/dist/cjs/node/programs/layout.d.ts +17 -39
  47. package/dist/cjs/node/programs/system.d.ts +10 -61
  48. package/dist/cjs/node/rpc-interface.d.ts +871 -1127
  49. package/dist/cjs/node/rpc.d.ts +34 -158
  50. package/dist/cjs/node/state/BN254.d.ts +2 -9
  51. package/dist/cjs/node/state/compressed-account.d.ts +6 -23
  52. package/dist/cjs/node/state/types.d.ts +1 -1
  53. package/dist/cjs/node/test-helpers/merkle-tree/indexed-array.d.ts +4 -18
  54. package/dist/cjs/node/test-helpers/merkle-tree/merkle-tree.d.ts +6 -19
  55. package/dist/cjs/node/test-helpers/test-rpc/get-compressed-accounts.d.ts +3 -12
  56. package/dist/cjs/node/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +5 -21
  57. package/dist/cjs/node/test-helpers/test-rpc/get-parsed-events.d.ts +4 -14
  58. package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +31 -135
  59. package/dist/cjs/node/test-helpers/test-utils.d.ts +1 -5
  60. package/dist/cjs/node/utils/address.d.ts +3 -12
  61. package/dist/cjs/node/utils/airdrop.d.ts +2 -14
  62. package/dist/cjs/node/utils/calculate-compute-unit-price.d.ts +1 -4
  63. package/dist/cjs/node/utils/conversion.d.ts +5 -9
  64. package/dist/cjs/node/utils/get-light-state-tree-info.d.ts +4 -28
  65. package/dist/cjs/node/utils/parse-validity-proof.d.ts +1 -3
  66. package/dist/cjs/node/utils/pipe.d.ts +1 -4
  67. package/dist/cjs/node/utils/send-and-confirm.d.ts +11 -42
  68. package/dist/cjs/node/utils/validation.d.ts +6 -9
  69. package/dist/types/index.d.ts +1131 -2097
  70. package/package.json +2 -1
@@ -1,18 +1,11 @@
1
1
  import { AccountMeta, PublicKey } from '@solana/web3.js';
2
- import {
3
- CompressedAccount,
4
- OutputCompressedAccountWithPackedContext,
5
- PackedCompressedAccountWithMerkleContext,
6
- } from '../state';
2
+ import { CompressedAccount, OutputCompressedAccountWithPackedContext, PackedCompressedAccountWithMerkleContext } from '../state';
7
3
  import { CompressedAccountWithMerkleContext } from '../state/compressed-account';
8
4
  /**
9
5
  * @internal Finds the index of a PublicKey in an array, or adds it if not
10
6
  * present
11
7
  * */
12
- export declare function getIndexOrAdd(
13
- accountsArray: PublicKey[],
14
- key: PublicKey,
15
- ): number;
8
+ export declare function getIndexOrAdd(accountsArray: PublicKey[], key: PublicKey): number;
16
9
  /**
17
10
  * @internal
18
11
  * Pads output state trees with the 0th state tree of the input state.
@@ -29,14 +22,8 @@ export declare function getIndexOrAdd(
29
22
  *
30
23
  * @returns Padded output state trees.
31
24
  */
32
- export declare function padOutputStateMerkleTrees(
33
- outputStateMerkleTrees: PublicKey[] | PublicKey | undefined,
34
- numberOfOutputCompressedAccounts: number,
35
- inputCompressedAccountsWithMerkleContext: CompressedAccountWithMerkleContext[],
36
- ): PublicKey[];
37
- export declare function toAccountMetas(
38
- remainingAccounts: PublicKey[],
39
- ): AccountMeta[];
25
+ export declare function padOutputStateMerkleTrees(outputStateMerkleTrees: PublicKey[] | PublicKey | undefined, numberOfOutputCompressedAccounts: number, inputCompressedAccountsWithMerkleContext: CompressedAccountWithMerkleContext[]): PublicKey[];
26
+ export declare function toAccountMetas(remainingAccounts: PublicKey[]): AccountMeta[];
40
27
  /**
41
28
  * Packs Compressed Accounts.
42
29
  *
@@ -57,13 +44,7 @@ export declare function toAccountMetas(
57
44
  * @param remainingAccounts Optional existing array of accounts
58
45
  * to append to.
59
46
  **/
60
- export declare function packCompressedAccounts(
61
- inputCompressedAccounts: CompressedAccountWithMerkleContext[],
62
- inputStateRootIndices: number[],
63
- outputCompressedAccounts: CompressedAccount[],
64
- outputStateMerkleTrees?: PublicKey[] | PublicKey,
65
- remainingAccounts?: PublicKey[],
66
- ): {
47
+ export declare function packCompressedAccounts(inputCompressedAccounts: CompressedAccountWithMerkleContext[], inputStateRootIndices: number[], outputCompressedAccounts: CompressedAccount[], outputStateMerkleTrees?: PublicKey[] | PublicKey, remainingAccounts?: PublicKey[]): {
67
48
  packedInputCompressedAccounts: PackedCompressedAccountWithMerkleContext[];
68
49
  packedOutputCompressedAccounts: OutputCompressedAccountWithPackedContext[];
69
50
  remainingAccounts: PublicKey[];
@@ -1,25 +1,15 @@
1
1
  import { Buffer } from 'buffer';
2
2
  import { PublicKey, AccountMeta } from '@solana/web3.js';
3
3
  import { Layout } from '@coral-xyz/borsh';
4
- import {
5
- InstructionDataInvoke,
6
- InstructionDataInvokeCpi,
7
- PublicTransactionEvent,
8
- } from '../state';
9
- export declare const CompressedAccountLayout: import('buffer-layout').Layout<unknown>;
10
- export declare const MerkleContextLayout: import('buffer-layout').Layout<unknown>;
11
- export declare const NewAddressParamsLayout: import('buffer-layout').Layout<unknown>;
4
+ import { InstructionDataInvoke, InstructionDataInvokeCpi, PublicTransactionEvent } from '../state';
5
+ export declare const CompressedAccountLayout: import("buffer-layout").Layout<unknown>;
6
+ export declare const MerkleContextLayout: import("buffer-layout").Layout<unknown>;
7
+ export declare const NewAddressParamsLayout: import("buffer-layout").Layout<unknown>;
12
8
  export declare const InstructionDataInvokeLayout: Layout<InstructionDataInvoke>;
13
- export declare function encodeInstructionDataInvoke(
14
- data: InstructionDataInvoke,
15
- ): Buffer;
9
+ export declare function encodeInstructionDataInvoke(data: InstructionDataInvoke): Buffer;
16
10
  export declare const InstructionDataInvokeCpiLayout: Layout<InstructionDataInvokeCpi>;
17
- export declare function decodeInstructionDataInvoke(
18
- buffer: Buffer,
19
- ): InstructionDataInvoke;
20
- export declare function decodeInstructionDataInvokeCpi(
21
- buffer: Buffer,
22
- ): InstructionDataInvokeCpi;
11
+ export declare function decodeInstructionDataInvoke(buffer: Buffer): InstructionDataInvoke;
12
+ export declare function decodeInstructionDataInvokeCpi(buffer: Buffer): InstructionDataInvokeCpi;
23
13
  export type invokeAccountsLayoutParams = {
24
14
  feePayer: PublicKey;
25
15
  authority: PublicKey;
@@ -31,24 +21,16 @@ export type invokeAccountsLayoutParams = {
31
21
  decompressionRecipient: PublicKey | null;
32
22
  systemProgram: PublicKey;
33
23
  };
34
- export declare const invokeAccountsLayout: (
35
- accounts: invokeAccountsLayoutParams,
36
- ) => AccountMeta[];
24
+ export declare const invokeAccountsLayout: (accounts: invokeAccountsLayoutParams) => AccountMeta[];
37
25
  export declare const PublicTransactionEventLayout: Layout<PublicTransactionEvent>;
38
- export declare function encodePublicTransactionEvent(
39
- data: PublicTransactionEvent,
40
- ): Buffer;
41
- export declare function decodePublicTransactionEvent(
42
- buffer: Buffer,
43
- ): PublicTransactionEvent;
44
- export declare const AppendNullifyCreateAddressInputsMetaLayout: import('buffer-layout').Layout<unknown>;
45
- export declare const AppendLeavesInputLayout: import('buffer-layout').Layout<unknown>;
46
- export declare const InsertNullifierInputLayout: import('buffer-layout').Layout<unknown>;
47
- export declare const InsertAddressInputLayout: import('buffer-layout').Layout<unknown>;
48
- export declare const MerkleTreeSequenceNumberLayout: import('buffer-layout').Layout<unknown>;
49
- export declare function deserializeAppendNullifyCreateAddressInputsIndexer(
50
- buffer: Buffer,
51
- ): {
26
+ export declare function encodePublicTransactionEvent(data: PublicTransactionEvent): Buffer;
27
+ export declare function decodePublicTransactionEvent(buffer: Buffer): PublicTransactionEvent;
28
+ export declare const AppendNullifyCreateAddressInputsMetaLayout: import("buffer-layout").Layout<unknown>;
29
+ export declare const AppendLeavesInputLayout: import("buffer-layout").Layout<unknown>;
30
+ export declare const InsertNullifierInputLayout: import("buffer-layout").Layout<unknown>;
31
+ export declare const InsertAddressInputLayout: import("buffer-layout").Layout<unknown>;
32
+ export declare const MerkleTreeSequenceNumberLayout: import("buffer-layout").Layout<unknown>;
33
+ export declare function deserializeAppendNullifyCreateAddressInputsIndexer(buffer: Buffer): {
52
34
  meta: unknown;
53
35
  leaves: unknown[];
54
36
  nullifiers: unknown[];
@@ -56,8 +38,4 @@ export declare function deserializeAppendNullifyCreateAddressInputsIndexer(
56
38
  sequence_numbers: unknown[];
57
39
  output_leaf_indices: number[];
58
40
  };
59
- export declare function convertToPublicTransactionEvent(
60
- decoded: any,
61
- remainingAccounts: PublicKey[],
62
- invokeData: InstructionDataInvoke,
63
- ): PublicTransactionEvent;
41
+ export declare function convertToPublicTransactionEvent(decoded: any, remainingAccounts: PublicKey[], invokeData: InstructionDataInvoke): PublicTransactionEvent;
@@ -1,14 +1,8 @@
1
1
  import BN from 'bn.js';
2
2
  import { PublicKey, TransactionInstruction } from '@solana/web3.js';
3
- import {
4
- CompressedAccount,
5
- CompressedAccountWithMerkleContext,
6
- CompressedProof,
7
- } from '../state';
3
+ import { CompressedAccount, CompressedAccountWithMerkleContext, CompressedProof } from '../state';
8
4
  import { NewAddressParams } from '../utils';
9
- export declare const sumUpLamports: (
10
- accounts: CompressedAccountWithMerkleContext[],
11
- ) => BN;
5
+ export declare const sumUpLamports: (accounts: CompressedAccountWithMerkleContext[]) => BN;
12
6
  /**
13
7
  * Create compressed account system transaction params
14
8
  */
@@ -165,76 +159,34 @@ export declare class LightSystemProgram {
165
159
  *
166
160
  */
167
161
  static deriveCompressedSolPda(): PublicKey;
168
- static createTransferOutputState(
169
- inputCompressedAccounts: CompressedAccountWithMerkleContext[],
170
- toAddress: PublicKey,
171
- lamports: number | BN,
172
- ): CompressedAccount[];
173
- static createDecompressOutputState(
174
- inputCompressedAccounts: CompressedAccountWithMerkleContext[],
175
- lamports: number | BN,
176
- ): CompressedAccount[];
162
+ static createTransferOutputState(inputCompressedAccounts: CompressedAccountWithMerkleContext[], toAddress: PublicKey, lamports: number | BN): CompressedAccount[];
163
+ static createDecompressOutputState(inputCompressedAccounts: CompressedAccountWithMerkleContext[], lamports: number | BN): CompressedAccount[];
177
164
  /**
178
165
  * No data by default
179
166
  */
180
- static createNewAddressOutputState(
181
- address: number[],
182
- owner: PublicKey,
183
- lamports?: BN | number,
184
- inputCompressedAccounts?: CompressedAccountWithMerkleContext[],
185
- ): CompressedAccount[];
167
+ static createNewAddressOutputState(address: number[], owner: PublicKey, lamports?: BN | number, inputCompressedAccounts?: CompressedAccountWithMerkleContext[]): CompressedAccount[];
186
168
  /**
187
169
  * Creates instruction to create compressed account with PDA.
188
170
  * Cannot write data.
189
171
  *
190
172
  * TODO: support transfer of lamports to the new account.
191
173
  */
192
- static createAccount({
193
- payer,
194
- newAddressParams,
195
- newAddress,
196
- recentValidityProof,
197
- outputStateTree,
198
- inputCompressedAccounts,
199
- inputStateRootIndices,
200
- lamports,
201
- }: CreateAccountWithSeedParams): Promise<TransactionInstruction>;
174
+ static createAccount({ payer, newAddressParams, newAddress, recentValidityProof, outputStateTree, inputCompressedAccounts, inputStateRootIndices, lamports, }: CreateAccountWithSeedParams): Promise<TransactionInstruction>;
202
175
  /**
203
176
  * Creates a transaction instruction that transfers compressed lamports from
204
177
  * one owner to another.
205
178
  */
206
- static transfer({
207
- payer,
208
- inputCompressedAccounts,
209
- toAddress,
210
- lamports,
211
- recentInputStateRootIndices,
212
- recentValidityProof,
213
- outputStateTrees,
214
- }: TransferParams): Promise<TransactionInstruction>;
179
+ static transfer({ payer, inputCompressedAccounts, toAddress, lamports, recentInputStateRootIndices, recentValidityProof, outputStateTrees, }: TransferParams): Promise<TransactionInstruction>;
215
180
  /**
216
181
  * Creates a transaction instruction that transfers compressed lamports from
217
182
  * one owner to another.
218
183
  */
219
- static compress({
220
- payer,
221
- toAddress,
222
- lamports,
223
- outputStateTree,
224
- }: CompressParams): Promise<TransactionInstruction>;
184
+ static compress({ payer, toAddress, lamports, outputStateTree, }: CompressParams): Promise<TransactionInstruction>;
225
185
  /**
226
186
  * Creates a transaction instruction that transfers compressed lamports from
227
187
  * one owner to another.
228
188
  */
229
- static decompress({
230
- payer,
231
- inputCompressedAccounts,
232
- toAddress,
233
- lamports,
234
- recentInputStateRootIndices,
235
- recentValidityProof,
236
- outputStateTree,
237
- }: DecompressParams): Promise<TransactionInstruction>;
189
+ static decompress({ payer, inputCompressedAccounts, toAddress, lamports, recentInputStateRootIndices, recentValidityProof, outputStateTree, }: DecompressParams): Promise<TransactionInstruction>;
238
190
  }
239
191
  /**
240
192
  * Selects the minimal number of compressed SOL accounts for a transfer.
@@ -243,8 +195,5 @@ export declare class LightSystemProgram {
243
195
  * 2. Accumulates the amount until it is greater than or equal to the transfer
244
196
  * amount
245
197
  */
246
- export declare function selectMinCompressedSolAccountsForTransfer(
247
- accounts: CompressedAccountWithMerkleContext[],
248
- transferLamports: BN | number,
249
- ): [selectedAccounts: CompressedAccountWithMerkleContext[], total: BN];
198
+ export declare function selectMinCompressedSolAccountsForTransfer(accounts: CompressedAccountWithMerkleContext[], transferLamports: BN | number): [selectedAccounts: CompressedAccountWithMerkleContext[], total: BN];
250
199
  export {};