1
0

pass wallet to PaymentIdentifier instead of config and contacts

This commit is contained in:
Sander van Grieken
2023-05-31 20:54:30 +02:00
parent ac341d9565
commit a2ca191de1
4 changed files with 21 additions and 17 deletions

View File

@@ -213,9 +213,9 @@ class PayToEdit(Logger, GenericInputHandler):
self.previous_payto = text
if self.disable_checks:
return
pi = PaymentIdentifier(self.config, self.win.contacts, text)
pi = PaymentIdentifier(self.send_tab.wallet, text)
self.is_multiline = bool(pi.multiline_outputs)
print('is_multiline', self.is_multiline)
self.logger.debug(f'is_multiline {self.is_multiline}')
self.send_tab.handle_payment_identifier(pi, can_use_network=full_check)
def handle_multiline(self, outputs):

View File

@@ -194,7 +194,7 @@ class SendTab(QWidget, MessageBoxMixin, Logger):
self.set_payment_identifier(text)
def set_payment_identifier(self, text):
pi = PaymentIdentifier(self.config, self.window.contacts, text)
pi = PaymentIdentifier(self.wallet, text)
if pi.error:
self.show_error(_('Clipboard text is not a valid payment identifier') + '\n' + pi.error)
return
@@ -356,7 +356,7 @@ class SendTab(QWidget, MessageBoxMixin, Logger):
w.setReadOnly(False)
def update_fields(self, pi):
recipient, amount, description, comment, validated = pi.get_fields_for_GUI(self.wallet)
recipient, amount, description, comment, validated = pi.get_fields_for_GUI()
if recipient:
self.payto_e.setTextNoCheck(recipient)
elif pi.multiline_outputs:
@@ -408,7 +408,7 @@ class SendTab(QWidget, MessageBoxMixin, Logger):
self.show_error(_('No amount'))
return
invoice = self.payment_identifier.get_invoice(self.wallet, amount_sat, self.get_message())
invoice = self.payment_identifier.get_invoice(amount_sat, self.get_message())
#except Exception as e:
if not invoice:
self.show_error('error getting invoice' + self.payment_identifier.error)
@@ -449,7 +449,7 @@ class SendTab(QWidget, MessageBoxMixin, Logger):
self.do_clear()
return
self.update_fields(pi)
invoice = pi.get_invoice(self.wallet, self.get_amount(), self.get_message())
invoice = pi.get_invoice(self.get_amount(), self.get_message())
self.pending_invoice = invoice
self.do_pay_invoice(invoice)