7 class AddressTableModel;
8 class TransactionTableModel;
11 struct SendCoinsRecipient
18 // Interface to Bitcoin wallet from Qt view code
19 class WalletModel : public QObject
23 explicit WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *parent = 0);
31 AmountWithFeeExceedsBalance,
33 TransactionCreationFailed,
34 TransactionCommitFailed,
41 Unencrypted, // !wallet->IsCrypted()
42 Locked, // wallet->IsCrypted() && wallet->IsLocked()
43 Unlocked // wallet->IsCrypted() && !wallet->IsLocked()
46 OptionsModel *getOptionsModel();
47 AddressTableModel *getAddressTableModel();
48 TransactionTableModel *getTransactionTableModel();
50 qint64 getBalance() const;
51 qint64 getUnconfirmedBalance() const;
52 int getNumTransactions() const;
53 EncryptionStatus getEncryptionStatus() const;
55 bool isEncrypted() const;
57 // Check address for validity
58 bool validateAddress(const QString &address);
60 // Return status record for SendCoins, contains error id + information
61 struct SendCoinsReturn
63 SendCoinsReturn(StatusCode status,
65 QString hex=QString()):
66 status(status), fee(fee), hex(hex) {}
68 qint64 fee; // is used in case status is "AmountWithFeeExceedsBalance"
69 QString hex; // is filled with the transaction hash if status is "OK"
72 // Send coins to a list of recipients
73 SendCoinsReturn sendCoins(const QList<SendCoinsRecipient> &recipients);
77 // Wallet has an options model for wallet-specific options
78 // (transaction fee, for example)
79 OptionsModel *optionsModel;
81 AddressTableModel *addressTableModel;
82 TransactionTableModel *transactionTableModel;
85 qint64 cachedUnconfirmedBalance;
86 qint64 cachedNumTransactions;
87 EncryptionStatus cachedEncryptionStatus;
90 void balanceChanged(qint64 balance, qint64 unconfirmedBalance);
91 void numTransactionsChanged(int count);
92 void encryptionStatusChanged(int status);
94 // Asynchronous error notification
95 void error(const QString &title, const QString &message);
104 #endif // WALLETMODEL_H