Page MenuHomePhabricator

[electrum] support eCash aliases in the "Pay To" field
ClosedPublic

Authored by PiRK on Sep 27 2023, 13:11.

Details

Reviewers
Fabien
bytesofman
Group Reviewers
Restricted Project
Maniphest Tasks
Restricted Maniphest Task
Commits
rABC6cf10b97ad86: [electrum] support eCash aliases in the "Pay To" field
Summary

Support eCash aliases in the "Pay To" field, with the same limitations as OpenAliases:

  • the resolving of the alias blocks the GUI for a couple of seconds
  • only one recipient is supported when using aliases (no "pay to many")

eCash aliases require a .xec suffix in the send tab to be recognized.

Partially fix how resolved aliases are added to the Contacts:

  • deduplicate self.win.contacts.add( line
  • save eCash aliases with an address rather than the original alias (we assume immutability, for phase 1)
  • update autcompletions immediately, rather than on the next restart

OpenAliases are not immutable, the address can be changes, which is probably why the URL was saved in the Contact's "address" field to avoid saving an address that could potentially become stale. But that means the autocompletion will not provide a string that is usable by the Send tab. Let's not add OpenAliases to the contacts, because right now the support is broken. OpenAliases are still usable in the PayTo field, they are just not saved to the wallet's contacts.

Depends on D14544

ref T3298

Test Plan

./electrum-abc --enable-aliases

Prepare a transaction to "twelvechar12.xec", check the transaction is a valid transaction to an actual eCash address.
Check that "twelvechar12" has been added to the Contacts tab, and that the next time it is typed in the send form there is autocompletion provided.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Sep 27 2023, 13:11

use constant for server url

(no "pay too many")

You can't pay to many, but still can pay too much with aliases !

Fabien requested changes to this revision.Sep 28 2023, 09:15
Fabien added inline comments.
electrum/electrumabc/contacts.py
44 ↗(On Diff #42424)

it's already in contact_list, don't duplicate

EDIT: it's moved and not duplicated, nice. But also it's weird that it belong to contacts or contact_list, should be in some alias.py instead

269 ↗(On Diff #42424)

Why is that a class method ? Also you probably want to move this to some alias.py file

This revision now requires changes to proceed.Sep 28 2023, 09:15

move alias related code from contacts.py to alias.py

electrum/electrumabc/alias.py
118 ↗(On Diff #42433)

move-only from contacts.py

126 ↗(On Diff #42433)

move-mostly from contacts.py, the only difference being the change from class method to regular function

reuse fetch_alias_data in resolve_ecash_alias

This revision is now accepted and ready to land.Sep 28 2023, 14:55