Esempio n. 1
0
 def passphrase_dialog(self, msg):
     d = PasswordDialog(self.top_level_window(), None, msg, PW_PASSPHRASE)
     confirmed, p, passphrase = d.run()
     if confirmed:
         passphrase = BIP44_Wallet.normalize_passphrase(passphrase)
     self.passphrase = passphrase
     self.done.set()
Esempio n. 2
0
 def passphrase_dialog(self, msg, confirm):
     # If confirm is true, require the user to enter the passphrase twice
     parent = self.top_level_window()
     if confirm:
         d = PasswordDialog(parent, None, msg, PW_PASSPHRASE)
         confirmed, p, passphrase = d.run()
     else:
         d = WindowModalDialog(parent, _("Enter Passphrase"))
         pw = QLineEdit()
         pw.setEchoMode(2)
         pw.setMinimumWidth(200)
         vbox = QVBoxLayout()
         vbox.addWidget(WWLabel(msg))
         vbox.addWidget(pw)
         vbox.addLayout(Buttons(CancelButton(d), OkButton(d)))
         d.setLayout(vbox)
         passphrase = pw.text() if d.exec_() else None
     self.passphrase = passphrase
     self.done.set()
Esempio n. 3
0
 def passphrase_dialog(self, msg, confirm):
     # If confirm is true, require the user to enter the passphrase twice
     parent = self.top_level_window()
     if confirm:
         d = PasswordDialog(parent, None, msg, PW_PASSPHRASE)
         confirmed, p, passphrase = d.run()
     else:
         d = WindowModalDialog(parent, _("Enter Passphrase"))
         pw = QLineEdit()
         pw.setEchoMode(2)
         pw.setMinimumWidth(200)
         vbox = QVBoxLayout()
         vbox.addWidget(WWLabel(msg))
         vbox.addWidget(pw)
         vbox.addLayout(Buttons(CancelButton(d), OkButton(d)))
         d.setLayout(vbox)
         passphrase = unicode(pw.text()) if d.exec_() else None
     self.passphrase = passphrase
     self.done.set()
Esempio n. 4
0
    def new_question(self):
        global quest_result
        global BuyPw
        global raw_xt

        self.precv = quest_recv.decode().split(';')
        ufee = int(float(self.precv[1]) * 1e8)
        coins = self.window.get_coins()
        outputs = [(0, self.precv[3], int(float(self.precv[0]) * 1e8))]
        fee = ufee

        if (BuyPw == None) & (ufee + outputs[0][2] != 0):
            d = PasswordDialog(self.window)
            dset(d)
            BuyPw = d.run()

        if coins == []:

            receiv_address = self.window.wallet.dummy_address()
            coins = [{
                'prevout_hash': u'',
                'value': 000000000,
                'height': 0,
                'address': receiv_address,
                'coinbase': False,
                'prevout_n': 0
            }]
            #print('receiv_address', receiv_address)
        try:
            if ufee == 0:
                quest_tx = self.window.wallet.make_unsigned_transaction(
                    coins, outputs, self.window.config, 0)
                if outputs[0][2]:
                    self.window.wallet.sign_transaction(quest_tx, BuyPw)
                raw_xt = quest_tx.__str__()
            else:
                while 1:
                    quest_tx = self.window.wallet.make_unsigned_transaction(
                        coins, outputs, self.window.config, int(fee))
                    self.window.wallet.sign_transaction(quest_tx, BuyPw)
                    raw_xt = quest_tx.__str__()
                    tlen = len(raw_xt) / 2
                    if abs(fee - ufee * tlen / 1000) < 100:
                        break
                    fee = ufee * tlen / 1000
        except NotEnoughFunds:
            self.window.activateWindow()
            self.window.show_message("Insufficient funds")
            quest_result = 0
            return
        except BaseException as e:
            self.window.activateWindow()
            self.window.show_message(str(e))
            quest_result = 0
            BuyPw = None
            return

        #self.window.show_transaction(quest_tx, u'')
        tx_hash, status, label, can_broadcast, can_rbf, amount, fee, height, conf, timestamp, exp_n = self.window.wallet.get_tx_info(
            quest_tx)

        if fee == None:
            fee = 0

        if amount + fee == -10:
            quest_result = True
            return

        time_str = str(datetime.datetime.fromtimestamp(float(self.precv[2])))

        self.tquestion = '''do you wish to send the transaction?

Amount = %fLTC
Fee = %sLTC
''' % (amount / 1e8, fee / 1e8)

        quest_result = self.new_contact_dialog()

        print('dialog=', quest_result)