Class LibraryUtils

Collection of helper utilities for the library.

Hierarchy

  • LibraryUtils

Constructors

Properties

FULL_LOADED: any
LOG_LEVEL: number = 0
REJECT_UNAUTHORIZED_FNS: any
WASM_MODULE: any
WORKER: any
WORKER_DIST_PATH: any = LibraryUtils.WORKER_DIST_PATH_DEFAULT
WORKER_DIST_PATH_DEFAULT: any = ...
WORKER_OBJECTS: any

Methods

  • Parameters

    • objectId: any
    • callbackId: any
    • callbackArgs: any

    Returns void

  • Parameters

    • serializedErr: any

    Returns Error

  • Get the library's log level.

    Returns number

    the library's log level

  • Get the total memory used by WebAssembly.

    Returns Promise<number>

    the total memory used by WebAssembly

  • Get the WebAssembly module in the current context (nodejs, browser main thread or worker).

    Returns any

  • Get a singleton instance of a worker to share.

    Returns Promise<any>

    a worker to share among wallet instances

  • Parameters

    • wasmModule: any

    Returns void

  • Invoke a worker function and get the result with error handling.

    Parameters

    • objectId: any

      identifies the worker object to invoke (default random id)

    • fnName: any

      is the name of the function to invoke

    • Optional args: any

      are function arguments to invoke with

    Returns Promise<unknown>

    resolves with response payload from the worker or an error

  • Indicate if unauthorized requests should be rejected.

    Parameters

    • fnId: any

      uniquely identifies the function

    Returns any

  • Load the WebAssembly full module with caching.

    The full module is a superset of the keys module and overrides it.

    TODO: this is separate static function from loadKeysModule() because webpack cannot bundle worker using runtime param for conditional import

    Returns Promise<any>

  • Load the WebAssembly keys module with caching.

    Returns Promise<any>

  • Log a message.

    Parameters

    • level: any

      log level of the message

    • msg: any

      message to log

    Returns void

  • Parameters

    • path: any

    Returns any

  • Parameters

    • objectId: any
    • callbackId: any

    Returns void

  • Parameters

    • objectId: any

    Returns void

  • Parameters

    • err: any

    Returns any

  • Set the library's log level with 0 being least verbose.

    Parameters

    • level: any

      the library's log level

    Returns Promise<void>

  • Register a function by id which informs if unauthorized requests (e.g. self-signed certificates) should be rejected.

    Parameters

    • fnId: any

      unique identifier for the function

    • fn: any

      function to inform if unauthorized requests should be rejected

    Returns void

  • Set the path to load the worker. Defaults to "/monero_web_worker.js" in the browser and "./MoneroWebWorker.js" in node.

    Parameters

    • workerDistPath: any

      path to load the worker

    Returns void

  • Terminate monero-ts's singleton worker.

    Returns Promise<void>

Generated using TypeDoc