Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 4,163 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
"associated with the address, \"\" is the default label\n" | "associated with the address, \"\" is the default label\n" | ||||
" \"timestamp\" : timestamp, (number, optional) The " | " \"timestamp\" : timestamp, (number, optional) The " | ||||
"creation time of the key if available in seconds since epoch " | "creation time of the key if available in seconds since epoch " | ||||
"(Jan 1 1970 GMT)\n" | "(Jan 1 1970 GMT)\n" | ||||
" \"hdkeypath\" : \"keypath\" (string, optional) The HD " | " \"hdkeypath\" : \"keypath\" (string, optional) The HD " | ||||
"keypath if the key is HD and available\n" | "keypath if the key is HD and available\n" | ||||
" \"hdseedid\" : \"<hash160>\" (string, optional) The " | " \"hdseedid\" : \"<hash160>\" (string, optional) The " | ||||
"Hash160 of the HD seed\n" | "Hash160 of the HD seed\n" | ||||
" \"hdmasterfingerprint\" : \"<hash160>\" (string, optional) " | |||||
"The fingperint of the master key.\n" | |||||
" \"labels\" (object) Array of labels " | " \"labels\" (object) Array of labels " | ||||
"associated with the address.\n" | "associated with the address.\n" | ||||
" [\n" | " [\n" | ||||
" { (json object of label data)\n" | " { (json object of label data)\n" | ||||
" \"name\": \"labelname\" (string) The label\n" | " \"name\": \"labelname\" (string) The label\n" | ||||
" \"purpose\": \"string\" (string) Purpose of address " | " \"purpose\": \"string\" (string) Purpose of address " | ||||
"(\"send\" for sending address, \"receive\" for receiving " | "(\"send\" for sending address, \"receive\" for receiving " | ||||
"address)\n" | "address)\n" | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | UniValue getaddressinfo(const Config &config, const JSONRPCRequest &request) { | ||||
if (!meta) { | if (!meta) { | ||||
auto it = pwallet->m_script_metadata.find(CScriptID(scriptPubKey)); | auto it = pwallet->m_script_metadata.find(CScriptID(scriptPubKey)); | ||||
if (it != pwallet->m_script_metadata.end()) { | if (it != pwallet->m_script_metadata.end()) { | ||||
meta = &it->second; | meta = &it->second; | ||||
} | } | ||||
} | } | ||||
if (meta) { | if (meta) { | ||||
ret.pushKV("timestamp", meta->nCreateTime); | ret.pushKV("timestamp", meta->nCreateTime); | ||||
if (!meta->hdKeypath.empty()) { | if (meta->has_key_origin) { | ||||
ret.pushKV("hdkeypath", meta->hdKeypath); | ret.pushKV("hdkeypath", WriteHDKeypath(meta->key_origin.path)); | ||||
ret.pushKV("hdseedid", meta->hd_seed_id.GetHex()); | ret.pushKV("hdseedid", meta->hd_seed_id.GetHex()); | ||||
ret.pushKV("hdmasterfingerprint", | |||||
HexStr(meta->key_origin.fingerprint, | |||||
meta->key_origin.fingerprint + 4)); | |||||
} | } | ||||
} | } | ||||
// Currently only one label can be associated with an address, return an | // Currently only one label can be associated with an address, return an | ||||
// array so the API remains stable if we allow multiple labels to be | // array so the API remains stable if we allow multiple labels to be | ||||
// associated with an address. | // associated with an address. | ||||
UniValue labels(UniValue::VARR); | UniValue labels(UniValue::VARR); | ||||
std::map<CTxDestination, CAddressBookData>::iterator mi = | std::map<CTxDestination, CAddressBookData>::iterator mi = | ||||
▲ Show 20 Lines • Show All 559 Lines • Show Last 20 Lines |