Beispiel #1
0
 def get_card(self, item: Invoice):
     status = self.app.wallet.get_invoice_status(item)
     status_str = item.get_status_str(status)
     is_lightning = item.type == PR_TYPE_LN
     if is_lightning:
         assert isinstance(item, LNInvoice)
         key = item.rhash
         address = key
         log = self.app.wallet.lnworker.logs.get(key)
         if status == PR_INFLIGHT and log:
             status_str += '... (%d)' % len(log)
         is_bip70 = False
     else:
         assert isinstance(item, OnchainInvoice)
         key = item.id
         address = item.get_address()
         is_bip70 = bool(item.bip70)
     return {
         'is_lightning': is_lightning,
         'is_bip70': is_bip70,
         'screen': self,
         'status': status,
         'status_str': status_str,
         'key': key,
         'memo': item.message or _('No Description'),
         'address': address,
         'amount': self.app.format_amount_and_units(item.get_amount_sat()
                                                    or 0),
     }
Beispiel #2
0
 def get_card(self, req: Invoice) -> Dict[str, Any]:
     is_lightning = req.is_lightning()
     if not is_lightning:
         assert isinstance(req, OnchainInvoice)
         address = req.get_address()
         key = address
     else:
         assert isinstance(req, LNInvoice)
         key = req.rhash
         address = req.invoice
     amount = req.get_amount_sat()
     description = req.message
     status = self.app.wallet.get_request_status(key)
     status_str = req.get_status_str(status)
     ci = {}
     ci['screen'] = self
     ci['address'] = address
     ci['is_lightning'] = is_lightning
     ci['key'] = key
     ci['amount'] = self.app.format_amount_and_units(
         amount) if amount else ''
     ci['memo'] = description
     ci['status'] = status
     ci['status_str'] = status_str
     return ci
Beispiel #3
0
 def update_item(self, key, invoice: Invoice):
     model = self.std_model
     for row in range(0, model.rowCount()):
         item = model.item(row, 0)
         if item.data(ROLE_KEY) == key:
             break
     else:
         return
     status_item = model.item(row, self.Columns.STATUS)
     status = self.parent.wallet.get_request_status(key)
     status_str = invoice.get_status_str(status)
     status_item.setText(status_str)
     status_item.setIcon(read_QIcon(pr_icons.get(status)))
Beispiel #4
0
 def update_item(self, key, invoice: Invoice):
     model = self.std_model
     for row in range(0, model.rowCount()):
         item = model.item(row, 0)
         if item.data(ROLE_REQUEST_ID) == key:
             break
     else:
         return
     status_item = model.item(row, self.Columns.STATUS)
     status = self.parent.wallet.get_invoice_status(invoice)
     status_str = invoice.get_status_str(status)
     if self.parent.wallet.lnworker:
         log = self.parent.wallet.lnworker.logs.get(key)
         if log and status == PR_INFLIGHT:
             status_str += '... (%d)' % len(log)
     status_item.setText(status_str)
     status_item.setIcon(read_QIcon(pr_icons.get(status)))
Beispiel #5
0
 def get_card(self, req: Invoice) -> Dict[str, Any]:
     is_lightning = req.is_lightning()
     if not is_lightning:
         address = req.get_address()
     else:
         address = req.lightning_invoice
     key = self.app.wallet.get_key_for_receive_request(req)
     amount = req.get_amount_sat()
     description = req.message
     status = self.app.wallet.get_request_status(key)
     status_str = req.get_status_str(status)
     ci = {}
     ci['screen'] = self
     ci['address'] = address
     ci['is_lightning'] = is_lightning
     ci['key'] = key
     ci['amount'] = self.app.format_amount_and_units(
         amount) if amount else ''
     ci['memo'] = description or _('No Description')
     ci['status'] = status
     ci['status_str'] = status_str
     return ci