Electroneum
wallet2_api.h
Go to the documentation of this file.
1 // Copyrights(c) 2017-2019, The Electroneum Project
2 // Copyrights(c) 2014-2017, The Monero Project
3 //
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without modification, are
7 // permitted provided that the following conditions are met:
8 //
9 // 1. Redistributions of source code must retain the above copyright notice, this list of
10 // conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form must reproduce the above copyright notice, this list
13 // of conditions and the following disclaimer in the documentation and/or other
14 // materials provided with the distribution.
15 //
16 // 3. Neither the name of the copyright holder nor the names of its contributors may be
17 // used to endorse or promote products derived from this software without specific
18 // prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
21 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23 // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
28 // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
31 
32 #pragma once
33 
34 
35 #include <string>
36 #include <vector>
37 #include <ctime>
38 #include <iostream>
39 
40 // Public interface for libwallet library
41 namespace Electroneum {
42 
43  namespace Utils {
44  bool isAddressLocal(const std::string &hostaddr);
45  }
46 
47  template<typename T>
48  class optional {
49  public:
51  optional(const T &t): t(t), set(true) {}
52  const T &operator*() const { return t; }
53  T &operator*() { return t; }
54  operator bool() const { return set; }
55  private:
56  T t;
57  bool set;
58  };
59 
64 {
65  enum Status {
69  };
70 
71  enum Priority {
76  };
77 
78  virtual ~PendingTransaction() = 0;
79  virtual int status() const = 0;
80  virtual std::string errorString() const = 0;
81  // commit transaction or save to file if filename is provided.
82  virtual bool commit(const std::string &filename = "", bool overwrite = false) = 0;
83  virtual uint64_t amount() const = 0;
84  virtual uint64_t dust() const = 0;
85  virtual uint64_t fee() const = 0;
86  virtual std::vector<std::string> txid() const = 0;
91  virtual uint64_t txCount() const = 0;
92 };
93 
98 {
99  enum Status {
103  };
104 
105  enum Priority {
110  };
111 
112  virtual ~UnsignedTransaction() = 0;
113  virtual int status() const = 0;
114  virtual std::string errorString() const = 0;
115  virtual std::vector<uint64_t> amount() const = 0;
116  virtual std::vector<uint64_t> fee() const = 0;
117  virtual std::vector<uint64_t> mixin() const = 0;
118  // returns a string with information about all transactions.
119  virtual std::string confirmationMessage() const = 0;
120  virtual std::vector<std::string> paymentId() const = 0;
121  virtual std::vector<std::string> recipientAddress() const = 0;
122  virtual uint64_t minMixinCount() const = 0;
127  virtual uint64_t txCount() const = 0;
133  virtual bool sign(const std::string &signedFileName) = 0;
134 };
135 
140 {
141  enum Direction {
144  };
145 
146  struct Transfer {
147  Transfer(uint64_t _amount, const std::string &address);
148  const uint64_t amount;
149  const std::string address;
150  };
151 
152  virtual ~TransactionInfo() = 0;
153  virtual int direction() const = 0;
154  virtual bool isPending() const = 0;
155  virtual bool isFailed() const = 0;
156  virtual uint64_t amount() const = 0;
157  virtual uint64_t fee() const = 0;
158  virtual uint64_t blockHeight() const = 0;
159  virtual uint64_t confirmations() const = 0;
160  virtual uint64_t unlockTime() const = 0;
162  virtual std::string hash() const = 0;
163  virtual std::time_t timestamp() const = 0;
164  virtual std::string paymentId() const = 0;
166  virtual const std::vector<Transfer> & transfers() const = 0;
167 };
172 {
173  virtual ~TransactionHistory() = 0;
174  virtual int count() const = 0;
175  virtual TransactionInfo * transaction(int index) const = 0;
176  virtual TransactionInfo * transaction(const std::string &id) const = 0;
177  virtual std::vector<TransactionInfo*> getAll() const = 0;
178  virtual void refresh() = 0;
179 };
180 
185 public:
186  AddressBookRow(std::size_t _rowId, const std::string &_address, const std::string &_paymentId, const std::string &_description):
187  m_rowId(_rowId),
188  m_address(_address),
189  m_paymentId(_paymentId),
190  m_description(_description) {}
191 
192 private:
193  std::size_t m_rowId;
194  std::string m_address;
195  std::string m_paymentId;
196  std::string m_description;
197 public:
198  std::string extra;
199  std::string getAddress() const {return m_address;}
200  std::string getDescription() const {return m_description;}
201  std::string getPaymentId() const {return m_paymentId;}
202  std::size_t getRowId() const {return m_rowId;}
203 };
204 
210 {
211  enum ErrorCode {
216  };
217  virtual ~AddressBook() = 0;
218  virtual std::vector<AddressBookRow*> getAll() const = 0;
219  virtual bool addRow(const std::string &dst_addr , const std::string &payment_id, const std::string &description) = 0;
220  virtual bool deleteRow(std::size_t rowId) = 0;
221  virtual void refresh() = 0;
222  virtual std::string errorString() const = 0;
223  virtual int errorCode() const = 0;
224  virtual int lookupPaymentID(const std::string &payment_id) const = 0;
225 };
226 
228 {
229  virtual ~WalletListener() = 0;
235  virtual void moneySpent(const std::string &txId, uint64_t amount) = 0;
236 
242  virtual void moneyReceived(const std::string &txId, uint64_t amount) = 0;
243 
249  virtual void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount) = 0;
250 
255  virtual void newBlock(uint64_t height) = 0;
256 
260  virtual void updated() = 0;
261 
262 
266  virtual void refreshed() = 0;
267 };
268 
269 
274 struct Wallet
275 {
276 
277  enum Status {
281  };
282 
287  };
288 
289  virtual ~Wallet() = 0;
290  virtual std::string seed() const = 0;
291  virtual std::string getSeedLanguage() const = 0;
292  virtual void setSeedLanguage(const std::string &arg) = 0;
294  virtual int status() const = 0;
296  virtual std::string errorString() const = 0;
297  virtual bool setPassword(const std::string &password) = 0;
298  virtual std::string address() const = 0;
299  virtual std::string path() const = 0;
300  virtual bool testnet() const = 0;
302  virtual void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const = 0;
304  virtual bool useForkRules(uint8_t version, int64_t early_blocks) const = 0;
314  virtual std::string integratedAddress(const std::string &payment_id) const = 0;
315 
320  virtual std::string secretViewKey() const = 0;
321 
326  virtual std::string publicViewKey() const = 0;
327 
332  virtual std::string secretSpendKey() const = 0;
333 
338  virtual std::string publicSpendKey() const = 0;
339 
346  virtual bool store(const std::string &path) = 0;
351  virtual std::string filename() const = 0;
356  virtual std::string keysFilename() const = 0;
366  virtual bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit, const std::string &daemon_username = "", const std::string &daemon_password = "") = 0;
367 
375  virtual bool createWatchOnly(const std::string &path, const std::string &password, const std::string &language) const = 0;
376 
382  virtual void setRefreshFromBlockHeight(uint64_t refresh_from_block_height) = 0;
383 
388  virtual uint64_t getRefreshFromBlockHeight() const = 0;
389 
395  virtual void setRecoveringFromSeed(bool recoveringFromSeed) = 0;
396 
401  virtual bool connectToDaemon() = 0;
402 
407  virtual ConnectionStatus connected() const = 0;
408  virtual void setTrustedDaemon(bool arg) = 0;
409  virtual bool trustedDaemon() const = 0;
410  virtual uint64_t balance() const = 0;
411  virtual uint64_t unlockedBalance() const = 0;
412 
417  virtual bool watchOnly() const = 0;
418 
423  virtual uint64_t blockChainHeight() const = 0;
424 
429  virtual uint64_t approximateBlockChainHeight() const = 0;
430 
436  virtual uint64_t daemonBlockChainHeight() const = 0;
437 
443  virtual uint64_t daemonBlockChainTargetHeight() const = 0;
444 
449  virtual bool synchronized() const = 0;
450 
451  static std::string displayAmount(uint64_t amount);
452  static uint64_t amountFromString(const std::string &amount);
453  static uint64_t amountFromDouble(double amount);
454  static std::string genPaymentId();
455  static bool paymentIdValid(const std::string &paiment_id);
456  static bool addressValid(const std::string &str, bool testnet);
457  static bool keyValid(const std::string &secret_key_string, const std::string &address_string, bool isViewKey, bool testnet, std::string &error);
458  static std::string paymentIdFromAddress(const std::string &str, bool testnet);
459  static uint64_t maximumAllowedAmount();
460  // Easylogger wrapper
461  static void init(const char *argv0, const char *default_log_base_name);
462  static void debug(const std::string &str);
463 
467  virtual void startRefresh() = 0;
471  virtual void pauseRefresh() = 0;
472 
477  virtual bool refresh() = 0;
478 
482  virtual void refreshAsync() = 0;
483 
488  virtual void setAutoRefreshInterval(int millis) = 0;
489 
494  virtual int autoRefreshInterval() const = 0;
495 
496 
508  virtual PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id,
509  optional<uint64_t> amount, uint32_t mixin_count,
511 
519 
525  virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) = 0;
526 
531  virtual bool submitTransaction(const std::string &fileName) = 0;
532 
533 
538  virtual void disposeTransaction(PendingTransaction * t) = 0;
539 
545  virtual bool exportKeyImages(const std::string &filename) = 0;
546 
552  virtual bool importKeyImages(const std::string &filename) = 0;
553 
554 
555  virtual TransactionHistory * history() const = 0;
556  virtual AddressBook * addressBook() const = 0;
557  virtual void setListener(WalletListener *) = 0;
558  virtual bool setUserNote(const std::string &txid, const std::string &note) = 0;
564  virtual std::string getUserNote(const std::string &txid) const = 0;
565  virtual std::string getTxKey(const std::string &txid) const = 0;
566 
567  /*
568  * \brief signMessage - sign a message with the spend private key
569  * \param message - the message to sign (arbitrary byte data)
570  * \return the signature
571  */
572  virtual std::string signMessage(const std::string &message) = 0;
580  virtual bool verifySignedMessage(const std::string &message, const std::string &addres, const std::string &signature) const = 0;
581 
582  virtual bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error) = 0;
583 
584  virtual std::string getDefaultDataDir() const = 0;
585 
586  /*
587  * \brief rescanSpent - Rescan spent outputs - Can only be used with trusted daemon
588  * \return true on success
589  */
590  virtual bool rescanSpent() = 0;
591 };
592 
597 {
598 
606  virtual Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language, bool testnet = false) = 0;
607 
614  virtual Wallet * openWallet(const std::string &path, const std::string &password, bool testnet = false) = 0;
615 
624  virtual Wallet * recoveryWallet(const std::string &path, const std::string &memo, bool testnet = false, uint64_t restoreHeight = 0) = 0;
625 
637  virtual Wallet * createWalletFromKeys(const std::string &path,
638  const std::string &language,
639  bool testnet,
640  uint64_t restoreHeight,
641  const std::string &addressString,
642  const std::string &viewKeyString,
643  const std::string &spendKeyString = "") = 0;
644 
650  virtual bool closeWallet(Wallet *wallet) = 0;
651 
652  /*
653  * ! checks if wallet with the given name already exists
654  */
655 
661  virtual bool walletExists(const std::string &path) = 0;
662 
670  virtual bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool watch_only) const = 0;
671 
677  virtual std::vector<std::string> findWallets(const std::string &path) = 0;
678 
690  virtual bool checkPayment(const std::string &address, const std::string &txid, const std::string &txkey, const std::string &daemon_address, uint64_t &received, uint64_t &height, std::string &error) const = 0;
691 
693  virtual std::string errorString() const = 0;
694 
696  virtual void setDaemonAddress(const std::string &address) = 0;
697 
699  virtual bool connected(uint32_t *version = NULL) const = 0;
700 
702  virtual uint64_t blockchainHeight() const = 0;
703 
705  virtual uint64_t blockchainTargetHeight() const = 0;
706 
708  virtual uint64_t networkDifficulty() const = 0;
709 
711  virtual double miningHashRate() const = 0;
712 
714  virtual uint64_t blockTarget() const = 0;
715 
717  virtual bool isMining() const = 0;
718 
720  virtual bool startMining(const std::string &address, uint32_t threads = 1, bool background_mining = false, bool ignore_battery = true) = 0;
721 
723  virtual bool stopMining() = 0;
724 
726  virtual std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const = 0;
727 
729  static std::tuple<bool, std::string, std::string, std::string, std::string> checkUpdates(const std::string &software, const std::string &subdir);
730 };
731 
732 
734 {
735  // logging levels for underlying library
736  enum LogLevel {
745  };
746 
747  static WalletManager * getWalletManager();
748  static void setLogLevel(int level);
749  static void setLogCategories(const std::string &categories);
750 };
751 
752 
753 }
754 
755 namespace Bitelectroneum = Electroneum;
756 
virtual std::string filename() const =0
filename - returns wallet filename
virtual bool commit(const std::string &filename="", bool overwrite=false)=0
virtual bool useForkRules(uint8_t version, int64_t early_blocks) const =0
check if hard fork rules should be used
virtual ~Wallet()=0
Definition: wallet.cpp:158
virtual void setRecoveringFromSeed(bool recoveringFromSeed)=0
setRecoveringFromSeed - set state recover form seed
virtual bool submitTransaction(const std::string &fileName)=0
submitTransaction - submits transaction in signed tx file
virtual void newBlock(uint64_t height)=0
newBlock - called when new block received
virtual std::string signMessage(const std::string &message)=0
static uint64_t maximumAllowedAmount()
Definition: wallet.cpp:258
virtual std::string errorString() const =0
const uint32_t T[512]
Definition: groestl_tables.h:34
virtual bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit, const std::string &daemon_username="", const std::string &daemon_password="")=0
init - initializes wallet with daemon connection params. if daemon_address is local address...
bool set
Definition: wallet2_api.h:57
virtual std::string address() const =0
bool isAddressLocal(const std::string &address)
Definition: utils.cpp:42
virtual uint64_t amount() const =0
virtual void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const =0
returns current hard fork info
optional(const T &t)
Definition: wallet2_api.h:51
virtual uint64_t unlockedBalance() const =0
virtual bool isFailed() const =0
virtual uint64_t approximateBlockChainHeight() const =0
approximateBlockChainHeight - returns approximate blockchain height calculated from date/time ...
virtual void moneySpent(const std::string &txId, uint64_t amount)=0
moneySpent - called when money spent
Status
Definition: wallet2_api.h:99
virtual bool isPending() const =0
virtual uint64_t daemonBlockChainHeight() const =0
daemonBlockChainHeight - returns daemon blockchain height
Definition: wallet2_api.h:66
virtual std::string secretSpendKey() const =0
secretSpendKey - returns secret spend key
static bool keyValid(const std::string &secret_key_string, const std::string &address_string, bool isViewKey, bool testnet, std::string &error)
Definition: wallet.cpp:208
static void setLogCategories(const std::string &categories)
Definition: wallet_manager.cpp:447
virtual int status() const =0
std::string m_address
Definition: wallet2_api.h:194
virtual PendingTransaction * createSweepUnmixableTransaction()=0
createSweepUnmixableTransaction creates transaction with unmixable outputs.
virtual ~UnsignedTransaction()=0
Definition: unsigned_transaction.cpp:48
virtual std::string seed() const =0
virtual bool verifySignedMessage(const std::string &message, const std::string &addres, const std::string &signature) const =0
verifySignedMessage - verify a signature matches a given message
virtual std::string getDefaultDataDir() const =0
LogLevel
Definition: wallet2_api.h:736
virtual uint64_t blockTarget() const =0
returns current block target
virtual const std::vector< Transfer > & transfers() const =0
only applicable for output transactions
virtual std::string integratedAddress(const std::string &payment_id) const =0
integratedAddress - returns integrated address for current wallet address and given payment_id...
virtual ConnectionStatus connected() const =0
connected - checks if the wallet connected to the daemon
uint64_t height
Definition: blockchain.cpp:87
virtual void updated()=0
updated - generic callback, called when any event (sent/received/block reveived/etc) happened with th...
virtual TransactionHistory * history() const =0
static std::string paymentIdFromAddress(const std::string &str, bool testnet)
Definition: wallet.cpp:246
Definition: wallet2_api.h:146
static WalletManager * getWalletManager()
Definition: wallet_manager.cpp:430
virtual bool importKeyImages(const std::string &filename)=0
importKeyImages - imports key images from file
std::string getPaymentId() const
Definition: wallet2_api.h:201
virtual Wallet * openWallet(const std::string &path, const std::string &password, bool testnet=false)=0
Opens existing wallet.
Definition: wallet2_api.h:48
static uint64_t amountFromString(const std::string &amount)
Definition: wallet.cpp:168
virtual uint64_t blockHeight() const =0
Priority
Definition: wallet2_api.h:71
virtual int status() const =0
static bool addressValid(const std::string &str, bool testnet)
Definition: wallet.cpp:200
virtual uint64_t blockchainHeight() const =0
returns current blockchain height
virtual std::string confirmationMessage() const =0
std::string m_description
Definition: wallet2_api.h:196
virtual void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount)=0
unconfirmedMoneyReceived - called when payment arrived in tx pool
virtual void refreshed()=0
refreshed - called when wallet refreshed by background thread or explicitly refreshed by calling "ref...
virtual int count() const =0
virtual uint64_t daemonBlockChainTargetHeight() const =0
daemonBlockChainTargetHeight - returns daemon blockchain target height
virtual int errorCode() const =0
const std::string address
Definition: wallet2_api.h:149
static std::string genPaymentId()
Definition: wallet.cpp:182
virtual std::vector< uint64_t > amount() const =0
Definition: wallet2_api.h:100
virtual PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id, optional< uint64_t > amount, uint32_t mixin_count, PendingTransaction::Priority=PendingTransaction::Priority_Low)=0
createTransaction creates transaction. if dst_addr is an integrated address, payment_id is ignored ...
virtual void setSeedLanguage(const std::string &arg)=0
std::size_t m_rowId
Definition: wallet2_api.h:193
virtual std::string hash() const =0
transaction_id
Definition: wallet2_api.h:280
virtual int direction() const =0
virtual double miningHashRate() const =0
returns current mining hash rate (0 if not mining)
ConnectionStatus
Definition: wallet2_api.h:283
T t
Definition: wallet2_api.h:56
T & operator*()
Definition: wallet2_api.h:53
ErrorCode
Definition: wallet2_api.h:211
std::string m_paymentId
Definition: wallet2_api.h:195
virtual uint64_t balance() const =0
static bool paymentIdValid(const std::string &paiment_id)
Definition: wallet.cpp:189
Definition: wallet2_api.h:213
virtual int autoRefreshInterval() const =0
autoRefreshInterval - returns automatic refresh interval in millis
optional()
Definition: wallet2_api.h:50
virtual bool exportKeyImages(const std::string &filename)=0
exportKeyImages - exports key images to file
virtual ~PendingTransaction()=0
Definition: pending_transaction.cpp:48
virtual std::vector< uint64_t > fee() const =0
virtual std::string errorString() const =0
virtual std::string paymentId() const =0
virtual Wallet * recoveryWallet(const std::string &path, const std::string &memo, bool testnet=false, uint64_t restoreHeight=0)=0
recovers existing wallet using memo (electrum seed)
AddressBookRow(std::size_t _rowId, const std::string &_address, const std::string &_paymentId, const std::string &_description)
Definition: wallet2_api.h:186
Definition: wallet2_api.h:142
virtual bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector< std::string > &unknown_parameters, std::string &error)=0
virtual TransactionInfo * transaction(int index) const =0
virtual Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language, bool testnet=false)=0
Creates new wallet.
Definition: wallet2_api.h:278
Interface for wallet operations. TODO: check if /include/IWallet.h is still actual.
Definition: wallet2_api.h:274
virtual bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool watch_only) const =0
verifyWalletPassword - check if the given filename is the wallet
virtual uint64_t fee() const =0
virtual bool connectToDaemon()=0
connectToDaemon - connects to the daemon. TODO: check if it can be removed
Transaction-like interface for sending money.
Definition: wallet2_api.h:63
virtual std::string path() const =0
virtual bool refresh()=0
refresh - refreshes the wallet, updating transactions from daemon
virtual bool walletExists(const std::string &path)=0
TODO: delme walletExists - check if the given filename is the wallet.
virtual void setAutoRefreshInterval(int millis)=0
setAutoRefreshInterval - setup interval for automatic refresh.
virtual std::vector< std::string > txid() const =0
virtual bool testnet() const =0
virtual bool checkPayment(const std::string &address, const std::string &txid, const std::string &txkey, const std::string &daemon_address, uint64_t &received, uint64_t &height, std::string &error) const =0
checkPayment - checks a payment was made using a txkey
virtual bool rescanSpent()=0
virtual uint64_t confirmations() const =0
#define false
Definition: stdbool.h:38
static void debug(const std::string &str)
Definition: wallet.cpp:268
Definition: address_book.cpp:41
std::string getAddress() const
Definition: wallet2_api.h:199
const T & operator*() const
Definition: wallet2_api.h:52
virtual bool trustedDaemon() const =0
virtual void pauseRefresh()=0
pauseRefresh - pause refresh thread
Transfer(uint64_t _amount, const std::string &address)
Definition: transaction_info.cpp:41
Status
Definition: wallet2_api.h:277
virtual std::string getUserNote(const std::string &txid) const =0
getUserNote - return an arbitrary string note attached to a txid
std::size_t getRowId() const
Definition: wallet2_api.h:202
virtual bool watchOnly() const =0
watchOnly - checks if wallet is watch only
const uint64_t amount
Definition: wallet2_api.h:148
virtual std::string publicViewKey() const =0
publicViewKey - returns public view key
Priority
Definition: wallet2_api.h:105
uint8_t version
Definition: blockchain.cpp:86
virtual uint64_t blockChainHeight() const =0
blockChainHeight - returns current blockchain height
virtual ~AddressBook()=0
Definition: address_book.cpp:43
virtual std::string getTxKey(const std::string &txid) const =0
virtual std::vector< std::string > paymentId() const =0
virtual std::vector< TransactionInfo * > getAll() const =0
virtual Wallet * createWalletFromKeys(const std::string &path, const std::string &language, bool testnet, uint64_t restoreHeight, const std::string &addressString, const std::string &viewKeyString, const std::string &spendKeyString="")=0
recovers existing wallet using keys. Creates a view only wallet if spend key is omitted ...
static void setLogLevel(int level)
Definition: wallet_manager.cpp:442
POD_CLASS signature
Definition: crypto.h:99
virtual void startRefresh()=0
StartRefresh - Start/resume refresh thread (refresh every 10 seconds)
virtual ~TransactionInfo()=0
Definition: transaction_info.cpp:39
virtual bool sign(const std::string &signedFileName)=0
sign - Sign txs and saves to file
internal::NamedArgWithType< char, T > arg(StringRef name, const T &arg)
Definition: format.h:3450
AddressBookRow - provides functions to manage address book.
Definition: wallet2_api.h:184
virtual bool store(const std::string &path)=0
store - stores wallet to file.
virtual std::string errorString() const =0
virtual void moneyReceived(const std::string &txId, uint64_t amount)=0
moneyReceived - called when money received
virtual uint64_t blockchainTargetHeight() const =0
returns current blockchain target height
virtual std::vector< std::string > findWallets(const std::string &path)=0
findWallets - searches for the wallet files by given path name recursively
virtual uint64_t txCount() const =0
txCount - number of transactions current transaction will be splitted to
virtual void setListener(WalletListener *)=0
Definition: wallet2_api.h:227
virtual bool connected(uint32_t *version=NULL) const =0
returns whether the daemon can be reached, and its version number
virtual std::string keysFilename() const =0
keysFilename - returns keys filename. usually this formed as "wallet_filename".keys ...
virtual void refresh()=0
virtual void disposeTransaction(PendingTransaction *t)=0
disposeTransaction - destroys transaction object
Definition: wallet2_api.h:733
virtual std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const =0
resolves an OpenAlias address to a electroneum address
virtual int lookupPaymentID(const std::string &payment_id) const =0
int bool
Definition: stdbool.h:36
virtual uint64_t txCount() const =0
txCount - number of transactions current transaction will be splitted to
static std::string displayAmount(uint64_t amount)
Definition: wallet.cpp:163
virtual uint64_t minMixinCount() const =0
Definition: wallet2_api.h:279
virtual std::vector< AddressBookRow * > getAll() const =0
static uint64_t amountFromDouble(double amount)
Definition: wallet.cpp:175
virtual bool setUserNote(const std::string &txid, const std::string &note)=0
The TransactionHistory - interface for displaying transaction history.
Definition: wallet2_api.h:171
std::string extra
Definition: wallet2_api.h:198
virtual int status() const =0
returns wallet status (Status_Ok | Status_Error)
virtual void setDaemonAddress(const std::string &address)=0
set the daemon address (hostname and port)
virtual bool setPassword(const std::string &password)=0
virtual std::string secretViewKey() const =0
secretViewKey - returns secret view key
virtual std::string errorString() const =0
in case error status, returns error string
virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename)=0
loadUnsignedTx - creates transaction from unsigned tx file
virtual bool deleteRow(std::size_t rowId)=0
virtual bool startMining(const std::string &address, uint32_t threads=1, bool background_mining=false, bool ignore_battery=true)=0
starts mining with the set number of threads
virtual bool isMining() const =0
returns true iff mining
virtual std::string publicSpendKey() const =0
publicSpendKey - returns public spend key
virtual uint64_t getRefreshFromBlockHeight() const =0
getRestoreHeight - get wallet creation height
virtual AddressBook * addressBook() const =0
virtual bool addRow(const std::string &dst_addr, const std::string &payment_id, const std::string &description)=0
Status
Definition: wallet2_api.h:65
virtual uint64_t dust() const =0
The TransactionInfo - interface for displaying transaction information.
Definition: wallet2_api.h:139
virtual void setRefreshFromBlockHeight(uint64_t refresh_from_block_height)=0
setRefreshFromBlockHeight - start refresh from block height on recover
virtual std::string errorString() const =0
returns verbose error string regarding last error;
WalletManager - provides functions to manage wallets.
Definition: wallet2_api.h:596
virtual uint64_t networkDifficulty() const =0
returns current network difficulty
virtual std::string getSeedLanguage() const =0
virtual uint64_t amount() const =0
virtual bool closeWallet(Wallet *wallet)=0
Closes wallet. In case operation succeded, wallet object deleted. in case operation failed...
virtual uint64_t unlockTime() const =0
virtual std::vector< uint64_t > mixin() const =0
virtual std::vector< std::string > recipientAddress() const =0
static std::tuple< bool, std::string, std::string, std::string, std::string > checkUpdates(const std::string &software, const std::string &subdir)
checks for an update and returns version, hash and url
Definition: wallet_manager.cpp:405
virtual void setTrustedDaemon(bool arg)=0
virtual std::time_t timestamp() const =0
virtual uint64_t fee() const =0
Definition: wallet2_api.h:143
std::string getDescription() const
Definition: wallet2_api.h:200
Definition: wallet2_api.h:212
virtual bool stopMining()=0
stops mining
#define true
Definition: stdbool.h:37
virtual void refreshAsync()=0
refreshAsync - refreshes wallet asynchronously.
virtual bool createWatchOnly(const std::string &path, const std::string &password, const std::string &language) const =0
createWatchOnly - Creates a watch only wallet
virtual ~TransactionHistory()=0
Definition: transaction_history.cpp:48
Transaction-like interface for sending money.
Definition: wallet2_api.h:97
Definition: wallet2_api.h:214
Direction
Definition: wallet2_api.h:141
The AddressBook - interface for Book.
Definition: wallet2_api.h:209
virtual ~WalletListener()=0
Definition: wallet.cpp:160