Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "Utils"

Index

Functions

byteArrayToWordArray

  • byteArrayToWordArray(data: Uint8Array): IWordArray

hexToByteArray

  • hexToByteArray(hex: string): Uint8Array
  • Returns a Uint8Array of a hex string. The hex string must only contain characters from 0 - 9 and a-f

    Parameters

    • hex: string

    Returns Uint8Array

isAccount

  • isAccount(addressAccount: Account | BigInt | number | string): boolean
  • Return true if the addressAccount value is an acount object. This does not check the network for a valid account, but just checks to see if it is an Account object

    Parameters

    • addressAccount: Account | BigInt | number | string

      Value to check to see if it can be a valid account object

    Returns boolean

    Boolean True if the addressAccount field is valid, else false

isAddress

  • isAddress(addressAccount: Account | BigInt | number | string): boolean
  • Return true if the number or string is an address value. This does not check the network for a valid address, but just checks to see if it is a number

    Parameters

    • addressAccount: Account | BigInt | number | string

      Value to check to see if it can be a valid address

    Returns boolean

    Boolean True if the address field is valid, else false

isHexString

  • isHexString(hex: string): boolean
  • Returns true if the string is a hex string

    Parameters

    • hex: string

    Returns boolean

isPublicKey

  • isPublicKey(publicKey: string): boolean
  • Returns true if the value is a public key.

    Parameters

    • publicKey: string

      value is public key - is string and has 64 hex chars

    Returns boolean

    True if the key is a public key

isPublicKeyChecksum

  • isPublicKeyChecksum(publicKey: string): boolean
  • Returns true if the public key provided has a valid checksum

    Parameters

    • publicKey: string

      to check to see if is a valid checksum key

    Returns boolean

    True if the public key has the correct upper/lower case checksum

prefix0x

  • prefix0x(value: string): string
  • Preappends a '0x' value to the front of key value.

    Parameters

    • value: string

      Value to preappend.

    Returns string

    Return the string with a '0x' at the front.

remove0xPrefix

  • remove0xPrefix(value: string): string
  • Removes any leading '0x' value.

    Parameters

    • value: string

      Value to remove the leading '0x'

    Returns string

    Return the value with the missing '0x'

toAddress

  • toAddress(addressAccount: Account | BigInt | number | string): BigInt
  • Convert an Account object, string, number BigInt values to an address number

    Parameters

    • addressAccount: Account | BigInt | number | string

      The Account object or number to convert to a single address value

    Returns BigInt

    Returns a single BigInt value of the address

toPublicKeyChecksum

  • toPublicKeyChecksum(publicKey: string): string
  • Converts a public key to a public key with a checksum. The checksum is calculated by doing as SHA3-256 on the hex values, then for each hex value if the hash value is > 7, then the hex value is upper case.

    Parameters

    • publicKey: string

      Value to convert to checksum key

    Returns string

    Checksum upper/lower case hex values

wordArrayToByteArray

  • wordArrayToByteArray(wordArray: IWordArray): Uint8Array

Generated using TypeDoc