Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 4,111 Lines • ▼ Show 20 Lines | |||||
UniValue getaddressinfo(const Config &config, const JSONRPCRequest &request) { | UniValue getaddressinfo(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
const std::string example_address = | |||||
"\"qrmzys48glkpevp2l4t24jtcltc9hyzx9cep2qffm4\""; | |||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"getaddressinfo", | "getaddressinfo", | ||||
"\nReturn information about the given bitcoin address.\n" | "\nReturn information about the given bitcoin address.\n" | ||||
"Some of the information will only be present if the address is in the " | "Some of the information will only be present if the address is in the " | ||||
"active wallet.\n", | "active wallet.\n", | ||||
{ | { | ||||
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, | {"address", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
"The bitcoin address for which to get information."}, | "The bitcoin address for which to get information."}, | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
" { (json object of label data)\n" | " { (json object of label data)\n" | ||||
" \"name\" : \"label name\" (string) The label name. " | " \"name\" : \"label name\" (string) The label name. " | ||||
"Defaults to \"\". Equivalent to the label field above.\n" | "Defaults to \"\". Equivalent to the label field above.\n" | ||||
" \"purpose\" : \"purpose\" (string) The purpose of the " | " \"purpose\" : \"purpose\" (string) The purpose of the " | ||||
"associated address (send or receive).\n" | "associated address (send or receive).\n" | ||||
" },...\n" | " },...\n" | ||||
" ]\n" | " ]\n" | ||||
"}\n"}, | "}\n"}, | ||||
RPCExamples{HelpExampleCli("getaddressinfo", example_address) + | RPCExamples{HelpExampleCli("getaddressinfo", EXAMPLE_ADDRESS) + | ||||
HelpExampleRpc("getaddressinfo", example_address)}, | HelpExampleRpc("getaddressinfo", EXAMPLE_ADDRESS)}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
LOCK(pwallet->cs_wallet); | LOCK(pwallet->cs_wallet); | ||||
UniValue ret(UniValue::VOBJ); | UniValue ret(UniValue::VOBJ); | ||||
CTxDestination dest = | CTxDestination dest = | ||||
DecodeDestination(request.params[0].get_str(), wallet->chainParams); | DecodeDestination(request.params[0].get_str(), wallet->chainParams); | ||||
▲ Show 20 Lines • Show All 661 Lines • Show Last 20 Lines |