aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-11-13 12:34:43 -0500
committerMarcoFalke <falke.marco@gmail.com>2018-11-13 12:34:50 -0500
commitc651265c934c84c683aa054f2a456b12acc41590 (patch)
tree9d82e4adebddea54656bc53116d191a91c3882f2 /src/wallet
parente0c6bb7823084abac7e9815781875baef2770916 (diff)
parentfa483e13b387f244c1c72d4dbd709e669335618e (diff)
downloadbitcoin-c651265c934c84c683aa054f2a456b12acc41590.tar.xz
Merge #14530: Use RPCHelpMan to generate RPC doc strings
fa483e13b3 rpc: Add RPCHelpMan for machine-generated help (MarcoFalke) fa0d36f712 rpc: Include rpc/util.h where needed for RPCHelpMan (MarcoFalke) Pull request description: This introduces a manager for the RPC help generation and demonstrates its use of it in some RPCs. It is the first non-exhaustive step toward #14378 and I will create pull requests for the next steps after this one is merged. Tree-SHA512: 86f68322443ff01cd964aaf0ebe186be63fbebe4c47676cf7a622cc2b5305fd176bd57badfd1bbf788a036812253eb0dead74ecc3b30664c3e0d9392b2248054
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/rpcdump.cpp7
-rw-r--r--src/wallet/rpcwallet.cpp107
2 files changed, 107 insertions, 7 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index 7dbe0c8462..a2b7adc5e6 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -3,18 +3,19 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <chain.h>
+#include <core_io.h>
#include <interfaces/chain.h>
#include <key_io.h>
+#include <merkleblock.h>
#include <rpc/server.h>
-#include <validation.h>
+#include <rpc/util.h>
#include <script/script.h>
#include <script/standard.h>
#include <sync.h>
#include <util/system.h>
#include <util/time.h>
+#include <validation.h>
#include <wallet/wallet.h>
-#include <merkleblock.h>
-#include <core_io.h>
#include <wallet/rpcwallet.h>
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index bfac990639..71bebb411c 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -2075,7 +2075,21 @@ static UniValue lockunspent(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
- "lockunspent unlock ([{\"txid\":\"txid\",\"vout\":n},...])\n"
+ RPCHelpMan{"lockunspent",
+ {
+ {"unlock", RPCArg::Type::BOOL, false},
+ {"transactions", RPCArg::Type::ARR,
+ {
+ {"", RPCArg::Type::OBJ,
+ {
+ {"txid", RPCArg::Type::STR_HEX, false},
+ {"vout", RPCArg::Type::NUM, false},
+ },
+ true},
+ },
+ true},
+ }}
+ .ToString() +
"\nUpdates list of temporarily unspendable outputs.\n"
"Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs.\n"
"If no transaction outputs are specified when unlocking then all current locked transaction outputs are unlocked.\n"
@@ -2620,7 +2634,26 @@ static UniValue listunspent(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() > 5)
throw std::runtime_error(
- "listunspent ( minconf maxconf [\"addresses\",...] [include_unsafe] [query_options])\n"
+ RPCHelpMan{"listunspent",
+ {
+ {"minconf", RPCArg::Type::NUM, true},
+ {"maxconf", RPCArg::Type::NUM, true},
+ {"addresses", RPCArg::Type::ARR,
+ {
+ {"address", RPCArg::Type::STR_HEX, true},
+ },
+ true},
+ {"include_unsafe", RPCArg::Type::BOOL, true},
+ {"query_options", RPCArg::Type::OBJ,
+ {
+ {"minimumAmount", RPCArg::Type::AMOUNT, true},
+ {"maximumAmount", RPCArg::Type::AMOUNT, true},
+ {"maximumCount", RPCArg::Type::NUM, true},
+ {"minimumSumAmount", RPCArg::Type::AMOUNT, true},
+ },
+ true},
+ }}
+ .ToString() +
"\nReturns array of unspent transaction outputs\n"
"with between minconf and maxconf (inclusive) confirmations.\n"
"Optionally filter to only include txouts paid to specified addresses.\n"
@@ -2995,7 +3028,25 @@ UniValue signrawtransactionwithwallet(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error(
- "signrawtransactionwithwallet \"hexstring\" ( [{\"txid\":\"id\",\"vout\":n,\"scriptPubKey\":\"hex\",\"redeemScript\":\"hex\"},...] sighashtype )\n"
+ RPCHelpMan{"signrawtransactionwithwallet",
+ {
+ {"hexstring", RPCArg::Type::STR, false},
+ {"prevtxs", RPCArg::Type::ARR,
+ {
+ {"", RPCArg::Type::OBJ,
+ {
+ {"txid", RPCArg::Type::STR_HEX, false},
+ {"vout", RPCArg::Type::NUM, false},
+ {"scriptPubKey", RPCArg::Type::STR_HEX, false},
+ {"redeemScript", RPCArg::Type::STR_HEX, false},
+ {"amount", RPCArg::Type::AMOUNT, false},
+ },
+ false},
+ },
+ true},
+ {"sighashtype", RPCArg::Type::STR, true},
+ }}
+ .ToString() +
"\nSign inputs for raw transaction (serialized, hex-encoded).\n"
"The second optional argument (may be null) is an array of previous transaction outputs that\n"
"this transaction depends on but may not yet be in the block chain.\n"
@@ -3902,7 +3953,55 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
if (request.fHelp || request.params.size() < 2 || request.params.size() > 5)
throw std::runtime_error(
- "walletcreatefundedpsbt [{\"txid\":\"id\",\"vout\":n},...] [{\"address\":amount},{\"data\":\"hex\"},...] ( locktime ) ( replaceable ) ( options bip32derivs )\n"
+ RPCHelpMan{"walletcreatefundedpsbt",
+ {
+ {"inputs", RPCArg::Type::ARR,
+ {
+ {"", RPCArg::Type::OBJ,
+ {
+ {"txid", RPCArg::Type::STR_HEX, false},
+ {"vout", RPCArg::Type::NUM, false},
+ {"sequence", RPCArg::Type::NUM, false},
+ },
+ false},
+ },
+ false},
+ {"outputs", RPCArg::Type::ARR,
+ {
+ {"", RPCArg::Type::OBJ,
+ {
+ {"address", RPCArg::Type::AMOUNT, true},
+ },
+ true},
+ {"", RPCArg::Type::OBJ,
+ {
+ {"data", RPCArg::Type::STR_HEX, true},
+ },
+ true},
+ },
+ false},
+ {"locktime", RPCArg::Type::NUM, true},
+ {"options", RPCArg::Type::OBJ,
+ {
+ {"changeAddress", RPCArg::Type::STR_HEX, true},
+ {"changePosition", RPCArg::Type::NUM, true},
+ {"change_type", RPCArg::Type::STR, true},
+ {"includeWatching", RPCArg::Type::BOOL, true},
+ {"lockUnspents", RPCArg::Type::BOOL, true},
+ {"feeRate", RPCArg::Type::NUM, true},
+ {"subtractFeeFromOutputs", RPCArg::Type::ARR,
+ {
+ {"int", RPCArg::Type::NUM, true},
+ },
+ true},
+ {"replaceable", RPCArg::Type::BOOL, true},
+ {"conf_target", RPCArg::Type::NUM, true},
+ {"estimate_mode", RPCArg::Type::STR, true},
+ },
+ true},
+ {"bip32derivs", RPCArg::Type::BOOL, true},
+ }}
+ .ToString() +
"\nCreates and funds a transaction in the Partially Signed Transaction format. Inputs will be added if supplied inputs are not enough\n"
"Implements the Creator and Updater roles.\n"
"\nArguments:\n"