1
0

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
This commit is contained in:
Siddhant Chawla
2021-07-22 23:53:32 +05:30
committed by GitHub
parent 2a80ab1623
commit a8ecc68833
2 changed files with 10 additions and 1 deletions

View File

@@ -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'

View File

@@ -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: