qbit-rpc
    Preparing search index...

    Interface RpcRequest<T>

    One JSON-RPC call: the method, its positional parameters, and the parser that validates and converts its result. Build one with a function from requests; pass it to QbitRpcClient.batch, or let a typed client method build and send it.

    interface RpcRequest<T> {
        blockHash?: string;
        method: string;
        params: readonly unknown[];
        parse: (result: unknown) => T;
        txid?: string;
        txids?: readonly (string | null)[];
        waitMs?: number;
    }

    Type Parameters

    • T
    Index
    blockHash?: string

    For submitblock and submitheader: the hash of the header the hex starts with, when it holds one. For submitauxblock: the hash submitted.

    method: string

    The JSON-RPC method name.

    params: readonly unknown[]

    The positional parameters, as they will be sent.

    parse: (result: unknown) => T

    Validates the raw result (numbers as JsonNumber) and converts it, synchronously. It may throw anything on a malformed result: the client reports whatever it throws as RpcResponseError (reason: 'validation'), with the thrown value as cause. That is the entry's own error in a batch, and, for a call with side effects, the cause of an RpcUnknownOutcomeError, since the node has acted by then.

    txid?: string

    For sendrawtransaction: the txid computed from the hex, when it parses.

    txids?: readonly (string | null)[]

    For submitpackage: one txid per transaction, in package order, computed from its hex, or null where the hex does not parse here (the node is the judge of that, as for sendrawtransaction, so it is sent all the same).

    waitMs?: number

    For a long poll (waitfornewblock, waitforblockheight, waitforblock): how long the node holds the request before it answers, in milliseconds. The client's deadline must be at least this plus LONG_POLL_MARGIN_MS.