Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 4,828 Lines • ▼ Show 20 Lines | static UniValue walletcreatefundedpsbt(const Config &config, | ||||
UniValue result(UniValue::VOBJ); | UniValue result(UniValue::VOBJ); | ||||
result.pushKV("psbt", EncodeBase64(ssTx.str())); | result.pushKV("psbt", EncodeBase64(ssTx.str())); | ||||
result.pushKV("fee", ValueFromAmount(fee)); | result.pushKV("fee", ValueFromAmount(fee)); | ||||
result.pushKV("changepos", change_position); | result.pushKV("changepos", change_position); | ||||
return result; | return result; | ||||
} | } | ||||
static UniValue upgradewallet(const Config &config, | |||||
const JSONRPCRequest &request) { | |||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | |||||
CWallet *const pwallet = wallet.get(); | |||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | |||||
return NullUniValue; | |||||
} | |||||
RPCHelpMan{"upgradewallet", | |||||
"\nUpgrade the wallet. Upgrades to the latest version if no " | |||||
"version number is specified\n" | |||||
"New keys may be generated and a new wallet backup will need to " | |||||
"be made.", | |||||
{{"version", RPCArg::Type::NUM, | |||||
/* default */ strprintf("%d", FEATURE_LATEST), | |||||
"The version number to upgrade to. Default is the latest " | |||||
"wallet version"}}, | |||||
RPCResults{}, | |||||
RPCExamples{HelpExampleCli("upgradewallet", "200300") + | |||||
HelpExampleRpc("upgradewallet", "200300")}} | |||||
.Check(request); | |||||
RPCTypeCheck(request.params, {UniValue::VNUM}, true); | |||||
EnsureWalletIsUnlocked(pwallet); | |||||
int version = 0; | |||||
if (!request.params[0].isNull()) { | |||||
version = request.params[0].get_int(); | |||||
} | |||||
bilingual_str error; | |||||
std::vector<bilingual_str> warnings; | |||||
if (!pwallet->UpgradeWallet(version, error, warnings)) { | |||||
throw JSONRPCError(RPC_WALLET_ERROR, error.original); | |||||
} | |||||
return error.original; | |||||
} | |||||
// clang-format off | // clang-format off | ||||
static const CRPCCommand commands[] = { | static const CRPCCommand commands[] = { | ||||
// category name actor (function) argNames | // category name actor (function) argNames | ||||
// ------------------- ------------------------ ---------------------- ---------- | // ------------------- ------------------------ ---------------------- ---------- | ||||
{ "rawtransactions", "fundrawtransaction", fundrawtransaction, {"hexstring","options"} }, | { "rawtransactions", "fundrawtransaction", fundrawtransaction, {"hexstring","options"} }, | ||||
{ "wallet", "abandontransaction", abandontransaction, {"txid"} }, | { "wallet", "abandontransaction", abandontransaction, {"txid"} }, | ||||
{ "wallet", "addmultisigaddress", addmultisigaddress, {"nrequired","keys","label"} }, | { "wallet", "addmultisigaddress", addmultisigaddress, {"nrequired","keys","label"} }, | ||||
{ "wallet", "backupwallet", backupwallet, {"destination"} }, | { "wallet", "backupwallet", backupwallet, {"destination"} }, | ||||
Show All 28 Lines | static const CRPCCommand commands[] = { | ||||
{ "wallet", "sendtoaddress", sendtoaddress, {"address","amount","comment","comment_to","subtractfeefromamount","avoid_reuse"} }, | { "wallet", "sendtoaddress", sendtoaddress, {"address","amount","comment","comment_to","subtractfeefromamount","avoid_reuse"} }, | ||||
{ "wallet", "sethdseed", sethdseed, {"newkeypool","seed"} }, | { "wallet", "sethdseed", sethdseed, {"newkeypool","seed"} }, | ||||
{ "wallet", "setlabel", setlabel, {"address","label"} }, | { "wallet", "setlabel", setlabel, {"address","label"} }, | ||||
{ "wallet", "settxfee", settxfee, {"amount"} }, | { "wallet", "settxfee", settxfee, {"amount"} }, | ||||
{ "wallet", "setwalletflag", setwalletflag, {"flag","value"} }, | { "wallet", "setwalletflag", setwalletflag, {"flag","value"} }, | ||||
{ "wallet", "signmessage", signmessage, {"address","message"} }, | { "wallet", "signmessage", signmessage, {"address","message"} }, | ||||
{ "wallet", "signrawtransactionwithwallet", signrawtransactionwithwallet, {"hextring","prevtxs","sighashtype"} }, | { "wallet", "signrawtransactionwithwallet", signrawtransactionwithwallet, {"hextring","prevtxs","sighashtype"} }, | ||||
{ "wallet", "unloadwallet", unloadwallet, {"wallet_name"} }, | { "wallet", "unloadwallet", unloadwallet, {"wallet_name"} }, | ||||
{ "wallet", "upgradewallet", upgradewallet, {"version"} }, | |||||
{ "wallet", "walletcreatefundedpsbt", walletcreatefundedpsbt, {"inputs","outputs","locktime","options","bip32derivs"} }, | { "wallet", "walletcreatefundedpsbt", walletcreatefundedpsbt, {"inputs","outputs","locktime","options","bip32derivs"} }, | ||||
{ "wallet", "walletlock", walletlock, {} }, | { "wallet", "walletlock", walletlock, {} }, | ||||
{ "wallet", "walletpassphrase", walletpassphrase, {"passphrase","timeout"} }, | { "wallet", "walletpassphrase", walletpassphrase, {"passphrase","timeout"} }, | ||||
{ "wallet", "walletpassphrasechange", walletpassphrasechange, {"oldpassphrase","newpassphrase"} }, | { "wallet", "walletpassphrasechange", walletpassphrasechange, {"oldpassphrase","newpassphrase"} }, | ||||
{ "wallet", "walletprocesspsbt", walletprocesspsbt, {"psbt","sign","sighashtype","bip32derivs"} }, | { "wallet", "walletprocesspsbt", walletprocesspsbt, {"psbt","sign","sighashtype","bip32derivs"} }, | ||||
}; | }; | ||||
// clang-format on | // clang-format on | ||||
Show All 9 Lines |