@lightprotocol/stateless.js 0.20.9 → 0.22.0

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 (76) hide show
  1. package/dist/cjs/browser/actions/compress.d.ts +9 -7
  2. package/dist/cjs/browser/actions/create-account.d.ts +25 -28
  3. package/dist/cjs/browser/actions/decompress.d.ts +6 -7
  4. package/dist/cjs/browser/actions/index.d.ts +1 -1
  5. package/dist/cjs/browser/actions/transfer.d.ts +7 -11
  6. package/dist/cjs/browser/constants.d.ts +40 -7
  7. package/dist/cjs/browser/index.cjs +1 -1
  8. package/dist/cjs/browser/index.cjs.map +1 -1
  9. package/dist/cjs/browser/index.d.ts +1 -3
  10. package/dist/cjs/browser/programs/index.d.ts +0 -1
  11. package/dist/cjs/{node → browser/programs/system}/idl.d.ts +5 -27
  12. package/dist/cjs/browser/programs/system/index.d.ts +5 -0
  13. package/dist/cjs/browser/programs/{layout.d.ts → system/layout.d.ts} +37 -1
  14. package/dist/cjs/browser/programs/system/pack.d.ts +74 -0
  15. package/dist/cjs/browser/programs/{system.d.ts → system/program.d.ts} +25 -49
  16. package/dist/cjs/browser/programs/system/select-compressed-accounts.d.ts +10 -0
  17. package/dist/cjs/browser/rpc-interface.d.ts +1689 -82
  18. package/dist/cjs/browser/rpc.d.ts +27 -67
  19. package/dist/cjs/browser/state/BN254.d.ts +0 -1
  20. package/dist/cjs/browser/state/bn.d.ts +3 -0
  21. package/dist/cjs/browser/state/compressed-account.d.ts +189 -15
  22. package/dist/cjs/browser/state/index.d.ts +1 -0
  23. package/dist/cjs/browser/state/types.d.ts +345 -31
  24. package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +3 -3
  25. package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +21 -49
  26. package/dist/cjs/browser/utils/calculate-compute-unit-price.d.ts +1 -1
  27. package/dist/cjs/browser/utils/conversion.d.ts +2 -0
  28. package/dist/cjs/browser/utils/get-state-tree-infos.d.ts +48 -0
  29. package/dist/cjs/browser/utils/index.d.ts +4 -2
  30. package/dist/cjs/browser/utils/parse-validity-proof.d.ts +3 -3
  31. package/dist/cjs/browser/utils/send-and-confirm.d.ts +1 -1
  32. package/dist/cjs/browser/utils/state-tree-lookup-table.d.ts +68 -0
  33. package/dist/cjs/browser/utils/validation.d.ts +2 -2
  34. package/dist/cjs/node/actions/compress.d.ts +9 -7
  35. package/dist/cjs/node/actions/create-account.d.ts +25 -28
  36. package/dist/cjs/node/actions/decompress.d.ts +6 -7
  37. package/dist/cjs/node/actions/index.d.ts +1 -1
  38. package/dist/cjs/node/actions/transfer.d.ts +7 -11
  39. package/dist/cjs/node/constants.d.ts +40 -7
  40. package/dist/cjs/node/index.cjs +1 -1
  41. package/dist/cjs/node/index.cjs.map +1 -1
  42. package/dist/cjs/node/index.d.ts +1 -3
  43. package/dist/cjs/node/programs/index.d.ts +0 -1
  44. package/dist/cjs/{browser → node/programs/system}/idl.d.ts +5 -27
  45. package/dist/cjs/node/programs/system/index.d.ts +5 -0
  46. package/dist/cjs/node/programs/{layout.d.ts → system/layout.d.ts} +37 -1
  47. package/dist/cjs/node/programs/system/pack.d.ts +74 -0
  48. package/dist/cjs/node/programs/{system.d.ts → system/program.d.ts} +25 -49
  49. package/dist/cjs/node/programs/system/select-compressed-accounts.d.ts +10 -0
  50. package/dist/cjs/node/rpc-interface.d.ts +1689 -82
  51. package/dist/cjs/node/rpc.d.ts +27 -67
  52. package/dist/cjs/node/state/BN254.d.ts +0 -1
  53. package/dist/cjs/node/state/bn.d.ts +3 -0
  54. package/dist/cjs/node/state/compressed-account.d.ts +189 -15
  55. package/dist/cjs/node/state/index.d.ts +1 -0
  56. package/dist/cjs/node/state/types.d.ts +345 -31
  57. package/dist/cjs/node/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +3 -3
  58. package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +21 -49
  59. package/dist/cjs/node/utils/calculate-compute-unit-price.d.ts +1 -1
  60. package/dist/cjs/node/utils/conversion.d.ts +2 -0
  61. package/dist/cjs/node/utils/get-state-tree-infos.d.ts +48 -0
  62. package/dist/cjs/node/utils/index.d.ts +4 -2
  63. package/dist/cjs/node/utils/parse-validity-proof.d.ts +3 -3
  64. package/dist/cjs/node/utils/send-and-confirm.d.ts +1 -1
  65. package/dist/cjs/node/utils/state-tree-lookup-table.d.ts +68 -0
  66. package/dist/cjs/node/utils/validation.d.ts +2 -2
  67. package/dist/types/index.d.ts +3177 -1063
  68. package/package.json +16 -8
  69. package/dist/cjs/browser/instruction/index.d.ts +0 -1
  70. package/dist/cjs/browser/instruction/pack-compressed-accounts.d.ts +0 -51
  71. package/dist/cjs/browser/utils/get-light-state-tree-info.d.ts +0 -76
  72. package/dist/cjs/node/instruction/index.d.ts +0 -1
  73. package/dist/cjs/node/instruction/pack-compressed-accounts.d.ts +0 -51
  74. package/dist/cjs/node/utils/get-light-state-tree-info.d.ts +0 -76
  75. /package/dist/cjs/browser/{actions/common.d.ts → utils/dedupe-signer.d.ts} +0 -0
  76. /package/dist/cjs/node/{actions/common.d.ts → utils/dedupe-signer.d.ts} +0 -0
@@ -1,11 +1,9 @@
1
1
  export * from './actions';
2
- export * from './instruction';
3
2
  export * from './programs';
4
3
  export * from './state';
4
+ export * from './test-helpers';
5
5
  export * from './utils';
6
6
  export * from './constants';
7
7
  export * from './errors';
8
8
  export * from './rpc-interface';
9
9
  export * from './rpc';
10
- export * from './test-helpers';
11
- export { LightSystemProgram as LightSystemProgramIDL, IDL } from './idl';
@@ -1,2 +1 @@
1
1
  export * from './system';
2
- export * from './layout';
@@ -698,7 +698,7 @@ export type LightSystemProgram = {
698
698
  type: 'u8';
699
699
  },
700
700
  {
701
- name: 'nullifierQueuePubkeyIndex';
701
+ name: 'queuePubkeyIndex';
702
702
  type: 'u8';
703
703
  },
704
704
  {
@@ -706,30 +706,8 @@ export type LightSystemProgram = {
706
706
  type: 'u32';
707
707
  },
708
708
  {
709
- name: 'queueIndex';
710
- type: {
711
- option: {
712
- defined: 'QueueIndex';
713
- };
714
- };
715
- }
716
- ];
717
- };
718
- },
719
- {
720
- name: 'QueueIndex';
721
- type: {
722
- kind: 'struct';
723
- fields: [
724
- {
725
- name: 'queueId';
726
- docs: ['Id of queue in queue account.'];
727
- type: 'u8';
728
- },
729
- {
730
- name: 'index';
731
- docs: ['Index of compressed account hash in queue.'];
732
- type: 'u16';
709
+ name: 'proveByIndex';
710
+ type: 'bool';
733
711
  }
734
712
  ];
735
713
  };
@@ -873,8 +851,8 @@ export type LightSystemProgram = {
873
851
  },
874
852
  {
875
853
  code: 6009;
876
- name: 'DeCompressLamportsUndefinedForCompressSol';
877
- msg: 'DeCompressLamportsUndefinedForCompressSol';
854
+ name: 'DecompressLamportsUndefinedForCompressSol';
855
+ msg: 'DecompressLamportsUndefinedForCompressSol';
878
856
  },
879
857
  {
880
858
  code: 6010;
@@ -0,0 +1,5 @@
1
+ export { LightSystemProgram as LightSystemProgramIDL, IDL } from './idl';
2
+ export * from './layout';
3
+ export * from './pack';
4
+ export * from './program';
5
+ export * from './select-compressed-accounts';
@@ -1,24 +1,60 @@
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 { InstructionDataInvoke, InstructionDataInvokeCpi, PublicTransactionEvent } from '../state';
4
+ import { InstructionDataInvoke, InstructionDataInvokeCpi, PublicTransactionEvent } from '../../state';
5
5
  export declare const CompressedAccountLayout: import("buffer-layout").Layout<unknown>;
6
6
  export declare const MerkleContextLayout: import("buffer-layout").Layout<unknown>;
7
7
  export declare const NewAddressParamsLayout: import("buffer-layout").Layout<unknown>;
8
8
  export declare const InstructionDataInvokeLayout: Layout<InstructionDataInvoke>;
9
9
  export declare function encodeInstructionDataInvoke(data: InstructionDataInvoke): Buffer;
10
10
  export declare const InstructionDataInvokeCpiLayout: Layout<InstructionDataInvokeCpi>;
11
+ export declare const CompressedProofLayout: import("buffer-layout").Layout<unknown>;
12
+ export declare const CompressedCpiContextLayout: import("buffer-layout").Layout<unknown>;
13
+ export declare const NewAddressParamsAssignedPackedLayout: import("buffer-layout").Layout<unknown>;
14
+ export declare const PackedMerkleContextLayout: import("buffer-layout").Layout<unknown>;
15
+ export declare const InAccountLayout: import("buffer-layout").Layout<unknown>;
16
+ export declare const PackedReadOnlyAddressLayout: import("buffer-layout").Layout<unknown>;
17
+ export declare const PackedReadOnlyCompressedAccountLayout: import("buffer-layout").Layout<unknown>;
18
+ export declare const InstructionDataInvokeCpiWithReadOnlyLayout: import("buffer-layout").Layout<unknown>;
19
+ export declare function decodeInstructionDataInvokeCpiWithReadOnly(buffer: Buffer): unknown;
11
20
  export declare function decodeInstructionDataInvoke(buffer: Buffer): InstructionDataInvoke;
12
21
  export declare function decodeInstructionDataInvokeCpi(buffer: Buffer): InstructionDataInvokeCpi;
13
22
  export type invokeAccountsLayoutParams = {
23
+ /**
24
+ * Fee payer.
25
+ */
14
26
  feePayer: PublicKey;
27
+ /**
28
+ * Authority.
29
+ */
15
30
  authority: PublicKey;
31
+ /**
32
+ * The registered program pda
33
+ */
16
34
  registeredProgramPda: PublicKey;
35
+ /**
36
+ * Noop program.
37
+ */
17
38
  noopProgram: PublicKey;
39
+ /**
40
+ * Account compression authority.
41
+ */
18
42
  accountCompressionAuthority: PublicKey;
43
+ /**
44
+ * Account compression program.
45
+ */
19
46
  accountCompressionProgram: PublicKey;
47
+ /**
48
+ * Solana pool pda. Some() if compression or decompression is done.
49
+ */
20
50
  solPoolPda: PublicKey | null;
51
+ /**
52
+ * Decompression recipient.
53
+ */
21
54
  decompressionRecipient: PublicKey | null;
55
+ /**
56
+ * Solana system program.
57
+ */
22
58
  systemProgram: PublicKey;
23
59
  };
24
60
  export declare const invokeAccountsLayout: (accounts: invokeAccountsLayoutParams) => AccountMeta[];
@@ -0,0 +1,74 @@
1
+ import { AccountMeta, PublicKey } from '@solana/web3.js';
2
+ import { AccountProofInput, CompressedAccountLegacy, NewAddressProofInput, OutputCompressedAccountWithPackedContext, PackedCompressedAccountWithMerkleContext, TreeInfo } from '../../state';
3
+ import { CompressedAccountWithMerkleContextLegacy, PackedAddressTreeInfo, PackedStateTreeInfo } from '../../state/compressed-account';
4
+ /**
5
+ * @internal Finds the index of a PublicKey in an array, or adds it if not
6
+ * present
7
+ * */
8
+ export declare function getIndexOrAdd(accountsArray: PublicKey[], key: PublicKey): number;
9
+ /**
10
+ * @internal
11
+ * Pads output state trees with the 0th state tree of the input state.
12
+ *
13
+ * @param outputStateMerkleTrees Optional output state trees
14
+ * to be inserted into the
15
+ * output state. Defaults to
16
+ * the 0th state tree of the
17
+ * input state. Gets padded to
18
+ * the length of
19
+ * outputCompressedAccounts.
20
+ * @param numberOfOutputCompressedAccounts The number of output
21
+ * compressed accounts.
22
+ *
23
+ * @returns Padded output state trees.
24
+ */
25
+ export declare function padOutputStateMerkleTrees(outputStateMerkleTrees: PublicKey, numberOfOutputCompressedAccounts: number): PublicKey[];
26
+ export declare function toAccountMetas(remainingAccounts: PublicKey[]): AccountMeta[];
27
+ export interface PackedStateTreeInfos {
28
+ packedTreeInfos: PackedStateTreeInfo[];
29
+ outputTreeIndex: number;
30
+ }
31
+ export interface PackedTreeInfos {
32
+ stateTrees?: PackedStateTreeInfos;
33
+ addressTrees: PackedAddressTreeInfo[];
34
+ }
35
+ /**
36
+ * Packs TreeInfos. Replaces PublicKey with index pointer to remaining accounts.
37
+ *
38
+ * Only use for MUT, CLOSE, NEW_ADDRESSES. For INIT, pass
39
+ * {@link newAddressParamsPacked} and `outputStateTreeIndex` to your program
40
+ * instead.
41
+ *
42
+ *
43
+ * @param remainingAccounts Optional existing array of accounts
44
+ * to append to.
45
+ * @param accountProofInputs Account proof inputs.
46
+ * @param newAddressProofInputs New address proof inputs.
47
+ *
48
+ * @returns Remaining accounts, packed state and address tree infos, state tree
49
+ * output index and address tree infos.
50
+ */
51
+ export declare function packTreeInfos(remainingAccounts: PublicKey[], accountProofInputs: AccountProofInput[], newAddressProofInputs: NewAddressProofInput[]): PackedTreeInfos;
52
+ /**
53
+ * Packs Compressed Accounts.
54
+ *
55
+ * Replaces PublicKey with index pointer to remaining accounts.
56
+ *
57
+ *
58
+ * @param inputCompressedAccounts Ix input state to be consumed
59
+ * @param inputStateRootIndices The recent state root indices of the
60
+ * input state. The expiry is tied to
61
+ * the proof.
62
+ * @param outputCompressedAccounts Ix output state to be created
63
+ * @param outputStateTreeInfo The output state tree info. Gets
64
+ * padded to the length of
65
+ * outputCompressedAccounts.
66
+ *
67
+ * @param remainingAccounts Optional existing array of accounts
68
+ * to append to.
69
+ **/
70
+ export declare function packCompressedAccounts(inputCompressedAccounts: CompressedAccountWithMerkleContextLegacy[], inputStateRootIndices: number[], outputCompressedAccounts: CompressedAccountLegacy[], outputStateTreeInfo?: TreeInfo, remainingAccounts?: PublicKey[]): {
71
+ packedInputCompressedAccounts: PackedCompressedAccountWithMerkleContext[];
72
+ packedOutputCompressedAccounts: OutputCompressedAccountWithPackedContext[];
73
+ remainingAccounts: PublicKey[];
74
+ };
@@ -1,7 +1,7 @@
1
1
  import BN from 'bn.js';
2
2
  import { PublicKey, TransactionInstruction } from '@solana/web3.js';
3
- import { CompressedAccount, CompressedAccountWithMerkleContext, CompressedProof } from '../state';
4
- import { NewAddressParams } from '../utils';
3
+ import { CompressedAccountWithMerkleContext, ValidityProof, TreeInfo, CompressedAccountLegacy } from '../../state';
4
+ import { NewAddressParams } from '../../utils';
5
5
  export declare const sumUpLamports: (accounts: CompressedAccountWithMerkleContext[]) => BN;
6
6
  /**
7
7
  * Create compressed account system transaction params
@@ -12,21 +12,24 @@ type CreateAccountWithSeedParams = {
12
12
  */
13
13
  payer: PublicKey;
14
14
  /**
15
- * Address params for the new compressed account
15
+ * Address params for the new compressed account.
16
16
  */
17
17
  newAddressParams: NewAddressParams;
18
+ /**
19
+ * Address of the new compressed account
20
+ */
18
21
  newAddress: number[];
19
22
  /**
20
23
  * Recent validity proof proving that there's no existing compressed account
21
24
  * registered with newAccountAddress
22
25
  */
23
- recentValidityProof: CompressedProof;
26
+ recentValidityProof: ValidityProof | null;
24
27
  /**
25
28
  * State tree pubkey. Defaults to a public state tree if unspecified.
26
29
  */
27
- outputStateTree?: PublicKey;
30
+ outputStateTreeInfo?: TreeInfo;
28
31
  /**
29
- * Public key of the program to assign as the owner of the created account
32
+ * Public key of the program to assign as the owner of the created account.
30
33
  */
31
34
  programId?: PublicKey;
32
35
  /**
@@ -57,31 +60,23 @@ type TransferParams = {
57
60
  */
58
61
  inputCompressedAccounts: CompressedAccountWithMerkleContext[];
59
62
  /**
60
- * Recipient address
63
+ * Recipient address.
61
64
  */
62
65
  toAddress: PublicKey;
63
66
  /**
64
- * amount of lamports to transfer.
67
+ * Amount of lamports to transfer.
65
68
  */
66
69
  lamports: number | BN;
67
70
  /**
68
71
  * The recent state root indices of the input state. The expiry is tied to
69
72
  * the proof.
70
- *
71
- * TODO: Add support for passing recent-values after instruction creation.
72
73
  */
73
74
  recentInputStateRootIndices: number[];
74
75
  /**
75
- * The recent validity proof for state inclusion of the input state. It
76
- * expires after n slots.
77
- */
78
- recentValidityProof: CompressedProof;
79
- /**
80
- * The state trees that the tx output should be inserted into. This can be a
81
- * single PublicKey or an array of PublicKey. Defaults to the 0th state tree
82
- * of input state.
76
+ * The recent validity proof for state inclusion of the input state. Expires
77
+ * after n slots.
83
78
  */
84
- outputStateTrees?: PublicKey[] | PublicKey;
79
+ recentValidityProof: ValidityProof | null;
85
80
  };
86
81
  /**
87
82
  * Defines the parameters for the transfer method
@@ -100,10 +95,9 @@ type CompressParams = {
100
95
  */
101
96
  lamports: number | BN;
102
97
  /**
103
- * The state tree that the tx output should be inserted into. Defaults to a
104
- * public state tree if unspecified.
98
+ * The state tree that the tx output should be inserted into.
105
99
  */
106
- outputStateTree?: PublicKey;
100
+ outputStateTreeInfo: TreeInfo;
107
101
  };
108
102
  /**
109
103
  * Defines the parameters for the transfer method
@@ -128,21 +122,13 @@ type DecompressParams = {
128
122
  /**
129
123
  * The recent state root indices of the input state. The expiry is tied to
130
124
  * the proof.
131
- *
132
- * TODO: Add support for passing recent-values after instruction creation.
133
125
  */
134
126
  recentInputStateRootIndices: number[];
135
127
  /**
136
128
  * The recent validity proof for state inclusion of the input state. It
137
129
  * expires after n slots.
138
130
  */
139
- recentValidityProof: CompressedProof;
140
- /**
141
- * The state trees that the tx output should be inserted into. This can be a
142
- * single PublicKey or an array of PublicKey. Defaults to the 0th state tree
143
- * of input state.
144
- */
145
- outputStateTree?: PublicKey;
131
+ recentValidityProof: ValidityProof | null;
146
132
  };
147
133
  export declare class LightSystemProgram {
148
134
  /**
@@ -150,7 +136,7 @@ export declare class LightSystemProgram {
150
136
  */
151
137
  constructor();
152
138
  /**
153
- * Public key that identifies the CompressedPda program
139
+ * The LightSystemProgram program ID.
154
140
  */
155
141
  static programId: PublicKey;
156
142
  /**
@@ -159,41 +145,31 @@ export declare class LightSystemProgram {
159
145
  *
160
146
  */
161
147
  static deriveCompressedSolPda(): PublicKey;
162
- static createTransferOutputState(inputCompressedAccounts: CompressedAccountWithMerkleContext[], toAddress: PublicKey, lamports: number | BN): CompressedAccount[];
163
- static createDecompressOutputState(inputCompressedAccounts: CompressedAccountWithMerkleContext[], lamports: number | BN): CompressedAccount[];
148
+ static createTransferOutputState(inputCompressedAccounts: CompressedAccountWithMerkleContext[], toAddress: PublicKey, lamports: number | BN): CompressedAccountLegacy[];
149
+ static createDecompressOutputState(inputCompressedAccounts: CompressedAccountWithMerkleContext[], lamports: number | BN): CompressedAccountLegacy[];
164
150
  /**
165
151
  * No data by default
166
152
  */
167
- static createNewAddressOutputState(address: number[], owner: PublicKey, lamports?: BN | number, inputCompressedAccounts?: CompressedAccountWithMerkleContext[]): CompressedAccount[];
153
+ static createNewAddressOutputState(address: number[], owner: PublicKey, lamports?: BN | number, inputCompressedAccounts?: CompressedAccountWithMerkleContext[]): CompressedAccountLegacy[];
168
154
  /**
169
155
  * Creates instruction to create compressed account with PDA.
170
156
  * Cannot write data.
171
- *
172
- * TODO: support transfer of lamports to the new account.
173
157
  */
174
- static createAccount({ payer, newAddressParams, newAddress, recentValidityProof, outputStateTree, inputCompressedAccounts, inputStateRootIndices, lamports, }: CreateAccountWithSeedParams): Promise<TransactionInstruction>;
158
+ static createAccount({ payer, newAddressParams, newAddress, recentValidityProof, outputStateTreeInfo, inputCompressedAccounts, inputStateRootIndices, lamports, }: CreateAccountWithSeedParams): Promise<TransactionInstruction>;
175
159
  /**
176
160
  * Creates a transaction instruction that transfers compressed lamports from
177
161
  * one owner to another.
178
162
  */
179
- static transfer({ payer, inputCompressedAccounts, toAddress, lamports, recentInputStateRootIndices, recentValidityProof, outputStateTrees, }: TransferParams): Promise<TransactionInstruction>;
163
+ static transfer({ payer, inputCompressedAccounts, toAddress, lamports, recentInputStateRootIndices, recentValidityProof, }: TransferParams): Promise<TransactionInstruction>;
180
164
  /**
181
165
  * Creates a transaction instruction that transfers compressed lamports from
182
166
  * one owner to another.
183
167
  */
184
- static compress({ payer, toAddress, lamports, outputStateTree, }: CompressParams): Promise<TransactionInstruction>;
168
+ static compress({ payer, toAddress, lamports, outputStateTreeInfo, }: CompressParams): Promise<TransactionInstruction>;
185
169
  /**
186
170
  * Creates a transaction instruction that transfers compressed lamports from
187
171
  * one owner to another.
188
172
  */
189
- static decompress({ payer, inputCompressedAccounts, toAddress, lamports, recentInputStateRootIndices, recentValidityProof, outputStateTree, }: DecompressParams): Promise<TransactionInstruction>;
173
+ static decompress({ payer, inputCompressedAccounts, toAddress, lamports, recentInputStateRootIndices, recentValidityProof, }: DecompressParams): Promise<TransactionInstruction>;
190
174
  }
191
- /**
192
- * Selects the minimal number of compressed SOL accounts for a transfer.
193
- *
194
- * 1. Sorts the accounts by amount in descending order
195
- * 2. Accumulates the amount until it is greater than or equal to the transfer
196
- * amount
197
- */
198
- export declare function selectMinCompressedSolAccountsForTransfer(accounts: CompressedAccountWithMerkleContext[], transferLamports: BN | number): [selectedAccounts: CompressedAccountWithMerkleContext[], total: BN];
199
175
  export {};
@@ -0,0 +1,10 @@
1
+ import BN from 'bn.js';
2
+ import { CompressedAccountWithMerkleContext } from '../../state';
3
+ /**
4
+ * Selects the minimal number of compressed SOL accounts for a transfer.
5
+ *
6
+ * 1. Sorts the accounts by amount in descending order
7
+ * 2. Accumulates the amount until it is greater than or equal to the transfer
8
+ * amount
9
+ */
10
+ export declare function selectMinCompressedSolAccountsForTransfer(accounts: CompressedAccountWithMerkleContext[], transferLamports: BN | number): [selectedAccounts: CompressedAccountWithMerkleContext[], total: BN];