aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.h
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-12-12 11:53:42 +0200
committerRiccardo Spagni <ric@spagni.net>2018-12-12 11:53:42 +0200
commit0b31baf6e4ce272b0b65e9d5337d1a4c933471cb (patch)
tree64d74190c831dc7b296d9ef1e6ae8c62501ca490 /src/wallet/wallet2.h
parentMerge pull request #4787 (diff)
parentdevice/trezor: device/trezor: correct device initialization, status check (diff)
downloadmonero-0b31baf6e4ce272b0b65e9d5337d1a4c933471cb.tar.xz
Merge pull request #4839
d71f89e2 device/trezor: device/trezor: correct device initialization, status check (Dusan Klinec) 65b9bca7 device/trezor: python2 compatibility - bundle dependencies (Dusan Klinec) 9cf636af device/trezor: ask for KI sync on first refresh (Dusan Klinec) d21dad70 device: enable to use multiple independent device wallets (Dusan Klinec) 318cc784 device/trezor: passphrase entry on host (Dusan Klinec)
Diffstat (limited to 'src/wallet/wallet2.h')
-rw-r--r--src/wallet/wallet2.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index d07385e96..91c68bf3c 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -100,11 +100,26 @@ namespace tools
virtual void on_lw_money_received(uint64_t height, const crypto::hash &txid, uint64_t amount) {}
virtual void on_lw_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, uint64_t amount) {}
virtual void on_lw_money_spent(uint64_t height, const crypto::hash &txid, uint64_t amount) {}
+ // Device callbacks
+ virtual void on_button_request() {}
+ virtual void on_pin_request(epee::wipeable_string & pin) {}
+ virtual void on_passphrase_request(bool on_device, epee::wipeable_string & passphrase) {}
// Common callbacks
virtual void on_pool_tx_removed(const crypto::hash &txid) {}
virtual ~i_wallet2_callback() {}
};
+ class wallet_device_callback : public hw::i_device_callback
+ {
+ public:
+ wallet_device_callback(wallet2 * wallet): wallet(wallet) {};
+ void on_button_request() override;
+ void on_pin_request(epee::wipeable_string & pin) override;
+ void on_passphrase_request(bool on_device, epee::wipeable_string & passphrase) override;
+ private:
+ wallet2 * wallet;
+ };
+
struct tx_dust_policy
{
uint64_t dust_threshold;
@@ -156,6 +171,7 @@ namespace tools
{
friend class ::Serialization_portability_wallet_Test;
friend class wallet_keys_unlocker;
+ friend class wallet_device_callback;
public:
static constexpr const std::chrono::seconds rpc_timeout = std::chrono::minutes(3) + std::chrono::seconds(30);
@@ -177,6 +193,7 @@ namespace tools
static bool has_testnet_option(const boost::program_options::variables_map& vm);
static bool has_stagenet_option(const boost::program_options::variables_map& vm);
static std::string device_name_option(const boost::program_options::variables_map& vm);
+ static std::string device_derivation_path_option(const boost::program_options::variables_map &vm);
static void init_options(boost::program_options::options_description& desc_params);
//! Uses stdin and stdout. Returns a wallet2 if no errors.
@@ -795,6 +812,7 @@ namespace tools
bool is_transfer_unlocked(uint64_t unlock_time, uint64_t block_height) const;
uint64_t get_last_block_reward() const { return m_last_block_reward; }
+ uint64_t get_device_last_key_image_sync() const { return m_device_last_key_image_sync; }
template <class t_archive>
inline void serialize(t_archive &a, const unsigned int ver)
@@ -903,6 +921,9 @@ namespace tools
if(ver < 26)
return;
a & m_tx_device;
+ if(ver < 27)
+ return;
+ a & m_device_last_key_image_sync;
}
/*!
@@ -964,6 +985,8 @@ namespace tools
void confirm_non_default_ring_size(bool always) { m_confirm_non_default_ring_size = always; }
const std::string & device_name() const { return m_device_name; }
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; }
bool get_tx_key(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);
@@ -1287,6 +1310,11 @@ namespace tools
void setup_new_blockchain();
void create_keys_file(const std::string &wallet_, bool watch_only, const epee::wipeable_string &password, bool create_address_file);
+ wallet_device_callback * get_device_callback();
+ void on_button_request();
+ void on_pin_request(epee::wipeable_string & pin);
+ void on_passphrase_request(bool on_device, epee::wipeable_string & passphrase);
+
cryptonote::account_base m_account;
boost::optional<epee::net_utils::http::login> m_daemon_login;
std::string m_daemon_address;
@@ -1365,6 +1393,8 @@ namespace tools
std::unordered_set<crypto::hash> m_scanned_pool_txs[2];
size_t m_subaddress_lookahead_major, m_subaddress_lookahead_minor;
std::string m_device_name;
+ std::string m_device_derivation_path;
+ uint64_t m_device_last_key_image_sync;
// Aux transaction data from device
std::unordered_map<crypto::hash, std::string> m_tx_device;
@@ -1398,9 +1428,10 @@ namespace tools
bool m_devices_registered;
std::shared_ptr<tools::Notify> m_tx_notify;
+ std::unique_ptr<wallet_device_callback> m_device_callback;
};
}
-BOOST_CLASS_VERSION(tools::wallet2, 26)
+BOOST_CLASS_VERSION(tools::wallet2, 27)
BOOST_CLASS_VERSION(tools::wallet2::transfer_details, 10)
BOOST_CLASS_VERSION(tools::wallet2::multisig_info, 1)
BOOST_CLASS_VERSION(tools::wallet2::multisig_info::LR, 0)