Options
All
  • Public
  • Public/Protected
  • All
Menu

External module util

The utility package for SignumJS, with loads of convenience methods

Index

Variables

Const CurrencyPlanckSymbol

CurrencyPlanckSymbol: "ꞩ" = "ꞩ"

Symbol/Character for Planck (the smallest possible unit)

Const CurrencySymbol

CurrencySymbol: "Ꞩ" = "Ꞩ"

Symbol/Character for currency unit

Const FeeQuantPlanck

FeeQuantPlanck: 735000 = 735000

The smallest possible fee

Const OneSignaPlanck

OneSignaPlanck: 100000000 = 100000000

One SIGNA expressed in Planck

Functions

asyncRetry

Const convertBase36StringToHexString

  • convertBase36StringToHexString(b36: string): string

Const convertBase64StringToString

  • convertBase64StringToString(b64: string): string

Const convertByteArrayToHexString

  • convertByteArrayToHexString(bytes: Uint8Array, uppercase?: boolean): string
  • Converts byte array to hexadecimal string Inverse operation of convertHexStringToByteArray

    Parameters

    • bytes: Uint8Array

      The (unsigned) byte array to be converted

    • Default value uppercase: boolean = false

      If true, converts hex string with uppercase characters (Default: false)

    Returns string

    A hex string representing the byte array input

Const convertByteArrayToString

  • convertByteArrayToString(byteArray: Uint8Array, startIndex?: number, length?: number): string
  • Converts a byte array into string Inverse function convertStringToByteArray

    Parameters

    • byteArray: Uint8Array

      The byte array to be converted

    • Default value startIndex: number = 0

      The starting index of array to be converted (Default: 0)

    • Default value length: number = null

      The number of bytes to be considered, iff startIndex is given. If null the byte array's length is considered

    Returns string

    The converted string

Const convertDecStringToHexString

  • convertDecStringToHexString(decimal: BigNumber | string, padding?: number): string

Const convertHexEndianess

  • convertHexEndianess(hexString: any): string
  • Toggles the endianess of a hex string. 0xBEEF > 0xEFBE If string is little Endianess it turns into Big Endianess, and vice versa

    This method is mainly used for Smart Contract messaging and data inspection

    Parameters

    • hexString: any

      The hex string to be converted

    Returns string

    The converted string as hex string

Const convertHexStringToBase36String

  • convertHexStringToBase36String(hex: string): string

Const convertHexStringToByteArray

  • convertHexStringToByteArray(hex: string): Uint8Array
  • Converts an hexadecimal string to byte array

    Parameters

    • hex: string

      The hexadecimal string to be converted

    Returns Uint8Array

    An byte array representing the hexadecimal input

Const convertHexStringToDecString

  • convertHexStringToDecString(hexStr: string): string

Const convertHexStringToString

  • convertHexStringToString(hex: string): string

Const convertNQTStringToNumber

  • convertNQTStringToNumber(amount: string): number
  • Helper method to convert a Planck Value (BURST * 1E-8) String to BURST number

    throws

    exception if argument is invalid

    deprecated
    Use Amount instead

    Parameters

    • amount: string

      The amount in Planck (aka NQT)

    Returns number

    A number expressed in Burst (not NQT)

Const convertNumberToNQTString

  • convertNumberToNQTString(n: number): string

Const convertStringToBase64String

  • convertStringToBase64String(str: string, isURICompatible?: boolean): string
  • Converts/Encodes a String into Base64 (URI) encoded string. UTF-8 is supported. Inverse function convertBase64StringToString

    Parameters

    • str: string

      The string to be converted

    • Default value isURICompatible: boolean = true

      Determine whether the resulting string shall be URI compatible, or not. Default is true

    Returns string

    The Base64 String representing the input string. The string is already URI encoded, i.e. can be used directly in browsers

Const convertStringToByteArray

  • convertStringToByteArray(str: string): Uint8Array

Const convertStringToHexString

  • convertStringToHexString(str: string): string

Const createDeeplink

  • Creates a deeplink according the CIP22 spec

    signum.[domain]://v1?action=[action]&payload=[encodedData]

    Deeplinks are a way to call/open applications and do certain actions within it, e.g. Phoenix wallet can redirect to the "Send Burst" screen a fill out the form according the passed payload.

    see

    parseDeeplink as inverse function

    Parameters

    Returns string

    The Deeplink

Const parseDeeplink

  • Parses a deeplink according the CIP22 spec

    burst[.domain]://v1?action=[action]&payload=[encodedData]

    see

    createDeeplink as inverse function

    throws

    Error if parsing fails

    Parameters

    • deeplink: string

      The deeplink to be parsed

    • Default value encoderFormat: EncoderFormat = EncoderFormat.Base64

      Optional encoding format, used to decode the payload. Default: Base64

    Returns DeeplinkParts

    The parsed deeplink parts.

sumNQTStringToNumber

  • sumNQTStringToNumber(...nqts: string[]): number
  • Sums various NQT values and returns in Burst

    deprecated
    Use Amount.add instead

    Parameters

    • Rest ...nqts: string[]

      Variable amount list with NQT string

    Returns number

    The sum of all amounts in BURST