Skip to content

Commit

Permalink
qt tx_dialog: share btn: add option to add slip-19 ownership proofs
Browse files Browse the repository at this point in the history
  • Loading branch information
SomberNight committed Feb 5, 2024
1 parent 158d685 commit 3b826be
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion electrum/gui/qt/transaction_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
TRANSACTION_FILE_EXTENSION_FILTER_ONLY_COMPLETE_TX,
TRANSACTION_FILE_EXTENSION_FILTER_ONLY_PARTIAL_TX,
BlockingWaitingDialog, getSaveFileName, ColorSchemeItem,
get_iconname_qrcode, VLine)
get_iconname_qrcode, VLine, WaitingDialog)
from .rate_limiter import rate_limited
from .my_treeview import create_toolbar_with_menu, QMenuWithConfig

Expand Down Expand Up @@ -511,6 +511,16 @@ def on_edited():
export_option = export_actions_menu.addConfig(
self.config.cv.GUI_QT_TX_DIALOG_EXPORT_INCLUDE_GLOBAL_XPUBS)
self.psbt_only_widgets.append(export_option)
export_option = export_actions_menu.addAction(
_('Include SLIP-19 ownership proofs'),
self._add_slip_19_ownership_proofs_to_tx)
export_option.setToolTip(_("Some cosigners (e.g. Trezor) might require this for coinjoins."))
self._export_option_slip19 = export_option
export_option.setCheckable(True)
export_option.setChecked(False)
if not self.wallet.has_support_for_slip_19_ownership_proofs():
export_option.setEnabled(False)
self.psbt_only_widgets.append(export_option)

self.export_actions_button = QToolButton()
self.export_actions_button.setText(_("Share"))
Expand Down Expand Up @@ -628,6 +638,20 @@ def gettx() -> Transaction:
action.triggered.connect(lambda: self.export_to_file(tx=gettx()))
menu.addAction(action)

def _add_slip_19_ownership_proofs_to_tx(self):
assert isinstance(self.tx, PartialTransaction)
def on_success(result):
self._export_option_slip19.setEnabled(False)
self.main_window.pop_top_level_window(self)
def on_failure(exc_info):
self._export_option_slip19.setChecked(False)
self.main_window.on_error(exc_info)
self.main_window.pop_top_level_window(self)
task = partial(self.wallet.add_slip_19_ownership_proofs_to_tx, self.tx)
msg = _('Adding SLIP-19 ownership proofs to transaction...')
self.main_window.push_top_level_window(self)
WaitingDialog(self, msg, task, on_success, on_failure)

def copy_to_clipboard(self, *, tx: Transaction = None):
if tx is None:
tx = self.tx
Expand Down

0 comments on commit 3b826be

Please sign in to comment.