diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index cb89371963..8ffc93e0ff 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -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 (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 .\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 .\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 blockheaders starting from .\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 blockheaders starting from .\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 blocks starting from which match .\n" + RPCHelpMan{"getmerkleblocks", + "\nReturns an array of hex-encoded merkleblocks for blocks starting from which match .\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 .\n" - "If verbosity is 2, returns an Object with information about block 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 .\n" + "If verbosity is 2, returns an Object with information about block 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(
) Outputs whose scriptPubKey corresponds to the specified address (does not include P2PK)\n" - " raw() Outputs whose scriptPubKey equals the specified hex scripts\n" - " combo() P2PK and P2PKH outputs for the given pubkey\n" - " pkh() P2PKH outputs for the given pubkey\n" - " sh(multi(,,,...)) P2SH-multisig outputs for the given threshold and pubkeys\n" - "\nIn the above, 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(
) Outputs whose scriptPubKey corresponds to the specified address (does not include P2PK)\n" + " raw() Outputs whose scriptPubKey equals the specified hex scripts\n" + " combo() P2PK and P2PKH outputs for the given pubkey\n" + " pkh() P2PKH outputs for the given pubkey\n" + " sh(multi(,,,...)) P2SH-multisig outputs for the given threshold and pubkeys\n" + "\nIn the above, 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 \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)" diff --git a/src/rpc/coinjoin.cpp b/src/rpc/coinjoin.cpp index 7b0094f8d4..f216fe8886 100644 --- a/src/rpc/coinjoin.cpp +++ b/src/rpc/coinjoin.cpp @@ -10,6 +10,7 @@ #endif // ENABLE_WALLET #include #include +#include #include #include @@ -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", "") ); } diff --git a/src/rpc/governance.cpp b/src/rpc/governance.cpp index 5161662f37..beefc23746 100644 --- a/src/rpc/governance.cpp +++ b/src/rpc/governance.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -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