Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 234 Lines • ▼ Show 20 Lines | static UniValue getlabeladdress(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (!IsDeprecatedRPCEnabled(gArgs, "accounts") && | |||||
request.strMethod == "getaccountaddress") { | |||||
if (request.fHelp) { | |||||
throw std::runtime_error( | |||||
"getaccountaddress (Deprecated, will be removed in v0.21. To " | |||||
"use this command, start bitcoind with " | |||||
"-deprecatedrpc=accounts)"); | |||||
} | |||||
throw JSONRPCError( | |||||
RPC_METHOD_DEPRECATED, | |||||
"getaccountaddress is deprecated and will be removed in v0.21. To " | |||||
"use this command, start bitcoind with -deprecatedrpc=accounts."); | |||||
} | |||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"getlabeladdress \"label\" ( force ) \n" | "getlabeladdress \"label\" ( force ) \n" | ||||
"\nReturns the default receiving address for this label. This will " | "\nReturns the default receiving address for this label. This will " | ||||
"reset to a fresh address once there's a transaction that spends " | "reset to a fresh address once there's a transaction that spends " | ||||
"to it.\n" | "to it.\n" | ||||
"\nArguments:\n" | "\nArguments:\n" | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | |||||
static UniValue setlabel(const Config &config, const JSONRPCRequest &request) { | static UniValue setlabel(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (!IsDeprecatedRPCEnabled(gArgs, "accounts") && | |||||
request.strMethod == "setaccount") { | |||||
if (request.fHelp) { | |||||
throw std::runtime_error( | |||||
"setaccount (Deprecated, will be removed in v0.21. To use this " | |||||
"command, start bitcoind with -deprecatedrpc=accounts)"); | |||||
} | |||||
throw JSONRPCError( | |||||
RPC_METHOD_DEPRECATED, | |||||
"setaccount is deprecated and will be removed in v0.21. To use " | |||||
"this command, start bitcoind with -deprecatedrpc=accounts."); | |||||
} | |||||
if (request.fHelp || request.params.size() != 2) { | if (request.fHelp || request.params.size() != 2) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"setlabel \"address\" \"label\"\n" | "setlabel \"address\" \"label\"\n" | ||||
"\nSets the label associated with the given address.\n" | "\nSets the label associated with the given address.\n" | ||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"address\" (string, required) The bitcoin address to " | "1. \"address\" (string, required) The bitcoin address to " | ||||
"be associated with a label.\n" | "be associated with a label.\n" | ||||
"2. \"label\" (string, required) The label to assign to " | "2. \"label\" (string, required) The label to assign to " | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | static UniValue getaccount(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (!IsDeprecatedRPCEnabled(gArgs, "accounts")) { | |||||
if (request.fHelp) { | |||||
throw std::runtime_error( | |||||
"getaccount (Deprecated, will be removed in v0.21. To use this " | |||||
"command, start bitcoind with -deprecatedrpc=accounts)"); | |||||
} | |||||
throw JSONRPCError( | |||||
RPC_METHOD_DEPRECATED, | |||||
"getaccount is deprecated and will be removed in v0.21. To use " | |||||
"this command, start bitcoind with -deprecatedrpc=accounts."); | |||||
} | |||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"getaccount \"address\"\n" | "getaccount \"address\"\n" | ||||
"\nDEPRECATED. Returns the account associated with the given " | "\nDEPRECATED. Returns the account associated with the given " | ||||
"address.\n" | "address.\n" | ||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"address\" (string, required) The bitcoin address for " | "1. \"address\" (string, required) The bitcoin address for " | ||||
"account lookup.\n" | "account lookup.\n" | ||||
Show All 29 Lines | static UniValue getaddressesbyaccount(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (!IsDeprecatedRPCEnabled(gArgs, "accounts")) { | |||||
if (request.fHelp) { | |||||
throw std::runtime_error( | |||||
"getaddressbyaccount (Deprecated, will be removed in v0.21. To " | |||||
"use this command, start bitcoind with " | |||||
"-deprecatedrpc=accounts)"); | |||||
} | |||||
throw JSONRPCError(RPC_METHOD_DEPRECATED, | |||||
"getaddressesbyaccount is deprecated and will be " | |||||
"removed in v0.21. To use this command, start " | |||||
"bitcoind with -deprecatedrpc=accounts."); | |||||
} | |||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"getaddressesbyaccount \"account\"\n" | "getaddressesbyaccount \"account\"\n" | ||||
"\nDEPRECATED. Returns the list of addresses for the given " | "\nDEPRECATED. Returns the list of addresses for the given " | ||||
"account.\n" | "account.\n" | ||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"account\" (string, required) The account name.\n" | "1. \"account\" (string, required) The account name.\n" | ||||
"\nResult:\n" | "\nResult:\n" | ||||
▲ Show 20 Lines • Show All 405 Lines • ▼ Show 20 Lines | static UniValue getreceivedbylabel(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (!IsDeprecatedRPCEnabled(gArgs, "accounts") && | |||||
request.strMethod == "getreceivedbyaccount") { | |||||
if (request.fHelp) { | |||||
throw std::runtime_error( | |||||
"getreceivedbyaccount (Deprecated, will be removed in v0.21. " | |||||
"To use this command, start bitcoind with " | |||||
"-deprecatedrpc=accounts)"); | |||||
} | |||||
throw JSONRPCError(RPC_METHOD_DEPRECATED, | |||||
"getreceivedbyaccount is deprecated and will be " | |||||
"removed in v0.21. To use this command, start " | |||||
"bitcoind with -deprecatedrpc=accounts."); | |||||
} | |||||
if (request.fHelp || request.params.size() < 1 || | if (request.fHelp || request.params.size() < 1 || | ||||
request.params.size() > 2) { | request.params.size() > 2) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"getreceivedbylabel \"label\" ( minconf )\n" | "getreceivedbylabel \"label\" ( minconf )\n" | ||||
"\nReturns the total amount received by addresses with <label> in " | "\nReturns the total amount received by addresses with <label> in " | ||||
"transactions with at least [minconf] confirmations.\n" | "transactions with at least [minconf] confirmations.\n" | ||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. \"label\" (string, required) The selected label, may be " | "1. \"label\" (string, required) The selected label, may be " | ||||
▲ Show 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | |||||
static UniValue movecmd(const Config &config, const JSONRPCRequest &request) { | static UniValue movecmd(const Config &config, const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (!IsDeprecatedRPCEnabled(gArgs, "accounts")) { | |||||
if (request.fHelp) { | |||||
throw std::runtime_error( | |||||
"move (Deprecated, will be removed in v0.21. To use this " | |||||
"command, start bitcoind with -deprecatedrpc=accounts)"); | |||||
} | |||||
throw JSONRPCError( | |||||
RPC_METHOD_DEPRECATED, | |||||
"move is deprecated and will be removed in v0.21. To use this " | |||||
"command, start bitcoind with -deprecatedrpc=accounts."); | |||||
} | |||||
if (request.fHelp || request.params.size() < 3 || | if (request.fHelp || request.params.size() < 3 || | ||||
request.params.size() > 5) { | request.params.size() > 5) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"move \"fromaccount\" \"toaccount\" amount ( minconf \"comment\" " | "move \"fromaccount\" \"toaccount\" amount ( minconf \"comment\" " | ||||
")\n" | ")\n" | ||||
"\nDEPRECATED. Move a specified amount from one account in your " | "\nDEPRECATED. Move a specified amount from one account in your " | ||||
"wallet to another.\n" | "wallet to another.\n" | ||||
"\nArguments:\n" | "\nArguments:\n" | ||||
▲ Show 20 Lines • Show All 678 Lines • ▼ Show 20 Lines | static UniValue listreceivedbylabel(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (!IsDeprecatedRPCEnabled(gArgs, "accounts") && | |||||
request.strMethod == "listreceivedbyaccount") { | |||||
if (request.fHelp) { | |||||
throw std::runtime_error( | |||||
"listreceivedbyaccount (Deprecated, will be removed in v0.21. " | |||||
"To use this command, start bitcoind with " | |||||
"-deprecatedrpc=accounts)"); | |||||
} | |||||
throw JSONRPCError(RPC_METHOD_DEPRECATED, | |||||
"listreceivedbyaccount is deprecated and will be " | |||||
"removed in v0.21. To use this command, start " | |||||
"bitcoind with -deprecatedrpc=accounts."); | |||||
} | |||||
if (request.fHelp || request.params.size() > 3) { | if (request.fHelp || request.params.size() > 3) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"listreceivedbylabel ( minconf include_empty include_watchonly)\n" | "listreceivedbylabel ( minconf include_empty include_watchonly)\n" | ||||
"\nList received transactions by label.\n" | "\nList received transactions by label.\n" | ||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. minconf (numeric, optional, default=1) The minimum " | "1. minconf (numeric, optional, default=1) The minimum " | ||||
"number of confirmations before payments are included.\n" | "number of confirmations before payments are included.\n" | ||||
"2. include_empty (bool, optional, default=false) Whether to " | "2. include_empty (bool, optional, default=false) Whether to " | ||||
▲ Show 20 Lines • Show All 346 Lines • ▼ Show 20 Lines | static UniValue listaccounts(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request); | ||||
CWallet *const pwallet = wallet.get(); | CWallet *const pwallet = wallet.get(); | ||||
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
if (!IsDeprecatedRPCEnabled(gArgs, "accounts")) { | |||||
if (request.fHelp) { | |||||
throw std::runtime_error( | |||||
"listaccounts (Deprecated, will be removed in v0.21. To use " | |||||
"this command, start bitcoind with -deprecatedrpc=accounts)"); | |||||
} | |||||
throw JSONRPCError( | |||||
RPC_METHOD_DEPRECATED, | |||||
"listaccounts is deprecated and will be removed in v0.21. To use " | |||||
"this command, start bitcoind with -deprecatedrpc=accounts."); | |||||
} | |||||
if (request.fHelp || request.params.size() > 2) { | if (request.fHelp || request.params.size() > 2) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
"listaccounts ( minconf include_watchonly)\n" | "listaccounts ( minconf include_watchonly)\n" | ||||
"\nDEPRECATED. Returns Object that has account names as keys, " | "\nDEPRECATED. Returns Object that has account names as keys, " | ||||
"account balances as values.\n" | "account balances as values.\n" | ||||
"\nArguments:\n" | "\nArguments:\n" | ||||
"1. minconf (numeric, optional, default=1) Only " | "1. minconf (numeric, optional, default=1) Only " | ||||
"include transactions with at least this many confirmations\n" | "include transactions with at least this many confirmations\n" | ||||
▲ Show 20 Lines • Show All 2,668 Lines • Show Last 20 Lines |