@lightprotocol/stateless.js 0.20.9 → 0.22.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.
Files changed (76) hide show
  1. package/dist/cjs/browser/actions/compress.d.ts +9 -7
  2. package/dist/cjs/browser/actions/create-account.d.ts +25 -28
  3. package/dist/cjs/browser/actions/decompress.d.ts +6 -7
  4. package/dist/cjs/browser/actions/index.d.ts +1 -1
  5. package/dist/cjs/browser/actions/transfer.d.ts +7 -11
  6. package/dist/cjs/browser/constants.d.ts +40 -7
  7. package/dist/cjs/browser/index.cjs +1 -1
  8. package/dist/cjs/browser/index.cjs.map +1 -1
  9. package/dist/cjs/browser/index.d.ts +1 -3
  10. package/dist/cjs/browser/programs/index.d.ts +0 -1
  11. package/dist/cjs/{node → browser/programs/system}/idl.d.ts +5 -27
  12. package/dist/cjs/browser/programs/system/index.d.ts +5 -0
  13. package/dist/cjs/browser/programs/{layout.d.ts → system/layout.d.ts} +37 -1
  14. package/dist/cjs/browser/programs/system/pack.d.ts +74 -0
  15. package/dist/cjs/browser/programs/{system.d.ts → system/program.d.ts} +25 -49
  16. package/dist/cjs/browser/programs/system/select-compressed-accounts.d.ts +10 -0
  17. package/dist/cjs/browser/rpc-interface.d.ts +1689 -82
  18. package/dist/cjs/browser/rpc.d.ts +27 -67
  19. package/dist/cjs/browser/state/BN254.d.ts +0 -1
  20. package/dist/cjs/browser/state/bn.d.ts +3 -0
  21. package/dist/cjs/browser/state/compressed-account.d.ts +189 -15
  22. package/dist/cjs/browser/state/index.d.ts +1 -0
  23. package/dist/cjs/browser/state/types.d.ts +345 -31
  24. package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +3 -3
  25. package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +21 -49
  26. package/dist/cjs/browser/utils/calculate-compute-unit-price.d.ts +1 -1
  27. package/dist/cjs/browser/utils/conversion.d.ts +2 -0
  28. package/dist/cjs/browser/utils/get-state-tree-infos.d.ts +48 -0
  29. package/dist/cjs/browser/utils/index.d.ts +4 -2
  30. package/dist/cjs/browser/utils/parse-validity-proof.d.ts +3 -3
  31. package/dist/cjs/browser/utils/send-and-confirm.d.ts +1 -1
  32. package/dist/cjs/browser/utils/state-tree-lookup-table.d.ts +68 -0
  33. package/dist/cjs/browser/utils/validation.d.ts +2 -2
  34. package/dist/cjs/node/actions/compress.d.ts +9 -7
  35. package/dist/cjs/node/actions/create-account.d.ts +25 -28
  36. package/dist/cjs/node/actions/decompress.d.ts +6 -7
  37. package/dist/cjs/node/actions/index.d.ts +1 -1
  38. package/dist/cjs/node/actions/transfer.d.ts +7 -11
  39. package/dist/cjs/node/constants.d.ts +40 -7
  40. package/dist/cjs/node/index.cjs +1 -1
  41. package/dist/cjs/node/index.cjs.map +1 -1
  42. package/dist/cjs/node/index.d.ts +1 -3
  43. package/dist/cjs/node/programs/index.d.ts +0 -1
  44. package/dist/cjs/{browser → node/programs/system}/idl.d.ts +5 -27
  45. package/dist/cjs/node/programs/system/index.d.ts +5 -0
  46. package/dist/cjs/node/programs/{layout.d.ts → system/layout.d.ts} +37 -1
  47. package/dist/cjs/node/programs/system/pack.d.ts +74 -0
  48. package/dist/cjs/node/programs/{system.d.ts → system/program.d.ts} +25 -49
  49. package/dist/cjs/node/programs/system/select-compressed-accounts.d.ts +10 -0
  50. package/dist/cjs/node/rpc-interface.d.ts +1689 -82
  51. package/dist/cjs/node/rpc.d.ts +27 -67
  52. package/dist/cjs/node/state/BN254.d.ts +0 -1
  53. package/dist/cjs/node/state/bn.d.ts +3 -0
  54. package/dist/cjs/node/state/compressed-account.d.ts +189 -15
  55. package/dist/cjs/node/state/index.d.ts +1 -0
  56. package/dist/cjs/node/state/types.d.ts +345 -31
  57. package/dist/cjs/node/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +3 -3
  58. package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +21 -49
  59. package/dist/cjs/node/utils/calculate-compute-unit-price.d.ts +1 -1
  60. package/dist/cjs/node/utils/conversion.d.ts +2 -0
  61. package/dist/cjs/node/utils/get-state-tree-infos.d.ts +48 -0
  62. package/dist/cjs/node/utils/index.d.ts +4 -2
  63. package/dist/cjs/node/utils/parse-validity-proof.d.ts +3 -3
  64. package/dist/cjs/node/utils/send-and-confirm.d.ts +1 -1
  65. package/dist/cjs/node/utils/state-tree-lookup-table.d.ts +68 -0
  66. package/dist/cjs/node/utils/validation.d.ts +2 -2
  67. package/dist/types/index.d.ts +3177 -1063
  68. package/package.json +16 -8
  69. package/dist/cjs/browser/instruction/index.d.ts +0 -1
  70. package/dist/cjs/browser/instruction/pack-compressed-accounts.d.ts +0 -51
  71. package/dist/cjs/browser/utils/get-light-state-tree-info.d.ts +0 -76
  72. package/dist/cjs/node/instruction/index.d.ts +0 -1
  73. package/dist/cjs/node/instruction/pack-compressed-accounts.d.ts +0 -51
  74. package/dist/cjs/node/utils/get-light-state-tree-info.d.ts +0 -76
  75. /package/dist/cjs/browser/{actions/common.d.ts → utils/dedupe-signer.d.ts} +0 -0
  76. /package/dist/cjs/node/{actions/common.d.ts → utils/dedupe-signer.d.ts} +0 -0
@@ -0,0 +1,48 @@
1
+ import { Connection, PublicKey } from '@solana/web3.js';
2
+ import { TreeInfo, TreeType } from '../state/types';
3
+ import { StateTreeLUTPair } from '../constants';
4
+ /**
5
+ * @deprecated use {@link getTreeInfoByPubkey} instead
6
+ */
7
+ export declare function getStateTreeInfoByPubkey(treeInfos: TreeInfo[], treeOrQueue: PublicKey): TreeInfo;
8
+ export declare function getTreeInfoByPubkey(treeInfos: TreeInfo[], treeOrQueue: PublicKey): TreeInfo;
9
+ /**
10
+ * @deprecated use {@link selectStateTreeInfo} instead.
11
+ *
12
+ * Get a random tree and queue from a set of provided state tree infos.
13
+ *
14
+ * @param infos Set of state tree infos
15
+ * @returns A random tree and queue
16
+ */
17
+ export declare function pickRandomTreeAndQueue(infos: TreeInfo[]): {
18
+ tree: PublicKey;
19
+ queue: PublicKey;
20
+ };
21
+ /**
22
+ * Select a pseudo-random active state tree info from the set of provided state
23
+ * tree infos.
24
+ *
25
+ * Using this reduces write-lock contention on state trees.
26
+ *
27
+ * @param infos Set of state tree infos
28
+ *
29
+ * @param treeType Optional: Only use if you know what you are
30
+ * doing. The type of tree.
31
+ * @param useMaxConcurrency Optional: Only use if you know what you are
32
+ * doing. If true, select from all infos.
33
+ *
34
+ * @returns A pseudo-randomly selected tree info
35
+ */
36
+ export declare function selectStateTreeInfo(infos: TreeInfo[], treeType?: TreeType, useMaxConcurrency?: boolean): TreeInfo;
37
+ /**
38
+ * Get active state tree infos from LUTs.
39
+ *
40
+ * @param connection The connection to the cluster
41
+ * @param stateTreeLUTPairs The state tree lookup table pairs
42
+ *
43
+ * @returns The active state tree infos
44
+ */
45
+ export declare function getAllStateTreeInfos({ connection, stateTreeLUTPairs, }: {
46
+ connection: Connection;
47
+ stateTreeLUTPairs: StateTreeLUTPair[];
48
+ }): Promise<TreeInfo[]>;
@@ -1,10 +1,12 @@
1
1
  export * from './address';
2
2
  export * from './airdrop';
3
+ export * from './calculate-compute-unit-price';
3
4
  export * from './conversion';
5
+ export * from './dedupe-signer';
4
6
  export * from './parse-validity-proof';
5
7
  export * from './pipe';
6
8
  export * from './send-and-confirm';
7
9
  export * from './sleep';
8
10
  export * from './validation';
9
- export * from './calculate-compute-unit-price';
10
- export * from './get-light-state-tree-info';
11
+ export * from './state-tree-lookup-table';
12
+ export * from './get-state-tree-infos';
@@ -1,4 +1,4 @@
1
- import { CompressedProof } from '../state';
1
+ import { ValidityProof } from '../state';
2
2
  interface GnarkProofJson {
3
3
  ar: string[];
4
4
  bs: string[][];
@@ -14,7 +14,7 @@ export declare const placeholderValidityProof: () => {
14
14
  b: number[];
15
15
  c: number[];
16
16
  };
17
- export declare const checkValidityProofShape: (proof: CompressedProof) => void;
17
+ export declare const checkValidityProofShape: (proof: ValidityProof) => void;
18
18
  export declare function proofFromJsonStruct(json: GnarkProofJson): ProofABC;
19
- export declare function negateAndCompressProof(proof: ProofABC): CompressedProof;
19
+ export declare function negateAndCompressProof(proof: ProofABC): ValidityProof;
20
20
  export {};
@@ -34,7 +34,7 @@ export declare function sendAndConfirmTx(rpc: Rpc, tx: VersionedTransaction, con
34
34
  * @param blockHashCtx blockhash context for confirmation
35
35
  * @return SignatureResult
36
36
  */
37
- export declare function confirmTx(rpc: Rpc, txId: string, confirmOptions?: ConfirmOptions, blockHashCtx?: {
37
+ export declare function confirmTx(rpc: Rpc, txId: string, confirmOptions?: ConfirmOptions, _blockHashCtx?: {
38
38
  blockhash: string;
39
39
  lastValidBlockHeight: number;
40
40
  }): Promise<RpcResponseAndContext<SignatureResult>>;
@@ -0,0 +1,68 @@
1
+ import { PublicKey, Keypair, Connection } from '@solana/web3.js';
2
+ /**
3
+ * Create two lookup tables storing all public state tree and queue addresses
4
+ * returns lookup table addresses and txId
5
+ *
6
+ * @internal
7
+ * @param connection Connection to the Solana network
8
+ * @param payer Keypair of the payer
9
+ * @param authority Keypair of the authority
10
+ * @param recentSlot Slot of the recent block
11
+ */
12
+ export declare function createStateTreeLookupTable({ connection, payer, authority, recentSlot, }: {
13
+ connection: Connection;
14
+ payer: Keypair;
15
+ authority: Keypair;
16
+ recentSlot: number;
17
+ }): Promise<{
18
+ address: PublicKey;
19
+ txId: string;
20
+ }>;
21
+ /**
22
+ * Extend state tree lookup table with new state tree and queue addresses
23
+ *
24
+ * @internal
25
+ * @param connection Connection to the Solana network
26
+ * @param tableAddress Address of the lookup table to extend
27
+ * @param newStateTreeAddresses Addresses of the new state trees to add
28
+ * @param newQueueAddresses Addresses of the new queues to add
29
+ * @param newCpiContextAddresses Addresses of the new cpi contexts to add
30
+ * @param payer Keypair of the payer
31
+ * @param authority Keypair of the authority
32
+ */
33
+ export declare function extendStateTreeLookupTable({ connection, tableAddress, newStateTreeAddresses, newQueueAddresses, newCpiContextAddresses, payer, authority, }: {
34
+ connection: Connection;
35
+ tableAddress: PublicKey;
36
+ newStateTreeAddresses: PublicKey[];
37
+ newQueueAddresses: PublicKey[];
38
+ newCpiContextAddresses: PublicKey[];
39
+ payer: Keypair;
40
+ authority: Keypair;
41
+ }): Promise<{
42
+ tableAddress: PublicKey;
43
+ txId: string;
44
+ }>;
45
+ /**
46
+ * Adds state tree address to lookup table. Acts as nullifier lookup for rolled
47
+ * over state trees.
48
+ *
49
+ * @internal
50
+ * @param connection Connection to the Solana network
51
+ * @param stateTreeAddress Address of the state tree to nullify
52
+ * @param nullifyLookupTableAddress Address of the nullifier lookup table to
53
+ * store address in
54
+ * @param stateTreeLookupTableAddress lookup table storing all state tree
55
+ * addresses
56
+ * @param payer Keypair of the payer
57
+ * @param authority Keypair of the authority
58
+ */
59
+ export declare function nullifyLookupTable({ connection, fullStateTreeAddress, nullifyLookupTableAddress, stateTreeLookupTableAddress, payer, authority, }: {
60
+ connection: Connection;
61
+ fullStateTreeAddress: PublicKey;
62
+ nullifyLookupTableAddress: PublicKey;
63
+ stateTreeLookupTableAddress: PublicKey;
64
+ payer: Keypair;
65
+ authority: Keypair;
66
+ }): Promise<{
67
+ txId: string;
68
+ }>;
@@ -1,7 +1,7 @@
1
1
  import BN from 'bn.js';
2
- import { CompressedAccount, CompressedAccountWithMerkleContext } from '../state';
2
+ import { CompressedAccountLegacy, CompressedAccountWithMerkleContext } from '../state';
3
3
  export declare const validateSufficientBalance: (balance: BN) => void;
4
- export declare const validateSameOwner: (compressedAccounts: CompressedAccount[] | CompressedAccountWithMerkleContext[]) => void;
4
+ export declare const validateSameOwner: (compressedAccounts: CompressedAccountLegacy[] | CompressedAccountWithMerkleContext[]) => void;
5
5
  export declare const validateNumbersForProof: (hashesLength: number, newAddressesLength: number) => void;
6
6
  export declare const validateNumbersForInclusionProof: (hashesLength: number) => void;
7
7
  export declare const validateNumbersForNonInclusionProof: (newAddressesLength: number) => void;