From 9de3ec3e2a48a4695b77c66add93c2fbf42affc2 Mon Sep 17 00:00:00 2001 From: Ilya Kitaev Date: Fri, 23 Sep 2016 22:36:37 +0300 Subject: libwallet_api: Wallet::blockChainHeight, WalletListener::newBlock --- src/wallet/wallet2_api.h | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'src/wallet/wallet2_api.h') diff --git a/src/wallet/wallet2_api.h b/src/wallet/wallet2_api.h index 2d2877856..08f010b32 100644 --- a/src/wallet/wallet2_api.h +++ b/src/wallet/wallet2_api.h @@ -114,11 +114,35 @@ struct TransactionHistory struct WalletListener { virtual ~WalletListener() = 0; + /** + * @brief moneySpent - called when money spent + * @param txId - transaction id + * @param amount - amount + */ virtual void moneySpent(const std::string &txId, uint64_t amount) = 0; + + /** + * @brief moneyReceived - called when money received + * @param txId - transaction id + * @param amount - amount + */ virtual void moneyReceived(const std::string &txId, uint64_t amount) = 0; - // generic callback, called when any event (sent/received/block reveived/etc) happened with the wallet; + + /** + * @brief newBlock - called when new block received + * @param height - block height + */ + virtual void newBlock(uint64_t height) = 0; + + /** + * @brief updated - generic callback, called when any event (sent/received/block reveived/etc) happened with the wallet; + */ virtual void updated() = 0; - // called when wallet refreshed by background thread or explicitly called be calling "refresh" synchronously + + + /** + * @brief refreshed - called when wallet refreshed by background thread or explicitly refreshed by calling "refresh" synchronously + */ virtual void refreshed() = 0; }; @@ -211,6 +235,12 @@ struct Wallet virtual uint64_t balance() const = 0; virtual uint64_t unlockedBalance() const = 0; + /** + * @brief getBlockChainHeight - returns current blockchain height + * @return + */ + virtual uint64_t blockChainHeight() const = 0; + static std::string displayAmount(uint64_t amount); static uint64_t amountFromString(const std::string &amount); static uint64_t amountFromDouble(double amount); -- cgit v1.2.3 From 7b4a85b309aa0fb864d63a2fd6f1ae062aaa71dd Mon Sep 17 00:00:00 2001 From: Ilya Kitaev Date: Mon, 26 Sep 2016 21:35:00 +0300 Subject: wallet2_api: added Wallet::daemonBlockChainHeight() --- src/wallet/wallet2_api.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/wallet/wallet2_api.h') diff --git a/src/wallet/wallet2_api.h b/src/wallet/wallet2_api.h index 08f010b32..f424f7258 100644 --- a/src/wallet/wallet2_api.h +++ b/src/wallet/wallet2_api.h @@ -236,11 +236,19 @@ struct Wallet virtual uint64_t unlockedBalance() const = 0; /** - * @brief getBlockChainHeight - returns current blockchain height + * @brief blockChainHeight - returns current blockchain height * @return */ virtual uint64_t blockChainHeight() const = 0; + /** + * @brief daemonBlockChainHeight - returns daemon blockchain height + * @return 0 - in case error communicating with the daemon. + * status() will return Status_Error and errorString() will return verbose error description + */ + virtual uint64_t daemonBlockChainHeight() const = 0; + + static std::string displayAmount(uint64_t amount); static uint64_t amountFromString(const std::string &amount); static uint64_t amountFromDouble(double amount); -- cgit v1.2.3 From 3079c5756be459af57c8c866b339b4b98c1da1f2 Mon Sep 17 00:00:00 2001 From: Ilya Kitaev Date: Mon, 26 Sep 2016 22:50:10 +0300 Subject: wallet2_api: milliseconds resolution for auto-refresh interval --- src/wallet/wallet2_api.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/wallet/wallet2_api.h') diff --git a/src/wallet/wallet2_api.h b/src/wallet/wallet2_api.h index f424f7258..08e2ae16b 100644 --- a/src/wallet/wallet2_api.h +++ b/src/wallet/wallet2_api.h @@ -269,12 +269,12 @@ struct Wallet /** * @brief setAutoRefreshInterval - setup interval for automatic refresh. - * @param seconds - interval in seconds. if zero or less than zero - automatic refresh disabled; + * @param seconds - interval in millis. if zero or less than zero - automatic refresh disabled; */ - virtual void setAutoRefreshInterval(int seconds) = 0; + virtual void setAutoRefreshInterval(int millis) = 0; /** - * @brief autoRefreshInterval - returns automatic refresh interval in seconds + * @brief autoRefreshInterval - returns automatic refresh interval in millis * @return */ virtual int autoRefreshInterval() const = 0; -- cgit v1.2.3