Class Key

Represents a Key that can identify different types of entities in the system.

Hierarchy

  • Key

Constructors

Properties

account?: AccountHash
addressableEntity?: EntityAddr
balance?: Hash
balanceHold?: BalanceHoldAddr
bidAddr?: BidAddr
blockGlobal?: BlockGlobalAddr
byteCode?: ByteCode
chainspecRegistry?: Hash
checksumRegistry?: Hash
deploy?: Hash
dictionary?: Hash
entryPoint?: EntryPointAddr
era?: Era
eraSummary?: Hash
hash?: Hash
message?: MessageAddr
namedKey?: NamedKeyAddr
package?: Hash
systemContactRegistry?: Hash
transfer?: TransferHash
type: KeyTypeID
uRef?: URef
unbond?: AccountHash
withdraw?: AccountHash

Methods

  • Converts the key to bytes.

    Returns

    A Uint8Array representing the serialized key.

    Parameters

    • withKeyTypeID: boolean = true

    Returns Uint8Array

  • Converts the instance to a JSON-compatible hexadecimal string.

    Returns

    The hex-encoded string representation of the instance.

    Returns string

  • Converts the key to a prefixed string representation.

    Returns

    The prefixed string of the key.

    Returns string

  • Converts the key to a string representation.

    Returns

    The string representation of the key.

    Returns string

  • Concatenates the type and field bytes.

    Returns

    A Uint8Array with concatenated type and field bytes.

    Parameters

    • fieldBytes: Uint8Array = ...

      The bytes representing the field.

    • Optional typeBytes: Uint8Array

      The bytes representing the type.

    Returns Uint8Array

  • Creates a Key instance based on the type ID and source string.

    Returns

    A new Key instance.

    Throws

    Error if the type is not found or invalid.

    Parameters

    • source: string

      The string containing the key data.

    • typeID: KeyTypeID

      The TypeID of the key.

    Returns Key

  • Finds the prefix name by matching the source string with a map of prefixes.

    Returns

    The matching PrefixName or undefined if not found.

    Parameters

    • source: string

      The string to check for a matching prefix.

    • prefixes: Map<PrefixName, KeyTypeID>

      The map of prefix names to KeyTypeID.

    Returns PrefixName

  • Creates a new Key instance from a source string.

    Returns

    A new Key instance.

    Throws

    Error if the prefix is not found or the source is invalid.

    Parameters

    • source: string

      The string containing the key data.

    Returns Key

  • Parses a Key instance from a string representation.

    Returns

    A new Key instance.

    Throws

    Error if the format is invalid or unexpected.

    Parameters

    • source: string

      The string containing the key data.

    Returns Key

Generated using TypeDoc