diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -283,17 +283,17 @@ static UniValue help(Config &config, const JSONRPCRequest &jsonRequest) { if (jsonRequest.fHelp || jsonRequest.params.size() > 1) { - throw std::runtime_error( - RPCHelpMan{ - "help", - "\nList all commands, or get help for a specified command.\n", - { - {"command", RPCArg::Type::STR, /* opt */ true, - /* default_val */ "", "The command to get help on"}, - }} - .ToString() + - "\nResult:\n" - "\"text\" (string) The help text\n"); + throw std::runtime_error(RPCHelpMan{ + "help", + "\nList all commands, or get help for a specified command.\n", + { + {"command", RPCArg::Type::STR, /* opt */ true, + /* default_val */ "", "The command to get help on"}, + }, + RPCResult{"\"text\" (string) The help text\n"}, + RPCExamples{""}, + } + .ToStringWithResultsAndExamples()); } std::string strCommand; @@ -310,8 +310,14 @@ // For instance, 'stop 1000' makes the call wait 1 second before returning // to the client (intended for testing) if (jsonRequest.fHelp || jsonRequest.params.size() > 1) { - throw std::runtime_error( - RPCHelpMan{"stop", "\nStop Bitcoin server.", {}}.ToString()); + throw std::runtime_error(RPCHelpMan{ + "stop", + "\nStop Bitcoin server.", + {}, + RPCResults{}, + RPCExamples{""}, + } + .ToStringWithResultsAndExamples()); } // Event loop will exit after current HTTP requests have been handled, so @@ -326,15 +332,16 @@ static UniValue uptime(const Config &config, const JSONRPCRequest &jsonRequest) { if (jsonRequest.fHelp || jsonRequest.params.size() > 0) { - throw std::runtime_error( - RPCHelpMan{ - "uptime", "\nReturns the total uptime of the server.\n", {}} - .ToString() + - "\nResult:\n" - "ttt (numeric) The number of seconds " - "that the server has been running\n" - "\nExamples:\n" + - HelpExampleCli("uptime", "") + HelpExampleRpc("uptime", "")); + throw std::runtime_error(RPCHelpMan{ + "uptime", + "\nReturns the total uptime of the server.\n", + {}, + RPCResult{"ttt (numeric) The number of seconds that the " + "server has been running\n"}, + RPCExamples{HelpExampleCli("uptime", "") + + HelpExampleRpc("uptime", "")}, + } + .ToStringWithResultsAndExamples()); } return GetTime() - GetStartupTime(); @@ -346,7 +353,11 @@ throw std::runtime_error(RPCHelpMan{ "getrpcinfo", "\nReturns details of the RPC server.\n", - {}}.ToString()); + {}, + RPCResults{}, + RPCExamples{""}, + } + .ToStringWithResultsAndExamples()); } LOCK(g_rpc_server_info.mutex);