Bitcoin Core  24.99.0
P2P Digital Currency
util.h
Go to the documentation of this file.
1 // Copyright (c) 2017-2022 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 <script/script.h>
9 
10 #include <any>
11 #include <memory>
12 #include <string>
13 #include <vector>
14 
15 class JSONRPCRequest;
16 class UniValue;
17 struct bilingual_str;
18 
19 namespace wallet {
20 class CWallet;
21 class LegacyScriptPubKeyMan;
22 enum class DatabaseStatus;
23 struct WalletContext;
24 
25 extern const std::string HELP_REQUIRING_PASSPHRASE;
26 
33 std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& request);
34 bool GetWalletNameFromJSONRPCRequest(const JSONRPCRequest& request, std::string& wallet_name);
35 
36 void EnsureWalletIsUnlocked(const CWallet&);
37 WalletContext& EnsureWalletContext(const std::any& context);
38 LegacyScriptPubKeyMan& EnsureLegacyScriptPubKeyMan(CWallet& wallet, bool also_create = false);
39 const LegacyScriptPubKeyMan& EnsureConstLegacyScriptPubKeyMan(const CWallet& wallet);
40 
41 bool GetAvoidReuseFlag(const CWallet& wallet, const UniValue& param);
42 bool ParseIncludeWatchonly(const UniValue& include_watchonly, const CWallet& wallet);
43 std::string LabelFromValue(const UniValue& value);
45 void PushParentDescriptors(const CWallet& wallet, const CScript& script_pubkey, UniValue& entry);
46 
47 void HandleWalletError(const std::shared_ptr<CWallet> wallet, DatabaseStatus& status, bilingual_str& error);
48 
49 int64_t ParseISO8601DateTime(const std::string& str);
50 } // namespace wallet
51 
52 #endif // BITCOIN_WALLET_RPC_UTIL_H
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:411
Definition: node.h:39
std::shared_ptr< CWallet > GetWalletForJSONRPCRequest(const JSONRPCRequest &request)
Figures out what wallet, if any, to use for a JSONRPCRequest.
Definition: util.cpp:71
bool GetWalletNameFromJSONRPCRequest(const JSONRPCRequest &request, std::string &wallet_name)
Definition: util.cpp:61
void HandleWalletError(const std::shared_ptr< CWallet > wallet, DatabaseStatus &status, bilingual_str &error)
Definition: util.cpp:153
void EnsureWalletIsUnlocked(const CWallet &wallet)
Definition: util.cpp:95
const LegacyScriptPubKeyMan & EnsureConstLegacyScriptPubKeyMan(const CWallet &wallet)
Definition: util.cpp:124
const std::string HELP_REQUIRING_PASSPHRASE
Definition: util.cpp:19
void PushParentDescriptors(const CWallet &wallet, const CScript &script_pubkey, UniValue &entry)
Fetch parent descriptors of this scriptPubKey.
Definition: util.cpp:144
LegacyScriptPubKeyMan & EnsureLegacyScriptPubKeyMan(CWallet &wallet, bool also_create)
Definition: util.cpp:112
WalletContext & EnsureWalletContext(const std::any &context)
Definition: util.cpp:102
std::string LabelFromValue(const UniValue &value)
Definition: util.cpp:133
bool ParseIncludeWatchonly(const UniValue &include_watchonly, const CWallet &wallet)
Used by RPC commands that have an include_watchonly parameter.
Definition: util.cpp:50
int64_t ParseISO8601DateTime(const std::string &str)
Definition: util.cpp:21
bool GetAvoidReuseFlag(const CWallet &wallet, const UniValue &param)
Definition: util.cpp:35
DatabaseStatus
Definition: db.h:239
WalletContext context
Bilingual messages:
Definition: translation.h:18
bool error(const char *fmt, const Args &... args)
Definition: system.h:48