From 78c04259315b4b5529909ae1ced8851731b1e62d Mon Sep 17 00:00:00 2001 From: Oren Date: Sat, 24 May 2025 02:30:00 +0300 Subject: [PATCH] return tx in on_closed callback --- electrum/gui/qt/main_window.py | 2 ++ electrum/gui/qt/transaction_dialog.py | 6 +++--- electrum/plugins/psbt_nostr/qt.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 15a4fa91a..d21d0d035 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -1183,6 +1183,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener): *, external_keypairs: Mapping[bytes, bytes] = None, invoice: Invoice = None, + on_closed: Callable[[Optional[Transaction]], None] = None, show_sign_button: bool = True, show_broadcast_button: bool = True, ): @@ -1191,6 +1192,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener): parent=self, external_keypairs=external_keypairs, invoice=invoice, + on_closed=on_closed, show_sign_button=show_sign_button, show_broadcast_button=show_broadcast_button, ) diff --git a/electrum/gui/qt/transaction_dialog.py b/electrum/gui/qt/transaction_dialog.py index e3c4e914d..0ebaf8c98 100644 --- a/electrum/gui/qt/transaction_dialog.py +++ b/electrum/gui/qt/transaction_dialog.py @@ -427,7 +427,7 @@ def show_transaction( prompt_if_unsaved: bool = False, external_keypairs: Mapping[bytes, bytes] = None, invoice: 'Invoice' = None, - on_closed: Callable[[], None] = None, + on_closed: Callable[[Optional[Transaction]], None] = None, show_sign_button: bool = True, show_broadcast_button: bool = True, ): @@ -463,7 +463,7 @@ class TxDialog(QDialog, MessageBoxMixin): prompt_if_unsaved: bool, external_keypairs: Mapping[bytes, bytes] = None, invoice: 'Invoice' = None, - on_closed: Callable[[], None] = None, + on_closed: Callable[[Optional[Transaction]], None] = None, ): '''Transactions in the wallet will show their description. Pass desc to give a description for txs not yet in the wallet. @@ -640,7 +640,7 @@ class TxDialog(QDialog, MessageBoxMixin): self._fetch_txin_data_fut = None if self.on_closed: - self.on_closed() + self.on_closed(self.tx) def reject(self): # Override escape-key to close normally (and invoke closeEvent) diff --git a/electrum/plugins/psbt_nostr/qt.py b/electrum/plugins/psbt_nostr/qt.py index b86c13e64..dc9f86f71 100644 --- a/electrum/plugins/psbt_nostr/qt.py +++ b/electrum/plugins/psbt_nostr/qt.py @@ -145,7 +145,7 @@ class QtCosignerWallet(EventListener, CosignerWallet): self.add_transaction_to_wallet(tx, label=label, on_failure=self.on_add_fail) self.window.update_tabs() - def on_tx_dialog_closed(self, event_id): + def on_tx_dialog_closed(self, event_id, _tx: Optional['Transaction']): self.mark_pending_event_rcvd(event_id) def on_add_fail(self, msg: str):