From c0c3627bd2e9d60bc3cd971ac87c18f8077d9b9d Mon Sep 17 00:00:00 2001 From: SomberNight Date: Mon, 6 Apr 2020 13:54:17 +0200 Subject: [PATCH] bitbox02: adapt to updated master --- electrum/plugins/bitbox02/bitbox02.py | 21 +++++---------------- electrum/plugins/hw_wallet/plugin.py | 2 +- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/electrum/plugins/bitbox02/bitbox02.py b/electrum/plugins/bitbox02/bitbox02.py index c7098d631..b56075aa2 100644 --- a/electrum/plugins/bitbox02/bitbox02.py +++ b/electrum/plugins/bitbox02/bitbox02.py @@ -569,39 +569,28 @@ class BitBox02Plugin(HW_PluginBase): def setup_device( self, device_info: DeviceInfo, wizard: BaseWizard, purpose: int ): - devmgr = self.device_manager() device_id = device_info.device.id_ - client = devmgr.client_by_id(device_id) - if client is None: - raise UserFacingException( - _("Failed to create a client for this device.") - + "\n" - + _("Make sure it is in the correct state.") - ) - client.handler = self.create_handler(wizard) + client = self.scan_and_create_client_for_device(device_id=device_id, wizard=wizard) if client.bitbox02_device is None: client.pairing_dialog() + return client def get_xpub( - self, device_id: bytes, derivation: str, xtype: str, wizard: BaseWizard + self, device_id: str, derivation: str, xtype: str, wizard: BaseWizard ): if xtype not in self.SUPPORTED_XTYPES: raise ScriptTypeNotSupported( _("This type of script is not supported with {}.").format(self.device) ) - devmgr = self.device_manager() - client = devmgr.client_by_id(device_id) + client = self.scan_and_create_client_for_device(device_id=device_id, wizard=wizard) if client.bitbox02_device is None: - client.handler = self.create_handler(wizard) client.pairing_dialog() return client.get_xpub(derivation, xtype) def get_client(self, keystore: BitBox02_KeyStore, force_pair: bool = True): devmgr = self.device_manager() handler = keystore.handler - with devmgr.hid_lock: - client = devmgr.client_for_keystore(self, handler, keystore, force_pair) - + client = devmgr.client_for_keystore(self, handler, keystore, force_pair) return client def show_address( diff --git a/electrum/plugins/hw_wallet/plugin.py b/electrum/plugins/hw_wallet/plugin.py index 68335f746..884732dad 100644 --- a/electrum/plugins/hw_wallet/plugin.py +++ b/electrum/plugins/hw_wallet/plugin.py @@ -165,7 +165,7 @@ class HW_PluginBase(BasePlugin): handler: Optional['HardwareHandlerBase']) -> Optional['HardwareClientBase']: raise NotImplementedError() - def get_xpub(self, device_id, derivation: str, xtype, wizard: 'BaseWizard') -> str: + def get_xpub(self, device_id: str, derivation: str, xtype, wizard: 'BaseWizard') -> str: raise NotImplementedError() def create_handler(self, window) -> 'HardwareHandlerBase':