mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
add option to pay multiple invoices
This commit is contained in:
parent
dd6cb2caf7
commit
8c3af39a9b
2 changed files with 14 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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…
Add table
Reference in a new issue