diff --git a/electrum/gui/kivy/main_window.py b/electrum/gui/kivy/main_window.py index 5e40a5cd4..259529959 100644 --- a/electrum/gui/kivy/main_window.py +++ b/electrum/gui/kivy/main_window.py @@ -916,7 +916,7 @@ class ElectrumWindow(App): return '' addr = None if self.send_screen: - addr = str(self.send_screen.screen.address) + addr = str(self.send_screen.address) if not addr: addr = self.wallet.dummy_address() outputs = [PartialTxOutput.from_address_and_value(addr, '!')] @@ -939,7 +939,11 @@ class ElectrumWindow(App): def format_amount(self, x, is_diff=False, whitespaces=False): return format_satoshis(x, 0, self.decimal_point(), is_diff=is_diff, whitespaces=whitespaces) - def format_amount_and_units(self, x): + def format_amount_and_units(self, x) -> str: + if x is None: + return 'none' + if x == '!': + return 'max' return format_satoshis_plain(x, self.decimal_point()) + ' ' + self.base_unit def format_fee_rate(self, fee_rate): diff --git a/electrum/gui/kivy/uix/dialogs/invoice_dialog.py b/electrum/gui/kivy/uix/dialogs/invoice_dialog.py index 249e7f638..a79822d3b 100644 --- a/electrum/gui/kivy/uix/dialogs/invoice_dialog.py +++ b/electrum/gui/kivy/uix/dialogs/invoice_dialog.py @@ -17,7 +17,7 @@ if TYPE_CHECKING: Builder.load_string(''' id: popup - amount: 0 + amount: None title: '' data: '' description:'' diff --git a/electrum/gui/kivy/uix/screens.py b/electrum/gui/kivy/uix/screens.py index c3e5df605..664a0d887 100644 --- a/electrum/gui/kivy/uix/screens.py +++ b/electrum/gui/kivy/uix/screens.py @@ -348,7 +348,6 @@ class SendScreen(CScreen): def _do_pay_onchain(self, invoice, rbf): # make unsigned transaction outputs = invoice['outputs'] # type: List[PartialTxOutput] - amount = sum(map(lambda x: x.value, outputs)) coins = self.app.wallet.get_spendable_coins(None) try: tx = self.app.wallet.make_unsigned_transaction(coins=coins, outputs=outputs) @@ -362,6 +361,7 @@ class SendScreen(CScreen): if rbf: tx.set_rbf(True) fee = tx.get_fee() + amount = sum(map(lambda x: x.value, outputs)) if '!' not in [x.value for x in outputs] else tx.output_value() msg = [ _("Amount to be sent") + ": " + self.app.format_amount_and_units(amount), _("Mining fee") + ": " + self.app.format_amount_and_units(fee),