Skip to main content

@midnight/zswap v3.0.2Readme | API


@midnight/zswap v3.0.2 / MerkleTreeCollapsedUpdate

Class: MerkleTreeCollapsedUpdate

A compact delta on the coin commitments Merkle tree, used to keep local spending trees in sync with the global state without requiring receiving all transactions.

Constructors

new MerkleTreeCollapsedUpdate(state, start, end)

new MerkleTreeCollapsedUpdate(
state,
start,
end): MerkleTreeCollapsedUpdate

Create a new compact update from a non-compact state, and inclusive start and end indices

Parameters

state: ZswapChainState

start: bigint

end: bigint

Returns

MerkleTreeCollapsedUpdate

Throws

If the indices are out-of-bounds for the state, or end < start

Methods

serialize()

serialize(netid): Uint8Array

Parameters

netid: NetworkId

Returns

Uint8Array


toString()

toString(compact?): string

Parameters

compact?: boolean

Returns

string


deserialize()

static deserialize(raw, netid): MerkleTreeCollapsedUpdate

Parameters

raw: Uint8Array

netid: NetworkId

Returns

MerkleTreeCollapsedUpdate