exchange.
Added the following signatures in the mention files:
wallet/wallet2.h
+ std::string export_key_images_string(bool all = false) const;
+ uint64_t import_key_images_string(const std::string &data, uint64_t &spent, uint64_t &unspent);
M bool wallet2::export_key_images(const std::string &filename, bool all) const
wallet/api/pending_transaction.h
+ std::string commit_string() override;
wallet/api/unsigned_transaction.h
+ std::string signAsString() override;
wallet/api/wallet.h:
+ bool submitTransactionFromString(const std::string &fileName) override;
+ virtual UnsignedTransaction * loadUnsignedTxFromString(const std::string &unsigned_filename) override;
+ std::string exportKeyImagesAsString(bool all = false) override;
+ bool importKeyImagesFromString(const std::string &data) override;
+ std::string exportOutputsAsString(bool all = false) override;
+ bool importOutputsFromString(const std::string &data) override;
wallet/api/wallet2_api.h
+ virtual std::string commit_string() = 0;
+ virtual std::string signAsString() = 0;
+ virtual UnsignedTransaction * loadUnsignedTxFromString(const std::string &unsigned_filename) = 0;
+ virtual bool submitTransactionFromString(const std::string &fileName) = 0;
+ virtual bool importKeyImagesFromString(const std::string &data) = 0;
+ virtual std::string exportOutputsAsString(bool all = false) = 0;
+ virtual bool importOutputsFromString(const std::string &data) = 0;
+ uint64_t import_key_images_string(const std::string &data, uint64_t &spent, uint64_t &unspent);
And the implementations in:
wallet/wallet2.cpp
wallet/api/pending_transaction.cpp
wallet/api/unsigned_transaction.cpp
wallet/api/wallet.cpp
The method `bool wallet2::export_key_images(const std::string &filename, bool all) const` is modified to
use `std::string export_key_images_string(bool all = false) const;` to get the string to write to the file.
IMO that would be the perfect way to do it everywhere, but in the other methods it would require more modifications, so the other I duplicated and removed the part writing to the file and return instead a std::string, or
use a std::string for the actual payload instead of a file path.
One thing to mention is I remove in one or two log messages the filename, and the other is in `export_key_images` probably(almost sure) is now the performance messed up.
This modifications was done to get all the necessary data for offline signing via UR or any other channel not
using files as medium. IMO it had been better to not implement the filehandling direct in wallet2 or in the wallet api but rather in monero-wallet-cli and monero-gui itself, but it is like it is.