Class MoneroRpcConnection

Maintains a connection and sends requests to a Monero RPC API.

Hierarchy

  • MoneroRpcConnection

Constructors

  • Construct a RPC connection.

    Examples:

    let connection1 = new MoneroRpcConnection("http://localhost:38081", "daemon_user", "daemon_password_123")

    let connection2 = new MoneroRpcConnection({
       uri: http://localhost:38081,
       username: "daemon_user",
       password: "daemon_password_123",
       rejectUnauthorized: false, // accept self-signed certificates e.g. for local development
       proxyToWorker: true // proxy request to worker (default false)
    });

    Parameters

    • uriOrConnection: string | Partial<MoneroRpcConnection>

      MoneroRpcConnection or URI of the RPC endpoint

    • Optional username: string

      username to authenticate with the RPC endpoint (optional)

    • Optional password: string

      password to authenticate with the RPC endpoint (optional)

    Returns MoneroRpcConnection

Properties

attributes: any
fakeDisconnected: boolean
isAuthenticated: boolean
isOnline: boolean
password: string
priority: number
proxyToWorker: boolean
rejectUnauthorized: boolean
responseTime: number
uri: string
username: string

Methods

  • Check the connection status to update isOnline, isAuthenticated, and response time.

    Parameters

    • timeoutMs: any

      maximum response time before considered offline

    Returns Promise<boolean>

    true if there is a change in status, false otherwise

  • Parameters

    • key: any

    Returns any

  • Returns {
        password: string;
        priority: number;
        proxyToWorker: boolean;
        rejectUnauthorized: boolean;
        uri: string;
        username: string;
    }

    • password: string
    • priority: number
    • proxyToWorker: boolean
    • rejectUnauthorized: boolean
    • uri: string
    • username: string
  • Indicates if the connection is authenticated according to the last call to checkConnection().

    Note: must call checkConnection() manually unless using MoneroConnectionManager.

    Returns boolean

    true if authenticated or no authentication, false if not authenticated, or undefined if checkConnection() has not been called

  • Indicates if the connection is online according to the last call to checkConnection().

    Note: must call checkConnection() manually unless using MoneroConnectionManager.

    Returns boolean

    true or false to indicate if online, or undefined if checkConnection() has not been called

  • Returns string

  • Returns number

  • Returns boolean

  • Returns boolean

  • Returns number

  • Returns string

  • Returns string

  • Indicates if the connection is connected according to the last call to checkConnection().

    Note: must call checkConnection() manually unless using MoneroConnectionManager.

    Returns boolean

    true or false to indicate if connected, or undefined if checkConnection() has not been called

  • Send a binary RPC request.

    Parameters

    • path: any

      path of the binary RPC method to invoke

    • Optional params: any

      request parameters

    • Optional timeoutInMs: any

      request timeout in milliseconds

    Returns Promise<any>

    the binary response

  • Send a JSON RPC request.

    Parameters

    • method: any

      JSON RPC method to invoke

    • Optional params: any

      request parameters

    • Optional timeoutInMs: any

      request timeout in milliseconds

    Returns Promise<any>

    is the response map

  • Send a RPC request to the given path and with the given paramters.

    E.g. "/get_transactions" with params

    Parameters

    • path: any

      JSON RPC path to invoke

    • Optional params: any

      request parameters

    • Optional timeoutInMs: any

      request timeout in milliseconds

    Returns Promise<any>

    is the response map

  • Parameters

    • fakeDisconnected: any

    Returns void

  • Set the connection's priority relative to other connections. Priority 1 is highest, then priority 2, etc. The default priority of 0 is lowest priority.

    Parameters

    • Optional priority: any

      the connection priority (default 0)

    Returns MoneroRpcConnection

    this connection

  • Returns string

  • Parameters

    • resp: any

    Returns void

  • Parameters

    • resp: any
    • method: any
    • params: any

    Returns void

Generated using TypeDoc