Bitcoin ABC  0.22.13
P2P Digital Currency
Classes | Enumerations | Functions | Variables
util.h File Reference
#include <node/transaction.h>
#include <outputtype.h>
#include <protocol.h>
#include <rpc/request.h>
#include <script/script.h>
#include <script/sign.h>
#include <script/standard.h>
#include <univalue.h>
#include <util/check.h>
#include <boost/variant.hpp>
#include <string>
#include <vector>
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  UniValueType
 Wrapper for UniValue::VType, which includes typeAny: used to denote don't care type. More...
 
struct  RPCArg
 
struct  RPCResult
 
struct  RPCResults
 
struct  RPCExamples
 
class  RPCHelpMan
 

Enumerations

enum  OuterType { OuterType::ARR, OuterType::OBJ, OuterType::NONE }
 Serializing JSON objects depends on the outer type. More...
 

Functions

void RPCTypeCheck (const UniValue &params, const std::list< UniValueType > &typesExpected, bool fAllowNull=false)
 Type-check arguments; throws JSONRPCError if wrong type given. More...
 
void RPCTypeCheckArgument (const UniValue &value, const UniValueType &typeExpected)
 Type-check one argument; throws JSONRPCError if wrong type given. More...
 
void RPCTypeCheckObj (const UniValue &o, const std::map< std::string, UniValueType > &typesExpected, bool fAllowNull=false, bool fStrict=false)
 Check for expected keys/value types in an Object. More...
 
uint256 ParseHashV (const UniValue &v, std::string strName)
 Utilities: convert hex-encoded values (throws error if not hex). More...
 
uint256 ParseHashO (const UniValue &o, std::string strKey)
 
std::vector< uint8_t > ParseHexV (const UniValue &v, std::string strName)
 
std::vector< uint8_t > ParseHexO (const UniValue &o, std::string strKey)
 
Amount AmountFromValue (const UniValue &value)
 
std::string HelpExampleCli (const std::string &methodname, const std::string &args)
 
std::string HelpExampleRpc (const std::string &methodname, const std::string &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)
 
RPCErrorCode RPCErrorFromTransactionError (TransactionError terr)
 
UniValue JSONRPCTransactionError (TransactionError terr, const std::string &err_string="")
 
std::pair< int64_t, int64_t > ParseDescriptorRange (const UniValue &value)
 Parse a JSON range specified as int64, or [int64, int64]. More...
 
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. More...
 
UniValue GetServicesNames (ServiceFlags services)
 Returns, given services flags, a list of humanly readable (known) network services. More...
 

Variables

const std::string 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
 Example CashAddr address used in multiple RPCExamples. More...
 

Enumeration Type Documentation

◆ OuterType

enum OuterType
strong

Serializing JSON objects depends on the outer type.

Only arrays and dictionaries can be nested in json. The top-level outer type is "NONE".

Enumerator
ARR 
OBJ 
NONE 

Definition at line 125 of file util.h.

Function Documentation

◆ AddAndGetMultisigDestination()

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

Definition at line 195 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 167 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 81 of file util.cpp.

Here is the call graph for this function:

◆ DescribeAddress()

UniValue DescribeAddress ( const CTxDestination dest)

Definition at line 263 of file util.cpp.

Here is the call graph for this function:
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 849 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 896 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 138 of file util.cpp.

◆ HelpExampleRpc()

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

Definition at line 143 of file util.cpp.

◆ HexToPubKey()

CPubKey HexToPubKey ( const std::string &  hex_in)

Definition at line 153 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 286 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 832 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 116 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 99 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 134 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 120 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 267 of file util.cpp.

Here is the caller graph for this function:

◆ RPCTypeCheck()

void RPCTypeCheck ( const UniValue params,
const std::list< UniValueType > &  typesExpected,
bool  fAllowNull = false 
)

Type-check arguments; throws JSONRPCError if wrong type given.

Does not check that the right number of arguments are passed, just that any passed are the correct type.

Definition at line 25 of file util.cpp.

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

◆ RPCTypeCheckArgument()

void RPCTypeCheckArgument ( const UniValue value,
const UniValueType typeExpected 
)

Type-check one argument; throws JSONRPCError if wrong type given.

Definition at line 42 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 = false,
bool  fStrict = false 
)

Check for expected keys/value types in an Object.

Definition at line 52 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

Example CashAddr address used in multiple RPCExamples.

Definition at line 22 of file util.cpp.

◆ UNIX_EPOCH_TIME

const std::string UNIX_EPOCH_TIME

String used to describe UNIX epoch time in documentation, factored out to a constant for consistency.

Definition at line 21 of file util.cpp.