@lightprotocol/stateless.js 0.20.0 → 0.20.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.
@@ -9,3 +9,4 @@ export * from './rpc-interface';
9
9
  export * from './rpc';
10
10
  export * from './test-helpers';
11
11
  export { LightSystemProgram as LightSystemProgramIDL, IDL } from './idl';
12
+ export * from './logger';
@@ -0,0 +1 @@
1
+ export declare const logger: any;
@@ -1,13 +1,15 @@
1
1
  import { Buffer } from 'buffer';
2
2
  import { PublicKey, AccountMeta } from '@solana/web3.js';
3
3
  import { Layout } from '@coral-xyz/borsh';
4
- import { InstructionDataInvoke, PublicTransactionEvent } from '../state';
4
+ import { InstructionDataInvoke, InstructionDataInvokeCpi, PublicTransactionEvent } from '../state';
5
5
  export declare const CompressedAccountLayout: import("buffer-layout").Layout<unknown>;
6
6
  export declare const MerkleContextLayout: import("buffer-layout").Layout<unknown>;
7
7
  export declare const NewAddressParamsLayout: import("buffer-layout").Layout<unknown>;
8
8
  export declare const InstructionDataInvokeLayout: Layout<InstructionDataInvoke>;
9
9
  export declare function encodeInstructionDataInvoke(data: InstructionDataInvoke): Buffer;
10
+ export declare const InstructionDataInvokeCpiLayout: Layout<InstructionDataInvokeCpi>;
10
11
  export declare function decodeInstructionDataInvoke(buffer: Buffer): InstructionDataInvoke;
12
+ export declare function decodeInstructionDataInvokeCpi(buffer: Buffer): InstructionDataInvokeCpi;
11
13
  export type invokeAccountsLayoutParams = {
12
14
  feePayer: PublicKey;
13
15
  authority: PublicKey;
@@ -23,3 +25,17 @@ export declare const invokeAccountsLayout: (accounts: invokeAccountsLayoutParams
23
25
  export declare const PublicTransactionEventLayout: Layout<PublicTransactionEvent>;
24
26
  export declare function encodePublicTransactionEvent(data: PublicTransactionEvent): Buffer;
25
27
  export declare function decodePublicTransactionEvent(buffer: Buffer): PublicTransactionEvent;
28
+ export declare const AppendNullifyCreateAddressInputsMetaLayout: import("buffer-layout").Layout<unknown>;
29
+ export declare const AppendLeavesInputLayout: import("buffer-layout").Layout<unknown>;
30
+ export declare const InsertNullifierInputLayout: import("buffer-layout").Layout<unknown>;
31
+ export declare const InsertAddressInputLayout: import("buffer-layout").Layout<unknown>;
32
+ export declare const MerkleTreeSequenceNumberLayout: import("buffer-layout").Layout<unknown>;
33
+ export declare function deserializeAppendNullifyCreateAddressInputsIndexer(buffer: Buffer): {
34
+ meta: unknown;
35
+ leaves: unknown[];
36
+ nullifiers: unknown[];
37
+ addresses: unknown[];
38
+ sequence_numbers: unknown[];
39
+ output_leaf_indices: number[];
40
+ };
41
+ export declare function convertToPublicTransactionEvent(decoded: any, remainingAccounts: PublicKey[], invokeData: InstructionDataInvoke): PublicTransactionEvent;
@@ -26,6 +26,12 @@ export declare function parseAccountData({ discriminator, data, dataHash, }: {
26
26
  * @param connectionConfig Optional connection config
27
27
  */
28
28
  export declare function createRpc(endpointOrWeb3JsConnection?: string | Connection, compressionApiEndpoint?: string, proverEndpoint?: string, config?: ConnectionConfig): Rpc;
29
+ /**
30
+ * Helper function to preprocess the response to wrap numbers as strings
31
+ * @param {string} text - The JSON string to preprocess
32
+ * @returns {string} - The preprocessed JSON string with numbers wrapped as strings
33
+ */
34
+ export declare function wrapBigNumbersAsStrings(text: string): string;
29
35
  /** @internal */
30
36
  export declare const rpcRequest: (rpcEndpoint: string, method: string, params?: any, convertToCamelCase?: boolean, debug?: boolean) => Promise<any>;
31
37
  /** @internal */
@@ -97,6 +97,21 @@ export interface InstructionDataInvoke {
97
97
  compressOrDecompressLamports: BN | null;
98
98
  isCompress: boolean;
99
99
  }
100
+ export interface InstructionDataInvokeCpi {
101
+ proof: CompressedProof | null;
102
+ inputCompressedAccountsWithMerkleContext: PackedCompressedAccountWithMerkleContext[];
103
+ outputCompressedAccounts: OutputCompressedAccountWithPackedContext[];
104
+ relayFee: BN | null;
105
+ newAddressParams: NewAddressParamsPacked[];
106
+ compressOrDecompressLamports: BN | null;
107
+ isCompress: boolean;
108
+ compressedCpiContext: CompressedCpiContext | null;
109
+ }
110
+ export interface CompressedCpiContext {
111
+ set_context: boolean;
112
+ first_set_context: boolean;
113
+ cpi_context_account_index: number;
114
+ }
100
115
  export interface CompressedProof {
101
116
  a: number[];
102
117
  b: number[];
@@ -1,6 +1,7 @@
1
- import { ParsedTransactionWithMeta } from '@solana/web3.js';
1
+ import { ParsedTransactionWithMeta, PublicKey } from '@solana/web3.js';
2
2
  import { Rpc } from '../../rpc';
3
3
  import { PublicTransactionEvent } from '../../state';
4
+ import { Buffer } from 'buffer';
4
5
  type Deserializer<T> = (data: Buffer, tx: ParsedTransactionWithMeta) => T;
5
6
  /**
6
7
  * @internal
@@ -10,4 +11,5 @@ type Deserializer<T> = (data: Buffer, tx: ParsedTransactionWithMeta) => T;
10
11
  export declare function getParsedEvents(rpc: Rpc): Promise<PublicTransactionEvent[]>;
11
12
  export declare const parseEvents: <T>(indexerEventsTransactions: (ParsedTransactionWithMeta | null)[], deserializeFn: Deserializer<T>) => NonNullable<T>[];
12
13
  export declare const parsePublicTransactionEventWithIdl: (data: Buffer) => PublicTransactionEvent | null;
14
+ export declare function parseLightTransaction(dataVec: Uint8Array[], accountKeys: PublicKey[][]): PublicTransactionEvent | null | undefined;
13
15
  export {};
@@ -4,7 +4,10 @@ import { ConfirmOptions, PublicKey } from '@solana/web3.js';
4
4
  import { ActiveTreeBundle } from './state/types';
5
5
  export declare const FIELD_SIZE: BN;
6
6
  export declare const HIGHEST_ADDRESS_PLUS_ONE: BN;
7
+ export declare const COMPUTE_BUDGET_PATTERN: number[];
7
8
  export declare const INVOKE_DISCRIMINATOR: Buffer;
9
+ export declare const INVOKE_CPI_DISCRIMINATOR: Buffer;
10
+ export declare const INSERT_INTO_QUEUES_DISCRIMINATOR: Buffer;
8
11
  export declare const noopProgram = "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV";
9
12
  export declare const lightProgram = "SySTEM1eSU2p4BGQfQpimFEWWSC1XDFeun3Nqzz3rT7";
10
13
  export declare const accountCompressionProgram = "compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq";