@@ -94,14 +94,15 @@ static UniValue getnetworkhashps(const JSONRPCRequest& request)
9494 {
9595 {" nblocks" , RPCArg::Type::NUM, /* opt */ true , /* default_val */ " 120" , " The number of blocks, or -1 for blocks since last difficulty change." },
9696 {" height" , RPCArg::Type::NUM, /* opt */ true , /* default_val */ " -1" , " To estimate at the time of the given height." },
97- }}
98- .ToString () +
99- " \n Result:\n "
97+ },
98+ RPCResult{
10099 " x (numeric) Hashes per second estimated\n "
101- " \n Examples:\n "
102- + HelpExampleCli (" getnetworkhashps" , " " )
100+ },
101+ RPCExamples{
102+ HelpExampleCli (" getnetworkhashps" , " " )
103103 + HelpExampleRpc (" getnetworkhashps" , " " )
104- );
104+ },
105+ }.ToString ());
105106
106107 LOCK (cs_main);
107108 return GetNetworkHashPS (!request.params [0 ].isNull () ? request.params [0 ].get_int () : 120 , !request.params [1 ].isNull () ? request.params [1 ].get_int () : -1 );
@@ -165,16 +166,17 @@ static UniValue generatetoaddress(const JSONRPCRequest& request)
165166 {" nblocks" , RPCArg::Type::NUM, /* opt */ false , /* default_val */ " " , " How many blocks are generated immediately." },
166167 {" address" , RPCArg::Type::STR, /* opt */ false , /* default_val */ " " , " The address to send the newly generated bitcoin to." },
167168 {" maxtries" , RPCArg::Type::NUM, /* opt */ true , /* default_val */ " 1000000" , " How many iterations to try." },
168- }}
169- .ToString () +
170- " \n Result:\n "
169+ },
170+ RPCResult{
171171 " [ blockhashes ] (array) hashes of blocks generated\n "
172- " \n Examples:\n "
172+ },
173+ RPCExamples{
173174 " \n Generate 11 blocks to myaddress\n "
174175 + HelpExampleCli (" generatetoaddress" , " 11 \" myaddress\" " )
175176 + " If you are running the bitcoin core wallet, you can get a new address to send the newly generated bitcoin to with:\n "
176177 + HelpExampleCli (" getnewaddress" , " " )
177- );
178+ },
179+ }.ToString ());
178180
179181 int nGenerate = request.params [0 ].get_int ();
180182 uint64_t nMaxTries = 1000000 ;
@@ -198,9 +200,9 @@ static UniValue getmininginfo(const JSONRPCRequest& request)
198200 if (request.fHelp || request.params .size () != 0 )
199201 throw std::runtime_error (
200202 RPCHelpMan{" getmininginfo" ,
201- " \n Returns a json object containing mining-related information." , {}}
202- . ToString () +
203- " \n Result: \n "
203+ " \n Returns a json object containing mining-related information." ,
204+ {},
205+ RPCResult{
204206 " {\n "
205207 " \" blocks\" : nnn, (numeric) The current block\n "
206208 " \" currentblockweight\" : nnn, (numeric) The last block weight\n "
@@ -211,10 +213,12 @@ static UniValue getmininginfo(const JSONRPCRequest& request)
211213 " \" chain\" : \" xxxx\" , (string) current network name as defined in BIP70 (main, test, regtest)\n "
212214 " \" warnings\" : \" ...\" (string) any network and blockchain warnings\n "
213215 " }\n "
214- " \n Examples:\n "
215- + HelpExampleCli (" getmininginfo" , " " )
216+ },
217+ RPCExamples{
218+ HelpExampleCli (" getmininginfo" , " " )
216219 + HelpExampleRpc (" getmininginfo" , " " )
217- );
220+ },
221+ }.ToString ());
218222
219223
220224 LOCK (cs_main);
@@ -247,14 +251,15 @@ static UniValue prioritisetransaction(const JSONRPCRequest& request)
247251 " Note, that this value is not a fee rate. It is a value to modify absolute fee of the TX.\n "
248252 " The fee is not actually paid, only the algorithm for selecting transactions into a block\n "
249253 " considers the transaction as it would have paid a higher (or lower) fee." },
250- }}
251- .ToString () +
252- " \n Result:\n "
254+ },
255+ RPCResult{
253256 " true (boolean) Returns true\n "
254- " \n Examples:\n "
255- + HelpExampleCli (" prioritisetransaction" , " \" txid\" 0.0 10000" )
257+ },
258+ RPCExamples{
259+ HelpExampleCli (" prioritisetransaction" , " \" txid\" 0.0 10000" )
256260 + HelpExampleRpc (" prioritisetransaction" , " \" txid\" , 0.0, 10000" )
257- );
261+ },
262+ }.ToString ());
258263
259264 LOCK (cs_main);
260265
@@ -326,9 +331,8 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
326331 },
327332 },
328333 " \" template_request\" " },
329- }}
330- .ToString () +
331- " \n Result:\n "
334+ },
335+ RPCResult{
332336 " {\n "
333337 " \" version\" : n, (numeric) The preferred block version\n "
334338 " \" rules\" : [ \" rulename\" , ... ], (array of strings) specific block rules that are to be enforced\n "
@@ -372,11 +376,12 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
372376 " \" bits\" : \" xxxxxxxx\" , (string) compressed target of next block\n "
373377 " \" height\" : n (numeric) The height of the next block\n "
374378 " }\n "
375-
376- " \n Examples: \n "
377- + HelpExampleCli (" getblocktemplate" , " {\" rules\" : [\" segwit\" ]}" )
379+ },
380+ RPCExamples{
381+ HelpExampleCli (" getblocktemplate" , " {\" rules\" : [\" segwit\" ]}" )
378382 + HelpExampleRpc (" getblocktemplate" , " {\" rules\" : [\" segwit\" ]}" )
379- );
383+ },
384+ }.ToString ());
380385
381386 LOCK (cs_main);
382387
@@ -713,13 +718,13 @@ static UniValue submitblock(const JSONRPCRequest& request)
713718 {
714719 {" hexdata" , RPCArg::Type::STR_HEX, /* opt */ false , /* default_val */ " " , " the hex-encoded block data to submit" },
715720 {" dummy" , RPCArg::Type::STR, /* opt */ true , /* default_val */ " ignored" , " dummy value, for compatibility with BIP22. This value is ignored." },
716- }}
717- .ToString () +
718- " \n Result:\n "
719- " \n Examples:\n "
720- + HelpExampleCli (" submitblock" , " \" mydata\" " )
721+ },
722+ RPCResults{},
723+ RPCExamples{
724+ HelpExampleCli (" submitblock" , " \" mydata\" " )
721725 + HelpExampleRpc (" submitblock" , " \" mydata\" " )
722- );
726+ },
727+ }.ToString ());
723728 }
724729
725730 std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>();
@@ -777,13 +782,15 @@ static UniValue submitheader(const JSONRPCRequest& request)
777782 " \n Throws when the header is invalid.\n " ,
778783 {
779784 {" hexdata" , RPCArg::Type::STR_HEX, /* opt */ false , /* default_val */ " " , " the hex-encoded block header data" },
780- }}
781- .ToString () +
782- " \n Result:\n "
785+ },
786+ RPCResult{
783787 " None"
784- " \n Examples:\n " +
785- HelpExampleCli (" submitheader" , " \" aabbcc\" " ) +
786- HelpExampleRpc (" submitheader" , " \" aabbcc\" " ));
788+ },
789+ RPCExamples{
790+ HelpExampleCli (" submitheader" , " \" aabbcc\" " ) +
791+ HelpExampleRpc (" submitheader" , " \" aabbcc\" " )
792+ },
793+ }.ToString ());
787794 }
788795
789796 CBlockHeader h;
@@ -826,9 +833,8 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request)
826833 " \" UNSET\"\n "
827834 " \" ECONOMICAL\"\n "
828835 " \" CONSERVATIVE\" " },
829- }}
830- .ToString () +
831- " \n Result:\n "
836+ },
837+ RPCResult{
832838 " {\n "
833839 " \" feerate\" : x.x, (numeric, optional) estimate fee rate in " + CURRENCY_UNIT + " /kB\n "
834840 " \" errors\" : [ str... ] (json array of strings, optional) Errors encountered during processing\n "
@@ -839,9 +845,11 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request)
839845 " fee estimation is able to return based on how long it has been running.\n "
840846 " An error is returned if not enough transactions and blocks\n "
841847 " have been observed to make an estimate for any number of blocks.\n "
842- " \n Example:\n "
843- + HelpExampleCli (" estimatesmartfee" , " 6" )
844- );
848+ },
849+ RPCExamples{
850+ HelpExampleCli (" estimatesmartfee" , " 6" )
851+ },
852+ }.ToString ());
845853
846854 RPCTypeCheck (request.params , {UniValue::VNUM, UniValue::VSTR});
847855 RPCTypeCheckArgument (request.params [0 ], UniValue::VNUM);
@@ -886,9 +894,8 @@ static UniValue estimaterawfee(const JSONRPCRequest& request)
886894 {" threshold" , RPCArg::Type::NUM, /* opt */ true , /* default_val */ " 0.95" , " The proportion of transactions in a given feerate range that must have been\n "
887895 " confirmed within conf_target in order to consider those feerates as high enough and proceed to check\n "
888896 " lower buckets." },
889- }}
890- .ToString () +
891- " \n Result:\n "
897+ },
898+ RPCResult{
892899 " {\n "
893900 " \" short\" : { (json object, optional) estimate for short time horizon\n "
894901 " \" feerate\" : x.x, (numeric, optional) estimate fee rate in " + CURRENCY_UNIT + " /kB\n "
@@ -910,9 +917,11 @@ static UniValue estimaterawfee(const JSONRPCRequest& request)
910917 " }\n "
911918 " \n "
912919 " Results are returned for any horizon which tracks blocks up to the confirmation target.\n "
913- " \n Example:\n "
914- + HelpExampleCli (" estimaterawfee" , " 6 0.9" )
915- );
920+ },
921+ RPCExamples{
922+ HelpExampleCli (" estimaterawfee" , " 6 0.9" )
923+ },
924+ }.ToString ());
916925
917926 RPCTypeCheck (request.params , {UniValue::VNUM, UniValue::VNUM}, true );
918927 RPCTypeCheckArgument (request.params [0 ], UniValue::VNUM);
0 commit comments