mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-13 11:35:20 +01:00
rpc: Add HelpExampleRpcNamed
This commit is contained in:
parent
e49117470b
commit
5d5a90e819
2 changed files with 14 additions and 0 deletions
|
@ -124,6 +124,17 @@ std::string HelpExampleRpc(const std::string& methodname, const std::string& arg
|
|||
"\"method\": \"" + methodname + "\", \"params\": [" + args + "]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/\n";
|
||||
}
|
||||
|
||||
std::string HelpExampleRpcNamed(const std::string& methodname, const RPCArgList& args)
|
||||
{
|
||||
UniValue params(UniValue::VOBJ);
|
||||
for (const auto& param: args) {
|
||||
params.pushKV(param.first, param.second);
|
||||
}
|
||||
|
||||
return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\": \"curltest\", "
|
||||
"\"method\": \"" + methodname + "\", \"params\": " + params.write() + "}' -H 'content-type: text/plain;' http://127.0.0.1:8332/\n";
|
||||
}
|
||||
|
||||
// Converts a hex string to a public key if possible
|
||||
CPubKey HexToPubKey(const std::string& hex_in)
|
||||
{
|
||||
|
|
|
@ -78,8 +78,11 @@ extern std::vector<unsigned char> ParseHexV(const UniValue& v, std::string strNa
|
|||
extern std::vector<unsigned char> ParseHexO(const UniValue& o, std::string strKey);
|
||||
|
||||
extern CAmount AmountFromValue(const UniValue& value);
|
||||
|
||||
using RPCArgList = std::vector<std::pair<std::string, UniValue>>;
|
||||
extern std::string HelpExampleCli(const std::string& methodname, const std::string& args);
|
||||
extern std::string HelpExampleRpc(const std::string& methodname, const std::string& args);
|
||||
extern std::string HelpExampleRpcNamed(const std::string& methodname, const RPCArgList& args);
|
||||
|
||||
CPubKey HexToPubKey(const std::string& hex_in);
|
||||
CPubKey AddrToPubKey(const FillableSigningProvider& keystore, const std::string& addr_in);
|
||||
|
|
Loading…
Add table
Reference in a new issue