MCPcopy Create free account
hub / github.com/LUX-Core/lux / RPCConvertNamedValues

Function RPCConvertNamedValues

src/rpcclient.cpp:249–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected