def create_menu(self, position):
     idx = self.indexAt(position)
     item = self.model().itemFromIndex(idx)
     item_col0 = self.model().itemFromIndex(
         idx.sibling(idx.row(), self.Columns.DATE))
     if not item or not item_col0:
         return
     key = item_col0.data(Qt.UserRole)
     column = idx.column()
     column_title = self.model().horizontalHeaderItem(column).text()
     column_data = item.text()
     status = self.parent.invoices.get_status(key)
     menu = QMenu(self)
     if column_data:
         if column == self.Columns.AMOUNT:
             column_data = column_data.strip()
         menu.addAction(
             _("Copy {}").format(column_title),
             lambda: self.parent.app.clipboard().setText(column_data))
     menu.addAction(_("Details"), lambda: self.parent.show_invoice(key))
     if status == PR_UNPAID:
         menu.addAction(_("Pay Now"),
                        lambda: self.parent.do_pay_invoice(key))
     menu.addAction(_("Delete"), lambda: self.parent.delete_invoice(key))
     menu.exec_(self.viewport().mapToGlobal(position))
Exemple #2
0
 def create_menu(self, position):
     idx = self.indexAt(position)
     item = self.model().itemFromIndex(idx)
     # TODO use siblingAtColumn when min Qt version is >=5.11
     item_addr = self.model().itemFromIndex(
         idx.sibling(idx.row(), self.Columns.ADDRESS))
     if not item_addr:
         return
     addr = item_addr.text()
     req = self.wallet.receive_requests.get(addr)
     if req is None:
         self.update()
         return
     column = idx.column()
     column_title = self.model().horizontalHeaderItem(column).text()
     column_data = item.text()
     menu = QMenu(self)
     if column != self.Columns.SIGNATURE:
         if column == self.Columns.AMOUNT:
             column_data = column_data.strip()
         menu.addAction(
             _("Copy {}").format(column_title),
             lambda: self.parent.app.clipboard().setText(column_data))
     menu.addAction(
         _("Copy URI"), lambda: self.parent.view_and_paste(
             'URI', '', self.parent.get_request_URI(addr)))
     menu.addAction(_("Save as BIP70 file"),
                    lambda: self.parent.export_payment_request(addr))
     menu.addAction(_("Delete"),
                    lambda: self.parent.delete_payment_request(addr))
     run_hook('receive_list_menu', menu, addr)
     menu.exec_(self.viewport().mapToGlobal(position))
Exemple #3
0
    def __init__(self, parent):
        super(CharacterDialog, self).__init__(parent)
        self.setWindowTitle(_("KeepKey Seed Recovery"))
        self.character_pos = 0
        self.word_pos = 0
        self.loop = QEventLoop()
        self.word_help = QLabel()
        self.char_buttons = []

        vbox = QVBoxLayout(self)
        vbox.addWidget(WWLabel(CHARACTER_RECOVERY))
        hbox = QHBoxLayout()
        hbox.addWidget(self.word_help)
        for i in range(4):
            char_button = CharacterButton('*')
            char_button.setMaximumWidth(36)
            self.char_buttons.append(char_button)
            hbox.addWidget(char_button)
        self.accept_button = CharacterButton(_("Accept Word"))
        self.accept_button.clicked.connect(partial(self.process_key, 32))
        self.rejected.connect(partial(self.loop.exit, 1))
        hbox.addWidget(self.accept_button)
        hbox.addStretch(1)
        vbox.addLayout(hbox)

        self.finished_button = QPushButton(_("Seed Entered"))
        self.cancel_button = QPushButton(_("Cancel"))
        self.finished_button.clicked.connect(
            partial(self.process_key, Qt.Key_Return))
        self.cancel_button.clicked.connect(self.rejected)
        buttons = Buttons(self.finished_button, self.cancel_button)
        vbox.addSpacing(40)
        vbox.addLayout(buttons)
        self.refresh()
        self.show()
Exemple #4
0
    def export_psbt(self, dia):
        # Called from hook in transaction dialog
        tx = dia.tx

        if tx.is_complete():
            # if they sign while dialog is open, it can transition from unsigned to signed,
            # which we don't support here, so do nothing
            return

        # can only expect Coldcard wallets to work with these files (right now)
        keystore = dia.wallet.get_keystore()
        assert type(keystore) == self.keystore_class

        # convert to PSBT
        raw_psbt = keystore.build_psbt(tx, wallet=dia.wallet)

        name = (dia.wallet.basename() +
                time.strftime('-%y%m%d-%H%M.psbt')).replace(' ', '-')
        fileName = dia.main_window.getSaveFileName(
            _("Select where to save the PSBT file"), name, "*.psbt")
        if fileName:
            with open(fileName, "wb+") as f:
                f.write(raw_psbt)
            dia.show_message(_("Transaction exported successfully"))
            dia.saved = True
Exemple #5
0
 def toggle_passphrase(self):
     if self.features.passphrase_protection:
         self.msg = _("Confirm on your {} device to disable passphrases")
     else:
         self.msg = _("Confirm on your {} device to enable passphrases")
     enabled = not self.features.passphrase_protection
     self.apply_settings(use_passphrase=enabled)
Exemple #6
0
    def _initialize_device(self, settings: TrezorInitSettings, method,
                           device_id, wizard, handler):
        if method == TIM_RECOVER and settings.recovery_type == RECOVERY_TYPE_SCRAMBLED_WORDS:
            handler.show_error(_(
                "You will be asked to enter 24 words regardless of your "
                "seed's actual length.  If you enter a word incorrectly or "
                "misspell it, you cannot change it or go back - you will need "
                "to start again from the beginning.\n\nSo please enter "
                "the words carefully!"),
                               blocking=True)

        devmgr = self.device_manager()
        client = devmgr.client_by_id(device_id)
        if not client:
            raise Exception(_("The device was disconnected."))

        if method == TIM_NEW:
            strength_from_word_count = {12: 128, 18: 192, 24: 256}
            client.reset_device(
                strength=strength_from_word_count[settings.word_count],
                passphrase_protection=settings.passphrase_enabled,
                pin_protection=settings.pin_enabled,
                label=settings.label,
                no_backup=settings.no_backup)
        elif method == TIM_RECOVER:
            client.recover_device(
                recovery_type=settings.recovery_type,
                word_count=settings.word_count,
                passphrase_protection=settings.passphrase_enabled,
                pin_protection=settings.pin_enabled,
                label=settings.label)
            if settings.recovery_type == RECOVERY_TYPE_MATRIX:
                handler.close_matrix_dialog()
        else:
            raise RuntimeError("Unsupported recovery method")
 def dbb_load_backup(self, show_msg=True):
     backups = self.hid_send_encrypt(b'{"backup":"list"}')
     if 'error' in backups:
         raise UserFacingException(backups['error']['message'])
     try:
         f = self.handler.win.query_choice(_("Choose a backup file:"),
                                           backups['backup'])
     except Exception:
         return False  # Back button pushed
     key = self.backup_password_dialog()
     if key is None:
         raise Exception('Canceled by user')
     key = self.stretch_key(key)
     if show_msg:
         self.handler.show_message(
             _("Loading backup...") + "\n\n" +
             _("To continue, touch the Digital Bitbox's light for 3 seconds."
               ) + "\n\n" +
             _("To cancel, briefly touch the light or wait for the timeout."
               ))
     msg = ('{"seed":{"source": "backup", "key": "%s", "filename": "%s"}}' %
            (key, backups['backup'][f])).encode('utf8')
     hid_reply = self.hid_send_encrypt(msg)
     self.handler.finished()
     if 'error' in hid_reply:
         raise UserFacingException(hid_reply['error']['message'])
     return True
 def show_address(self, wallet, address, keystore=None):
     if keystore is None:
         keystore = wallet.get_keystore()
     if not self.show_address_helper(wallet, address, keystore):
         return
     if type(wallet) is not Standard_Wallet:
         keystore.handler.show_error(
             _('This function is only available for standard wallets when using {}.'
               ).format(self.device))
         return
     if not self.is_mobile_paired():
         keystore.handler.show_error(
             _('This function is only available after pairing your {} with a mobile device.'
               ).format(self.device))
         return
     if not keystore.is_p2pkh():
         keystore.handler.show_error(
             _('This function is only available for p2pkh keystores when using {}.'
               ).format(self.device))
         return
     change, index = wallet.get_address_index(address)
     keypath = '%s/%d/%d' % (keystore.derivation, change, index)
     xpub = self.get_client(keystore)._get_xpub(keypath)
     verify_request_payload = {
         "type": 'p2pkh',
         "echo": xpub['echo'],
     }
     self.comserver_post_notification(verify_request_payload)
Exemple #9
0
 def get_tooltip(self, pos, fee_rate):
     mempool = self.config.use_mempool_fees()
     target, estimate = self.config.get_fee_text(pos, self.dyn, mempool, fee_rate)
     if self.dyn:
         return _('Target') + ': ' + target + '\n' + _('Current rate') + ': ' + estimate
     else:
         return _('Fixed rate') + ': ' + target + '\n' + _('Estimate') + ': ' + estimate
Exemple #10
0
 def _start_wizard_to_select_or_create_wallet(
         self, path) -> Optional[Abstract_Wallet]:
     wizard = InstallWizard(self.config, self.app, self.plugins)
     try:
         path, storage = wizard.select_storage(path, self.daemon.get_wallet)
         # storage is None if file does not exist
         if storage is None:
             wizard.path = path  # needed by trustedcoin plugin
             wizard.run('new')
             storage = wizard.create_storage(path)
         else:
             wizard.run_upgrades(storage)
     except (UserCancelled, GoBack):
         return
     except WalletAlreadyOpenInMemory as e:
         return e.wallet
     except (WalletFileException, BitcoinException) as e:
         self.logger.exception('')
         QMessageBox.warning(None, _('Error'),
                             _('Cannot load wallet') + ' (2):\n' + str(e))
         return
     finally:
         wizard.terminate()
     # return if wallet creation is not complete
     if storage is None or storage.get_action():
         return
     wallet = Wallet(storage)
     wallet.start_network(self.daemon.network)
     self.daemon.add_wallet(wallet)
     return wallet
Exemple #11
0
 def get_library_not_available_message(self) -> str:
     if hasattr(self, 'libraries_available_message'):
         message = self.libraries_available_message
     else:
         message = _("Missing libraries for {}.").format(self.name)
     message += '\n' + _("Make sure you install it with python3")
     return message
Exemple #12
0
 def seed_options(self):
     dialog = QDialog()
     vbox = QVBoxLayout(dialog)
     if 'ext' in self.options:
         cb_ext = QCheckBox(_('Extend this seed with custom words'))
         cb_ext.setChecked(self.is_ext)
         vbox.addWidget(cb_ext)
     if 'bip39' in self.options:
         def f(b):
             self.is_seed = (lambda x: bool(x)) if b else self.saved_is_seed
             self.is_bip39 = b
             self.on_edit()
             if b:
                 msg = ' '.join([
                     '<b>' + _('Warning') + ':</b>  ',
                     _('BIP39 seeds can be imported in Electrum-MUE, so that users can access funds locked in other wallets.'),
                     _('However, we do not generate BIP39 seeds, because they do not meet our safety standard.'),
                     _('BIP39 seeds do not include a version number, which compromises compatibility with future software.'),
                     _('We do not guarantee that BIP39 imports will always be supported in Electrum-MUE.'),
                 ])
             else:
                 msg = ''
             self.seed_warning.setText(msg)
         cb_bip39 = QCheckBox(_('BIP39 seed'))
         cb_bip39.toggled.connect(f)
         cb_bip39.setChecked(self.is_bip39)
         vbox.addWidget(cb_bip39)
     vbox.addLayout(Buttons(OkButton(dialog)))
     if not dialog.exec_():
         return None
     self.is_ext = cb_ext.isChecked() if 'ext' in self.options else False
     self.is_bip39 = cb_bip39.isChecked() if 'bip39' in self.options else False
Exemple #13
0
 def show_address(self, sequence, txin_type):
     client = self.get_client()
     address_path = self.get_derivation()[2:] + "/%d/%d"%sequence
     self.handler.show_message(_("Showing address ..."))
     segwit = is_segwit_script_type(txin_type)
     segwitNative = txin_type == 'p2wpkh'
     try:
         client.getWalletPublicKey(address_path, showOnScreen=True, segwit=segwit, segwitNative=segwitNative)
     except BTChipException as e:
         if e.sw == 0x6985:  # cancelled by user
             pass
         elif e.sw == 0x6982:
             raise  # pin lock. decorator will catch it
         elif e.sw == 0x6b00:  # hw.1 raises this
             self.handler.show_error('{}\n{}\n{}'.format(
                 _('Error showing address') + ':',
                 e,
                 _('Your device might not have support for this functionality.')))
         else:
             self.logger.exception('')
             self.handler.show_error(e)
     except BaseException as e:
         self.logger.exception('')
         self.handler.show_error(e)
     finally:
         self.handler.finished()
Exemple #14
0
    def make_cypherseed(self, img, rawnoise, calibration=False, is_seed = True):
        img = img.convertToFormat(QImage.Format_Mono)
        p = QPainter()
        p.begin(img)
        p.setCompositionMode(26) #xor
        p.drawImage(0, 0, rawnoise)
        p.end()
        cypherseed = self.pixelcode_2x2(img)
        cypherseed = QBitmap.fromImage(cypherseed)
        cypherseed = cypherseed.scaled(self.f_size, Qt.KeepAspectRatio)
        cypherseed = self.overlay_marks(cypherseed, True, calibration)

        if not is_seed:
            self.filename_prefix = 'custom_secret_'
            self.was = _('Custom secret')
        else:
            self.filename_prefix = self.wallet_name + '_seed_'
            self.was = self.wallet_name + ' ' + _('seed')
            if self.extension:
                self.ext_warning(self.c_dialog)


        if not calibration:
            self.toPdf(QImage(cypherseed))
            QDesktopServices.openUrl(QUrl.fromLocalFile(self.get_path_to_revealer_file('.pdf')))
            cypherseed.save(self.get_path_to_revealer_file('.png'))
            self.bcrypt(self.c_dialog)
        return cypherseed
Exemple #15
0
    def __init__(self, parent):
        super(MatrixDialog, self).__init__(parent)
        self.setWindowTitle(_("Trezor Matrix Recovery"))
        self.num = 9
        self.loop = QEventLoop()

        vbox = QVBoxLayout(self)
        vbox.addWidget(WWLabel(MATRIX_RECOVERY))

        grid = QGridLayout()
        grid.setSpacing(0)
        self.char_buttons = []
        for y in range(3):
            for x in range(3):
                button = QPushButton('?')
                button.clicked.connect(
                    partial(self.process_key,
                            ord('1') + y * 3 + x))
                grid.addWidget(button, 3 - y, x)
                self.char_buttons.append(button)
        vbox.addLayout(grid)

        self.backspace_button = QPushButton("<=")
        self.backspace_button.clicked.connect(
            partial(self.process_key, Qt.Key_Backspace))
        self.cancel_button = QPushButton(_("Cancel"))
        self.cancel_button.clicked.connect(
            partial(self.process_key, Qt.Key_Escape))
        buttons = Buttons(self.backspace_button, self.cancel_button)
        vbox.addSpacing(40)
        vbox.addLayout(buttons)
        self.refresh()
        self.show()
Exemple #16
0
 def add_cosigner_dialog(self, run_next, index, is_valid):
     title = _("Add Cosigner") + " %d" % index
     message = ' '.join([
         _('Please enter the master public key (xpub) of your cosigner.'),
         _('Enter their master private key (xprv) if you want to be able to sign for them.'
           )
     ])
     return self.text_input(title, message, is_valid)
Exemple #17
0
 def on_error(exc_info):
     e = exc_info[1]
     window.show_error("{header}\n{exc}\n\n{tor}".format(
         header=_('Error getting TrustedCoin account info.'),
         exc=str(e),
         tor=
         _('If you keep experiencing network problems, try using a Tor proxy.'
           )))
Exemple #18
0
 def __init__(self, text="", allow_multi=False):
     ButtonsTextEdit.__init__(self, text)
     self.allow_multi = allow_multi
     self.setReadOnly(0)
     self.addButton("file.png", self.file_input, _("Read file"))
     icon = "camera_white.png" if ColorScheme.dark_scheme else "camera_dark.png"
     self.addButton(icon, self.qr_input, _("Read QR code"))
     run_hook('scan_text_edit', self)
Exemple #19
0
 def set_pin(self, remove):
     if remove:
         self.msg = _("Confirm on your {} device to disable PIN protection")
     elif self.features.pin_protection:
         self.msg = _("Confirm on your {} device to change your PIN")
     else:
         self.msg = _("Confirm on your {} device to set a PIN")
     self.change_pin(remove)
 def create_password_layout(self, wallet, is_encrypted, OK_button):
     if not is_encrypted:
         msg = _('Your wallet file is NOT encrypted.')
     else:
         msg = _('Your wallet file is encrypted.')
     msg += '\n' + _('Note: If you enable this setting, you will need your hardware device to open your wallet.')
     msg += '\n' + _('Use this dialog to toggle encryption.')
     self.playout = PasswordLayoutForHW(msg)
Exemple #21
0
 def __init__(self, parent, seed, passphrase):
     WindowModalDialog.__init__(self, parent, ('Electrum-MUE - ' + _('Seed')))
     self.setMinimumWidth(400)
     vbox = QVBoxLayout(self)
     title =  _("Your wallet generation seed is:")
     slayout = SeedLayout(title=title, seed=seed, msg=True, passphrase=passphrase)
     vbox.addLayout(slayout)
     vbox.addLayout(Buttons(CloseButton(self)))
    def __init__(self, config, app, manager, parent):
        BaseWizard.__init__(self, config, None, None)
        QDialog.__init__(self, None)
        self.app = app
        self.gui = parent
        self.manager = manager
        self.setMinimumSize(600, 400)
        self.accept_signal.connect(self.accept)
        self.setWindowTitle('Electrum-MUE  -  ' + _('Masternode Wizard'))

        self.mn = MasternodeAnnounce()

        self.alias_e = None
        self.address_e = None
        self.privkey_e = None
        self.valid_utxo_list = None

        self.title = QLabel()
        self.main_widget = QWidget()
        self.back_button = QPushButton(_("Back"), self)
        self.back_button.setText(
            _('Back') if self.can_go_back() else _('Cancel'))
        self.next_button = QPushButton(_("Next"), self)
        self.next_button.setDefault(True)
        self.logo = QLabel()
        self.icon_filename = None
        self.loop = QEventLoop()
        self.rejected.connect(lambda: self.loop.exit(0))
        self.back_button.clicked.connect(lambda: self.loop.exit(1))
        self.next_button.clicked.connect(lambda: self.loop.exit(2))

        outer_vbox = QVBoxLayout(self)
        inner_vbox = QVBoxLayout()
        inner_vbox.addWidget(self.title)
        inner_vbox.addWidget(self.main_widget)
        inner_vbox.addStretch(1)
        # inner_vbox.addWidget(self.please_wait)
        inner_vbox.addStretch(1)
        scroll_widget = QWidget()
        scroll_widget.setLayout(inner_vbox)
        scroll = QScrollArea()
        scroll.setWidget(scroll_widget)
        scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        scroll.setWidgetResizable(True)
        icon_vbox = QVBoxLayout()
        icon_vbox.addWidget(self.logo)
        icon_vbox.addStretch(1)
        hbox = QHBoxLayout()
        hbox.addLayout(icon_vbox)
        hbox.addSpacing(5)
        hbox.addWidget(scroll)
        hbox.setStretchFactor(scroll, 1)
        outer_vbox.addLayout(hbox)
        outer_vbox.addLayout(Buttons(self.back_button, self.next_button))
        self.set_icon('electrum.png')
        self.show()
        self.raise_()
        self.refresh_gui()  # Need for QT on MacOSX.  Lame.
Exemple #23
0
    def add_io(self, vbox):
        vbox.addWidget(QLabel(_("Inputs") + ' (%d)' % len(self.tx.inputs())))
        ext = QTextCharFormat()
        rec = QTextCharFormat()
        rec.setBackground(QBrush(ColorScheme.GREEN.as_color(background=True)))
        rec.setToolTip(_("Wallet receive address"))
        chg = QTextCharFormat()
        chg.setBackground(QBrush(ColorScheme.YELLOW.as_color(background=True)))
        chg.setToolTip(_("Wallet change address"))
        twofactor = QTextCharFormat()
        twofactor.setBackground(
            QBrush(ColorScheme.BLUE.as_color(background=True)))
        twofactor.setToolTip(
            _("TrustedCoin (2FA) fee for the next batch of transactions"))

        def text_format(addr):
            if self.wallet.is_mine(addr):
                return chg if self.wallet.is_change(addr) else rec
            elif self.wallet.is_billing_address(addr):
                return twofactor
            return ext

        def format_amount(amt):
            return self.main_window.format_amount(amt, whitespaces=True)

        i_text = QTextEditWithDefaultSize()
        i_text.setFont(QFont(MONOSPACE_FONT))
        i_text.setReadOnly(True)
        cursor = i_text.textCursor()
        for x in self.tx.inputs():
            if x['type'] == 'coinbase':
                cursor.insertText('coinbase')
            else:
                prevout_hash = x.get('prevout_hash')
                prevout_n = x.get('prevout_n')
                cursor.insertText(prevout_hash + ":%-4d " % prevout_n, ext)
                addr = self.wallet.get_txin_address(x)
                if addr is None:
                    addr = ''
                cursor.insertText(addr, text_format(addr))
                if x.get('value'):
                    cursor.insertText(format_amount(x['value']), ext)
            cursor.insertBlock()

        vbox.addWidget(i_text)
        vbox.addWidget(QLabel(_("Outputs") + ' (%d)' % len(self.tx.outputs())))
        o_text = QTextEditWithDefaultSize()
        o_text.setFont(QFont(MONOSPACE_FONT))
        o_text.setReadOnly(True)
        cursor = o_text.textCursor()
        for o in self.tx.get_outputs_for_UI():
            addr, v = o.address, o.value
            cursor.insertText(addr, text_format(addr))
            if v is not None:
                cursor.insertText('\t', ext)
                cursor.insertText(format_amount(v), ext)
            cursor.insertBlock()
        vbox.addWidget(o_text)
Exemple #24
0
    def __init__(self, seed=None, title=None, icon=True, msg=None, options=None,
                 is_seed=None, passphrase=None, parent=None, for_seed_words=True):
        QVBoxLayout.__init__(self)
        self.parent = parent
        self.options = options
        if title:
            self.addWidget(WWLabel(title))
        if seed:  # "read only", we already have the text
            if for_seed_words:
                self.seed_e = ButtonsTextEdit()
            else:  # e.g. xpub
                self.seed_e = ShowQRTextEdit()
            self.seed_e.setReadOnly(True)
            self.seed_e.setText(seed)
        else:  # we expect user to enter text
            assert for_seed_words
            self.seed_e = CompletionTextEdit()
            self.seed_e.setTabChangesFocus(False)  # so that tab auto-completes
            self.is_seed = is_seed
            self.saved_is_seed = self.is_seed
            self.seed_e.textChanged.connect(self.on_edit)
            self.initialize_completer()

        self.seed_e.setMaximumHeight(75)
        hbox = QHBoxLayout()
        if icon:
            logo = QLabel()
            logo.setPixmap(QPixmap(icon_path("seed.png"))
                           .scaledToWidth(64, mode=Qt.SmoothTransformation))
            logo.setMaximumWidth(60)
            hbox.addWidget(logo)
        hbox.addWidget(self.seed_e)
        self.addLayout(hbox)
        hbox = QHBoxLayout()
        hbox.addStretch(1)
        self.seed_type_label = QLabel('')
        hbox.addWidget(self.seed_type_label)

        # options
        self.is_bip39 = False
        self.is_ext = False
        if options:
            opt_button = EnterButton(_('Options'), self.seed_options)
            hbox.addWidget(opt_button)
            self.addLayout(hbox)
        if passphrase:
            hbox = QHBoxLayout()
            passphrase_e = QLineEdit()
            passphrase_e.setText(passphrase)
            passphrase_e.setReadOnly(True)
            hbox.addWidget(QLabel(_("Your seed extension is") + ':'))
            hbox.addWidget(passphrase_e)
            self.addLayout(hbox)
        self.addStretch(1)
        self.seed_warning = WWLabel('')
        if msg:
            self.seed_warning.setText(seed_warning_msg(seed))
        self.addWidget(self.seed_warning)
Exemple #25
0
 def toggle_passphrase(self):
     if self.features.passphrase_protection:
         msg = _("Confirm on your {} device to disable passphrases")
     else:
         msg = _("Confirm on your {} device to enable passphrases")
     enabled = not self.features.passphrase_protection
     with self.run_flow(msg):
         trezorlib.device.apply_settings(self.client,
                                         use_passphrase=enabled)
Exemple #26
0
 def setup_device(self, device_info, wizard, purpose):
     devmgr = self.device_manager()
     device_id = device_info.device.id_
     client = devmgr.client_by_id(device_id)
     if client is None:
         raise UserFacingException(_('Failed to create a client for this device.') + '\n' +
                                   _('Make sure it is in the correct state.'))
     client.handler = self.create_handler(wizard)
     client.get_xpub("m/44'/222'", 'standard') # TODO replace by direct derivation once Nano S > 1.1
Exemple #27
0
 def setup_device(self, device_info, wizard, purpose):
     devmgr = self.device_manager()
     device_id = device_info.device.id_
     client = devmgr.client_by_id(device_id)
     if client is None:
         raise UserFacingException(
             _('Failed to create a client for this device.') + '\n' +
             _('Make sure it is in the correct state.'))
     client.handler = self.create_handler(wizard)
Exemple #28
0
 def set_pin(self, remove):
     if remove:
         msg = _("Confirm on your {} device to disable PIN protection")
     elif self.features.pin_protection:
         msg = _("Confirm on your {} device to change your PIN")
     else:
         msg = _("Confirm on your {} device to set a PIN")
     with self.run_flow(msg):
         trezorlib.device.change_pin(self.client, remove)
Exemple #29
0
 def bcrypt(self, dialog):
     self.rawnoise = False
     version = self.versioned_seed.version
     code_id = self.versioned_seed.checksum
     dialog.show_message(''.join([_("{} encrypted for Revealer {}_{} saved as PNG and PDF at: ").format(self.was, version, code_id),
                                  "<b>", self.get_path_to_revealer_file(), "</b>", "<br/>",
                                  "<br/>", "<b>", _("Always check your backups.")]),
                         rich_text=True)
     dialog.close()
Exemple #30
0
 def export(self):
     name = 'signed_%s.txn' % (
         self.tx.txid()[0:8]) if self.tx.is_complete() else 'unsigned.txn'
     fileName = self.main_window.getSaveFileName(
         _("Select where to save your signed transaction"), name, "*.txn")
     if fileName:
         with open(fileName, "w+") as f:
             f.write(json.dumps(self.tx.as_dict(), indent=4) + '\n')
         self.show_message(_("Transaction exported successfully"))
         self.saved = True