Esempio n. 1
0
 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
    def on_verify_restore_ok(self, wallet, _dlg, btn, restore=False):
        if btn in (_dlg.ids.back, _dlg.ids.but_close) :
            _dlg.close()
            Factory.CreateRestoreDialog(
                on_release=self.on_creatrestore_complete).open()
            return

        seed = self.get_seed_text(_dlg.ids.text_input_seed)
        if not seed:
            return app.show_error(_("No seed!"), duration=.5)

        _dlg.close()

        if Wallet.is_seed(seed):
            return self.password_dialog(wallet=wallet, mode='restore',
                                        seed=seed)
        elif Wallet.is_mpk(seed):
            wallet = Wallet.from_mpk(seed, self.storage)
        elif Wallet.is_address(seed):
            wallet = Wallet.from_address(seed, self.storage)
        elif Wallet.is_private_key(seed):
            wallet = Wallet.from_private_key(seed, self.storage)
        else:
            return app.show_error(_('Not a valid seed. App will now exit'),
                                  exit=True, modal=True, duration=.5)
        return
Esempio n. 3
0
    def on_verify_restore_ok(self, wallet, _dlg, btn, restore=False):
        if btn in (_dlg.ids.back, _dlg.ids.but_close):
            _dlg.close()
            Factory.CreateRestoreDialog(
                on_release=self.on_creatrestore_complete).open()
            return

        seed = self.get_seed_text(_dlg.ids.text_input_seed)
        if not seed:
            return app.show_error(_("No seed!"), duration=.5)

        _dlg.close()

        if Wallet.is_seed(seed):
            return self.password_dialog(wallet=wallet,
                                        mode='restore',
                                        seed=seed)
        elif Wallet.is_mpk(seed):
            wallet = Wallet.from_mpk(seed, self.storage)
        elif Wallet.is_address(seed):
            wallet = Wallet.from_address(seed, self.storage)
        elif Wallet.is_private_key(seed):
            wallet = Wallet.from_private_key(seed, self.storage)
        else:
            return app.show_error(_('Not a valid seed. App will now exit'),
                                  exit=True,
                                  modal=True,
                                  duration=.5)
        return
 def is_any(self, seed_e):
     text = self.get_seed_text(seed_e)
     return (Wallet.is_seed(text) or
             Wallet.is_mpk(text) or
             Wallet.is_address(text) or
             Wallet.is_private_key(text))
 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
 def is_any(self, text):
     return Wallet.is_seed(text) or Wallet.is_old_mpk(text) or Wallet.is_xpub(text) or Wallet.is_xprv(text) or Wallet.is_address(text) or Wallet.is_private_key(text)
Esempio n. 7
0
 def is_any(self, text):
     return Wallet.is_seed(text) or Wallet.is_old_mpk(
         text) or Wallet.is_xpub(text) or Wallet.is_xprv(
             text) or Wallet.is_address(text) or Wallet.is_private_key(text)
Esempio n. 8
0
 def is_any(self, seed_e):
     text = self.get_seed_text(seed_e)
     return (Wallet.is_seed(text) or Wallet.is_mpk(text)
             or Wallet.is_address(text) or Wallet.is_private_key(text))