RPCHelpMan: Check default values are given at compile-time

This commit is contained in:
MarcoFalke 2018-12-10 16:56:51 -05:00
parent ff9e197212
commit fa0ad4e7ce
No known key found for this signature in database
GPG key ID: CE2B75697E69A548
10 changed files with 388 additions and 363 deletions

View file

@ -215,7 +215,7 @@ static UniValue waitfornewblock(const JSONRPCRequest& request)
"\nWaits for a specific new block and returns useful info about it.\n" "\nWaits for a specific new block and returns useful info about it.\n"
"\nReturns the current block on timeout or exit.\n", "\nReturns the current block on timeout or exit.\n",
{ {
{"timeout", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Time in milliseconds to wait for a response. 0 indicates no timeout."}, {"timeout", RPCArg::Type::NUM, /* default */ "0", "Time in milliseconds to wait for a response. 0 indicates no timeout."},
}, },
RPCResult{ RPCResult{
"{ (json object)\n" "{ (json object)\n"
@ -256,8 +256,8 @@ static UniValue waitforblock(const JSONRPCRequest& request)
"\nWaits for a specific new block and returns useful info about it.\n" "\nWaits for a specific new block and returns useful info about it.\n"
"\nReturns the current block on timeout or exit.\n", "\nReturns the current block on timeout or exit.\n",
{ {
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "Block hash to wait for."}, {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Block hash to wait for."},
{"timeout", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Time in milliseconds to wait for a response. 0 indicates no timeout."}, {"timeout", RPCArg::Type::NUM, /* default */ "0", "Time in milliseconds to wait for a response. 0 indicates no timeout."},
}, },
RPCResult{ RPCResult{
"{ (json object)\n" "{ (json object)\n"
@ -302,8 +302,8 @@ static UniValue waitforblockheight(const JSONRPCRequest& request)
"of the current tip.\n" "of the current tip.\n"
"\nReturns the current block on timeout or exit.\n", "\nReturns the current block on timeout or exit.\n",
{ {
{"height", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "Block height to wait for."}, {"height", RPCArg::Type::NUM, RPCArg::Optional::NO, "Block height to wait for."},
{"timeout", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Time in milliseconds to wait for a response. 0 indicates no timeout."}, {"timeout", RPCArg::Type::NUM, /* default */ "0", "Time in milliseconds to wait for a response. 0 indicates no timeout."},
}, },
RPCResult{ RPCResult{
"{ (json object)\n" "{ (json object)\n"
@ -501,7 +501,7 @@ static UniValue getrawmempool(const JSONRPCRequest& request)
"\nReturns all transaction ids in memory pool as a json array of string transaction ids.\n" "\nReturns all transaction ids in memory pool as a json array of string transaction ids.\n"
"\nHint: use getmempoolentry to fetch a specific transaction from the mempool.\n", "\nHint: use getmempoolentry to fetch a specific transaction from the mempool.\n",
{ {
{"verbose", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "True for a json object, false for array of transaction ids"}, {"verbose", RPCArg::Type::BOOL, /* default */ "false", "True for a json object, false for array of transaction ids"},
}, },
RPCResult{"for verbose = false", RPCResult{"for verbose = false",
"[ (json array of string)\n" "[ (json array of string)\n"
@ -535,8 +535,8 @@ static UniValue getmempoolancestors(const JSONRPCRequest& request)
RPCHelpMan{"getmempoolancestors", RPCHelpMan{"getmempoolancestors",
"\nIf txid is in the mempool, returns all in-mempool ancestors.\n", "\nIf txid is in the mempool, returns all in-mempool ancestors.\n",
{ {
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id (must be in mempool)"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id (must be in mempool)"},
{"verbose", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "True for a json object, false for array of transaction ids"}, {"verbose", RPCArg::Type::BOOL, /* default */ "false", "True for a json object, false for array of transaction ids"},
}, },
{ {
RPCResult{"for verbose = false", RPCResult{"for verbose = false",
@ -605,8 +605,8 @@ static UniValue getmempooldescendants(const JSONRPCRequest& request)
RPCHelpMan{"getmempooldescendants", RPCHelpMan{"getmempooldescendants",
"\nIf txid is in the mempool, returns all in-mempool descendants.\n", "\nIf txid is in the mempool, returns all in-mempool descendants.\n",
{ {
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id (must be in mempool)"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id (must be in mempool)"},
{"verbose", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "True for a json object, false for array of transaction ids"}, {"verbose", RPCArg::Type::BOOL, /* default */ "false", "True for a json object, false for array of transaction ids"},
}, },
{ {
RPCResult{"for verbose = false", RPCResult{"for verbose = false",
@ -675,7 +675,7 @@ static UniValue getmempoolentry(const JSONRPCRequest& request)
RPCHelpMan{"getmempoolentry", RPCHelpMan{"getmempoolentry",
"\nReturns mempool data for given transaction\n", "\nReturns mempool data for given transaction\n",
{ {
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id (must be in mempool)"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id (must be in mempool)"},
}, },
RPCResult{ RPCResult{
"{ (json object)\n" "{ (json object)\n"
@ -711,7 +711,7 @@ static UniValue getblockhash(const JSONRPCRequest& request)
RPCHelpMan{"getblockhash", RPCHelpMan{"getblockhash",
"\nReturns hash of block in best-block-chain at height provided.\n", "\nReturns hash of block in best-block-chain at height provided.\n",
{ {
{"height", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The height index"}, {"height", RPCArg::Type::NUM, RPCArg::Optional::NO, "The height index"},
}, },
RPCResult{ RPCResult{
"\"hash\" (string) The block hash\n" "\"hash\" (string) The block hash\n"
@ -740,8 +740,8 @@ static UniValue getblockheader(const JSONRPCRequest& request)
"\nIf verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'.\n" "\nIf verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'.\n"
"If verbose is true, returns an Object with information about blockheader <hash>.\n", "If verbose is true, returns an Object with information about blockheader <hash>.\n",
{ {
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The block hash"}, {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The block hash"},
{"verbose", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "true for a json object, false for the hex-encoded data"}, {"verbose", RPCArg::Type::BOOL, /* default */ "true", "true for a json object, false for the hex-encoded data"},
}, },
{ {
RPCResult{"for verbose = true", RPCResult{"for verbose = true",
@ -830,8 +830,8 @@ static UniValue getblock(const JSONRPCRequest& request)
"If verbosity is 1, returns an Object with information about block <hash>.\n" "If verbosity is 1, returns an Object with information about block <hash>.\n"
"If verbosity is 2, returns an Object with information about block <hash> and information about each transaction. \n", "If verbosity is 2, returns an Object with information about block <hash> and information about each transaction. \n",
{ {
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The block hash"}, {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The block hash"},
{"verbosity", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1", "0 for hex-encoded data, 1 for a json object, and 2 for json object with transaction data"}, {"verbosity", RPCArg::Type::NUM, /* default */ "1", "0 for hex-encoded data, 1 for a json object, and 2 for json object with transaction data"},
}, },
{ {
RPCResult{"for verbosity = 0", RPCResult{"for verbosity = 0",
@ -986,7 +986,7 @@ static UniValue pruneblockchain(const JSONRPCRequest& request)
throw std::runtime_error( throw std::runtime_error(
RPCHelpMan{"pruneblockchain", "", RPCHelpMan{"pruneblockchain", "",
{ {
{"height", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The block height to prune up to. May be set to a discrete height, or a unix timestamp\n" {"height", RPCArg::Type::NUM, RPCArg::Optional::NO, "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."}, " to prune blocks whose block time is at least 2 hours older than the provided timestamp."},
}, },
RPCResult{ RPCResult{
@ -1085,9 +1085,9 @@ UniValue gettxout(const JSONRPCRequest& request)
RPCHelpMan{"gettxout", RPCHelpMan{"gettxout",
"\nReturns details about an unspent transaction output.\n", "\nReturns details about an unspent transaction output.\n",
{ {
{"txid", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The transaction id"}, {"txid", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction id"},
{"n", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "vout number"}, {"n", RPCArg::Type::NUM, RPCArg::Optional::NO, "vout number"},
{"include_mempool", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Whether to include the mempool. Note that an unspent output that is spent in the mempool won't appear."}, {"include_mempool", RPCArg::Type::BOOL, /* default */ "true", "Whether to include the mempool. Note that an unspent output that is spent in the mempool won't appear."},
}, },
RPCResult{ RPCResult{
"{\n" "{\n"
@ -1166,8 +1166,8 @@ static UniValue verifychain(const JSONRPCRequest& request)
RPCHelpMan{"verifychain", RPCHelpMan{"verifychain",
"\nVerifies blockchain database.\n", "\nVerifies blockchain database.\n",
{ {
{"checklevel", RPCArg::Type::NUM, /* opt */ true, /* default_val */ strprintf("%d, range=0-4", nCheckLevel), "How thorough the block verification is."}, {"checklevel", RPCArg::Type::NUM, /* default */ strprintf("%d, range=0-4", nCheckLevel), "How thorough the block verification is."},
{"nblocks", RPCArg::Type::NUM, /* opt */ true, /* default_val */ strprintf("%d, 0=all", nCheckDepth), "The number of blocks to check."}, {"nblocks", RPCArg::Type::NUM, /* default */ strprintf("%d, 0=all", nCheckDepth), "The number of blocks to check."},
}, },
RPCResult{ RPCResult{
"true|false (boolean) Verified or not\n" "true|false (boolean) Verified or not\n"
@ -1534,7 +1534,7 @@ static UniValue preciousblock(const JSONRPCRequest& request)
"\nA later preciousblock call can override the effect of an earlier one.\n" "\nA later preciousblock call can override the effect of an earlier one.\n"
"\nThe effects of preciousblock are not retained across restarts.\n", "\nThe effects of preciousblock are not retained across restarts.\n",
{ {
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hash of the block to mark as precious"}, {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hash of the block to mark as precious"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -1571,7 +1571,7 @@ static UniValue invalidateblock(const JSONRPCRequest& request)
RPCHelpMan{"invalidateblock", RPCHelpMan{"invalidateblock",
"\nPermanently marks a block as invalid, as if it violated a consensus rule.\n", "\nPermanently marks a block as invalid, as if it violated a consensus rule.\n",
{ {
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hash of the block to mark as invalid"}, {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hash of the block to mark as invalid"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -1612,7 +1612,7 @@ static UniValue reconsiderblock(const JSONRPCRequest& request)
"\nRemoves invalidity status of a block, its ancestors and its descendants, reconsider them for activation.\n" "\nRemoves invalidity status of a block, its ancestors and its descendants, reconsider them for activation.\n"
"This can be used to undo the effects of invalidateblock.\n", "This can be used to undo the effects of invalidateblock.\n",
{ {
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hash of the block to reconsider"}, {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hash of the block to reconsider"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -1650,8 +1650,8 @@ static UniValue getchaintxstats(const JSONRPCRequest& request)
RPCHelpMan{"getchaintxstats", RPCHelpMan{"getchaintxstats",
"\nCompute statistics about the total number and rate of transactions in the chain.\n", "\nCompute statistics about the total number and rate of transactions in the chain.\n",
{ {
{"nblocks", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "one month", "Size of the window in number of blocks"}, {"nblocks", RPCArg::Type::NUM, /* default */ "one month", "Size of the window in number of blocks"},
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ true, /* default_val */ "chain tip", "The hash of the block that ends the window."}, {"blockhash", RPCArg::Type::STR_HEX, /* default */ "chain tip", "The hash of the block that ends the window."},
}, },
RPCResult{ RPCResult{
"{\n" "{\n"
@ -1785,11 +1785,11 @@ static UniValue getblockstats(const JSONRPCRequest& request)
"It won't work for some heights with pruning.\n" "It won't work for some heights with pruning.\n"
"It won't work without -txindex for utxo_size_inc, *fee or *feerate stats.\n", "It won't work without -txindex for utxo_size_inc, *fee or *feerate stats.\n",
{ {
{"hash_or_height", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The block hash or height of the target block", "", {"", "string or numeric"}}, {"hash_or_height", RPCArg::Type::NUM, RPCArg::Optional::NO, "The block hash or height of the target block", "", {"", "string or numeric"}},
{"stats", RPCArg::Type::ARR, /* opt */ true, /* default_val */ "all values", "Values to plot (see result below)", {"stats", RPCArg::Type::ARR, /* default */ "all values", "Values to plot (see result below)",
{ {
{"height", RPCArg::Type::STR, /* opt */ true, /* default_val */ "", "Selected statistic"}, {"height", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Selected statistic"},
{"time", RPCArg::Type::STR, /* opt */ true, /* default_val */ "", "Selected statistic"}, {"time", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Selected statistic"},
}, },
"stats"}, "stats"},
}, },
@ -2148,18 +2148,18 @@ UniValue scantxoutset(const JSONRPCRequest& request)
"In the latter case, a range needs to be specified by below if different from 1000.\n" "In the latter case, a range needs to be specified by below if different from 1000.\n"
"For more information on output descriptors, see the documentation in the doc/descriptors.md file.\n", "For more information on output descriptors, see the documentation in the doc/descriptors.md file.\n",
{ {
{"action", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The action to execute\n" {"action", RPCArg::Type::STR, RPCArg::Optional::NO, "The action to execute\n"
" \"start\" for starting a scan\n" " \"start\" for starting a scan\n"
" \"abort\" for aborting the current scan (returns true when abort was successful)\n" " \"abort\" for aborting the current scan (returns true when abort was successful)\n"
" \"status\" for progress report (in %) of the current scan"}, " \"status\" for progress report (in %) of the current scan"},
{"scanobjects", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "Array of scan objects\n" {"scanobjects", RPCArg::Type::ARR, RPCArg::Optional::NO, "Array of scan objects\n"
" Every scan object is either a string descriptor or an object:", " Every scan object is either a string descriptor or an object:",
{ {
{"descriptor", RPCArg::Type::STR, /* opt */ true, /* default_val */ "", "An output descriptor"}, {"descriptor", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "An output descriptor"},
{"", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "", "An object with output descriptor and metadata", {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "An object with output descriptor and metadata",
{ {
{"desc", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "An output descriptor"}, {"desc", RPCArg::Type::STR, RPCArg::Optional::NO, "An output descriptor"},
{"range", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1000", "Up to what child index HD chains should be explored"}, {"range", RPCArg::Type::NUM, /* default */ "1000", "Up to what child index HD chains should be explored"},
}, },
}, },
}, },

View file

@ -92,8 +92,8 @@ static UniValue getnetworkhashps(const JSONRPCRequest& request)
"Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n" "Pass in [blocks] to override # of blocks, -1 specifies since last difficulty change.\n"
"Pass in [height] to estimate the network speed at the time when a certain block was found.\n", "Pass in [height] to estimate the network speed at the time when a certain block was found.\n",
{ {
{"nblocks", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "120", "The number of blocks, or -1 for blocks since last difficulty change."}, {"nblocks", RPCArg::Type::NUM, /* default */ "120", "The number of blocks, or -1 for blocks since last difficulty change."},
{"height", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "-1", "To estimate at the time of the given height."}, {"height", RPCArg::Type::NUM, /* default */ "-1", "To estimate at the time of the given height."},
}, },
RPCResult{ RPCResult{
"x (numeric) Hashes per second estimated\n" "x (numeric) Hashes per second estimated\n"
@ -163,9 +163,9 @@ static UniValue generatetoaddress(const JSONRPCRequest& request)
RPCHelpMan{"generatetoaddress", RPCHelpMan{"generatetoaddress",
"\nMine blocks immediately to a specified address (before the RPC call returns)\n", "\nMine blocks immediately to a specified address (before the RPC call returns)\n",
{ {
{"nblocks", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "How many blocks are generated immediately."}, {"nblocks", RPCArg::Type::NUM, RPCArg::Optional::NO, "How many blocks are generated immediately."},
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The address to send the newly generated bitcoin to."}, {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The address to send the newly generated bitcoin to."},
{"maxtries", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1000000", "How many iterations to try."}, {"maxtries", RPCArg::Type::NUM, /* default */ "1000000", "How many iterations to try."},
}, },
RPCResult{ RPCResult{
"[ blockhashes ] (array) hashes of blocks generated\n" "[ blockhashes ] (array) hashes of blocks generated\n"
@ -244,10 +244,10 @@ static UniValue prioritisetransaction(const JSONRPCRequest& request)
RPCHelpMan{"prioritisetransaction", RPCHelpMan{"prioritisetransaction",
"Accepts the transaction into mined blocks at a higher (or lower) priority\n", "Accepts the transaction into mined blocks at a higher (or lower) priority\n",
{ {
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id."}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id."},
{"dummy", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "null", "API-Compatibility for previous API. Must be zero or null.\n" {"dummy", RPCArg::Type::NUM, RPCArg::Optional::OMITTED_NAMED_ARG, "API-Compatibility for previous API. Must be zero or null.\n"
" DEPRECATED. For forward compatibility use named arguments and omit this parameter."}, " DEPRECATED. For forward compatibility use named arguments and omit this parameter."},
{"fee_delta", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The fee value (in satoshis) to add (or subtract, if negative).\n" {"fee_delta", RPCArg::Type::NUM, RPCArg::Optional::NO, "The fee value (in satoshis) to add (or subtract, if negative).\n"
" Note, that this value is not a fee rate. It is a value to modify absolute fee of the TX.\n" " Note, that this value is not a fee rate. It is a value to modify absolute fee of the TX.\n"
" The fee is not actually paid, only the algorithm for selecting transactions into a block\n" " The fee is not actually paid, only the algorithm for selecting transactions into a block\n"
" considers the transaction as it would have paid a higher (or lower) fee."}, " considers the transaction as it would have paid a higher (or lower) fee."},
@ -316,17 +316,17 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
" https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes\n" " https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes\n"
" https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki\n", " https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki\n",
{ {
{"template_request", RPCArg::Type::OBJ, /* opt */ false, /* default_val */ "", "A json object in the following spec", {"template_request", RPCArg::Type::OBJ, RPCArg::Optional::NO, "A json object in the following spec",
{ {
{"mode", RPCArg::Type::STR, /* opt */ true, /* default_val */ "", "This must be set to \"template\", \"proposal\" (see BIP 23), or omitted"}, {"mode", RPCArg::Type::STR, /* treat as named arg */ RPCArg::Optional::OMITTED_NAMED_ARG, "This must be set to \"template\", \"proposal\" (see BIP 23), or omitted"},
{"capabilities", RPCArg::Type::ARR, /* opt */ true, /* default_val */ "", "A list of strings", {"capabilities", RPCArg::Type::ARR, /* treat as named arg */ RPCArg::Optional::OMITTED_NAMED_ARG, "A list of strings",
{ {
{"support", RPCArg::Type::STR, /* opt */ true, /* default_val */ "", "client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid'"}, {"support", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "client side supported feature, 'longpoll', 'coinbasetxn', 'coinbasevalue', 'proposal', 'serverlist', 'workid'"},
}, },
}, },
{"rules", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "A list of strings", {"rules", RPCArg::Type::ARR, RPCArg::Optional::NO, "A list of strings",
{ {
{"support", RPCArg::Type::STR, /* opt */ true, /* default_val */ "", "client side supported softfork deployment"}, {"support", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "client side supported softfork deployment"},
}, },
}, },
}, },
@ -716,8 +716,8 @@ static UniValue submitblock(const JSONRPCRequest& request)
"\nAttempts to submit new block to network.\n" "\nAttempts to submit new block to network.\n"
"See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n", "See https://en.bitcoin.it/wiki/BIP_0022 for full specification.\n",
{ {
{"hexdata", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hex-encoded block data to submit"}, {"hexdata", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hex-encoded block data to submit"},
{"dummy", RPCArg::Type::STR, /* opt */ true, /* default_val */ "ignored", "dummy value, for compatibility with BIP22. This value is ignored."}, {"dummy", RPCArg::Type::STR, /* default */ "ignored", "dummy value, for compatibility with BIP22. This value is ignored."},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -781,7 +781,7 @@ static UniValue submitheader(const JSONRPCRequest& request)
"\nDecode the given hexdata as a header and submit it as a candidate chain tip if valid." "\nDecode the given hexdata as a header and submit it as a candidate chain tip if valid."
"\nThrows when the header is invalid.\n", "\nThrows when the header is invalid.\n",
{ {
{"hexdata", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hex-encoded block header data"}, {"hexdata", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hex-encoded block header data"},
}, },
RPCResult{ RPCResult{
"None" "None"
@ -823,8 +823,8 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request)
"for which the estimate is valid. Uses virtual transaction size as defined\n" "for which the estimate is valid. Uses virtual transaction size as defined\n"
"in BIP 141 (witness data is discounted).\n", "in BIP 141 (witness data is discounted).\n",
{ {
{"conf_target", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "Confirmation target in blocks (1 - 1008)"}, {"conf_target", RPCArg::Type::NUM, RPCArg::Optional::NO, "Confirmation target in blocks (1 - 1008)"},
{"estimate_mode", RPCArg::Type::STR, /* opt */ true, /* default_val */ "CONSERVATIVE", "The fee estimate mode.\n" {"estimate_mode", RPCArg::Type::STR, /* default */ "CONSERVATIVE", "The fee estimate mode.\n"
" Whether to return a more conservative estimate which also satisfies\n" " Whether to return a more conservative estimate which also satisfies\n"
" a longer history. A conservative estimate potentially returns a\n" " a longer history. A conservative estimate potentially returns a\n"
" higher feerate and is more likely to be sufficient for the desired\n" " higher feerate and is more likely to be sufficient for the desired\n"
@ -890,8 +890,8 @@ static UniValue estimaterawfee(const JSONRPCRequest& request)
"confirmation within conf_target blocks if possible. Uses virtual transaction size as\n" "confirmation within conf_target blocks if possible. Uses virtual transaction size as\n"
"defined in BIP 141 (witness data is discounted).\n", "defined in BIP 141 (witness data is discounted).\n",
{ {
{"conf_target", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "Confirmation target in blocks (1 - 1008)"}, {"conf_target", RPCArg::Type::NUM, RPCArg::Optional::NO, "Confirmation target in blocks (1 - 1008)"},
{"threshold", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0.95", "The proportion of transactions in a given feerate range that must have been\n" {"threshold", RPCArg::Type::NUM, /* default */ "0.95", "The proportion of transactions in a given feerate range that must have been\n"
" confirmed within conf_target in order to consider those feerates as high enough and proceed to check\n" " confirmed within conf_target in order to consider those feerates as high enough and proceed to check\n"
" lower buckets."}, " lower buckets."},
}, },

View file

@ -40,7 +40,7 @@ static UniValue validateaddress(const JSONRPCRequest& request)
"fields have moved to getaddressinfo and will only be shown here with -deprecatedrpc=validateaddress: ismine, iswatchonly,\n" "fields have moved to getaddressinfo and will only be shown here with -deprecatedrpc=validateaddress: ismine, iswatchonly,\n"
"script, hex, pubkeys, sigsrequired, pubkey, addresses, embedded, iscompressed, account, timestamp, hdkeypath, kdmasterkeyid.\n", "script, hex, pubkeys, sigsrequired, pubkey, addresses, embedded, iscompressed, account, timestamp, hdkeypath, kdmasterkeyid.\n",
{ {
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The bitcoin address to validate"}, {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address to validate"},
}, },
RPCResult{ RPCResult{
"{\n" "{\n"
@ -87,12 +87,12 @@ static UniValue createmultisig(const JSONRPCRequest& request)
"\nCreates a multi-signature address with n signature of m keys required.\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", "It returns a json object with the address and redeemScript.\n",
{ {
{"nrequired", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The number of required signatures out of the n keys."}, {"nrequired", RPCArg::Type::NUM, RPCArg::Optional::NO, "The number of required signatures out of the n keys."},
{"keys", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "A json array of hex-encoded public keys.", {"keys", RPCArg::Type::ARR, RPCArg::Optional::NO, "A json array of hex-encoded public keys.",
{ {
{"key", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex-encoded public key"}, {"key", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "The hex-encoded public key"},
}}, }},
{"address_type", RPCArg::Type::STR, /* opt */ true, /* default_val */ "legacy", "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."}, {"address_type", RPCArg::Type::STR, /* default */ "legacy", "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
}, },
RPCResult{ RPCResult{
"{\n" "{\n"
@ -158,9 +158,9 @@ UniValue deriveaddresses(const JSONRPCRequest& request)
"or more path elements separated by \"/\", where \"h\" represents a hardened child key.\n" "or more path elements separated by \"/\", where \"h\" represents a hardened child key.\n"
"For more information on output descriptors, see the documentation in the doc/descriptors.md file.\n"}, "For more information on output descriptors, see the documentation in the doc/descriptors.md file.\n"},
{ {
{"descriptor", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The descriptor."}, {"descriptor", RPCArg::Type::STR, RPCArg::Optional::NO, "The descriptor."},
{"begin", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "", "If a ranged descriptor is used, this specifies the beginning of the range to import."}, {"begin", RPCArg::Type::NUM, RPCArg::Optional::OMITTED_NAMED_ARG, "If a ranged descriptor is used, this specifies the beginning of the range to import."},
{"end", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "", "If a ranged descriptor is used, this specifies the end of the range to import."} {"end", RPCArg::Type::NUM, RPCArg::Optional::OMITTED_NAMED_ARG, "If a ranged descriptor is used, this specifies the end of the range to import."}
}, },
RPCResult{ RPCResult{
"[ address ] (array) the derived addresses\n" "[ address ] (array) the derived addresses\n"
@ -239,9 +239,9 @@ static UniValue verifymessage(const JSONRPCRequest& request)
RPCHelpMan{"verifymessage", RPCHelpMan{"verifymessage",
"\nVerify a signed message\n", "\nVerify a signed message\n",
{ {
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The bitcoin address to use for the signature."}, {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address to use for the signature."},
{"signature", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The signature provided by the signer in base 64 encoding (see signmessage)."}, {"signature", RPCArg::Type::STR, RPCArg::Optional::NO, "The signature provided by the signer in base 64 encoding (see signmessage)."},
{"message", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The message that was signed."}, {"message", RPCArg::Type::STR, RPCArg::Optional::NO, "The message that was signed."},
}, },
RPCResult{ RPCResult{
"true|false (boolean) If the signature is verified or not.\n" "true|false (boolean) If the signature is verified or not.\n"
@ -298,8 +298,8 @@ static UniValue signmessagewithprivkey(const JSONRPCRequest& request)
RPCHelpMan{"signmessagewithprivkey", RPCHelpMan{"signmessagewithprivkey",
"\nSign a message with the private key of an address\n", "\nSign a message with the private key of an address\n",
{ {
{"privkey", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The private key to sign the message with."}, {"privkey", RPCArg::Type::STR, RPCArg::Optional::NO, "The private key to sign the message with."},
{"message", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The message to create a signature of."}, {"message", RPCArg::Type::STR, RPCArg::Optional::NO, "The message to create a signature of."},
}, },
RPCResult{ RPCResult{
"\"signature\" (string) The signature of the message encoded in base 64\n" "\"signature\" (string) The signature of the message encoded in base 64\n"
@ -340,7 +340,7 @@ static UniValue setmocktime(const JSONRPCRequest& request)
RPCHelpMan{"setmocktime", RPCHelpMan{"setmocktime",
"\nSet the local time to given timestamp (-regtest only)\n", "\nSet the local time to given timestamp (-regtest only)\n",
{ {
{"timestamp", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "Unix seconds-since-epoch timestamp\n" {"timestamp", RPCArg::Type::NUM, RPCArg::Optional::NO, "Unix seconds-since-epoch timestamp\n"
" Pass 0 to go back to using the system time."}, " Pass 0 to go back to using the system time."},
}, },
RPCResults{}, RPCResults{},
@ -406,7 +406,7 @@ static UniValue getmemoryinfo(const JSONRPCRequest& request)
RPCHelpMan{"getmemoryinfo", RPCHelpMan{"getmemoryinfo",
"Returns an object containing information about memory usage.\n", "Returns an object containing information about memory usage.\n",
{ {
{"mode", RPCArg::Type::STR, /* opt */ true, /* default_val */ "\"stats\"", "determines what kind of information is returned.\n" {"mode", RPCArg::Type::STR, /* default */ "\"stats\"", "determines what kind of information is returned.\n"
" - \"stats\" returns general statistics about memory usage in the daemon.\n" " - \"stats\" returns general statistics about memory usage in the daemon.\n"
" - \"mallocinfo\" returns an XML string describing low-level heap state (only available if compiled with glibc 2.10+)."}, " - \"mallocinfo\" returns an XML string describing low-level heap state (only available if compiled with glibc 2.10+)."},
}, },
@ -483,13 +483,13 @@ UniValue logging(const JSONRPCRequest& request)
" - \"none\", \"0\" : even if other logging categories are specified, ignore all of them.\n" " - \"none\", \"0\" : even if other logging categories are specified, ignore all of them.\n"
, ,
{ {
{"include", RPCArg::Type::ARR, /* opt */ true, /* default_val */ "null", "A json array of categories to add debug logging", {"include", RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, "A json array of categories to add debug logging",
{ {
{"include_category", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "the valid logging category"}, {"include_category", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "the valid logging category"},
}}, }},
{"exclude", RPCArg::Type::ARR, /* opt */ true, /* default_val */ "null", "A json array of categories to remove debug logging", {"exclude", RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, "A json array of categories to remove debug logging",
{ {
{"exclude_category", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "the valid logging category"}, {"exclude_category", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "the valid logging category"},
}}, }},
}, },
RPCResult{ RPCResult{

View file

@ -221,8 +221,8 @@ static UniValue addnode(const JSONRPCRequest& request)
"Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be\n" "Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be\n"
"full nodes/support SegWit as other outbound peers are (though such peers will not be synced from).\n", "full nodes/support SegWit as other outbound peers are (though such peers will not be synced from).\n",
{ {
{"node", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The node (see getpeerinfo for nodes)"}, {"node", RPCArg::Type::STR, RPCArg::Optional::NO, "The node (see getpeerinfo for nodes)"},
{"command", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "'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"}, {"command", RPCArg::Type::STR, RPCArg::Optional::NO, "'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"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -266,8 +266,8 @@ static UniValue disconnectnode(const JSONRPCRequest& request)
"\nStrictly one out of 'address' and 'nodeid' can be provided to identify the node.\n" "\nStrictly one out of 'address' and 'nodeid' can be provided to identify the node.\n"
"\nTo disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.\n", "\nTo disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.\n",
{ {
{"address", RPCArg::Type::STR, /* opt */ true, /* default_val */ "fallback to nodeid", "The IP address/port of the node"}, {"address", RPCArg::Type::STR, /* default */ "fallback to nodeid", "The IP address/port of the node"},
{"nodeid", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "fallback to address", "The node ID (see getpeerinfo for node IDs)"}, {"nodeid", RPCArg::Type::NUM, /* default */ "fallback to address", "The node ID (see getpeerinfo for node IDs)"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -311,7 +311,7 @@ static UniValue getaddednodeinfo(const JSONRPCRequest& request)
"\nReturns information about the given added node, or all added nodes\n" "\nReturns information about the given added node, or all added nodes\n"
"(note that onetry addnodes are not listed here)\n", "(note that onetry addnodes are not listed here)\n",
{ {
{"node", RPCArg::Type::STR, /* opt */ true, /* default_val */ "all nodes", "If provided, return information about this specific node, otherwise all nodes are returned."}, {"node", RPCArg::Type::STR, /* default */ "all nodes", "If provided, return information about this specific node, otherwise all nodes are returned."},
}, },
RPCResult{ RPCResult{
"[\n" "[\n"
@ -532,10 +532,10 @@ static UniValue setban(const JSONRPCRequest& request)
RPCHelpMan{"setban", RPCHelpMan{"setban",
"\nAttempts to add or remove an IP/Subnet from the banned list.\n", "\nAttempts to add or remove an IP/Subnet from the banned list.\n",
{ {
{"subnet", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The IP/Subnet (see getpeerinfo for nodes IP) with an optional netmask (default is /32 = single IP)"}, {"subnet", RPCArg::Type::STR, RPCArg::Optional::NO, "The IP/Subnet (see getpeerinfo for nodes IP) with an optional netmask (default is /32 = single IP)"},
{"command", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "'add' to add an IP/Subnet to the list, 'remove' to remove an IP/Subnet from the list"}, {"command", RPCArg::Type::STR, RPCArg::Optional::NO, "'add' to add an IP/Subnet to the list, 'remove' to remove an IP/Subnet from the list"},
{"bantime", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "time in seconds how long (or until when if [absolute] is set) the IP is banned (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument)"}, {"bantime", RPCArg::Type::NUM, /* default */ "0", "time in seconds how long (or until when if [absolute] is set) the IP is banned (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument)"},
{"absolute", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "If set, the bantime must be an absolute timestamp in seconds since epoch (Jan 1 1970 GMT)"}, {"absolute", RPCArg::Type::BOOL, /* default */ "false", "If set, the bantime must be an absolute timestamp in seconds since epoch (Jan 1 1970 GMT)"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -667,7 +667,7 @@ static UniValue setnetworkactive(const JSONRPCRequest& request)
RPCHelpMan{"setnetworkactive", RPCHelpMan{"setnetworkactive",
"\nDisable/enable all p2p network activity.\n", "\nDisable/enable all p2p network activity.\n",
{ {
{"state", RPCArg::Type::BOOL, /* opt */ false, /* default_val */ "", "true to enable networking, false to disable"}, {"state", RPCArg::Type::BOOL, RPCArg::Optional::NO, "true to enable networking, false to disable"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{""}, RPCExamples{""},
@ -691,7 +691,7 @@ static UniValue getnodeaddresses(const JSONRPCRequest& request)
RPCHelpMan{"getnodeaddresses", RPCHelpMan{"getnodeaddresses",
"\nReturn known addresses which can potentially be used to find new nodes in the network\n", "\nReturn known addresses which can potentially be used to find new nodes in the network\n",
{ {
{"count", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1", "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."}, {"count", RPCArg::Type::NUM, /* default */ "1", "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."},
}, },
RPCResult{ RPCResult{
"[\n" "[\n"

View file

@ -82,9 +82,9 @@ static UniValue getrawtransaction(const JSONRPCRequest& request)
"\nIf verbose is 'true', returns an Object with information about 'txid'.\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", "If verbose is 'false' or omitted, returns a string that is serialized, hex-encoded data for 'txid'.\n",
{ {
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
{"verbose", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "If false, return a string, otherwise return a json object"}, {"verbose", RPCArg::Type::BOOL, /* default */ "false", "If false, return a string, otherwise return a json object"},
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ true, /* default_val */ "null", "The block in which to look for the transaction"}, {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED_NAMED_ARG, "The block in which to look for the transaction"},
}, },
{ {
RPCResult{"if verbose is not set or set to false", RPCResult{"if verbose is not set or set to false",
@ -218,12 +218,12 @@ static UniValue gettxoutproof(const JSONRPCRequest& request)
"you need to maintain a transaction index, using the -txindex command line option or\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", "specify the block in which the transaction is included manually (by blockhash).\n",
{ {
{"txids", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "A json array of txids to filter", {"txids", RPCArg::Type::ARR, RPCArg::Optional::NO, "A json array of txids to filter",
{ {
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "A transaction hash"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A transaction hash"},
}, },
}, },
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ true, /* default_val */ "null", "If specified, looks for txid in the block with this hash"}, {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED_NAMED_ARG, "If specified, looks for txid in the block with this hash"},
}, },
RPCResult{ RPCResult{
"\"data\" (string) A string that is a serialized, hex-encoded data for the proof.\n" "\"data\" (string) A string that is a serialized, hex-encoded data for the proof.\n"
@ -311,7 +311,7 @@ static UniValue verifytxoutproof(const JSONRPCRequest& request)
"\nVerifies that a proof points to a transaction in a block, returning the transaction it commits to\n" "\nVerifies that a proof points to a transaction in a block, returning the transaction it commits to\n"
"and throwing an RPC error if the block is not in our best chain\n", "and throwing an RPC error if the block is not in our best chain\n",
{ {
{"proof", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex-encoded proof generated by gettxoutproof"}, {"proof", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex-encoded proof generated by gettxoutproof"},
}, },
RPCResult{ RPCResult{
"[\"txid\"] (array, strings) The txid(s) which the proof commits to, or empty array if the proof can not be validated.\n" "[\"txid\"] (array, strings) The txid(s) which the proof commits to, or empty array if the proof can not be validated.\n"
@ -472,36 +472,36 @@ static UniValue createrawtransaction(const JSONRPCRequest& request)
"Note that the transaction's inputs are not signed, and\n" "Note that the transaction's inputs are not signed, and\n"
"it is not stored in the wallet or transmitted to the network.\n", "it is not stored in the wallet or transmitted to the network.\n",
{ {
{"inputs", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "A json array of json objects", {"inputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "A json array of json objects",
{ {
{"", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "", "", {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{ {
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
{"vout", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The output number"}, {"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
{"sequence", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "depends on the value of the 'replaceable' and 'locktime' arguments", "The sequence number"}, {"sequence", RPCArg::Type::NUM, /* default */ "depends on the value of the 'replaceable' and 'locktime' arguments", "The sequence number"},
}, },
}, },
}, },
}, },
{"outputs", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "a json array with outputs (key-value pairs), where none of the keys are duplicated.\n" {"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "a json array with outputs (key-value pairs), where none of the keys are duplicated.\n"
"That is, each address can only appear once and there can only be one 'data' object.\n" "That is, each address can only appear once and there can only be one 'data' object.\n"
"For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n" "For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n"
" accepted as second parameter.", " accepted as second parameter.",
{ {
{"", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "", "", {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{ {
{"address", RPCArg::Type::AMOUNT, /* opt */ false, /* default_val */ "", "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT}, {"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT},
}, },
}, },
{"", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "", "", {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{ {
{"data", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "A key-value pair. The key must be \"data\", the value is hex-encoded data"}, {"data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A key-value pair. The key must be \"data\", the value is hex-encoded data"},
}, },
}, },
}, },
}, },
{"locktime", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Raw locktime. Non-0 value also locktime-activates inputs"}, {"locktime", RPCArg::Type::NUM, /* default */ "0", "Raw locktime. Non-0 value also locktime-activates inputs"},
{"replaceable", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Marks this transaction as BIP125-replaceable.\n" {"replaceable", RPCArg::Type::BOOL, /* default */ "false", "Marks this transaction as BIP125-replaceable.\n"
" Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."}, " Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."},
}, },
RPCResult{ RPCResult{
@ -536,8 +536,8 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
RPCHelpMan{"decoderawtransaction", RPCHelpMan{"decoderawtransaction",
"\nReturn a JSON object representing the serialized, hex-encoded transaction.\n", "\nReturn a JSON object representing the serialized, hex-encoded transaction.\n",
{ {
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction hex string"}, {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction hex string"},
{"iswitness", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "depends on heuristic tests", "Whether the transaction hex is a serialized witness transaction\n" {"iswitness", RPCArg::Type::BOOL, /* default */ "depends on heuristic tests", "Whether the transaction hex is a serialized witness transaction\n"
" If iswitness is not present, heuristic tests will be used in decoding"}, " If iswitness is not present, heuristic tests will be used in decoding"},
}, },
RPCResult{ RPCResult{
@ -611,7 +611,7 @@ static UniValue decodescript(const JSONRPCRequest& request)
RPCHelpMan{"decodescript", RPCHelpMan{"decodescript",
"\nDecode a hex-encoded script.\n", "\nDecode a hex-encoded script.\n",
{ {
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "the hex-encoded script"}, {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hex-encoded script"},
}, },
RPCResult{ RPCResult{
"{\n" "{\n"
@ -711,9 +711,9 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
"The combined transaction may be another partially signed transaction or a \n" "The combined transaction may be another partially signed transaction or a \n"
"fully signed transaction.", "fully signed transaction.",
{ {
{"txs", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "A json array of hex strings of partially signed transactions", {"txs", RPCArg::Type::ARR, RPCArg::Optional::NO, "A json array of hex strings of partially signed transactions",
{ {
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "A transaction hash"}, {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A transaction hash"},
}, },
}, },
}, },
@ -936,26 +936,26 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
"The third optional argument (may be null) is an array of previous transaction outputs that\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", "this transaction depends on but may not yet be in the block chain.\n",
{ {
{"hexstring", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The transaction hex string"}, {"hexstring", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction hex string"},
{"privkeys", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "A json array of base58-encoded private keys for signing", {"privkeys", RPCArg::Type::ARR, RPCArg::Optional::NO, "A json array of base58-encoded private keys for signing",
{ {
{"privatekey", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "private key in base58-encoding"}, {"privatekey", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "private key in base58-encoding"},
}, },
}, },
{"prevtxs", RPCArg::Type::ARR, /* opt */ true, /* default_val */ "null", "A json array of previous dependent transaction outputs", {"prevtxs", RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, "A json array of previous dependent transaction outputs",
{ {
{"", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "", "", {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{ {
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
{"vout", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The output number"}, {"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
{"scriptPubKey", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "script key"}, {"scriptPubKey", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "script key"},
{"redeemScript", RPCArg::Type::STR_HEX, /* opt */ true, /* default_val */ "omitted", "(required for P2SH or P2WSH) redeem script"}, {"redeemScript", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "(required for P2SH or P2WSH) redeem script"},
{"amount", RPCArg::Type::AMOUNT, /* opt */ false, /* default_val */ "", "The amount spent"}, {"amount", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "The amount spent"},
}, },
}, },
}, },
}, },
{"sighashtype", RPCArg::Type::STR, /* opt */ true, /* default_val */ "ALL", "The signature hash type. Must be one of:\n" {"sighashtype", RPCArg::Type::STR, /* default */ "ALL", "The signature hash type. Must be one of:\n"
" \"ALL\"\n" " \"ALL\"\n"
" \"NONE\"\n" " \"NONE\"\n"
" \"SINGLE\"\n" " \"SINGLE\"\n"
@ -1023,8 +1023,8 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
"\nSubmits raw transaction (serialized, hex-encoded) to local node and network.\n" "\nSubmits raw transaction (serialized, hex-encoded) to local node and network.\n"
"\nAlso see createrawtransaction and signrawtransactionwithkey calls.\n", "\nAlso see createrawtransaction and signrawtransactionwithkey calls.\n",
{ {
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex string of the raw transaction"}, {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex string of the raw transaction"},
{"allowhighfees", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Allow high fees"}, {"allowhighfees", RPCArg::Type::BOOL, /* default */ "false", "Allow high fees"},
}, },
RPCResult{ RPCResult{
"\"hex\" (string) The transaction hash in hex\n" "\"hex\" (string) The transaction hash in hex\n"
@ -1122,13 +1122,13 @@ static UniValue testmempoolaccept(const JSONRPCRequest& request)
"\nThis checks if the transaction violates the consensus or policy rules.\n" "\nThis checks if the transaction violates the consensus or policy rules.\n"
"\nSee sendrawtransaction call.\n", "\nSee sendrawtransaction call.\n",
{ {
{"rawtxs", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "An array of hex strings of raw transactions.\n" {"rawtxs", RPCArg::Type::ARR, RPCArg::Optional::NO, "An array of hex strings of raw transactions.\n"
" Length must be one for now.", " Length must be one for now.",
{ {
{"rawtx", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", ""}, {"rawtx", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, ""},
}, },
}, },
{"allowhighfees", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Allow high fees"}, {"allowhighfees", RPCArg::Type::BOOL, /* default */ "false", "Allow high fees"},
}, },
RPCResult{ RPCResult{
"[ (array) The result of the mempool acceptance test for each raw transaction in the input array.\n" "[ (array) The result of the mempool acceptance test for each raw transaction in the input array.\n"
@ -1223,7 +1223,7 @@ UniValue decodepsbt(const JSONRPCRequest& request)
RPCHelpMan{"decodepsbt", RPCHelpMan{"decodepsbt",
"\nReturn a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction.\n", "\nReturn a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction.\n",
{ {
{"psbt", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The PSBT base64 string"}, {"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, "The PSBT base64 string"},
}, },
RPCResult{ RPCResult{
"{\n" "{\n"
@ -1499,9 +1499,9 @@ UniValue combinepsbt(const JSONRPCRequest& request)
"\nCombine multiple partially signed Bitcoin transactions into one transaction.\n" "\nCombine multiple partially signed Bitcoin transactions into one transaction.\n"
"Implements the Combiner role.\n", "Implements the Combiner role.\n",
{ {
{"txs", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "A json array of base64 strings of partially signed transactions", {"txs", RPCArg::Type::ARR, RPCArg::Optional::NO, "A json array of base64 strings of partially signed transactions",
{ {
{"psbt", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "A base64 string of a PSBT"}, {"psbt", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "A base64 string of a PSBT"},
}, },
}, },
}, },
@ -1559,8 +1559,8 @@ UniValue finalizepsbt(const JSONRPCRequest& request)
"created which has the final_scriptSig and final_scriptWitness fields filled for inputs that are complete.\n" "created which has the final_scriptSig and final_scriptWitness fields filled for inputs that are complete.\n"
"Implements the Finalizer and Extractor roles.\n", "Implements the Finalizer and Extractor roles.\n",
{ {
{"psbt", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "A base64 string of a PSBT"}, {"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, "A base64 string of a PSBT"},
{"extract", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "If true and the transaction is complete,\n" {"extract", RPCArg::Type::BOOL, /* default */ "true", "If true and the transaction is complete,\n"
" extract and return the complete transaction in normal network serialization instead of the PSBT."}, " extract and return the complete transaction in normal network serialization instead of the PSBT."},
}, },
RPCResult{ RPCResult{
@ -1622,36 +1622,36 @@ UniValue createpsbt(const JSONRPCRequest& request)
"\nCreates a transaction in the Partially Signed Transaction format.\n" "\nCreates a transaction in the Partially Signed Transaction format.\n"
"Implements the Creator role.\n", "Implements the Creator role.\n",
{ {
{"inputs", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "A json array of json objects", {"inputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "A json array of json objects",
{ {
{"", RPCArg::Type::OBJ, /* opt */ false, /* default_val */ "", "", {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{ {
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
{"vout", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The output number"}, {"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
{"sequence", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "depends on the value of the 'replaceable' and 'locktime' arguments", "The sequence number"}, {"sequence", RPCArg::Type::NUM, /* default */ "depends on the value of the 'replaceable' and 'locktime' arguments", "The sequence number"},
}, },
}, },
}, },
}, },
{"outputs", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "a json array with outputs (key-value pairs), where none of the keys are duplicated.\n" {"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "a json array with outputs (key-value pairs), where none of the keys are duplicated.\n"
"That is, each address can only appear once and there can only be one 'data' object.\n" "That is, each address can only appear once and there can only be one 'data' object.\n"
"For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n" "For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n"
" accepted as second parameter.", " accepted as second parameter.",
{ {
{"", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "", "", {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{ {
{"address", RPCArg::Type::AMOUNT, /* opt */ false, /* default_val */ "", "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT}, {"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT},
}, },
}, },
{"", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "", "", {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{ {
{"data", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "A key-value pair. The key must be \"data\", the value is hex-encoded data"}, {"data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A key-value pair. The key must be \"data\", the value is hex-encoded data"},
}, },
}, },
}, },
}, },
{"locktime", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Raw locktime. Non-0 value also locktime-activates inputs"}, {"locktime", RPCArg::Type::NUM, /* default */ "0", "Raw locktime. Non-0 value also locktime-activates inputs"},
{"replaceable", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Marks this transaction as BIP125 replaceable.\n" {"replaceable", RPCArg::Type::BOOL, /* default */ "false", "Marks this transaction as BIP125 replaceable.\n"
" Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."}, " Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."},
}, },
RPCResult{ RPCResult{
@ -1698,10 +1698,10 @@ UniValue converttopsbt(const JSONRPCRequest& request)
"\nConverts a network serialized transaction to a PSBT. This should be used only with createrawtransaction and fundrawtransaction\n" "\nConverts a network serialized transaction to a PSBT. This should be used only with createrawtransaction and fundrawtransaction\n"
"createpsbt and walletcreatefundedpsbt should be used for new applications.\n", "createpsbt and walletcreatefundedpsbt should be used for new applications.\n",
{ {
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex string of a raw transaction"}, {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex string of a raw transaction"},
{"permitsigdata", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "If true, any signatures in the input will be discarded and conversion.\n" {"permitsigdata", RPCArg::Type::BOOL, /* default */ "false", "If true, any signatures in the input will be discarded and conversion.\n"
" will continue. If false, RPC will fail if any signatures are present."}, " will continue. If false, RPC will fail if any signatures are present."},
{"iswitness", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "depends on heuristic tests", "Whether the transaction hex is a serialized witness transaction.\n" {"iswitness", RPCArg::Type::BOOL, /* default */ "depends on heuristic tests", "Whether the transaction hex is a serialized witness transaction.\n"
" If iswitness is not present, heuristic tests will be used in decoding. If true, only witness deserializaion\n" " If iswitness is not present, heuristic tests will be used in decoding. If true, only witness deserializaion\n"
" will be tried. If false, only non-witness deserialization will be tried. Only has an effect if\n" " will be tried. If false, only non-witness deserialization will be tried. Only has an effect if\n"
" permitsigdata is true."}, " permitsigdata is true."},

View file

@ -230,7 +230,7 @@ UniValue help(const JSONRPCRequest& jsonRequest)
RPCHelpMan{"help", RPCHelpMan{"help",
"\nList all commands, or get help for a specified command.\n", "\nList all commands, or get help for a specified command.\n",
{ {
{"command", RPCArg::Type::STR, /* opt */ true, /* default_val */ "all commands", "The command to get help on"}, {"command", RPCArg::Type::STR, /* default */ "all commands", "The command to get help on"},
}, },
RPCResult{ RPCResult{
"\"text\" (string) The help text\n" "\"text\" (string) The help text\n"

View file

@ -170,12 +170,12 @@ struct Sections {
left += outer_type == OuterType::OBJ ? arg.ToStringObj(/* oneline */ false) : arg.ToString(/* oneline */ false); left += outer_type == OuterType::OBJ ? arg.ToStringObj(/* oneline */ false) : arg.ToString(/* oneline */ false);
} }
left += ","; left += ",";
PushSection({left, arg.ToDescriptionString(/* implicitly_required */ outer_type == OuterType::ARR)}); PushSection({left, arg.ToDescriptionString()});
break; break;
} }
case RPCArg::Type::OBJ: case RPCArg::Type::OBJ:
case RPCArg::Type::OBJ_USER_KEYS: { case RPCArg::Type::OBJ_USER_KEYS: {
const auto right = outer_type == OuterType::NAMED_ARG ? "" : arg.ToDescriptionString(/* implicitly_required */ outer_type == OuterType::ARR); const auto right = outer_type == OuterType::NAMED_ARG ? "" : arg.ToDescriptionString();
PushSection({indent + "{", right}); PushSection({indent + "{", right});
for (const auto& arg_inner : arg.m_inner) { for (const auto& arg_inner : arg.m_inner) {
Push(arg_inner, current_indent + 2, OuterType::OBJ); Push(arg_inner, current_indent + 2, OuterType::OBJ);
@ -190,7 +190,7 @@ struct Sections {
auto left = indent; auto left = indent;
left += outer_type == OuterType::OBJ ? "\"" + arg.m_name + "\": " : ""; left += outer_type == OuterType::OBJ ? "\"" + arg.m_name + "\": " : "";
left += "["; left += "[";
const auto right = outer_type == OuterType::NAMED_ARG ? "" : arg.ToDescriptionString(/* implicitly_required */ outer_type == OuterType::ARR); const auto right = outer_type == OuterType::NAMED_ARG ? "" : arg.ToDescriptionString();
PushSection({left, right}); PushSection({left, right});
for (const auto& arg_inner : arg.m_inner) { for (const auto& arg_inner : arg.m_inner) {
Push(arg_inner, current_indent + 2, OuterType::ARR); Push(arg_inner, current_indent + 2, OuterType::ARR);
@ -283,8 +283,14 @@ std::string RPCHelpMan::ToString() const
ret += m_name; ret += m_name;
bool was_optional{false}; bool was_optional{false};
for (const auto& arg : m_args) { for (const auto& arg : m_args) {
bool optional;
if (arg.m_fallback.which() == 1) {
optional = true;
} else {
optional = RPCArg::Optional::NO != boost::get<RPCArg::Optional>(arg.m_fallback);
}
ret += " "; ret += " ";
if (arg.m_optional) { if (optional) {
if (!was_optional) ret += "( "; if (!was_optional) ret += "( ";
was_optional = true; was_optional = true;
} else { } else {
@ -324,7 +330,7 @@ std::string RPCHelpMan::ToString() const
return ret; return ret;
} }
std::string RPCArg::ToDescriptionString(const bool implicitly_required) const std::string RPCArg::ToDescriptionString() const
{ {
std::string ret; std::string ret;
ret += "("; ret += "(";
@ -362,19 +368,24 @@ std::string RPCArg::ToDescriptionString(const bool implicitly_required) const
// no default case, so the compiler can warn about missing cases // no default case, so the compiler can warn about missing cases
} }
} }
if (!implicitly_required) { if (m_fallback.which() == 1) {
ret += ", "; ret += ", optional, default=" + boost::get<std::string>(m_fallback);
if (m_optional) { } else {
ret += "optional"; switch (boost::get<RPCArg::Optional>(m_fallback)) {
if (!m_default_value.empty()) { case RPCArg::Optional::OMITTED: {
ret += ", default=" + m_default_value; // nothing to do. Element is treated as if not present and has no default value
} else { break;
// TODO enable this assert, when all optional parameters have their default value documented }
//assert(false); case RPCArg::Optional::OMITTED_NAMED_ARG: {
} ret += ", optional"; // Default value is "null"
} else { break;
ret += "required"; }
assert(m_default_value.empty()); // Default value is ignored, and must not be present case RPCArg::Optional::NO: {
ret += ", required";
break;
}
// no default case, so the compiler can warn about missing cases
} }
} }
ret += ")"; ret += ")";

View file

@ -12,6 +12,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <boost/variant.hpp>
class CKeyStore; class CKeyStore;
class CPubKey; class CPubKey;
class CScript; class CScript;
@ -39,11 +41,28 @@ struct RPCArg {
AMOUNT, //!< Special type representing a floating point amount (can be either NUM or STR) AMOUNT, //!< Special type representing a floating point amount (can be either NUM or STR)
STR_HEX, //!< Special type that is a STR with only hex chars STR_HEX, //!< Special type that is a STR with only hex chars
}; };
enum class Optional {
/** Required arg */
NO,
/**
* Optinal arg that is a named argument and has a default value of
* `null`. When possible, the default value should be specified.
*/
OMITTED_NAMED_ARG,
/**
* Optional argument with default value omitted because they are
* implicitly clear. That is, elements in an array or object may not
* exist by default.
* When possible, the default value should be specified.
*/
OMITTED,
};
using Fallback = boost::variant<Optional, /* default value for optional args */ std::string>;
const std::string m_name; //!< The name of the arg (can be empty for inner args) const std::string m_name; //!< The name of the arg (can be empty for inner args)
const Type m_type; const Type m_type;
const std::vector<RPCArg> m_inner; //!< Only used for arrays or dicts const std::vector<RPCArg> m_inner; //!< Only used for arrays or dicts
const bool m_optional; const Fallback m_fallback;
const std::string m_default_value; //!< Only used for optional args
const std::string m_description; const std::string m_description;
const std::string m_oneline_description; //!< Should be empty unless it is supposed to override the auto-generated summary line const std::string m_oneline_description; //!< Should be empty unless it is supposed to override the auto-generated summary line
const std::vector<std::string> m_type_str; //!< Should be empty unless it is supposed to override the auto-generated type strings. Vector length is either 0 or 2, m_type_str.at(0) will override the type of the value in a key-value pair, m_type_str.at(1) will override the type in the argument description. const std::vector<std::string> m_type_str; //!< Should be empty unless it is supposed to override the auto-generated type strings. Vector length is either 0 or 2, m_type_str.at(0) will override the type of the value in a key-value pair, m_type_str.at(1) will override the type in the argument description.
@ -51,15 +70,13 @@ struct RPCArg {
RPCArg( RPCArg(
const std::string& name, const std::string& name,
const Type& type, const Type& type,
const bool opt, const Fallback& fallback,
const std::string& default_val,
const std::string& description, const std::string& description,
const std::string& oneline_description = "", const std::string& oneline_description = "",
const std::vector<std::string>& type_str = {}) const std::vector<std::string>& type_str = {})
: m_name{name}, : m_name{name},
m_type{type}, m_type{type},
m_optional{opt}, m_fallback{fallback},
m_default_value{default_val},
m_description{description}, m_description{description},
m_oneline_description{oneline_description}, m_oneline_description{oneline_description},
m_type_str{type_str} m_type_str{type_str}
@ -70,8 +87,7 @@ struct RPCArg {
RPCArg( RPCArg(
const std::string& name, const std::string& name,
const Type& type, const Type& type,
const bool opt, const Fallback& fallback,
const std::string& default_val,
const std::string& description, const std::string& description,
const std::vector<RPCArg>& inner, const std::vector<RPCArg>& inner,
const std::string& oneline_description = "", const std::string& oneline_description = "",
@ -79,8 +95,7 @@ struct RPCArg {
: m_name{name}, : m_name{name},
m_type{type}, m_type{type},
m_inner{inner}, m_inner{inner},
m_optional{opt}, m_fallback{fallback},
m_default_value{default_val},
m_description{description}, m_description{description},
m_oneline_description{oneline_description}, m_oneline_description{oneline_description},
m_type_str{type_str} m_type_str{type_str}
@ -101,9 +116,8 @@ struct RPCArg {
/** /**
* Return the description string, including the argument type and whether * Return the description string, including the argument type and whether
* the argument is required. * the argument is required.
* implicitly_required is set for arguments in an array, which are neither optional nor required.
*/ */
std::string ToDescriptionString(bool implicitly_required = false) const; std::string ToDescriptionString() const;
}; };
struct RPCResult { struct RPCResult {

View file

@ -116,9 +116,9 @@ UniValue importprivkey(const JSONRPCRequest& request)
"\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n" "\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
"may report that the imported key exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n", "may report that the imported key exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n",
{ {
{"privkey", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The private key (see dumpprivkey)"}, {"privkey", RPCArg::Type::STR, RPCArg::Optional::NO, "The private key (see dumpprivkey)"},
{"label", RPCArg::Type::STR, /* opt */ true, /* default_val */ "current label if address exists, otherwise \"\"", "An optional label"}, {"label", RPCArg::Type::STR, /* default */ "current label if address exists, otherwise \"\"", "An optional label"},
{"rescan", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Rescan the wallet for transactions"}, {"rescan", RPCArg::Type::BOOL, /* default */ "true", "Rescan the wallet for transactions"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -286,10 +286,10 @@ UniValue importaddress(const JSONRPCRequest& request)
"\nNote: If you import a non-standard raw script in hex form, outputs sending to it will be treated\n" "\nNote: If you import a non-standard raw script in hex form, outputs sending to it will be treated\n"
"as change, and not show up in many RPCs.\n", "as change, and not show up in many RPCs.\n",
{ {
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The Bitcoin address (or hex-encoded script)"}, {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The Bitcoin address (or hex-encoded script)"},
{"label", RPCArg::Type::STR, /* opt */ true, /* default_val */ "\"\"", "An optional label"}, {"label", RPCArg::Type::STR, /* default */ "\"\"", "An optional label"},
{"rescan", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Rescan the wallet for transactions"}, {"rescan", RPCArg::Type::BOOL, /* default */ "true", "Rescan the wallet for transactions"},
{"p2sh", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Add the P2SH version of the script as well"}, {"p2sh", RPCArg::Type::BOOL, /* default */ "false", "Add the P2SH version of the script as well"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -364,8 +364,8 @@ UniValue importprunedfunds(const JSONRPCRequest& request)
RPCHelpMan{"importprunedfunds", RPCHelpMan{"importprunedfunds",
"\nImports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets. The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.\n", "\nImports funds without rescan. Corresponding address or script must previously be included in wallet. Aimed towards pruned wallets. The end-user is responsible to import additional transactions that subsequently spend the imported outputs or rescan after the point in the blockchain the transaction is included.\n",
{ {
{"rawtransaction", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "A raw transaction in hex funding an already-existing address in wallet"}, {"rawtransaction", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A raw transaction in hex funding an already-existing address in wallet"},
{"txoutproof", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex output from gettxoutproof that contains the transaction"}, {"txoutproof", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex output from gettxoutproof that contains the transaction"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{""}, RPCExamples{""},
@ -431,7 +431,7 @@ UniValue removeprunedfunds(const JSONRPCRequest& request)
RPCHelpMan{"removeprunedfunds", RPCHelpMan{"removeprunedfunds",
"\nDeletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.\n", "\nDeletes the specified transaction from the wallet. Meant for use with pruned wallets and as a companion to importprunedfunds. This will affect wallet balances.\n",
{ {
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex-encoded id of the transaction you are deleting"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex-encoded id of the transaction you are deleting"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -475,9 +475,9 @@ UniValue importpubkey(const JSONRPCRequest& request)
"\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n" "\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
"may report that the imported pubkey exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n", "may report that the imported pubkey exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n",
{ {
{"pubkey", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The hex-encoded public key"}, {"pubkey", RPCArg::Type::STR, RPCArg::Optional::NO, "The hex-encoded public key"},
{"label", RPCArg::Type::STR, /* opt */ true, /* default_val */ "\"\"", "An optional label"}, {"label", RPCArg::Type::STR, /* default */ "\"\"", "An optional label"},
{"rescan", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Rescan the wallet for transactions"}, {"rescan", RPCArg::Type::BOOL, /* default */ "true", "Rescan the wallet for transactions"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -548,7 +548,7 @@ UniValue importwallet(const JSONRPCRequest& request)
RPCHelpMan{"importwallet", RPCHelpMan{"importwallet",
"\nImports keys from a wallet dump file (see dumpwallet). Requires a new wallet backup to include imported keys.\n", "\nImports keys from a wallet dump file (see dumpwallet). Requires a new wallet backup to include imported keys.\n",
{ {
{"filename", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The wallet file"}, {"filename", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet file"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -709,7 +709,7 @@ UniValue dumpprivkey(const JSONRPCRequest& request)
"\nReveals the private key corresponding to 'address'.\n" "\nReveals the private key corresponding to 'address'.\n"
"Then the importprivkey can be used with this output\n", "Then the importprivkey can be used with this output\n",
{ {
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The bitcoin address for the private key"}, {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address for the private key"},
}, },
RPCResult{ RPCResult{
"\"key\" (string) The private key\n" "\"key\" (string) The private key\n"
@ -759,7 +759,7 @@ UniValue dumpwallet(const JSONRPCRequest& request)
"Note that if your wallet contains keys which are not derived from your HD seed (e.g. imported keys), these are not covered by\n" "Note that if your wallet contains keys which are not derived from your HD seed (e.g. imported keys), these are not covered by\n"
"only backing up the seed itself, and must be backed up too (e.g. ensure you back up the whole dumpfile).\n", "only backing up the seed itself, and must be backed up too (e.g. ensure you back up the whole dumpfile).\n",
{ {
{"filename", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The filename with path (either absolute or relative to bitcoind)"}, {"filename", RPCArg::Type::STR, RPCArg::Optional::NO, "The filename with path (either absolute or relative to bitcoind)"},
}, },
RPCResult{ RPCResult{
"{ (json object)\n" "{ (json object)\n"
@ -1319,15 +1319,15 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
"\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n" "\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
"may report that the imported keys, addresses or scripts exists but related transactions are still missing.\n", "may report that the imported keys, addresses or scripts exists but related transactions are still missing.\n",
{ {
{"requests", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "Data to be imported", {"requests", RPCArg::Type::ARR, RPCArg::Optional::NO, "Data to be imported",
{ {
{"", RPCArg::Type::OBJ, /* opt */ false, /* default_val */ "", "", {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{ {
{"desc", RPCArg::Type::STR, /* opt */ true, /* default_val */ "", "Descriptor to import. If using descriptor, do not also provide address/scriptPubKey, scripts, or pubkeys"}, {"desc", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Descriptor to import. If using descriptor, do not also provide address/scriptPubKey, scripts, or pubkeys"},
{"scriptPubKey", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "Type of scriptPubKey (string for script, json for address). Should not be provided if using a descriptor", {"scriptPubKey", RPCArg::Type::STR, RPCArg::Optional::NO, "Type of scriptPubKey (string for script, json for address). Should not be provided if using a descriptor",
/* oneline_description */ "", {"\"<script>\" | { \"address\":\"<address>\" }", "string / json"} /* oneline_description */ "", {"\"<script>\" | { \"address\":\"<address>\" }", "string / json"}
}, },
{"timestamp", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "Creation time of the key in seconds since epoch (Jan 1 1970 GMT),\n" {"timestamp", RPCArg::Type::NUM, RPCArg::Optional::NO, "Creation time of the key in seconds since epoch (Jan 1 1970 GMT),\n"
" or the string \"now\" to substitute the current synced blockchain time. The timestamp of the oldest\n" " or the string \"now\" to substitute the current synced blockchain time. The timestamp of the oldest\n"
" key will determine how far back blockchain rescans need to begin for missing wallet transactions.\n" " key will determine how far back blockchain rescans need to begin for missing wallet transactions.\n"
" \"now\" can be specified to bypass scanning, for keys which are known to never have been used, and\n" " \"now\" can be specified to bypass scanning, for keys which are known to never have been used, and\n"
@ -1335,34 +1335,34 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
" creation time of all keys being imported by the importmulti call will be scanned.", " creation time of all keys being imported by the importmulti call will be scanned.",
/* oneline_description */ "", {"timestamp | \"now\"", "integer / string"} /* oneline_description */ "", {"timestamp | \"now\"", "integer / string"}
}, },
{"redeemscript", RPCArg::Type::STR, /* opt */ true, /* default_val */ "omitted", "Allowed only if the scriptPubKey is a P2SH or P2SH-P2WSH address/scriptPubKey"}, {"redeemscript", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Allowed only if the scriptPubKey is a P2SH or P2SH-P2WSH address/scriptPubKey"},
{"witnessscript", RPCArg::Type::STR, /* opt */ true, /* default_val */ "omitted", "Allowed only if the scriptPubKey is a P2SH-P2WSH or P2WSH address/scriptPubKey"}, {"witnessscript", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Allowed only if the scriptPubKey is a P2SH-P2WSH or P2WSH address/scriptPubKey"},
{"pubkeys", RPCArg::Type::ARR, /* opt */ true, /* default_val */ "empty array", "Array of strings giving pubkeys to import. They must occur in P2PKH or P2WPKH scripts. They are not required when the private key is also provided (see the \"keys\" argument).", {"pubkeys", RPCArg::Type::ARR, /* default */ "empty array", "Array of strings giving pubkeys to import. They must occur in P2PKH or P2WPKH scripts. They are not required when the private key is also provided (see the \"keys\" argument).",
{ {
{"pubKey", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", ""}, {"pubKey", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""},
} }
}, },
{"keys", RPCArg::Type::ARR, /* opt */ true, /* default_val */ "empty array", "Array of strings giving private keys to import. The corresponding public keys must occur in the output or redeemscript.", {"keys", RPCArg::Type::ARR, /* default */ "empty array", "Array of strings giving private keys to import. The corresponding public keys must occur in the output or redeemscript.",
{ {
{"key", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", ""}, {"key", RPCArg::Type::STR, RPCArg::Optional::OMITTED, ""},
} }
}, },
{"range", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "", "If a ranged descriptor is used, this specifies the start and end of the range to import", {"range", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "If a ranged descriptor is used, this specifies the start and end of the range to import",
{ {
{"start", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Start of the range to import"}, {"start", RPCArg::Type::NUM, /* default */ "0", "Start of the range to import"},
{"end", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "End of the range to import (inclusive)"}, {"end", RPCArg::Type::NUM, RPCArg::Optional::NO, "End of the range to import (inclusive)"},
} }
}, },
{"internal", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Stating whether matching outputs should be treated as not incoming payments (also known as change)"}, {"internal", RPCArg::Type::BOOL, /* default */ "false", "Stating whether matching outputs should be treated as not incoming payments (also known as change)"},
{"watchonly", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Stating whether matching outputs should be considered watchonly."}, {"watchonly", RPCArg::Type::BOOL, /* default */ "false", "Stating whether matching outputs should be considered watchonly."},
{"label", RPCArg::Type::STR, /* opt */ true, /* default_val */ "''", "Label to assign to the address, only allowed with internal=false"}, {"label", RPCArg::Type::STR, /* default */ "''", "Label to assign to the address, only allowed with internal=false"},
}, },
}, },
}, },
"\"requests\""}, "\"requests\""},
{"options", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "null", "", {"options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "",
{ {
{"rescan", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Stating if should rescan the blockchain after all imports"}, {"rescan", RPCArg::Type::BOOL, /* default */ "true", "Stating if should rescan the blockchain after all imports"},
}, },
"\"options\""}, "\"options\""},
}, },

View file

@ -158,8 +158,8 @@ static UniValue getnewaddress(const JSONRPCRequest& request)
"If 'label' is specified, it is added to the address book \n" "If 'label' is specified, it is added to the address book \n"
"so payments received with the address will be associated with 'label'.\n", "so payments received with the address will be associated with 'label'.\n",
{ {
{"label", RPCArg::Type::STR, /* opt */ true, /* default_val */ "null", "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."}, {"label", RPCArg::Type::STR, /* default */ "\"\"", "The label name for the address to be linked to. 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."},
{"address_type", RPCArg::Type::STR, /* opt */ true, /* default_val */ "set by -addresstype", "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."}, {"address_type", RPCArg::Type::STR, /* default */ "set by -addresstype", "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
}, },
RPCResult{ RPCResult{
"\"address\" (string) The new bitcoin address\n" "\"address\" (string) The new bitcoin address\n"
@ -226,7 +226,7 @@ static UniValue getrawchangeaddress(const JSONRPCRequest& request)
"\nReturns a new Bitcoin address, for receiving change.\n" "\nReturns a new Bitcoin address, for receiving change.\n"
"This is for use with raw transactions, NOT normal use.\n", "This is for use with raw transactions, NOT normal use.\n",
{ {
{"address_type", RPCArg::Type::STR, /* opt */ true, /* default_val */ "set by -changetype", "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."}, {"address_type", RPCArg::Type::STR, /* default */ "set by -changetype", "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
}, },
RPCResult{ RPCResult{
"\"address\" (string) The address\n" "\"address\" (string) The address\n"
@ -287,8 +287,8 @@ static UniValue setlabel(const JSONRPCRequest& request)
RPCHelpMan{"setlabel", RPCHelpMan{"setlabel",
"\nSets the label associated with the given address.\n", "\nSets the label associated with the given address.\n",
{ {
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The bitcoin address to be associated with a label."}, {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address to be associated with a label."},
{"label", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The label to assign to the address."}, {"label", RPCArg::Type::STR, RPCArg::Optional::NO, "The label to assign to the address."},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -371,18 +371,18 @@ static UniValue sendtoaddress(const JSONRPCRequest& request)
"\nSend an amount to a given address." + "\nSend an amount to a given address." +
HelpRequiringPassphrase(pwallet) + "\n", HelpRequiringPassphrase(pwallet) + "\n",
{ {
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The bitcoin address to send to."}, {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address to send to."},
{"amount", RPCArg::Type::AMOUNT, /* opt */ false, /* default_val */ "", "The amount in " + CURRENCY_UNIT + " to send. eg 0.1"}, {"amount", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "The amount in " + CURRENCY_UNIT + " to send. eg 0.1"},
{"comment", RPCArg::Type::STR, /* opt */ true, /* default_val */ "null", "A comment used to store what the transaction is for.\n" {"comment", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "A comment used to store what the transaction is for.\n"
" This is not part of the transaction, just kept in your wallet."}, " This is not part of the transaction, just kept in your wallet."},
{"comment_to", RPCArg::Type::STR, /* opt */ true, /* default_val */ "null", "A comment to store the name of the person or organization\n" {"comment_to", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "A comment to store the name of the person or organization\n"
" to which you're sending the transaction. This is not part of the \n" " to which you're sending the transaction. This is not part of the \n"
" transaction, just kept in your wallet."}, " transaction, just kept in your wallet."},
{"subtractfeefromamount", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "The fee will be deducted from the amount being sent.\n" {"subtractfeefromamount", RPCArg::Type::BOOL, /* default */ "false", "The fee will be deducted from the amount being sent.\n"
" The recipient will receive less bitcoins than you enter in the amount field."}, " The recipient will receive less bitcoins than you enter in the amount field."},
{"replaceable", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "fallback to wallet's default", "Allow this transaction to be replaced by a transaction with higher fees via BIP 125"}, {"replaceable", RPCArg::Type::BOOL, /* default */ "fallback to wallet's default", "Allow this transaction to be replaced by a transaction with higher fees via BIP 125"},
{"conf_target", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "fallback to wallet's default", "Confirmation target (in blocks)"}, {"conf_target", RPCArg::Type::NUM, /* default */ "fallback to wallet's default", "Confirmation target (in blocks)"},
{"estimate_mode", RPCArg::Type::STR, /* opt */ true, /* default_val */ "UNSET", "The fee estimate mode, must be one of:\n" {"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n"
" \"UNSET\"\n" " \"UNSET\"\n"
" \"ECONOMICAL\"\n" " \"ECONOMICAL\"\n"
" \"CONSERVATIVE\""}, " \"CONSERVATIVE\""},
@ -527,8 +527,8 @@ static UniValue signmessage(const JSONRPCRequest& request)
"\nSign a message with the private key of an address" + "\nSign a message with the private key of an address" +
HelpRequiringPassphrase(pwallet) + "\n", HelpRequiringPassphrase(pwallet) + "\n",
{ {
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The bitcoin address to use for the private key."}, {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address to use for the private key."},
{"message", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The message to create a signature of."}, {"message", RPCArg::Type::STR, RPCArg::Optional::NO, "The message to create a signature of."},
}, },
RPCResult{ RPCResult{
"\"signature\" (string) The signature of the message encoded in base 64\n" "\"signature\" (string) The signature of the message encoded in base 64\n"
@ -593,8 +593,8 @@ static UniValue getreceivedbyaddress(const JSONRPCRequest& request)
RPCHelpMan{"getreceivedbyaddress", RPCHelpMan{"getreceivedbyaddress",
"\nReturns the total amount received by the given address in transactions with at least minconf confirmations.\n", "\nReturns the total amount received by the given address in transactions with at least minconf confirmations.\n",
{ {
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The bitcoin address for transactions."}, {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address for transactions."},
{"minconf", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1", "Only include transactions confirmed at least this many times."}, {"minconf", RPCArg::Type::NUM, /* default */ "1", "Only include transactions confirmed at least this many times."},
}, },
RPCResult{ RPCResult{
"amount (numeric) The total amount in " + CURRENCY_UNIT + " received at this address.\n" "amount (numeric) The total amount in " + CURRENCY_UNIT + " received at this address.\n"
@ -665,8 +665,8 @@ static UniValue getreceivedbylabel(const JSONRPCRequest& request)
RPCHelpMan{"getreceivedbylabel", RPCHelpMan{"getreceivedbylabel",
"\nReturns the total amount received by addresses with <label> in transactions with at least [minconf] confirmations.\n", "\nReturns the total amount received by addresses with <label> in transactions with at least [minconf] confirmations.\n",
{ {
{"label", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The selected label, may be the default label using \"\"."}, {"label", RPCArg::Type::STR, RPCArg::Optional::NO, "The selected label, may be the default label using \"\"."},
{"minconf", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1", "Only include transactions confirmed at least this many times."}, {"minconf", RPCArg::Type::NUM, /* default */ "1", "Only include transactions confirmed at least this many times."},
}, },
RPCResult{ RPCResult{
"amount (numeric) The total amount in " + CURRENCY_UNIT + " received for this label.\n" "amount (numeric) The total amount in " + CURRENCY_UNIT + " received for this label.\n"
@ -737,9 +737,9 @@ static UniValue getbalance(const JSONRPCRequest& request)
"The available balance is what the wallet considers currently spendable, and is\n" "The available balance is what the wallet considers currently spendable, and is\n"
"thus affected by options which limit spendability such as -spendzeroconfchange.\n", "thus affected by options which limit spendability such as -spendzeroconfchange.\n",
{ {
{"dummy", RPCArg::Type::STR, /* opt */ true, /* default_val */ "null", "Remains for backward compatibility. Must be excluded or set to \"*\"."}, {"dummy", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Remains for backward compatibility. Must be excluded or set to \"*\"."},
{"minconf", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Only include transactions confirmed at least this many times."}, {"minconf", RPCArg::Type::NUM, /* default */ "0", "Only include transactions confirmed at least this many times."},
{"include_watchonly", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Also include balance in watch-only addresses (see 'importaddress')"}, {"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", "Also include balance in watch-only addresses (see 'importaddress')"},
}, },
RPCResult{ RPCResult{
"amount (numeric) The total amount in " + CURRENCY_UNIT + " received for this wallet.\n" "amount (numeric) The total amount in " + CURRENCY_UNIT + " received for this wallet.\n"
@ -823,25 +823,25 @@ static UniValue sendmany(const JSONRPCRequest& request)
"\nSend multiple times. Amounts are double-precision floating point numbers." + "\nSend multiple times. Amounts are double-precision floating point numbers." +
HelpRequiringPassphrase(pwallet) + "\n", HelpRequiringPassphrase(pwallet) + "\n",
{ {
{"dummy", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "Must be set to \"\" for backwards compatibility.", "\"\""}, {"dummy", RPCArg::Type::STR, RPCArg::Optional::NO, "Must be set to \"\" for backwards compatibility.", "\"\""},
{"amounts", RPCArg::Type::OBJ, /* opt */ false, /* default_val */ "", "A json object with addresses and amounts", {"amounts", RPCArg::Type::OBJ, RPCArg::Optional::NO, "A json object with addresses and amounts",
{ {
{"address", RPCArg::Type::AMOUNT, /* opt */ false, /* default_val */ "", "The bitcoin address is the key, the numeric amount (can be string) in " + CURRENCY_UNIT + " is the value"}, {"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "The bitcoin address is the key, the numeric amount (can be string) in " + CURRENCY_UNIT + " is the value"},
}, },
}, },
{"minconf", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1", "Only use the balance confirmed at least this many times."}, {"minconf", RPCArg::Type::NUM, /* default */ "1", "Only use the balance confirmed at least this many times."},
{"comment", RPCArg::Type::STR, /* opt */ true, /* default_val */ "null", "A comment"}, {"comment", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "A comment"},
{"subtractfeefrom", RPCArg::Type::ARR, /* opt */ true, /* default_val */ "null", "A json array with addresses.\n" {"subtractfeefrom", RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, "A json array with addresses.\n"
" The fee will be equally deducted from the amount of each selected address.\n" " The fee will be equally deducted from the amount of each selected address.\n"
" Those recipients will receive less bitcoins than you enter in their corresponding amount field.\n" " Those recipients will receive less bitcoins than you enter in their corresponding amount field.\n"
" If no addresses are specified here, the sender pays the fee.", " If no addresses are specified here, the sender pays the fee.",
{ {
{"address", RPCArg::Type::STR, /* opt */ true, /* default_val */ "", "Subtract fee from this address"}, {"address", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Subtract fee from this address"},
}, },
}, },
{"replaceable", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "fallback to wallet's default", "Allow this transaction to be replaced by a transaction with higher fees via BIP 125"}, {"replaceable", RPCArg::Type::BOOL, /* default */ "fallback to wallet's default", "Allow this transaction to be replaced by a transaction with higher fees via BIP 125"},
{"conf_target", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "fallback to wallet's default", "Confirmation target (in blocks)"}, {"conf_target", RPCArg::Type::NUM, /* default */ "fallback to wallet's default", "Confirmation target (in blocks)"},
{"estimate_mode", RPCArg::Type::STR, /* opt */ true, /* default_val */ "UNSET", "The fee estimate mode, must be one of:\n" {"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n"
" \"UNSET\"\n" " \"UNSET\"\n"
" \"ECONOMICAL\"\n" " \"ECONOMICAL\"\n"
" \"CONSERVATIVE\""}, " \"CONSERVATIVE\""},
@ -983,14 +983,14 @@ static UniValue addmultisigaddress(const JSONRPCRequest& request)
"See `importaddress` for watchonly p2sh address support.\n" "See `importaddress` for watchonly p2sh address support.\n"
"If 'label' is specified, assign address to that label.\n", "If 'label' is specified, assign address to that label.\n",
{ {
{"nrequired", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The number of required signatures out of the n keys or addresses."}, {"nrequired", RPCArg::Type::NUM, RPCArg::Optional::NO, "The number of required signatures out of the n keys or addresses."},
{"keys", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "A json array of bitcoin addresses or hex-encoded public keys", {"keys", RPCArg::Type::ARR, RPCArg::Optional::NO, "A json array of bitcoin addresses or hex-encoded public keys",
{ {
{"key", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "bitcoin address or hex-encoded public key"}, {"key", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "bitcoin address or hex-encoded public key"},
}, },
}, },
{"label", RPCArg::Type::STR, /* opt */ true, /* default_val */ "null", "A label to assign the addresses to."}, {"label", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "A label to assign the addresses to."},
{"address_type", RPCArg::Type::STR, /* opt */ true, /* default_val */ "set by -addresstype", "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."}, {"address_type", RPCArg::Type::STR, /* default */ "set by -addresstype", "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
}, },
RPCResult{ RPCResult{
"{\n" "{\n"
@ -1217,10 +1217,10 @@ static UniValue listreceivedbyaddress(const JSONRPCRequest& request)
RPCHelpMan{"listreceivedbyaddress", RPCHelpMan{"listreceivedbyaddress",
"\nList balances by receiving address.\n", "\nList balances by receiving address.\n",
{ {
{"minconf", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1", "The minimum number of confirmations before payments are included."}, {"minconf", RPCArg::Type::NUM, /* default */ "1", "The minimum number of confirmations before payments are included."},
{"include_empty", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Whether to include addresses that haven't received any payments."}, {"include_empty", RPCArg::Type::BOOL, /* default */ "false", "Whether to include addresses that haven't received any payments."},
{"include_watchonly", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Whether to include watch-only addresses (see 'importaddress')."}, {"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", "Whether to include watch-only addresses (see 'importaddress')."},
{"address_filter", RPCArg::Type::STR, /* opt */ true, /* default_val */ "null", "If present, only return information on this address."}, {"address_filter", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "If present, only return information on this address."},
}, },
RPCResult{ RPCResult{
"[\n" "[\n"
@ -1270,9 +1270,9 @@ static UniValue listreceivedbylabel(const JSONRPCRequest& request)
RPCHelpMan{"listreceivedbylabel", RPCHelpMan{"listreceivedbylabel",
"\nList received transactions by label.\n", "\nList received transactions by label.\n",
{ {
{"minconf", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1", "The minimum number of confirmations before payments are included."}, {"minconf", RPCArg::Type::NUM, /* default */ "1", "The minimum number of confirmations before payments are included."},
{"include_empty", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Whether to include labels that haven't received any payments."}, {"include_empty", RPCArg::Type::BOOL, /* default */ "false", "Whether to include labels that haven't received any payments."},
{"include_watchonly", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Whether to include watch-only addresses (see 'importaddress')."}, {"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", "Whether to include watch-only addresses (see 'importaddress')."},
}, },
RPCResult{ RPCResult{
"[\n" "[\n"
@ -1411,11 +1411,11 @@ UniValue listtransactions(const JSONRPCRequest& request)
"\nIf a label name is provided, this will return only incoming transactions paying to addresses with the specified label.\n" "\nIf a label name is provided, this will return only incoming transactions paying to addresses with the specified label.\n"
"\nReturns up to 'count' most recent transactions skipping the first 'from' transactions.\n", "\nReturns up to 'count' most recent transactions skipping the first 'from' transactions.\n",
{ {
{"label", RPCArg::Type::STR, /* opt */ true, /* default_val */ "null", "If set, should be a valid label name to return only incoming transactions\n" {"label", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "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."}, " with the specified label, or \"*\" to disable filtering and return all transactions."},
{"count", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "10", "The number of transactions to return"}, {"count", RPCArg::Type::NUM, /* default */ "10", "The number of transactions to return"},
{"skip", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "The number of transactions to skip"}, {"skip", RPCArg::Type::NUM, /* default */ "0", "The number of transactions to skip"},
{"include_watchonly", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Include transactions to watch-only addresses (see 'importaddress')"}, {"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", "Include transactions to watch-only addresses (see 'importaddress')"},
}, },
RPCResult{ RPCResult{
"[\n" "[\n"
@ -1546,10 +1546,10 @@ static UniValue listsinceblock(const JSONRPCRequest& request)
"If \"blockhash\" is no longer a part of the main chain, transactions from the fork point onward are included.\n" "If \"blockhash\" is no longer a part of the main chain, transactions from the fork point onward are included.\n"
"Additionally, if include_removed is set, transactions affecting the wallet which were removed are returned in the \"removed\" array.\n", "Additionally, if include_removed is set, transactions affecting the wallet which were removed are returned in the \"removed\" array.\n",
{ {
{"blockhash", RPCArg::Type::STR, /* opt */ true, /* default_val */ "null", "If set, the block hash to list transactions since, otherwise list all transactions."}, {"blockhash", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "If set, the block hash to list transactions since, otherwise list all transactions."},
{"target_confirmations", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "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"}, {"target_confirmations", RPCArg::Type::NUM, /* 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"},
{"include_watchonly", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Include transactions to watch-only addresses (see 'importaddress')"}, {"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", "Include transactions to watch-only addresses (see 'importaddress')"},
{"include_removed", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Show transactions that were removed due to a reorg in the \"removed\" array\n" {"include_removed", RPCArg::Type::BOOL, /* default */ "true", "Show transactions that were removed due to a reorg in the \"removed\" array\n"
" (not guaranteed to work on pruned nodes)"}, " (not guaranteed to work on pruned nodes)"},
}, },
RPCResult{ RPCResult{
@ -1689,8 +1689,8 @@ static UniValue gettransaction(const JSONRPCRequest& request)
RPCHelpMan{"gettransaction", RPCHelpMan{"gettransaction",
"\nGet detailed information about in-wallet transaction <txid>\n", "\nGet detailed information about in-wallet transaction <txid>\n",
{ {
{"txid", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The transaction id"}, {"txid", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction id"},
{"include_watchonly", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Whether to include watch-only addresses in balance calculation and details[]"}, {"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", "Whether to include watch-only addresses in balance calculation and details[]"},
}, },
RPCResult{ RPCResult{
"{\n" "{\n"
@ -1795,7 +1795,7 @@ static UniValue abandontransaction(const JSONRPCRequest& request)
"It only works on transactions which are not included in a block and are not currently in the mempool.\n" "It only works on transactions which are not included in a block and are not currently in the mempool.\n"
"It has no effect on transactions which are already abandoned.\n", "It has no effect on transactions which are already abandoned.\n",
{ {
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -1839,7 +1839,7 @@ static UniValue backupwallet(const JSONRPCRequest& request)
RPCHelpMan{"backupwallet", RPCHelpMan{"backupwallet",
"\nSafely copies current wallet file to destination, which can be a directory or a path with filename.\n", "\nSafely copies current wallet file to destination, which can be a directory or a path with filename.\n",
{ {
{"destination", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The destination directory or file"}, {"destination", RPCArg::Type::STR, RPCArg::Optional::NO, "The destination directory or file"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -1879,7 +1879,7 @@ static UniValue keypoolrefill(const JSONRPCRequest& request)
"\nFills the keypool."+ "\nFills the keypool."+
HelpRequiringPassphrase(pwallet) + "\n", HelpRequiringPassphrase(pwallet) + "\n",
{ {
{"newsize", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "100", "The new keypool size"}, {"newsize", RPCArg::Type::NUM, /* default */ "100", "The new keypool size"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -1932,8 +1932,8 @@ static UniValue walletpassphrase(const JSONRPCRequest& request)
"Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock\n" "Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock\n"
"time that overrides the old one.\n", "time that overrides the old one.\n",
{ {
{"passphrase", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The wallet passphrase"}, {"passphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet passphrase"},
{"timeout", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The time to keep the decryption key in seconds; capped at 100000000 (~3 years)."}, {"timeout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The time to keep the decryption key in seconds; capped at 100000000 (~3 years)."},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -2015,8 +2015,8 @@ static UniValue walletpassphrasechange(const JSONRPCRequest& request)
RPCHelpMan{"walletpassphrasechange", RPCHelpMan{"walletpassphrasechange",
"\nChanges the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.\n", "\nChanges the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.\n",
{ {
{"oldpassphrase", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The current passphrase"}, {"oldpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The current passphrase"},
{"newpassphrase", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The new passphrase"}, {"newpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The new passphrase"},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -2117,7 +2117,7 @@ static UniValue encryptwallet(const JSONRPCRequest& request)
"Use the walletpassphrase call for this, and then walletlock call.\n" "Use the walletpassphrase call for this, and then walletlock call.\n"
"If the wallet is already encrypted, use the walletpassphrasechange call.\n", "If the wallet is already encrypted, use the walletpassphrasechange call.\n",
{ {
{"passphrase", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long."}, {"passphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long."},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -2179,13 +2179,13 @@ static UniValue lockunspent(const JSONRPCRequest& request)
"is always cleared (by virtue of process exit) when a node stops or fails.\n" "is always cleared (by virtue of process exit) when a node stops or fails.\n"
"Also see the listunspent call\n", "Also see the listunspent call\n",
{ {
{"unlock", RPCArg::Type::BOOL, /* opt */ false, /* default_val */ "", "Whether to unlock (true) or lock (false) the specified transactions"}, {"unlock", RPCArg::Type::BOOL, RPCArg::Optional::NO, "Whether to unlock (true) or lock (false) the specified transactions"},
{"transactions", RPCArg::Type::ARR, /* opt */ true, /* default_val */ "empty array", "A json array of objects. Each object the txid (string) vout (numeric).", {"transactions", RPCArg::Type::ARR, /* default */ "empty array", "A json array of objects. Each object the txid (string) vout (numeric).",
{ {
{"", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "", "", {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{ {
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
{"vout", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The output number"}, {"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
}, },
}, },
}, },
@ -2359,7 +2359,7 @@ static UniValue settxfee(const JSONRPCRequest& request)
RPCHelpMan{"settxfee", RPCHelpMan{"settxfee",
"\nSet the transaction fee per kB for this wallet. Overrides the global -paytxfee command line parameter.\n", "\nSet the transaction fee per kB for this wallet. Overrides the global -paytxfee command line parameter.\n",
{ {
{"amount", RPCArg::Type::AMOUNT, /* opt */ false, /* default_val */ "", "The transaction fee in " + CURRENCY_UNIT + "/kB"}, {"amount", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "The transaction fee in " + CURRENCY_UNIT + "/kB"},
}, },
RPCResult{ RPCResult{
"true|false (boolean) Returns true if successful\n" "true|false (boolean) Returns true if successful\n"
@ -2540,7 +2540,7 @@ static UniValue loadwallet(const JSONRPCRequest& request)
"\nNote that all wallet command-line options used when starting bitcoind will be" "\nNote that all wallet command-line options used when starting bitcoind will be"
"\napplied to the new wallet (eg -zapwallettxes, upgradewallet, rescan, etc).\n", "\napplied to the new wallet (eg -zapwallettxes, upgradewallet, rescan, etc).\n",
{ {
{"filename", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The wallet directory or .dat file."}, {"filename", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet directory or .dat file."},
}, },
RPCResult{ RPCResult{
"{\n" "{\n"
@ -2594,9 +2594,9 @@ static UniValue createwallet(const JSONRPCRequest& request)
RPCHelpMan{"createwallet", RPCHelpMan{"createwallet",
"\nCreates and loads a new wallet.\n", "\nCreates and loads a new wallet.\n",
{ {
{"wallet_name", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The name for the new wallet. If this is a path, the wallet will be created at the path location."}, {"wallet_name", RPCArg::Type::STR, RPCArg::Optional::NO, "The name for the new wallet. If this is a path, the wallet will be created at the path location."},
{"disable_private_keys", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Disable the possibility of private keys (only watchonlys are possible in this mode)."}, {"disable_private_keys", RPCArg::Type::BOOL, /* default */ "false", "Disable the possibility of private keys (only watchonlys are possible in this mode)."},
{"blank", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using sethdseed."}, {"blank", RPCArg::Type::BOOL, /* default */ "false", "Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using sethdseed."},
}, },
RPCResult{ RPCResult{
"{\n" "{\n"
@ -2655,7 +2655,7 @@ static UniValue unloadwallet(const JSONRPCRequest& request)
"Unloads the wallet referenced by the request endpoint otherwise unloads the wallet specified in the argument.\n" "Unloads the wallet referenced by the request endpoint otherwise unloads the wallet specified in the argument.\n"
"Specifying the wallet name on a wallet endpoint is invalid.", "Specifying the wallet name on a wallet endpoint is invalid.",
{ {
{"wallet_name", RPCArg::Type::STR, /* opt */ true, /* default_val */ "the wallet name from the RPC request", "The name of the wallet to unload."}, {"wallet_name", RPCArg::Type::STR, /* default */ "the wallet name from the RPC request", "The name of the wallet to unload."},
}, },
RPCResults{}, RPCResults{},
RPCExamples{ RPCExamples{
@ -2750,21 +2750,21 @@ static UniValue listunspent(const JSONRPCRequest& request)
"with between minconf and maxconf (inclusive) confirmations.\n" "with between minconf and maxconf (inclusive) confirmations.\n"
"Optionally filter to only include txouts paid to specified addresses.\n", "Optionally filter to only include txouts paid to specified addresses.\n",
{ {
{"minconf", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1", "The minimum confirmations to filter"}, {"minconf", RPCArg::Type::NUM, /* default */ "1", "The minimum confirmations to filter"},
{"maxconf", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "9999999", "The maximum confirmations to filter"}, {"maxconf", RPCArg::Type::NUM, /* default */ "9999999", "The maximum confirmations to filter"},
{"addresses", RPCArg::Type::ARR, /* opt */ true, /* default_val */ "empty array", "A json array of bitcoin addresses to filter", {"addresses", RPCArg::Type::ARR, /* default */ "empty array", "A json array of bitcoin addresses to filter",
{ {
{"address", RPCArg::Type::STR, /* opt */ true, /* default_val */ "", "bitcoin address"}, {"address", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "bitcoin address"},
}, },
}, },
{"include_unsafe", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Include outputs that are not safe to spend\n" {"include_unsafe", RPCArg::Type::BOOL, /* default */ "true", "Include outputs that are not safe to spend\n"
" See description of \"safe\" attribute below."}, " See description of \"safe\" attribute below."},
{"query_options", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "null", "JSON with query options", {"query_options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "JSON with query options",
{ {
{"minimumAmount", RPCArg::Type::AMOUNT, /* opt */ true, /* default_val */ "0", "Minimum value of each UTXO in " + CURRENCY_UNIT + ""}, {"minimumAmount", RPCArg::Type::AMOUNT, /* default */ "0", "Minimum value of each UTXO in " + CURRENCY_UNIT + ""},
{"maximumAmount", RPCArg::Type::AMOUNT, /* opt */ true, /* default_val */ "unlimited", "Maximum value of each UTXO in " + CURRENCY_UNIT + ""}, {"maximumAmount", RPCArg::Type::AMOUNT, /* default */ "unlimited", "Maximum value of each UTXO in " + CURRENCY_UNIT + ""},
{"maximumCount", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "unlimited", "Maximum number of UTXOs"}, {"maximumCount", RPCArg::Type::NUM, /* default */ "unlimited", "Maximum number of UTXOs"},
{"minimumSumAmount", RPCArg::Type::AMOUNT, /* opt */ true, /* default_val */ "unlimited", "Minimum sum value of all UTXOs in " + CURRENCY_UNIT + ""}, {"minimumSumAmount", RPCArg::Type::AMOUNT, /* default */ "unlimited", "Minimum sum value of all UTXOs in " + CURRENCY_UNIT + ""},
}, },
"query_options"}, "query_options"},
}, },
@ -3052,33 +3052,33 @@ static UniValue fundrawtransaction(const JSONRPCRequest& request)
"You can see whether this is the case by checking the \"solvable\" field in the listunspent output.\n" "You can see whether this is the case by checking the \"solvable\" field in the listunspent output.\n"
"Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only\n", "Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only\n",
{ {
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The hex string of the raw transaction"}, {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex string of the raw transaction"},
{"options", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "null", "for backward compatibility: passing in a true instead of an object will result in {\"includeWatching\":true}", {"options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "for backward compatibility: passing in a true instead of an object will result in {\"includeWatching\":true}",
{ {
{"changeAddress", RPCArg::Type::STR, /* opt */ true, /* default_val */ "pool address", "The bitcoin address to receive the change"}, {"changeAddress", RPCArg::Type::STR, /* default */ "pool address", "The bitcoin address to receive the change"},
{"changePosition", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "random", "The index of the change output"}, {"changePosition", RPCArg::Type::NUM, /* default */ "random", "The index of the change output"},
{"change_type", RPCArg::Type::STR, /* opt */ true, /* default_val */ "set by -changetype", "The output type to use. Only valid if changeAddress is not specified. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."}, {"change_type", RPCArg::Type::STR, /* default */ "set by -changetype", "The output type to use. Only valid if changeAddress is not specified. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
{"includeWatching", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Also select inputs which are watch only"}, {"includeWatching", RPCArg::Type::BOOL, /* default */ "false", "Also select inputs which are watch only"},
{"lockUnspents", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Lock selected unspent outputs"}, {"lockUnspents", RPCArg::Type::BOOL, /* default */ "false", "Lock selected unspent outputs"},
{"feeRate", RPCArg::Type::AMOUNT, /* opt */ true, /* default_val */ "not set: makes wallet determine the fee", "Set a specific fee rate in " + CURRENCY_UNIT + "/kB"}, {"feeRate", RPCArg::Type::AMOUNT, /* default */ "not set: makes wallet determine the fee", "Set a specific fee rate in " + CURRENCY_UNIT + "/kB"},
{"subtractFeeFromOutputs", RPCArg::Type::ARR, /* opt */ true, /* default_val */ "empty array", "A json array of integers.\n" {"subtractFeeFromOutputs", RPCArg::Type::ARR, /* default */ "empty array", "A json array of integers.\n"
" The fee will be equally deducted from the amount of each specified output.\n" " The fee will be equally deducted from the amount of each specified output.\n"
" Those recipients will receive less bitcoins than you enter in their corresponding amount field.\n" " Those recipients will receive less bitcoins than you enter in their corresponding amount field.\n"
" If no outputs are specified here, the sender pays the fee.", " If no outputs are specified here, the sender pays the fee.",
{ {
{"vout_index", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "", "The zero-based output index, before a change output is added."}, {"vout_index", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The zero-based output index, before a change output is added."},
}, },
}, },
{"replaceable", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "fallback to wallet's default", "Marks this transaction as BIP125 replaceable.\n" {"replaceable", RPCArg::Type::BOOL, /* default */ "fallback to wallet's default", "Marks this transaction as BIP125 replaceable.\n"
" Allows this transaction to be replaced by a transaction with higher fees"}, " Allows this transaction to be replaced by a transaction with higher fees"},
{"conf_target", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "fallback to wallet's default", "Confirmation target (in blocks)"}, {"conf_target", RPCArg::Type::NUM, /* default */ "fallback to wallet's default", "Confirmation target (in blocks)"},
{"estimate_mode", RPCArg::Type::STR, /* opt */ true, /* default_val */ "UNSET", "The fee estimate mode, must be one of:\n" {"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n"
" \"UNSET\"\n" " \"UNSET\"\n"
" \"ECONOMICAL\"\n" " \"ECONOMICAL\"\n"
" \"CONSERVATIVE\""}, " \"CONSERVATIVE\""},
}, },
"options"}, "options"},
{"iswitness", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "depends on heuristic tests", "Whether the transaction hex is a serialized witness transaction \n" {"iswitness", RPCArg::Type::BOOL, /* default */ "depends on heuristic tests", "Whether the transaction hex is a serialized witness transaction \n"
" If iswitness is not present, heuristic tests will be used in decoding"}, " If iswitness is not present, heuristic tests will be used in decoding"},
}, },
RPCResult{ RPCResult{
@ -3139,21 +3139,21 @@ UniValue signrawtransactionwithwallet(const JSONRPCRequest& request)
"this transaction depends on but may not yet be in the block chain." + "this transaction depends on but may not yet be in the block chain." +
HelpRequiringPassphrase(pwallet) + "\n", HelpRequiringPassphrase(pwallet) + "\n",
{ {
{"hexstring", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The transaction hex string"}, {"hexstring", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction hex string"},
{"prevtxs", RPCArg::Type::ARR, /* opt */ true, /* default_val */ "null", "A json array of previous dependent transaction outputs", {"prevtxs", RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, "A json array of previous dependent transaction outputs",
{ {
{"", RPCArg::Type::OBJ, /* opt */ false, /* default_val */ "", "", {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{ {
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
{"vout", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The output number"}, {"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
{"scriptPubKey", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "script key"}, {"scriptPubKey", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "script key"},
{"redeemScript", RPCArg::Type::STR_HEX, /* opt */ true, /* default_val */ "omitted", "(required for P2SH or P2WSH)"}, {"redeemScript", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "(required for P2SH or P2WSH) redeem script"},
{"amount", RPCArg::Type::AMOUNT, /* opt */ false, /* default_val */ "", "The amount spent"}, {"amount", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "The amount spent"},
}, },
}, },
}, },
}, },
{"sighashtype", RPCArg::Type::STR, /* opt */ true, /* default_val */ "ALL", "The signature hash type. Must be one of\n" {"sighashtype", RPCArg::Type::STR, /* default */ "ALL", "The signature hash type. Must be one of\n"
" \"ALL\"\n" " \"ALL\"\n"
" \"NONE\"\n" " \"NONE\"\n"
" \"SINGLE\"\n" " \"SINGLE\"\n"
@ -3222,22 +3222,22 @@ static UniValue bumpfee(const JSONRPCRequest& request)
"At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee\n" "At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee\n"
"returned by getnetworkinfo) to enter the node's mempool.\n", "returned by getnetworkinfo) to enter the node's mempool.\n",
{ {
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The txid to be bumped"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The txid to be bumped"},
{"options", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "null", "", {"options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "",
{ {
{"confTarget", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "fallback to wallet's default", "Confirmation target (in blocks)"}, {"confTarget", RPCArg::Type::NUM, /* default */ "fallback to wallet's default", "Confirmation target (in blocks)"},
{"totalFee", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "fallback to 'confTarget'", "Total fee (NOT feerate) to pay, in satoshis.\n" {"totalFee", RPCArg::Type::NUM, /* default */ "fallback to 'confTarget'", "Total fee (NOT feerate) to pay, in satoshis.\n"
" In rare cases, the actual fee paid might be slightly higher than the specified\n" " In rare cases, the actual fee paid might be slightly higher than the specified\n"
" totalFee if the tx change output has to be removed because it is too close to\n" " totalFee if the tx change output has to be removed because it is too close to\n"
" the dust threshold."}, " the dust threshold."},
{"replaceable", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Whether the new transaction should still be\n" {"replaceable", RPCArg::Type::BOOL, /* default */ "true", "Whether the new transaction should still be\n"
" marked bip-125 replaceable. If true, the sequence numbers in the transaction will\n" " marked bip-125 replaceable. If true, the sequence numbers in the transaction will\n"
" be left unchanged from the original. If false, any input sequence numbers in the\n" " be left unchanged from the original. If false, any input sequence numbers in the\n"
" original transaction that were less than 0xfffffffe will be increased to 0xfffffffe\n" " original transaction that were less than 0xfffffffe will be increased to 0xfffffffe\n"
" so the new transaction will not be explicitly bip-125 replaceable (though it may\n" " so the new transaction will not be explicitly bip-125 replaceable (though it may\n"
" still be replaceable in practice, for example if it has unconfirmed ancestors which\n" " still be replaceable in practice, for example if it has unconfirmed ancestors which\n"
" are replaceable)."}, " are replaceable)."},
{"estimate_mode", RPCArg::Type::STR, /* opt */ true, /* default_val */ "UNSET", "The fee estimate mode, must be one of:\n" {"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n"
" \"UNSET\"\n" " \"UNSET\"\n"
" \"ECONOMICAL\"\n" " \"ECONOMICAL\"\n"
" \"CONSERVATIVE\""}, " \"CONSERVATIVE\""},
@ -3369,8 +3369,8 @@ UniValue generate(const JSONRPCRequest& request)
RPCHelpMan{"generate", RPCHelpMan{"generate",
"\nMine up to nblocks blocks immediately (before the RPC call returns) to an address in the wallet.\n", "\nMine up to nblocks blocks immediately (before the RPC call returns) to an address in the wallet.\n",
{ {
{"nblocks", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "How many blocks are generated immediately."}, {"nblocks", RPCArg::Type::NUM, RPCArg::Optional::NO, "How many blocks are generated immediately."},
{"maxtries", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "1000000", "How many iterations to try."}, {"maxtries", RPCArg::Type::NUM, /* default */ "1000000", "How many iterations to try."},
}, },
RPCResult{ RPCResult{
"[ blockhashes ] (array) hashes of blocks generated\n" "[ blockhashes ] (array) hashes of blocks generated\n"
@ -3424,8 +3424,8 @@ UniValue rescanblockchain(const JSONRPCRequest& request)
RPCHelpMan{"rescanblockchain", RPCHelpMan{"rescanblockchain",
"\nRescan the local blockchain for wallet related transactions.\n", "\nRescan the local blockchain for wallet related transactions.\n",
{ {
{"start_height", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "block height where the rescan should start"}, {"start_height", RPCArg::Type::NUM, /* default */ "0", "block height where the rescan should start"},
{"stop_height", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "", "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."}, {"stop_height", RPCArg::Type::NUM, RPCArg::Optional::OMITTED_NAMED_ARG, "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."},
}, },
RPCResult{ RPCResult{
"{\n" "{\n"
@ -3638,7 +3638,7 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
"\nReturn information about the given bitcoin address. Some information requires the address\n" "\nReturn information about the given bitcoin address. Some information requires the address\n"
"to be in the wallet.\n", "to be in the wallet.\n",
{ {
{"address", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The bitcoin address to get the information of."}, {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address to get the information of."},
}, },
RPCResult{ RPCResult{
"{\n" "{\n"
@ -3765,7 +3765,7 @@ static UniValue getaddressesbylabel(const JSONRPCRequest& request)
RPCHelpMan{"getaddressesbylabel", RPCHelpMan{"getaddressesbylabel",
"\nReturns the list of addresses assigned the specified label.\n", "\nReturns the list of addresses assigned the specified label.\n",
{ {
{"label", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The label."}, {"label", RPCArg::Type::STR, RPCArg::Optional::NO, "The label."},
}, },
RPCResult{ RPCResult{
"{ (json object with addresses as keys)\n" "{ (json object with addresses as keys)\n"
@ -3813,7 +3813,7 @@ static UniValue listlabels(const JSONRPCRequest& request)
RPCHelpMan{"listlabels", RPCHelpMan{"listlabels",
"\nReturns the list of all labels, or labels that are assigned to addresses with a specific purpose.\n", "\nReturns the list of all labels, or labels that are assigned to addresses with a specific purpose.\n",
{ {
{"purpose", RPCArg::Type::STR, /* opt */ true, /* default_val */ "null", "Address purpose to list labels for ('send','receive'). An empty string is the same as not providing this argument."}, {"purpose", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Address purpose to list labels for ('send','receive'). An empty string is the same as not providing this argument."},
}, },
RPCResult{ RPCResult{
"[ (json array of string)\n" "[ (json array of string)\n"
@ -3873,11 +3873,11 @@ UniValue sethdseed(const JSONRPCRequest& request)
"\nNote that you will need to MAKE A NEW BACKUP of your wallet after setting the HD wallet seed." + "\nNote that you will need to MAKE A NEW BACKUP of your wallet after setting the HD wallet seed." +
HelpRequiringPassphrase(pwallet) + "\n", HelpRequiringPassphrase(pwallet) + "\n",
{ {
{"newkeypool", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Whether to flush old unused addresses, including change addresses, from the keypool and regenerate it.\n" {"newkeypool", RPCArg::Type::BOOL, /* default */ "true", "Whether to flush old unused addresses, including change addresses, from the keypool and regenerate it.\n"
" If true, the next address from getnewaddress and change address from getrawchangeaddress will be from this new seed.\n" " If true, the next address from getnewaddress and change address from getrawchangeaddress will be from this new seed.\n"
" If false, addresses (including change addresses if the wallet already had HD Chain Split enabled) from the existing\n" " If false, addresses (including change addresses if the wallet already had HD Chain Split enabled) from the existing\n"
" keypool will be used until it has been depleted."}, " keypool will be used until it has been depleted."},
{"seed", RPCArg::Type::STR, /* opt */ true, /* default_val */ "random seed", "The WIF private key to use as the new HD seed.\n" {"seed", RPCArg::Type::STR, /* default */ "random seed", "The WIF private key to use as the new HD seed.\n"
" The seed value can be retrieved using the dumpwallet command. It is the private key marked hdseed=1"}, " The seed value can be retrieved using the dumpwallet command. It is the private key marked hdseed=1"},
}, },
RPCResults{}, RPCResults{},
@ -4018,16 +4018,16 @@ UniValue walletprocesspsbt(const JSONRPCRequest& request)
"that we can sign for." + "that we can sign for." +
HelpRequiringPassphrase(pwallet) + "\n", HelpRequiringPassphrase(pwallet) + "\n",
{ {
{"psbt", RPCArg::Type::STR, /* opt */ false, /* default_val */ "", "The transaction base64 string"}, {"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction base64 string"},
{"sign", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "true", "Also sign the transaction when updating"}, {"sign", RPCArg::Type::BOOL, /* default */ "true", "Also sign the transaction when updating"},
{"sighashtype", RPCArg::Type::STR, /* opt */ true, /* default_val */ "ALL", "The signature hash type to sign with if not specified by the PSBT. Must be one of\n" {"sighashtype", RPCArg::Type::STR, /* default */ "ALL", "The signature hash type to sign with if not specified by the PSBT. Must be one of\n"
" \"ALL\"\n" " \"ALL\"\n"
" \"NONE\"\n" " \"NONE\"\n"
" \"SINGLE\"\n" " \"SINGLE\"\n"
" \"ALL|ANYONECANPAY\"\n" " \"ALL|ANYONECANPAY\"\n"
" \"NONE|ANYONECANPAY\"\n" " \"NONE|ANYONECANPAY\"\n"
" \"SINGLE|ANYONECANPAY\""}, " \"SINGLE|ANYONECANPAY\""},
{"bip32derivs", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "If true, includes the BIP 32 derivation paths for public keys if we know them"}, {"bip32derivs", RPCArg::Type::BOOL, /* default */ "false", "If true, includes the BIP 32 derivation paths for public keys if we know them"},
}, },
RPCResult{ RPCResult{
"{\n" "{\n"
@ -4082,61 +4082,61 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
"\nCreates and funds a transaction in the Partially Signed Transaction format. Inputs will be added if supplied inputs are not enough\n" "\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", "Implements the Creator and Updater roles.\n",
{ {
{"inputs", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "A json array of json objects", {"inputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "A json array of json objects",
{ {
{"", RPCArg::Type::OBJ, /* opt */ false, /* default_val */ "", "", {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{ {
{"txid", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "The transaction id"}, {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
{"vout", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The output number"}, {"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
{"sequence", RPCArg::Type::NUM, /* opt */ false, /* default_val */ "", "The sequence number"}, {"sequence", RPCArg::Type::NUM, RPCArg::Optional::NO, "The sequence number"},
}, },
}, },
}, },
}, },
{"outputs", RPCArg::Type::ARR, /* opt */ false, /* default_val */ "", "a json array with outputs (key-value pairs), where none of the keys are duplicated.\n" {"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "a json array with outputs (key-value pairs), where none of the keys are duplicated.\n"
"That is, each address can only appear once and there can only be one 'data' object.\n" "That is, each address can only appear once and there can only be one 'data' object.\n"
"For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n" "For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n"
" accepted as second parameter.", " accepted as second parameter.",
{ {
{"", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "", "", {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{ {
{"address", RPCArg::Type::AMOUNT, /* opt */ false, /* default_val */ "", "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT + ""}, {"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT + ""},
}, },
}, },
{"", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "", "", {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{ {
{"data", RPCArg::Type::STR_HEX, /* opt */ false, /* default_val */ "", "A key-value pair. The key must be \"data\", the value is hex-encoded data"}, {"data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A key-value pair. The key must be \"data\", the value is hex-encoded data"},
}, },
}, },
}, },
}, },
{"locktime", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "0", "Raw locktime. Non-0 value also locktime-activates inputs"}, {"locktime", RPCArg::Type::NUM, /* default */ "0", "Raw locktime. Non-0 value also locktime-activates inputs"},
{"options", RPCArg::Type::OBJ, /* opt */ true, /* default_val */ "null", "", {"options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "",
{ {
{"changeAddress", RPCArg::Type::STR_HEX, /* opt */ true, /* default_val */ "pool address", "The bitcoin address to receive the change"}, {"changeAddress", RPCArg::Type::STR_HEX, /* default */ "pool address", "The bitcoin address to receive the change"},
{"changePosition", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "random", "The index of the change output"}, {"changePosition", RPCArg::Type::NUM, /* default */ "random", "The index of the change output"},
{"change_type", RPCArg::Type::STR, /* opt */ true, /* default_val */ "set by -changetype", "The output type to use. Only valid if changeAddress is not specified. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."}, {"change_type", RPCArg::Type::STR, /* default */ "set by -changetype", "The output type to use. Only valid if changeAddress is not specified. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
{"includeWatching", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Also select inputs which are watch only"}, {"includeWatching", RPCArg::Type::BOOL, /* default */ "false", "Also select inputs which are watch only"},
{"lockUnspents", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Lock selected unspent outputs"}, {"lockUnspents", RPCArg::Type::BOOL, /* default */ "false", "Lock selected unspent outputs"},
{"feeRate", RPCArg::Type::AMOUNT, /* opt */ true, /* default_val */ "not set: makes wallet determine the fee", "Set a specific fee rate in " + CURRENCY_UNIT + "/kB"}, {"feeRate", RPCArg::Type::AMOUNT, /* default */ "not set: makes wallet determine the fee", "Set a specific fee rate in " + CURRENCY_UNIT + "/kB"},
{"subtractFeeFromOutputs", RPCArg::Type::ARR, /* opt */ true, /* default_val */ "empty array", "A json array of integers.\n" {"subtractFeeFromOutputs", RPCArg::Type::ARR, /* default */ "empty array", "A json array of integers.\n"
" The fee will be equally deducted from the amount of each specified output.\n" " The fee will be equally deducted from the amount of each specified output.\n"
" Those recipients will receive less bitcoins than you enter in their corresponding amount field.\n" " Those recipients will receive less bitcoins than you enter in their corresponding amount field.\n"
" If no outputs are specified here, the sender pays the fee.", " If no outputs are specified here, the sender pays the fee.",
{ {
{"vout_index", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "", "The zero-based output index, before a change output is added."}, {"vout_index", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The zero-based output index, before a change output is added."},
}, },
}, },
{"replaceable", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "Marks this transaction as BIP125 replaceable.\n" {"replaceable", RPCArg::Type::BOOL, /* default */ "false", "Marks this transaction as BIP125 replaceable.\n"
" Allows this transaction to be replaced by a transaction with higher fees"}, " Allows this transaction to be replaced by a transaction with higher fees"},
{"conf_target", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "Fallback to wallet's confirmation target", "Confirmation target (in blocks)"}, {"conf_target", RPCArg::Type::NUM, /* default */ "Fallback to wallet's confirmation target", "Confirmation target (in blocks)"},
{"estimate_mode", RPCArg::Type::STR, /* opt */ true, /* default_val */ "UNSET", "The fee estimate mode, must be one of:\n" {"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n"
" \"UNSET\"\n" " \"UNSET\"\n"
" \"ECONOMICAL\"\n" " \"ECONOMICAL\"\n"
" \"CONSERVATIVE\""}, " \"CONSERVATIVE\""},
}, },
"options"}, "options"},
{"bip32derivs", RPCArg::Type::BOOL, /* opt */ true, /* default_val */ "false", "If true, includes the BIP 32 derivation paths for public keys if we know them"}, {"bip32derivs", RPCArg::Type::BOOL, /* default */ "false", "If true, includes the BIP 32 derivation paths for public keys if we know them"},
}, },
RPCResult{ RPCResult{
"{\n" "{\n"