forked from MultiChain/multichain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrpclist.cpp
327 lines (300 loc) · 28.4 KB
/
rpclist.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2014-2016 The Bitcoin Core developers
// Original code was distributed under the MIT software license.
// Copyright (c) 2014-2019 Coin Sciences Ltd
// MultiChain code distributed under the GPLv3 license, see COPYING file.
#if defined(HAVE_CONFIG_H)
#include "config/bitcoin-config.h"
#endif
#include "rpc/rpcserver.h"
/* MCHN START */
static const CRPCCommand vRPCWalletReadCommands[] =
{ // category name actor (function) okSafeMode threadSafe reqWallet
// --------------------- ------------------------ ----------------------- ---------- ---------- ---------
{ "wallet", "getbalance", &getbalance, false, false, true },
{ "wallet", "getreceivedbyaccount", &getreceivedbyaccount, false, false, true },
{ "wallet", "getreceivedbyaddress", &getreceivedbyaddress, false, false, true },
{ "wallet", "gettransaction", &gettransaction, false, false, true },
{ "wallet", "getunconfirmedbalance", &getunconfirmedbalance, false, false, true },
{ "wallet", "getwalletinfo", &getwalletinfo, false, false, true },
{ "wallet", "listlockunspent", &listlockunspent, false, false, true },
{ "wallet", "listreceivedbyaccount", &listreceivedbyaccount, false, false, true },
{ "wallet", "listreceivedbyaddress", &listreceivedbyaddress, false, false, true },
{ "wallet", "listsinceblock", &listsinceblock, false, false, true },
{ "wallet", "listtransactions", &listtransactions, false, false, true },
{ "wallet", "listunspent", &listunspent, false, false, true },
{ "wallet", "getassetbalances", &getassetbalances, false, false, true },
{ "wallet", "gettotalbalances", &gettotalbalances, false, false, true },
{ "wallet", "getmultibalances", &getmultibalances, false, false, true },
{ "wallet", "getaddressbalances", &getaddressbalances, false, false, true },
{ "wallet", "listwallettransactions", &listwallettransactions, false, false, true },
{ "wallet", "listaddresstransactions",&listaddresstransactions,false, false, true },
{ "wallet", "getwallettransaction", &getwallettransaction, false, false, true },
{ "wallet", "getaddresstransaction", &getaddresstransaction, false, false, true },
};
/* MCHN END */
/**
* Call Table
*/
static const CRPCCommand vRPCCommands[] =
{ // category name actor (function) okSafeMode threadSafe reqWallet
// --------------------- ------------------------ ----------------------- ---------- ---------- ---------
/* Overall control/query calls */
{ "control", "getinfo", &getinfo, true, false, false }, /* uses wallet if enabled */
{ "control", "getinitstatus", &getinitstatus, true, true, false },
{ "control", "help", &help, true, true, false },
{ "control", "stop", &stop, true, true, false },
/* MCHN START */
{ "control", "pause", &pausecmd, true, false, false },
{ "control", "resume", &resumecmd, true, false, false },
{ "control", "clearmempool", &clearmempool, true, false, false },
{ "control", "setlastblock", &setlastblock, true, false, false },
{ "control", "getblockchainparams", &getblockchainparams, true, false, false },
{ "control", "getruntimeparams", &getruntimeparams, true, false, false },
{ "control", "setruntimeparam", &setruntimeparam, true, false, false },
/* MCHN END */
/* P2P networking */
{ "network", "getnetworkinfo", &getnetworkinfo, true, false, false },
{ "network", "addnode", &addnode, true, true, false },
{ "network", "getaddednodeinfo", &getaddednodeinfo, true, true, false },
{ "network", "getconnectioncount", &getconnectioncount, true, false, false },
{ "network", "getnettotals", &getnettotals, true, true, false },
{ "network", "getpeerinfo", &getpeerinfo, true, false, false },
{ "network", "ping", &ping, true, false, false },
{ "network", "getchunkqueueinfo", &getchunkqueueinfo, true, true, true },
{ "network", "getchunkqueuetotals", &getchunkqueuetotals, true, true, true },
/* Block chain and UTXO */
{ "blockchain", "getblockchaininfo", &getblockchaininfo, true, false, false },
{ "blockchain", "getbestblockhash", &getbestblockhash, true, false, false },
{ "blockchain", "getblockcount", &getblockcount, true, false, false },
{ "blockchain", "getlastblockinfo", &getlastblockinfo, true, false, false },
{ "blockchain", "getblock", &getblock, true, false, false },
{ "blockchain", "getblockhash", &getblockhash, true, false, false },
{ "blockchain", "getchaintips", &getchaintips, true, false, false },
{ "blockchain", "getdifficulty", &getdifficulty, true, false, false },
{ "blockchain", "getmempoolinfo", &getmempoolinfo, true, true, false },
{ "blockchain", "getrawmempool", &getrawmempool, true, false, false },
{ "blockchain", "gettxout", &gettxout, true, false, false },
{ "blockchain", "gettxoutsetinfo", &gettxoutsetinfo, true, false, false },
{ "blockchain", "verifychain", &verifychain, true, false, false },
{ "blockchain", "invalidateblock", &invalidateblock, true, true, false },
{ "blockchain", "reconsiderblock", &reconsiderblock, true, true, false },
/* MCHN START */
{ "blockchain", "listassets", &listassets, true, false, false },
{ "blockchain", "listpermissions", &listpermissions, true, false, false },
{ "blockchain", "liststreams", &liststreams, true, false, false },
{ "blockchain", "listupgrades", &listupgrades, true, false, false },
{ "blockchain", "listtxfilters", &listtxfilters, true, false, false },
{ "blockchain", "liststreamfilters", &liststreamfilters, true, false, false },
{ "blockchain", "getfiltercode", &getfiltercode, true, false, false },
{ "blockchain", "testtxfilter", &testtxfilter, true, false, false },
{ "blockchain", "runtxfilter", &runtxfilter, true, false, false },
{ "blockchain", "teststreamfilter", &teststreamfilter, true, false, false },
{ "blockchain", "runstreamfilter", &runstreamfilter, true, false, false },
{ "blockchain", "listblocks", &listblocks, true, false, false },
{ "blockchain", "getassetinfo", &getassetinfo, true, false, false },
{ "blockchain", "getstreaminfo", &getstreaminfo, true, false, false },
{ "blockchain", "verifypermission", &verifypermission, true, false, false },
/* MCHN END */
/* Mining */
{ "mining", "getblocktemplate", &getblocktemplate, true, false, false },
{ "mining", "getmininginfo", &getmininginfo, true, false, false },
{ "mining", "getnetworkhashps", &getnetworkhashps, true, false, false },
{ "mining", "prioritisetransaction", &prioritisetransaction, true, false, false },
{ "mining", "submitblock", &submitblock, true, true, false },
#ifdef ENABLE_WALLET
/* Coin generation */
{ "generating", "getgenerate", &getgenerate, true, false, false },
{ "generating", "gethashespersec", &gethashespersec, true, false, false },
{ "generating", "setgenerate", &setgenerate, true, true, false },
#endif
/* Raw transactions */
{ "rawtransactions", "appendrawtransaction", &appendrawtransaction, true, false, false },
{ "rawtransactions", "createrawtransaction", &createrawtransaction, true, false, false },
{ "rawtransactions", "decoderawtransaction", &decoderawtransaction, true, false, false },
{ "rawtransactions", "decodescript", &decodescript, true, false, false },
{ "rawtransactions", "getrawtransaction", &getrawtransaction, true, false, false },
{ "rawtransactions", "sendrawtransaction", &sendrawtransaction, false, false, false },
{ "rawtransactions", "signrawtransaction", &signrawtransaction, false, false, false }, /* uses wallet if enabled */
/* MCHN START */
{ "rawtransactions", "appendrawchange", &appendrawchange, false, false, true },
{ "hidden", "appendrawmetadata", &appendrawmetadata, false, false, true },
{ "rawtransactions", "appendrawdata", &appendrawmetadata, false, false, true },
{ "hidden", "debug", &debug, false, true, true },
/* MCHN END */
/* Utility functions */
{ "util", "createkeypairs", &createkeypairs, true, true , false },
{ "util", "createmultisig", &createmultisig, true, true , false },
{ "util", "validateaddress", &validateaddress, true, false, false }, /* uses wallet if enabled */
{ "util", "verifymessage", &verifymessage, true, false, false },
{ "util", "estimatefee", &estimatefee, true, true, false },
{ "util", "estimatepriority", &estimatepriority, true, true, false },
{ "util", "createbinarycache", &createbinarycache, true, false, false },
{ "util", "appendbinarycache", &appendbinarycache, true, false, false },
{ "util", "deletebinarycache", &deletebinarycache, true, false, false },
/* Not shown in help */
{ "hidden", "invalidateblock", &invalidateblock, true, true, false },
{ "hidden", "reconsiderblock", &reconsiderblock, true, true, false },
{ "hidden", "setmocktime", &setmocktime, true, false, false },
{ "hidden", "data-all", &purehelpitem_nomethod, true, true, true },
{ "hidden", "data-with", &purehelpitem_nomethod, true, true, true },
{ "hidden", "addresses-all", &purehelpitem_nomethod, true, true, true },
{ "hidden", "getfilterstreamitem", &purehelpitem_onlyfilter, true, false, false },
{ "hidden", "getfiltertransaction", &purehelpitem_onlyfilter, true, false, false },
{ "hidden", "getfilterassetbalances", &purehelpitem_onlyfilter, true, false, false },
{ "hidden", "getfiltertxid", &purehelpitem_onlyfilter, true, true, true },
{ "hidden", "getfiltertxinput", &purehelpitem_onlyfilter, true, true, true },
{ "hidden", "setfilterparam", &purehelpitem_onlyfilter, true, true, true },
{ "hidden", "filters", &purehelpitem_nomethod, true, true, true },
#ifdef ENABLE_WALLET
/* Licensing */
{ "hidden", "getlicenserequest", &getlicenserequest, true, false, true },
{ "hidden", "decodelicenserequest", &decodelicenserequest, true, false, true },
{ "hidden", "decodelicenseconfirmation", &decodelicenseconfirmation, true, false, true },
{ "hidden", "activatelicense", &activatelicense, true, false, true },
{ "hidden", "activatelicensefrom", &activatelicensefrom, true, false, true },
{ "hidden", "transferlicense", &transferlicense, true, false, true },
{ "hidden", "takelicense", &takelicense, true, false, true },
{ "hidden", "listlicenses", &listlicenses, true, false, true },
{ "hidden", "getlicenseconfirmation", &getlicenseconfirmation, true, false, true },
{ "hidden", "importlicenserequest", &importlicenserequest, true, false, true },
{ "hidden", "createfeed", &createfeed, true, false, false },
{ "hidden", "suspendfeed", &suspendfeed, true, false, false },
{ "hidden", "deletefeed", &deletefeed, true, false, false },
{ "hidden", "rescanfeed", &rescanfeed, true, false, false },
{ "hidden", "addfeedstreams", &addfeedstreams, true, false, false },
{ "hidden", "removefeedstreams", &removefeedstreams, true, false, false },
{ "hidden", "addfeedblocks", &addfeedblocks, true, false, false },
{ "hidden", "removefeedblocks", &removefeedblocks, true, false, false },
{ "hidden", "purgefeedfile", &purgefeedfile, true, false, false },
{ "hidden", "listfeeds", &listfeeds, true, false, false },
/* Wallet */
{ "wallet", "addmultisigaddress", &addmultisigaddress, true, false, true },
{ "wallet", "backupwallet", &backupwallet, true, false, true },
{ "wallet", "dumpprivkey", &dumpprivkey, true, false, true },
{ "wallet", "dumpwallet", &dumpwallet, true, false, true },
{ "wallet", "encryptwallet", &encryptwallet, true, false, true },
{ "wallet", "getaccountaddress", &getaccountaddress, true, false, true },
{ "wallet", "getaccount", &getaccount, true, false, true },
{ "wallet", "getaddressesbyaccount", &getaddressesbyaccount, true, false, true },
{ "wallet", "getbalance", &getbalance, false, false, true },
{ "wallet", "getnewaddress", &getnewaddress, true, false, true },
{ "wallet", "getrawchangeaddress", &getrawchangeaddress, true, false, true },
{ "wallet", "getreceivedbyaccount", &getreceivedbyaccount, false, false, true },
{ "wallet", "getreceivedbyaddress", &getreceivedbyaddress, false, false, true },
{ "wallet", "gettransaction", &gettransaction, false, false, true },
{ "wallet", "getunconfirmedbalance", &getunconfirmedbalance, false, false, true },
{ "wallet", "getwalletinfo", &getwalletinfo, false, false, true },
{ "wallet", "importprivkey", &importprivkey, true, false, true },
{ "wallet", "importwallet", &importwallet, true, false, true },
{ "wallet", "importaddress", &importaddress, true, false, true },
{ "wallet", "keypoolrefill", &keypoolrefill, true, false, true },
{ "wallet", "listaccounts", &listaccounts, false, false, true },
{ "wallet", "listaddressgroupings", &listaddressgroupings, false, false, true },
{ "wallet", "listlockunspent", &listlockunspent, false, false, true },
{ "wallet", "listreceivedbyaccount", &listreceivedbyaccount, false, false, true },
{ "wallet", "listreceivedbyaddress", &listreceivedbyaddress, false, false, true },
{ "wallet", "listsinceblock", &listsinceblock, false, false, true },
{ "wallet", "listtransactions", &listtransactions, false, false, true },
{ "wallet", "listunspent", &listunspent, false, false, true },
{ "wallet", "lockunspent", &lockunspent, true, false, true },
{ "wallet", "move", &movecmd, false, false, true },
// { "wallet", "sendfrom", &sendfrom, false, false, true },
{ "wallet", "sendfromaccount", &sendfrom, false, false, true },
{ "wallet", "sendmany", &sendmany, false, false, true },
{ "hidden", "sendtoaddress", &sendtoaddress, false, false, true },
{ "wallet", "send", &sendtoaddress, false, false, true },
/* MCHN START */
{ "wallet", "getaddresses", &getaddresses, true, false, true },
{ "wallet", "combineunspent", &combineunspent, false, false, true },
{ "wallet", "grant", &grantcmd, false, false, true },
{ "wallet", "revoke", &revokecmd, false, false, true },
{ "wallet", "issue", &issuecmd, false, false, true },
{ "wallet", "issuemore", &issuemorecmd, false, false, true },
{ "wallet", "getassetbalances", &getassetbalances, false, false, true },
{ "wallet", "gettotalbalances", &gettotalbalances, false, false, true },
{ "hidden", "sendassettoaddress", &sendassettoaddress, false, false, true },
{ "wallet", "sendasset", &sendassettoaddress, false, false, true },
{ "wallet", "preparelockunspent", &preparelockunspent, false, false, true },
{ "wallet", "createrawexchange", &createrawexchange, false, false, true },
{ "wallet", "appendrawexchange", &appendrawexchange, false, false, true },
{ "wallet", "completerawexchange", &completerawexchange, false, false, true },
{ "wallet", "decoderawexchange", &decoderawexchange, false, false, true },
{ "wallet", "grantfrom", &grantfromcmd, false, false, true },
{ "wallet", "approvefrom", &approvefrom, false, false, true },
{ "wallet", "revokefrom", &revokefromcmd, false, false, true },
{ "wallet", "issuefrom", &issuefromcmd, false, false, true },
{ "wallet", "issuemorefrom", &issuemorefromcmd, false, false, true },
{ "wallet", "preparelockunspentfrom", &preparelockunspentfrom, false, false, true },
{ "wallet", "sendassetfrom", &sendassetfrom, false, false, true },
{ "hidden", "sendfromaddress", &sendfromaddress, false, false, true },
{ "wallet", "sendfrom", &sendfromaddress, false, false, true },
{ "wallet", "getmultibalances", &getmultibalances, false, false, true },
{ "wallet", "getaddressbalances", &getaddressbalances, false, false, true },
{ "wallet", "disablerawtransaction", &disablerawtransaction, false, false, true },
{ "hidden", "sendwithmetadata", &sendwithmetadata, false, false, true },
{ "wallet", "sendwithdata", &sendwithmetadata, false, false, true },
{ "hidden", "sendwithmetadatafrom", &sendwithmetadatafrom, false, false, true },
{ "wallet", "sendwithdatafrom", &sendwithmetadatafrom, false, false, true },
{ "hidden", "grantwithmetadata", &grantwithmetadata, false, false, true },
{ "wallet", "grantwithdata", &grantwithmetadata, false, false, true },
{ "hidden", "grantwithmetadatafrom", &grantwithmetadatafrom, false, false, true },
{ "wallet", "grantwithdatafrom", &grantwithmetadatafrom, false, false, true },
{ "wallet", "createrawsendfrom", &createrawsendfrom, false, false, true },
{ "wallet", "listaddresses", &listaddresses, false, false, true },
{ "wallet", "listwallettransactions", &listwallettransactions, false, false, true },
{ "wallet", "listaddresstransactions",&listaddresstransactions,false, false, true },
{ "wallet", "getwallettransaction", &getwallettransaction, false, false, true },
{ "wallet", "getaddresstransaction", &getaddresstransaction, false, false, true },
{ "wallet", "resendwallettransactions",&resendwallettransactions, false, false, true },
{ "wallet", "create", &createcmd, false, false, true },
{ "wallet", "createfrom", &createfromcmd, false, false, true },
{ "wallet", "publish", &publish, false, false, true },
{ "wallet", "publishfrom", &publishfrom, false, false, true },
{ "wallet", "publishmulti", &publishmulti, false, false, true },
{ "wallet", "publishmultifrom", &publishmultifrom, false, false, true },
{ "wallet", "subscribe", &subscribe, false, false, true },
{ "wallet", "unsubscribe", &unsubscribe, false, false, true },
{ "wallet", "trimsubscribe", &trimsubscribe, false, false, true },
{ "wallet", "retrievestreamitems", &retrievestreamitems, false, false, true },
{ "wallet", "purgestreamitems", &purgestreamitems, false, false, true },
{ "wallet", "purgepublisheditems", &purgepublisheditems, false, false, true },
{ "wallet", "listassettransactions", &listassettransactions, false, false, true },
{ "wallet", "getassettransaction", &getassettransaction, false, false, true },
{ "wallet", "getstreamitem", &getstreamitem, false, false, true },
{ "wallet", "liststreamtxitems", &liststreamtxitems, false, false, true },
{ "wallet", "liststreamitems", &liststreamitems, false, false, true },
{ "wallet", "liststreamqueryitems", &liststreamqueryitems, false, false, true },
{ "wallet", "liststreamkeyitems", &liststreamkeyitems, false, false, true },
{ "wallet", "liststreampublisheritems",&liststreampublisheritems,false, false, true },
{ "wallet", "liststreamkeys", &liststreamkeys, false, false, true },
{ "wallet", "liststreampublishers", &liststreampublishers, false, false, true },
{ "wallet", "gettxoutdata", &gettxoutdata, false, false, true },
{ "wallet", "txouttobinarycache", &txouttobinarycache, false, false, true },
{ "wallet", "liststreamblockitems", &liststreamblockitems, false, false, false },
{ "wallet", "getstreamkeysummary", &getstreamkeysummary, false, false, true },
{ "wallet", "getstreampublishersummary", &getstreampublishersummary, false, false, true },
{ "hidden", "storechunk", &storechunk, false, false, true },
/* MCHN END */
{ "wallet", "setaccount", &setaccount, true, false, true },
{ "wallet", "settxfee", &settxfee, true, false, true },
{ "wallet", "signmessage", &signmessage, true, false, true },
{ "wallet", "walletlock", &walletlock, true, false, true },
{ "wallet", "walletpassphrasechange", &walletpassphrasechange, true, false, true },
{ "wallet", "walletpassphrase", &walletpassphrase, true, false, true },
#endif // ENABLE_WALLET
};
void mc_InitRPCList(std::vector<CRPCCommand>& vStaticRPCCommands,std::vector<CRPCCommand>& vStaticRPCWalletReadCommands)
{
unsigned int vcidx;
vStaticRPCCommands.clear();
vStaticRPCWalletReadCommands.clear();
for (vcidx = 0; vcidx < (sizeof(vRPCCommands) / sizeof(vRPCCommands[0])); vcidx++)
{
vStaticRPCCommands.push_back(vRPCCommands[vcidx]);
}
for (vcidx = 0; vcidx < (sizeof(vRPCWalletReadCommands) / sizeof(vRPCWalletReadCommands[0])); vcidx++)
{
vStaticRPCWalletReadCommands.push_back(vRPCCommands[vcidx]);
}
}