Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | static void TxToJSON(const CTransaction &tx, const BlockHash &hashBlock, | ||||
} | } | ||||
} | } | ||||
static UniValue getrawtransaction(const Config &config, | static UniValue getrawtransaction(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 3) { | request.params.size() > 3) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"getrawtransaction \"txid\" ( verbose \"blockhash\" )\n" | RPCHelpMan{"getrawtransaction", | ||||
"\nNOTE: By default this function only works for " | |||||
"\nNOTE: By default this function only works for mempool " | "mempool transactions. If the -txindex option is\n" | ||||
"transactions. If the -txindex option is\n" | "enabled, it also works for blockchain transactions. If " | ||||
"enabled, it also works for blockchain transactions. If the block " | "the block which contains the transaction\n" | ||||
"which contains the transaction\n" | "is known, its hash can be provided even for nodes " | ||||
"is known, its hash can be provided even for nodes without " | "without -txindex. Note that if a blockhash is\n" | ||||
"-txindex. Note that if a blockhash is\n" | "provided, only that block will be searched and if the " | ||||
"provided, only that block will be searched and if the transaction " | "transaction is in the mempool or other\n" | ||||
"is in the mempool or other\n" | "blocks, or if this node does not have the given block " | ||||
"blocks, or if this node does not have the given block available, " | "available, the transaction will not be found.\n", | ||||
"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 " | "DEPRECATED: for now, it also works for transactions with unspent " | ||||
"outputs.\n" | "outputs.\n" | ||||
"\nReturn the raw transaction data.\n" | "\nReturn the raw transaction data.\n" | ||||
"\nIf verbose is 'true', returns an Object with information about " | "\nIf verbose is 'true', returns an Object with information about " | ||||
"'txid'.\n" | "'txid'.\n" | ||||
"If verbose is 'false' or omitted, returns a string that is " | "If verbose is 'false' or omitted, returns a string that is " | ||||
"serialized, hex-encoded data for 'txid'.\n" | "serialized, hex-encoded data for 'txid'.\n" | ||||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static UniValue gettxoutproof(const Config &config, | static UniValue gettxoutproof(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || | if (request.fHelp || | ||||
(request.params.size() != 1 && request.params.size() != 2)) { | (request.params.size() != 1 && request.params.size() != 2)) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
RPCHelpMan{"gettxoutproof", | 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", | {"txids", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
{ | { | ||||
{"txid", RPCArg::Type::STR_HEX, false}, | {"txid", RPCArg::Type::STR_HEX, false}, | ||||
}, | }, | ||||
false}, | false}, | ||||
{"blockhash", RPCArg::Type::STR_HEX, true}, | {"blockhash", RPCArg::Type::STR_HEX, true}, | ||||
}} | }} | ||||
.ToString() + | .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" | "\nArguments:\n" | ||||
"1. \"txids\" (string) A json array of txids to filter\n" | "1. \"txids\" (string) A json array of txids to filter\n" | ||||
" [\n" | " [\n" | ||||
" \"txid\" (string) A transaction hash\n" | " \"txid\" (string) A transaction hash\n" | ||||
" ,...\n" | " ,...\n" | ||||
" ]\n" | " ]\n" | ||||
"2. \"blockhash\" (string, optional) If specified, looks for " | "2. \"blockhash\" (string, optional) If specified, looks for " | ||||
"txid in the block with this hash\n" | "txid in the block with this hash\n" | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | static UniValue gettxoutproof(const Config &config, | ||||
std::string strHex = HexStr(ssMB.begin(), ssMB.end()); | std::string strHex = HexStr(ssMB.begin(), ssMB.end()); | ||||
return strHex; | return strHex; | ||||
} | } | ||||
static UniValue verifytxoutproof(const Config &config, | static UniValue verifytxoutproof(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( | ||||
"verifytxoutproof \"proof\"\n" | RPCHelpMan{"verifytxoutproof", | ||||
"\nVerifies that a proof points to a transaction in a block, " | "\nVerifies that a proof points to a transaction in a " | ||||
"returning the transaction it commits to\n" | "block, returning the transaction it commits to\n" | ||||
"and throwing an RPC error if the block is not in our best chain\n" | "and throwing an RPC error if the block is not in our " | ||||
"best chain\n", | |||||
{ | |||||
{"proof", RPCArg::Type::STR_HEX, false}, | |||||
}} | |||||
.ToString() + | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"proof\" (string, required) The hex-encoded proof " | "1. \"proof\" (string, required) The hex-encoded proof " | ||||
"generated by gettxoutproof\n" | "generated by gettxoutproof\n" | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"[\"txid\"] (array, strings) The txid(s) which the proof " | "[\"txid\"] (array, strings) The txid(s) which the proof " | ||||
"commits to, or empty array if the proof can not be validated.\n"); | "commits to, or empty array if the proof can not be validated.\n"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | static UniValue createrawtransaction(const Config &config, | ||||
return EncodeHexTx(CTransaction(rawTx)); | return EncodeHexTx(CTransaction(rawTx)); | ||||
} | } | ||||
static UniValue decoderawtransaction(const Config &config, | static UniValue decoderawtransaction(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( | ||||
"decoderawtransaction \"hexstring\"\n" | RPCHelpMan{"decoderawtransaction", | ||||
"\nReturn a JSON object representing the serialized, hex-encoded " | "\nReturn a JSON object representing the serialized, " | ||||
"transaction.\n" | "hex-encoded transaction.\n", | ||||
{ | |||||
{"hexstring", RPCArg::Type::STR_HEX, false}, | |||||
}} | |||||
.ToString() + | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"hexstring\" (string, required) The transaction hex " | "1. \"hexstring\" (string, required) The transaction hex " | ||||
"string\n" | "string\n" | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"txid\" : \"id\", (string) The transaction id\n" | " \"txid\" : \"id\", (string) The transaction id\n" | ||||
" \"hash\" : \"id\", (string) The transaction hash " | " \"hash\" : \"id\", (string) The transaction hash " | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | static UniValue decoderawtransaction(const Config &config, | ||||
return result; | return result; | ||||
} | } | ||||
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" | RPCHelpMan{"decodescript", | ||||
"\nDecode a hex-encoded script.\n" | "\nDecode a hex-encoded script.\n", | ||||
{ | |||||
{"hexstring", RPCArg::Type::STR_HEX, false}, | |||||
}} | |||||
.ToString() + | |||||
"\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" | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | static void TxInErrorToJSON(const CTxIn &txin, UniValue &vErrorsRet, | ||||
vErrorsRet.push_back(entry); | vErrorsRet.push_back(entry); | ||||
} | } | ||||
static UniValue combinerawtransaction(const Config &config, | static UniValue combinerawtransaction(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( | ||||
RPCHelpMan{"combinerawtransaction", | 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", | {"txs", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
{ | { | ||||
{"hexstring", RPCArg::Type::STR_HEX, false}, | {"hexstring", RPCArg::Type::STR_HEX, false}, | ||||
}, | }, | ||||
false}, | false}, | ||||
}} | }} | ||||
.ToString() + | .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" | "\nArguments:\n" | ||||
"1. \"txs\" (string) A json array of hex strings of " | "1. \"txs\" (string) A json array of hex strings of " | ||||
"partially signed transactions\n" | "partially signed transactions\n" | ||||
" [\n" | " [\n" | ||||
" \"hexstring\" (string) A transaction hash\n" | " \"hexstring\" (string) A transaction hash\n" | ||||
" ,...\n" | " ,...\n" | ||||
" ]\n" | " ]\n" | ||||
▲ Show 20 Lines • Show All 251 Lines • ▼ Show 20 Lines | |||||
static UniValue signrawtransactionwithkey(const Config &config, | static UniValue signrawtransactionwithkey(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() < 2 || | if (request.fHelp || request.params.size() < 2 || | ||||
request.params.size() > 4) { | request.params.size() > 4) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"signrawtransactionwithkey", | "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_HEX, false}, | {"hexstring", RPCArg::Type::STR_HEX, false}, | ||||
{"privkyes", | {"privkyes", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
{ | { | ||||
{"privatekey", RPCArg::Type::STR_HEX, false}, | {"privatekey", RPCArg::Type::STR_HEX, false}, | ||||
}, | }, | ||||
false}, | false}, | ||||
Show All 10 Lines | if (request.fHelp || request.params.size() < 2 || | ||||
{"amount", RPCArg::Type::AMOUNT, false}, | {"amount", RPCArg::Type::AMOUNT, false}, | ||||
}, | }, | ||||
true}, | true}, | ||||
}, | }, | ||||
true}, | true}, | ||||
{"sighashtype", RPCArg::Type::STR, true}, | {"sighashtype", RPCArg::Type::STR, true}, | ||||
}} | }} | ||||
.ToString() + | .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" | "\nArguments:\n" | ||||
"1. \"hexstring\" (string, required) The " | "1. \"hexstring\" (string, required) The " | ||||
"transaction hex string\n" | "transaction hex string\n" | ||||
"2. \"privkeys\" (string, required) A json " | "2. \"privkeys\" (string, required) A json " | ||||
"array of base58-encoded private keys for signing\n" | "array of base58-encoded private keys for signing\n" | ||||
" [ (json array of strings)\n" | " [ (json array of strings)\n" | ||||
" \"privatekey\" (string) private key in " | " \"privatekey\" (string) private key in " | ||||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | return SignTransaction(*g_rpc_interfaces->chain, mtx, request.params[2], | ||||
&keystore, true, request.params[3]); | &keystore, true, request.params[3]); | ||||
} | } | ||||
static UniValue sendrawtransaction(const Config &config, | static UniValue sendrawtransaction(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"sendrawtransaction \"hexstring\" ( allowhighfees )\n" | RPCHelpMan{"sendrawtransaction", | ||||
"\nSubmits raw transaction (serialized, hex-encoded) to local node " | "\nSubmits raw transaction (serialized, hex-encoded) to " | ||||
"and network.\n" | "local node and network.\n" | ||||
"\nAlso see createrawtransaction and signrawtransactionwithkey " | "\nAlso see createrawtransaction and " | ||||
"calls.\n" | "signrawtransactionwithkey calls.\n", | ||||
{ | |||||
{"hexstring", RPCArg::Type::STR_HEX, false}, | |||||
{"allowhighfees", RPCArg::Type::BOOL, true}, | |||||
}} | |||||
.ToString() + | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"hexstring\" (string, required) The hex string of the raw " | "1. \"hexstring\" (string, required) The hex string of the raw " | ||||
"transaction)\n" | "transaction)\n" | ||||
"2. allowhighfees (boolean, optional, default=false) Allow high " | "2. allowhighfees (boolean, optional, default=false) Allow high " | ||||
"fees\n" | "fees\n" | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\"hex\" (string) The transaction hash in hex\n" | "\"hex\" (string) The transaction hash in hex\n" | ||||
"\nExamples:\n" | "\nExamples:\n" | ||||
▲ Show 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | static std::string WriteHDKeypath(std::vector<uint32_t> &keypath) { | ||||
} | } | ||||
return keypath_str; | return keypath_str; | ||||
} | } | ||||
static UniValue decodepsbt(const Config &config, | static UniValue decodepsbt(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( | ||||
"decodepsbt \"psbt\"\n" | RPCHelpMan{"decodepsbt", | ||||
"\nReturn a JSON object representing the serialized, " | "\nReturn a JSON object representing the serialized, " | ||||
"base64-encoded partially signed Bitcoin transaction.\n" | "base64-encoded partially signed Bitcoin transaction.\n", | ||||
{ | |||||
{"psbt", RPCArg::Type::STR, false}, | |||||
}} | |||||
.ToString() + | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"psbt\" (string, required) The PSBT base64 string\n" | "1. \"psbt\" (string, required) The PSBT base64 string\n" | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"tx\" : { (json object) The decoded " | " \"tx\" : { (json object) The decoded " | ||||
"network-serialized unsigned transaction.\n" | "network-serialized unsigned transaction.\n" | ||||
" ... The layout is the " | " ... The layout is the " | ||||
▲ Show 20 Lines • Show All 258 Lines • ▼ Show 20 Lines | static UniValue decodepsbt(const Config &config, | ||||
return result; | return result; | ||||
} | } | ||||
static UniValue combinepsbt(const Config &config, | static UniValue combinepsbt(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( | ||||
RPCHelpMan{"combinepsbt", | RPCHelpMan{"combinepsbt", | ||||
"\nCombine multiple partially signed Bitcoin " | |||||
"transactions into one transaction.\n" | |||||
"Implements the Combiner role.\n", | |||||
{ | { | ||||
{"txs", | {"txs", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
{ | { | ||||
{"psbt", RPCArg::Type::STR_HEX, false}, | {"psbt", RPCArg::Type::STR, false}, | ||||
}, | }, | ||||
false}, | false}, | ||||
}} | }} | ||||
.ToString() + | .ToString() + | ||||
"\nCombine multiple partially signed Bitcoin transactions into one " | |||||
"transaction.\n" | |||||
"Implements the Combiner role.\n" | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"txs\" (string) A json array of base64 " | "1. \"txs\" (string) A json array of base64 " | ||||
"strings of partially signed transactions\n" | "strings of partially signed transactions\n" | ||||
" [\n" | " [\n" | ||||
" \"psbt\" (string) A base64 string of a PSBT\n" | " \"psbt\" (string) A base64 string of a PSBT\n" | ||||
" ,...\n" | " ,...\n" | ||||
" ]\n" | " ]\n" | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | static UniValue combinepsbt(const Config &config, | ||||
return EncodeBase64((uint8_t *)ssTx.data(), ssTx.size()); | return EncodeBase64((uint8_t *)ssTx.data(), ssTx.size()); | ||||
} | } | ||||
static UniValue finalizepsbt(const Config &config, | static UniValue finalizepsbt(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"finalizepsbt \"psbt\" ( extract )\n" | RPCHelpMan{"finalizepsbt", | ||||
"Finalize the inputs of a PSBT. If the transaction is fully " | "Finalize the inputs of a PSBT. If the transaction is " | ||||
"signed, it will produce a\n" | "fully signed, it will produce a\n" | ||||
"network serialized transaction which can be broadcast with " | "network serialized transaction which can be broadcast " | ||||
"sendrawtransaction. Otherwise a PSBT will be\n" | "with sendrawtransaction. Otherwise a PSBT will be\n" | ||||
"created which has the final_scriptSigfields filled for inputs " | "created which has the final_scriptSigfields filled for " | ||||
"that are complete.\n" | "inputs that are complete.\n" | ||||
"Implements the Finalizer and Extractor roles.\n" | "Implements the Finalizer and Extractor roles.\n", | ||||
{ | |||||
{"psbt", RPCArg::Type::STR, false}, | |||||
{"extract", RPCArg::Type::BOOL, true}, | |||||
}} | |||||
.ToString() + | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"psbt\" (string) A base64 string of a PSBT\n" | "1. \"psbt\" (string) A base64 string of a PSBT\n" | ||||
"2. \"extract\" (boolean, optional, default=true) If " | "2. \"extract\" (boolean, optional, default=true) If " | ||||
"true and the transaction is complete, \n" | "true and the transaction is complete, \n" | ||||
" extract and return the complete " | " extract and return the complete " | ||||
"transaction in normal network serialization instead of the PSBT.\n" | "transaction in normal network serialization instead of the PSBT.\n" | ||||
"\nResult:\n" | "\nResult:\n" | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static UniValue createpsbt(const Config &config, | static UniValue createpsbt(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() < 2 || | if (request.fHelp || request.params.size() < 2 || | ||||
request.params.size() > 3) { | request.params.size() > 3) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
RPCHelpMan{"createpsbt", | RPCHelpMan{"createpsbt", | ||||
"\nCreates a transaction in the Partially Signed " | |||||
"Transaction format.\n" | |||||
"Implements the Creator role.\n", | |||||
{ | { | ||||
{"inputs", | {"inputs", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
{ | { | ||||
{"", | {"", | ||||
RPCArg::Type::OBJ, | RPCArg::Type::OBJ, | ||||
{ | { | ||||
{"txid", RPCArg::Type::STR_HEX, false}, | {"txid", RPCArg::Type::STR_HEX, false}, | ||||
Show All 18 Lines | if (request.fHelp || request.params.size() < 2 || | ||||
{"data", RPCArg::Type::STR_HEX, false}, | {"data", RPCArg::Type::STR_HEX, false}, | ||||
}, | }, | ||||
true}, | true}, | ||||
}, | }, | ||||
false}, | false}, | ||||
{"locktime", RPCArg::Type::NUM, true}, | {"locktime", RPCArg::Type::NUM, true}, | ||||
}} | }} | ||||
.ToString() + | .ToString() + | ||||
"\nCreates a transaction in the Partially Signed Transaction " | |||||
"format.\n" | |||||
"Implements the Creator role.\n" | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"inputs\" (array, required) A json array of " | "1. \"inputs\" (array, required) A json array of " | ||||
"json objects\n" | "json objects\n" | ||||
" [\n" | " [\n" | ||||
" {\n" | " {\n" | ||||
" \"txid\":\"id\", (string, required) The transaction " | " \"txid\":\"id\", (string, required) The transaction " | ||||
"id\n" | "id\n" | ||||
" \"vout\":n, (numeric, required) The output " | " \"vout\":n, (numeric, required) The output " | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | static UniValue createpsbt(const Config &config, | ||||
return EncodeBase64((uint8_t *)ssTx.data(), ssTx.size()); | return EncodeBase64((uint8_t *)ssTx.data(), ssTx.size()); | ||||
} | } | ||||
static UniValue converttopsbt(const Config &config, | static UniValue converttopsbt(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"converttopsbt \"hexstring\" ( permitsigdata )\n" | RPCHelpMan{"converttopsbt", | ||||
"\nConverts a network serialized transaction to a PSBT. This " | "\nConverts a network serialized transaction to a PSBT. " | ||||
"should be used only with createrawtransaction and " | "This should be used only with createrawtransaction and " | ||||
"fundrawtransaction\n" | "fundrawtransaction\n" | ||||
"createpsbt and walletcreatefundedpsbt should be used for new " | "createpsbt and walletcreatefundedpsbt should be used " | ||||
"applications.\n" | "for new applications.\n", | ||||
{ | |||||
{"hexstring", RPCArg::Type::STR_HEX, false}, | |||||
{"permitsigdata", RPCArg::Type::BOOL, true}, | |||||
}} | |||||
.ToString() + | |||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"hexstring\" (string, required) The hex string " | "1. \"hexstring\" (string, required) The hex string " | ||||
"of a raw transaction\n" | "of a raw transaction\n" | ||||
"2. permitsigdata (boolean, optional, default=false) If " | "2. permitsigdata (boolean, optional, default=false) If " | ||||
"true, any signatures in the input will be discarded and " | "true, any signatures in the input will be discarded and " | ||||
"conversion.\n" | "conversion.\n" | ||||
" will continue. If false, RPC will " | " will continue. If false, RPC will " | ||||
"fail if any signatures are present.\n" | "fail if any signatures are present.\n" | ||||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |