JSONRPCReplyObj

Build a JSON-RPC reply object from a result or error.

Synopsis

Declared in <rpc/request.h>

UniValue
JSONRPCReplyObj(
    UniValue result,
    UniValue error,
    std::optional<UniValue> id,
    JSONRPCVersion jsonrpc_version);

Return Value

A JSON object representing the reply.

Parameters

NameDescription
resultThe result value, if the call succeeded.
errorThe error value, if the call failed.
idThe request id being replied to.
jsonrpc_versionThe protocol version to format the reply for.