53 Commits

Author SHA1 Message Date
85a9fad68b Replace bitcoin URI scheme with palladium in donation flow and add palladium URI support 2026-02-16 00:05:43 +01:00
35f9ac77f6 Add support for palladium BIP21 URI scheme
The changes introduce a new URI scheme 'palladium' alongside the existing 'bitcoin' scheme for BIP21 payment URIs. This allows the wallet to parse and handle palladium payment URIs in the same way as bitcoin URIs.
2025-11-21 10:45:05 +01:00
f321x
fdeada3f51 lnurl: implement LNURL-withdraw
adds handling of lnurl-withdraw payment identifiers which allow users to
withdraw bitcoin from a service by scanning a qr code or pasting the
lnurl-w code as "sending" address.
2025-08-27 15:31:43 +02:00
f321x
40f11213df make openalias and lnaddress lookup concurrent 2025-05-20 10:08:36 +02:00
f321x
61492d361e Use async dnspython methods for openalias/dnssec 2025-05-16 17:09:41 +02:00
f321x
b6e1e527c2 contacts: support lightning addressses as contact address
lightning addresses are useful and widely adopted, so it should be
possible to save them as payment identifier for a contact.
2025-05-15 17:55:23 +02:00
f321x
4e8db98d1b fix: SendTab not updating amount after text input change
When paying a 0 amount invoice, after clicking pay the entered amount
will get saved in
`PaymentIdentifier.boltPaymentIdentifier.bolt11.amount_msat`. However if
the user clicks cancel instead of pay, and then changes the amount,
amount_msat will not get updated, as it is not None anymore. If the user
clicks pay again, it will pay the previously entered wrong amount.
This checks the `LnAddr` amount instead of the `Invoice` amount.
2025-05-05 15:39:22 +02:00
Sander van Grieken
c6a0018c52 payment_identifier: regard BIP21 without address and without bolt11 invalid 2024-10-08 10:33:08 +02:00
SomberNight
2f1095510c bitcoin.py/transaction.py: API changes: rm most hex usage
Instead of some functions operating with hex strings,
and others using bytes, this consolidates most things to use bytes.

This mainly focuses on bitcoin.py and transaction.py,
and then adapts the API usages in other files.

Notably,
- scripts,
- pubkeys,
- signatures
should be bytes in almost all places now.
2024-04-29 17:10:26 +00:00
Sander van Grieken
6d37e464f3 payment_identifier: don't assume bip70_data exists in has_expired() 2024-04-08 13:58:55 +02:00
Sander van Grieken
ef87fbd3e5 payment_identifier: return onchain invoice when GUI requests MAX amount (fixes #8900) 2024-02-19 10:35:55 +01:00
SomberNight
1736558e3d type hints: follow-up prevprev. "union types as X | Y" needs py3.10
https://peps.python.org/pep-0604/
2024-02-07 11:03:55 +00:00
Sander van Grieken
f811db4ec8 payment_identifier: imports, typing declarations 2024-02-07 11:03:52 +01:00
xiaolou86
50e5b0efd1 electrum: fix typos 2023-12-04 14:15:39 +08:00
Sander van Grieken
6ce8a583fd qt: add missing case for on-chain fallback for BIP21 payment identfier containing lightning invoice 2023-11-02 10:24:37 +01:00
Sander van Grieken
ec8500bd55 payment_identifier: if a bip21 uri contains a lightning invoice without fallback address,
and an address is present in the bip21 uri path, register the on-chain address in the
Invoice.outputs field to allow paying onchain from a saved Invoice later (when the PI
is unavailable). Fixes #8654
2023-11-01 12:47:28 +01:00
Sander van Grieken
f7bf4e146d payment_identifier: move adding openalias to contacts out of _do_resolve.
This fixes "cannot pickle '_thread.RLock' object" when paying from Contacts tab
2023-10-03 11:42:12 +02:00
Sander van Grieken
3ff588049e payment_identifier: output is only considered a script if written as call-like 'script(<script>)' 2023-09-25 17:15:00 +02:00
SomberNight
64ba3bd017 (trivial) do not use old-style (%) formatting inside translations
see f29cd810e3/electrum/i18n.py (L48)
2023-09-07 13:25:35 +00:00
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