let the send tab parse and return its own fields
This commit is contained in:
parent
838a3e3187
commit
03c84aab0e
|
@ -799,7 +799,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
return lambda s, *args: s.do_protect(func, args)
|
return lambda s, *args: s.do_protect(func, args)
|
||||||
|
|
||||||
|
|
||||||
def do_send(self):
|
def read_send_tab(self):
|
||||||
label = unicode( self.message_e.text() )
|
label = unicode( self.message_e.text() )
|
||||||
|
|
||||||
if self.gui_object.payment_request:
|
if self.gui_object.payment_request:
|
||||||
|
@ -837,16 +837,23 @@ class ElectrumWindow(QMainWindow):
|
||||||
if not self.question(_("The fee for this transaction seems unusually high.\nAre you really sure you want to pay %(fee)s in fees?")%{ 'fee' : self.format_amount(fee) + ' '+ self.base_unit()}):
|
if not self.question(_("The fee for this transaction seems unusually high.\nAre you really sure you want to pay %(fee)s in fees?")%{ 'fee' : self.format_amount(fee) + ' '+ self.base_unit()}):
|
||||||
return
|
return
|
||||||
|
|
||||||
self.send_tx(outputs, fee, label)
|
coins = self.get_coins()
|
||||||
|
return outputs, fee, label, coins
|
||||||
|
|
||||||
|
|
||||||
|
def do_send(self):
|
||||||
|
r = self.read_send_tab()
|
||||||
|
if not r:
|
||||||
|
return
|
||||||
|
outputs, fee, label, coins = r
|
||||||
|
self.send_tx(outputs, fee, label, coins)
|
||||||
|
|
||||||
|
|
||||||
@protected
|
@protected
|
||||||
def send_tx(self, outputs, fee, label, password):
|
def send_tx(self, outputs, fee, label, coins, password):
|
||||||
self.send_button.setDisabled(True)
|
self.send_button.setDisabled(True)
|
||||||
|
|
||||||
# first, create an unsigned tx
|
# first, create an unsigned tx
|
||||||
coins = self.get_coins()
|
|
||||||
try:
|
try:
|
||||||
tx = self.wallet.make_unsigned_transaction(outputs, fee, None, coins = coins)
|
tx = self.wallet.make_unsigned_transaction(outputs, fee, None, coins = coins)
|
||||||
tx.error = None
|
tx.error = None
|
||||||
|
|
|
@ -86,30 +86,13 @@ class Plugin(BasePlugin):
|
||||||
return r.data
|
return r.data
|
||||||
|
|
||||||
def show_raw_qr(self):
|
def show_raw_qr(self):
|
||||||
r = unicode( self.gui.main_window.payto_e.text() )
|
r = self.gui.main_window.read_send_tab()
|
||||||
r = r.strip()
|
if not r:
|
||||||
|
|
||||||
# label or alias, with address in brackets
|
|
||||||
m = re.match('(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>', r)
|
|
||||||
to_address = m.group(2) if m else r
|
|
||||||
|
|
||||||
if not is_valid(to_address):
|
|
||||||
QMessageBox.warning(self.gui.main_window, _('Error'), _('Invalid Bitcoin Address') + ':\n' + to_address, _('OK'))
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
outputs, fee, label, coins = r
|
||||||
try:
|
try:
|
||||||
amount = self.gui.main_window.read_amount(unicode( self.gui.main_window.amount_e.text()))
|
tx = self.gui.main_window.wallet.make_unsigned_transaction(outputs, fee, None, None, coins)
|
||||||
except Exception:
|
|
||||||
QMessageBox.warning(self.gui.main_window, _('Error'), _('Invalid Amount'), _('OK'))
|
|
||||||
return
|
|
||||||
try:
|
|
||||||
fee = self.gui.main_window.read_amount(unicode( self.gui.main_window.fee_e.text()))
|
|
||||||
except Exception:
|
|
||||||
QMessageBox.warning(self.gui.main_window, _('Error'), _('Invalid Fee'), _('OK'))
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
tx = self.gui.main_window.wallet.mktx( [(to_address, amount)], None, fee)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.gui.main_window.show_message(str(e))
|
self.gui.main_window.show_message(str(e))
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue