StateValue
@midnight-ntwrk/compact-runtime v0.9.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:
null- Cells of AlignedValues
- Maps from AlignedValues to state values
- Bounded Merkle trees containing AlignedValue leaves
- Short (<= 15 element) arrays 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(): undefined | StateValue[];
Returnsβ
undefined | StateValue[]
asBoundedMerkleTree()β
asBoundedMerkleTree(): undefined | StateBoundedMerkleTree;
Returnsβ
undefined | StateBoundedMerkleTree
asCell()β
asCell(): AlignedValue;
Returnsβ
asMap()β
asMap(): undefined | StateMap;
Returnsβ
undefined | StateMap
encode()β
encode(): EncodedStateValue;
Internal
Returnsβ
EncodedStateValue
logSize()β
logSize(): number;
Returnsβ
number
toString()β
toString(compact?): string;
Parametersβ
compact?β
boolean
Returnsβ
string
type()β
type(): "map" | "null" | "cell" | "array" | "boundedMerkleTree";
Returnsβ
"map" | "null" | "cell" | "array" | "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β
Returnsβ
StateValue
newCell()β
static newCell(value): StateValue;
Parametersβ
valueβ
Returnsβ
StateValue
newMap()β
static newMap(map): StateValue;
Parametersβ
mapβ
Returnsβ
StateValue
newNull()β
static newNull(): StateValue;
Returnsβ
StateValue