diff options
Diffstat (limited to 'libbridge/src/main/cpp/wallet2_api.h')
| -rw-r--r-- | libbridge/src/main/cpp/wallet2_api.h | 82 |
1 files changed, 80 insertions, 2 deletions
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 |
