Merge 0ee9a00f90 into merged_master (Bitcoin PR bitcoin/bitcoin#23652)

This commit is contained in:
James Dorfman 2023-06-01 16:32:19 +00:00
commit c5302defa7
2 changed files with 108 additions and 106 deletions

View file

@ -40,41 +40,42 @@
static RPCHelpMan validateaddress()
{
return RPCHelpMan{"validateaddress",
"\nReturn information about the given bitcoin address.\n",
return RPCHelpMan{
"validateaddress",
"\nReturn information about the given bitcoin address.\n",
{
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address to validate"},
},
RPCResult{
RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::BOOL, "isvalid", "If the address is valid or not"},
{RPCResult::Type::BOOL, "isvalid_parent", "If the address is valid or not for parent chain"},
{RPCResult::Type::STR, "address", /* optional */ true, "The bitcoin address validated"},
{RPCResult::Type::STR_HEX, "scriptPubKey", /* optional */ true, "The hex-encoded scriptPubKey generated by the address"},
{RPCResult::Type::BOOL, "isscript", /* optional */ true, "If the key is a script"},
{RPCResult::Type::BOOL, "iswitness", /* optional */ true, "If the address is a witness address"},
{RPCResult::Type::NUM, "witness_version", /* optional */ true, "The version number of the witness program"},
{RPCResult::Type::STR_HEX, "witness_program", /* optional */ true, "The hex value of the witness program"},
{RPCResult::Type::STR_HEX, "confidential_key", "the raw blinding public key for that address, if any. \"\" if none"},
{RPCResult::Type::STR, "unconfidential", "The address without confidentiality key"},
{RPCResult::Type::OBJ, "parent_address_info", "If the address isvalid_parent, this object contains details about the parent address type",
{
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address to validate"},
},
RPCResult{
RPCResult::Type::OBJ, "", "",
{RPCResult::Type::STR, "address", ""},
{RPCResult::Type::STR_HEX, "scriptPubKey", ""},
}},
{RPCResult::Type::STR, "error", /* optional */ true, "Error message, if any"},
{RPCResult::Type::STR, "error_parent", /* optional */ true, "Error message, if any"},
{RPCResult::Type::ARR, "error_locations", "Indices of likely error locations in address, if known (e.g. Bech32 errors)",
{
{RPCResult::Type::BOOL, "isvalid", "If the address is valid or not"},
{RPCResult::Type::BOOL, "isvalid_parent", "If the address is valid or not for parent chain"},
{RPCResult::Type::STR, "address", /* optional */ true, "The bitcoin address validated"},
{RPCResult::Type::STR_HEX, "scriptPubKey", /* optional */ true, "The hex-encoded scriptPubKey generated by the address"},
{RPCResult::Type::BOOL, "isscript", /* optional */ true, "If the key is a script"},
{RPCResult::Type::BOOL, "iswitness", /* optional */ true, "If the address is a witness address"},
{RPCResult::Type::NUM, "witness_version", /* optional */ true, "The version number of the witness program"},
{RPCResult::Type::STR_HEX, "witness_program", /* optional */ true, "The hex value of the witness program"},
{RPCResult::Type::STR_HEX, "confidential_key", "the raw blinding public key for that address, if any. \"\" if none"},
{RPCResult::Type::STR, "unconfidential", "The address without confidentiality key"},
{RPCResult::Type::OBJ, "parent_address_info", "If the address isvalid_parent, this object contains details about the parent address type",
{
{RPCResult::Type::STR, "address", ""},
{RPCResult::Type::STR_HEX, "scriptPubKey", ""},
}},
{RPCResult::Type::STR, "error", /* optional */ true, "Error message, if any"},
{RPCResult::Type::STR, "error_parent", /* optional */ true, "Error message, if any"},
{RPCResult::Type::ARR, "error_locations", "Indices of likely error locations in address, if known (e.g. Bech32 errors)",
{
{RPCResult::Type::NUM, "index", "index of a potential error"},
}},
}
},
RPCExamples{
HelpExampleCli("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"") +
HelpExampleRpc("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"")
},
{RPCResult::Type::NUM, "index", "index of a potential error"},
}},
}
},
RPCExamples{
HelpExampleCli("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"") +
HelpExampleRpc("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"")
},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
std::string error_msg;