diff options
Diffstat (limited to 'src/interfaces/wallet.h')
-rw-r--r-- | src/interfaces/wallet.h | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index a02134f2b2..f26ac866dc 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2020 The Bitcoin Core developers +// Copyright (c) 2018-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. @@ -6,6 +6,7 @@ #define BITCOIN_INTERFACES_WALLET_H #include <consensus/amount.h> +#include <fs.h> #include <interfaces/chain.h> // For ChainClient #include <pubkey.h> // For CKeyID and CScriptID (definitions needed in CTxDestination instantiation) #include <script/standard.h> // For CTxDestination @@ -23,19 +24,21 @@ #include <utility> #include <vector> -class CCoinControl; class CFeeRate; class CKey; -class CWallet; enum class FeeReason; enum class OutputType; enum class TransactionError; +struct PartiallySignedTransaction; +struct bilingual_str; +namespace wallet { +class CCoinControl; +class CWallet; enum isminetype : unsigned int; struct CRecipient; -struct PartiallySignedTransaction; struct WalletContext; -struct bilingual_str; using isminefilter = std::underlying_type<isminetype>::type; +} // namespace wallet namespace interfaces { @@ -107,7 +110,7 @@ public: //! Look up address in wallet, return whether exists. virtual bool getAddress(const CTxDestination& dest, std::string* name, - isminetype* is_mine, + wallet::isminetype* is_mine, std::string* purpose) = 0; //! Get wallet address list. @@ -135,8 +138,8 @@ public: virtual void listLockedCoins(std::vector<COutPoint>& outputs) = 0; //! Create transaction. - virtual CTransactionRef createTransaction(const std::vector<CRecipient>& recipients, - const CCoinControl& coin_control, + virtual CTransactionRef createTransaction(const std::vector<wallet::CRecipient>& recipients, + const wallet::CCoinControl& coin_control, bool sign, int& change_pos, CAmount& fee, @@ -158,7 +161,7 @@ public: //! Create bump transaction. virtual bool createBumpTransaction(const uint256& txid, - const CCoinControl& coin_control, + const wallet::CCoinControl& coin_control, std::vector<bilingual_str>& errors, CAmount& old_fee, CAmount& new_fee, @@ -213,19 +216,19 @@ public: virtual CAmount getBalance() = 0; //! Get available balance. - virtual CAmount getAvailableBalance(const CCoinControl& coin_control) = 0; + virtual CAmount getAvailableBalance(const wallet::CCoinControl& coin_control) = 0; //! Return whether transaction input belongs to wallet. - virtual isminetype txinIsMine(const CTxIn& txin) = 0; + virtual wallet::isminetype txinIsMine(const CTxIn& txin) = 0; //! Return whether transaction output belongs to wallet. - virtual isminetype txoutIsMine(const CTxOut& txout) = 0; + virtual wallet::isminetype txoutIsMine(const CTxOut& txout) = 0; //! Return debit amount if transaction input belongs to wallet. - virtual CAmount getDebit(const CTxIn& txin, isminefilter filter) = 0; + virtual CAmount getDebit(const CTxIn& txin, wallet::isminefilter filter) = 0; //! Return credit amount if transaction input belongs to wallet. - virtual CAmount getCredit(const CTxOut& txout, isminefilter filter) = 0; + virtual CAmount getCredit(const CTxOut& txout, wallet::isminefilter filter) = 0; //! Return AvailableCoins + LockedCoins grouped by wallet address. //! (put change in one group with wallet address) @@ -240,7 +243,7 @@ public: //! Get minimum fee. virtual CAmount getMinimumFee(unsigned int tx_bytes, - const CCoinControl& coin_control, + const wallet::CCoinControl& coin_control, int* returned_target, FeeReason* reason) = 0; @@ -307,7 +310,7 @@ public: virtual std::unique_ptr<Handler> handleCanGetAddressesChanged(CanGetAddressesChangedFn fn) = 0; //! Return pointer to internal wallet class, useful for testing. - virtual CWallet* wallet() { return nullptr; } + virtual wallet::CWallet* wallet() { return nullptr; } }; //! Wallet chain client that in addition to having chain client methods for @@ -326,7 +329,7 @@ public: virtual std::string getWalletDir() = 0; //! Restore backup wallet - virtual std::unique_ptr<Wallet> restoreWallet(const std::string& backup_file, const std::string& wallet_name, bilingual_str& error, std::vector<bilingual_str>& warnings) = 0; + virtual std::unique_ptr<Wallet> restoreWallet(const fs::path& backup_file, const std::string& wallet_name, bilingual_str& error, std::vector<bilingual_str>& warnings) = 0; //! Return available wallets in wallet directory. virtual std::vector<std::string> listWalletDir() = 0; @@ -341,18 +344,18 @@ public: virtual std::unique_ptr<Handler> handleLoadWallet(LoadWalletFn fn) = 0; //! Return pointer to internal context, useful for testing. - virtual WalletContext* context() { return nullptr; } + virtual wallet::WalletContext* context() { return nullptr; } }; //! Information about one wallet address. struct WalletAddress { CTxDestination dest; - isminetype is_mine; + wallet::isminetype is_mine; std::string name; std::string purpose; - WalletAddress(CTxDestination dest, isminetype is_mine, std::string name, std::string purpose) + WalletAddress(CTxDestination dest, wallet::isminetype is_mine, std::string name, std::string purpose) : dest(std::move(dest)), is_mine(is_mine), name(std::move(name)), purpose(std::move(purpose)) { } @@ -382,10 +385,10 @@ struct WalletBalances struct WalletTx { CTransactionRef tx; - std::vector<isminetype> txin_is_mine; - std::vector<isminetype> txout_is_mine; + std::vector<wallet::isminetype> txin_is_mine; + std::vector<wallet::isminetype> txout_is_mine; std::vector<CTxDestination> txout_address; - std::vector<isminetype> txout_address_is_mine; + std::vector<wallet::isminetype> txout_address_is_mine; CAmount credit; CAmount debit; CAmount change; @@ -402,7 +405,6 @@ struct WalletTxStatus int depth_in_main_chain; unsigned int time_received; uint32_t lock_time; - bool is_final; bool is_trusted; bool is_abandoned; bool is_coinbase; @@ -420,7 +422,7 @@ struct WalletTxOut //! Return implementation of Wallet interface. This function is defined in //! dummywallet.cpp and throws if the wallet component is not compiled. -std::unique_ptr<Wallet> MakeWallet(WalletContext& context, const std::shared_ptr<CWallet>& wallet); +std::unique_ptr<Wallet> MakeWallet(wallet::WalletContext& context, const std::shared_ptr<wallet::CWallet>& wallet); //! Return implementation of ChainClient interface for a wallet loader. This //! function will be undefined in builds where ENABLE_WALLET is false. |