@lightprotocol/stateless.js 0.1.0-alpha.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 (44) hide show
  1. package/README.md +58 -0
  2. package/dist/cjs/index.cjs +4031 -0
  3. package/dist/es/index.js +3988 -0
  4. package/dist/types/actions/common.d.ts +3 -0
  5. package/dist/types/actions/compress-lamports.d.ts +16 -0
  6. package/dist/types/actions/decompress-lamports.d.ts +16 -0
  7. package/dist/types/actions/index.d.ts +4 -0
  8. package/dist/types/actions/init-sol-omnibus-account.d.ts +13 -0
  9. package/dist/types/constants.d.ts +34 -0
  10. package/dist/types/errors.d.ts +74 -0
  11. package/dist/types/idls/account_compression.d.ts +932 -0
  12. package/dist/types/idls/index.d.ts +5 -0
  13. package/dist/types/idls/light.d.ts +192 -0
  14. package/dist/types/idls/psp_compressed_pda.d.ts +607 -0
  15. package/dist/types/idls/user_registry.d.ts +69 -0
  16. package/dist/types/index.d.ts +12 -0
  17. package/dist/types/instruction/index.d.ts +1 -0
  18. package/dist/types/instruction/pack-compressed-accounts.d.ts +30 -0
  19. package/dist/types/programs/compressed-pda.d.ts +148 -0
  20. package/dist/types/programs/index.d.ts +1 -0
  21. package/dist/types/rpc-interface.d.ts +430 -0
  22. package/dist/types/rpc.d.ts +26 -0
  23. package/dist/types/state/BN254.d.ts +20 -0
  24. package/dist/types/state/compressed-account.d.ts +35 -0
  25. package/dist/types/state/index.d.ts +3 -0
  26. package/dist/types/state/types.d.ts +108 -0
  27. package/dist/types/test-utils/common.d.ts +32 -0
  28. package/dist/types/test-utils/index.d.ts +5 -0
  29. package/dist/types/test-utils/merkle-tree.d.ts +92 -0
  30. package/dist/types/test-utils/parse-event.d.ts +7 -0
  31. package/dist/types/test-utils/parse-validity-proof.d.ts +20 -0
  32. package/dist/types/test-utils/test-rpc.d.ts +51 -0
  33. package/dist/types/utils/airdrop.d.ts +7 -0
  34. package/dist/types/utils/conversion.d.ts +10 -0
  35. package/dist/types/utils/index.d.ts +6 -0
  36. package/dist/types/utils/pipe.d.ts +2 -0
  37. package/dist/types/utils/send-and-confirm.d.ts +18 -0
  38. package/dist/types/utils/sleep.d.ts +1 -0
  39. package/dist/types/utils/validation.d.ts +4 -0
  40. package/dist/types/wallet/index.d.ts +1 -0
  41. package/dist/types/wallet/interface.d.ts +25 -0
  42. package/dist/types/wallet/use-wallet.d.ts +9 -0
  43. package/dist/umd/index.js +4027 -0
  44. package/package.json +81 -0
@@ -0,0 +1,3 @@
1
+ import { Signer } from '@solana/web3.js';
2
+ /** @internal remove signer from signers if part of signers */
3
+ export declare function dedupeSigner(signer: Signer, signers: Signer[]): Signer[];
@@ -0,0 +1,16 @@
1
+ import { ConfirmOptions, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
2
+ import { Rpc } from '../rpc';
3
+ import { BN } from '@coral-xyz/anchor';
4
+ /**
5
+ * Init the SOL omnibus account for Light
6
+ *
7
+ * @param rpc RPC to use
8
+ * @param payer Payer of the transaction and initialization fees
9
+ * @param lamports Amount of lamports to compress
10
+ * @param toAddress Address of the recipient compressed account
11
+ * @param outputStateTree Optional output state tree. Defaults to a current shared state tree.
12
+ * @param confirmOptions Options for confirming the transaction
13
+ *
14
+ * @return Transaction signature
15
+ */
16
+ export declare function compressLamports(rpc: Rpc, payer: Signer, lamports: number | BN, toAddress: PublicKey, outputStateTree?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
@@ -0,0 +1,16 @@
1
+ import { ConfirmOptions, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
2
+ import { Rpc } from '../rpc';
3
+ import { BN } from '@coral-xyz/anchor';
4
+ /**
5
+ * Init the SOL omnibus account for Light
6
+ *
7
+ * @param rpc RPC to use
8
+ * @param payer Payer of the transaction and initialization fees
9
+ * @param lamports Amount of lamports to compress
10
+ * @param toAddress Address of the recipient compressed account
11
+ * @param outputStateTree Optional output state tree. Defaults to a current shared state tree.
12
+ * @param confirmOptions Options for confirming the transaction
13
+ *
14
+ * @return Transaction signature
15
+ */
16
+ export declare function decompressLamports(rpc: Rpc, payer: Signer, lamports: number | BN, recipient: PublicKey, outputStateTree?: PublicKey, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
@@ -0,0 +1,4 @@
1
+ export * from './compress-lamports';
2
+ export * from './decompress-lamports';
3
+ export * from './init-sol-omnibus-account';
4
+ export * from './common';
@@ -0,0 +1,13 @@
1
+ import { ConfirmOptions, Signer, TransactionSignature } from '@solana/web3.js';
2
+ import { Rpc } from '../rpc';
3
+ /**
4
+ * Init the SOL omnibus account for Light
5
+ *
6
+ * @param rpc RPC to use
7
+ * @param payer Payer of the transaction and initialization fees
8
+ * @param initAuthority Init authority.
9
+ * @param confirmOptions Options for confirming the transaction
10
+ *
11
+ * @return Transaction signature
12
+ */
13
+ export declare function initSolOmnibusAccount(rpc: Rpc, payer: Signer, initAuthority?: Signer, confirmOptions?: ConfirmOptions): Promise<TransactionSignature>;
@@ -0,0 +1,34 @@
1
+ import { BN } from '@coral-xyz/anchor';
2
+ import { ConfirmOptions, PublicKey } from '@solana/web3.js';
3
+ export declare const FIELD_SIZE: BN;
4
+ export declare const noopProgram = "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV";
5
+ export declare const lightProgram = "5WzvRtu7LABotw1SUEpguJiKU27LRGsiCnF5FH6VV7yP";
6
+ export declare const accountCompressionProgram = "5QPEJ5zDsVou9FQS3KCauKswM3VwBEBu4dpL9xTqkWwN";
7
+ export declare const getRegisteredProgramPda: () => PublicKey;
8
+ export declare const getPspAccountCompressionAuthority: () => PublicKey;
9
+ export declare const defaultStaticAccounts: () => PublicKey[];
10
+ export declare const defaultStaticAccountsStruct: () => {
11
+ registeredProgramPda: PublicKey;
12
+ noopProgram: PublicKey;
13
+ accountCompressionProgram: PublicKey;
14
+ pspAccountCompressionAuthority: PublicKey;
15
+ cpiSignatureAccount: null;
16
+ };
17
+ export declare const defaultTestStateTreeAccounts: () => {
18
+ nullifierQueue: PublicKey;
19
+ merkleTree: PublicKey;
20
+ merkleTreeHeight: number;
21
+ };
22
+ export declare const nullifierQueuePubkey = "44J4oDXpjPAbzHCSc24q7NEiPekss4sAbLd8ka4gd9CZ";
23
+ export declare const merkletreePubkey = "5bdFnXU47QjzGpzHfXnxcEi5WXyxzEAZzd1vrE39bf1W";
24
+ export declare const confirmConfig: ConfirmOptions;
25
+ export declare const DEFAULT_MERKLE_TREE_HEIGHT = 26;
26
+ export declare const DEFAULT_MERKLE_TREE_ROOTS = 2800;
27
+ /** Threshold (per asset) at which new in-UTXOs get merged, in order to reduce UTXO pool size */
28
+ export declare const UTXO_MERGE_THRESHOLD = 20;
29
+ export declare const UTXO_MERGE_MAXIMUM = 10;
30
+ /**
31
+ * Treshold after which the currently used transaction Merkle tree is switched
32
+ * to the next one
33
+ */
34
+ export declare const TRANSACTION_MERKLE_TREE_ROLLOVER_THRESHOLD: BN;
@@ -0,0 +1,74 @@
1
+ export declare enum UtxoErrorCode {
2
+ NEGATIVE_LAMPORTS = "NEGATIVE_LAMPORTS",
3
+ NOT_U64 = "NOT_U64",
4
+ BLINDING_EXCEEDS_FIELD_SIZE = "BLINDING_EXCEEDS_FIELD_SIZE"
5
+ }
6
+ export declare enum SelectInUtxosErrorCode {
7
+ FAILED_TO_FIND_UTXO_COMBINATION = "FAILED_TO_FIND_UTXO_COMBINATION",
8
+ INVALID_NUMBER_OF_IN_UTXOS = "INVALID_NUMBER_OF_IN_UTXOS"
9
+ }
10
+ export declare enum CreateUtxoErrorCode {
11
+ OWNER_UNDEFINED = "OWNER_UNDEFINED",
12
+ INVALID_OUTPUT_UTXO_LENGTH = "INVALID_OUTPUT_UTXO_LENGTH",
13
+ UTXO_DATA_UNDEFINED = "UTXO_DATA_UNDEFINED"
14
+ }
15
+ export declare enum RpcErrorCode {
16
+ CONNECTION_UNDEFINED = "CONNECTION_UNDEFINED",
17
+ RPC_PUBKEY_UNDEFINED = "RPC_PUBKEY_UNDEFINED",
18
+ RPC_METHOD_NOT_IMPLEMENTED = "RPC_METHOD_NOT_IMPLEMENTED",
19
+ RPC_INVALID = "RPC_INVALID"
20
+ }
21
+ export declare enum LookupTableErrorCode {
22
+ LOOK_UP_TABLE_UNDEFINED = "LOOK_UP_TABLE_UNDEFINED",
23
+ LOOK_UP_TABLE_NOT_INITIALIZED = "LOOK_UP_TABLE_NOT_INITIALIZED"
24
+ }
25
+ export declare enum HashErrorCode {
26
+ NO_POSEIDON_HASHER_PROVIDED = "NO_POSEIDON_HASHER_PROVIDED"
27
+ }
28
+ export declare enum ProofErrorCode {
29
+ INVALID_PROOF = "INVALID_PROOF",
30
+ PROOF_INPUT_UNDEFINED = "PROOF_INPUT_UNDEFINED",
31
+ PROOF_GENERATION_FAILED = "PROOF_GENERATION_FAILED"
32
+ }
33
+ export declare enum MerkleTreeErrorCode {
34
+ MERKLE_TREE_NOT_INITIALIZED = "MERKLE_TREE_NOT_INITIALIZED",
35
+ SOL_MERKLE_TREE_UNDEFINED = "SOL_MERKLE_TREE_UNDEFINED",
36
+ MERKLE_TREE_UNDEFINED = "MERKLE_TREE_UNDEFINED",
37
+ INPUT_UTXO_NOT_INSERTED_IN_MERKLE_TREE = "INPUT_UTXO_NOT_INSERTED_IN_MERKLE_TREE",
38
+ MERKLE_TREE_INDEX_UNDEFINED = "MERKLE_TREE_INDEX_UNDEFINED",
39
+ MERKLE_TREE_SET_SPACE_UNDEFINED = "MERKLE_TREE_SET_SPACE_UNDEFINED"
40
+ }
41
+ export declare enum UtilsErrorCode {
42
+ ACCOUNT_NAME_UNDEFINED_IN_IDL = "ACCOUNT_NAME_UNDEFINED_IN_IDL",
43
+ PROPERTY_UNDEFINED = "PROPERTY_UNDEFINED",
44
+ LOOK_UP_TABLE_CREATION_FAILED = "LOOK_UP_TABLE_CREATION_FAILED",
45
+ UNSUPPORTED_ARCHITECTURE = "UNSUPPORTED_ARCHITECTURE",
46
+ UNSUPPORTED_PLATFORM = "UNSUPPORTED_PLATFORM",
47
+ ACCOUNTS_UNDEFINED = "ACCOUNTS_UNDEFINED",
48
+ INVALID_NUMBER = "INVALID_NUMBER"
49
+ }
50
+ declare class MetaError extends Error {
51
+ code: string;
52
+ functionName: string;
53
+ codeMessage?: string;
54
+ constructor(code: string, functionName: string, codeMessage?: string);
55
+ }
56
+ export declare class UtxoError extends MetaError {
57
+ }
58
+ export declare class SelectInUtxosError extends MetaError {
59
+ }
60
+ export declare class CreateUtxoError extends MetaError {
61
+ }
62
+ export declare class RpcError extends MetaError {
63
+ }
64
+ export declare class LookupTableError extends MetaError {
65
+ }
66
+ export declare class HashError extends MetaError {
67
+ }
68
+ export declare class ProofError extends MetaError {
69
+ }
70
+ export declare class MerkleTreeError extends MetaError {
71
+ }
72
+ export declare class UtilsError extends MetaError {
73
+ }
74
+ export {};