Skip to main content

StateValue

@midnight-ntwrk/compact-runtime v0.14.0


@midnight-ntwrk/compact-runtime / StateValue

Class: StateValue

Represents the core of a contract's state, and recursively represents each of its components.

There are different classes of state values:

State values are immutable, any operations that mutate states will return a new state instead.

Methods

arrayPush()

arrayPush(value): StateValue;

Parameters

value

StateValue

Returns

StateValue


asArray()

asArray(): StateValue[] | undefined;

Returns

StateValue[] | undefined


asBoundedMerkleTree()

asBoundedMerkleTree(): StateBoundedMerkleTree | undefined;

Returns

StateBoundedMerkleTree | undefined


asCell()

asCell(): AlignedValue;

Returns

AlignedValue


asMap()

asMap(): StateMap | undefined;

Returns

StateMap | undefined


encode()

encode(): EncodedStateValue;

Internal

Returns

EncodedStateValue


logSize()

logSize(): number;

Returns

number


toString()

toString(compact?): string;

Parameters

compact?

boolean

Returns

string


type()

type(): "cell" | "map" | "array" | "null" | "boundedMerkleTree";

Returns

"cell" | "map" | "array" | "null" | "boundedMerkleTree"


decode()

static decode(value): StateValue;

Internal

Parameters

value

EncodedStateValue

Returns

StateValue


newArray()

static newArray(): StateValue;

Returns

StateValue


newBoundedMerkleTree()

static newBoundedMerkleTree(tree): StateValue;

Parameters

tree

StateBoundedMerkleTree

Returns

StateValue


newCell()

static newCell(value): StateValue;

Parameters

value

AlignedValue

Returns

StateValue


newMap()

static newMap(map): StateValue;

Parameters

map

StateMap

Returns

StateValue


newNull()

static newNull(): StateValue;

Returns

StateValue