aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpc/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/rpc/util.h')
-rw-r--r--src/wallet/rpc/util.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/wallet/rpc/util.h b/src/wallet/rpc/util.h
new file mode 100644
index 0000000000..a493a80a74
--- /dev/null
+++ b/src/wallet/rpc/util.h
@@ -0,0 +1,38 @@
+// Copyright (c) 2017-2021 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#ifndef BITCOIN_WALLET_RPC_UTIL_H
+#define BITCOIN_WALLET_RPC_UTIL_H
+
+#include <any>
+#include <memory>
+#include <string>
+
+class CWallet;
+class JSONRPCRequest;
+class LegacyScriptPubKeyMan;
+class UniValue;
+struct WalletContext;
+
+extern const std::string HELP_REQUIRING_PASSPHRASE;
+
+/**
+ * Figures out what wallet, if any, to use for a JSONRPCRequest.
+ *
+ * @param[in] request JSONRPCRequest that wishes to access a wallet
+ * @return nullptr if no wallet should be used, or a pointer to the CWallet
+ */
+std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& request);
+bool GetWalletNameFromJSONRPCRequest(const JSONRPCRequest& request, std::string& wallet_name);
+
+void EnsureWalletIsUnlocked(const CWallet&);
+WalletContext& EnsureWalletContext(const std::any& context);
+LegacyScriptPubKeyMan& EnsureLegacyScriptPubKeyMan(CWallet& wallet, bool also_create = false);
+const LegacyScriptPubKeyMan& EnsureConstLegacyScriptPubKeyMan(const CWallet& wallet);
+
+bool GetAvoidReuseFlag(const CWallet& wallet, const UniValue& param);
+bool ParseIncludeWatchonly(const UniValue& include_watchonly, const CWallet& wallet);
+std::string LabelFromValue(const UniValue& value);
+
+#endif // BITCOIN_WALLET_RPC_UTIL_H