Class: Text

Properties overview

  • height: readonly height: number;
  • root: readonly root: Field;
  • size: readonly size: number;
  • text: readonly text: string;

Methods overview

  • toString()

Defined in: packages/nft/src/metadata/text.ts:14

The Text class represents textual data in the form of a Merkle tree. Each character of the text is converted to its
ASCII code and stored as a leaf in the Merkle tree. The root of the tree can be used as a compact representation
of the text data in cryptographic proofs.

Constructors

new Text()

new Text(text: string, height: number): Text

Defined in: packages/nft/src/metadata/text.ts:40

Constructs a new Text instance by creating a Merkle tree from the given text string.
Each character in the text is converted to its ASCII code and stored as a leaf in the tree.

Parameters

text

string

The text string to be represented.

height

number = TEXT_TREE_HEIGHT

The height of the Merkle tree. Defaults to TEXT_TREE_HEIGHT.

Returns

Text

Throws

Will throw an error if the text length exceeds the number of leaves in the Merkle tree.

Properties

height

readonly height: number;

Defined in: packages/nft/src/metadata/text.ts:30

The height of the Merkle tree.


root

readonly root: Field;

Defined in: packages/nft/src/metadata/text.ts:26

The root of the Merkle tree representing the text data.


size

readonly size: number;

Defined in: packages/nft/src/metadata/text.ts:18

The length of the text.


text

readonly text: string;

Defined in: packages/nft/src/metadata/text.ts:22

The original text string.

Methods

toString()

toString(): string

Defined in: packages/nft/src/metadata/text.ts:57

Returns the original text string.

Returns

string

The text string.