22 const std::string
EXAMPLE_ADDRESS[2] = {
"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl",
"bc1q02ad21edsxd23d32dfgqqsz4vv4nmtfzuklhy3"};
26 std::vector<std::string>
ret;
27 using U = std::underlying_type<TxoutType>::type;
35 const std::map<std::string, UniValueType>& typesExpected,
39 for (
const auto&
t : typesExpected) {
41 if (!fAllowNull && v.
isNull())
44 if (!(
t.second.typeAny || v.
type() ==
t.second.type || (fAllowNull && v.
isNull())))
50 for (
const std::string&
k : o.
getKeys())
52 if (typesExpected.count(
k) == 0)
54 std::string err =
strprintf(
"Unexpected key %s",
k);
75 const std::string& strHex(v.
get_str());
76 if (64 != strHex.length())
107 std::string ShellQuote(
const std::string& s)
110 result.reserve(s.size() * 2);
111 for (
const char ch: s) {
118 return "'" + result +
"'";
126 std::string ShellQuoteIfNeeded(
const std::string& s)
128 for (
const char ch: s) {
129 if (ch ==
' ' || ch ==
'\'' || ch ==
'"') {
130 return ShellQuote(s);
141 return "> bitcoin-cli " + methodname +
" " +
args +
"\n";
146 std::string result =
"> bitcoin-cli -named " + methodname;
147 for (
const auto& argpair:
args) {
148 const auto& value = argpair.second.isStr()
149 ? argpair.second.get_str()
150 : argpair.second.write();
151 result +=
" " + argpair.first +
"=" + ShellQuoteIfNeeded(value);
159 return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\": \"curltest\", "
160 "\"method\": \"" + methodname +
"\", \"params\": [" +
args +
"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/\n";
166 for (
const auto& param:
args) {
167 params.
pushKV(param.first, param.second);
170 return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\": \"curltest\", "
171 "\"method\": \"" + methodname +
"\", \"params\": " + params.
write() +
"}' -H 'content-type: text/plain;' http://127.0.0.1:8332/\n";
177 if (!
IsHex(hex_in)) {
199 if (!keystore.
GetPubKey(key, vchPubKey)) {
215 if ((
int)pubkeys.size() < required) {
226 if (!
pk.IsCompressed()) {
255 obj.
pushKV(
"isscript",
false);
256 obj.
pushKV(
"iswitness",
false);
263 obj.
pushKV(
"isscript",
true);
264 obj.
pushKV(
"iswitness",
false);
271 obj.
pushKV(
"isscript",
false);
272 obj.
pushKV(
"iswitness",
true);
273 obj.
pushKV(
"witness_version", 0);
281 obj.
pushKV(
"isscript",
true);
282 obj.
pushKV(
"iswitness",
true);
283 obj.
pushKV(
"witness_version", 0);
291 obj.
pushKV(
"isscript",
true);
292 obj.
pushKV(
"iswitness",
true);
293 obj.
pushKV(
"witness_version", 1);
301 obj.
pushKV(
"iswitness",
true);
302 obj.
pushKV(
"witness_version", (
int)
id.version);
303 obj.
pushKV(
"witness_program",
HexStr({
id.program,
id.length}));
315 const int target{value.
getInt<
int>()};
316 const unsigned int unsigned_target{
static_cast<unsigned int>(target)};
317 if (target < 1 || unsigned_target > max_target) {
320 return unsigned_target;
344 if (err_string.length() > 0) {
356 Section(
const std::string& left,
const std::string& right)
381 const auto indent = std::string(current_indent,
' ');
382 const auto indent_next = std::string(current_indent + 2,
' ');
394 if (is_top_level_arg)
return;
408 PushSection({indent + (push_name ?
"\"" + arg.
GetName() +
"\": " :
"") +
"{", right});
409 for (
const auto& arg_inner : arg.
m_inner) {
415 PushSection({indent +
"}" + (is_top_level_arg ?
"" :
","),
""});
420 left += push_name ?
"\"" + arg.
GetName() +
"\": " :
"";
424 for (
const auto& arg_inner : arg.
m_inner) {
428 PushSection({indent +
"]" + (is_top_level_arg ?
"" :
","),
""});
445 if (s.m_right.empty()) {
451 std::string left = s.m_left;
452 left.resize(pad,
' ');
458 size_t new_line_pos = s.m_right.find_first_of(
'\n');
460 right += s.m_right.substr(begin, new_line_pos - begin);
461 if (new_line_pos == std::string::npos) {
464 right +=
"\n" + std::string(pad,
' ');
465 begin = s.m_right.find_first_not_of(
' ', new_line_pos + 1);
466 if (begin == std::string::npos) {
469 new_line_pos = s.m_right.find_first_of(
'\n', begin + 1);
483 m_fun{
std::move(fun)},
484 m_description{
std::move(description)},
486 m_results{
std::move(results)},
487 m_examples{
std::move(examples)}
492 enum ParamType { POSITIONAL = 1, NAMED = 2, NAMED_ONLY = 4 };
493 std::map<std::string, int> param_names;
495 for (
const auto& arg :
m_args) {
496 std::vector<std::string> names =
SplitString(arg.m_names,
'|');
498 for (
const std::string&
name : names) {
499 auto& param_type = param_names[
name];
502 param_type |= POSITIONAL;
505 for (
const auto& inner : arg.m_inner) {
506 std::vector<std::string> inner_names =
SplitString(inner.m_names,
'|');
507 for (
const std::string& inner_name : inner_names) {
508 auto& param_type = param_names[inner_name];
509 CHECK_NONFATAL(!(param_type & POSITIONAL) || inner.m_opts.also_positional);
512 param_type |= inner.m_opts.also_positional ? NAMED : NAMED_ONLY;
517 if (arg.m_fallback.index() == 2) {
519 switch (std::get<RPCArg::Default>(arg.m_fallback).getType()) {
551 if (r.m_cond.empty()) {
552 result +=
"\nResult:\n";
554 result +=
"\nResult (" + r.m_cond +
"):\n";
557 r.ToSections(sections);
578 throw std::runtime_error(
ToString());
581 for (
size_t i{0}; i <
m_args.size(); ++i) {
582 const auto& arg{
m_args.at(i)};
584 if (!match.isTrue()) {
585 arg_mismatch.
pushKV(
strprintf(
"Position %s (%s)", i + 1, arg.m_names), std::move(match));
588 if (!arg_mismatch.empty()) {
596 if (match.isTrue()) {
600 mismatch.push_back(match);
602 if (!mismatch.isNull()) {
604 mismatch.empty() ?
"no possible results defined" :
605 mismatch.size() == 1 ? mismatch[0].write(4) :
607 throw std::runtime_error{
608 strprintf(
"Internal bug detected: RPC call \"%s\" returned incorrect type:\n%s\n%s %s\nPlease report this issue here: %s\n",
619 size_t num_required_args = 0;
620 for (
size_t n =
m_args.size(); n > 0; --n) {
621 if (!
m_args.at(n - 1).IsOptional()) {
622 num_required_args = n;
626 return num_required_args <= num_args && num_args <=
m_args.size();
631 std::vector<std::pair<std::string, bool>>
ret;
633 for (
const auto& arg :
m_args) {
635 for (
const auto& inner : arg.m_inner) {
636 ret.emplace_back(inner.m_names,
true);
639 ret.emplace_back(arg.m_names,
false);
650 bool was_optional{
false};
651 for (
const auto& arg :
m_args) {
652 if (arg.m_opts.hidden)
break;
653 const bool optional = arg.IsOptional();
656 if (!was_optional)
ret +=
"( ";
659 if (was_optional)
ret +=
") ";
660 was_optional =
false;
662 ret += arg.ToString(
true);
664 if (was_optional)
ret +=
" )";
672 for (
size_t i{0}; i <
m_args.size(); ++i) {
673 const auto& arg =
m_args.at(i);
674 if (arg.m_opts.hidden)
break;
677 sections.
m_sections.emplace_back(::
ToString(i + 1) +
". " + arg.GetFirstName(), arg.ToDescriptionString(
true));
685 for (
const auto& arg_inner : arg.m_inner) {
686 named_only_sections.
PushSection({arg_inner.GetFirstName(), arg_inner.ToDescriptionString(
true)});
687 named_only_sections.
Push(arg_inner);
694 if (!named_only_sections.
m_sections.empty())
ret +=
"\nNamed Arguments:\n";
710 auto push_back_arg_info = [&arr](
const std::string& rpc_name,
int pos,
const std::string& arg_name,
const RPCArg::Type& type) {
712 map.push_back(rpc_name);
714 map.push_back(arg_name);
720 for (
int i{0}; i < int(
m_args.size()); ++i) {
721 const auto& arg =
m_args.at(i);
722 std::vector<std::string> arg_names =
SplitString(arg.m_names,
'|');
723 for (
const auto& arg_name : arg_names) {
724 push_back_arg_info(
m_name, i, arg_name, arg.m_type);
726 for (
const auto& inner : arg.m_inner) {
727 std::vector<std::string> inner_names =
SplitString(inner.m_names,
'|');
728 for (
const std::string& inner_name : inner_names) {
729 push_back_arg_info(
m_name, i, inner_name, inner.m_type);
761 case Type::OBJ_NAMED_PARAMS:
762 case Type::OBJ_USER_KEYS: {
777 if (!exp_type)
return true;
779 if (*exp_type != request.
getType()) {
823 ret +=
"numeric or string";
827 ret +=
"numeric or array";
837 ret +=
"json object";
847 ret +=
", optional, default=" + std::get<RPCArg::DefaultHint>(
m_fallback);
849 ret +=
", optional, default=" + std::get<RPCArg::Default>(
m_fallback).write();
851 switch (std::get<RPCArg::Optional>(
m_fallback)) {
853 if (is_named_arg)
ret +=
", optional";
872 const std::string indent(current_indent,
' ');
873 const std::string indent_next(current_indent + 2,
' ');
876 const std::string maybe_separator{outer_type !=
OuterType::NONE ?
"," :
""};
879 const std::string maybe_key{
885 const auto Description = [&](
const std::string& type) {
886 return "(" + type + (this->
m_optional ?
", optional" :
"") +
")" +
900 sections.
PushSection({indent +
"null" + maybe_separator, Description(
"json null")});
904 sections.
PushSection({indent + maybe_key +
"\"str\"" + maybe_separator, Description(
"string")});
908 sections.
PushSection({indent + maybe_key +
"n" + maybe_separator, Description(
"numeric")});
912 sections.
PushSection({indent + maybe_key +
"\"hex\"" + maybe_separator, Description(
"string")});
916 sections.
PushSection({indent + maybe_key +
"n" + maybe_separator, Description(
"numeric")});
920 sections.
PushSection({indent + maybe_key +
"xxx" + maybe_separator, Description(
"numeric")});
924 sections.
PushSection({indent + maybe_key +
"true|false" + maybe_separator, Description(
"boolean")});
929 sections.
PushSection({indent + maybe_key +
"[", Description(
"json array")});
930 for (
const auto& i :
m_inner) {
940 sections.
PushSection({indent +
"]" + maybe_separator,
""});
946 sections.
PushSection({indent + maybe_key +
"{}", Description(
"empty JSON object")});
949 sections.
PushSection({indent + maybe_key +
"{", Description(
"json object")});
950 for (
const auto& i :
m_inner) {
960 sections.
PushSection({indent +
"}" + maybe_separator,
""});
979 case Type::STR_HEX: {
983 case Type::STR_AMOUNT:
984 case Type::NUM_TIME: {
990 case Type::ARR_FIXED:
1009 if (!exp_type)
return true;
1011 if (*exp_type != result.
getType()) {
1017 for (
size_t i{0}; i < result.
get_array().size(); ++i) {
1023 if (errors.
empty())
return true;
1032 for (
size_t i{0}; i < result.
get_obj().size(); ++i) {
1034 if (!match.isTrue()) errors.
pushKV(result.
getKeys()[i], match);
1036 if (errors.
empty())
return true;
1039 std::set<std::string> doc_keys;
1040 for (
const auto& doc_entry :
m_inner) {
1041 doc_keys.insert(doc_entry.m_key_name);
1043 std::map<std::string, UniValue> result_obj;
1045 for (
const auto& result_entry : result_obj) {
1046 if (doc_keys.find(result_entry.first) == doc_keys.end()) {
1047 errors.
pushKV(result_entry.first,
"key returned that was not in doc");
1051 for (
const auto& doc_entry :
m_inner) {
1052 const auto result_it{result_obj.find(doc_entry.m_key_name)};
1053 if (result_it == result_obj.end()) {
1054 if (!doc_entry.m_optional) {
1055 errors.
pushKV(doc_entry.m_key_name,
"key missing, despite not being optional in doc");
1059 UniValue match{doc_entry.MatchesType(result_it->second)};
1060 if (!match.isTrue()) errors.
pushKV(doc_entry.m_key_name, match);
1062 if (errors.
empty())
return true;
1092 return res +
"\"str\"";
1094 return res +
"\"hex\"";
1098 return res +
"n or [n,n]";
1100 return res +
"amount";
1102 return res +
"bool";
1105 for (
const auto& i :
m_inner) {
1106 res += i.ToString(oneline) +
",";
1108 return res +
"...]";
1138 return "{" + res +
"}";
1140 return "{" + res +
",...}";
1145 for (
const auto& i :
m_inner) {
1146 res += i.ToString(oneline) +
",";
1148 return "[" + res +
"...]";
1156 if (value.
isNum()) {
1157 return {0, value.
getInt<int64_t>()};
1160 int64_t low = value[0].
getInt<int64_t>();
1161 int64_t high = value[1].
getInt<int64_t>();
1175 if ((high >> 31) != 0) {
1178 if (high >= low + 1000000) {
1186 std::string desc_str;
1187 std::pair<int64_t, int64_t> range = {0, 1000};
1188 if (scanobject.
isStr()) {
1189 desc_str = scanobject.
get_str();
1190 }
else if (scanobject.
isObject()) {
1193 desc_str = desc_uni.get_str();
1195 if (!range_uni.isNull()) {
1203 auto desc =
Parse(desc_str, provider,
error);
1207 if (!desc->IsRange()) {
1211 std::vector<CScript>
ret;
1212 for (
int i = range.first; i <= range.second; ++i) {
1213 std::vector<CScript> scripts;
1214 if (!desc->Expand(i, provider, scripts, provider)) {
1218 desc->ExpandPrivate(i, provider, provider);
1220 std::move(scripts.begin(), scripts.end(), std::back_inserter(
ret));
1233 return servicesNames;
1241 for (
const auto& s : bilingual_strings) {
1242 result.push_back(s.original);
1249 if (warnings.
empty())
return;
1250 obj.
pushKV(
"warnings", warnings);
1255 if (warnings.empty())
return;
bool MoneyRange(const CAmount &nValue)
int64_t CAmount
Amount in satoshis (Can be negative)
#define PACKAGE_BUGREPORT
#define CHECK_NONFATAL(condition)
Identity function.
#define NONFATAL_UNREACHABLE()
NONFATAL_UNREACHABLE() is a macro that is used to mark unreachable code.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
A reference to a CKey: the Hash160 of its serialized public key.
An encapsulated public key.
bool IsFullyValid() const
fully validate whether this is a valid public key (more expensive than IsValid())
Serialized script, used inside transaction inputs and outputs.
UniValue operator()(const WitnessUnknown &id) const
UniValue operator()(const WitnessV0KeyHash &id) const
UniValue operator()(const WitnessV0ScriptHash &id) const
DescribeAddressVisitor()=default
UniValue operator()(const CNoDestination &dest) const
UniValue operator()(const WitnessV1Taproot &tap) const
UniValue operator()(const ScriptHash &scriptID) const
UniValue operator()(const PKHash &keyID) const
Fillable signing provider that keeps keys in an address->secret map.
virtual bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const override
enum JSONRPCRequest::Mode mode
std::function< UniValue(const RPCHelpMan &, const JSONRPCRequest &)> RPCMethodImpl
const RPCExamples m_examples
RPCHelpMan(std::string name, std::string description, std::vector< RPCArg > args, RPCResults results, RPCExamples examples)
const std::string m_description
bool IsValidNumArgs(size_t num_args) const
If the supplied number of args is neither too small nor too high.
const RPCMethodImpl m_fun
const RPCResults m_results
const std::vector< RPCArg > m_args
std::string ToString() const
UniValue GetArgMap() const
Return the named args that need to be converted from string to another JSON type.
std::vector< std::pair< std::string, bool > > GetArgNames() const
Return list of arguments and whether they are named-only.
UniValue HandleRequest(const JSONRPCRequest &request) const
void push_back(UniValue val)
const std::string & get_str() const
const UniValue & find_value(std::string_view key) const
enum VType getType() const
std::string write(unsigned int prettyIndent=0, unsigned int indentLevel=0) const
const UniValue & get_obj() const
const std::string & getValStr() const
const std::vector< std::string > & getKeys() const
const UniValue & get_array() const
void pushKV(std::string key, UniValue val)
void getObjMap(std::map< std::string, UniValue > &kv) const
constexpr bool IsNull() const
static UniValue Parse(std::string_view raw)
Parse string to UniValue or throw runtime_error if string contains invalid JSON.
std::string FormatFullVersion()
bilingual_str TransactionErrorString(const TransactionError err)
CTxDestination DecodeDestination(const std::string &str, std::string &error_msg, std::vector< int > *error_locations)
bool error(const char *fmt, const Args &... args)
CTxDestination AddAndGetDestinationForScript(FillableSigningProvider &keystore, const CScript &script, OutputType type)
Get a destination of the requested type (if possible) to the specified script.
std::vector< std::string > serviceFlagsToStr(uint64_t flags)
Convert service flags (a bitmask of NODE_*) to human readable strings.
ServiceFlags
nServices flags
UniValue JSONRPCError(int code, const std::string &message)
RPCErrorCode
Bitcoin RPC error codes.
@ RPC_TRANSACTION_ALREADY_IN_CHAIN
@ RPC_TYPE_ERROR
Unexpected type was passed as parameter.
@ RPC_TRANSACTION_REJECTED
@ RPC_TRANSACTION_ERROR
Aliases for backward compatibility.
@ RPC_INVALID_PARAMETER
Invalid, missing or duplicate parameter.
@ RPC_DESERIALIZATION_ERROR
Error parsing or validating structure in raw format.
@ RPC_INVALID_ADDRESS_OR_KEY
Invalid address or key.
@ RPC_CLIENT_P2P_DISABLED
No valid connection manager instance found.
std::pair< int64_t, int64_t > ParseDescriptorRange(const UniValue &value)
Parse a JSON range specified as int64, or [int64, int64].
std::vector< unsigned char > ParseHexV(const UniValue &v, std::string strName)
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
UniValue GetServicesNames(ServiceFlags services)
Returns, given services flags, a list of humanly readable (known) network services.
CTxDestination AddAndGetMultisigDestination(const int required, const std::vector< CPubKey > &pubkeys, OutputType type, FillableSigningProvider &keystore, CScript &script_out)
std::string HelpExampleRpcNamed(const std::string &methodname, const RPCArgList &args)
CAmount AmountFromValue(const UniValue &value, int decimals)
Validate and return a CAmount from a UniValue number or string.
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...
static std::optional< UniValue::VType > ExpectedType(RPCArg::Type type)
void PushWarnings(const UniValue &warnings, UniValue &obj)
Push warning messages to an RPC "warnings" field as a JSON array of strings.
UniValue JSONRPCTransactionError(TransactionError terr, const std::string &err_string)
RPCErrorCode RPCErrorFromTransactionError(TransactionError terr)
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
const std::string UNIX_EPOCH_TIME
String used to describe UNIX epoch time in documentation, factored out to a constant for consistency.
std::string GetAllOutputTypes()
Gets all existing output types formatted for RPC help sections.
CPubKey HexToPubKey(const std::string &hex_in)
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 ...
uint256 ParseHashO(const UniValue &o, std::string strKey)
std::vector< unsigned char > ParseHexO(const UniValue &o, std::string strKey)
uint256 ParseHashV(const UniValue &v, std::string strName)
Utilities: convert hex-encoded Values (throws error if not hex).
const std::string EXAMPLE_ADDRESS[2]
Example bech32 addresses for the RPCExamples help documentation.
unsigned int ParseConfirmTarget(const UniValue &value, unsigned int max_target)
Parse a confirm target option and raise an RPC error if it is invalid.
void RPCTypeCheckObj(const UniValue &o, const std::map< std::string, UniValueType > &typesExpected, bool fAllowNull, bool fStrict)
static std::pair< int64_t, int64_t > ParseRange(const UniValue &value)
std::string HelpExampleCliNamed(const std::string &methodname, const RPCArgList &args)
CPubKey AddrToPubKey(const FillableSigningProvider &keystore, const std::string &addr_in)
UniValue DescribeAddress(const CTxDestination &dest)
std::vector< std::pair< std::string, UniValue > > RPCArgList
static constexpr bool DEFAULT_RPC_DOC_CHECK
OuterType
Serializing JSON objects depends on the outer type.
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE
static const int MAX_PUBKEYS_PER_MULTISIG
CKeyID GetKeyForDestination(const SigningProvider &store, const CTxDestination &dest)
Return the CKeyID of the key involved in a script (if there is a unique one).
CScript GetScriptForMultisig(int nRequired, const std::vector< CPubKey > &keys)
Generate a multisig script.
std::string GetTxnOutputType(TxoutType t)
Get the name of a TxoutType as a string.
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
@ WITNESS_UNKNOWN
Only for Witness versions not already defined above.
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
std::vector< Byte > ParseHex(std::string_view hex_str)
Like TryParseHex, but returns an empty vector on invalid input.
std::string TrimString(std::string_view str, std::string_view pattern=" \f\n\r\t\v")
std::vector< std::string > SplitString(std::string_view str, char sep)
auto Join(const C &container, const S &separator, UnaryOp unary_op)
Join all container items.
@ RANGE
Special type that is a NUM or [NUM,NUM].
@ OBJ_USER_KEYS
Special type where the user must set the keys e.g. to define multiple addresses; as opposed to e....
@ STR_HEX
Special type that is a STR with only hex chars.
@ AMOUNT
Special type representing a floating point amount (can be either NUM or STR)
@ OBJ_NAMED_PARAMS
Special type that behaves almost exactly like OBJ, defining an options object with a list of pre-defi...
const std::vector< RPCArg > m_inner
Only used for arrays or dicts.
const RPCArgOptions m_opts
const std::string m_names
The name of the arg (can be empty for inner args, can contain multiple aliases separated by | for nam...
const Fallback m_fallback
std::string ToString(bool oneline) const
Return the type string of the argument.
UniValue MatchesType(const UniValue &request) const
Check whether the request JSON type matches.
const std::string m_description
std::string ToDescriptionString(bool is_named_arg) const
Return the description string, including the argument type and whether the argument is required.
std::string GetName() const
Return the name, throws when there are aliases.
std::string GetFirstName() const
Return the first of all aliases.
std::string ToStringObj(bool oneline) const
Return the type string of the argument when it is in an object (dict).
@ OMITTED
Optional argument for which the default value is omitted from help text for one of two reasons:
std::vector< std::string > type_str
Should be empty unless it is supposed to override the auto-generated type strings....
std::string oneline_description
Should be empty unless it is supposed to override the auto-generated summary line.
std::string ToDescriptionString() const
const std::string m_examples
const std::string m_description
void ToSections(Sections §ions, OuterType outer_type=OuterType::NONE, const int current_indent=0) const
Append the sections of the result.
@ ELISION
Special type to denote elision (...)
@ NUM_TIME
Special numeric to denote unix epoch time.
@ ANY
Special type to disable type checks (for testing only)
@ ARR_FIXED
Special array that has a fixed number of entries.
@ OBJ_DYN
Special dictionary with keys that are not literals.
@ STR_HEX
Special string with only hex chars.
@ STR_AMOUNT
Special string to represent a floating point amount.
const std::vector< RPCResult > m_inner
Only used for arrays or dicts.
UniValue MatchesType(const UniValue &result) const
Check whether the result JSON type matches.
void CheckInnerDoc() const
const std::string m_key_name
Only used for dicts.
const bool m_skip_type_check
std::string ToDescriptionString() const
Return the description string.
const std::vector< RPCResult > m_results
A pair of strings that can be aligned (through padding) with other Sections later on.
Section(const std::string &left, const std::string &right)
const std::string m_right
Keeps track of RPCArgs by transforming them into sections for the purpose of serializing everything t...
void PushSection(const Section &s)
std::vector< Section > m_sections
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.
std::string ToString() const
Concatenate all sections with proper padding.
CTxDestination subtype to encode any future Witness version.
uint256 uint256S(const char *str)
const char * uvTypeName(UniValue::VType t)
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
bool ParseFixedPoint(std::string_view val, int decimals, int64_t *amount_out)
Parse number as fixed point according to JSON number syntax.
bool IsHex(std::string_view str)