Class MessageAddr

Represents an addressable message within the system. The address is composed of an associated entity address, a hashed topic name, and an optional message index. It offers various utilities for serialization, deserialization, and converting the address into prefixed string and byte representations.

Hierarchy

  • MessageAddr

Constructors

  • Creates an instance of MessageAddr.

    Parameters

    • hashAddr: Hash

      The address of the associated entity.

    • topicNameHash: Hash

      The hash of the topic name.

    • Optional messageIndex: number

      Optional index of the message.

    Returns MessageAddr

Properties

hashAddr: Hash

The address of the associated entity.

messageIndex?: number

The optional index of the message within the topic.

topicNameHash: Hash

The hash of the topic name associated with this message.

Methods

  • Converts the MessageAddr to a byte array, enabling binary data storage. Useful for transmission or storage where a compact format is needed.

    Returns

    A Uint8Array representing the MessageAddr.

    Returns Uint8Array

  • Serializes the MessageAddr into a JSON-compatible string format. Primarily used for JSON-based data exchange.

    Returns

    A JSON string representation of the MessageAddr.

    Returns string

  • Converts the MessageAddr into a standardized prefixed string format. Useful for displaying or storing the address in text format.

    Returns

    A prefixed string representation of the MessageAddr.

    Returns string

  • Constructs a MessageAddr instance from a byte array. Interprets the byte array in a structured format to extract the entity address, topic name hash, and optionally, the message index.

    Returns

    A new MessageAddr instance wrapped in an IResultWithBytes.

    Parameters

    • bytes: Uint8Array

      The byte array representing the MessageAddr.

    Returns IResultWithBytes<MessageAddr>

  • Instantiates a MessageAddr from its string representation. The string should follow the prefixed format used in the system.

    Returns

    A new MessageAddr instance.

    Throws

    Error if the provided string does not match the expected format.

    Parameters

    • source: string

      The string representation of the MessageAddr.

    Returns MessageAddr

Generated using TypeDoc