diff --git a/src/rpc/coinjoin.cpp b/src/rpc/coinjoin.cpp index e0367734467a3..93e70008895d9 100644 --- a/src/rpc/coinjoin.cpp +++ b/src/rpc/coinjoin.cpp @@ -59,7 +59,7 @@ static RPCHelpMan coinjoin() { {"command", RPCArg::Type::STR, RPCArg::Optional::NO, "The command to execute"}, }, - RPCResults{}, + RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -231,7 +231,7 @@ static RPCHelpMan coinjoinsalt() { {"command", RPCArg::Type::STR, RPCArg::Optional::NO, "The command to execute"}, }, - RPCResults{}, + RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { diff --git a/src/rpc/evo.cpp b/src/rpc/evo.cpp index 3e0dcc6416368..aa96e1cccfb03 100644 --- a/src/rpc/evo.cpp +++ b/src/rpc/evo.cpp @@ -1404,7 +1404,16 @@ static RPCHelpMan protx_list() {"detailed", RPCArg::Type::BOOL, RPCArg::Default{false}, "If not specified, only the hashes of the ProTx will be returned."}, {"height", RPCArg::Type::NUM, RPCArg::DefaultHint{"current chain-tip"}, ""}, }, - RPCResults{}, + RPCResult{ + RPCResult::Type::ARR, "", "List of masternodes", + { + RPCResult{"when detailed=false", RPCResult::Type::STR, "", "ProTx hash"}, + RPCResult{"when detailed=true", RPCResult::Type::OBJ, "", "", + { + // TODO: document fields of the detailed entry + {RPCResult::Type::ELISION, "", ""} + }}, + }}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -1511,6 +1520,7 @@ static RPCHelpMan protx_info() RPCResult{ RPCResult::Type::OBJ, "", "Details about a specific deterministic masternode", { + // TODO: implement proper doc for protx info {RPCResult::Type::ELISION, "", ""} } }, @@ -1644,8 +1654,40 @@ static RPCHelpMan protx_listdiff() {"baseBlock", RPCArg::Type::NUM, RPCArg::Optional::NO, "The starting block height."}, {"block", RPCArg::Type::NUM, RPCArg::Optional::NO, "The ending block height."}, }, - RPCResults{}, - RPCExamples{""}, + RPCResult { + RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::NUM, "baseHeight", "Height of base (starting) block"}, + {RPCResult::Type::NUM, "blockHeight", "Height of target (ending) block"}, + {RPCResult::Type::ARR, "addedMNs", "Added masternodes", + { + {RPCResult::Type::OBJ, "", "", + { + // TODO: list fields of output for RPC help instead ELISION + {RPCResult::Type::ELISION, "", ""} + }}, + }, + }, + {RPCResult::Type::ARR, "removedMns", "Removed masternodes", + { + {RPCResult::Type::STR_HEX, "protx", "ProTx of removed masternode"}, + }, + }, + {RPCResult::Type::ARR, "updatedMNs", "Updated masternodes", + { + {RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::OBJ, "protx", "ProTx of updated masternode", + { + // TODO: list fields of output for RPC help instead ELISION + {RPCResult::Type::ELISION, "", ""} + }}, + }}, + }, + }, + }, + }, + RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { const NodeContext& node = EnsureAnyNodeContext(request.context); @@ -1743,7 +1785,7 @@ static RPCHelpMan protx_help() { {"command", RPCArg::Type::STR, RPCArg::Optional::NO, "The command to execute"}, }, - RPCResults{}, + RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -1833,7 +1875,7 @@ static RPCHelpMan bls_help() { {"command", RPCArg::Type::STR, RPCArg::Optional::NO, "The command to execute"}, }, - RPCResults{}, + RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { diff --git a/src/rpc/governance.cpp b/src/rpc/governance.cpp index ea66057b457ca..c67eb7749538b 100644 --- a/src/rpc/governance.cpp +++ b/src/rpc/governance.cpp @@ -43,7 +43,20 @@ static RPCHelpMan gobject_count() { {"mode", RPCArg::Type::STR, RPCArg::DefaultHint{"json"}, "Output format: json (\"json\") or string in free form (\"all\")"}, }, - RPCResults{}, + { + RPCResult{"for mode = json", + RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::NUM, "objects_total", "Total number of all governance objects"}, + {RPCResult::Type::NUM, "proposals", "Number of governance proposals"}, + {RPCResult::Type::NUM, "triggers", "Number of triggers"}, + {RPCResult::Type::NUM, "other", "Total number of unknown governance objects"}, + {RPCResult::Type::NUM, "erased", "Number of removed (expired) objects"}, + {RPCResult::Type::NUM, "votes", "Total number of votes"}, + } + }, + RPCResult{"for mode = all", RPCResult::Type::STR, "", "Human-friendly summary string for proposals and votes"}, + }, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -71,7 +84,7 @@ static RPCHelpMan gobject_deserialize() { {"hex_data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "data in hex string form"}, }, - RPCResults{}, + RPCResult{RPCResult::Type::STR, "", "JSON string of the deserialized governance object"}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -96,7 +109,12 @@ static RPCHelpMan gobject_check() { {"hex_data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "data in hex string format"}, }, - RPCResults{}, + RPCResult{"if object is valid", + RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::STR, "Object status", "OK"}, + } + }, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -145,7 +163,7 @@ static RPCHelpMan gobject_prepare() {"outputHash", RPCArg::Type::STR_HEX, RPCArg::Default{""}, "the single output to submit the proposal fee from"}, {"outputIndex", RPCArg::Type::NUM, RPCArg::Default{0}, "The output index."}, }, - RPCResults{}, + {RPCResult{"if object valid", RPCResult::Type::STR_HEX, "", "The collateral transaction id (txid)"}}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -254,7 +272,16 @@ static RPCHelpMan gobject_list_prepared() { {"count", RPCArg::Type::NUM, RPCArg::Default{10}, "Maximum number of objects to return."}, }, - RPCResults{}, + RPCResult{ + RPCResult::Type::ARR, "", "list of governance objects", + { + {RPCResult::Type::OBJ, "", "", + { + // TODO: list fields of output for RPC help instead ELISION + {RPCResult::Type::ELISION, "", ""} + }}, + } + }, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -303,7 +330,7 @@ static RPCHelpMan gobject_submit() {"data-hex", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "data in hex string form"}, {"fee-txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "txid of the corresponding proposal fee transaction"}, }, - RPCResults{}, + RPCResult{RPCResult::Type::STR_HEX, "hash", "Hash of the submitted governance object"}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -484,6 +511,23 @@ static bool CheckWalletOwnsKey(const CWallet& wallet, const CKeyID& keyid) return wallet.IsMine(script) == isminetype::ISMINE_SPENDABLE; } +namespace { +const RPCResult vote_results{ + RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::STR, "overall", "Total number of successful and failed votes"}, + {RPCResult::Type::OBJ, "detail", "Detailed information for each vote", + { + {RPCResult::Type::OBJ, "protx", "ProTx of masternode for voting", + { + {RPCResult::Type::STR, "result", "Result of voting: {success|failed}"}, + {RPCResult::Type::STR, "errorMessage", /*optional=*/true, "Error message if failed"}, + }}, + }}, + }, +}; +} // anonymous namespace + static RPCHelpMan gobject_vote_many() { return RPCHelpMan{"gobject vote-many", @@ -494,7 +538,7 @@ static RPCHelpMan gobject_vote_many() {"vote", RPCArg::Type::STR, RPCArg::Optional::NO, "vote, possible values: [funding|valid|delete|endorsed]"}, {"vote-outcome", RPCArg::Type::STR, RPCArg::Optional::NO, "vote outcome, possible values: [yes|no|abstain]"}, }, - RPCResults{}, + vote_results, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -547,7 +591,7 @@ static RPCHelpMan gobject_vote_alias() {"vote-outcome", RPCArg::Type::STR, RPCArg::Optional::NO, "vote outcome, possible values: [yes|no|abstain]"}, {"protx-hash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "masternode's proTxHash"}, }, - RPCResults{}, + vote_results, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -669,7 +713,18 @@ static RPCHelpMan gobject_list_helper(const bool make_a_diff) {"signal", RPCArg::Type::STR, RPCArg::Default{"valid"}, "cached signal, possible values: [valid|funding|delete|endorsed|all]"}, {"type", RPCArg::Type::STR, RPCArg::Default{"all"}, "object type, possible values: [proposals|triggers|all]"}, }, - RPCResults{}, + { + RPCResult{"If request is valid", + RPCResult::Type::OBJ, "hash", "Object details", + { + // TODO: list fields of output for RPC help instead ELISION + {RPCResult::Type::ELISION, "", ""} + }, + }, + RPCResult{"If request is invalid", + RPCResult::Type::STR, "", "Error string" + }, + }, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -715,7 +770,15 @@ static RPCHelpMan gobject_get() { {"governance-hash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "object id"}, }, - RPCResults{}, + { + RPCResult{ + RPCResult::Type::OBJ, "", "", + { + // TODO: list fields of output for RPC help instead ELISION + {RPCResult::Type::ELISION, "", ""} + } + }, + }, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -811,7 +874,12 @@ static RPCHelpMan gobject_getcurrentvotes() {"txid", RPCArg::Type::STR_HEX, RPCArg::Default{""}, "masternode collateral txid"}, {"vout", RPCArg::Type::STR, RPCArg::Default{""}, "masternode collateral output index, required if present"}, }, - RPCResults{}, + RPCResult{ + RPCResult::Type::OBJ_DYN, "", "Keys are hashes of vote, values are votes", + { + {RPCResult::Type::STR, "votes", "Human-friendly presentation of vote"}, + }, + }, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -877,7 +945,7 @@ static RPCHelpMan gobject() { {"command", RPCArg::Type::STR, RPCArg::Optional::NO, "The command to execute"}, }, - RPCResults{}, + RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -899,7 +967,7 @@ static RPCHelpMan voteraw() {"time", RPCArg::Type::NUM, RPCArg::Optional::NO, ""}, {"vote-sig", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, ""}, }, - RPCResults{}, + RPCResult{RPCResult::Type::STR, "", "Result of voting"}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { diff --git a/src/rpc/masternode.cpp b/src/rpc/masternode.cpp index 727b20e9ebf53..c516f6f4151e6 100644 --- a/src/rpc/masternode.cpp +++ b/src/rpc/masternode.cpp @@ -49,7 +49,9 @@ static RPCHelpMan masternode_connect() {"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The address of the masternode to connect"}, {"v2transport", RPCArg::Type::BOOL, RPCArg::DefaultHint{"set by -v2transport"}, "Attempt to connect using BIP324 v2 transport protocol"}, }, - RPCResults{}, + RPCResult{ + RPCResult::Type::STR, "status", "Returns 'successfully connected' if successful" + }, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -85,7 +87,28 @@ static RPCHelpMan masternode_count() return RPCHelpMan{"masternode count", "Get information about number of masternodes.\n", {}, - RPCResults{}, + RPCResult{ + RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::NUM, "total", "Total number of Masternodes"}, + {RPCResult::Type::NUM, "enabled", "Number of enabled Masternodes"}, + {RPCResult::Type::OBJ, "details", "Breakdown of masternodes by type", + {{RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::OBJ, "regular", "Details for regular masternodes", + { + {RPCResult::Type::NUM, "total", "Total number of regular Masternodes"}, + {RPCResult::Type::NUM, "enabled", "Number of enabled regular Masternodes"} + }}, + {RPCResult::Type::OBJ, "evo", "Details for Evo nodes", + { + {RPCResult::Type::NUM, "total", "Total number of Evo nodes"}, + {RPCResult::Type::NUM, "enabled", "Number of enabled Evo nodes"} + }}, + }}, + }} + } + }, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -157,7 +180,13 @@ static RPCHelpMan masternode_status() return RPCHelpMan{"masternode status", "Print masternode status information\n", {}, - RPCResults{}, + RPCResult{ + RPCResult::Type::OBJ, "", "", + { + // TODO: implement proper type validator instead ELISION + {RPCResult::Type::ELISION, "", ""} + } + }, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -232,7 +261,12 @@ static RPCHelpMan masternode_winners() {"count", RPCArg::Type::NUM, RPCArg::Default{10}, "number of last winners to return"}, {"filter", RPCArg::Type::STR, RPCArg::Default{""}, "filter for returned winners"}, }, - RPCResults{}, + RPCResult{ + RPCResult::Type::OBJ_DYN, "", "Keys are block heights (as strings); values describe the payees for that height", + { + {RPCResult::Type::STR, "payee", "Payee for the height"} + } + }, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -454,7 +488,7 @@ static RPCHelpMan masternode_help() { {"command", RPCArg::Type::STR, RPCArg::Optional::NO, "The command to execute"}, }, - RPCResults{}, + RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -491,7 +525,13 @@ static RPCHelpMan masternodelist_helper(bool is_composite) {"mode", RPCArg::Type::STR, RPCArg::DefaultHint{"json"}, "The mode to run list in"}, {"filter", RPCArg::Type::STR, RPCArg::Default{""}, "Filter results. Partial match by outpoint by default in all modes, additional matches in some modes are also available"}, }, - RPCResults{}, + RPCResult{ + RPCResult::Type::OBJ, "", "", + { + // TODO: implement proper type validator instead ELISION + {RPCResult::Type::ELISION, "", ""} + } + }, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { diff --git a/src/rpc/node.cpp b/src/rpc/node.cpp index 97d6188828b93..a34c543307125 100644 --- a/src/rpc/node.cpp +++ b/src/rpc/node.cpp @@ -825,7 +825,7 @@ static RPCHelpMan mockscheduler() { {"delta_time", RPCArg::Type::NUM, RPCArg::Optional::NO, "Number of seconds to forward the scheduler into the future." }, }, - RPCResults{}, + RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { diff --git a/src/rpc/quorums.cpp b/src/rpc/quorums.cpp index a9b3b88d34553..da9e2e29d71f9 100644 --- a/src/rpc/quorums.cpp +++ b/src/rpc/quorums.cpp @@ -242,7 +242,12 @@ static RPCHelpMan quorum_info() {"quorumHash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Block hash of quorum."}, {"includeSkShare", RPCArg::Type::BOOL, RPCArg::Default{false}, "Include secret key share in output."}, }, - RPCResults{}, + RPCResult{ + RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::ELISION, "", ""} + }, + }, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -280,7 +285,35 @@ static RPCHelpMan quorum_dkgstatus() "Detail level of output.\n" "0=Only show counts. 1=Show member indexes. 2=Show member's ProTxHashes."}, }, - RPCResults{}, + RPCResult{ + RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::NUM, "time", "Adjusted time for the last update, timestamp"}, + {RPCResult::Type::STR, "timeStr", "Adjusted time for the last update, human friendly"}, + {RPCResult::Type::ARR, "session", "", + { + {RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::NUM, "llmqType", "Name of quorum"}, + {RPCResult::Type::NUM, "quorumIndex", "Relevant for rotation quorums only, 0 for non-rotating quorums"}, + {RPCResult::Type::OBJ, "status", "", + { + // TODO: list fields of output for RPC help instead ELISION + {RPCResult::Type::ELISION, "", ""}, + }}, + }}, + }, + }, + {RPCResult::Type::ARR, "quorumConnections", "", + // TODO: list fields of output for RPC help instead ELISION + {{RPCResult::Type::ELISION, "", ""}}, + }, + {RPCResult::Type::ARR, "mineableCommitments", "", + // TODO: list fields of output for RPC help instead ELISION + {{RPCResult::Type::ELISION, "", ""}}, + }, + }, + }, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -388,7 +421,17 @@ static RPCHelpMan quorum_memberof() "Can be CPU/disk heavy when the value is larger than the number of active quorums." }, }, - RPCResults{}, + RPCResult{ + RPCResult::Type::ARR, "quorums", "", + { + {RPCResult::Type::OBJ, "", "Quorum Info", + { + {RPCResult::Type::ELISION, "", "See for details help for `quorum info`"}, + {RPCResult::Type::BOOL, "isValidMember", ""}, + {RPCResult::Type::NUM, "memberIndex", ""}, + }}, + }, + }, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -492,6 +535,23 @@ static UniValue quorum_sign_helper(const JSONRPCRequest& request, Consensus::LLM } } +namespace { +const RPCResults quorum_sign_result{ + RPCResult{"if submit is set to true", RPCResult::Type::BOOL, "result", "result of signing, true if success"}, + RPCResult{"if submit is not set or set to false", RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::NUM, "llmqType", "Quorum type"}, + {RPCResult::Type::STR_HEX, "quorumHash", "Quorum Hash"}, + {RPCResult::Type::NUM, "quorumMember", "Number of quorum member"}, + {RPCResult::Type::STR_HEX, "id", "Request ID"}, + {RPCResult::Type::STR_HEX, "msgHash", "Hash of message"}, + {RPCResult::Type::STR_HEX, "signHash", "Hash of signature"}, + {RPCResult::Type::STR_HEX, "signature", "Hex encoded signature"}, + }, + }, +}; +} // anonymous namespace + static RPCHelpMan quorum_sign() { return RPCHelpMan{"quorum sign", @@ -504,7 +564,7 @@ static RPCHelpMan quorum_sign() {"submit", RPCArg::Type::BOOL, RPCArg::Default{true}, "Submits the signature share to the network if this is true. " "Returns an object containing the signature share if this is false."}, }, - RPCResults{}, + quorum_sign_result, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -531,7 +591,7 @@ static RPCHelpMan quorum_platformsign() {"submit", RPCArg::Type::BOOL, RPCArg::Default{true}, "Submits the signature share to the network if this is true. " "Returns an object containing the signature share if this is false."}, }, - RPCResults{}, + quorum_sign_result, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -569,7 +629,7 @@ static RPCHelpMan quorum_verify() "The height at which the message was signed.\n" "Only works when quorumHash is \"\"."}, }, - RPCResults{}, + RPCResult{RPCResult::Type::BOOL, "", "Returns true if the signature is valid"}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -623,7 +683,7 @@ static RPCHelpMan quorum_hasrecsig() {"id", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Request id."}, {"msgHash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Message hash."}, }, - RPCResults{}, + RPCResult{RPCResult::Type::BOOL, "", "Returns true if node has this recovered signature"}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -688,7 +748,7 @@ static RPCHelpMan quorum_isconflicting() {"id", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Request id."}, {"msgHash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Message hash."}, }, - RPCResults{}, + RPCResult{RPCResult::Type::BOOL, "", "Returns true if this msgHash is conflicting with previous signing sessions"}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -716,7 +776,15 @@ static RPCHelpMan quorum_selectquorum() {"llmqType", RPCArg::Type::NUM, RPCArg::Optional::NO, "LLMQ type."}, {"id", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Request id."}, }, - RPCResults{}, + RPCResult{ + RPCResult::Type::OBJ, "", "", + { + {RPCResult::Type::STR_HEX, "quorumHash", "Hash of chosen quorum"}, + {RPCResult::Type::ARR, "recoveryMembers", "List of members to use for signature recovery", + {{RPCResult::Type::STR_HEX, "hash", "ProTxHash of member"}} + }, + } + }, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -761,7 +829,7 @@ static RPCHelpMan quorum_dkgsimerror() {"type", RPCArg::Type::STR, RPCArg::Optional::NO, "Error type."}, {"rate", RPCArg::Type::NUM, RPCArg::Optional::NO, "Rate at which to simulate this error type (between 0 and 100)."}, }, - RPCResults{}, + RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -777,7 +845,7 @@ static RPCHelpMan quorum_dkgsimerror() throw JSONRPCError(RPC_INVALID_PARAMETER, "invalid type. See DKGError class implementation"); } else { llmq::SetSimulatedDKGErrorRate(type, static_cast(rate) / 100); - return UniValue(); + return NullUniValue; } }, }; @@ -798,7 +866,7 @@ static RPCHelpMan quorum_getdata() "3 - Request both, 1 and 2"}, {"proTxHash", RPCArg::Type::STR_HEX, RPCArg::Default{""}, "The proTxHash the contributions will be requested for. Must be member of the specified LLMQ."}, }, - RPCResults{}, + RPCResult{RPCResult::Type::BOOL, "", "Returns true if the message QGETDATA has been successfully sent"}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -960,7 +1028,7 @@ static RPCHelpMan quorum_help() { {"command", RPCArg::Type::STR, RPCArg::Optional::NO, "The command to execute"}, }, - RPCResults{}, + RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -978,7 +1046,7 @@ static RPCHelpMan verifychainlock() {"signature", RPCArg::Type::STR, RPCArg::Optional::NO, "The signature of the ChainLock."}, {"blockHeight", RPCArg::Type::NUM, RPCArg::DefaultHint{"There will be an internal lookup of \"blockHash\" if this is not provided."}, "The height of the ChainLock."}, }, - RPCResults{}, + RPCResult{RPCResult::Type::BOOL, "", "Returns true if the chainlock is valid"}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { @@ -1037,7 +1105,7 @@ static RPCHelpMan verifyislock() {"signature", RPCArg::Type::STR, RPCArg::Optional::NO, "The InstantSend Lock signature to verify."}, {"maxHeight", RPCArg::Type::NUM, RPCArg::Default{-1}, "The maximum height to search quorums from."}, }, - RPCResults{}, + RPCResult{RPCResult::Type::BOOL, "", "Returns true if the instantsend lock is valid"}, RPCExamples{""}, [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 77de92f39f674..f9b7397ebba7e 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -358,8 +358,19 @@ static RPCHelpMan getrawtransactionmulti() { {"verbose", RPCArg::Type::BOOL, RPCArg::Default{false}, "If false, return a string, otherwise return a json object"}, }, - // TODO: replace RPCResults to proper annotation - RPCResults{}, + RPCResult{ + RPCResult::Type::OBJ, "", "", + { + {"If verbose is not set or set to false", + RPCResult::Type::STR_HEX, "txid", "The serialized, hex-encoded data for 'txid'"}, + {"if verbose is set to true", + RPCResult::Type::OBJ, "txid", "The decoded network-serialized transaction.", + { + {RPCResult::Type::ELISION, "", "The layout is the same as the output of getrawtransaction."}, + }}, + {"If tx is unknown", RPCResult::Type::STR, "txid", "None"}, + }, + }, RPCExamples{ HelpExampleCli("getrawtransactionmulti", R"('{"blockhash1":["txid1","txid2"], "0":["txid3"]}')") diff --git a/src/wallet/rpc/wallet.cpp b/src/wallet/rpc/wallet.cpp index d7fdae8cd6093..699fb7795e3b0 100644 --- a/src/wallet/rpc/wallet.cpp +++ b/src/wallet/rpc/wallet.cpp @@ -96,7 +96,7 @@ static RPCHelpMan setcoinjoinrounds() "The default number of rounds is " + ToString(DEFAULT_COINJOIN_ROUNDS) + " Cannot be more than " + ToString(MAX_COINJOIN_ROUNDS) + " nor less than " + ToString(MIN_COINJOIN_ROUNDS)}, }, - RPCResults{}, + RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{ HelpExampleCli("setcoinjoinrounds", "4") + HelpExampleRpc("setcoinjoinrounds", "16") @@ -127,7 +127,7 @@ static RPCHelpMan setcoinjoinamount() "The default amount is " + ToString(DEFAULT_COINJOIN_AMOUNT) + " Cannot be more than " + ToString(MAX_COINJOIN_AMOUNT) + " nor less than " + ToString(MIN_COINJOIN_AMOUNT)}, }, - RPCResults{}, + RPCResult{RPCResult::Type::NONE, "", ""}, RPCExamples{ HelpExampleCli("setcoinjoinamount", "500") + HelpExampleRpc("setcoinjoinamount", "208")