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