|
|
@ -31,6 +31,9 @@ from .wallet import Imported_Wallet, Standard_Wallet, Multisig_Wallet, wallet_ty |
|
|
|
from .i18n import _ |
|
|
|
|
|
|
|
|
|
|
|
class ScriptTypeNotSupported(Exception): pass |
|
|
|
|
|
|
|
|
|
|
|
class BaseWizard(object): |
|
|
|
|
|
|
|
def __init__(self, config, storage): |
|
|
@ -241,15 +244,23 @@ class BaseWizard(object): |
|
|
|
('legacy BIP44', bip44_derivation(0, False)), |
|
|
|
('p2sh-segwit BIP49', bip44_derivation(0, True)), |
|
|
|
) |
|
|
|
self.line_dialog(run_next=f, title=_('Derivation'), message=message, |
|
|
|
default=default, test=bitcoin.is_bip32_derivation, |
|
|
|
presets=presets) |
|
|
|
while True: |
|
|
|
try: |
|
|
|
self.line_dialog(run_next=f, title=_('Derivation'), message=message, |
|
|
|
default=default, test=bitcoin.is_bip32_derivation, |
|
|
|
presets=presets) |
|
|
|
return |
|
|
|
except ScriptTypeNotSupported as e: |
|
|
|
self.show_error(e) |
|
|
|
# let the user choose again |
|
|
|
|
|
|
|
def on_hw_derivation(self, name, device_info, derivation): |
|
|
|
from .keystore import hardware_keystore |
|
|
|
xtype = 'p2wpkh-p2sh' if derivation.startswith("m/49'/") else 'standard' |
|
|
|
try: |
|
|
|
xpub = self.plugin.get_xpub(device_info.device.id_, derivation, xtype, self) |
|
|
|
except ScriptTypeNotSupported: |
|
|
|
raise # this is handled in derivation_dialog |
|
|
|
except BaseException as e: |
|
|
|
self.show_error(e) |
|
|
|
return |
|
|
|