@lightprotocol/stateless.js 0.17.2-alpha.1 → 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.
- package/dist/cjs/browser/constants.d.ts +2 -0
- package/dist/cjs/browser/idl.d.ts +1015 -0
- package/dist/cjs/browser/index.cjs +1 -1
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/browser/index.d.ts +1 -0
- package/dist/cjs/browser/rpc-interface.d.ts +107 -114
- package/dist/cjs/browser/state/types.d.ts +5 -0
- package/dist/cjs/browser/utils/test-utils.d.ts +8 -0
- package/dist/cjs/node/constants.d.ts +2 -0
- package/dist/cjs/node/idl.d.ts +1015 -0
- package/dist/cjs/node/index.cjs +1 -1
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/cjs/node/index.d.ts +1 -0
- package/dist/cjs/node/rpc-interface.d.ts +107 -114
- package/dist/cjs/node/state/types.d.ts +5 -0
- package/dist/cjs/node/utils/test-utils.d.ts +8 -0
- package/dist/types/index.d.ts +1032 -9
- package/package.json +6 -5
- package/dist/es/browser/actions/common.d.ts +0 -3
- package/dist/es/browser/actions/compress.d.ts +0 -16
- package/dist/es/browser/actions/create-account.d.ts +0 -41
- package/dist/es/browser/actions/decompress.d.ts +0 -16
- package/dist/es/browser/actions/index.d.ts +0 -5
- package/dist/es/browser/actions/transfer.d.ts +0 -20
- package/dist/es/browser/constants.d.ts +0 -63
- package/dist/es/browser/errors.d.ts +0 -74
- package/dist/es/browser/index.d.ts +0 -10
- package/dist/es/browser/index.js +0 -2
- package/dist/es/browser/index.js.map +0 -1
- package/dist/es/browser/instruction/index.d.ts +0 -1
- package/dist/es/browser/instruction/pack-compressed-accounts.d.ts +0 -35
- package/dist/es/browser/programs/index.d.ts +0 -2
- package/dist/es/browser/programs/layout.d.ts +0 -25
- package/dist/es/browser/programs/system.d.ts +0 -199
- package/dist/es/browser/rpc-interface.d.ts +0 -1179
- package/dist/es/browser/rpc.d.ts +0 -275
- package/dist/es/browser/state/BN254.d.ts +0 -14
- package/dist/es/browser/state/compressed-account.d.ts +0 -31
- package/dist/es/browser/state/index.d.ts +0 -3
- package/dist/es/browser/state/types.d.ts +0 -91
- package/dist/es/browser/test-helpers/index.d.ts +0 -2
- package/dist/es/browser/test-helpers/merkle-tree/index.d.ts +0 -2
- package/dist/es/browser/test-helpers/merkle-tree/indexed-array.d.ts +0 -85
- package/dist/es/browser/test-helpers/merkle-tree/merkle-tree.d.ts +0 -92
- package/dist/es/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +0 -7
- package/dist/es/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +0 -40
- package/dist/es/browser/test-helpers/test-rpc/get-parsed-events.d.ts +0 -13
- package/dist/es/browser/test-helpers/test-rpc/index.d.ts +0 -3
- package/dist/es/browser/test-helpers/test-rpc/test-rpc.d.ts +0 -249
- package/dist/es/browser/utils/address.d.ts +0 -63
- package/dist/es/browser/utils/airdrop.d.ts +0 -7
- package/dist/es/browser/utils/calculate-compute-unit-price.d.ts +0 -7
- package/dist/es/browser/utils/conversion.d.ts +0 -31
- package/dist/es/browser/utils/index.d.ts +0 -10
- package/dist/es/browser/utils/parse-validity-proof.d.ts +0 -20
- package/dist/es/browser/utils/pipe.d.ts +0 -2
- package/dist/es/browser/utils/send-and-confirm.d.ts +0 -52
- package/dist/es/browser/utils/sleep.d.ts +0 -1
- package/dist/es/browser/utils/test-utils.d.ts +0 -23
- package/dist/es/browser/utils/validation.d.ts +0 -4
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './pack-compressed-accounts';
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { AccountMeta, PublicKey } from '@solana/web3.js';
|
|
2
|
-
import { CompressedAccount, OutputCompressedAccountWithPackedContext, PackedCompressedAccountWithMerkleContext } from '../state';
|
|
3
|
-
import { CompressedAccountWithMerkleContext } 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
|
-
/** @internal */
|
|
10
|
-
export declare function padOutputStateMerkleTrees(outputStateMerkleTrees: PublicKey[] | PublicKey | undefined, numberOfOutputCompressedAccounts: number, inputCompressedAccountsWithMerkleContext: CompressedAccountWithMerkleContext[]): PublicKey[];
|
|
11
|
-
export declare function toAccountMetas(remainingAccounts: PublicKey[]): AccountMeta[];
|
|
12
|
-
/**
|
|
13
|
-
* Packs Compressed Accounts.
|
|
14
|
-
*
|
|
15
|
-
* Replaces PublicKey with index pointer to remaining accounts.
|
|
16
|
-
*
|
|
17
|
-
* @param inputCompressedAccounts Ix input state to be consumed
|
|
18
|
-
* @param inputStateRootIndices The recent state root indices of the
|
|
19
|
-
* input state. The expiry is tied to
|
|
20
|
-
* the proof.
|
|
21
|
-
* @param outputCompressedAccounts Ix output state to be created
|
|
22
|
-
* @param outputStateMerkleTrees Optional output state trees to be
|
|
23
|
-
* inserted into the output state.
|
|
24
|
-
* Defaults to the 0th state tree of
|
|
25
|
-
* the input state. Gets padded to the
|
|
26
|
-
* length of outputCompressedAccounts.
|
|
27
|
-
*
|
|
28
|
-
* @param remainingAccounts Optional existing array of accounts
|
|
29
|
-
* to append to.
|
|
30
|
-
**/
|
|
31
|
-
export declare function packCompressedAccounts(inputCompressedAccounts: CompressedAccountWithMerkleContext[], inputStateRootIndices: number[], outputCompressedAccounts: CompressedAccount[], outputStateMerkleTrees?: PublicKey[] | PublicKey, remainingAccounts?: PublicKey[]): {
|
|
32
|
-
packedInputCompressedAccounts: PackedCompressedAccountWithMerkleContext[];
|
|
33
|
-
packedOutputCompressedAccounts: OutputCompressedAccountWithPackedContext[];
|
|
34
|
-
remainingAccounts: PublicKey[];
|
|
35
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Buffer } from 'buffer';
|
|
2
|
-
import { PublicKey, AccountMeta } from '@solana/web3.js';
|
|
3
|
-
import { Layout } from '@coral-xyz/borsh';
|
|
4
|
-
import { InstructionDataInvoke, 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>;
|
|
8
|
-
export declare const InstructionDataInvokeLayout: Layout<InstructionDataInvoke>;
|
|
9
|
-
export declare function encodeInstructionDataInvoke(data: InstructionDataInvoke): Buffer;
|
|
10
|
-
export declare function decodeInstructionDataInvoke(buffer: Buffer): InstructionDataInvoke;
|
|
11
|
-
export type invokeAccountsLayoutParams = {
|
|
12
|
-
feePayer: PublicKey;
|
|
13
|
-
authority: PublicKey;
|
|
14
|
-
registeredProgramPda: PublicKey;
|
|
15
|
-
noopProgram: PublicKey;
|
|
16
|
-
accountCompressionAuthority: PublicKey;
|
|
17
|
-
accountCompressionProgram: PublicKey;
|
|
18
|
-
solPoolPda: PublicKey | null;
|
|
19
|
-
decompressionRecipient: PublicKey | null;
|
|
20
|
-
systemProgram: PublicKey;
|
|
21
|
-
};
|
|
22
|
-
export declare const invokeAccountsLayout: (accounts: invokeAccountsLayoutParams) => AccountMeta[];
|
|
23
|
-
export declare const PublicTransactionEventLayout: Layout<PublicTransactionEvent>;
|
|
24
|
-
export declare function encodePublicTransactionEvent(data: PublicTransactionEvent): Buffer;
|
|
25
|
-
export declare function decodePublicTransactionEvent(buffer: Buffer): PublicTransactionEvent;
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import BN from 'bn.js';
|
|
2
|
-
import { PublicKey, TransactionInstruction } from '@solana/web3.js';
|
|
3
|
-
import { CompressedAccount, CompressedAccountWithMerkleContext, CompressedProof } from '../state';
|
|
4
|
-
import { NewAddressParams } from '../utils';
|
|
5
|
-
export declare const sumUpLamports: (accounts: CompressedAccountWithMerkleContext[]) => BN;
|
|
6
|
-
/**
|
|
7
|
-
* Create compressed account system transaction params
|
|
8
|
-
*/
|
|
9
|
-
type CreateAccountWithSeedParams = {
|
|
10
|
-
/**
|
|
11
|
-
* The payer of the transaction.
|
|
12
|
-
*/
|
|
13
|
-
payer: PublicKey;
|
|
14
|
-
/**
|
|
15
|
-
* Address params for the new compressed account
|
|
16
|
-
*/
|
|
17
|
-
newAddressParams: NewAddressParams;
|
|
18
|
-
newAddress: number[];
|
|
19
|
-
/**
|
|
20
|
-
* Recent validity proof proving that there's no existing compressed account
|
|
21
|
-
* registered with newAccountAddress
|
|
22
|
-
*/
|
|
23
|
-
recentValidityProof: CompressedProof;
|
|
24
|
-
/**
|
|
25
|
-
* State tree pubkey. Defaults to a public state tree if unspecified.
|
|
26
|
-
*/
|
|
27
|
-
outputStateTree?: PublicKey;
|
|
28
|
-
/**
|
|
29
|
-
* Public key of the program to assign as the owner of the created account
|
|
30
|
-
*/
|
|
31
|
-
programId?: PublicKey;
|
|
32
|
-
/**
|
|
33
|
-
* Optional input accounts to transfer lamports from into the new compressed
|
|
34
|
-
* account.
|
|
35
|
-
*/
|
|
36
|
-
inputCompressedAccounts?: CompressedAccountWithMerkleContext[];
|
|
37
|
-
/**
|
|
38
|
-
* Optional input state root indices of 'inputCompressedAccounts'. The
|
|
39
|
-
* expiry is tied to the 'recentValidityProof'.
|
|
40
|
-
*/
|
|
41
|
-
inputStateRootIndices?: number[];
|
|
42
|
-
/**
|
|
43
|
-
* Optional lamports to transfer into the new compressed account.
|
|
44
|
-
*/
|
|
45
|
-
lamports?: number | BN;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Defines the parameters for the transfer method
|
|
49
|
-
*/
|
|
50
|
-
type TransferParams = {
|
|
51
|
-
/**
|
|
52
|
-
* The payer of the transaction.
|
|
53
|
-
*/
|
|
54
|
-
payer: PublicKey;
|
|
55
|
-
/**
|
|
56
|
-
* The input state to be consumed.
|
|
57
|
-
*/
|
|
58
|
-
inputCompressedAccounts: CompressedAccountWithMerkleContext[];
|
|
59
|
-
/**
|
|
60
|
-
* Recipient address
|
|
61
|
-
*/
|
|
62
|
-
toAddress: PublicKey;
|
|
63
|
-
/**
|
|
64
|
-
* amount of lamports to transfer.
|
|
65
|
-
*/
|
|
66
|
-
lamports: number | BN;
|
|
67
|
-
/**
|
|
68
|
-
* The recent state root indices of the input state. The expiry is tied to
|
|
69
|
-
* the proof.
|
|
70
|
-
*
|
|
71
|
-
* TODO: Add support for passing recent-values after instruction creation.
|
|
72
|
-
*/
|
|
73
|
-
recentInputStateRootIndices: number[];
|
|
74
|
-
/**
|
|
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.
|
|
83
|
-
*/
|
|
84
|
-
outputStateTrees?: PublicKey[] | PublicKey;
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Defines the parameters for the transfer method
|
|
88
|
-
*/
|
|
89
|
-
type CompressParams = {
|
|
90
|
-
/**
|
|
91
|
-
* The payer of the transaction.
|
|
92
|
-
*/
|
|
93
|
-
payer: PublicKey;
|
|
94
|
-
/**
|
|
95
|
-
* address that the lamports are attached to. also defaults to the recipient owner
|
|
96
|
-
*/
|
|
97
|
-
toAddress: PublicKey;
|
|
98
|
-
/**
|
|
99
|
-
* amount of lamports to compress.
|
|
100
|
-
*/
|
|
101
|
-
lamports: number | BN;
|
|
102
|
-
/**
|
|
103
|
-
* The state tree that the tx output should be inserted into. Defaults to a
|
|
104
|
-
* public state tree if unspecified.
|
|
105
|
-
*/
|
|
106
|
-
outputStateTree?: PublicKey;
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Defines the parameters for the transfer method
|
|
110
|
-
*/
|
|
111
|
-
type DecompressParams = {
|
|
112
|
-
/**
|
|
113
|
-
* The payer of the transaction.
|
|
114
|
-
*/
|
|
115
|
-
payer: PublicKey;
|
|
116
|
-
/**
|
|
117
|
-
* The input state to be consumed.
|
|
118
|
-
*/
|
|
119
|
-
inputCompressedAccounts: CompressedAccountWithMerkleContext[];
|
|
120
|
-
/**
|
|
121
|
-
* Recipient address of uncompressed lamports
|
|
122
|
-
*/
|
|
123
|
-
toAddress: PublicKey;
|
|
124
|
-
/**
|
|
125
|
-
* amount of lamports to decompress.
|
|
126
|
-
*/
|
|
127
|
-
lamports: number | BN;
|
|
128
|
-
/**
|
|
129
|
-
* The recent state root indices of the input state. The expiry is tied to
|
|
130
|
-
* the proof.
|
|
131
|
-
*
|
|
132
|
-
* TODO: Add support for passing recent-values after instruction creation.
|
|
133
|
-
*/
|
|
134
|
-
recentInputStateRootIndices: number[];
|
|
135
|
-
/**
|
|
136
|
-
* The recent validity proof for state inclusion of the input state. It
|
|
137
|
-
* expires after n slots.
|
|
138
|
-
*/
|
|
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;
|
|
146
|
-
};
|
|
147
|
-
export declare class LightSystemProgram {
|
|
148
|
-
/**
|
|
149
|
-
* @internal
|
|
150
|
-
*/
|
|
151
|
-
constructor();
|
|
152
|
-
/**
|
|
153
|
-
* Public key that identifies the CompressedPda program
|
|
154
|
-
*/
|
|
155
|
-
static programId: PublicKey;
|
|
156
|
-
/**
|
|
157
|
-
* @internal
|
|
158
|
-
* Cwct1kQLwJm8Z3HetLu8m4SXkhD6FZ5fXbJQCxTxPnGY
|
|
159
|
-
*
|
|
160
|
-
*/
|
|
161
|
-
static deriveCompressedSolPda(): PublicKey;
|
|
162
|
-
static createTransferOutputState(inputCompressedAccounts: CompressedAccountWithMerkleContext[], toAddress: PublicKey, lamports: number | BN): CompressedAccount[];
|
|
163
|
-
static createDecompressOutputState(inputCompressedAccounts: CompressedAccountWithMerkleContext[], lamports: number | BN): CompressedAccount[];
|
|
164
|
-
/**
|
|
165
|
-
* No data by default
|
|
166
|
-
*/
|
|
167
|
-
static createNewAddressOutputState(address: number[], owner: PublicKey, lamports?: BN | number, inputCompressedAccounts?: CompressedAccountWithMerkleContext[]): CompressedAccount[];
|
|
168
|
-
/**
|
|
169
|
-
* Creates instruction to create compressed account with PDA.
|
|
170
|
-
* Cannot write data.
|
|
171
|
-
*
|
|
172
|
-
* TODO: support transfer of lamports to the new account.
|
|
173
|
-
*/
|
|
174
|
-
static createAccount({ payer, newAddressParams, newAddress, recentValidityProof, outputStateTree, inputCompressedAccounts, inputStateRootIndices, lamports, }: CreateAccountWithSeedParams): Promise<TransactionInstruction>;
|
|
175
|
-
/**
|
|
176
|
-
* Creates a transaction instruction that transfers compressed lamports from
|
|
177
|
-
* one owner to another.
|
|
178
|
-
*/
|
|
179
|
-
static transfer({ payer, inputCompressedAccounts, toAddress, lamports, recentInputStateRootIndices, recentValidityProof, outputStateTrees, }: TransferParams): Promise<TransactionInstruction>;
|
|
180
|
-
/**
|
|
181
|
-
* Creates a transaction instruction that transfers compressed lamports from
|
|
182
|
-
* one owner to another.
|
|
183
|
-
*/
|
|
184
|
-
static compress({ payer, toAddress, lamports, outputStateTree, }: CompressParams): Promise<TransactionInstruction>;
|
|
185
|
-
/**
|
|
186
|
-
* Creates a transaction instruction that transfers compressed lamports from
|
|
187
|
-
* one owner to another.
|
|
188
|
-
*/
|
|
189
|
-
static decompress({ payer, inputCompressedAccounts, toAddress, lamports, recentInputStateRootIndices, recentValidityProof, outputStateTree, }: DecompressParams): Promise<TransactionInstruction>;
|
|
190
|
-
}
|
|
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
|
-
export {};
|