Skip to main content

UtxoState

@midnight/ledger v7.0.0


@midnight/ledger / UtxoState

Class: UtxoState

The sub-state for unshielded UTXOs

Constructors

Constructor

new UtxoState(): UtxoState;

Returns

UtxoState

Properties

utxos

readonly utxos: Set<Utxo>;

The set of valid UTXOs

Methods

delta()

delta(prior, filterBy?): [Set<Utxo>, Set<Utxo>];

Given a prior UTXO state, produce the set differences this \ prior, and prior \ this, optionally filtered by a further condition.

Note that this should be more efficient than iterating or manifesting the utxos value, as the low-level implementation can avoid traversing shared sub-structures.

Parameters

prior

UtxoState

filterBy?

(utxo) => boolean

Returns

[Set<Utxo>, Set<Utxo>]


filter()

filter(addr): Set<Utxo>;

Filters out the UTXOs owned by a specific user address

Parameters

addr

string

Returns

Set<Utxo>


lookupMeta()

lookupMeta(utxo): undefined | UtxoMeta;

Lookup the metadata for a specific UTXO.

Parameters

utxo

Utxo

Returns

undefined | UtxoMeta


new()

static new(utxos): UtxoState;

Parameters

utxos

Map<Utxo, UtxoMeta>

Returns

UtxoState