Browse Source

Added BTC and Fiat amount on the confirmation screen for Lightning Invoice (#7425)

Added BTC and Fiat amount(as enabled by the user) on the confirmation screen for a Lightning Invoice in the Kivy GUI 

closes https://github.com/spesmilo/electrum/issues/7410
patch-4
Siddhant Chawla 4 years ago
committed by GitHub
parent
commit
a8ecc68833
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      electrum/gui/kivy/main_window.py
  2. 4
      electrum/gui/kivy/uix/screens.py

7
electrum/gui/kivy/main_window.py

@ -973,6 +973,13 @@ class ElectrumWindow(App, Logger):
# via self.get_amount()... the need for converting back should be removed
return format_satoshis_plain(x, decimal_point=self.decimal_point()) + ' ' + self.base_unit
def format_amount_and_units_with_fiat(self, x) -> str:
text = self.format_amount_and_units(x)
fiat = self.fx.format_amount_and_units(x) if self.fx else None
if text and fiat:
text += f' ({fiat})'
return text
def format_fee_rate(self, fee_rate):
# fee_rate is in sat/kB
return format_fee_satoshis(fee_rate/1000) + ' sat/byte'

4
electrum/gui/kivy/uix/screens.py

@ -341,7 +341,9 @@ class SendScreen(CScreen, Logger):
def do_pay_invoice(self, invoice):
if invoice.is_lightning():
if self.app.wallet.lnworker:
self.app.protected(_('Pay lightning invoice?'), self._do_pay_lightning, (invoice,))
amount_sat = invoice.get_amount_sat()
msg = _("Pay lightning invoice?") + '\n\n' + _("This will send {}?").format(self.app.format_amount_and_units_with_fiat(amount_sat)) +'\n'
self.app.protected(msg, self._do_pay_lightning, (invoice,))
else:
self.app.show_error(_("Lightning payments are not available for this wallet"))
else:

Loading…
Cancel
Save