Esempio n. 1
0
def run_recovery_dialog():
    message = "Please enter your wallet seed or the corresponding mnemonic list of words, and the gap limit of your wallet."
    dialog = Gtk.MessageDialog(
        parent = None,
        flags = Gtk.DialogFlags.MODAL, 
        buttons = Gtk.ButtonsType.OK_CANCEL,
        message_format = message)

    vbox = dialog.vbox
    dialog.set_default_response(Gtk.ResponseType.OK)

    # ask seed, server and gap in the same dialog
    seed_box = Gtk.HBox()
    seed_label = Gtk.Label(label='Seed or mnemonic:')
    seed_label.set_size_request(150,-1)
    seed_box.pack_start(seed_label, False, False, 10)
    seed_label.show()
    seed_entry = Gtk.Entry()
    seed_entry.show()
    seed_entry.set_size_request(450,-1)
    seed_box.pack_start(seed_entry, False, False, 10)
    add_help_button(seed_box, '.')
    seed_box.show()
    vbox.pack_start(seed_box, False, False, 5)    

    dialog.show()
    r = dialog.run()
    seed = seed_entry.get_text()
    dialog.destroy()

    if r==Gtk.ResponseType.CANCEL:
        return False

    if Wallet.is_seed(seed):
        return seed

    show_message("no seed")
    return False
Esempio n. 2
0
def run_recovery_dialog():
    message = "Please enter your wallet seed or the corresponding mnemonic list of words, and the gap limit of your wallet."
    dialog = Gtk.MessageDialog(
        parent = None,
        flags = Gtk.DialogFlags.MODAL, 
        buttons = Gtk.ButtonsType.OK_CANCEL,
        message_format = message)

    vbox = dialog.vbox
    dialog.set_default_response(Gtk.ResponseType.OK)

    # ask seed, server and gap in the same dialog
    seed_box = Gtk.HBox()
    seed_label = Gtk.Label(label='Seed or mnemonic:')
    seed_label.set_size_request(150,-1)
    seed_box.pack_start(seed_label, False, False, 10)
    seed_label.show()
    seed_entry = Gtk.Entry()
    seed_entry.show()
    seed_entry.set_size_request(450,-1)
    seed_box.pack_start(seed_entry, False, False, 10)
    add_help_button(seed_box, '.')
    seed_box.show()
    vbox.pack_start(seed_box, False, False, 5)    

    dialog.show()
    r = dialog.run()
    seed = seed_entry.get_text()
    dialog.destroy()

    if r==Gtk.ResponseType.CANCEL:
        return False

    if Wallet.is_seed(seed):
        return seed

    show_message("no seed")
    return False
Esempio n. 3
0
    def restore(self, t):

        if t == 'standard':
            text = self.enter_seed_dialog(MSG_ENTER_ANYTHING, None)
            if not text:
                return
            if Wallet.is_xprv(text):
                password = self.password_dialog()
                wallet = Wallet.from_xprv(text, password, self.storage)
            elif Wallet.is_old_mpk(text):
                wallet = Wallet.from_old_mpk(text, self.storage)
            elif Wallet.is_xpub(text):
                wallet = Wallet.from_xpub(text, self.storage)
            elif Wallet.is_address(text):
                wallet = Wallet.from_address(text, self.storage)
            elif Wallet.is_private_key(text):
                wallet = Wallet.from_private_key(text, self.storage)
            elif Wallet.is_seed(text):
                password = self.password_dialog()
                wallet = Wallet.from_seed(text, self.storage)
                wallet.add_seed(text, password)
                wallet.create_master_keys(password)
                wallet.create_main_account(password)
            else:
                raise BaseException('unknown wallet type')

        elif t in ['2of2']:
            r = self.multi_seed_dialog(1)
            if not r:
                return
            text1, text2 = r
            wallet = Wallet_2of2(self.storage)
            if Wallet.is_seed(text1) or Wallet.is_seed(text2):
                password = self.password_dialog()
            else:
                password = None

            if Wallet.is_seed(text2) and Wallet.is_xpub(text1):
                c = text1
                text1 = text2
                text2 = c

            if Wallet.is_seed(text1):
                wallet.add_seed(text1, password)
                wallet.create_master_keys(password)
            else:
                wallet.add_master_public_key("x1/", text1)

            if Wallet.is_seed(text2):
                wallet.add_cosigner_seed(text2, "x2/", password)
            elif Wallet.is_xpub(text2):
                wallet.add_master_public_key("x2/", text2)

            wallet.create_main_account(password)

        elif t in ['2of3']:
            r = self.multi_seed_dialog(2)
            if not r:
                return
            text1, text2, text3 = r
            wallet = Wallet_2of3(self.storage)
            if Wallet.is_seed(text1) or Wallet.is_seed(
                    text2) or Wallet.is_seed(text3):
                password = self.password_dialog()
            else:
                password = None

            if Wallet.is_xpub(text1) and Wallet.is_seed(text2):
                temp = text1
                text1 = text2
                text2 = temp

            if Wallet.is_xpub(text1) and Wallet.is_seed(text3):
                temp = text1
                text1 = text3
                text3 = temp

            if Wallet.is_seed(text1):
                wallet.add_seed(text1, password)
                wallet.create_master_keys(password)
            else:
                wallet.add_master_public_key("x1/", text1)

            if Wallet.is_seed(text2):
                wallet.add_cosigner_seed(text2, "x2/", password)
            elif Wallet.is_xpub(text2):
                wallet.add_master_public_key("x2/", text2)

            if Wallet.is_seed(text3):
                wallet.add_cosigner_seed(text3, "x3/", password)
            elif Wallet.is_xpub(text3):
                wallet.add_master_public_key("x3/", text3)

            wallet.create_main_account(password)

        else:
            self.storage.put('wallet_type', t)
            wallet = run_hook('installwizard_restore', self, self.storage)
            if not wallet:
                return

        # create first keys offline
        self.waiting_dialog(wallet.synchronize)

        return wallet
Esempio n. 4
0
 def is_any(self, seed_e):
     text = self.get_seed_text(seed_e)
     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. 5
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)
    def restore(self, t):

            if t == 'standard':
                text = self.enter_seed_dialog(MSG_ENTER_ANYTHING, None)
                if not text:
                    return
                if Wallet.is_xprv(text):
                    password = self.password_dialog()
                    wallet = Wallet.from_xprv(text, password, self.storage)
                elif Wallet.is_old_mpk(text):
                    wallet = Wallet.from_old_mpk(text, self.storage)
                elif Wallet.is_xpub(text):
                    wallet = Wallet.from_xpub(text, self.storage)
                elif Wallet.is_address(text):
                    wallet = Wallet.from_address(text, self.storage)
                elif Wallet.is_private_key(text):
                    wallet = Wallet.from_private_key(text, self.storage)
                elif Wallet.is_seed(text):
                    password = self.password_dialog()
                    wallet = Wallet.from_seed(text, self.storage)
                    wallet.add_seed(text, password)
                    wallet.create_master_keys(password)
                    wallet.create_main_account(password)
                else:
                    raise BaseException('unknown wallet type')

            elif t in ['2of2']:
                r = self.multi_seed_dialog(1)
                if not r:
                    return
                text1, text2 = r
                wallet = Wallet_2of2(self.storage)
                if Wallet.is_seed(text1) or Wallet.is_seed(text2):
                    password = self.password_dialog()
                else:
                    password = None

                if Wallet.is_seed(text2) and Wallet.is_xpub(text1):
                    c = text1
                    text1 = text2
                    text2 = c

                if Wallet.is_seed(text1):
                    wallet.add_seed(text1, password)
                    wallet.create_master_keys(password)
                else:
                    wallet.add_master_public_key("x1/", text1)

                if Wallet.is_seed(text2):
                    wallet.add_cosigner_seed(text2, "x2/", password)
                elif Wallet.is_xpub(text2):
                    wallet.add_master_public_key("x2/", text2)

                wallet.create_main_account(password)


            elif t in ['2of3']:
                r = self.multi_seed_dialog(2)
                if not r:
                    return
                text1, text2, text3 = r
                wallet = Wallet_2of3(self.storage)
                if Wallet.is_seed(text1) or Wallet.is_seed(text2) or Wallet.is_seed(text3):
                    password = self.password_dialog()
                else:
                    password = None

                if Wallet.is_xpub(text1) and Wallet.is_seed(text2):
                    temp = text1
                    text1 = text2
                    text2 = temp

                if Wallet.is_xpub(text1) and Wallet.is_seed(text3):
                    temp = text1
                    text1 = text3
                    text3 = temp

                if Wallet.is_seed(text1):
                    wallet.add_seed(text1, password)
                    wallet.create_master_keys(password)
                else:
                    wallet.add_master_public_key("x1/", text1)

                if Wallet.is_seed(text2):
                    wallet.add_cosigner_seed(text2, "x2/", password)
                elif Wallet.is_xpub(text2):
                    wallet.add_master_public_key("x2/", text2)

                if Wallet.is_seed(text3):
                    wallet.add_cosigner_seed(text3, "x3/", password)
                elif Wallet.is_xpub(text3):
                    wallet.add_master_public_key("x3/", text3)

                wallet.create_main_account(password)

            else:
                self.storage.put('wallet_type', t)
                wallet = run_hook('installwizard_restore', self, self.storage)
                if not 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. 8
0
 def is_any(self, seed_e):
     text = self.get_seed_text(seed_e)
     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)