Merge bitcoin#14726: Use RPCHelpMan for all RPCs (#4492)

* Merge #14726: Use RPCHelpMan for all RPCs

fa5e0452e875a7ca6bf6fe61fdd652d341eece40 rpc: Documentation fixups (MarcoFalke)
fa91e8eda541acdb78ca481b74605639f319c108 Use RPCHelpMan for all RPCs (MarcoFalke)
fa520e72f7b5964cea1ade666e71212914556cf3 lint: Must use RPCHelpMan to generate the RPC docs (MarcoFalke)

Pull request description:

  The resulting documentation should not change unless the type in the oneline-summary was previously incorrect. (E.g. string vs bool)

Tree-SHA512: 4ff355b6a53178f02781e97a7aca7ee1d0d97ff348b6bf5a01caa1c96904ee33c704465fae54c2cd7445097427fd04c71ad3779bb7a7ed886055ef36c1b5a1d0

* Dash-specific changes to support RPCHelpMan with RPC commands

Signed-off-by: Dzutte <dzutte.tomsk@gmail.com>

Co-authored-by: Wladimir J. van der Laan <laanwj@gmail.com>
This commit is contained in:
Dzutte 2021-10-11 14:55:23 -07:00 committed by GitHub
parent 63df2b79eb
commit 0f2e8aa504
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 1993 additions and 973 deletions

View File

@ -190,8 +190,9 @@ static UniValue getblockcount(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getblockcount\n"
"\nReturns the number of blocks in the longest blockchain.\n"
RPCHelpMan{"getblockcount",
"\nReturns the number of blocks in the longest blockchain.\n", {}}
.ToString() +
"\nResult:\n"
"n (numeric) The current block count\n"
"\nExamples:\n"
@ -207,8 +208,9 @@ static UniValue getbestblockhash(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getbestblockhash\n"
"\nReturns the hash of the best (tip) block in the longest blockchain.\n"
RPCHelpMan{"getbestblockhash",
"\nReturns the hash of the best (tip) block in the longest blockchain.\n", {}}
.ToString() +
"\nResult:\n"
"\"hex\" (string) the block hash, hex-encoded\n"
"\nExamples:\n"
@ -224,8 +226,10 @@ static UniValue getbestchainlock(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getbestchainlock\n"
"\nReturns information about the best chainlock. Throws an error if there is no known chainlock yet."
RPCHelpMan{"getbestchainlock",
"\nReturns information about the best chainlock. Throws an error if there is no known chainlock yet.",
{}
}.ToString() +
"\nResult:\n"
"{\n"
" \"blockhash\" : \"hash\", (string) The block hash hex-encoded\n"
@ -266,9 +270,13 @@ static UniValue waitfornewblock(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
"waitfornewblock (timeout)\n"
"\nWaits for a specific new block and returns useful info about it.\n"
"\nReturns the current block on timeout or exit.\n"
RPCHelpMan{"waitfornewblock",
"\nWaits for a specific new block and returns useful info about it.\n"
"\nReturns the current block on timeout or exit.\n",
{
{"timeout", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"1. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n"
"\nResult:\n"
@ -304,9 +312,14 @@ static UniValue waitforblock(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
"waitforblock <blockhash> (timeout)\n"
"\nWaits for a specific new block and returns useful info about it.\n"
"\nReturns the current block on timeout or exit.\n"
RPCHelpMan{"waitforblock",
"\nWaits for a specific new block and returns useful info about it.\n"
"\nReturns the current block on timeout or exit.\n",
{
{"blockhash", RPCArg::Type::STR, false},
{"timeout", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\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"
@ -346,10 +359,15 @@ static UniValue waitforblockheight(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
"waitforblockheight height ( timeout )\n"
"\nWaits for (at least) block height and returns the height and hash\n"
"of the current tip.\n"
"\nReturns the current block on timeout or exit.\n"
RPCHelpMan{"waitforblockheight",
"\nWaits for (at least) block height and returns the height and hash\n"
"of the current tip.\n"
"\nReturns the current block on timeout or exit.\n",
{
{"height", RPCArg::Type::NUM, false},
{"timeout", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\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"
@ -389,8 +407,9 @@ static UniValue syncwithvalidationinterfacequeue(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 0) {
throw std::runtime_error(
"syncwithvalidationinterfacequeue\n"
"\nWaits for the validation interface queue to catch up on everything that was there when we entered this function.\n"
RPCHelpMan{"syncwithvalidationinterfacequeue",
"\nWaits for the validation interface queue to catch up on everything that was there when we entered this function.\n", {}}
.ToString() +
"\nExamples:\n"
+ HelpExampleCli("syncwithvalidationinterfacequeue","")
+ HelpExampleRpc("syncwithvalidationinterfacequeue","")
@ -404,8 +423,9 @@ static UniValue getdifficulty(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getdifficulty\n"
"\nReturns the proof-of-work difficulty as a multiple of the minimum difficulty.\n"
RPCHelpMan{"getdifficulty",
"\nReturns the proof-of-work difficulty as a multiple of the minimum difficulty.\n", {}}
.ToString() +
"\nResult:\n"
"n.nnn (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty.\n"
"\nExamples:\n"
@ -526,8 +546,12 @@ static UniValue getrawmempool(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
"getrawmempool ( verbose )\n"
"\nReturns all transaction ids in memory pool as a json array of string transaction ids.\n"
RPCHelpMan{"getrawmempool",
"\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"
"\nArguments:\n"
"1. verbose (boolean, optional, default=false) True for a json object, false for array of transaction ids\n"
@ -558,8 +582,13 @@ static UniValue getmempoolancestors(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error(
"getmempoolancestors txid ( verbose )\n"
"\nIf txid is in the mempool, returns all in-mempool ancestors.\n"
RPCHelpMan{"getmempoolancestors",
"\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"
"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"
@ -622,8 +651,13 @@ static UniValue getmempooldescendants(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error(
"getmempooldescendants txid ( verbose )\n"
"\nIf txid is in the mempool, returns all in-mempool descendants.\n"
RPCHelpMan{"getmempooldescendants",
"\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"
"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"
@ -686,8 +720,12 @@ static UniValue getmempoolentry(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error(
"getmempoolentry txid\n"
"\nReturns mempool data for given transaction\n"
RPCHelpMan{"getmempoolentry",
"\nReturns mempool data for given transaction\n",
{
{"txid", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"txid\" (string, required) The transaction id (must be in mempool)\n"
"\nResult:\n"
@ -719,8 +757,13 @@ static UniValue getblockhashes(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 2)
throw std::runtime_error(
"getblockhashes timestamp\n"
"\nReturns array of hashes of blocks within the timestamp range provided.\n"
RPCHelpMan{"getblockhashes",
"\nReturns array of hashes of blocks within the timestamp range provided.\n",
{
{"high", RPCArg::Type::NUM, false},
{"low", RPCArg::Type::NUM, false},
}}
.ToString() +
"\nArguments:\n"
"1. high (numeric, required) The newer block timestamp\n"
"2. low (numeric, required) The older block timestamp\n"
@ -753,8 +796,12 @@ static UniValue getblockhash(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"getblockhash height\n"
"\nReturns hash of block in best-block-chain at height provided.\n"
RPCHelpMan{"getblockhash",
"\nReturns hash of block in best-block-chain at height provided.\n",
{
{"height", RPCArg::Type::NUM, false},
}}
.ToString() +
"\nArguments:\n"
"1. height (numeric, required) The height index\n"
"\nResult:\n"
@ -778,9 +825,14 @@ static UniValue getblockheader(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
"getblockheader \"blockhash\" ( verbose )\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"
RPCHelpMan{"getblockheader",
"\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",
{
{"blockhash", RPCArg::Type::STR_HEX, false},
{"verbose", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\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"
@ -843,10 +895,16 @@ static UniValue getblockheaders(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error(
"getblockheaders \"hash\" ( count verbose )\n"
"\nReturns an array of items with information about <count> blockheaders starting from <hash>.\n"
"\nIf verbose is false, each item is a string that is serialized, hex-encoded data for a single blockheader.\n"
"If verbose is true, each item is an Object with information about a single blockheader.\n"
RPCHelpMan{"getblockheaders",
"\nReturns an array of items with information about <count> blockheaders starting from <hash>.\n"
"\nIf verbose is false, each item is a string that is serialized, hex-encoded data for a single blockheader.\n"
"If verbose is true, each item is an Object with information about a single blockheader.\n",
{
{"hash", RPCArg::Type::STR, false},
{"count", RPCArg::Type::NUM, true},
{"verbose", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"hash\" (string, required) The block hash\n"
"2. count (numeric, optional, default/max=" + strprintf("%s", MAX_HEADERS_RESULTS) +")\n"
@ -952,8 +1010,14 @@ static UniValue getmerkleblocks(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error(
"getmerkleblocks \"filter\" \"hash\" ( count )\n"
"\nReturns an array of hex-encoded merkleblocks for <count> blocks starting from <hash> which match <filter>.\n"
RPCHelpMan{"getmerkleblocks",
"\nReturns an array of hex-encoded merkleblocks for <count> blocks starting from <hash> which match <filter>.\n",
{
{"filter", RPCArg::Type::STR, false},
{"hash", RPCArg::Type::STR, false},
{"count", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"filter\" (string, required) The hex-encoded bloom filter\n"
"2. \"hash\" (string, required) The block hash\n"
@ -1028,10 +1092,15 @@ static UniValue getblock(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
"getblock \"blockhash\" ( verbosity ) \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 2, returns an Object with information about block <hash> and information about each transaction. \n"
RPCHelpMan{"getblock",
"\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 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"
"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"
@ -1114,7 +1183,11 @@ static UniValue pruneblockchain(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"pruneblockchain height\n"
RPCHelpMan{"pruneblockchain", "",
{
{"height", RPCArg::Type::NUM, false},
}}
.ToString() +
"\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"
" to prune blocks whose block time is at least 2 hours older than the provided timestamp.\n"
@ -1163,9 +1236,11 @@ static UniValue gettxoutsetinfo(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"gettxoutsetinfo\n"
"\nReturns statistics about the unspent transaction output set.\n"
"Note this call may take some time.\n"
RPCHelpMan{"gettxoutsetinfo",
"\nReturns statistics about the unspent transaction output set.\n"
"Note this call may take some time.\n",
{}}
.ToString() +
"\nResult:\n"
"{\n"
" \"height\":n, (numeric) The current block height (index)\n"
@ -1205,8 +1280,14 @@ static UniValue gettxout(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
throw std::runtime_error(
"gettxout \"txid\" n ( include_mempool )\n"
"\nReturns details about an unspent transaction output.\n"
RPCHelpMan{"gettxout",
"\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"
"1. \"txid\" (string, required) The transaction id\n"
"2. \"n\" (numeric, required) vout number\n"
@ -1286,8 +1367,13 @@ static UniValue verifychain(const JSONRPCRequest& request)
int nCheckDepth = gArgs.GetArg("-checkblocks", DEFAULT_CHECKBLOCKS);
if (request.fHelp || request.params.size() > 2)
throw std::runtime_error(
"verifychain ( checklevel nblocks )\n"
"\nVerifies blockchain database.\n"
RPCHelpMan{"verifychain",
"\nVerifies blockchain database.\n",
{
{"checklevel", RPCArg::Type::NUM, true},
{"nblocks", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\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"
@ -1383,8 +1469,9 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getblockchaininfo\n"
"Returns an object containing various state info regarding blockchain processing.\n"
RPCHelpMan{"getblockchaininfo",
"Returns an object containing various state info regarding blockchain processing.\n", {}}
.ToString() +
"\nResult:\n"
"{\n"
" \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest) and\n"
@ -1504,9 +1591,14 @@ static UniValue getchaintips(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 2)
throw std::runtime_error(
"getchaintips ( count branchlen )\n"
"Return information about all known tips in the block tree,"
" including the main chain as well as orphaned branches.\n"
RPCHelpMan{"getchaintips",
"Return information about all known tips in the block tree,"
" including the main chain as well as orphaned branches.\n",
{
{"count", RPCArg::Type::NUM, true},
{"branchlen", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"1. count (numeric, optional) only show this much of latest tips\n"
"2. branchlen (numeric, optional) only show tips that have equal or greater length of branch\n"
@ -1650,8 +1742,9 @@ static UniValue getmempoolinfo(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getmempoolinfo\n"
"\nReturns details on the active state of the TX memory pool.\n"
RPCHelpMan{"getmempoolinfo",
"\nReturns details on the active state of the TX memory pool.\n", {}}
.ToString() +
"\nResult:\n"
"{\n"
" \"size\": xxxxx, (numeric) Current tx count\n"
@ -1674,10 +1767,14 @@ static UniValue preciousblock(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"preciousblock \"blockhash\"\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"
"\nThe effects of preciousblock are not retained across restarts.\n"
RPCHelpMan{"preciousblock",
"\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"
"\nThe effects of preciousblock are not retained across restarts.\n",
{
{"blockhash", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"blockhash\" (string, required) the hash of the block to mark as precious\n"
"\nResult:\n"
@ -1712,8 +1809,12 @@ static UniValue invalidateblock(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"invalidateblock \"blockhash\"\n"
"\nPermanently marks a block as invalid, as if it violated a consensus rule.\n"
RPCHelpMan{"invalidateblock",
"\nPermanently marks a block as invalid, as if it violated a consensus rule.\n",
{
{"blockhash", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"blockhash\" (string, required) the hash of the block to mark as invalid\n"
"\nResult:\n"
@ -1751,9 +1852,13 @@ static UniValue reconsiderblock(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"reconsiderblock \"blockhash\"\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"
RPCHelpMan{"reconsiderblock",
"\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",
{
{"blockhash", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"blockhash\" (string, required) the hash of the block to reconsider\n"
"\nResult:\n"
@ -1789,8 +1894,13 @@ static UniValue getchaintxstats(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 2)
throw std::runtime_error(
"getchaintxstats ( nblocks \"blockhash\" )\n"
"\nCompute statistics about the total number and rate of transactions in the chain.\n"
RPCHelpMan{"getchaintxstats",
"\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"
"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"
@ -1921,10 +2031,20 @@ static UniValue getblockstats(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4) {
throw std::runtime_error(
"getblockstats hash_or_height ( stats )\n"
"\nCompute per block statistics for a given window. All amounts are in duffs.\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"
RPCHelpMan{"getblockstats",
"\nCompute per block statistics for a given window. All amounts are in duffs.\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",
{
{"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"
"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"
@ -2165,11 +2285,19 @@ static UniValue getspecialtxes(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 5)
throw std::runtime_error(
"getspecialtxes \"blockhash\" ( type count skip verbosity ) \n"
"Returns an array of special transactions found in the specified block\n"
"\nIf verbosity is 0, returns tx hash for each transaction.\n"
"If verbosity is 1, returns hex-encoded data for each transaction.\n"
"If verbosity is 2, returns an Object with information for each transaction.\n"
RPCHelpMan{"getspecialtxes",
"Returns an array of special transactions found in the specified block\n"
"\nIf verbosity is 0, returns tx hash for each transaction.\n"
"If verbosity is 1, returns hex-encoded data for each transaction.\n"
"If verbosity is 2, returns an Object with information for each transaction.\n",
{
{"blockhash", RPCArg::Type::STR, false},
{"type", RPCArg::Type::NUM, true},
{"count", RPCArg::Type::NUM, true},
{"skip", RPCArg::Type::NUM, true},
{"verbosity", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"blockhash\" (string, required) The block hash\n"
"2. type (numeric, optional, default=-1) Filter special txes by type, -1 means all types\n"
@ -2266,8 +2394,9 @@ static UniValue savemempool(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0) {
throw std::runtime_error(
"savemempool\n"
"\nDumps the mempool to disk. It will fail until the previous dump is fully loaded.\n"
RPCHelpMan{"savemempool",
"\nDumps the mempool to disk. It will fail until the previous dump is fully loaded.\n", {}}
.ToString() +
"\nExamples:\n"
+ HelpExampleCli("savemempool", "")
+ HelpExampleRpc("savemempool", "")
@ -2349,20 +2478,34 @@ UniValue scantxoutset(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
"scantxoutset \"action\" [scanobjects,...]\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"
"Examples of output descriptors are:\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"
" combo(<pubkey>) P2PK and 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"
"\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"
"unhardened or hardened child keys.\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"
RPCHelpMan{"scantxoutset",
"\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"
"Examples of output descriptors are:\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"
" combo(<pubkey>) P2PK and 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"
"\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"
"unhardened or hardened child keys.\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",
{
{"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"
"1. \"action\" (string, required) The action to execute\n"
" \"start\" for starting a scan\n"
@ -2500,8 +2643,13 @@ static UniValue getblockfilter(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error(
"getblockfilter <blockhash> <filtertype>\n"
"\nRetrieve a BIP 157 content filter for a particular block.\n"
RPCHelpMan{"getblockfilter",
"\nRetrieve a BIP 157 content filter for a particular block.\n",
{
{"blockhash", RPCArg::Type::STR, false},
{"filtertype", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
"\n1. blockhash (string, required) The hash of the block"
"\n2. filtertype (string, optional) The type name of the filter (default: basic)"

View File

@ -10,6 +10,7 @@
#endif // ENABLE_WALLET
#include <coinjoin/server.h>
#include <rpc/server.h>
#include <rpc/util.h>
#include <util/strencodings.h>
#include <univalue.h>
@ -24,7 +25,12 @@ static UniValue coinjoin(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"coinjoin \"command\"\n"
RPCHelpMan{"coinjoin",
"",
{
{"command", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"command\" (string or set of strings, required) The command to execute\n"
"\nAvailable commands:\n"
@ -81,8 +87,10 @@ static UniValue coinjoin(const JSONRPCRequest& request)
static UniValue getpoolinfo(const JSONRPCRequest& request)
{
throw std::runtime_error(
"getpoolinfo\n"
"DEPRECATED. Please use getcoinjoininfo instead.\n"
RPCHelpMan{"getpoolinfo",
"DEPRECATED. Please use getcoinjoininfo instead.\n",
{}}
.ToString()
);
}
@ -90,44 +98,46 @@ static UniValue getcoinjoininfo(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0) {
throw std::runtime_error(
"getcoinjoininfo\n"
"Returns an object containing an information about CoinJoin settings and state.\n"
"\nResult (for regular nodes):\n"
"{\n"
" \"enabled\": true|false, (bool) Whether mixing functionality is enabled\n"
" \"multisession\": true|false, (bool) Whether CoinJoin Multisession option is enabled\n"
" \"max_sessions\": xxx, (numeric) How many parallel mixing sessions can there be at once\n"
" \"max_rounds\": xxx, (numeric) How many rounds to mix\n"
" \"max_amount\": xxx, (numeric) Target CoinJoin balance in " + CURRENCY_UNIT + "\n"
" \"denoms_goal\": xxx, (numeric) How many inputs of each denominated amount to target\n"
" \"denoms_hardcap\": xxx, (numeric) Maximum limit of how many inputs of each denominated amount to create\n"
" \"queue_size\": xxx, (numeric) How many queues there are currently on the network\n"
" \"running\": true|false, (bool) Whether mixing is currently running\n"
" \"sessions\": (array of json objects)\n"
" [\n"
" {\n"
" \"protxhash\": \"...\", (string) The ProTxHash of the masternode\n"
" \"outpoint\": \"txid-index\", (string) The outpoint of the masternode\n"
" \"service\": \"host:port\", (string) The IP address and port of the masternode\n"
" \"denomination\": xxx, (numeric) The denomination of the mixing session in " + CURRENCY_UNIT + "\n"
" \"state\": \"...\", (string) Current state of the mixing session\n"
" \"entries_count\": xxx, (numeric) The number of entries in the mixing session\n"
" }\n"
" ,...\n"
" ],\n"
" \"keys_left\": xxx, (numeric) How many new keys are left since last automatic backup\n"
" \"warnings\": \"...\" (string) Warnings if any\n"
"}\n"
"\nResult (for masternodes):\n"
"{\n"
" \"queue_size\": xxx, (numeric) How many queues there are currently on the network\n"
" \"denomination\": xxx, (numeric) The denomination of the mixing session in " + CURRENCY_UNIT + "\n"
" \"state\": \"...\", (string) Current state of the mixing session\n"
" \"entries_count\": xxx, (numeric) The number of entries in the mixing session\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("getcoinjoininfo", "")
+ HelpExampleRpc("getcoinjoininfo", "")
RPCHelpMan{"getcoinjoininfo",
"Returns an object containing an information about CoinJoin settings and state.\n",
{}}
.ToString() +
"\nResult (for regular nodes):\n"
"{\n"
" \"enabled\": true|false, (bool) Whether mixing functionality is enabled\n"
" \"multisession\": true|false, (bool) Whether CoinJoin Multisession option is enabled\n"
" \"max_sessions\": xxx, (numeric) How many parallel mixing sessions can there be at once\n"
" \"max_rounds\": xxx, (numeric) How many rounds to mix\n"
" \"max_amount\": xxx, (numeric) Target CoinJoin balance in " + CURRENCY_UNIT + "\n"
" \"denoms_goal\": xxx, (numeric) How many inputs of each denominated amount to target\n"
" \"denoms_hardcap\": xxx, (numeric) Maximum limit of how many inputs of each denominated amount to create\n"
" \"queue_size\": xxx, (numeric) How many queues there are currently on the network\n"
" \"running\": true|false, (bool) Whether mixing is currently running\n"
" \"sessions\": (array of json objects)\n"
" [\n"
" {\n"
" \"protxhash\": \"...\", (string) The ProTxHash of the masternode\n"
" \"outpoint\": \"txid-index\", (string) The outpoint of the masternode\n"
" \"service\": \"host:port\", (string) The IP address and port of the masternode\n"
" \"denomination\": xxx, (numeric) The denomination of the mixing session in " + CURRENCY_UNIT + "\n"
" \"state\": \"...\", (string) Current state of the mixing session\n"
" \"entries_count\": xxx, (numeric) The number of entries in the mixing session\n"
" }\n"
" ,...\n"
" ],\n"
" \"keys_left\": xxx, (numeric) How many new keys are left since last automatic backup\n"
" \"warnings\": \"...\" (string) Warnings if any\n"
"}\n"
"\nResult (for masternodes):\n"
"{\n"
" \"queue_size\": xxx, (numeric) How many queues there are currently on the network\n"
" \"denomination\": xxx, (numeric) The denomination of the mixing session in " + CURRENCY_UNIT + "\n"
" \"state\": \"...\", (string) Current state of the mixing session\n"
" \"entries_count\": xxx, (numeric) The number of entries in the mixing session\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("getcoinjoininfo", "")
+ HelpExampleRpc("getcoinjoininfo", "")
);
}

View File

@ -15,6 +15,7 @@
#include <masternode/sync.h>
#include <messagesigner.h>
#include <net.h>
#include <rpc/util.h>
#include <rpc/server.h>
#include <util/system.h>
#include <validation.h>
@ -26,11 +27,14 @@
static void gobject_count_help()
{
throw std::runtime_error(
"gobject count (\"mode\")\n"
"Count governance objects and votes\n"
"\nArguments:\n"
"1. \"mode\" (string, optional, default: \"json\") Output format: json (\"json\") or string in free form (\"all\")\n"
);
RPCHelpMan{"gobject count",
"Count governance objects and votes\n",
{
{"mode", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"mode\" (string, optional, default: \"json\") Output format: json (\"json\") or string in free form (\"all\")\n");
}
static UniValue gobject_count(const JSONRPCRequest& request)
@ -53,11 +57,14 @@ static UniValue gobject_count(const JSONRPCRequest& request)
static void gobject_deserialize_help()
{
throw std::runtime_error(
"gobject deserialize \"hex_data\"\n"
"Deserialize governance object from hex string to JSON\n"
"\nArguments:\n"
"1. \"hex_data\" (string, required) data in hex string form\n"
);
RPCHelpMan {"gobject deserialize",
"Deserialize governance object from hex string to JSON\n",
{
{"hex_data", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"hex_data\" (string, required) data in hex string form\n");
}
static UniValue gobject_deserialize(const JSONRPCRequest& request)
@ -79,11 +86,14 @@ static UniValue gobject_deserialize(const JSONRPCRequest& request)
static void gobject_check_help()
{
throw std::runtime_error(
"gobject check \"hex_data\"\n"
"Validate governance object data (proposal only)\n"
"\nArguments:\n"
"1. \"hex_data\" (string, required) data in hex string form\n"
);
RPCHelpMan{"gobject check",
"Validate governance object data (proposal only)\n",
{
{"hex_data", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"hex_data\" (string, required) data in hex string form\n");
}
static UniValue gobject_check(const JSONRPCRequest& request)
@ -122,18 +132,27 @@ static UniValue gobject_check(const JSONRPCRequest& request)
static void gobject_prepare_help(CWallet* const pwallet)
{
throw std::runtime_error(
"gobject prepare <parent-hash> <revision> <time> <data-hex>\n"
"Prepare governance object by signing and creating tx\n"
+ HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\n"
"1. parent-hash (string, required) hash of the parent object, \"0\" is root\n"
"2. revision (numeric, required) object revision in the system\n"
"3. time (numeric, required) time this object was created\n"
"4. data-hex (string, required) data in hex string form\n"
"5. use-IS (boolean, optional, default=false) Deprecated and ignored\n"
"6. outputHash (string, optional) the single output to submit the proposal fee from\n"
"7. outputIndex (numeric, optional) The output index.\n"
);
RPCHelpMan{"gobject prepare",
"Prepare governance object by signing and creating tx\n"
+ HelpRequiringPassphrase(pwallet) + "\n",
{
{"parent-hash", RPCArg::Type::STR, false},
{"revision", RPCArg::Type::NUM, false},
{"time", RPCArg::Type::NUM, false},
{"data-hex", RPCArg::Type::STR, false},
{"use-IS", RPCArg::Type::BOOL, true},
{"outputHash", RPCArg::Type::STR, true},
{"outputIndex", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"1. parent-hash (string, required) hash of the parent object, \"0\" is root\n"
"2. revision (numeric, required) object revision in the system\n"
"3. time (numeric, required) time this object was created\n"
"4. data-hex (string, required) data in hex string form\n"
"5. use-IS (boolean, optional, default=false) Deprecated and ignored\n"
"6. outputHash (string, optional) the single output to submit the proposal fee from\n"
"7. outputIndex (numeric, optional) The output index.\n");
}
static UniValue gobject_prepare(const JSONRPCRequest& request)
@ -240,12 +259,15 @@ static UniValue gobject_prepare(const JSONRPCRequest& request)
static void gobject_list_prepared_help(CWallet* const pwallet)
{
throw std::runtime_error(
"gobject list-prepared <count>\n"
"Returns a list of governance objects prepared by this wallet with \"gobject prepare\" sorted by their creation time.\n"
+ HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\n"
"1. count (numeric, optional, default=10) Maximum number of objects to return.\n"
);
RPCHelpMan{"gobject list-prepared",
"Returns a list of governance objects prepared by this wallet with \"gobject prepare\" sorted by their creation time.\n"
+ HelpRequiringPassphrase(pwallet) + "\n",
{
{"count", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"1. count (numeric, optional, default=10) Maximum number of objects to return.\n");
}
static UniValue gobject_list_prepared(const JSONRPCRequest& request)
@ -289,15 +311,22 @@ static UniValue gobject_list_prepared(const JSONRPCRequest& request)
static void gobject_submit_help()
{
throw std::runtime_error(
"gobject submit <parent-hash> <revision> <time> <data-hex> <fee-txid>\n"
"Submit governance object to network\n"
"\nArguments:\n"
"1. parent-hash (string, required) hash of the parent object, \"0\" is root\n"
"2. revision (numeric, required) object revision in the system\n"
"3. time (numeric, required) time this object was created\n"
"4. data-hex (string, required) data in hex string form\n"
"5. fee-txid (string, optional) fee-tx id, required for all objects except triggers"
);
RPCHelpMan{"gobject submit",
"Submit governance object to network\n",
{
{"parent-hash", RPCArg::Type::STR, false},
{"revision", RPCArg::Type::NUM, false},
{"time", RPCArg::Type::NUM, false},
{"data-hex", RPCArg::Type::STR, false},
{"fee-txid", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
"1. parent-hash (string, required) hash of the parent object, \"0\" is root\n"
"2. revision (numeric, required) object revision in the system\n"
"3. time (numeric, required) time this object was created\n"
"4. data-hex (string, required) data in hex string form\n"
"5. fee-txid (string, optional) fee-tx id, required for all objects except triggers");
}
static UniValue gobject_submit(const JSONRPCRequest& request)
@ -401,13 +430,18 @@ static UniValue gobject_submit(const JSONRPCRequest& request)
static void gobject_vote_conf_help()
{
throw std::runtime_error(
"gobject vote-conf <governance-hash> <vote> <vote-outcome>\n"
"Vote on a governance object by masternode configured in dash.conf\n"
"\nArguments:\n"
"1. governance-hash (string, required) hash of the governance object\n"
"2. vote (string, required) vote, possible values: [funding|valid|delete|endorsed]\n"
"3. vote-outcome (string, required) vote outcome, possible values: [yes|no|abstain]\n"
);
RPCHelpMan{"gobject vote-conf",
"Vote on a governance object by masternode configured in dash.conf\n",
{
{"governance-hash", RPCArg::Type::STR, false},
{"vote", RPCArg::Type::STR, false},
{"vote-outcome", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. governance-hash (string, required) hash of the governance object\n"
"2. vote (string, required) vote, possible values: [funding|valid|delete|endorsed]\n"
"3. vote-outcome (string, required) vote outcome, possible values: [yes|no|abstain]\n");
}
static UniValue gobject_vote_conf(const JSONRPCRequest& request)
@ -572,14 +606,19 @@ static UniValue VoteWithMasternodes(const std::map<uint256, CKey>& keys,
static void gobject_vote_many_help(CWallet* const pwallet)
{
throw std::runtime_error(
"gobject vote-many <governance-hash> <vote> <vote-outcome>\n"
"Vote on a governance object by all masternodes for which the voting key is present in the local wallet\n"
+ HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\n"
"1. governance-hash (string, required) hash of the governance object\n"
"2. vote (string, required) vote, possible values: [funding|valid|delete|endorsed]\n"
"3. vote-outcome (string, required) vote outcome, possible values: [yes|no|abstain]\n"
);
RPCHelpMan{"gobject vote-many",
"Vote on a governance object by all masternodes for which the voting key is present in the local wallet\n"
+ HelpRequiringPassphrase(pwallet) + "\n",
{
{"governance-hash", RPCArg::Type::STR, false},
{"vote", RPCArg::Type::STR, false},
{"vote-outcome", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. governance-hash (string, required) hash of the governance object\n"
"2. vote (string, required) vote, possible values: [funding|valid|delete|endorsed]\n"
"3. vote-outcome (string, required) vote outcome, possible values: [yes|no|abstain]\n");
}
static UniValue gobject_vote_many(const JSONRPCRequest& request)
@ -626,15 +665,21 @@ static UniValue gobject_vote_many(const JSONRPCRequest& request)
static void gobject_vote_alias_help(CWallet* const pwallet)
{
throw std::runtime_error(
"gobject vote-alias <governance-hash> <vote> <vote-outcome> <protx-hash>\n"
"Vote on a governance object by masternode's voting key (if present in local wallet)\n"
+ HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\n"
"1. governance-hash (string, required) hash of the governance object\n"
"2. vote (string, required) vote, possible values: [funding|valid|delete|endorsed]\n"
"3. vote-outcome (string, required) vote outcome, possible values: [yes|no|abstain]\n"
"4. protx-hash (string, required) masternode's proTxHash"
);
RPCHelpMan{"gobject vote-alias",
"Vote on a governance object by masternode's voting key (if present in local wallet)\n"
+ HelpRequiringPassphrase(pwallet) + "\n",
{
{"governance-hash", RPCArg::Type::STR, false},
{"vote", RPCArg::Type::STR, false},
{"vote-outcome", RPCArg::Type::STR, false},
{"protx-hash", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. governance-hash (string, required) hash of the governance object\n"
"2. vote (string, required) vote, possible values: [funding|valid|delete|endorsed]\n"
"3. vote-outcome (string, required) vote outcome, possible values: [yes|no|abstain]\n"
"4. protx-hash (string, required) masternode's proTxHash");
}
static UniValue gobject_vote_alias(const JSONRPCRequest& request)
@ -744,12 +789,16 @@ static UniValue ListObjects(const std::string& strCachedSignal, const std::strin
static void gobject_list_help()
{
throw std::runtime_error(
"gobject list ( <signal> <type> )\n"
"List governance objects (can be filtered by signal and/or object type)\n"
"\nArguments:\n"
"1. signal (string, optional, default=valid) cached signal, possible values: [valid|funding|delete|endorsed|all]\n"
"2. type (string, optional, default=all) object type, possible values: [proposals|triggers|all]\n"
);
RPCHelpMan{"gobject list",
"List governance objects (can be filtered by signal and/or object type)\n",
{
{"signal", RPCArg::Type::STR, false},
{"type", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. signal (string, optional, default=valid) cached signal, possible values: [valid|funding|delete|endorsed|all]\n"
"2. type (string, optional, default=all) object type, possible values: [proposals|triggers|all]\n");
}
static UniValue gobject_list(const JSONRPCRequest& request)
@ -777,12 +826,16 @@ static UniValue gobject_list(const JSONRPCRequest& request)
static void gobject_diff_help()
{
throw std::runtime_error(
"gobject diff ( <signal> <type> )\n"
"List differences since last diff or list\n"
"\nArguments:\n"
"1. signal (string, optional, default=valid) cached signal, possible values: [valid|funding|delete|endorsed|all]\n"
"2. type (string, optional, default=all) object type, possible values: [proposals|triggers|all]\n"
);
RPCHelpMan{"gobject diff",
"List differences since last diff or list\n",
{
{"signal", RPCArg::Type::STR, false},
{"type", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. signal (string, optional, default=valid) cached signal, possible values: [valid|funding|delete|endorsed|all]\n"
"2. type (string, optional, default=all) object type, possible values: [proposals|triggers|all]\n");
}
static UniValue gobject_diff(const JSONRPCRequest& request)
@ -810,11 +863,14 @@ static UniValue gobject_diff(const JSONRPCRequest& request)
static void gobject_get_help()
{
throw std::runtime_error(
"gobject get <governance-hash>\n"
"Get governance object by hash\n"
"\nArguments:\n"
"1. governance-hash (string, required) object id\n"
);
RPCHelpMan{"gobject get",
"Get governance object by hash\n",
{
{"governance-hash", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. governance-hash (string, required) object id\n");
}
static UniValue gobject_get(const JSONRPCRequest& request)
@ -899,13 +955,18 @@ static UniValue gobject_get(const JSONRPCRequest& request)
static void gobject_getcurrentvotes_help()
{
throw std::runtime_error(
"gobject getcurrentvotes <governance-hash> (<txid> <vout>)\n"
"Get only current (tallying) votes for a governance object hash (does not include old votes)\n"
"\nArguments:\n"
"1. governance-hash (string, required) object id\n"
"2. txid (string, optional) masternode collateral txid\n"
"3. vout (string, optional) masternode collateral output index, required if <txid> presents\n"
);
RPCHelpMan{"gobject getcurrentvotes",
"Get only current (tallying) votes for a governance object hash (does not include old votes)\n",
{
{"governance-hash", RPCArg::Type::STR, false},
{"txid", RPCArg::Type::STR, true},
{"vout", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
"1. governance-hash (string, required) object id\n"
"2. txid (string, optional) masternode collateral txid\n"
"3. vout (string, optional) masternode collateral output index, required if <txid> presents\n");
}
static UniValue gobject_getcurrentvotes(const JSONRPCRequest& request)
@ -951,7 +1012,7 @@ static UniValue gobject_getcurrentvotes(const JSONRPCRequest& request)
[[ noreturn ]] static void gobject_help()
{
throw std::runtime_error(
"gobject \"command\" ...\n"
RPCHelpMan {"gobject",
"Set of commands to manage governance objects.\n"
"\nAvailable commands:\n"
" check - Validate governance object data (proposal only)\n"
@ -973,7 +1034,9 @@ static UniValue gobject_getcurrentvotes(const JSONRPCRequest& request)
#ifdef ENABLE_WALLET
" vote-many - Vote on a governance object by all masternodes for which the voting key is in the wallet\n"
#endif // ENABLE_WALLET
);
,
{}
}.ToString());
}
static UniValue gobject(const JSONRPCRequest& request)
@ -1037,9 +1100,18 @@ static UniValue voteraw(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 7)
throw std::runtime_error(
"voteraw <mn-collateral-tx-hash> <mn-collateral-tx-index> <governance-hash> <vote-signal> [yes|no|abstain] <time> <vote-sig>\n"
"Compile and relay a governance vote with provided external signature instead of signing vote internally\n"
);
RPCHelpMan{"voteraw",
"Compile and relay a governance vote with provided external signature instead of signing vote internally\n",
{
{"mn-collateral-tx-hash", RPCArg::Type::STR, false},
{"mn-collateral-tx-index", RPCArg::Type::NUM, false},
{"governance-hash", RPCArg::Type::STR, false},
{"vote-signal", RPCArg::Type::STR, false},
{"vote-outcome", RPCArg::Type::STR, false},
{"time", RPCArg::Type::NUM, false},
{"vote-sig", RPCArg::Type::STR_HEX, false},
}}
.ToString());
uint256 hashMnCollateralTx = ParseHashV(request.params[0], "mn collateral tx hash");
int nMnCollateralTxIndex = request.params[1].get_int();
@ -1108,8 +1180,10 @@ static UniValue getgovernanceinfo(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0) {
throw std::runtime_error(
"getgovernanceinfo\n"
"Returns an object containing governance parameters.\n"
RPCHelpMan{"getgovernanceinfo",
"Returns an object containing governance parameters.\n",
{}}
.ToString() +
"\nResult:\n"
"{\n"
" \"governanceminquorum\": xxxxx, (numeric) the absolute minimum number of votes needed to trigger a governance action\n"
@ -1143,8 +1217,12 @@ static UniValue getsuperblockbudget(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error(
"getsuperblockbudget index\n"
"\nReturns the absolute maximum sum of superblock payments allowed.\n"
RPCHelpMan{"getsuperblockbudget",
"\nReturns the absolute maximum sum of superblock payments allowed.\n",
{
{"index", RPCArg::Type::NUM, false},
}}
.ToString() +
"\nArguments:\n"
"1. index (numeric, required) The block index\n"
"\nResult:\n"

View File

@ -9,6 +9,7 @@
#include <masternode/payments.h>
#include <net.h>
#include <netbase.h>
#include <rpc/util.h>
#include <rpc/server.h>
#include <validation.h>
#include <wallet/coincontrol.h>
@ -26,8 +27,13 @@ static UniValue masternodelist(const JSONRPCRequest& request);
static void masternode_list_help()
{
throw std::runtime_error(
"masternodelist ( \"mode\" \"filter\" )\n"
"Get a list of masternodes in different modes. This call is identical to 'masternode list' call.\n"
RPCHelpMan{"masternodelist",
"Get a list of masternodes in different modes. This call is identical to 'masternode list' call.\n",
{
{"mode", RPCArg::Type::STR, true},
{"filter", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"mode\" (string, optional/required to use filter, defaults = json) The mode to run list in\n"
"2. \"filter\" (string, optional) Filter results. Partial match by outpoint by default in all modes,\n"
@ -67,11 +73,14 @@ static UniValue masternode_list(const JSONRPCRequest& request)
static void masternode_connect_help()
{
throw std::runtime_error(
"masternode connect \"address\"\n"
"Connect to given masternode\n"
"\nArguments:\n"
"1. \"address\" (string, required) The address of the masternode to connect\n"
);
RPCHelpMan{"masternode connect",
"Connect to given masternode\n",
{
{"address", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"address\" (string, required) The address of the masternode to connect\n");
}
static UniValue masternode_connect(const JSONRPCRequest& request)
@ -96,9 +105,9 @@ static UniValue masternode_connect(const JSONRPCRequest& request)
static void masternode_count_help()
{
throw std::runtime_error(
"masternode count\n"
"Get information about number of masternodes.\n"
);
RPCHelpMan{"masternode count",
"Get information about number of masternodes.\n",
{}}.ToString());
}
static UniValue masternode_count(const JSONRPCRequest& request)
@ -145,9 +154,9 @@ static void masternode_winner_help()
}
throw std::runtime_error(
"masternode winner\n"
"Print info on next masternode winner to vote for\n"
);
RPCHelpMan{"masternode winner",
"Print info on next masternode winner to vote for\n",
{}}.ToString());
}
static UniValue masternode_winner(const JSONRPCRequest& request)
@ -165,9 +174,9 @@ static void masternode_current_help()
}
throw std::runtime_error(
"masternode current\n"
"Print info on current masternode winner to be paid the next block (calculated locally)\n"
);
RPCHelpMan{"masternode current",
"Print info on current masternode winner to be paid the next block (calculated locally)\n",
{}}.ToString());
}
static UniValue masternode_current(const JSONRPCRequest& request)
@ -182,9 +191,9 @@ static UniValue masternode_current(const JSONRPCRequest& request)
static void masternode_outputs_help()
{
throw std::runtime_error(
"masternode outputs\n"
"Print masternode compatible outputs\n"
);
RPCHelpMan{"masternode outputs",
"Print masternode compatible outputs\n",
{}}.ToString());
}
static UniValue masternode_outputs(const JSONRPCRequest& request)
@ -220,9 +229,9 @@ static UniValue masternode_outputs(const JSONRPCRequest& request)
static void masternode_status_help()
{
throw std::runtime_error(
"masternode status\n"
"Print masternode status information\n"
);
RPCHelpMan{"masternode status",
"Print masternode status information\n",
{}}.ToString());
}
static UniValue masternode_status(const JSONRPCRequest& request)
@ -297,12 +306,15 @@ static std::string GetRequiredPaymentsString(int nBlockHeight, const CDeterminis
static void masternode_winners_help()
{
throw std::runtime_error(
"masternode winners ( count \"filter\" )\n"
"Print list of masternode winners\n"
"\nArguments:\n"
"1. count (numeric, optional) number of last winners to return\n"
"2. filter (string, optional) filter for returned winners\n"
);
RPCHelpMan{"masternode winners",
"Print list of masternode winners\n",
{
{"count", RPCArg::Type::NUM, true},
{"filter", RPCArg::Type::STR, true},
}}.ToString() +
"\nArguments:\n"
"1. count (numeric, optional) number of last winners to return\n"
"2. filter (string, optional) filter for returned winners\n");
}
static UniValue masternode_winners(const JSONRPCRequest& request)
@ -353,35 +365,39 @@ static UniValue masternode_winners(const JSONRPCRequest& request)
static void masternode_payments_help()
{
throw std::runtime_error(
"masternode payments ( \"blockhash\" count )\n"
"\nReturns an array of deterministic masternodes and their payments for the specified block\n"
"\nArguments:\n"
"1. \"blockhash\" (string, optional, default=tip) The hash of the starting block\n"
"2. count (numeric, optional, default=1) The number of blocks to return.\n"
" Will return <count> previous blocks if <count> is negative.\n"
" Both 1 and -1 correspond to the chain tip.\n"
"\nResult:\n"
" [ (array) Blocks\n"
" {\n"
" \"height\" : n, (numeric) The height of the block\n"
" \"blockhash\" : \"hash\", (string) The hash of the block\n"
" \"amount\": n (numeric) Amount received in this block by all masternodes\n"
" \"masternodes\": [ (array) Masternodes that received payments in this block\n"
" {\n"
" \"proTxHash\": \"xxxx\", (string) The hash of the corresponding ProRegTx\n"
" \"amount\": n (numeric) Amount received by this masternode\n"
" \"payees\": [ (array) Payees who received a share of this payment\n"
" {\n"
" \"address\" : \"xxx\", (string) Payee address\n"
" \"script\" : \"xxx\", (string) Payee scriptPubKey\n"
" \"amount\": n (numeric) Amount received by this payee\n"
" },...\n"
" ]\n"
" },...\n"
" ]\n"
" },...\n"
" ]\n"
);
RPCHelpMan{"masternode payments",
"\nReturns an array of deterministic masternodes and their payments for the specified block\n",
{
{"blockhash", RPCArg::Type::STR, true},
{"count", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"blockhash\" (string, optional, default=tip) The hash of the starting block\n"
"2. count (numeric, optional, default=1) The number of blocks to return.\n"
" Will return <count> previous blocks if <count> is negative.\n"
" Both 1 and -1 correspond to the chain tip.\n"
"\nResult:\n"
" [ (array) Blocks\n"
" {\n"
" \"height\" : n, (numeric) The height of the block\n"
" \"blockhash\" : \"hash\", (string) The hash of the block\n"
" \"amount\": n (numeric) Amount received in this block by all masternodes\n"
" \"masternodes\": [ (array) Masternodes that received payments in this block\n"
" {\n"
" \"proTxHash\": \"xxxx\", (string) The hash of the corresponding ProRegTx\n"
" \"amount\": n (numeric) Amount received by this masternode\n"
" \"payees\": [ (array) Payees who received a share of this payment\n"
" {\n"
" \"address\" : \"xxx\", (string) Payee address\n"
" \"script\" : \"xxx\", (string) Payee scriptPubKey\n"
" \"amount\": n (numeric) Amount received by this payee\n"
" },...\n"
" ]\n"
" },...\n"
" ]\n"
" },...\n"
" ]\n");
}
static UniValue masternode_payments(const JSONRPCRequest& request)
@ -497,8 +513,10 @@ static UniValue masternode_payments(const JSONRPCRequest& request)
[[ noreturn ]] static void masternode_help()
{
throw std::runtime_error(
"masternode \"command\" ...\n"
"Set of commands to execute masternode related actions\n"
RPCHelpMan{"masternode",
"Set of commands to execute masternode related actions\n",
{}}
.ToString() +
"\nArguments:\n"
"1. \"command\" (string or set of strings, required) The command to execute\n"
"\nAvailable commands:\n"

View File

@ -86,10 +86,15 @@ static UniValue getnetworkhashps(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 2)
throw std::runtime_error(
"getnetworkhashps ( nblocks height )\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 [height] to estimate the network speed at the time when a certain block was found.\n"
RPCHelpMan{"getnetworkhashps",
"\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 [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"
"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"
@ -157,8 +162,14 @@ static UniValue generatetoaddress(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
throw std::runtime_error(
"generatetoaddress nblocks address (maxtries)\n"
"\nMine blocks immediately to a specified address (before the RPC call returns)\n"
RPCHelpMan{"generatetoaddress",
"\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"
"1. nblocks (numeric, required) How many blocks are generated immediately.\n"
"2. address (string, required) The address to send the newly generated Dash to.\n"
@ -197,8 +208,9 @@ static UniValue getmininginfo(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getmininginfo\n"
"\nReturns a json object containing mining-related information."
RPCHelpMan{"getmininginfo",
"\nReturns a json object containing mining-related information.", {}}
.ToString() +
"\nResult:\n"
"{\n"
" \"blocks\": nnn, (numeric) The current block\n"
@ -236,8 +248,13 @@ static UniValue prioritisetransaction(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 2)
throw std::runtime_error(
"prioritisetransaction \"txid\" fee_delta\n"
"Accepts the transaction into mined blocks at a higher (or lower) priority\n"
RPCHelpMan{"prioritisetransaction",
"Accepts the transaction into mined blocks at a higher (or lower) priority\n",
{
{"txid", RPCArg::Type::STR, false},
{"fee_delta", RPCArg::Type::NUM, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"txid\" (string, required) The transaction id.\n"
"2. fee_delta (numeric, required) The fee value (in duffs) to add (or subtract, if negative).\n"
@ -293,14 +310,31 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
"getblocktemplate ( \"template_request\" )\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"
"For full specification, see BIPs 22, 23, and 9:\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-0009.mediawiki#getblocktemplate_changes\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"
"It returns data needed to construct a block to work on.\n"
"For full specification, see BIPs 22, 23, and 9:\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-0009.mediawiki#getblocktemplate_changes\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"
"1. template_request (json object, optional) A json object in the following spec\n"
" {\n"
@ -722,10 +756,14 @@ static UniValue submitblock(const JSONRPCRequest& request)
// We allow 2 arguments for compliance with BIP22. Argument 2 is ignored.
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error(
"submitblock \"hexdata\" ( \"dummy\" )\n"
"\nAttempts to submit new block to network.\n"
"See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n"
RPCHelpMan{"submitblock",
"\nAttempts to submit new block to network.\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"
"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"
@ -778,9 +816,13 @@ static UniValue submitheader(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error(
"submitheader \"hexdata\"\n"
"\nDecode the given hexdata as a header and submit it as a candidate chain tip if valid."
"\nThrows when the header is invalid.\n"
RPCHelpMan{"submitheader",
"\nDecode the given hexdata as a header and submit it as a candidate chain tip if valid."
"\nThrows when the header is invalid.\n",
{
{"hexdata", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments\n"
"1. \"hexdata\" (string, required) the hex-encoded block header data\n"
"\nResult:\n"
@ -814,10 +856,15 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
"estimatesmartfee conf_target (\"estimate_mode\")\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"
"for which the estimate is valid.\n"
RPCHelpMan{"estimatesmartfee",
"\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"
"for which the estimate is valid.\n",
{
{"conf_target", RPCArg::Type::NUM, false},
{"estimate_mode", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
"1. conf_target (numeric) Confirmation target in blocks (1 - 1008)\n"
"2. \"estimate_mode\" (string, optional, default=CONSERVATIVE) The fee estimate mode.\n"
@ -874,13 +921,18 @@ static UniValue estimaterawfee(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
"estimaterawfee conf_target (threshold)\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"
" 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"
"\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
"confirmation within conf_target blocks if possible.\n"
RPCHelpMan{"estimaterawfee",
"\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"
" 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"
"\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
"confirmation within conf_target blocks if possible.\n",
{
{"conf_target", RPCArg::Type::NUM, false},
{"threshold", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\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"

View File

@ -40,15 +40,19 @@ static UniValue debug(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"debug \"category\"\n"
"Change debug category on the fly. Specify single category or use '+' to specify many.\n"
"The valid debug categories are: " + ListLogCategories() + ".\n"
"libevent logging is configured on startup and cannot be modified by this RPC during runtime.\n"
"There are also a few meta-categories:\n"
" - \"all\", \"1\" and \"\" activate all categories at once;\n"
" - \"dash\" activates all Dash-specific categories at once;\n"
" - \"none\" (or \"0\") deactivates all categories at once.\n"
"Note: If specified category doesn't match any of the above, no error is thrown.\n"
RPCHelpMan{"debug",
"Change debug category on the fly. Specify single category or use '+' to specify many.\n"
"The valid debug categories are: " + ListLogCategories() + ".\n"
"libevent logging is configured on startup and cannot be modified by this RPC during runtime.\n"
"There are also a few meta-categories:\n"
" - \"all\", \"1\" and \"\" activate all categories at once;\n"
" - \"dash\" activates all Dash-specific categories at once;\n"
" - \"none\" (or \"0\") deactivates all categories at once.\n"
"Note: If specified category doesn't match any of the above, no error is thrown.\n",
{
{"category", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"category\" (string, required) The name of the debug category to turn on.\n"
"\nResult:\n"
@ -77,8 +81,14 @@ static UniValue mnsync(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"mnsync [status|next|reset]\n"
"Returns the sync status, updates to the next step or resets it entirely.\n"
RPCHelpMan{"mnsync",
"Returns the sync status, updates to the next step or resets it entirely.\n",
{
{"mode", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. mode (string, required) [status|next|reset]\n"
);
std::string strMode = request.params[0].get_str();
@ -134,8 +144,12 @@ static UniValue spork(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 2) {
// default help, for basic mode
throw std::runtime_error(
"spork \"command\"\n"
"\nShows information about current state of sporks\n"
RPCHelpMan{"spork",
"\nShows information about current state of sporks\n",
{
{"command", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"command\" (string, required) 'show' to show all current spork values, 'active' to show which sporks are active\n"
"\nResult:\n"
@ -169,8 +183,13 @@ static UniValue spork(const JSONRPCRequest& request)
return "success";
} else {
throw std::runtime_error(
"spork \"name\" value\n"
"\nUpdate the value of the specific spork. Requires \"-sporkkey\" to be set to sign the message.\n"
RPCHelpMan{"spork",
"\nUpdate the value of the specific spork. Requires \"-sporkkey\" to be set to sign the message.\n",
{
{"name", RPCArg::Type::STR, false},
{"value", RPCArg::Type::NUM, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"name\" (string, required) The name of the spork to update\n"
"2. value (number, required) The new desired value of the spork\n"
@ -188,8 +207,12 @@ static UniValue validateaddress(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"validateaddress \"address\"\n"
"\nReturn information about the given dash address.\n"
RPCHelpMan{"validateaddress",
"\nReturn information about the given dash address.\n",
{
{"address", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"address\" (string, required) The dash address to validate\n"
"\nResult:\n"
@ -227,9 +250,19 @@ static UniValue createmultisig(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 2 || request.params.size() > 2)
{
std::string msg = "createmultisig nrequired [\"key\",...]\n"
"\nCreates a multi-signature address with n signature of m keys required.\n"
"It returns a json object with the address and redeemScript.\n"
std::string msg =
RPCHelpMan{"createmultisig",
"\nCreates a multi-signature address with n signature of m keys required.\n"
"It returns a json object with the address and redeemScript.\n",
{
{"nrequired", RPCArg::Type::NUM, false},
{"keys", RPCArg::Type::ARR,
{
{"key", RPCArg::Type::STR_HEX, true},
},
false},
}}
.ToString() +
"\nArguments:\n"
"1. nrequired (numeric, required) The number of required signatures out of the n keys.\n"
"2. \"keys\" (string, required) A json array of hex-encoded public keys\n"
@ -281,8 +314,14 @@ static UniValue verifymessage(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 3)
throw std::runtime_error(
"verifymessage \"address\" \"signature\" \"message\"\n"
"\nVerify a signed message\n"
RPCHelpMan{"verifymessage",
"\nVerify a signed message\n",
{
{"address", RPCArg::Type::STR, false},
{"signature", RPCArg::Type::STR, false},
{"message", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"address\" (string, required) The dash address to use for the signature.\n"
"2. \"signature\" (string, required) The signature provided by the signer in base 64 encoding (see signmessage).\n"
@ -337,8 +376,13 @@ static UniValue signmessagewithprivkey(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 2)
throw std::runtime_error(
"signmessagewithprivkey \"privkey\" \"message\"\n"
"\nSign a message with the private key of an address\n"
RPCHelpMan{"signmessagewithprivkey",
"\nSign a message with the private key of an address\n",
{
{"privkey", RPCArg::Type::STR, false},
{"message", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"privkey\" (string, required) The private key to sign the message with.\n"
"2. \"message\" (string, required) The message to create a signature of.\n"
@ -376,8 +420,12 @@ static UniValue setmocktime(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"setmocktime timestamp\n"
"\nSet the local time to given timestamp (-regtest only)\n"
RPCHelpMan{"setmocktime",
"\nSet the local time to given timestamp (-regtest only)\n",
{
{"timestamp", RPCArg::Type::NUM, false},
}}
.ToString() +
"\nArguments:\n"
"1. timestamp (integer, required) Unix seconds-since-epoch timestamp\n"
" Pass 0 to go back to using the system time."
@ -403,8 +451,14 @@ static UniValue mnauth(const JSONRPCRequest& request)
{
if (request.fHelp || (request.params.size() != 3))
throw std::runtime_error(
"mnauth nodeId \"proTxHash\" \"publicKey\"\n"
"\nOverride MNAUTH processing results for the specified node with a user provided data (-regtest only).\n"
RPCHelpMan{"mnauth",
"\nOverride MNAUTH processing results for the specified node with a user provided data (-regtest only).\n",
{
{"nodeId", RPCArg::Type::NUM, false},
{"proTxHash", RPCArg::Type::STR, false},
{"publicKey", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. nodeId (integer, required) Internal peer id of the node the mock data gets added to.\n"
"2. \"proTxHash\" (string, required) The authenticated proTxHash as hex string.\n"
@ -508,8 +562,15 @@ static UniValue getaddressmempool(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"getaddressmempool\n"
"\nReturns all mempool deltas for an address (requires addressindex to be enabled).\n"
RPCHelpMan{"getaddressmempool",
"\nReturns all mempool deltas for an address (requires addressindex to be enabled).\n",
{
{"addresses", RPCArg::Type::ARR,
{
{"address", RPCArg::Type::STR, true},
},
true},
}}.ToString() +
"\nArguments:\n"
"{\n"
" \"addresses\"\n"
@ -579,8 +640,15 @@ static UniValue getaddressutxos(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"getaddressutxos\n"
"\nReturns all unspent outputs for an address (requires addressindex to be enabled).\n"
RPCHelpMan{"getaddressutxos",
"\nReturns all unspent outputs for an address (requires addressindex to be enabled).\n",
{
{"addresses", RPCArg::Type::ARR,
{
{"address", RPCArg::Type::STR, true},
},
true},
}}.ToString() +
"\nArguments:\n"
"{\n"
" \"addresses\"\n"
@ -646,8 +714,15 @@ static UniValue getaddressdeltas(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1 || !request.params[0].isObject())
throw std::runtime_error(
"getaddressdeltas\n"
"\nReturns all changes for an address (requires addressindex to be enabled).\n"
RPCHelpMan{"getaddressdeltas",
"\nReturns all changes for an address (requires addressindex to be enabled).\n",
{
{"addresses", RPCArg::Type::ARR,
{
{"address", RPCArg::Type::STR, true},
},
true},
}}.ToString() +
"\nArguments:\n"
"{\n"
" \"addresses\"\n"
@ -734,8 +809,15 @@ static UniValue getaddressbalance(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"getaddressbalance\n"
"\nReturns the balance for an address(es) (requires addressindex to be enabled).\n"
RPCHelpMan{"getaddressbalance",
"\nReturns the balance for an address(es) (requires addressindex to be enabled).\n",
{
{"addresses", RPCArg::Type::ARR,
{
{"address", RPCArg::Type::STR, true},
},
true},
}}.ToString() +
"\nArguments:\n"
"{\n"
" \"addresses\"\n"
@ -803,8 +885,15 @@ static UniValue getaddresstxids(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"getaddresstxids\n"
"\nReturns the txids for an address(es) (requires addressindex to be enabled).\n"
RPCHelpMan{"getaddresstxids",
"\nReturns the txids for an address(es) (requires addressindex to be enabled).\n",
{
{"addresses", RPCArg::Type::ARR,
{
{"address", RPCArg::Type::STR, true},
},
true},
}}.ToString() +
"\nArguments:\n"
"{\n"
" \"addresses\"\n"
@ -886,8 +975,16 @@ static UniValue getspentinfo(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1 || !request.params[0].isObject())
throw std::runtime_error(
"getspentinfo\n"
"\nReturns the txid and index where an output is spent.\n"
RPCHelpMan{"getspentinfo",
"\nReturns the txid and index where an output is spent.\n",
{
{"request", RPCArg::Type::OBJ,
{
{"txid", RPCArg::Type::STR, true},
{"index", RPCArg::Type::NUM, true},
},
true},
}}.ToString() +
"\nArguments:\n"
"{\n"
" \"txid\" (string) The hex string of the txid\n"
@ -968,8 +1065,12 @@ static UniValue getmemoryinfo(const JSONRPCRequest& request)
*/
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
"getmemoryinfo (\"mode\")\n"
"Returns an object containing information about memory usage.\n"
RPCHelpMan{"getmemoryinfo",
"Returns an object containing information about memory usage.\n",
{
{"mode", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"mode\" (string, optional, default: \"stats\") Determines what kind of information is returned.\n"
" - \"stats\" returns general statistics about memory usage in the daemon.\n"
@ -1030,7 +1131,7 @@ static UniValue logging(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 2) {
throw std::runtime_error(
"logging ( <include> <exclude> )\n"
RPCHelpMan{"logging",
"Gets and sets the logging configuration.\n"
"When called without an argument, returns the list of categories with status that are currently being debug logged or not.\n"
"When called with arguments, adds or removes categories from debug logging and return the lists above.\n"
@ -1042,6 +1143,12 @@ static UniValue logging(const JSONRPCRequest& request)
" - \"dash\" activates all Dash-specific categories at once.\n"
"To deactivate all categories at once you can specify \"all\" in <exclude>.\n"
" - \"none\", \"0\" : even if other logging categories are specified, ignore all of them.\n"
,
{
{"include", RPCArg::Type::STR, true},
{"exclude", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"include\" (array of strings, optional) A json array of categories to add debug logging\n"
" [\n"
@ -1101,11 +1208,13 @@ static UniValue echo(const JSONRPCRequest& request)
{
if (request.fHelp)
throw std::runtime_error(
"echo|echojson \"message\" ...\n"
"\nSimply echo back the input arguments. This command is for testing.\n"
"\nThe difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in"
"dash-cli and the GUI. There is no server-side difference."
);
RPCHelpMan{"echo|echojson ...",
"\nSimply echo back the input arguments. This command is for testing.\n"
"\nThe difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in "
"dash-cli and the GUI. There is no server-side difference.",
{}}
.ToString() +
"");
return request.params;
}

View File

@ -31,8 +31,9 @@ static UniValue getconnectioncount(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getconnectioncount\n"
"\nReturns the number of connections to other nodes.\n"
RPCHelpMan{"getconnectioncount",
"\nReturns the number of connections to other nodes.\n", {}}
.ToString() +
"\nResult:\n"
"n (numeric) The connection count\n"
"\nExamples:\n"
@ -50,10 +51,12 @@ static UniValue ping(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"ping\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"
"Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.\n"
RPCHelpMan{"ping",
"\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"
"Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.\n",
{}}
.ToString() +
"\nExamples:\n"
+ HelpExampleCli("ping", "")
+ HelpExampleRpc("ping", "")
@ -73,8 +76,9 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getpeerinfo\n"
"\nReturns data about each connected network node as a json array of objects.\n"
RPCHelpMan{"getpeerinfo",
"\nReturns data about each connected network node as a json array of objects.\n", {}}
.ToString() +
"\nResult:\n"
"[\n"
" {\n"
@ -234,11 +238,16 @@ static UniValue addnode(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 2 ||
(strCommand != "onetry" && strCommand != "add" && strCommand != "remove"))
throw std::runtime_error(
"addnode \"node\" \"command\"\n"
"\nAttempts to add or remove a node from the addnode list.\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"
"full nodes as other outbound peers are (though such peers will not be synced from).\n"
RPCHelpMan{"addnode",
"\nAttempts to add or remove a node from the addnode list.\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"
"full nodes 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"
"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"
@ -277,10 +286,15 @@ static UniValue disconnectnode(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() == 0 || request.params.size() >= 3)
throw std::runtime_error(
"disconnectnode ( \"address\" nodeid )\n"
"\nImmediately disconnects from the specified peer 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"
RPCHelpMan{"disconnectnode",
"\nImmediately disconnects from the specified peer 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",
{
{"address", RPCArg::Type::STR, true},
{"nodeid", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\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"
@ -320,9 +334,13 @@ static UniValue getaddednodeinfo(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
"getaddednodeinfo ( \"node\" )\n"
"\nReturns information about the given added node, or all added nodes\n"
"(note that onetry addnodes are not listed here)\n"
RPCHelpMan{"getaddednodeinfo",
"\nReturns information about the given added node, or all added nodes\n"
"(note that onetry addnodes are not listed here)\n",
{
{"node", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"node\" (string, optional) If provided, return information about this specific node, otherwise all nodes are returned.\n"
"\nResult:\n"
@ -388,9 +406,11 @@ static UniValue getnettotals(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 0)
throw std::runtime_error(
"getnettotals\n"
"\nReturns information about network traffic, including bytes in, bytes out,\n"
"and current time.\n"
RPCHelpMan{"getnettotals",
"\nReturns information about network traffic, including bytes in, bytes out,\n"
"and current time.\n",
{}}
.ToString() +
"\nResult:\n"
"{\n"
" \"totalbytesrecv\": n, (numeric) Total bytes received\n"
@ -454,8 +474,9 @@ static UniValue getnetworkinfo(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getnetworkinfo\n"
"Returns an object containing various state info regarding P2P networking.\n"
RPCHelpMan{"getnetworkinfo",
"Returns an object containing various state info regarding P2P networking.\n", {}}
.ToString() +
"\nResult:\n"
"{\n"
" \"version\": xxxxx, (numeric) the server version\n"
@ -562,8 +583,15 @@ static UniValue setban(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 ||
(strCommand != "add" && strCommand != "remove"))
throw std::runtime_error(
"setban \"subnet\" \"command\" ( bantime absolute )\n"
"\nAttempts to add or remove an IP/Subnet from the banned list.\n"
RPCHelpMan{"setban",
"\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"
"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"
@ -635,8 +663,9 @@ static UniValue listbanned(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"listbanned\n"
"\nList all banned IPs/Subnets.\n"
RPCHelpMan{"listbanned",
"\nList all banned IPs/Subnets.\n", {}}
.ToString() +
"\nExamples:\n"
+ HelpExampleCli("listbanned", "")
+ HelpExampleRpc("listbanned", "")
@ -669,8 +698,9 @@ static UniValue clearbanned(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"clearbanned\n"
"\nClear all banned IPs.\n"
RPCHelpMan{"clearbanned",
"\nClear all banned IPs.\n", {}}
.ToString() +
"\nExamples:\n"
+ HelpExampleCli("clearbanned", "")
+ HelpExampleRpc("clearbanned", "")
@ -688,8 +718,12 @@ static UniValue setnetworkactive(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error(
"setnetworkactive state\n"
"\nDisable/enable all p2p network activity.\n"
RPCHelpMan{"setnetworkactive",
"\nDisable/enable all p2p network activity.\n",
{
{"state", RPCArg::Type::BOOL, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"state\" (boolean, required) true to enable networking, false to disable\n"
);
@ -708,8 +742,12 @@ static UniValue getnodeaddresses(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 1) {
throw std::runtime_error(
"getnodeaddresses ( count )\n"
"\nReturn known addresses which can potentially be used to find new nodes in the network\n"
RPCHelpMan{"getnodeaddresses",
"\nReturn known addresses which can potentially be used to find new nodes in the network\n",
{
{"count", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"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"

View File

@ -108,14 +108,18 @@ static UniValue getrawtransaction(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error(
"getrawtransaction \"txid\" ( verbose \"blockhash\" )\n"
"\nBy default this function only works for mempool transactions. When called with a blockhash\n"
"argument, getrawtransaction will return the transaction if the specified block is available and\n"
"the transaction is found in that block. When called without a blockhash argument, getrawtransaction\n"
"will return the transaction if it is in the mempool, or if -txindex is enabled and the transaction\n"
"is in a block in the blockchain.\n"
RPCHelpMan{"getrawtransaction",
"\nBy default this function only works for mempool transactions. When called with a blockhash\n"
"argument, getrawtransaction will return the transaction if the specified block is available and\n"
"the transaction is found in that block. When called without a blockhash argument, getrawtransaction\n"
"will return the transaction if it is in the mempool, or if -txindex is enabled and the transaction\n"
"is in a block in the blockchain.\n",
{
{"txid", RPCArg::Type::STR_HEX, false},
{"verbose", RPCArg::Type::BOOL, true},
{"blockhash", RPCArg::Type::STR_HEX, true},
}}
.ToString() +
"\nReturn the raw transaction data.\n"
"\nIf verbose is 'true', returns an Object with information about 'txid'.\n"
"If verbose is 'false' or omitted, returns a string that is serialized, hex-encoded data for 'txid'.\n"
@ -250,6 +254,11 @@ static UniValue gettxoutproof(const JSONRPCRequest& request)
if (request.fHelp || (request.params.size() != 1 && request.params.size() != 2))
throw std::runtime_error(
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,
{
@ -259,11 +268,6 @@ static UniValue gettxoutproof(const JSONRPCRequest& request)
{"blockhash", RPCArg::Type::STR_HEX, true},
}}
.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"
"1. \"txids\" (string) A json array of txids to filter\n"
" [\n"
@ -357,9 +361,13 @@ static UniValue verifytxoutproof(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"verifytxoutproof \"proof\"\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"
RPCHelpMan{"verifytxoutproof",
"\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",
{
{"proof", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"proof\" (string, required) The hex-encoded proof generated by gettxoutproof\n"
"\nResult:\n"
@ -550,9 +558,12 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"decoderawtransaction \"hexstring\"\n"
"\nReturn a JSON object representing the serialized, hex-encoded transaction.\n"
RPCHelpMan{"decoderawtransaction",
"\nReturn a JSON object representing the serialized, hex-encoded transaction.\n",
{
{"hexstring", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"hexstring\" (string, required) The transaction hex string\n"
@ -618,8 +629,12 @@ static UniValue decodescript(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"decodescript \"hexstring\"\n"
"\nDecode a hex-encoded script.\n"
RPCHelpMan{"decodescript",
"\nDecode a hex-encoded script.\n",
{
{"hexstring", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"hexstring\" (string) the hex-encoded script\n"
"\nResult:\n"
@ -681,6 +696,9 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
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,
{
@ -689,10 +707,6 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
false},
}}
.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"
"1. \"txs\" (string) A json array of hex strings of partially signed transactions\n"
" [\n"
@ -905,6 +919,11 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 || request.params.size() > 4)
throw std::runtime_error(
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},
{"privkeys", RPCArg::Type::ARR,
@ -928,12 +947,6 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
{"sighashtype", RPCArg::Type::STR, true},
}}
.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"
"1. \"hexstring\" (string, required) The transaction hex string\n"
"2. \"privkeys\" (string, required) A json array of base58-encoded private keys for signing\n"
@ -1014,9 +1027,16 @@ UniValue sendrawtransaction(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4)
throw std::runtime_error(
"sendrawtransaction \"hexstring\" ( allowhighfees instantsend bypasslimits)\n"
"\nSubmits raw transaction (serialized, hex-encoded) to local node and network.\n"
"\nAlso see createrawtransaction and signrawtransactionwithkey calls.\n"
RPCHelpMan{"sendrawtransaction",
"\nSubmits raw transaction (serialized, hex-encoded) to local node and network.\n"
"\nAlso see createrawtransaction and signrawtransactionwithkey calls.\n",
{
{"hexstring", RPCArg::Type::STR_HEX, false},
{"allowhighfees", RPCArg::Type::BOOL, true},
{"instantsend", RPCArg::Type::BOOL, true},
{"bypasslimits", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"hexstring\" (string, required) The hex string of the raw transaction)\n"
"2. allowhighfees (boolean, optional, default=false) Allow high fees\n"
@ -1159,9 +1179,12 @@ UniValue decodepsbt(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"decodepsbt \"psbt\"\n"
"\nReturn a JSON object representing the serialized, base64-encoded partially signed Dash transaction.\n"
RPCHelpMan{"decodepsbt",
"\nReturn a JSON object representing the serialized, base64-encoded partially signed Dash transaction.\n",
{
{"psbt", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"psbt\" (string, required) The PSBT base64 string\n"
@ -1386,6 +1409,8 @@ UniValue combinepsbt(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
RPCHelpMan{"combinepsbt",
"\nCombine multiple partially signed Dash transactions into one transaction.\n"
"Implements the Combiner role.\n",
{
{"txs", RPCArg::Type::ARR,
{
@ -1394,8 +1419,6 @@ UniValue combinepsbt(const JSONRPCRequest& request)
false},
}}
.ToString() +
"\nCombine multiple partially signed Dash transactions into one transaction.\n"
"Implements the Combiner role.\n"
"\nArguments:\n"
"1. \"txs\" (string) A json array of base64 strings of partially signed transactions\n"
" [\n"
@ -1441,11 +1464,16 @@ UniValue finalizepsbt(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
"finalizepsbt \"psbt\" ( extract )\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"
"created which has the final_scriptSig fields filled for inputs that are complete.\n"
"Implements the Finalizer and Extractor roles.\n"
RPCHelpMan{"finalizepsbt",
"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"
"created which has the final_scriptSig field filled for inputs that are complete.\n"
"Implements the Finalizer and Extractor roles.\n",
{
{"psbt", RPCArg::Type::STR, false},
{"extract", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\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"
@ -1500,6 +1528,8 @@ UniValue createpsbt(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 || request.params.size() > 4)
throw std::runtime_error(
RPCHelpMan{"createpsbt",
"\nCreates a transaction in the Partially Signed Transaction format.\n"
"Implements the Creator role.\n",
{
{"inputs", RPCArg::Type::ARR,
{
@ -1529,8 +1559,6 @@ UniValue createpsbt(const JSONRPCRequest& request)
{"locktime", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nCreates a transaction in the Partially Signed Transaction format.\n"
"Implements the Creator role.\n"
"\nArguments:\n"
"1. \"inputs\" (array, required) A json array of json objects\n"
" [\n"
@ -1590,9 +1618,14 @@ UniValue converttopsbt(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error(
"converttopsbt \"hexstring\" ( permitsigdata )\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"
RPCHelpMan{"converttopsbt",
"\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",
{
{"hexstring", RPCArg::Type::STR_HEX, false},
{"permitsigdata", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\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"

View File

@ -7,6 +7,7 @@
#include <core_io.h>
#include <index/txindex.h>
#include <messagesigner.h>
#include <rpc/util.h>
#include <rpc/server.h>
#include <txmempool.h>
#include <util/moneystr.h>
@ -302,13 +303,25 @@ static std::string SignAndSendSpecialTx(const CMutableTransaction& tx, bool fSub
static void protx_register_fund_help(CWallet* const pwallet)
{
throw std::runtime_error(
"protx register_fund \"collateralAddress\" \"ipAndPort\" \"ownerAddress\" \"operatorPubKey\" \"votingAddress\" operatorReward \"payoutAddress\" ( \"fundAddress\" submit )\n"
"\nCreates, funds and sends a ProTx to the network. The resulting transaction will move 1000 Dash\n"
"to the address specified by collateralAddress and will then function as the collateral of your\n"
"masternode.\n"
"A few of the limitations you see in the arguments are temporary and might be lifted after DIP3\n"
"is fully deployed.\n"
+ HelpRequiringPassphrase(pwallet) + "\n"
RPCHelpMan{"protx register_fund",
"\nCreates, funds and sends a ProTx to the network. The resulting transaction will move 1000 Dash\n"
"to the address specified by collateralAddress and will then function as the collateral of your\n"
"masternode.\n"
"A few of the limitations you see in the arguments are temporary and might be lifted after DIP3\n"
"is fully deployed.\n"
+ HelpRequiringPassphrase(pwallet) + "\n",
{
{"collateralAddress", RPCArg::Type::STR, false},
{"ipAndPort", RPCArg::Type::STR, false},
{"ownerAddress", RPCArg::Type::STR, false},
{"operatorPubKey_register", RPCArg::Type::STR, false},
{"votingAddress_register", RPCArg::Type::STR, false},
{"operatorReward", RPCArg::Type::NUM, false},
{"payoutAddress_register", RPCArg::Type::STR, false},
{"fundAddress", RPCArg::Type::STR, true},
{"submit", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n"
+ GetHelpString(1, "collateralAddress")
+ GetHelpString(2, "ipAndPort")
@ -331,75 +344,105 @@ static void protx_register_fund_help(CWallet* const pwallet)
static void protx_register_help(CWallet* const pwallet)
{
throw std::runtime_error(
"protx register \"collateralHash\" collateralIndex \"ipAndPort\" \"ownerAddress\" \"operatorPubKey\" \"votingAddress\" operatorReward \"payoutAddress\" ( \"feeSourceAddress\" submit )\n"
RPCHelpMan{"protx register",
"\nSame as \"protx register_fund\", but with an externally referenced collateral.\n"
"The collateral is specified through \"collateralHash\" and \"collateralIndex\" and must be an unspent\n"
"transaction output spendable by this wallet. It must also not be used by any other masternode.\n"
+ HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\n"
+ GetHelpString(1, "collateralHash")
+ GetHelpString(2, "collateralIndex")
+ GetHelpString(3, "ipAndPort")
+ GetHelpString(4, "ownerAddress")
+ GetHelpString(5, "operatorPubKey_register")
+ GetHelpString(6, "votingAddress_register")
+ GetHelpString(7, "operatorReward")
+ GetHelpString(8, "payoutAddress_register")
+ GetHelpString(9, "feeSourceAddress")
+ GetHelpString(10, "submit") +
"\nResult (if \"submit\" is not set or set to true):\n"
"\"txid\" (string) The transaction id.\n"
"\nResult (if \"submit\" is set to false):\n"
"\"hex\" (string) The serialized signed ProTx in hex format.\n"
"\nExamples:\n"
+ HelpExampleCli("protx", "register \"0123456701234567012345670123456701234567012345670123456701234567\" 0 \"1.2.3.4:1234\" \"Xt9AMWaYSz7tR7Uo7gzXA3m4QmeWgrR3rr\" \"93746e8731c57f87f79b3620a7982924e2931717d49540a85864bd543de11c43fb868fd63e501a1db37e19ed59ae6db4\" \"Xt9AMWaYSz7tR7Uo7gzXA3m4QmeWgrR3rr\" 0 \"XrVhS9LogauRJGJu2sHuryjhpuex4RNPSb\"")
+ HelpRequiringPassphrase(pwallet) + "\n",
{
{"collateralHash", RPCArg::Type::STR, false},
{"collateralAddress", RPCArg::Type::STR, false},
{"ipAndPort", RPCArg::Type::STR, false},
{"ownerAddress", RPCArg::Type::STR, false},
{"operatorPubKey_register", RPCArg::Type::STR, false},
{"votingAddress_register", RPCArg::Type::STR, false},
{"operatorReward", RPCArg::Type::NUM, false},
{"payoutAddress_register", RPCArg::Type::STR, false},
{"feeSourceAddress", RPCArg::Type::STR, true},
{"submit", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n"
+ GetHelpString(1, "collateralHash")
+ GetHelpString(2, "collateralIndex")
+ GetHelpString(3, "ipAndPort")
+ GetHelpString(4, "ownerAddress")
+ GetHelpString(5, "operatorPubKey_register")
+ GetHelpString(6, "votingAddress_register")
+ GetHelpString(7, "operatorReward")
+ GetHelpString(8, "payoutAddress_register")
+ GetHelpString(9, "feeSourceAddress")
+ GetHelpString(10, "submit") +
"\nResult (if \"submit\" is not set or set to true):\n"
"\"txid\" (string) The transaction id.\n"
"\nResult (if \"submit\" is set to false):\n"
"\"hex\" (string) The serialized signed ProTx in hex format.\n"
"\nExamples:\n"
+ HelpExampleCli("protx", "register \"0123456701234567012345670123456701234567012345670123456701234567\" 0 \"1.2.3.4:1234\" \"Xt9AMWaYSz7tR7Uo7gzXA3m4QmeWgrR3rr\" \"93746e8731c57f87f79b3620a7982924e2931717d49540a85864bd543de11c43fb868fd63e501a1db37e19ed59ae6db4\" \"Xt9AMWaYSz7tR7Uo7gzXA3m4QmeWgrR3rr\" 0 \"XrVhS9LogauRJGJu2sHuryjhpuex4RNPSb\"")
);
}
static void protx_register_prepare_help()
{
throw std::runtime_error(
"protx register_prepare \"collateralHash\" collateralIndex \"ipAndPort\" \"ownerAddress\" \"operatorPubKey\" \"votingAddress\" operatorReward \"payoutAddress\" ( \"feeSourceAddress\" )\n"
RPCHelpMan{"protx register_prepare",
"\nCreates an unsigned ProTx and a message that must be signed externally\n"
"with the private key that corresponds to collateralAddress to prove collateral ownership.\n"
"The prepared transaction will also contain inputs and outputs to cover fees.\n"
"\nArguments:\n"
+ GetHelpString(1, "collateralHash")
+ GetHelpString(2, "collateralIndex")
+ GetHelpString(3, "ipAndPort")
+ GetHelpString(4, "ownerAddress")
+ GetHelpString(5, "operatorPubKey_register")
+ GetHelpString(6, "votingAddress_register")
+ GetHelpString(7, "operatorReward")
+ GetHelpString(8, "payoutAddress_register")
+ GetHelpString(9, "feeSourceAddress") +
"\nResult:\n"
"{ (json object)\n"
" \"tx\" : (string) The serialized unsigned ProTx in hex format.\n"
" \"collateralAddress\" : (string) The collateral address.\n"
" \"signMessage\" : (string) The string message that needs to be signed with\n"
" the collateral key.\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("protx", "register_prepare \"0123456701234567012345670123456701234567012345670123456701234567\" 0 \"1.2.3.4:1234\" \"Xt9AMWaYSz7tR7Uo7gzXA3m4QmeWgrR3rr\" \"93746e8731c57f87f79b3620a7982924e2931717d49540a85864bd543de11c43fb868fd63e501a1db37e19ed59ae6db4\" \"Xt9AMWaYSz7tR7Uo7gzXA3m4QmeWgrR3rr\" 0 \"XrVhS9LogauRJGJu2sHuryjhpuex4RNPSb\"")
"The prepared transaction will also contain inputs and outputs to cover fees.\n",
{
{"collateralHash", RPCArg::Type::STR, false},
{"collateralAddress", RPCArg::Type::STR, false},
{"ipAndPort", RPCArg::Type::STR, false},
{"ownerAddress", RPCArg::Type::STR, false},
{"operatorPubKey_register", RPCArg::Type::STR, false},
{"votingAddress_register", RPCArg::Type::STR, false},
{"operatorReward", RPCArg::Type::NUM, false},
{"payoutAddress_register", RPCArg::Type::STR, false},
{"feeSourceAddress", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
+ GetHelpString(1, "collateralHash")
+ GetHelpString(2, "collateralIndex")
+ GetHelpString(3, "ipAndPort")
+ GetHelpString(4, "ownerAddress")
+ GetHelpString(5, "operatorPubKey_register")
+ GetHelpString(6, "votingAddress_register")
+ GetHelpString(7, "operatorReward")
+ GetHelpString(8, "payoutAddress_register")
+ GetHelpString(9, "feeSourceAddress") +
"\nResult:\n"
"{ (json object)\n"
" \"tx\" : (string) The serialized unsigned ProTx in hex format.\n"
" \"collateralAddress\" : (string) The collateral address.\n"
" \"signMessage\" : (string) The string message that needs to be signed with\n"
" the collateral key.\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("protx", "register_prepare \"0123456701234567012345670123456701234567012345670123456701234567\" 0 \"1.2.3.4:1234\" \"Xt9AMWaYSz7tR7Uo7gzXA3m4QmeWgrR3rr\" \"93746e8731c57f87f79b3620a7982924e2931717d49540a85864bd543de11c43fb868fd63e501a1db37e19ed59ae6db4\" \"Xt9AMWaYSz7tR7Uo7gzXA3m4QmeWgrR3rr\" 0 \"XrVhS9LogauRJGJu2sHuryjhpuex4RNPSb\"")
);
}
static void protx_register_submit_help(CWallet* const pwallet)
{
throw std::runtime_error(
"protx register_submit \"tx\" \"sig\"\n"
RPCHelpMan{"protx register_submit",
"\nCombines the unsigned ProTx and a signature of the signMessage, signs all inputs\n"
"which were added to cover fees and submits the resulting transaction to the network.\n"
"Note: See \"help protx register_prepare\" for more info about creating a ProTx and a message to sign.\n"
+ HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\n"
"1. \"tx\" (string, required) The serialized unsigned ProTx in hex format.\n"
"2. \"sig\" (string, required) The signature signed with the collateral key. Must be in base64 format.\n"
"\nResult:\n"
"\"txid\" (string) The transaction id.\n"
"\nExamples:\n"
+ HelpExampleCli("protx", "register_submit \"tx\" \"sig\"")
+ HelpRequiringPassphrase(pwallet) + "\n",
{
{"tx", RPCArg::Type::STR, false},
{"sig", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"tx\" (string, required) The serialized unsigned ProTx in hex format.\n"
"2. \"sig\" (string, required) The signature signed with the collateral key. Must be in base64 format.\n"
"\nResult:\n"
"\"txid\" (string) The transaction id.\n"
"\nExamples:\n"
+ HelpExampleCli("protx", "register_submit \"tx\" \"sig\"")
);
}
@ -603,21 +646,29 @@ static UniValue protx_register_submit(const JSONRPCRequest& request)
static void protx_update_service_help(CWallet* const pwallet)
{
throw std::runtime_error(
"protx update_service \"proTxHash\" \"ipAndPort\" \"operatorKey\" (\"operatorPayoutAddress\" \"feeSourceAddress\" )\n"
RPCHelpMan{"protx update_service",
"\nCreates and sends a ProUpServTx to the network. This will update the IP address\n"
"of a masternode.\n"
"If this is done for a masternode that got PoSe-banned, the ProUpServTx will also revive this masternode.\n"
+ HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\n"
+ GetHelpString(1, "proTxHash")
+ GetHelpString(2, "ipAndPort")
+ GetHelpString(3, "operatorKey")
+ GetHelpString(4, "operatorPayoutAddress")
+ GetHelpString(5, "feeSourceAddress") +
"\nResult:\n"
"\"txid\" (string) The transaction id.\n"
"\nExamples:\n"
+ HelpExampleCli("protx", "update_service \"0123456701234567012345670123456701234567012345670123456701234567\" \"1.2.3.4:1234\" 5a2e15982e62f1e0b7cf9783c64cf7e3af3f90a52d6c40f6f95d624c0b1621cd")
+ HelpRequiringPassphrase(pwallet) + "\n",
{
{"proTxHash", RPCArg::Type::STR, false},
{"ipAndPort", RPCArg::Type::STR, false},
{"operatorKey", RPCArg::Type::STR, false},
{"operatorPayoutAddress", RPCArg::Type::STR, true},
{"feeSourceAddress", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
+ GetHelpString(1, "proTxHash")
+ GetHelpString(2, "ipAndPort")
+ GetHelpString(3, "operatorKey")
+ GetHelpString(4, "operatorPayoutAddress")
+ GetHelpString(5, "feeSourceAddress") +
"\nResult:\n"
"\"txid\" (string) The transaction id.\n"
"\nExamples:\n"
+ HelpExampleCli("protx", "update_service \"0123456701234567012345670123456701234567012345670123456701234567\" \"1.2.3.4:1234\" 5a2e15982e62f1e0b7cf9783c64cf7e3af3f90a52d6c40f6f95d624c0b1621cd")
);
}
@ -699,21 +750,29 @@ static UniValue protx_update_service(const JSONRPCRequest& request)
static void protx_update_registrar_help(CWallet* const pwallet)
{
throw std::runtime_error(
"protx update_registrar \"proTxHash\" \"operatorPubKey\" \"votingAddress\" \"payoutAddress\" ( \"feeSourceAddress\" )\n"
RPCHelpMan{"protx update_registrar",
"\nCreates and sends a ProUpRegTx to the network. This will update the operator key, voting key and payout\n"
"address of the masternode specified by \"proTxHash\".\n"
"The owner key of the masternode must be known to your wallet.\n"
+ HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\n"
+ GetHelpString(1, "proTxHash")
+ GetHelpString(2, "operatorPubKey_update")
+ GetHelpString(3, "votingAddress_update")
+ GetHelpString(4, "payoutAddress_update")
+ GetHelpString(5, "feeSourceAddress") +
"\nResult:\n"
"\"txid\" (string) The transaction id.\n"
"\nExamples:\n"
+ HelpExampleCli("protx", "update_registrar \"0123456701234567012345670123456701234567012345670123456701234567\" \"982eb34b7c7f614f29e5c665bc3605f1beeef85e3395ca12d3be49d2868ecfea5566f11cedfad30c51b2403f2ad95b67\" \"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\"")
+ HelpRequiringPassphrase(pwallet) + "\n",
{
{"proTxHash", RPCArg::Type::STR, false},
{"operatorPubKey_update", RPCArg::Type::STR, false},
{"votingAddress_update", RPCArg::Type::STR, false},
{"payoutAddress_update", RPCArg::Type::STR, true},
{"feeSourceAddress", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
+ GetHelpString(1, "proTxHash")
+ GetHelpString(2, "operatorPubKey_update")
+ GetHelpString(3, "votingAddress_update")
+ GetHelpString(4, "payoutAddress_update")
+ GetHelpString(5, "feeSourceAddress") +
"\nResult:\n"
"\"txid\" (string) The transaction id.\n"
"\nExamples:\n"
+ HelpExampleCli("protx", "update_registrar \"0123456701234567012345670123456701234567012345670123456701234567\" \"982eb34b7c7f614f29e5c665bc3605f1beeef85e3395ca12d3be49d2868ecfea5566f11cedfad30c51b2403f2ad95b67\" \"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\"")
);
}
@ -788,6 +847,19 @@ static UniValue protx_update_registrar(const JSONRPCRequest& request)
static void protx_revoke_help(CWallet* const pwallet)
{
throw std::runtime_error(
RPCHelpMan{"protx revoke",
"\nCreates and sends a ProUpRevTx to the network. This will revoke the operator key of the masternode and\n"
"put it into the PoSe-banned state. It will also set the service field of the masternode\n"
"to zero. Use this in case your operator key got compromised or you want to stop providing your service\n"
"to the masternode owner.\n"
+ HelpRequiringPassphrase(pwallet) + "\n",
{
{"proTxHash", RPCArg::Type::STR, false},
{"operatorKey", RPCArg::Type::STR, false},
{"reason", RPCArg::Type::NUM, true},
{"feeSourceAddress", RPCArg::Type::STR, true},
}}
.ToString() +
"protx revoke \"proTxHash\" \"operatorKey\" ( reason \"feeSourceAddress\")\n"
"\nCreates and sends a ProUpRevTx to the network. This will revoke the operator key of the masternode and\n"
"put it into the PoSe-banned state. It will also set the service field of the masternode\n"
@ -875,18 +947,24 @@ static UniValue protx_revoke(const JSONRPCRequest& request)
static void protx_list_help()
{
throw std::runtime_error(
"protx list (\"type\" \"detailed\" \"height\")\n"
"\nLists all ProTxs in your wallet or on-chain, depending on the given type.\n"
"If \"type\" is not specified, it defaults to \"registered\".\n"
"If \"detailed\" is not specified, it defaults to \"false\" and only the hashes of the ProTx will be returned.\n"
"If \"height\" is not specified, it defaults to the current chain-tip.\n"
"\nAvailable types:\n"
" registered - List all ProTx which are registered at the given chain height.\n"
" This will also include ProTx which failed PoSe verification.\n"
" valid - List only ProTx which are active/valid at the given chain height.\n"
RPCHelpMan{"protx list",
"\nLists all ProTxs in your wallet or on-chain, depending on the given type.\n",
{
{"type", RPCArg::Type::STR, false},
{"detailed", RPCArg::Type::BOOL, true},
{"height", RPCArg::Type::NUM, true},
}}
.ToString() +
"If \"type\" is not specified, it defaults to \"registered\".\n"
"If \"detailed\" is not specified, it defaults to \"false\" and only the hashes of the ProTx will be returned.\n"
"If \"height\" is not specified, it defaults to the current chain-tip.\n"
"\nAvailable types:\n"
" registered - List all ProTx which are registered at the given chain height.\n"
" This will also include ProTx which failed PoSe verification.\n"
" valid - List only ProTx which are active/valid at the given chain height.\n"
#ifdef ENABLE_WALLET
" wallet - List only ProTx which are found in your wallet at the given chain height.\n"
" This will also include ProTx which failed PoSe verification.\n"
" wallet - List only ProTx which are found in your wallet at the given chain height.\n"
" This will also include ProTx which failed PoSe verification.\n"
#endif
);
}
@ -1045,15 +1123,19 @@ static UniValue protx_list(const JSONRPCRequest& request)
static void protx_info_help()
{
throw std::runtime_error(
"protx info \"proTxHash\"\n"
"\nReturns detailed information about a deterministic masternode.\n"
"\nArguments:\n"
+ GetHelpString(1, "proTxHash") +
"\nResult:\n"
"{ (json object) Details about a specific deterministic masternode\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("protx", "info \"0123456701234567012345670123456701234567012345670123456701234567\"")
RPCHelpMan{"protx info",
"\nReturns detailed information about a deterministic masternode.\n",
{
{"proTxHash", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
+ GetHelpString(1, "proTxHash") +
"\nResult:\n"
"{ (json object) Details about a specific deterministic masternode\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("protx", "info \"0123456701234567012345670123456701234567012345670123456701234567\"")
);
}
@ -1086,11 +1168,16 @@ static UniValue protx_info(const JSONRPCRequest& request)
static void protx_diff_help()
{
throw std::runtime_error(
"protx diff \"baseBlock\" \"block\"\n"
"\nCalculates a diff between two deterministic masternode lists. The result also contains proof data.\n"
"\nArguments:\n"
"1. \"baseBlock\" (numeric, required) The starting block height.\n"
"2. \"block\" (numeric, required) The ending block height.\n"
RPCHelpMan{"protx diff",
"\nCalculates a diff between two deterministic masternode lists. The result also contains proof data.\n",
{
{"baseBlock", RPCArg::Type::NUM, false},
{"block", RPCArg::Type::NUM, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"baseBlock\" (numeric, required) The starting block height.\n"
"2. \"block\" (numeric, required) The ending block height.\n"
);
}
@ -1132,26 +1219,27 @@ static UniValue protx_diff(const JSONRPCRequest& request)
[[ noreturn ]] static void protx_help()
{
throw std::runtime_error(
"protx \"command\" ...\n"
RPCHelpMan{"protx",
"Set of commands to execute ProTx related actions.\n"
"To get help on individual commands, use \"help protx command\".\n"
"\nArguments:\n"
"1. \"command\" (string, required) The command to execute\n"
"\nAvailable commands:\n"
"To get help on individual commands, use \"help protx command\".\n",
{}} .ToString() +
"\nArguments:\n"
"1. \"command\" (string, required) The command to execute\n"
"\nAvailable commands:\n"
#ifdef ENABLE_WALLET
" register - Create and send ProTx to network\n"
" register_fund - Fund, create and send ProTx to network\n"
" register_prepare - Create an unsigned ProTx\n"
" register_submit - Sign and submit a ProTx\n"
" register - Create and send ProTx to network\n"
" register_fund - Fund, create and send ProTx to network\n"
" register_prepare - Create an unsigned ProTx\n"
" register_submit - Sign and submit a ProTx\n"
#endif
" list - List ProTxs\n"
" info - Return information about a ProTx\n"
" list - List ProTxs\n"
" info - Return information about a ProTx\n"
#ifdef ENABLE_WALLET
" update_service - Create and send ProUpServTx to network\n"
" update_registrar - Create and send ProUpRegTx to network\n"
" revoke - Create and send ProUpRevTx to network\n"
" update_service - Create and send ProUpServTx to network\n"
" update_registrar - Create and send ProUpRegTx to network\n"
" revoke - Create and send ProUpRevTx to network\n"
#endif
" diff - Calculate a diff and a proof between two masternode lists\n"
" diff - Calculate a diff and a proof between two masternode lists\n"
);
}
@ -1193,15 +1281,16 @@ static UniValue protx(const JSONRPCRequest& request)
static void bls_generate_help()
{
throw std::runtime_error(
"bls generate\n"
"\nReturns a BLS secret/public key pair.\n"
"\nResult:\n"
"{\n"
" \"secret\": \"xxxx\", (string) BLS secret key\n"
" \"public\": \"xxxx\", (string) BLS public key\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("bls generate", "")
RPCHelpMan{"bls generate",
"\nReturns a BLS secret/public key pair.\n",
{}}.ToString() +
"\nResult:\n"
"{\n"
" \"secret\": \"xxxx\", (string) BLS secret key\n"
" \"public\": \"xxxx\", (string) BLS public key\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("bls generate", "")
);
}
@ -1223,17 +1312,21 @@ static UniValue bls_generate(const JSONRPCRequest& request)
static void bls_fromsecret_help()
{
throw std::runtime_error(
"bls fromsecret \"secret\"\n"
"\nParses a BLS secret key and returns the secret/public key pair.\n"
"\nArguments:\n"
"1. \"secret\" (string, required) The BLS secret key\n"
"\nResult:\n"
"{\n"
" \"secret\": \"xxxx\", (string) BLS secret key\n"
" \"public\": \"xxxx\", (string) BLS public key\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("bls fromsecret", "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f")
RPCHelpMan{"bls fromsecret",
"\nParses a BLS secret key and returns the secret/public key pair.\n",
{
{"secret", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"secret\" (string, required) The BLS secret key\n"
"\nResult:\n"
"{\n"
" \"secret\": \"xxxx\", (string) BLS secret key\n"
" \"public\": \"xxxx\", (string) BLS public key\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("bls fromsecret", "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f")
);
}
@ -1257,15 +1350,19 @@ static UniValue bls_fromsecret(const JSONRPCRequest& request)
[[ noreturn ]] static void bls_help()
{
throw std::runtime_error(
"bls \"command\" ...\n"
RPCHelpMan{"bls",
"Set of commands to execute BLS related actions.\n"
"To get help on individual commands, use \"help bls command\".\n"
"\nArguments:\n"
"1. \"command\" (string, required) The command to execute\n"
"\nAvailable commands:\n"
" generate - Create a BLS secret/public key pair\n"
" fromsecret - Parse a BLS secret key and return the secret/public key pair\n"
);
"To get help on individual commands, use \"help bls command\".\n",
{
{"command", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"command\" (string, required) The command to execute\n"
"\nAvailable commands:\n"
" generate - Create a BLS secret/public key pair\n"
" fromsecret - Parse a BLS secret key and return the secret/public key pair\n"
);
}
static UniValue _bls(const JSONRPCRequest& request)

View File

@ -5,6 +5,7 @@
#include <chainparams.h>
#include <index/txindex.h>
#include <rpc/server.h>
#include <rpc/util.h>
#include <validation.h>
#include <masternode/node.h>
@ -25,22 +26,26 @@ extern const std::string CLSIG_REQUESTID_PREFIX;
static void quorum_list_help()
{
throw std::runtime_error(
"quorum list ( count )\n"
"List of on-chain quorums\n"
"\nArguments:\n"
"1. count (number, optional) Number of quorums to list. Will list active quorums\n"
" if \"count\" is not specified.\n"
"\nResult:\n"
"{\n"
" \"quorumName\" : [ (array of strings) List of quorum hashes per some quorum type.\n"
" \"quorumHash\" (string) Quorum hash. Note: most recent quorums come first.\n"
" ,...\n"
" ],\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("quorum", "list")
+ HelpExampleCli("quorum", "list 10")
+ HelpExampleRpc("quorum", "list, 10")
RPCHelpMan{"quorum list",
"List of on-chain quorums\n",
{
{"count", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"1. count (number, optional) Number of quorums to list. Will list active quorums\n"
" if \"count\" is not specified.\n"
"\nResult:\n"
"{\n"
" \"quorumName\" : [ (array of strings) List of quorum hashes per some quorum type.\n"
" \"quorumHash\" (string) Quorum hash. Note: most recent quorums come first.\n"
" ,...\n"
" ],\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("quorum", "list")
+ HelpExampleCli("quorum", "list 10")
+ HelpExampleRpc("quorum", "list, 10")
);
}
@ -80,12 +85,18 @@ static UniValue quorum_list(const JSONRPCRequest& request)
static void quorum_info_help()
{
throw std::runtime_error(
"quorum info llmqType \"quorumHash\" ( includeSkShare )\n"
"Return information about a quorum\n"
"\nArguments:\n"
"1. llmqType (int, required) LLMQ type.\n"
"2. \"quorumHash\" (string, required) Block hash of quorum.\n"
"3. includeSkShare (boolean, optional) Include secret key share in output.\n"
RPCHelpMan{"quorum info",
"Return information about a quorum\n",
{
{"llmqType", RPCArg::Type::NUM, false},
{"quorumHash", RPCArg::Type::STR, false},
{"includeSkShare", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n"
"1. llmqType (int, required) LLMQ type.\n"
"2. \"quorumHash\" (string, required) Block hash of quorum.\n"
"3. includeSkShare (boolean, optional) Include secret key share in output.\n"
);
}
@ -152,12 +163,16 @@ static UniValue quorum_info(const JSONRPCRequest& request)
static void quorum_dkgstatus_help()
{
throw std::runtime_error(
"quorum dkgstatus ( detail_level )\n"
RPCHelpMan{"quorum dkgstatus",
"Return the status of the current DKG process.\n"
"Works only when SPORK_17_QUORUM_DKG_ENABLED spork is ON.\n"
"\nArguments:\n"
"1. detail_level (number, optional, default=0) Detail level of output.\n"
" 0=Only show counts. 1=Show member indexes. 2=Show member's ProTxHashes.\n"
"Works only when SPORK_17_QUORUM_DKG_ENABLED spork is ON.\n",
{
{"detail_level", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"1. detail_level (number, optional, default=0) Detail level of output.\n"
" 0=Only show counts. 1=Show member indexes. 2=Show member's ProTxHashes.\n"
);
}
@ -235,12 +250,17 @@ static UniValue quorum_dkgstatus(const JSONRPCRequest& request)
static void quorum_memberof_help()
{
throw std::runtime_error(
"quorum memberof \"proTxHash\" (quorumCount)\n"
"Checks which quorums the given masternode is a member of.\n"
"\nArguments:\n"
"1. \"proTxHash\" (string, required) ProTxHash of the masternode.\n"
"2. scanQuorumsCount (number, optional) Number of quorums to scan for. If not specified,\n"
" the active quorum count for each specific quorum type is used."
RPCHelpMan{"quorum memberof",
"Checks which quorums the given masternode is a member of.\n",
{
{"proTxHash", RPCArg::Type::STR, false},
{"scanQuorumsCount", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"proTxHash\" (string, required) ProTxHash of the masternode.\n"
"2. scanQuorumsCount (number, optional) Number of quorums to scan for. If not specified,\n"
" the active quorum count for each specific quorum type is used."
);
}
@ -292,14 +312,22 @@ static UniValue quorum_memberof(const JSONRPCRequest& request)
static void quorum_sign_help()
{
throw std::runtime_error(
"quorum sign llmqType \"id\" \"msgHash\" ( \"quorumHash\" submit )\n"
"Threshold-sign a message\n"
"\nArguments:\n"
"1. llmqType (int, required) LLMQ type.\n"
"2. \"id\" (string, required) Request id.\n"
"3. \"msgHash\" (string, required) Message hash.\n"
"4. \"quorumHash\" (string, optional) The quorum identifier.\n"
"5. submit (bool, optional, default=true) Submits the signature share to the network if this is true."
RPCHelpMan{"quorum sign",
"Threshold-sign a message\n",
{
{"llmqType", RPCArg::Type::NUM, false},
{"id", RPCArg::Type::STR, false},
{"msgHash", RPCArg::Type::STR, false},
{"quorumHash", RPCArg::Type::STR, true},
{"submit", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n"
"1. llmqType (int, required) LLMQ type.\n"
"2. \"id\" (string, required) Request id.\n"
"3. \"msgHash\" (string, required) Message hash.\n"
"4. \"quorumHash\" (string, optional) The quorum identifier.\n"
"5. submit (bool, optional, default=true) Submits the signature share to the network if this is true."
" Returns an object containing the signature share if this is false.\n"
);
}
@ -307,53 +335,80 @@ static void quorum_sign_help()
static void quorum_verify_help()
{
throw std::runtime_error(
"quorum verify llmqType \"id\" \"msgHash\" \"signature\" ( \"quorumHash\" signHeight )\n"
"Test if a quorum signature is valid for a request id and a message hash\n"
"\nArguments:\n"
"1. llmqType (int, required) LLMQ type.\n"
"2. \"id\" (string, required) Request id.\n"
"3. \"msgHash\" (string, required) Message hash.\n"
"4. \"signature\" (string, required) Quorum signature to verify.\n"
"5. \"quorumHash\" (string, optional) The quorum identifier.\n"
" Set to \"\" if you want to specify signHeight instead.\n"
"6. signHeight (int, optional) The height at which the message was signed.\n"
" Only works when quorumHash is \"\".\n"
RPCHelpMan{"quorum verify",
"Test if a quorum signature is valid for a request id and a message hash\n",
{
{"llmqType", RPCArg::Type::NUM, false},
{"id", RPCArg::Type::STR, false},
{"msgHash", RPCArg::Type::STR, false},
{"signature", RPCArg::Type::STR, false},
{"quorumHash", RPCArg::Type::STR, true},
{"signHeight", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"1. llmqType (int, required) LLMQ type.\n"
"2. \"id\" (string, required) Request id.\n"
"3. \"msgHash\" (string, required) Message hash.\n"
"4. \"signature\" (string, required) Quorum signature to verify.\n"
"5. \"quorumHash\" (string, optional) The quorum identifier.\n"
" Set to \"\" if you want to specify signHeight instead.\n"
"6. signHeight (int, optional) The height at which the message was signed.\n"
" Only works when quorumHash is \"\".\n"
);
}
static void quorum_hasrecsig_help()
{
throw std::runtime_error(
"quorum hasrecsig llmqType \"id\" \"msgHash\"\n"
"Test if a valid recovered signature is present\n"
"\nArguments:\n"
"1. llmqType (int, required) LLMQ type.\n"
"2. \"id\" (string, required) Request id.\n"
"3. \"msgHash\" (string, required) Message hash.\n"
RPCHelpMan{"quorum hasrecsig",
"Test if a valid recovered signature is present\n",
{
{"llmqType", RPCArg::Type::NUM, false},
{"id", RPCArg::Type::STR, false},
{"msgHash", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. llmqType (int, required) LLMQ type.\n"
"2. \"id\" (string, required) Request id.\n"
"3. \"msgHash\" (string, required) Message hash.\n"
);
}
static void quorum_getrecsig_help()
{
throw std::runtime_error(
"quorum getrecsig llmqType \"id\" \"msgHash\"\n"
"Get a recovered signature\n"
"\nArguments:\n"
"1. llmqType (int, required) LLMQ type.\n"
"2. \"id\" (string, required) Request id.\n"
"3. \"msgHash\" (string, required) Message hash.\n"
RPCHelpMan{"quorum getrecsig",
"Get a recovered signature\n",
{
{"llmqType", RPCArg::Type::NUM, false},
{"id", RPCArg::Type::STR, false},
{"msgHash", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. llmqType (int, required) LLMQ type.\n"
"2. \"id\" (string, required) Request id.\n"
"3. \"msgHash\" (string, required) Message hash.\n"
);
}
static void quorum_isconflicting_help()
{
throw std::runtime_error(
"quorum isconflicting llmqType \"id\" \"msgHash\"\n"
"Test if a conflict exists\n"
"\nArguments:\n"
"1. llmqType (int, required) LLMQ type.\n"
"2. \"id\" (string, required) Request id.\n"
"3. \"msgHash\" (string, required) Message hash.\n"
RPCHelpMan{"quorum isconflicting",
"Test if a conflict exists\n",
{
{"llmqType", RPCArg::Type::NUM, false},
{"id", RPCArg::Type::STR, false},
{"msgHash", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. llmqType (int, required) LLMQ type.\n"
"2. \"id\" (string, required) Request id.\n"
"3. \"msgHash\" (string, required) Message hash.\n"
);
}
@ -479,11 +534,16 @@ static UniValue quorum_sigs_cmd(const JSONRPCRequest& request)
static void quorum_selectquorum_help()
{
throw std::runtime_error(
"quorum selectquorum llmqType \"id\"\n"
"Returns the quorum that would/should sign a request\n"
"\nArguments:\n"
"1. llmqType (int, required) LLMQ type.\n"
"2. \"id\" (string, required) Request id.\n"
RPCHelpMan{"quorum selectquorum",
"Returns the quorum that would/should sign a request\n",
{
{"llmqType", RPCArg::Type::NUM, false},
{"id", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. llmqType (int, required) LLMQ type.\n"
"2. \"id\" (string, required) Request id.\n"
);
}
@ -521,12 +581,17 @@ static UniValue quorum_selectquorum(const JSONRPCRequest& request)
static void quorum_dkgsimerror_help()
{
throw std::runtime_error(
"quorum dkgsimerror \"type\" rate\n"
RPCHelpMan{"quorum dkgsimerror",
"This enables simulation of errors and malicious behaviour in the DKG. Do NOT use this on mainnet\n"
"as you will get yourself very likely PoSe banned for this.\n"
"\nArguments:\n"
"1. \"type\" (string, required) Error type.\n"
"2. rate (number, required) Rate at which to simulate this error type.\n"
"as you will get yourself very likely PoSe banned for this.\n",
{
{"type", RPCArg::Type::STR, false},
{"rate", RPCArg::Type::NUM, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"type\" (string, required) Error type.\n"
"2. rate (number, required) Rate at which to simulate this error type.\n"
);
}
@ -551,8 +616,16 @@ static UniValue quorum_dkgsimerror(const JSONRPCRequest& request)
static void quorum_getdata_help()
{
throw std::runtime_error(
"quorum getdata nodeId llmqType \"quorumHash\" dataMask ( \"proTxHash\" )\n"
"Send a QGETDATA message to the specified peer.\n"
RPCHelpMan{"quorum getdata",
"Send a QGETDATA message to the specified peer.\n",
{
{"nodeId", RPCArg::Type::NUM, false},
{"llmqType", RPCArg::Type::NUM, false},
{"quorumHash", RPCArg::Type::STR, false},
{"dataMask", RPCArg::Type::NUM, false},
{"proTxHash", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
"1. nodeId (integer, required) The internal nodeId of the peer to request quorum data from.\n"
"2. llmqType (integer, required) The quorum type related to the quorum data being requested.\n"
@ -599,24 +672,28 @@ static UniValue quorum_getdata(const JSONRPCRequest& request)
[[ noreturn ]] static void quorum_help()
{
throw std::runtime_error(
"quorum \"command\" ...\n"
RPCHelpMan{"quorum",
"Set of commands for quorums/LLMQs.\n"
"To get help on individual commands, use \"help quorum command\".\n"
"\nArguments:\n"
"1. \"command\" (string, required) The command to execute\n"
"\nAvailable commands:\n"
" list - List of on-chain quorums\n"
" info - Return information about a quorum\n"
" dkgsimerror - Simulates DKG errors and malicious behavior\n"
" dkgstatus - Return the status of the current DKG process\n"
" memberof - Checks which quorums the given masternode is a member of\n"
" sign - Threshold-sign a message\n"
" verify - Test if a quorum signature is valid for a request id and a message hash\n"
" hasrecsig - Test if a valid recovered signature is present\n"
" getrecsig - Get a recovered signature\n"
" isconflicting - Test if a conflict exists\n"
" selectquorum - Return the quorum that would/should sign a request\n"
" getdata - Request quorum data from other masternodes in the quorum\n"
"To get help on individual commands, use \"help quorum command\".\n",
{
{"command", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"command\" (string, required) The command to execute\n"
"\nAvailable commands:\n"
" list - List of on-chain quorums\n"
" info - Return information about a quorum\n"
" dkgsimerror - Simulates DKG errors and malicious behavior\n"
" dkgstatus - Return the status of the current DKG process\n"
" memberof - Checks which quorums the given masternode is a member of\n"
" sign - Threshold-sign a message\n"
" verify - Test if a quorum signature is valid for a request id and a message hash\n"
" hasrecsig - Test if a valid recovered signature is present\n"
" getrecsig - Get a recovered signature\n"
" isconflicting - Test if a conflict exists\n"
" selectquorum - Return the quorum that would/should sign a request\n"
" getdata - Request quorum data from other masternodes in the quorum\n"
);
}
@ -655,12 +732,18 @@ static UniValue _quorum(const JSONRPCRequest& request)
static void verifychainlock_help()
{
throw std::runtime_error(
"verifychainlock \"blockHash\" \"signature\" ( blockHeight )\n"
"Test if a quorum signature is valid for a ChainLock.\n"
"\nArguments:\n"
"1. \"blockHash\" (string, required) The block hash of the ChainLock.\n"
"2. \"signature\" (string, required) The signature of the ChainLock.\n"
"3. blockHeight (integer, optional) The height of the ChainLock. There will be an internal lookup of \"blockHash\" if this is not provided.\n"
RPCHelpMan{"verifychainlock",
"Test if a quorum signature is valid for a ChainLock.\n",
{
{"blockHash", RPCArg::Type::STR, false},
{"signature", RPCArg::Type::STR, false},
{"blockHeight", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"blockHash\" (string, required) The block hash of the ChainLock.\n"
"2. \"signature\" (string, required) The signature of the ChainLock.\n"
"3. blockHeight (integer, optional) The height of the ChainLock. There will be an internal lookup of \"blockHash\" if this is not provided.\n"
);
}
@ -696,13 +779,20 @@ static UniValue verifychainlock(const JSONRPCRequest& request)
static void verifyislock_help()
{
throw std::runtime_error(
"verifyislock \"id\" \"txid\" \"signature\" ( maxHeight )\n"
"Test if a quorum signature is valid for an InstantSend Lock\n"
"\nArguments:\n"
"1. \"id\" (string, required) Request id.\n"
"2. \"txid\" (string, required) The transaction id.\n"
"3. \"signature\" (string, required) The InstantSend Lock signature to verify.\n"
"4. maxHeight (int, optional) The maximum height to search quorums from.\n"
RPCHelpMan{"verifyislock",
"Test if a quorum signature is valid for an InstantSend Lock\n",
{
{"id", RPCArg::Type::STR, false},
{"txid", RPCArg::Type::STR, false},
{"signature", RPCArg::Type::STR, false},
{"maxHeight", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"id\" (string, required) Request id.\n"
"2. \"txid\" (string, required) The transaction id.\n"
"3. \"signature\" (string, required) The InstantSend Lock signature to verify.\n"
"4. maxHeight (int, optional) The maximum height to search quorums from.\n"
);
}

View File

@ -276,8 +276,13 @@ UniValue help(const JSONRPCRequest& jsonRequest)
{
if (jsonRequest.fHelp || jsonRequest.params.size() > 2)
throw std::runtime_error(
"help ( \"command\" \"subcommand\" )\n"
"\nList all commands, or get help for a specified command.\n"
RPCHelpMan{"help",
"\nList all commands, or get help for a specified command.\n",
{
{"command", RPCArg::Type::STR, true},
{"subcommand", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"command\" (string, optional) The command to get help on\n"
"2. \"subcommand\" (string, optional) The subcommand to get help on. Please note that not all subcommands support this at the moment\n"
@ -303,8 +308,9 @@ UniValue stop(const JSONRPCRequest& jsonRequest)
// to the client (intended for testing)
if (jsonRequest.fHelp || jsonRequest.params.size() > 1)
throw std::runtime_error(
"stop\n"
"\nStop Dash Core server.");
RPCHelpMan{"stop",
"\nStop Dash Core server.", {}}
.ToString());
// Event loop will exit after current HTTP requests have been handled, so
// this reply will get back to the client.
StartShutdown();
@ -318,8 +324,9 @@ static UniValue uptime(const JSONRPCRequest& jsonRequest)
{
if (jsonRequest.fHelp || jsonRequest.params.size() > 0)
throw std::runtime_error(
"uptime\n"
"\nReturns the total uptime of the server.\n"
RPCHelpMan{"uptime",
"\nReturns the total uptime of the server.\n", {}}
.ToString() +
"\nResult:\n"
"ttt (numeric) The number of seconds that the server has been running\n"
"\nExamples:\n"

View File

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

View File

@ -47,15 +47,16 @@ struct RPCArg {
const Type m_type;
const std::vector<RPCArg> m_inner; //!< Only used for arrays or dicts
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)
: m_name{name}, m_type{type}, m_optional{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_oneline_description{oneline_description}
{
assert(type != Type::ARR && type != Type::OBJ);
}
RPCArg(const std::string& name, const Type& type, const std::vector<RPCArg>& inner, const bool optional)
: m_name{name}, m_type{type}, m_inner{inner}, m_optional{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_oneline_description{oneline_description}
{
assert(type == Type::ARR || type == Type::OBJ);
}
@ -69,8 +70,8 @@ private:
class RPCHelpMan
{
public:
RPCHelpMan(const std::string& name, const std::vector<RPCArg>& args)
: m_name{name}, m_args{args}
RPCHelpMan(const std::string& name, const std::string& description, const std::vector<RPCArg>& args)
: m_name{name}, m_description{description}, m_args{args}
{
}
@ -78,6 +79,7 @@ public:
private:
const std::string m_name;
const std::string m_description;
const std::vector<RPCArg> m_args;
};

View File

@ -88,8 +88,14 @@ UniValue importprivkey(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error(
"importprivkey \"privkey\" ( \"label\" ) ( rescan )\n"
"\nAdds a private key (as returned by dumpprivkey) to your wallet. Requires a new wallet backup.\n"
RPCHelpMan{"importprivkey",
"\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"
"\nArguments:\n"
"1. \"privkey\" (string, required) The private key (see dumpprivkey)\n"
@ -177,8 +183,9 @@ UniValue abortrescan(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 0)
throw std::runtime_error(
"abortrescan\n"
"\nStops current wallet rescan triggered by an RPC call, e.g. by an importprivkey call.\n"
RPCHelpMan{"abortrescan",
"\nStops current wallet rescan triggered by an RPC call, e.g. by an importprivkey call.\n", {}}
.ToString() +
"\nExamples:\n"
"\nImport a private key\n"
+ HelpExampleCli("importprivkey", "\"mykey\"") +
@ -239,8 +246,15 @@ UniValue importaddress(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4)
throw std::runtime_error(
"importaddress \"address\" ( \"label\" rescan p2sh )\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"
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",
{
{"address", RPCArg::Type::STR, false},
{"label", RPCArg::Type::STR, true},
{"rescan", RPCArg::Type::BOOL, true},
{"p2sh", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"address\" (string, required) The Dash address (or hex-encoded script)\n"
"2. \"label\" (string, optional, default=\"\") An optional label\n"
@ -318,8 +332,13 @@ UniValue importprunedfunds(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 2)
throw std::runtime_error(
"importprunedfunds \"rawtransaction\" \"txoutproof\"\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"
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",
{
{"rawtransaction", RPCArg::Type::STR_HEX, false},
{"txoutproof", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\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"
@ -381,8 +400,12 @@ UniValue removeprunedfunds(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"removeprunedfunds \"txid\"\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"
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",
{
{"txid", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"txid\" (string, required) The hex-encoded id of the transaction you are deleting\n"
"\nExamples:\n"
@ -420,8 +443,14 @@ UniValue importpubkey(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error(
"importpubkey \"pubkey\" ( \"label\" rescan )\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"
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",
{
{"pubkey", RPCArg::Type::STR, false},
{"label", RPCArg::Type::STR, true},
{"rescan", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"pubkey\" (string, required) The hex-encoded public key\n"
"2. \"label\" (string, optional, default=\"\") An optional label\n"
@ -488,8 +517,12 @@ UniValue importwallet(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"importwallet \"filename\"\n"
"\nImports keys from a wallet dump file (see dumpwallet). Requires a new wallet backup to include imported keys.\n"
RPCHelpMan{"importwallet",
"\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"
"1. \"filename\" (string, required) The wallet file\n"
"\nExamples:\n"
@ -642,8 +675,13 @@ UniValue importelectrumwallet(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
"importelectrumwallet \"filename\" index\n"
"\nImports keys from an Electrum wallet export file (.csv or .json)\n"
RPCHelpMan{"importselectrumwallet",
"\nImports keys from an Electrum wallet export file (.csv or .json)\n",
{
{"filename", RPCArg::Type::STR, false},
{"index", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"filename\" (string, required) The Electrum wallet export file, should be in csv or json format\n"
"2. index (numeric, optional, default=0) Rescan the wallet for transactions starting from this block index\n"
@ -787,9 +825,13 @@ UniValue dumpprivkey(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"dumpprivkey \"address\"\n"
"\nReveals the private key corresponding to 'address'.\n"
"Then the importprivkey can be used with this output\n"
RPCHelpMan{"dumpprivkey",
"\nReveals the private key corresponding to 'address'.\n"
"Then the importprivkey can be used with this output\n",
{
{"address", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"address\" (string, required) The dash address for the private key\n"
"\nResult:\n"
@ -829,8 +871,10 @@ UniValue dumphdinfo(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"dumphdinfo\n"
"Returns an object containing sensitive private info about this HD wallet.\n"
RPCHelpMan{"dumphdinfo",
"Returns an object containing sensitive private info about this HD wallet.\n",
{}}
.ToString() +
"\nResult:\n"
"{\n"
" \"hdseed\": \"seed\", (string) The HD seed (bip32, in hex)\n"
@ -875,11 +919,15 @@ UniValue dumpwallet(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"dumpwallet \"filename\"\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 too, their corresponding addresses will 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"
"only backing up the seed itself, and must be backed up too (e.g. ensure you back up the whole dumpfile).\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"
"Imported scripts are included in the dumpfile too, their corresponding addresses will 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"
"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"
"1. \"filename\" (string, required) The filename with path (either absolute or relative to dashd)\n"
"\nResult:\n"
@ -1257,11 +1305,35 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
return NullUniValue;
}
// clang-format off
if (mainRequest.fHelp || mainRequest.params.size() < 1 || mainRequest.params.size() > 2)
throw std::runtime_error(
"importmulti \"requests\" ( \"options\" )\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"
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",
{
{"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"
"1. requests (array, required) Data to be imported\n"
" [ (array of json objects)\n"
@ -1296,7 +1368,6 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
"\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");
// clang-format on
RPCTypeCheck(mainRequest.params, {UniValue::VARR, UniValue::VOBJ});

View File

@ -151,10 +151,14 @@ UniValue getnewaddress(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
"getnewaddress ( \"label\" )\n"
"\nReturns a new Dash address for receiving payments.\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"
RPCHelpMan{"getnewaddress",
"\nReturns a new Dash address for receiving payments.\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",
{
{"label", RPCArg::Type::STR, true},
}}
.ToString() +
"\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"
"\nResult:\n"
@ -202,9 +206,11 @@ static UniValue getrawchangeaddress(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 0)
throw std::runtime_error(
"getrawchangeaddress\n"
"\nReturns a new Dash address, for receiving change.\n"
"This is for use with raw transactions, NOT normal use.\n"
RPCHelpMan{"getrawchangeaddress",
"\nReturns a new Dash address, for receiving change.\n"
"This is for use with raw transactions, NOT normal use.\n",
{}}
.ToString() +
"\nResult:\n"
"\"address\" (string) The address\n"
"\nExamples:\n"
@ -246,8 +252,13 @@ static UniValue setlabel(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 2)
throw std::runtime_error(
"setlabel \"address\" \"label\"\n"
"\nSets the label associated with the given address.\n"
RPCHelpMan{"setlabel",
"\nSets the label associated with the given address.\n",
{
{"address", RPCArg::Type::STR, false},
{"label", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"address\" (string, required) The dash address to be associated with a label.\n"
"2. \"label\" (string, required) The label to assign to the address.\n"
@ -330,9 +341,21 @@ static UniValue sendtoaddress(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 || request.params.size() > 9)
throw std::runtime_error(
"sendtoaddress \"address\" amount ( \"comment\" \"comment_to\" subtractfeefromamount use_is use_cj conf_target \"estimate_mode\")\n"
"\nSend an amount to a given address.\n"
+ HelpRequiringPassphrase(pwallet) +
RPCHelpMan{"sendtoaddress",
"\nSend an amount to a given address.\n",
{
{"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},
{"use_is", RPCArg::Type::BOOL, true},
{"use_cj", RPCArg::Type::BOOL, true},
{"conf_target", RPCArg::Type::NUM, true},
{"estimate_mode", RPCArg::Type::STR, true},
}}
.ToString() +
HelpRequiringPassphrase(pwallet) +
"\nArguments:\n"
"1. \"address\" (string, required) The dash address to send to.\n"
"2. \"amount\" (numeric or string, required) The amount in " + CURRENCY_UNIT + " to send. eg 0.1\n"
@ -431,10 +454,12 @@ static UniValue listaddressgroupings(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"listaddressgroupings\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"
"in past transactions\n"
RPCHelpMan{"listaddressgroupings",
"\nLists groups of addresses which have had their common ownership\n"
"made public by common use as inputs or as the resulting change\n"
"in past transactions\n",
{}}
.ToString() +
"\nResult:\n"
"[\n"
" [\n"
@ -488,8 +513,12 @@ static UniValue listaddressbalances(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
"listaddressbalances ( minamount )\n"
"\nLists addresses of this wallet and their balances\n"
RPCHelpMan{"listaddressbalances",
"\nLists addresses of this wallet and their balances\n",
{
{"minamount", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\n"
"1. minamount (numeric, optional, default=0) Minimum balance in " + CURRENCY_UNIT + " an address should have to be shown in the list\n"
"\nResult:\n"
@ -533,9 +562,14 @@ static UniValue signmessage(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 2)
throw std::runtime_error(
"signmessage \"address\" \"message\"\n"
"\nSign a message with the private key of an address"
+ HelpRequiringPassphrase(pwallet) + "\n"
RPCHelpMan{"signmessage",
"\nSign a message with the private key of an address",
{
{"address", RPCArg::Type::STR, false},
{"message", RPCArg::Type::STR, false},
}}
.ToString() +
HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\n"
"1. \"address\" (string, required) The dash address to use for the private key.\n"
"2. \"message\" (string, required) The message to create a signature of.\n"
@ -596,8 +630,14 @@ static UniValue getreceivedbyaddress(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error(
"getreceivedbyaddress \"address\" ( minconf addlocked )\n"
"\nReturns the total amount received by the given address in transactions with at least minconf confirmations.\n"
RPCHelpMan{"getreceivedbyaddress",
"\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},
{"addlocked", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"address\" (string, required) The dash address for transactions.\n"
"2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
@ -665,8 +705,14 @@ static UniValue getreceivedbylabel(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error(
"getreceivedbylabel \"account\" ( minconf addlocked )\n"
"\nReturns the total amount received by addresses with <label> in transactions with specified minimum number of confirmations.\n"
RPCHelpMan{"getreceivedbylabel",
"\nReturns the total amount received by addresses with <label> in transactions with specified minimum number of confirmations.\n",
{
{"label", RPCArg::Type::STR, false},
{"minconf", RPCArg::Type::NUM, true},
{"addlocked", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\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"
@ -732,10 +778,17 @@ static UniValue getbalance(const JSONRPCRequest& request)
if (request.fHelp || (request.params.size() > 4))
throw std::runtime_error(
"getbalance ( \"dummy\" minconf addlocked include_watchonly )\n"
"\nReturns the total available balance.\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"
RPCHelpMan{"getbalance",
"\nReturns the total available balance.\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",
{
{"dummy", RPCArg::Type::STR, true},
{"minconf", RPCArg::Type::NUM, true},
{"addlocked", RPCArg::Type::BOOL, true},
{"include_watchonly", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\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"
@ -793,8 +846,9 @@ static UniValue getunconfirmedbalance(const JSONRPCRequest &request)
if (request.fHelp || request.params.size() > 0)
throw std::runtime_error(
"getunconfirmedbalance\n"
"Returns the server's total unconfirmed balance\n");
RPCHelpMan{"getunconfirmedbalance",
"Returns the server's total unconfirmed balance\n", {}}
.ToString());
// 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
@ -817,9 +871,30 @@ static UniValue sendmany(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 || request.params.size() > 10)
throw std::runtime_error(
"sendmany \"\" {\"address\":amount,...} ( minconf addlocked \"comment\" [\"address\",...] subtractfeefrom use_is use_cj conf_target \"estimate_mode\")\n"
"\nSend multiple times. Amounts are double-precision floating point numbers.\n"
+ HelpRequiringPassphrase(pwallet) + "\n"
RPCHelpMan{"sendmany",
"\nSend multiple times. Amounts are double-precision floating point numbers.\n",
{
{"dummy", RPCArg::Type::STR, false, "\"\""},
{"amounts", RPCArg::Type::OBJ,
{
{"address", RPCArg::Type::AMOUNT, false},
},
false},
{"minconf", RPCArg::Type::NUM, true},
{"addlocked", RPCArg::Type::BOOL, true},
{"comment", RPCArg::Type::STR, true},
{"subtractfeefrom", RPCArg::Type::ARR,
{
{"address", RPCArg::Type::STR, true},
},
true},
{"use_is", RPCArg::Type::BOOL, true},
{"use_cj", RPCArg::Type::BOOL, true},
{"conf_target", RPCArg::Type::NUM, true},
{"estimate_mode", RPCArg::Type::STR, true},
}}
.ToString() +
HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\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"
@ -975,13 +1050,24 @@ static UniValue addmultisigaddress(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3)
{
std::string msg = "addmultisigaddress nrequired [\"key\",...] ( \"label\" )\n"
"\nAdd a nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup.\n"
"Each key is a Dash address or hex-encoded public key.\n"
"This functionality is only intended for use with non-watchonly addresses.\n"
"See `importaddress` for watchonly p2sh address support.\n"
"If 'label' is specified, assign address to that label.\n"
std::string msg =
RPCHelpMan{"addmultisigaddress",
"\nAdd a nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup.\n"
"Each key is a Dash address or hex-encoded public key.\n"
"This functionality is only intended for use with non-watchonly addresses.\n"
"See `importaddress` for watchonly p2sh address support.\n"
"If 'label' is specified, assign address to that label.\n",
{
{"nrequired", RPCArg::Type::NUM, false},
{"inputs", RPCArg::Type::ARR,
{
{"address", RPCArg::Type::STR, false},
},
false},
{"label", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
"1. nrequired (numeric, required) The number of required signatures out of the n keys or addresses.\n"
"2. \"keys\" (string, required) A json array of dash addresses or hex-encoded public keys\n"
@ -1211,8 +1297,16 @@ static UniValue listreceivedbyaddress(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 5)
throw std::runtime_error(
"listreceivedbyaddress ( minconf addlocked include_empty include_watchonly address_filter )\n"
"\nList incoming payments grouped by receiving address.\n"
RPCHelpMan{"listreceivedbyaddress",
"\nList balances by receiving address.\n",
{
{"minconf", RPCArg::Type::NUM, true},
{"addlocked", RPCArg::Type::BOOL, true},
{"include_empty", RPCArg::Type::BOOL, true},
{"include_watchonly", RPCArg::Type::BOOL, true},
{"address_filter", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
"1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n"
"2. addlocked (bool, optional, default=false) Whether to include transactions locked via InstantSend.\n"
@ -1264,8 +1358,15 @@ static UniValue listreceivedbylabel(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 4)
throw std::runtime_error(
"listreceivedbylabel ( minconf addlocked include_empty include_watchonly)\n"
"\nList received transactions by label.\n"
RPCHelpMan{"listreceivedbylabel",
"\nList received transactions by label.\n",
{
{"minconf", RPCArg::Type::NUM, true},
{"addlocked", RPCArg::Type::BOOL, true},
{"include_empty", RPCArg::Type::BOOL, true},
{"include_watchonly", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\n"
"1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n"
"2. addlocked (bool, optional, default=false) Whether to include transactions locked via InstantSend.\n"
@ -1404,9 +1505,16 @@ static UniValue listtransactions(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 4)
throw std::runtime_error(
"listtransactions ( \"label\" count skip include_watchonly )\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"
RPCHelpMan{"listtransactions",
"\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",
{
{"label", RPCArg::Type::STR, true},
{"count", RPCArg::Type::NUM, true},
{"skip", RPCArg::Type::NUM, true},
{"include_watchonly", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\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"
@ -1527,10 +1635,17 @@ static UniValue listsinceblock(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 4)
throw std::runtime_error(
"listsinceblock ( \"blockhash\" target_confirmations include_watchonly include_removed )\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"
"Additionally, if include_removed is set, transactions affecting the wallet which were removed are returned in the \"removed\" array.\n"
RPCHelpMan{"listsinceblock",
"\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"
"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"
"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"
@ -1668,8 +1783,13 @@ static UniValue gettransaction(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
"gettransaction \"txid\" ( include_watchonly )\n"
"\nGet detailed information about in-wallet transaction <txid>\n"
RPCHelpMan{"gettransaction",
"\nGet detailed information about in-wallet transaction <txid>\n",
{
{"txid", RPCArg::Type::STR, false},
{"include_watchonly", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\nArguments:\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"
@ -1764,12 +1884,16 @@ static UniValue abandontransaction(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error(
"abandontransaction \"txid\"\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"
"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 has no effect on transactions which are already abandoned.\n"
RPCHelpMan{"abandontransaction",
"\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"
"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 has no effect on transactions which are already abandoned.\n",
{
{"txid", RPCArg::Type::STR_HEX, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"txid\" (string, required) The transaction id\n"
"\nResult:\n"
@ -1810,8 +1934,12 @@ static UniValue backupwallet(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"backupwallet \"destination\"\n"
"\nSafely copies current wallet file to destination, which can be a directory or a path with filename.\n"
RPCHelpMan{"backupwallet",
"\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"
"1. \"destination\" (string) The destination directory or file\n"
"\nExamples:\n"
@ -1845,9 +1973,13 @@ static UniValue keypoolrefill(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
"keypoolrefill ( newsize )\n"
"\nFills the keypool."
+ HelpRequiringPassphrase(pwallet) + "\n"
RPCHelpMan{"keypoolrefill",
"\nFills the keypool.",
{
{"newsize", RPCArg::Type::NUM, true},
}}
.ToString() +
HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\n"
"1. newsize (numeric, optional, default=" + itostr(DEFAULT_KEYPOOL_SIZE) + ") The new keypool size\n"
"\nExamples:\n"
@ -1891,9 +2023,15 @@ static UniValue walletpassphrase(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 || request.params.size() > 3) {
throw std::runtime_error(
"walletpassphrase \"passphrase\" timeout ( mixingonly )\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 dashs\n"
RPCHelpMan{"walletpassphrase",
"\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 dashs\n",
{
{"passphrase", RPCArg::Type::STR, false},
{"timeout", RPCArg::Type::NUM, false},
{"mixingonly", RPCArg::Type::BOOL, false},
}}
.ToString() +
"\nArguments:\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"
@ -1988,8 +2126,13 @@ static UniValue walletpassphrasechange(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 2) {
throw std::runtime_error(
"walletpassphrasechange \"oldpassphrase\" \"newpassphrase\"\n"
"\nChanges the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.\n"
RPCHelpMan{"walletpassphrasechange",
"\nChanges the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.\n",
{
{"oldpassphrase", RPCArg::Type::STR, false},
{"newpassphrase", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"oldpassphrase\" (string) The current passphrase\n"
"2. \"newpassphrase\" (string) The new passphrase\n"
@ -2038,10 +2181,12 @@ static UniValue walletlock(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 0) {
throw std::runtime_error(
"walletlock\n"
"\nRemoves the wallet encryption key from memory, locking the wallet.\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"
RPCHelpMan{"walletlock",
"\nRemoves the wallet encryption key from memory, locking the wallet.\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",
{}}
.ToString() +
"\nExamples:\n"
"\nSet the passphrase for 2 minutes to perform a transaction\n"
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\" 120") +
@ -2078,12 +2223,16 @@ static UniValue encryptwallet(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error(
"encryptwallet \"passphrase\"\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"
"will require the passphrase to be set prior the making these calls.\n"
"Use the walletpassphrase call for this, and then walletlock call.\n"
"If the wallet is already encrypted, use the walletpassphrasechange call.\n"
RPCHelpMan{"encryptwallet",
"\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"
"will require the passphrase to be set prior the making these calls.\n"
"Use the walletpassphrase call for this, and then walletlock call.\n"
"If the wallet is already encrypted, use the walletpassphrasechange call.\n",
{
{"passphrase", RPCArg::Type::STR, false},
}}
.ToString() +
"\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"
"\nExamples:\n"
@ -2135,6 +2284,13 @@ static UniValue lockunspent(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
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 dashs.\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},
{"transactions", RPCArg::Type::ARR,
@ -2149,13 +2305,6 @@ static UniValue lockunspent(const JSONRPCRequest& request)
true},
}}
.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 dashs.\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"
"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"
@ -2277,9 +2426,11 @@ static UniValue listlockunspent(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 0)
throw std::runtime_error(
"listlockunspent\n"
"\nReturns list of temporarily unspendable outputs.\n"
"See the lockunspent call to lock and unlock transactions for spending.\n"
RPCHelpMan{"listlockunspent",
"\nReturns list of temporarily unspendable outputs.\n"
"See the lockunspent call to lock and unlock transactions for spending.\n",
{}}
.ToString() +
"\nResult:\n"
"[\n"
" {\n"
@ -2330,8 +2481,12 @@ static UniValue settxfee(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 1) {
throw std::runtime_error(
"settxfee amount\n"
"\nSet the transaction fee per kB for this wallet. Overrides the global -paytxfee command line parameter.\n"
RPCHelpMan{"settxfee",
"\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"
"1. amount (numeric or string, required) The transaction fee in " + CURRENCY_UNIT + "/kB\n"
"\nResult:\n"
@ -2367,6 +2522,12 @@ static UniValue setcoinjoinrounds(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
RPCHelpMan{"setcoinjoinrounds",
"\nSet the number of rounds for CoinJoin.\n",
{
{"rounds", RPCArg::Type::NUM, false},
}}
.ToString() +
"setcoinjoinrounds rounds\n"
"\nSet the number of rounds for CoinJoin.\n"
"\nArguments:\n"
@ -2396,8 +2557,12 @@ static UniValue setcoinjoinamount(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"setcoinjoinamount amount\n"
"\nSet the goal amount in " + CURRENCY_UNIT + " for CoinJoin.\n"
RPCHelpMan{"setcoinjoinamount",
"\nSet the goal amount in " + CURRENCY_UNIT + " for CoinJoin.\n",
{
{"amount", RPCArg::Type::NUM, false},
}}
.ToString() +
"\nArguments:\n"
"1. amount (numeric, required) The default amount is " + std::to_string(DEFAULT_COINJOIN_AMOUNT) +
" Cannot be more than " + std::to_string(MAX_COINJOIN_AMOUNT) + " nor less than " + std::to_string(MIN_COINJOIN_AMOUNT) +
@ -2426,8 +2591,9 @@ static UniValue getwalletinfo(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getwalletinfo\n"
"Returns an object containing various wallet state info.\n"
RPCHelpMan{"getwalletinfo",
"Returns an object containing various wallet state info.\n", {}}
.ToString() +
"\nResult:\n"
"{\n"
" \"walletname\": xxxxx, (string) the wallet name\n"
@ -2528,8 +2694,9 @@ static UniValue listwalletdir(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0) {
throw std::runtime_error(
"listwalletdir\n"
"Returns a list of wallets in the wallet directory.\n"
RPCHelpMan{"listwalletdir",
"Returns a list of wallets in the wallet directory.\n", {}}
.ToString() +
"{\n"
" \"wallets\" : [ (json array of objects)\n"
" {\n"
@ -2560,9 +2727,11 @@ static UniValue listwallets(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"listwallets\n"
"Returns a list of currently loaded wallets.\n"
"For full information on the wallet, use \"getwalletinfo\"\n"
RPCHelpMan{"listwallets",
"Returns a list of currently loaded wallets.\n"
"For full information on the wallet, use \"getwalletinfo\"\n",
{}}
.ToString() +
"\nResult:\n"
"[ (json array of strings)\n"
" \"walletname\" (string) the wallet name\n"
@ -2599,21 +2768,27 @@ static UniValue upgradetohd(const JSONRPCRequest& request)
if (request.fHelp)
throw std::runtime_error(
"upgradetohd ( \"mnemonic\" \"mnemonicpassphrase\" \"walletpassphrase\" )\n"
RPCHelpMan{"upgradetohd",
"\nUpgrades non-HD wallets to HD.\n"
"\nWarning: You will need to make a new backup of your wallet after setting the HD wallet mnemonic.\n"
"\nArguments:\n"
"1. \"mnemonic\" (string, optional, default=\"\") Mnemonic as defined in BIP39 to use for the new HD wallet.\n"
" Use an empty string \"\" to generate a new random mnemonic.\n"
"2. \"mnemonicpassphrase\" (string, optional, default=\"\") Optional mnemonic passphrase as defined in BIP39\n"
"3. \"walletpassphrase\" (string, optional) If your wallet is encrypted you must have your wallet passphrase here.\n"
" If your wallet is not encrypted specifying wallet passphrase will trigger wallet encryption.\n"
"\nWarning: You will need to make a new backup of your wallet after setting the HD wallet mnemonic.\n",
{
{"mnemonic", RPCArg::Type::STR, true},
{"mnemonicpassphrase", RPCArg::Type::STR, true},
{"walletpassphrase", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"mnemonic\" (string, optional, default=\"\") Mnemonic as defined in BIP39 to use for the new HD wallet.\n"
" Use an empty string \"\" to generate a new random mnemonic.\n"
"2. \"mnemonicpassphrase\" (string, optional, default=\"\") Optional mnemonic passphrase as defined in BIP39\n"
"3. \"walletpassphrase\" (string, optional) If your wallet is encrypted you must have your wallet passphrase here.\n"
" If your wallet is not encrypted specifying wallet passphrase will trigger wallet encryption.\n"
"\nExamples:\n"
+ HelpExampleCli("upgradetohd", "")
+ HelpExampleCli("upgradetohd", "\"mnemonicword1 ... mnemonicwordN\"")
+ HelpExampleCli("upgradetohd", "\"mnemonicword1 ... mnemonicwordN\" \"mnemonicpassphrase\"")
+ HelpExampleCli("upgradetohd", "\"mnemonicword1 ... mnemonicwordN\" \"mnemonicpassphrase\" \"walletpassphrase\""));
"\nExamples:\n"
+ HelpExampleCli("upgradetohd", "")
+ HelpExampleCli("upgradetohd", "\"mnemonicword1 ... mnemonicwordN\"")
+ HelpExampleCli("upgradetohd", "\"mnemonicword1 ... mnemonicwordN\" \"mnemonicpassphrase\"")
+ HelpExampleCli("upgradetohd", "\"mnemonicword1 ... mnemonicwordN\" \"mnemonicpassphrase\" \"walletpassphrase\""));
LOCK2(cs_main, pwallet->cs_wallet);
@ -2752,10 +2927,14 @@ static UniValue loadwallet(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"loadwallet \"filename\"\n"
"\nLoads a wallet from a wallet file or directory."
"\nNote that all wallet command-line options used when starting dashd will be"
"\napplied to the new wallet (eg -zapwallettxes, upgradewallet, rescan, etc).\n"
RPCHelpMan{"loadwallet",
"\nLoads a wallet from a wallet file or directory."
"\nNote that all wallet command-line options used when starting dashd will be"
"\napplied to the new wallet (eg -zapwallettxes, upgradewallet, rescan, etc).\n",
{
{"filename", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"filename\" (string, required) The wallet directory or .dat file.\n"
"\nResult:\n"
@ -2804,8 +2983,13 @@ static UniValue createwallet(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error(
"createwallet \"wallet_name\" ( disable_private_keys )\n"
"\nCreates and loads a new wallet.\n"
RPCHelpMan{"createwallet",
"\nCreates and loads a new wallet.\n",
{
{"wallet_name", RPCArg::Type::STR, false},
{"disable_private_keys", RPCArg::Type::BOOL, true},
}}
.ToString() +
"\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"
"2. disable_private_keys (boolean, optional, default: false) Disable the possibility of private keys (only watchonlys are possible in this mode).\n"
@ -2856,9 +3040,13 @@ static UniValue unloadwallet(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 1) {
throw std::runtime_error(
"unloadwallet ( \"wallet_name\" )\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."
RPCHelpMan{"unloadwallet",
"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.",
{
{"wallet_name", RPCArg::Type::STR, true},
}}
.ToString() +
"\nArguments:\n"
"1. \"wallet_name\" (string, optional) The name of the wallet to unload.\n"
"\nExamples:\n"
@ -2904,9 +3092,11 @@ static UniValue resendwallettransactions(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"resendwallettransactions\n"
"Immediately re-broadcast unconfirmed wallet transactions to all peers.\n"
"Intended only for testing; the wallet code periodically re-broadcasts\n"
RPCHelpMan{"resendwallettransactions",
"Immediately re-broadcast unconfirmed wallet transactions to all peers.\n"
"Intended only for testing; the wallet code periodically re-broadcasts\n",
{}}
.ToString() +
"automatically.\n"
"Returns an RPC error if -walletbroadcast is set to false.\n"
"Returns array of transaction ids that were re-broadcast.\n"
@ -2943,12 +3133,15 @@ static UniValue listunspent(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 5)
throw std::runtime_error(
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},
{"maxconf", RPCArg::Type::NUM, true},
{"addresses", RPCArg::Type::ARR,
{
{"address", RPCArg::Type::STR_HEX, true},
{"address", RPCArg::Type::STR, true},
},
true},
{"include_unsafe", RPCArg::Type::BOOL, true},
@ -2959,12 +3152,9 @@ static UniValue listunspent(const JSONRPCRequest& request)
{"maximumCount", RPCArg::Type::NUM, true},
{"minimumSumAmount", RPCArg::Type::AMOUNT, true},
},
true},
true, "query_options"},
}}
.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"
"1. minconf (numeric, optional, default=1) The minimum confirmations to filter\n"
"2. maxconf (numeric, optional, default=9999999) The maximum confirmations to filter\n"
@ -3262,56 +3452,76 @@ static UniValue fundrawtransaction(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error(
"fundrawtransaction \"hexstring\" ( options )\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"
"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"
"The inputs added will not be signed, use signrawtransactionwithkey\n"
" or signrawtransactionwithwallet for that.\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"
"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"
"Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only\n"
"\nArguments:\n"
"1. \"hexstring\" (string, required) The hex string of the raw transaction\n"
"2. options (object, optional)\n"
" {\n"
" \"changeAddress\" (string, optional, default pool address) The dash address to receive the change\n"
" \"changePosition\" (numeric, optional, default random) The index of the change output\n"
" \"includeWatching\" (boolean, optional, default false) Also select inputs which are watch only\n"
" \"lockUnspents\" (boolean, optional, default false) Lock selected unspent outputs\n"
" \"feeRate\" (numeric, optional, default not set: makes wallet determine the fee) Set a specific fee rate in " + CURRENCY_UNIT + "/kB\n"
" \"subtractFeeFromOutputs\" (array, optional) A json array of integers.\n"
" The fee will be equally deducted from the amount of each specified output.\n"
" The outputs are specified by their zero-based index, before any change output is added.\n"
" Those recipients will receive less dash than you enter in their corresponding amount field.\n"
" If no outputs are specified here, the sender pays the fee.\n"
" [vout_index,...]\n"
" \"conf_target\" (numeric, optional) Confirmation target (in blocks)\n"
" \"estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n"
" \"UNSET\"\n"
" \"ECONOMICAL\"\n"
" \"CONSERVATIVE\"\n"
" }\n"
" for backward compatibility: passing in a true instead of an object will result in {\"includeWatching\":true}\n"
"\nResult:\n"
"{\n"
" \"hex\": \"value\", (string) The resulting raw transaction (hex-encoded string)\n"
" \"fee\": n, (numeric) Fee in " + CURRENCY_UNIT + " the resulting transaction pays\n"
" \"changepos\": n (numeric) The position of the added change output, or -1\n"
"}\n"
"\nExamples:\n"
"\nCreate a transaction with no inputs\n"
+ HelpExampleCli("createrawtransaction", "\"[]\" \"{\\\"myaddress\\\":0.01}\"") +
"\nAdd sufficient unsigned inputs to meet the output value\n"
+ HelpExampleCli("fundrawtransaction", "\"rawtransactionhex\"") +
"\nSign the transaction\n"
+ HelpExampleCli("signrawtransactionwithwallet", "\"fundedtransactionhex\"") +
"\nSend the transaction\n"
+ HelpExampleCli("sendrawtransaction", "\"signedtransactionhex\"")
);
RPCHelpMan{"fundrawtransaction",
"\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"
"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"
"The inputs added will not be signed, use signrawtransactionwithkey\n"
" or signrawtransactionwithwallet for that.\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"
"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"
"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},
{"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},
{"conf_target", RPCArg::Type::NUM, true},
{"estimate_mode", RPCArg::Type::STR, true},
},
true, "options"},
}}
.ToString() +
"\nArguments:\n"
"1. \"hexstring\" (string, required) The hex string of the raw transaction\n"
"2. options (object, optional)\n"
" {\n"
" \"changeAddress\" (string, optional, default pool address) The dash address to receive the change\n"
" \"changePosition\" (numeric, optional, default random) The index of the change output\n"
" \"includeWatching\" (boolean, optional, default false) Also select inputs which are watch only\n"
" \"lockUnspents\" (boolean, optional, default false) Lock selected unspent outputs\n"
" \"feeRate\" (numeric, optional, default not set: makes wallet determine the fee) Set a specific fee rate in " + CURRENCY_UNIT + "/kB\n"
" \"subtractFeeFromOutputs\" (array, optional) A json array of integers.\n"
" The fee will be equally deducted from the amount of each specified output.\n"
" The outputs are specified by their zero-based index, before any change output is added.\n"
" Those recipients will receive less dash than you enter in their corresponding amount field.\n"
" If no outputs are specified here, the sender pays the fee.\n"
" [vout_index,...]\n"
" \"conf_target\" (numeric, optional) Confirmation target (in blocks)\n"
" \"estimate_mode\" (string, optional, default=UNSET) The fee estimate mode, must be one of:\n"
" \"UNSET\"\n"
" \"ECONOMICAL\"\n"
" \"CONSERVATIVE\"\n"
" }\n"
" for backward compatibility: passing in a true instead of an object will result in {\"includeWatching\":true}\n"
"\nResult:\n"
"{\n"
" \"hex\": \"value\", (string) The resulting raw transaction (hex-encoded string)\n"
" \"fee\": n, (numeric) Fee in " + CURRENCY_UNIT + " the resulting transaction pays\n"
" \"changepos\": n (numeric) The position of the added change output, or -1\n"
"}\n"
"\nExamples:\n"
"\nCreate a transaction with no inputs\n"
+ HelpExampleCli("createrawtransaction", "\"[]\" \"{\\\"myaddress\\\":0.01}\"") +
"\nAdd sufficient unsigned inputs to meet the output value\n"
+ HelpExampleCli("fundrawtransaction", "\"rawtransactionhex\"") +
"\nSign the transaction\n"
+ HelpExampleCli("signrawtransaction", "\"fundedtransactionhex\"") +
"\nSend the transaction\n"
+ HelpExampleCli("sendrawtransaction", "\"signedtransactionhex\"")
);
RPCTypeCheck(request.params, {UniValue::VSTR, UniValueType(), UniValue::VBOOL});
@ -3345,6 +3555,9 @@ UniValue signrawtransactionwithwallet(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error(
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},
{"prevtxs", RPCArg::Type::ARR,
@ -3363,10 +3576,7 @@ UniValue signrawtransactionwithwallet(const JSONRPCRequest& request)
{"sighashtype", RPCArg::Type::STR, true},
}}
.ToString() +
"\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"
+ HelpRequiringPassphrase(pwallet) + "\n"
HelpRequiringPassphrase(pwallet) + "\n"
"\nArguments:\n"
"1. \"hexstring\" (string, required) The transaction hex string\n"
@ -3438,8 +3648,13 @@ UniValue generate(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error(
"generate nblocks ( maxtries )\n"
"\nMine up to nblocks blocks immediately (before the RPC call returns) to an address in the wallet.\n"
RPCHelpMan{"generate",
"\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"
"1. nblocks (numeric, required) How many blocks are generated immediately.\n"
"2. maxtries (numeric, optional) How many iterations to try (default = 1000000).\n"
@ -3490,8 +3705,13 @@ static UniValue rescanblockchain(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 2) {
throw std::runtime_error(
"rescanblockchain (\"start_height\") (\"stop_height\")\n"
"\nRescan the local blockchain for wallet related transactions.\n"
RPCHelpMan{"rescanblockchain",
"\nRescan the local blockchain for wallet related transactions.\n",
{
{"start_height", RPCArg::Type::NUM, true},
{"stop_height", RPCArg::Type::NUM, true},
}}
.ToString() +
"\nArguments:\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. If none is provided it will rescan up to the tip at return time of this call.\n"
@ -3639,9 +3859,13 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error(
"getaddressinfo \"address\"\n"
"\nReturn information about the given dash address. Some information requires the address\n"
"to be in the wallet.\n"
RPCHelpMan{"getaddressinfo",
"\nReturn information about the given dash address. Some information requires the address\n"
"to be in the wallet.\n",
{
{"address", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"address\" (string, required) The dash address to get the information of.\n"
"\nResult:\n"
@ -3755,8 +3979,12 @@ static UniValue getaddressesbylabel(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
"getaddressesbylabel \"label\"\n"
"\nReturns the list of addresses assigned the specified label.\n"
RPCHelpMan{"getaddressesbylabel",
"\nReturns the list of addresses assigned the specified label.\n",
{
{"label", RPCArg::Type::STR, false},
}}
.ToString() +
"\nArguments:\n"
"1. \"label\" (string, required) The label.\n"
"\nResult:\n"
@ -3811,8 +4039,12 @@ static UniValue listlabels(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
"listlabels ( \"purpose\" )\n"
"\nReturns the list of all labels, or labels that are assigned to addresses with a specific purpose.\n"
RPCHelpMan{"listlabels",
"\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"
"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"
@ -3864,7 +4096,6 @@ UniValue importwallet(const JSONRPCRequest& request);
UniValue importprunedfunds(const JSONRPCRequest& request);
UniValue removeprunedfunds(const JSONRPCRequest& request);
UniValue importmulti(const JSONRPCRequest& request);
UniValue dumphdinfo(const JSONRPCRequest& request);
UniValue importelectrumwallet(const JSONRPCRequest& request);
@ -3879,10 +4110,17 @@ UniValue walletprocesspsbt(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4)
throw std::runtime_error(
"walletprocesspsbt \"psbt\" ( sign \"sighashtype\" bip32derivs )\n"
"\nUpdate a PSBT with input information from our wallet and then sign inputs\n"
"that we can sign for.\n"
+ HelpRequiringPassphrase(pwallet) + "\n"
RPCHelpMan{"walletprocesspsbt",
"\nUpdate a PSBT with input information from our wallet and then sign inputs\n"
"that we can sign for.\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"
"1. \"psbt\" (string, required) The transaction base64 string\n"
@ -3953,6 +4191,8 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 || request.params.size() > 6)
throw std::runtime_error(
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,
{
@ -3987,7 +4227,7 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
{"change_type", RPCArg::Type::STR, true},
{"includeWatching", RPCArg::Type::BOOL, true},
{"lockUnspents", RPCArg::Type::BOOL, true},
{"feeRate", RPCArg::Type::NUM, true},
{"feeRate", RPCArg::Type::AMOUNT, true},
{"subtractFeeFromOutputs", RPCArg::Type::ARR,
{
{"int", RPCArg::Type::NUM, true},
@ -3996,12 +4236,10 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
{"conf_target", RPCArg::Type::NUM, true},
{"estimate_mode", RPCArg::Type::STR, true},
},
true},
true, "options"},
{"bip32derivs", RPCArg::Type::BOOL, true},
}}
.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"
"1. \"inputs\" (array, required) A json array of json objects\n"
" [\n"

View File

@ -17,8 +17,9 @@ UniValue getzmqnotifications(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0) {
throw std::runtime_error(
"getzmqnotifications\n"
"\nReturns information about the active ZeroMQ notifications.\n"
RPCHelpMan{"getzmqnotifications",
"\nReturns information about the active ZeroMQ notifications.\n", {}}
.ToString() +
"\nResult:\n"
"[\n"
" { (json object)\n"

24
test/lint/lint-rpc-help.sh Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
#
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Check that all RPC help texts are generated by RPCHelpMan.
export LC_ALL=C
EXIT_CODE=0
# Assume that all multiline strings passed into a runtime_error are help texts.
# This is potentially fragile, but the linter is only temporary and can safely
# be removed early 2019.
non_autogenerated_help=$(grep -A1 'runtime_error($' $(git ls-files -- "*.cpp") | grep '".*\\n"$')
if [[ ${non_autogenerated_help} != "" ]]; then
echo "Must use RPCHelpMan to generate the help for the following RPC methods:"
echo "${non_autogenerated_help}"
echo
EXIT_CODE=1
fi
exit ${EXIT_CODE}