Bitcoin Core 30.99.0
P2P Digital Currency
Functions
client.h File Reference
#include <string>
#include <string_view>
#include <univalue.h>
Include dependency graph for client.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

UniValue RPCConvertValues (const std::string &strMethod, const std::vector< std::string > &strParams)
 Convert positional arguments to command-specific RPC representation. More...
 
UniValue RPCConvertNamedValues (const std::string &strMethod, const std::vector< std::string > &strParams)
 Convert named arguments to command-specific RPC representation. More...
 

Function Documentation

◆ RPCConvertNamedValues()

UniValue RPCConvertNamedValues ( const std::string &  strMethod,
const std::vector< std::string > &  strParams 
)

Convert named arguments to command-specific RPC representation.

Convert named arguments to command-specific RPC representation.

The -named syntax accepts named arguments in NAME=VALUE format, as well as positional arguments without names. The syntax is inherently ambiguous if names are omitted and values contain '=', so a heuristic is used to disambiguate:

  • Arguments that do not contain '=' are treated as positional parameters.
  • Arguments that do contain '=' are assumed to be named parameters in NAME=VALUE format except for two special cases:
    1. The case where NAME is not a known parameter name, and the next positional parameter requires a JSON value, and the argument parses as JSON. E.g. ["list", "with", "="].
    2. The case where NAME is not a known parameter name and the next positional parameter requires a string value. E.g. "my=wallet".

For example, the command bitcoin-cli -named createwallet "my=wallet", the parser initially sees "my=wallet" and attempts to process it as a parameter named "my". When it finds that "my" is not a valid named parameter parameter for this method, it falls back to checking the rule for the next available positional parameter (index 0). Because it finds the rule that this parameter is a ParamFormat::STRING, it correctly treats the entire "my=wallet" as a single positional string, successfully creating a wallet with that literal name.

Definition at line 473 of file client.cpp.

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

◆ RPCConvertValues()

UniValue RPCConvertValues ( const std::string &  strMethod,
const std::vector< std::string > &  strParams 
)

Convert positional arguments to command-specific RPC representation.

Convert positional arguments to command-specific RPC representation.

Definition at line 433 of file client.cpp.

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