@lightprotocol/stateless.js 0.19.0 → 0.20.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.
- package/dist/cjs/browser/constants.d.ts +30 -16
- 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 +107 -107
- package/dist/cjs/browser/rpc.d.ts +8 -9
- package/dist/cjs/browser/state/types.d.ts +24 -0
- package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +5 -6
- package/dist/cjs/browser/utils/get-light-state-tree-info.d.ts +11 -9
- package/dist/cjs/node/constants.d.ts +30 -16
- 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 +107 -107
- package/dist/cjs/node/rpc.d.ts +8 -9
- package/dist/cjs/node/state/types.d.ts +24 -0
- package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +5 -6
- package/dist/cjs/node/utils/get-light-state-tree-info.d.ts +11 -9
- package/dist/types/index.d.ts +75 -39
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { AddressWithTree, CompressedMintTokenHolders, CompressedTransaction, Get
|
|
|
4
4
|
import { CompressedProofWithContext, CompressionApiInterface, GetCompressedTokenAccountsByOwnerOrDelegateOptions, ParsedTokenAccount, TokenBalance } from '../../rpc-interface';
|
|
5
5
|
import { BN254, CompressedAccountWithMerkleContext, MerkleContextWithMerkleProof } from '../../state';
|
|
6
6
|
import { MerkleContextWithNewAddressProof } from '../../rpc';
|
|
7
|
-
import {
|
|
7
|
+
import { ActiveTreeBundle } from '../../state/types';
|
|
8
8
|
export interface TestRpcConfig {
|
|
9
9
|
/**
|
|
10
10
|
* Address of the state tree to index. Default: public default test state
|
|
@@ -75,8 +75,7 @@ export declare class TestRpc extends Connection implements CompressionApiInterfa
|
|
|
75
75
|
lightWasm: LightWasm;
|
|
76
76
|
depth: number;
|
|
77
77
|
log: boolean;
|
|
78
|
-
activeStateTreeInfo:
|
|
79
|
-
fetchStateTreePromise: Promise<ActiveStateTreeAddresses> | null;
|
|
78
|
+
activeStateTreeInfo: ActiveTreeBundle[] | null;
|
|
80
79
|
/**
|
|
81
80
|
* Establish a Compression-compatible JSON RPC mock-connection
|
|
82
81
|
*
|
|
@@ -93,15 +92,15 @@ export declare class TestRpc extends Connection implements CompressionApiInterfa
|
|
|
93
92
|
/**
|
|
94
93
|
* Manually set state tree addresses
|
|
95
94
|
*/
|
|
96
|
-
setStateTreeInfo(info:
|
|
95
|
+
setStateTreeInfo(info: ActiveTreeBundle[]): void;
|
|
97
96
|
/**
|
|
98
97
|
* Returns local test state trees.
|
|
99
98
|
*/
|
|
100
|
-
getCachedActiveStateTreeInfo(): Promise<
|
|
99
|
+
getCachedActiveStateTreeInfo(): Promise<ActiveTreeBundle[]>;
|
|
101
100
|
/**
|
|
102
101
|
* Returns local test state trees.
|
|
103
102
|
*/
|
|
104
|
-
getLatestActiveStateTreeInfo(): Promise<
|
|
103
|
+
getLatestActiveStateTreeInfo(): Promise<ActiveTreeBundle[]>;
|
|
105
104
|
/**
|
|
106
105
|
* Fetch the compressed account for the specified account hash
|
|
107
106
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
|
2
|
+
import { ActiveTreeBundle } from '../state/types';
|
|
2
3
|
/**
|
|
3
4
|
* Create two lookup tables storing all public state tree and queue addresses
|
|
4
5
|
* returns lookup table addresses and txId
|
|
@@ -25,14 +26,16 @@ export declare function createStateTreeLookupTable({ connection, payer, authorit
|
|
|
25
26
|
* @param tableAddress - Address of the lookup table to extend
|
|
26
27
|
* @param newStateTreeAddresses - Addresses of the new state trees to add
|
|
27
28
|
* @param newQueueAddresses - Addresses of the new queues to add
|
|
29
|
+
* @param newCpiContextAddresses - Addresses of the new cpi contexts to add
|
|
28
30
|
* @param payer - Keypair of the payer
|
|
29
31
|
* @param authority - Keypair of the authority
|
|
30
32
|
*/
|
|
31
|
-
export declare function extendStateTreeLookupTable({ connection, tableAddress, newStateTreeAddresses, newQueueAddresses, payer, authority, }: {
|
|
33
|
+
export declare function extendStateTreeLookupTable({ connection, tableAddress, newStateTreeAddresses, newQueueAddresses, newCpiContextAddresses, payer, authority, }: {
|
|
32
34
|
connection: Connection;
|
|
33
35
|
tableAddress: PublicKey;
|
|
34
36
|
newStateTreeAddresses: PublicKey[];
|
|
35
37
|
newQueueAddresses: PublicKey[];
|
|
38
|
+
newCpiContextAddresses: PublicKey[];
|
|
36
39
|
payer: Keypair;
|
|
37
40
|
authority: Keypair;
|
|
38
41
|
}): Promise<{
|
|
@@ -40,12 +43,15 @@ export declare function extendStateTreeLookupTable({ connection, tableAddress, n
|
|
|
40
43
|
txId: string;
|
|
41
44
|
}>;
|
|
42
45
|
/**
|
|
43
|
-
* Adds
|
|
46
|
+
* Adds state tree address to lookup table. Acts as nullifier lookup for rolled
|
|
47
|
+
* over state trees.
|
|
44
48
|
* @internal
|
|
45
49
|
* @param connection - Connection to the Solana network
|
|
46
50
|
* @param stateTreeAddress - Address of the state tree to nullify
|
|
47
|
-
* @param nullifyTableAddress - Address nullifier lookup table to store
|
|
48
|
-
*
|
|
51
|
+
* @param nullifyTableAddress - Address of the nullifier lookup table to store
|
|
52
|
+
* address in
|
|
53
|
+
* @param stateTreeLookupTableAddress - lookup table storing all state tree
|
|
54
|
+
* addresses
|
|
49
55
|
* @param payer - Keypair of the payer
|
|
50
56
|
* @param authority - Keypair of the authority
|
|
51
57
|
*/
|
|
@@ -59,10 +65,6 @@ export declare function nullifyLookupTable({ connection, fullStateTreeAddress, n
|
|
|
59
65
|
}): Promise<{
|
|
60
66
|
txId: string;
|
|
61
67
|
}>;
|
|
62
|
-
export type ActiveStateTreeAddresses = {
|
|
63
|
-
activeStateTrees: PublicKey[];
|
|
64
|
-
activeQueues: PublicKey[];
|
|
65
|
-
};
|
|
66
68
|
/**
|
|
67
69
|
* Get most recent , active state tree data
|
|
68
70
|
* we store in lookup table for each public state tree
|
|
@@ -71,4 +73,4 @@ export declare function getLightStateTreeInfo({ connection, stateTreeLookupTable
|
|
|
71
73
|
connection: Connection;
|
|
72
74
|
stateTreeLookupTableAddress: PublicKey;
|
|
73
75
|
nullifyTableAddress: PublicKey;
|
|
74
|
-
}): Promise<
|
|
76
|
+
}): Promise<ActiveTreeBundle[]>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import BN from 'bn.js';
|
|
2
2
|
import { Buffer } from 'buffer';
|
|
3
3
|
import { ConfirmOptions, PublicKey } from '@solana/web3.js';
|
|
4
|
+
import { ActiveTreeBundle } from './state/types';
|
|
4
5
|
export declare const FIELD_SIZE: BN;
|
|
5
6
|
export declare const HIGHEST_ADDRESS_PLUS_ONE: BN;
|
|
6
7
|
export declare const INVOKE_DISCRIMINATOR: Buffer;
|
|
@@ -17,21 +18,29 @@ export declare const defaultStaticAccountsStruct: () => {
|
|
|
17
18
|
accountCompressionAuthority: PublicKey;
|
|
18
19
|
cpiSignatureAccount: null;
|
|
19
20
|
};
|
|
21
|
+
export type StateTreeLUTPair = {
|
|
22
|
+
stateTreeLookupTable: PublicKey;
|
|
23
|
+
nullifyTable: PublicKey;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Returns the Default Public State Tree LUTs for Devnet and Mainnet-Beta.
|
|
27
|
+
*/
|
|
20
28
|
export declare const defaultStateTreeLookupTables: () => {
|
|
21
|
-
mainnet:
|
|
22
|
-
|
|
23
|
-
nullifyTable: PublicKey;
|
|
24
|
-
};
|
|
25
|
-
devnet: {
|
|
26
|
-
stateTreeLookupTable: PublicKey;
|
|
27
|
-
nullifyTable: PublicKey;
|
|
28
|
-
};
|
|
29
|
+
mainnet: StateTreeLUTPair[];
|
|
30
|
+
devnet: StateTreeLUTPair[];
|
|
29
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
30
35
|
export declare const isLocalTest: (url: string) => boolean;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export declare const localTestActiveStateTreeInfo: () => ActiveTreeBundle[];
|
|
40
|
+
/**
|
|
41
|
+
* Use only with Localnet testing.
|
|
42
|
+
* For public networks, fetch via {@link defaultStateTreeLookupTables} and {@link getLightStateTreeInfo}.
|
|
43
|
+
*/
|
|
35
44
|
export declare const defaultTestStateTreeAccounts: () => {
|
|
36
45
|
nullifierQueue: PublicKey;
|
|
37
46
|
merkleTree: PublicKey;
|
|
@@ -39,20 +48,25 @@ export declare const defaultTestStateTreeAccounts: () => {
|
|
|
39
48
|
addressTree: PublicKey;
|
|
40
49
|
addressQueue: PublicKey;
|
|
41
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* @internal testing only
|
|
53
|
+
*/
|
|
42
54
|
export declare const defaultTestStateTreeAccounts2: () => {
|
|
43
55
|
nullifierQueue2: PublicKey;
|
|
44
56
|
merkleTree2: PublicKey;
|
|
45
57
|
};
|
|
46
|
-
export declare const stateTreeLookupTableMainnet = "
|
|
47
|
-
export declare const nullifiedStateTreeLookupTableMainnet = "
|
|
48
|
-
export declare const stateTreeLookupTableDevnet = "
|
|
49
|
-
export declare const nullifiedStateTreeLookupTableDevnet = "
|
|
58
|
+
export declare const stateTreeLookupTableMainnet = "7i86eQs3GSqHjN47WdWLTCGMW6gde1q96G2EVnUyK2st";
|
|
59
|
+
export declare const nullifiedStateTreeLookupTableMainnet = "H9QD4u1fG7KmkAzn2tDXhheushxFe1EcrjGGyEFXeMqT";
|
|
60
|
+
export declare const stateTreeLookupTableDevnet = "8n8rH2bFRVA6cSGNDpgqcKHCndbFCT1bXxAQG89ejVsh";
|
|
61
|
+
export declare const nullifiedStateTreeLookupTableDevnet = "5dhaJLBjnVBQFErr8oiCJmcVsx3Zj6xDekGB2zULPsnP";
|
|
50
62
|
export declare const nullifierQueuePubkey = "nfq1NvQDJ2GEgnS8zt9prAe8rjjpAW1zFkrvZoBR148";
|
|
63
|
+
export declare const cpiContextPubkey = "cpi1uHzrEhBG733DoEJNgHCyRS3XmmyVNZx5fonubE4";
|
|
51
64
|
export declare const merkletreePubkey = "smt1NamzXdq4AMqS2fS2F1i5KTYPZRhoHgWx38d8WsT";
|
|
52
65
|
export declare const addressTree = "amt1Ayt45jfbdw5YSo7iz6WZxUmnZsQTYXy82hVwyC2";
|
|
53
66
|
export declare const addressQueue = "aq1S9z4reTSQAdgWHGD2zDaS39sjGrAxbR31vxJ2F4F";
|
|
54
67
|
export declare const merkleTree2Pubkey = "smt2rJAFdyJJupwMKAqTNAJwvjhmiZ4JYGZmbVRw1Ho";
|
|
55
68
|
export declare const nullifierQueue2Pubkey = "nfq2hgS7NYemXsFaFUCe3EMXSDSfnZnAe27jC6aPP1X";
|
|
69
|
+
export declare const cpiContext2Pubkey = "cpi2cdhkH5roePvcudTgUL8ppEBfTay1desGh8G8QxK";
|
|
56
70
|
export declare const confirmConfig: ConfirmOptions;
|
|
57
71
|
export declare const DEFAULT_MERKLE_TREE_HEIGHT = 26;
|
|
58
72
|
export declare const DEFAULT_MERKLE_TREE_ROOTS = 2800;
|