Bitcoin
Classes | Functions | Variables
util.cpp File Reference
#include <key_io.h>
#include <outputtype.h>
#include <script/signingprovider.h>
#include <rpc/util.h>
#include <script/descriptor.h>
#include <tinyformat.h>
#include <util/strencodings.h>
#include <tuple>

Classes

class  DescribeAddressVisitor
 
struct  Section
 
struct  Sections
 

Functions

void RPCTypeCheck (const UniValue &params, const std::list< UniValueType > &typesExpected, bool fAllowNull)
 
void RPCTypeCheckArgument (const UniValue &value, const UniValueType &typeExpected)
 
void RPCTypeCheckObj (const UniValue &o, const std::map< std::string, UniValueType > &typesExpected, bool fAllowNull, bool fStrict)
 
CAmount AmountFromValue (const UniValue &value)
 
uint256 ParseHashV (const UniValue &v, std::string strName)
 
uint256 ParseHashO (const UniValue &o, std::string strKey)
 
std::vector< unsigned char > ParseHexV (const UniValue &v, std::string strName)
 
std::vector< unsigned char > ParseHexO (const UniValue &o, std::string strKey)
 
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 (FillableSigningProvider *const 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)
 
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 RPCErrorFromTransactionError (TransactionError terr)
 
UniValue JSONRPCTransactionError (TransactionError terr, const std::string &err_string)
 
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]. More...
 
std::vector< CScriptEvalDescriptorStringOrObject (const UniValue &scanobject, FlatSigningProvider &provider)
 

Variables

InitInterfacesg_rpc_interfaces = nullptr
 

Function Documentation

◆ AddAndGetMultisigDestination()

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

◆ AddrToPubKey()

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

◆ AmountFromValue()

CAmount AmountFromValue ( const UniValue value)

◆ DescribeAddress()

UniValue DescribeAddress ( const CTxDestination dest)

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

◆ HelpExampleCli()

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

◆ HelpExampleRpc()

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

◆ HexToPubKey()

CPubKey HexToPubKey ( const std::string &  hex_in)

◆ JSONRPCTransactionError()

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

◆ ParseConfirmTarget()

unsigned int ParseConfirmTarget ( const UniValue value,
unsigned int  max_target 
)

Parse a confirm target option and raise an RPC error if it is invalid.

◆ ParseDescriptorRange()

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

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

◆ ParseHashO()

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

◆ ParseHashV()

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

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

◆ ParseHexO()

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

◆ ParseHexV()

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

◆ ParseRange()

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

◆ RPCErrorFromTransactionError()

RPCErrorCode RPCErrorFromTransactionError ( TransactionError  terr)

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

◆ RPCTypeCheckArgument()

void RPCTypeCheckArgument ( const UniValue value,
const UniValueType typeExpected 
)

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

◆ RPCTypeCheckObj()

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

Variable Documentation

◆ g_rpc_interfaces

InitInterfaces* g_rpc_interfaces = nullptr

Pointers to interfaces that need to be accessible from RPC methods. Due to limitations of the RPC framework, there's currently no direct way to pass in state to RPC method implementations.