Skip to main content

State

@iota/notarization API documentation


Class: State

Represents the state of a notarization.

State encapsulates the data being notarized along with optional metadata. It serves as the primary content container for both locked and dynamic notarizations.

Properties

data

readonly data: Data

Retrieves the data associated with the state.

Returns

A Data instance containing the state data.


metadata

readonly metadata: undefined | string

Retrieves the metadata associated with the state.

Returns

A string containing the metadata, if existing.

Methods

toJSON()

toJSON(): Object

  • Return copy of self without private attributes.

Returns

Object


toString()

toString(): string

Return stringified version of self.

Returns

string


fromString()

static fromString(data, metadata?): State

Creates a new state from a string.

Use this for text data like documents, JSON, or configuration.

Arguments

  • data - The string data for the state.
  • metadata - Optional metadata for the state.

Returns

A new State instance.

Parameters

data

string

metadata?

null | string

Returns

State


fromBytes()

static fromBytes(data, metadata?): State

Creates a new state from raw bytes.

Use this for binary data like files, images, or serialized content.

Arguments

  • data - The byte array data for the state.
  • metadata - Optional metadata for the state.

Returns

A new State instance.

Parameters

data

Uint8Array

metadata?

null | string

Returns

State