Function newTree

  • Creates a new tree.

    Type Parameters

    • T extends TreeBase

    Parameters

    • c: (new (...args) => T)

      The class of the tree to be instantiated.

        • new (...args): T
        • Parameters

          • Rest ...args: any[]

          Returns T

    • db: Level<string, Buffer>

      A database used to store the Merkle tree data.

    • hasher: Hasher

      A hasher used to compute hash paths.

    • name: string

      Name of the tree.

    • depth: number

      Depth of the tree.

    • prefilledSize: number = 0

      A number of leaves that are prefilled with values.

    Returns Promise<T>

    The newly created tree.