@lightprotocol/stateless.js 0.16.0 → 0.17.1
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 +1 -4
- package/dist/cjs/browser/actions/compress.d.ts +2 -14
- package/dist/cjs/browser/actions/create-account.d.ts +3 -27
- package/dist/cjs/browser/actions/decompress.d.ts +2 -14
- package/dist/cjs/browser/actions/transfer.d.ts +2 -15
- package/dist/cjs/browser/constants.d.ts +7 -14
- package/dist/cjs/browser/errors.d.ts +49 -40
- package/dist/cjs/browser/idls/account_compression.d.ts +56 -56
- package/dist/cjs/browser/idls/index.d.ts +4 -22
- package/dist/cjs/browser/idls/light_compressed_token.d.ts +209 -89
- package/dist/cjs/browser/idls/light_registry.d.ts +60 -60
- package/dist/cjs/browser/idls/light_system_program.d.ts +55 -55
- package/dist/cjs/browser/index.cjs +3223 -4792
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/browser/instruction/pack-compressed-accounts.d.ts +5 -24
- package/dist/cjs/browser/programs/system.d.ts +10 -61
- package/dist/cjs/browser/rpc-interface.d.ts +871 -1127
- package/dist/cjs/browser/rpc.d.ts +31 -143
- package/dist/cjs/browser/state/BN254.d.ts +2 -9
- package/dist/cjs/browser/state/compressed-account.d.ts +6 -23
- package/dist/cjs/browser/test-helpers/merkle-tree/indexed-array.d.ts +4 -18
- package/dist/cjs/browser/test-helpers/merkle-tree/merkle-tree.d.ts +6 -19
- package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +3 -12
- package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +5 -21
- package/dist/cjs/browser/test-helpers/test-rpc/get-parsed-events.d.ts +3 -10
- package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +31 -135
- package/dist/cjs/browser/utils/address.d.ts +3 -12
- package/dist/cjs/browser/utils/airdrop.d.ts +2 -14
- package/dist/cjs/browser/utils/calculate-compute-unit-price.d.ts +1 -4
- package/dist/cjs/browser/utils/conversion.d.ts +3 -9
- package/dist/cjs/browser/utils/parse-validity-proof.d.ts +1 -3
- package/dist/cjs/browser/utils/pipe.d.ts +1 -4
- package/dist/cjs/browser/utils/send-and-confirm.d.ts +11 -42
- package/dist/cjs/browser/utils/test-utils.d.ts +1 -5
- package/dist/cjs/browser/utils/validation.d.ts +2 -9
- package/dist/cjs/browser/wallet/interface.d.ts +4 -15
- package/dist/cjs/browser/wallet/use-wallet.d.ts +5 -20
- package/dist/cjs/node/actions/common.d.ts +1 -4
- package/dist/cjs/node/actions/compress.d.ts +2 -14
- package/dist/cjs/node/actions/create-account.d.ts +3 -27
- package/dist/cjs/node/actions/decompress.d.ts +2 -14
- package/dist/cjs/node/actions/transfer.d.ts +2 -15
- package/dist/cjs/node/constants.d.ts +7 -14
- package/dist/cjs/node/errors.d.ts +49 -40
- package/dist/cjs/node/idls/account_compression.d.ts +56 -56
- package/dist/cjs/node/idls/index.d.ts +4 -22
- package/dist/cjs/node/idls/light_compressed_token.d.ts +209 -89
- package/dist/cjs/node/idls/light_registry.d.ts +60 -60
- package/dist/cjs/node/idls/light_system_program.d.ts +55 -55
- package/dist/cjs/node/index.cjs +1070 -2329
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/cjs/node/instruction/pack-compressed-accounts.d.ts +5 -24
- package/dist/cjs/node/programs/system.d.ts +10 -61
- package/dist/cjs/node/rpc-interface.d.ts +871 -1127
- package/dist/cjs/node/rpc.d.ts +31 -143
- package/dist/cjs/node/state/BN254.d.ts +2 -9
- package/dist/cjs/node/state/compressed-account.d.ts +6 -23
- package/dist/cjs/node/test-helpers/merkle-tree/indexed-array.d.ts +4 -18
- package/dist/cjs/node/test-helpers/merkle-tree/merkle-tree.d.ts +6 -19
- package/dist/cjs/node/test-helpers/test-rpc/get-compressed-accounts.d.ts +3 -12
- package/dist/cjs/node/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +5 -21
- package/dist/cjs/node/test-helpers/test-rpc/get-parsed-events.d.ts +3 -10
- package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +31 -135
- package/dist/cjs/node/utils/address.d.ts +3 -12
- package/dist/cjs/node/utils/airdrop.d.ts +2 -14
- package/dist/cjs/node/utils/calculate-compute-unit-price.d.ts +1 -4
- package/dist/cjs/node/utils/conversion.d.ts +3 -9
- package/dist/cjs/node/utils/parse-validity-proof.d.ts +1 -3
- package/dist/cjs/node/utils/pipe.d.ts +1 -4
- package/dist/cjs/node/utils/send-and-confirm.d.ts +11 -42
- package/dist/cjs/node/utils/test-utils.d.ts +1 -5
- package/dist/cjs/node/utils/validation.d.ts +2 -9
- package/dist/cjs/node/wallet/interface.d.ts +4 -15
- package/dist/cjs/node/wallet/use-wallet.d.ts +5 -20
- package/dist/es/browser/actions/common.d.ts +1 -4
- package/dist/es/browser/actions/compress.d.ts +2 -14
- package/dist/es/browser/actions/create-account.d.ts +3 -27
- package/dist/es/browser/actions/decompress.d.ts +2 -14
- package/dist/es/browser/actions/transfer.d.ts +2 -15
- package/dist/es/browser/constants.d.ts +7 -14
- package/dist/es/browser/errors.d.ts +49 -40
- package/dist/es/browser/idls/account_compression.d.ts +56 -56
- package/dist/es/browser/idls/index.d.ts +4 -22
- package/dist/es/browser/idls/light_compressed_token.d.ts +209 -89
- package/dist/es/browser/idls/light_registry.d.ts +60 -60
- package/dist/es/browser/idls/light_system_program.d.ts +55 -55
- package/dist/es/browser/index.js +3209 -4698
- package/dist/es/browser/index.js.map +1 -1
- package/dist/es/browser/instruction/pack-compressed-accounts.d.ts +5 -24
- package/dist/es/browser/programs/system.d.ts +10 -61
- package/dist/es/browser/rpc-interface.d.ts +871 -1127
- package/dist/es/browser/rpc.d.ts +31 -143
- package/dist/es/browser/state/BN254.d.ts +2 -9
- package/dist/es/browser/state/compressed-account.d.ts +6 -23
- package/dist/es/browser/test-helpers/merkle-tree/indexed-array.d.ts +4 -18
- package/dist/es/browser/test-helpers/merkle-tree/merkle-tree.d.ts +6 -19
- package/dist/es/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +3 -12
- package/dist/es/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +5 -21
- package/dist/es/browser/test-helpers/test-rpc/get-parsed-events.d.ts +3 -10
- package/dist/es/browser/test-helpers/test-rpc/test-rpc.d.ts +31 -135
- package/dist/es/browser/utils/address.d.ts +3 -12
- package/dist/es/browser/utils/airdrop.d.ts +2 -14
- package/dist/es/browser/utils/calculate-compute-unit-price.d.ts +1 -4
- package/dist/es/browser/utils/conversion.d.ts +3 -9
- package/dist/es/browser/utils/parse-validity-proof.d.ts +1 -3
- package/dist/es/browser/utils/pipe.d.ts +1 -4
- package/dist/es/browser/utils/send-and-confirm.d.ts +11 -42
- package/dist/es/browser/utils/test-utils.d.ts +1 -5
- package/dist/es/browser/utils/validation.d.ts +2 -9
- package/dist/es/browser/wallet/interface.d.ts +4 -15
- package/dist/es/browser/wallet/use-wallet.d.ts +5 -20
- package/dist/types/index.d.ts +1433 -2192
- package/package.json +1 -1
|
@@ -1,27 +1,14 @@
|
|
|
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
|
/** @internal */
|
|
17
|
-
export declare function padOutputStateMerkleTrees(
|
|
18
|
-
|
|
19
|
-
numberOfOutputCompressedAccounts: number,
|
|
20
|
-
inputCompressedAccountsWithMerkleContext: CompressedAccountWithMerkleContext[],
|
|
21
|
-
): PublicKey[];
|
|
22
|
-
export declare function toAccountMetas(
|
|
23
|
-
remainingAccounts: PublicKey[],
|
|
24
|
-
): AccountMeta[];
|
|
10
|
+
export declare function padOutputStateMerkleTrees(outputStateMerkleTrees: PublicKey[] | PublicKey | undefined, numberOfOutputCompressedAccounts: number, inputCompressedAccountsWithMerkleContext: CompressedAccountWithMerkleContext[]): PublicKey[];
|
|
11
|
+
export declare function toAccountMetas(remainingAccounts: PublicKey[]): AccountMeta[];
|
|
25
12
|
/**
|
|
26
13
|
* Packs Compressed Accounts.
|
|
27
14
|
*
|
|
@@ -41,13 +28,7 @@ export declare function toAccountMetas(
|
|
|
41
28
|
* @param remainingAccounts Optional existing array of accounts
|
|
42
29
|
* to append to.
|
|
43
30
|
**/
|
|
44
|
-
export declare function packCompressedAccounts(
|
|
45
|
-
inputCompressedAccounts: CompressedAccountWithMerkleContext[],
|
|
46
|
-
inputStateRootIndices: number[],
|
|
47
|
-
outputCompressedAccounts: CompressedAccount[],
|
|
48
|
-
outputStateMerkleTrees?: PublicKey[] | PublicKey,
|
|
49
|
-
remainingAccounts?: PublicKey[],
|
|
50
|
-
): {
|
|
31
|
+
export declare function packCompressedAccounts(inputCompressedAccounts: CompressedAccountWithMerkleContext[], inputStateRootIndices: number[], outputCompressedAccounts: CompressedAccount[], outputStateMerkleTrees?: PublicKey[] | PublicKey, remainingAccounts?: PublicKey[]): {
|
|
51
32
|
packedInputCompressedAccounts: PackedCompressedAccountWithMerkleContext[];
|
|
52
33
|
packedOutputCompressedAccounts: OutputCompressedAccountWithPackedContext[];
|
|
53
34
|
remainingAccounts: PublicKey[];
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { Program, BN } from '@coral-xyz/anchor';
|
|
2
2
|
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
3
3
|
import { LightSystemProgram as LightSystemProgramIDL } from '../idls/light_system_program';
|
|
4
|
-
import {
|
|
5
|
-
CompressedAccount,
|
|
6
|
-
CompressedAccountWithMerkleContext,
|
|
7
|
-
CompressedProof,
|
|
8
|
-
} from '../state';
|
|
4
|
+
import { CompressedAccount, CompressedAccountWithMerkleContext, CompressedProof } from '../state';
|
|
9
5
|
import { NewAddressParams } from '../utils';
|
|
10
|
-
export declare const sumUpLamports: (
|
|
11
|
-
accounts: CompressedAccountWithMerkleContext[],
|
|
12
|
-
) => BN;
|
|
6
|
+
export declare const sumUpLamports: (accounts: CompressedAccountWithMerkleContext[]) => BN;
|
|
13
7
|
/**
|
|
14
8
|
* Create compressed account system transaction params
|
|
15
9
|
*/
|
|
@@ -172,76 +166,34 @@ export declare class LightSystemProgram {
|
|
|
172
166
|
* Initializes the program statically if not already initialized.
|
|
173
167
|
*/
|
|
174
168
|
private static initializeProgram;
|
|
175
|
-
static createTransferOutputState(
|
|
176
|
-
|
|
177
|
-
toAddress: PublicKey,
|
|
178
|
-
lamports: number | BN,
|
|
179
|
-
): CompressedAccount[];
|
|
180
|
-
static createDecompressOutputState(
|
|
181
|
-
inputCompressedAccounts: CompressedAccountWithMerkleContext[],
|
|
182
|
-
lamports: number | BN,
|
|
183
|
-
): CompressedAccount[];
|
|
169
|
+
static createTransferOutputState(inputCompressedAccounts: CompressedAccountWithMerkleContext[], toAddress: PublicKey, lamports: number | BN): CompressedAccount[];
|
|
170
|
+
static createDecompressOutputState(inputCompressedAccounts: CompressedAccountWithMerkleContext[], lamports: number | BN): CompressedAccount[];
|
|
184
171
|
/**
|
|
185
172
|
* No data by default
|
|
186
173
|
*/
|
|
187
|
-
static createNewAddressOutputState(
|
|
188
|
-
address: number[],
|
|
189
|
-
owner: PublicKey,
|
|
190
|
-
lamports?: BN | number,
|
|
191
|
-
inputCompressedAccounts?: CompressedAccountWithMerkleContext[],
|
|
192
|
-
): CompressedAccount[];
|
|
174
|
+
static createNewAddressOutputState(address: number[], owner: PublicKey, lamports?: BN | number, inputCompressedAccounts?: CompressedAccountWithMerkleContext[]): CompressedAccount[];
|
|
193
175
|
/**
|
|
194
176
|
* Creates instruction to create compressed account with PDA.
|
|
195
177
|
* Cannot write data.
|
|
196
178
|
*
|
|
197
179
|
* TODO: support transfer of lamports to the new account.
|
|
198
180
|
*/
|
|
199
|
-
static createAccount({
|
|
200
|
-
payer,
|
|
201
|
-
newAddressParams,
|
|
202
|
-
newAddress,
|
|
203
|
-
recentValidityProof,
|
|
204
|
-
outputStateTree,
|
|
205
|
-
inputCompressedAccounts,
|
|
206
|
-
inputStateRootIndices,
|
|
207
|
-
lamports,
|
|
208
|
-
}: CreateAccountWithSeedParams): Promise<TransactionInstruction>;
|
|
181
|
+
static createAccount({ payer, newAddressParams, newAddress, recentValidityProof, outputStateTree, inputCompressedAccounts, inputStateRootIndices, lamports, }: CreateAccountWithSeedParams): Promise<TransactionInstruction>;
|
|
209
182
|
/**
|
|
210
183
|
* Creates a transaction instruction that transfers compressed lamports from
|
|
211
184
|
* one owner to another.
|
|
212
185
|
*/
|
|
213
|
-
static transfer({
|
|
214
|
-
payer,
|
|
215
|
-
inputCompressedAccounts,
|
|
216
|
-
toAddress,
|
|
217
|
-
lamports,
|
|
218
|
-
recentInputStateRootIndices,
|
|
219
|
-
recentValidityProof,
|
|
220
|
-
outputStateTrees,
|
|
221
|
-
}: TransferParams): Promise<TransactionInstruction>;
|
|
186
|
+
static transfer({ payer, inputCompressedAccounts, toAddress, lamports, recentInputStateRootIndices, recentValidityProof, outputStateTrees, }: TransferParams): Promise<TransactionInstruction>;
|
|
222
187
|
/**
|
|
223
188
|
* Creates a transaction instruction that transfers compressed lamports from
|
|
224
189
|
* one owner to another.
|
|
225
190
|
*/
|
|
226
|
-
static compress({
|
|
227
|
-
payer,
|
|
228
|
-
toAddress,
|
|
229
|
-
lamports,
|
|
230
|
-
outputStateTree,
|
|
231
|
-
}: CompressParams): Promise<TransactionInstruction>;
|
|
191
|
+
static compress({ payer, toAddress, lamports, outputStateTree, }: CompressParams): Promise<TransactionInstruction>;
|
|
232
192
|
/**
|
|
233
193
|
* Creates a transaction instruction that transfers compressed lamports from
|
|
234
194
|
* one owner to another.
|
|
235
195
|
*/
|
|
236
|
-
static decompress({
|
|
237
|
-
payer,
|
|
238
|
-
inputCompressedAccounts,
|
|
239
|
-
toAddress,
|
|
240
|
-
lamports,
|
|
241
|
-
recentInputStateRootIndices,
|
|
242
|
-
recentValidityProof,
|
|
243
|
-
outputStateTree,
|
|
244
|
-
}: DecompressParams): Promise<TransactionInstruction>;
|
|
196
|
+
static decompress({ payer, inputCompressedAccounts, toAddress, lamports, recentInputStateRootIndices, recentValidityProof, outputStateTree, }: DecompressParams): Promise<TransactionInstruction>;
|
|
245
197
|
}
|
|
246
198
|
/**
|
|
247
199
|
* Selects the minimal number of compressed SOL accounts for a transfer.
|
|
@@ -250,8 +202,5 @@ export declare class LightSystemProgram {
|
|
|
250
202
|
* 2. Accumulates the amount until it is greater than or equal to the transfer
|
|
251
203
|
* amount
|
|
252
204
|
*/
|
|
253
|
-
export declare function selectMinCompressedSolAccountsForTransfer(
|
|
254
|
-
accounts: CompressedAccountWithMerkleContext[],
|
|
255
|
-
transferLamports: BN | number,
|
|
256
|
-
): [selectedAccounts: CompressedAccountWithMerkleContext[], total: BN];
|
|
205
|
+
export declare function selectMinCompressedSolAccountsForTransfer(accounts: CompressedAccountWithMerkleContext[], transferLamports: BN | number): [selectedAccounts: CompressedAccountWithMerkleContext[], total: BN];
|
|
257
206
|
export {};
|