Class MoneroUtils

Collection of Monero utilities. Runs in a worker thread by default.

Hierarchy

  • MoneroUtils

Constructors

Properties

AU_PER_XMR: bigint = ...
NUM_MNEMONIC_WORDS: number = 25
PROXY_TO_WORKER: boolean = false
RING_SIZE: number = 12

Methods

  • Convert atomic units to XMR.

    Parameters

    • amountAtomicUnits: string | bigint

      amount in atomic units to convert to XMR

    Returns number

    amount in XMR

  • Convert the binary response from daemon RPC block retrieval to JSON.

    Parameters

    • uint8arr: any

      binary response from daemon RPC when getting blocks

    Returns Promise<any>

    JSON object with the blocks data

  • Convert the given portable storage binary to JSON.

    Parameters

    • uint8arr: any

      binary data in Monero's portable storage format

    Returns Promise<any>

    JSON object converted from the binary data

  • Get an integrated address.

    Parameters

    • networkType: MoneroNetworkType

      network type of the integrated address

    • standardAddress: string

      address to derive the integrated address from

    • Optional paymentId: string

      optionally specifies the integrated address's payment id (defaults to random payment id)

    Returns Promise<any>

    the integrated address

  • Decode tx extra according to https://cryptonote.org/cns/cns005.txt and returns the last tx pub key.

    TODO: use c++ bridge for this

    Parameters

    • txExtra: any

    Returns Promise<string>

    the last pub key as a hexidecimal string

  • Get the version of the monero-ts library.

    Returns string

    the version of this monero-ts library

  • Parameters

    • str: any

    Returns boolean

  • Determine if the given unlock time is a timestamp or block height.

    Parameters

    • unlockTime: bigint

      is the unlock time to check

    Returns boolean

    true if the unlock time is a timestamp, false if a block height

  • Determine if the given address is valid.

    Parameters

    • address: any

      address

    • networkType: any

      network type of the address to validate

    Returns Promise<boolean>

    true if the address is valid, false otherwise

  • Determine if the given payment id is valid.

    Parameters

    • paymentId: any

      payment id to determine if valid

    Returns Promise<boolean>

    true if the payment id is valid, false otherwise

  • Indicates if a private spend key is valid.

    Parameters

    • privateSpendKey: any

      is the private spend key to validate

    Returns Promise<boolean>

    true if the private spend key is valid, false otherwise

  • Indicates if a private view key is valid.

    Parameters

    • privateViewKey: any

      is the private view key to validate

    Returns Promise<boolean>

    true if the private view key is valid, false otherwise

  • Indicates if a public spend key is valid.

    Parameters

    • publicSpendKey: any

      is the public spend key to validate

    Returns Promise<boolean>

    true if the public spend key is valid, false otherwise

  • Indicates if a public view key is valid.

    Parameters

    • publicViewKey: any

      is the public view key to validate

    Returns Promise<boolean>

    true if the public view key is valid, false otherwise

  • Convert the given JSON to a binary Uint8Array using Monero's portable storage format.

    Parameters

    • json: any

      json to convert to binary

    Returns Promise<any>

    the json converted to portable storage binary

  • Merges a transaction into a list of existing transactions.

    Parameters

    • txs: any

      existing transactions to merge into

    • tx: any

      transaction to merge into the list

    Returns void

  • Determines if two payment ids are functionally equal.

    For example, 03284e41c342f032 and 03284e41c342f032000000000000000000000000000000000000000000000000 are considered equal.

    Parameters

    • paymentId1: any

      is a payment id to compare

    • paymentId2: any

      is a payment id to compare

    Returns boolean

    true if the payment ids are equal, false otherwise

  • Enable or disable proxying these utilities to a worker thread.

    Parameters

    • proxyToWorker: any

      specifies if utilities should be proxied to a worker

    Returns void

  • Validate the given address, throw an error if invalid.

    Parameters

    • address: any

      address to validate

    • networkType: any

      network type of the address to validate

    Returns Promise<any>

  • Validate the given mnemonic, throw an error if invalid.

    TODO: improve validation, use network type

    Parameters

    • mnemonic: any

      mnemonic to validate

    Returns Promise<void>

  • Validate the given payment id, throw an error if invalid.

    TODO: improve validation

    Parameters

    • paymentId: any

      payment id to validate

    Returns Promise<void>

  • Validate the given private spend key, throw an error if invalid.

    Parameters

    • privateSpendKey: any

      private spend key to validate

    Returns Promise<void>

  • Validate the given private view key, throw an error if invalid.

    Parameters

    • privateViewKey: any

      private view key to validate

    Returns Promise<void>

  • Validate the given public spend key, throw an error if invalid.

    Parameters

    • publicSpendKey: any

      public spend key to validate

    Returns Promise<void>

  • Validate the given public view key, throw an error if invalid.

    Parameters

    • publicViewKey: any

      public view key to validate

    Returns Promise<void>

  • Convert XMR to atomic units.

    Parameters

    • amountXmr: string | number

      amount in XMR to convert to atomic units

    Returns bigint

    amount in atomic units

Generated using TypeDoc