Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

UTF8Length

  • UTF8Length(str: string, nullTerminated?: boolean): usize
  • Calculates the byte length of the specified UTF-8 string, which can optionally be null terminated.

    Parameters

    • str: string

      data

    • Default value nullTerminated: boolean = false

    Returns usize

allocate

  • allocate<T>(): T

bytesToString

  • bytesToString(bytes: Uint8Array | null): string | null
  • Decode an UTF-8 encoded Uint8Array into a string.

    Parameters

    • bytes: Uint8Array | null

      array to decode

    Returns string | null

parseFromBytes

  • parseFromBytes<T>(bytes: Uint8Array): T
  • Parses the given bytes array to return a value of the given generic type. Supported types: bool, integer, string and data objects defined in model.ts.

    Type parameters

    • T

    Parameters

    • bytes: Uint8Array

      Bytes to parse. Bytes must be not null.

    Returns T

    A parsed value of type T.

parseFromString

  • parseFromString<T>(s: string): T
  • Parses the given string to return a value of the given generic type. Supported types: bool, integer, string and data objects defined in model.ts.

    Type parameters

    • T

    Parameters

    • s: string

      String to parse. Must be not null.

    Returns T

    A parsed value of type T.

read_register

  • read_register(register_id: u64): Uint8Array
  • package

    Reads contents of a register into a Uint8Array. Note: this is a low level function and should be used directly only rarely from client code.

    Parameters

    • register_id: u64

      Id of register to read from

    Returns Uint8Array

read_register_string

  • read_register_string(register_id: u64): string

stringToBytes

  • stringToBytes(s: string): Uint8Array
  • Convert a given string into a Uint8Array encoded as UTF-8.

    Parameters

    • s: string

      data to encode

    Returns Uint8Array

toUTF8

  • toUTF8(str: string, nullTerminated?: boolean): usize

uint8ArrayToBuffer

  • uint8ArrayToBuffer(array: Uint8Array): ArrayBuffer

Generated using TypeDoc