Bitcoin Core 32.99.0
P2P Digital Currency
Loading...
Searching...
No Matches
client.cpp
Go to the documentation of this file.
1// Copyright (c) 2010 Satoshi Nakamoto
2// Copyright (c) 2009-present The Bitcoin Core developers
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#include <rpc/client.h>
7
8#include <tinyformat.h>
9
10#include <algorithm>
11#include <cstddef>
12#include <ranges>
13#include <stdexcept>
14#include <string>
15#include <string_view>
16#include <utility>
17
21
23{
24public:
25 std::string methodName;
27 std::string paramName;
29};
30
31// clang-format off
61{
62 { "setmocktime", 0, "timestamp" },
63 { "mockscheduler", 0, "delta_time" },
64 { "utxoupdatepsbt", 0, "psbt", ParamFormat::STRING },
65 { "utxoupdatepsbt", 1, "descriptors" },
66 { "generatetoaddress", 0, "nblocks" },
67 { "generatetoaddress", 2, "maxtries" },
68 { "generatetodescriptor", 0, "num_blocks" },
69 { "generatetodescriptor", 2, "maxtries" },
70 { "generateblock", 1, "transactions" },
71 { "generateblock", 2, "submit" },
72 { "getnetworkhashps", 0, "nblocks" },
73 { "getnetworkhashps", 1, "height" },
74 { "sendtoaddress", 0, "address", ParamFormat::STRING },
75 { "sendtoaddress", 1, "amount" },
76 { "sendtoaddress", 2, "comment", ParamFormat::STRING },
77 { "sendtoaddress", 3, "comment_to", ParamFormat::STRING },
78 { "sendtoaddress", 4, "subtractfeefromamount" },
79 { "sendtoaddress", 5 , "replaceable" },
80 { "sendtoaddress", 6 , "conf_target" },
81 { "sendtoaddress", 7, "estimate_mode", ParamFormat::STRING },
82 { "sendtoaddress", 8, "avoid_reuse" },
83 { "sendtoaddress", 9, "fee_rate"},
84 { "sendtoaddress", 10, "verbose"},
85 { "getreceivedbyaddress", 1, "minconf" },
86 { "getreceivedbyaddress", 2, "include_immature_coinbase" },
87 { "getreceivedbylabel", 0, "label", ParamFormat::STRING },
88 { "getreceivedbylabel", 1, "minconf" },
89 { "getreceivedbylabel", 2, "include_immature_coinbase" },
90 { "listreceivedbyaddress", 0, "minconf" },
91 { "listreceivedbyaddress", 1, "include_empty" },
92 { "listreceivedbyaddress", 2, "include_watchonly" },
93 { "listreceivedbyaddress", 4, "include_immature_coinbase" },
94 { "listreceivedbylabel", 0, "minconf" },
95 { "listreceivedbylabel", 1, "include_empty" },
96 { "listreceivedbylabel", 2, "include_watchonly" },
97 { "listreceivedbylabel", 3, "include_immature_coinbase" },
98 { "getbalance", 1, "minconf" },
99 { "getbalance", 2, "include_watchonly" },
100 { "getbalance", 3, "avoid_reuse" },
101 { "getblockfrompeer", 1, "peer_id" },
102 { "getblockhash", 0, "height" },
103 { "waitforblockheight", 0, "height" },
104 { "waitforblockheight", 1, "timeout" },
105 { "waitforblock", 1, "timeout" },
106 { "waitfornewblock", 0, "timeout" },
107 { "listtransactions", 0, "label", ParamFormat::STRING },
108 { "listtransactions", 1, "count" },
109 { "listtransactions", 2, "skip" },
110 { "listtransactions", 3, "include_watchonly" },
111 { "listrawtransactions", 0, "count" },
112 { "listrawtransactions", 1, "skip" },
113 { "listrawtransactions", 2, "verbose" },
114 { "walletpassphrase", 0, "passphrase", ParamFormat::STRING },
115 { "walletpassphrase", 1, "timeout" },
116 { "getblocktemplate", 0, "template_request" },
117 { "listsinceblock", 0, "blockhash", ParamFormat::STRING },
118 { "listsinceblock", 1, "target_confirmations" },
119 { "listsinceblock", 2, "include_watchonly" },
120 { "listsinceblock", 3, "include_removed" },
121 { "listsinceblock", 4, "include_change" },
122 { "listsinceblock", 5, "label", ParamFormat::STRING },
123 { "sendmany", 0, "dummy", ParamFormat::STRING },
124 { "sendmany", 1, "amounts" },
125 { "sendmany", 2, "minconf" },
126 { "sendmany", 3, "comment", ParamFormat::STRING },
127 { "sendmany", 4, "subtractfeefrom" },
128 { "sendmany", 5 , "replaceable" },
129 { "sendmany", 6 , "conf_target" },
130 { "sendmany", 7, "estimate_mode", ParamFormat::STRING },
131 { "sendmany", 8, "fee_rate"},
132 { "sendmany", 9, "verbose" },
133 { "deriveaddresses", 1, "range" },
134 { "scanblocks", 1, "scanobjects" },
135 { "scanblocks", 2, "start_height" },
136 { "scanblocks", 3, "stop_height" },
137 { "scanblocks", 5, "options" },
138 { "scanblocks", 5, "filter_false_positives" },
139 { "getdescriptoractivity", 0, "blockhashes" },
140 { "getdescriptoractivity", 1, "scanobjects" },
141 { "getdescriptoractivity", 2, "include_mempool" },
142 { "scantxoutset", 1, "scanobjects" },
143 { "createmultisig", 0, "nrequired" },
144 { "createmultisig", 1, "keys" },
145 { "listunspent", 0, "minconf" },
146 { "listunspent", 1, "maxconf" },
147 { "listunspent", 2, "addresses" },
148 { "listunspent", 3, "include_unsafe" },
149 { "listunspent", 4, "query_options" },
150 { "listunspent", 4, "minimum_amount" },
151 { "listunspent", 4, "minimumAmount" },
152 { "listunspent", 4, "maximum_amount" },
153 { "listunspent", 4, "maximumAmount" },
154 { "listunspent", 4, "maximum_count" },
155 { "listunspent", 4, "maximumCount" },
156 { "listunspent", 4, "minimum_sum_amount" },
157 { "listunspent", 4, "minimumSumAmount" },
158 { "listunspent", 4, "include_immature_coinbase" },
159 { "getblock", 1, "verbosity" },
160 { "getblock", 1, "verbose" },
161 { "getblockheader", 1, "verbose" },
162 { "getchaintxstats", 0, "nblocks" },
163 { "gettransaction", 1, "include_watchonly" },
164 { "gettransaction", 2, "verbose" },
165 { "getrawtransaction", 1, "verbosity" },
166 { "getrawtransaction", 1, "verbose" },
167 { "createrawtransaction", 0, "inputs" },
168 { "createrawtransaction", 1, "outputs" },
169 { "createrawtransaction", 2, "locktime" },
170 { "createrawtransaction", 3, "replaceable" },
171 { "createrawtransaction", 4, "version" },
172 { "decoderawtransaction", 1, "iswitness" },
173 { "signrawtransactionwithkey", 1, "privkeys" },
174 { "signrawtransactionwithkey", 2, "prevtxs" },
175 { "signrawtransactionwithwallet", 1, "prevtxs" },
176 { "sendrawtransaction", 1, "maxfeerate" },
177 { "sendrawtransaction", 2, "maxburnamount" },
178 { "testmempoolaccept", 0, "rawtxs" },
179 { "testmempoolaccept", 1, "maxfeerate" },
180 { "submitpackage", 0, "package" },
181 { "submitpackage", 1, "maxfeerate" },
182 { "submitpackage", 2, "maxburnamount" },
183 { "combinerawtransaction", 0, "txs" },
184 { "fundrawtransaction", 1, "options" },
185 { "fundrawtransaction", 1, "add_inputs"},
186 { "fundrawtransaction", 1, "include_unsafe"},
187 { "fundrawtransaction", 1, "minconf"},
188 { "fundrawtransaction", 1, "maxconf"},
189 { "fundrawtransaction", 1, "changePosition"},
190 { "fundrawtransaction", 1, "change_position"},
191 { "fundrawtransaction", 1, "includeWatching"},
192 { "fundrawtransaction", 1, "lockUnspents"},
193 { "fundrawtransaction", 1, "lock_unspents"},
194 { "fundrawtransaction", 1, "fee_rate"},
195 { "fundrawtransaction", 1, "feeRate"},
196 { "fundrawtransaction", 1, "subtractFeeFromOutputs"},
197 { "fundrawtransaction", 1, "subtract_fee_from_outputs"},
198 { "fundrawtransaction", 1, "input_weights"},
199 { "fundrawtransaction", 1, "conf_target"},
200 { "fundrawtransaction", 1, "replaceable"},
201 { "fundrawtransaction", 1, "solving_data"},
202 { "fundrawtransaction", 1, "max_tx_weight"},
203 { "fundrawtransaction", 2, "iswitness" },
204 { "walletcreatefundedpsbt", 0, "inputs" },
205 { "walletcreatefundedpsbt", 1, "outputs" },
206 { "walletcreatefundedpsbt", 2, "locktime" },
207 { "walletcreatefundedpsbt", 3, "options" },
208 { "walletcreatefundedpsbt", 3, "add_inputs"},
209 { "walletcreatefundedpsbt", 3, "include_unsafe"},
210 { "walletcreatefundedpsbt", 3, "minconf"},
211 { "walletcreatefundedpsbt", 3, "maxconf"},
212 { "walletcreatefundedpsbt", 3, "changePosition"},
213 { "walletcreatefundedpsbt", 3, "change_position"},
214 { "walletcreatefundedpsbt", 3, "includeWatching"},
215 { "walletcreatefundedpsbt", 3, "lockUnspents"},
216 { "walletcreatefundedpsbt", 3, "lock_unspents"},
217 { "walletcreatefundedpsbt", 3, "fee_rate"},
218 { "walletcreatefundedpsbt", 3, "feeRate"},
219 { "walletcreatefundedpsbt", 3, "subtractFeeFromOutputs"},
220 { "walletcreatefundedpsbt", 3, "subtract_fee_from_outputs"},
221 { "walletcreatefundedpsbt", 3, "conf_target"},
222 { "walletcreatefundedpsbt", 3, "replaceable"},
223 { "walletcreatefundedpsbt", 3, "solving_data"},
224 { "walletcreatefundedpsbt", 3, "max_tx_weight"},
225 { "walletcreatefundedpsbt", 4, "bip32derivs" },
226 { "walletcreatefundedpsbt", 5, "version" },
227 { "walletcreatefundedpsbt", 6, "psbt_version" },
228 { "walletprocesspsbt", 0, "psbt", ParamFormat::STRING },
229 { "walletprocesspsbt", 1, "sign" },
230 { "walletprocesspsbt", 2, "sighashtype", ParamFormat::STRING },
231 { "walletprocesspsbt", 3, "bip32derivs" },
232 { "walletprocesspsbt", 4, "finalize" },
233 { "descriptorprocesspsbt", 0, "psbt", ParamFormat::STRING },
234 { "descriptorprocesspsbt", 1, "descriptors"},
235 { "descriptorprocesspsbt", 2, "sighashtype", ParamFormat::STRING },
236 { "descriptorprocesspsbt", 3, "bip32derivs" },
237 { "descriptorprocesspsbt", 4, "finalize" },
238 { "createpsbt", 0, "inputs" },
239 { "createpsbt", 1, "outputs" },
240 { "createpsbt", 2, "locktime" },
241 { "createpsbt", 3, "replaceable" },
242 { "createpsbt", 4, "version" },
243 { "createpsbt", 5, "psbt_version" },
244 { "combinepsbt", 0, "txs"},
245 { "joinpsbts", 0, "txs"},
246 { "finalizepsbt", 0, "psbt", ParamFormat::STRING },
247 { "finalizepsbt", 1, "extract"},
248 { "converttopsbt", 1, "permitsigdata"},
249 { "converttopsbt", 2, "iswitness"},
250 { "converttopsbt", 3, "psbt_version"},
251 { "gettxout", 1, "n" },
252 { "gettxout", 2, "include_mempool" },
253 { "gettxoutproof", 0, "txids" },
254 { "gettxoutsetinfo", 1, "hash_or_height", ParamFormat::JSON_OR_STRING },
255 { "gettxoutsetinfo", 2, "use_index"},
256 { "dumptxoutset", 0, "path", ParamFormat::STRING },
257 { "dumptxoutset", 1, "type", ParamFormat::STRING },
258 { "dumptxoutset", 2, "options" },
259 { "dumptxoutset", 2, "rollback", ParamFormat::JSON_OR_STRING },
260 { "dumptxoutset", 2, "in_memory" },
261 { "lockunspent", 0, "unlock" },
262 { "lockunspent", 1, "transactions" },
263 { "lockunspent", 2, "persistent" },
264 { "send", 0, "outputs" },
265 { "send", 1, "conf_target" },
266 { "send", 3, "fee_rate"},
267 { "send", 4, "options" },
268 { "send", 4, "add_inputs"},
269 { "send", 4, "include_unsafe"},
270 { "send", 4, "minconf"},
271 { "send", 4, "maxconf"},
272 { "send", 4, "add_to_wallet"},
273 { "send", 4, "change_position"},
274 { "send", 4, "fee_rate"},
275 { "send", 4, "include_watching"},
276 { "send", 4, "inputs"},
277 { "send", 4, "locktime"},
278 { "send", 4, "lock_unspents"},
279 { "send", 4, "psbt"},
280 { "send", 4, "subtract_fee_from_outputs"},
281 { "send", 4, "conf_target"},
282 { "send", 4, "replaceable"},
283 { "send", 4, "solving_data"},
284 { "send", 4, "max_tx_weight"},
285 { "send", 5, "version"},
286 { "sendall", 0, "recipients" },
287 { "sendall", 1, "conf_target" },
288 { "sendall", 3, "fee_rate"},
289 { "sendall", 4, "options" },
290 { "sendall", 4, "add_to_wallet"},
291 { "sendall", 4, "fee_rate"},
292 { "sendall", 4, "include_watching"},
293 { "sendall", 4, "inputs"},
294 { "sendall", 4, "locktime"},
295 { "sendall", 4, "lock_unspents"},
296 { "sendall", 4, "psbt"},
297 { "sendall", 4, "send_max"},
298 { "sendall", 4, "minconf"},
299 { "sendall", 4, "maxconf"},
300 { "sendall", 4, "conf_target"},
301 { "sendall", 4, "replaceable"},
302 { "sendall", 4, "solving_data"},
303 { "sendall", 4, "version"},
304 { "simulaterawtransaction", 0, "rawtxs" },
305 { "simulaterawtransaction", 1, "options" },
306 { "simulaterawtransaction", 1, "include_watchonly"},
307 { "importmempool", 0, "filepath", ParamFormat::STRING },
308 { "importmempool", 1, "options" },
309 { "importmempool", 1, "apply_fee_delta_priority" },
310 { "importmempool", 1, "use_current_time" },
311 { "importmempool", 1, "apply_unbroadcast_set" },
312 { "importdescriptors", 0, "requests" },
313 { "listdescriptors", 0, "private" },
314 { "verifychain", 0, "checklevel" },
315 { "verifychain", 1, "nblocks" },
316 { "getblockstats", 0, "hash_or_height", ParamFormat::JSON_OR_STRING },
317 { "getblockstats", 1, "stats" },
318 { "pruneblockchain", 0, "height" },
319 { "keypoolrefill", 0, "newsize" },
320 { "getrawmempool", 0, "verbose" },
321 { "getrawmempool", 1, "mempool_sequence" },
322 { "getorphantxs", 0, "verbosity" },
323 { "estimatesmartfee", 0, "conf_target" },
324 { "estimatesmartfee", 2, "options" },
325 { "estimaterawfee", 0, "conf_target" },
326 { "estimaterawfee", 1, "threshold" },
327 { "prioritisetransaction", 1, "dummy" },
328 { "prioritisetransaction", 2, "fee_delta" },
329 { "setban", 2, "bantime" },
330 { "setban", 3, "absolute" },
331 { "setnetworkactive", 0, "state" },
332 { "setwalletflag", 1, "value" },
333 { "getmempoolancestors", 1, "verbose" },
334 { "getmempooldescendants", 1, "verbose" },
335 { "gettxspendingprevout", 0, "outputs" },
336 { "gettxspendingprevout", 1, "options" },
337 { "gettxspendingprevout", 1, "mempool_only" },
338 { "gettxspendingprevout", 1, "return_spending_tx" },
339 { "bumpfee", 1, "options" },
340 { "bumpfee", 1, "conf_target"},
341 { "bumpfee", 1, "fee_rate"},
342 { "bumpfee", 1, "replaceable"},
343 { "bumpfee", 1, "outputs"},
344 { "bumpfee", 1, "original_change_index"},
345 { "psbtbumpfee", 1, "options" },
346 { "psbtbumpfee", 1, "conf_target"},
347 { "psbtbumpfee", 1, "fee_rate"},
348 { "psbtbumpfee", 1, "replaceable"},
349 { "psbtbumpfee", 1, "outputs"},
350 { "psbtbumpfee", 1, "original_change_index"},
351 { "psbtbumpfee", 1, "psbt_version"},
352 { "logging", 0, "include" },
353 { "logging", 1, "exclude" },
354 { "disconnectnode", 1, "nodeid" },
355 { "getopenrpcinfo", 0, "show_hidden" },
356 { "gethdkeys", 0, "active_only" },
357 { "gethdkeys", 0, "options" },
358 { "gethdkeys", 0, "private" },
359 { "derivehdkey", 1, "options" },
360 { "derivehdkey", 1, "private" },
361 { "createwalletdescriptor", 1, "options" },
362 { "createwalletdescriptor", 1, "internal" },
363 // Echo with conversion (For testing only)
364 { "echojson", 0, "arg0" },
365 { "echojson", 1, "arg1" },
366 { "echojson", 2, "arg2" },
367 { "echojson", 3, "arg3" },
368 { "echojson", 4, "arg4" },
369 { "echojson", 5, "arg5" },
370 { "echojson", 6, "arg6" },
371 { "echojson", 7, "arg7" },
372 { "echojson", 8, "arg8" },
373 { "echojson", 9, "arg9" },
374 { "rescanblockchain", 0, "start_height"},
375 { "rescanblockchain", 1, "stop_height"},
376 { "createwallet", 0, "wallet_name", ParamFormat::STRING },
377 { "createwallet", 1, "disable_private_keys"},
378 { "createwallet", 2, "blank"},
379 { "createwallet", 3, "passphrase", ParamFormat::STRING },
380 { "createwallet", 4, "avoid_reuse"},
381 { "createwallet", 5, "descriptors"},
382 { "createwallet", 6, "load_on_startup"},
383 { "createwallet", 7, "external_signer"},
384 { "restorewallet", 0, "wallet_name", ParamFormat::STRING },
385 { "restorewallet", 1, "backup_file", ParamFormat::STRING },
386 { "restorewallet", 2, "load_on_startup"},
387 { "loadwallet", 0, "filename", ParamFormat::STRING },
388 { "loadwallet", 1, "load_on_startup"},
389 { "unloadwallet", 0, "wallet_name", ParamFormat::STRING },
390 { "unloadwallet", 1, "load_on_startup"},
391 { "getnodeaddresses", 0, "count"},
392 { "addpeeraddress", 1, "port"},
393 { "addpeeraddress", 2, "tried"},
394 { "sendmsgtopeer", 0, "peer_id" },
395 { "stop", 0, "wait" },
396 { "addnode", 2, "v2transport" },
397 { "addconnection", 2, "v2transport" },
398 { "decodepsbt", 0, "psbt", ParamFormat::STRING },
399 { "analyzepsbt", 0, "psbt", ParamFormat::STRING},
400 { "verifymessage", 1, "signature", ParamFormat::STRING },
401 { "verifymessage", 2, "message", ParamFormat::STRING },
402 { "getnewaddress", 0, "label", ParamFormat::STRING },
403 { "getnewaddress", 1, "address_type", ParamFormat::STRING },
404 { "backupwallet", 0, "destination", ParamFormat::STRING },
405 { "echoipc", 0, "arg", ParamFormat::STRING },
406 { "encryptwallet", 0, "passphrase", ParamFormat::STRING },
407 { "getaddressesbylabel", 0, "label", ParamFormat::STRING },
408 { "loadtxoutset", 0, "path", ParamFormat::STRING },
409 { "migratewallet", 0, "wallet_name", ParamFormat::STRING },
410 { "migratewallet", 1, "passphrase", ParamFormat::STRING },
411 { "migratewallet", 2, "load_wallet"},
412 { "setlabel", 1, "label", ParamFormat::STRING },
413 { "signmessage", 1, "message", ParamFormat::STRING },
414 { "signmessagewithprivkey", 1, "message", ParamFormat::STRING },
415 { "walletpassphrasechange", 0, "oldpassphrase", ParamFormat::STRING },
416 { "walletpassphrasechange", 1, "newpassphrase", ParamFormat::STRING },
417};
418// clang-format on
419
421static UniValue Parse(std::string_view raw, ParamFormat format = ParamFormat::JSON)
422{
424 if (!parsed.read(raw)) {
425 if (format != ParamFormat::JSON_OR_STRING) throw std::runtime_error(tfm::format("Error parsing JSON: %s", raw));
426 return UniValue(std::string(raw));
427 }
428 return parsed;
429}
430
431namespace rpc_convert
432{
433const CRPCConvertParam* FromPosition(std::string_view method, size_t pos)
434{
435 auto it = std::ranges::find_if(vRPCConvertParams, [&](const auto& p) {
436 return p.methodName == method && p.paramIdx == static_cast<int>(pos);
437 });
438
439 return it == std::end(vRPCConvertParams) ? nullptr : &*it;
440}
441
442const CRPCConvertParam* FromName(std::string_view method, std::string_view name)
443{
444 auto it = std::ranges::find_if(vRPCConvertParams, [&](const auto& p) {
445 return p.methodName == method && p.paramName == name;
446 });
447
448 return it == std::end(vRPCConvertParams) ? nullptr : &*it;
449}
450} // namespace rpc_convert
451
452static UniValue ParseParam(const CRPCConvertParam* param, std::string_view raw)
453{
454 // Only parse parameters which have the JSON or JSON_OR_STRING format; otherwise, treat them as strings.
455 return (param && (param->format == ParamFormat::JSON || param->format == ParamFormat::JSON_OR_STRING)) ? Parse(raw, param->format) : UniValue(std::string(raw));
456}
457
461UniValue RPCConvertValues(const std::string &strMethod, const std::vector<std::string> &strParams)
462{
463 UniValue params(UniValue::VARR);
464
465 for (std::string_view s : strParams) {
466 params.push_back(ParseParam(rpc_convert::FromPosition(strMethod, params.size()), s));
467 }
468
469 return params;
470}
471
501UniValue RPCConvertNamedValues(const std::string &strMethod, const std::vector<std::string> &strParams)
502{
503 UniValue params(UniValue::VOBJ);
505
506 for (std::string_view s: strParams) {
507 size_t pos = s.find('=');
508 if (pos == std::string_view::npos) {
510 continue;
511 }
512
513 std::string name{s.substr(0, pos)};
514 std::string_view value{s.substr(pos+1)};
515
517 if (!named_param) {
522 continue;
523 } else if (positional_param && positional_param->format == ParamFormat::STRING) {
524 positional_args.push_back(s);
525 continue;
526 }
527 }
528
529 // Intentionally overwrite earlier named values with later ones as a
530 // convenience for scripts and command line users that want to merge
531 // options.
532 params.pushKV(name, ParseParam(named_param, value));
533 }
534
535 if (!positional_args.empty()) {
536 // Use pushKVEnd instead of pushKV to avoid overwriting an explicit
537 // "args" value with an implicit one. Let the RPC server handle the
538 // request as given.
539 params.pushKVEnd("args", std::move(positional_args));
540 }
541
542 return params;
543}
std::string methodName
method whose params want conversion
Definition client.cpp:25
int paramIdx
0-based idx of param to convert
Definition client.cpp:26
std::string paramName
parameter name
Definition client.cpp:27
ParamFormat format
parameter format
Definition client.cpp:28
void push_back(UniValue val)
Definition univalue.cpp:103
size_t size() const
Definition univalue.h:71
void pushKVEnd(std::string key, UniValue val)
Definition univalue.cpp:117
void pushKV(std::string key, UniValue val)
Definition univalue.cpp:125
UniValue RPCConvertValues(const std::string &strMethod, const std::vector< std::string > &strParams)
Convert command lines arguments to params object when -named is disabled.
Definition client.cpp:461
static UniValue ParseParam(const CRPCConvertParam *param, std::string_view raw)
Definition client.cpp:452
static UniValue Parse(std::string_view raw, ParamFormat format=ParamFormat::JSON)
Parse string to UniValue or throw runtime_error if string contains invalid JSON.
Definition client.cpp:421
UniValue RPCConvertNamedValues(const std::string &strMethod, const std::vector< std::string > &strParams)
Convert command line arguments to params object when -named is enabled.
Definition client.cpp:501
ParamFormat
Specify whether parameter should be parsed by bitcoin-cli as a JSON value, or passed unchanged as a s...
Definition client.cpp:20
@ JSON_OR_STRING
Definition client.cpp:20
@ JSON
Definition client.cpp:20
@ STRING
Definition client.cpp:20
static const CRPCConvertParam vRPCConvertParams[]
Specify a (method, idx, name, format) here if the argument is a non-string RPC argument and needs to ...
Definition client.cpp:60
const CRPCConvertParam * FromPosition(std::string_view method, size_t pos)
Definition client.cpp:433
const CRPCConvertParam * FromName(std::string_view method, std::string_view name)
Definition client.cpp:442
void format(std::ostream &out, FormatStringCheck< sizeof...(Args)> fmt, const Args &... args)
Format list of arguments to the stream according to given format string.
const char * name
Definition rest.cpp:71
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
Definition time.h:82