1
0

return tx in on_closed callback

This commit is contained in:
Oren
2025-05-24 02:30:00 +03:00
parent 7eb29f9a6b
commit 78c0425931
3 changed files with 6 additions and 4 deletions

View File

@@ -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,
)

View File

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

View File

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