Browse Source

swap dialog: show on_result popup for both directions

master
ThomasV 2 years ago
parent
commit
a5da379d13
  1. 21
      electrum/gui/qt/swap_dialog.py

21
electrum/gui/qt/swap_dialog.py

@ -256,7 +256,7 @@ class SwapDialog(WindowModalDialog, QtEventListener):
lightning_amount_sat=lightning_amount, lightning_amount_sat=lightning_amount,
expected_onchain_amount_sat=onchain_amount + self.swap_manager.get_claim_fee(), expected_onchain_amount_sat=onchain_amount + self.swap_manager.get_claim_fee(),
) )
self.window.run_coroutine_from_thread(coro, _('Swapping funds')) self.window.run_coroutine_from_thread(coro, _('Swapping funds'), on_result=self.on_result)
return True return True
else: else:
lightning_amount = self.recv_amount_e.get_amount() lightning_amount = self.recv_amount_e.get_amount()
@ -325,15 +325,16 @@ class SwapDialog(WindowModalDialog, QtEventListener):
tx=tx, tx=tx,
channels=self.channels, channels=self.channels,
) )
def on_result(txid): self.window.run_coroutine_from_thread(coro, _('Swapping funds'), on_result=self.on_result)
msg = _("Submarine swap") + ': ' + (_("Success") if txid else _("Expired")) + '\n'
if txid: def on_result(self, txid):
msg += _("Funding transaction") + ': ' + txid + '\n' msg = _("Submarine swap") + ': ' + (_("Success") if txid else _("Expired")) + '\n\n'
msg += _("Please remain online until your transaction is confirmed") if txid:
else: msg += _("Funding transaction") + ': ' + txid + '\n'
msg += _("The server failed to send lightning funds to you") msg += _("Please remain online until the funding transaction is confirmed.")
self.window.show_error_signal.emit(msg) else:
self.window.run_coroutine_from_thread(coro, _('Swapping funds'), on_result=on_result) msg += _("Lightning funds were not received.")
self.window.show_error_signal.emit(msg)
def get_description(self): def get_description(self):
onchain_funds = "onchain funds" onchain_funds = "onchain funds"

Loading…
Cancel
Save