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 atomic units by another.

    Returns

    the result

    Parameters

    • au1: bigint

      dividend

    • au2: 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-ts GenUtils.ts 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

  • Return the maximum of two bigints.

    Returns

    the maximum of the two bigints

    Parameters

    • bi1: bigint

      first bigint

    • bi2: bigint

      second bigint

    Returns bigint

  • Multiply a bigint by a number or bigint.

    Returns

    the product as a bigint

    Parameters

    • a: bigint

      bigint to multiply

    • b: number | bigint

      bigint or number to multiply by

    Returns bigint

  • 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