mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
[rpc] createrawtransaction: Fix docs and rename nValue to amount, to match utxo dictionaries.
This commit is contained in:
parent
9ffa0c67fa
commit
cff526d387
1 changed files with 15 additions and 9 deletions
|
|
@ -418,7 +418,7 @@ UniValue createrawtransaction(const JSONRPCRequest& request)
|
|||
{
|
||||
if (request.fHelp || request.params.size() < 2 || request.params.size() > 4)
|
||||
throw runtime_error(
|
||||
"createrawtransaction [{\"txid\":\"id\",\"vout\":n,\"nValue\":n},...] {\"address\":amount,\"data\":\"hex\",...} ( locktime ) {\"address\":assetid}\n"
|
||||
"createrawtransaction [{\"txid\":\"id\",\"vout\":n,\"amount\":n},...] {\"address\":amount,\"data\":\"hex\",...} ( locktime {\"address\":assetid} )\n"
|
||||
"\nCreate a transaction spending the given inputs and creating new outputs.\n"
|
||||
"Outputs can be addresses or data.\n"
|
||||
"Returns hex-encoded raw transaction.\n"
|
||||
|
|
@ -431,8 +431,8 @@ UniValue createrawtransaction(const JSONRPCRequest& request)
|
|||
" {\n"
|
||||
" \"txid\":\"id\", (string, required) The transaction id\n"
|
||||
" \"vout\":n, (numeric, required) The output number\n"
|
||||
" \"nValue\":x.xxx, (numeric, required) The amount being spent\n"
|
||||
" \"assetid\":\"hex\" (string, optional, default=bitcoin) The asset of the input\n"
|
||||
" \"amount\": x.xxx, (numeric, required) The amount being spent\n"
|
||||
" \"assetid\": \"string\" (string, optional, default=bitcoin) The asset of the input, as a tag string or a hex value\n"
|
||||
" \"sequence\":n (numeric, optional) The sequence number\n"
|
||||
" } \n"
|
||||
" ,...\n"
|
||||
|
|
@ -444,7 +444,7 @@ UniValue createrawtransaction(const JSONRPCRequest& request)
|
|||
" ,...\n"
|
||||
" }\n"
|
||||
"3. locktime (numeric, optional, default=0) Raw locktime. Non-0 value also locktime-activates inputs\n"
|
||||
"4. \"output_assetids\" (string, optional, default=bitcoin) a json object of assetids to addresses\n"
|
||||
"4. \"output_assetids\" (strings, optional, default=bitcoin) A json object of assetids to addresses\n"
|
||||
" {\n"
|
||||
" \"address\": \"hex\" \n"
|
||||
" ...\n"
|
||||
|
|
@ -453,10 +453,12 @@ UniValue createrawtransaction(const JSONRPCRequest& request)
|
|||
"\"transaction\" (string) hex string of the transaction\n"
|
||||
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"address\\\":0.01}\"")
|
||||
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"data\\\":\\\"00010203\\\"}\"")
|
||||
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"address\\\":0.01}\"")
|
||||
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"data\\\":\\\"00010203\\\"}\"")
|
||||
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0,\\\"amount\\\":2.5}]\" \"{\\\"address\\\":2.41}\"")
|
||||
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0,\\\"amount\\\":2.5,\\\"assetid\\\":\\\"myassetid\\\"}]\" \"{\\\"address\\\":2.41}\" 0 \"{\\\"address\\\":\\\"myassetid\\\"}\"")
|
||||
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0,\\\"amount\\\":2.5}]\" \"{\\\"data\\\":\\\"00010203\\\"}\"")
|
||||
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0,\\\"amount\\\":2.5}]\", \"{\\\"address\\\":2.41}\"")
|
||||
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0,\\\"amount\\\":2.5,\\\"assetid\\\":\\\"myassetid\\\"}]\", \"{\\\"address\\\":2.41}\", 0, \"{\\\"address\\\":\\\"myassetid\\\"}\"")
|
||||
+ HelpExampleRpc("createrawtransaction", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0,\\\"amount\\\":2.5}]\", \"{\\\"data\\\":\\\"00010203\\\"}\"")
|
||||
);
|
||||
|
||||
RPCTypeCheck(request.params, boost::assign::list_of(UniValue::VARR)(UniValue::VOBJ)(UniValue::VNUM)(UniValue::VOBJ), true);
|
||||
|
|
@ -515,7 +517,11 @@ UniValue createrawtransaction(const JSONRPCRequest& request)
|
|||
asset = ParseHashO(o, "assetid");
|
||||
}
|
||||
|
||||
const UniValue& vout_value = find_value(o, "nValue");
|
||||
UniValue vout_value = find_value(o, "amount");
|
||||
if (vout_value.isNull()) {
|
||||
LogPrintf("deprecated use of `nValue' in call to createrawtransaction --- use `amount' instead\n");
|
||||
vout_value = find_value(o, "nValue");
|
||||
}
|
||||
inputValue[asset] += AmountFromValue(vout_value);
|
||||
|
||||
rawTx.vin.push_back(in);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue