HomePhabricator

[Cashtab] [Alias] pt 4 - Implement isAddressRegistered function

Description

[Cashtab] [Alias] pt 4 - Implement isAddressRegistered function

Summary:
T2551

Depends on D12907

This diff fleshes out the isAddressRegistered function which is called upon loading the Alias component to check whether the current active wallet has any onchain aliases attached to it.

The payment address tx history retrieval logic was moved into it's own getAliasPaymentHistory function so that it can be reused by both isAddressRegistered and isAliasAvailable.

isAddressRegistered basically filters for valid incoming registration transactions at the alias payment address and extracts the hash160 of inputs[0] (the sender address of a valid registration tx) and compares it to the active wallet's hash160 (wallet.Path1899.hash160).

In later diffs the chronik API calls in isAddressRegistered will retrieve cached tx histories if the tx count of the alias payment address has not changed.

[Cashtab] [Alias] pt 1 - Create scaffold for new Identity component
[Cashtab] [Alias] pt 2 - Implement registerNewAlias() to handle alias registration
[Cashtab] [Alias] pt 3 - Implement isAliasAvailable function
[Cashtab] [Alias] pt 4 - Implement isAddressRegistered function
[Cashtab] [Alias] pt 5 - Implement getAddressFromAlias function
[Cashtab] [Alias] pt 6 - Implement isLocalAliasStateLatest function
[Cashtab] [Alias] pt 7 - Enable alias lookup for Send XEC component
[Cashtab] [Alias] pt 8 - Enable alias lookup for Send Token component
[Cashtab] [Alias] pt 9 - Implement pricing mechanism
[Cashtab] [Alias] pt 10 - Server cron job
[Cashtab] [Alias] pt 11 - Upgrade tx history to recognize alias registration txs

Test Plan:

  • npm test
  • npm start
  • use a wallet that you have previously registered an alias with from part 3 of this stack
  • navigate to the Alias page and verify the 'Does this active wallet have an onchain alias? : true' console log message is displayed
  • switch to a wallet that did not previously register an alias then navigate to the Alias page and verify the 'Does this active wallet have an onchain alias? : false' console log message is displayed

Reviewers: bytesofman, kieran709, #bitcoin_abc

Reviewed By: bytesofman, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D12908

Details

Provenance
emackAuthored on Dec 18 2022, 04:20
emackPushed on Feb 22 2023, 04:05
Reviewer
Restricted Project
Differential Revision
D12908: [Cashtab] [Alias] pt 4 - Implement isAddressRegistered function
Parents
rABC3e8398063ea7: [Cashtab] [Alias] pt 3 - Implement isAliasAvailable function
Branches
Unknown
Tags
Unknown