aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/misc.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-10-20 08:19:44 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-11-14 15:33:15 -0500
commitfa91e8eda541acdb78ca481b74605639f319c108 (patch)
treec6f299e2daa4c2428ca2039a538b4686a1c1d5f6 /src/rpc/misc.cpp
parentfa520e72f7b5964cea1ade666e71212914556cf3 (diff)
Use RPCHelpMan for all RPCs
Diffstat (limited to 'src/rpc/misc.cpp')
-rw-r--r--src/rpc/misc.cpp71
1 files changed, 51 insertions, 20 deletions
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp
index cebf12bb34..a6c90bd6d7 100644
--- a/src/rpc/misc.cpp
+++ b/src/rpc/misc.cpp
@@ -32,12 +32,16 @@ static UniValue validateaddress(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
- "validateaddress \"address\"\n"
- "\nReturn information about the given bitcoin address.\n"
- "DEPRECATION WARNING: Parts of this command have been deprecated and moved to getaddressinfo. Clients must\n"
- "transition to using getaddressinfo to access this information before upgrading to v0.18. The following deprecated\n"
- "fields have moved to getaddressinfo and will only be shown here with -deprecatedrpc=validateaddress: ismine, iswatchonly,\n"
- "script, hex, pubkeys, sigsrequired, pubkey, addresses, embedded, iscompressed, account, timestamp, hdkeypath, kdmasterkeyid.\n"
+ RPCHelpMan{"validateaddress",
+ "\nReturn information about the given bitcoin address.\n"
+ "DEPRECATION WARNING: Parts of this command have been deprecated and moved to getaddressinfo. Clients must\n"
+ "transition to using getaddressinfo to access this information before upgrading to v0.18. The following deprecated\n"
+ "fields have moved to getaddressinfo and will only be shown here with -deprecatedrpc=validateaddress: ismine, iswatchonly,\n"
+ "script, hex, pubkeys, sigsrequired, pubkey, addresses, embedded, iscompressed, account, timestamp, hdkeypath, kdmasterkeyid.\n",
+ {
+ {"address", RPCArg::Type::STR, false},
+ }}
+ .ToString() +
"\nArguments:\n"
"1. \"address\" (string, required) The bitcoin address to validate\n"
"\nResult:\n"
@@ -142,8 +146,14 @@ static UniValue verifymessage(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 3)
throw std::runtime_error(
- "verifymessage \"address\" \"signature\" \"message\"\n"
- "\nVerify a signed message\n"
+ RPCHelpMan{"verifymessage",
+ "\nVerify a signed message\n",
+ {
+ {"address", RPCArg::Type::STR, false},
+ {"signature", RPCArg::Type::STR, false},
+ {"message", RPCArg::Type::STR, false},
+ }}
+ .ToString() +
"\nArguments:\n"
"1. \"address\" (string, required) The bitcoin address to use for the signature.\n"
"2. \"signature\" (string, required) The signature provided by the signer in base 64 encoding (see signmessage).\n"
@@ -198,8 +208,13 @@ static UniValue signmessagewithprivkey(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 2)
throw std::runtime_error(
- "signmessagewithprivkey \"privkey\" \"message\"\n"
- "\nSign a message with the private key of an address\n"
+ RPCHelpMan{"signmessagewithprivkey",
+ "\nSign a message with the private key of an address\n",
+ {
+ {"privkey", RPCArg::Type::STR, false},
+ {"message", RPCArg::Type::STR, false},
+ }}
+ .ToString() +
"\nArguments:\n"
"1. \"privkey\" (string, required) The private key to sign the message with.\n"
"2. \"message\" (string, required) The message to create a signature of.\n"
@@ -237,8 +252,12 @@ static UniValue setmocktime(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
- "setmocktime timestamp\n"
- "\nSet the local time to given timestamp (-regtest only)\n"
+ RPCHelpMan{"setmocktime",
+ "\nSet the local time to given timestamp (-regtest only)\n",
+ {
+ {"timestamp", RPCArg::Type::NUM, false},
+ }}
+ .ToString() +
"\nArguments:\n"
"1. timestamp (integer, required) Unix seconds-since-epoch timestamp\n"
" Pass 0 to go back to using the system time."
@@ -299,8 +318,12 @@ static UniValue getmemoryinfo(const JSONRPCRequest& request)
*/
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
- "getmemoryinfo (\"mode\")\n"
- "Returns an object containing information about memory usage.\n"
+ RPCHelpMan{"getmemoryinfo",
+ "Returns an object containing information about memory usage.\n",
+ {
+ {"mode", RPCArg::Type::STR, true},
+ }}
+ .ToString() +
"Arguments:\n"
"1. \"mode\" determines what kind of information is returned. This argument is optional, the default mode is \"stats\".\n"
" - \"stats\" returns general statistics about memory usage in the daemon.\n"
@@ -361,7 +384,7 @@ UniValue logging(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 2) {
throw std::runtime_error(
- "logging ( <include> <exclude> )\n"
+ RPCHelpMan{"logging",
"Gets and sets the logging configuration.\n"
"When called without an argument, returns the list of categories with status that are currently being debug logged or not.\n"
"When called with arguments, adds or removes categories from debug logging and return the lists above.\n"
@@ -371,6 +394,12 @@ UniValue logging(const JSONRPCRequest& request)
"In addition, the following are available as category names with special meanings:\n"
" - \"all\", \"1\" : represent all logging categories.\n"
" - \"none\", \"0\" : even if other logging categories are specified, ignore all of them.\n"
+ ,
+ {
+ {"include", RPCArg::Type::STR, true},
+ {"exclude", RPCArg::Type::STR, true},
+ }}
+ .ToString() +
"\nArguments:\n"
"1. \"include\" (array of strings, optional) A json array of categories to add debug logging\n"
" [\n"
@@ -430,11 +459,13 @@ static UniValue echo(const JSONRPCRequest& request)
{
if (request.fHelp)
throw std::runtime_error(
- "echo|echojson \"message\" ...\n"
- "\nSimply echo back the input arguments. This command is for testing.\n"
- "\nThe difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in"
- "bitcoin-cli and the GUI. There is no server-side difference."
- );
+ RPCHelpMan{"echo|echojson ...",
+ "\nSimply echo back the input arguments. This command is for testing.\n"
+ "\nThe difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in"
+ "bitcoin-cli and the GUI. There is no server-side difference.",
+ {}}
+ .ToString() +
+ "");
return request.params;
}