Skip to content

Commit d524cc1

Browse files
committed
RPC: Named arguments for masternode, budget, and evo calls
1 parent 81de632 commit d524cc1

File tree

3 files changed

+78
-78
lines changed

3 files changed

+78
-78
lines changed

src/rpc/budget.cpp

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,16 @@ UniValue preparebudget(const JSONRPCRequest& request)
108108

109109
if (request.fHelp || request.params.size() != 6)
110110
throw std::runtime_error(
111-
"preparebudget \"proposal-name\" \"url\" payment-count block-start \"pivx-address\" monthy-payment\n"
111+
"preparebudget \"name\" \"url\" npayments start \"address\" monthly_payment\n"
112112
"\nPrepare proposal for network by signing and creating tx\n"
113113

114114
"\nArguments:\n"
115-
"1. \"proposal-name\": (string, required) Desired proposal name (20 character limit)\n"
116-
"2. \"url\": (string, required) URL of proposal details (64 character limit)\n"
117-
"3. payment-count: (numeric, required) Total number of monthly payments\n"
118-
"4. block-start: (numeric, required) Starting super block height\n"
119-
"5. \"pivx-address\": (string, required) PIVX address to send payments to\n"
120-
"6. monthly-payment: (numeric, required) Monthly payment amount\n"
115+
"1. \"name\": (string, required) Desired proposal name (20 character limit)\n"
116+
"2. \"url\": (string, required) URL of proposal details (64 character limit)\n"
117+
"3. npayments: (numeric, required) Total number of monthly payments\n"
118+
"4. start: (numeric, required) Starting super block height\n"
119+
"5. \"address\": (string, required) PIVX address to send payments to\n"
120+
"6. monthly_payment: (numeric, required) Monthly payment amount\n"
121121

122122
"\nResult:\n"
123123
"\"xxxx\" (string) proposal fee hash (if successful) or error message (if failed)\n"
@@ -171,17 +171,17 @@ UniValue submitbudget(const JSONRPCRequest& request)
171171
{
172172
if (request.fHelp || request.params.size() != 7)
173173
throw std::runtime_error(
174-
"submitbudget \"proposal-name\" \"url\" payment-count block-start \"pivx-address\" monthly-payment \"fee-tx\"\n"
174+
"submitbudget \"name\" \"url\" npayments start \"address\" monthly_payment \"fee_txid\"\n"
175175
"\nSubmit proposal to the network\n"
176176

177177
"\nArguments:\n"
178-
"1. \"proposal-name\": (string, required) Desired proposal name (20 character limit)\n"
179-
"2. \"url\": (string, required) URL of proposal details (64 character limit)\n"
180-
"3. payment-count: (numeric, required) Total number of monthly payments\n"
181-
"4. block-start: (numeric, required) Starting super block height\n"
182-
"5. \"pivx-address\": (string, required) PIVX address to send payments to\n"
183-
"6. monthly-payment: (numeric, required) Monthly payment amount\n"
184-
"7. \"fee-tx\": (string, required) Transaction hash from preparebudget command\n"
178+
"1. \"name\": (string, required) Desired proposal name (20 character limit)\n"
179+
"2. \"url\": (string, required) URL of proposal details (64 character limit)\n"
180+
"3. npayments: (numeric, required) Total number of monthly payments\n"
181+
"4. start: (numeric, required) Starting super block height\n"
182+
"5. \"address\": (string, required) PIVX address to send payments to\n"
183+
"6. monthly_payment: (numeric, required) Monthly payment amount\n"
184+
"7. \"fee_txid\": (string, required) Transaction hash from preparebudget command\n"
185185

186186
"\nResult:\n"
187187
"\"xxxx\" (string) proposal hash (if successful) or error message (if failed)\n"
@@ -471,13 +471,13 @@ UniValue mnbudgetvote(const JSONRPCRequest& request)
471471
if (request.fHelp || (request.params.size() == 3 && (strCommand != "local" && strCommand != "many")) || (request.params.size() == 4 && strCommand != "alias") ||
472472
request.params.size() > 5 || request.params.size() < 3)
473473
throw std::runtime_error(
474-
"mnbudgetvote \"local|many|alias\" \"votehash\" \"yes|no\" ( \"alias\" legacy )\n"
474+
"mnbudgetvote \"local|many|alias\" \"hash\" \"yes|no\" ( \"alias\" legacy )\n"
475475
"\nVote on a budget proposal\n"
476476
"\nAfter V6 enforcement, the deterministic masternode system is used by default. Set the \"legacy\" parameter to true to vote with legacy masternodes."
477477

478478
"\nArguments:\n"
479479
"1. \"mode\" (string, required) The voting mode. 'local' for voting directly from a masternode, 'many' for voting with a MN controller and casting the same vote for each MN, 'alias' for voting with a MN controller and casting a vote for a single MN\n"
480-
"2. \"votehash\" (string, required) The vote hash for the proposal\n"
480+
"2. \"hash\" (string, required) The budget proposal hash\n"
481481
"3. \"votecast\" (string, required) Your vote. 'yes' to vote for the proposal, 'no' to vote against\n"
482482
"4. \"alias\" (string, required for 'alias' mode) The MN alias to cast a vote for (for deterministic masternodes it's the hash of the proTx transaction).\n"
483483
"5. \"legacy\" (boolean, optional, default=false) Use the legacy masternode system after deterministic masternodes enforcement.\n"
@@ -529,11 +529,11 @@ UniValue getbudgetvotes(const JSONRPCRequest& request)
529529
{
530530
if (request.params.size() != 1)
531531
throw std::runtime_error(
532-
"getbudgetvotes \"proposal-name\"\n"
532+
"getbudgetvotes \"name\"\n"
533533
"\nPrint vote information for a budget proposal\n"
534534

535535
"\nArguments:\n"
536-
"1. \"proposal-name\": (string, required) Name of the proposal\n"
536+
"1. \"name\": (string, required) Name of the proposal\n"
537537

538538
"\nResult:\n"
539539
"[\n"
@@ -636,11 +636,11 @@ UniValue getbudgetinfo(const JSONRPCRequest& request)
636636
{
637637
if (request.fHelp || request.params.size() > 1)
638638
throw std::runtime_error(
639-
"getbudgetinfo ( \"proposal\" )\n"
639+
"getbudgetinfo ( \"name\" )\n"
640640
"\nShow current masternode budgets\n"
641641

642642
"\nArguments:\n"
643-
"1. \"proposal\" (string, optional) Proposal name\n"
643+
"1. \"name\" (string, optional) Proposal name\n"
644644

645645
"\nResult:\n"
646646
"[\n"
@@ -699,16 +699,16 @@ UniValue mnbudgetrawvote(const JSONRPCRequest& request)
699699
{
700700
if (request.fHelp || request.params.size() != 6)
701701
throw std::runtime_error(
702-
"mnbudgetrawvote \"masternode-tx-hash\" masternode-tx-index \"proposal-hash\" yes|no time \"vote-sig\"\n"
702+
"mnbudgetrawvote \"collat_txid\" collat_vout \"hash\" votecast time \"sig\"\n"
703703
"\nCompile and relay a proposal vote with provided external signature instead of signing vote internally\n"
704704

705705
"\nArguments:\n"
706-
"1. \"masternode-tx-hash\" (string, required) Transaction hash for the masternode\n"
707-
"2. masternode-tx-index (numeric, required) Output index for the masternode\n"
708-
"3. \"proposal-hash\" (string, required) Proposal vote hash\n"
709-
"4. yes|no (boolean, required) Vote to cast\n"
710-
"5. time (numeric, required) Time since epoch in seconds\n"
711-
"6. \"vote-sig\" (string, required) External signature\n"
706+
"1. \"collat_txid\" (string, required) Transaction hash for the masternode collateral\n"
707+
"2. collat_vout (numeric, required) Output index for the masternode collateral\n"
708+
"3. \"hash\" (string, required) Budget Proposal hash\n"
709+
"4. \"votecast\" (string, required) Your vote. 'yes' to vote for the proposal, 'no' to vote against\n"
710+
"5. time (numeric, required) Time since epoch in seconds\n"
711+
"6. \"sig\" (string, required) External signature\n"
712712

713713
"\nResult:\n"
714714
"\"status\" (string) Vote status or error message\n"
@@ -865,21 +865,21 @@ UniValue checkbudgets(const JSONRPCRequest& request)
865865
}
866866

867867
static const CRPCCommand commands[] =
868-
{ // category name actor (function) okSafeMode
869-
// --------------------- ------------------------ ----------------------- ----------
870-
{ "budget", "preparebudget", &preparebudget, true },
871-
{ "budget", "submitbudget", &submitbudget, true },
872-
{ "budget", "mnbudgetvote", &mnbudgetvote, true },
873-
{ "budget", "getbudgetvotes", &getbudgetvotes, true },
874-
{ "budget", "getnextsuperblock", &getnextsuperblock, true },
875-
{ "budget", "getbudgetprojection", &getbudgetprojection, true },
876-
{ "budget", "getbudgetinfo", &getbudgetinfo, true },
877-
{ "budget", "mnbudgetrawvote", &mnbudgetrawvote, true },
878-
{ "budget", "mnfinalbudget", &mnfinalbudget, true },
879-
{ "budget", "checkbudgets", &checkbudgets, true },
868+
{ // category name actor (function) okSafe argNames
869+
// --------------------- ------------------------ ----------------------- ------ --------
870+
{ "budget", "preparebudget", &preparebudget, true, {"name","url","npayments","start","address","monthly_payment"} },
871+
{ "budget", "submitbudget", &submitbudget, true, {"name","url","npayments","start","address","monthly_payment","fee_txid"} },
872+
{ "budget", "mnbudgetvote", &mnbudgetvote, true, {"mode","hash","votecast","alias","legacy"} },
873+
{ "budget", "getbudgetvotes", &getbudgetvotes, true, {"name"} },
874+
{ "budget", "getnextsuperblock", &getnextsuperblock, true, {} },
875+
{ "budget", "getbudgetprojection", &getbudgetprojection, true, {} },
876+
{ "budget", "getbudgetinfo", &getbudgetinfo, true, {"name"} },
877+
{ "budget", "mnbudgetrawvote", &mnbudgetrawvote, true, {"collat_txid","collat_vout","hash","votecast","time","sig"} },
878+
{ "budget", "mnfinalbudget", &mnfinalbudget, true, {"command"} },
879+
{ "budget", "checkbudgets", &checkbudgets, true, {} },
880880

881881
/* Not shown in help */
882-
{ "hidden", "mnfinalbudgetsuggest", &mnfinalbudgetsuggest, true },
882+
{ "hidden", "mnfinalbudgetsuggest", &mnfinalbudgetsuggest, true, {} },
883883

884884
};
885885

src/rpc/masternode.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ UniValue initmasternode(const JSONRPCRequest& request)
5757
{
5858
if (request.fHelp || (request.params.size() < 2|| request.params.size() > 3)) {
5959
throw std::runtime_error(
60-
"initmasternode \"masternodePrivKey\" \"masternodeAddr\" ( deterministic )\n"
60+
"initmasternode ( \"privkey\" \"address\" deterministic )\n"
6161
"\nInitialize masternode on demand if it's not already initialized.\n"
6262
"\nArguments:\n"
63-
"1. masternodePrivKey (string, required) The masternode private key.\n"
64-
"2. masternodeAddr (string, required) The IP:Port of this masternode.\n"
65-
"3. deterministic (boolean, optional, default=false) Init as DMN.\n"
63+
"1. privkey (string, required) The masternode private key.\n"
64+
"2. address (string, required) The IP:Port of this masternode.\n"
65+
"3. deterministic (boolean, optional, default=false) Init as DMN.\n"
6666

6767
"\nResult:\n"
6868
" success (string) if the masternode initialization succeeded.\n"
@@ -294,7 +294,7 @@ UniValue getmasternodecount (const JSONRPCRequest& request)
294294
return obj;
295295
}
296296

297-
UniValue masternodecurrent (const JSONRPCRequest& request)
297+
UniValue masternodecurrent(const JSONRPCRequest& request)
298298
{
299299
if (request.fHelp || (request.params.size() != 0))
300300
throw std::runtime_error(
@@ -538,7 +538,7 @@ UniValue startmasternode(const JSONRPCRequest& request)
538538
return NullUniValue;
539539
}
540540

541-
UniValue createmasternodekey (const JSONRPCRequest& request)
541+
UniValue createmasternodekey(const JSONRPCRequest& request)
542542
{
543543
if (request.fHelp || (request.params.size() != 0))
544544
throw std::runtime_error(
@@ -557,7 +557,7 @@ UniValue createmasternodekey (const JSONRPCRequest& request)
557557
return EncodeSecret(secret);
558558
}
559559

560-
UniValue getmasternodeoutputs (const JSONRPCRequest& request)
560+
UniValue getmasternodeoutputs(const JSONRPCRequest& request)
561561
{
562562
CWallet * const pwallet = GetWalletForJSONRPCRequest(request);
563563

@@ -599,7 +599,7 @@ UniValue getmasternodeoutputs (const JSONRPCRequest& request)
599599
return ret;
600600
}
601601

602-
UniValue listmasternodeconf (const JSONRPCRequest& request)
602+
UniValue listmasternodeconf(const JSONRPCRequest& request)
603603
{
604604
std::string strFilter = "";
605605

@@ -661,7 +661,7 @@ UniValue listmasternodeconf (const JSONRPCRequest& request)
661661
return ret;
662662
}
663663

664-
UniValue getmasternodestatus (const JSONRPCRequest& request)
664+
UniValue getmasternodestatus(const JSONRPCRequest& request)
665665
{
666666
if (request.fHelp || (request.params.size() != 0))
667667
throw std::runtime_error(
@@ -733,9 +733,9 @@ UniValue getmasternodestatus (const JSONRPCRequest& request)
733733
+ activeMasternode.GetStatusMessage());
734734
}
735735

736-
UniValue getmasternodewinners (const JSONRPCRequest& request)
736+
UniValue getmasternodewinners(const JSONRPCRequest& request)
737737
{
738-
if (request.fHelp || request.params.size() > 3)
738+
if (request.fHelp || request.params.size() > 2)
739739
throw std::runtime_error(
740740
"getmasternodewinners ( blocks \"filter\" )\n"
741741
"\nPrint the masternode winners for the last n blocks\n"
@@ -830,7 +830,7 @@ UniValue getmasternodewinners (const JSONRPCRequest& request)
830830
return ret;
831831
}
832832

833-
UniValue getmasternodescores (const JSONRPCRequest& request)
833+
UniValue getmasternodescores(const JSONRPCRequest& request)
834834
{
835835
if (request.fHelp || request.params.size() > 1)
836836
throw std::runtime_error(
@@ -1091,26 +1091,26 @@ UniValue relaymasternodebroadcast(const JSONRPCRequest& request)
10911091
}
10921092

10931093
static const CRPCCommand commands[] =
1094-
{ // category name actor (function) okSafeMode
1095-
// --------------------- --------------------------- -------------------------- ----------
1096-
{ "masternode", "listmasternodes", &listmasternodes, true },
1097-
{ "masternode", "getmasternodecount", &getmasternodecount, true },
1098-
{ "masternode", "masternodecurrent", &masternodecurrent, true },
1099-
{ "masternode", "startmasternode", &startmasternode, true },
1100-
{ "masternode", "createmasternodekey", &createmasternodekey, true },
1101-
{ "masternode", "getmasternodeoutputs", &getmasternodeoutputs, true },
1102-
{ "masternode", "listmasternodeconf", &listmasternodeconf, true },
1103-
{ "masternode", "getmasternodestatus", &getmasternodestatus, true },
1104-
{ "masternode", "getmasternodewinners", &getmasternodewinners, true },
1105-
{ "masternode", "getmasternodescores", &getmasternodescores, true },
1106-
{ "masternode", "createmasternodebroadcast", &createmasternodebroadcast, true },
1107-
{ "masternode", "decodemasternodebroadcast", &decodemasternodebroadcast, true },
1108-
{ "masternode", "relaymasternodebroadcast", &relaymasternodebroadcast, true },
1109-
{ "masternode", "initmasternode", &initmasternode, true },
1094+
{ // category name actor (function) okSafe argNames
1095+
// --------------------- --------------------------- -------------------------- ------ --------
1096+
{ "masternode", "listmasternodes", &listmasternodes, true, {"filter"} },
1097+
{ "masternode", "getmasternodecount", &getmasternodecount, true, {} },
1098+
{ "masternode", "masternodecurrent", &masternodecurrent, true, {} },
1099+
{ "masternode", "startmasternode", &startmasternode, true, {"set","lockwallet","alias","reload_conf"} },
1100+
{ "masternode", "createmasternodekey", &createmasternodekey, true, {} },
1101+
{ "masternode", "getmasternodeoutputs", &getmasternodeoutputs, true, {} },
1102+
{ "masternode", "listmasternodeconf", &listmasternodeconf, true, {"filter"} },
1103+
{ "masternode", "getmasternodestatus", &getmasternodestatus, true, {} },
1104+
{ "masternode", "getmasternodewinners", &getmasternodewinners, true, {"blocks","filter"} },
1105+
{ "masternode", "getmasternodescores", &getmasternodescores, true, {"blocks"} },
1106+
{ "masternode", "createmasternodebroadcast", &createmasternodebroadcast, true, {"command","alias"} },
1107+
{ "masternode", "decodemasternodebroadcast", &decodemasternodebroadcast, true, {"hexstring"} },
1108+
{ "masternode", "relaymasternodebroadcast", &relaymasternodebroadcast, true, {"hexstring"} },
1109+
{ "masternode", "initmasternode", &initmasternode, true, {"privkey","address","deterministic"} },
11101110

11111111
/* Not shown in help */
1112-
{ "hidden", "getcachedblockhashes", &getcachedblockhashes, true },
1113-
{ "hidden", "mnping", &mnping, true },
1112+
{ "hidden", "getcachedblockhashes", &getcachedblockhashes, true, {} },
1113+
{ "hidden", "mnping", &mnping, true, {} },
11141114
};
11151115

11161116
void RegisterMasternodeRPCCommands(CRPCTable &tableRPC)

src/rpc/rpcevo.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -751,14 +751,14 @@ UniValue protx_list(const JSONRPCRequest& request)
751751

752752

753753
static const CRPCCommand commands[] =
754-
{ // category name actor (function)
755-
// -------------- --------------------------------- ------------------------
756-
{ "evo", "protx_list", &protx_list, {} },
754+
{ // category name actor (function) okSafe argNames
755+
// -------------- --------------------------------- ------------------------ ------ --------
756+
{ "evo", "protx_list", &protx_list, true, {"detailed","wallet_only","valid_only","height"} },
757757
#ifdef ENABLE_WALLET
758-
{ "evo", "protx_register", &protx_register, {} },
759-
{ "evo", "protx_register_fund", &protx_register_fund, {} },
760-
{ "evo", "protx_register_prepare", &protx_register_prepare, {} },
761-
{ "evo", "protx_register_submit", &protx_register_submit, {} },
758+
{ "evo", "protx_register", &protx_register, true, {"collateralHash","collateralIndex","ipAndPort","ownerAddress","operatorAddress","votingAddress","payoutAddress","operatorReward","operatorPayoutAddress"} },
759+
{ "evo", "protx_register_fund", &protx_register_fund, true, {"collateralAddress","ipAndPort","ownerAddress","operatorAddress","votingAddress","payoutAddress","operatorReward","operatorPayoutAddress"} },
760+
{ "evo", "protx_register_prepare", &protx_register_prepare, true, {"collateralHash","collateralIndex","ipAndPort","ownerAddress","operatorAddress","votingAddress","payoutAddress","operatorReward","operatorPayoutAddress"} },
761+
{ "evo", "protx_register_submit", &protx_register_submit, true, {"tx","sig"} },
762762
#endif //ENABLE_WALLET
763763
};
764764

0 commit comments

Comments
 (0)