26 const std::string
EXAMPLE_ADDRESS[2] = {
"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl",
"bc1q02ad21edsxd23d32dfgqqsz4vv4nmtfzuklhy3"};
30 std::vector<std::string>
ret;
31 using U = std::underlying_type<TxoutType>::type;
39 const std::map<std::string, UniValueType>& typesExpected,
43 for (
const auto&
t : typesExpected) {
45 if (!fAllowNull && v.
isNull())
48 if (!(
t.second.typeAny || v.
type() ==
t.second.type || (fAllowNull && v.
isNull())))
54 for (
const std::string&
k : o.
getKeys())
56 if (typesExpected.count(
k) == 0)
58 std::string err =
strprintf(
"Unexpected key %s",
k);
79 const std::string& strHex(v.
get_str());
80 if (64 != strHex.length())
111 std::string ShellQuote(
const std::string& s)
114 result.reserve(s.size() * 2);
115 for (
const char ch: s) {
122 return "'" + result +
"'";
130 std::string ShellQuoteIfNeeded(
const std::string& s)
132 for (
const char ch: s) {
133 if (ch ==
' ' || ch ==
'\'' || ch ==
'"') {
134 return ShellQuote(s);
145 return "> bitcoin-cli " + methodname +
" " +
args +
"\n";
150 std::string result =
"> bitcoin-cli -named " + methodname;
151 for (
const auto& argpair:
args) {
152 const auto& value = argpair.second.isStr()
153 ? argpair.second.get_str()
154 : argpair.second.write();
155 result +=
" " + argpair.first +
"=" + ShellQuoteIfNeeded(value);
163 return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\": \"curltest\", " 164 "\"method\": \"" + methodname +
"\", \"params\": [" +
args +
"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/\n";
170 for (
const auto& param:
args) {
171 params.
pushKV(param.first, param.second);
174 return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\": \"curltest\", " 175 "\"method\": \"" + methodname +
"\", \"params\": " + params.
write() +
"}' -H 'content-type: text/plain;' http://127.0.0.1:8332/\n";
181 if (!
IsHex(hex_in)) {
203 if (!keystore.
GetPubKey(key, vchPubKey)) {
219 if ((
int)pubkeys.size() < required) {
230 if (!
pk.IsCompressed()) {
264 obj.
pushKV(
"isscript",
false);
265 obj.
pushKV(
"iswitness",
false);
272 obj.
pushKV(
"isscript",
true);
273 obj.
pushKV(
"iswitness",
false);
280 obj.
pushKV(
"isscript",
false);
281 obj.
pushKV(
"iswitness",
true);
282 obj.
pushKV(
"witness_version", 0);
290 obj.
pushKV(
"isscript",
true);
291 obj.
pushKV(
"iswitness",
true);
292 obj.
pushKV(
"witness_version", 0);
300 obj.
pushKV(
"isscript",
true);
301 obj.
pushKV(
"iswitness",
true);
302 obj.
pushKV(
"witness_version", 1);
310 obj.
pushKV(
"iswitness",
true);
311 obj.
pushKV(
"witness_version",
id.GetWitnessVersion());
312 obj.
pushKV(
"witness_program",
HexStr(
id.GetWitnessProgram()));
336 return result.value();
341 const int target{value.
getInt<
int>()};
342 const unsigned int unsigned_target{
static_cast<unsigned int>(target)};
343 if (target < 1 || unsigned_target > max_target) {
346 return unsigned_target;
370 if (err_string.length() > 0) {
382 Section(
const std::string& left,
const std::string& right)
407 const auto indent = std::string(current_indent,
' ');
408 const auto indent_next = std::string(current_indent + 2,
' ');
420 if (is_top_level_arg)
return;
434 PushSection({indent + (push_name ?
"\"" + arg.
GetName() +
"\": " :
"") +
"{", right});
435 for (
const auto& arg_inner : arg.
m_inner) {
441 PushSection({indent +
"}" + (is_top_level_arg ?
"" :
","),
""});
446 left += push_name ?
"\"" + arg.
GetName() +
"\": " :
"";
450 for (
const auto& arg_inner : arg.
m_inner) {
454 PushSection({indent +
"]" + (is_top_level_arg ?
"" :
","),
""});
471 if (s.m_right.empty()) {
477 std::string left = s.m_left;
478 left.resize(pad,
' ');
484 size_t new_line_pos = s.m_right.find_first_of(
'\n');
486 right += s.m_right.substr(begin, new_line_pos - begin);
487 if (new_line_pos == std::string::npos) {
490 right +=
"\n" + std::string(pad,
' ');
491 begin = s.m_right.find_first_not_of(
' ', new_line_pos + 1);
492 if (begin == std::string::npos) {
495 new_line_pos = s.m_right.find_first_of(
'\n', begin + 1);
505 :
RPCHelpMan{std::move(
name), std::move(description), std::move(
args), std::move(results), std::move(examples),
nullptr} {}
508 : m_name{std::move(
name)},
509 m_fun{std::move(fun)},
510 m_description{std::move(description)},
511 m_args{std::move(
args)},
512 m_results{std::move(results)},
513 m_examples{std::move(examples)}
518 enum ParamType { POSITIONAL = 1, NAMED = 2, NAMED_ONLY = 4 };
519 std::map<std::string, int> param_names;
521 for (
const auto& arg : m_args) {
522 std::vector<std::string> names =
SplitString(arg.m_names,
'|');
524 for (
const std::string&
name : names) {
525 auto& param_type = param_names[
name];
528 param_type |= POSITIONAL;
531 for (
const auto& inner : arg.m_inner) {
532 std::vector<std::string> inner_names =
SplitString(inner.m_names,
'|');
533 for (
const std::string& inner_name : inner_names) {
534 auto& param_type = param_names[inner_name];
535 CHECK_NONFATAL(!(param_type & POSITIONAL) || inner.m_opts.also_positional);
538 param_type |= inner.m_opts.also_positional ? NAMED : NAMED_ONLY;
543 if (arg.m_fallback.index() == 2) {
545 switch (std::get<RPCArg::Default>(arg.m_fallback).getType()) {
577 if (r.m_cond.empty()) {
578 result +=
"\nResult:\n";
580 result +=
"\nResult (" + r.m_cond +
"):\n";
583 r.ToSections(sections);
604 throw std::runtime_error(
ToString());
607 for (
size_t i{0}; i <
m_args.size(); ++i) {
608 const auto& arg{
m_args.at(i)};
610 if (!match.isTrue()) {
611 arg_mismatch.
pushKV(
strprintf(
"Position %s (%s)", i + 1, arg.m_names), std::move(match));
614 if (!arg_mismatch.empty()) {
625 if (match.isTrue()) {
629 mismatch.push_back(match);
631 if (!mismatch.isNull()) {
633 mismatch.empty() ?
"no possible results defined" :
634 mismatch.size() == 1 ? mismatch[0].write(4) :
636 throw std::runtime_error{
637 strprintf(
"Internal bug detected: RPC call \"%s\" returned incorrect type:\n%s\n%s %s\nPlease report this issue here: %s\n",
651 const RPCArg& param{params.at(i)};
652 if (check) check(param);
654 if (!arg.isNull())
return &arg;
655 if (!std::holds_alternative<RPCArg::Default>(param.m_fallback))
return nullptr;
656 return &std::get<RPCArg::Default>(param.m_fallback);
668 #define TMPL_INST(check_param, ret_type, return_code) \ 670 ret_type RPCHelpMan::ArgValue<ret_type>(size_t i) const \ 672 const UniValue* maybe_arg{ \ 673 DetailMaybeArg(check_param, m_args, m_req, i), \ 677 void force_semicolon(ret_type) 680 TMPL_INST(
nullptr, std::optional<double>, maybe_arg ? std::optional{maybe_arg->get_real()} : std::nullopt;);
681 TMPL_INST(
nullptr, std::optional<bool>, maybe_arg ? std::optional{maybe_arg->get_bool()} : std::nullopt;);
682 TMPL_INST(
nullptr,
const std::string*, maybe_arg ? &maybe_arg->get_str() :
nullptr;);
692 size_t num_required_args = 0;
693 for (
size_t n =
m_args.size(); n > 0; --n) {
694 if (!
m_args.at(n - 1).IsOptional()) {
695 num_required_args = n;
699 return num_required_args <= num_args && num_args <=
m_args.size();
704 std::vector<std::pair<std::string, bool>>
ret;
706 for (
const auto& arg :
m_args) {
708 for (
const auto& inner : arg.m_inner) {
709 ret.emplace_back(inner.m_names,
true);
712 ret.emplace_back(arg.m_names,
false);
723 bool was_optional{
false};
724 for (
const auto& arg :
m_args) {
725 if (arg.m_opts.hidden)
break;
726 const bool optional = arg.IsOptional();
729 if (!was_optional)
ret +=
"( ";
732 if (was_optional)
ret +=
") ";
733 was_optional =
false;
735 ret += arg.ToString(
true);
737 if (was_optional)
ret +=
" )";
745 for (
size_t i{0}; i <
m_args.size(); ++i) {
746 const auto& arg =
m_args.at(i);
747 if (arg.m_opts.hidden)
break;
750 sections.
m_sections.emplace_back(::
ToString(i + 1) +
". " + arg.GetFirstName(), arg.ToDescriptionString(
true));
758 for (
const auto& arg_inner : arg.m_inner) {
759 named_only_sections.
PushSection({arg_inner.GetFirstName(), arg_inner.ToDescriptionString(
true)});
760 named_only_sections.
Push(arg_inner);
767 if (!named_only_sections.
m_sections.empty())
ret +=
"\nNamed Arguments:\n";
783 auto push_back_arg_info = [&arr](
const std::string& rpc_name,
int pos,
const std::string& arg_name,
const RPCArg::Type& type) {
785 map.push_back(rpc_name);
787 map.push_back(arg_name);
793 for (
int i{0}; i < int(
m_args.size()); ++i) {
794 const auto& arg =
m_args.at(i);
795 std::vector<std::string> arg_names =
SplitString(arg.m_names,
'|');
796 for (
const auto& arg_name : arg_names) {
797 push_back_arg_info(
m_name, i, arg_name, arg.m_type);
799 for (
const auto& inner : arg.m_inner) {
800 std::vector<std::string> inner_names =
SplitString(inner.m_names,
'|');
801 for (
const std::string& inner_name : inner_names) {
802 push_back_arg_info(
m_name, i, inner_name, inner.m_type);
834 case Type::OBJ_NAMED_PARAMS:
835 case Type::OBJ_USER_KEYS: {
850 if (!exp_type)
return true;
852 if (*exp_type != request.
getType()) {
896 ret +=
"numeric or string";
900 ret +=
"numeric or array";
910 ret +=
"json object";
920 ret +=
", optional, default=" + std::get<RPCArg::DefaultHint>(
m_fallback);
922 ret +=
", optional, default=" + std::get<RPCArg::Default>(
m_fallback).write();
924 switch (std::get<RPCArg::Optional>(
m_fallback)) {
926 if (is_named_arg)
ret +=
", optional";
945 const std::string indent(current_indent,
' ');
946 const std::string indent_next(current_indent + 2,
' ');
949 const std::string maybe_separator{outer_type !=
OuterType::NONE ?
"," :
""};
952 const std::string maybe_key{
958 const auto Description = [&](
const std::string& type) {
959 return "(" + type + (this->
m_optional ?
", optional" :
"") +
")" +
973 sections.
PushSection({indent +
"null" + maybe_separator, Description(
"json null")});
977 sections.
PushSection({indent + maybe_key +
"\"str\"" + maybe_separator, Description(
"string")});
981 sections.
PushSection({indent + maybe_key +
"n" + maybe_separator, Description(
"numeric")});
985 sections.
PushSection({indent + maybe_key +
"\"hex\"" + maybe_separator, Description(
"string")});
989 sections.
PushSection({indent + maybe_key +
"n" + maybe_separator, Description(
"numeric")});
993 sections.
PushSection({indent + maybe_key +
"xxx" + maybe_separator, Description(
"numeric")});
997 sections.
PushSection({indent + maybe_key +
"true|false" + maybe_separator, Description(
"boolean")});
1002 sections.
PushSection({indent + maybe_key +
"[", Description(
"json array")});
1003 for (
const auto& i :
m_inner) {
1011 sections.
m_sections.back().m_left.pop_back();
1013 sections.
PushSection({indent +
"]" + maybe_separator,
""});
1019 sections.
PushSection({indent + maybe_key +
"{}", Description(
"empty JSON object")});
1022 sections.
PushSection({indent + maybe_key +
"{", Description(
"json object")});
1023 for (
const auto& i :
m_inner) {
1031 sections.
m_sections.back().m_left.pop_back();
1033 sections.
PushSection({indent +
"}" + maybe_separator,
""});
1046 return std::nullopt;
1052 case Type::STR_HEX: {
1056 case Type::STR_AMOUNT:
1057 case Type::NUM_TIME: {
1063 case Type::ARR_FIXED:
1082 if (!exp_type)
return true;
1084 if (*exp_type != result.
getType()) {
1096 if (errors.
empty())
return true;
1105 for (
size_t i{0}; i < result.
get_obj().
size(); ++i) {
1107 if (!match.isTrue()) errors.
pushKV(result.
getKeys()[i], match);
1109 if (errors.
empty())
return true;
1112 std::set<std::string> doc_keys;
1113 for (
const auto& doc_entry :
m_inner) {
1114 doc_keys.insert(doc_entry.m_key_name);
1116 std::map<std::string, UniValue> result_obj;
1118 for (
const auto& result_entry : result_obj) {
1119 if (doc_keys.find(result_entry.first) == doc_keys.end()) {
1120 errors.
pushKV(result_entry.first,
"key returned that was not in doc");
1124 for (
const auto& doc_entry :
m_inner) {
1125 const auto result_it{result_obj.find(doc_entry.m_key_name)};
1126 if (result_it == result_obj.end()) {
1127 if (!doc_entry.m_optional) {
1128 errors.
pushKV(doc_entry.m_key_name,
"key missing, despite not being optional in doc");
1132 UniValue match{doc_entry.MatchesType(result_it->second)};
1133 if (!match.isTrue()) errors.
pushKV(doc_entry.m_key_name, match);
1135 if (errors.
empty())
return true;
1165 return res +
"\"str\"";
1167 return res +
"\"hex\"";
1171 return res +
"n or [n,n]";
1173 return res +
"amount";
1175 return res +
"bool";
1178 for (
const auto& i :
m_inner) {
1179 res += i.ToString(oneline) +
",";
1181 return res +
"...]";
1195 throw std::runtime_error{
1219 return "{" + res +
"}";
1221 return "{" + res +
",...}";
1226 for (
const auto& i :
m_inner) {
1227 res += i.ToString(oneline) +
",";
1229 return "[" + res +
"...]";
1237 if (value.
isNum()) {
1238 return {0, value.
getInt<int64_t>()};
1241 int64_t low = value[0].
getInt<int64_t>();
1242 int64_t high = value[1].
getInt<int64_t>();
1256 if ((high >> 31) != 0) {
1259 if (high >= low + 1000000) {
1267 std::string desc_str;
1268 std::pair<int64_t, int64_t> range = {0, 1000};
1269 if (scanobject.
isStr()) {
1270 desc_str = scanobject.
get_str();
1271 }
else if (scanobject.
isObject()) {
1274 desc_str = desc_uni.
get_str();
1276 if (!range_uni.isNull()) {
1284 auto desc =
Parse(desc_str, provider,
error);
1288 if (!desc->IsRange()) {
1292 std::vector<CScript>
ret;
1293 for (
int i = range.first; i <= range.second; ++i) {
1294 std::vector<CScript> scripts;
1295 if (!desc->Expand(i, provider, scripts, provider)) {
1299 desc->ExpandPrivate(i, provider, provider);
1301 std::move(scripts.begin(), scripts.end(), std::back_inserter(
ret));
1314 return servicesNames;
1322 for (
const auto& s : bilingual_strings) {
1323 result.push_back(s.original);
1330 if (warnings.
empty())
return;
1331 obj.
pushKV(
"warnings", warnings);
1336 if (warnings.empty())
return;
virtual bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const override
static const std::string sighash
Aliases for backward compatibility.
CScript GetScriptForMultisig(int nRequired, const std::vector< CPubKey > &keys)
Generate a multisig script.
util::Result< int > SighashFromStr(const std::string &sighash)
static UniValue Parse(std::string_view raw)
Parse string to UniValue or throw runtime_error if string contains invalid JSON.
void push_back(UniValue val)
const std::vector< RPCResult > m_inner
Only used for arrays or dicts.
std::vector< std::string > type_str
Should be empty unless it is supposed to override the auto-generated type strings. Vector length is either 0 or 2, m_opts.type_str.at(0) will override the type of the value in a key-value pair, m_opts.type_str.at(1) will override the type in the argument description.
const Fallback m_fallback
std::string HelpExampleRpcNamed(const std::string &methodname, const RPCArgList &args)
std::vector< Byte > ParseHex(std::string_view hex_str)
Like TryParseHex, but returns an empty vector on invalid input.
ServiceFlags
nServices flags
void CheckInnerDoc() const
std::string ToDescriptionString() const
Return the description string.
void RPCTypeCheckObj(const UniValue &o, const std::map< std::string, UniValueType > &typesExpected, bool fAllowNull, bool fStrict)
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination corresponds to one with an address.
const RPCArgOptions m_opts
RPCErrorCode RPCErrorFromTransactionError(TransactionError terr)
Keeps track of RPCArgs by transforming them into sections for the purpose of serializing everything t...
static std::pair< int64_t, int64_t > ParseRange(const UniValue &value)
std::vector< unsigned char > ParseHexV(const UniValue &v, std::string strName)
UniValue GetServicesNames(ServiceFlags services)
Returns, given services flags, a list of humanly readable (known) network services.
static constexpr bool DEFAULT_RPC_DOC_CHECK
void ToSections(Sections §ions, OuterType outer_type=OuterType::NONE, const int current_indent=0) const
Append the sections of the result.
int ParseSighashString(const UniValue &sighash)
Returns a sighash value corresponding to the passed in argument.
bool MoneyRange(const CAmount &nValue)
#define CHECK_NONFATAL(condition)
Identity function.
bool IsHex(std::string_view str)
void(const RPCArg &) CheckFn
Special type that behaves almost exactly like OBJ, defining an options object with a list of pre-defi...
const std::string m_key_name
Only used for dicts.
std::string ToDescriptionString() const
const std::string m_right
CPubKey HexToPubKey(const std::string &hex_in)
UniValue DescribeAddress(const CTxDestination &dest)
std::vector< std::pair< std::string, bool > > GetArgNames() const
Return list of arguments and whether they are named-only.
const RPCExamples m_examples
const std::string & get_str() const
const std::string EXAMPLE_ADDRESS[2]
Example bech32 addresses for the RPCExamples help documentation.
enum VType getType() const
CKeyID GetKeyForDestination(const SigningProvider &store, const CTxDestination &dest)
Return the CKeyID of the key involved in a script (if there is a unique one).
const UniValue & get_array() const
unsigned int ParseConfirmTarget(const UniValue &value, unsigned int max_target)
Parse a confirm target option and raise an RPC error if it is invalid.
bilingual_str TransactionErrorString(const TransactionError err)
std::vector< std::string > serviceFlagsToStr(uint64_t flags)
Convert service flags (a bitmask of NODE_*) to human readable strings.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
const RPCMethodImpl m_fun
static UniValue BilingualStringsToUniValue(const std::vector< bilingual_str > &bilingual_strings)
Convert a vector of bilingual strings to a UniValue::VARR containing their original untranslated valu...
bool IsValidNumArgs(size_t num_args) const
If the supplied number of args is neither too small nor too high.
const std::vector< std::string > & getKeys() const
UniValue GetArgMap() const
Return the named args that need to be converted from string to another JSON type. ...
std::vector< std::string > SplitString(std::string_view str, char sep)
UniValue operator()(const WitnessUnknown &id) const
Taproot only; implied when sighash byte is missing, and equivalent to SIGHASH_ALL.
const std::string & getValStr() const
static const int MAX_PUBKEYS_PER_MULTISIG
UniValue operator()(const WitnessV0ScriptHash &id) const
std::string ToString() const
const bool m_skip_type_check
const std::vector< RPCArg > m_inner
Only used for arrays or dicts.
Invalid, missing or duplicate parameter.
const std::string m_description
UniValue operator()(const WitnessV1Taproot &tap) const
std::pair< int64_t, int64_t > ParseDescriptorRange(const UniValue &value)
Parse a JSON range specified as int64, or [int64, int64].
int64_t CAmount
Amount in satoshis (Can be negative)
std::string GetAllOutputTypes()
Gets all existing output types formatted for RPC help sections.
const UniValue & find_value(std::string_view key) const
static const UniValue * DetailMaybeArg(CheckFn *check, const std::vector< RPCArg > ¶ms, const JSONRPCRequest *req, size_t i)
CTxDestination AddAndGetMultisigDestination(const int required, const std::vector< CPubKey > &pubkeys, OutputType type, FillableSigningProvider &keystore, CScript &script_out)
std::string oneline_description
Should be empty unless it is supposed to override the auto-generated summary line.
Special type that is a STR with only hex chars.
std::string GetName() const
Return the name, throws when there are aliases.
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
const char * uvTypeName(UniValue::VType t)
UniValue operator()(const PKHash &keyID) const
uint256 ParseHashO(const UniValue &o, std::string strKey)
UniValue JSONRPCError(int code, const std::string &message)
Special string with only hex chars.
static std::optional< UniValue::VType > ExpectedType(RPCArg::Type type)
UniValue operator()(const CNoDestination &dest) const
UniValue operator()(const ScriptHash &scriptID) const
bool IsFullyValid() const
fully validate whether this is a valid public key (more expensive than IsValid()) ...
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
DescribeAddressVisitor()=default
CTxDestination subtype to encode any future Witness version.
void getObjMap(std::map< std::string, UniValue > &kv) const
enum JSONRPCRequest::Mode mode
Special array that has a fixed number of entries.
uint256 uint256S(const char *str)
An encapsulated public key.
Fillable signing provider that keeps keys in an address->secret map.
const std::string m_names
The name of the arg (can be empty for inner args, can contain multiple aliases separated by | for nam...
UniValue operator()(const PubKeyDestination &dest) const
Unexpected type was passed as parameter.
Special type where the user must set the keys e.g. to define multiple addresses; as opposed to e...
Special type to disable type checks (for testing only)
std::function< UniValue(const RPCHelpMan &, const JSONRPCRequest &)> RPCMethodImpl
std::string write(unsigned int prettyIndent=0, unsigned int indentLevel=0) const
UniValue operator()(const WitnessV0KeyHash &id) const
const std::vector< RPCResult > m_results
std::string GetFirstName() const
Return the first of all aliases.
const std::vector< RPCArg > m_args
std::string HelpExampleCliNamed(const std::string &methodname, const RPCArgList &args)
void PushWarnings(const UniValue &warnings, UniValue &obj)
Push warning messages to an RPC "warnings" field as a JSON array of strings.
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
constexpr bool IsNull() const
const std::string m_description
Special numeric to denote unix epoch time.
CTxDestination AddAndGetDestinationForScript(FillableSigningProvider &keystore, const CScript &script, OutputType type)
Get a destination of the requested type (if possible) to the specified script.
std::string FormatFullVersion()
const std::string m_examples
bool ParseFixedPoint(std::string_view val, int decimals, int64_t *amount_out)
Parse number as fixed point according to JSON number syntax.
const JSONRPCRequest * m_req
std::vector< std::pair< std::string, UniValue > > RPCArgList
uint256 ParseHashV(const UniValue &v, std::string strName)
Utilities: convert hex-encoded Values (throws error if not hex).
const RPCResults m_results
Special type that is a NUM or [NUM,NUM].
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
std::string GetTxnOutputType(TxoutType t)
Get the name of a TxoutType as a string.
OuterType
Serializing JSON objects depends on the outer type.
RPCHelpMan(std::string name, std::string description, std::vector< RPCArg > args, RPCResults results, RPCExamples examples)
Optional argument for which the default value is omitted from help text for one of two reasons: ...
std::vector< Section > m_sections
Special string to represent a floating point amount.
bool error(const char *fmt, const Args &... args)
void pushKV(std::string key, UniValue val)
Serialized script, used inside transaction inputs and outputs.
auto Join(const C &container, const S &separator, UnaryOp unary_op)
Join all container items.
Section(const std::string &left, const std::string &right)
const std::string m_description
const UniValue & get_obj() const
void Push(const RPCArg &arg, const size_t current_indent=5, const OuterType outer_type=OuterType::NONE)
Recursive helper to translate an RPCArg into sections.
#define NONFATAL_UNREACHABLE()
NONFATAL_UNREACHABLE() is a macro that is used to mark unreachable code.
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE
A reference to a CKey: the Hash160 of its serialized public key.
Special type representing a floating point amount (can be either NUM or STR)
std::vector< unsigned char > ParseHexO(const UniValue &o, std::string strKey)
UniValue MatchesType(const UniValue &request) const
Check whether the request JSON type matches.
bilingual_str ErrorString(const Result< T > &result)
CAmount AmountFromValue(const UniValue &value, int decimals)
Validate and return a CAmount from a UniValue number or string.
std::vector< CScript > EvalDescriptorStringOrObject(const UniValue &scanobject, FlatSigningProvider &provider, const bool expand_priv)
Evaluate a descriptor given as a string, or as a {"desc":...,"range":...} object, with default range ...
UniValue MatchesType(const UniValue &result) const
Check whether the result JSON type matches.
#define STR_INTERNAL_BUG(msg)
std::string ToDescriptionString(bool is_named_arg) const
Return the description string, including the argument type and whether the argument is required...
No valid connection manager instance found.
void PushSection(const Section &s)
UniValue JSONRPCTransactionError(TransactionError terr, const std::string &err_string)
RPCErrorCode
Bitcoin RPC error codes.
Special dictionary with keys that are not literals.
std::string ToString() const
Concatenate all sections with proper padding.
#define TMPL_INST(check_param, ret_type, return_code)
UniValue HandleRequest(const JSONRPCRequest &request) const
std::string ToString(bool oneline) const
Return the type string of the argument.
CTxDestination DecodeDestination(const std::string &str, std::string &error_msg, std::vector< int > *error_locations)
A pair of strings that can be aligned (through padding) with other Sections later on...
std::string TrimString(std::string_view str, std::string_view pattern=" \\\)
Only for Witness versions not already defined above.
CPubKey AddrToPubKey(const FillableSigningProvider &keystore, const std::string &addr_in)
#define PACKAGE_BUGREPORT
Error parsing or validating structure in raw format.
const std::string UNIX_EPOCH_TIME
String used to describe UNIX epoch time in documentation, factored out to a constant for consistency...
Special type to denote elision (...)
static void CheckRequiredOrDefault(const RPCArg ¶m)
std::string ToStringObj(bool oneline) const
Return the type string of the argument when it is in an object (dict).