@lightprotocol/stateless.js - v0.22.1-alpha.1
    Preparing search index...

    Class TestRpc

    Mock RPC for unit tests that simulates the ZK Compression RPC interface. Parses events and builds merkletree on-demand. It does not persist state. Constraints:

    • Can only index up to 1000 transactions

    For advanced testing use Rpc class which uses photon: https://github.com/helius-labs/photon

    Hierarchy

    • Connection
      • TestRpc

    Implements

    Index

    Constructors

    • Establish a Compression-compatible JSON RPC mock-connection

      Parameters

      • endpoint: string

        endpoint to the solana cluster (use for localnet only)

      • hasher: LightWasm

        light wasm hasher instance

      • compressionApiEndpoint: string

        Endpoint to the compression server.

      • proverEndpoint: string

        Endpoint to the prover server. defaults to endpoint

      • OptionalconnectionConfig: ConnectionConfig

        Optional connection config

      • OptionaltestRpcConfig: TestRpcConfig

        Config for the mock rpc

      Returns TestRpc

    Properties

    compressionApiEndpoint: string
    proverEndpoint: string
    lightWasm: LightWasm
    depth: number
    log: boolean = false
    allStateTreeInfos: TreeInfo[] | null = null
    lastStateTreeFetchTime: number | null = null
    fetchPromise: Promise<TreeInfo[]> | null = null
    CACHE_TTL: number = ...

    Methods

    • Fetch the latest validity proof for (1) compressed accounts specified by an array of account hashes. (2) new unique addresses specified by an array of addresses.

      Validity proofs prove the presence of compressed accounts in state trees and the non-existence of addresses in address trees, respectively. They enable verification without recomputing the merkle proof path, thus lowering verification and data costs.

      Parameters

      • hashes: BN[] = []

        Array of BN254 hashes.

      • newAddresses: BN[] = []

        Array of BN254 new addresses.

      Returns Promise<ValidityProofWithContext>

      validity proof with context