aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2_api.h
diff options
context:
space:
mode:
authorIlya Kitaev <mbg033@gmail.com>2016-07-14 12:47:01 +0300
committerIlya Kitaev <mbg033@gmail.com>2016-07-18 23:03:09 +0300
commit6d32a3d16b8bb1bf2a51a41ce9f826cf31d02352 (patch)
tree02f16ea19e0bfaf5a15614ccf1691595a5f3ff8d /src/wallet/wallet2_api.h
parentlibwallet_api cmake: conditionally creating libwallet_merged2 only for (diff)
downloadmonero-6d32a3d16b8bb1bf2a51a41ce9f826cf31d02352.tar.xz
wallet_api: async init, Wallet::connected status, log level
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet2_api.h50
1 files changed, 46 insertions, 4 deletions
diff --git a/src/wallet/wallet2_api.h b/src/wallet/wallet2_api.h
index f6c573673..2c5836573 100644
--- a/src/wallet/wallet2_api.h
+++ b/src/wallet/wallet2_api.h
@@ -116,11 +116,10 @@ struct WalletListener
virtual ~WalletListener() = 0;
virtual void moneySpent(const std::string &txId, uint64_t amount) = 0;
virtual void moneyReceived(const std::string &txId, uint64_t amount) = 0;
- // generic callback, called when any event happened with the wallet;
+ // 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 when wallet refreshed by background thread or explicitly called be calling "refresh" synchronously
virtual void refreshed() = 0;
-
};
@@ -175,9 +174,38 @@ struct Wallet
* \return
*/
virtual std::string keysFilename() const = 0;
-
+ /*!
+ * \brief init - initializes wallet with daemon connection params. implicitly connects to the daemon
+ * and refreshes the wallet. "refreshed" callback will be invoked. if daemon_address is
+ * local address, "trusted daemon" will be set to true forcibly
+ *
+ * \param daemon_address - daemon address in "hostname:port" format
+ * \param upper_transaction_size_limit
+ * \return - true if initialized and refreshed successfully
+ */
virtual bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit) = 0;
+
+ /*!
+ * \brief init - initalizes wallet asynchronously. logic is the same as "init" but returns immediately.
+ * "refreshed" callback will be invoked.
+ *
+ * \param daemon_address - daemon address in "hostname:port" format
+ * \param upper_transaction_size_limit
+ * \return - true if initialized and refreshed successfully
+ */
+ virtual void initAsync(const std::string &daemon_address, uint64_t upper_transaction_size_limit) = 0;
+
+ /**
+ * @brief connectToDaemon - connects to the daemon. TODO: check if it can be removed
+ * @return
+ */
virtual bool connectToDaemon() = 0;
+
+ /**
+ * @brief connected - checks if the wallet connected to the daemon
+ * @return - true if connected
+ */
+ virtual bool connected() const = 0;
virtual void setTrustedDaemon(bool arg) = 0;
virtual bool trustedDaemon() const = 0;
virtual uint64_t balance() const = 0;
@@ -296,8 +324,22 @@ struct WalletManager
struct WalletManagerFactory
{
+ // logging levels for underlying library
+ enum LogLevel {
+ LogLevel_Silent = -1,
+ LogLevel_0 = 0,
+ LogLevel_1 = 1,
+ LogLevel_2 = 2,
+ LogLevel_3 = 3,
+ LogLevel_4 = 4,
+ LogLevel_Min = LogLevel_Silent,
+ LogLevel_Max = LogLevel_4
+ };
+
static WalletManager * getWalletManager();
+ static void setLogLevel(int level);
};
+
}