StateValue
@midnight-ntwrk/ledger v3.0.2 β’ Readme | API
@midnight-ntwrk/ledger v3.0.2 / 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.
Constructorsβ
new StateValue()β
private new StateValue(): StateValue
Returnsβ
Methodsβ
arrayPush()β
arrayPush(value): StateValue
Parametersβ
β’ value: StateValue
Returnsβ
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()β
Internal
encode(): EncodedStateValue
Returnsβ
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()β
Internal
static decode(value): StateValue
Parametersβ
β’ value: EncodedStateValue
Returnsβ
newArray()β
static newArray(): StateValue
Returnsβ
newBoundedMerkleTree()β
static newBoundedMerkleTree(tree): StateValue
Parametersβ
β’ tree: StateBoundedMerkleTree
Returnsβ
newCell()β
static newCell(value): StateValue
Parametersβ
β’ value: AlignedValue
Returnsβ
newMap()β
static newMap(map): StateValue
Parametersβ
β’ map: StateMap
Returnsβ
newNull()β
static newNull(): StateValue