rpc: fix/add missing RPCExamples for "Util" RPCs

fixes HelpExampleRpc for
    - createmultisig

adds missing HelpExampleRpc for
    - deriveaddresses
    - estimatesmartfee
    - getdescriptorinfo
This commit is contained in:
Sebastian Falbesoner 2020-03-26 19:27:32 +01:00
parent c0b1706964
commit ea98d9c2ef
2 changed files with 11 additions and 4 deletions

View File

@ -1030,7 +1030,8 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request)
"have been observed to make an estimate for any number of blocks."}, "have been observed to make an estimate for any number of blocks."},
}}, }},
RPCExamples{ RPCExamples{
HelpExampleCli("estimatesmartfee", "6") HelpExampleCli("estimatesmartfee", "6") +
HelpExampleRpc("estimatesmartfee", "6")
}, },
}.Check(request); }.Check(request);

View File

@ -98,7 +98,7 @@ static RPCHelpMan createmultisig()
"\nCreate a multisig address from 2 public keys\n" "\nCreate a multisig address from 2 public keys\n"
+ HelpExampleCli("createmultisig", "2 \"[\\\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\\\",\\\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\\\"]\"") + + HelpExampleCli("createmultisig", "2 \"[\\\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\\\",\\\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\\\"]\"") +
"\nAs a JSON-RPC call\n" "\nAs a JSON-RPC call\n"
+ HelpExampleRpc("createmultisig", "2, \"[\\\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\\\",\\\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\\\"]\"") + HelpExampleRpc("createmultisig", "2, [\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\",\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\"]")
}, },
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{ {
@ -143,6 +143,8 @@ static RPCHelpMan createmultisig()
static RPCHelpMan getdescriptorinfo() static RPCHelpMan getdescriptorinfo()
{ {
const std::string EXAMPLE_DESCRIPTOR = "wpkh([d34db33f/84h/0h/0h]0279be667ef9dcbbac55a06295Ce870b07029Bfcdb2dce28d959f2815b16f81798)";
return RPCHelpMan{"getdescriptorinfo", return RPCHelpMan{"getdescriptorinfo",
{"\nAnalyses a descriptor.\n"}, {"\nAnalyses a descriptor.\n"},
{ {
@ -160,7 +162,8 @@ static RPCHelpMan getdescriptorinfo()
}, },
RPCExamples{ RPCExamples{
"Analyse a descriptor\n" + "Analyse a descriptor\n" +
HelpExampleCli("getdescriptorinfo", "\"wpkh([d34db33f/84h/0h/0h]0279be667ef9dcbbac55a06295Ce870b07029Bfcdb2dce28d959f2815b16f81798)\"") HelpExampleCli("getdescriptorinfo", "\"" + EXAMPLE_DESCRIPTOR + "\"") +
HelpExampleRpc("getdescriptorinfo", "\"" + EXAMPLE_DESCRIPTOR + "\"")
}, },
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{ {
@ -186,6 +189,8 @@ static RPCHelpMan getdescriptorinfo()
static RPCHelpMan deriveaddresses() static RPCHelpMan deriveaddresses()
{ {
const std::string EXAMPLE_DESCRIPTOR = "wpkh([d34db33f/84h/0h/0h]xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY/0/*)#cjjspncu";
return RPCHelpMan{"deriveaddresses", return RPCHelpMan{"deriveaddresses",
{"\nDerives one or more addresses corresponding to an output descriptor.\n" {"\nDerives one or more addresses corresponding to an output descriptor.\n"
"Examples of output descriptors are:\n" "Examples of output descriptors are:\n"
@ -208,7 +213,8 @@ static RPCHelpMan deriveaddresses()
}, },
RPCExamples{ RPCExamples{
"First three native segwit receive addresses\n" + "First three native segwit receive addresses\n" +
HelpExampleCli("deriveaddresses", "\"wpkh([d34db33f/84h/0h/0h]xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY/0/*)#cjjspncu\" \"[0,2]\"") HelpExampleCli("deriveaddresses", "\"" + EXAMPLE_DESCRIPTOR + "\" \"[0,2]\"") +
HelpExampleRpc("deriveaddresses", "\"" + EXAMPLE_DESCRIPTOR + "\", \"[0,2]\"")
}, },
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{ {