Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
{"verbose", RPCArg::Type::BOOL, /* default */ "false", | {"verbose", RPCArg::Type::BOOL, /* default */ "false", | ||||
"If false, return a string, otherwise return a json object"}, | "If false, return a string, otherwise return a json object"}, | ||||
{"blockhash", RPCArg::Type::STR_HEX, | {"blockhash", RPCArg::Type::STR_HEX, | ||||
RPCArg::Optional::OMITTED_NAMED_ARG, | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
"The block in which to look for the transaction"}, | "The block in which to look for the transaction"}, | ||||
}, | }, | ||||
{ | { | ||||
RPCResult{"if verbose is not set or set to false", | RPCResult{"if verbose is not set or set to false", | ||||
"\"data\" (string) The serialized, hex-encoded data " | RPCResult::Type::STR, "data", | ||||
"for 'txid'\n"}, | "The serialized, hex-encoded data for 'txid'"}, | ||||
RPCResult{ | RPCResult{ | ||||
"if verbose is set to true", | "if verbose is set to true", | ||||
"{\n" | RPCResult::Type::OBJ, | ||||
" \"in_active_chain\": b, (bool) Whether specified block is " | "", | ||||
"in the active chain or not (only present with explicit " | "", | ||||
"\"blockhash\" argument)\n" | { | ||||
" \"hex\" : \"data\", (string) The serialized, " | {RPCResult::Type::BOOL, "in_active_chain", | ||||
"hex-encoded data for 'txid'\n" | "Whether specified block is in the active chain or not " | ||||
" \"txid\" : \"id\", (string) The transaction id (same " | "(only present with explicit \"blockhash\" argument)"}, | ||||
"as provided)\n" | {RPCResult::Type::STR_HEX, "hex", | ||||
" \"hash\" : \"id\", (string) The transaction hash " | "The serialized, hex-encoded data for 'txid'"}, | ||||
"(differs from txid for witness transactions)\n" | {RPCResult::Type::STR_HEX, "txid", | ||||
" \"size\" : n, (numeric) The serialized " | "The transaction id (same as provided)"}, | ||||
"transaction size\n" | {RPCResult::Type::STR_HEX, "hash", "The transaction hash"}, | ||||
" \"version\" : n, (numeric) The version\n" | {RPCResult::Type::NUM, "size", | ||||
" \"locktime\" : ttt, (numeric) The lock time\n" | "The serialized transaction size"}, | ||||
" \"vin\" : [ (array of json objects)\n" | {RPCResult::Type::NUM, "version", "The version"}, | ||||
" {\n" | {RPCResult::Type::NUM_TIME, "locktime", "The lock time"}, | ||||
" \"txid\": \"id\", (string) The transaction id\n" | {RPCResult::Type::ARR, | ||||
" \"vout\": n, (numeric) \n" | "vin", | ||||
" \"scriptSig\": { (json object) The script\n" | "", | ||||
" \"asm\": \"asm\", (string) asm\n" | { | ||||
" \"hex\": \"hex\" (string) hex\n" | {RPCResult::Type::OBJ, | ||||
" },\n" | "", | ||||
" \"sequence\": n (numeric) The script sequence " | "", | ||||
"number\n" | { | ||||
" }\n" | {RPCResult::Type::STR_HEX, "txid", | ||||
" ,...\n" | "The transaction id"}, | ||||
" ],\n" | {RPCResult::Type::STR, "vout", ""}, | ||||
" \"vout\" : [ (array of json objects)\n" | {RPCResult::Type::OBJ, | ||||
" {\n" | "scriptSig", | ||||
" \"value\" : x.xxx, (numeric) The value in " + | "The script", | ||||
CURRENCY_UNIT + | { | ||||
"\n" | {RPCResult::Type::STR, "asm", "asm"}, | ||||
" \"n\" : n, (numeric) index\n" | {RPCResult::Type::STR_HEX, "hex", "hex"}, | ||||
" \"scriptPubKey\" : { (json object)\n" | }}, | ||||
" \"asm\" : \"asm\", (string) the asm\n" | {RPCResult::Type::NUM, "sequence", | ||||
" \"hex\" : \"hex\", (string) the hex\n" | "The script sequence number"}, | ||||
" \"reqSigs\" : n, (numeric) The " | }}, | ||||
"required sigs\n" | }}, | ||||
" \"type\" : \"pubkeyhash\", (string) The type, " | {RPCResult::Type::ARR, | ||||
"eg 'pubkeyhash'\n" | "vout", | ||||
" \"addresses\" : [ (json array of " | "", | ||||
"string)\n" | { | ||||
" \"address\" (string) bitcoin address\n" | {RPCResult::Type::OBJ, | ||||
" ,...\n" | "", | ||||
" ]\n" | "", | ||||
" }\n" | { | ||||
" }\n" | {RPCResult::Type::NUM, "value", | ||||
" ,...\n" | "The value in " + CURRENCY_UNIT}, | ||||
" ],\n" | {RPCResult::Type::NUM, "n", "index"}, | ||||
" \"blockhash\" : \"hash\", (string) the block hash\n" | {RPCResult::Type::OBJ, | ||||
" \"confirmations\" : n, (numeric) The " | "scriptPubKey", | ||||
"confirmations\n" | "", | ||||
" \"blocktime\" : ttt (numeric) The block time " | { | ||||
"expressed in " + | {RPCResult::Type::STR, "asm", "the asm"}, | ||||
UNIX_EPOCH_TIME + | {RPCResult::Type::STR, "hex", "the hex"}, | ||||
"\n" | {RPCResult::Type::NUM, "reqSigs", | ||||
" \"time\" : ttt, (numeric) Same as " | "The required sigs"}, | ||||
"\"blocktime\"\n" | {RPCResult::Type::STR, "type", | ||||
"}\n"}, | "The type, eg 'pubkeyhash'"}, | ||||
{RPCResult::Type::ARR, | |||||
"addresses", | |||||
"", | |||||
{ | |||||
{RPCResult::Type::STR, "address", | |||||
"bitcoin address"}, | |||||
}}, | |||||
}}, | |||||
}}, | |||||
}}, | |||||
{RPCResult::Type::STR_HEX, "blockhash", "the block hash"}, | |||||
{RPCResult::Type::NUM, "confirmations", | |||||
"The confirmations"}, | |||||
{RPCResult::Type::NUM_TIME, "blocktime", | |||||
"The block time expressed in " + UNIX_EPOCH_TIME}, | |||||
{RPCResult::Type::NUM, "time", "Same as \"blocktime\""}, | |||||
}}, | |||||
}, | }, | ||||
RPCExamples{HelpExampleCli("getrawtransaction", "\"mytxid\"") + | RPCExamples{HelpExampleCli("getrawtransaction", "\"mytxid\"") + | ||||
HelpExampleCli("getrawtransaction", "\"mytxid\" true") + | HelpExampleCli("getrawtransaction", "\"mytxid\" true") + | ||||
HelpExampleRpc("getrawtransaction", "\"mytxid\", true") + | HelpExampleRpc("getrawtransaction", "\"mytxid\", true") + | ||||
HelpExampleCli("getrawtransaction", | HelpExampleCli("getrawtransaction", | ||||
"\"mytxid\" false \"myblockhash\"") + | "\"mytxid\" false \"myblockhash\"") + | ||||
HelpExampleCli("getrawtransaction", | HelpExampleCli("getrawtransaction", | ||||
"\"mytxid\" true \"myblockhash\"")}, | "\"mytxid\" true \"myblockhash\"")}, | ||||
▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, | {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, | ||||
"A transaction hash"}, | "A transaction hash"}, | ||||
}, | }, | ||||
}, | }, | ||||
{"blockhash", RPCArg::Type::STR_HEX, | {"blockhash", RPCArg::Type::STR_HEX, | ||||
RPCArg::Optional::OMITTED_NAMED_ARG, | RPCArg::Optional::OMITTED_NAMED_ARG, | ||||
"If specified, looks for txid in the block with this hash"}, | "If specified, looks for txid in the block with this hash"}, | ||||
}, | }, | ||||
RPCResult{"\"data\" (string) A string that is a serialized, " | RPCResult{ | ||||
"hex-encoded data for the proof.\n"}, | RPCResult::Type::STR, "data", | ||||
"A string that is a serialized, hex-encoded data for the proof."}, | |||||
RPCExamples{""}, | RPCExamples{""}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
std::set<TxId> setTxIds; | std::set<TxId> setTxIds; | ||||
TxId oneTxId; | TxId oneTxId; | ||||
UniValue txids = request.params[0].get_array(); | UniValue txids = request.params[0].get_array(); | ||||
for (unsigned int idx = 0; idx < txids.size(); idx++) { | for (unsigned int idx = 0; idx < txids.size(); idx++) { | ||||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
"verifytxoutproof", | "verifytxoutproof", | ||||
"Verifies that a proof points to a transaction in a block, returning " | "Verifies that a proof points to a transaction in a block, returning " | ||||
"the transaction it commits to\n" | "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, RPCArg::Optional::NO, | {"proof", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
"The hex-encoded proof generated by gettxoutproof"}, | "The hex-encoded proof generated by gettxoutproof"}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{RPCResult::Type::ARR, | ||||
"[\"txid\"] (array, strings) The txid(s) which the proof " | "", | ||||
"commits to, or empty array if the proof can not be validated.\n"}, | "", | ||||
{ | |||||
{RPCResult::Type::STR_HEX, "txid", | |||||
"The txid(s) which the proof commits to, or empty array " | |||||
"if the proof can not be validated."}, | |||||
}}, | |||||
RPCExamples{""}, | RPCExamples{""}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
CDataStream ssMB(ParseHexV(request.params[0], "proof"), SER_NETWORK, | CDataStream ssMB(ParseHexV(request.params[0], "proof"), SER_NETWORK, | ||||
PROTOCOL_VERSION); | PROTOCOL_VERSION); | ||||
CMerkleBlock merkleBlock; | CMerkleBlock merkleBlock; | ||||
ssMB >> merkleBlock; | ssMB >> merkleBlock; | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
"value is hex-encoded data"}, | "value is hex-encoded data"}, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
{"locktime", RPCArg::Type::NUM, /* default */ "0", | {"locktime", RPCArg::Type::NUM, /* default */ "0", | ||||
"Raw locktime. Non-0 value also locktime-activates inputs"}, | "Raw locktime. Non-0 value also locktime-activates inputs"}, | ||||
}, | }, | ||||
RPCResult{"\"transaction\" (string) hex string of the " | RPCResult{RPCResult::Type::STR_HEX, "transaction", | ||||
"transaction\n"}, | "hex string of the transaction"}, | ||||
RPCExamples{ | RPCExamples{ | ||||
HelpExampleCli("createrawtransaction", | HelpExampleCli("createrawtransaction", | ||||
"\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]" | "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]" | ||||
"\" \"[{\\\"address\\\":0.01}]\"") + | "\" \"[{\\\"address\\\":0.01}]\"") + | ||||
HelpExampleCli("createrawtransaction", | HelpExampleCli("createrawtransaction", | ||||
"\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]" | "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]" | ||||
"\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"") + | "\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"") + | ||||
HelpExampleRpc("createrawtransaction", | HelpExampleRpc("createrawtransaction", | ||||
Show All 24 Lines | RPCHelpMan{ | ||||
"decoderawtransaction", | "decoderawtransaction", | ||||
"Return a JSON object representing the serialized, hex-encoded " | "Return a JSON object representing the serialized, hex-encoded " | ||||
"transaction.\n", | "transaction.\n", | ||||
{ | { | ||||
{"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
"The transaction hex string"}, | "The transaction hex string"}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"{\n" | RPCResult::Type::OBJ, | ||||
" \"txid\" : \"id\", (string) The transaction id\n" | "", | ||||
" \"hash\" : \"id\", (string) The transaction hash " | "", | ||||
"(differs from txid for witness transactions)\n" | { | ||||
" \"size\" : n, (numeric) The transaction size\n" | {RPCResult::Type::STR_HEX, "txid", "The transaction id"}, | ||||
" \"version\" : n, (numeric) The version\n" | {RPCResult::Type::STR_HEX, "hash", "The transaction hash"}, | ||||
" \"locktime\" : ttt, (numeric) The lock time\n" | {RPCResult::Type::NUM, "size", "The transaction size"}, | ||||
" \"vin\" : [ (array of json objects)\n" | {RPCResult::Type::NUM, "version", "The version"}, | ||||
" {\n" | {RPCResult::Type::NUM_TIME, "locktime", "The lock time"}, | ||||
" \"txid\": \"id\", (string) The transaction id\n" | {RPCResult::Type::ARR, | ||||
" \"vout\": n, (numeric) The output number\n" | "vin", | ||||
" \"scriptSig\": { (json object) The script\n" | "", | ||||
" \"asm\": \"asm\", (string) asm\n" | { | ||||
" \"hex\": \"hex\" (string) hex\n" | {RPCResult::Type::OBJ, | ||||
" },\n" | "", | ||||
" \"sequence\": n (numeric) The script sequence number\n" | "", | ||||
" }\n" | { | ||||
" ,...\n" | {RPCResult::Type::STR_HEX, "txid", | ||||
" ],\n" | "The transaction id"}, | ||||
" \"vout\" : [ (array of json objects)\n" | {RPCResult::Type::NUM, "vout", "The output number"}, | ||||
" {\n" | {RPCResult::Type::OBJ, | ||||
" \"value\" : x.xxx, (numeric) The value in " + | "scriptSig", | ||||
CURRENCY_UNIT + | "The script", | ||||
"\n" | { | ||||
" \"n\" : n, (numeric) index\n" | {RPCResult::Type::STR, "asm", "asm"}, | ||||
" \"scriptPubKey\" : { (json object)\n" | {RPCResult::Type::STR_HEX, "hex", "hex"}, | ||||
" \"asm\" : \"asm\", (string) the asm\n" | }}, | ||||
" \"hex\" : \"hex\", (string) the hex\n" | {RPCResult::Type::NUM, "sequence", | ||||
" \"reqSigs\" : n, (numeric) The required sigs\n" | "The script sequence number"}, | ||||
" \"type\" : \"pubkeyhash\", (string) The type, eg " | }}, | ||||
"'pubkeyhash'\n" | }}, | ||||
" \"addresses\" : [ (json array of string)\n" | {RPCResult::Type::ARR, | ||||
" \"12tvKAXCxZjSmdNbao16dKXC8tRWfcF5oc\" (string) " | "vout", | ||||
"bitcoin address\n" | "", | ||||
" ,...\n" | { | ||||
" ]\n" | {RPCResult::Type::OBJ, | ||||
" }\n" | "", | ||||
" }\n" | "", | ||||
" ,...\n" | { | ||||
" ],\n" | {RPCResult::Type::NUM, "value", | ||||
"}\n"}, | "The value in " + CURRENCY_UNIT}, | ||||
{RPCResult::Type::NUM, "n", "index"}, | |||||
{RPCResult::Type::OBJ, | |||||
"scriptPubKey", | |||||
"", | |||||
{ | |||||
{RPCResult::Type::STR, "asm", "the asm"}, | |||||
{RPCResult::Type::STR_HEX, "hex", "the hex"}, | |||||
{RPCResult::Type::NUM, "reqSigs", | |||||
"The required sigs"}, | |||||
{RPCResult::Type::STR, "type", | |||||
"The type, eg 'pubkeyhash'"}, | |||||
{RPCResult::Type::ARR, | |||||
"addresses", | |||||
"", | |||||
{ | |||||
{RPCResult::Type::STR, "address", | |||||
"bitcoin address"}, | |||||
}}, | |||||
}}, | |||||
}}, | |||||
}}, | |||||
}}, | |||||
RPCExamples{HelpExampleCli("decoderawtransaction", "\"hexstring\"") + | RPCExamples{HelpExampleCli("decoderawtransaction", "\"hexstring\"") + | ||||
HelpExampleRpc("decoderawtransaction", "\"hexstring\"")}, | HelpExampleRpc("decoderawtransaction", "\"hexstring\"")}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
RPCTypeCheck(request.params, {UniValue::VSTR}); | RPCTypeCheck(request.params, {UniValue::VSTR}); | ||||
CMutableTransaction mtx; | CMutableTransaction mtx; | ||||
Show All 24 Lines | static UniValue decodescript(const Config &config, | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"decodescript", | "decodescript", | ||||
"Decode a hex-encoded script.\n", | "Decode a hex-encoded script.\n", | ||||
{ | { | ||||
{"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
"the hex-encoded script"}, | "the hex-encoded script"}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"{\n" | RPCResult::Type::OBJ, | ||||
" \"asm\":\"asm\", (string) Script public key\n" | "", | ||||
" \"type\":\"type\", (string) The output type (e.g. " + | "", | ||||
GetAllOutputTypes() + | { | ||||
")\n" | {RPCResult::Type::STR, "asm", "Script public key"}, | ||||
" \"reqSigs\": n, (numeric) The required signatures\n" | {RPCResult::Type::STR, "type", | ||||
" \"addresses\": [ (json array of string)\n" | "The output type (e.g. " + GetAllOutputTypes() + ")"}, | ||||
" \"address\" (string) bitcoin address\n" | {RPCResult::Type::NUM, "reqSigs", "The required signatures"}, | ||||
" ,...\n" | {RPCResult::Type::ARR, | ||||
" ],\n" | "addresses", | ||||
" \"p2sh\":\"str\" (string) address of P2SH script" | "", | ||||
" wrapping this redeem script (not returned if the script" | { | ||||
" is already a P2SH).\n" | {RPCResult::Type::STR, "address", "bitcoin address"}, | ||||
"}\n"}, | }}, | ||||
{RPCResult::Type::STR, "p2sh", | |||||
"address of P2SH script wrapping this redeem script (not " | |||||
"returned if the script is already a P2SH)"}, | |||||
}}, | |||||
RPCExamples{HelpExampleCli("decodescript", "\"hexstring\"") + | RPCExamples{HelpExampleCli("decodescript", "\"hexstring\"") + | ||||
HelpExampleRpc("decodescript", "\"hexstring\"")}, | HelpExampleRpc("decodescript", "\"hexstring\"")}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
RPCTypeCheck(request.params, {UniValue::VSTR}); | RPCTypeCheck(request.params, {UniValue::VSTR}); | ||||
UniValue r(UniValue::VOBJ); | UniValue r(UniValue::VOBJ); | ||||
Show All 37 Lines | RPCHelpMan{ | ||||
"A json array of hex strings of partially signed " | "A json array of hex strings of partially signed " | ||||
"transactions", | "transactions", | ||||
{ | { | ||||
{"hexstring", RPCArg::Type::STR_HEX, | {"hexstring", RPCArg::Type::STR_HEX, | ||||
RPCArg::Optional::OMITTED, "A transaction hash"}, | RPCArg::Optional::OMITTED, "A transaction hash"}, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
RPCResult{"\"hex\" (string) The hex-encoded raw transaction " | RPCResult{RPCResult::Type::STR, "", | ||||
"with signature(s)\n"}, | "The hex-encoded raw transaction with signature(s)"}, | ||||
RPCExamples{HelpExampleCli("combinerawtransaction", | RPCExamples{HelpExampleCli("combinerawtransaction", | ||||
"[\"myhex1\", \"myhex2\", \"myhex3\"]")}, | "[\"myhex1\", \"myhex2\", \"myhex3\"]")}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
UniValue txs = request.params[0].get_array(); | UniValue txs = request.params[0].get_array(); | ||||
std::vector<CMutableTransaction> txVariants(txs.size()); | std::vector<CMutableTransaction> txVariants(txs.size()); | ||||
▲ Show 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
" \"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\""}, | " \"SINGLE|FORKID|ANYONECANPAY\""}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"{\n" | RPCResult::Type::OBJ, | ||||
" \"hex\" : \"value\", (string) The hex-encoded raw " | "", | ||||
"transaction with signature(s)\n" | "", | ||||
" \"complete\" : true|false, (boolean) If the transaction has a " | { | ||||
"complete set of signatures\n" | {RPCResult::Type::STR_HEX, "hex", | ||||
" \"errors\" : [ (json array of objects) Script " | "The hex-encoded raw transaction with signature(s)"}, | ||||
"verification errors (if there are any)\n" | {RPCResult::Type::BOOL, "complete", | ||||
" {\n" | "If the transaction has a complete set of signatures"}, | ||||
" \"txid\" : \"hash\", (string) The hash of the " | {RPCResult::Type::ARR, | ||||
"referenced, previous transaction\n" | "errors", | ||||
" \"vout\" : n, (numeric) The index of the output " | "Script verification errors (if there are any)", | ||||
"to spent and used as input\n" | { | ||||
" \"scriptSig\" : \"hex\", (string) The hex-encoded signature " | {RPCResult::Type::OBJ, | ||||
"script\n" | "", | ||||
" \"sequence\" : n, (numeric) Script sequence number\n" | "", | ||||
" \"error\" : \"text\" (string) Verification or signing " | { | ||||
"error related to the input\n" | {RPCResult::Type::STR_HEX, "txid", | ||||
" }\n" | "The hash of the referenced, previous transaction"}, | ||||
" ,...\n" | {RPCResult::Type::NUM, "vout", | ||||
" ]\n" | "The index of the output to spent and used as " | ||||
"}\n"}, | "input"}, | ||||
{RPCResult::Type::STR_HEX, "scriptSig", | |||||
"The hex-encoded signature script"}, | |||||
{RPCResult::Type::NUM, "sequence", | |||||
"Script sequence number"}, | |||||
{RPCResult::Type::STR, "error", | |||||
"Verification or signing error related to the " | |||||
"input"}, | |||||
}}, | |||||
}}, | |||||
}}, | |||||
RPCExamples{ | RPCExamples{ | ||||
HelpExampleCli("signrawtransactionwithkey", | HelpExampleCli("signrawtransactionwithkey", | ||||
"\"myhex\" \"[\\\"key1\\\",\\\"key2\\\"]\"") + | "\"myhex\" \"[\\\"key1\\\",\\\"key2\\\"]\"") + | ||||
HelpExampleRpc("signrawtransactionwithkey", | HelpExampleRpc("signrawtransactionwithkey", | ||||
"\"myhex\", \"[\\\"key1\\\",\\\"key2\\\"]\"")}, | "\"myhex\", \"[\\\"key1\\\",\\\"key2\\\"]\"")}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
"The hex string of the raw transaction"}, | "The hex string of the raw transaction"}, | ||||
{"maxfeerate", RPCArg::Type::AMOUNT, | {"maxfeerate", RPCArg::Type::AMOUNT, | ||||
/* default */ | /* default */ | ||||
FormatMoney(DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK()), | FormatMoney(DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK()), | ||||
"Reject transactions whose fee rate is higher than the specified " | "Reject transactions whose fee rate is higher than the specified " | ||||
"value, expressed in " + | "value, expressed in " + | ||||
CURRENCY_UNIT + "/kB\nSet to 0 to accept any fee rate.\n"}, | CURRENCY_UNIT + "/kB\nSet to 0 to accept any fee rate.\n"}, | ||||
}, | }, | ||||
RPCResult{"\"hex\" (string) The transaction hash in hex\n"}, | RPCResult{RPCResult::Type::STR_HEX, "", "The transaction hash in hex"}, | ||||
RPCExamples{ | RPCExamples{ | ||||
"\nCreate a transaction\n" + | "\nCreate a transaction\n" + | ||||
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\"") + | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
}, | }, | ||||
{"maxfeerate", RPCArg::Type::AMOUNT, | {"maxfeerate", RPCArg::Type::AMOUNT, | ||||
/* default */ | /* default */ | ||||
FormatMoney(DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK()), | FormatMoney(DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK()), | ||||
"Reject transactions whose fee rate is higher than the specified " | "Reject transactions whose fee rate is higher than the specified " | ||||
"value, expressed in " + | "value, expressed in " + | ||||
CURRENCY_UNIT + "/kB\n"}, | CURRENCY_UNIT + "/kB\n"}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{RPCResult::Type::ARR, | ||||
"[ (array) The result of the mempool acceptance " | "", | ||||
"test for each raw transaction in the input array.\n" | "The result of the mempool acceptance test for each raw " | ||||
" Length is exactly one for now.\n" | "transaction in the input array.\n" | ||||
" {\n" | "Length is exactly one for now.", | ||||
" \"txid\" (string) The transaction hash in hex\n" | { | ||||
" \"allowed\" (boolean) If the mempool allows this tx to be " | {RPCResult::Type::OBJ, | ||||
"inserted\n" | "", | ||||
" \"reject-reason\" (string) Rejection string (only present when " | "", | ||||
"'allowed' is false)\n" | { | ||||
" }\n" | {RPCResult::Type::STR_HEX, "txid", | ||||
"]\n"}, | "The transaction hash in hex"}, | ||||
{RPCResult::Type::BOOL, "allowed", | |||||
"If the mempool allows this tx to be inserted"}, | |||||
{RPCResult::Type::STR, "reject-reason", | |||||
"Rejection string (only present when 'allowed' is " | |||||
"false)"}, | |||||
}}, | |||||
}}, | |||||
RPCExamples{ | RPCExamples{ | ||||
"\nCreate a transaction\n" + | "\nCreate a transaction\n" + | ||||
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\"") + | ||||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
"decodepsbt", | "decodepsbt", | ||||
"Return a JSON object representing the serialized, base64-encoded " | "Return a JSON object representing the serialized, base64-encoded " | ||||
"partially signed Bitcoin transaction.\n", | "partially signed Bitcoin transaction.\n", | ||||
{ | { | ||||
{"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, | {"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
"The PSBT base64 string"}, | "The PSBT base64 string"}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{ | ||||
"{\n" | RPCResult::Type::OBJ, | ||||
" \"tx\" : { (json object) The decoded " | "", | ||||
"network-serialized unsigned transaction.\n" | "", | ||||
" ... The layout is the " | { | ||||
"same as the output of decoderawtransaction.\n" | {RPCResult::Type::OBJ, | ||||
" },\n" | "tx", | ||||
" \"unknown\" : { (json object) The unknown global " | "The decoded network-serialized unsigned transaction.", | ||||
"fields\n" | { | ||||
" \"key\" : \"value\" (key-value pair) An unknown " | {RPCResult::Type::ELISION, "", | ||||
"key-value pair\n" | "The layout is the same as the output of " | ||||
" ...\n" | "decoderawtransaction."}, | ||||
" },\n" | }}, | ||||
" \"inputs\" : [ (array of json objects)\n" | {RPCResult::Type::OBJ_DYN, | ||||
" {\n" | "unknown", | ||||
" \"utxo\" : { (json object, optional) Transaction " | "The unknown global fields", | ||||
"output for UTXOs\n" | { | ||||
" \"amount\" : x.xxx, (numeric) The value in " + | {RPCResult::Type::STR_HEX, "key", | ||||
CURRENCY_UNIT + | "(key-value pair) An unknown key-value pair"}, | ||||
"\n" | }}, | ||||
" \"scriptPubKey\" : { (json object)\n" | {RPCResult::Type::ARR, | ||||
" \"asm\" : \"asm\", (string) The asm\n" | "inputs", | ||||
" \"hex\" : \"hex\", (string) The hex\n" | "", | ||||
" \"type\" : \"pubkeyhash\", (string) The type, eg " | { | ||||
"'pubkeyhash'\n" | {RPCResult::Type::OBJ, | ||||
" \"address\" : \"address\" (string) Bitcoin address " | "", | ||||
"if there is one\n" | "", | ||||
" }\n" | { | ||||
" },\n" | {RPCResult::Type::OBJ, | ||||
" \"partial_signatures\" : { (json object, " | "utxo", | ||||
"optional)\n" | /* optional */ true, | ||||
" \"pubkey\" : \"signature\", (string) The public " | "Transaction output for UTXOs", | ||||
"key and signature that corresponds to it.\n" | { | ||||
" ,...\n" | {RPCResult::Type::NUM, "amount", | ||||
" }\n" | "The value in " + CURRENCY_UNIT}, | ||||
" \"sighash\" : \"type\", (string, optional) " | {RPCResult::Type::OBJ, | ||||
"The sighash type to be used\n" | "scriptPubKey", | ||||
" \"redeem_script\" : { (json object, optional)\n" | "", | ||||
" \"asm\" : \"asm\", (string) The asm\n" | { | ||||
" \"hex\" : \"hex\", (string) The hex\n" | {RPCResult::Type::STR, "asm", "The asm"}, | ||||
" \"type\" : \"pubkeyhash\", (string) The type, eg " | {RPCResult::Type::STR_HEX, "hex", | ||||
"'pubkeyhash'\n" | "The hex"}, | ||||
" }\n" | {RPCResult::Type::STR, "type", | ||||
" \"bip32_derivs\" : { (json object, optional)\n" | "The type, eg 'pubkeyhash'"}, | ||||
" \"pubkey\" : { (json object, " | {RPCResult::Type::STR, "address", | ||||
"optional) The public key with the derivation path as the value.\n" | " Bitcoin address if there is one"}, | ||||
" \"master_fingerprint\" : \"fingerprint\" (string) " | }}, | ||||
"The fingerprint of the master key\n" | }}, | ||||
" \"path\" : \"path\", (string) " | {RPCResult::Type::OBJ_DYN, | ||||
"The path\n" | "partial_signatures", | ||||
" }\n" | /* optional */ true, | ||||
" ,...\n" | "", | ||||
" }\n" | { | ||||
" \"final_scriptsig\" : { (json object, optional)\n" | {RPCResult::Type::STR, "pubkey", | ||||
" \"asm\" : \"asm\", (string) The asm\n" | "The public key and signature that corresponds " | ||||
" \"hex\" : \"hex\", (string) The hex\n" | "to it."}, | ||||
" }\n" | }}, | ||||
" \"unknown\" : { (json object) The unknown " | {RPCResult::Type::STR, "sighash", /* optional */ true, | ||||
"global fields\n" | "The sighash type to be used"}, | ||||
" \"key\" : \"value\" (key-value pair) An " | {RPCResult::Type::OBJ, | ||||
"unknown key-value pair\n" | "redeem_script", | ||||
" ...\n" | /* optional */ true, | ||||
" },\n" | "", | ||||
" }\n" | { | ||||
" ,...\n" | {RPCResult::Type::STR, "asm", "The asm"}, | ||||
" ]\n" | {RPCResult::Type::STR_HEX, "hex", "The hex"}, | ||||
" \"outputs\" : [ (array of json objects)\n" | {RPCResult::Type::STR, "type", | ||||
" {\n" | "The type, eg 'pubkeyhash'"}, | ||||
" \"redeem_script\" : { (json object, optional)\n" | }}, | ||||
" \"asm\" : \"asm\", (string) The asm\n" | {RPCResult::Type::ARR, | ||||
" \"hex\" : \"hex\", (string) The hex\n" | "bip32_derivs", | ||||
" \"type\" : \"pubkeyhash\", (string) The type, eg " | /* optional */ true, | ||||
"'pubkeyhash'\n" | "", | ||||
" }\n" | { | ||||
" \"bip32_derivs\" : [ (array of json objects, " | {RPCResult::Type::OBJ, | ||||
"optional)\n" | "pubkey", | ||||
" {\n" | /* optional */ true, | ||||
" \"pubkey\" : \"pubkey\", (string) " | "The public key with the derivation path as " | ||||
"The public key this path corresponds to\n" | "the value.", | ||||
" \"master_fingerprint\" : \"fingerprint\" (string) " | { | ||||
"The fingerprint of the master key\n" | {RPCResult::Type::STR, "master_fingerprint", | ||||
" \"path\" : \"path\", (string) " | "The fingerprint of the master key"}, | ||||
"The path\n" | {RPCResult::Type::STR, "path", "The path"}, | ||||
" }\n" | }}, | ||||
" }\n" | }}, | ||||
" ,...\n" | {RPCResult::Type::OBJ, | ||||
" ],\n" | "final_scriptsig", | ||||
" \"unknown\" : { (json object) The unknown " | /* optional */ true, | ||||
"global fields\n" | "", | ||||
" \"key\" : \"value\" (key-value pair) An " | { | ||||
"unknown key-value pair\n" | {RPCResult::Type::STR, "asm", "The asm"}, | ||||
" ...\n" | {RPCResult::Type::STR, "hex", "The hex"}, | ||||
" },\n" | }}, | ||||
" }\n" | {RPCResult::Type::OBJ_DYN, | ||||
" ,...\n" | "unknown", | ||||
" ]\n" | "The unknown global fields", | ||||
" \"fee\" : fee (numeric, optional) The " | { | ||||
"transaction fee paid if all UTXOs slots in the PSBT have been " | {RPCResult::Type::STR_HEX, "key", | ||||
"filled.\n" | "(key-value pair) An unknown key-value pair"}, | ||||
"}\n"}, | }}, | ||||
}}, | |||||
}}, | |||||
{RPCResult::Type::ARR, | |||||
"outputs", | |||||
"", | |||||
{ | |||||
{RPCResult::Type::OBJ, | |||||
"", | |||||
"", | |||||
{ | |||||
{RPCResult::Type::OBJ, | |||||
"redeem_script", | |||||
/* optional */ true, | |||||
"", | |||||
{ | |||||
{RPCResult::Type::STR, "asm", "The asm"}, | |||||
{RPCResult::Type::STR_HEX, "hex", "The hex"}, | |||||
{RPCResult::Type::STR, "type", | |||||
"The type, eg 'pubkeyhash'"}, | |||||
}}, | |||||
{RPCResult::Type::ARR, | |||||
"bip32_derivs", | |||||
/* optional */ true, | |||||
"", | |||||
{ | |||||
{RPCResult::Type::OBJ, | |||||
"", | |||||
"", | |||||
{ | |||||
{RPCResult::Type::STR, "pubkey", | |||||
"The public key this path corresponds to"}, | |||||
{RPCResult::Type::STR, "master_fingerprint", | |||||
"The fingerprint of the master key"}, | |||||
{RPCResult::Type::STR, "path", "The path"}, | |||||
}}, | |||||
}}, | |||||
{RPCResult::Type::OBJ_DYN, | |||||
"unknown", | |||||
"The unknown global fields", | |||||
{ | |||||
{RPCResult::Type::STR_HEX, "key", | |||||
"(key-value pair) An unknown key-value pair"}, | |||||
}}, | |||||
}}, | |||||
}}, | |||||
{RPCResult::Type::STR_AMOUNT, "fee", /* optional */ true, | |||||
"The transaction fee paid if all UTXOs slots in the PSBT have " | |||||
"been filled."}, | |||||
}}, | |||||
RPCExamples{HelpExampleCli("decodepsbt", "\"psbt\"")}, | RPCExamples{HelpExampleCli("decodepsbt", "\"psbt\"")}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
RPCTypeCheck(request.params, {UniValue::VSTR}); | RPCTypeCheck(request.params, {UniValue::VSTR}); | ||||
// Unserialize the transactions | // Unserialize the transactions | ||||
PartiallySignedTransaction psbtx; | PartiallySignedTransaction psbtx; | ||||
▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
"A json array of base64 strings of partially signed " | "A json array of base64 strings of partially signed " | ||||
"transactions", | "transactions", | ||||
{ | { | ||||
{"psbt", RPCArg::Type::STR, RPCArg::Optional::OMITTED, | {"psbt", RPCArg::Type::STR, RPCArg::Optional::OMITTED, | ||||
"A base64 string of a PSBT"}, | "A base64 string of a PSBT"}, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
RPCResult{" \"psbt\" (string) The base64-encoded partially " | RPCResult{RPCResult::Type::STR, "", | ||||
"signed transaction\n"}, | "The base64-encoded partially signed transaction"}, | ||||
RPCExamples{HelpExampleCli( | RPCExamples{HelpExampleCli( | ||||
"combinepsbt", "[\"mybase64_1\", \"mybase64_2\", \"mybase64_3\"]")}, | "combinepsbt", "[\"mybase64_1\", \"mybase64_2\", \"mybase64_3\"]")}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
RPCTypeCheck(request.params, {UniValue::VARR}, true); | RPCTypeCheck(request.params, {UniValue::VARR}, true); | ||||
// Unserialize the transactions | // Unserialize the transactions | ||||
Show All 39 Lines | RPCHelpMan{ | ||||
{"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, | {"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
"A base64 string of a PSBT"}, | "A base64 string of a PSBT"}, | ||||
{"extract", RPCArg::Type::BOOL, /* default */ "true", | {"extract", RPCArg::Type::BOOL, /* default */ "true", | ||||
"If true and the transaction is complete,\n" | "If 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 " | "transaction in normal network serialization instead of the " | ||||
"PSBT."}, | "PSBT."}, | ||||
}, | }, | ||||
RPCResult{ | RPCResult{RPCResult::Type::OBJ, | ||||
"{\n" | "", | ||||
" \"psbt\" : \"value\", (string) The base64-encoded " | "", | ||||
"partially signed transaction if not extracted\n" | { | ||||
" \"hex\" : \"value\", (string) The hex-encoded network " | {RPCResult::Type::STR, "psbt", | ||||
"transaction if extracted\n" | "The base64-encoded partially signed transaction if not " | ||||
" \"complete\" : true|false, (boolean) If the transaction has a " | "extracted"}, | ||||
"complete set of signatures\n" | {RPCResult::Type::STR_HEX, "hex", | ||||
" ]\n" | "The hex-encoded network transaction if extracted"}, | ||||
"}\n"}, | {RPCResult::Type::BOOL, "complete", | ||||
"If the transaction has a complete set of signatures"}, | |||||
}}, | |||||
RPCExamples{HelpExampleCli("finalizepsbt", "\"psbt\"")}, | RPCExamples{HelpExampleCli("finalizepsbt", "\"psbt\"")}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL}, true); | RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL}, true); | ||||
// Unserialize the transactions | // Unserialize the transactions | ||||
PartiallySignedTransaction psbtx; | PartiallySignedTransaction psbtx; | ||||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
"value is hex-encoded data"}, | "value is hex-encoded data"}, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
{"locktime", RPCArg::Type::NUM, /* default */ "0", | {"locktime", RPCArg::Type::NUM, /* default */ "0", | ||||
"Raw locktime. Non-0 value also locktime-activates inputs"}, | "Raw locktime. Non-0 value also locktime-activates inputs"}, | ||||
}, | }, | ||||
RPCResult{" \"psbt\" (string) The resulting raw transaction " | RPCResult{RPCResult::Type::STR, "", | ||||
"(base64-encoded string)\n"}, | "The resulting raw transaction (base64-encoded string)"}, | ||||
RPCExamples{HelpExampleCli( | RPCExamples{HelpExampleCli( | ||||
"createpsbt", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]" | "createpsbt", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]" | ||||
"\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"")}, | "\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"")}, | ||||
} | } | ||||
.Check(request); | .Check(request); | ||||
RPCTypeCheck(request.params, | RPCTypeCheck(request.params, | ||||
{ | { | ||||
Show All 37 Lines | RPCHelpMan{ | ||||
{"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, | ||||
"The hex string of a raw transaction"}, | "The hex string of a raw transaction"}, | ||||
{"permitsigdata", RPCArg::Type::BOOL, /* default */ "false", | {"permitsigdata", RPCArg::Type::BOOL, /* default */ "false", | ||||
"If true, any signatures in the input will be discarded and " | "If 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."}, | "fail if any signatures are present."}, | ||||
}, | }, | ||||
RPCResult{" \"psbt\" (string) The resulting raw " | RPCResult{RPCResult::Type::STR, "", | ||||
"transaction (base64-encoded string)\n"}, | "The resulting raw transaction (base64-encoded string)"}, | ||||
RPCExamples{ | RPCExamples{ | ||||
"\nCreate a transaction\n" + | "\nCreate a transaction\n" + | ||||
HelpExampleCli("createrawtransaction", | HelpExampleCli("createrawtransaction", | ||||
"\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]" | "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]" | ||||
"\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"") + | "\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"") + | ||||
"\nConvert the transaction to a PSBT\n" + | "\nConvert the transaction to a PSBT\n" + | ||||
HelpExampleCli("converttopsbt", "\"rawtransaction\"")}, | HelpExampleCli("converttopsbt", "\"rawtransaction\"")}, | ||||
} | } | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
{"desc", RPCArg::Type::STR, RPCArg::Optional::NO, | {"desc", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
"An output descriptor"}, | "An output descriptor"}, | ||||
{"range", RPCArg::Type::RANGE, "1000", | {"range", RPCArg::Type::RANGE, "1000", | ||||
"Up to what index HD chains should be explored (either " | "Up to what index HD chains should be explored (either " | ||||
"end or [begin,end])"}, | "end or [begin,end])"}, | ||||
}}, | }}, | ||||
}}, | }}, | ||||
}, | }, | ||||
RPCResult{" \"psbt\" (string) The base64-encoded " | RPCResult{RPCResult::Type::STR, "", | ||||
"partially signed transaction with inputs updated\n"}, | "The base64-encoded partially signed transaction with inputs " | ||||
"updated"}, | |||||
RPCExamples{HelpExampleCli("utxoupdatepsbt", "\"psbt\"")}} | RPCExamples{HelpExampleCli("utxoupdatepsbt", "\"psbt\"")}} | ||||
.Check(request); | .Check(request); | ||||
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR}, true); | RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR}, true); | ||||
// Unserialize the transactions | // Unserialize the transactions | ||||
PartiallySignedTransaction psbtx; | PartiallySignedTransaction psbtx; | ||||
std::string error; | std::string error; | ||||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | RPCHelpMan{ | ||||
"into one PSBT with inputs and outputs from all of the PSBTs\n" | "into one PSBT with inputs and outputs from all of the PSBTs\n" | ||||
"No input in any of the PSBTs can be in more than one of the PSBTs.\n", | "No input in any of the PSBTs can be in more than one of the PSBTs.\n", | ||||
{{"txs", | {{"txs", | ||||
RPCArg::Type::ARR, | RPCArg::Type::ARR, | ||||
RPCArg::Optional::NO, | RPCArg::Optional::NO, | ||||
"A json array of base64 strings of partially signed transactions", | "A json array of base64 strings of partially signed transactions", | ||||
{{"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, | {{"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
"A base64 string of a PSBT"}}}}, | "A base64 string of a PSBT"}}}}, | ||||
RPCResult{" \"psbt\" (string) The base64-encoded partially " | RPCResult{RPCResult::Type::STR, "", | ||||
"signed transaction\n"}, | "The base64-encoded partially signed transaction"}, | ||||
RPCExamples{HelpExampleCli("joinpsbts", "\"psbt\"")}} | RPCExamples{HelpExampleCli("joinpsbts", "\"psbt\"")}} | ||||
.Check(request); | .Check(request); | ||||
RPCTypeCheck(request.params, {UniValue::VARR}, true); | RPCTypeCheck(request.params, {UniValue::VARR}, true); | ||||
// Unserialize the transactions | // Unserialize the transactions | ||||
std::vector<PartiallySignedTransaction> psbtxs; | std::vector<PartiallySignedTransaction> psbtxs; | ||||
UniValue txs = request.params[0].get_array(); | UniValue txs = request.params[0].get_array(); | ||||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | |||||
UniValue analyzepsbt(const Config &config, const JSONRPCRequest &request) { | UniValue analyzepsbt(const Config &config, const JSONRPCRequest &request) { | ||||
RPCHelpMan{ | RPCHelpMan{ | ||||
"analyzepsbt", | "analyzepsbt", | ||||
"Analyzes and provides information about the current status of a " | "Analyzes and provides information about the current status of a " | ||||
"PSBT and its inputs\n", | "PSBT and its inputs\n", | ||||
{{"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, | {{"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, | ||||
"A base64 string of a PSBT"}}, | "A base64 string of a PSBT"}}, | ||||
RPCResult{ | RPCResult{ | ||||
"{\n" | RPCResult::Type::OBJ, | ||||
" \"inputs\" : [ (array of json objects)\n" | "", | ||||
" {\n" | "", | ||||
" \"has_utxo\" : true|false (boolean) Whether a UTXO is " | { | ||||
"provided\n" | {RPCResult::Type::ARR, | ||||
" \"is_final\" : true|false (boolean) Whether the input " | "inputs", | ||||
"is finalized\n" | "", | ||||
" \"missing\" : { (json object, optional) " | { | ||||
"Things that are missing that are required to complete this input\n" | {RPCResult::Type::OBJ, | ||||
" \"pubkeys\" : [ (array), optional\n" | "", | ||||
" \"keyid\" (string) Public key ID, " | "", | ||||
"hash160 of the public key, of a public key whose BIP 32 " | { | ||||
"derivation path is missing\n" | {RPCResult::Type::BOOL, "has_utxo", | ||||
" ]\n" | "Whether a UTXO is provided"}, | ||||
" \"signatures\" : [ (array), optional\n" | {RPCResult::Type::BOOL, "is_final", | ||||
" \"keyid\" (string) Public key ID, " | "Whether the input is finalized"}, | ||||
"hash160 of the public key, of a public key whose signature is " | {RPCResult::Type::OBJ, | ||||
"missing\n" | "missing", | ||||
" ]\n" | /* optional */ true, | ||||
" \"redeemscript\" : \"hash\" (string, optional) Hash160 " | "Things that are missing that are required to " | ||||
"of the redeemScript that is missing\n" | "complete this input", | ||||
" }\n" | { | ||||
" \"next\" : \"role\" (string, optional) Role of " | {RPCResult::Type::ARR, | ||||
"the next person that this input needs to go to\n" | "pubkeys", | ||||
" }\n" | /* optional */ true, | ||||
" ,...\n" | "", | ||||
" ]\n" | { | ||||
" \"estimated_vsize\" : vsize (numeric, optional) Estimated " | {RPCResult::Type::STR_HEX, "keyid", | ||||
"vsize of the final signed transaction\n" | "Public key ID, hash160 of the public " | ||||
" \"estimated_feerate\" : feerate (numeric, optional) Estimated " | "key, of a public key whose BIP 32 " | ||||
"feerate of the final signed transaction in " + | "derivation path is missing"}, | ||||
}}, | |||||
{RPCResult::Type::ARR, | |||||
"signatures", | |||||
/* optional */ true, | |||||
"", | |||||
{ | |||||
{RPCResult::Type::STR_HEX, "keyid", | |||||
"Public key ID, hash160 of the public " | |||||
"key, of a public key whose signature is " | |||||
"missing"}, | |||||
}}, | |||||
{RPCResult::Type::STR_HEX, "redeemscript", | |||||
/* optional */ true, | |||||
"Hash160 of the redeemScript that is missing"}, | |||||
}}, | |||||
{RPCResult::Type::STR, "next", /* optional */ true, | |||||
"Role of the next person that this input needs to " | |||||
"go to"}, | |||||
}}, | |||||
}}, | |||||
{RPCResult::Type::NUM, "estimated_vsize", /* optional */ true, | |||||
"Estimated vsize of the final signed transaction"}, | |||||
{RPCResult::Type::STR_AMOUNT, "estimated_feerate", | |||||
/* optional */ true, | |||||
"Estimated feerate of the final signed transaction in " + | |||||
CURRENCY_UNIT + | CURRENCY_UNIT + | ||||
"/kB. Shown only if all UTXO slots in the PSBT have been filled.\n" | "/kB. Shown only if all UTXO slots in the PSBT have been " | ||||
" \"fee\" : fee (numeric, optional) The " | "filled"}, | ||||
"transaction fee paid. Shown only if all UTXO slots in the PSBT " | {RPCResult::Type::STR_AMOUNT, "fee", /* optional */ true, | ||||
"have been filled.\n" | "The transaction fee paid. Shown only if all UTXO slots in " | ||||
" \"next\" : \"role\" (string) Role of the next " | "the PSBT have been filled"}, | ||||
"person that this psbt needs to go to\n" | {RPCResult::Type::STR, "next", | ||||
" \"error\" : \"error\" (string) Error message if " | "Role of the next person that this psbt needs to go to"}, | ||||
"there is one" | {RPCResult::Type::STR, "error", | ||||
"}\n"}, | "Error message if there is one"}, | ||||
}}, | |||||
RPCExamples{HelpExampleCli("analyzepsbt", "\"psbt\"")}} | RPCExamples{HelpExampleCli("analyzepsbt", "\"psbt\"")}} | ||||
.Check(request); | .Check(request); | ||||
RPCTypeCheck(request.params, {UniValue::VSTR}); | RPCTypeCheck(request.params, {UniValue::VSTR}); | ||||
// Unserialize the transaction | // Unserialize the transaction | ||||
PartiallySignedTransaction psbtx; | PartiallySignedTransaction psbtx; | ||||
std::string error; | std::string error; | ||||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |