Skip to content

Commit fafff13

Browse files
author
MarcoFalke
committed
doc: Extract FundTxDoc
For the fields: conf_target, estimate_mode, replaceable, and solving_data.
1 parent c6f710e commit fafff13

File tree

1 file changed

+34
-75
lines changed

1 file changed

+34
-75
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 34 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -3177,6 +3177,34 @@ static RPCHelpMan listunspent()
31773177
};
31783178
}
31793179

3180+
// Only includes key documentation where the key is snake_case in all RPC methods. MixedCase keys can be added later.
3181+
static std::vector<RPCArg> FundTxDoc()
3182+
{
3183+
return {
3184+
{"conf_target", RPCArg::Type::NUM, RPCArg::DefaultHint{"wallet -txconfirmtarget"}, "Confirmation target in blocks"},
3185+
{"estimate_mode", RPCArg::Type::STR, RPCArg::Default{"unset"}, std::string() + "The fee estimate mode, must be one of (case insensitive):\n"
3186+
" \"" + FeeModes("\"\n\"") + "\""},
3187+
{"replaceable", RPCArg::Type::BOOL, RPCArg::DefaultHint{"wallet default"}, "Marks this transaction as BIP125 replaceable.\n"
3188+
"Allows this transaction to be replaced by a transaction with higher fees"},
3189+
{"solving_data", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "Keys and scripts needed for producing a final transaction with a dummy signature.\n"
3190+
"Used for fee estimation during coin selection.",
3191+
{
3192+
{"pubkeys", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "Public keys involved in this transaction.",
3193+
{
3194+
{"pubkey", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A public key"},
3195+
}},
3196+
{"scripts", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "Scripts involved in this transaction.",
3197+
{
3198+
{"script", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A script"},
3199+
}},
3200+
{"descriptors", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "Descriptors that provide solving data for this transaction.",
3201+
{
3202+
{"descriptor", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "A descriptor"},
3203+
}},
3204+
}},
3205+
};
3206+
}
3207+
31803208
void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out, int& change_position, const UniValue& options, CCoinControl& coinControl, bool override_min_fee)
31813209
{
31823210
// Make sure the results are valid at least up to the most recent block
@@ -3394,6 +3422,7 @@ static RPCHelpMan fundrawtransaction()
33943422
{
33953423
{"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex string of the raw transaction"},
33963424
{"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}",
3425+
Cat<std::vector<RPCArg>>(
33973426
{
33983427
{"add_inputs", RPCArg::Type::BOOL, RPCArg::Default{true}, "For a transaction with existing inputs, automatically include more if they are not enough."},
33993428
{"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"
@@ -3416,32 +3445,8 @@ static RPCHelpMan fundrawtransaction()
34163445
{"vout_index", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The zero-based output index, before a change output is added."},
34173446
},
34183447
},
3419-
{"replaceable", RPCArg::Type::BOOL, RPCArg::DefaultHint{"wallet default"}, "Marks this transaction as BIP125 replaceable.\n"
3420-
"Allows this transaction to be replaced by a transaction with higher fees"},
3421-
{"conf_target", RPCArg::Type::NUM, RPCArg::DefaultHint{"wallet -txconfirmtarget"}, "Confirmation target in blocks"},
3422-
{"estimate_mode", RPCArg::Type::STR, RPCArg::Default{"unset"}, std::string() + "The fee estimate mode, must be one of (case insensitive):\n"
3423-
" \"" + FeeModes("\"\n\"") + "\""},
3424-
{"solving_data", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "Keys and scripts needed for producing a final transaction with a dummy signature.\n"
3425-
"Used for fee estimation during coin selection.",
3426-
{
3427-
{"pubkeys", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "Public keys involved in this transaction.",
3428-
{
3429-
{"pubkey", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A public key"},
3430-
},
3431-
},
3432-
{"scripts", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "Scripts involved in this transaction.",
3433-
{
3434-
{"script", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A script"},
3435-
},
3436-
},
3437-
{"descriptors", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "Descriptors that provide solving data for this transaction.",
3438-
{
3439-
{"descriptor", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "A descriptor"},
3440-
},
3441-
}
3442-
}
3443-
},
34443448
},
3449+
FundTxDoc()),
34453450
"options"},
34463451
{"iswitness", RPCArg::Type::BOOL, RPCArg::DefaultHint{"depends on heuristic tests"}, "Whether the transaction hex is a serialized witness transaction.\n"
34473452
"If iswitness is not present, heuristic tests will be used in decoding.\n"
@@ -4250,6 +4255,7 @@ static RPCHelpMan send()
42504255
" \"" + FeeModes("\"\n\"") + "\""},
42514256
{"fee_rate", RPCArg::Type::AMOUNT, RPCArg::DefaultHint{"not set, fall back to wallet fee estimation"}, "Specify a fee rate in " + CURRENCY_ATOM + "/vB."},
42524257
{"options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "",
4258+
Cat<std::vector<RPCArg>>(
42534259
{
42544260
{"add_inputs", RPCArg::Type::BOOL, RPCArg::Default{false}, "If inputs are specified, automatically include more if they are not enough."},
42554261
{"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"
@@ -4259,9 +4265,6 @@ static RPCHelpMan send()
42594265
{"change_address", RPCArg::Type::STR_HEX, RPCArg::DefaultHint{"pool address"}, "The bitcoin address to receive the change"},
42604266
{"change_position", RPCArg::Type::NUM, RPCArg::DefaultHint{"random"}, "The index of the change output"},
42614267
{"change_type", RPCArg::Type::STR, RPCArg::DefaultHint{"set by -changetype"}, "The output type to use. Only valid if change_address is not specified. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
4262-
{"conf_target", RPCArg::Type::NUM, RPCArg::DefaultHint{"wallet -txconfirmtarget"}, "Confirmation target in blocks"},
4263-
{"estimate_mode", RPCArg::Type::STR, RPCArg::Default{"unset"}, std::string() + "The fee estimate mode, must be one of (case insensitive):\n"
4264-
" \"" + FeeModes("\"\n\"") + "\""},
42654268
{"fee_rate", RPCArg::Type::AMOUNT, RPCArg::DefaultHint{"not set, fall back to wallet fee estimation"}, "Specify a fee rate in " + CURRENCY_ATOM + "/vB."},
42664269
{"include_watching", RPCArg::Type::BOOL, RPCArg::DefaultHint{"true for watch-only wallets, otherwise false"}, "Also select inputs which are watch only.\n"
42674270
"Only solvable inputs can be used. Watch-only destinations are solvable if the public key and/or output script was imported,\n"
@@ -4284,29 +4287,8 @@ static RPCHelpMan send()
42844287
{"vout_index", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The zero-based output index, before a change output is added."},
42854288
},
42864289
},
4287-
{"replaceable", RPCArg::Type::BOOL, RPCArg::DefaultHint{"wallet default"}, "Marks this transaction as BIP125 replaceable.\n"
4288-
"Allows this transaction to be replaced by a transaction with higher fees"},
4289-
{"solving_data", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "Keys and scripts needed for producing a final transaction with a dummy signature.\n"
4290-
"Used for fee estimation during coin selection.",
4291-
{
4292-
{"pubkeys", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "Public keys involved in this transaction.",
4293-
{
4294-
{"pubkey", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A public key"},
4295-
},
4296-
},
4297-
{"scripts", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "Scripts involved in this transaction.",
4298-
{
4299-
{"script", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A script"},
4300-
},
4301-
},
4302-
{"descriptors", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "Descriptors that provide solving data for this transaction.",
4303-
{
4304-
{"descriptor", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "A descriptor"},
4305-
},
4306-
}
4307-
}
4308-
},
43094290
},
4291+
FundTxDoc()),
43104292
"options"},
43114293
},
43124294
RPCResult{
@@ -4627,6 +4609,7 @@ static RPCHelpMan walletcreatefundedpsbt()
46274609
},
46284610
{"locktime", RPCArg::Type::NUM, RPCArg::Default{0}, "Raw locktime. Non-0 value also locktime-activates inputs"},
46294611
{"options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "",
4612+
Cat<std::vector<RPCArg>>(
46304613
{
46314614
{"add_inputs", RPCArg::Type::BOOL, RPCArg::Default{false}, "If inputs are specified, automatically include more if they are not enough."},
46324615
{"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"
@@ -4647,32 +4630,8 @@ static RPCHelpMan walletcreatefundedpsbt()
46474630
{"vout_index", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The zero-based output index, before a change output is added."},
46484631
},
46494632
},
4650-
{"replaceable", RPCArg::Type::BOOL, RPCArg::DefaultHint{"wallet default"}, "Marks this transaction as BIP125 replaceable.\n"
4651-
"Allows this transaction to be replaced by a transaction with higher fees"},
4652-
{"conf_target", RPCArg::Type::NUM, RPCArg::DefaultHint{"wallet -txconfirmtarget"}, "Confirmation target in blocks"},
4653-
{"estimate_mode", RPCArg::Type::STR, RPCArg::Default{"unset"}, std::string() + "The fee estimate mode, must be one of (case insensitive):\n"
4654-
" \"" + FeeModes("\"\n\"") + "\""},
4655-
{"solving_data", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "Keys and scripts needed for producing a final transaction with a dummy signature.\n"
4656-
"Used for fee estimation during coin selection.",
4657-
{
4658-
{"pubkeys", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "Public keys involved in this transaction.",
4659-
{
4660-
{"pubkey", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A public key"},
4661-
},
4662-
},
4663-
{"scripts", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "Scripts involved in this transaction.",
4664-
{
4665-
{"script", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "A script"},
4666-
},
4667-
},
4668-
{"descriptors", RPCArg::Type::ARR, RPCArg::Default{UniValue::VARR}, "Descriptors that provide solving data for this transaction.",
4669-
{
4670-
{"descriptor", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "A descriptor"},
4671-
},
4672-
}
4673-
}
4674-
},
46754633
},
4634+
FundTxDoc()),
46764635
"options"},
46774636
{"bip32derivs", RPCArg::Type::BOOL, RPCArg::Default{true}, "Include BIP 32 derivation paths for public keys if we know them"},
46784637
},

0 commit comments

Comments
 (0)