MCPcopy Create free account
hub / github.com/ElementsProject/elements / RPCConvertNamedValues

Function RPCConvertNamedValues

src/rpc/client.cpp:304–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304UniValue RPCConvertNamedValues(const std::string &strMethod, const std::vector<std::string> &strParams)
305{
306 UniValue params(UniValue::VOBJ);
307
308 for (const std::string &s: strParams) {
309 size_t pos = s.find('=');
310 if (pos == std::string::npos) {
311 throw(std::runtime_error("No '=' in named argument '"+s+"', this needs to be present for every argument (even if it is empty)"));
312 }
313
314 std::string name = s.substr(0, pos);
315 std::string value = s.substr(pos+1);
316
317 if (!rpcCvtTable.convert(strMethod, name)) {
318 // insert string value directly
319 params.pushKV(name, value);
320 } else {
321 // parse string as JSON, insert bool/number/object/etc. value
322 params.pushKV(name, ParseNonRFCJSONValue(value));
323 }
324 }
325
326 return params;
327}

Callers 2

PrepareRequestMethod · 0.85
FUZZ_TARGETFunction · 0.85

Calls 4

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

Tested by 1

FUZZ_TARGETFunction · 0.68