def get_card(self, item: Invoice) -> Dict[str, Any]: status = self.app.wallet.get_invoice_status(item) status_str = item.get_status_str(status) is_lightning = item.type == PR_TYPE_LN key = self.app.wallet.get_key_for_outgoing_invoice(item) if is_lightning: assert isinstance(item, LNInvoice) address = item.rhash if self.app.wallet.lnworker: 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) 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), }
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
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 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 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, 'amount': self.app.format_amount_and_units(item.get_amount_sat() or 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)))
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)))