Use RPCHelpMan for all RPCs

This commit is contained in:
MarcoFalke 2018-10-20 08:19:44 -04:00
parent fa520e72f7
commit fa91e8eda5
No known key found for this signature in database
GPG key ID: CE2B75697E69A548
11 changed files with 1008 additions and 426 deletions

View file

@ -163,8 +163,9 @@ static UniValue getblockcount(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(
"getblockcount\n" RPCHelpMan{"getblockcount",
"\nReturns the number of blocks in the longest blockchain.\n" "\nReturns the number of blocks in the longest blockchain.\n", {}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"n (numeric) The current block count\n" "n (numeric) The current block count\n"
"\nExamples:\n" "\nExamples:\n"
@ -180,8 +181,9 @@ static UniValue getbestblockhash(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(
"getbestblockhash\n" RPCHelpMan{"getbestblockhash",
"\nReturns the hash of the best (tip) block in the longest blockchain.\n" "\nReturns the hash of the best (tip) block in the longest blockchain.\n", {}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"\"hex\" (string) the block hash, hex-encoded\n" "\"hex\" (string) the block hash, hex-encoded\n"
"\nExamples:\n" "\nExamples:\n"
@ -207,9 +209,13 @@ static UniValue waitfornewblock(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 1) if (request.fHelp || request.params.size() > 1)
throw std::runtime_error( throw std::runtime_error(
"waitfornewblock (timeout)\n" RPCHelpMan{"waitfornewblock",
"\nWaits for a specific new block and returns useful info about it.\n" "\nWaits for a specific new block and returns useful info about it.\n"
"\nReturns the current block on timeout or exit.\n" "\nReturns the current block on timeout or exit.\n",
{
{"timeout", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n" "1. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n"
"\nResult:\n" "\nResult:\n"
@ -245,9 +251,14 @@ static UniValue waitforblock(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"waitforblock <blockhash> (timeout)\n" RPCHelpMan{"waitforblock",
"\nWaits for a specific new block and returns useful info about it.\n" "\nWaits for a specific new block and returns useful info about it.\n"
"\nReturns the current block on timeout or exit.\n" "\nReturns the current block on timeout or exit.\n",
{
{"blockhash", RPCArg::Type::STR, false},
{"timeout", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"blockhash\" (required, string) Block hash to wait for.\n" "1. \"blockhash\" (required, string) Block hash to wait for.\n"
"2. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n" "2. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n"
@ -287,10 +298,15 @@ static UniValue waitforblockheight(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"waitforblockheight height ( timeout )\n" RPCHelpMan{"waitforblockheight",
"\nWaits for (at least) block height and returns the height and hash\n" "\nWaits for (at least) block height and returns the height and hash\n"
"of the current tip.\n" "of the current tip.\n"
"\nReturns the current block on timeout or exit.\n" "\nReturns the current block on timeout or exit.\n",
{
{"height", RPCArg::Type::NUM, false},
{"timeout", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. height (int, required) Block height to wait for.\n" "1. height (int, required) Block height to wait for.\n"
"2. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n" "2. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n"
@ -329,8 +345,9 @@ static UniValue syncwithvalidationinterfacequeue(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(
"syncwithvalidationinterfacequeue\n" RPCHelpMan{"syncwithvalidationinterfacequeue",
"\nWaits for the validation interface queue to catch up on everything that was there when we entered this function.\n" "\nWaits for the validation interface queue to catch up on everything that was there when we entered this function.\n", {}}
.ToString() +
"\nExamples:\n" "\nExamples:\n"
+ HelpExampleCli("syncwithvalidationinterfacequeue","") + HelpExampleCli("syncwithvalidationinterfacequeue","")
+ HelpExampleRpc("syncwithvalidationinterfacequeue","") + HelpExampleRpc("syncwithvalidationinterfacequeue","")
@ -344,8 +361,9 @@ static UniValue getdifficulty(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(
"getdifficulty\n" RPCHelpMan{"getdifficulty",
"\nReturns the proof-of-work difficulty as a multiple of the minimum difficulty.\n" "\nReturns the proof-of-work difficulty as a multiple of the minimum difficulty.\n", {}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"n.nnn (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty.\n" "n.nnn (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty.\n"
"\nExamples:\n" "\nExamples:\n"
@ -478,8 +496,12 @@ static UniValue getrawmempool(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 1) if (request.fHelp || request.params.size() > 1)
throw std::runtime_error( throw std::runtime_error(
"getrawmempool ( verbose )\n" RPCHelpMan{"getrawmempool",
"\nReturns all transaction ids in memory pool as a json array of string transaction ids.\n" "\nReturns all transaction ids in memory pool as a json array of string transaction ids.\n",
{
{"verbose", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nHint: use getmempoolentry to fetch a specific transaction from the mempool.\n" "\nHint: use getmempoolentry to fetch a specific transaction from the mempool.\n"
"\nArguments:\n" "\nArguments:\n"
"1. verbose (boolean, optional, default=false) True for a json object, false for array of transaction ids\n" "1. verbose (boolean, optional, default=false) True for a json object, false for array of transaction ids\n"
@ -510,8 +532,13 @@ static UniValue getmempoolancestors(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error( throw std::runtime_error(
"getmempoolancestors txid ( verbose )\n" RPCHelpMan{"getmempoolancestors",
"\nIf txid is in the mempool, returns all in-mempool ancestors.\n" "\nIf txid is in the mempool, returns all in-mempool ancestors.\n",
{
{"txid", RPCArg::Type::STR_HEX, false},
{"verbose", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"txid\" (string, required) The transaction id (must be in mempool)\n" "1. \"txid\" (string, required) The transaction id (must be in mempool)\n"
"2. verbose (boolean, optional, default=false) True for a json object, false for array of transaction ids\n" "2. verbose (boolean, optional, default=false) True for a json object, false for array of transaction ids\n"
@ -574,8 +601,13 @@ static UniValue getmempooldescendants(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error( throw std::runtime_error(
"getmempooldescendants txid ( verbose )\n" RPCHelpMan{"getmempooldescendants",
"\nIf txid is in the mempool, returns all in-mempool descendants.\n" "\nIf txid is in the mempool, returns all in-mempool descendants.\n",
{
{"txid", RPCArg::Type::STR_HEX, false},
{"verbose", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"txid\" (string, required) The transaction id (must be in mempool)\n" "1. \"txid\" (string, required) The transaction id (must be in mempool)\n"
"2. verbose (boolean, optional, default=false) True for a json object, false for array of transaction ids\n" "2. verbose (boolean, optional, default=false) True for a json object, false for array of transaction ids\n"
@ -638,8 +670,12 @@ static UniValue getmempoolentry(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) { if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error( throw std::runtime_error(
"getmempoolentry txid\n" RPCHelpMan{"getmempoolentry",
"\nReturns mempool data for given transaction\n" "\nReturns mempool data for given transaction\n",
{
{"txid", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"txid\" (string, required) The transaction id (must be in mempool)\n" "1. \"txid\" (string, required) The transaction id (must be in mempool)\n"
"\nResult:\n" "\nResult:\n"
@ -671,8 +707,12 @@ static UniValue getblockhash(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"getblockhash height\n" RPCHelpMan{"getblockhash",
"\nReturns hash of block in best-block-chain at height provided.\n" "\nReturns hash of block in best-block-chain at height provided.\n",
{
{"height", RPCArg::Type::NUM, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. height (numeric, required) The height index\n" "1. height (numeric, required) The height index\n"
"\nResult:\n" "\nResult:\n"
@ -696,9 +736,14 @@ static UniValue getblockheader(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"getblockheader \"blockhash\" ( verbose )\n" RPCHelpMan{"getblockheader",
"\nIf verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'.\n" "\nIf verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'.\n"
"If verbose is true, returns an Object with information about blockheader <hash>.\n" "If verbose is true, returns an Object with information about blockheader <hash>.\n",
{
{"blockhash", RPCArg::Type::STR_HEX, false},
{"verbose", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"blockhash\" (string, required) The block hash\n" "1. \"blockhash\" (string, required) The block hash\n"
"2. verbose (boolean, optional, default=true) true for a json object, false for the hex-encoded data\n" "2. verbose (boolean, optional, default=true) true for a json object, false for the hex-encoded data\n"
@ -774,10 +819,15 @@ static UniValue getblock(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"getblock \"blockhash\" ( verbosity ) \n" RPCHelpMan{"getblock",
"\nIf verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.\n" "\nIf verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.\n"
"If verbosity is 1, returns an Object with information about block <hash>.\n" "If verbosity is 1, returns an Object with information about block <hash>.\n"
"If verbosity is 2, returns an Object with information about block <hash> and information about each transaction. \n" "If verbosity is 2, returns an Object with information about block <hash> and information about each transaction. \n",
{
{"blockhash", RPCArg::Type::STR_HEX, false},
{"verbosity", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"blockhash\" (string, required) The block hash\n" "1. \"blockhash\" (string, required) The block hash\n"
"2. verbosity (numeric, optional, default=1) 0 for hex-encoded data, 1 for a json object, and 2 for json object with transaction data\n" "2. verbosity (numeric, optional, default=1) 0 for hex-encoded data, 1 for a json object, and 2 for json object with transaction data\n"
@ -926,7 +976,11 @@ static UniValue pruneblockchain(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"pruneblockchain height\n" RPCHelpMan{"pruneblockchain", "",
{
{"height", RPCArg::Type::NUM, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"height\" (numeric, required) The block height to prune up to. May be set to a discrete height, or a unix timestamp\n" "1. \"height\" (numeric, required) The block height to prune up to. May be set to a discrete height, or a unix timestamp\n"
" to prune blocks whose block time is at least 2 hours older than the provided timestamp.\n" " to prune blocks whose block time is at least 2 hours older than the provided timestamp.\n"
@ -975,9 +1029,11 @@ static UniValue gettxoutsetinfo(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(
"gettxoutsetinfo\n" RPCHelpMan{"gettxoutsetinfo",
"\nReturns statistics about the unspent transaction output set.\n" "\nReturns statistics about the unspent transaction output set.\n"
"Note this call may take some time.\n" "Note this call may take some time.\n",
{}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"{\n" "{\n"
" \"height\":n, (numeric) The current block height (index)\n" " \"height\":n, (numeric) The current block height (index)\n"
@ -1017,8 +1073,14 @@ UniValue gettxout(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3) if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
throw std::runtime_error( throw std::runtime_error(
"gettxout \"txid\" n ( include_mempool )\n" RPCHelpMan{"gettxout",
"\nReturns details about an unspent transaction output.\n" "\nReturns details about an unspent transaction output.\n",
{
{"txid", RPCArg::Type::STR, false},
{"n", RPCArg::Type::NUM, false},
{"include_mempool", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"txid\" (string, required) The transaction id\n" "1. \"txid\" (string, required) The transaction id\n"
"2. \"n\" (numeric, required) vout number\n" "2. \"n\" (numeric, required) vout number\n"
@ -1097,8 +1159,13 @@ static UniValue verifychain(const JSONRPCRequest& request)
int nCheckDepth = gArgs.GetArg("-checkblocks", DEFAULT_CHECKBLOCKS); int nCheckDepth = gArgs.GetArg("-checkblocks", DEFAULT_CHECKBLOCKS);
if (request.fHelp || request.params.size() > 2) if (request.fHelp || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"verifychain ( checklevel nblocks )\n" RPCHelpMan{"verifychain",
"\nVerifies blockchain database.\n" "\nVerifies blockchain database.\n",
{
{"checklevel", RPCArg::Type::NUM, true},
{"nblocks", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. checklevel (numeric, optional, 0-4, default=" + strprintf("%d", nCheckLevel) + ") How thorough the block verification is.\n" "1. checklevel (numeric, optional, 0-4, default=" + strprintf("%d", nCheckLevel) + ") How thorough the block verification is.\n"
"2. nblocks (numeric, optional, default=" + strprintf("%d", nCheckDepth) + ", 0=all) The number of blocks to check.\n" "2. nblocks (numeric, optional, default=" + strprintf("%d", nCheckDepth) + ", 0=all) The number of blocks to check.\n"
@ -1194,8 +1261,9 @@ UniValue getblockchaininfo(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(
"getblockchaininfo\n" RPCHelpMan{"getblockchaininfo",
"Returns an object containing various state info regarding blockchain processing.\n" "Returns an object containing various state info regarding blockchain processing.\n", {}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"{\n" "{\n"
" \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n" " \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n"
@ -1311,9 +1379,11 @@ static UniValue getchaintips(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(
"getchaintips\n" RPCHelpMan{"getchaintips",
"Return information about all known tips in the block tree," "Return information about all known tips in the block tree,"
" including the main chain as well as orphaned branches.\n" " including the main chain as well as orphaned branches.\n",
{}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"[\n" "[\n"
" {\n" " {\n"
@ -1428,8 +1498,9 @@ static UniValue getmempoolinfo(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(
"getmempoolinfo\n" RPCHelpMan{"getmempoolinfo",
"\nReturns details on the active state of the TX memory pool.\n" "\nReturns details on the active state of the TX memory pool.\n", {}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"{\n" "{\n"
" \"size\": xxxxx, (numeric) Current tx count\n" " \"size\": xxxxx, (numeric) Current tx count\n"
@ -1451,10 +1522,14 @@ static UniValue preciousblock(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"preciousblock \"blockhash\"\n" RPCHelpMan{"preciousblock",
"\nTreats a block as if it were received before others with the same work.\n" "\nTreats a block as if it were received before others with the same work.\n"
"\nA later preciousblock call can override the effect of an earlier one.\n" "\nA later preciousblock call can override the effect of an earlier one.\n"
"\nThe effects of preciousblock are not retained across restarts.\n" "\nThe effects of preciousblock are not retained across restarts.\n",
{
{"blockhash", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"blockhash\" (string, required) the hash of the block to mark as precious\n" "1. \"blockhash\" (string, required) the hash of the block to mark as precious\n"
"\nResult:\n" "\nResult:\n"
@ -1488,8 +1563,12 @@ static UniValue invalidateblock(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"invalidateblock \"blockhash\"\n" RPCHelpMan{"invalidateblock",
"\nPermanently marks a block as invalid, as if it violated a consensus rule.\n" "\nPermanently marks a block as invalid, as if it violated a consensus rule.\n",
{
{"blockhash", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"blockhash\" (string, required) the hash of the block to mark as invalid\n" "1. \"blockhash\" (string, required) the hash of the block to mark as invalid\n"
"\nResult:\n" "\nResult:\n"
@ -1526,9 +1605,13 @@ static UniValue reconsiderblock(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"reconsiderblock \"blockhash\"\n" RPCHelpMan{"reconsiderblock",
"\nRemoves invalidity status of a block and its descendants, reconsider them for activation.\n" "\nRemoves invalidity status of a block and its descendants, reconsider them for activation.\n"
"This can be used to undo the effects of invalidateblock.\n" "This can be used to undo the effects of invalidateblock.\n",
{
{"blockhash", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"blockhash\" (string, required) the hash of the block to reconsider\n" "1. \"blockhash\" (string, required) the hash of the block to reconsider\n"
"\nResult:\n" "\nResult:\n"
@ -1563,8 +1646,13 @@ static UniValue getchaintxstats(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 2) if (request.fHelp || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"getchaintxstats ( nblocks \"blockhash\" )\n" RPCHelpMan{"getchaintxstats",
"\nCompute statistics about the total number and rate of transactions in the chain.\n" "\nCompute statistics about the total number and rate of transactions in the chain.\n",
{
{"nblocks", RPCArg::Type::NUM, true},
{"blockhash", RPCArg::Type::STR_HEX, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. nblocks (numeric, optional) Size of the window in number of blocks (default: one month).\n" "1. nblocks (numeric, optional) Size of the window in number of blocks (default: one month).\n"
"2. \"blockhash\" (string, optional) The hash of the block that ends the window.\n" "2. \"blockhash\" (string, optional) The hash of the block that ends the window.\n"
@ -1693,10 +1781,20 @@ static UniValue getblockstats(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 4) {
throw std::runtime_error( throw std::runtime_error(
"getblockstats hash_or_height ( stats )\n" RPCHelpMan{"getblockstats",
"\nCompute per block statistics for a given window. All amounts are in satoshis.\n" "\nCompute per block statistics for a given window. All amounts are in satoshis.\n"
"It won't work for some heights with pruning.\n" "It won't work for some heights with pruning.\n"
"It won't work without -txindex for utxo_size_inc, *fee or *feerate stats.\n" "It won't work without -txindex for utxo_size_inc, *fee or *feerate stats.\n",
{
{"hash_or_height", RPCArg::Type::NUM, false},
{"stats", RPCArg::Type::ARR,
{
{"height", RPCArg::Type::STR, true},
{"time", RPCArg::Type::STR, true},
},
true, "stats"},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"hash_or_height\" (string or numeric, required) The block hash or height of the target block\n" "1. \"hash_or_height\" (string or numeric, required) The block hash or height of the target block\n"
"2. \"stats\" (array, optional) Values to plot, by default all values (see result below)\n" "2. \"stats\" (array, optional) Values to plot, by default all values (see result below)\n"
@ -1957,8 +2055,9 @@ static UniValue savemempool(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(
"savemempool\n" RPCHelpMan{"savemempool",
"\nDumps the mempool to disk. It will fail until the previous dump is fully loaded.\n" "\nDumps the mempool to disk. It will fail until the previous dump is fully loaded.\n", {}}
.ToString() +
"\nExamples:\n" "\nExamples:\n"
+ HelpExampleCli("savemempool", "") + HelpExampleCli("savemempool", "")
+ HelpExampleRpc("savemempool", "") + HelpExampleRpc("savemempool", "")
@ -2040,20 +2139,34 @@ UniValue scantxoutset(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"scantxoutset \"action\" [scanobjects,...]\n" RPCHelpMan{"scantxoutset",
"\nEXPERIMENTAL warning: this call may be removed or changed in future releases.\n" "\nEXPERIMENTAL warning: this call may be removed or changed in future releases.\n"
"\nScans the unspent transaction output set for entries that match certain output descriptors.\n" "\nScans the unspent transaction output set for entries that match certain output descriptors.\n"
"Examples of output descriptors are:\n" "Examples of output descriptors are:\n"
" addr(<address>) Outputs whose scriptPubKey corresponds to the specified address (does not include P2PK)\n" " addr(<address>) Outputs whose scriptPubKey corresponds to the specified address (does not include P2PK)\n"
" raw(<hex script>) Outputs whose scriptPubKey equals the specified hex scripts\n" " raw(<hex script>) Outputs whose scriptPubKey equals the specified hex scripts\n"
" combo(<pubkey>) P2PK, P2PKH, P2WPKH, and P2SH-P2WPKH outputs for the given pubkey\n" " combo(<pubkey>) P2PK, P2PKH, P2WPKH, and P2SH-P2WPKH outputs for the given pubkey\n"
" pkh(<pubkey>) P2PKH outputs for the given pubkey\n" " pkh(<pubkey>) P2PKH outputs for the given pubkey\n"
" sh(multi(<n>,<pubkey>,<pubkey>,...)) P2SH-multisig outputs for the given threshold and pubkeys\n" " sh(multi(<n>,<pubkey>,<pubkey>,...)) P2SH-multisig outputs for the given threshold and pubkeys\n"
"\nIn the above, <pubkey> either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one\n" "\nIn the above, <pubkey> either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one\n"
"or more path elements separated by \"/\", and optionally ending in \"/*\" (unhardened), or \"/*'\" or \"/*h\" (hardened) to specify all\n" "or more path elements separated by \"/\", and optionally ending in \"/*\" (unhardened), or \"/*'\" or \"/*h\" (hardened) to specify all\n"
"unhardened or hardened child keys.\n" "unhardened or hardened child keys.\n"
"In the latter case, a range needs to be specified by below if different from 1000.\n" "In the latter case, a range needs to be specified by below if different from 1000.\n"
"For more information on output descriptors, see the documentation in the doc/descriptors.md file.\n" "For more information on output descriptors, see the documentation in the doc/descriptors.md file.\n",
{
{"action", RPCArg::Type::STR, false},
{"scanobjects", RPCArg::Type::ARR,
{
{"descriptor", RPCArg::Type::OBJ,
{
{"desc", RPCArg::Type::STR, false},
{"range", RPCArg::Type::NUM, true},
},
false, "scanobjects"},
},
false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"action\" (string, required) The action to execute\n" "1. \"action\" (string, required) The action to execute\n"
" \"start\" for starting a scan\n" " \"start\" for starting a scan\n"

View file

@ -87,10 +87,15 @@ static UniValue getnetworkhashps(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 2) if (request.fHelp || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"getnetworkhashps ( nblocks height )\n" RPCHelpMan{"getnetworkhashps",
"\nReturns the estimated network hashes per second based on the last n blocks.\n" "\nReturns the estimated network hashes per second based on the last n blocks.\n"
"Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n" "Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n"
"Pass in [height] to estimate the network speed at the time when a certain block was found.\n" "Pass in [height] to estimate the network speed at the time when a certain block was found.\n",
{
{"nblocks", RPCArg::Type::NUM, true},
{"height", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. nblocks (numeric, optional, default=120) The number of blocks, or -1 for blocks since last difficulty change.\n" "1. nblocks (numeric, optional, default=120) The number of blocks, or -1 for blocks since last difficulty change.\n"
"2. height (numeric, optional, default=-1) To estimate at the time of the given height.\n" "2. height (numeric, optional, default=-1) To estimate at the time of the given height.\n"
@ -157,8 +162,14 @@ static UniValue generatetoaddress(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3) if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
throw std::runtime_error( throw std::runtime_error(
"generatetoaddress nblocks address (maxtries)\n" RPCHelpMan{"generatetoaddress",
"\nMine blocks immediately to a specified address (before the RPC call returns)\n" "\nMine blocks immediately to a specified address (before the RPC call returns)\n",
{
{"nblocks", RPCArg::Type::NUM, false},
{"address", RPCArg::Type::STR, false},
{"maxtries", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. nblocks (numeric, required) How many blocks are generated immediately.\n" "1. nblocks (numeric, required) How many blocks are generated immediately.\n"
"2. address (string, required) The address to send the newly generated bitcoin to.\n" "2. address (string, required) The address to send the newly generated bitcoin to.\n"
@ -193,8 +204,9 @@ static UniValue getmininginfo(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(
"getmininginfo\n" RPCHelpMan{"getmininginfo",
"\nReturns a json object containing mining-related information." "\nReturns a json object containing mining-related information.", {}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"{\n" "{\n"
" \"blocks\": nnn, (numeric) The current block\n" " \"blocks\": nnn, (numeric) The current block\n"
@ -232,8 +244,14 @@ static UniValue prioritisetransaction(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 3) if (request.fHelp || request.params.size() != 3)
throw std::runtime_error( throw std::runtime_error(
"prioritisetransaction \"txid\" dummy fee_delta\n" RPCHelpMan{"prioritisetransaction",
"Accepts the transaction into mined blocks at a higher (or lower) priority\n" "Accepts the transaction into mined blocks at a higher (or lower) priority\n",
{
{"txid", RPCArg::Type::STR, false},
{"dummy", RPCArg::Type::NUM, false},
{"fee_delta", RPCArg::Type::NUM, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"txid\" (string, required) The transaction id.\n" "1. \"txid\" (string, required) The transaction id.\n"
"2. dummy (numeric, optional) API-Compatibility for previous API. Must be zero or null.\n" "2. dummy (numeric, optional) API-Compatibility for previous API. Must be zero or null.\n"
@ -295,15 +313,32 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 1) if (request.fHelp || request.params.size() > 1)
throw std::runtime_error( throw std::runtime_error(
"getblocktemplate ( \"template_request\" )\n" RPCHelpMan{"getblocktemplate",
"\nIf the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.\n" "\nIf the request parameters include a 'mode' key, that is used to explicitly select between the default 'template' request or a 'proposal'.\n"
"It returns data needed to construct a block to work on.\n" "It returns data needed to construct a block to work on.\n"
"For full specification, see BIPs 22, 23, 9, and 145:\n" "For full specification, see BIPs 22, 23, 9, and 145:\n"
" https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki\n" " https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki\n"
" https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki\n" " https://github.com/bitcoin/bips/blob/master/bip-0023.mediawiki\n"
" https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes\n" " https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes\n"
" https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki\n" " https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki\n",
{
{"template_request", RPCArg::Type::OBJ,
{
{"mode", RPCArg::Type::STR, true},
{"capabilities", RPCArg::Type::ARR,
{
{"support", RPCArg::Type::STR, true},
},
true},
{"rules", RPCArg::Type::ARR,
{
{"support", RPCArg::Type::STR, true},
},
true},
},
true, "\"template_request\""},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. template_request (json object, optional) A json object in the following spec\n" "1. template_request (json object, optional) A json object in the following spec\n"
" {\n" " {\n"
@ -703,10 +738,14 @@ static UniValue submitblock(const JSONRPCRequest& request)
// We allow 2 arguments for compliance with BIP22. Argument 2 is ignored. // We allow 2 arguments for compliance with BIP22. Argument 2 is ignored.
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error( throw std::runtime_error(
"submitblock \"hexdata\" ( \"dummy\" )\n" RPCHelpMan{"submitblock",
"\nAttempts to submit new block to network.\n" "\nAttempts to submit new block to network.\n"
"See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n" "See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n",
{
{"hexdata", RPCArg::Type::STR_HEX, false},
{"dummy", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments\n" "\nArguments\n"
"1. \"hexdata\" (string, required) the hex-encoded block data to submit\n" "1. \"hexdata\" (string, required) the hex-encoded block data to submit\n"
"2. \"dummy\" (optional) dummy value, for compatibility with BIP22. This value is ignored.\n" "2. \"dummy\" (optional) dummy value, for compatibility with BIP22. This value is ignored.\n"
@ -767,9 +806,13 @@ static UniValue submitheader(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) { if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error( throw std::runtime_error(
"submitheader \"hexdata\"\n" RPCHelpMan{"submitheader",
"\nDecode the given hexdata as a header and submit it as a candidate chain tip if valid." "\nDecode the given hexdata as a header and submit it as a candidate chain tip if valid."
"\nThrows when the header is invalid.\n" "\nThrows when the header is invalid.\n",
{
{"hexdata", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments\n" "\nArguments\n"
"1. \"hexdata\" (string, required) the hex-encoded block header data\n" "1. \"hexdata\" (string, required) the hex-encoded block header data\n"
"\nResult:\n" "\nResult:\n"
@ -803,11 +846,16 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"estimatesmartfee conf_target (\"estimate_mode\")\n" RPCHelpMan{"estimatesmartfee",
"\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n" "\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
"confirmation within conf_target blocks if possible and return the number of blocks\n" "confirmation within conf_target blocks if possible and return the number of blocks\n"
"for which the estimate is valid. Uses virtual transaction size as defined\n" "for which the estimate is valid. Uses virtual transaction size as defined\n"
"in BIP 141 (witness data is discounted).\n" "in BIP 141 (witness data is discounted).\n",
{
{"conf_target", RPCArg::Type::NUM, false},
{"estimate_mode", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. conf_target (numeric) Confirmation target in blocks (1 - 1008)\n" "1. conf_target (numeric) Confirmation target in blocks (1 - 1008)\n"
"2. \"estimate_mode\" (string, optional, default=CONSERVATIVE) The fee estimate mode.\n" "2. \"estimate_mode\" (string, optional, default=CONSERVATIVE) The fee estimate mode.\n"
@ -864,14 +912,19 @@ static UniValue estimaterawfee(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"estimaterawfee conf_target (threshold)\n" RPCHelpMan{"estimaterawfee",
"\nWARNING: This interface is unstable and may disappear or change!\n" "\nWARNING: This interface is unstable and may disappear or change!\n"
"\nWARNING: This is an advanced API call that is tightly coupled to the specific\n" "\nWARNING: This is an advanced API call that is tightly coupled to the specific\n"
" implementation of fee estimation. The parameters it can be called with\n" " implementation of fee estimation. The parameters it can be called with\n"
" and the results it returns will change if the internal implementation changes.\n" " and the results it returns will change if the internal implementation changes.\n"
"\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n" "\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
"confirmation within conf_target blocks if possible. Uses virtual transaction size as\n" "confirmation within conf_target blocks if possible. Uses virtual transaction size as\n"
"defined in BIP 141 (witness data is discounted).\n" "defined in BIP 141 (witness data is discounted).\n",
{
{"conf_target", RPCArg::Type::NUM, false},
{"threshold", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. conf_target (numeric) Confirmation target in blocks (1 - 1008)\n" "1. conf_target (numeric) Confirmation target in blocks (1 - 1008)\n"
"2. threshold (numeric, optional) The proportion of transactions in a given feerate range that must have been\n" "2. threshold (numeric, optional) The proportion of transactions in a given feerate range that must have been\n"

View file

@ -32,12 +32,16 @@ static UniValue validateaddress(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"validateaddress \"address\"\n" RPCHelpMan{"validateaddress",
"\nReturn information about the given bitcoin 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" "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" "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" "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" "script, hex, pubkeys, sigsrequired, pubkey, addresses, embedded, iscompressed, account, timestamp, hdkeypath, kdmasterkeyid.\n",
{
{"address", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"address\" (string, required) The bitcoin address to validate\n" "1. \"address\" (string, required) The bitcoin address to validate\n"
"\nResult:\n" "\nResult:\n"
@ -142,8 +146,14 @@ static UniValue verifymessage(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 3) if (request.fHelp || request.params.size() != 3)
throw std::runtime_error( throw std::runtime_error(
"verifymessage \"address\" \"signature\" \"message\"\n" RPCHelpMan{"verifymessage",
"\nVerify a signed message\n" "\nVerify a signed message\n",
{
{"address", RPCArg::Type::STR, false},
{"signature", RPCArg::Type::STR, false},
{"message", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"address\" (string, required) The bitcoin address to use for the signature.\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" "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) if (request.fHelp || request.params.size() != 2)
throw std::runtime_error( throw std::runtime_error(
"signmessagewithprivkey \"privkey\" \"message\"\n" RPCHelpMan{"signmessagewithprivkey",
"\nSign a message with the private key of an address\n" "\nSign a message with the private key of an address\n",
{
{"privkey", RPCArg::Type::STR, false},
{"message", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"privkey\" (string, required) The private key to sign the message with.\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" "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) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"setmocktime timestamp\n" RPCHelpMan{"setmocktime",
"\nSet the local time to given timestamp (-regtest only)\n" "\nSet the local time to given timestamp (-regtest only)\n",
{
{"timestamp", RPCArg::Type::NUM, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. timestamp (integer, required) Unix seconds-since-epoch timestamp\n" "1. timestamp (integer, required) Unix seconds-since-epoch timestamp\n"
" Pass 0 to go back to using the system time." " 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) if (request.fHelp || request.params.size() > 1)
throw std::runtime_error( throw std::runtime_error(
"getmemoryinfo (\"mode\")\n" RPCHelpMan{"getmemoryinfo",
"Returns an object containing information about memory usage.\n" "Returns an object containing information about memory usage.\n",
{
{"mode", RPCArg::Type::STR, true},
}}
.ToString() +
"Arguments:\n" "Arguments:\n"
"1. \"mode\" determines what kind of information is returned. This argument is optional, the default mode is \"stats\".\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" " - \"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) { if (request.fHelp || request.params.size() > 2) {
throw std::runtime_error( throw std::runtime_error(
"logging ( <include> <exclude> )\n" RPCHelpMan{"logging",
"Gets and sets the logging configuration.\n" "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 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" "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" "In addition, the following are available as category names with special meanings:\n"
" - \"all\", \"1\" : represent all logging categories.\n" " - \"all\", \"1\" : represent all logging categories.\n"
" - \"none\", \"0\" : even if other logging categories are specified, ignore all of them.\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" "\nArguments:\n"
"1. \"include\" (array of strings, optional) A json array of categories to add debug logging\n" "1. \"include\" (array of strings, optional) A json array of categories to add debug logging\n"
" [\n" " [\n"
@ -430,11 +459,13 @@ static UniValue echo(const JSONRPCRequest& request)
{ {
if (request.fHelp) if (request.fHelp)
throw std::runtime_error( throw std::runtime_error(
"echo|echojson \"message\" ...\n" RPCHelpMan{"echo|echojson ...",
"\nSimply echo back the input arguments. This command is for testing.\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" "\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." "bitcoin-cli and the GUI. There is no server-side difference.",
); {}}
.ToString() +
"");
return request.params; return request.params;
} }

View file

@ -28,8 +28,9 @@ static UniValue getconnectioncount(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(
"getconnectioncount\n" RPCHelpMan{"getconnectioncount",
"\nReturns the number of connections to other nodes.\n" "\nReturns the number of connections to other nodes.\n", {}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"n (numeric) The connection count\n" "n (numeric) The connection count\n"
"\nExamples:\n" "\nExamples:\n"
@ -47,10 +48,12 @@ static UniValue ping(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(
"ping\n" RPCHelpMan{"ping",
"\nRequests that a ping be sent to all other nodes, to measure ping time.\n" "\nRequests that a ping be sent to all other nodes, to measure ping time.\n"
"Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds.\n" "Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds.\n"
"Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.\n" "Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.\n",
{}}
.ToString() +
"\nExamples:\n" "\nExamples:\n"
+ HelpExampleCli("ping", "") + HelpExampleCli("ping", "")
+ HelpExampleRpc("ping", "") + HelpExampleRpc("ping", "")
@ -70,8 +73,9 @@ static UniValue getpeerinfo(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(
"getpeerinfo\n" RPCHelpMan{"getpeerinfo",
"\nReturns data about each connected network node as a json array of objects.\n" "\nReturns data about each connected network node as a json array of objects.\n", {}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"[\n" "[\n"
" {\n" " {\n"
@ -201,11 +205,16 @@ static UniValue addnode(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 2 || if (request.fHelp || request.params.size() != 2 ||
(strCommand != "onetry" && strCommand != "add" && strCommand != "remove")) (strCommand != "onetry" && strCommand != "add" && strCommand != "remove"))
throw std::runtime_error( throw std::runtime_error(
"addnode \"node\" \"command\"\n" RPCHelpMan{"addnode",
"\nAttempts to add or remove a node from the addnode list.\n" "\nAttempts to add or remove a node from the addnode list.\n"
"Or try a connection to a node once.\n" "Or try a connection to a node once.\n"
"Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be\n" "Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be\n"
"full nodes/support SegWit as other outbound peers are (though such peers will not be synced from).\n" "full nodes/support SegWit as other outbound peers are (though such peers will not be synced from).\n",
{
{"node", RPCArg::Type::STR, false},
{"command", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"node\" (string, required) The node (see getpeerinfo for nodes)\n" "1. \"node\" (string, required) The node (see getpeerinfo for nodes)\n"
"2. \"command\" (string, required) 'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once\n" "2. \"command\" (string, required) 'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once\n"
@ -244,10 +253,15 @@ static UniValue disconnectnode(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() == 0 || request.params.size() >= 3) if (request.fHelp || request.params.size() == 0 || request.params.size() >= 3)
throw std::runtime_error( throw std::runtime_error(
"disconnectnode ( \"address\" nodeid )\n" RPCHelpMan{"disconnectnode",
"\nImmediately disconnects from the specified peer node.\n" "\nImmediately disconnects from the specified peer node.\n"
"\nStrictly one out of 'address' and 'nodeid' can be provided to identify the node.\n" "\nStrictly one out of 'address' and 'nodeid' can be provided to identify the node.\n"
"\nTo disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.\n" "\nTo disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.\n",
{
{"address", RPCArg::Type::STR, true},
{"nodeid", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"address\" (string, optional) The IP address/port of the node\n" "1. \"address\" (string, optional) The IP address/port of the node\n"
"2. nodeid (number, optional) The node ID (see getpeerinfo for node IDs)\n" "2. nodeid (number, optional) The node ID (see getpeerinfo for node IDs)\n"
@ -287,9 +301,13 @@ static UniValue getaddednodeinfo(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 1) if (request.fHelp || request.params.size() > 1)
throw std::runtime_error( throw std::runtime_error(
"getaddednodeinfo ( \"node\" )\n" RPCHelpMan{"getaddednodeinfo",
"\nReturns information about the given added node, or all added nodes\n" "\nReturns information about the given added node, or all added nodes\n"
"(note that onetry addnodes are not listed here)\n" "(note that onetry addnodes are not listed here)\n",
{
{"node", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"node\" (string, optional) If provided, return information about this specific node, otherwise all nodes are returned.\n" "1. \"node\" (string, optional) If provided, return information about this specific node, otherwise all nodes are returned.\n"
"\nResult:\n" "\nResult:\n"
@ -354,9 +372,11 @@ static UniValue getnettotals(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(
"getnettotals\n" RPCHelpMan{"getnettotals",
"\nReturns information about network traffic, including bytes in, bytes out,\n" "\nReturns information about network traffic, including bytes in, bytes out,\n"
"and current time.\n" "and current time.\n",
{}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"{\n" "{\n"
" \"totalbytesrecv\": n, (numeric) Total bytes received\n" " \"totalbytesrecv\": n, (numeric) Total bytes received\n"
@ -420,8 +440,9 @@ static UniValue getnetworkinfo(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(
"getnetworkinfo\n" RPCHelpMan{"getnetworkinfo",
"Returns an object containing various state info regarding P2P networking.\n" "Returns an object containing various state info regarding P2P networking.\n", {}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"{\n" "{\n"
" \"version\": xxxxx, (numeric) the server version\n" " \"version\": xxxxx, (numeric) the server version\n"
@ -500,8 +521,15 @@ static UniValue setban(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 || if (request.fHelp || request.params.size() < 2 ||
(strCommand != "add" && strCommand != "remove")) (strCommand != "add" && strCommand != "remove"))
throw std::runtime_error( throw std::runtime_error(
"setban \"subnet\" \"command\" ( bantime absolute )\n" RPCHelpMan{"setban",
"\nAttempts to add or remove an IP/Subnet from the banned list.\n" "\nAttempts to add or remove an IP/Subnet from the banned list.\n",
{
{"subnet", RPCArg::Type::STR, false},
{"command", RPCArg::Type::STR, false},
{"bantime", RPCArg::Type::NUM, true},
{"absolute", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"subnet\" (string, required) The IP/Subnet (see getpeerinfo for nodes IP) with an optional netmask (default is /32 = single IP)\n" "1. \"subnet\" (string, required) The IP/Subnet (see getpeerinfo for nodes IP) with an optional netmask (default is /32 = single IP)\n"
"2. \"command\" (string, required) 'add' to add an IP/Subnet to the list, 'remove' to remove an IP/Subnet from the list\n" "2. \"command\" (string, required) 'add' to add an IP/Subnet to the list, 'remove' to remove an IP/Subnet from the list\n"
@ -560,8 +588,9 @@ static UniValue listbanned(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(
"listbanned\n" RPCHelpMan{"listbanned",
"\nList all banned IPs/Subnets.\n" "\nList all banned IPs/Subnets.\n", {}}
.ToString() +
"\nExamples:\n" "\nExamples:\n"
+ HelpExampleCli("listbanned", "") + HelpExampleCli("listbanned", "")
+ HelpExampleRpc("listbanned", "") + HelpExampleRpc("listbanned", "")
@ -593,8 +622,9 @@ static UniValue clearbanned(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(
"clearbanned\n" RPCHelpMan{"clearbanned",
"\nClear all banned IPs.\n" "\nClear all banned IPs.\n", {}}
.ToString() +
"\nExamples:\n" "\nExamples:\n"
+ HelpExampleCli("clearbanned", "") + HelpExampleCli("clearbanned", "")
+ HelpExampleRpc("clearbanned", "") + HelpExampleRpc("clearbanned", "")
@ -611,8 +641,12 @@ static UniValue setnetworkactive(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) { if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error( throw std::runtime_error(
"setnetworkactive state\n" RPCHelpMan{"setnetworkactive",
"\nDisable/enable all p2p network activity.\n" "\nDisable/enable all p2p network activity.\n",
{
{"state", RPCArg::Type::BOOL, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"state\" (boolean, required) true to enable networking, false to disable\n" "1. \"state\" (boolean, required) true to enable networking, false to disable\n"
); );
@ -631,8 +665,12 @@ static UniValue getnodeaddresses(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 1) { if (request.fHelp || request.params.size() > 1) {
throw std::runtime_error( throw std::runtime_error(
"getnodeaddresses ( count )\n" RPCHelpMan{"getnodeaddresses",
"\nReturn known addresses which can potentially be used to find new nodes in the network\n" "\nReturn known addresses which can potentially be used to find new nodes in the network\n",
{
{"count", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"count\" (numeric, optional) How many addresses to return. Limited to the smaller of " + std::to_string(ADDRMAN_GETADDR_MAX) + "1. \"count\" (numeric, optional) How many addresses to return. Limited to the smaller of " + std::to_string(ADDRMAN_GETADDR_MAX) +
" or " + std::to_string(ADDRMAN_GETADDR_MAX_PCT) + "% of all known addresses. (default = 1)\n" " or " + std::to_string(ADDRMAN_GETADDR_MAX_PCT) + "% of all known addresses. (default = 1)\n"

View file

@ -66,13 +66,18 @@ static UniValue getrawtransaction(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3) if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error( throw std::runtime_error(
"getrawtransaction \"txid\" ( verbose \"blockhash\" )\n" RPCHelpMan{"getrawtransaction",
"\nNOTE: By default this function only works for mempool transactions. If the -txindex option is\n"
"\nNOTE: By default this function only works for mempool transactions. If the -txindex option is\n" "enabled, it also works for blockchain transactions. If the block which contains the transaction\n"
"enabled, it also works for blockchain transactions. If the block which contains the transaction\n" "is known, its hash can be provided even for nodes without -txindex. Note that if a blockhash is\n"
"is known, its hash can be provided even for nodes without -txindex. Note that if a blockhash is\n" "provided, only that block will be searched and if the transaction is in the mempool or other\n"
"provided, only that block will be searched and if the transaction is in the mempool or other\n" "blocks, or if this node does not have the given block available, the transaction will not be found.\n",
"blocks, or if this node does not have the given block available, the transaction will not be found.\n" {
{"txid", RPCArg::Type::STR_HEX, false},
{"verbose", RPCArg::Type::BOOL, true},
{"blockhash", RPCArg::Type::STR_HEX, true},
}}
.ToString() +
"DEPRECATED: for now, it also works for transactions with unspent outputs.\n" "DEPRECATED: for now, it also works for transactions with unspent outputs.\n"
"\nReturn the raw transaction data.\n" "\nReturn the raw transaction data.\n"
@ -207,6 +212,11 @@ static UniValue gettxoutproof(const JSONRPCRequest& request)
if (request.fHelp || (request.params.size() != 1 && request.params.size() != 2)) if (request.fHelp || (request.params.size() != 1 && request.params.size() != 2))
throw std::runtime_error( throw std::runtime_error(
RPCHelpMan{"gettxoutproof", RPCHelpMan{"gettxoutproof",
"\nReturns a hex-encoded proof that \"txid\" was included in a block.\n"
"\nNOTE: By default this function only works sometimes. This is when there is an\n"
"unspent output in the utxo for this transaction. To make it always work,\n"
"you need to maintain a transaction index, using the -txindex command line option or\n"
"specify the block in which the transaction is included manually (by blockhash).\n",
{ {
{"txids", RPCArg::Type::ARR, {"txids", RPCArg::Type::ARR,
{ {
@ -216,11 +226,6 @@ static UniValue gettxoutproof(const JSONRPCRequest& request)
{"blockhash", RPCArg::Type::STR_HEX, true}, {"blockhash", RPCArg::Type::STR_HEX, true},
}} }}
.ToString() + .ToString() +
"\nReturns a hex-encoded proof that \"txid\" was included in a block.\n"
"\nNOTE: By default this function only works sometimes. This is when there is an\n"
"unspent output in the utxo for this transaction. To make it always work,\n"
"you need to maintain a transaction index, using the -txindex command line option or\n"
"specify the block in which the transaction is included manually (by blockhash).\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"txids\" (string) A json array of txids to filter\n" "1. \"txids\" (string) A json array of txids to filter\n"
" [\n" " [\n"
@ -307,9 +312,13 @@ static UniValue verifytxoutproof(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"verifytxoutproof \"proof\"\n" RPCHelpMan{"verifytxoutproof",
"\nVerifies that a proof points to a transaction in a block, returning the transaction it commits to\n" "\nVerifies that a proof points to a transaction in a block, returning the transaction it commits to\n"
"and throwing an RPC error if the block is not in our best chain\n" "and throwing an RPC error if the block is not in our best chain\n",
{
{"proof", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"proof\" (string, required) The hex-encoded proof generated by gettxoutproof\n" "1. \"proof\" (string, required) The hex-encoded proof generated by gettxoutproof\n"
"\nResult:\n" "\nResult:\n"
@ -514,9 +523,13 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"decoderawtransaction \"hexstring\" ( iswitness )\n" RPCHelpMan{"decoderawtransaction",
"\nReturn a JSON object representing the serialized, hex-encoded transaction.\n" "\nReturn a JSON object representing the serialized, hex-encoded transaction.\n",
{
{"hexstring", RPCArg::Type::STR_HEX, false},
{"iswitness", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"hexstring\" (string, required) The transaction hex string\n" "1. \"hexstring\" (string, required) The transaction hex string\n"
"2. iswitness (boolean, optional) Whether the transaction hex is a serialized witness transaction\n" "2. iswitness (boolean, optional) Whether the transaction hex is a serialized witness transaction\n"
@ -589,8 +602,12 @@ static UniValue decodescript(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"decodescript \"hexstring\"\n" RPCHelpMan{"decodescript",
"\nDecode a hex-encoded script.\n" "\nDecode a hex-encoded script.\n",
{
{"hexstring", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"hexstring\" (string) the hex-encoded script\n" "1. \"hexstring\" (string) the hex-encoded script\n"
"\nResult:\n" "\nResult:\n"
@ -685,6 +702,9 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
RPCHelpMan{"combinerawtransaction", RPCHelpMan{"combinerawtransaction",
"\nCombine multiple partially signed transactions into one transaction.\n"
"The combined transaction may be another partially signed transaction or a \n"
"fully signed transaction.",
{ {
{"txs", RPCArg::Type::ARR, {"txs", RPCArg::Type::ARR,
{ {
@ -693,10 +713,6 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
false}, false},
}} }}
.ToString() + .ToString() +
"\nCombine multiple partially signed transactions into one transaction.\n"
"The combined transaction may be another partially signed transaction or a \n"
"fully signed transaction."
"\nArguments:\n" "\nArguments:\n"
"1. \"txs\" (string) A json array of hex strings of partially signed transactions\n" "1. \"txs\" (string) A json array of hex strings of partially signed transactions\n"
" [\n" " [\n"
@ -916,6 +932,11 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 || request.params.size() > 4) if (request.fHelp || request.params.size() < 2 || request.params.size() > 4)
throw std::runtime_error( throw std::runtime_error(
RPCHelpMan{"signrawtransactionwithkey", RPCHelpMan{"signrawtransactionwithkey",
"\nSign inputs for raw transaction (serialized, hex-encoded).\n"
"The second argument is an array of base58-encoded private\n"
"keys that will be the only keys used to sign the transaction.\n"
"The third optional argument (may be null) is an array of previous transaction outputs that\n"
"this transaction depends on but may not yet be in the block chain.\n",
{ {
{"hexstring", RPCArg::Type::STR, false}, {"hexstring", RPCArg::Type::STR, false},
{"privkyes", RPCArg::Type::ARR, {"privkyes", RPCArg::Type::ARR,
@ -939,12 +960,6 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
{"sighashtype", RPCArg::Type::STR, true}, {"sighashtype", RPCArg::Type::STR, true},
}} }}
.ToString() + .ToString() +
"\nSign inputs for raw transaction (serialized, hex-encoded).\n"
"The second argument is an array of base58-encoded private\n"
"keys that will be the only keys used to sign the transaction.\n"
"The third optional argument (may be null) is an array of previous transaction outputs that\n"
"this transaction depends on but may not yet be in the block chain.\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"hexstring\" (string, required) The transaction hex string\n" "1. \"hexstring\" (string, required) The transaction hex string\n"
"2. \"privkeys\" (string, required) A json array of base58-encoded private keys for signing\n" "2. \"privkeys\" (string, required) A json array of base58-encoded private keys for signing\n"
@ -1025,9 +1040,14 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"sendrawtransaction \"hexstring\" ( allowhighfees )\n" RPCHelpMan{"sendrawtransaction",
"\nSubmits raw transaction (serialized, hex-encoded) to local node and network.\n" "\nSubmits raw transaction (serialized, hex-encoded) to local node and network.\n"
"\nAlso see createrawtransaction and signrawtransactionwithkey calls.\n" "\nAlso see createrawtransaction and signrawtransactionwithkey calls.\n",
{
{"hexstring", RPCArg::Type::STR_HEX, false},
{"allowhighfees", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"hexstring\" (string, required) The hex string of the raw transaction)\n" "1. \"hexstring\" (string, required) The hex string of the raw transaction)\n"
"2. allowhighfees (boolean, optional, default=false) Allow high fees\n" "2. allowhighfees (boolean, optional, default=false) Allow high fees\n"
@ -1218,9 +1238,12 @@ UniValue decodepsbt(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"decodepsbt \"psbt\"\n" RPCHelpMan{"decodepsbt",
"\nReturn a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction.\n" "\nReturn a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction.\n",
{
{"psbt", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"psbt\" (string, required) The PSBT base64 string\n" "1. \"psbt\" (string, required) The PSBT base64 string\n"
@ -1494,6 +1517,8 @@ UniValue combinepsbt(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
RPCHelpMan{"combinepsbt", RPCHelpMan{"combinepsbt",
"\nCombine multiple partially signed Bitcoin transactions into one transaction.\n"
"Implements the Combiner role.\n",
{ {
{"txs", RPCArg::Type::ARR, {"txs", RPCArg::Type::ARR,
{ {
@ -1502,8 +1527,6 @@ UniValue combinepsbt(const JSONRPCRequest& request)
false}, false},
}} }}
.ToString() + .ToString() +
"\nCombine multiple partially signed Bitcoin transactions into one transaction.\n"
"Implements the Combiner role.\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"txs\" (string) A json array of base64 strings of partially signed transactions\n" "1. \"txs\" (string) A json array of base64 strings of partially signed transactions\n"
" [\n" " [\n"
@ -1554,11 +1577,16 @@ UniValue finalizepsbt(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"finalizepsbt \"psbt\" ( extract )\n" RPCHelpMan{"finalizepsbt",
"Finalize the inputs of a PSBT. If the transaction is fully signed, it will produce a\n" "Finalize the inputs of a PSBT. If the transaction is fully signed, it will produce a\n"
"network serialized transaction which can be broadcast with sendrawtransaction. Otherwise a PSBT will be\n" "network serialized transaction which can be broadcast with sendrawtransaction. Otherwise a PSBT will be\n"
"created which has the final_scriptSig and final_scriptWitness fields filled for inputs that are complete.\n" "created which has the final_scriptSig and final_scriptWitness fields filled for inputs that are complete.\n"
"Implements the Finalizer and Extractor roles.\n" "Implements the Finalizer and Extractor roles.\n",
{
{"psbt", RPCArg::Type::STR, false},
{"extract", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"psbt\" (string) A base64 string of a PSBT\n" "1. \"psbt\" (string) A base64 string of a PSBT\n"
"2. \"extract\" (boolean, optional, default=true) If true and the transaction is complete, \n" "2. \"extract\" (boolean, optional, default=true) If true and the transaction is complete, \n"
@ -1619,6 +1647,8 @@ UniValue createpsbt(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 || request.params.size() > 4) if (request.fHelp || request.params.size() < 2 || request.params.size() > 4)
throw std::runtime_error( throw std::runtime_error(
RPCHelpMan{"createpsbt", RPCHelpMan{"createpsbt",
"\nCreates a transaction in the Partially Signed Transaction format.\n"
"Implements the Creator role.\n",
{ {
{"inputs", RPCArg::Type::ARR, {"inputs", RPCArg::Type::ARR,
{ {
@ -1649,8 +1679,6 @@ UniValue createpsbt(const JSONRPCRequest& request)
{"replaceable", RPCArg::Type::BOOL, true}, {"replaceable", RPCArg::Type::BOOL, true},
}} }}
.ToString() + .ToString() +
"\nCreates a transaction in the Partially Signed Transaction format.\n"
"Implements the Creator role.\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"inputs\" (array, required) A json array of json objects\n" "1. \"inputs\" (array, required) A json array of json objects\n"
" [\n" " [\n"
@ -1713,9 +1741,15 @@ UniValue converttopsbt(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3) if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error( throw std::runtime_error(
"converttopsbt \"hexstring\" ( permitsigdata iswitness )\n" RPCHelpMan{"converttopsbt",
"\nConverts a network serialized transaction to a PSBT. This should be used only with createrawtransaction and fundrawtransaction\n" "\nConverts a network serialized transaction to a PSBT. This should be used only with createrawtransaction and fundrawtransaction\n"
"createpsbt and walletcreatefundedpsbt should be used for new applications.\n" "createpsbt and walletcreatefundedpsbt should be used for new applications.\n",
{
{"hexstring", RPCArg::Type::STR_HEX, false},
{"permitsigdata", RPCArg::Type::BOOL, true},
{"iswitness", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"hexstring\" (string, required) The hex string of a raw transaction\n" "1. \"hexstring\" (string, required) The hex string of a raw transaction\n"
"2. permitsigdata (boolean, optional, default=false) If true, any signatures in the input will be discarded and conversion.\n" "2. permitsigdata (boolean, optional, default=false) If true, any signatures in the input will be discarded and conversion.\n"

View file

@ -204,8 +204,12 @@ UniValue help(const JSONRPCRequest& jsonRequest)
{ {
if (jsonRequest.fHelp || jsonRequest.params.size() > 1) if (jsonRequest.fHelp || jsonRequest.params.size() > 1)
throw std::runtime_error( throw std::runtime_error(
"help ( \"command\" )\n" RPCHelpMan{"help",
"\nList all commands, or get help for a specified command.\n" "\nList all commands, or get help for a specified command.\n",
{
{"command", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"command\" (string, optional) The command to get help on\n" "1. \"command\" (string, optional) The command to get help on\n"
"\nResult:\n" "\nResult:\n"
@ -225,8 +229,9 @@ UniValue stop(const JSONRPCRequest& jsonRequest)
// Accept the deprecated and ignored 'detach' boolean argument // Accept the deprecated and ignored 'detach' boolean argument
if (jsonRequest.fHelp || jsonRequest.params.size() > 1) if (jsonRequest.fHelp || jsonRequest.params.size() > 1)
throw std::runtime_error( throw std::runtime_error(
"stop\n" RPCHelpMan{"stop",
"\nStop Bitcoin server."); "\nStop Bitcoin server.", {}}
.ToString());
// Event loop will exit after current HTTP requests have been handled, so // Event loop will exit after current HTTP requests have been handled, so
// this reply will get back to the client. // this reply will get back to the client.
StartShutdown(); StartShutdown();
@ -237,8 +242,9 @@ static UniValue uptime(const JSONRPCRequest& jsonRequest)
{ {
if (jsonRequest.fHelp || jsonRequest.params.size() > 0) if (jsonRequest.fHelp || jsonRequest.params.size() > 0)
throw std::runtime_error( throw std::runtime_error(
"uptime\n" RPCHelpMan{"uptime",
"\nReturns the total uptime of the server.\n" "\nReturns the total uptime of the server.\n", {}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"ttt (numeric) The number of seconds that the server has been running\n" "ttt (numeric) The number of seconds that the server has been running\n"
"\nExamples:\n" "\nExamples:\n"

View file

@ -150,6 +150,8 @@ std::string RPCHelpMan::ToString() const
if (is_optional) ret += " )"; if (is_optional) ret += " )";
ret += "\n"; ret += "\n";
ret += m_description;
return ret; return ret;
} }
@ -185,6 +187,8 @@ std::string RPCArg::ToStringObj() const
std::string RPCArg::ToString() const std::string RPCArg::ToString() const
{ {
if (!m_oneline_description.empty()) return m_oneline_description;
switch (m_type) { switch (m_type) {
case Type::STR_HEX: case Type::STR_HEX:
case Type::STR: { case Type::STR: {

View file

@ -45,15 +45,16 @@ struct RPCArg {
const Type m_type; const Type m_type;
const std::vector<RPCArg> m_inner; //!< Only used for arrays or dicts const std::vector<RPCArg> m_inner; //!< Only used for arrays or dicts
const bool m_optional; const bool m_optional;
const std::string m_oneline_description; //!< Should be empty unless it is supposed to override the auto-generated summary line
RPCArg(const std::string& name, const Type& type, const bool optional) RPCArg(const std::string& name, const Type& type, const bool optional, const std::string& oneline_description = "")
: m_name{name}, m_type{type}, m_optional{optional} : m_name{name}, m_type{type}, m_optional{optional}, m_oneline_description{oneline_description}
{ {
assert(type != Type::ARR && type != Type::OBJ); assert(type != Type::ARR && type != Type::OBJ);
} }
RPCArg(const std::string& name, const Type& type, const std::vector<RPCArg>& inner, const bool optional) RPCArg(const std::string& name, const Type& type, const std::vector<RPCArg>& inner, const bool optional, const std::string& oneline_description = "")
: m_name{name}, m_type{type}, m_inner{inner}, m_optional{optional} : m_name{name}, m_type{type}, m_inner{inner}, m_optional{optional}, m_oneline_description{oneline_description}
{ {
assert(type == Type::ARR || type == Type::OBJ); assert(type == Type::ARR || type == Type::OBJ);
} }
@ -67,8 +68,8 @@ private:
class RPCHelpMan class RPCHelpMan
{ {
public: public:
RPCHelpMan(const std::string& name, const std::vector<RPCArg>& args) RPCHelpMan(const std::string& name, const std::string& description, const std::vector<RPCArg>& args)
: m_name{name}, m_args{args} : m_name{name}, m_description{description}, m_args{args}
{ {
} }
@ -76,6 +77,7 @@ public:
private: private:
const std::string m_name; const std::string m_name;
const std::string m_description;
const std::vector<RPCArg> m_args; const std::vector<RPCArg> m_args;
}; };

View file

@ -109,8 +109,14 @@ UniValue importprivkey(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3) if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error( throw std::runtime_error(
"importprivkey \"privkey\" ( \"label\" ) ( rescan )\n" RPCHelpMan{"importprivkey",
"\nAdds a private key (as returned by dumpprivkey) to your wallet. Requires a new wallet backup.\n" "\nAdds a private key (as returned by dumpprivkey) to your wallet. Requires a new wallet backup.\n",
{
{"privkey", RPCArg::Type::STR, false},
{"label", RPCArg::Type::STR, true},
{"rescan", RPCArg::Type::BOOL, true},
}}
.ToString() +
"Hint: use importmulti to import more than one private key.\n" "Hint: use importmulti to import more than one private key.\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"privkey\" (string, required) The private key (see dumpprivkey)\n" "1. \"privkey\" (string, required) The private key (see dumpprivkey)\n"
@ -206,8 +212,9 @@ UniValue abortrescan(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(
"abortrescan\n" RPCHelpMan{"abortrescan",
"\nStops current wallet rescan triggered by an RPC call, e.g. by an importprivkey call.\n" "\nStops current wallet rescan triggered by an RPC call, e.g. by an importprivkey call.\n", {}}
.ToString() +
"\nExamples:\n" "\nExamples:\n"
"\nImport a private key\n" "\nImport a private key\n"
+ HelpExampleCli("importprivkey", "\"mykey\"") + + HelpExampleCli("importprivkey", "\"mykey\"") +
@ -268,8 +275,15 @@ UniValue importaddress(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4) if (request.fHelp || request.params.size() < 1 || request.params.size() > 4)
throw std::runtime_error( throw std::runtime_error(
"importaddress \"address\" ( \"label\" rescan p2sh )\n" RPCHelpMan{"importaddress",
"\nAdds an address or script (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.\n" "\nAdds an address or script (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.\n",
{
{"address", RPCArg::Type::STR, false},
{"label", RPCArg::Type::STR, true},
{"rescan", RPCArg::Type::BOOL, true},
{"p2sh", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"address\" (string, required) The Bitcoin address (or hex-encoded script)\n" "1. \"address\" (string, required) The Bitcoin address (or hex-encoded script)\n"
"2. \"label\" (string, optional, default=\"\") An optional label\n" "2. \"label\" (string, optional, default=\"\") An optional label\n"
@ -348,8 +362,13 @@ UniValue importprunedfunds(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 2) if (request.fHelp || request.params.size() != 2)
throw std::runtime_error( throw std::runtime_error(
"importprunedfunds \"rawtransaction\" \"txoutproof\"\n" RPCHelpMan{"importprunedfunds",
"\nImports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets. The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.\n" "\nImports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets. The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.\n",
{
{"rawtransaction", RPCArg::Type::STR_HEX, false},
{"txoutproof", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"rawtransaction\" (string, required) A raw transaction in hex funding an already-existing address in wallet\n" "1. \"rawtransaction\" (string, required) A raw transaction in hex funding an already-existing address in wallet\n"
"2. \"txoutproof\" (string, required) The hex output from gettxoutproof that contains the transaction\n" "2. \"txoutproof\" (string, required) The hex output from gettxoutproof that contains the transaction\n"
@ -412,8 +431,12 @@ UniValue removeprunedfunds(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"removeprunedfunds \"txid\"\n" RPCHelpMan{"removeprunedfunds",
"\nDeletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.\n" "\nDeletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.\n",
{
{"txid", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"txid\" (string, required) The hex-encoded id of the transaction you are deleting\n" "1. \"txid\" (string, required) The hex-encoded id of the transaction you are deleting\n"
"\nExamples:\n" "\nExamples:\n"
@ -451,8 +474,14 @@ UniValue importpubkey(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3) if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error( throw std::runtime_error(
"importpubkey \"pubkey\" ( \"label\" rescan )\n" RPCHelpMan{"importpubkey",
"\nAdds a public key (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.\n" "\nAdds a public key (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Requires a new wallet backup.\n",
{
{"pubkey", RPCArg::Type::STR, false},
{"label", RPCArg::Type::STR, true},
{"rescan", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"pubkey\" (string, required) The hex-encoded public key\n" "1. \"pubkey\" (string, required) The hex-encoded public key\n"
"2. \"label\" (string, optional, default=\"\") An optional label\n" "2. \"label\" (string, optional, default=\"\") An optional label\n"
@ -523,8 +552,12 @@ UniValue importwallet(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"importwallet \"filename\"\n" RPCHelpMan{"importwallet",
"\nImports keys from a wallet dump file (see dumpwallet). Requires a new wallet backup to include imported keys.\n" "\nImports keys from a wallet dump file (see dumpwallet). Requires a new wallet backup to include imported keys.\n",
{
{"filename", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"filename\" (string, required) The wallet file\n" "1. \"filename\" (string, required) The wallet file\n"
"\nExamples:\n" "\nExamples:\n"
@ -653,9 +686,13 @@ UniValue dumpprivkey(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"dumpprivkey \"address\"\n" RPCHelpMan{"dumpprivkey",
"\nReveals the private key corresponding to 'address'.\n" "\nReveals the private key corresponding to 'address'.\n"
"Then the importprivkey can be used with this output\n" "Then the importprivkey can be used with this output\n",
{
{"address", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"address\" (string, required) The bitcoin address for the private key\n" "1. \"address\" (string, required) The bitcoin address for the private key\n"
"\nResult:\n" "\nResult:\n"
@ -698,11 +735,15 @@ UniValue dumpwallet(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"dumpwallet \"filename\"\n" RPCHelpMan{"dumpwallet",
"\nDumps all wallet keys in a human-readable format to a server-side file. This does not allow overwriting existing files.\n" "\nDumps all wallet keys in a human-readable format to a server-side file. This does not allow overwriting existing files.\n"
"Imported scripts are included in the dumpfile, but corresponding BIP173 addresses, etc. may not be added automatically by importwallet.\n" "Imported scripts are included in the dumpfile, but corresponding BIP173 addresses, etc. may not be added automatically by importwallet.\n"
"Note that if your wallet contains keys which are not derived from your HD seed (e.g. imported keys), these are not covered by\n" "Note that if your wallet contains keys which are not derived from your HD seed (e.g. imported keys), these are not covered by\n"
"only backing up the seed itself, and must be backed up too (e.g. ensure you back up the whole dumpfile).\n" "only backing up the seed itself, and must be backed up too (e.g. ensure you back up the whole dumpfile).\n",
{
{"filename", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"filename\" (string, required) The filename with path (either absolute or relative to bitcoind)\n" "1. \"filename\" (string, required) The filename with path (either absolute or relative to bitcoind)\n"
"\nResult:\n" "\nResult:\n"
@ -1083,11 +1124,35 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
return NullUniValue; return NullUniValue;
} }
// clang-format off
if (mainRequest.fHelp || mainRequest.params.size() < 1 || mainRequest.params.size() > 2) if (mainRequest.fHelp || mainRequest.params.size() < 1 || mainRequest.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"importmulti \"requests\" ( \"options\" )\n" RPCHelpMan{"importmulti",
"\nImport addresses/scripts (with private or public keys, redeem script (P2SH)), rescanning all addresses in one-shot-only (rescan can be disabled via options). Requires a new wallet backup.\n\n" "\nImport addresses/scripts (with private or public keys, redeem script (P2SH)), rescanning all addresses in one-shot-only (rescan can be disabled via options). Requires a new wallet backup.\n\n",
{
{"requests", RPCArg::Type::ARR,
{
{"", RPCArg::Type::OBJ,
{
{
{"scriptPubKey", RPCArg::Type::STR, false},
{"timestamp", RPCArg::Type::NUM, false},
{"redeemscript", RPCArg::Type::STR, true},
{"witnessscript", RPCArg::Type::STR, true},
{"internal", RPCArg::Type::BOOL, true},
{"watchonly", RPCArg::Type::BOOL, true},
{"label", RPCArg::Type::STR, true},
},
},
false},
},
false, "\"requests\""},
{"options", RPCArg::Type::OBJ,
{
{"rescan", RPCArg::Type::BOOL, true},
},
true, "\"options\""},
}}
.ToString() +
"Arguments:\n" "Arguments:\n"
"1. requests (array, required) Data to be imported\n" "1. requests (array, required) Data to be imported\n"
" [ (array of json objects)\n" " [ (array of json objects)\n"
@ -1123,7 +1188,6 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
"\nResponse is an array with the same size as the input that has the execution result :\n" "\nResponse is an array with the same size as the input that has the execution result :\n"
" [{ \"success\": true } , { \"success\": false, \"error\": { \"code\": -1, \"message\": \"Internal Server Error\"} }, ... ]\n"); " [{ \"success\": true } , { \"success\": false, \"error\": { \"code\": -1, \"message\": \"Internal Server Error\"} }, ... ]\n");
// clang-format on
RPCTypeCheck(mainRequest.params, {UniValue::VARR, UniValue::VOBJ}); RPCTypeCheck(mainRequest.params, {UniValue::VARR, UniValue::VOBJ});

View file

@ -149,10 +149,15 @@ static UniValue getnewaddress(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 2) if (request.fHelp || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"getnewaddress ( \"label\" \"address_type\" )\n" RPCHelpMan{"getnewaddress",
"\nReturns a new Bitcoin address for receiving payments.\n" "\nReturns a new Bitcoin address for receiving payments.\n"
"If 'label' is specified, it is added to the address book \n" "If 'label' is specified, it is added to the address book \n"
"so payments received with the address will be associated with 'label'.\n" "so payments received with the address will be associated with 'label'.\n",
{
{"label", RPCArg::Type::STR, true},
{"address_type", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"label\" (string, optional) The label name for the address to be linked to. If not provided, the default label \"\" is used. It can also be set to the empty string \"\" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name.\n" "1. \"label\" (string, optional) The label name for the address to be linked to. If not provided, the default label \"\" is used. It can also be set to the empty string \"\" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name.\n"
"2. \"address_type\" (string, optional) The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\". Default is set by -addresstype.\n" "2. \"address_type\" (string, optional) The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\". Default is set by -addresstype.\n"
@ -209,9 +214,13 @@ static UniValue getrawchangeaddress(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 1) if (request.fHelp || request.params.size() > 1)
throw std::runtime_error( throw std::runtime_error(
"getrawchangeaddress ( \"address_type\" )\n" RPCHelpMan{"getrawchangeaddress",
"\nReturns a new Bitcoin address, for receiving change.\n" "\nReturns a new Bitcoin address, for receiving change.\n"
"This is for use with raw transactions, NOT normal use.\n" "This is for use with raw transactions, NOT normal use.\n",
{
{"address_type", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"address_type\" (string, optional) The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\". Default is set by -changetype.\n" "1. \"address_type\" (string, optional) The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\". Default is set by -changetype.\n"
"\nResult:\n" "\nResult:\n"
@ -263,8 +272,13 @@ static UniValue setlabel(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 2) if (request.fHelp || request.params.size() != 2)
throw std::runtime_error( throw std::runtime_error(
"setlabel \"address\" \"label\"\n" RPCHelpMan{"setlabel",
"\nSets the label associated with the given address.\n" "\nSets the label associated with the given address.\n",
{
{"address", RPCArg::Type::STR, false},
{"label", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"address\" (string, required) The bitcoin address to be associated with a label.\n" "1. \"address\" (string, required) The bitcoin address to be associated with a label.\n"
"2. \"label\" (string, required) The label to assign to the address.\n" "2. \"label\" (string, required) The label to assign to the address.\n"
@ -343,9 +357,20 @@ static UniValue sendtoaddress(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 || request.params.size() > 8) if (request.fHelp || request.params.size() < 2 || request.params.size() > 8)
throw std::runtime_error( throw std::runtime_error(
"sendtoaddress \"address\" amount ( \"comment\" \"comment_to\" subtractfeefromamount replaceable conf_target \"estimate_mode\")\n" RPCHelpMan{"sendtoaddress",
"\nSend an amount to a given address.\n" "\nSend an amount to a given address.\n",
+ HelpRequiringPassphrase(pwallet) + {
{"address", RPCArg::Type::STR, false},
{"amount", RPCArg::Type::AMOUNT, false},
{"comment", RPCArg::Type::STR, true},
{"comment_to", RPCArg::Type::STR, true},
{"subtractfeefromamount", RPCArg::Type::BOOL, true},
{"replaceable", RPCArg::Type::BOOL, true},
{"conf_target", RPCArg::Type::NUM, true},
{"estimate_mode", RPCArg::Type::STR, true},
}}
.ToString() +
HelpRequiringPassphrase(pwallet) +
"\nArguments:\n" "\nArguments:\n"
"1. \"address\" (string, required) The bitcoin address to send to.\n" "1. \"address\" (string, required) The bitcoin address to send to.\n"
"2. \"amount\" (numeric or string, required) The amount in " + CURRENCY_UNIT + " to send. eg 0.1\n" "2. \"amount\" (numeric or string, required) The amount in " + CURRENCY_UNIT + " to send. eg 0.1\n"
@ -433,10 +458,12 @@ static UniValue listaddressgroupings(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(
"listaddressgroupings\n" RPCHelpMan{"listaddressgroupings",
"\nLists groups of addresses which have had their common ownership\n" "\nLists groups of addresses which have had their common ownership\n"
"made public by common use as inputs or as the resulting change\n" "made public by common use as inputs or as the resulting change\n"
"in past transactions\n" "in past transactions\n",
{}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"[\n" "[\n"
" [\n" " [\n"
@ -493,9 +520,14 @@ static UniValue signmessage(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 2) if (request.fHelp || request.params.size() != 2)
throw std::runtime_error( throw std::runtime_error(
"signmessage \"address\" \"message\"\n" RPCHelpMan{"signmessage",
"\nSign a message with the private key of an address" "\nSign a message with the private key of an address",
+ HelpRequiringPassphrase(pwallet) + "\n" {
{"address", RPCArg::Type::STR, false},
{"message", RPCArg::Type::STR, false},
}}
.ToString() +
HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"address\" (string, required) The bitcoin address to use for the private key.\n" "1. \"address\" (string, required) The bitcoin address to use for the private key.\n"
"2. \"message\" (string, required) The message to create a signature of.\n" "2. \"message\" (string, required) The message to create a signature of.\n"
@ -557,8 +589,13 @@ static UniValue getreceivedbyaddress(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"getreceivedbyaddress \"address\" ( minconf )\n" RPCHelpMan{"getreceivedbyaddress",
"\nReturns the total amount received by the given address in transactions with at least minconf confirmations.\n" "\nReturns the total amount received by the given address in transactions with at least minconf confirmations.\n",
{
{"address", RPCArg::Type::STR, false},
{"minconf", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"address\" (string, required) The bitcoin address for transactions.\n" "1. \"address\" (string, required) The bitcoin address for transactions.\n"
"2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n" "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
@ -626,8 +663,13 @@ static UniValue getreceivedbylabel(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"getreceivedbylabel \"label\" ( minconf )\n" RPCHelpMan{"getreceivedbylabel",
"\nReturns the total amount received by addresses with <label> in transactions with at least [minconf] confirmations.\n" "\nReturns the total amount received by addresses with <label> in transactions with at least [minconf] confirmations.\n",
{
{"label", RPCArg::Type::STR, false},
{"minconf", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"label\" (string, required) The selected label, may be the default label using \"\".\n" "1. \"label\" (string, required) The selected label, may be the default label using \"\".\n"
"2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n" "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
@ -693,10 +735,16 @@ static UniValue getbalance(const JSONRPCRequest& request)
if (request.fHelp || (request.params.size() > 3 )) if (request.fHelp || (request.params.size() > 3 ))
throw std::runtime_error( throw std::runtime_error(
"getbalance ( \"dummy\" minconf include_watchonly )\n" RPCHelpMan{"getbalance",
"\nReturns the total available balance.\n" "\nReturns the total available balance.\n"
"The available balance is what the wallet considers currently spendable, and is\n" "The available balance is what the wallet considers currently spendable, and is\n"
"thus affected by options which limit spendability such as -spendzeroconfchange.\n" "thus affected by options which limit spendability such as -spendzeroconfchange.\n",
{
{"dummy", RPCArg::Type::STR, true},
{"minconf", RPCArg::Type::NUM, true},
{"include_watchonly", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. (dummy) (string, optional) Remains for backward compatibility. Must be excluded or set to \"*\".\n" "1. (dummy) (string, optional) Remains for backward compatibility. Must be excluded or set to \"*\".\n"
"2. minconf (numeric, optional, default=0) Only include transactions confirmed at least this many times.\n" "2. minconf (numeric, optional, default=0) Only include transactions confirmed at least this many times.\n"
@ -748,8 +796,9 @@ static UniValue getunconfirmedbalance(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(
"getunconfirmedbalance\n" RPCHelpMan{"getunconfirmedbalance",
"Returns the server's total unconfirmed balance\n"); "Returns the server's total unconfirmed balance\n", {}}
.ToString());
// Make sure the results are valid at least up to the most recent block // Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now // the user could have gotten from another RPC command prior to now
@ -773,9 +822,28 @@ static UniValue sendmany(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 || request.params.size() > 8) if (request.fHelp || request.params.size() < 2 || request.params.size() > 8)
throw std::runtime_error( throw std::runtime_error(
"sendmany \"\" {\"address\":amount,...} ( minconf \"comment\" [\"address\",...] replaceable conf_target \"estimate_mode\")\n" RPCHelpMan{"sendmany",
"\nSend multiple times. Amounts are double-precision floating point numbers.\n" "\nSend multiple times. Amounts are double-precision floating point numbers.\n",
+ HelpRequiringPassphrase(pwallet) + "\n" {
{"dummy", RPCArg::Type::STR, false, "\"\""},
{"amounts", RPCArg::Type::OBJ,
{
{"address", RPCArg::Type::AMOUNT, false},
},
false},
{"minconf", RPCArg::Type::NUM, true},
{"comment", RPCArg::Type::STR, true},
{"subtractfeefrom", RPCArg::Type::ARR,
{
{"address", RPCArg::Type::STR, true},
},
true},
{"replaceable", RPCArg::Type::BOOL, true},
{"conf_target", RPCArg::Type::NUM, true},
{"estimate_mode", RPCArg::Type::STR, true},
}}
.ToString() +
HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"dummy\" (string, required) Must be set to \"\" for backwards compatibility.\n" "1. \"dummy\" (string, required) Must be set to \"\" for backwards compatibility.\n"
"2. \"amounts\" (string, required) A json object with addresses and amounts\n" "2. \"amounts\" (string, required) A json object with addresses and amounts\n"
@ -1166,8 +1234,15 @@ static UniValue listreceivedbyaddress(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 4) if (request.fHelp || request.params.size() > 4)
throw std::runtime_error( throw std::runtime_error(
"listreceivedbyaddress ( minconf include_empty include_watchonly address_filter )\n" RPCHelpMan{"listreceivedbyaddress",
"\nList balances by receiving address.\n" "\nList balances by receiving address.\n",
{
{"minconf", RPCArg::Type::NUM, true},
{"include_empty", RPCArg::Type::BOOL, true},
{"include_watchonly", RPCArg::Type::BOOL, true},
{"address_filter", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n" "1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n"
"2. include_empty (bool, optional, default=false) Whether to include addresses that haven't received any payments.\n" "2. include_empty (bool, optional, default=false) Whether to include addresses that haven't received any payments.\n"
@ -1217,8 +1292,14 @@ static UniValue listreceivedbylabel(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 3) if (request.fHelp || request.params.size() > 3)
throw std::runtime_error( throw std::runtime_error(
"listreceivedbylabel ( minconf include_empty include_watchonly)\n" RPCHelpMan{"listreceivedbylabel",
"\nList received transactions by label.\n" "\nList received transactions by label.\n",
{
{"minconf", RPCArg::Type::NUM, true},
{"include_empty", RPCArg::Type::BOOL, true},
{"include_watchonly", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n" "1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n"
"2. include_empty (bool, optional, default=false) Whether to include labels that haven't received any payments.\n" "2. include_empty (bool, optional, default=false) Whether to include labels that haven't received any payments.\n"
@ -1356,9 +1437,16 @@ UniValue listtransactions(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 4) if (request.fHelp || request.params.size() > 4)
throw std::runtime_error( throw std::runtime_error(
"listtransactions ( \"label\" count skip include_watchonly )\n" RPCHelpMan{"listtransactions",
"\nIf a label name is provided, this will return only incoming transactions paying to addresses with the specified label.\n" "\nIf a label name is provided, this will return only incoming transactions paying to addresses with the specified label.\n"
"\nReturns up to 'count' most recent transactions skipping the first 'from' transactions.\n" "\nReturns up to 'count' most recent transactions skipping the first 'from' transactions.\n",
{
{"label", RPCArg::Type::STR, true},
{"count", RPCArg::Type::NUM, true},
{"skip", RPCArg::Type::NUM, true},
{"include_watchonly", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"label\" (string, optional) If set, should be a valid label name to return only incoming transactions\n" "1. \"label\" (string, optional) If set, should be a valid label name to return only incoming transactions\n"
" with the specified label, or \"*\" to disable filtering and return all transactions.\n" " with the specified label, or \"*\" to disable filtering and return all transactions.\n"
@ -1483,10 +1571,17 @@ static UniValue listsinceblock(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 4) if (request.fHelp || request.params.size() > 4)
throw std::runtime_error( throw std::runtime_error(
"listsinceblock ( \"blockhash\" target_confirmations include_watchonly include_removed )\n" RPCHelpMan{"listsinceblock",
"\nGet all transactions in blocks since block [blockhash], or all transactions if omitted.\n" "\nGet all transactions in blocks since block [blockhash], or all transactions if omitted.\n"
"If \"blockhash\" is no longer a part of the main chain, transactions from the fork point onward are included.\n" "If \"blockhash\" is no longer a part of the main chain, transactions from the fork point onward are included.\n"
"Additionally, if include_removed is set, transactions affecting the wallet which were removed are returned in the \"removed\" array.\n" "Additionally, if include_removed is set, transactions affecting the wallet which were removed are returned in the \"removed\" array.\n",
{
{"blockhash", RPCArg::Type::STR, true},
{"target_confirmations", RPCArg::Type::NUM, true},
{"include_watchonly", RPCArg::Type::BOOL, true},
{"include_removed", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"blockhash\" (string, optional) The block hash to list transactions since\n" "1. \"blockhash\" (string, optional) The block hash to list transactions since\n"
"2. target_confirmations: (numeric, optional, default=1) Return the nth block hash from the main chain. e.g. 1 would mean the best block hash. Note: this is not used as a filter, but only affects [lastblock] in the return value\n" "2. target_confirmations: (numeric, optional, default=1) Return the nth block hash from the main chain. e.g. 1 would mean the best block hash. Note: this is not used as a filter, but only affects [lastblock] in the return value\n"
@ -1623,8 +1718,13 @@ static UniValue gettransaction(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
"gettransaction \"txid\" ( include_watchonly )\n" RPCHelpMan{"gettransaction",
"\nGet detailed information about in-wallet transaction <txid>\n" "\nGet detailed information about in-wallet transaction <txid>\n",
{
{"txid", RPCArg::Type::STR, false},
{"include_watchonly", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"txid\" (string, required) The transaction id\n" "1. \"txid\" (string, required) The transaction id\n"
"2. \"include_watchonly\" (bool, optional, default=false) Whether to include watch-only addresses in balance calculation and details[]\n" "2. \"include_watchonly\" (bool, optional, default=false) Whether to include watch-only addresses in balance calculation and details[]\n"
@ -1718,12 +1818,16 @@ static UniValue abandontransaction(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) { if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error( throw std::runtime_error(
"abandontransaction \"txid\"\n" RPCHelpMan{"abandontransaction",
"\nMark in-wallet transaction <txid> as abandoned\n" "\nMark in-wallet transaction <txid> as abandoned\n"
"This will mark this transaction and all its in-wallet descendants as abandoned which will allow\n" "This will mark this transaction and all its in-wallet descendants as abandoned which will allow\n"
"for their inputs to be respent. It can be used to replace \"stuck\" or evicted transactions.\n" "for their inputs to be respent. It can be used to replace \"stuck\" or evicted transactions.\n"
"It only works on transactions which are not included in a block and are not currently in the mempool.\n" "It only works on transactions which are not included in a block and are not currently in the mempool.\n"
"It has no effect on transactions which are already abandoned.\n" "It has no effect on transactions which are already abandoned.\n",
{
{"txid", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"txid\" (string, required) The transaction id\n" "1. \"txid\" (string, required) The transaction id\n"
"\nResult:\n" "\nResult:\n"
@ -1764,8 +1868,12 @@ static UniValue backupwallet(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"backupwallet \"destination\"\n" RPCHelpMan{"backupwallet",
"\nSafely copies current wallet file to destination, which can be a directory or a path with filename.\n" "\nSafely copies current wallet file to destination, which can be a directory or a path with filename.\n",
{
{"destination", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"destination\" (string) The destination directory or file\n" "1. \"destination\" (string) The destination directory or file\n"
"\nExamples:\n" "\nExamples:\n"
@ -1800,9 +1908,13 @@ static UniValue keypoolrefill(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 1) if (request.fHelp || request.params.size() > 1)
throw std::runtime_error( throw std::runtime_error(
"keypoolrefill ( newsize )\n" RPCHelpMan{"keypoolrefill",
"\nFills the keypool." "\nFills the keypool.",
+ HelpRequiringPassphrase(pwallet) + "\n" {
{"newsize", RPCArg::Type::NUM, true},
}}
.ToString() +
HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments\n" "\nArguments\n"
"1. newsize (numeric, optional, default=100) The new keypool size\n" "1. newsize (numeric, optional, default=100) The new keypool size\n"
"\nExamples:\n" "\nExamples:\n"
@ -1847,9 +1959,14 @@ static UniValue walletpassphrase(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 2) { if (request.fHelp || request.params.size() != 2) {
throw std::runtime_error( throw std::runtime_error(
"walletpassphrase \"passphrase\" timeout\n" RPCHelpMan{"walletpassphrase",
"\nStores the wallet decryption key in memory for 'timeout' seconds.\n" "\nStores the wallet decryption key in memory for 'timeout' seconds.\n"
"This is needed prior to performing transactions related to private keys such as sending bitcoins\n" "This is needed prior to performing transactions related to private keys such as sending bitcoins\n",
{
{"passphrase", RPCArg::Type::STR, false},
{"timeout", RPCArg::Type::NUM, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"passphrase\" (string, required) The wallet passphrase\n" "1. \"passphrase\" (string, required) The wallet passphrase\n"
"2. timeout (numeric, required) The time to keep the decryption key in seconds; capped at 100000000 (~3 years).\n" "2. timeout (numeric, required) The time to keep the decryption key in seconds; capped at 100000000 (~3 years).\n"
@ -1900,8 +2017,13 @@ static UniValue walletpassphrase(const JSONRPCRequest& request)
} }
else else
throw std::runtime_error( throw std::runtime_error(
"walletpassphrase <passphrase> <timeout>\n" RPCHelpMan{"walletpassphrase",
"Stores the wallet decryption key in memory for <timeout> seconds."); "Stores the wallet decryption key in memory for <timeout> seconds.",
{
{"passphrase", RPCArg::Type::STR, false},
{"timeout", RPCArg::Type::NUM, false},
}}
.ToString());
pwallet->TopUpKeyPool(); pwallet->TopUpKeyPool();
@ -1934,8 +2056,13 @@ static UniValue walletpassphrasechange(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 2) { if (request.fHelp || request.params.size() != 2) {
throw std::runtime_error( throw std::runtime_error(
"walletpassphrasechange \"oldpassphrase\" \"newpassphrase\"\n" RPCHelpMan{"walletpassphrasechange",
"\nChanges the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.\n" "\nChanges the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.\n",
{
{"oldpassphrase", RPCArg::Type::STR, false},
{"newpassphrase", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"oldpassphrase\" (string) The current passphrase\n" "1. \"oldpassphrase\" (string) The current passphrase\n"
"2. \"newpassphrase\" (string) The new passphrase\n" "2. \"newpassphrase\" (string) The new passphrase\n"
@ -1964,8 +2091,13 @@ static UniValue walletpassphrasechange(const JSONRPCRequest& request)
if (strOldWalletPass.length() < 1 || strNewWalletPass.length() < 1) if (strOldWalletPass.length() < 1 || strNewWalletPass.length() < 1)
throw std::runtime_error( throw std::runtime_error(
"walletpassphrasechange <oldpassphrase> <newpassphrase>\n" RPCHelpMan{"walletpassphrasechange",
"Changes the wallet passphrase from <oldpassphrase> to <newpassphrase>."); "Changes the wallet passphrase from <oldpassphrase> to <newpassphrase>.",
{
{"oldpassphrase", RPCArg::Type::STR, false},
{"newpassphrase", RPCArg::Type::STR, false},
}}
.ToString());
if (!pwallet->ChangeWalletPassphrase(strOldWalletPass, strNewWalletPass)) { if (!pwallet->ChangeWalletPassphrase(strOldWalletPass, strNewWalletPass)) {
throw JSONRPCError(RPC_WALLET_PASSPHRASE_INCORRECT, "Error: The wallet passphrase entered was incorrect."); throw JSONRPCError(RPC_WALLET_PASSPHRASE_INCORRECT, "Error: The wallet passphrase entered was incorrect.");
@ -1986,10 +2118,12 @@ static UniValue walletlock(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(
"walletlock\n" RPCHelpMan{"walletlock",
"\nRemoves the wallet encryption key from memory, locking the wallet.\n" "\nRemoves the wallet encryption key from memory, locking the wallet.\n"
"After calling this method, you will need to call walletpassphrase again\n" "After calling this method, you will need to call walletpassphrase again\n"
"before being able to call any methods which require the wallet to be unlocked.\n" "before being able to call any methods which require the wallet to be unlocked.\n",
{}}
.ToString() +
"\nExamples:\n" "\nExamples:\n"
"\nSet the passphrase for 2 minutes to perform a transaction\n" "\nSet the passphrase for 2 minutes to perform a transaction\n"
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\" 120") + + HelpExampleCli("walletpassphrase", "\"my pass phrase\" 120") +
@ -2027,12 +2161,16 @@ static UniValue encryptwallet(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) { if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error( throw std::runtime_error(
"encryptwallet \"passphrase\"\n" RPCHelpMan{"encryptwallet",
"\nEncrypts the wallet with 'passphrase'. This is for first time encryption.\n" "\nEncrypts the wallet with 'passphrase'. This is for first time encryption.\n"
"After this, any calls that interact with private keys such as sending or signing \n" "After this, any calls that interact with private keys such as sending or signing \n"
"will require the passphrase to be set prior the making these calls.\n" "will require the passphrase to be set prior the making these calls.\n"
"Use the walletpassphrase call for this, and then walletlock call.\n" "Use the walletpassphrase call for this, and then walletlock call.\n"
"If the wallet is already encrypted, use the walletpassphrasechange call.\n" "If the wallet is already encrypted, use the walletpassphrasechange call.\n",
{
{"passphrase", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"passphrase\" (string) The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long.\n" "1. \"passphrase\" (string) The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long.\n"
"\nExamples:\n" "\nExamples:\n"
@ -2064,8 +2202,12 @@ static UniValue encryptwallet(const JSONRPCRequest& request)
if (strWalletPass.length() < 1) if (strWalletPass.length() < 1)
throw std::runtime_error( throw std::runtime_error(
"encryptwallet <passphrase>\n" RPCHelpMan{"encryptwallet",
"Encrypts the wallet with <passphrase>."); "Encrypts the wallet with <passphrase>.",
{
{"passphrase", RPCArg::Type::STR, false},
}}
.ToString());
if (!pwallet->EncryptWallet(strWalletPass)) { if (!pwallet->EncryptWallet(strWalletPass)) {
throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, "Error: Failed to encrypt the wallet."); throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, "Error: Failed to encrypt the wallet.");
@ -2086,6 +2228,13 @@ static UniValue lockunspent(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error( throw std::runtime_error(
RPCHelpMan{"lockunspent", RPCHelpMan{"lockunspent",
"\nUpdates list of temporarily unspendable outputs.\n"
"Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs.\n"
"If no transaction outputs are specified when unlocking then all current locked transaction outputs are unlocked.\n"
"A locked transaction output will not be chosen by automatic coin selection, when spending bitcoins.\n"
"Locks are stored in memory only. Nodes start with zero locked outputs, and the locked output list\n"
"is always cleared (by virtue of process exit) when a node stops or fails.\n"
"Also see the listunspent call\n",
{ {
{"unlock", RPCArg::Type::BOOL, false}, {"unlock", RPCArg::Type::BOOL, false},
{"transactions", RPCArg::Type::ARR, {"transactions", RPCArg::Type::ARR,
@ -2100,13 +2249,6 @@ static UniValue lockunspent(const JSONRPCRequest& request)
true}, true},
}} }}
.ToString() + .ToString() +
"\nUpdates list of temporarily unspendable outputs.\n"
"Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs.\n"
"If no transaction outputs are specified when unlocking then all current locked transaction outputs are unlocked.\n"
"A locked transaction output will not be chosen by automatic coin selection, when spending bitcoins.\n"
"Locks are stored in memory only. Nodes start with zero locked outputs, and the locked output list\n"
"is always cleared (by virtue of process exit) when a node stops or fails.\n"
"Also see the listunspent call\n"
"\nArguments:\n" "\nArguments:\n"
"1. unlock (boolean, required) Whether to unlock (true) or lock (false) the specified transactions\n" "1. unlock (boolean, required) Whether to unlock (true) or lock (false) the specified transactions\n"
"2. \"transactions\" (string, optional) A json array of objects. Each object the txid (string) vout (numeric)\n" "2. \"transactions\" (string, optional) A json array of objects. Each object the txid (string) vout (numeric)\n"
@ -2225,9 +2367,11 @@ static UniValue listlockunspent(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(
"listlockunspent\n" RPCHelpMan{"listlockunspent",
"\nReturns list of temporarily unspendable outputs.\n" "\nReturns list of temporarily unspendable outputs.\n"
"See the lockunspent call to lock and unlock transactions for spending.\n" "See the lockunspent call to lock and unlock transactions for spending.\n",
{}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"[\n" "[\n"
" {\n" " {\n"
@ -2279,8 +2423,12 @@ static UniValue settxfee(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 1) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 1) {
throw std::runtime_error( throw std::runtime_error(
"settxfee amount\n" RPCHelpMan{"settxfee",
"\nSet the transaction fee per kB for this wallet. Overrides the global -paytxfee command line parameter.\n" "\nSet the transaction fee per kB for this wallet. Overrides the global -paytxfee command line parameter.\n",
{
{"amount", RPCArg::Type::NUM, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. amount (numeric or string, required) The transaction fee in " + CURRENCY_UNIT + "/kB\n" "1. amount (numeric or string, required) The transaction fee in " + CURRENCY_UNIT + "/kB\n"
"\nResult\n" "\nResult\n"
@ -2319,8 +2467,9 @@ static UniValue getwalletinfo(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(
"getwalletinfo\n" RPCHelpMan{"getwalletinfo",
"Returns an object containing various wallet state info.\n" "Returns an object containing various wallet state info.\n", {}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"{\n" "{\n"
" \"walletname\": xxxxx, (string) the wallet name\n" " \"walletname\": xxxxx, (string) the wallet name\n"
@ -2381,8 +2530,9 @@ static UniValue listwalletdir(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(
"listwalletdir\n" RPCHelpMan{"listwalletdir",
"Returns a list of wallets in the wallet directory.\n" "Returns a list of wallets in the wallet directory.\n", {}}
.ToString() +
"{\n" "{\n"
" \"wallets\" : [ (json array of objects)\n" " \"wallets\" : [ (json array of objects)\n"
" {\n" " {\n"
@ -2413,9 +2563,11 @@ static UniValue listwallets(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(
"listwallets\n" RPCHelpMan{"listwallets",
"Returns a list of currently loaded wallets.\n" "Returns a list of currently loaded wallets.\n"
"For full information on the wallet, use \"getwalletinfo\"\n" "For full information on the wallet, use \"getwalletinfo\"\n",
{}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"[ (json array of strings)\n" "[ (json array of strings)\n"
" \"walletname\" (string) the wallet name\n" " \"walletname\" (string) the wallet name\n"
@ -2445,10 +2597,14 @@ static UniValue loadwallet(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"loadwallet \"filename\"\n" RPCHelpMan{"loadwallet",
"\nLoads a wallet from a wallet file or directory." "\nLoads a wallet from a wallet file or directory."
"\nNote that all wallet command-line options used when starting bitcoind will be" "\nNote that all wallet command-line options used when starting bitcoind will be"
"\napplied to the new wallet (eg -zapwallettxes, upgradewallet, rescan, etc).\n" "\napplied to the new wallet (eg -zapwallettxes, upgradewallet, rescan, etc).\n",
{
{"filename", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"filename\" (string, required) The wallet directory or .dat file.\n" "1. \"filename\" (string, required) The wallet directory or .dat file.\n"
"\nResult:\n" "\nResult:\n"
@ -2498,8 +2654,13 @@ static UniValue createwallet(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error( throw std::runtime_error(
"createwallet \"wallet_name\" ( disable_private_keys )\n" RPCHelpMan{"createwallet",
"\nCreates and loads a new wallet.\n" "\nCreates and loads a new wallet.\n",
{
{"wallet_name", RPCArg::Type::STR, false},
{"disable_private_keys", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"wallet_name\" (string, required) The name for the new wallet. If this is a path, the wallet will be created at the path location.\n" "1. \"wallet_name\" (string, required) The name for the new wallet. If this is a path, the wallet will be created at the path location.\n"
"2. disable_private_keys (boolean, optional, default: false) Disable the possibility of private keys (only watchonlys are possible in this mode).\n" "2. disable_private_keys (boolean, optional, default: false) Disable the possibility of private keys (only watchonlys are possible in this mode).\n"
@ -2550,9 +2711,13 @@ static UniValue unloadwallet(const JSONRPCRequest& request)
{ {
if (request.fHelp || request.params.size() > 1) { if (request.fHelp || request.params.size() > 1) {
throw std::runtime_error( throw std::runtime_error(
"unloadwallet ( \"wallet_name\" )\n" RPCHelpMan{"unloadwallet",
"Unloads the wallet referenced by the request endpoint otherwise unloads the wallet specified in the argument.\n" "Unloads the wallet referenced by the request endpoint otherwise unloads the wallet specified in the argument.\n"
"Specifying the wallet name on a wallet endpoint is invalid." "Specifying the wallet name on a wallet endpoint is invalid.",
{
{"wallet_name", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"wallet_name\" (string, optional) The name of the wallet to unload.\n" "1. \"wallet_name\" (string, optional) The name of the wallet to unload.\n"
"\nExamples:\n" "\nExamples:\n"
@ -2606,9 +2771,11 @@ static UniValue resendwallettransactions(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(
"resendwallettransactions\n" RPCHelpMan{"resendwallettransactions",
"Immediately re-broadcast unconfirmed wallet transactions to all peers.\n" "Immediately re-broadcast unconfirmed wallet transactions to all peers.\n"
"Intended only for testing; the wallet code periodically re-broadcasts\n" "Intended only for testing; the wallet code periodically re-broadcasts\n",
{}}
.ToString() +
"automatically.\n" "automatically.\n"
"Returns an RPC error if -walletbroadcast is set to false.\n" "Returns an RPC error if -walletbroadcast is set to false.\n"
"Returns array of transaction ids that were re-broadcast.\n" "Returns array of transaction ids that were re-broadcast.\n"
@ -2645,12 +2812,15 @@ static UniValue listunspent(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 5) if (request.fHelp || request.params.size() > 5)
throw std::runtime_error( throw std::runtime_error(
RPCHelpMan{"listunspent", RPCHelpMan{"listunspent",
"\nReturns array of unspent transaction outputs\n"
"with between minconf and maxconf (inclusive) confirmations.\n"
"Optionally filter to only include txouts paid to specified addresses.\n",
{ {
{"minconf", RPCArg::Type::NUM, true}, {"minconf", RPCArg::Type::NUM, true},
{"maxconf", RPCArg::Type::NUM, true}, {"maxconf", RPCArg::Type::NUM, true},
{"addresses", RPCArg::Type::ARR, {"addresses", RPCArg::Type::ARR,
{ {
{"address", RPCArg::Type::STR_HEX, true}, {"address", RPCArg::Type::STR, true},
}, },
true}, true},
{"include_unsafe", RPCArg::Type::BOOL, true}, {"include_unsafe", RPCArg::Type::BOOL, true},
@ -2661,12 +2831,9 @@ static UniValue listunspent(const JSONRPCRequest& request)
{"maximumCount", RPCArg::Type::NUM, true}, {"maximumCount", RPCArg::Type::NUM, true},
{"minimumSumAmount", RPCArg::Type::AMOUNT, true}, {"minimumSumAmount", RPCArg::Type::AMOUNT, true},
}, },
true}, true, "query_options"},
}} }}
.ToString() + .ToString() +
"\nReturns array of unspent transaction outputs\n"
"with between minconf and maxconf (inclusive) confirmations.\n"
"Optionally filter to only include txouts paid to specified addresses.\n"
"\nArguments:\n" "\nArguments:\n"
"1. minconf (numeric, optional, default=1) The minimum confirmations to filter\n" "1. minconf (numeric, optional, default=1) The minimum confirmations to filter\n"
"2. maxconf (numeric, optional, default=9999999) The maximum confirmations to filter\n" "2. maxconf (numeric, optional, default=9999999) The maximum confirmations to filter\n"
@ -2949,17 +3116,40 @@ static UniValue fundrawtransaction(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3) if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error( throw std::runtime_error(
"fundrawtransaction \"hexstring\" ( options iswitness )\n" RPCHelpMan{"fundrawtransaction",
"\nAdd inputs to a transaction until it has enough in value to meet its out value.\n" "\nAdd inputs to a transaction until it has enough in value to meet its out value.\n"
"This will not modify existing inputs, and will add at most one change output to the outputs.\n" "This will not modify existing inputs, and will add at most one change output to the outputs.\n"
"No existing outputs will be modified unless \"subtractFeeFromOutputs\" is specified.\n" "No existing outputs will be modified unless \"subtractFeeFromOutputs\" is specified.\n"
"Note that inputs which were signed may need to be resigned after completion since in/outputs have been added.\n" "Note that inputs which were signed may need to be resigned after completion since in/outputs have been added.\n"
"The inputs added will not be signed, use signrawtransaction for that.\n" "The inputs added will not be signed, use signrawtransaction for that.\n"
"Note that all existing inputs must have their previous output transaction be in the wallet.\n" "Note that all existing inputs must have their previous output transaction be in the wallet.\n"
"Note that all inputs selected must be of standard form and P2SH scripts must be\n" "Note that all inputs selected must be of standard form and P2SH scripts must be\n"
"in the wallet using importaddress or addmultisigaddress (to calculate fees).\n" "in the wallet using importaddress or addmultisigaddress (to calculate fees).\n"
"You can see whether this is the case by checking the \"solvable\" field in the listunspent output.\n" "You can see whether this is the case by checking the \"solvable\" field in the listunspent output.\n"
"Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only\n" "Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only\n",
{
{"hexstring", RPCArg::Type::STR_HEX, false},
{"options", RPCArg::Type::OBJ,
{
{"changeAddress", RPCArg::Type::STR, true},
{"changePosition", RPCArg::Type::NUM, true},
{"change_type", RPCArg::Type::STR, true},
{"includeWatching", RPCArg::Type::BOOL, true},
{"lockUnspents", RPCArg::Type::BOOL, true},
{"feeRate", RPCArg::Type::AMOUNT, true},
{"subtractFeeFromOutputs", RPCArg::Type::ARR,
{
{"vout_index", RPCArg::Type::NUM, true},
},
true},
{"replaceable", RPCArg::Type::BOOL, true},
{"conf_target", RPCArg::Type::NUM, true},
{"estimate_mode", RPCArg::Type::STR, true},
},
true, "options"},
{"iswitness", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"hexstring\" (string, required) The hex string of the raw transaction\n" "1. \"hexstring\" (string, required) The hex string of the raw transaction\n"
"2. options (object, optional)\n" "2. options (object, optional)\n"
@ -3039,6 +3229,9 @@ UniValue signrawtransactionwithwallet(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3) if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error( throw std::runtime_error(
RPCHelpMan{"signrawtransactionwithwallet", RPCHelpMan{"signrawtransactionwithwallet",
"\nSign inputs for raw transaction (serialized, hex-encoded).\n"
"The second optional argument (may be null) is an array of previous transaction outputs that\n"
"this transaction depends on but may not yet be in the block chain.\n",
{ {
{"hexstring", RPCArg::Type::STR, false}, {"hexstring", RPCArg::Type::STR, false},
{"prevtxs", RPCArg::Type::ARR, {"prevtxs", RPCArg::Type::ARR,
@ -3057,10 +3250,7 @@ UniValue signrawtransactionwithwallet(const JSONRPCRequest& request)
{"sighashtype", RPCArg::Type::STR, true}, {"sighashtype", RPCArg::Type::STR, true},
}} }}
.ToString() + .ToString() +
"\nSign inputs for raw transaction (serialized, hex-encoded).\n" HelpRequiringPassphrase(pwallet) + "\n"
"The second optional argument (may be null) is an array of previous transaction outputs that\n"
"this transaction depends on but may not yet be in the block chain.\n"
+ HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"hexstring\" (string, required) The transaction hex string\n" "1. \"hexstring\" (string, required) The transaction hex string\n"
@ -3130,18 +3320,30 @@ static UniValue bumpfee(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error( throw std::runtime_error(
"bumpfee \"txid\" ( options ) \n" RPCHelpMan{"bumpfee",
"\nBumps the fee of an opt-in-RBF transaction T, replacing it with a new transaction B.\n" "\nBumps the fee of an opt-in-RBF transaction T, replacing it with a new transaction B.\n"
"An opt-in RBF transaction with the given txid must be in the wallet.\n" "An opt-in RBF transaction with the given txid must be in the wallet.\n"
"The command will pay the additional fee by decreasing (or perhaps removing) its change output.\n" "The command will pay the additional fee by decreasing (or perhaps removing) its change output.\n"
"If the change output is not big enough to cover the increased fee, the command will currently fail\n" "If the change output is not big enough to cover the increased fee, the command will currently fail\n"
"instead of adding new inputs to compensate. (A future implementation could improve this.)\n" "instead of adding new inputs to compensate. (A future implementation could improve this.)\n"
"The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs.\n" "The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs.\n"
"By default, the new fee will be calculated automatically using estimatesmartfee.\n" "By default, the new fee will be calculated automatically using estimatesmartfee.\n"
"The user can specify a confirmation target for estimatesmartfee.\n" "The user can specify a confirmation target for estimatesmartfee.\n"
"Alternatively, the user can specify totalFee, or use RPC settxfee to set a higher fee rate.\n" "Alternatively, the user can specify totalFee, or use RPC settxfee to set a higher fee rate.\n"
"At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee\n" "At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee\n"
"returned by getnetworkinfo) to enter the node's mempool.\n" "returned by getnetworkinfo) to enter the node's mempool.\n",
{
{"txid", RPCArg::Type::STR_HEX, false},
{"options", RPCArg::Type::OBJ,
{
{"confTarget", RPCArg::Type::NUM, true},
{"totalFee", RPCArg::Type::AMOUNT, true},
{"replaceable", RPCArg::Type::BOOL, true},
{"estimate_mode", RPCArg::Type::STR, true},
},
true, "options"},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. txid (string, required) The txid to be bumped\n" "1. txid (string, required) The txid to be bumped\n"
"2. options (object, optional)\n" "2. options (object, optional)\n"
@ -3282,8 +3484,13 @@ UniValue generate(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error( throw std::runtime_error(
"generate nblocks ( maxtries )\n" RPCHelpMan{"generate",
"\nMine up to nblocks blocks immediately (before the RPC call returns) to an address in the wallet.\n" "\nMine up to nblocks blocks immediately (before the RPC call returns) to an address in the wallet.\n",
{
{"nblocks", RPCArg::Type::NUM, false},
{"maxtries", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. nblocks (numeric, required) How many blocks are generated immediately.\n" "1. nblocks (numeric, required) How many blocks are generated immediately.\n"
"2. maxtries (numeric, optional) How many iterations to try (default = 1000000).\n" "2. maxtries (numeric, optional) How many iterations to try (default = 1000000).\n"
@ -3334,8 +3541,13 @@ UniValue rescanblockchain(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 2) { if (request.fHelp || request.params.size() > 2) {
throw std::runtime_error( throw std::runtime_error(
"rescanblockchain (\"start_height\") (\"stop_height\")\n" RPCHelpMan{"rescanblockchain",
"\nRescan the local blockchain for wallet related transactions.\n" "\nRescan the local blockchain for wallet related transactions.\n",
{
{"start_height", RPCArg::Type::NUM, true},
{"stop_height", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"start_height\" (numeric, optional) block height where the rescan should start\n" "1. \"start_height\" (numeric, optional) block height where the rescan should start\n"
"2. \"stop_height\" (numeric, optional) the last block height that should be scanned\n" "2. \"stop_height\" (numeric, optional) the last block height that should be scanned\n"
@ -3540,9 +3752,13 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) { if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error( throw std::runtime_error(
"getaddressinfo \"address\"\n" RPCHelpMan{"getaddressinfo",
"\nReturn information about the given bitcoin address. Some information requires the address\n" "\nReturn information about the given bitcoin address. Some information requires the address\n"
"to be in the wallet.\n" "to be in the wallet.\n",
{
{"address", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"address\" (string, required) The bitcoin address to get the information of.\n" "1. \"address\" (string, required) The bitcoin address to get the information of.\n"
"\nResult:\n" "\nResult:\n"
@ -3660,8 +3876,12 @@ static UniValue getaddressesbylabel(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) if (request.fHelp || request.params.size() != 1)
throw std::runtime_error( throw std::runtime_error(
"getaddressesbylabel \"label\"\n" RPCHelpMan{"getaddressesbylabel",
"\nReturns the list of addresses assigned the specified label.\n" "\nReturns the list of addresses assigned the specified label.\n",
{
{"label", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"label\" (string, required) The label.\n" "1. \"label\" (string, required) The label.\n"
"\nResult:\n" "\nResult:\n"
@ -3705,8 +3925,12 @@ static UniValue listlabels(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 1) if (request.fHelp || request.params.size() > 1)
throw std::runtime_error( throw std::runtime_error(
"listlabels ( \"purpose\" )\n" RPCHelpMan{"listlabels",
"\nReturns the list of all labels, or labels that are assigned to addresses with a specific purpose.\n" "\nReturns the list of all labels, or labels that are assigned to addresses with a specific purpose.\n",
{
{"purpose", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n" "\nArguments:\n"
"1. \"purpose\" (string, optional) Address purpose to list labels for ('send','receive'). An empty string is the same as not providing this argument.\n" "1. \"purpose\" (string, optional) Address purpose to list labels for ('send','receive'). An empty string is the same as not providing this argument.\n"
"\nResult:\n" "\nResult:\n"
@ -3759,10 +3983,15 @@ UniValue sethdseed(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 2) { if (request.fHelp || request.params.size() > 2) {
throw std::runtime_error( throw std::runtime_error(
"sethdseed ( \"newkeypool\" \"seed\" )\n" RPCHelpMan{"sethdseed",
"\nSet or generate a new HD wallet seed. Non-HD wallets will not be upgraded to being a HD wallet. Wallets that are already\n" "\nSet or generate a new HD wallet seed. Non-HD wallets will not be upgraded to being a HD wallet. Wallets that are already\n"
"HD will have a new HD seed set so that new keys added to the keypool will be derived from this new seed.\n" "HD will have a new HD seed set so that new keys added to the keypool will be derived from this new seed.\n"
"\nNote that you will need to MAKE A NEW BACKUP of your wallet after setting the HD wallet seed.\n" "\nNote that you will need to MAKE A NEW BACKUP of your wallet after setting the HD wallet seed.\n",
{
{"newkeypool", RPCArg::Type::BOOL, true},
{"seed", RPCArg::Type::STR, true},
}}
.ToString()
+ HelpRequiringPassphrase(pwallet) + + HelpRequiringPassphrase(pwallet) +
"\nArguments:\n" "\nArguments:\n"
"1. \"newkeypool\" (boolean, optional, default=true) Whether to flush old unused addresses, including change addresses, from the keypool and regenerate it.\n" "1. \"newkeypool\" (boolean, optional, default=true) Whether to flush old unused addresses, including change addresses, from the keypool and regenerate it.\n"
@ -3898,10 +4127,17 @@ UniValue walletprocesspsbt(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4) if (request.fHelp || request.params.size() < 1 || request.params.size() > 4)
throw std::runtime_error( throw std::runtime_error(
"walletprocesspsbt \"psbt\" ( sign \"sighashtype\" bip32derivs )\n" RPCHelpMan{"walletprocesspsbt",
"\nUpdate a PSBT with input information from our wallet and then sign inputs\n" "\nUpdate a PSBT with input information from our wallet and then sign inputs\n"
"that we can sign for.\n" "that we can sign for.\n",
+ HelpRequiringPassphrase(pwallet) + "\n" {
{"psbt", RPCArg::Type::STR, false},
{"sign", RPCArg::Type::BOOL, true},
{"sighashtype", RPCArg::Type::STR, true},
{"bip32derivs", RPCArg::Type::BOOL, true},
}}
.ToString() +
HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"psbt\" (string, required) The transaction base64 string\n" "1. \"psbt\" (string, required) The transaction base64 string\n"
@ -3964,6 +4200,8 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 || request.params.size() > 5) if (request.fHelp || request.params.size() < 2 || request.params.size() > 5)
throw std::runtime_error( throw std::runtime_error(
RPCHelpMan{"walletcreatefundedpsbt", RPCHelpMan{"walletcreatefundedpsbt",
"\nCreates and funds a transaction in the Partially Signed Transaction format. Inputs will be added if supplied inputs are not enough\n"
"Implements the Creator and Updater roles.\n",
{ {
{"inputs", RPCArg::Type::ARR, {"inputs", RPCArg::Type::ARR,
{ {
@ -3998,7 +4236,7 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
{"change_type", RPCArg::Type::STR, true}, {"change_type", RPCArg::Type::STR, true},
{"includeWatching", RPCArg::Type::BOOL, true}, {"includeWatching", RPCArg::Type::BOOL, true},
{"lockUnspents", RPCArg::Type::BOOL, true}, {"lockUnspents", RPCArg::Type::BOOL, true},
{"feeRate", RPCArg::Type::NUM, true}, {"feeRate", RPCArg::Type::AMOUNT, true},
{"subtractFeeFromOutputs", RPCArg::Type::ARR, {"subtractFeeFromOutputs", RPCArg::Type::ARR,
{ {
{"int", RPCArg::Type::NUM, true}, {"int", RPCArg::Type::NUM, true},
@ -4008,12 +4246,10 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
{"conf_target", RPCArg::Type::NUM, true}, {"conf_target", RPCArg::Type::NUM, true},
{"estimate_mode", RPCArg::Type::STR, true}, {"estimate_mode", RPCArg::Type::STR, true},
}, },
true}, true, "options"},
{"bip32derivs", RPCArg::Type::BOOL, true}, {"bip32derivs", RPCArg::Type::BOOL, true},
}} }}
.ToString() + .ToString() +
"\nCreates and funds a transaction in the Partially Signed Transaction format. Inputs will be added if supplied inputs are not enough\n"
"Implements the Creator and Updater roles.\n"
"\nArguments:\n" "\nArguments:\n"
"1. \"inputs\" (array, required) A json array of json objects\n" "1. \"inputs\" (array, required) A json array of json objects\n"
" [\n" " [\n"

View file

@ -17,8 +17,9 @@ UniValue getzmqnotifications(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(
"getzmqnotifications\n" RPCHelpMan{"getzmqnotifications",
"\nReturns information about the active ZeroMQ notifications.\n" "\nReturns information about the active ZeroMQ notifications.\n", {}}
.ToString() +
"\nResult:\n" "\nResult:\n"
"[\n" "[\n"
" { (json object)\n" " { (json object)\n"