Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HarmonyAddress

// Step 1: import the class
const { HarmonyAddress } = require('@harmony-js/crypto');

// Step 2: call functions
const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
const res = HarmonyAddress.isValidBech32(addr);
console.log(res);

Hierarchy

  • HarmonyAddress

Index

Constructors

constructor

  • Parameters

    • raw: string

    Returns HarmonyAddress

Properties

basic

basic: string

raw

raw: string

Accessors

basicHex

  • get basicHex(): string
  • get basicHex of the address

    example
    const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
    const instance = new HarmonyAddress(addr);
    console.log(instance.basicHex);

    Returns string

bech32

  • get bech32(): string
  • example
    const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
    const instance = new HarmonyAddress(addr);
    console.log(instance.bech32);

    Returns string

bech32TestNet

  • get bech32TestNet(): string
  • example
    const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
    const instance = new HarmonyAddress(addr);
    console.log(instance.bech32TestNet);

    Returns string

checksum

  • get checksum(): string
  • example
    const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
    const instance = new HarmonyAddress(addr);
    console.log(instance.checksum);

    Returns string

Methods

Private getBasic

  • getBasic(addr: string): string
  • Check whether the address has an valid address format

    example
    const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
    const instance = new HarmonyAddress(addr);
    const res = instance.getBasic(addr);
    console.log(res)

    Parameters

    • addr: string

      string, the address

    Returns string

Static isValidBasic

  • isValidBasic(str: string): boolean
  • example
    const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
    const res = HarmonyAddress.isValidBech32(addr);
    console.log(res);

    Parameters

    • str: string

    Returns boolean

Static isValidBech32

  • isValidBech32(str: string): boolean
  • example
    const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
    const res = HarmonyAddress.isValidBech32(addr);
    console.log(res);

    Parameters

    • str: string

    Returns boolean

Static isValidBech32TestNet

  • isValidBech32TestNet(str: string): boolean
  • example
    const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
    const res = HarmonyAddress.isValidBech32TestNet(addr);
    console.log(res);

    Parameters

    • str: string

    Returns boolean

Static isValidChecksum

  • isValidChecksum(str: string): boolean
  • example
    const addr = 'one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7'
    const res = HarmonyAddress.isValidChecksum(addr);
    console.log(res);

    Parameters

    • str: string

    Returns boolean

Generated using TypeDoc