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:
@@ -973,6 +973,13 @@ class ElectrumWindow(App, Logger):
|
|||||||
# via self.get_amount()... the need for converting back should be removed
|
# 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
|
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):
|
def format_fee_rate(self, fee_rate):
|
||||||
# fee_rate is in sat/kB
|
# fee_rate is in sat/kB
|
||||||
return format_fee_satoshis(fee_rate/1000) + ' sat/byte'
|
return format_fee_satoshis(fee_rate/1000) + ' sat/byte'
|
||||||
|
|||||||
@@ -341,7 +341,9 @@ class SendScreen(CScreen, Logger):
|
|||||||
def do_pay_invoice(self, invoice):
|
def do_pay_invoice(self, invoice):
|
||||||
if invoice.is_lightning():
|
if invoice.is_lightning():
|
||||||
if self.app.wallet.lnworker:
|
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:
|
else:
|
||||||
self.app.show_error(_("Lightning payments are not available for this wallet"))
|
self.app.show_error(_("Lightning payments are not available for this wallet"))
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user