Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
Classes | Functions | Variables
util.cpp File Reference
#include <rpc/util.h>
#include <clientversion.h>
#include <common/args.h>
#include <consensus/amount.h>
#include <key_io.h>
#include <script/descriptor.h>
#include <script/signingprovider.h>
#include <tinyformat.h>
#include <util/check.h>
#include <util/strencodings.h>
#include <util/string.h>
#include <util/translation.h>
#include <tuple>
#include <variant>
Include dependency graph for util.cpp:

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...
 

Functions

void RPCTypeCheckObj (const UniValue &o, const std::map< std::string, UniValueType > &typesExpected, bool fAllowNull, bool fStrict)
 Check for expected keys/value types in an Object.
 
Amount AmountFromValue (const UniValue &value)
 
uint256 ParseHashV (const UniValue &v, std::string strName)
 Utilities: convert hex-encoded values (throws error if not hex).
 
uint256 ParseHashO (const UniValue &o, std::string strKey)
 
std::vector< uint8_tParseHexV (const UniValue &v, std::string strName)
 
std::vector< uint8_tParseHexO (const UniValue &o, std::string 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)
 
CPubKey AddrToPubKey (const CChainParams &chainparams, const FillableSigningProvider &keystore, const std::string &addr_in)
 
CTxDestination AddAndGetMultisigDestination (const int required, const std::vector< CPubKey > &pubkeys, OutputType type, FillableSigningProvider &keystore, CScript &script_out)
 
UniValue DescribeAddress (const CTxDestination &dest)
 
std::string GetAllOutputTypes ()
 
RPCErrorCode RPCErrorFromTransactionError (TransactionError terr)
 
UniValue JSONRPCTransactionError (TransactionError terr, const std::string &err_string)
 
static std::optional< UniValue::VTypeExpectedType (RPCArg::Type type)
 
static std::optional< UniValue::VTypeExpectedType (RPCResult::Type type)
 
static std::pair< int64_t, int64_tParseRange (const UniValue &value)
 
std::pair< int64_t, int64_tParseDescriptorRange (const UniValue &value)
 Parse a JSON range specified as int64, or [int64, int64].
 
std::vector< CScriptEvalDescriptorStringOrObject (const UniValue &scanobject, FlatSigningProvider &provider)
 Evaluate a descriptor given as a string, or as a {"desc":...,"range":...} object, with default range of 1000.
 
UniValue GetServicesNames (ServiceFlags services)
 Returns, given services flags, a list of humanly readable (known) network services.
 

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
 Example CashAddr address used in multiple RPCExamples.
 

Function Documentation

◆ AddAndGetMultisigDestination()

CTxDestination AddAndGetMultisigDestination ( const int  required,
const std::vector< CPubKey > &  pubkeys,
OutputType  type,
FillableSigningProvider keystore,
CScript script_out 
)

Definition at line 233 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddrToPubKey()

CPubKey AddrToPubKey ( const CChainParams chainparams,
const FillableSigningProvider keystore,
const std::string &  addr_in 
)

Definition at line 205 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ AmountFromValue()

Amount AmountFromValue ( const UniValue value)

Definition at line 55 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DescribeAddress()

UniValue DescribeAddress ( const CTxDestination dest)

Definition at line 301 of file util.cpp.

Here is the caller graph for this function:

◆ EvalDescriptorStringOrObject()

std::vector< CScript > EvalDescriptorStringOrObject ( const UniValue scanobject,
FlatSigningProvider provider 
)

Evaluate a descriptor given as a string, or as a {"desc":...,"range":...} object, with default range of 1000.

Definition at line 1290 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ExpectedType() [1/2]

static std::optional< UniValue::VType > ExpectedType ( RPCArg::Type  type)
static

Definition at line 781 of file util.cpp.

Here is the caller graph for this function:

◆ ExpectedType() [2/2]

static std::optional< UniValue::VType > ExpectedType ( RPCResult::Type  type)
static

Definition at line 1038 of file util.cpp.

◆ GetAllOutputTypes()

std::string GetAllOutputTypes ( )

Definition at line 305 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetServicesNames()

UniValue GetServicesNames ( ServiceFlags  services)

Returns, given services flags, a list of humanly readable (known) network services.

Definition at line 1337 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HelpExampleCli()

std::string HelpExampleCli ( const std::string &  methodname,
const std::string &  args 
)

Definition at line 150 of file util.cpp.

Here is the call graph for this function:

◆ HelpExampleCliNamed()

std::string HelpExampleCliNamed ( const std::string &  methodname,
const RPCArgList args 
)

Definition at line 155 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HelpExampleRpc()

std::string HelpExampleRpc ( const std::string &  methodname,
const std::string &  args 
)

Definition at line 167 of file util.cpp.

Here is the call graph for this function:

◆ HelpExampleRpcNamed()

std::string HelpExampleRpcNamed ( const std::string &  methodname,
const RPCArgList args 
)

Definition at line 176 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HexToPubKey()

CPubKey HexToPubKey ( const std::string &  hex_in)

Definition at line 191 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ JSONRPCTransactionError()

UniValue JSONRPCTransactionError ( TransactionError  terr,
const std::string &  err_string 
)

Definition at line 333 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseDescriptorRange()

std::pair< int64_t, int64_t > ParseDescriptorRange ( const UniValue value)

Parse a JSON range specified as int64, or [int64, int64].

Definition at line 1273 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseHashO()

uint256 ParseHashO ( const UniValue o,
std::string  strKey 
)

Definition at line 90 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseHashV()

uint256 ParseHashV ( const UniValue v,
std::string  strName 
)

Utilities: convert hex-encoded values (throws error if not hex).

Definition at line 73 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseHexO()

std::vector< uint8_t > ParseHexO ( const UniValue o,
std::string  strKey 
)

Definition at line 108 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseHexV()

std::vector< uint8_t > ParseHexV ( const UniValue v,
std::string  strName 
)

Definition at line 94 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseRange()

static std::pair< int64_t, int64_t > ParseRange ( const UniValue value)
static

Definition at line 1254 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RPCErrorFromTransactionError()

RPCErrorCode RPCErrorFromTransactionError ( TransactionError  terr)

Definition at line 314 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RPCTypeCheckObj()

void RPCTypeCheckObj ( const UniValue o,
const std::map< std::string, UniValueType > &  typesExpected,
bool  fAllowNull,
bool  fStrict 
)

Check for expected keys/value types in an Object.

Definition at line 26 of file util.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ EXAMPLE_ADDRESS

const std::string EXAMPLE_ADDRESS
Initial value:
=
"\"qrmzys48glkpevp2l4t24jtcltc9hyzx9cep2qffm4\""

Example CashAddr address used in multiple RPCExamples.

Definition at line 23 of file util.cpp.

◆ UNIX_EPOCH_TIME

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.

Definition at line 22 of file util.cpp.