aboutsummaryrefslogtreecommitdiff
path: root/src/rpcdump.cpp
diff options
context:
space:
mode:
authorsje <sje3000@gmail.com>2013-10-29 22:29:44 +1100
committerWladimir J. van der Laan <laanwj@gmail.com>2013-11-13 14:54:29 +0100
commita6099ef319a73e2255dca77065600abb22c4f5f8 (patch)
tree4b02c150d44351ceac018a0557667f242ea68f22 /src/rpcdump.cpp
parent2830a9051d19fa8ba29e26ef0440107a13b15975 (diff)
Issue #1865 - Clean up RPC help messages
Based on the proposal, update the help message of rpc methods - strings arguments are in double quotes rather than square brackets - numeric arguments have no quotes (and no default value) - optional parameters are surrounded by round brackets - json arguments are strings but don't use double quotes Added 3 sections for the details - Arguments: lists each argument, it's type, required or not, a default, and a description - Result: The method result, with json format if applicable, type, and a description - Examples: examples calls using bitcoin-cli and curl for json rpc call Problems - maybe this is too verbose - lines might be too long - description are not good or complete - examples may be too much
Diffstat (limited to 'src/rpcdump.cpp')
-rw-r--r--src/rpcdump.cpp56
1 files changed, 48 insertions, 8 deletions
diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp
index fe2f4b93b9..53cec9a6fa 100644
--- a/src/rpcdump.cpp
+++ b/src/rpcdump.cpp
@@ -71,8 +71,22 @@ Value importprivkey(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 3)
throw runtime_error(
- "importprivkey <bitcoinprivkey> [label] [rescan=true]\n"
- "Adds a private key (as returned by dumpprivkey) to your wallet.");
+ "importprivkey \"bitcoinprivkey\" ( \"label\" rescan )\n"
+ "\nAdds a private key (as returned by dumpprivkey) to your wallet.\n"
+ "\nArguments:\n"
+ "1. \"bitcoinprivkey\" (string, required) The private key (see dumpprivkey)\n"
+ "2. \"label\" (string, optional) an optional label\n"
+ "3. rescan (boolean, optional, default=true) Rescan the wallet for transactions\n"
+ "\nExamples:\n"
+ "\nDump a private key\n"
+ + HelpExampleCli("dumpprivkey", "\"myaddress\"") +
+ "\nImport the private key\n"
+ + HelpExampleCli("importprivkey", "\"mykey\"") +
+ "\nImport using a label\n"
+ + HelpExampleCli("importprivkey", "\"mykey\" \"testing\" false") +
+ "\nAs a json rpc call\n"
+ + HelpExampleRpc("importprivkey", "\"mykey\", \"testing\", false")
+ );
string strSecret = params[0].get_str();
string strLabel = "";
@@ -118,8 +132,18 @@ Value importwallet(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
- "importwallet <filename>\n"
- "Imports keys from a wallet dump file (see dumpwallet).");
+ "importwallet \"filename\"\n"
+ "\nImports keys from a wallet dump file (see dumpwallet).\n"
+ "\nArguments:\n"
+ "1. \"filename\" (string, required) The wallet file\n"
+ "\nExamples:\n"
+ "\nDump the wallet\n"
+ + HelpExampleCli("dumpwallet", "\"test\"") +
+ "\nImport the wallet\n"
+ + HelpExampleCli("importwallet", "\"test\"") +
+ "\nImport using the json rpc call\n"
+ + HelpExampleRpc("importwallet", "\"test\"")
+ );
EnsureWalletIsUnlocked();
@@ -198,8 +222,18 @@ Value dumpprivkey(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
- "dumpprivkey <bitcoinaddress>\n"
- "Reveals the private key corresponding to <bitcoinaddress>.");
+ "dumpprivkey \"bitcoinaddress\"\n"
+ "\nReveals the private key corresponding to 'bitcoinaddress'.\n"
+ "Then the importprivkey can be used with this output\n"
+ "\nArguments:\n"
+ "1. \"bitcoinaddress\" (string, required) The bitcoin address for the private key\n"
+ "\nResult:\n"
+ "\"key\" (string) The private key\n"
+ "\nExamples:\n"
+ + HelpExampleCli("dumpprivkey", "\"myaddress\"")
+ + HelpExampleCli("importprivkey", "\"mykey\"")
+ + HelpExampleRpc("dumpprivkey", "\"myaddress\"")
+ );
EnsureWalletIsUnlocked();
@@ -221,8 +255,14 @@ Value dumpwallet(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
- "dumpwallet <filename>\n"
- "Dumps all wallet keys in a human-readable format.");
+ "dumpwallet \"filename\"\n"
+ "\nDumps all wallet keys in a human-readable format.\n"
+ "\nArguments:\n"
+ "1. \"filename\" (string, required) The filename\n"
+ "\nExamples:\n"
+ + HelpExampleCli("dumpwallet", "\"test\"")
+ + HelpExampleRpc("dumpwallet", "\"test\"")
+ );
EnsureWalletIsUnlocked();