![]() |
Bitcoin Core 30.99.0
P2P Digital Currency
|
#include <bitcoin-build-config.h>#include <chain.h>#include <clientversion.h>#include <common/args.h>#include <common/messages.h>#include <common/types.h>#include <consensus/amount.h>#include <core_io.h>#include <key_io.h>#include <node/types.h>#include <outputtype.h>#include <pow.h>#include <rpc/util.h>#include <script/descriptor.h>#include <script/interpreter.h>#include <script/signingprovider.h>#include <script/solver.h>#include <tinyformat.h>#include <uint256.h>#include <univalue.h>#include <util/check.h>#include <util/result.h>#include <util/strencodings.h>#include <util/string.h>#include <util/translation.h>#include <algorithm>#include <iterator>#include <string_view>#include <tuple>#include <utility>Go to the source code of this file.
Classes | |
| class | DescribeAddressVisitor |
| struct | Section |
| A pair of strings that can be aligned (through padding) with other Sections later on. More... | |
| struct | Sections |
| Keeps track of RPCArgs by transforming them into sections for the purpose of serializing everything to a single string. More... | |
Macros | |
| #define | TMPL_INST(check_param, ret_type, return_code) |
Typedefs | |
| using | CheckFn = void(const RPCArg &) |
Functions | |
| std::string | GetAllOutputTypes () |
| Gets all existing output types formatted for RPC help sections. More... | |
| void | RPCTypeCheckObj (const UniValue &o, const std::map< std::string, UniValueType > &typesExpected, bool fAllowNull, bool fStrict) |
| int | ParseVerbosity (const UniValue &arg, int default_verbosity, bool allow_bool) |
| Parses verbosity from provided UniValue. More... | |
| CAmount | AmountFromValue (const UniValue &value, int decimals) |
| Validate and return a CAmount from a UniValue number or string. More... | |
| CFeeRate | ParseFeeRate (const UniValue &json) |
| Parse a json number or string, denoting BTC/kvB, into a CFeeRate (sat/kvB). More... | |
| uint256 | ParseHashV (const UniValue &v, std::string_view name) |
| Utilities: convert hex-encoded Values (throws error if not hex). More... | |
| uint256 | ParseHashO (const UniValue &o, std::string_view strKey) |
| std::vector< unsigned char > | ParseHexV (const UniValue &v, std::string_view name) |
| std::vector< unsigned char > | ParseHexO (const UniValue &o, std::string_view strKey) |
| std::string | HelpExampleCli (const std::string &methodname, const std::string &args) |
| std::string | HelpExampleCliNamed (const std::string &methodname, const RPCArgList &args) |
| std::string | HelpExampleRpc (const std::string &methodname, const std::string &args) |
| std::string | HelpExampleRpcNamed (const std::string &methodname, const RPCArgList &args) |
| CPubKey | HexToPubKey (const std::string &hex_in) |
| CTxDestination | AddAndGetMultisigDestination (const int required, const std::vector< CPubKey > &pubkeys, OutputType type, FlatSigningProvider &keystore, CScript &script_out) |
| UniValue | DescribeAddress (const CTxDestination &dest) |
| std::optional< int > | ParseSighashString (const UniValue &sighash) |
| Returns a sighash value corresponding to the passed in argument. More... | |
| unsigned int | ParseConfirmTarget (const UniValue &value, unsigned int max_target) |
| Parse a confirm target option and raise an RPC error if it is invalid. More... | |
| RPCErrorCode | RPCErrorFromPSBTError (PSBTError err) |
| RPCErrorCode | RPCErrorFromTransactionError (TransactionError terr) |
| UniValue | JSONRPCPSBTError (PSBTError err) |
| UniValue | JSONRPCTransactionError (TransactionError terr, const std::string &err_string) |
| static const UniValue * | DetailMaybeArg (CheckFn *check, const std::vector< RPCArg > ¶ms, const JSONRPCRequest *req, size_t i) |
| static void | CheckRequiredOrDefault (const RPCArg ¶m) |
| TMPL_INST (nullptr, const UniValue *, maybe_arg;) | |
| TMPL_INST (nullptr, std::optional< double >, maybe_arg ? std::optional{maybe_arg->get_real()} :std::nullopt;) | |
| TMPL_INST (nullptr, std::optional< bool >, maybe_arg ? std::optional{maybe_arg->get_bool()} :std::nullopt;) | |
| TMPL_INST (nullptr, std::optional< int64_t >, maybe_arg ? std::optional{maybe_arg->getInt< int64_t >()} :std::nullopt;) | |
| TMPL_INST (nullptr, std::optional< std::string_view >, maybe_arg ? std::optional< std::string_view >{maybe_arg->get_str()} :std::nullopt;) | |
| TMPL_INST (CheckRequiredOrDefault, const UniValue &, *CHECK_NONFATAL(maybe_arg);) | |
| TMPL_INST (CheckRequiredOrDefault, bool, CHECK_NONFATAL(maybe_arg) ->get_bool();) | |
| TMPL_INST (CheckRequiredOrDefault, int, CHECK_NONFATAL(maybe_arg) ->getInt< int >();) | |
| TMPL_INST (CheckRequiredOrDefault, uint64_t, CHECK_NONFATAL(maybe_arg) ->getInt< uint64_t >();) | |
| TMPL_INST (CheckRequiredOrDefault, uint32_t, CHECK_NONFATAL(maybe_arg) ->getInt< uint32_t >();) | |
| TMPL_INST (CheckRequiredOrDefault, std::string_view, CHECK_NONFATAL(maybe_arg) ->get_str();) | |
| static std::optional< UniValue::VType > | ExpectedType (RPCArg::Type type) |
| static std::optional< UniValue::VType > | ExpectedType (RPCResult::Type type) |
| static std::pair< int64_t, int64_t > | ParseRange (const UniValue &value) |
| std::pair< int64_t, int64_t > | ParseDescriptorRange (const UniValue &value) |
| Parse a JSON range specified as int64, or [int64, int64]. More... | |
| 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 of 1000. More... | |
| static UniValue | BilingualStringsToUniValue (const std::vector< bilingual_str > &bilingual_strings) |
| Convert a vector of bilingual strings to a UniValue::VARR containing their original untranslated values. More... | |
| void | PushWarnings (const UniValue &warnings, UniValue &obj) |
| Push warning messages to an RPC "warnings" field as a JSON array of strings. More... | |
| void | PushWarnings (const std::vector< bilingual_str > &warnings, UniValue &obj) |
| std::vector< RPCResult > | ScriptPubKeyDoc () |
| uint256 | GetTarget (const CBlockIndex &blockindex, const uint256 pow_limit) |
Variables | |
| const std::string | UNIX_EPOCH_TIME = "UNIX epoch time" |
| String used to describe UNIX epoch time in documentation, factored out to a constant for consistency. More... | |
| const std::string | EXAMPLE_ADDRESS [2] = {"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl", "bc1q02ad21edsxd23d32dfgqqsz4vv4nmtfzuklhy3"} |
| Example bech32 addresses for the RPCExamples help documentation. More... | |
| #define TMPL_INST | ( | check_param, | |
| ret_type, | |||
| return_code | |||
| ) |
| CTxDestination AddAndGetMultisigDestination | ( | const int | required, |
| const std::vector< CPubKey > & | pubkeys, | ||
| OutputType | type, | ||
| FlatSigningProvider & | keystore, | ||
| CScript & | script_out | ||
| ) |
Validate and return a CAmount from a UniValue number or string.
| [in] | value | UniValue number or string to parse. |
| [in] | decimals | Number of significant digits (default: 8). |
Definition at line 101 of file util.cpp.
|
static |
Convert a vector of bilingual strings to a UniValue::VARR containing their original untranslated values.
Definition at line 1373 of file util.cpp.
|
static |
| UniValue DescribeAddress | ( | const CTxDestination & | dest | ) |
|
static |
| std::vector< CScript > EvalDescriptorStringOrObject | ( | const UniValue & | scanobject, |
| FlatSigningProvider & | provider, | ||
| const bool | expand_priv | ||
| ) |
|
static |
|
static |
| std::string GetAllOutputTypes | ( | ) |
| uint256 GetTarget | ( | const CBlockIndex & | blockindex, |
| const uint256 | pow_limit | ||
| ) |
| std::string HelpExampleCli | ( | const std::string & | methodname, |
| const std::string & | args | ||
| ) |
| std::string HelpExampleCliNamed | ( | const std::string & | methodname, |
| const RPCArgList & | args | ||
| ) |
| std::string HelpExampleRpc | ( | const std::string & | methodname, |
| const std::string & | args | ||
| ) |
| std::string HelpExampleRpcNamed | ( | const std::string & | methodname, |
| const RPCArgList & | args | ||
| ) |
| CPubKey HexToPubKey | ( | const std::string & | hex_in | ) |
| UniValue JSONRPCPSBTError | ( | PSBTError | err | ) |
| UniValue JSONRPCTransactionError | ( | TransactionError | terr, |
| const std::string & | err_string | ||
| ) |
| unsigned int ParseConfirmTarget | ( | const UniValue & | value, |
| unsigned int | max_target | ||
| ) |
| std::pair< int64_t, int64_t > ParseDescriptorRange | ( | const UniValue & | value | ) |
| std::vector< unsigned char > ParseHexO | ( | const UniValue & | o, |
| std::string_view | strKey | ||
| ) |
| std::vector< unsigned char > ParseHexV | ( | const UniValue & | v, |
| std::string_view | name | ||
| ) |
|
static |
| std::optional< int > ParseSighashString | ( | const UniValue & | sighash | ) |
Returns a sighash value corresponding to the passed in argument.
Parse a sighash string representation and raise an RPC error if it is invalid.
Definition at line 360 of file util.cpp.
| int ParseVerbosity | ( | const UniValue & | arg, |
| int | default_verbosity, | ||
| bool | allow_bool | ||
| ) |
Parses verbosity from provided UniValue.
| [in] | arg | The verbosity argument as an int (0, 1, 2,...) or bool if allow_bool is set to true |
| [in] | default_verbosity | The value to return if verbosity argument is null |
| [in] | allow_bool | If true, allows arg to be a bool and parses it |
| JSONRPCError | if allow_bool is false but arg provided is boolean |
Definition at line 86 of file util.cpp.
| void PushWarnings | ( | const std::vector< bilingual_str > & | warnings, |
| UniValue & | obj | ||
| ) |
Push warning messages to an RPC "warnings" field as a JSON array of strings.
| [in] | warnings | Warning messages to push. |
| [out] | obj | UniValue object to push the warnings array object to. |
Definition at line 1383 of file util.cpp.
| RPCErrorCode RPCErrorFromPSBTError | ( | PSBTError | err | ) |
| RPCErrorCode RPCErrorFromTransactionError | ( | TransactionError | terr | ) |
| void RPCTypeCheckObj | ( | const UniValue & | o, |
| const std::map< std::string, UniValueType > & | typesExpected, | ||
| bool | fAllowNull, | ||
| bool | fStrict | ||
| ) |
| std::vector< RPCResult > ScriptPubKeyDoc | ( | ) |
| TMPL_INST | ( | CheckRequiredOrDefault | , |
| bool | , | ||
| CHECK_NONFATAL(maybe_arg) ->get_bool(); | |||
| ) |
| TMPL_INST | ( | CheckRequiredOrDefault | , |
| const UniValue & | , | ||
| *CHECK_NONFATAL(maybe_arg); | |||
| ) |
| TMPL_INST | ( | CheckRequiredOrDefault | , |
| int | , | ||
| CHECK_NONFATAL(maybe_arg) ->getInt< int >(); | |||
| ) |
| TMPL_INST | ( | CheckRequiredOrDefault | , |
| std::string_view | , | ||
| CHECK_NONFATAL(maybe_arg) ->get_str(); | |||
| ) |
| TMPL_INST | ( | CheckRequiredOrDefault | , |
| uint32_t | , | ||
| CHECK_NONFATAL(maybe_arg) ->getInt< uint32_t >(); | |||
| ) |
| TMPL_INST | ( | CheckRequiredOrDefault | , |
| uint64_t | , | ||
| CHECK_NONFATAL(maybe_arg) ->getInt< uint64_t >(); | |||
| ) |
| TMPL_INST | ( | nullptr | , |
| const UniValue * | , | ||
| maybe_arg; | |||
| ) |
| TMPL_INST | ( | nullptr | , |
| std::optional< bool > | , | ||
| maybe_arg ? std::optional{maybe_arg->get_bool()} :std::nullopt; | |||
| ) |
| TMPL_INST | ( | nullptr | , |
| std::optional< double > | , | ||
| maybe_arg ? std::optional{maybe_arg->get_real()} :std::nullopt; | |||
| ) |
| TMPL_INST | ( | nullptr | , |
| std::optional< int64_t > | , | ||
| maybe_arg ? std::optional{maybe_arg->getInt< int64_t >()} :std::nullopt; | |||
| ) |
| TMPL_INST | ( | nullptr | , |
| std::optional< std::string_view > | , | ||
| maybe_arg ? std::optional< std::string_view >{maybe_arg->get_str()} :std::nullopt; | |||
| ) |
| const std::string EXAMPLE_ADDRESS[2] = {"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl", "bc1q02ad21edsxd23d32dfgqqsz4vv4nmtfzuklhy3"} |
Example bech32 addresses for the RPCExamples help documentation.
They are intentionally invalid to prevent accidental transactions by users.