MCPcopy Create free account
hub / github.com/ElementsProject/elements / fundrawtransaction

Function fundrawtransaction

src/wallet/rpc/spend.cpp:733–844  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

731}
732
733RPCHelpMan fundrawtransaction()
734{
735 return RPCHelpMan{"fundrawtransaction",
736 "\nIf the transaction has no inputs, they will be automatically selected to meet its out value.\n"
737 "It will add at most one change output to the outputs.\n"
738 "No existing outputs will be modified unless \"subtractFeeFromOutputs\" is specified.\n"
739 "Note that inputs which were signed may need to be resigned after completion since in/outputs have been added.\n"
740 "The inputs added will not be signed, use signrawtransactionwithkey\n"
741 "or signrawtransactionwithwallet for that.\n"
742 "All existing inputs must either have their previous output transaction be in the wallet\n"
743 "or be in the UTXO set. Solving data must be provided for non-wallet inputs.\n"
744 "Note that all inputs selected must be of standard form and P2SH scripts must be\n"
745 "in the wallet using importaddress or addmultisigaddress (to calculate fees).\n"
746 "You can see whether this is the case by checking the \"solvable\" field in the listunspent output.\n"
747 "Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only\n",
748 {
749 {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex string of the raw transaction"},
750 {"options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "for backward compatibility: passing in a true instead of an object will result in {\"includeWatching\":true}",
751 Cat<std::vector<RPCArg>>(
752 {
753 {"add_inputs", RPCArg::Type::BOOL, RPCArg::Default{true}, "For a transaction with existing inputs, automatically include more if they are not enough."},
754 {"include_unsafe", RPCArg::Type::BOOL, RPCArg::Default{false}, "Include inputs that are not safe to spend (unconfirmed transactions from outside keys and unconfirmed replacement transactions).\n"
755 "Warning: the resulting transaction may become invalid if one of the unsafe inputs disappears.\n"
756 "If that happens, you will need to fund the transaction with different inputs and republish it."},
757 {"changeAddress", RPCArg::Type::STR, RPCArg::DefaultHint{"pool address"}, "The address to receive the change"},
758 {"changePosition", RPCArg::Type::NUM, RPCArg::DefaultHint{"random"}, "The index of the change output"},
759 {"change_type", RPCArg::Type::STR, RPCArg::DefaultHint{"set by -changetype"}, "The output type to use. Only valid if changeAddress is not specified. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
760 {"includeWatching", RPCArg::Type::BOOL, RPCArg::DefaultHint{"true for watch-only wallets, otherwise false"}, "Also select inputs which are watch only.\n"
761 "Only solvable inputs can be used. Watch-only destinations are solvable if the public key and/or output script was imported,\n"
762 "e.g. with 'importpubkey' or 'importmulti' with the 'pubkeys' or 'desc' field."},
763 {"lockUnspents", RPCArg::Type::BOOL, RPCArg::Default{false}, "Lock selected unspent outputs"},
764 {"fee_rate", RPCArg::Type::AMOUNT, RPCArg::DefaultHint{"not set, fall back to wallet fee estimation"}, "Specify a fee rate in " + CURRENCY_ATOM + "/vB."},
765 {"feeRate", RPCArg::Type::AMOUNT, RPCArg::DefaultHint{"not set, fall back to wallet fee estimation"}, "Specify a fee rate in " + CURRENCY_UNIT + "/kvB."},
766 {"subtractFeeFromOutputs", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "The integers.\n"
767 "The fee will be equally deducted from the amount of each specified output.\n"
768 "Those recipients will receive less coins than you enter in their corresponding amount field.\n"
769 "If no outputs are specified here, the sender pays the fee.",
770 {
771 {"vout_index", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The zero-based output index, before a change output is added."},
772 },
773 },
774 {"input_weights", RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, "Inputs and their corresponding weights",
775 {
776 {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
777 {"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output index"},
778 {"weight", RPCArg::Type::NUM, RPCArg::Optional::NO, "The maximum weight for this input, "
779 "including the weight of the outpoint and sequence number. "
780 "Note that serialized signature sizes are not guaranteed to be consistent, "
781 "so the maximum DER signatures size of 73 bytes should be used when considering ECDSA signatures."
782 "Remember to convert serialized sizes to weight units when necessary."},
783 },
784 },
785 },
786 FundTxDoc()),
787 "options"},
788 {"iswitness", RPCArg::Type::BOOL, RPCArg::DefaultHint{"depends on heuristic tests"}, "Whether the transaction hex is a serialized witness transaction.\n"
789 "If iswitness is not present, heuristic tests will be used in decoding.\n"
790 "If true, only witness deserialization will be tried.\n"

Callers

nothing calls this directly

Calls 14

FundTxDocFunction · 0.85
HelpExampleCliFunction · 0.85
RPCTypeCheckFunction · 0.85
UniValueTypeClass · 0.85
DecodeHexTxFunction · 0.85
JSONRPCErrorFunction · 0.85
FundTransactionFunction · 0.85
EncodeHexTxFunction · 0.85
ValueFromAmountFunction · 0.85
get_boolMethod · 0.80
CTransactionClass · 0.50

Tested by

no test coverage detected