Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 522 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 2 || | ||||
"sendtoaddress", | "sendtoaddress", | ||||
"\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1 \"\" \"\" true") + | "\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\" 0.1 \"\" \"\" true") + | ||||
HelpExampleRpc("sendtoaddress", "\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvay" | HelpExampleRpc("sendtoaddress", "\"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvay" | ||||
"dd\", 0.1, \"donation\", \"seans " | "dd\", 0.1, \"donation\", \"seans " | ||||
"outpost\"")); | "outpost\"")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
CTxDestination dest = | CTxDestination dest = | ||||
DecodeDestination(request.params[0].get_str(), config.GetChainParams()); | DecodeDestination(request.params[0].get_str(), config.GetChainParams()); | ||||
if (!IsValidDestination(dest)) { | if (!IsValidDestination(dest)) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address"); | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | if (request.fHelp) { | ||||
" ,...\n" | " ,...\n" | ||||
"]\n" | "]\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("listaddressgroupings", "") + | HelpExampleCli("listaddressgroupings", "") + | ||||
HelpExampleRpc("listaddressgroupings", "")); | HelpExampleRpc("listaddressgroupings", "")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
UniValue jsonGroupings(UniValue::VARR); | UniValue jsonGroupings(UniValue::VARR); | ||||
std::map<CTxDestination, Amount> balances = pwallet->GetAddressBalances(); | std::map<CTxDestination, Amount> balances = pwallet->GetAddressBalances(); | ||||
for (const std::set<CTxDestination> &grouping : | for (const std::set<CTxDestination> &grouping : | ||||
pwallet->GetAddressGroupings()) { | pwallet->GetAddressGroupings()) { | ||||
UniValue jsonGrouping(UniValue::VARR); | UniValue jsonGrouping(UniValue::VARR); | ||||
for (const CTxDestination &address : grouping) { | for (const CTxDestination &address : grouping) { | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
"\nExamples:\n" | "\nExamples:\n" | ||||
"\nThe amount from transactions with at least 1 confirmation\n" + | "\nThe amount from transactions with at least 1 confirmation\n" + | ||||
HelpExampleCli("getreceivedbyaddress", | HelpExampleCli("getreceivedbyaddress", | ||||
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\"") + | "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\"") + | ||||
"\nThe amount including unconfirmed transactions, zero " | "\nThe amount including unconfirmed transactions, zero " | ||||
"confirmations\n" + | "confirmations\n" + | ||||
HelpExampleCli("getreceivedbyaddress", | HelpExampleCli("getreceivedbyaddress", | ||||
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" 0") + | "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" 0") + | ||||
"\nThe amount with at least 6 confirmation, very safe\n" + | "\nThe amount with at least 6 confirmations\n" + | ||||
HelpExampleCli("getreceivedbyaddress", | HelpExampleCli("getreceivedbyaddress", | ||||
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" 6") + | "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" 6") + | ||||
"\nAs a json rpc call\n" + | "\nAs a json rpc call\n" + | ||||
HelpExampleRpc("getreceivedbyaddress", | HelpExampleRpc("getreceivedbyaddress", | ||||
"\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\", 6")); | "\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\", 6")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
// Bitcoin address | // Bitcoin address | ||||
CTxDestination dest = | CTxDestination dest = | ||||
DecodeDestination(request.params[0].get_str(), config.GetChainParams()); | DecodeDestination(request.params[0].get_str(), config.GetChainParams()); | ||||
if (!IsValidDestination(dest)) { | if (!IsValidDestination(dest)) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
"Invalid Bitcoin address"); | "Invalid Bitcoin address"); | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
"amounts with zero confirmations\n" + | "amounts with zero confirmations\n" + | ||||
HelpExampleCli("getreceivedbylabel", "\"tabby\" 0") + | HelpExampleCli("getreceivedbylabel", "\"tabby\" 0") + | ||||
"\nThe amount with at least 6 confirmations\n" + | "\nThe amount with at least 6 confirmations\n" + | ||||
HelpExampleCli("getreceivedbylabel", "\"tabby\" 6") + | HelpExampleCli("getreceivedbylabel", "\"tabby\" 6") + | ||||
"\nAs a json rpc call\n" + | "\nAs a json rpc call\n" + | ||||
HelpExampleRpc("getreceivedbylabel", "\"tabby\", 6")); | HelpExampleRpc("getreceivedbylabel", "\"tabby\", 6")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
// Minimum confirmations | // Minimum confirmations | ||||
int nMinDepth = 1; | int nMinDepth = 1; | ||||
if (request.params.size() > 1) { | if (request.params.size() > 1) { | ||||
nMinDepth = request.params[1].get_int(); | nMinDepth = request.params[1].get_int(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() > 3) { | ||||
"transactions confirmed at least this many times.\n" | "transactions confirmed at least this many times.\n" | ||||
"3. include_watchonly (bool, optional, default=false) Also include " | "3. include_watchonly (bool, optional, default=false) Also include " | ||||
"balance in watch-only addresses (see 'importaddress')\n" | "balance in watch-only addresses (see 'importaddress')\n" | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"amount (numeric) The total amount in " + | "amount (numeric) The total amount in " + | ||||
CURRENCY_UNIT + | CURRENCY_UNIT + | ||||
" received for this account.\n" | " received for this account.\n" | ||||
"\nExamples:\n" | "\nExamples:\n" | ||||
"\nThe total amount in the wallet\n" + | "\nThe total amount in the wallet with 1 or more confirmations\n" + | ||||
HelpExampleCli("getbalance", "") + | HelpExampleCli("getbalance", "") + | ||||
"\nThe total amount in the wallet at least 5 blocks confirmed\n" + | "\nThe total amount in the wallet at least 6 blocks confirmed\n" + | ||||
HelpExampleCli("getbalance", "\"*\" 6") + "\nAs a json rpc call\n" + | HelpExampleCli("getbalance", "\"*\" 6") + "\nAs a json rpc call\n" + | ||||
HelpExampleRpc("getbalance", "\"*\", 6")); | HelpExampleRpc("getbalance", "\"*\", 6")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
if (request.params.size() == 0) { | if (request.params.size() == 0) { | ||||
return ValueFromAmount(pwallet->GetBalance()); | return ValueFromAmount(pwallet->GetBalance()); | ||||
} | } | ||||
const std::string *account = request.params[0].get_str() != "*" | const std::string *account = request.params[0].get_str() != "*" | ||||
? &request.params[0].get_str() | ? &request.params[0].get_str() | ||||
Show All 22 Lines | static UniValue getunconfirmedbalance(const Config &config, | ||||
if (request.fHelp || request.params.size() > 0) { | if (request.fHelp || request.params.size() > 0) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"getunconfirmedbalance\n" | "getunconfirmedbalance\n" | ||||
"Returns the server's total unconfirmed balance\n"); | "Returns the server's total unconfirmed balance\n"); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
return ValueFromAmount(pwallet->GetUnconfirmedBalance()); | return ValueFromAmount(pwallet->GetUnconfirmedBalance()); | ||||
} | } | ||||
static UniValue movecmd(const Config &config, const JSONRPCRequest &request) { | static UniValue movecmd(const Config &config, const JSONRPCRequest &request) { | ||||
CWallet *const pwallet = GetWalletForJSONRPCRequest(request); | CWallet *const pwallet = GetWalletForJSONRPCRequest(request); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 3 || | ||||
"0.01 6 \"donation\" \"seans outpost\"") + | "0.01 6 \"donation\" \"seans outpost\"") + | ||||
"\nAs a json rpc call\n" + | "\nAs a json rpc call\n" + | ||||
HelpExampleRpc("sendfrom", | HelpExampleRpc("sendfrom", | ||||
"\"tabby\", \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", " | "\"tabby\", \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\", " | ||||
"0.01, 6, \"donation\", \"seans outpost\"")); | "0.01, 6, \"donation\", \"seans outpost\"")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
std::string label = LabelFromValue(request.params[0]); | std::string label = LabelFromValue(request.params[0]); | ||||
CTxDestination dest = | CTxDestination dest = | ||||
DecodeDestination(request.params[1].get_str(), config.GetChainParams()); | DecodeDestination(request.params[1].get_str(), config.GetChainParams()); | ||||
if (!IsValidDestination(dest)) { | if (!IsValidDestination(dest)) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
"Invalid Bitcoin address"); | "Invalid Bitcoin address"); | ||||
▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 2 || | ||||
HelpExampleRpc("sendmany", | HelpExampleRpc("sendmany", | ||||
"\"\", " | "\"\", " | ||||
"\"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\\\":0.01," | "\"{\\\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\\\":0.01," | ||||
"\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\"," | "\\\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\\\":0.02}\"," | ||||
" 6, \"testing\"")); | " 6, \"testing\"")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
if (pwallet->GetBroadcastTransactions() && !g_connman) { | if (pwallet->GetBroadcastTransactions() && !g_connman) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_CLIENT_P2P_DISABLED, | RPC_CLIENT_P2P_DISABLED, | ||||
"Error: Peer-to-peer functionality missing or disabled"); | "Error: Peer-to-peer functionality missing or disabled"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 367 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() > 4) { | ||||
HelpExampleCli("listreceivedbyaddress", "6 true") + | HelpExampleCli("listreceivedbyaddress", "6 true") + | ||||
HelpExampleRpc("listreceivedbyaddress", "6, true, true") + | HelpExampleRpc("listreceivedbyaddress", "6, true, true") + | ||||
HelpExampleRpc( | HelpExampleRpc( | ||||
"listreceivedbyaddress", | "listreceivedbyaddress", | ||||
"6, true, true, \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\"")); | "6, true, true, \"1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd\"")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
return ListReceived(config, pwallet, request.params, false); | return ListReceived(config, pwallet, request.params, false); | ||||
} | } | ||||
UniValue listreceivedbylabel(const Config &config, | UniValue listreceivedbylabel(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
CWallet *const pwallet = GetWalletForJSONRPCRequest(request); | CWallet *const pwallet = GetWalletForJSONRPCRequest(request); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
Show All 31 Lines | if (request.fHelp || request.params.size() > 3) { | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("listreceivedbylabel", "") + | HelpExampleCli("listreceivedbylabel", "") + | ||||
HelpExampleCli("listreceivedbylabel", "6 true") + | HelpExampleCli("listreceivedbylabel", "6 true") + | ||||
HelpExampleRpc("listreceivedbylabel", "6, true, true")); | HelpExampleRpc("listreceivedbylabel", "6, true, true")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
return ListReceived(config, pwallet, request.params, true); | return ListReceived(config, pwallet, request.params, true); | ||||
} | } | ||||
static void MaybePushAddress(UniValue &entry, const CTxDestination &dest) { | static void MaybePushAddress(UniValue &entry, const CTxDestination &dest) { | ||||
if (IsValidDestination(dest)) { | if (IsValidDestination(dest)) { | ||||
entry.pushKV("address", EncodeDestination(dest)); | entry.pushKV("address", EncodeDestination(dest)); | ||||
▲ Show 20 Lines • Show All 199 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() > 4) { | ||||
HelpExampleCli("listtransactions", "") + | HelpExampleCli("listtransactions", "") + | ||||
"\nList transactions 100 to 120\n" + | "\nList transactions 100 to 120\n" + | ||||
HelpExampleCli("listtransactions", "\"*\" 20 100") + | HelpExampleCli("listtransactions", "\"*\" 20 100") + | ||||
"\nAs a json rpc call\n" + | "\nAs a json rpc call\n" + | ||||
HelpExampleRpc("listtransactions", "\"*\", 20, 100")); | HelpExampleRpc("listtransactions", "\"*\", 20, 100")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
std::string strAccount = "*"; | std::string strAccount = "*"; | ||||
if (request.params.size() > 0) { | if (request.params.size() > 0) { | ||||
strAccount = request.params[0].get_str(); | strAccount = request.params[0].get_str(); | ||||
} | } | ||||
int nCount = 10; | int nCount = 10; | ||||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() > 2) { | ||||
"transactions\n" + | "transactions\n" + | ||||
HelpExampleCli("listaccounts", "0") + | HelpExampleCli("listaccounts", "0") + | ||||
"\nList account balances for 6 or more confirmations\n" + | "\nList account balances for 6 or more confirmations\n" + | ||||
HelpExampleCli("listaccounts", "6") + "\nAs json rpc call\n" + | HelpExampleCli("listaccounts", "6") + "\nAs json rpc call\n" + | ||||
HelpExampleRpc("listaccounts", "6")); | HelpExampleRpc("listaccounts", "6")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
int nMinDepth = 1; | int nMinDepth = 1; | ||||
if (request.params.size() > 0) { | if (request.params.size() > 0) { | ||||
nMinDepth = request.params[0].get_int(); | nMinDepth = request.params[0].get_int(); | ||||
} | } | ||||
isminefilter includeWatchonly = ISMINE_SPENDABLE; | isminefilter includeWatchonly = ISMINE_SPENDABLE; | ||||
▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | if (request.fHelp) { | ||||
"5ef753ee9a7d38571037cdb1a57f663ad" | "5ef753ee9a7d38571037cdb1a57f663ad" | ||||
"\" 6") + | "\" 6") + | ||||
HelpExampleRpc("listsinceblock", "\"000000000000000bacf66f7497b7dc4" | HelpExampleRpc("listsinceblock", "\"000000000000000bacf66f7497b7dc4" | ||||
"5ef753ee9a7d38571037cdb1a57f663ad" | "5ef753ee9a7d38571037cdb1a57f663ad" | ||||
"\", 6")); | "\", 6")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
const CBlockIndex *pindex = nullptr; | const CBlockIndex *pindex = nullptr; | ||||
int target_confirms = 1; | int target_confirms = 1; | ||||
isminefilter filter = ISMINE_SPENDABLE; | isminefilter filter = ISMINE_SPENDABLE; | ||||
if (request.params.size() > 0) { | if (request.params.size() > 0) { | ||||
uint256 blockId; | uint256 blockId; | ||||
▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
"5b9345e16c5cf302fc80e9d5fbf5d48d" | "5b9345e16c5cf302fc80e9d5fbf5d48d" | ||||
"\" true") + | "\" true") + | ||||
HelpExampleRpc("gettransaction", "\"1075db55d416d3ca199f55b6084e211" | HelpExampleRpc("gettransaction", "\"1075db55d416d3ca199f55b6084e211" | ||||
"5b9345e16c5cf302fc80e9d5fbf5d48d" | "5b9345e16c5cf302fc80e9d5fbf5d48d" | ||||
"\"")); | "\"")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
TxId txid; | TxId txid; | ||||
txid.SetHex(request.params[0].get_str()); | txid.SetHex(request.params[0].get_str()); | ||||
isminefilter filter = ISMINE_SPENDABLE; | isminefilter filter = ISMINE_SPENDABLE; | ||||
if (request.params.size() > 1 && request.params[1].get_bool()) { | if (request.params.size() > 1 && request.params[1].get_bool()) { | ||||
filter = filter | ISMINE_WATCH_ONLY; | filter = filter | ISMINE_WATCH_ONLY; | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
"e2115b9345e16c5cf302fc80e9d5f" | "e2115b9345e16c5cf302fc80e9d5f" | ||||
"bf5d48d\"") + | "bf5d48d\"") + | ||||
HelpExampleRpc("abandontransaction", "\"1075db55d416d3ca199f55b6084" | HelpExampleRpc("abandontransaction", "\"1075db55d416d3ca199f55b6084" | ||||
"e2115b9345e16c5cf302fc80e9d5f" | "e2115b9345e16c5cf302fc80e9d5f" | ||||
"bf5d48d\"")); | "bf5d48d\"")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
TxId txid; | TxId txid; | ||||
txid.SetHex(request.params[0].get_str()); | txid.SetHex(request.params[0].get_str()); | ||||
if (!pwallet->mapWallet.count(txid)) { | if (!pwallet->mapWallet.count(txid)) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
"Invalid or non-wallet transaction id"); | "Invalid or non-wallet transaction id"); | ||||
Show All 21 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
"a directory or a path with filename.\n" | "a directory or a path with filename.\n" | ||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"destination\" (string) The destination directory or file\n" | "1. \"destination\" (string) The destination directory or file\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("backupwallet", "\"backup.dat\"") + | HelpExampleCli("backupwallet", "\"backup.dat\"") + | ||||
HelpExampleRpc("backupwallet", "\"backup.dat\"")); | HelpExampleRpc("backupwallet", "\"backup.dat\"")); | ||||
} | } | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
std::string strDest = request.params[0].get_str(); | std::string strDest = request.params[0].get_str(); | ||||
if (!pwallet->BackupWallet(strDest)) { | if (!pwallet->BackupWallet(strDest)) { | ||||
throw JSONRPCError(RPC_WALLET_ERROR, "Error: Wallet backup failed!"); | throw JSONRPCError(RPC_WALLET_ERROR, "Error: Wallet backup failed!"); | ||||
} | } | ||||
return NullUniValue; | return NullUniValue; | ||||
▲ Show 20 Lines • Show All 368 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
"\nAs a json rpc call\n" + | "\nAs a json rpc call\n" + | ||||
HelpExampleRpc("lockunspent", "false, " | HelpExampleRpc("lockunspent", "false, " | ||||
"\"[{\\\"txid\\\":" | "\"[{\\\"txid\\\":" | ||||
"\\\"a08e6907dbbd3d809776dbfc5d82e371" | "\\\"a08e6907dbbd3d809776dbfc5d82e371" | ||||
"b764ed838b5655e72f463568df1aadf0\\\"" | "b764ed838b5655e72f463568df1aadf0\\\"" | ||||
",\\\"vout\\\":1}]\"")); | ",\\\"vout\\\":1}]\"")); | ||||
} | } | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
if (request.params.size() == 1) { | if (request.params.size() == 1) { | ||||
RPCTypeCheck(request.params, {UniValue::VBOOL}); | RPCTypeCheck(request.params, {UniValue::VBOOL}); | ||||
} else { | } else { | ||||
RPCTypeCheck(request.params, {UniValue::VBOOL, UniValue::VARR}); | RPCTypeCheck(request.params, {UniValue::VBOOL, UniValue::VARR}); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 0) { | ||||
"the Hash160 of the HD master pubkey\n" | "the Hash160 of the HD master pubkey\n" | ||||
"}\n" | "}\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("getwalletinfo", "") + | HelpExampleCli("getwalletinfo", "") + | ||||
HelpExampleRpc("getwalletinfo", "")); | HelpExampleRpc("getwalletinfo", "")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
UniValue obj(UniValue::VOBJ); | UniValue obj(UniValue::VOBJ); | ||||
size_t kpExternalSize = pwallet->KeypoolCountExternalKeys(); | size_t kpExternalSize = pwallet->KeypoolCountExternalKeys(); | ||||
obj.pushKV("walletname", pwallet->GetName()); | obj.pushKV("walletname", pwallet->GetName()); | ||||
obj.pushKV("walletversion", pwallet->GetVersion()); | obj.pushKV("walletversion", pwallet->GetVersion()); | ||||
obj.pushKV("balance", ValueFromAmount(pwallet->GetBalance())); | obj.pushKV("balance", ValueFromAmount(pwallet->GetBalance())); | ||||
▲ Show 20 Lines • Show All 252 Lines • ▼ Show 20 Lines | if (!request.params[4].isNull()) { | ||||
nMinimumSumAmount = AmountFromValue(options["minimumSumAmount"]); | nMinimumSumAmount = AmountFromValue(options["minimumSumAmount"]); | ||||
} | } | ||||
if (options.exists("maximumCount")) { | if (options.exists("maximumCount")) { | ||||
nMaximumCount = options["maximumCount"].get_int64(); | nMaximumCount = options["maximumCount"].get_int64(); | ||||
} | } | ||||
} | } | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
UniValue results(UniValue::VARR); | UniValue results(UniValue::VARR); | ||||
std::vector<COutput> vecOutputs; | std::vector<COutput> vecOutputs; | ||||
assert(pwallet != nullptr); | assert(pwallet != nullptr); | ||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
pwallet->AvailableCoins(vecOutputs, !include_unsafe, nullptr, | pwallet->AvailableCoins(vecOutputs, !include_unsafe, nullptr, | ||||
nMinimumAmount, nMaximumAmount, nMinimumSumAmount, | nMinimumAmount, nMaximumAmount, nMinimumSumAmount, | ||||
nMaximumCount, nMinDepth, nMaxDepth); | nMaximumCount, nMinDepth, nMaxDepth); | ||||
▲ Show 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
HelpExampleCli("signrawtransaction", "\"fundedtransactionhex\"") + | HelpExampleCli("signrawtransaction", "\"fundedtransactionhex\"") + | ||||
"\nSend the transaction\n" + | "\nSend the transaction\n" + | ||||
HelpExampleCli("sendrawtransaction", "\"signedtransactionhex\"")); | HelpExampleCli("sendrawtransaction", "\"signedtransactionhex\"")); | ||||
} | } | ||||
ObserveSafeMode(); | ObserveSafeMode(); | ||||
RPCTypeCheck(request.params, {UniValue::VSTR}); | RPCTypeCheck(request.params, {UniValue::VSTR}); | ||||
// Make sure the results are valid at least up to the most recent block | |||||
// the user could have gotten from another RPC command prior to now | |||||
pwallet->BlockUntilSyncedToCurrentChain(); | |||||
CTxDestination changeAddress = CNoDestination(); | CTxDestination changeAddress = CNoDestination(); | ||||
int changePosition = -1; | int changePosition = -1; | ||||
bool includeWatching = false; | bool includeWatching = false; | ||||
bool lockUnspents = false; | bool lockUnspents = false; | ||||
bool reserveChangeKey = true; | bool reserveChangeKey = true; | ||||
CFeeRate feeRate = CFeeRate(Amount::zero()); | CFeeRate feeRate = CFeeRate(Amount::zero()); | ||||
bool overrideEstimatedFeerate = false; | bool overrideEstimatedFeerate = false; | ||||
UniValue subtractFeeFromOutputs; | UniValue subtractFeeFromOutputs; | ||||
▲ Show 20 Lines • Show All 311 Lines • Show Last 20 Lines |