Collection of utilities for working with Haveno.

Hierarchy

  • HavenoUtils

Constructors

Properties

AU_PER_XMR: bigint = ...
lastLogTimeMs: number = 0
logLevel: number = 0
months: string[] = ...

Methods

  • Return the absolute value of the given bigint.

    Returns

    the absolute value of the given bigint

    Parameters

    • a: bigint

      the bigint to get the absolute value of

    Returns bigint

  • Convert atomic units to XMR.

    Returns

    amount in XMR

    Parameters

    • amountAtomicUnits: string | BigInt

      amount in atomic units to convert to XMR

    Returns number

  • Divide one bigint by another.

    Returns

    the result

    Parameters

    • a: bigint

      dividend

    • b: bigint

      divisor

    Returns number

  • Format a timestamp as e.g. Jul-07 hh:mm:ss:ms. // TODO: move to GenUtils?

    Returns

    the formatted timestamp

    Parameters

    • timestamp: number

      the timestamp in milliseconds to format

    Returns string

  • Get a validated payment method id from a string or form id.

    Returns

    the payment method id

    Parameters

    • id: string | FormId

      identifies the payment method

    Returns string

  • Kill the given process.

    TODO (woodser): move this to monero-javascript GenUtils.js as common utility

    Parameters

    • process: any

      the nodejs child process to child

    • Optional signal: string

      the kill signal, e.g. SIGTERM, SIGKILL, SIGINT (default)

    Returns Promise<void>

  • Log a message. // TODO (woodser): switch to log library?

    Parameters

    • level: number

      log level of the message

    • msg: string

      message to log

    Returns void

  • Calculate the difference from a first bigint to a second, as a percentage (float).

    Returns

    the percentage difference as a float

    Parameters

    • a: bigint

      first bigint to get the difference from

    • b: bigint

      second bigint to get the difference from

    Returns number

  • Set the log level with 0 being least verbose.

    Parameters

    • level: number

      the log level

    Returns Promise<void>

  • Wait for the duration.

    Parameters

    • durationMs: number

      the duration to wait for in milliseconds

    Returns Promise<unknown>

  • Convert XMR to atomic units.

    Returns

    amount in atomic units

    Parameters

    • amountXmr: string | number

      amount in XMR to convert to atomic units

    Returns bigint

Generated using TypeDoc