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 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
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 __init__(self, _config, _network, plugins): global wallet, network, contacts, config network = _network config = _config network.register_callback('updated', update_callback) network.register_callback('connected', update_callback) network.register_callback('disconnected', update_callback) network.register_callback('disconnecting', update_callback) contacts = util.StoreDict(config, 'contacts') storage = WalletStorage(config.get_wallet_path()) if not storage.file_exists: action = self.restore_or_create() if not action: exit() password = droid.dialogGetPassword('Choose a password').result if password: password2 = droid.dialogGetPassword('Confirm password').result if password != password2: modal_dialog('Error','passwords do not match') exit() else: # set to None if it's an empty string password = None if action == 'create': wallet = Wallet(storage) seed = wallet.make_seed() modal_dialog('Your seed is:', seed) wallet.add_seed(seed, password) wallet.create_master_keys(password) wallet.create_main_account(password) elif action == 'restore': seed = self.seed_dialog() if not seed: exit() if not Wallet.is_seed(seed): exit() wallet = Wallet.from_seed(seed, password, storage) else: exit() msg = "Creating wallet" if action == 'create' else "Restoring wallet" droid.dialogCreateSpinnerProgress("Electrum-GMC", msg) droid.dialogShow() wallet.start_threads(network) if action == 'restore': wallet.wait_until_synchronized() else: wallet.synchronize() droid.dialogDismiss() droid.vibrate() else: wallet = Wallet(storage) wallet.start_threads(network)
def __init__(self, _config, _network, plugins): global wallet, network, contacts, config network = _network config = _config network.register_callback('updated', update_callback) network.register_callback('connected', update_callback) network.register_callback('disconnected', update_callback) network.register_callback('disconnecting', update_callback) contacts = util.StoreDict(config, 'contacts') storage = WalletStorage(config.get_wallet_path()) if not storage.file_exists: action = self.restore_or_create() if not action: exit() password = droid.dialogGetPassword('Choose a password').result if password: password2 = droid.dialogGetPassword('Confirm password').result if password != password2: modal_dialog('Error', 'passwords do not match') exit() else: # set to None if it's an empty string password = None if action == 'create': wallet = Wallet(storage) seed = wallet.make_seed() modal_dialog('Your seed is:', seed) wallet.add_seed(seed, password) wallet.create_master_keys(password) wallet.create_main_account(password) elif action == 'restore': seed = self.seed_dialog() if not seed: exit() if not Wallet.is_seed(seed): exit() wallet = Wallet.from_seed(seed, password, storage) else: exit() msg = "Creating wallet" if action == 'create' else "Restoring wallet" droid.dialogCreateSpinnerProgress("Electrum-GMC", msg) droid.dialogShow() wallet.start_threads(network) if action == 'restore': wallet.wait_until_synchronized() else: wallet.synchronize() droid.dialogDismiss() droid.vibrate() else: wallet = Wallet(storage) wallet.start_threads(network)
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
def __init__(self): global wallet self.qr_data = None storage = WalletStorage('/sdcard/electrum-gmc/authenticator') if not storage.file_exists: action = self.restore_or_create() if not action: exit() password = droid.dialogGetPassword('Choose a password').result if password: password2 = droid.dialogGetPassword('Confirm password').result if password != password2: modal_dialog('Error', 'Passwords do not match') exit() else: password = None if action == 'create': wallet = Wallet(storage) seed = wallet.make_seed() modal_dialog('Your seed is:', seed) elif action == 'import': seed = self.seed_dialog() if not seed: exit() if not Wallet.is_seed(seed): exit() wallet = Wallet.from_seed(seed, password, storage) else: exit() wallet.add_seed(seed, password) wallet.create_master_keys(password) wallet.create_main_account(password) else: wallet = Wallet(storage)
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 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 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 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))