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

    Class IndexedArray

    This indexed array implementation mirrors the rust implementation of the indexed merkle tree. It stores the elements of the indexed merkle tree.

    Index

    Constructors

    Properties

    elements: IndexedElement[]
    currentNodeIndex: number
    highestElementIndex: number

    Methods

    • Finds the index of the low element for the given value which should not be part of the array. Low element is the greatest element which still has a lower value than the provided one. Low elements are used in non-membership proofs.

      Parameters

      • value: BN

      Returns number | undefined

    • Returns the hash of the given element. That hash consists of:

      • The value of the given element.
      • The nextIndex of the given element.
      • The value of the element pointed by nextIndex.

      Parameters

      Returns Uint8Array<ArrayBufferLike> | undefined

    • Appends a new element with the given value to the indexed array using a specific low element index. This method ensures the new element is placed correctly relative to the low element.

      Parameters

      • lowElementIndex: number

        The index of the low element.

      • value: BN

        The value of the new element to append.

      Returns IndexedElementBundle

      The new element and its updated low element.