aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2_api.h
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-09-29 22:13:49 +0200
committerRiccardo Spagni <ric@spagni.net>2016-09-29 22:13:49 +0200
commitf195a447ccf1a26eba8aaf7560e6bfc902db6f77 (patch)
treeee36fd1a595b1d0df170f805e2a0b6a4d2d90019 /src/wallet/wallet2_api.h
parentMerge pull request #1137 (diff)
parentwallet2: wallet2::get_daemon_blockchain_height() clean error message on (diff)
downloadmonero-f195a447ccf1a26eba8aaf7560e6bfc902db6f77.tar.xz
Merge pull request #1136
2dacb19 wallet2: wallet2::get_daemon_blockchain_height() clean error message on success (Ilya Kitaev) 25e5efc libwallet_api: Wallet::setAutoRefreshInterval sanity check (Ilya Kitaev) a668820 libwallet_api: explicitly return 0 in Wallet::daemonBlockChainHeight() on error (Ilya Kitaev) aef92f2 libwallet_api: tests: fixed WalletCallbackReceived test (Ilya Kitaev) 15c0882 libwallet_api: tests: test fixed according implementation (Ilya Kitaev) a7882da libwallet_api: tests: compilation errors fixed (Ilya Kitaev) cda4cb9 formatting: 2-spaces indentation (Ilya Kitaev) 545a48f formatting: 2-spaces indentation (Ilya Kitaev) 3079c57 wallet2_api: milliseconds resolution for auto-refresh interval (Ilya Kitaev) 7b4a85b wallet2_api: added Wallet::daemonBlockChainHeight() (Ilya Kitaev) 9de3ec3 libwallet_api: Wallet::blockChainHeight, WalletListener::newBlock (Ilya Kitaev)
Diffstat (limited to 'src/wallet/wallet2_api.h')
-rw-r--r--src/wallet/wallet2_api.h48
1 files changed, 43 insertions, 5 deletions
diff --git a/src/wallet/wallet2_api.h b/src/wallet/wallet2_api.h
index 2d2877856..08e2ae16b 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,20 @@ struct Wallet
virtual uint64_t balance() const = 0;
virtual uint64_t unlockedBalance() const = 0;
+ /**
+ * @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);
@@ -231,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;