plugin: separate get_xpub and setup_device
This commit is contained in:
@@ -204,17 +204,15 @@ class BaseWizard(object):
|
|||||||
self.choice_dialog(title=title, message=msg, choices=choices, run_next=self.on_device)
|
self.choice_dialog(title=title, message=msg, choices=choices, run_next=self.on_device)
|
||||||
|
|
||||||
def on_device(self, name, device_info):
|
def on_device(self, name, device_info):
|
||||||
plugin = self.plugins.get_plugin(name)
|
self.plugin = self.plugins.get_plugin(name)
|
||||||
self.plugin = plugin
|
self.plugin.setup_device(device_info, self)
|
||||||
xpub = plugin.setup_device(device_info, 'm', self)
|
|
||||||
f = lambda x: self.run('on_hardware_account_id', name, device_info, x)
|
f = lambda x: self.run('on_hardware_account_id', name, device_info, x)
|
||||||
self.account_id_dialog(run_next=f)
|
self.account_id_dialog(run_next=f)
|
||||||
|
|
||||||
def on_hardware_account_id(self, name, device_info, account_id):
|
def on_hardware_account_id(self, name, device_info, account_id):
|
||||||
from keystore import hardware_keystore, bip44_derivation
|
from keystore import hardware_keystore, bip44_derivation
|
||||||
plugin = self.plugins.get_plugin(name)
|
|
||||||
derivation = bip44_derivation(int(account_id))
|
derivation = bip44_derivation(int(account_id))
|
||||||
xpub = plugin.setup_device(device_info, derivation, self)
|
xpub = self.plugin.get_xpub(device_info.device.id_, derivation, self)
|
||||||
d = {
|
d = {
|
||||||
'type': 'hardware',
|
'type': 'hardware',
|
||||||
'hw_type': name,
|
'hw_type': name,
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ class TrezorCompatiblePlugin(HW_PluginBase):
|
|||||||
client.load_device_by_xprv(item, pin, passphrase_protection,
|
client.load_device_by_xprv(item, pin, passphrase_protection,
|
||||||
label, language)
|
label, language)
|
||||||
|
|
||||||
def setup_device(self, device_info, derivation, wizard):
|
def setup_device(self, device_info, wizard):
|
||||||
'''Called when creating a new wallet. Select the device to use. If
|
'''Called when creating a new wallet. Select the device to use. If
|
||||||
the device is uninitialized, go through the intialization
|
the device is uninitialized, go through the intialization
|
||||||
process.'''
|
process.'''
|
||||||
@@ -209,7 +209,13 @@ class TrezorCompatiblePlugin(HW_PluginBase):
|
|||||||
handler = self.create_handler(wizard)
|
handler = self.create_handler(wizard)
|
||||||
client.handler = handler
|
client.handler = handler
|
||||||
self.initialize_device(device_id, wizard, handler)
|
self.initialize_device(device_id, wizard, handler)
|
||||||
|
client.handler = wizard
|
||||||
|
client.get_xpub('m')
|
||||||
|
client.used()
|
||||||
|
|
||||||
|
def get_xpub(self, device_id, derivation, wizard):
|
||||||
|
devmgr = self.device_manager()
|
||||||
|
client = devmgr.client_by_id(device_id)
|
||||||
client.handler = wizard
|
client.handler = wizard
|
||||||
xpub = client.get_xpub(derivation)
|
xpub = client.get_xpub(derivation)
|
||||||
client.used()
|
client.used()
|
||||||
|
|||||||
Reference in New Issue
Block a user