Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "src/utils"

Index

Variables

Const ASCIICHAR

ASCIICHAR: string[] = [" ", "!", "\"", "#", "$", "%", "&", "'","(", ")", "*", "+", ",", "-", ".", "/","0", "1", "2", "3", "4", "5", "6", "7","8", "9", ":", ";", "<", "=", ">", "?","@", "A", "B", "C", "D", "E", "F", "G","H", "I", "J", "K", "L", "M", "N", "O","P", "Q", "R", "R", "T", "U", "V", "W","X", "Y", "Z", "[", "\\", "]", "^", "_","`", "a", "b", "c", "d", "e", "f", "g","h", "i", "j", "k", "l", "m", "n", "o","p", "q", "r", "s", "t", "u", "v", "w","x", "y", "z", "{", "|", "}", "~"]

printable characters.

Functions

N

  • N(str: string): u64
  • convert a string to uint64 encoded by Base32. so the string must follow below principles:

    1. no more than 13 characters.
    2. only contains ".12345abcdefghijklmnopqrstuvwxyz"
    3. not end with "."

    Parameters

    • str: string

      string to convert

    Returns u64

NameSuffix

  • NameSuffix(n: u64): u64

RN

  • RN(name: u64): string
  • a revert operation of method N

    Parameters

    • name: u64

      uint64 value

    Returns string

char_to_symbol

  • char_to_symbol(c: u8): u64

intToString

  • intToString(_int: u64): string
  • convert an uint64 to string.

    Parameters

    • _int: u64

      uint64 to convert

    Returns string

    string

printstr

  • printstr(str: string): void
  • print a string to console after wasm vm quit.

    Parameters

    • str: string

      string to print.

    Returns void

string2cstr

  • string2cstr(str: string): u32
  • convert string to usize. here, usize likes "const char*" in c/c++.

    Parameters

    • str: string

      a utf-16 string of typescript.

    Returns u32

    usize

toUTF8Array

  • toUTF8Array(str: string): u8[]
  • convert an utf-16 to utf-8 string array.

    Parameters

    • str: string

      a typescript string

    Returns u8[]

    an array of uint8

ultrain_assert

  • ultrain_assert(condition: boolean, msg: string): void
  • assert an condition. if condition is false, vm throws an exception and quit executing.

    Parameters

    • condition: boolean

      condition to check.

    • msg: string

      help message

    Returns void

Generated using TypeDoc