@@ -94,14 +94,15 @@ static UniValue getnetworkhashps(const JSONRPCRequest& request)
94
94
{
95
95
{" nblocks" , RPCArg::Type::NUM, /* opt */ true , /* default_val */ " 120" , " The number of blocks, or -1 for blocks since last difficulty change." },
96
96
{" 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{
100
99
" x (numeric) Hashes per second estimated\n "
101
- " \n Examples:\n "
102
- + HelpExampleCli (" getnetworkhashps" , " " )
100
+ },
101
+ RPCExamples{
102
+ HelpExampleCli (" getnetworkhashps" , " " )
103
103
+ HelpExampleRpc (" getnetworkhashps" , " " )
104
- );
104
+ },
105
+ }.ToString ());
105
106
106
107
LOCK (cs_main);
107
108
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)
165
166
{" nblocks" , RPCArg::Type::NUM, /* opt */ false , /* default_val */ " " , " How many blocks are generated immediately." },
166
167
{" address" , RPCArg::Type::STR, /* opt */ false , /* default_val */ " " , " The address to send the newly generated bitcoin to." },
167
168
{" maxtries" , RPCArg::Type::NUM, /* opt */ true , /* default_val */ " 1000000" , " How many iterations to try." },
168
- }}
169
- .ToString () +
170
- " \n Result:\n "
169
+ },
170
+ RPCResult{
171
171
" [ blockhashes ] (array) hashes of blocks generated\n "
172
- " \n Examples:\n "
172
+ },
173
+ RPCExamples{
173
174
" \n Generate 11 blocks to myaddress\n "
174
175
+ HelpExampleCli (" generatetoaddress" , " 11 \" myaddress\" " )
175
176
+ " If you are running the bitcoin core wallet, you can get a new address to send the newly generated bitcoin to with:\n "
176
177
+ HelpExampleCli (" getnewaddress" , " " )
177
- );
178
+ },
179
+ }.ToString ());
178
180
179
181
int nGenerate = request.params [0 ].get_int ();
180
182
uint64_t nMaxTries = 1000000 ;
@@ -198,9 +200,9 @@ static UniValue getmininginfo(const JSONRPCRequest& request)
198
200
if (request.fHelp || request.params .size () != 0 )
199
201
throw std::runtime_error (
200
202
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{
204
206
" {\n "
205
207
" \" blocks\" : nnn, (numeric) The current block\n "
206
208
" \" currentblockweight\" : nnn, (numeric) The last block weight\n "
@@ -211,10 +213,12 @@ static UniValue getmininginfo(const JSONRPCRequest& request)
211
213
" \" chain\" : \" xxxx\" , (string) current network name as defined in BIP70 (main, test, regtest)\n "
212
214
" \" warnings\" : \" ...\" (string) any network and blockchain warnings\n "
213
215
" }\n "
214
- " \n Examples:\n "
215
- + HelpExampleCli (" getmininginfo" , " " )
216
+ },
217
+ RPCExamples{
218
+ HelpExampleCli (" getmininginfo" , " " )
216
219
+ HelpExampleRpc (" getmininginfo" , " " )
217
- );
220
+ },
221
+ }.ToString ());
218
222
219
223
220
224
LOCK (cs_main);
@@ -247,14 +251,15 @@ static UniValue prioritisetransaction(const JSONRPCRequest& request)
247
251
" Note, that this value is not a fee rate. It is a value to modify absolute fee of the TX.\n "
248
252
" The fee is not actually paid, only the algorithm for selecting transactions into a block\n "
249
253
" considers the transaction as it would have paid a higher (or lower) fee." },
250
- }}
251
- .ToString () +
252
- " \n Result:\n "
254
+ },
255
+ RPCResult{
253
256
" 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" )
256
260
+ HelpExampleRpc (" prioritisetransaction" , " \" txid\" , 0.0, 10000" )
257
- );
261
+ },
262
+ }.ToString ());
258
263
259
264
LOCK (cs_main);
260
265
@@ -326,9 +331,8 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
326
331
},
327
332
},
328
333
" \" template_request\" " },
329
- }}
330
- .ToString () +
331
- " \n Result:\n "
334
+ },
335
+ RPCResult{
332
336
" {\n "
333
337
" \" version\" : n, (numeric) The preferred block version\n "
334
338
" \" rules\" : [ \" rulename\" , ... ], (array of strings) specific block rules that are to be enforced\n "
@@ -372,11 +376,12 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
372
376
" \" bits\" : \" xxxxxxxx\" , (string) compressed target of next block\n "
373
377
" \" height\" : n (numeric) The height of the next block\n "
374
378
" }\n "
375
-
376
- " \n Examples: \n "
377
- + HelpExampleCli (" getblocktemplate" , " {\" rules\" : [\" segwit\" ]}" )
379
+ },
380
+ RPCExamples{
381
+ HelpExampleCli (" getblocktemplate" , " {\" rules\" : [\" segwit\" ]}" )
378
382
+ HelpExampleRpc (" getblocktemplate" , " {\" rules\" : [\" segwit\" ]}" )
379
- );
383
+ },
384
+ }.ToString ());
380
385
381
386
LOCK (cs_main);
382
387
@@ -713,13 +718,13 @@ static UniValue submitblock(const JSONRPCRequest& request)
713
718
{
714
719
{" hexdata" , RPCArg::Type::STR_HEX, /* opt */ false , /* default_val */ " " , " the hex-encoded block data to submit" },
715
720
{" 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\" " )
721
725
+ HelpExampleRpc (" submitblock" , " \" mydata\" " )
722
- );
726
+ },
727
+ }.ToString ());
723
728
}
724
729
725
730
std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>();
@@ -777,13 +782,15 @@ static UniValue submitheader(const JSONRPCRequest& request)
777
782
" \n Throws when the header is invalid.\n " ,
778
783
{
779
784
{" 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{
783
787
" 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 ());
787
794
}
788
795
789
796
CBlockHeader h;
@@ -826,9 +833,8 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request)
826
833
" \" UNSET\"\n "
827
834
" \" ECONOMICAL\"\n "
828
835
" \" CONSERVATIVE\" " },
829
- }}
830
- .ToString () +
831
- " \n Result:\n "
836
+ },
837
+ RPCResult{
832
838
" {\n "
833
839
" \" feerate\" : x.x, (numeric, optional) estimate fee rate in " + CURRENCY_UNIT + " /kB\n "
834
840
" \" errors\" : [ str... ] (json array of strings, optional) Errors encountered during processing\n "
@@ -839,9 +845,11 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request)
839
845
" fee estimation is able to return based on how long it has been running.\n "
840
846
" An error is returned if not enough transactions and blocks\n "
841
847
" 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 ());
845
853
846
854
RPCTypeCheck (request.params , {UniValue::VNUM, UniValue::VSTR});
847
855
RPCTypeCheckArgument (request.params [0 ], UniValue::VNUM);
@@ -886,9 +894,8 @@ static UniValue estimaterawfee(const JSONRPCRequest& request)
886
894
{" threshold" , RPCArg::Type::NUM, /* opt */ true , /* default_val */ " 0.95" , " The proportion of transactions in a given feerate range that must have been\n "
887
895
" confirmed within conf_target in order to consider those feerates as high enough and proceed to check\n "
888
896
" lower buckets." },
889
- }}
890
- .ToString () +
891
- " \n Result:\n "
897
+ },
898
+ RPCResult{
892
899
" {\n "
893
900
" \" short\" : { (json object, optional) estimate for short time horizon\n "
894
901
" \" feerate\" : x.x, (numeric, optional) estimate fee rate in " + CURRENCY_UNIT + " /kB\n "
@@ -910,9 +917,11 @@ static UniValue estimaterawfee(const JSONRPCRequest& request)
910
917
" }\n "
911
918
" \n "
912
919
" 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 ());
916
925
917
926
RPCTypeCheck (request.params , {UniValue::VNUM, UniValue::VNUM}, true );
918
927
RPCTypeCheckArgument (request.params [0 ], UniValue::VNUM);
0 commit comments