Class RPCWithBackup

Sends RPC requests to the RPC node, also has wrappers for actions that only read the network (write actions are handled by the Wallet class)

Hierarchy (view full)

  • RPC
    • RPCWithBackup

Constructors

  • Parameters

    • rpc_urls: string[]
    • Optional timeout: number

      Request to RPC timeout, in milliseconds. If RPC request fails or timeouts, tries the next RPC

    • use_pending: boolean = false

    Returns RPCWithBackup

Properties

DECIMALS: any = undefined
debug: boolean = false
headers: Record<string, string>

HTTP headers to send with any RPC requests, defaults to { "Content-Type": "application/json" }

rpc_url: string
rpc_urls: string[]
timeout: number
use_pending: boolean

Methods

  • The function that sends the RPC POST request

    Parameters

    • payload: Record<string, any>

    Returns Promise<Record<string, any>>