Changeset View
Changeset View
Standalone View
Standalone View
src/zmq/zmqrpc.cpp
Show All 10 Lines | |||||
#include <univalue.h> | #include <univalue.h> | ||||
namespace { | namespace { | ||||
UniValue getzmqnotifications(const Config &config, | UniValue getzmqnotifications(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 0) { | if (request.fHelp || request.params.size() != 0) { | ||||
throw std::runtime_error( | throw std::runtime_error(RPCHelpMan{ | ||||
RPCHelpMan{"getzmqnotifications", | "getzmqnotifications", | ||||
"\nReturns information about the active ZeroMQ " | "\nReturns information about the active ZeroMQ " | ||||
"notifications.\n", | "notifications.\n", | ||||
{}} | {}, | ||||
.ToString() + | RPCResult{ | ||||
"\nResult:\n" | |||||
"[\n" | "[\n" | ||||
" { (json object)\n" | " { (json object)\n" | ||||
" \"type\": \"pubhashtx\", (string) Type of notification\n" | " \"type\": \"pubhashtx\", (string) Type of notification\n" | ||||
" \"address\": \"...\" (string) Address of the publisher\n" | " \"address\": \"...\" (string) Address of the " | ||||
"publisher\n" | |||||
" },\n" | " },\n" | ||||
" ...\n" | " ...\n" | ||||
"]\n" | "]\n"}, | ||||
"\nExamples:\n" + | RPCExamples{HelpExampleCli("getzmqnotifications", "") + | ||||
HelpExampleCli("getzmqnotifications", "") + | HelpExampleRpc("getzmqnotifications", "")}, | ||||
HelpExampleRpc("getzmqnotifications", "")); | } | ||||
.ToString()); | |||||
} | } | ||||
UniValue result(UniValue::VARR); | UniValue result(UniValue::VARR); | ||||
if (g_zmq_notification_interface != nullptr) { | if (g_zmq_notification_interface != nullptr) { | ||||
for (const auto *n : | for (const auto *n : | ||||
g_zmq_notification_interface->GetActiveNotifiers()) { | g_zmq_notification_interface->GetActiveNotifiers()) { | ||||
UniValue obj(UniValue::VOBJ); | UniValue obj(UniValue::VOBJ); | ||||
obj.pushKV("type", n->GetType()); | obj.pushKV("type", n->GetType()); | ||||
Show All 23 Lines |