• Public
  • Public/Protected
  • All

External module util

The utility package for BurstJS, with loads of convenience methods



Const BurstPlanckSymbol

BurstPlanckSymbol: "ƀ" = "ƀ"

Symbol/Character for Planck (the smallest possible unit in Burstcoin)

Const BurstSymbol

BurstSymbol: "Ƀ" = "Ƀ"

Symbol/Character for BURST unit

Const FeeQuantPlanck

FeeQuantPlanck: 735000 = 735000

The smallest possible fee

Const OneBurstPlanck

OneBurstPlanck: 100000000 = 100000000

One Burst expressed in Planck


Const convertAddressToNumericId

  • convertAddressToNumericId(address: string): string
  • Converts BURST-XXXX-XXXX-XXXX-XXXXX into numeric Id


    • address: string

      The BURST address

    Returns string

    The numeric id, or undefined if address is invalid

Const convertBase64StringToString

  • convertBase64StringToString(b64: string): string

Const convertBurstTimeToDate

  • convertBurstTimeToDate(burstTimestamp: number): Date

Const convertBurstTimeToEpochTime

  • convertBurstTimeToEpochTime(burstTimestamp: number): number
  • Converts a Burst/Block Time (seconds since genesis block) into Unix Epoch Time (milliseconds since 01.01.1970)

    Use BurstTime.getEpoch instead


    • burstTimestamp: number

      The numeric Id

    Returns number

    Unix Epoch Time (milliseconds since 01.01.1970)

Const convertByteArrayToHexString

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


    • 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


    • 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 convertDateToBurstTime

  • convertDateToBurstTime(date: Date): number

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


    • hexString: any

      The hex string to be converted

    Returns string

    The converted string as hex string

Const convertHexStringToByteArray

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


    • 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


    exception if argument is invalid

    Use BurstValue instead


    • amount: string

      The amount in Planck (aka NQT)

    Returns number

    A number expressed in Burst (not NQT)

Const convertNumberToNQTString

  • convertNumberToNQTString(n: number): string

Const convertNumericIdToAddress

  • convertNumericIdToAddress(numericId: string): string
  • Encode a numeric id into BURST-XXXX-XXXX-XXXX-XXXXX


    • numericId: string

      The numeric Id

    Returns string

    the BURST address in Reed-Solomon encoding, or undefined if passed null, undefined

Const convertStringToBase64String

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


    • 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


    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.


    parseDeeplink as inverse function


    Returns string

    The Deeplink

Const isBurstAddress

  • isBurstAddress(address: string): boolean
  • Check for valid Burst address (format: BURST-XXXX-XXXX-XXXX-XXXXX, XXXX-XXXX-XXXX-XXXXX)


    • address: string

      The address

    Returns boolean

    true, if is a valid address, else false

Const parseDeeplink


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

    Use BurstValue.add instead


    • Rest ...nqts: string[]

      Variable amount list with NQT string

    Returns number

    The sum of all amounts in BURST