mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Use RPCHelpMan for all RPCs
This commit is contained in:
@@ -66,13 +66,18 @@ static UniValue getrawtransaction(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
|
||||
throw std::runtime_error(
|
||||
"getrawtransaction \"txid\" ( verbose \"blockhash\" )\n"
|
||||
|
||||
"\nNOTE: By default this function only works for mempool transactions. If the -txindex option is\n"
|
||||
"enabled, it also works for blockchain transactions. If the block which contains the transaction\n"
|
||||
"is known, its hash can be provided even for nodes without -txindex. Note that if a blockhash is\n"
|
||||
"provided, only that block will be searched and if the transaction is in the mempool or other\n"
|
||||
"blocks, or if this node does not have the given block available, the transaction will not be found.\n"
|
||||
RPCHelpMan{"getrawtransaction",
|
||||
"\nNOTE: By default this function only works for mempool transactions. If the -txindex option is\n"
|
||||
"enabled, it also works for blockchain transactions. If the block which contains the transaction\n"
|
||||
"is known, its hash can be provided even for nodes without -txindex. Note that if a blockhash is\n"
|
||||
"provided, only that block will be searched and if the transaction is in the mempool or other\n"
|
||||
"blocks, or if this node does not have the given block available, the transaction will not be found.\n",
|
||||
{
|
||||
{"txid", RPCArg::Type::STR_HEX, false},
|
||||
{"verbose", RPCArg::Type::BOOL, true},
|
||||
{"blockhash", RPCArg::Type::STR_HEX, true},
|
||||
}}
|
||||
.ToString() +
|
||||
"DEPRECATED: for now, it also works for transactions with unspent outputs.\n"
|
||||
|
||||
"\nReturn the raw transaction data.\n"
|
||||
@@ -207,6 +212,11 @@ static UniValue gettxoutproof(const JSONRPCRequest& request)
|
||||
if (request.fHelp || (request.params.size() != 1 && request.params.size() != 2))
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"gettxoutproof",
|
||||
"\nReturns a hex-encoded proof that \"txid\" was included in a block.\n"
|
||||
"\nNOTE: By default this function only works sometimes. This is when there is an\n"
|
||||
"unspent output in the utxo for this transaction. To make it always work,\n"
|
||||
"you need to maintain a transaction index, using the -txindex command line option or\n"
|
||||
"specify the block in which the transaction is included manually (by blockhash).\n",
|
||||
{
|
||||
{"txids", RPCArg::Type::ARR,
|
||||
{
|
||||
@@ -216,11 +226,6 @@ static UniValue gettxoutproof(const JSONRPCRequest& request)
|
||||
{"blockhash", RPCArg::Type::STR_HEX, true},
|
||||
}}
|
||||
.ToString() +
|
||||
"\nReturns a hex-encoded proof that \"txid\" was included in a block.\n"
|
||||
"\nNOTE: By default this function only works sometimes. This is when there is an\n"
|
||||
"unspent output in the utxo for this transaction. To make it always work,\n"
|
||||
"you need to maintain a transaction index, using the -txindex command line option or\n"
|
||||
"specify the block in which the transaction is included manually (by blockhash).\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"txids\" (string) A json array of txids to filter\n"
|
||||
" [\n"
|
||||
@@ -307,9 +312,13 @@ static UniValue verifytxoutproof(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw std::runtime_error(
|
||||
"verifytxoutproof \"proof\"\n"
|
||||
"\nVerifies that a proof points to a transaction in a block, returning the transaction it commits to\n"
|
||||
"and throwing an RPC error if the block is not in our best chain\n"
|
||||
RPCHelpMan{"verifytxoutproof",
|
||||
"\nVerifies that a proof points to a transaction in a block, returning the transaction it commits to\n"
|
||||
"and throwing an RPC error if the block is not in our best chain\n",
|
||||
{
|
||||
{"proof", RPCArg::Type::STR, false},
|
||||
}}
|
||||
.ToString() +
|
||||
"\nArguments:\n"
|
||||
"1. \"proof\" (string, required) The hex-encoded proof generated by gettxoutproof\n"
|
||||
"\nResult:\n"
|
||||
@@ -514,9 +523,13 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
||||
throw std::runtime_error(
|
||||
"decoderawtransaction \"hexstring\" ( iswitness )\n"
|
||||
"\nReturn a JSON object representing the serialized, hex-encoded transaction.\n"
|
||||
|
||||
RPCHelpMan{"decoderawtransaction",
|
||||
"\nReturn a JSON object representing the serialized, hex-encoded transaction.\n",
|
||||
{
|
||||
{"hexstring", RPCArg::Type::STR_HEX, false},
|
||||
{"iswitness", RPCArg::Type::BOOL, true},
|
||||
}}
|
||||
.ToString() +
|
||||
"\nArguments:\n"
|
||||
"1. \"hexstring\" (string, required) The transaction hex string\n"
|
||||
"2. iswitness (boolean, optional) Whether the transaction hex is a serialized witness transaction\n"
|
||||
@@ -589,8 +602,12 @@ static UniValue decodescript(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw std::runtime_error(
|
||||
"decodescript \"hexstring\"\n"
|
||||
"\nDecode a hex-encoded script.\n"
|
||||
RPCHelpMan{"decodescript",
|
||||
"\nDecode a hex-encoded script.\n",
|
||||
{
|
||||
{"hexstring", RPCArg::Type::STR_HEX, false},
|
||||
}}
|
||||
.ToString() +
|
||||
"\nArguments:\n"
|
||||
"1. \"hexstring\" (string) the hex-encoded script\n"
|
||||
"\nResult:\n"
|
||||
@@ -685,6 +702,9 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"combinerawtransaction",
|
||||
"\nCombine multiple partially signed transactions into one transaction.\n"
|
||||
"The combined transaction may be another partially signed transaction or a \n"
|
||||
"fully signed transaction.",
|
||||
{
|
||||
{"txs", RPCArg::Type::ARR,
|
||||
{
|
||||
@@ -693,10 +713,6 @@ static UniValue combinerawtransaction(const JSONRPCRequest& request)
|
||||
false},
|
||||
}}
|
||||
.ToString() +
|
||||
"\nCombine multiple partially signed transactions into one transaction.\n"
|
||||
"The combined transaction may be another partially signed transaction or a \n"
|
||||
"fully signed transaction."
|
||||
|
||||
"\nArguments:\n"
|
||||
"1. \"txs\" (string) A json array of hex strings of partially signed transactions\n"
|
||||
" [\n"
|
||||
@@ -916,6 +932,11 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
|
||||
if (request.fHelp || request.params.size() < 2 || request.params.size() > 4)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"signrawtransactionwithkey",
|
||||
"\nSign inputs for raw transaction (serialized, hex-encoded).\n"
|
||||
"The second argument is an array of base58-encoded private\n"
|
||||
"keys that will be the only keys used to sign the transaction.\n"
|
||||
"The third optional argument (may be null) is an array of previous transaction outputs that\n"
|
||||
"this transaction depends on but may not yet be in the block chain.\n",
|
||||
{
|
||||
{"hexstring", RPCArg::Type::STR, false},
|
||||
{"privkyes", RPCArg::Type::ARR,
|
||||
@@ -939,12 +960,6 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
|
||||
{"sighashtype", RPCArg::Type::STR, true},
|
||||
}}
|
||||
.ToString() +
|
||||
"\nSign inputs for raw transaction (serialized, hex-encoded).\n"
|
||||
"The second argument is an array of base58-encoded private\n"
|
||||
"keys that will be the only keys used to sign the transaction.\n"
|
||||
"The third optional argument (may be null) is an array of previous transaction outputs that\n"
|
||||
"this transaction depends on but may not yet be in the block chain.\n"
|
||||
|
||||
"\nArguments:\n"
|
||||
"1. \"hexstring\" (string, required) The transaction hex string\n"
|
||||
"2. \"privkeys\" (string, required) A json array of base58-encoded private keys for signing\n"
|
||||
@@ -1025,9 +1040,14 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
||||
throw std::runtime_error(
|
||||
"sendrawtransaction \"hexstring\" ( allowhighfees )\n"
|
||||
"\nSubmits raw transaction (serialized, hex-encoded) to local node and network.\n"
|
||||
"\nAlso see createrawtransaction and signrawtransactionwithkey calls.\n"
|
||||
RPCHelpMan{"sendrawtransaction",
|
||||
"\nSubmits raw transaction (serialized, hex-encoded) to local node and network.\n"
|
||||
"\nAlso see createrawtransaction and signrawtransactionwithkey calls.\n",
|
||||
{
|
||||
{"hexstring", RPCArg::Type::STR_HEX, false},
|
||||
{"allowhighfees", RPCArg::Type::BOOL, true},
|
||||
}}
|
||||
.ToString() +
|
||||
"\nArguments:\n"
|
||||
"1. \"hexstring\" (string, required) The hex string of the raw transaction)\n"
|
||||
"2. allowhighfees (boolean, optional, default=false) Allow high fees\n"
|
||||
@@ -1218,9 +1238,12 @@ UniValue decodepsbt(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw std::runtime_error(
|
||||
"decodepsbt \"psbt\"\n"
|
||||
"\nReturn a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction.\n"
|
||||
|
||||
RPCHelpMan{"decodepsbt",
|
||||
"\nReturn a JSON object representing the serialized, base64-encoded partially signed Bitcoin transaction.\n",
|
||||
{
|
||||
{"psbt", RPCArg::Type::STR, false},
|
||||
}}
|
||||
.ToString() +
|
||||
"\nArguments:\n"
|
||||
"1. \"psbt\" (string, required) The PSBT base64 string\n"
|
||||
|
||||
@@ -1494,6 +1517,8 @@ UniValue combinepsbt(const JSONRPCRequest& request)
|
||||
if (request.fHelp || request.params.size() != 1)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"combinepsbt",
|
||||
"\nCombine multiple partially signed Bitcoin transactions into one transaction.\n"
|
||||
"Implements the Combiner role.\n",
|
||||
{
|
||||
{"txs", RPCArg::Type::ARR,
|
||||
{
|
||||
@@ -1502,8 +1527,6 @@ UniValue combinepsbt(const JSONRPCRequest& request)
|
||||
false},
|
||||
}}
|
||||
.ToString() +
|
||||
"\nCombine multiple partially signed Bitcoin transactions into one transaction.\n"
|
||||
"Implements the Combiner role.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"txs\" (string) A json array of base64 strings of partially signed transactions\n"
|
||||
" [\n"
|
||||
@@ -1554,11 +1577,16 @@ UniValue finalizepsbt(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
||||
throw std::runtime_error(
|
||||
"finalizepsbt \"psbt\" ( extract )\n"
|
||||
"Finalize the inputs of a PSBT. If the transaction is fully signed, it will produce a\n"
|
||||
"network serialized transaction which can be broadcast with sendrawtransaction. Otherwise a PSBT will be\n"
|
||||
"created which has the final_scriptSig and final_scriptWitness fields filled for inputs that are complete.\n"
|
||||
"Implements the Finalizer and Extractor roles.\n"
|
||||
RPCHelpMan{"finalizepsbt",
|
||||
"Finalize the inputs of a PSBT. If the transaction is fully signed, it will produce a\n"
|
||||
"network serialized transaction which can be broadcast with sendrawtransaction. Otherwise a PSBT will be\n"
|
||||
"created which has the final_scriptSig and final_scriptWitness fields filled for inputs that are complete.\n"
|
||||
"Implements the Finalizer and Extractor roles.\n",
|
||||
{
|
||||
{"psbt", RPCArg::Type::STR, false},
|
||||
{"extract", RPCArg::Type::BOOL, true},
|
||||
}}
|
||||
.ToString() +
|
||||
"\nArguments:\n"
|
||||
"1. \"psbt\" (string) A base64 string of a PSBT\n"
|
||||
"2. \"extract\" (boolean, optional, default=true) If true and the transaction is complete, \n"
|
||||
@@ -1619,6 +1647,8 @@ UniValue createpsbt(const JSONRPCRequest& request)
|
||||
if (request.fHelp || request.params.size() < 2 || request.params.size() > 4)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"createpsbt",
|
||||
"\nCreates a transaction in the Partially Signed Transaction format.\n"
|
||||
"Implements the Creator role.\n",
|
||||
{
|
||||
{"inputs", RPCArg::Type::ARR,
|
||||
{
|
||||
@@ -1649,8 +1679,6 @@ UniValue createpsbt(const JSONRPCRequest& request)
|
||||
{"replaceable", RPCArg::Type::BOOL, true},
|
||||
}}
|
||||
.ToString() +
|
||||
"\nCreates a transaction in the Partially Signed Transaction format.\n"
|
||||
"Implements the Creator role.\n"
|
||||
"\nArguments:\n"
|
||||
"1. \"inputs\" (array, required) A json array of json objects\n"
|
||||
" [\n"
|
||||
@@ -1713,9 +1741,15 @@ UniValue converttopsbt(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
|
||||
throw std::runtime_error(
|
||||
"converttopsbt \"hexstring\" ( permitsigdata iswitness )\n"
|
||||
"\nConverts a network serialized transaction to a PSBT. This should be used only with createrawtransaction and fundrawtransaction\n"
|
||||
"createpsbt and walletcreatefundedpsbt should be used for new applications.\n"
|
||||
RPCHelpMan{"converttopsbt",
|
||||
"\nConverts a network serialized transaction to a PSBT. This should be used only with createrawtransaction and fundrawtransaction\n"
|
||||
"createpsbt and walletcreatefundedpsbt should be used for new applications.\n",
|
||||
{
|
||||
{"hexstring", RPCArg::Type::STR_HEX, false},
|
||||
{"permitsigdata", RPCArg::Type::BOOL, true},
|
||||
{"iswitness", RPCArg::Type::BOOL, true},
|
||||
}}
|
||||
.ToString() +
|
||||
"\nArguments:\n"
|
||||
"1. \"hexstring\" (string, required) The hex string of a raw transaction\n"
|
||||
"2. permitsigdata (boolean, optional, default=false) If true, any signatures in the input will be discarded and conversion.\n"
|
||||
|
||||
Reference in New Issue
Block a user