State
@iota/notarization API documentation
Class: State
The mutable content of a notarization — payload plus optional metadata.
Remarks
State pairs the notarized Data with an optional metadata string.
It is the primary content container of every notarization regardless of
the configured NotarizationMethod.
Mutability depends on the Notarization Method:
Dynamic:dataandmetadatacan be replaced after creation via NotarizationClient.updateState.Locked: the state is fixed at creation and cannot be replaced.
data and metadata can only be replaced together, in a single
NotarizationClient.updateState call. Every such replacement
increments the underlying notarization's stateVersionCount and updates
its lastStateChangeAt timestamp, even when only the metadata changes.
Properties
data
readonlydata:Data
The notarized payload.
metadata
readonlymetadata:undefined|string
The optional metadata associated with the current state version.
Methods
toJSON()
toJSON():
Object
- Return copy of self without private attributes.
Returns
Object
toString()
toString():
string
Return stringified version of self.
Returns
string
fromBytes()
staticfromBytes(data,metadata?):State
Builds a state from a binary payload.
Parameters
data
Uint8Array
The bytes to notarize.
metadata?
Optional metadata associated with this state version.
null | string
Returns
State
A State carrying the given binary payload.
fromString()
staticfromString(data,metadata?):State
Builds a state from a text payload.
Parameters
data
string
The string payload to notarize.
metadata?
Optional metadata associated with this state version.
null | string
Returns
State
A State carrying the given text payload.