32 {
"issue", 1,
"qty" },
33 {
"issue", 4,
"units" },
34 {
"issue", 5,
"reissuable" },
35 {
"issue", 6,
"has_ipfs" },
36 {
"issuerestrictedasset", 1,
"qty" },
37 {
"issuerestrictedasset", 5,
"units" },
38 {
"issuerestrictedasset", 6,
"reissuable" },
39 {
"issuerestrictedasset", 7,
"has_ipfs" },
40 {
"reissuerestrictedasset", 1,
"qty" },
41 {
"reissuerestrictedasset", 3,
"change_verifier" },
42 {
"reissuerestrictedasset", 6,
"new_unit" },
43 {
"reissuerestrictedasset", 7,
"reissuable" },
44 {
"issueunique", 1,
"asset_tags"},
45 {
"issueunique", 2,
"ipfs_hashes"},
46 {
"transfer", 1,
"qty"},
47 {
"transfer", 4,
"expire_time"},
48 {
"transferfromaddress", 2,
"qty"},
49 {
"transferfromaddress", 5,
"expire_time"},
50 {
"transferfromaddresses", 1,
"from_addresses"},
51 {
"transferfromaddresses", 2,
"qty"},
52 {
"transferfromaddresses", 5,
"expire_time"},
53 {
"transferqualifier", 2,
"qty"},
54 {
"transferqualifier", 5,
"expire_time"},
55 {
"reissue", 1,
"qty"},
56 {
"reissue", 4,
"reissuable"},
57 {
"reissue", 5,
"new_unit"},
58 {
"listmyassets", 1,
"verbose" },
59 {
"listmyassets", 2,
"count" },
60 {
"listmyassets", 3,
"start"},
61 {
"listmyassets", 4,
"confs"},
62 {
"listassets", 1,
"verbose" },
63 {
"listassets", 2,
"count" },
64 {
"listassets", 3,
"start" },
65 {
"setmocktime", 0,
"timestamp" },
66 {
"generate", 0,
"nblocks" },
67 {
"generate", 1,
"maxtries" },
68 {
"setgenerate", 0,
"generate" },
69 {
"setgenerate", 1,
"genproclimit" },
70 {
"generatetoaddress", 0,
"nblocks" },
71 {
"generatetoaddress", 2,
"maxtries" },
72 {
"getnetworkhashps", 0,
"nblocks" },
73 {
"getnetworkhashps", 1,
"height" },
74 {
"sendtoaddress", 1,
"amount" },
75 {
"sendtoaddress", 4,
"subtractfeefromamount" },
77 {
"sendtoaddress", 5 ,
"conf_target" },
78 {
"settxfee", 0,
"amount" },
79 {
"getreceivedbyaddress", 1,
"minconf" },
80 {
"getreceivedbyaccount", 1,
"minconf" },
81 {
"listreceivedbyaddress", 0,
"minconf" },
82 {
"listreceivedbyaddress", 1,
"include_empty" },
83 {
"listreceivedbyaddress", 2,
"include_watchonly" },
84 {
"listreceivedbyaccount", 0,
"minconf" },
85 {
"listreceivedbyaccount", 1,
"include_empty" },
86 {
"listreceivedbyaccount", 2,
"include_watchonly" },
87 {
"getbalance", 1,
"minconf" },
88 {
"getbalance", 2,
"include_watchonly" },
89 {
"getblockhash", 0,
"height" },
90 {
"waitforblockheight", 0,
"height" },
91 {
"waitforblockheight", 1,
"timeout" },
92 {
"waitforblock", 1,
"timeout" },
93 {
"waitfornewblock", 0,
"timeout" },
94 {
"move", 2,
"amount" },
95 {
"move", 3,
"minconf" },
96 {
"sendfrom", 2,
"amount" },
97 {
"sendfrom", 3,
"minconf" },
98 {
"listtransactions", 1,
"count" },
99 {
"listtransactions", 2,
"skip" },
100 {
"listtransactions", 3,
"include_watchonly" },
101 {
"listaccounts", 0,
"minconf" },
102 {
"listaccounts", 1,
"include_watchonly" },
103 {
"walletpassphrase", 1,
"timeout" },
104 {
"getblocktemplate", 0,
"template_request" },
105 {
"listsinceblock", 1,
"target_confirmations" },
106 {
"listsinceblock", 2,
"include_watchonly" },
107 {
"listsinceblock", 3,
"include_removed" },
108 {
"sendmany", 1,
"amounts" },
109 {
"sendmany", 2,
"minconf" },
110 {
"sendmany", 4,
"subtractfeefrom" },
112 {
"sendmany", 5 ,
"conf_target" },
113 {
"addmultisigaddress", 0,
"nrequired" },
114 {
"addmultisigaddress", 1,
"keys" },
115 {
"createmultisig", 0,
"nrequired" },
116 {
"createmultisig", 1,
"keys" },
117 {
"listunspent", 0,
"minconf" },
118 {
"listunspent", 1,
"maxconf" },
119 {
"listunspent", 2,
"addresses" },
120 {
"listunspent", 3,
"include_unsafe" },
121 {
"listunspent", 4,
"query_options" },
122 {
"getblock", 1,
"verbosity" },
123 {
"getblock", 1,
"verbose" },
124 {
"getblockheader", 1,
"verbose" },
125 {
"getchaintxstats", 0,
"nblocks" },
126 {
"gettransaction", 1,
"include_watchonly" },
127 {
"getrawtransaction", 1,
"verbose" },
128 {
"createrawtransaction", 0,
"inputs" },
129 {
"createrawtransaction", 1,
"outputs" },
130 {
"createrawtransaction", 2,
"locktime" },
132 {
"signrawtransaction", 1,
"prevtxs" },
133 {
"signrawtransaction", 2,
"privkeys" },
134 {
"sendrawtransaction", 1,
"allowhighfees" },
135 {
"combinerawtransaction", 0,
"txs" },
136 {
"fundrawtransaction", 1,
"options" },
137 {
"gettxout", 1,
"n" },
138 {
"gettxout", 2,
"include_mempool" },
139 {
"gettxoutproof", 0,
"txids" },
140 {
"lockunspent", 0,
"unlock" },
141 {
"lockunspent", 1,
"transactions" },
142 {
"importprivkey", 2,
"rescan" },
143 {
"importaddress", 2,
"rescan" },
144 {
"importaddress", 3,
"p2sh" },
145 {
"importpubkey", 2,
"rescan" },
146 {
"importmulti", 0,
"requests" },
147 {
"importmulti", 1,
"options" },
148 {
"verifychain", 0,
"checklevel" },
149 {
"verifychain", 1,
"nblocks" },
150 {
"pruneblockchain", 0,
"height" },
151 {
"keypoolrefill", 0,
"newsize" },
152 {
"getrawmempool", 0,
"verbose" },
153 {
"estimatefee", 0,
"nblocks" },
154 {
"estimatesmartfee", 0,
"conf_target" },
155 {
"estimaterawfee", 0,
"conf_target" },
156 {
"estimaterawfee", 1,
"threshold" },
157 {
"prioritisetransaction", 1,
"dummy" },
158 {
"prioritisetransaction", 2,
"fee_delta" },
159 {
"setban", 2,
"bantime" },
160 {
"setban", 3,
"absolute" },
161 {
"setnetworkactive", 0,
"state" },
162 {
"getmempoolancestors", 1,
"verbose" },
163 {
"getmempooldescendants", 1,
"verbose" },
164 {
"getblockhashes", 0 ,
"high"},
165 {
"getblockhashes", 1,
"low"},
166 {
"getblockhashes", 2,
"options" },
167 {
"getspentinfo", 0,
"txid_index"},
168 {
"getaddresstxids", 0,
"addresses"},
169 {
"getaddresstxids", 1,
"includeAssets"},
170 {
"getaddressbalance", 0,
"addresses"},
171 {
"getaddressbalance", 1,
"includeAssets"},
172 {
"getaddressdeltas", 0,
"addresses"},
173 {
"getaddressutxos", 0,
"addresses"},
174 {
"getaddressmempool", 0,
"addresses"},
175 {
"getaddressmempool", 1,
"includeAssets"},
176 {
"bumpfee", 1,
"options" },
177 {
"logging", 0,
"include" },
178 {
"logging", 1,
"exclude" },
179 {
"disconnectnode", 1,
"nodeid" },
181 {
"echojson", 0,
"arg0" },
182 {
"echojson", 1,
"arg1" },
183 {
"echojson", 2,
"arg2" },
184 {
"echojson", 3,
"arg3" },
185 {
"echojson", 4,
"arg4" },
186 {
"echojson", 5,
"arg5" },
187 {
"echojson", 6,
"arg6" },
188 {
"echojson", 7,
"arg7" },
189 {
"echojson", 8,
"arg8" },
190 {
"echojson", 9,
"arg9" },
191 {
"rescanblockchain", 0,
"start_height"},
192 {
"rescanblockchain", 1,
"stop_height"},
193 {
"listaddressesbyasset", 1,
"totalonly"},
194 {
"listaddressesbyasset", 2,
"count"},
195 {
"listaddressesbyasset", 3,
"start"},
196 {
"listassetbalancesbyaddress", 1,
"totalonly"},
197 {
"listassetbalancesbyaddress", 2,
"count"},
198 {
"listassetbalancesbyaddress", 3,
"start"},
199 {
"sendmessage", 2,
"expire_time"},
205 std::set<std::pair<std::string, int>>
members;
211 bool convert(
const std::string& method,
int idx) {
212 return (members.count(std::make_pair(method, idx)) > 0);
214 bool convert(
const std::string& method,
const std::string& name) {
215 return (membersByName.count(std::make_pair(method, name)) > 0);
221 const unsigned int n_elem =
222 (
sizeof(vRPCConvertParams) /
sizeof(vRPCConvertParams[0]));
224 for (
unsigned int i = 0; i < n_elem; i++) {
225 members.insert(std::make_pair(vRPCConvertParams[i].
methodName,
227 membersByName.insert(std::make_pair(vRPCConvertParams[i].methodName,
240 if (!jVal.
read(std::string(
"[")+strVal+std::string(
"]")) ||
242 throw std::runtime_error(std::string(
"Error parsing JSON:")+strVal);
250 for (
unsigned int idx = 0; idx < strParams.size(); idx++) {
251 const std::string& strVal = strParams[idx];
253 if (!rpcCvtTable.
convert(strMethod, idx)) {
269 for (
const std::string &s: strParams) {
270 size_t pos = s.find(
"=");
271 if (pos == std::string::npos) {
272 throw(std::runtime_error(
"No '=' in named argument '"+s+
"', this needs to be present for every argument (even if it is empty)"));
275 std::string name = s.substr(0, pos);
276 std::string value = s.substr(pos+1);
278 if (!rpcCvtTable.
convert(strMethod, name)) {
280 params.
pushKV(name, value);
bool read(const char *raw, size_t len)
std::set< std::pair< std::string, int > > members
UniValue RPCConvertValues(const std::string &strMethod, const std::vector< std::string > &strParams)
Convert positional arguments to command-specific RPC representation.
bool push_back(const UniValue &val)
UniValue ParseNonRFCJSONValue(const std::string &strVal)
Non-RFC4627 JSON parser, accepts internal values (such as numbers, true, false, null) as well as obje...
bool convert(const std::string &method, const std::string &name)
std::string paramName
parameter name
bool pushKV(const std::string &key, const UniValue &val)
bool convert(const std::string &method, int idx)
std::string methodName
method whose params want conversion
UniValue RPCConvertNamedValues(const std::string &strMethod, const std::vector< std::string > &strParams)
Convert named arguments to command-specific RPC representation.
std::set< std::pair< std::string, std::string > > membersByName
int paramIdx
0-based idx of param to convert