commit 018e073dd3b91b9d5b6884d12e7cc6ec0c838806
parent 64677facf209b7e1b670bf8c78332eb773460286
Author: ThomasV <electrumdev@gmail.com>
Date: Wed, 11 Feb 2015 14:18:06 +0100
Merge pull request #1015 from m0mchil/show_on_trezor
Confirm address on TREZOR
Diffstat:
1 file changed, 21 insertions(+), 0 deletions(-)
diff --git a/plugins/trezor.py b/plugins/trezor.py
@@ -131,6 +131,10 @@ class Plugin(BasePlugin):
self.wallet.trezor_sign(tx)
except Exception as e:
tx.error = str(e)
+ @hook
+ def receive_menu(self, menu, addrs):
+ if not self.wallet.is_watching_only() and len(addrs) == 1:
+ menu.addAction(_("Show on TREZOR"), lambda: self.wallet.show_address(addrs[0]))
def settings_widget(self, window):
return EnterButton(_('Settings'), self.settings_dialog)
@@ -277,6 +281,21 @@ class TrezorWallet(BIP32_HD_Wallet):
# twd.emit(SIGNAL('trezor_done'))
#return str(decrypted_msg)
+ def show_address(self, address):
+ if not self.check_proper_device():
+ give_error('Wrong device or password')
+ try:
+ address_path = self.address_id(address)
+ address_n = self.get_client().expand_path(address_path)
+ except Exception, e:
+ give_error(e)
+ try:
+ self.get_client().get_address('Bitcoin', address_n, True)
+ except Exception, e:
+ give_error(e)
+ finally:
+ twd.emit(SIGNAL('trezor_done'))
+
def sign_message(self, address, message, password):
if not self.check_proper_device():
give_error('Wrong device or password')
@@ -426,6 +445,8 @@ class TrezorQtGuiMixin(object):
message = "Confirm transaction fee on Trezor device to continue"
elif msg.code == 7:
message = "Confirm message to sign on Trezor device to continue"
+ elif msg.code == 10:
+ message = "Confirm address on Trezor device to continue"
else:
message = "Check Trezor device to continue"
twd.start(message)