Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 564 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 2 || | ||||
" ,...\n" | " ,...\n" | ||||
" ]\n" | " ]\n" | ||||
"2. \"outputs\" (array, required) a json array with outputs (key-value pairs)\n" | "2. \"outputs\" (array, required) a json array with outputs (key-value pairs)\n" | ||||
" [\n" | " [\n" | ||||
" {\n" | " {\n" | ||||
" \"address\": x.xxx, (obj, optional) A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT + "\n" | " \"address\": x.xxx, (obj, optional) A key-value pair. The key (string) is the bitcoin address, the value (float or string) is the amount in " + CURRENCY_UNIT + "\n" | ||||
" },\n" | " },\n" | ||||
" {\n" | " {\n" | ||||
" \"data\": \"hex\" (obj, optional) A key-value pair. The key must be \"data\", the value is hex encoded data\n" | " \"data\": \"hex\" (obj, optional) A key-value pair. The key must be \"data\", the value is hex-encoded data\n" | ||||
" }\n" | " }\n" | ||||
" ,... More key-value pairs of the above form. For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n" | " ,... More key-value pairs of the above form. For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n" | ||||
" accepted as second parameter.\n" | " accepted as second parameter.\n" | ||||
" ]\n" | " ]\n" | ||||
"3. locktime (numeric, optional, default=0) Raw locktime. Non-0 value also locktime-activates inputs\n" | "3. locktime (numeric, optional, default=0) Raw locktime. Non-0 value also locktime-activates inputs\n" | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\"transaction\" (string) hex string of the transaction\n" | "\"transaction\" (string) hex string of the transaction\n" | ||||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | |||||
static UniValue decodescript(const Config &config, | static UniValue decodescript(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"decodescript \"hexstring\"\n" | "decodescript \"hexstring\"\n" | ||||
"\nDecode a hex-encoded script.\n" | "\nDecode a hex-encoded script.\n" | ||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"hexstring\" (string) the hex encoded script\n" | "1. \"hexstring\" (string) the hex-encoded script\n" | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"asm\":\"asm\", (string) Script public key\n" | " \"asm\":\"asm\", (string) Script public key\n" | ||||
" \"hex\":\"hex\", (string) hex encoded public key\n" | " \"hex\":\"hex\", (string) hex-encoded public key\n" | ||||
" \"type\":\"type\", (string) The output type\n" | " \"type\":\"type\", (string) The output type\n" | ||||
" \"reqSigs\": n, (numeric) The required signatures\n" | " \"reqSigs\": n, (numeric) The required signatures\n" | ||||
" \"addresses\": [ (json array of string)\n" | " \"addresses\": [ (json array of string)\n" | ||||
" \"address\" (string) bitcoin address\n" | " \"address\" (string) bitcoin address\n" | ||||
" ,...\n" | " ,...\n" | ||||
" ],\n" | " ],\n" | ||||
" \"p2sh\",\"address\" (string) address of P2SH script wrapping " | " \"p2sh\",\"address\" (string) address of P2SH script wrapping " | ||||
"this redeem script (not returned if the script is already a " | "this redeem script (not returned if the script is already a " | ||||
▲ Show 20 Lines • Show All 390 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 2 || | ||||
" \"redeemScript\": \"hex\", (string, required for " | " \"redeemScript\": \"hex\", (string, required for " | ||||
"P2SH) redeem script\n" | "P2SH) redeem script\n" | ||||
" \"amount\": value (numeric, required) The " | " \"amount\": value (numeric, required) The " | ||||
"amount spent\n" | "amount spent\n" | ||||
" }\n" | " }\n" | ||||
" ,...\n" | " ,...\n" | ||||
" ]\n" | " ]\n" | ||||
"4. \"sighashtype\" (string, optional, " | "4. \"sighashtype\" (string, optional, " | ||||
"default=ALL|FORKID) The signature hash type. Must be one of\n" | "default=ALL|FORKID) The signature hash type. Must be one of:\n" | ||||
" \"ALL|FORKID\"\n" | " \"ALL|FORKID\"\n" | ||||
" \"NONE|FORKID\"\n" | " \"NONE|FORKID\"\n" | ||||
" \"SINGLE|FORKID\"\n" | " \"SINGLE|FORKID\"\n" | ||||
" \"ALL|FORKID|ANYONECANPAY\"\n" | " \"ALL|FORKID|ANYONECANPAY\"\n" | ||||
" \"NONE|FORKID|ANYONECANPAY\"\n" | " \"NONE|FORKID|ANYONECANPAY\"\n" | ||||
" \"SINGLE|FORKID|ANYONECANPAY\"\n" | " \"SINGLE|FORKID|ANYONECANPAY\"\n" | ||||
"\nResult:\n" | "\nResult:\n" | ||||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
HelpExampleCli( | HelpExampleCli( | ||||
"createrawtransaction", | "createrawtransaction", | ||||
"\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" " | "\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" " | ||||
"\"{\\\"myaddress\\\":0.01}\"") + | "\"{\\\"myaddress\\\":0.01}\"") + | ||||
"Sign the transaction, and get back the hex\n" + | "Sign the transaction, and get back the hex\n" + | ||||
HelpExampleCli("signrawtransactionwithwallet", "\"myhex\"") + | HelpExampleCli("signrawtransactionwithwallet", "\"myhex\"") + | ||||
"\nSend the transaction (signed hex)\n" + | "\nSend the transaction (signed hex)\n" + | ||||
HelpExampleCli("sendrawtransaction", "\"signedhex\"") + | HelpExampleCli("sendrawtransaction", "\"signedhex\"") + | ||||
"\nAs a json rpc call\n" + | "\nAs a JSON-RPC call\n" + | ||||
HelpExampleRpc("sendrawtransaction", "\"signedhex\"")); | HelpExampleRpc("sendrawtransaction", "\"signedhex\"")); | ||||
} | } | ||||
std::promise<void> promise; | std::promise<void> promise; | ||||
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL}); | RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL}); | ||||
// parse hex string from parameter | // parse hex string from parameter | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
"]\n" | "]\n" | ||||
"\nExamples:\n" | "\nExamples:\n" | ||||
"\nCreate a transaction\n" | "\nCreate a transaction\n" | ||||
+ HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"") + | + HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"") + | ||||
"Sign the transaction, and get back the hex\n" | "Sign the transaction, and get back the hex\n" | ||||
+ HelpExampleCli("signrawtransactionwithwallet", "\"myhex\"") + | + HelpExampleCli("signrawtransactionwithwallet", "\"myhex\"") + | ||||
"\nTest acceptance of the transaction (signed hex)\n" | "\nTest acceptance of the transaction (signed hex)\n" | ||||
+ HelpExampleCli("testmempoolaccept", "\"signedhex\"") + | + HelpExampleCli("testmempoolaccept", "\"signedhex\"") + | ||||
"\nAs a json rpc call\n" | "\nAs a JSON-RPC call\n" | ||||
+ HelpExampleRpc("testmempoolaccept", "[\"signedhex\"]") | + HelpExampleRpc("testmempoolaccept", "[\"signedhex\"]") | ||||
// clang-format on | // clang-format on | ||||
); | ); | ||||
} | } | ||||
RPCTypeCheck(request.params, {UniValue::VARR, UniValue::VBOOL}); | RPCTypeCheck(request.params, {UniValue::VARR, UniValue::VBOOL}); | ||||
if (request.params[0].get_array().size() != 1) { | if (request.params[0].get_array().size() != 1) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
▲ Show 20 Lines • Show All 547 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 2 || | ||||
" \"address\": x.xxx, (obj, optional) A key-value pair. " | " \"address\": x.xxx, (obj, optional) A key-value pair. " | ||||
"The key (string) is the bitcoin address, the value (float or " | "The key (string) is the bitcoin address, the value (float or " | ||||
"string) is the amount in " + | "string) is the amount in " + | ||||
CURRENCY_UNIT + | CURRENCY_UNIT + | ||||
"\n" | "\n" | ||||
" },\n" | " },\n" | ||||
" {\n" | " {\n" | ||||
" \"data\": \"hex\" (obj, optional) A key-value pair. " | " \"data\": \"hex\" (obj, optional) A key-value pair. " | ||||
"The key must be \"data\", the value is hex encoded data\n" | "The key must be \"data\", the value is hex-encoded data\n" | ||||
" }\n" | " }\n" | ||||
" ,... More key-value pairs of the above " | " ,... More key-value pairs of the above " | ||||
"form. For compatibility reasons, a dictionary, which holds the " | "form. For compatibility reasons, a dictionary, which holds the " | ||||
"key-value pairs directly, is also\n" | "key-value pairs directly, is also\n" | ||||
" accepted as second parameter.\n" | " accepted as second parameter.\n" | ||||
" ]\n" | " ]\n" | ||||
"3. locktime (numeric, optional, default=0) Raw " | "3. locktime (numeric, optional, default=0) Raw " | ||||
"locktime. Non-0 value also locktime-activates inputs\n" | "locktime. Non-0 value also locktime-activates inputs\n" | ||||
▲ Show 20 Lines • Show All 133 Lines • Show Last 20 Lines |