Skip to content

Commit fab6c43

Browse files
author
MarcoFalke
committed
doc: Document optional result fields in validateaddress
Can be reviewed with --ignore-all-space --word-diff-regex=.
1 parent faee265 commit fab6c43

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

src/rpc/misc.cpp

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,32 +36,33 @@
3636

3737
static RPCHelpMan validateaddress()
3838
{
39-
return RPCHelpMan{"validateaddress",
40-
"\nReturn information about the given bitcoin address.\n",
41-
{
42-
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address to validate"},
43-
},
44-
RPCResult{
45-
RPCResult::Type::OBJ, "", "",
39+
return RPCHelpMan{
40+
"validateaddress",
41+
"\nReturn information about the given bitcoin address.\n",
42+
{
43+
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The bitcoin address to validate"},
44+
},
45+
RPCResult{
46+
RPCResult::Type::OBJ, "", "",
47+
{
48+
{RPCResult::Type::BOOL, "isvalid", "If the address is valid or not"},
49+
{RPCResult::Type::STR, "address", /* optional */ true, "The bitcoin address validated"},
50+
{RPCResult::Type::STR_HEX, "scriptPubKey", /* optional */ true, "The hex-encoded scriptPubKey generated by the address"},
51+
{RPCResult::Type::BOOL, "isscript", /* optional */ true, "If the key is a script"},
52+
{RPCResult::Type::BOOL, "iswitness", /* optional */ true, "If the address is a witness address"},
53+
{RPCResult::Type::NUM, "witness_version", /* optional */ true, "The version number of the witness program"},
54+
{RPCResult::Type::STR_HEX, "witness_program", /* optional */ true, "The hex value of the witness program"},
55+
{RPCResult::Type::STR, "error", /* optional */ true, "Error message, if any"},
56+
{RPCResult::Type::ARR, "error_locations", /*optional=*/true, "Indices of likely error locations in address, if known (e.g. Bech32 errors)",
4657
{
47-
{RPCResult::Type::BOOL, "isvalid", "If the address is valid or not"},
48-
{RPCResult::Type::STR, "address", /* optional */ true, "The bitcoin address validated"},
49-
{RPCResult::Type::STR_HEX, "scriptPubKey", /* optional */ true, "The hex-encoded scriptPubKey generated by the address"},
50-
{RPCResult::Type::BOOL, "isscript", /* optional */ true, "If the key is a script"},
51-
{RPCResult::Type::BOOL, "iswitness", /* optional */ true, "If the address is a witness address"},
52-
{RPCResult::Type::NUM, "witness_version", /* optional */ true, "The version number of the witness program"},
53-
{RPCResult::Type::STR_HEX, "witness_program", /* optional */ true, "The hex value of the witness program"},
54-
{RPCResult::Type::STR, "error", /* optional */ true, "Error message, if any"},
55-
{RPCResult::Type::ARR, "error_locations", "Indices of likely error locations in address, if known (e.g. Bech32 errors)",
56-
{
57-
{RPCResult::Type::NUM, "index", "index of a potential error"},
58-
}},
59-
}
60-
},
61-
RPCExamples{
62-
HelpExampleCli("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"") +
63-
HelpExampleRpc("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"")
64-
},
58+
{RPCResult::Type::NUM, "index", "index of a potential error"},
59+
}},
60+
}
61+
},
62+
RPCExamples{
63+
HelpExampleCli("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"") +
64+
HelpExampleRpc("validateaddress", "\"" + EXAMPLE_ADDRESS[0] + "\"")
65+
},
6566
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
6667
{
6768
std::string error_msg;

0 commit comments

Comments
 (0)