bitbox02: adapt to updated master

This commit is contained in:
SomberNight 2020-04-06 13:54:17 +02:00 committed by TheCharlatan
parent a4fe14bb82
commit c0c3627bd2
No known key found for this signature in database
GPG key ID: 9B79B45691DB4173
2 changed files with 6 additions and 17 deletions

View file

@ -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)
return client
def show_address(

View file

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