wizard: add capability to restore multisig
This commit is contained in:
@@ -212,6 +212,7 @@ Builder.load_string('''
|
||||
|
||||
|
||||
<RestoreSeedDialog>
|
||||
message: ''
|
||||
word: ''
|
||||
BigLabel:
|
||||
text: "ENTER YOUR SEED PHRASE"
|
||||
@@ -384,6 +385,7 @@ Builder.load_string('''
|
||||
|
||||
|
||||
<ShowSeedDialog>
|
||||
message: ''
|
||||
spacing: '12dp'
|
||||
value: 'next'
|
||||
BigLabel:
|
||||
@@ -493,7 +495,8 @@ class WizardChoiceDialog(WizardDialog):
|
||||
class ShowSeedDialog(WizardDialog):
|
||||
|
||||
seed_text = StringProperty('')
|
||||
message = StringProperty('')
|
||||
message = _("If you forget your PIN or lose your device, your seed phrase will be the "
|
||||
"only way to recover your funds.")
|
||||
|
||||
def on_parent(self, instance, value):
|
||||
if value:
|
||||
@@ -513,8 +516,6 @@ class WizardButton(Button):
|
||||
|
||||
class RestoreSeedDialog(WizardDialog):
|
||||
|
||||
message = StringProperty('')
|
||||
|
||||
def __init__(self, wizard, **kwargs):
|
||||
super(RestoreSeedDialog, self).__init__(wizard, **kwargs)
|
||||
self._test = kwargs['is_valid']
|
||||
@@ -522,6 +523,8 @@ class RestoreSeedDialog(WizardDialog):
|
||||
from electrum.old_mnemonic import words as old_wordlist
|
||||
self.words = set(Mnemonic('en').wordlist).union(set(old_wordlist))
|
||||
self.ids.text_input_seed.text = test_seed if is_test else ''
|
||||
self.message = _('Please type your seed phrase using the virtual keyboard.')
|
||||
self.title = _('Enter Seed')
|
||||
|
||||
def get_suggestions(self, prefix):
|
||||
for w in self.words:
|
||||
@@ -708,8 +711,24 @@ class InstallWizard(BaseWizard, Widget):
|
||||
def choice_dialog(self, **kwargs): WizardChoiceDialog(self, **kwargs).open()
|
||||
def multisig_dialog(self, **kwargs): WizardMultisigDialog(self, **kwargs).open()
|
||||
def show_seed_dialog(self, **kwargs): ShowSeedDialog(self, **kwargs).open()
|
||||
def enter_seed_dialog(self, **kwargs): RestoreSeedDialog(self, **kwargs).open()
|
||||
def add_xpub_dialog(self, **kwargs): AddXpubDialog(self, **kwargs).open()
|
||||
|
||||
def confirm_seed_dialog(self, **kwargs):
|
||||
kwargs['title'] = _('Confirm Seed')
|
||||
kwargs['message'] = _('Please retype your seed phrase, to confirm that you properly saved it')
|
||||
RestoreSeedDialog(self, **kwargs).open()
|
||||
|
||||
def restore_seed_dialog(self, **kwargs):
|
||||
RestoreSeedDialog(self, **kwargs).open()
|
||||
|
||||
def restore_keys_dialog(self, **kwargs):
|
||||
kwargs['message'] += ' ' + _('Use the camera button to scan a QR code.')
|
||||
AddXpubDialog(self, **kwargs).open()
|
||||
|
||||
def add_cosigner_dialog(self, **kwargs):
|
||||
kwargs['title'] = _("Add Cosigner") + " %d"%kwargs['index']
|
||||
kwargs['message'] = _('Please paste your cosigners master public key, or scan it using the camera button.')
|
||||
AddXpubDialog(self, **kwargs).open()
|
||||
|
||||
def show_xpub_dialog(self, **kwargs): ShowXpubDialog(self, **kwargs).open()
|
||||
|
||||
def show_error(self, msg):
|
||||
|
||||
@@ -24,7 +24,6 @@ MSG_GENERATING_WAIT = _("Electrum is generating your addresses, please wait...")
|
||||
MSG_ENTER_ANYTHING = _("Please enter a seed phrase, a master key, a list of "
|
||||
"Bitcoin addresses, or a list of private keys")
|
||||
MSG_ENTER_SEED_OR_MPK = _("Please enter a seed phrase or a master key (xpub or xprv):")
|
||||
MSG_VERIFY_SEED = _("Your seed is important!\nTo make sure that you have properly saved your seed, please retype it here.")
|
||||
MSG_COSIGNER = _("Please enter the master public key of cosigner #%d:")
|
||||
MSG_SHOW_MPK = _("Here is your master public key:")
|
||||
MSG_ENTER_PASSWORD = _("Choose a password to encrypt your wallet keys. "
|
||||
@@ -236,16 +235,33 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
||||
return seed
|
||||
|
||||
@wizard_dialog
|
||||
def add_xpub_dialog(self, title, message, is_valid, run_next):
|
||||
def restore_keys_dialog(self, title, message, is_valid, run_next):
|
||||
return self.text_input(title, message, is_valid)
|
||||
|
||||
@wizard_dialog
|
||||
def enter_seed_dialog(self, run_next, title, message, is_valid):
|
||||
def add_cosigner_dialog(self, run_next, index, is_valid):
|
||||
title = _("Add Cosigner") + " %d"%index
|
||||
message = ' '.join([
|
||||
_('Please enter the master public key of your cosigner.'),
|
||||
_('Enter their seed or master private key if you want to be able to sign for them.')
|
||||
])
|
||||
return self.text_input(title, message, is_valid)
|
||||
|
||||
@wizard_dialog
|
||||
def restore_seed_dialog(self, run_next, is_valid):
|
||||
title = _('Enter Seed')
|
||||
message = _('Please enter your seed phrase in order to restore your wallet.')
|
||||
return self.text_input(title, message, is_valid)
|
||||
|
||||
@wizard_dialog
|
||||
def confirm_seed_dialog(self, run_next, is_valid):
|
||||
self.app.clipboard().clear()
|
||||
title = _('Confirm Seed')
|
||||
message = _("Your seed is important!\nTo make sure that you have properly saved your seed, please retype it here.")
|
||||
return self.text_input(title, message, is_valid)
|
||||
|
||||
@wizard_dialog
|
||||
def show_seed_dialog(self, run_next, message, seed_text):
|
||||
def show_seed_dialog(self, run_next, seed_text):
|
||||
slayout = SeedWarningLayout(seed_text)
|
||||
self.set_main_layout(slayout.layout())
|
||||
return seed_text
|
||||
@@ -326,7 +342,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
||||
@wizard_dialog
|
||||
def show_xpub_dialog(self, xpub, run_next):
|
||||
vbox = QVBoxLayout()
|
||||
layout = SeedDisplayLayout(xpub, title=MSG_SHOW_MPK, sid='hot')
|
||||
layout = SeedDisplayLayout(xpub, title=_('Master Public Key'), sid='hot')
|
||||
vbox.addLayout(layout.layout())
|
||||
self.set_main_layout(vbox, MSG_SHOW_MPK)
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user