doc: Extract CreateTxDoc in rawtransaction
For the fields: inputs, outputs, locktime, replaceable
This commit is contained in:
1 file changed
+39
-66
+39
-66
@@ -69,6 +69,43 @@ static void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::vector<RPCArg> CreateTxDoc()
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
{"inputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The inputs",
|
||||||
|
{
|
||||||
|
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
|
||||||
|
{
|
||||||
|
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
|
||||||
|
{"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
|
||||||
|
{"sequence", RPCArg::Type::NUM, RPCArg::DefaultHint{"depends on the value of the 'replaceable' and 'locktime' arguments"}, "The sequence number"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The outputs (key-value pairs), where none of the keys are duplicated.\n"
|
||||||
|
"That is, each address can only appear once and there can only be one 'data' object.\n"
|
||||||
|
"For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n"
|
||||||
|
" accepted as second parameter.",
|
||||||
|
{
|
||||||
|
{"", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::OMITTED, "",
|
||||||
|
{
|
||||||
|
{"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
|
||||||
|
{
|
||||||
|
{"data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A key-value pair. The key must be \"data\", the value is hex-encoded data"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{"locktime", RPCArg::Type::NUM, RPCArg::Default{0}, "Raw locktime. Non-0 value also locktime-activates inputs"},
|
||||||
|
{"replaceable", RPCArg::Type::BOOL, RPCArg::Default{false}, "Marks this transaction as BIP125-replaceable.\n"
|
||||||
|
"Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
static RPCHelpMan getrawtransaction()
|
static RPCHelpMan getrawtransaction()
|
||||||
{
|
{
|
||||||
return RPCHelpMan{
|
return RPCHelpMan{
|
||||||
@@ -375,39 +412,7 @@ static RPCHelpMan createrawtransaction()
|
|||||||
"Returns hex-encoded raw transaction.\n"
|
"Returns hex-encoded raw transaction.\n"
|
||||||
"Note that the transaction's inputs are not signed, and\n"
|
"Note that the transaction's inputs are not signed, and\n"
|
||||||
"it is not stored in the wallet or transmitted to the network.\n",
|
"it is not stored in the wallet or transmitted to the network.\n",
|
||||||
{
|
CreateTxDoc(),
|
||||||
{"inputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The inputs",
|
|
||||||
{
|
|
||||||
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
|
|
||||||
{
|
|
||||||
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
|
|
||||||
{"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
|
|
||||||
{"sequence", RPCArg::Type::NUM, RPCArg::DefaultHint{"depends on the value of the 'replaceable' and 'locktime' arguments"}, "The sequence number"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The outputs (key-value pairs), where none of the keys are duplicated.\n"
|
|
||||||
"That is, each address can only appear once and there can only be one 'data' object.\n"
|
|
||||||
"For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n"
|
|
||||||
" accepted as second parameter.",
|
|
||||||
{
|
|
||||||
{"", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::OMITTED, "",
|
|
||||||
{
|
|
||||||
{"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
|
|
||||||
{
|
|
||||||
{"data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A key-value pair. The key must be \"data\", the value is hex-encoded data"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{"locktime", RPCArg::Type::NUM, RPCArg::Default{0}, "Raw locktime. Non-0 value also locktime-activates inputs"},
|
|
||||||
{"replaceable", RPCArg::Type::BOOL, RPCArg::Default{false}, "Marks this transaction as BIP125-replaceable.\n"
|
|
||||||
" Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."},
|
|
||||||
},
|
|
||||||
RPCResult{
|
RPCResult{
|
||||||
RPCResult::Type::STR_HEX, "transaction", "hex string of the transaction"
|
RPCResult::Type::STR_HEX, "transaction", "hex string of the transaction"
|
||||||
},
|
},
|
||||||
@@ -1435,39 +1440,7 @@ static RPCHelpMan createpsbt()
|
|||||||
return RPCHelpMan{"createpsbt",
|
return RPCHelpMan{"createpsbt",
|
||||||
"\nCreates a transaction in the Partially Signed Transaction format.\n"
|
"\nCreates a transaction in the Partially Signed Transaction format.\n"
|
||||||
"Implements the Creator role.\n",
|
"Implements the Creator role.\n",
|
||||||
{
|
CreateTxDoc(),
|
||||||
{"inputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The json objects",
|
|
||||||
{
|
|
||||||
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
|
|
||||||
{
|
|
||||||
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
|
|
||||||
{"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
|
|
||||||
{"sequence", RPCArg::Type::NUM, RPCArg::DefaultHint{"depends on the value of the 'replaceable' and 'locktime' arguments"}, "The sequence number"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "The outputs (key-value pairs), where none of the keys are duplicated.\n"
|
|
||||||
"That is, each address can only appear once and there can only be one 'data' object.\n"
|
|
||||||
"For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n"
|
|
||||||
" accepted as second parameter.",
|
|
||||||
{
|
|
||||||
{"", RPCArg::Type::OBJ_USER_KEYS, RPCArg::Optional::OMITTED, "",
|
|
||||||
{
|
|
||||||
{"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
|
|
||||||
{
|
|
||||||
{"data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A key-value pair. The key must be \"data\", the value is hex-encoded data"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{"locktime", RPCArg::Type::NUM, RPCArg::Default{0}, "Raw locktime. Non-0 value also locktime-activates inputs"},
|
|
||||||
{"replaceable", RPCArg::Type::BOOL, RPCArg::Default{false}, "Marks this transaction as BIP125 replaceable.\n"
|
|
||||||
" Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible."},
|
|
||||||
},
|
|
||||||
RPCResult{
|
RPCResult{
|
||||||
RPCResult::Type::STR, "", "The resulting raw transaction (base64-encoded string)"
|
RPCResult::Type::STR, "", "The resulting raw transaction (base64-encoded string)"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user