def do_save(self): if not self.screen.address: return if self.screen.is_pr: # it should be already saved return # save address as invoice from electrum_mona.paymentrequest import make_unsigned_request, PaymentRequest req = {'address': self.screen.address, 'memo': self.screen.message} amount = self.app.get_amount( self.screen.amount) if self.screen.amount else 0 req['amount'] = amount pr = make_unsigned_request(req).SerializeToString() pr = PaymentRequest(pr) self.app.wallet.invoices.add(pr) self.app.show_info(_("Invoice saved")) if pr.is_pr(): self.screen.is_pr = True self.payment_request = pr else: self.screen.is_pr = False self.payment_request = None
def on_receive(self, pr_str): self.print_error('received payment request') self.pr = PaymentRequest(pr_str) self.obj.email_new_invoice_signal.emit()