![]() |
Bitcoin Core 31.0.0
P2P Digital Currency
|
#include <chain.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&) |
Enumerations | |
| enum class | PSBTError |
| enum class | TransactionError |
Functions | |
| std::string | GetAllOutputTypes () |
| Gets all existing output types formatted for RPC help sections. | |
| 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. | |
| CAmount | AmountFromValue (const UniValue &value, int decimals) |
| Validate and return a CAmount from a UniValue number or string. | |
| CFeeRate | ParseFeeRate (const UniValue &json) |
| Parse a json number or string, denoting BTC/kvB, into a CFeeRate (sat/kvB). | |
| uint256 | ParseHashV (const UniValue &v, std::string_view name) |
| Utilities: convert hex-encoded Values (throws error if not hex). | |
| 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. | |
| unsigned int | ParseConfirmTarget (const UniValue &value, unsigned int max_target) |
| Parse a confirm target option and raise an RPC error if it is invalid. | |
| 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]. | |
| 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. | |
| 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. | |
| void | PushWarnings (const UniValue &warnings, UniValue &obj) |
| Push warning messages to an RPC "warnings" field as a JSON array of strings. | |
| void | PushWarnings (const std::vector< bilingual_str > &warnings, UniValue &obj) |
| std::vector< RPCResult > | ScriptPubKeyDoc () |
| uint256 | GetTarget (const CBlockIndex &blockindex, const uint256 pow_limit) |
| bilingual_str | PSBTErrorString (PSBTError err) |
| bilingual_str | TransactionErrorString (const TransactionError err) |
| template<typename C, typename S, typename UnaryOp> | |
| auto | Join (const C &container, const S &separator, UnaryOp unary_op) |
| Join all container items. | |
| std::vector< std::string > | SplitString (std::string_view str, char sep) |
| std::string | TrimString (std::string_view str, std::string_view pattern=" \f\n\r\t\v") |
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. | |
| const std::string | EXAMPLE_ADDRESS [2] = {"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl", "bc1q02ad21edsxd23d32dfgqqsz4vv4nmtfzuklhy3"} |
| Example bech32 addresses for the RPCExamples help documentation. | |
| #define TMPL_INST | ( | check_param, | |
| ret_type, | |||
| return_code ) |
|
strong |
|
strong |
| 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 98 of file util.cpp.
|
staticnodiscard |
Convert a vector of bilingual strings to a UniValue::VARR containing their original untranslated values.
Definition at line 1368 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 | ) |
| auto util::Join | ( | const C & | container, |
| const S & | separator, | ||
| UnaryOp | unary_op ) |
Join all container items.
Typically used to concatenate strings but accepts containers with elements of any type.
| container | The items to join |
| separator | The separator |
| unary_op | Apply this operator to each item |
Definition at line 205 of file string.h.
| 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 357 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 83 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 1378 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 | ( | ) |
|
inlinenodiscard |
| 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; | ) |
| bilingual_str common::TransactionErrorString | ( | const TransactionError | err | ) |
|
inlinenodiscard |
| 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.