aboutsummaryrefslogtreecommitdiff
path: root/src/qt/walletmodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/walletmodel.h')
-rw-r--r--src/qt/walletmodel.h67
1 files changed, 21 insertions, 46 deletions
diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h
index ff4b38a804..bc409b10ee 100644
--- a/src/qt/walletmodel.h
+++ b/src/qt/walletmodel.h
@@ -13,6 +13,7 @@
#include <qt/paymentrequestplus.h>
#include <qt/walletmodeltransaction.h>
+#include <interface/wallet.h>
#include <support/allocators/secure.h>
#include <map>
@@ -34,9 +35,12 @@ class CKeyID;
class COutPoint;
class COutput;
class CPubKey;
-class CWallet;
class uint256;
+namespace interface {
+class Node;
+} // namespace interface
+
QT_BEGIN_NAMESPACE
class QTimer;
QT_END_NAMESPACE
@@ -107,7 +111,7 @@ class WalletModel : public QObject
Q_OBJECT
public:
- explicit WalletModel(const PlatformStyle *platformStyle, CWallet *wallet, OptionsModel *optionsModel, QObject *parent = 0);
+ explicit WalletModel(std::unique_ptr<interface::Wallet> wallet, interface::Node& node, const PlatformStyle *platformStyle, OptionsModel *optionsModel, QObject *parent = 0);
~WalletModel();
enum StatusCode // Returned by sendCoins
@@ -136,15 +140,6 @@ public:
TransactionTableModel *getTransactionTableModel();
RecentRequestsTableModel *getRecentRequestsTableModel();
- CWallet *getWallet() const { return wallet; };
-
- CAmount getBalance(const CCoinControl *coinControl = nullptr) const;
- CAmount getUnconfirmedBalance() const;
- CAmount getImmatureBalance() const;
- bool haveWatchOnly() const;
- CAmount getWatchBalance() const;
- CAmount getWatchUnconfirmedBalance() const;
- CAmount getWatchImmatureBalance() const;
EncryptionStatus getEncryptionStatus() const;
// Check address for validity
@@ -173,8 +168,6 @@ public:
// Passphrase only needed when unlocking
bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString());
bool changePassphrase(const SecureString &oldPass, const SecureString &newPass);
- // Wallet backup
- bool backupWallet(const QString &filename);
// RAI object for unlocking wallet, returned by requestUnlock()
class UnlockContext
@@ -198,40 +191,28 @@ public:
UnlockContext requestUnlock();
- bool getPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const;
- bool IsSpendable(const CTxDestination& dest) const;
- bool getPrivKey(const CKeyID &address, CKey& vchPrivKeyOut) const;
- void getOutputs(const std::vector<COutPoint>& vOutpoints, std::vector<COutput>& vOutputs);
- bool isSpent(const COutPoint& outpoint) const;
- void listCoins(std::map<QString, std::vector<COutput> >& mapCoins) const;
-
- bool isLockedCoin(uint256 hash, unsigned int n) const;
- void lockCoin(COutPoint& output);
- void unlockCoin(COutPoint& output);
- void listLockedCoins(std::vector<COutPoint>& vOutpts);
-
void loadReceiveRequests(std::vector<std::string>& vReceiveRequests);
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest);
- bool transactionCanBeAbandoned(uint256 hash) const;
- bool abandonTransaction(uint256 hash) const;
-
- bool transactionCanBeBumped(uint256 hash) const;
bool bumpFee(uint256 hash);
static bool isWalletEnabled();
- bool hdEnabled() const;
-
- OutputType getDefaultAddressType() const;
-
- int getDefaultConfirmTarget() const;
+ interface::Node& node() const { return m_node; }
+ interface::Wallet& wallet() const { return *m_wallet; }
QString getWalletName() const;
- static bool isMultiwallet();
+ bool isMultiwallet();
private:
- CWallet *wallet;
+ std::unique_ptr<interface::Wallet> m_wallet;
+ std::unique_ptr<interface::Handler> m_handler_status_changed;
+ std::unique_ptr<interface::Handler> m_handler_address_book_changed;
+ std::unique_ptr<interface::Handler> m_handler_transaction_changed;
+ std::unique_ptr<interface::Handler> m_handler_show_progress;
+ std::unique_ptr<interface::Handler> m_handler_watch_only_changed;
+ interface::Node& m_node;
+
bool fHaveWatchOnly;
bool fForceCheckBalanceChanged;
@@ -244,12 +225,7 @@ private:
RecentRequestsTableModel *recentRequestsTableModel;
// Cache some values to be able to detect changes
- CAmount cachedBalance;
- CAmount cachedUnconfirmedBalance;
- CAmount cachedImmatureBalance;
- CAmount cachedWatchOnlyBalance;
- CAmount cachedWatchUnconfBalance;
- CAmount cachedWatchImmatureBalance;
+ interface::WalletBalances m_cached_balances;
EncryptionStatus cachedEncryptionStatus;
int cachedNumBlocks;
@@ -257,12 +233,11 @@ private:
void subscribeToCoreSignals();
void unsubscribeFromCoreSignals();
- void checkBalanceChanged();
+ void checkBalanceChanged(const interface::WalletBalances& new_balances);
Q_SIGNALS:
// Signal that balance in wallet changed
- void balanceChanged(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance,
- const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance);
+ void balanceChanged(const interface::WalletBalances& balances);
// Encryption status of wallet changed
void encryptionStatusChanged();
@@ -276,7 +251,7 @@ Q_SIGNALS:
void message(const QString &title, const QString &message, unsigned int style);
// Coins sent: from wallet, to recipient, in (serialized) transaction:
- void coinsSent(CWallet* wallet, SendCoinsRecipient recipient, QByteArray transaction);
+ void coinsSent(WalletModel* wallet, SendCoinsRecipient recipient, QByteArray transaction);
// Show progress dialog e.g. for rescan
void showProgress(const QString &title, int nProgress);