forked from Public/monero-gui
Qt wrappers for libwallet API classes
This commit is contained in:
@@ -3,41 +3,88 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "wallet/wallet2_api.h" // we need to access Status enum here;
|
||||
|
||||
namespace Bitmonero {
|
||||
class Wallet; // forward declaration
|
||||
}
|
||||
|
||||
class PendingTransaction;
|
||||
class TransactionHistory;
|
||||
|
||||
class Wallet : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString seed READ getSeed)
|
||||
Q_PROPERTY(QString seedLanguage READ getSeedLanguage)
|
||||
Q_PROPERTY(Status status READ status)
|
||||
Q_PROPERTY(QString errorString READ errorString)
|
||||
Q_PROPERTY(QString address READ address)
|
||||
Q_PROPERTY(quint64 balance READ balance)
|
||||
Q_PROPERTY(quint64 unlockedBalance READ unlockedBalance)
|
||||
Q_PROPERTY(TransactionHistory * history READ history)
|
||||
|
||||
public:
|
||||
enum Status {
|
||||
Status_Ok = 0,
|
||||
Status_Error = 1
|
||||
Status_Ok = Bitmonero::Wallet::Status_Ok,
|
||||
Status_Error = Bitmonero::Wallet::Status_Error
|
||||
};
|
||||
|
||||
Q_ENUM(Status)
|
||||
|
||||
//! returns mnemonic seed
|
||||
Q_INVOKABLE QString getSeed() const;
|
||||
QString getSeed() const;
|
||||
|
||||
//! returns seed language
|
||||
Q_INVOKABLE QString getSeedLanguage() const;
|
||||
QString getSeedLanguage() const;
|
||||
|
||||
//! set seed language
|
||||
Q_INVOKABLE void setSeedLanguage(const QString &lang);
|
||||
|
||||
//! returns last operation's status
|
||||
Q_INVOKABLE int status() const;
|
||||
Status status() const;
|
||||
|
||||
//! returns last operation's error message
|
||||
Q_INVOKABLE QString errorString() const;
|
||||
QString errorString() const;
|
||||
|
||||
//! changes the password using existing parameters (path, seed, seed lang)
|
||||
Q_INVOKABLE bool setPassword(const QString &password);
|
||||
|
||||
//! returns wallet's public address
|
||||
Q_INVOKABLE QString address() const;
|
||||
QString address() const;
|
||||
|
||||
//! saves wallet to the file by given path
|
||||
Q_INVOKABLE bool store(const QString &path);
|
||||
|
||||
//! initializes wallet
|
||||
Q_INVOKABLE bool init(const QString &daemonAddress, quint64 upperTransactionLimit);
|
||||
|
||||
//! connects to daemon
|
||||
Q_INVOKABLE bool connectToDaemon();
|
||||
|
||||
//! indicates id daemon is trusted
|
||||
Q_INVOKABLE void setTrustedDaemon(bool arg);
|
||||
|
||||
//! returns balance
|
||||
quint64 balance() const;
|
||||
|
||||
//! returns unlocked balance
|
||||
quint64 unlockedBalance() const;
|
||||
|
||||
//! refreshes the wallet
|
||||
Q_INVOKABLE bool refresh();
|
||||
|
||||
//! creates transaction
|
||||
Q_INVOKABLE PendingTransaction * createTransaction(const QString &dst_addr,
|
||||
quint64 amount);
|
||||
|
||||
//! deletes transaction and frees memory
|
||||
Q_INVOKABLE void disposeTransaction(PendingTransaction * t);
|
||||
|
||||
//! returns transaction history
|
||||
TransactionHistory * history();
|
||||
|
||||
// TODO: setListenter() when it implemented in API
|
||||
|
||||
private:
|
||||
Wallet(Bitmonero::Wallet *w, QObject * parent = 0);
|
||||
@@ -47,6 +94,8 @@ private:
|
||||
friend class WalletManager;
|
||||
//! libwallet's
|
||||
Bitmonero::Wallet * m_walletImpl;
|
||||
// history lifetime managed by wallet;
|
||||
TransactionHistory * m_history;
|
||||
};
|
||||
|
||||
#endif // WALLET_H
|
||||
|
||||
Reference in New Issue
Block a user