5 #if defined(HAVE_CONFIG_H) 27 #include <string_view> 31 const std::string
EXAMPLE_ADDRESS[2] = {
"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl",
"bc1q02ad21edsxd23d32dfgqqsz4vv4nmtfzuklhy3"};
35 std::vector<std::string>
ret;
36 using U = std::underlying_type<TxoutType>::type;
44 const std::map<std::string, UniValueType>& typesExpected,
48 for (
const auto&
t : typesExpected) {
50 if (!fAllowNull && v.
isNull())
53 if (!(
t.second.typeAny || v.
type() ==
t.second.type || (fAllowNull && v.
isNull())))
59 for (
const std::string&
k : o.
getKeys())
61 if (typesExpected.count(
k) == 0)
63 std::string err =
strprintf(
"Unexpected key %s",
k);
91 const std::string& strHex(v.
get_str());
92 if (64 != strHex.length())
123 std::string ShellQuote(
const std::string& s)
126 result.reserve(s.size() * 2);
127 for (
const char ch: s) {
134 return "'" + result +
"'";
142 std::string ShellQuoteIfNeeded(
const std::string& s)
144 for (
const char ch: s) {
145 if (ch ==
' ' || ch ==
'\'' || ch ==
'"') {
146 return ShellQuote(s);
157 return "> bitcoin-cli " + methodname +
" " +
args +
"\n";
162 std::string result =
"> bitcoin-cli -named " + methodname;
163 for (
const auto& argpair:
args) {
164 const auto& value = argpair.second.isStr()
165 ? argpair.second.get_str()
166 : argpair.second.write();
167 result +=
" " + argpair.first +
"=" + ShellQuoteIfNeeded(value);
175 return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\": \"curltest\", " 176 "\"method\": \"" + methodname +
"\", \"params\": [" +
args +
"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/\n";
182 for (
const auto& param:
args) {
183 params.
pushKV(param.first, param.second);
186 return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\": \"curltest\", " 187 "\"method\": \"" + methodname +
"\", \"params\": " + params.
write() +
"}' -H 'content-type: text/plain;' http://127.0.0.1:8332/\n";
193 if (!
IsHex(hex_in)) {
215 if (!keystore.
GetPubKey(key, vchPubKey)) {
231 if ((
int)pubkeys.size() < required) {
242 if (!
pk.IsCompressed()) {
276 obj.
pushKV(
"isscript",
false);
277 obj.
pushKV(
"iswitness",
false);
284 obj.
pushKV(
"isscript",
true);
285 obj.
pushKV(
"iswitness",
false);
292 obj.
pushKV(
"isscript",
false);
293 obj.
pushKV(
"iswitness",
true);
294 obj.
pushKV(
"witness_version", 0);
302 obj.
pushKV(
"isscript",
true);
303 obj.
pushKV(
"iswitness",
true);
304 obj.
pushKV(
"witness_version", 0);
312 obj.
pushKV(
"isscript",
true);
313 obj.
pushKV(
"iswitness",
true);
314 obj.
pushKV(
"witness_version", 1);
322 obj.
pushKV(
"iswitness",
true);
323 obj.
pushKV(
"witness_version",
id.GetWitnessVersion());
324 obj.
pushKV(
"witness_program",
HexStr(
id.GetWitnessProgram()));
348 return result.value();
353 const int target{value.
getInt<
int>()};
354 const unsigned int unsigned_target{
static_cast<unsigned int>(target)};
355 if (target < 1 || unsigned_target > max_target) {
358 return unsigned_target;
382 if (err_string.length() > 0) {
394 Section(
const std::string& left,
const std::string& right)
419 const auto indent = std::string(current_indent,
' ');
420 const auto indent_next = std::string(current_indent + 2,
' ');
432 if (is_top_level_arg)
return;
446 PushSection({indent + (push_name ?
"\"" + arg.
GetName() +
"\": " :
"") +
"{", right});
447 for (
const auto& arg_inner : arg.
m_inner) {
453 PushSection({indent +
"}" + (is_top_level_arg ?
"" :
","),
""});
458 left += push_name ?
"\"" + arg.
GetName() +
"\": " :
"";
462 for (
const auto& arg_inner : arg.
m_inner) {
466 PushSection({indent +
"]" + (is_top_level_arg ?
"" :
","),
""});
483 if (s.m_right.empty()) {
489 std::string left = s.m_left;
490 left.resize(pad,
' ');
496 size_t new_line_pos = s.m_right.find_first_of(
'\n');
498 right += s.m_right.substr(begin, new_line_pos - begin);
499 if (new_line_pos == std::string::npos) {
502 right +=
"\n" + std::string(pad,
' ');
503 begin = s.m_right.find_first_not_of(
' ', new_line_pos + 1);
504 if (begin == std::string::npos) {
507 new_line_pos = s.m_right.find_first_of(
'\n', begin + 1);
517 :
RPCHelpMan{std::move(
name), std::move(description), std::move(
args), std::move(results), std::move(examples),
nullptr} {}
520 : m_name{std::move(
name)},
521 m_fun{std::move(fun)},
522 m_description{std::move(description)},
523 m_args{std::move(
args)},
524 m_results{std::move(results)},
525 m_examples{std::move(examples)}
530 enum ParamType { POSITIONAL = 1, NAMED = 2, NAMED_ONLY = 4 };
531 std::map<std::string, int> param_names;
533 for (
const auto& arg : m_args) {
534 std::vector<std::string> names =
SplitString(arg.m_names,
'|');
536 for (
const std::string&
name : names) {
537 auto& param_type = param_names[
name];
540 param_type |= POSITIONAL;
543 for (
const auto& inner : arg.m_inner) {
544 std::vector<std::string> inner_names =
SplitString(inner.m_names,
'|');
545 for (
const std::string& inner_name : inner_names) {
546 auto& param_type = param_names[inner_name];
547 CHECK_NONFATAL(!(param_type & POSITIONAL) || inner.m_opts.also_positional);
550 param_type |= inner.m_opts.also_positional ? NAMED : NAMED_ONLY;
555 if (arg.m_fallback.index() == 2) {
557 switch (std::get<RPCArg::Default>(arg.m_fallback).getType()) {
589 if (r.m_cond.empty()) {
590 result +=
"\nResult:\n";
592 result +=
"\nResult (" + r.m_cond +
"):\n";
595 r.ToSections(sections);
616 throw std::runtime_error(
ToString());
619 for (
size_t i{0}; i <
m_args.size(); ++i) {
620 const auto& arg{
m_args.at(i)};
622 if (!match.isTrue()) {
623 arg_mismatch.
pushKV(
strprintf(
"Position %s (%s)", i + 1, arg.m_names), std::move(match));
626 if (!arg_mismatch.empty()) {
637 if (match.isTrue()) {
641 mismatch.push_back(match);
643 if (!mismatch.isNull()) {
645 mismatch.empty() ?
"no possible results defined" :
646 mismatch.size() == 1 ? mismatch[0].write(4) :
648 throw std::runtime_error{
649 strprintf(
"Internal bug detected: RPC call \"%s\" returned incorrect type:\n%s\n%s %s\nPlease report this issue here: %s\n",
663 const RPCArg& param{params.at(i)};
664 if (check) check(param);
666 if (!arg.isNull())
return &arg;
667 if (!std::holds_alternative<RPCArg::Default>(param.m_fallback))
return nullptr;
668 return &std::get<RPCArg::Default>(param.m_fallback);
680 #define TMPL_INST(check_param, ret_type, return_code) \ 682 ret_type RPCHelpMan::ArgValue<ret_type>(size_t i) const \ 684 const UniValue* maybe_arg{ \ 685 DetailMaybeArg(check_param, m_args, m_req, i), \ 689 void force_semicolon(ret_type) 693 TMPL_INST(
nullptr, std::optional<double>, maybe_arg ? std::optional{maybe_arg->get_real()} : std::nullopt;);
694 TMPL_INST(
nullptr, std::optional<bool>, maybe_arg ? std::optional{maybe_arg->get_bool()} : std::nullopt;);
695 TMPL_INST(
nullptr,
const std::string*, maybe_arg ? &maybe_arg->get_str() :
nullptr;);
706 size_t num_required_args = 0;
707 for (
size_t n =
m_args.size(); n > 0; --n) {
708 if (!
m_args.at(n - 1).IsOptional()) {
709 num_required_args = n;
713 return num_required_args <= num_args && num_args <=
m_args.size();
718 std::vector<std::pair<std::string, bool>>
ret;
720 for (
const auto& arg :
m_args) {
722 for (
const auto& inner : arg.m_inner) {
723 ret.emplace_back(inner.m_names,
true);
726 ret.emplace_back(arg.m_names,
false);
737 bool was_optional{
false};
738 for (
const auto& arg :
m_args) {
739 if (arg.m_opts.hidden)
break;
740 const bool optional = arg.IsOptional();
743 if (!was_optional)
ret +=
"( ";
746 if (was_optional)
ret +=
") ";
747 was_optional =
false;
749 ret += arg.ToString(
true);
751 if (was_optional)
ret +=
" )";
759 for (
size_t i{0}; i <
m_args.size(); ++i) {
760 const auto& arg =
m_args.at(i);
761 if (arg.m_opts.hidden)
break;
764 sections.
m_sections.emplace_back(::
ToString(i + 1) +
". " + arg.GetFirstName(), arg.ToDescriptionString(
true));
772 for (
const auto& arg_inner : arg.m_inner) {
773 named_only_sections.
PushSection({arg_inner.GetFirstName(), arg_inner.ToDescriptionString(
true)});
774 named_only_sections.
Push(arg_inner);
781 if (!named_only_sections.
m_sections.empty())
ret +=
"\nNamed Arguments:\n";
797 auto push_back_arg_info = [&arr](
const std::string& rpc_name,
int pos,
const std::string& arg_name,
const RPCArg::Type& type) {
799 map.push_back(rpc_name);
801 map.push_back(arg_name);
807 for (
int i{0}; i < int(
m_args.size()); ++i) {
808 const auto& arg =
m_args.at(i);
809 std::vector<std::string> arg_names =
SplitString(arg.m_names,
'|');
810 for (
const auto& arg_name : arg_names) {
811 push_back_arg_info(
m_name, i, arg_name, arg.m_type);
813 for (
const auto& inner : arg.m_inner) {
814 std::vector<std::string> inner_names =
SplitString(inner.m_names,
'|');
815 for (
const std::string& inner_name : inner_names) {
816 push_back_arg_info(
m_name, i, inner_name, inner.m_type);
848 case Type::OBJ_NAMED_PARAMS:
849 case Type::OBJ_USER_KEYS: {
864 if (!exp_type)
return true;
866 if (*exp_type != request.
getType()) {
910 ret +=
"numeric or string";
914 ret +=
"numeric or array";
924 ret +=
"json object";
934 ret +=
", optional, default=" + std::get<RPCArg::DefaultHint>(
m_fallback);
936 ret +=
", optional, default=" + std::get<RPCArg::Default>(
m_fallback).write();
938 switch (std::get<RPCArg::Optional>(
m_fallback)) {
940 if (is_named_arg)
ret +=
", optional";
959 const std::string indent(current_indent,
' ');
960 const std::string indent_next(current_indent + 2,
' ');
963 const std::string maybe_separator{outer_type !=
OuterType::NONE ?
"," :
""};
966 const std::string maybe_key{
972 const auto Description = [&](
const std::string& type) {
973 return "(" + type + (this->
m_optional ?
", optional" :
"") +
")" +
987 sections.
PushSection({indent +
"null" + maybe_separator, Description(
"json null")});
991 sections.
PushSection({indent + maybe_key +
"\"str\"" + maybe_separator, Description(
"string")});
995 sections.
PushSection({indent + maybe_key +
"n" + maybe_separator, Description(
"numeric")});
999 sections.
PushSection({indent + maybe_key +
"\"hex\"" + maybe_separator, Description(
"string")});
1003 sections.
PushSection({indent + maybe_key +
"n" + maybe_separator, Description(
"numeric")});
1007 sections.
PushSection({indent + maybe_key +
"xxx" + maybe_separator, Description(
"numeric")});
1011 sections.
PushSection({indent + maybe_key +
"true|false" + maybe_separator, Description(
"boolean")});
1016 sections.
PushSection({indent + maybe_key +
"[", Description(
"json array")});
1017 for (
const auto& i :
m_inner) {
1025 sections.
m_sections.back().m_left.pop_back();
1027 sections.
PushSection({indent +
"]" + maybe_separator,
""});
1033 sections.
PushSection({indent + maybe_key +
"{}", Description(
"empty JSON object")});
1036 sections.
PushSection({indent + maybe_key +
"{", Description(
"json object")});
1037 for (
const auto& i :
m_inner) {
1045 sections.
m_sections.back().m_left.pop_back();
1047 sections.
PushSection({indent +
"}" + maybe_separator,
""});
1060 return std::nullopt;
1066 case Type::STR_HEX: {
1070 case Type::STR_AMOUNT:
1071 case Type::NUM_TIME: {
1077 case Type::ARR_FIXED:
1096 if (!exp_type)
return true;
1098 if (*exp_type != result.
getType()) {
1110 if (errors.
empty())
return true;
1119 for (
size_t i{0}; i < result.
get_obj().
size(); ++i) {
1121 if (!match.isTrue()) errors.
pushKV(result.
getKeys()[i], match);
1123 if (errors.
empty())
return true;
1126 std::set<std::string> doc_keys;
1127 for (
const auto& doc_entry :
m_inner) {
1128 doc_keys.insert(doc_entry.m_key_name);
1130 std::map<std::string, UniValue> result_obj;
1132 for (
const auto& result_entry : result_obj) {
1133 if (doc_keys.find(result_entry.first) == doc_keys.end()) {
1134 errors.
pushKV(result_entry.first,
"key returned that was not in doc");
1138 for (
const auto& doc_entry :
m_inner) {
1139 const auto result_it{result_obj.find(doc_entry.m_key_name)};
1140 if (result_it == result_obj.end()) {
1141 if (!doc_entry.m_optional) {
1142 errors.
pushKV(doc_entry.m_key_name,
"key missing, despite not being optional in doc");
1146 UniValue match{doc_entry.MatchesType(result_it->second)};
1147 if (!match.isTrue()) errors.
pushKV(doc_entry.m_key_name, match);
1149 if (errors.
empty())
return true;
1179 return res +
"\"str\"";
1181 return res +
"\"hex\"";
1185 return res +
"n or [n,n]";
1187 return res +
"amount";
1189 return res +
"bool";
1192 for (
const auto& i :
m_inner) {
1193 res += i.ToString(oneline) +
",";
1195 return res +
"...]";
1209 throw std::runtime_error{
1233 return "{" + res +
"}";
1235 return "{" + res +
",...}";
1240 for (
const auto& i :
m_inner) {
1241 res += i.ToString(oneline) +
",";
1243 return "[" + res +
"...]";
1251 if (value.
isNum()) {
1252 return {0, value.
getInt<int64_t>()};
1255 int64_t low = value[0].
getInt<int64_t>();
1256 int64_t high = value[1].
getInt<int64_t>();
1270 if ((high >> 31) != 0) {
1273 if (high >= low + 1000000) {
1281 std::string desc_str;
1282 std::pair<int64_t, int64_t> range = {0, 1000};
1283 if (scanobject.
isStr()) {
1284 desc_str = scanobject.
get_str();
1285 }
else if (scanobject.
isObject()) {
1288 desc_str = desc_uni.
get_str();
1290 if (!range_uni.isNull()) {
1298 auto desc =
Parse(desc_str, provider,
error);
1302 if (!desc->IsRange()) {
1306 std::vector<CScript>
ret;
1307 for (
int i = range.first; i <= range.second; ++i) {
1308 std::vector<CScript> scripts;
1309 if (!desc->Expand(i, provider, scripts, provider)) {
1313 desc->ExpandPrivate(i, provider, provider);
1315 std::move(scripts.begin(), scripts.end(), std::back_inserter(
ret));
1325 for (
const auto& s : bilingual_strings) {
1326 result.push_back(s.original);
1333 if (warnings.
empty())
return;
1334 obj.
pushKV(
"warnings", warnings);
1339 if (warnings.empty())
return;
char const * json() noexcept
Template to generate JSON data.
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.
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.
void CheckInnerDoc() const
uint256 ParseHashO(const UniValue &o, std::string_view strKey)
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)
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)
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.
CFeeRate ParseFeeRate(const UniValue &json)
Parse a json number or string, denoting BTC/kvB, into a CFeeRate (sat/kvB).
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
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::vector< unsigned char > ParseHexO(const UniValue &o, std::string_view strKey)
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
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.
uint256 ParseHashV(const UniValue &v, std::string_view name)
Utilities: convert hex-encoded Values (throws error if not hex).
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)
Fee rate in satoshis per kilovirtualbyte: CAmount / kvB.
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)
static constexpr CAmount COIN
The amount of satoshis in one BTC.
std::string ToStringObj(bool oneline) const
Return the type string of the argument when it is in an object (dict).
std::vector< unsigned char > ParseHexV(const UniValue &v, std::string_view name)