diff options
author | Tadeas Moravec <moravec.tadeas@gmail.com> | 2019-04-10 11:20:12 +0200 |
---|---|---|
committer | Tadeas Moravec <moravec.tadeas@gmail.com> | 2019-08-22 16:03:22 +0200 |
commit | 63186a01ce1603c65771a3ef91f29f3e91679d42 (patch) | |
tree | 2537dd559bf198574351db3759e75e8d2046ad74 /src/wallet/wallet2.h | |
parent | Merge pull request #5827 (diff) | |
download | monero-63186a01ce1603c65771a3ef91f29f3e91679d42.tar.xz |
Wallet: Option to export data to ASCII
New CLI wallet variable: export-format with options "binary" (the default),
or "ascii". "Binary" behaves as before, "ascii" forces the wallet to convert
data to ASCII using base64.
Reading files from the disk tries to auto detect what format has been
used (using a magic string added when exporting the data).
Implements https://github.com/monero-project/monero/issues/2859
Diffstat (limited to 'src/wallet/wallet2.h')
-rw-r--r-- | src/wallet/wallet2.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index c2e34dd76..e1aca1e89 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -227,6 +227,11 @@ private: BackgroundMiningNo = 2, }; + enum ExportFormat { + Binary = 0, + Ascii, + }; + static const char* tr(const char* str); static bool has_testnet_option(const boost::program_options::variables_map& vm); @@ -1050,6 +1055,8 @@ private: void device_name(const std::string & device_name) { m_device_name = device_name; } const std::string & device_derivation_path() const { return m_device_derivation_path; } void device_derivation_path(const std::string &device_derivation_path) { m_device_derivation_path = device_derivation_path; } + const ExportFormat & export_format() const { return m_export_format; } + inline void set_export_format(const ExportFormat& export_format) { m_export_format = export_format; } bool get_tx_key_cached(const crypto::hash &txid, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys) const; void set_tx_key(const crypto::hash &txid, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys); @@ -1300,6 +1307,9 @@ private: bool frozen(const crypto::key_image &ki) const; bool frozen(const transfer_details &td) const; + bool save_to_file(const std::string& path_to_file, const std::string& binary, bool is_printable = false) const; + static bool load_from_file(const std::string& path_to_file, std::string& target_str, size_t max_size = 1000000000); + uint64_t get_bytes_sent() const; uint64_t get_bytes_received() const; @@ -1546,6 +1556,8 @@ private: std::shared_ptr<tools::Notify> m_tx_notify; std::unique_ptr<wallet_device_callback> m_device_callback; + + ExportFormat m_export_format; }; } BOOST_CLASS_VERSION(tools::wallet2, 28) |