Data
@iota/notarization API documentation
Class: Data
A typed payload that can be notarized — either binary or text.
Remarks
Data is the inner payload of a State. Inspect its kind via
Data.valueType and pull the value out as bytes or text via
Data.toBytes or Data.toString.
Properties
value
readonlyvalue:any
The raw value as either a Uint8Array (for binary payloads) or a
string (for text payloads).
valueByteSize
readonlyvalueByteSize:number
The size of the payload in bytes.
Remarks
For binary payloads this is the length of the underlying Uint8Array;
for text payloads this is the UTF-8 byte length of the string.
valueType
readonlyvalueType:string
The runtime type of Data.value as a string: "Uint8Array" for
binary payloads, "String" for text payloads.
Methods
toJSON()
toJSON():
Object
- Return copy of self without private attributes.
Returns
Object
toString()
Call Signature
toString():
string
Return stringified version of self.
Returns
string
Call Signature
toString():
string
Returns the payload as a string.
Returns
string
Remarks
For binary payloads the bytes are interpreted as UTF-8; invalid byte sequences are replaced with the Unicode replacement character.
toBytes()
toBytes():
Uint8Array
Returns the payload as a byte array.
Returns
Uint8Array
Remarks
For text payloads the string is encoded as UTF-8.