diff options
author | Ilya Kitaev <mbg033@gmail.com> | 2016-05-05 22:24:00 +0300 |
---|---|---|
committer | Ilya Kitaev <mbg033@gmail.com> | 2016-06-23 16:01:33 +0300 |
commit | 374577018d9e32a6f50e9fb23deb27b98da8ae67 (patch) | |
tree | f6aabb2c352562bcb0c8d6601fcaf583ec7a9ebe /src/wallet/api/wallet.cpp | |
parent | TransactionHistory continued (diff) | |
download | monero-374577018d9e32a6f50e9fb23deb27b98da8ae67.tar.xz |
started WalletListener
Diffstat (limited to 'src/wallet/api/wallet.cpp')
-rw-r--r-- | src/wallet/api/wallet.cpp | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index d9d24b4f0..6170000b7 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -47,6 +47,47 @@ namespace { static const size_t DEFAULT_MIX = 4; } +struct Wallet2CallbackImpl : public tools::i_wallet2_callback +{ + + ~Wallet2CallbackImpl() + { + + } + + void setListener(WalletListener * listener) + { + // TODO; + } + + WalletListener * getListener() const + { + return m_listener; + } + + virtual void on_new_block(uint64_t height, const cryptonote::block& block) + { + // TODO; + } + virtual void on_money_received(uint64_t height, const cryptonote::transaction& tx, size_t out_index) + { + // TODO; + + } + virtual void on_money_spent(uint64_t height, const cryptonote::transaction& in_tx, size_t out_index, + const cryptonote::transaction& spend_tx) + { + // TODO; + } + + virtual void on_skip_transaction(uint64_t height, const cryptonote::transaction& tx) + { + // TODO; + } + + WalletListener * m_listener; +}; + Wallet::~Wallet() {} string Wallet::displayAmount(uint64_t amount) @@ -56,14 +97,17 @@ string Wallet::displayAmount(uint64_t amount) ///////////////////////// WalletImpl implementation //////////////////////// WalletImpl::WalletImpl(bool testnet) - :m_wallet(nullptr), m_status(Wallet::Status_Ok), m_trustedDaemon(false) + :m_wallet(nullptr), m_status(Wallet::Status_Ok), m_trustedDaemon(false), + m_wallet2Callback(nullptr) { m_wallet = new tools::wallet2(testnet); m_history = new TransactionHistoryImpl(this); + m_wallet2Callback = new Wallet2CallbackImpl; } WalletImpl::~WalletImpl() { + delete m_wallet2Callback; delete m_history; delete m_wallet; } @@ -399,6 +443,14 @@ TransactionHistory *WalletImpl::history() const return m_history; } +void WalletImpl::setListener(WalletListener *l) +{ + // TODO thread synchronization; + m_wallet2Callback->setListener(l); +} + + + bool WalletImpl::connectToDaemon() { bool result = m_wallet->check_connection(); |