Class LibraryUtils

Collection of helper utilities for the library.

Hierarchy

  • LibraryUtils

Constructors

Properties

FULL_LOADED: any
LOG_LEVEL: number = 0
MUTEX: ThreadPool = ...
REJECT_UNAUTHORIZED_FNS: any
WASM_MODULE: any
WORKER: any
WORKER_DIST_PATH: any = LibraryUtils.WORKER_DIST_PATH_DEFAULT
WORKER_DIST_PATH_DEFAULT: any = ...
WORKER_LOADER?: (() => Worker) = undefined

Type declaration

    • (): Worker
    • Returns Worker

WORKER_OBJECTS: any

Methods

  • Parameters

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

    Returns void

  • Parameters

    • serializedErr: any

    Returns Error

  • Parameters

    • fs: any
    • path: string

    Returns Promise<boolean>

  • 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.

    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

  • Type Parameters

    • T

    Parameters

    • asyncFn: (() => Promise<T>)
        • (): Promise<T>
        • Returns Promise<T>

    Returns Promise<T>

  • 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.worker.js" in the browser and "./MoneroWebWorker.js" in node.

    Parameters

    • workerDistPath: any

      path to load the worker

    Returns void

  • Set the worker loader closure to customize worker loading. Takes precedence over default loading mechanisms.

    Could be as simple as () => new Worker(new URL("monero-ts/dist/monero.worker.js", import.meta.url)); for browsers.

    Parameters

    • Optional loader: (() => Worker)

      loader function which instantiates a worker

        • (): Worker
        • Returns Worker

    Returns void

  • Terminate monero-ts's singleton worker.

    Returns Promise<void>

Generated using TypeDoc