Electroneum
wallet2_api.h
Go to the documentation of this file.
1 // Copyright (c) 2014-2019, The Monero Project
2 //
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without modification, are
6 // permitted provided that the following conditions are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice, this list of
9 // conditions and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 // of conditions and the following disclaimer in the documentation and/or other
13 // materials provided with the distribution.
14 //
15 // 3. Neither the name of the copyright holder nor the names of its contributors may be
16 // used to endorse or promote products derived from this software without specific
17 // prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27 // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 //
29 // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
30 
31 #pragma once
32 
33 
34 #include <string>
35 #include <vector>
36 #include <list>
37 #include <set>
38 #include <ctime>
39 #include <iostream>
40 #include <stdexcept>
41 
42 // Public interface for libwallet library
43 namespace Electroneum {
44 
46  MAINNET = 0,
49 };
50 
51  namespace Utils {
52  bool isAddressLocal(const std::string &hostaddr);
53  void onStartup();
54  }
55 
56  template<typename T>
57  class optional {
58  public:
59  optional(): set(false) {}
60  optional(const T &t): t(t), set(true) {}
61  const T &operator*() const { return t; }
62  T &operator*() { return t; }
63  operator bool() const { return set; }
64  private:
65  T t;
66  bool set;
67  };
68 
73 {
74  enum Status {
78  };
79 
80  enum Priority {
86  };
87 
88  virtual ~PendingTransaction() = 0;
89  virtual int status() const = 0;
90  virtual std::string errorString() const = 0;
91  // commit transaction or save to file if filename is provided.
92  virtual bool commit(const std::string &filename = "", bool overwrite = false) = 0;
93  virtual uint64_t amount() const = 0;
94  virtual uint64_t dust() const = 0;
95  virtual uint64_t fee() const = 0;
96  virtual std::vector<std::string> txid() const = 0;
101  virtual uint64_t txCount() const = 0;
102  virtual std::vector<uint32_t> subaddrAccount() const = 0;
103  virtual std::vector<std::set<uint32_t>> subaddrIndices() const = 0;
104 
121  virtual std::string multisigSignData() = 0;
122  virtual void signMultisigTx() = 0;
127  virtual std::vector<std::string> signersKeys() const = 0;
128 };
129 
134 {
135  enum Status {
139  };
140 
141  virtual ~UnsignedTransaction() = 0;
142  virtual int status() const = 0;
143  virtual std::string errorString() const = 0;
144  virtual std::vector<uint64_t> amount() const = 0;
145  virtual std::vector<uint64_t> fee() const = 0;
146  virtual std::vector<uint64_t> mixin() const = 0;
147  // returns a string with information about all transactions.
148  virtual std::string confirmationMessage() const = 0;
149  virtual std::vector<std::string> paymentId() const = 0;
150  virtual std::vector<std::string> recipientAddress() const = 0;
151  virtual uint64_t minMixinCount() const = 0;
156  virtual uint64_t txCount() const = 0;
162  virtual bool sign(const std::string &signedFileName) = 0;
163 };
164 
169 {
170  enum Direction {
173  };
174 
175  struct Transfer {
176  Transfer(uint64_t _amount, const std::string &address);
179  };
180 
181  virtual ~TransactionInfo() = 0;
182  virtual int direction() const = 0;
183  virtual bool isPending() const = 0;
184  virtual bool isFailed() const = 0;
185  virtual uint64_t amount() const = 0;
186  virtual uint64_t fee() const = 0;
187  virtual uint64_t blockHeight() const = 0;
188  virtual std::set<uint32_t> subaddrIndex() const = 0;
189  virtual uint32_t subaddrAccount() const = 0;
190  virtual std::string label() const = 0;
191  virtual uint64_t confirmations() const = 0;
192  virtual uint64_t unlockTime() const = 0;
194  virtual std::string hash() const = 0;
195  virtual std::time_t timestamp() const = 0;
196  virtual std::string paymentId() const = 0;
198  virtual const std::vector<Transfer> & transfers() const = 0;
199 };
204 {
205  virtual ~TransactionHistory() = 0;
206  virtual int count() const = 0;
207  virtual TransactionInfo * transaction(int index) const = 0;
208  virtual TransactionInfo * transaction(const std::string &id) const = 0;
209  virtual std::vector<TransactionInfo*> getAll() const = 0;
210  virtual void refresh() = 0;
211 };
212 
217 public:
218  AddressBookRow(std::size_t _rowId, const std::string &_address, const std::string &_paymentId, const std::string &_description):
219  m_rowId(_rowId),
220  m_address(_address),
221  m_paymentId(_paymentId),
222  m_description(_description) {}
223 
224 private:
225  std::size_t m_rowId;
226  std::string m_address;
227  std::string m_paymentId;
228  std::string m_description;
229 public:
231  std::string getAddress() const {return m_address;}
232  std::string getDescription() const {return m_description;}
233  std::string getPaymentId() const {return m_paymentId;}
234  std::size_t getRowId() const {return m_rowId;}
235 };
236 
242 {
243  enum ErrorCode {
248  };
249  virtual ~AddressBook() = 0;
250  virtual std::vector<AddressBookRow*> getAll() const = 0;
251  virtual bool addRow(const std::string &dst_addr , const std::string &payment_id, const std::string &description) = 0;
252  virtual bool deleteRow(std::size_t rowId) = 0;
253  virtual void refresh() = 0;
254  virtual std::string errorString() const = 0;
255  virtual int errorCode() const = 0;
256  virtual int lookupPaymentID(const std::string &payment_id) const = 0;
257 };
258 
260 public:
261  SubaddressRow(std::size_t _rowId, const std::string &_address, const std::string &_label):
262  m_rowId(_rowId),
263  m_address(_address),
264  m_label(_label) {}
265 
266 private:
267  std::size_t m_rowId;
268  std::string m_address;
269  std::string m_label;
270 public:
272  std::string getAddress() const {return m_address;}
273  std::string getLabel() const {return m_label;}
274  std::size_t getRowId() const {return m_rowId;}
275 };
276 
278 {
279  virtual ~Subaddress() = 0;
280  virtual std::vector<SubaddressRow*> getAll() const = 0;
281  virtual void addRow(uint32_t accountIndex, const std::string &label) = 0;
282  virtual void setLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) = 0;
283  virtual void refresh(uint32_t accountIndex) = 0;
284 };
285 
287 public:
288  SubaddressAccountRow(std::size_t _rowId, const std::string &_address, const std::string &_label, const std::string &_balance, const std::string &_unlockedBalance, const std::string &_old_balance, const std::string &_old_unlocked_balance):
289  m_rowId(_rowId),
290  m_address(_address),
291  m_label(_label),
292  m_balance(_balance),
293  m_unlockedBalance(_unlockedBalance),
294  m_old_balance(_old_balance),
295  m_old_unlocked_balance(_old_unlocked_balance){}
296 
297 private:
298  std::size_t m_rowId;
299  std::string m_address;
300  std::string m_label;
301  std::string m_balance;
302  std::string m_unlockedBalance;
303  std::string m_old_balance;
304  std::string m_old_unlocked_balance;
305 public:
307  std::string getAddress() const {return m_address;}
308  std::string getLabel() const {return m_label;}
309  std::string getBalance() const {return m_balance;}
310  std::string getUnlockedBalance() const {return m_unlockedBalance;}
311  std::string getOldBalance() const {return m_old_balance;}
312  std::string getOldUnlockedBalance() const {return m_old_unlocked_balance;}
313  std::size_t getRowId() const {return m_rowId;}
314 };
315 
317 {
318  virtual ~SubaddressAccount() = 0;
319  virtual std::vector<SubaddressAccountRow*> getAll() const = 0;
320  virtual void addRow(const std::string &label) = 0;
321  virtual void setLabel(uint32_t accountIndex, const std::string &label) = 0;
322  virtual void refresh() = 0;
323 };
324 
327 
329  bool isReady;
332 };
333 
334 
338 
339  virtual double progress() const { return m_progress; }
340  virtual bool indeterminate() const { return m_indeterminate; }
341 
342 protected:
343  double m_progress;
345 };
346 
347 struct Wallet;
349 {
350  virtual ~WalletListener() = 0;
356  virtual void etnSpent(const std::string &txId, uint64_t amount) = 0;
357 
363  virtual void etnReceived(const std::string &txId, uint64_t amount) = 0;
364 
370  virtual void unconfirmedETNReceived(const std::string &txId, uint64_t amount) = 0;
371 
376  virtual void newBlock(uint64_t height) = 0;
377 
381  virtual void updated() = 0;
382 
383 
387  virtual void refreshed() = 0;
388 
392  virtual void onDeviceButtonRequest(uint64_t code) { (void)code; }
393 
397  virtual void onDeviceButtonPressed() { }
398 
403  throw std::runtime_error("Not supported");
404  }
405 
410  if (!on_device) throw std::runtime_error("Not supported");
411  return optional<std::string>();
412  }
413 
417  virtual void onDeviceProgress(const DeviceProgress & event) { (void)event; };
418 
422  virtual void onSetWallet(Wallet * wallet) { (void)wallet; };
423 };
424 
425 
430 struct Wallet
431 {
432  enum Device {
436  };
437 
438  enum Status {
442  };
443 
448  };
449 
450  virtual ~Wallet() = 0;
451  virtual std::string seed() const = 0;
452  virtual std::string getSeedLanguage() const = 0;
453  virtual void setSeedLanguage(const std::string &arg) = 0;
455  virtual int status() const = 0; //deprecated: use safe alternative statusWithErrorString
457  virtual std::string errorString() const = 0; //deprecated: use safe alternative statusWithErrorString
459  virtual void statusWithErrorString(int& status, std::string& errorString) const = 0;
460  virtual bool setPassword(const std::string &password) = 0;
461  virtual bool setDevicePin(const std::string &pin) { (void)pin; return false; };
462  virtual bool setDevicePassphrase(const std::string &passphrase) { (void)passphrase; return false; };
463  virtual std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const = 0;
464  std::string mainAddress() const { return address(0, 0); }
465  virtual std::string path() const = 0;
466  virtual NetworkType nettype() const = 0;
467  bool mainnet() const { return nettype() == MAINNET; }
468  bool testnet() const { return nettype() == TESTNET; }
469  bool stagenet() const { return nettype() == STAGENET; }
471  virtual void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const = 0;
473  virtual bool useForkRules(uint8_t version, int64_t early_blocks) const = 0;
483  virtual std::string integratedAddress(const std::string &payment_id) const = 0;
484 
489  virtual std::string secretViewKey() const = 0;
490 
495  virtual std::string publicViewKey() const = 0;
496 
501  virtual std::string secretSpendKey() const = 0;
502 
507  virtual std::string publicSpendKey() const = 0;
508 
513  virtual std::string publicMultisigSignerKey() const = 0;
514 
521  virtual bool store(const std::string &path) = 0;
526  virtual std::string filename() const = 0;
531  virtual std::string keysFilename() const = 0;
544  virtual bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit = 0, const std::string &daemon_username = "", const std::string &daemon_password = "", bool use_ssl = false, bool lightWallet = false) = 0;
545 
553  virtual bool createWatchOnly(const std::string &path, const std::string &password, const std::string &language) const = 0;
554 
560  virtual void setRefreshFromBlockHeight(uint64_t refresh_from_block_height) = 0;
561 
566  virtual uint64_t getRefreshFromBlockHeight() const = 0;
567 
573  virtual void setRecoveringFromSeed(bool recoveringFromSeed) = 0;
574 
580  virtual void setRecoveringFromDevice(bool recoveringFromDevice) = 0;
581 
588  virtual void setSubaddressLookahead(uint32_t major, uint32_t minor) = 0;
589 
594  virtual bool connectToDaemon() = 0;
595 
600  virtual ConnectionStatus connected() const = 0;
601  virtual void setTrustedDaemon(bool arg) = 0;
602  virtual bool trustedDaemon() const = 0;
603  virtual uint64_t balance(uint32_t accountIndex = 0, bool public_blockchain = false) const = 0;
604  uint64_t balanceAll(bool public_blockchain) const {
605  uint64_t result = 0;
606  for (uint32_t i = 0; i < numSubaddressAccounts(); ++i)
607  result += balance(i, public_blockchain);
608  return result;
609  }
610  virtual uint64_t unlockedBalance(uint32_t accountIndex = 0, bool public_blockchain = false) const = 0;
611  uint64_t unlockedBalanceAll(bool public_blockchain) const {
612  uint64_t result = 0;
613  for (uint32_t i = 0; i < numSubaddressAccounts(); ++i)
614  result += unlockedBalance(i, public_blockchain);
615  return result;
616  }
617 
622  virtual bool watchOnly() const = 0;
623 
628  virtual uint64_t blockChainHeight() const = 0;
629 
634  virtual uint64_t approximateBlockChainHeight() const = 0;
635 
641  virtual uint64_t estimateBlockChainHeight() const = 0;
647  virtual uint64_t daemonBlockChainHeight() const = 0;
648 
654  virtual uint64_t daemonBlockChainTargetHeight() const = 0;
655 
660  virtual bool synchronized() const = 0;
661 
662  static std::string displayAmount(uint64_t amount);
663  static uint64_t amountFromString(const std::string &amount);
664  static uint64_t amountFromDouble(double amount);
665  static std::string genPaymentId();
666  static bool paymentIdValid(const std::string &paiment_id);
667  static bool addressValid(const std::string &str, NetworkType nettype);
668  static bool addressValid(const std::string &str, bool testnet) // deprecated
669  {
670  return addressValid(str, testnet ? TESTNET : MAINNET);
671  }
672  static bool keyValid(const std::string &secret_key_string, const std::string &address_string, bool isViewKey, NetworkType nettype, std::string &error);
673  static bool keyValid(const std::string &secret_key_string, const std::string &address_string, bool isViewKey, bool testnet, std::string &error) // deprecated
674  {
675  return keyValid(secret_key_string, address_string, isViewKey, testnet ? TESTNET : MAINNET, error);
676  }
678  static std::string paymentIdFromAddress(const std::string &str, bool testnet) // deprecated
679  {
680  return paymentIdFromAddress(str, testnet ? TESTNET : MAINNET);
681  }
683  // Easylogger wrapper
684  static void init(const char *argv0, const char *default_log_base_name) { init(argv0, default_log_base_name, "", true); }
685  static void init(const char *argv0, const char *default_log_base_name, const std::string &log_path, bool console);
686  static void debug(const std::string &category, const std::string &str);
687  static void info(const std::string &category, const std::string &str);
688  static void warning(const std::string &category, const std::string &str);
689  static void error(const std::string &category, const std::string &str);
690 
694  virtual void startRefresh() = 0;
698  virtual void pauseRefresh() = 0;
699 
704  virtual bool refresh() = 0;
705 
709  virtual void refreshAsync() = 0;
710 
715  virtual bool rescanBlockchain() = 0;
716 
720  virtual void rescanBlockchainAsync() = 0;
721 
726  virtual void setAutoRefreshInterval(int millis) = 0;
727 
732  virtual int autoRefreshInterval() const = 0;
733 
738  virtual void addSubaddressAccount(const std::string& label) = 0;
742  virtual size_t numSubaddressAccounts() const = 0;
747  virtual size_t numSubaddresses(uint32_t accountIndex) const = 0;
753  virtual void addSubaddress(uint32_t accountIndex, const std::string& label) = 0;
759  virtual std::string getSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex) const = 0;
766  virtual void setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) = 0;
767 
772  virtual MultisigState multisig() const = 0;
777  virtual std::string getMultisigInfo() const = 0;
784  virtual std::string makeMultisig(const std::vector<std::string>& info, uint32_t threshold) = 0;
790  virtual std::string exchangeMultisigKeys(const std::vector<std::string> &info) = 0;
796  virtual bool finalizeMultisig(const std::vector<std::string>& extraMultisigInfo) = 0;
802  virtual bool exportMultisigImages(std::string& images) = 0;
808  virtual size_t importMultisigImages(const std::vector<std::string>& images) = 0;
813  virtual bool hasMultisigPartialKeyImages() const = 0;
814 
820  virtual PendingTransaction* restoreMultisigTransaction(const std::string& signData) = 0;
834  virtual PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id,
835  optional<uint64_t> amount, uint32_t mixin_count,
837  uint32_t subaddr_account = 0,
838  std::set<uint32_t> subaddr_indices = {}) = 0;
839 
846  virtual PendingTransaction * createSweepUnmixableTransaction() = 0;
847 
853  virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) = 0;
854 
859  virtual bool submitTransaction(const std::string &fileName) = 0;
860 
861 
866  virtual void disposeTransaction(PendingTransaction * t) = 0;
867 
873  virtual bool exportKeyImages(const std::string &filename) = 0;
874 
880  virtual bool importKeyImages(const std::string &filename) = 0;
881 
882 
883  virtual TransactionHistory * history() = 0;
884  virtual AddressBook * addressBook() = 0;
885  virtual Subaddress * subaddress() = 0;
886  virtual SubaddressAccount * subaddressAccount() = 0;
887  virtual void setListener(WalletListener *) = 0;
892  virtual uint32_t defaultMixin() const = 0;
897  virtual void setDefaultMixin(uint32_t arg) = 0;
898 
905  virtual bool setUserNote(const std::string &txid, const std::string &note) = 0;
911  virtual std::string getUserNote(const std::string &txid) const = 0;
912  virtual std::string getTxKey(const std::string &txid) const = 0;
913  virtual bool checkTxKey(const std::string &txid, std::string tx_key, const std::string &address, uint64_t &received, bool &in_pool, uint64_t &confirmations) = 0;
914  virtual std::string getTxProof(const std::string &txid, const std::string &address, const std::string &message) const = 0;
915  virtual bool checkTxProof(const std::string &txid, const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &received, bool &in_pool, uint64_t &confirmations) = 0;
916  virtual std::string getSpendProof(const std::string &txid, const std::string &message) const = 0;
917  virtual bool checkSpendProof(const std::string &txid, const std::string &message, const std::string &signature, bool &good) const = 0;
922  virtual std::string getReserveProof(bool all, uint32_t account_index, uint64_t amount, const std::string &message) const = 0;
923  virtual bool checkReserveProof(const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &total, uint64_t &spent) const = 0;
924 
925  /*
926  * \brief signMessage - sign a message with the spend private key
927  * \param message - the message to sign (arbitrary byte data)
928  * \return the signature
929  */
930  virtual std::string signMessage(const std::string &message) = 0;
938  virtual bool verifySignedMessage(const std::string &message, const std::string &addres, const std::string &signature) const = 0;
939 
945  virtual std::string signMultisigParticipant(const std::string &message) const = 0;
953  virtual bool verifyMessageWithPublicKey(const std::string &message, const std::string &publicKey, const std::string &signature) const = 0;
954 
955  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;
956 
957  virtual std::string getDefaultDataDir() const = 0;
958 
959  /*
960  * \brief rescanSpent - Rescan spent outputs - Can only be used with trusted daemon
961  * \return true on success
962  */
963  virtual bool rescanSpent() = 0;
964 
966  virtual bool blackballOutputs(const std::vector<std::string> &outputs, bool add) = 0;
967 
969  virtual bool blackballOutput(const std::string &amount, const std::string &offset) = 0;
970 
972  virtual bool unblackballOutput(const std::string &amount, const std::string &offset) = 0;
973 
975  virtual bool getRing(const std::string &key_image, std::vector<uint64_t> &ring) const = 0;
976 
978  virtual bool getRings(const std::string &txid, std::vector<std::pair<std::string, std::vector<uint64_t>>> &rings) const = 0;
979 
981  virtual bool setRing(const std::string &key_image, const std::vector<uint64_t> &ring, bool relative) = 0;
982 
984  virtual void segregatePreForkOutputs(bool segregate) = 0;
985 
987  virtual void segregationHeight(uint64_t height) = 0;
988 
990  virtual void keyReuseMitigation2(bool mitigation) = 0;
991 
993  virtual bool lightWalletLogin(bool &isNewWallet) const = 0;
994 
996  virtual bool lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status) = 0;
997 
999  virtual bool lockKeysFile() = 0;
1000  virtual bool unlockKeysFile() = 0;
1002  virtual bool isKeysFileLocked() = 0;
1003 
1008  virtual Device getDeviceType() const = 0;
1009 
1011  virtual uint64_t coldKeyImageSync(uint64_t &spent, uint64_t &unspent) = 0;
1012 };
1013 
1018 {
1019 
1029  virtual Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language, NetworkType nettype, uint64_t kdf_rounds = 1) = 0;
1030  Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language, bool testnet = false) // deprecated
1031  {
1032  return createWallet(path, password, language, testnet ? TESTNET : MAINNET);
1033  }
1034 
1044  virtual Wallet * openWallet(const std::string &path, const std::string &password, NetworkType nettype, uint64_t kdf_rounds = 1, WalletListener * listener = nullptr) = 0;
1045  Wallet * openWallet(const std::string &path, const std::string &password, bool testnet = false) // deprecated
1046  {
1047  return openWallet(path, password, testnet ? TESTNET : MAINNET);
1048  }
1049 
1060  virtual Wallet * recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic,
1061  NetworkType nettype = MAINNET, uint64_t restoreHeight = 0, uint64_t kdf_rounds = 1) = 0;
1062  Wallet * recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic,
1063  bool testnet = false, uint64_t restoreHeight = 0) // deprecated
1064  {
1065  return recoveryWallet(path, password, mnemonic, testnet ? TESTNET : MAINNET, restoreHeight);
1066  }
1067 
1077  virtual Wallet * recoveryWallet(const std::string &path, const std::string &mnemonic, NetworkType nettype, uint64_t restoreHeight = 0) = 0;
1078  Wallet * recoveryWallet(const std::string &path, const std::string &mnemonic, bool testnet = false, uint64_t restoreHeight = 0) // deprecated
1079  {
1080  return recoveryWallet(path, mnemonic, testnet ? TESTNET : MAINNET, restoreHeight);
1081  }
1082 
1096  virtual Wallet * createWalletFromKeys(const std::string &path,
1097  const std::string &password,
1098  const std::string &language,
1099  NetworkType nettype,
1100  uint64_t restoreHeight,
1101  const std::string &addressString,
1102  const std::string &viewKeyString,
1103  const std::string &spendKeyString = "",
1104  uint64_t kdf_rounds = 1) = 0;
1106  const std::string &password,
1107  const std::string &language,
1108  bool testnet,
1109  uint64_t restoreHeight,
1110  const std::string &addressString,
1111  const std::string &viewKeyString,
1112  const std::string &spendKeyString = "") // deprecated
1113  {
1114  return createWalletFromKeys(path, password, language, testnet ? TESTNET : MAINNET, restoreHeight, addressString, viewKeyString, spendKeyString);
1115  }
1116 
1129  virtual Wallet * createWalletFromKeys(const std::string &path,
1130  const std::string &language,
1131  NetworkType nettype,
1132  uint64_t restoreHeight,
1133  const std::string &addressString,
1134  const std::string &viewKeyString,
1135  const std::string &spendKeyString = "") = 0;
1137  const std::string &language,
1138  bool testnet,
1139  uint64_t restoreHeight,
1140  const std::string &addressString,
1141  const std::string &viewKeyString,
1142  const std::string &spendKeyString = "") // deprecated
1143  {
1144  return createWalletFromKeys(path, language, testnet ? TESTNET : MAINNET, restoreHeight, addressString, viewKeyString, spendKeyString);
1145  }
1146 
1159  virtual Wallet * createWalletFromDevice(const std::string &path,
1160  const std::string &password,
1161  NetworkType nettype,
1162  const std::string &deviceName,
1163  uint64_t restoreHeight = 0,
1164  const std::string &subaddressLookahead = "",
1165  uint64_t kdf_rounds = 1,
1166  WalletListener * listener = nullptr) = 0;
1167 
1173  virtual bool closeWallet(Wallet *wallet, bool store = true) = 0;
1174 
1175  /*
1176  * ! checks if wallet with the given name already exists
1177  */
1178 
1184  virtual bool walletExists(const std::string &path) = 0;
1185 
1198  virtual bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool no_spend_key, uint64_t kdf_rounds = 1) const = 0;
1199 
1210  virtual bool queryWalletDevice(Wallet::Device& device_type, const std::string &keys_file_name, const std::string &password, uint64_t kdf_rounds = 1) const = 0;
1211 
1217  virtual std::vector<std::string> findWallets(const std::string &path) = 0;
1218 
1220  virtual std::string errorString() const = 0;
1221 
1223  virtual void setDaemonAddress(const std::string &address) = 0;
1224 
1226  virtual bool connected(uint32_t *version = NULL) = 0;
1227 
1229  virtual uint64_t blockchainHeight() = 0;
1230 
1232  virtual uint64_t blockchainTargetHeight() = 0;
1233 
1235  virtual uint64_t networkDifficulty() = 0;
1236 
1238  virtual double miningHashRate() = 0;
1239 
1241  virtual uint64_t blockTarget() = 0;
1242 
1244  virtual bool isMining() = 0;
1245 
1247  virtual bool startMining(const std::string &address, uint32_t threads = 1, bool background_mining = false, bool ignore_battery = true) = 0;
1248 
1250  virtual bool stopMining() = 0;
1251 
1253  virtual std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const = 0;
1254 
1256  static std::tuple<bool, std::string, std::string, std::string, std::string> checkUpdates(const std::string &software, std::string subdir);
1257 };
1258 
1259 
1261 {
1262  // logging levels for underlying library
1263  enum LogLevel {
1272  };
1273 
1274  static WalletManager * getWalletManager();
1275  static void setLogLevel(int level);
1276  static void setLogCategories(const std::string &categories);
1277 };
1278 
1279 
1280 }
1281 
1282 namespace Bitelectroneum = Electroneum;
1283 
virtual std::vector< SubaddressAccountRow * > getAll() const =0
virtual uint64_t unlockTime() const =0
virtual std::string getUserNote(const std::string &txid) const =0
getUserNote - return an arbitrary string note attached to a txid
virtual bool setDevicePassphrase(const std::string &passphrase)
Definition: wallet2_api.h:462
virtual PendingTransaction * createSweepUnmixableTransaction()=0
createSweepUnmixableTransaction creates transaction with unmixable outputs.
virtual std::set< uint32_t > subaddrIndex() const =0
virtual std::string secretViewKey() const =0
secretViewKey - returns secret view key
std::string getOldBalance() const
Definition: wallet2_api.h:311
static void debug(const std::string &category, const std::string &str)
Definition: wallet.cpp:403
bool mainnet() const
Definition: wallet2_api.h:467
virtual void addSubaddressAccount(const std::string &label)=0
addSubaddressAccount - appends a new subaddress account at the end of the last major index of existin...
static void setLogLevel(int level)
std::string getLabel() const
Definition: wallet2_api.h:273
virtual void addRow(uint32_t accountIndex, const std::string &label)=0
virtual std::string hash() const =0
transaction_id
virtual bool lightWalletLogin(bool &isNewWallet) const =0
Light wallet authenticate and login.
const uint32_t T[512]
virtual std::string getMultisigInfo() const =0
getMultisigInfo
virtual uint32_t subaddrAccount() const =0
virtual void pauseRefresh()=0
pauseRefresh - pause refresh thread
The TransactionHistory - interface for displaying transaction history.
Definition: wallet2_api.h:203
virtual bool indeterminate() const
Definition: wallet2_api.h:340
virtual void segregatePreForkOutputs(bool segregate)=0
sets whether pre-fork outs are to be segregated
virtual int status() const =0
virtual uint64_t approximateBlockChainHeight() const =0
approximateBlockChainHeight - returns approximate blockchain height calculated from date/time ...
virtual int lookupPaymentID(const std::string &payment_id) const =0
Transaction-like interface for sending etn.
Definition: wallet2_api.h:133
virtual std::string errorString() const =0
virtual bool checkSpendProof(const std::string &txid, const std::string &message, const std::string &signature, bool &good) const =0
virtual uint64_t unlockedBalance(uint32_t accountIndex=0, bool public_blockchain=false) const =0
std::string publicKey
virtual std::string errorString() const =0
in case error status, returns error string
virtual bool watchOnly() const =0
watchOnly - checks if wallet is watch only
virtual bool store(const std::string &path)=0
store - stores wallet to file.
uint64_t unlockedBalanceAll(bool public_blockchain) const
Definition: wallet2_api.h:611
virtual std::string secretSpendKey() const =0
secretSpendKey - returns secret spend key
virtual void setAutoRefreshInterval(int millis)=0
setAutoRefreshInterval - setup interval for automatic refresh.
virtual bool closeWallet(Wallet *wallet, bool store=true)=0
Closes wallet. In case operation succeeded, wallet object deleted. in case operation failed...
virtual optional< std::string > onDevicePinRequest()
called by device when PIN is needed
Definition: wallet2_api.h:402
virtual void disposeTransaction(PendingTransaction *t)=0
disposeTransaction - destroys transaction object
::std::string string
Definition: gtest-port.h:1097
virtual Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language, NetworkType nettype, uint64_t kdf_rounds=1)=0
Creates new wallet.
Wallet * recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic, bool testnet=false, uint64_t restoreHeight=0)
Definition: wallet2_api.h:1062
virtual double miningHashRate()=0
returns current mining hash rate (0 if not mining)
SubaddressRow(std::size_t _rowId, const std::string &_address, const std::string &_label)
Definition: wallet2_api.h:261
virtual std::string errorString() const =0
virtual Wallet * createWalletFromKeys(const std::string &path, const std::string &password, const std::string &language, NetworkType nettype, uint64_t restoreHeight, const std::string &addressString, const std::string &viewKeyString, const std::string &spendKeyString="", uint64_t kdf_rounds=1)=0
recovers existing wallet using keys. Creates a view only wallet if spend key is omitted ...
std::size_t getRowId() const
Definition: wallet2_api.h:313
uint64_t height
Definition: blockchain.cpp:91
virtual bool commit(const std::string &filename="", bool overwrite=false)=0
optional(const T &t)
Definition: wallet2_api.h:60
virtual uint64_t amount() const =0
virtual Wallet * openWallet(const std::string &path, const std::string &password, NetworkType nettype, uint64_t kdf_rounds=1, WalletListener *listener=nullptr)=0
Opens existing wallet.
virtual void refreshed()=0
refreshed - called when wallet refreshed by background thread or explicitly refreshed by calling "ref...
virtual bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit=0, const std::string &daemon_username="", const std::string &daemon_password="", bool use_ssl=false, bool lightWallet=false)=0
init - initializes wallet with daemon connection params. if daemon_address is local address...
virtual std::vector< uint64_t > mixin() const =0
virtual std::vector< SubaddressRow * > getAll() const =0
virtual void refresh(uint32_t accountIndex)=0
virtual bool unlockKeysFile()=0
virtual uint64_t confirmations() const =0
static bool addressValid(const std::string &str, bool testnet)
Definition: wallet2_api.h:668
static std::string paymentIdFromAddress(const std::string &str, bool testnet)
Definition: wallet2_api.h:678
Transfer(uint64_t _amount, const std::string &address)
virtual uint64_t fee() const =0
virtual uint64_t blockChainHeight() const =0
blockChainHeight - returns current blockchain height
virtual std::string confirmationMessage() const =0
virtual uint64_t amount() const =0
virtual bool checkTxProof(const std::string &txid, const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &received, bool &in_pool, uint64_t &confirmations)=0
virtual Wallet * recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic, NetworkType nettype=MAINNET, uint64_t restoreHeight=0, uint64_t kdf_rounds=1)=0
recovers existing wallet using mnemonic (electrum seed)
virtual bool blackballOutput(const std::string &amount, const std::string &offset)=0
blackballs an output
virtual bool deleteRow(std::size_t rowId)=0
virtual ~Wallet()=0
Definition: wallet.cpp:294
virtual uint64_t fee() const =0
unsigned char uint8_t
Definition: stdint.h:124
virtual std::string errorString() const =0
returns verbose error string regarding last error;
virtual std::vector< TransactionInfo * > getAll() const =0
virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename)=0
loadUnsignedTx - creates transaction from unsigned tx file
AddressBookRow(std::size_t _rowId, const std::string &_address, const std::string &_paymentId, const std::string &_description)
Definition: wallet2_api.h:218
virtual void setRecoveringFromDevice(bool recoveringFromDevice)=0
setRecoveringFromDevice - set state to recovering from device
virtual bool setPassword(const std::string &password)=0
static uint64_t maximumAllowedAmount()
Definition: wallet.cpp:388
virtual optional< std::string > onDevicePassphraseRequest(bool on_device)
called by device when passphrase entry is needed
Definition: wallet2_api.h:409
std::string getAddress() const
Definition: wallet2_api.h:307
virtual bool addRow(const std::string &dst_addr, const std::string &payment_id, const std::string &description)=0
virtual bool verifyMessageWithPublicKey(const std::string &message, const std::string &publicKey, const std::string &signature) const =0
verifyMessageWithPublicKey verifies that message was signed with the given public key ...
std::string getLabel() const
Definition: wallet2_api.h:308
virtual AddressBook * addressBook()=0
WalletManager - provides functions to manage wallets.
Definition: wallet2_api.h:1017
virtual uint64_t daemonBlockChainTargetHeight() const =0
daemonBlockChainTargetHeight - returns daemon blockchain target height
virtual std::vector< std::string > signersKeys() const =0
signersKeys
virtual bool queryWalletDevice(Wallet::Device &device_type, const std::string &keys_file_name, const std::string &password, uint64_t kdf_rounds=1) const =0
determine the key storage for the specified wallet file
virtual std::string address(uint32_t accountIndex=0, uint32_t addressIndex=0) const =0
virtual std::vector< uint64_t > amount() const =0
virtual std::string publicMultisigSignerKey() const =0
publicMultisigSignerKey - returns public signer key
virtual uint64_t blockTarget()=0
returns current block target
std::string getAddress() const
Definition: wallet2_api.h:272
virtual void onSetWallet(Wallet *wallet)
If the listener is created before the wallet this enables to set created wallet object.
Definition: wallet2_api.h:422
virtual bool getRing(const std::string &key_image, std::vector< uint64_t > &ring) const =0
gets the ring used for a key image, if any
virtual bool rescanSpent()=0
virtual void setDaemonAddress(const std::string &address)=0
set the daemon address (hostname and port)
virtual std::string getDefaultDataDir() const =0
virtual uint64_t blockchainHeight()=0
returns current blockchain height
virtual std::string getReserveProof(bool all, uint32_t account_index, uint64_t amount, const std::string &message) const =0
getReserveProof - Generates a proof that proves the reserve of unspent funds Parameters account_index...
virtual void setLabel(uint32_t accountIndex, const std::string &label)=0
static std::string paymentIdFromAddress(const std::string &str, NetworkType nettype)
Definition: wallet.cpp:378
virtual uint32_t defaultMixin() const =0
defaultMixin - returns number of mixins used in transactions
virtual NetworkType nettype() const =0
virtual void segregationHeight(uint64_t height)=0
sets the height where segregation should occur
virtual bool setRing(const std::string &key_image, const std::vector< uint64_t > &ring, bool relative)=0
sets the ring used for a key image
virtual std::string multisigSignData()=0
multisigSignData
virtual bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool no_spend_key, uint64_t kdf_rounds=1) const =0
verifyWalletPassword - check if the given filename is the wallet
virtual bool submitTransaction(const std::string &fileName)=0
submitTransaction - submits transaction in signed tx file
virtual uint64_t getRefreshFromBlockHeight() const =0
getRestoreHeight - get wallet creation height
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, uint32_t subaddr_account=0, std::set< uint32_t > subaddr_indices={})=0
createTransaction creates transaction. if dst_addr is an integrated address, payment_id is ignored ...
virtual void refresh()=0
return true
virtual int direction() const =0
static std::tuple< bool, std::string, std::string, std::string, std::string > checkUpdates(const std::string &software, std::string subdir)
checks for an update and returns version, hash and url
virtual bool rescanBlockchain()=0
rescanBlockchain - rescans the wallet, updating transactions from daemon
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
bool isAddressLocal(const std::string &address)
Definition: utils.cpp:42
virtual TransactionInfo * transaction(int index) const =0
virtual bool lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status)=0
Initiates a light wallet import wallet request.
virtual void setListener(WalletListener *)=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 int errorCode() const =0
Wallet * recoveryWallet(const std::string &path, const std::string &mnemonic, bool testnet=false, uint64_t restoreHeight=0)
Definition: wallet2_api.h:1078
virtual std::string getTxKey(const std::string &txid) const =0
virtual bool trustedDaemon() const =0
virtual void setRefreshFromBlockHeight(uint64_t refresh_from_block_height)=0
setRefreshFromBlockHeight - start refresh from block height on recover
virtual void setLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label)=0
virtual std::string signMultisigParticipant(const std::string &message) const =0
signMultisigParticipant signs given message with the multisig public signer key
static WalletManager * getWalletManager()
virtual bool importKeyImages(const std::string &filename)=0
importKeyImages - imports key images from file
virtual int status() const =0
returns wallet status (Status_Ok | Status_Error)
virtual Wallet * createWalletFromDevice(const std::string &path, const std::string &password, NetworkType nettype, const std::string &deviceName, uint64_t restoreHeight=0, const std::string &subaddressLookahead="", uint64_t kdf_rounds=1, WalletListener *listener=nullptr)=0
creates wallet using hardware device.
virtual void newBlock(uint64_t height)=0
newBlock - called when new block received
unsigned int uint32_t
Definition: stdint.h:126
virtual std::string integratedAddress(const std::string &payment_id) const =0
integratedAddress - returns integrated address for current wallet address and given payment_id...
static bool keyValid(const std::string &secret_key_string, const std::string &address_string, bool isViewKey, bool testnet, std::string &error)
Definition: wallet2_api.h:673
virtual uint64_t coldKeyImageSync(uint64_t &spent, uint64_t &unspent)=0
cold-device protocol key image sync
virtual std::string signMessage(const std::string &message)=0
virtual std::string keysFilename() const =0
keysFilename - returns keys filename. usually this formed as "wallet_filename".keys ...
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
static void error(const std::string &category, const std::string &str)
Definition: wallet.cpp:415
virtual void unconfirmedETNReceived(const std::string &txId, uint64_t amount)=0
unconfirmedETNReceived - called when payment arrived in tx pool
virtual void updated()=0
updated - generic callback, called when any event (sent/received/block reveived/etc) happened with th...
static std::string genPaymentId()
Definition: wallet.cpp:318
std::size_t getRowId() const
Definition: wallet2_api.h:274
virtual int autoRefreshInterval() const =0
autoRefreshInterval - returns automatic refresh interval in millis
virtual double progress() const
Definition: wallet2_api.h:339
std::string getPaymentId() const
Definition: wallet2_api.h:233
SubaddressAccountRow(std::size_t _rowId, const std::string &_address, const std::string &_label, const std::string &_balance, const std::string &_unlockedBalance, const std::string &_old_balance, const std::string &_old_unlocked_balance)
Definition: wallet2_api.h:288
virtual Subaddress * subaddress()=0
virtual bool sign(const std::string &signedFileName)=0
sign - Sign txs and saves to file
virtual PendingTransaction * restoreMultisigTransaction(const std::string &signData)=0
restoreMultisigTransaction creates PendingTransaction from signData
virtual bool isPending() const =0
virtual bool exportMultisigImages(std::string &images)=0
exportMultisigImages - exports transfers&#39; key images
The AddressBook - interface for Book.
Definition: wallet2_api.h:241
unsigned __int64 uint64_t
Definition: stdint.h:136
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="")
Definition: wallet2_api.h:1136
virtual std::string path() const =0
virtual std::string publicSpendKey() const =0
publicSpendKey - returns public spend key
virtual void onDeviceButtonPressed()
called by device if the button was pressed
Definition: wallet2_api.h:397
virtual bool isKeysFileLocked()=0
returns true if the keys file is locked
virtual uint64_t dust() const =0
#define false
Definition: stdbool.h:38
virtual std::vector< uint32_t > subaddrAccount() const =0
static void warning(const std::string &category, const std::string &str)
Definition: wallet.cpp:411
Wallet * openWallet(const std::string &path, const std::string &password, bool testnet=false)
Definition: wallet2_api.h:1045
Transaction-like interface for sending etn.
Definition: wallet2_api.h:72
virtual void refreshAsync()=0
refreshAsync - refreshes wallet asynchronously.
static std::string displayAmount(uint64_t amount)
Definition: wallet.cpp:299
virtual bool connectToDaemon()=0
connectToDaemon - connects to the daemon. TODO: check if it can be removed
virtual std::string label() const =0
virtual TransactionHistory * history()=0
virtual std::string getSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex) const =0
getSubaddressLabel - gets the label of the specified subaddress
virtual int count() const =0
AddressBookRow - provides functions to manage address book.
Definition: wallet2_api.h:216
version
Supported socks variants.
Definition: socks.h:57
virtual bool lockKeysFile()=0
locks/unlocks the keys file; returns true on success
Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language, bool testnet=false)
Definition: wallet2_api.h:1030
virtual std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const =0
resolves an OpenAlias address to a electroneum address
virtual bool hasMultisigPartialKeyImages() const =0
hasMultisigPartialKeyImages - checks if wallet needs to import multisig key images from other partici...
virtual void addSubaddress(uint32_t accountIndex, const std::string &label)=0
addSubaddress - appends a new subaddress at the end of the last minor index of the specified subaddre...
static uint64_t amountFromDouble(double amount)
Definition: wallet.cpp:311
std::string message("Message requiring signing")
virtual uint64_t blockHeight() const =0
virtual bool stopMining()=0
stops mining
virtual std::string exchangeMultisigKeys(const std::vector< std::string > &info)=0
exchange_multisig_keys - provides additional key exchange round for arbitrary multisig schemes (like ...
virtual void addRow(const std::string &label)=0
virtual bool unblackballOutput(const std::string &amount, const std::string &offset)=0
unblackballs an output
virtual bool walletExists(const std::string &path)=0
TODO: delme walletExists - check if the given filename is the wallet.
virtual bool setDevicePin(const std::string &pin)
Definition: wallet2_api.h:461
virtual bool blackballOutputs(const std::vector< std::string > &outputs, bool add)=0
blackballs a set of outputs
static bool paymentIdValid(const std::string &paiment_id)
Definition: wallet.cpp:325
virtual std::time_t timestamp() const =0
virtual std::vector< std::string > txid() const =0
virtual bool getRings(const std::string &txid, std::vector< std::pair< std::string, std::vector< uint64_t >>> &rings) const =0
gets the rings used for a txid, if any
virtual void onDeviceProgress(const DeviceProgress &event)
Signalizes device operation progress.
Definition: wallet2_api.h:417
Definition: main.cpp:101
virtual ConnectionStatus connected() const =0
connected - checks if the wallet connected to the daemon
POD_CLASS signature
Definition: crypto.h:108
std::size_t getRowId() const
Definition: wallet2_api.h:234
virtual void keyReuseMitigation2(bool mitigation)=0
secondary key reuse mitigation
virtual size_t importMultisigImages(const std::vector< std::string > &images)=0
importMultisigImages - imports other participants&#39; multisig images
Wallet * createWalletFromKeys(const std::string &path, const std::string &password, const std::string &language, bool testnet, uint64_t restoreHeight, const std::string &addressString, const std::string &viewKeyString, const std::string &spendKeyString="")
Definition: wallet2_api.h:1105
virtual bool connected(uint32_t *version=NULL)=0
returns whether the daemon can be reached, and its version number
string daemon_address
Definition: transfers.cpp:42
virtual void setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label)=0
setSubaddressLabel - sets the label of the specified subaddress
static void init(const char *argv0, const char *default_log_base_name)
Definition: wallet2_api.h:684
virtual void setSubaddressLookahead(uint32_t major, uint32_t minor)=0
setSubaddressLookahead - set size of subaddress lookahead
POD_CLASS key_image
Definition: crypto.h:102
virtual void statusWithErrorString(int &status, std::string &errorString) const =0
returns both error and error string atomically. suggested to use in instead of status() and errorStri...
virtual std::vector< std::string > paymentId() const =0
virtual std::vector< std::string > findWallets(const std::string &path)=0
findWallets - searches for the wallet files by given path name recursively
virtual void etnReceived(const std::string &txId, uint64_t amount)=0
etnReceived - called when etn received
virtual std::string seed() const =0
virtual void etnSpent(const std::string &txId, uint64_t amount)=0
etnSpent - called when etn spent
virtual bool checkReserveProof(const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &total, uint64_t &spent) const =0
bool stagenet() const
Definition: wallet2_api.h:469
virtual uint64_t txCount() const =0
txCount - number of transactions current transaction will be splitted to
virtual bool finalizeMultisig(const std::vector< std::string > &extraMultisigInfo)=0
finalizeMultisig - finalizes N - 1 / N multisig wallets creation
virtual std::string getTxProof(const std::string &txid, const std::string &address, const std::string &message) const =0
virtual ~WalletListener()=0
Definition: wallet.cpp:296
virtual void setTrustedDaemon(bool arg)=0
virtual bool isMining()=0
returns true iff mining
virtual SubaddressAccount * subaddressAccount()=0
virtual void setRecoveringFromSeed(bool recoveringFromSeed)=0
setRecoveringFromSeed - set state recover form seed
virtual uint64_t estimateBlockChainHeight() const =0
estimateBlockChainHeight - returns estimate blockchain height. More accurate than approximateBlockCha...
signed __int64 int64_t
Definition: stdint.h:135
virtual Device getDeviceType() const =0
Queries backing device for wallet keys.
static void setLogCategories(const std::string &categories)
int bool
Definition: stdbool.h:36
virtual bool checkTxKey(const std::string &txid, std::string tx_key, const std::string &address, uint64_t &received, bool &in_pool, uint64_t &confirmations)=0
virtual bool exportKeyImages(const std::string &filename)=0
exportKeyImages - exports key images to file
virtual void setDefaultMixin(uint32_t arg)=0
setDefaultMixin - setum number of mixins to be used for new transactions
virtual void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const =0
returns current hard fork info
virtual uint64_t minMixinCount() const =0
bool testnet() const
Definition: wallet2_api.h:468
virtual bool createWatchOnly(const std::string &path, const std::string &password, const std::string &language) const =0
createWatchOnly - Creates a watch only wallet
const T & operator*() const
Definition: wallet2_api.h:61
static uint64_t amountFromString(const std::string &amount)
Definition: wallet.cpp:304
std::string getDescription() const
Definition: wallet2_api.h:232
virtual bool setUserNote(const std::string &txid, const std::string &note)=0
setUserNote - attach an arbitrary string note to a txid
virtual const std::vector< Transfer > & transfers() const =0
only applicable for output transactions
virtual std::string filename() const =0
filename - returns wallet filename
static void info(const std::string &category, const std::string &str)
Definition: wallet.cpp:407
std::string getBalance() const
Definition: wallet2_api.h:309
virtual std::string getSeedLanguage() const =0
virtual uint64_t balance(uint32_t accountIndex=0, bool public_blockchain=false) const =0
const char * address
Definition: multisig.cpp:37
virtual std::string errorString() const =0
virtual std::string makeMultisig(const std::vector< std::string > &info, uint32_t threshold)=0
makeMultisig - switches wallet in multisig state. The one and only creation phase for N / N wallets ...
virtual uint64_t daemonBlockChainHeight() const =0
daemonBlockChainHeight - returns daemon blockchain height
virtual std::string paymentId() const =0
virtual std::vector< uint64_t > fee() const =0
uint64_t balanceAll(bool public_blockchain) const
Definition: wallet2_api.h:604
virtual bool useForkRules(uint8_t version, int64_t early_blocks) const =0
check if hard fork rules should be used
virtual void onDeviceButtonRequest(uint64_t code)
called by device if the action is required
Definition: wallet2_api.h:392
virtual bool isFailed() const =0
virtual size_t numSubaddresses(uint32_t accountIndex) const =0
numSubaddresses - returns the number of existing subaddresses associated with the specified subaddres...
virtual std::vector< std::string > recipientAddress() const =0
std::string getAddress() const
Definition: wallet2_api.h:231
virtual std::string publicViewKey() const =0
publicViewKey - returns public view key
std::string mainAddress() const
Definition: wallet2_api.h:464
virtual void startRefresh()=0
StartRefresh - Start/resume refresh thread (refresh every 10 seconds)
virtual bool refresh()=0
refresh - refreshes the wallet, updating transactions from daemon
static bool addressValid(const std::string &str, NetworkType nettype)
Definition: wallet.cpp:336
virtual int status() const =0
virtual size_t numSubaddressAccounts() const =0
numSubaddressAccounts - returns the number of existing subaddress accounts
std::string getOldUnlockedBalance() const
Definition: wallet2_api.h:312
virtual std::string getSpendProof(const std::string &txid, const std::string &message) const =0
virtual uint64_t networkDifficulty()=0
returns current network difficulty
The TransactionInfo - interface for displaying transaction information.
Definition: wallet2_api.h:168
virtual uint64_t txCount() const =0
txCount - number of transactions current transaction will be splitted to
DeviceProgress(double progress, bool indeterminate=false)
Definition: wallet2_api.h:337
virtual std::vector< std::set< uint32_t > > subaddrIndices() const =0
virtual MultisigState multisig() const =0
multisig - returns current state of multisig wallet creation process
virtual void setSeedLanguage(const std::string &arg)=0
std::string getUnlockedBalance() const
Definition: wallet2_api.h:310
virtual std::vector< AddressBookRow * > getAll() const =0
virtual uint64_t blockchainTargetHeight()=0
returns current blockchain target height
static bool keyValid(const std::string &secret_key_string, const std::string &address_string, bool isViewKey, NetworkType nettype, std::string &error)
Definition: wallet.cpp:342
Interface for wallet operations. TODO: check if /include/IWallet.h is still actual.
Definition: wallet2_api.h:430
virtual void rescanBlockchainAsync()=0
rescanBlockchainAsync - rescans wallet asynchronously, starting from genesys
uint8_t threshold
Definition: blockchain.cpp:92
void onStartup()
Definition: utils.cpp:52