MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / RPCConvertNamedValues

Function RPCConvertNamedValues

src/rpc/client.cpp:242–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242UniValue RPCConvertNamedValues(const std::string &strMethod, const std::vector<std::string> &strParams)
243{
244 UniValue params(UniValue::VOBJ);
245
246 for (const std::string &s: strParams) {
247 size_t pos = s.find('=');
248 if (pos == std::string::npos) {
249 throw(std::runtime_error("No '=' in named argument '"+s+"', this needs to be present for every argument (even if it is empty)"));
250 }
251
252 std::string name = s.substr(0, pos);
253 std::string value = s.substr(pos+1);
254
255 if (!rpcCvtTable.convert(strMethod, name)) {
256 // insert string value directly
257 params.pushKV(name, value);
258 } else {
259 // parse string as JSON, insert bool/number/object/etc. value
260 params.pushKV(name, ParseNonRFCJSONValue(value));
261 }
262 }
263
264 return params;
265}

Callers 1

PrepareRequestMethod · 0.85

Calls 4

ParseNonRFCJSONValueFunction · 0.85
convertMethod · 0.80
findMethod · 0.45
pushKVMethod · 0.45

Tested by

no test coverage detected