Commit Graph

34 Commits

Author SHA1 Message Date
Sander van Grieken 307cf25fd4 register distinction between address and script for SPK type payment identifiers and allow zero amount for
script destinations.

This is mainly to support OP_RETURN outputs, which typically have a zero amount output value,
but as we don't special case OP_RETURN, this is currently done for all non-address scripts

Also, it's probably good to add a warning popup for OP_RETURN outputs with a non-zero output value, but this
would also need special casing for OP_RETURN.

Saving of script output payment identifiers is disabled for now, as reading the script from the stored invoice
back into human-readable form is currently not implemented, and currently only lightning invoices or address output
is supported.
2023-09-04 20:00:40 +02:00
SomberNight ffa3acc013 invoices: don't modify .amount_msat directly 2023-08-22 18:12:15 +00:00
SomberNight 7245762922 qt: fix lnurl-pay
regression from https://github.com/spesmilo/electrum/pull/8462
2023-08-22 17:00:17 +00:00
SomberNight e38605c10a CLI: fix regression re handling "unknown command", re payment_identifiers
```
$ ./run_electrum sadasdasddsa
Traceback (most recent call last):
  File "/home/user/wspace/electrum/./run_electrum", line 532, in <module>
    main()
  File "/home/user/wspace/electrum/./run_electrum", line 398, in main
    if uri and not PaymentIdentifier(None, uri).is_valid():
  File "/home/user/wspace/electrum/electrum/payment_identifier.py", line 136, in __init__
    self.parse(text)
  File "/home/user/wspace/electrum/electrum/payment_identifier.py", line 265, in parse
    elif contact := self.contacts.by_name(text):
AttributeError: 'NoneType' object has no attribute 'by_name'
```
2023-08-09 14:52:37 +00:00
Sander van Grieken b1b2190f0a payment_identifier: add payment_identifier_from_invoice function to reconstruct a PI from bip70 invoice 2023-07-11 16:43:49 +02:00
Sander van Grieken ad4b431738 payment_identifier: fix setting self.bolt11 to invoice in bip21 LN alt case 2023-07-11 15:24:03 +02:00
Sander van Grieken 33acfd3d1c followup d15050a2bf 2023-07-11 14:24:43 +02:00
Sander van Grieken 78a741e4a3 actually remove the FIXME 2023-07-11 14:19:54 +02:00
Sander van Grieken d15050a2bf payment_identifier: fix _on_finalize params, fix lnurlp send comment instead of description,
refactor payment_identifier.get_invoice to standalone invoice_from_payment_identifier
2023-07-11 14:15:17 +02:00
SomberNight f2dbf47413 payment_identifier.py: add some type hints, trivial clean-up 2023-07-10 17:59:56 +00:00
SomberNight 612a8e6424 qt: fix: bip70 pay reqs need x509 verification
regression from https://github.com/spesmilo/electrum/pull/8462

- pr.verify() was called in qml, but not in qt gui
- we now call pr.verify() in get_payment_request(), to make the API less error-prone
- it is now ok to call pr.verify() multiple times, the result is cached
2023-07-10 17:50:53 +00:00
ThomasV 6bacd65a80 payment_identifter: add FIXME 2023-07-09 10:05:31 +02:00
Sander van Grieken f980bd97b5 payment_identifier: factor out bip21 functions to bip21.py to break cyclic dependencies,
parse bolt11 only once, store invoice internally instead of bolt11 string
add is_onchain method to indicate if payment identifier can be paid onchain
2023-07-08 12:18:37 +02:00
Sander van Grieken 7f766f6dfb payment_identifiers: also match local contacts 2023-07-07 22:54:46 +02:00
Sander van Grieken eeda06e751 payment_identifier: fix error path for bip70 2023-06-30 11:44:13 +02:00
Sander van Grieken 81544fdaed send_tab: simplify lock_recipient check 2023-06-28 16:49:28 +02:00
Sander van Grieken 30abcad999 payment_identifier: move amount_range into payment_identifier 2023-06-28 16:49:28 +02:00
Sander van Grieken fbb37d6fae payment_identifier: add DOMAINLIKE payment identifier type, support domainlike -> openalias 2023-06-28 16:49:28 +02:00
Sander van Grieken 5cc7948eee fix bip70 potentially not returning gui fields tuple 2023-06-28 16:49:28 +02:00
Sander van Grieken 0cbf403f8b use NamedTuple for payment identifier gui fields 2023-06-28 16:49:28 +02:00
Sander van Grieken 3a1e5244b8 qt: fix enable/disable max button for openalias and restrict openalias to address only 2023-06-28 16:49:28 +02:00
Sander van Grieken eed016bd7e qt: move setting frozen styling to edit components themselves, fix re-enabling Clear button after finalize 2023-06-28 16:49:28 +02:00
Sander van Grieken 74a1f38a8b payment identifier types as enum 2023-06-28 16:49:28 +02:00
Sander van Grieken fc141c0182 payment_identfier: refactor qml and tests 2023-06-28 16:49:28 +02:00
Sander van Grieken 915f66c0b8 payment_identifier: fix emaillike
qt: validate on pushback timer, buttons enable/disable, cleanup
2023-06-28 16:49:28 +02:00
Sander van Grieken bde066f9ce qt: refactor send_tab, paytoedit 2023-06-28 16:49:28 +02:00
Sander van Grieken d9a43fa6ed refactor last callback, signals. remove timered validate, don't add invalid address/amount to outputs 2023-06-28 16:49:28 +02:00
Sander van Grieken b1925f8747 payment_identifier: refactor round_3 to need_merchant_notify/notify_merchant 2023-06-28 16:49:28 +02:00
Sander van Grieken 7601726d29 payment_identifier: refactor round_2 to need_finalize/finalize stage 2023-06-28 16:49:28 +02:00
Sander van Grieken 508d1038d3 payment_identifier: define states, refactor round_1 into resolve stage 2023-06-28 16:49:28 +02:00
Sander van Grieken a2ca191de1 pass wallet to PaymentIdentifier instead of config and contacts 2023-06-28 16:49:28 +02:00
Sander van Grieken ac341d9565 whitespace, code style 2023-06-28 16:49:28 +02:00
Sander van Grieken cbd388c297 fix flake8 issues (undefined references) 2023-06-28 16:49:28 +02:00
ThomasV 15eb765eac payment_identifiers:
- this separates GUI from core handling
 - the PaymentIdentifier class handles network requests
 - the GUI is agnostic about the type of PI
2023-06-28 16:49:28 +02:00