Class NamedKeyAddr

Represents a named key address, which is identified by a base entity address and a unique name. The name is represented in bytes to allow for efficient encoding and decoding.

Hierarchy

  • NamedKeyAddr

Constructors

Properties

baseAddr: EntityAddr

The base address of the entity to which this key belongs.

nameBytes: Uint8Array

The bytes representing the name associated with the address. Expected to be a 32-byte array for validity.

Methods

  • Converts the NamedKeyAddr to a byte array for efficient storage or transmission. The byte array includes the base address followed by the 32-byte name.

    Returns

    A Uint8Array representing the NamedKeyAddr.

    Returns Uint8Array

  • Serializes the NamedKeyAddr to a JSON-compatible string. Primarily used for exchanging data in JSON format.

    Returns

    A JSON-compatible string representation of the NamedKeyAddr.

    Returns string

  • Converts the NamedKeyAddr instance to a standardized prefixed string format. This format includes the base address and the name bytes, represented in hexadecimal.

    Returns

    A prefixed string representation of the NamedKeyAddr.

    Returns string

  • Constructs a NamedKeyAddr instance from a byte array representation. The byte array should contain the base address followed by the name bytes.

    Returns

    An IResultWithBytes object containing the NamedKeyAddr instance and any remaining bytes.

    Throws

    Error if the byte array does not contain at least 32 bytes for the name.

    Parameters

    • bytes: Uint8Array

      The byte array representing the NamedKeyAddr.

    Returns IResultWithBytes<NamedKeyAddr>

  • Creates a NamedKeyAddr instance from a string representation, parsing the base address and name bytes. The string should follow the expected prefixed format used by the system.

    Returns

    A new NamedKeyAddr instance.

    Throws

    Error if the nameBytes length is not exactly 32 bytes.

    Parameters

    • source: string

      The string representation of the NamedKeyAddr.

    Returns NamedKeyAddr

Generated using TypeDoc