@lightprotocol/stateless.js 0.17.0 → 0.17.2-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 (96) hide show
  1. package/README.md +8 -0
  2. package/dist/cjs/browser/actions/compress.d.ts +1 -1
  3. package/dist/cjs/browser/actions/create-account.d.ts +1 -1
  4. package/dist/cjs/browser/actions/decompress.d.ts +1 -1
  5. package/dist/cjs/browser/actions/transfer.d.ts +1 -1
  6. package/dist/cjs/browser/connection-interface.d.ts +125 -0
  7. package/dist/cjs/browser/constants.d.ts +1 -1
  8. package/dist/cjs/browser/index.cjs +1 -12991
  9. package/dist/cjs/browser/index.cjs.map +1 -1
  10. package/dist/cjs/browser/index.d.ts +0 -2
  11. package/dist/cjs/browser/programs/index.d.ts +1 -0
  12. package/dist/cjs/browser/programs/layout.d.ts +25 -0
  13. package/dist/cjs/browser/programs/system.d.ts +1 -8
  14. package/dist/cjs/browser/rpc-interface.d.ts +164 -157
  15. package/dist/cjs/browser/rpc.d.ts +61 -4
  16. package/dist/cjs/browser/state/BN254.d.ts +1 -1
  17. package/dist/cjs/browser/state/compressed-account.d.ts +1 -1
  18. package/dist/cjs/browser/state/types.d.ts +1 -25
  19. package/dist/cjs/browser/test-helpers/merkle-tree/indexed-array.d.ts +1 -1
  20. package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +1 -1
  21. package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +3 -1
  22. package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +5 -3
  23. package/dist/cjs/browser/utils/conversion.d.ts +1 -1
  24. package/dist/cjs/browser/utils/validation.d.ts +1 -1
  25. package/dist/cjs/node/actions/compress.d.ts +1 -1
  26. package/dist/cjs/node/actions/create-account.d.ts +1 -1
  27. package/dist/cjs/node/actions/decompress.d.ts +1 -1
  28. package/dist/cjs/node/actions/transfer.d.ts +1 -1
  29. package/dist/cjs/node/connection-interface.d.ts +125 -0
  30. package/dist/cjs/node/constants.d.ts +1 -1
  31. package/dist/cjs/node/index.cjs +1 -10036
  32. package/dist/cjs/node/index.cjs.map +1 -1
  33. package/dist/cjs/node/index.d.ts +0 -2
  34. package/dist/cjs/node/programs/index.d.ts +1 -0
  35. package/dist/cjs/node/programs/layout.d.ts +25 -0
  36. package/dist/cjs/node/programs/system.d.ts +1 -8
  37. package/dist/cjs/node/rpc-interface.d.ts +164 -157
  38. package/dist/cjs/node/rpc.d.ts +61 -4
  39. package/dist/cjs/node/state/BN254.d.ts +1 -1
  40. package/dist/cjs/node/state/compressed-account.d.ts +1 -1
  41. package/dist/cjs/node/state/types.d.ts +1 -25
  42. package/dist/cjs/node/test-helpers/merkle-tree/indexed-array.d.ts +1 -1
  43. package/dist/cjs/node/test-helpers/test-rpc/get-compressed-accounts.d.ts +1 -1
  44. package/dist/cjs/node/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +3 -1
  45. package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +5 -3
  46. package/dist/cjs/node/utils/conversion.d.ts +1 -1
  47. package/dist/cjs/node/utils/validation.d.ts +1 -1
  48. package/dist/es/browser/actions/compress.d.ts +1 -1
  49. package/dist/es/browser/actions/create-account.d.ts +1 -1
  50. package/dist/es/browser/actions/decompress.d.ts +1 -1
  51. package/dist/es/browser/actions/transfer.d.ts +1 -1
  52. package/dist/es/browser/connection-interface.d.ts +125 -0
  53. package/dist/es/browser/constants.d.ts +1 -1
  54. package/dist/es/browser/index.d.ts +0 -2
  55. package/dist/es/browser/index.js +1 -12911
  56. package/dist/es/browser/index.js.map +1 -1
  57. package/dist/es/browser/programs/index.d.ts +1 -0
  58. package/dist/es/browser/programs/layout.d.ts +25 -0
  59. package/dist/es/browser/programs/system.d.ts +1 -8
  60. package/dist/es/browser/rpc-interface.d.ts +164 -157
  61. package/dist/es/browser/rpc.d.ts +61 -4
  62. package/dist/es/browser/state/BN254.d.ts +1 -1
  63. package/dist/es/browser/state/compressed-account.d.ts +1 -1
  64. package/dist/es/browser/state/types.d.ts +1 -25
  65. package/dist/es/browser/test-helpers/merkle-tree/indexed-array.d.ts +1 -1
  66. package/dist/es/browser/test-helpers/test-rpc/get-compressed-accounts.d.ts +1 -1
  67. package/dist/es/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +3 -1
  68. package/dist/es/browser/test-helpers/test-rpc/test-rpc.d.ts +5 -3
  69. package/dist/es/browser/utils/conversion.d.ts +1 -1
  70. package/dist/es/browser/utils/validation.d.ts +1 -1
  71. package/dist/types/index.d.ts +1248 -6396
  72. package/package.json +16 -9
  73. package/dist/cjs/browser/idls/account_compression.d.ts +0 -1170
  74. package/dist/cjs/browser/idls/index.d.ts +0 -5
  75. package/dist/cjs/browser/idls/light_compressed_token.d.ts +0 -1792
  76. package/dist/cjs/browser/idls/light_registry.d.ts +0 -1293
  77. package/dist/cjs/browser/idls/light_system_program.d.ts +0 -1065
  78. package/dist/cjs/browser/wallet/index.d.ts +0 -1
  79. package/dist/cjs/browser/wallet/interface.d.ts +0 -25
  80. package/dist/cjs/browser/wallet/use-wallet.d.ts +0 -9
  81. package/dist/cjs/node/idls/account_compression.d.ts +0 -1170
  82. package/dist/cjs/node/idls/index.d.ts +0 -5
  83. package/dist/cjs/node/idls/light_compressed_token.d.ts +0 -1792
  84. package/dist/cjs/node/idls/light_registry.d.ts +0 -1293
  85. package/dist/cjs/node/idls/light_system_program.d.ts +0 -1065
  86. package/dist/cjs/node/wallet/index.d.ts +0 -1
  87. package/dist/cjs/node/wallet/interface.d.ts +0 -25
  88. package/dist/cjs/node/wallet/use-wallet.d.ts +0 -9
  89. package/dist/es/browser/idls/account_compression.d.ts +0 -1170
  90. package/dist/es/browser/idls/index.d.ts +0 -5
  91. package/dist/es/browser/idls/light_compressed_token.d.ts +0 -1792
  92. package/dist/es/browser/idls/light_registry.d.ts +0 -1293
  93. package/dist/es/browser/idls/light_system_program.d.ts +0 -1065
  94. package/dist/es/browser/wallet/index.d.ts +0 -1
  95. package/dist/es/browser/wallet/interface.d.ts +0 -25
  96. package/dist/es/browser/wallet/use-wallet.d.ts +0 -9
@@ -1,8 +1,8 @@
1
- import { Connection, ConnectionConfig, PublicKey } from '@solana/web3.js';
1
+ import { Connection, ConnectionConfig, Commitment, PublicKey, BlockhashWithExpiryBlockHeight, RpcResponseAndContext, GetBalanceConfig, GetSupplyConfig, Supply, GetTokenAccountsByOwnerConfig, GetProgramAccountsResponse, TokenAccountsFilter, AccountInfo, GetMultipleAccountsConfig, StakeActivationData, GetStakeActivationConfig, GetRecentPrioritizationFeesConfig, RecentPrioritizationFees, GetLatestBlockhashConfig, Version, ParsedConfirmedTransaction, GetAccountInfoConfig, GetLargestAccountsConfig, TokenAccountBalancePair, AccountBalancePair, ParsedAccountData, Finality, TransactionSignature, ConfirmedSignatureInfo, AddressLookupTableAccount, ParsedNoneModeBlockResponse, TokenAmount, GetNonceAndContextConfig, NonceAccount, GetNonceConfig, GetProgramAccountsConfig, GetParsedProgramAccountsConfig, Blockhash, IsBlockhashValidConfig, GetVersionedBlockConfig, ParsedAccountsModeBlockResponse, ConfirmedTransaction, ConfirmedSignaturesForAddress2Options, SignaturesForAddressOptions } 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';
5
- import { BN } from '@coral-xyz/anchor';
5
+ import BN from 'bn.js';
6
6
  /** @internal */
7
7
  export declare function parseAccountData({ discriminator, data, dataHash, }: {
8
8
  discriminator: BN;
@@ -27,7 +27,7 @@ export declare function createRpc(endpointOrWeb3JsConnection?: string | Connecti
27
27
  /** @internal */
28
28
  export declare const rpcRequest: (rpcEndpoint: string, method: string, params?: any, convertToCamelCase?: boolean, debug?: boolean) => Promise<any>;
29
29
  /** @internal */
30
- export declare const proverRequest: (proverEndpoint: string, method: "inclusion" | "new-address" | "combined", params?: any, log?: boolean) => Promise<CompressedProof>;
30
+ export declare const proverRequest: (proverEndpoint: string, method: "inclusion" | "new-address" | "combined", params?: any, log?: boolean, publicInputHash?: BN | undefined) => Promise<CompressedProof>;
31
31
  export type NonInclusionMerkleProofInputs = {
32
32
  root: BN;
33
33
  value: BN;
@@ -60,10 +60,14 @@ export type NonInclusionJsonStruct = {
60
60
  };
61
61
  export declare function convertMerkleProofsWithContextToHex(merkleProofsWithContext: MerkleContextWithMerkleProof[]): HexInputsForProver[];
62
62
  export declare function convertNonInclusionMerkleProofInputsToHex(nonInclusionMerkleProofInputs: MerkleContextWithNewAddressProof[]): NonInclusionJsonStruct[];
63
+ import { LightWasm } from './test-helpers';
64
+ import { ConnectionInterface } from './connection-interface';
65
+ export declare function getPublicInputHash(accountProofs: MerkleContextWithMerkleProof[], accountHashes: BN254[], newAddressProofs: MerkleContextWithNewAddressProof[], lightWasm: LightWasm): BN;
63
66
  /**
64
67
  *
65
68
  */
66
- export declare class Rpc extends Connection implements CompressionApiInterface {
69
+ export declare class Rpc extends Connection implements ConnectionInterface, CompressionApiInterface {
70
+ connection: Connection;
67
71
  compressionApiEndpoint: string;
68
72
  proverEndpoint: string;
69
73
  /**
@@ -75,6 +79,59 @@ export declare class Rpc extends Connection implements CompressionApiInterface {
75
79
  * @param connectionConfig Optional connection config
76
80
  */
77
81
  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>;
78
135
  /**
79
136
  * Fetch the compressed account for the specified account address or hash
80
137
  */
@@ -1,4 +1,4 @@
1
- import { BN } from '@coral-xyz/anchor';
1
+ import BN from 'bn.js';
2
2
  import { Buffer } from 'buffer';
3
3
  /**
4
4
  * bignumber with <254-bit max size. Anchor serialization doesn't support native
@@ -1,4 +1,4 @@
1
- import { BN } from '@coral-xyz/anchor';
1
+ import BN from 'bn.js';
2
2
  import { PublicKey } from '@solana/web3.js';
3
3
  import { CompressedAccount, CompressedAccountData } from './types';
4
4
  import { BN254 } from './BN254';
@@ -1,4 +1,4 @@
1
- import { BN } from '@coral-xyz/anchor';
1
+ import BN from 'bn.js';
2
2
  import { PublicKey } from '@solana/web3.js';
3
3
  import { Buffer } from 'buffer';
4
4
  import { NewAddressParamsPacked } from '../utils';
@@ -73,30 +73,6 @@ export interface CompressedProof {
73
73
  b: number[];
74
74
  c: number[];
75
75
  }
76
- /**
77
- * Compressed-token types
78
- *
79
- * TODO: Token-related code should ideally not have to go into stateless.js.
80
- * Find a better altnerative way to extend the RPC.
81
- *
82
- */
83
- export type TokenTransferOutputData = {
84
- owner: PublicKey;
85
- amount: BN;
86
- lamports: BN | null;
87
- tlv: Buffer | null;
88
- };
89
- export type CompressedTokenInstructionDataTransfer = {
90
- proof: CompressedProof | null;
91
- mint: PublicKey;
92
- delegatedTransfer: null;
93
- inputTokenDataWithContext: InputTokenDataWithContext[];
94
- outputCompressedAccounts: TokenTransferOutputData[];
95
- isCompress: boolean;
96
- compressOrDecompressAmount: BN | null;
97
- cpiContext: null;
98
- lamportsChangeAccountMerkleTreeIndex: number | null;
99
- };
100
76
  export interface InputTokenDataWithContext {
101
77
  amount: BN;
102
78
  delegateIndex: number | null;
@@ -1,5 +1,5 @@
1
1
  import { LightWasm } from '../test-rpc/test-rpc';
2
- import { BN } from '@coral-xyz/anchor';
2
+ import BN from 'bn.js';
3
3
  export declare class IndexedElement {
4
4
  index: number;
5
5
  value: BN;
@@ -1,5 +1,5 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
- import { BN } from '@coral-xyz/anchor';
2
+ import BN from 'bn.js';
3
3
  import { Rpc } from '../../rpc';
4
4
  import { CompressedAccountWithMerkleContext } from '../../state';
5
5
  export declare function getCompressedAccountsByOwnerTest(rpc: Rpc, owner: PublicKey): Promise<CompressedAccountWithMerkleContext[]>;
@@ -1,8 +1,9 @@
1
1
  import { PublicKey } from '@solana/web3.js';
2
- import { BN } from '@coral-xyz/anchor';
2
+ import BN from 'bn.js';
3
3
  import { Rpc } from '../../rpc';
4
4
  import { ParsedTokenAccount, WithCursor } from '../../rpc-interface';
5
5
  import { CompressedAccount, PublicTransactionEvent } from '../../state';
6
+ import { Layout } from '@coral-xyz/borsh';
6
7
  type TokenData = {
7
8
  mint: PublicKey;
8
9
  owner: PublicKey;
@@ -11,6 +12,7 @@ type TokenData = {
11
12
  state: number;
12
13
  tlv: Buffer | null;
13
14
  };
15
+ export declare const TokenDataLayout: Layout<TokenData>;
14
16
  export type EventWithParsedTokenTlvData = {
15
17
  inputCompressedAccountHashes: number[][];
16
18
  outputCompressedAccounts: ParsedTokenAccount[];
@@ -1,9 +1,9 @@
1
1
  import { Connection, ConnectionConfig, PublicKey } from '@solana/web3.js';
2
- import { BN } from '@coral-xyz/anchor';
2
+ 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 } from '../../rpc';
6
+ import { MerkleContextWithNewAddressProof, Rpc } from '../../rpc';
7
7
  export interface TestRpcConfig {
8
8
  /**
9
9
  * Address of the state tree to index. Default: public default test state
@@ -32,6 +32,7 @@ export interface TestRpcConfig {
32
32
  */
33
33
  addressQueueAddress?: PublicKey;
34
34
  }
35
+ export type ClientSubscriptionId = number;
35
36
  export interface LightWasm {
36
37
  blakeHash(input: string | Uint8Array, hashLength: number): Uint8Array;
37
38
  poseidonHash(input: string[] | BN[]): Uint8Array;
@@ -53,7 +54,7 @@ export interface LightWasm {
53
54
  * @param depth Depth of the merkle tree.
54
55
  * @param log Log proof generation time.
55
56
  */
56
- export declare function getTestRpc(lightWasm: LightWasm, endpoint?: string, compressionApiEndpoint?: string, proverEndpoint?: string, merkleTreeAddress?: PublicKey, nullifierQueueAddress?: PublicKey, depth?: number, log?: boolean): Promise<TestRpc>;
57
+ export declare function getTestRpc(lightWasm: LightWasm, endpoint?: string, compressionApiEndpoint?: string, proverEndpoint?: string, merkleTreeAddress?: PublicKey, nullifierQueueAddress?: PublicKey, depth?: number, log?: boolean): Promise<Rpc>;
57
58
  /**
58
59
  * Simple mock rpc for unit tests that simulates the compression rpc interface.
59
60
  * Fetches, parses events and builds merkletree on-demand, i.e. it does not persist state.
@@ -64,6 +65,7 @@ export declare function getTestRpc(lightWasm: LightWasm, endpoint?: string, comp
64
65
  * For advanced testing use photon: https://github.com/helius-labs/photon
65
66
  */
66
67
  export declare class TestRpc extends Connection implements CompressionApiInterface {
68
+ connection: Connection;
67
69
  compressionApiEndpoint: string;
68
70
  proverEndpoint: string;
69
71
  merkleTreeAddress: PublicKey;
@@ -1,6 +1,6 @@
1
1
  import { Buffer } from 'buffer';
2
2
  import { Keypair } from '@solana/web3.js';
3
- import { BN } from '@coral-xyz/anchor';
3
+ import BN from 'bn.js';
4
4
  export declare function byteArrayToKeypair(byteArray: number[]): Keypair;
5
5
  /**
6
6
  * @internal
@@ -1,4 +1,4 @@
1
- import { BN } from '@coral-xyz/anchor';
1
+ import BN from 'bn.js';
2
2
  import { CompressedAccount, CompressedAccountWithMerkleContext } from '../state';
3
3
  export declare const validateSufficientBalance: (balance: BN) => void;
4
4
  export declare const validateSameOwner: (compressedAccounts: CompressedAccount[] | CompressedAccountWithMerkleContext[]) => void;
@@ -1,6 +1,6 @@
1
1
  import { ConfirmOptions, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
2
2
  import { Rpc } from '../rpc';
3
- import { BN } from '@coral-xyz/anchor';
3
+ import BN from 'bn.js';
4
4
  /**
5
5
  * Compress lamports to a solana address
6
6
  *
@@ -1,6 +1,6 @@
1
1
  import { ConfirmOptions, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
2
2
  import { Rpc } from '../rpc';
3
- import { BN } from '@coral-xyz/anchor';
3
+ import BN from 'bn.js';
4
4
  /**
5
5
  * Create compressed account with address
6
6
  *
@@ -1,6 +1,6 @@
1
1
  import { ConfirmOptions, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
2
2
  import { Rpc } from '../rpc';
3
- import { BN } from '@coral-xyz/anchor';
3
+ import BN from 'bn.js';
4
4
  /**
5
5
  * Decompress lamports into a solana account
6
6
  *
@@ -1,5 +1,5 @@
1
1
  import { ConfirmOptions, PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
2
- import { BN } from '@coral-xyz/anchor';
2
+ import BN from 'bn.js';
3
3
  import { Rpc } from '../rpc';
4
4
  /**
5
5
  * Transfer compressed lamports from one owner to another
@@ -0,0 +1,125 @@
1
+ import { PublicKey, Commitment, GetBalanceConfig, RpcResponseAndContext, Supply, TokenAmount, GetSupplyConfig, TokenAccountsFilter, GetProgramAccountsResponse, GetTokenAccountsByOwnerConfig, AccountInfo, ParsedAccountData, GetLargestAccountsConfig, AccountBalancePair, TokenAccountBalancePair, GetAccountInfoConfig, GetMultipleAccountsConfig, StakeActivationData, GetBlockHeightConfig, GetBlockProductionConfig, BlockProduction, GetLatestBlockhashConfig, BlockhashWithExpiryBlockHeight, SimulatedTransactionResponse, SimulateTransactionConfig, SendOptions, TransactionSignature, AddressLookupTableAccount, GetParsedProgramAccountsConfig, Finality, GetVersionedBlockConfig, VersionedBlockResponse, VersionedAccountsModeBlockResponse, VersionedNoneModeBlockResponse, ParsedAccountsModeBlockResponse, ParsedNoneModeBlockResponse, ParsedTransactionWithMeta, VersionedTransaction, VersionedTransactionResponse, ConfirmedBlock, ConfirmedSignatureInfo, ConfirmedSignaturesForAddress2Options, SignatureStatusConfig, SignatureStatus, Version, VoteAccountStatus, GetSlotConfig, GetSlotLeaderConfig, GetProgramAccountsConfig, SignatureResult, TransactionConfirmationStrategy, AccountChangeCallback, ProgramAccountChangeCallback, LogsCallback, SlotChangeCallback, SlotUpdateCallback, SignatureResultCallback, SignatureSubscriptionCallback, SignatureSubscriptionOptions, RootChangeCallback, GetStakeActivationConfig, InflationGovernor, GetTransactionCountConfig, GetInflationRewardConfig, InflationReward, InflationRate, GetEpochInfoConfig, EpochInfo, EpochSchedule, LeaderSchedule, Blockhash, FeeCalculator, PerfSample, VersionedMessage, GetRecentPrioritizationFeesConfig, RecentPrioritizationFees, IsBlockhashValidConfig, GetVersionedTransactionConfig, ParsedConfirmedTransaction, ConfirmedTransaction, BlockSignatures, SignaturesForAddressOptions, GetNonceAndContextConfig, NonceAccount, GetNonceConfig, GetStakeMinimumDelegationConfig, AccountSubscriptionConfig, ProgramAccountSubscriptionConfig, LogsFilter, ContactInfo } from '@solana/web3.js';
2
+ export type ClientSubscriptionId = number;
3
+ export interface ConnectionInterface {
4
+ readonly commitment?: Commitment;
5
+ readonly rpcEndpoint: string;
6
+ getBalanceAndContext(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetBalanceConfig): Promise<RpcResponseAndContext<number>>;
7
+ getBalance(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetBalanceConfig): Promise<number>;
8
+ getBlockTime(slot: number): Promise<number | null>;
9
+ getMinimumLedgerSlot(): Promise<number>;
10
+ getFirstAvailableBlock(): Promise<number>;
11
+ getSupply(config?: GetSupplyConfig | Commitment): Promise<RpcResponseAndContext<Supply>>;
12
+ getTokenSupply(tokenMintAddress: PublicKey, commitment?: Commitment): Promise<RpcResponseAndContext<TokenAmount>>;
13
+ getTokenAccountBalance(tokenAddress: PublicKey, commitment?: Commitment): Promise<RpcResponseAndContext<TokenAmount>>;
14
+ getTokenAccountsByOwner(ownerAddress: PublicKey, filter: TokenAccountsFilter, commitmentOrConfig?: Commitment | GetTokenAccountsByOwnerConfig): Promise<RpcResponseAndContext<GetProgramAccountsResponse>>;
15
+ getParsedTokenAccountsByOwner(ownerAddress: PublicKey, filter: TokenAccountsFilter, commitment?: Commitment): Promise<RpcResponseAndContext<Array<{
16
+ pubkey: PublicKey;
17
+ account: AccountInfo<ParsedAccountData>;
18
+ }>>>;
19
+ getLargestAccounts(config?: GetLargestAccountsConfig): Promise<RpcResponseAndContext<Array<AccountBalancePair>>>;
20
+ getTokenLargestAccounts(mintAddress: PublicKey, commitment?: Commitment): Promise<RpcResponseAndContext<Array<TokenAccountBalancePair>>>;
21
+ getAccountInfoAndContext(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<RpcResponseAndContext<AccountInfo<Buffer> | null>>;
22
+ getParsedAccountInfo(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<RpcResponseAndContext<AccountInfo<Buffer | ParsedAccountData> | null>>;
23
+ getAccountInfo(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<AccountInfo<Buffer> | null>;
24
+ getMultipleParsedAccounts(publicKeys: PublicKey[], rawConfig?: GetMultipleAccountsConfig): Promise<RpcResponseAndContext<(AccountInfo<Buffer | ParsedAccountData> | null)[]>>;
25
+ getMultipleAccountsInfoAndContext(publicKeys: PublicKey[], commitmentOrConfig?: Commitment | GetMultipleAccountsConfig): Promise<RpcResponseAndContext<(AccountInfo<Buffer> | null)[]>>;
26
+ getMultipleAccountsInfo(publicKeys: PublicKey[], commitmentOrConfig?: Commitment | GetMultipleAccountsConfig): Promise<(AccountInfo<Buffer> | null)[]>;
27
+ getStakeActivation(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetStakeActivationConfig, epoch?: number): Promise<StakeActivationData>;
28
+ getProgramAccounts(programId: PublicKey, configOrCommitment?: GetProgramAccountsConfig | Commitment): Promise<GetProgramAccountsResponse>;
29
+ getProgramAccounts(programId: PublicKey, configOrCommitment: GetProgramAccountsConfig & {
30
+ withContext: true;
31
+ }): Promise<RpcResponseAndContext<GetProgramAccountsResponse>>;
32
+ getParsedProgramAccounts(programId: PublicKey, configOrCommitment?: GetParsedProgramAccountsConfig | Commitment): Promise<Array<{
33
+ pubkey: PublicKey;
34
+ account: AccountInfo<Buffer | ParsedAccountData>;
35
+ }>>;
36
+ confirmTransaction(strategy: TransactionConfirmationStrategy, commitment?: Commitment): Promise<RpcResponseAndContext<SignatureResult>>;
37
+ confirmTransaction(strategy: TransactionSignature, commitment?: Commitment): Promise<RpcResponseAndContext<SignatureResult>>;
38
+ getClusterNodes(): Promise<Array<ContactInfo>>;
39
+ getVoteAccounts(commitment?: Commitment): Promise<VoteAccountStatus>;
40
+ getSlot(commitmentOrConfig?: Commitment | GetSlotConfig): Promise<number>;
41
+ getSlotLeader(commitmentOrConfig?: Commitment | GetSlotLeaderConfig): Promise<string>;
42
+ getSlotLeaders(startSlot: number, limit: number): Promise<Array<PublicKey>>;
43
+ getSignatureStatus(signature: TransactionSignature, config?: SignatureStatusConfig): Promise<RpcResponseAndContext<SignatureStatus | null>>;
44
+ getSignatureStatuses(signatures: Array<TransactionSignature>, config?: SignatureStatusConfig): Promise<RpcResponseAndContext<Array<SignatureStatus | null>>>;
45
+ getTransactionCount(commitmentOrConfig?: Commitment | GetTransactionCountConfig): Promise<number>;
46
+ getTotalSupply(commitment?: Commitment): Promise<number>;
47
+ getInflationGovernor(commitment?: Commitment): Promise<InflationGovernor>;
48
+ getInflationReward(addresses: PublicKey[], epoch?: number, commitmentOrConfig?: Commitment | GetInflationRewardConfig): Promise<(InflationReward | null)[]>;
49
+ getInflationRate(): Promise<InflationRate>;
50
+ getEpochInfo(commitmentOrConfig?: Commitment | GetEpochInfoConfig): Promise<EpochInfo>;
51
+ getEpochSchedule(): Promise<EpochSchedule>;
52
+ getLeaderSchedule(): Promise<LeaderSchedule>;
53
+ getMinimumBalanceForRentExemption(dataLength: number, commitment?: Commitment): Promise<number>;
54
+ getRecentBlockhashAndContext(commitment?: Commitment): Promise<RpcResponseAndContext<{
55
+ blockhash: Blockhash;
56
+ feeCalculator: FeeCalculator;
57
+ }>>;
58
+ getRecentPerformanceSamples(limit?: number): Promise<Array<PerfSample>>;
59
+ getFeeCalculatorForBlockhash(blockhash: Blockhash, commitment?: Commitment): Promise<RpcResponseAndContext<FeeCalculator | null>>;
60
+ getFeeForMessage(message: VersionedMessage, commitment?: Commitment): Promise<RpcResponseAndContext<number | null>>;
61
+ getRecentPrioritizationFees(config?: GetRecentPrioritizationFeesConfig): Promise<RecentPrioritizationFees[]>;
62
+ getRecentBlockhash(commitment?: Commitment): Promise<{
63
+ blockhash: Blockhash;
64
+ feeCalculator: FeeCalculator;
65
+ }>;
66
+ getLatestBlockhash(commitmentOrConfig?: Commitment | GetLatestBlockhashConfig): Promise<BlockhashWithExpiryBlockHeight>;
67
+ getLatestBlockhashAndContext(commitmentOrConfig?: Commitment | GetLatestBlockhashConfig): Promise<RpcResponseAndContext<BlockhashWithExpiryBlockHeight>>;
68
+ isBlockhashValid(blockhash: Blockhash, rawConfig?: IsBlockhashValidConfig): Promise<RpcResponseAndContext<boolean>>;
69
+ getVersion(): Promise<Version>;
70
+ getGenesisHash(): Promise<string>;
71
+ getBlock(slot: number, rawConfig?: GetVersionedBlockConfig): Promise<VersionedBlockResponse | null>;
72
+ getBlock(slot: number, rawConfig: GetVersionedBlockConfig & {
73
+ transactionDetails: 'accounts';
74
+ }): Promise<VersionedAccountsModeBlockResponse | null>;
75
+ getBlock(slot: number, rawConfig: GetVersionedBlockConfig & {
76
+ transactionDetails: 'none';
77
+ }): Promise<VersionedNoneModeBlockResponse | null>;
78
+ getParsedBlock(slot: number, rawConfig?: GetVersionedBlockConfig): Promise<ParsedAccountsModeBlockResponse>;
79
+ getParsedBlock(slot: number, rawConfig: GetVersionedBlockConfig & {
80
+ transactionDetails: 'accounts';
81
+ }): Promise<ParsedAccountsModeBlockResponse>;
82
+ getParsedBlock(slot: number, rawConfig: GetVersionedBlockConfig & {
83
+ transactionDetails: 'none';
84
+ }): Promise<ParsedNoneModeBlockResponse>;
85
+ getBlockHeight(commitmentOrConfig?: Commitment | GetBlockHeightConfig): Promise<number>;
86
+ getBlockProduction(configOrCommitment?: GetBlockProductionConfig | Commitment): Promise<RpcResponseAndContext<BlockProduction>>;
87
+ getTransaction(signature: string, rawConfig?: GetVersionedTransactionConfig): Promise<VersionedTransactionResponse | null>;
88
+ getParsedTransaction(signature: TransactionSignature, commitmentOrConfig?: GetVersionedTransactionConfig | Finality): Promise<ParsedTransactionWithMeta | null>;
89
+ getParsedTransactions(signatures: TransactionSignature[], commitmentOrConfig?: GetVersionedTransactionConfig | Finality): Promise<(ParsedTransactionWithMeta | null)[]>;
90
+ getTransactions(signatures: TransactionSignature[], commitmentOrConfig: GetVersionedTransactionConfig | Finality): Promise<(VersionedTransactionResponse | null)[]>;
91
+ getConfirmedBlock(slot: number, commitment?: Finality): Promise<ConfirmedBlock>;
92
+ getBlocks(startSlot: number, endSlot?: number, commitment?: Finality): Promise<Array<number>>;
93
+ getBlockSignatures(slot: number, commitment?: Finality): Promise<BlockSignatures>;
94
+ getConfirmedBlockSignatures(slot: number, commitment?: Finality): Promise<BlockSignatures>;
95
+ getConfirmedTransaction(signature: TransactionSignature, commitment?: Finality): Promise<ConfirmedTransaction | null>;
96
+ getParsedConfirmedTransaction(signature: TransactionSignature, commitment?: Finality): Promise<ParsedConfirmedTransaction | null>;
97
+ getParsedConfirmedTransactions(signatures: TransactionSignature[], commitment?: Finality): Promise<(ParsedConfirmedTransaction | null)[]>;
98
+ getConfirmedSignaturesForAddress(address: PublicKey, startSlot: number, endSlot: number): Promise<Array<TransactionSignature>>;
99
+ getConfirmedSignaturesForAddress2(address: PublicKey, options?: ConfirmedSignaturesForAddress2Options, commitment?: Finality): Promise<Array<ConfirmedSignatureInfo>>;
100
+ getSignaturesForAddress(address: PublicKey, options?: SignaturesForAddressOptions, commitment?: Finality): Promise<Array<ConfirmedSignatureInfo>>;
101
+ getAddressLookupTable(accountKey: PublicKey, config?: GetAccountInfoConfig): Promise<RpcResponseAndContext<AddressLookupTableAccount | null>>;
102
+ getNonceAndContext(nonceAccount: PublicKey, commitmentOrConfig?: Commitment | GetNonceAndContextConfig): Promise<RpcResponseAndContext<NonceAccount | null>>;
103
+ getNonce(nonceAccount: PublicKey, commitmentOrConfig?: Commitment | GetNonceConfig): Promise<NonceAccount | null>;
104
+ requestAirdrop(to: PublicKey, lamports: number): Promise<TransactionSignature>;
105
+ getStakeMinimumDelegation(config?: GetStakeMinimumDelegationConfig): Promise<RpcResponseAndContext<number>>;
106
+ simulateTransaction(transaction: VersionedTransaction, config?: SimulateTransactionConfig): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
107
+ sendTransaction(transaction: VersionedTransaction, options?: SendOptions): Promise<TransactionSignature>;
108
+ sendRawTransaction(rawTransaction: Buffer | Uint8Array | Array<number>, options?: SendOptions): Promise<TransactionSignature>;
109
+ sendEncodedTransaction(encodedTransaction: string, options?: SendOptions): Promise<TransactionSignature>;
110
+ onAccountChange(publicKey: PublicKey, callback: AccountChangeCallback, config?: AccountSubscriptionConfig): ClientSubscriptionId;
111
+ onProgramAccountChange(programId: PublicKey, callback: ProgramAccountChangeCallback, config?: ProgramAccountSubscriptionConfig): ClientSubscriptionId;
112
+ onLogs(filter: LogsFilter, callback: LogsCallback, commitment?: Commitment): ClientSubscriptionId;
113
+ onSlotChange(callback: SlotChangeCallback): ClientSubscriptionId;
114
+ onSlotUpdate(callback: SlotUpdateCallback): ClientSubscriptionId;
115
+ onSignature(signature: TransactionSignature, callback: SignatureResultCallback, commitment?: Commitment): ClientSubscriptionId;
116
+ onSignatureWithOptions(signature: TransactionSignature, callback: SignatureSubscriptionCallback, options?: SignatureSubscriptionOptions): ClientSubscriptionId;
117
+ onRootChange(callback: RootChangeCallback): ClientSubscriptionId;
118
+ removeAccountChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
119
+ removeProgramAccountChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
120
+ removeOnLogsListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
121
+ removeSlotChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
122
+ removeSlotUpdateListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
123
+ removeSignatureListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
124
+ removeRootChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
125
+ }
@@ -1,4 +1,4 @@
1
- import { BN } from '@coral-xyz/anchor';
1
+ import BN from 'bn.js';
2
2
  import { ConfirmOptions, PublicKey } from '@solana/web3.js';
3
3
  export declare const FIELD_SIZE: BN;
4
4
  export declare const HIGHEST_ADDRESS_PLUS_ONE: BN;