Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/misc.cpp
Show All 33 Lines | |||||
static UniValue validateaddress(const Config &config, | static UniValue validateaddress(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"validateaddress", | "validateaddress", | ||||
"\nReturn information about the given bitcoin address.\n", | "\nReturn information about the given bitcoin address.\n", | ||||
{ | { | ||||
{"address", RPCArg::Type::STR, /* opt */ false, | {"address", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The bitcoin address to validate"}, | "The bitcoin address to validate"}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"{\n" | "{\n" | ||||
" \"isvalid\" : true|false, (boolean) If the address is " | " \"isvalid\" : true|false, (boolean) If the address is " | ||||
"valid or not. If not, this is the only property returned.\n" | "valid or not. If not, this is the only property returned.\n" | ||||
" \"address\" : \"address\", (string) The bitcoin " | " \"address\" : \"address\", (string) The bitcoin " | ||||
"address validated\n" | "address validated\n" | ||||
" \"scriptPubKey\" : \"hex\", (string) The hex-encoded " | " \"scriptPubKey\" : \"hex\", (string) The hex-encoded " | ||||
Show All 39 Lines | if (request.fHelp || request.params.size() < 2 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
std::string msg = | std::string msg = | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"createmultisig", | "createmultisig", | ||||
"\nCreates a multi-signature address with n signature of m " | "\nCreates a multi-signature address with n signature of m " | ||||
"keys required.\n" | "keys required.\n" | ||||
"It returns a json object with the address and redeemScript.\n", | "It returns a json object with the address and redeemScript.\n", | ||||
{ | { | ||||
{"nrequired", RPCArg::Type::NUM, /* opt */ false, | {"nrequired", RPCArg::Type::NUM, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The number of required signatures out of the n keys."}, | "The number of required signatures out of the n keys."}, | ||||
{"keys", | {"keys", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
/* opt */ false, | RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"A json array of hex-encoded public keys.", | "A json array of hex-encoded public keys.", | ||||
{ | { | ||||
{"key", RPCArg::Type::STR_HEX, /* opt */ false, | {"key", RPCArg::Type::STR_HEX, | ||||
/* default_val */ "", "The hex-encoded public key"}, | RPCArg::Optional::OMITTED, | ||||
"The hex-encoded public key"}, | |||||
}}, | }}, | ||||
}, | }, | ||||
RPCResult{"{\n" | RPCResult{"{\n" | ||||
" \"address\":\"multisigaddress\", (string) The " | " \"address\":\"multisigaddress\", (string) The " | ||||
"value of the new multisig address.\n" | "value of the new multisig address.\n" | ||||
" \"redeemScript\":\"script\" (string) The " | " \"redeemScript\":\"script\" (string) The " | ||||
"string value of the hex-encoded redemption script.\n" | "string value of the hex-encoded redemption script.\n" | ||||
"}\n"}, | "}\n"}, | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.empty() || request.params.size() > 3) { | ||||
"scriptPubKey equals the specified hex scripts\n" | "scriptPubKey equals the specified hex scripts\n" | ||||
"\nIn the above, <pubkey> either refers to a fixed public key in " | "\nIn the above, <pubkey> either refers to a fixed public key in " | ||||
"hexadecimal notation, or to an xpub/xprv optionally followed by " | "hexadecimal notation, or to an xpub/xprv optionally followed by " | ||||
"one\n" | "one\n" | ||||
"or more path elements separated by \"/\", where \"h\" represents " | "or more path elements separated by \"/\", where \"h\" represents " | ||||
"a hardened child key.\n" | "a hardened child key.\n" | ||||
"For more information on output descriptors, see the " | "For more information on output descriptors, see the " | ||||
"documentation in the doc/descriptors.md file.\n"}, | "documentation in the doc/descriptors.md file.\n"}, | ||||
{{"descriptor", RPCArg::Type::STR, /* opt */ false, | { | ||||
/* default_val */ "", "The descriptor."}, | {"descriptor", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
{"begin", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "", | "The descriptor."}, | ||||
"If a ranged descriptor is used, this specifies the beginning of " | {"begin", RPCArg::Type::NUM, | ||||
RPCArg::Optional::OMITTED_NAMED_ARG, | |||||
"If a ranged descriptor is used, this specifies the beginning " | |||||
"of " | |||||
Fabien: Layout | |||||
"the range to import."}, | "the range to import."}, | ||||
{"end", RPCArg::Type::NUM, /* opt */ true, /* default_val */ "", | {"end", RPCArg::Type::NUM, RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
"If a ranged descriptor is used, this specifies the end of the " | "If a ranged descriptor is used, this specifies the end of " | ||||
"range to import."}}, | "the " | ||||
FabienUnsubmitted Not Done Inline ActionsDito Fabien: Dito | |||||
"range to import."}, | |||||
}, | |||||
RPCResult{"[ address ] (array) the derived addresses\n"}, | RPCResult{"[ address ] (array) the derived addresses\n"}, | ||||
RPCExamples{ | RPCExamples{ | ||||
"First three native segwit receive addresses\n" + | "First three native segwit receive addresses\n" + | ||||
HelpExampleCli( | HelpExampleCli( | ||||
"deriveaddresses", | "deriveaddresses", | ||||
"\"pkh([d34db33f/84h/0h/" | "\"pkh([d34db33f/84h/0h/" | ||||
"0h]" | "0h]" | ||||
"xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9" | "xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9" | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | |||||
static UniValue verifymessage(const Config &config, | static UniValue verifymessage(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 3) { | if (request.fHelp || request.params.size() != 3) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"verifymessage", | "verifymessage", | ||||
"\nVerify a signed message\n", | "\nVerify a signed message\n", | ||||
{ | { | ||||
{"address", RPCArg::Type::STR, /* opt */ false, | {"address", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The bitcoin address to use for the signature."}, | "The bitcoin address to use for the signature."}, | ||||
{"signature", RPCArg::Type::STR, /* opt */ false, | {"signature", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The signature provided by the signer in base 64 encoding " | "The signature provided by the signer in base 64 encoding " | ||||
"(see signmessage)."}, | "(see signmessage)."}, | ||||
{"message", RPCArg::Type::STR, /* opt */ false, | {"message", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The message that was signed."}, | "The message that was signed."}, | ||||
}, | }, | ||||
RPCResult{"true|false (boolean) If the signature is verified or " | RPCResult{"true|false (boolean) If the signature is verified or " | ||||
"not.\n"}, | "not.\n"}, | ||||
RPCExamples{ | RPCExamples{ | ||||
"\nUnlock the wallet for 30 seconds\n" + | "\nUnlock the wallet for 30 seconds\n" + | ||||
HelpExampleCli("walletpassphrase", "\"mypassphrase\" 30") + | HelpExampleCli("walletpassphrase", "\"mypassphrase\" 30") + | ||||
"\nCreate the signature\n" + | "\nCreate the signature\n" + | ||||
HelpExampleCli( | HelpExampleCli( | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
static UniValue signmessagewithprivkey(const Config &config, | static UniValue signmessagewithprivkey(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 2) { | if (request.fHelp || request.params.size() != 2) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"signmessagewithprivkey", | "signmessagewithprivkey", | ||||
"\nSign a message with the private key of an address\n", | "\nSign a message with the private key of an address\n", | ||||
{ | { | ||||
{"privkey", RPCArg::Type::STR, /* opt */ false, | {"privkey", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"The private key to sign the message with."}, | "The private key to sign the message with."}, | ||||
{"message", RPCArg::Type::STR, /* opt */ false, | {"message", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
/* default_val */ "", "The message to create a signature of."}, | "The message to create a signature of."}, | ||||
}, | }, | ||||
RPCResult{"\"signature\" (string) The signature of the " | RPCResult{"\"signature\" (string) The signature of the " | ||||
"message encoded in base 64\n"}, | "message encoded in base 64\n"}, | ||||
RPCExamples{"\nCreate the signature\n" + | RPCExamples{"\nCreate the signature\n" + | ||||
HelpExampleCli("signmessagewithprivkey", | HelpExampleCli("signmessagewithprivkey", | ||||
"\"privkey\" \"my message\"") + | "\"privkey\" \"my message\"") + | ||||
"\nVerify the signature\n" + | "\nVerify the signature\n" + | ||||
HelpExampleCli("verifymessage", | HelpExampleCli("verifymessage", | ||||
Show All 29 Lines | |||||
static UniValue setmocktime(const Config &config, | static UniValue setmocktime(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"setmocktime", | "setmocktime", | ||||
"\nSet the local time to given timestamp (-regtest only)\n", | "\nSet the local time to given timestamp (-regtest only)\n", | ||||
{ | { | ||||
{"timestamp", RPCArg::Type::NUM, /* opt */ false, | {"timestamp", RPCArg::Type::NUM, RPCArg::Optional::NO, | ||||
/* default_val */ "", | |||||
"Unix seconds-since-epoch timestamp\n" | "Unix seconds-since-epoch timestamp\n" | ||||
" Pass 0 to go back to using the system time."}, | " Pass 0 to go back to using the system time."}, | ||||
}, | }, | ||||
RPCResults{}, | RPCResults{}, | ||||
RPCExamples{""}, | RPCExamples{""}, | ||||
} | } | ||||
.ToString()); | .ToString()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | static UniValue getmemoryinfo(const Config &config, | ||||
/* Please, avoid using the word "pool" here in the RPC interface or help, | /* Please, avoid using the word "pool" here in the RPC interface or help, | ||||
* as users will undoubtedly confuse it with the other "memory pool" | * as users will undoubtedly confuse it with the other "memory pool" | ||||
*/ | */ | ||||
if (request.fHelp || request.params.size() > 1) { | if (request.fHelp || request.params.size() > 1) { | ||||
throw std::runtime_error(RPCHelpMan{ | throw std::runtime_error(RPCHelpMan{ | ||||
"getmemoryinfo", | "getmemoryinfo", | ||||
"Returns an object containing information about memory usage.\n", | "Returns an object containing information about memory usage.\n", | ||||
{ | { | ||||
{"mode", RPCArg::Type::STR, /* opt */ true, | {"mode", RPCArg::Type::STR, /* default */ "\"stats\"", | ||||
/* default_val */ "\"stats\"", | |||||
"determines what kind of information is returned.\n" | "determines what kind of information is returned.\n" | ||||
" - \"stats\" returns general statistics about memory usage " | " - \"stats\" returns general statistics about memory usage " | ||||
"in the daemon.\n" | "in the daemon.\n" | ||||
" - \"mallocinfo\" returns an XML string describing " | " - \"mallocinfo\" returns an XML string describing " | ||||
"low-level heap state (only available if compiled with glibc " | "low-level heap state (only available if compiled with glibc " | ||||
"2.10+)."}, | "2.10+)."}, | ||||
}, | }, | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() > 2) { | ||||
"In addition, the following are available as category names " | "In addition, the following are available as category names " | ||||
"with special meanings:\n" | "with special meanings:\n" | ||||
" - \"all\", \"1\" : represent all logging categories.\n" | " - \"all\", \"1\" : represent all logging categories.\n" | ||||
" - \"none\", \"0\" : even if other logging categories are " | " - \"none\", \"0\" : even if other logging categories are " | ||||
"specified, ignore all of them.\n", | "specified, ignore all of them.\n", | ||||
{ | { | ||||
{"include", | {"include", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
/* opt */ true, | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
/* default_val */ "null", | |||||
"A json array of categories to add debug logging", | "A json array of categories to add debug logging", | ||||
{ | { | ||||
{"include_category", RPCArg::Type::STR, | {"include_category", RPCArg::Type::STR, | ||||
/* opt */ false, /* default_val */ "", | RPCArg::Optional::OMITTED, "the valid logging category"}, | ||||
"the valid logging category"}, | |||||
}}, | }}, | ||||
{"exclude", | {"exclude", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
/* opt */ true, | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
/* default_val */ "null", | |||||
"A json array of categories to remove debug logging", | "A json array of categories to remove debug logging", | ||||
{ | { | ||||
{"exclude_category", RPCArg::Type::STR, | {"exclude_category", RPCArg::Type::STR, | ||||
/* opt */ false, /* default_val */ "", | RPCArg::Optional::OMITTED, "the valid logging category"}, | ||||
"the valid logging category"}, | |||||
}}, | }}, | ||||
}, | }, | ||||
RPCResult{"{ (json object where keys are the " | RPCResult{"{ (json object where keys are the " | ||||
"logging categories, and values indicates its status\n" | "logging categories, and values indicates its status\n" | ||||
" \"category\": 0|1, (numeric) if being debug logged " | " \"category\": 0|1, (numeric) if being debug logged " | ||||
"or not. 0:inactive, 1:active\n" | "or not. 0:inactive, 1:active\n" | ||||
" ...\n" | " ...\n" | ||||
"}\n"}, | "}\n"}, | ||||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |
Layout