wizard: ask accound id after device setup
This commit is contained in:
parent
8edca91390
commit
1e6caf8f03
|
@ -198,28 +198,29 @@ class BaseWizard(object):
|
||||||
self.devices = devices
|
self.devices = devices
|
||||||
choices = []
|
choices = []
|
||||||
for name, device_info in devices:
|
for name, device_info in devices:
|
||||||
choices.append( ((name, device_info), device_info.description) )
|
choices.append( ((name, device_info), device_info.description + ' [%s]'%name) )
|
||||||
msg = _('Select a device') + ':'
|
msg = _('Select a device') + ':'
|
||||||
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 = plugin
|
||||||
|
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, hw_type, 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))
|
||||||
plugin = self.plugins.get_plugin(hw_type)
|
|
||||||
self.plugin = plugin
|
|
||||||
xpub = plugin.setup_device(device_info, derivation, self)
|
xpub = plugin.setup_device(device_info, derivation, self)
|
||||||
# create keystore
|
|
||||||
d = {
|
d = {
|
||||||
'type': 'hardware',
|
'type': 'hardware',
|
||||||
'hw_type': hw_type,
|
'hw_type': name,
|
||||||
'derivation': derivation,
|
'derivation': derivation,
|
||||||
'xpub': xpub,
|
'xpub': xpub,
|
||||||
}
|
}
|
||||||
k = hardware_keystore(hw_type, d)
|
k = hardware_keystore(d)
|
||||||
self.on_keystore(k, None)
|
self.on_keystore(k, None)
|
||||||
|
|
||||||
def on_hardware_seed(self):
|
def on_hardware_seed(self):
|
||||||
|
|
|
@ -553,7 +553,8 @@ hw_keystores = {}
|
||||||
def register_keystore(hw_type, constructor):
|
def register_keystore(hw_type, constructor):
|
||||||
hw_keystores[hw_type] = constructor
|
hw_keystores[hw_type] = constructor
|
||||||
|
|
||||||
def hardware_keystore(hw_type, d):
|
def hardware_keystore(d):
|
||||||
|
hw_type = d['hw_type']
|
||||||
if hw_type in hw_keystores:
|
if hw_type in hw_keystores:
|
||||||
constructor = hw_keystores[hw_type]
|
constructor = hw_keystores[hw_type]
|
||||||
return constructor(d)
|
return constructor(d)
|
||||||
|
@ -572,8 +573,7 @@ def load_keystore(storage, name):
|
||||||
elif t == 'bip32':
|
elif t == 'bip32':
|
||||||
k = BIP32_KeyStore(d)
|
k = BIP32_KeyStore(d)
|
||||||
elif t == 'hardware':
|
elif t == 'hardware':
|
||||||
hw_type = d.get('hw_type')
|
k = hardware_keystore(d)
|
||||||
k = hardware_keystore(hw_type, d)
|
|
||||||
else:
|
else:
|
||||||
raise BaseException('unknown wallet type', t)
|
raise BaseException('unknown wallet type', t)
|
||||||
return k
|
return k
|
||||||
|
|
Loading…
Reference in New Issue