mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge #18122: rpc: update validateaddress RPCExamples to bech32
rpc: update validateaddress RPCExamples to bech32 also contains the following changes: - rpc: factor out example bech32 address for RPCExamples - doc: update developer notes wrt RPCExamples addresses (mention the EXAMPLE_ADDRESS constant as an example for an invalid bech32 address suitable for RPCExamples help documentation)
This commit is contained in:
parent
df51c199b4
commit
c06e887385
@ -1186,7 +1186,8 @@ A few guidelines for introducing and reviewing new RPC interfaces:
|
||||
new RPC is replacing a deprecated RPC, to avoid both RPCs confusingly
|
||||
showing up in the command list.
|
||||
|
||||
- Use *invalid* Dash addresses for `RPCExamples` help documentation.
|
||||
- Use *invalid* Dash addresses (e.g. the constant `EXAMPLE_ADDRESS`) for
|
||||
`RPCExamples` help documentation.
|
||||
|
||||
- *Rationale*: Prevent accidental transactions by users.
|
||||
|
||||
|
@ -227,8 +227,8 @@ static UniValue validateaddress(const JSONRPCRequest& request)
|
||||
}
|
||||
},
|
||||
RPCExamples{
|
||||
HelpExampleCli("validateaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"") +
|
||||
HelpExampleRpc("validateaddress", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"")
|
||||
HelpExampleCli("validateaddress", EXAMPLE_ADDRESS) +
|
||||
HelpExampleRpc("validateaddress", EXAMPLE_ADDRESS)
|
||||
},
|
||||
}.Check(request);
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <tuple>
|
||||
|
||||
const std::string UNIX_EPOCH_TIME = "UNIX epoch time";
|
||||
const std::string EXAMPLE_ADDRESS = "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPw0\"";
|
||||
|
||||
|
||||
void RPCTypeCheck(const UniValue& params,
|
||||
|
@ -29,6 +29,12 @@
|
||||
*/
|
||||
extern const std::string UNIX_EPOCH_TIME;
|
||||
|
||||
/**
|
||||
* Example Dash address used in multiple RPCExamples. The address is intentionally
|
||||
* invalid to prevent accidental transactions by users.
|
||||
*/
|
||||
extern const std::string EXAMPLE_ADDRESS;
|
||||
|
||||
class FillableSigningProvider;
|
||||
class FillableSigningProvider;
|
||||
class CPubKey;
|
||||
|
@ -3622,8 +3622,6 @@ static UniValue AddressBookDataToJSON(const CAddressBookData& data, const bool v
|
||||
|
||||
UniValue getaddressinfo(const JSONRPCRequest& request)
|
||||
{
|
||||
const std::string example_address = "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"";
|
||||
|
||||
RPCHelpMan{"getaddressinfo",
|
||||
"\nReturn information about the given dash address.\n"
|
||||
"Some of the information will only be present if the address is in the active wallet.\n",
|
||||
@ -3672,8 +3670,8 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
|
||||
}
|
||||
},
|
||||
RPCExamples{
|
||||
HelpExampleCli("getaddressinfo", example_address)
|
||||
+ HelpExampleRpc("getaddressinfo", example_address)
|
||||
HelpExampleCli("getaddressinfo", EXAMPLE_ADDRESS)
|
||||
+ HelpExampleRpc("getaddressinfo", EXAMPLE_ADDRESS)
|
||||
},
|
||||
}.Check(request);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user