@lightprotocol/stateless.js 0.17.2-alpha.0 → 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 +110 -117
- package/dist/cjs/browser/rpc.d.ts +2 -57
- package/dist/cjs/browser/state/types.d.ts +5 -0
- package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +2 -3
- 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 +110 -117
- package/dist/cjs/node/rpc.d.ts +2 -57
- package/dist/cjs/node/state/types.d.ts +5 -0
- package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +2 -3
- package/dist/cjs/node/utils/test-utils.d.ts +8 -0
- package/dist/types/index.d.ts +1036 -193
- package/package.json +9 -8
- package/dist/cjs/browser/connection-interface.d.ts +0 -125
- package/dist/cjs/node/connection-interface.d.ts +0 -125
- 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/connection-interface.d.ts +0 -125
- 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 -330
- 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 -250
- 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,4 +1,4 @@
|
|
|
1
|
-
import { Connection, ConnectionConfig,
|
|
1
|
+
import { Connection, ConnectionConfig, PublicKey } from '@solana/web3.js';
|
|
2
2
|
import { Buffer } from 'buffer';
|
|
3
3
|
import { CompressedProofWithContext, CompressedTransaction, CompressionApiInterface, GetCompressedTokenAccountsByOwnerOrDelegateOptions, HexInputsForProver, ParsedTokenAccount, SignatureWithMetadata, LatestNonVotingSignatures, LatestNonVotingSignaturesPaginated, WithContext, GetCompressedAccountsByOwnerConfig, WithCursor, AddressWithTree, HashWithTree, CompressedMintTokenHolders, TokenBalance, PaginatedOptions } from './rpc-interface';
|
|
4
4
|
import { MerkleContextWithMerkleProof, BN254, CompressedAccountWithMerkleContext, CompressedProof } from './state';
|
|
@@ -61,13 +61,11 @@ export type NonInclusionJsonStruct = {
|
|
|
61
61
|
export declare function convertMerkleProofsWithContextToHex(merkleProofsWithContext: MerkleContextWithMerkleProof[]): HexInputsForProver[];
|
|
62
62
|
export declare function convertNonInclusionMerkleProofInputsToHex(nonInclusionMerkleProofInputs: MerkleContextWithNewAddressProof[]): NonInclusionJsonStruct[];
|
|
63
63
|
import { LightWasm } from './test-helpers';
|
|
64
|
-
import { ConnectionInterface } from './connection-interface';
|
|
65
64
|
export declare function getPublicInputHash(accountProofs: MerkleContextWithMerkleProof[], accountHashes: BN254[], newAddressProofs: MerkleContextWithNewAddressProof[], lightWasm: LightWasm): BN;
|
|
66
65
|
/**
|
|
67
66
|
*
|
|
68
67
|
*/
|
|
69
|
-
export declare class Rpc extends Connection implements
|
|
70
|
-
connection: Connection;
|
|
68
|
+
export declare class Rpc extends Connection implements CompressionApiInterface {
|
|
71
69
|
compressionApiEndpoint: string;
|
|
72
70
|
proverEndpoint: string;
|
|
73
71
|
/**
|
|
@@ -79,59 +77,6 @@ export declare class Rpc extends Connection implements ConnectionInterface, Comp
|
|
|
79
77
|
* @param connectionConfig Optional connection config
|
|
80
78
|
*/
|
|
81
79
|
constructor(endpoint: string, compressionApiEndpoint: string, proverEndpoint: string, config?: ConnectionConfig);
|
|
82
|
-
get commitment(): Commitment | undefined;
|
|
83
|
-
get rpcEndpoint(): string;
|
|
84
|
-
getBalanceAndContext(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetBalanceConfig): Promise<RpcResponseAndContext<number>>;
|
|
85
|
-
getBalance(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetBalanceConfig): Promise<number>;
|
|
86
|
-
getBlockTime(slot: number): Promise<number | null>;
|
|
87
|
-
getMinimumLedgerSlot(): Promise<number>;
|
|
88
|
-
getFirstAvailableBlock(): Promise<number>;
|
|
89
|
-
getSupply(config?: GetSupplyConfig | Commitment): Promise<RpcResponseAndContext<Supply>>;
|
|
90
|
-
getTokenSupply(tokenMintAddress: PublicKey, commitment?: Commitment): Promise<RpcResponseAndContext<TokenAmount>>;
|
|
91
|
-
getTokenAccountBalance(tokenAddress: PublicKey, commitment?: Commitment): Promise<RpcResponseAndContext<TokenAmount>>;
|
|
92
|
-
getTokenAccountsByOwner(ownerAddress: PublicKey, filter: TokenAccountsFilter, commitmentOrConfig?: Commitment | GetTokenAccountsByOwnerConfig): Promise<RpcResponseAndContext<GetProgramAccountsResponse>>;
|
|
93
|
-
getParsedTokenAccountsByOwner(ownerAddress: PublicKey, filter: TokenAccountsFilter, commitment?: Commitment): Promise<RpcResponseAndContext<Array<{
|
|
94
|
-
pubkey: PublicKey;
|
|
95
|
-
account: AccountInfo<ParsedAccountData>;
|
|
96
|
-
}>>>;
|
|
97
|
-
getLargestAccounts(config?: GetLargestAccountsConfig): Promise<RpcResponseAndContext<Array<AccountBalancePair>>>;
|
|
98
|
-
getTokenLargestAccounts(mintAddress: PublicKey, commitment?: Commitment): Promise<RpcResponseAndContext<Array<TokenAccountBalancePair>>>;
|
|
99
|
-
getAccountInfoAndContext(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<RpcResponseAndContext<AccountInfo<Buffer> | null>>;
|
|
100
|
-
getParsedAccountInfo(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<RpcResponseAndContext<AccountInfo<Buffer | ParsedAccountData> | null>>;
|
|
101
|
-
getAccountInfo(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<AccountInfo<Buffer> | null>;
|
|
102
|
-
getMultipleParsedAccounts(publicKeys: PublicKey[], rawConfig?: GetMultipleAccountsConfig): Promise<RpcResponseAndContext<(AccountInfo<Buffer | ParsedAccountData> | null)[]>>;
|
|
103
|
-
getMultipleAccountsInfoAndContext(publicKeys: PublicKey[], commitmentOrConfig?: Commitment | GetMultipleAccountsConfig): Promise<RpcResponseAndContext<(AccountInfo<Buffer> | null)[]>>;
|
|
104
|
-
getMultipleAccountsInfo(publicKeys: PublicKey[], commitmentOrConfig?: Commitment | GetMultipleAccountsConfig): Promise<(AccountInfo<Buffer> | null)[]>;
|
|
105
|
-
getStakeActivation(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetStakeActivationConfig, epoch?: number): Promise<StakeActivationData>;
|
|
106
|
-
getProgramAccounts(programId: PublicKey, configOrCommitment?: GetProgramAccountsConfig | Commitment): Promise<GetProgramAccountsResponse>;
|
|
107
|
-
getProgramAccounts(programId: PublicKey, configOrCommitment: GetProgramAccountsConfig & {
|
|
108
|
-
withContext: true;
|
|
109
|
-
}): Promise<RpcResponseAndContext<GetProgramAccountsResponse>>;
|
|
110
|
-
getParsedProgramAccounts(programId: PublicKey, configOrCommitment?: GetParsedProgramAccountsConfig | Commitment): Promise<Array<{
|
|
111
|
-
pubkey: PublicKey;
|
|
112
|
-
account: AccountInfo<Buffer | ParsedAccountData>;
|
|
113
|
-
}>>;
|
|
114
|
-
getParsedBlock(slot: number, rawConfig?: GetVersionedBlockConfig): Promise<ParsedAccountsModeBlockResponse>;
|
|
115
|
-
getParsedBlock(slot: number, rawConfig: GetVersionedBlockConfig & {
|
|
116
|
-
transactionDetails: 'accounts';
|
|
117
|
-
}): Promise<ParsedAccountsModeBlockResponse>;
|
|
118
|
-
getParsedBlock(slot: number, rawConfig: GetVersionedBlockConfig & {
|
|
119
|
-
transactionDetails: 'none';
|
|
120
|
-
}): Promise<ParsedNoneModeBlockResponse>;
|
|
121
|
-
getConfirmedTransaction(signature: TransactionSignature, commitment?: Finality): Promise<ConfirmedTransaction | null>;
|
|
122
|
-
getParsedConfirmedTransaction(signature: TransactionSignature, commitment?: Finality): Promise<ParsedConfirmedTransaction | null>;
|
|
123
|
-
getParsedConfirmedTransactions(signatures: TransactionSignature[], commitment?: Finality): Promise<(ParsedConfirmedTransaction | null)[]>;
|
|
124
|
-
getConfirmedSignaturesForAddress(address: PublicKey, startSlot: number, endSlot: number): Promise<Array<TransactionSignature>>;
|
|
125
|
-
getConfirmedSignaturesForAddress2(address: PublicKey, options?: ConfirmedSignaturesForAddress2Options, commitment?: Finality): Promise<Array<ConfirmedSignatureInfo>>;
|
|
126
|
-
getSignaturesForAddress(address: PublicKey, options?: SignaturesForAddressOptions, commitment?: Finality): Promise<Array<ConfirmedSignatureInfo>>;
|
|
127
|
-
getRecentPrioritizationFees(config?: GetRecentPrioritizationFeesConfig): Promise<RecentPrioritizationFees[]>;
|
|
128
|
-
getLatestBlockhash(config?: GetLatestBlockhashConfig): Promise<BlockhashWithExpiryBlockHeight>;
|
|
129
|
-
getLatestBlockhashAndContext(commitmentOrConfig?: Commitment | GetLatestBlockhashConfig): Promise<RpcResponseAndContext<BlockhashWithExpiryBlockHeight>>;
|
|
130
|
-
isBlockhashValid(blockhash: Blockhash, config?: IsBlockhashValidConfig): Promise<RpcResponseAndContext<boolean>>;
|
|
131
|
-
getVersion(): Promise<Version>;
|
|
132
|
-
getAddressLookupTable(accountKey: PublicKey, config?: GetAccountInfoConfig): Promise<RpcResponseAndContext<AddressLookupTableAccount | null>>;
|
|
133
|
-
getNonceAndContext(nonceAccount: PublicKey, commitmentOrConfig?: Commitment | GetNonceAndContextConfig): Promise<RpcResponseAndContext<NonceAccount | null>>;
|
|
134
|
-
getNonce(nonceAccount: PublicKey, commitmentOrConfig?: Commitment | GetNonceConfig): Promise<NonceAccount | null>;
|
|
135
80
|
/**
|
|
136
81
|
* Fetch the compressed account for the specified account address or hash
|
|
137
82
|
*/
|
|
@@ -48,11 +48,16 @@ export interface CompressedAccountData {
|
|
|
48
48
|
data: Buffer;
|
|
49
49
|
dataHash: number[];
|
|
50
50
|
}
|
|
51
|
+
export interface MerkleTreeSequenceNumber {
|
|
52
|
+
pubkey: PublicKey;
|
|
53
|
+
seq: BN;
|
|
54
|
+
}
|
|
51
55
|
export interface PublicTransactionEvent {
|
|
52
56
|
inputCompressedAccountHashes: number[][];
|
|
53
57
|
outputCompressedAccountHashes: number[][];
|
|
54
58
|
outputCompressedAccounts: OutputCompressedAccountWithPackedContext[];
|
|
55
59
|
outputLeafIndices: number[];
|
|
60
|
+
sequenceNumbers: MerkleTreeSequenceNumber[];
|
|
56
61
|
relayFee: BN | null;
|
|
57
62
|
isCompress: boolean;
|
|
58
63
|
compressOrDecompressLamports: BN | null;
|
|
@@ -3,7 +3,7 @@ import BN from 'bn.js';
|
|
|
3
3
|
import { AddressWithTree, CompressedMintTokenHolders, CompressedTransaction, GetCompressedAccountsByOwnerConfig, PaginatedOptions, HashWithTree, LatestNonVotingSignatures, LatestNonVotingSignaturesPaginated, SignatureWithMetadata, WithContext, WithCursor } from '../../rpc-interface';
|
|
4
4
|
import { CompressedProofWithContext, CompressionApiInterface, GetCompressedTokenAccountsByOwnerOrDelegateOptions, ParsedTokenAccount, TokenBalance } from '../../rpc-interface';
|
|
5
5
|
import { BN254, CompressedAccountWithMerkleContext, MerkleContextWithMerkleProof } from '../../state';
|
|
6
|
-
import { MerkleContextWithNewAddressProof
|
|
6
|
+
import { MerkleContextWithNewAddressProof } from '../../rpc';
|
|
7
7
|
export interface TestRpcConfig {
|
|
8
8
|
/**
|
|
9
9
|
* Address of the state tree to index. Default: public default test state
|
|
@@ -54,7 +54,7 @@ export interface LightWasm {
|
|
|
54
54
|
* @param depth Depth of the merkle tree.
|
|
55
55
|
* @param log Log proof generation time.
|
|
56
56
|
*/
|
|
57
|
-
export declare function getTestRpc(lightWasm: LightWasm, endpoint?: string, compressionApiEndpoint?: string, proverEndpoint?: string, merkleTreeAddress?: PublicKey, nullifierQueueAddress?: PublicKey, depth?: number, log?: boolean): Promise<
|
|
57
|
+
export declare function getTestRpc(lightWasm: LightWasm, endpoint?: string, compressionApiEndpoint?: string, proverEndpoint?: string, merkleTreeAddress?: PublicKey, nullifierQueueAddress?: PublicKey, depth?: number, log?: boolean): Promise<TestRpc>;
|
|
58
58
|
/**
|
|
59
59
|
* Simple mock rpc for unit tests that simulates the compression rpc interface.
|
|
60
60
|
* Fetches, parses events and builds merkletree on-demand, i.e. it does not persist state.
|
|
@@ -65,7 +65,6 @@ export declare function getTestRpc(lightWasm: LightWasm, endpoint?: string, comp
|
|
|
65
65
|
* For advanced testing use photon: https://github.com/helius-labs/photon
|
|
66
66
|
*/
|
|
67
67
|
export declare class TestRpc extends Connection implements CompressionApiInterface {
|
|
68
|
-
connection: Connection;
|
|
69
68
|
compressionApiEndpoint: string;
|
|
70
69
|
proverEndpoint: string;
|
|
71
70
|
merkleTreeAddress: PublicKey;
|
|
@@ -4,6 +4,14 @@ export declare const ALICE: Keypair;
|
|
|
4
4
|
export declare const BOB: Keypair;
|
|
5
5
|
export declare const CHARLIE: Keypair;
|
|
6
6
|
export declare const DAVE: Keypair;
|
|
7
|
+
/**
|
|
8
|
+
* Deep comparison of two objects. Handles BN comparison correctly.
|
|
9
|
+
*
|
|
10
|
+
* @param ref - The reference object to compare.
|
|
11
|
+
* @param val - The value object to compare.
|
|
12
|
+
* @returns True if the objects are deeply equal, false otherwise.
|
|
13
|
+
*/
|
|
14
|
+
export declare function deepEqual(ref: any, val: any): boolean;
|
|
7
15
|
/**
|
|
8
16
|
* Create a new account and airdrop lamports to it
|
|
9
17
|
*
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import BN from 'bn.js';
|
|
2
|
+
import { Buffer } from 'buffer';
|
|
2
3
|
import { ConfirmOptions, PublicKey } from '@solana/web3.js';
|
|
3
4
|
export declare const FIELD_SIZE: BN;
|
|
4
5
|
export declare const HIGHEST_ADDRESS_PLUS_ONE: BN;
|
|
6
|
+
export declare const INVOKE_DISCRIMINATOR: Buffer;
|
|
5
7
|
export declare const noopProgram = "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV";
|
|
6
8
|
export declare const lightProgram = "SySTEM1eSU2p4BGQfQpimFEWWSC1XDFeun3Nqzz3rT7";
|
|
7
9
|
export declare const accountCompressionProgram = "compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq";
|