Skip to content

BinaryStateTree.insert

Inserts a key-value pair into the Binary State Tree.

Imports

Named
import { BinaryStateTree } from 'ox'

Examples

import { BinaryStateTree, Bytes } from 'ox'
 
const tree = BinaryStateTree.create()
 
BinaryStateTree.insert(
  tree,
  Bytes.fromHex('0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54'),
  Bytes.fromHex('0xd4fd4e189132273036449fc9e11198c739161b4c0116a9a2dccdfa1c492006f1')
)

Definition

function insert(
  tree: BinaryStateTree.BinaryStateTree,
  key: Bytes.Bytes,
  value: Bytes.Bytes,
): void

Source: src/core/BinaryStateTree.ts

Parameters

tree

Binary State Tree instance.

tree.root

  • Type: Node

key

  • Type: Bytes.Bytes

Key to insert.

value

  • Type: Bytes.Bytes

Value to insert.

Return Type

void