diff options
| author | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2024-01-04 22:17:42 +0100 |
|---|---|---|
| committer | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2024-01-04 22:17:42 +0100 |
| commit | 12bc3aaaa9aafb7db0b08ad1343f830070aa18d3 (patch) | |
| tree | 605be942e089a30acc1d7e76a39645f921638473 /libbridge/src | |
| parent | 1e52f62e78918ae1805eddca435014d4f27e4ae8 (diff) | |
drop cache, it is causing more trouble than it's worth
implement anonero's fork functions in bridge. Calling it RC39 to not break versioning.
Diffstat (limited to 'libbridge/src')
| -rw-r--r-- | libbridge/src/main/cpp/helpers.cpp | 14 | ||||
| -rw-r--r-- | libbridge/src/main/cpp/helpers.hpp | 3 | ||||
| -rw-r--r-- | libbridge/src/main/cpp/wallet2_api.h | 82 | ||||
| -rw-r--r-- | libbridge/src/main/cpp/wallet2_api_c.cpp | 107 | ||||
| -rw-r--r-- | libbridge/src/main/cpp/wallet2_api_c.h | 53 |
5 files changed, 252 insertions, 7 deletions
diff --git a/libbridge/src/main/cpp/helpers.cpp b/libbridge/src/main/cpp/helpers.cpp index 064ce36..fac131a 100644 --- a/libbridge/src/main/cpp/helpers.cpp +++ b/libbridge/src/main/cpp/helpers.cpp @@ -143,3 +143,17 @@ const char* vectorToString(const std::set<uint32_t>& intSet, const std::string s memcpy(buffer, str.c_str(), size + 1); return buffer; } + +std::set<std::string> splitString(const std::string& str, const std::string& delim) { + std::set<std::string> tokens; + size_t pos = 0; + std::string token; + std::string content = str; // Copy of str so we can safely erase content + while ((pos = content.find(delim)) != std::string::npos) { + token = content.substr(0, pos); + tokens.insert(token); + content.erase(0, pos + delim.length()); + } + tokens.insert(content); // Inserting the last token + return tokens; +}
\ No newline at end of file diff --git a/libbridge/src/main/cpp/helpers.hpp b/libbridge/src/main/cpp/helpers.hpp index 5d9b4a4..45fa624 100644 --- a/libbridge/src/main/cpp/helpers.hpp +++ b/libbridge/src/main/cpp/helpers.hpp @@ -7,4 +7,5 @@ const char* vectorToString(const std::vector<std::string>& vec, const std::strin const char* vectorToString(const std::vector<uint32_t>& vec, const std::string separator); const char* vectorToString(const std::vector<uint64_t>& vec, const std::string separator); const char* vectorToString(const std::vector<std::set<uint32_t>>& vec, const std::string separator); -const char* vectorToString(const std::set<uint32_t>& intSet, const std::string separator);
\ No newline at end of file +const char* vectorToString(const std::set<uint32_t>& intSet, const std::string separator); +std::set<std::string> splitString(const std::string& str, const std::string& delim);
\ No newline at end of file diff --git a/libbridge/src/main/cpp/wallet2_api.h b/libbridge/src/main/cpp/wallet2_api.h index 646e585..5612c66 100644 --- a/libbridge/src/main/cpp/wallet2_api.h +++ b/libbridge/src/main/cpp/wallet2_api.h @@ -38,6 +38,7 @@ #include <ctime> #include <iostream> #include <stdexcept> +#include <cstdint> // Public interface for libwallet library namespace Monero { @@ -287,6 +288,7 @@ struct CoinsInfo virtual bool unlocked() const = 0; virtual std::string pubKey() const = 0; virtual bool coinbase() const = 0; + virtual std::string description() const = 0; }; struct Coins @@ -296,9 +298,12 @@ struct Coins virtual CoinsInfo * coin(int index) const = 0; virtual std::vector<CoinsInfo*> getAll() const = 0; virtual void refresh() = 0; + virtual void setFrozen(std::string public_key) = 0; virtual void setFrozen(int index) = 0; + virtual void thaw(std::string public_key) = 0; virtual void thaw(int index) = 0; virtual bool isTransferUnlocked(uint64_t unlockTime, uint64_t blockHeight) = 0; + virtual void setDescription(const std::string &public_key, const std::string &description) = 0; }; struct SubaddressRow { @@ -485,6 +490,12 @@ struct Wallet ConnectionStatus_WrongVersion }; + enum BackgroundSyncType { + BackgroundSync_Off = 0, + BackgroundSync_ReusePassword = 1, + BackgroundSync_CustomPassword = 2 + }; + virtual ~Wallet() = 0; virtual std::string seed(const std::string& seed_offset = "") const = 0; virtual std::string getSeedLanguage() const = 0; @@ -660,6 +671,7 @@ struct Wallet result += unlockedBalance(i); return result; } + virtual uint64_t viewOnlyBalance(uint32_t accountIndex, const std::vector<std::string> &key_images = {}) const = 0; /** * @brief watchOnly - checks if wallet is watch only @@ -740,6 +752,10 @@ struct Wallet static void warning(const std::string &category, const std::string &str); static void error(const std::string &category, const std::string &str); + virtual bool getPolyseed(std::string &seed, std::string &passphrase) const = 0; + static bool createPolyseed(std::string &seed_words, std::string &err, const std::string &language = "English"); + static std::vector<std::pair<std::string, std::string>> getPolyseedLanguages(); + /** * @brief StartRefresh - Start/resume refresh thread (refresh every 10 seconds) */ @@ -883,7 +899,8 @@ struct Wallet optional<std::vector<uint64_t>> amount, uint32_t mixin_count, PendingTransaction::Priority = PendingTransaction::Priority_Low, uint32_t subaddr_account = 0, - std::set<uint32_t> subaddr_indices = {}) = 0; + std::set<uint32_t> subaddr_indices = {}, + const std::set<std::string> &preferred_inputs = {}) = 0; /*! * \brief createTransaction creates transaction. if dst_addr is an integrated address, payment_id is ignored @@ -902,7 +919,8 @@ struct Wallet 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; + std::set<uint32_t> subaddr_indices = {}, + const std::set<std::string> &preferred_inputs = {}) = 0; /*! * \brief createSweepUnmixableTransaction creates transaction with unmixable outputs. @@ -940,6 +958,8 @@ struct Wallet virtual uint64_t estimateTransactionFee(const std::vector<std::pair<std::string, uint64_t>> &destinations, PendingTransaction::Priority priority) const = 0; + virtual bool hasUnknownKeyImages() const = 0; + /*! * \brief exportKeyImages - exports key images to file * \param filename @@ -976,6 +996,43 @@ struct Wallet */ virtual bool scanTransactions(const std::vector<std::string> &txids) = 0; + /*! + * \brief setupBackgroundSync - setup background sync mode with just a view key + * \param background_sync_type - the mode the wallet background syncs in + * \param wallet_password + * \param background_cache_password - custom password to encrypt background cache, only needed for custom password background sync type + * \return - true on success + */ + virtual bool setupBackgroundSync(const BackgroundSyncType background_sync_type, const std::string &wallet_password, const optional<std::string> &background_cache_password) = 0; + + /*! + * \brief getBackgroundSyncType - get mode the wallet background syncs in + * \return - the type, or off if type is unknown + */ + virtual BackgroundSyncType getBackgroundSyncType() const = 0; + + /** + * @brief startBackgroundSync - sync the chain in the background with just view key + */ + virtual bool startBackgroundSync() = 0; + + /** + * @brief stopBackgroundSync - bring back spend key and process background synced txs + * \param wallet_password + */ + virtual bool stopBackgroundSync(const std::string &wallet_password) = 0; + + /** + * @brief isBackgroundSyncing - returns true if the wallet is background syncing + */ + virtual bool isBackgroundSyncing() const = 0; + + /** + * @brief isBackgroundWallet - returns true if the wallet is a background wallet + */ + virtual bool isBackgroundWallet() const = 0; + + virtual TransactionHistory * history() = 0; virtual AddressBook * addressBook() = 0; virtual Coins * coins() = 0; @@ -1298,6 +1355,27 @@ struct WalletManager WalletListener * listener = nullptr) = 0; /*! + * \brief creates a wallet from a polyseed mnemonic phrase + * \param path Name of the wallet file to be created + * \param password Password of wallet file + * \param nettype Network type + * \param mnemonic Polyseed mnemonic + * \param passphrase Optional seed offset passphrase + * \param newWallet Whether it is a new wallet + * \param restoreHeight Override the embedded restore height + * \param kdf_rounds Number of rounds for key derivation function + * @return + */ + virtual Wallet * createWalletFromPolyseed(const std::string &path, + const std::string &password, + NetworkType nettype, + const std::string &mnemonic, + const std::string &passphrase = "", + bool newWallet = true, + uint64_t restore_height = 0, + uint64_t kdf_rounds = 1) = 0; + + /*! * \brief Closes wallet. In case operation succeeded, wallet object deleted. in case operation failed, wallet object not deleted * \param wallet previously opened / created wallet instance * \return None diff --git a/libbridge/src/main/cpp/wallet2_api_c.cpp b/libbridge/src/main/cpp/wallet2_api_c.cpp index 97b6fa8..388c0b0 100644 --- a/libbridge/src/main/cpp/wallet2_api_c.cpp +++ b/libbridge/src/main/cpp/wallet2_api_c.cpp @@ -475,6 +475,15 @@ bool MONERO_CoinsInfo_coinbase(void* coinsInfo_ptr) { Monero::CoinsInfo *coinsInfo = reinterpret_cast<Monero::CoinsInfo*>(coinsInfo_ptr); return coinsInfo->internalOutputIndex(); } +// virtual std::string description() const = 0; +const char* MONERO_CoinsInfo_description(void* coinsInfo_ptr) { + Monero::CoinsInfo *coinsInfo = reinterpret_cast<Monero::CoinsInfo*>(coinsInfo_ptr); + std::string str = coinsInfo->description(); + const std::string::size_type size = str.size(); + char *buffer = new char[size + 1]; //we need extra char for NUL + memcpy(buffer, str.c_str(), size + 1); + return buffer; +} // coins @@ -496,6 +505,11 @@ void MONERO_Coins_refresh(void* coins_ptr) { Monero::Coins *coins = reinterpret_cast<Monero::Coins*>(coins_ptr); return coins->refresh(); } +// virtual void setFrozen(std::string public_key) = 0; +void MONERO_Coins_setFrozenByPublicKey(void* coins_ptr, const char* public_key) { + Monero::Coins *coins = reinterpret_cast<Monero::Coins*>(coins_ptr); + return coins->setFrozen(std::string(public_key)); +} // virtual void setFrozen(int index) = 0; void MONERO_Coins_setFrozen(void* coins_ptr, int index) { Monero::Coins *coins = reinterpret_cast<Monero::Coins*>(coins_ptr); @@ -506,11 +520,21 @@ void MONERO_Coins_thaw(void* coins_ptr, int index) { Monero::Coins *coins = reinterpret_cast<Monero::Coins*>(coins_ptr); return coins->thaw(index); } +// virtual void thaw(std::string public_key) = 0; +void MONERO_Coins_thawByPublicKey(void* coins_ptr, const char* public_key) { + Monero::Coins *coins = reinterpret_cast<Monero::Coins*>(coins_ptr); + return coins->thaw(std::string(public_key)); +} // virtual bool isTransferUnlocked(uint64_t unlockTime, uint64_t blockHeight) = 0; bool MONERO_Coins_isTransferUnlocked(void* coins_ptr, uint64_t unlockTime, uint64_t blockHeight) { Monero::Coins *coins = reinterpret_cast<Monero::Coins*>(coins_ptr); return coins->isTransferUnlocked(unlockTime, blockHeight); } +// virtual void setDescription(const std::string &public_key, const std::string &description) = 0; +void MONERO_Coins_setDescription(void* coins_ptr, const char* public_key, const char* description) { + Monero::Coins *coins = reinterpret_cast<Monero::Coins*>(coins_ptr); + coins->setDescription(std::string(public_key), std::string(description)); +} // SubaddressRow @@ -923,6 +947,11 @@ uint64_t MONERO_Wallet_unlockedBalance(void* wallet_ptr, uint32_t accountIndex) return wallet->unlockedBalance(accountIndex); } +uint64_t MONERO_Wallet_viewOnlyBalance(void* wallet_ptr, uint32_t accountIndex) { + Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); + return wallet->viewOnlyBalance(accountIndex); +} + // TODO bool MONERO_Wallet_watchOnly(void* wallet_ptr) { Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); @@ -1035,6 +1064,29 @@ void MONERO_Wallet_init3(void* wallet_ptr, const char* argv0, const char* defaul Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); return wallet->init(argv0, default_log_base_name, log_path, console); } +const char* MONERO_Wallet_getPolyseed(void* wallet_ptr, const char* passphrase) { + Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); + std::string seed = ""; + std::string _passphrase = std::string(passphrase); + wallet->getPolyseed(seed, _passphrase); + std::string str = seed; + const std::string::size_type size = str.size(); + char *buffer = new char[size + 1]; //we need extra char for NUL + memcpy(buffer, str.c_str(), size + 1); + return buffer; +} +// static bool createPolyseed(std::string &seed_words, std::string &err, const std::string &language = "English"); +const char* MONERO_Wallet_createPolyseed() { + std::string seed_words = ""; + std::string err; + Monero::Wallet::createPolyseed(seed_words, err); + std::string str = seed_words; + const std::string::size_type size = str.size(); + char *buffer = new char[size + 1]; //we need extra char for NUL + memcpy(buffer, str.c_str(), size + 1); + return buffer; +} + void MONERO_Wallet_startRefresh(void* wallet_ptr) { Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); return wallet->startRefresh(); @@ -1107,16 +1159,19 @@ const char* MONERO_Wallet_getMultisigInfo(void* wallet_ptr) { void* MONERO_Wallet_createTransaction(void* wallet_ptr, const char* dst_addr, const char* payment_id, uint64_t amount, uint32_t mixin_count, int pendingTransactionPriority, - uint32_t subaddr_account) { + uint32_t subaddr_account, + const char* preferredInputs, const char* separator) { Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); Monero::optional<uint64_t> optAmount; if (amount != 0) { optAmount = amount; } + std::set<uint32_t> subaddr_indices = {}; + std::set<std::string> preferred_inputs = splitString(std::string(preferredInputs), std::string(separator)); return wallet->createTransaction(std::string(dst_addr), std::string(payment_id), optAmount, mixin_count, Monero::PendingTransaction::Priority_Low, - subaddr_account /*, subaddr_indices */); + subaddr_account, subaddr_indices); } void* MONERO_Wallet_loadUnsignedTx(void* wallet_ptr, const char* fileName) { Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); @@ -1126,6 +1181,10 @@ bool MONERO_Wallet_submitTransaction(void* wallet_ptr, const char* fileName) { Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); return wallet->submitTransaction(std::string(fileName)); } +bool MONERO_Wallet_hasUnknownKeyImages(void* wallet_ptr) { + Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); + return wallet->hasUnknownKeyImages(); +} bool MONERO_Wallet_exportKeyImages(void* wallet_ptr, const char* filename, bool all) { Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); return wallet->exportKeyImages(std::string(filename), all); @@ -1142,6 +1201,36 @@ bool MONERO_Wallet_importOutputs(void* wallet_ptr, const char* filename) { Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); return wallet->importOutputs(std::string(filename)); } +// virtual bool setupBackgroundSync(const BackgroundSyncType background_sync_type, const std::string &wallet_password, const optional<std::string> &background_cache_password) = 0; +bool MONERO_Wallet_setupBackgroundSync(void* wallet_ptr, int background_sync_type, const char* wallet_password, const char* background_cache_password) { + Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); + return wallet->setupBackgroundSync(Monero::Wallet::BackgroundSyncType::BackgroundSync_CustomPassword, std::string(wallet_password), std::string(background_cache_password)); +} +// virtual BackgroundSyncType getBackgroundSyncType() const = 0; +int MONERO_Wallet_getBackgroundSyncType(void* wallet_ptr) { + Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); + return wallet->getBackgroundSyncType(); +} +// virtual bool startBackgroundSync() = 0; +bool MONERO_Wallet_startBackgroundSync(void* wallet_ptr) { + Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); + return wallet->startBackgroundSync(); +} +// virtual bool stopBackgroundSync(const std::string &wallet_password) = 0; +bool MONERO_Wallet_stopBackgroundSync(void* wallet_ptr, const char* wallet_password) { + Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); + return wallet->stopBackgroundSync(std::string(wallet_password)); +} +// virtual bool isBackgroundSyncing() const = 0; +bool MONERO_Wallet_isBackgroundSyncing(void* wallet_ptr) { + Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); + return wallet->hasUnknownKeyImages(); +} +// virtual bool isBackgroundWallet() const = 0; +bool MONERO_Wallet_isBackgroundWallet(void* wallet_ptr) { + Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); + return wallet->isBackgroundWallet(); +} void* MONERO_Wallet_history(void* wallet_ptr) { Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); return wallet->history(); @@ -1325,6 +1414,20 @@ void* MONERO_WalletManager_recoveryWallet(const char* path, const char* password return reinterpret_cast<void*>(wallet); } +void* MONERO_WalletManager_createWalletFromPolyseed(const char* path, const char* password, + int nettype, const char* mnemonic, const char* passphrase, + bool newWallet, uint64_t restore_height, uint64_t kdf_rounds) { + return Monero::WalletManagerFactory::getWalletManager()->createWalletFromPolyseed(std::string(path), + std::string(password), + static_cast<Monero::NetworkType>(nettype), + std::string(mnemonic), + std::string(passphrase), + newWallet, + restore_height, + kdf_rounds); +} + + bool MONERO_WalletManager_closeWallet(void* wallet_ptr, bool store) { Monero::Wallet *wallet = reinterpret_cast<Monero::Wallet*>(wallet_ptr); return Monero::WalletManagerFactory::getWalletManager()->closeWallet( diff --git a/libbridge/src/main/cpp/wallet2_api_c.h b/libbridge/src/main/cpp/wallet2_api_c.h index 6e9c971..53b75f2 100644 --- a/libbridge/src/main/cpp/wallet2_api_c.h +++ b/libbridge/src/main/cpp/wallet2_api_c.h @@ -293,6 +293,8 @@ bool MONERO_CoinsInfo_unlocked(void* coinsInfo_ptr); const char* MONERO_CoinsInfo_pubKey(void* coinsInfo_ptr); // virtual bool coinbase() const = 0; bool MONERO_CoinsInfo_coinbase(void* coinsInfo_ptr); +// virtual std::string description() const = 0; +const char* MONERO_CoinsInfo_description(void* coinsInfo_ptr); // }; // struct Coins // { @@ -304,12 +306,18 @@ void* MONERO_Coins_coin(void* coins_ptr, int index); // virtual std::vector<CoinsInfo*> getAll() const = 0; // virtual void refresh() = 0; void MONERO_Coins_refresh(void* coins_ptr); +// virtual void setFrozen(std::string public_key) = 0; +void MONERO_Coins_setFrozenByPublicKey(void* coins_ptr, const char* public_key); // virtual void setFrozen(int index) = 0; void MONERO_Coins_setFrozen(void* coins_ptr, int index); // virtual void thaw(int index) = 0; void MONERO_Coins_thaw(void* coins_ptr, int index); +// virtual void thaw(std::string public_key) = 0; +void MONERO_Coins_thawByPublicKey(void* coins_ptr, const char* public_key); // virtual bool isTransferUnlocked(uint64_t unlockTime, uint64_t blockHeight) = 0; bool MONERO_Coins_isTransferUnlocked(void* coins_ptr, uint64_t unlockTime, uint64_t blockHeight); +// virtual void setDescription(const std::string &public_key, const std::string &description) = 0; +void MONERO_Coins_setDescription(void* coins_ptr, const char* public_key, const char* description); // }; // struct SubaddressRow { // public: @@ -467,6 +475,14 @@ const int WalletConnectionStatus_Connected = 1; // ConnectionStatus_WrongVersion const int WalletConnectionStatus_WrongVersion = 2; // }; +// enum BackgroundSyncType { +// BackgroundSync_Off = 0, +const int WalletBackgroundSync_Off = 0; +// BackgroundSync_ReusePassword = 1, +const int WalletBackgroundSync_ReusePassword = 1; +// BackgroundSync_CustomPassword = 2 +const int BackgroundSync_CustomPassword = 2; +// }; // virtual ~Wallet() = 0; // virtual std::string seed(const std::string& seed_offset = "") const = 0; const char* MONERO_Wallet_seed(void* wallet_ptr, const char* seed_offset); @@ -561,6 +577,8 @@ uint64_t MONERO_Wallet_unlockedBalance(void* wallet_ptr, uint32_t accountIndex); // return result; // } // virtual bool watchOnly() const = 0; +// virtual uint64_t viewOnlyBalance(uint32_t accountIndex, const std::vector<std::string> &key_images = {}) const = 0; +uint64_t MONERO_Wallet_viewOnlyBalance(void* wallet_ptr, uint32_t accountIndex); bool MONERO_Wallet_watchOnly(void* wallet_ptr); // virtual bool isDeterministic() const = 0; bool MONERO_Wallet_isDeterministic(void* wallet_ptr); @@ -617,6 +635,10 @@ void MONERO_Wallet_init3(void* wallet_ptr, const char* argv0, const char* defaul // static void warning(const std::string &category, const std::string &str); // static void error(const std::string &category, const std::string &str); // virtual void startRefresh() = 0; +// virtual bool getPolyseed(std::string &seed, std::string &passphrase) const = 0; +const char* MONERO_Wallet_getPolyseed(void* wallet_ptr, const char* passphrase); +// static bool createPolyseed(std::string &seed_words, std::string &err, const std::string &language = "English"); +const char* MONERO_Wallet_createPolyseed(); void MONERO_Wallet_startRefresh(void* wallet_ptr); // virtual void pauseRefresh() = 0; void MONERO_Wallet_pauseRefresh(void* wallet_ptr); @@ -662,11 +684,13 @@ const char* MONERO_Wallet_getMultisigInfo(void* wallet_ptr); // 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; +// std::set<uint32_t> subaddr_indices = {}, +// const std::set<std::string> &preferred_inputs = {) = 0; void* MONERO_Wallet_createTransaction(void* wallet_ptr, const char* dst_addr, const char* payment_id, uint64_t amount, uint32_t mixin_count, int pendingTransactionPriority, - uint32_t subaddr_account); // std::nullopt + uint32_t subaddr_account, + const char* preferredInputs, const char* separator); // virtual PendingTransaction * createSweepUnmixableTransaction() = 0; // virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) = 0; void* MONERO_Wallet_loadUnsignedTx(void* wallet_ptr, const char* unsigned_filename); @@ -675,6 +699,8 @@ bool MONERO_Wallet_submitTransaction(void* wallet_ptr, const char* fileName); // virtual void disposeTransaction(PendingTransaction * t) = 0; // virtual uint64_t estimateTransactionFee(const std::vector<std::pair<std::string, uint64_t>> &destinations, // PendingTransaction::Priority priority) const = 0; +// virtual bool hasUnknownKeyImages() const = 0; +bool MONERO_Wallet_hasUnknownKeyImages(void* wallet_ptr); // virtual bool exportKeyImages(const std::string &filename, bool all = false) = 0; bool MONERO_Wallet_exportKeyImages(void* wallet_ptr, const char* filename, bool all); // virtual bool importKeyImages(const std::string &filename) = 0; @@ -684,6 +710,18 @@ bool MONERO_Wallet_exportOutputs(void* wallet_ptr, const char* filename, bool al // virtual bool importOutputs(const std::string &filename) = 0; bool MONERO_Wallet_importOutputs(void* wallet_ptr, const char* filename); // virtual bool scanTransactions(const std::vector<std::string> &txids) = 0; +// virtual bool setupBackgroundSync(const BackgroundSyncType background_sync_type, const std::string &wallet_password, const optional<std::string> &background_cache_password) = 0; +bool MONERO_Wallet_setupBackgroundSync(void* wallet_ptr, int background_sync_type, const char* wallet_password, const char* background_cache_password); +// virtual BackgroundSyncType getBackgroundSyncType() const = 0; +int MONERO_Wallet_getBackgroundSyncType(void* wallet_ptr); +// virtual bool startBackgroundSync() = 0; +bool MONERO_Wallet_startBackgroundSync(void* wallet_ptr); +// virtual bool stopBackgroundSync(const std::string &wallet_password) = 0; +bool MONERO_Wallet_stopBackgroundSync(void* wallet_ptr, const char* wallet_password); +// virtual bool isBackgroundSyncing() const = 0; +bool MONERO_Wallet_isBackgroundSyncing(void* wallet_ptr); +// virtual bool isBackgroundWallet() const = 0; +bool MONERO_Wallet_isBackgroundWallet(void* wallet_ptr); // virtual TransactionHistory * history() = 0; void* MONERO_Wallet_history(void* wallet_ptr); // virtual AddressBook * addressBook() = 0; @@ -836,6 +874,17 @@ void* MONERO_WalletManager_recoveryWallet(const char* path, const char* password // const std::string &subaddressLookahead = "", // uint64_t kdf_rounds = 1, // WalletListener * listener = nullptr) = 0; +// virtual Wallet * createWalletFromPolyseed(const std::string &path, +// const std::string &password, +// NetworkType nettype, +// const std::string &mnemonic, +// const std::string &passphrase = "", +// bool newWallet = true, +// uint64_t restore_height = 0, +// uint64_t kdf_rounds = 1) = 0; +void* MONERO_WalletManager_createWalletFromPolyseed(const char* path, const char* password, + int nettype, const char* mnemonic, const char* passphrase, + bool newWallet, uint64_t restore_height, uint64_t kdf_rounds); // virtual bool closeWallet(Wallet *wallet, bool store = true) = 0; bool MONERO_WalletManager_closeWallet(void* wallet_ptr, bool store); // virtual bool walletExists(const std::string &path) = 0; |
