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,
39 OptionsModel *getOptionsModel();
40 AddressTableModel *getAddressTableModel();
41 TransactionTableModel *getTransactionTableModel();
43 qint64 getBalance() const;
44 qint64 getUnconfirmedBalance() const;
45 int getNumTransactions() const;
47 // Check address for validity
48 bool validateAddress(const QString &address);
50 // Return status record for SendCoins, contains error id + information
51 struct SendCoinsReturn
53 SendCoinsReturn(StatusCode status,
55 QString hex=QString()):
56 status(status), fee(fee), hex(hex) {}
58 qint64 fee; // is used in case status is "AmountWithFeeExceedsBalance"
59 QString hex; // is filled with the transaction hash if status is "OK"
62 // Send coins to a list of recipients
63 SendCoinsReturn sendCoins(const QList<SendCoinsRecipient> &recipients);
67 // Wallet has an options model for wallet-specific options
68 // (transaction fee, for example)
69 OptionsModel *optionsModel;
71 AddressTableModel *addressTableModel;
72 TransactionTableModel *transactionTableModel;
75 qint64 cachedUnconfirmedBalance;
76 qint64 cachedNumTransactions;
79 void balanceChanged(qint64 balance, qint64 unconfirmedBalance);
80 void numTransactionsChanged(int count);
82 // Asynchronous error notification
83 void error(const QString &title, const QString &message);
92 #endif // WALLETMODEL_H