コード例 #1
0
ファイル: installwizard.py プロジェクト: manuelfr51/electrum
 def restore(self, t):
     if t == 'standard':
         text = self.enter_seed_dialog(MSG_ENTER_ANYTHING, None)
         if not text:
             return
         password = self.password_dialog(
         ) if Wallet.is_seed(text) or Wallet.is_xprv(
             text) or Wallet.is_private_key(text) else None
         wallet = Wallet.from_text(text, password, self.storage)
     elif re.match('(\d+)of(\d+)', t):
         n = int(re.match('(\d+)of(\d+)', t).group(2))
         key_list = self.multi_seed_dialog(n - 1)
         if not key_list:
             return
         password = self.password_dialog() if any(
             map(lambda x: Wallet.is_seed(x) or Wallet.is_xprv(x),
                 key_list)) else None
         wallet = Wallet.from_multisig(key_list, password, self.storage, t)
     else:
         self.storage.put('wallet_type', t, False)
         # call the constructor to load the plugin (side effect)
         Wallet(self.storage)
         wallet = always_hook('installwizard_restore', self, self.storage)
         if not wallet:
             util.print_error("no wallet")
             return
     # create first keys offline
     self.waiting_dialog(wallet.synchronize)
     return wallet
コード例 #2
0
ファイル: installwizard.py プロジェクト: ttytyper/electrum
 def restore(self, t):
     if t == 'standard':
         text = self.enter_seed_dialog(MSG_ENTER_ANYTHING, None)
         if not text:
             return
         password = self.password_dialog() if Wallet.is_seed(text) or Wallet.is_xprv(text) or Wallet.is_private_key(text) else None
         wallet = Wallet.from_text(text, password, self.storage)
     elif re.match('(\d+)of(\d+)', t):
         n = int(re.match('(\d+)of(\d+)', t).group(2))
         key_list = self.multi_seed_dialog(n - 1)
         if not key_list:
             return
         password = self.password_dialog() if any(map(lambda x: Wallet.is_seed(x) or Wallet.is_xprv(x), key_list)) else None
         wallet = Wallet.from_multisig(key_list, password, self.storage, t)
     else:
         self.storage.put('wallet_type', t, False)
         # call the constructor to load the plugin (side effect)
         Wallet(self.storage)
         wallet = always_hook('installwizard_restore', self, self.storage)
         if not wallet:
             util.print_error("no wallet")
             return
     # create first keys offline
     self.waiting_dialog(wallet.synchronize)
     return wallet
コード例 #3
0
ファイル: installwizard.py プロジェクト: bontaq/electrum
 def task():
     if Wallet.is_seed(text):
         self.wallet.add_seed(text, password)
         self.wallet.create_master_keys(password)
     else:
         self.wallet = Wallet.from_text(text, None, self.storage)
     self.wallet.create_main_account()
     self.wallet.synchronize()
コード例 #4
0
 def task():
     if Wallet.is_seed(text):
         self.wallet.add_seed(text, password)
         self.wallet.create_master_keys(password)
     else:
         self.wallet = Wallet.from_text(text, None, self.storage)
     self.wallet.create_main_account()
     self.wallet.synchronize()
コード例 #5
0
 def task():
     self.wallet = Wallet.from_text(text, password, self.storage)
     self.wallet.create_main_account()
     self.wallet.synchronize()
コード例 #6
0
ファイル: installwizard.py プロジェクト: Emzy/electrum
        def on_release(wallet, seed, _dlg, _btn):
            ti_password = _dlg.ids.ti_password
            ti_new_password = _dlg.ids.ti_new_password
            ti_confirm_password = _dlg.ids.ti_confirm_password
            if _btn != _dlg.ids.next:
                if mode == 'restore':
                    # back is disabled cause seed is already set
                    return
                _dlg.close()
                if not instance:
                    # back on create
                    Factory.CreateRestoreDialog(
                        on_release=self.on_creatrestore_complete).open()
                return

            # Confirm
            wallet_name = _dlg.ids.ti_wallet_name.text
            new_password = unicode(ti_new_password.text)
            new_password2 = unicode(ti_confirm_password.text)

            if new_password != new_password2:
                # passwords don't match
                ti_password.text = ""
                ti_new_password.text = ""
                ti_confirm_password.text = ""
                if ti_password.disabled:
                    ti_new_password.focus = True
                else:
                    ti_password.focus = True
                return app.show_error(_('Passwords do not match'), duration=.5)

            if not new_password:
                new_password = None

            if mode == 'restore':
                password = unicode(ti_password.text)
                           # if wallet and wallet.use_encryption else
                           # None)
                if not password:
                    password = None
                wallet = Wallet.from_text(seed, password, self.storage)

                def on_complete(*l):
                    self.load_network(wallet, mode='restore')
                    _dlg.close()

                self.waiting_dialog(wallet.synchronize,
                                    msg=_("generating addresses"),
                                    on_complete=on_complete)
                return

            if not instance:
                # create mode
                _dlg.close()
                seed = wallet.make_seed()

                return self.show_seed(password=new_password, wallet=wallet,
                                      wallet_name=wallet_name, mode=mode,
                                      seed=seed)

            # change password mode
            try:
                seed = wallet.decode_seed(password)
            except BaseException:
                return app.show_error(_('Incorrect Password'), duration=.5)

            # test carefully
            try:
                wallet.update_password(seed, password, new_password)
            except BaseException:
                return app.show_error(_('Failed to update password'), exit=True)
            else:
                app.show_info_bubble(
                    text=_('Password successfully updated'), duration=1,
                    pos=_btn.pos)
            _dlg.close()

            if instance is None:  # in initial phase
                self.load_wallet()
            self.app.update_wallet()
コード例 #7
0
ファイル: installwizard.py プロジェクト: ChainEXS/electrum
 def task():
     self.wallet = Wallet.from_text(text, password, self.storage)
     self.wallet.create_main_account()
     self.wallet.synchronize()
コード例 #8
0
ファイル: installwizard.py プロジェクト: andreas-h/electrum
        def on_release(wallet, seed, _dlg, _btn):
            ti_password = _dlg.ids.ti_password
            ti_new_password = _dlg.ids.ti_new_password
            ti_confirm_password = _dlg.ids.ti_confirm_password
            if _btn != _dlg.ids.next:
                if mode == 'restore':
                    # back is disabled cause seed is already set
                    return
                _dlg.close()
                if not instance:
                    # back on create
                    Factory.CreateRestoreDialog(
                        on_release=self.on_creatrestore_complete).open()
                return

            # Confirm
            wallet_name = _dlg.ids.ti_wallet_name.text
            new_password = unicode(ti_new_password.text)
            new_password2 = unicode(ti_confirm_password.text)

            if new_password != new_password2:
                # passwords don't match
                ti_password.text = ""
                ti_new_password.text = ""
                ti_confirm_password.text = ""
                if ti_password.disabled:
                    ti_new_password.focus = True
                else:
                    ti_password.focus = True
                return app.show_error(_('Passwords do not match'), duration=.5)

            if not new_password:
                new_password = None

            if mode == 'restore':
                password = unicode(ti_password.text)
                # if wallet and wallet.use_encryption else
                # None)
                if not password:
                    password = None
                wallet = Wallet.from_text(seed, password, self.storage)

                def on_complete(*l):
                    self.load_network(wallet, mode='restore')
                    _dlg.close()

                self.waiting_dialog(wallet.synchronize,
                                    msg=_("generating addresses"),
                                    on_complete=on_complete)
                return

            if not instance:
                # create mode
                _dlg.close()
                seed = wallet.make_seed()

                return self.show_seed(password=new_password,
                                      wallet=wallet,
                                      wallet_name=wallet_name,
                                      mode=mode,
                                      seed=seed)

            # change password mode
            try:
                seed = wallet.decode_seed(password)
            except BaseException:
                return app.show_error(_('Incorrect Password'), duration=.5)

            # test carefully
            try:
                wallet.update_password(seed, password, new_password)
            except BaseException:
                return app.show_error(_('Failed to update password'),
                                      exit=True)
            else:
                app.show_info_bubble(text=_('Password successfully updated'),
                                     duration=1,
                                     pos=_btn.pos)
            _dlg.close()

            if instance is None:  # in initial phase
                self.load_wallet()
            self.app.update_wallet()