Class Address

A class representing an address.

Remarks

For now, an address is intrinsically linked (to be understood as a digest of) to the public key.

Constructors

Properties

bytes: Uint8Array
isEOA: boolean = false
serializer: default
version: Version
versioner: Versioner

Methods

  • Serializes the address to a string.

    Returns string

    The serialized address string.

    Remarks

    A address is serialized as follows:

    • The version is serialized as a varint and prepended to the address bytes.
    • The result is then sent to the serializer.
  • Get address in binary format from a bytes buffer.

    Parameters

    • data: Uint8Array
    • offset: number = 0

    Returns {
        data: Uint8Array;
        length: number;
    }

    The address in bytes format.

    • data: Uint8Array
    • length: number
  • Initializes a new address object from a serialized string.

    Parameters

    • str: string

      The serialized address string.

    Returns Address

    A new address instance.

    Throws

    If the address string is invalid.

  • Initialize a new address object from a version.

    Parameters

    • version: Version = DEFAULT_VERSION

      The version of the address.

    Returns Address

    A new address instance.

    Throws

    If the version is not supported.