Skip to content

Commit

Permalink
RPC: Named arguments for masternode, budget, and evo calls
Browse files Browse the repository at this point in the history
  • Loading branch information
random-zebra committed May 25, 2021
1 parent 81de632 commit d524cc1
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 78 deletions.
82 changes: 41 additions & 41 deletions src/rpc/budget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ UniValue preparebudget(const JSONRPCRequest& request)

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

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

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

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

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

"\nArguments:\n"
"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"
"2. \"votehash\" (string, required) The vote hash for the proposal\n"
"2. \"hash\" (string, required) The budget proposal hash\n"
"3. \"votecast\" (string, required) Your vote. 'yes' to vote for the proposal, 'no' to vote against\n"
"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"
"5. \"legacy\" (boolean, optional, default=false) Use the legacy masternode system after deterministic masternodes enforcement.\n"
Expand Down Expand Up @@ -529,11 +529,11 @@ UniValue getbudgetvotes(const JSONRPCRequest& request)
{
if (request.params.size() != 1)
throw std::runtime_error(
"getbudgetvotes \"proposal-name\"\n"
"getbudgetvotes \"name\"\n"
"\nPrint vote information for a budget proposal\n"

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

"\nResult:\n"
"[\n"
Expand Down Expand Up @@ -636,11 +636,11 @@ UniValue getbudgetinfo(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
"getbudgetinfo ( \"proposal\" )\n"
"getbudgetinfo ( \"name\" )\n"
"\nShow current masternode budgets\n"

"\nArguments:\n"
"1. \"proposal\" (string, optional) Proposal name\n"
"1. \"name\" (string, optional) Proposal name\n"

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

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

"\nResult:\n"
"\"status\" (string) Vote status or error message\n"
Expand Down Expand Up @@ -865,21 +865,21 @@ UniValue checkbudgets(const JSONRPCRequest& request)
}

static const CRPCCommand commands[] =
{ // category name actor (function) okSafeMode
// --------------------- ------------------------ ----------------------- ----------
{ "budget", "preparebudget", &preparebudget, true },
{ "budget", "submitbudget", &submitbudget, true },
{ "budget", "mnbudgetvote", &mnbudgetvote, true },
{ "budget", "getbudgetvotes", &getbudgetvotes, true },
{ "budget", "getnextsuperblock", &getnextsuperblock, true },
{ "budget", "getbudgetprojection", &getbudgetprojection, true },
{ "budget", "getbudgetinfo", &getbudgetinfo, true },
{ "budget", "mnbudgetrawvote", &mnbudgetrawvote, true },
{ "budget", "mnfinalbudget", &mnfinalbudget, true },
{ "budget", "checkbudgets", &checkbudgets, true },
{ // category name actor (function) okSafe argNames
// --------------------- ------------------------ ----------------------- ------ --------
{ "budget", "preparebudget", &preparebudget, true, {"name","url","npayments","start","address","monthly_payment"} },
{ "budget", "submitbudget", &submitbudget, true, {"name","url","npayments","start","address","monthly_payment","fee_txid"} },
{ "budget", "mnbudgetvote", &mnbudgetvote, true, {"mode","hash","votecast","alias","legacy"} },
{ "budget", "getbudgetvotes", &getbudgetvotes, true, {"name"} },
{ "budget", "getnextsuperblock", &getnextsuperblock, true, {} },
{ "budget", "getbudgetprojection", &getbudgetprojection, true, {} },
{ "budget", "getbudgetinfo", &getbudgetinfo, true, {"name"} },
{ "budget", "mnbudgetrawvote", &mnbudgetrawvote, true, {"collat_txid","collat_vout","hash","votecast","time","sig"} },
{ "budget", "mnfinalbudget", &mnfinalbudget, true, {"command"} },
{ "budget", "checkbudgets", &checkbudgets, true, {} },

/* Not shown in help */
{ "hidden", "mnfinalbudgetsuggest", &mnfinalbudgetsuggest, true },
{ "hidden", "mnfinalbudgetsuggest", &mnfinalbudgetsuggest, true, {} },

};

Expand Down
60 changes: 30 additions & 30 deletions src/rpc/masternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ UniValue initmasternode(const JSONRPCRequest& request)
{
if (request.fHelp || (request.params.size() < 2|| request.params.size() > 3)) {
throw std::runtime_error(
"initmasternode \"masternodePrivKey\" \"masternodeAddr\" ( deterministic )\n"
"initmasternode ( \"privkey\" \"address\" deterministic )\n"
"\nInitialize masternode on demand if it's not already initialized.\n"
"\nArguments:\n"
"1. masternodePrivKey (string, required) The masternode private key.\n"
"2. masternodeAddr (string, required) The IP:Port of this masternode.\n"
"3. deterministic (boolean, optional, default=false) Init as DMN.\n"
"1. privkey (string, required) The masternode private key.\n"
"2. address (string, required) The IP:Port of this masternode.\n"
"3. deterministic (boolean, optional, default=false) Init as DMN.\n"

"\nResult:\n"
" success (string) if the masternode initialization succeeded.\n"
Expand Down Expand Up @@ -294,7 +294,7 @@ UniValue getmasternodecount (const JSONRPCRequest& request)
return obj;
}

UniValue masternodecurrent (const JSONRPCRequest& request)
UniValue masternodecurrent(const JSONRPCRequest& request)
{
if (request.fHelp || (request.params.size() != 0))
throw std::runtime_error(
Expand Down Expand Up @@ -538,7 +538,7 @@ UniValue startmasternode(const JSONRPCRequest& request)
return NullUniValue;
}

UniValue createmasternodekey (const JSONRPCRequest& request)
UniValue createmasternodekey(const JSONRPCRequest& request)
{
if (request.fHelp || (request.params.size() != 0))
throw std::runtime_error(
Expand All @@ -557,7 +557,7 @@ UniValue createmasternodekey (const JSONRPCRequest& request)
return EncodeSecret(secret);
}

UniValue getmasternodeoutputs (const JSONRPCRequest& request)
UniValue getmasternodeoutputs(const JSONRPCRequest& request)
{
CWallet * const pwallet = GetWalletForJSONRPCRequest(request);

Expand Down Expand Up @@ -599,7 +599,7 @@ UniValue getmasternodeoutputs (const JSONRPCRequest& request)
return ret;
}

UniValue listmasternodeconf (const JSONRPCRequest& request)
UniValue listmasternodeconf(const JSONRPCRequest& request)
{
std::string strFilter = "";

Expand Down Expand Up @@ -661,7 +661,7 @@ UniValue listmasternodeconf (const JSONRPCRequest& request)
return ret;
}

UniValue getmasternodestatus (const JSONRPCRequest& request)
UniValue getmasternodestatus(const JSONRPCRequest& request)
{
if (request.fHelp || (request.params.size() != 0))
throw std::runtime_error(
Expand Down Expand Up @@ -733,9 +733,9 @@ UniValue getmasternodestatus (const JSONRPCRequest& request)
+ activeMasternode.GetStatusMessage());
}

UniValue getmasternodewinners (const JSONRPCRequest& request)
UniValue getmasternodewinners(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 3)
if (request.fHelp || request.params.size() > 2)
throw std::runtime_error(
"getmasternodewinners ( blocks \"filter\" )\n"
"\nPrint the masternode winners for the last n blocks\n"
Expand Down Expand Up @@ -830,7 +830,7 @@ UniValue getmasternodewinners (const JSONRPCRequest& request)
return ret;
}

UniValue getmasternodescores (const JSONRPCRequest& request)
UniValue getmasternodescores(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
Expand Down Expand Up @@ -1091,26 +1091,26 @@ UniValue relaymasternodebroadcast(const JSONRPCRequest& request)
}

static const CRPCCommand commands[] =
{ // category name actor (function) okSafeMode
// --------------------- --------------------------- -------------------------- ----------
{ "masternode", "listmasternodes", &listmasternodes, true },
{ "masternode", "getmasternodecount", &getmasternodecount, true },
{ "masternode", "masternodecurrent", &masternodecurrent, true },
{ "masternode", "startmasternode", &startmasternode, true },
{ "masternode", "createmasternodekey", &createmasternodekey, true },
{ "masternode", "getmasternodeoutputs", &getmasternodeoutputs, true },
{ "masternode", "listmasternodeconf", &listmasternodeconf, true },
{ "masternode", "getmasternodestatus", &getmasternodestatus, true },
{ "masternode", "getmasternodewinners", &getmasternodewinners, true },
{ "masternode", "getmasternodescores", &getmasternodescores, true },
{ "masternode", "createmasternodebroadcast", &createmasternodebroadcast, true },
{ "masternode", "decodemasternodebroadcast", &decodemasternodebroadcast, true },
{ "masternode", "relaymasternodebroadcast", &relaymasternodebroadcast, true },
{ "masternode", "initmasternode", &initmasternode, true },
{ // category name actor (function) okSafe argNames
// --------------------- --------------------------- -------------------------- ------ --------
{ "masternode", "listmasternodes", &listmasternodes, true, {"filter"} },
{ "masternode", "getmasternodecount", &getmasternodecount, true, {} },
{ "masternode", "masternodecurrent", &masternodecurrent, true, {} },
{ "masternode", "startmasternode", &startmasternode, true, {"set","lockwallet","alias","reload_conf"} },
{ "masternode", "createmasternodekey", &createmasternodekey, true, {} },
{ "masternode", "getmasternodeoutputs", &getmasternodeoutputs, true, {} },
{ "masternode", "listmasternodeconf", &listmasternodeconf, true, {"filter"} },
{ "masternode", "getmasternodestatus", &getmasternodestatus, true, {} },
{ "masternode", "getmasternodewinners", &getmasternodewinners, true, {"blocks","filter"} },
{ "masternode", "getmasternodescores", &getmasternodescores, true, {"blocks"} },
{ "masternode", "createmasternodebroadcast", &createmasternodebroadcast, true, {"command","alias"} },
{ "masternode", "decodemasternodebroadcast", &decodemasternodebroadcast, true, {"hexstring"} },
{ "masternode", "relaymasternodebroadcast", &relaymasternodebroadcast, true, {"hexstring"} },
{ "masternode", "initmasternode", &initmasternode, true, {"privkey","address","deterministic"} },

/* Not shown in help */
{ "hidden", "getcachedblockhashes", &getcachedblockhashes, true },
{ "hidden", "mnping", &mnping, true },
{ "hidden", "getcachedblockhashes", &getcachedblockhashes, true, {} },
{ "hidden", "mnping", &mnping, true, {} },
};

void RegisterMasternodeRPCCommands(CRPCTable &tableRPC)
Expand Down
14 changes: 7 additions & 7 deletions src/rpc/rpcevo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,14 +751,14 @@ UniValue protx_list(const JSONRPCRequest& request)


static const CRPCCommand commands[] =
{ // category name actor (function)
// -------------- --------------------------------- ------------------------
{ "evo", "protx_list", &protx_list, {} },
{ // category name actor (function) okSafe argNames
// -------------- --------------------------------- ------------------------ ------ --------
{ "evo", "protx_list", &protx_list, true, {"detailed","wallet_only","valid_only","height"} },
#ifdef ENABLE_WALLET
{ "evo", "protx_register", &protx_register, {} },
{ "evo", "protx_register_fund", &protx_register_fund, {} },
{ "evo", "protx_register_prepare", &protx_register_prepare, {} },
{ "evo", "protx_register_submit", &protx_register_submit, {} },
{ "evo", "protx_register", &protx_register, true, {"collateralHash","collateralIndex","ipAndPort","ownerAddress","operatorAddress","votingAddress","payoutAddress","operatorReward","operatorPayoutAddress"} },
{ "evo", "protx_register_fund", &protx_register_fund, true, {"collateralAddress","ipAndPort","ownerAddress","operatorAddress","votingAddress","payoutAddress","operatorReward","operatorPayoutAddress"} },
{ "evo", "protx_register_prepare", &protx_register_prepare, true, {"collateralHash","collateralIndex","ipAndPort","ownerAddress","operatorAddress","votingAddress","payoutAddress","operatorReward","operatorPayoutAddress"} },
{ "evo", "protx_register_submit", &protx_register_submit, true, {"tx","sig"} },
#endif //ENABLE_WALLET
};

Expand Down

0 comments on commit d524cc1

Please sign in to comment.