Bitcoin Core  22.99.0
P2P Digital Currency
util.h
Go to the documentation of this file.
1 // Copyright (c) 2017-2021 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_WALLET_RPC_UTIL_H
6 #define BITCOIN_WALLET_RPC_UTIL_H
7 
8 #include <any>
9 #include <memory>
10 #include <string>
11 #include <vector>
12 
13 class JSONRPCRequest;
14 class UniValue;
15 struct bilingual_str;
16 
17 namespace wallet {
18 class CWallet;
19 class LegacyScriptPubKeyMan;
20 enum class DatabaseStatus;
21 struct WalletContext;
22 
23 extern const std::string HELP_REQUIRING_PASSPHRASE;
24 
31 std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& request);
32 bool GetWalletNameFromJSONRPCRequest(const JSONRPCRequest& request, std::string& wallet_name);
33 
34 void EnsureWalletIsUnlocked(const CWallet&);
35 WalletContext& EnsureWalletContext(const std::any& context);
36 LegacyScriptPubKeyMan& EnsureLegacyScriptPubKeyMan(CWallet& wallet, bool also_create = false);
37 const LegacyScriptPubKeyMan& EnsureConstLegacyScriptPubKeyMan(const CWallet& wallet);
38 
39 bool GetAvoidReuseFlag(const CWallet& wallet, const UniValue& param);
40 bool ParseIncludeWatchonly(const UniValue& include_watchonly, const CWallet& wallet);
41 std::string LabelFromValue(const UniValue& value);
42 
43 void HandleWalletError(const std::shared_ptr<CWallet> wallet, DatabaseStatus& status, bilingual_str& error);
44 } // namespace wallet
45 
46 #endif // BITCOIN_WALLET_RPC_UTIL_H
wallet::DatabaseStatus
DatabaseStatus
Definition: db.h:213
wallet::EnsureConstLegacyScriptPubKeyMan
const LegacyScriptPubKeyMan & EnsureConstLegacyScriptPubKeyMan(const CWallet &wallet)
Definition: util.cpp:109
bilingual_str
Bilingual messages:
Definition: translation.h:16
wallet::GetWalletForJSONRPCRequest
std::shared_ptr< CWallet > GetWalletForJSONRPCRequest(const JSONRPCRequest &request)
Figures out what wallet, if any, to use for a JSONRPCRequest.
Definition: util.cpp:55
wallet
Definition: node.h:38
UniValue
Definition: univalue.h:17
wallet::HELP_REQUIRING_PASSPHRASE
const std::string HELP_REQUIRING_PASSPHRASE
Definition: util.cpp:17
context
WalletContext context
Definition: notifications.cpp:37
wallet::HandleWalletError
void HandleWalletError(const std::shared_ptr< CWallet > wallet, DatabaseStatus &status, bilingual_str &error)
Definition: util.cpp:126
wallet::GetWalletNameFromJSONRPCRequest
bool GetWalletNameFromJSONRPCRequest(const JSONRPCRequest &request, std::string &wallet_name)
Definition: util.cpp:45
JSONRPCRequest
Definition: request.h:28
error
bool error(const char *fmt, const Args &... args)
Definition: system.h:49
wallet::EnsureLegacyScriptPubKeyMan
LegacyScriptPubKeyMan & EnsureLegacyScriptPubKeyMan(CWallet &wallet, bool also_create)
Definition: util.cpp:97
wallet::ParseIncludeWatchonly
bool ParseIncludeWatchonly(const UniValue &include_watchonly, const CWallet &wallet)
Used by RPC commands that have an include_watchonly parameter.
Definition: util.cpp:34
wallet::GetAvoidReuseFlag
bool GetAvoidReuseFlag(const CWallet &wallet, const UniValue &param)
Definition: util.cpp:19
wallet::EnsureWalletContext
WalletContext & EnsureWalletContext(const std::any &context)
Definition: util.cpp:87
wallet::EnsureWalletIsUnlocked
void EnsureWalletIsUnlocked(const CWallet &wallet)
Definition: util.cpp:80
wallet::LabelFromValue
std::string LabelFromValue(const UniValue &value)
Definition: util.cpp:118