Browse Source

bitbox02: adapt to updated master

hard-fail-on-bad-server-string
SomberNight 5 years ago
committed by TheCharlatan
parent
commit
c0c3627bd2
No known key found for this signature in database GPG Key ID: 9B79B45691DB4173
  1. 21
      electrum/plugins/bitbox02/bitbox02.py
  2. 2
      electrum/plugins/hw_wallet/plugin.py

21
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(

2
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':

Loading…
Cancel
Save