1 // Copyright (c) 2016-2020 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_RPCWALLET_H
6 #define BITCOIN_WALLET_RPCWALLET_H
7 
8 #include <span.h>
9 #include <wallet/walletutil.h>
10 
11 #include <memory>
12 #include <string>
13 #include <vector>
14 
15 class CCoinControl;
16 class CRecipient;
17 class CRPCCommand;
18 class CWallet;
19 class CWalletTx;
20 class JSONRPCRequest;
21 class LegacyScriptPubKeyMan;
22 class UniValue;
23 class CTransaction;
24 struct PartiallySignedTransaction;
25 struct WalletContext;
26 
27 extern const std::string HELP_REQUIRING_PASSPHRASE;
28 
29 Span<const CRPCCommand> GetWalletRPCCommands();
30 
31 /**
32  * Figures out what wallet, if any, to use for a JSONRPCRequest.
33  *
34  * @param[in] request JSONRPCRequest that wishes to access a wallet
35  * @return nullptr if no wallet should be used, or a pointer to the CWallet
36  */
37 std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& request);
38 
39 void EnsureWalletIsUnlocked(const CWallet*);
40 WalletContext& EnsureWalletContext(const util::Ref& context);
41 LegacyScriptPubKeyMan& EnsureLegacyScriptPubKeyMan(CWallet& wallet, bool also_create = false);
42 
43 /* These are private to rpcwallet.cpp upstream, but are used also from
44    rpcnames.cpp in Namecoin.  */
45 UniValue SendMoney(CWallet* pwallet, const CCoinControl& coin_control,
46                    const CTxIn* withInput,
47                    std::vector<CRecipient>& recipients, mapValue_t map_value, bool verbose);
48 
49 RPCHelpMan getaddressinfo();
50 RPCHelpMan signrawtransactionwithwallet();
51 #endif //BITCOIN_WALLET_RPCWALLET_H
52