Browse Source

add option to pay multiple invoices

ln-negative-red
ThomasV 5 years ago
parent
commit
8c3af39a9b
  1. 10
      electrum/gui/qt/invoice_list.py
  2. 6
      electrum/gui/qt/main_window.py

10
electrum/gui/qt/invoice_list.py

@ -146,8 +146,14 @@ class InvoiceList(MyTreeView):
def create_menu(self, position):
items = self.selected_in_column(0)
if len(items) > 1:
print(items)
if len(items)>1:
keys = [ item.data(ROLE_REQUEST_ID) for item in items]
invoices = [ self.parent.wallet.get_invoice(key) for key in keys]
invoices = [ invoice for invoice in invoices if invoice['status'] == PR_UNPAID and invoice['type'] == PR_TYPE_ONCHAIN]
if len(invoices) > 1:
menu = QMenu(self)
menu.addAction(_("Pay multiple invoices"), lambda: self.parent.pay_multiple_invoices(invoices))
menu.exec_(self.viewport().mapToGlobal(position))
return
idx = self.indexAt(position)
item = self.model().itemFromIndex(idx)

6
electrum/gui/qt/main_window.py

@ -1435,6 +1435,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
self.do_clear()
self.do_pay_invoice(invoice)
def pay_multiple_invoices(self, invoices):
outputs = []
for invoice in invoices:
outputs += invoice['outputs']
self.pay_onchain_dialog(self.get_coins, outputs)
def do_pay_invoice(self, invoice):
if invoice['type'] == PR_TYPE_LN:
self.pay_lightning_invoice(invoice['invoice'])

Loading…
Cancel
Save