From 556a0cf5a764c0123151f0b84d4cb69d50db3c95 Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Wed, 11 May 2016 18:33:22 -0400 Subject: [PATCH] rpc: include help text for addressindex and related commands --- src/rpcblockchain.cpp | 6 ++- src/rpcmisc.cpp | 99 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 93 insertions(+), 12 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index c20f2941d2cc9..4365a72407b86 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -285,10 +285,12 @@ UniValue getblockhashes(const UniValue& params, bool fHelp) "1. high (numeric, required) The newer block timestamp\n" "2. low (numeric, required) The older block timestamp\n" "\nResult:\n" - "[" + "[\n" " \"hash\" (string) The block hash\n" - "]" + "]\n" "\nExamples:\n" + + HelpExampleCli("getblockhashes", "1231614698 1231024505") + + HelpExampleRpc("getblockhashes", "1231614698, 1231024505") ); unsigned int high = params[0].get_int(); diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 04eb5eceffbff..8dc8f7146594a 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -462,7 +462,30 @@ UniValue getaddressmempool(const UniValue& params, bool fHelp) throw runtime_error( "getaddressmempool\n" "\nReturns all mempool deltas for an address (requires addressindex to be enabled).\n" - ); + "\nArguments:\n" + "{\n" + " \"addresses\"\n" + " [\n" + " \"address\" (string) The base58check encoded address\n" + " ,...\n" + " ]\n" + "}\n" + "\nResult:\n" + "[\n" + " {\n" + " \"address\" (string) The base58check encoded address\n" + " \"txid\" (string) The related txid\n" + " \"index\" (number) The related input or output index\n" + " \"satoshis\" (number) The difference of satoshis\n" + " \"timestamp\" (number) The time the transaction entered the mempool (seconds)\n" + " \"prevtxid\" (string) The previous txid (if spending)\n" + " \"prevout\" (string) The previous transaction output index (if spending)\n" + " }\n" + "]\n" + "\nExamples:\n" + + HelpExampleCli("getaddressmempool", "'{\"addresses\": [\"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\"]}'") + + HelpExampleRpc("getaddressmempool", "{\"addresses\": [\"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\"]}") + ); std::vector > addresses; @@ -510,6 +533,14 @@ UniValue getaddressutxos(const UniValue& params, bool fHelp) throw runtime_error( "getaddressutxos\n" "\nReturns all unspent outputs for an address (requires addressindex to be enabled).\n" + "\nArguments:\n" + "{\n" + " \"addresses\"\n" + " [\n" + " \"address\" (string) The base58check encoded address\n" + " ,...\n" + " ]\n" + "}\n" "\nResult\n" "[\n" " {\n" @@ -521,7 +552,10 @@ UniValue getaddressutxos(const UniValue& params, bool fHelp) " \"satoshis\" (number) The number of satoshis of the output\n" " }\n" "]\n" - ); + "\nExamples:\n" + + HelpExampleCli("getaddressutxos", "'{\"addresses\": [\"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\"]}'") + + HelpExampleRpc("getaddressutxos", "{\"addresses\": [\"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\"]}") + ); std::vector > addresses; @@ -566,7 +600,17 @@ UniValue getaddressdeltas(const UniValue& params, bool fHelp) throw runtime_error( "getaddressdeltas\n" "\nReturns all changes for an address (requires addressindex to be enabled).\n" - "\nResult\n" + "\nArguments:\n" + "{\n" + " \"addresses\"\n" + " [\n" + " \"address\" (string) The base58check encoded address\n" + " ,...\n" + " ]\n" + " \"start\" (number) The start block height\n" + " \"end\" (number) The end block height\n" + "}\n" + "\nResult:\n" "[\n" " {\n" " \"satoshis\" (number) The difference of satoshis\n" @@ -576,6 +620,9 @@ UniValue getaddressdeltas(const UniValue& params, bool fHelp) " \"address\" (string) The base58check encoded address\n" " }\n" "]\n" + "\nExamples:\n" + + HelpExampleCli("getaddressdeltas", "'{\"addresses\": [\"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\"]}'") + + HelpExampleRpc("getaddressdeltas", "{\"addresses\": [\"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\"]}") ); @@ -638,12 +685,23 @@ UniValue getaddressbalance(const UniValue& params, bool fHelp) if (fHelp || params.size() != 1) throw runtime_error( "getaddressbalance\n" - "\nReturns the balance for an address (requires addressindex to be enabled).\n" - "\nResult\n" + "\nReturns the balance for an address(es) (requires addressindex to be enabled).\n" + "\nArguments:\n" "{\n" - " \"balance\" (string) The current balance\n" - " ,...\n" + " \"addresses\"\n" + " [\n" + " \"address\" (string) The base58check encoded address\n" + " ,...\n" + " ]\n" "}\n" + "\nResult:\n" + "{\n" + " \"balance\" (string) The current balance in satoshis\n" + " \"received\" (string) The total number of satoshis received (including change)\n" + "}\n" + "\nExamples:\n" + + HelpExampleCli("getaddressbalance", "'{\"addresses\": [\"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\"]}'") + + HelpExampleRpc("getaddressbalance", "{\"addresses\": [\"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\"]}") ); std::vector > addresses; @@ -683,12 +741,25 @@ UniValue getaddresstxids(const UniValue& params, bool fHelp) if (fHelp || params.size() != 1) throw runtime_error( "getaddresstxids\n" - "\nReturns the txids for an address (requires addressindex to be enabled).\n" - "\nResult\n" + "\nReturns the txids for an address(es) (requires addressindex to be enabled).\n" + "\nArguments:\n" + "{\n" + " \"addresses\"\n" + " [\n" + " \"address\" (string) The base58check encoded address\n" + " ,...\n" + " ]\n" + " \"start\" (number) The start block height\n" + " \"end\" (number) The end block height\n" + "}\n" + "\nResult:\n" "[\n" " \"transactionid\" (string) The transaction id\n" " ,...\n" "]\n" + "\nExamples:\n" + + HelpExampleCli("getaddresstxids", "'{\"addresses\": [\"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\"]}'") + + HelpExampleRpc("getaddresstxids", "{\"addresses\": [\"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\"]}") ); std::vector > addresses; @@ -755,12 +826,20 @@ UniValue getspentinfo(const UniValue& params, bool fHelp) throw runtime_error( "getspentinfo\n" "\nReturns the txid and index where an output is spent.\n" - "\nResult\n" + "\nArguments:\n" + "{\n" + " \"txid\" (string) The hex string of the txid\n" + " \"index\" (number) The start block height\n" + "}\n" + "\nResult:\n" "{\n" " \"txid\" (string) The transaction id\n" " \"index\" (number) The spending input index\n" " ,...\n" "}\n" + "\nExamples:\n" + + HelpExampleCli("getspentinfo", "'{\"txid\": \"0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9\", \"index\": 0}'") + + HelpExampleRpc("getspentinfo", "{\"txid\": \"0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9\", \"index\": 0}") ); UniValue txidValue = find_value(params[0].get_obj(), "txid");