@lightprotocol/stateless.js 0.22.0 → 0.22.1-alpha.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/README.md +10 -10
- package/dist/cjs/browser/constants.d.ts +24 -7
- package/dist/cjs/browser/index.cjs +1 -1
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/browser/rpc-interface.d.ts +275 -275
- package/dist/cjs/browser/rpc.d.ts +5 -1
- package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +4 -0
- package/dist/cjs/browser/utils/address.d.ts +7 -6
- package/dist/cjs/browser/utils/conversion.d.ts +1 -0
- package/dist/cjs/browser/utils/index.d.ts +1 -0
- package/dist/cjs/browser/utils/instruction.d.ts +35 -0
- package/dist/cjs/node/constants.d.ts +24 -7
- package/dist/cjs/node/index.cjs +1 -1
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/cjs/node/rpc-interface.d.ts +275 -275
- package/dist/cjs/node/rpc.d.ts +5 -1
- package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +4 -0
- package/dist/cjs/node/utils/address.d.ts +7 -6
- package/dist/cjs/node/utils/conversion.d.ts +1 -0
- package/dist/cjs/node/utils/index.d.ts +1 -0
- package/dist/cjs/node/utils/instruction.d.ts +35 -0
- package/dist/es/browser/actions/compress.d.ts +18 -0
- package/dist/es/browser/actions/create-account.d.ts +38 -0
- package/dist/es/browser/actions/decompress.d.ts +15 -0
- package/dist/es/browser/actions/index.d.ts +5 -0
- package/dist/es/browser/actions/transfer.d.ts +16 -0
- package/dist/es/browser/constants.d.ts +157 -0
- package/dist/es/browser/errors.d.ts +74 -0
- package/dist/es/browser/index.d.ts +9 -0
- package/dist/es/browser/index.js +2 -0
- package/dist/es/browser/index.js.map +1 -0
- package/dist/es/browser/programs/index.d.ts +1 -0
- package/dist/es/browser/programs/system/idl.d.ts +997 -0
- package/dist/es/browser/programs/system/index.d.ts +5 -0
- package/dist/es/browser/programs/system/layout.d.ts +77 -0
- package/dist/es/browser/programs/system/pack.d.ts +74 -0
- package/dist/es/browser/programs/system/program.d.ts +175 -0
- package/dist/es/browser/programs/system/select-compressed-accounts.d.ts +10 -0
- package/dist/es/browser/rpc-interface.d.ts +2779 -0
- package/dist/es/browser/rpc.d.ts +284 -0
- package/dist/es/browser/state/BN254.d.ts +13 -0
- package/dist/es/browser/state/bn.d.ts +3 -0
- package/dist/es/browser/state/compressed-account.d.ts +205 -0
- package/dist/es/browser/state/index.d.ts +4 -0
- package/dist/es/browser/state/types.d.ts +449 -0
- package/dist/es/browser/test-helpers/index.d.ts +3 -0
- package/dist/es/browser/test-helpers/merkle-tree/index.d.ts +2 -0
- package/dist/es/browser/test-helpers/merkle-tree/indexed-array.d.ts +85 -0
- package/dist/es/browser/test-helpers/merkle-tree/merkle-tree.d.ts +92 -0
- package/dist/es/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +7 -0
- package/dist/es/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +40 -0
- package/dist/es/browser/test-helpers/test-rpc/get-parsed-events.d.ts +15 -0
- package/dist/es/browser/test-helpers/test-rpc/index.d.ts +3 -0
- package/dist/es/browser/test-helpers/test-rpc/test-rpc.d.ts +239 -0
- package/dist/es/browser/test-helpers/test-utils.d.ts +31 -0
- package/dist/es/browser/utils/address.d.ts +64 -0
- package/dist/es/browser/utils/airdrop.d.ts +7 -0
- package/dist/es/browser/utils/calculate-compute-unit-price.d.ts +7 -0
- package/dist/es/browser/utils/conversion.d.ts +36 -0
- package/dist/es/browser/utils/dedupe-signer.d.ts +3 -0
- package/dist/es/browser/utils/get-state-tree-infos.d.ts +48 -0
- package/dist/es/browser/utils/index.d.ts +13 -0
- package/dist/es/browser/utils/instruction.d.ts +35 -0
- package/dist/es/browser/utils/parse-validity-proof.d.ts +20 -0
- package/dist/es/browser/utils/pipe.d.ts +2 -0
- package/dist/es/browser/utils/send-and-confirm.d.ts +52 -0
- package/dist/es/browser/utils/sleep.d.ts +1 -0
- package/dist/es/browser/utils/state-tree-lookup-table.d.ts +68 -0
- package/dist/es/browser/utils/validation.d.ts +8 -0
- package/dist/types/index.d.ts +78 -16
- package/package.json +16 -8
|
@@ -12,7 +12,7 @@ export declare function parseAccountData({ discriminator, data, dataHash, }: {
|
|
|
12
12
|
dataHash: BN;
|
|
13
13
|
}): {
|
|
14
14
|
discriminator: number[];
|
|
15
|
-
data: Buffer
|
|
15
|
+
data: Buffer<ArrayBuffer>;
|
|
16
16
|
dataHash: number[];
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
@@ -100,6 +100,10 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
100
100
|
* @internal
|
|
101
101
|
*/
|
|
102
102
|
doFetch(): Promise<TreeInfo[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Get a V2 address tree info.
|
|
105
|
+
*/
|
|
106
|
+
getAddressTreeInfoV2(): Promise<TreeInfo>;
|
|
103
107
|
/**
|
|
104
108
|
* Fetch the compressed account for the specified account address or hash
|
|
105
109
|
*/
|
|
@@ -83,6 +83,10 @@ export declare class TestRpc extends Connection implements CompressionApiInterfa
|
|
|
83
83
|
*/
|
|
84
84
|
getStateTreeInfos(): Promise<TreeInfo[]>;
|
|
85
85
|
doFetch(): Promise<TreeInfo[]>;
|
|
86
|
+
/**
|
|
87
|
+
* Get a V2 address tree info.
|
|
88
|
+
*/
|
|
89
|
+
getAddressTreeInfoV2(): Promise<TreeInfo>;
|
|
86
90
|
/**
|
|
87
91
|
* Fetch the compressed account for the specified account hash
|
|
88
92
|
*/
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { PublicKey } from '@solana/web3.js';
|
|
2
2
|
export declare function deriveAddressSeed(seeds: Uint8Array[], programId: PublicKey): Uint8Array;
|
|
3
|
+
export declare function deriveAddress(seed: Uint8Array, addressMerkleTreePubkey?: PublicKey): PublicKey;
|
|
4
|
+
export declare function deriveAddressSeedV2(seeds: Uint8Array[]): Uint8Array;
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
5
|
-
* tree public key.
|
|
6
|
+
* Derives an address from a seed using the v2 method (matching Rust's derive_address_from_seed)
|
|
6
7
|
*
|
|
7
|
-
* @param
|
|
8
|
-
* @param addressMerkleTreePubkey Merkle tree public key
|
|
9
|
-
*
|
|
8
|
+
* @param addressSeed The address seed (32 bytes)
|
|
9
|
+
* @param addressMerkleTreePubkey Merkle tree public key
|
|
10
|
+
* @param programId Program ID
|
|
10
11
|
* @returns Derived address
|
|
11
12
|
*/
|
|
12
|
-
export declare function
|
|
13
|
+
export declare function deriveAddressV2(addressSeed: Uint8Array, addressMerkleTreePubkey: PublicKey, programId: PublicKey): PublicKey;
|
|
13
14
|
export interface NewAddressParams {
|
|
14
15
|
/**
|
|
15
16
|
* Seed for the compressed account. Must be seed used to derive
|
|
@@ -21,6 +21,7 @@ export declare const toCamelCase: (object: any) => any;
|
|
|
21
21
|
* @deprecated Use `hashvToBn254FieldSizeBe` instead.
|
|
22
22
|
*/
|
|
23
23
|
export declare function hashToBn254FieldSizeBe(bytes: Buffer): [Buffer, number] | null;
|
|
24
|
+
export declare function hashvToBn254FieldSizeBeU8Array(bytes: Uint8Array[]): Uint8Array;
|
|
24
25
|
/**
|
|
25
26
|
* Hash the provided `bytes` with Keccak256 and ensure that the result fits in
|
|
26
27
|
* the BN254 prime field by truncating the resulting hash to 31 bytes.
|
|
@@ -3,6 +3,7 @@ export * from './airdrop';
|
|
|
3
3
|
export * from './calculate-compute-unit-price';
|
|
4
4
|
export * from './conversion';
|
|
5
5
|
export * from './dedupe-signer';
|
|
6
|
+
export * from './instruction';
|
|
6
7
|
export * from './parse-validity-proof';
|
|
7
8
|
export * from './pipe';
|
|
8
9
|
export * from './send-and-confirm';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AccountMeta, PublicKey } from '@solana/web3.js';
|
|
2
|
+
export declare class PackedAccounts {
|
|
3
|
+
private preAccounts;
|
|
4
|
+
private systemAccounts;
|
|
5
|
+
private nextIndex;
|
|
6
|
+
private map;
|
|
7
|
+
static newWithSystemAccounts(config: SystemAccountMetaConfig): PackedAccounts;
|
|
8
|
+
static newWithSystemAccountsV2(config: SystemAccountMetaConfig): PackedAccounts;
|
|
9
|
+
addPreAccountsSigner(pubkey: PublicKey): void;
|
|
10
|
+
addPreAccountsSignerMut(pubkey: PublicKey): void;
|
|
11
|
+
addPreAccountsMeta(accountMeta: AccountMeta): void;
|
|
12
|
+
addSystemAccounts(config: SystemAccountMetaConfig): void;
|
|
13
|
+
addSystemAccountsV2(config: SystemAccountMetaConfig): void;
|
|
14
|
+
insertOrGet(pubkey: PublicKey): number;
|
|
15
|
+
insertOrGetReadOnly(pubkey: PublicKey): number;
|
|
16
|
+
insertOrGetConfig(pubkey: PublicKey, isSigner: boolean, isWritable: boolean): number;
|
|
17
|
+
private hashSetAccountsToMetas;
|
|
18
|
+
private getOffsets;
|
|
19
|
+
toAccountMetas(): {
|
|
20
|
+
remainingAccounts: AccountMeta[];
|
|
21
|
+
systemStart: number;
|
|
22
|
+
packedStart: number;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare class SystemAccountMetaConfig {
|
|
26
|
+
selfProgram: PublicKey;
|
|
27
|
+
cpiContext?: PublicKey;
|
|
28
|
+
solCompressionRecipient?: PublicKey;
|
|
29
|
+
solPoolPda?: PublicKey;
|
|
30
|
+
private constructor();
|
|
31
|
+
static new(selfProgram: PublicKey): SystemAccountMetaConfig;
|
|
32
|
+
static newWithCpiContext(selfProgram: PublicKey, cpiContext: PublicKey): SystemAccountMetaConfig;
|
|
33
|
+
}
|
|
34
|
+
export declare function getLightSystemAccountMetas(config: SystemAccountMetaConfig): AccountMeta[];
|
|
35
|
+
export declare function getLightSystemAccountMetasV2(config: SystemAccountMetaConfig): AccountMeta[];
|
|
@@ -24,11 +24,11 @@ export declare const versionedEndpoint: (base: string) => string;
|
|
|
24
24
|
export declare const FIELD_SIZE: BN;
|
|
25
25
|
export declare const HIGHEST_ADDRESS_PLUS_ONE: BN;
|
|
26
26
|
export declare const COMPUTE_BUDGET_PATTERN: number[];
|
|
27
|
-
export declare const INVOKE_DISCRIMINATOR: Buffer
|
|
28
|
-
export declare const INVOKE_CPI_DISCRIMINATOR: Buffer
|
|
29
|
-
export declare const INVOKE_CPI_WITH_READ_ONLY_DISCRIMINATOR: Buffer
|
|
30
|
-
export declare const INVOKE_CPI_WITH_ACCOUNT_INFO_DISCRIMINATOR: Buffer
|
|
31
|
-
export declare const INSERT_INTO_QUEUES_DISCRIMINATOR: Buffer
|
|
27
|
+
export declare const INVOKE_DISCRIMINATOR: Buffer<ArrayBuffer>;
|
|
28
|
+
export declare const INVOKE_CPI_DISCRIMINATOR: Buffer<ArrayBuffer>;
|
|
29
|
+
export declare const INVOKE_CPI_WITH_READ_ONLY_DISCRIMINATOR: Buffer<ArrayBuffer>;
|
|
30
|
+
export declare const INVOKE_CPI_WITH_ACCOUNT_INFO_DISCRIMINATOR: Buffer<ArrayBuffer>;
|
|
31
|
+
export declare const INSERT_INTO_QUEUES_DISCRIMINATOR: Buffer<ArrayBuffer>;
|
|
32
32
|
export declare const noopProgram = "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV";
|
|
33
33
|
export declare const lightSystemProgram = "SySTEM1eSU2p4BGQfQpimFEWWSC1XDFeun3Nqzz3rT7";
|
|
34
34
|
export declare const accountCompressionProgram = "compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq";
|
|
@@ -101,8 +101,25 @@ export declare const addressQueue = "aq1S9z4reTSQAdgWHGD2zDaS39sjGrAxbR31vxJ2F4F
|
|
|
101
101
|
export declare const merkleTree2Pubkey = "smt2rJAFdyJJupwMKAqTNAJwvjhmiZ4JYGZmbVRw1Ho";
|
|
102
102
|
export declare const nullifierQueue2Pubkey = "nfq2hgS7NYemXsFaFUCe3EMXSDSfnZnAe27jC6aPP1X";
|
|
103
103
|
export declare const cpiContext2Pubkey = "cpi2cdhkH5roePvcudTgUL8ppEBfTay1desGh8G8QxK";
|
|
104
|
-
export declare const
|
|
105
|
-
export declare const
|
|
104
|
+
export declare const batchMerkleTree1 = "bmt1LryLZUMmF7ZtqESaw7wifBXLfXHQYoE4GAmrahU";
|
|
105
|
+
export declare const batchQueue1 = "oq1na8gojfdUhsfCpyjNt6h4JaDWtHf1yQj4koBWfto";
|
|
106
|
+
export declare const batchCpiContext1 = "cpi15BoVPKgEPw5o8wc2T816GE7b378nMXnhH3Xbq4y";
|
|
107
|
+
export declare const batchMerkleTree2 = "bmt2UxoBxB9xWev4BkLvkGdapsz6sZGkzViPNph7VFi";
|
|
108
|
+
export declare const batchQueue2 = "oq2UkeMsJLfXt2QHzim242SUi3nvjJs8Pn7Eac9H9vg";
|
|
109
|
+
export declare const batchCpiContext2 = "cpi2yGapXUR3As5SjnHBAVvmApNiLsbeZpF3euWnW6B";
|
|
110
|
+
export declare const batchMerkleTree3 = "bmt3ccLd4bqSVZVeCJnH1F6C8jNygAhaDfxDwePyyGb";
|
|
111
|
+
export declare const batchQueue3 = "oq3AxjekBWgo64gpauB6QtuZNesuv19xrhaC1ZM1THQ";
|
|
112
|
+
export declare const batchCpiContext3 = "cpi3mbwMpSX8FAGMZVP85AwxqCaQMfEk9Em1v8QK9Rf";
|
|
113
|
+
export declare const batchMerkleTree4 = "bmt4d3p1a4YQgk9PeZv5s4DBUmbF5NxqYpk9HGjQsd8";
|
|
114
|
+
export declare const batchQueue4 = "oq4ypwvVGzCUMoiKKHWh4S1SgZJ9vCvKpcz6RT6A8dq";
|
|
115
|
+
export declare const batchCpiContext4 = "cpi4yyPDc4bCgHAnsenunGA8Y77j3XEDyjgfyCKgcoc";
|
|
116
|
+
export declare const batchMerkleTree5 = "bmt5yU97jC88YXTuSukYHa8Z5Bi2ZDUtmzfkDTA2mG2";
|
|
117
|
+
export declare const batchQueue5 = "oq5oh5ZR3yGomuQgFduNDzjtGvVWfDRGLuDVjv9a96P";
|
|
118
|
+
export declare const batchCpiContext5 = "cpi5ZTjdgYpZ1Xr7B1cMLLUE81oTtJbNNAyKary2nV6";
|
|
119
|
+
export declare const batchAddressTree = "amt2kaJA14v3urZbZvnc5v2np8jqvc4Z8zDep5wbtzx";
|
|
120
|
+
export declare const testBatchAddressTree = "EzKE84aVTkCUhDHLELqyJaq1Y7UVVmqxXqZjVHwHY3rK";
|
|
121
|
+
export declare const batchMerkleTree = "bmt1LryLZUMmF7ZtqESaw7wifBXLfXHQYoE4GAmrahU";
|
|
122
|
+
export declare const batchQueue = "oq1na8gojfdUhsfCpyjNt6h4JaDWtHf1yQj4koBWfto";
|
|
106
123
|
export declare const confirmConfig: ConfirmOptions;
|
|
107
124
|
export declare const DEFAULT_MERKLE_TREE_HEIGHT = 26;
|
|
108
125
|
export declare const DEFAULT_MERKLE_TREE_ROOTS = 2800;
|