diff --git a/external/trezor-common b/external/trezor-common index cb238cb1f..31a0073c6 160000 --- a/external/trezor-common +++ b/external/trezor-common @@ -1 +1 @@ -Subproject commit cb238cb1f134accc4200217d9511115a8f61c6cb +Subproject commit 31a0073c62738827b48d725facd3766879429124 diff --git a/src/device/device.hpp b/src/device/device.hpp index 866e2c676..215e97eb6 100644 --- a/src/device/device.hpp +++ b/src/device/device.hpp @@ -236,6 +236,7 @@ namespace hw { virtual bool compute_key_image(const cryptonote::account_keys& ack, const crypto::public_key& out_key, const crypto::key_derivation& recv_derivation, size_t real_output_index, const cryptonote::subaddress_index& received_index, cryptonote::keypair& in_ephemeral, crypto::key_image& ki) { return false; } virtual void computing_key_images(bool started) {}; virtual void set_network_type(cryptonote::network_type network_type) { } + virtual void display_address(const cryptonote::subaddress_index& index, const boost::optional &payment_id) {} protected: device_mode mode; diff --git a/src/device/device_cold.hpp b/src/device/device_cold.hpp index 31b1504ab..22708c46a 100644 --- a/src/device/device_cold.hpp +++ b/src/device/device_cold.hpp @@ -47,6 +47,7 @@ namespace hw { std::vector tx_recipients; // as entered by user boost::optional bp_version; // BP version to use boost::optional client_version; // Signing client version to use (testing) + boost::optional hard_fork; // hard fork being used for the transaction }; class device_cold { diff --git a/src/device_trezor/device_trezor.cpp b/src/device_trezor/device_trezor.cpp index b1022dd9c..a77f6697f 100644 --- a/src/device_trezor/device_trezor.cpp +++ b/src/device_trezor/device_trezor.cpp @@ -200,6 +200,10 @@ namespace trezor { } } + void device_trezor::display_address(const cryptonote::subaddress_index& index, const boost::optional &payment_id) { + get_address(index, payment_id, true); + } + /* ======================================================================= */ /* Helpers */ /* ======================================================================= */ @@ -209,8 +213,12 @@ namespace trezor { /* ======================================================================= */ std::shared_ptr device_trezor::get_address( + const boost::optional & subaddress, + const boost::optional & payment_id, + bool show_address, const boost::optional> & path, const boost::optional & network_type){ + CHECK_AND_ASSERT_THROW_MES(!payment_id || !subaddress || subaddress->is_zero(), "Subaddress cannot be integrated"); TREZOR_AUTO_LOCK_CMD(); require_connected(); device_state_reset_unsafe(); @@ -218,6 +226,14 @@ namespace trezor { auto req = std::make_shared(); this->set_msg_addr(req.get(), path, network_type); + req->set_show_display(show_address); + if (subaddress){ + req->set_account(subaddress->major); + req->set_minor(subaddress->minor); + } + if (payment_id){ + req->set_payment_id(std::string(payment_id->data, 8)); + } auto response = this->client_exchange(req); MTRACE("Get address response received"); diff --git a/src/device_trezor/device_trezor.hpp b/src/device_trezor/device_trezor.hpp index 0e91847dc..a26a42788 100644 --- a/src/device_trezor/device_trezor.hpp +++ b/src/device_trezor/device_trezor.hpp @@ -110,6 +110,7 @@ namespace trezor { /* ======================================================================= */ bool get_public_address(cryptonote::account_public_address &pubkey) override; bool get_secret_keys(crypto::secret_key &viewkey , crypto::secret_key &spendkey) override; + void display_address(const cryptonote::subaddress_index& index, const boost::optional &payment_id) override; /* ======================================================================= */ /* TREZOR PROTOCOL */ @@ -119,6 +120,9 @@ namespace trezor { * Get address. Throws. */ std::shared_ptr get_address( + const boost::optional & subaddress = boost::none, + const boost::optional & payment_id = boost::none, + bool show_address = false, const boost::optional> & path = boost::none, const boost::optional & network_type = boost::none); diff --git a/src/device_trezor/trezor/protocol.cpp b/src/device_trezor/trezor/protocol.cpp index 5fe08abbe..61e51be14 100644 --- a/src/device_trezor/trezor/protocol.cpp +++ b/src/device_trezor/trezor/protocol.cpp @@ -27,6 +27,7 @@ // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // +#include "version.h" #include "protocol.hpp" #include #include @@ -502,6 +503,8 @@ namespace tx { tsx_data.set_num_inputs(static_cast(tx.sources.size())); tsx_data.set_mixin(static_cast(tx.sources[0].outputs.size() - 1)); tsx_data.set_account(tx.subaddr_account); + tsx_data.set_monero_version(std::string(MONERO_VERSION) + "|" + MONERO_VERSION_TAG); + tsx_data.set_hard_fork(m_aux_data->hard_fork ? m_aux_data->hard_fork.get() : 0); assign_to_repeatable(tsx_data.mutable_minor_indices(), tx.subaddr_indices.begin(), tx.subaddr_indices.end()); // Rsig decision diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 02a099811..43323be2c 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -177,8 +177,8 @@ namespace " account tag [ ...]\n" " account untag [ ...]\n" " account tag_description "); - const char* USAGE_ADDRESS("address [ new