Page MenuHomePhabricator

[Cashtab] [Alias] pt 6.4 - Update getAliases() to extract both alias and address
ClosedPublic

Authored by emack on Jan 26 2023, 12:57.

Details

Summary

T2551

Depends on D13049

This diff refactors getAliases() into getAliasAndAddresses() which will now return an array of objects containing both alias name and its corresponding address.

Related functions in chronik.js and useWallet.js have been updated to reflect the new alias caching structure of

aliases: [{alias: 'foo', address: 'ecash:qrjr23zzzz'}...] instead of the previous [aliasString1, aliasString2...]

Similar to the replyAddress function, it assumes the first hash160 in input[0].outputScript will always be the address broadcasting the registration transaction.

Alias unit tests across the board updated to reflect the new alias cache object.

[Cashtab] [Alias] pt 1 - Create scaffold for new Identity component
[Cashtab] [Alias] pt 2 - Upgrade sendXec() 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.1 - Get latest alias tx count from payment address
[Cashtab] [Alias] pt 6.1.1 - Apply Promise.All approach for alias history retrieval
[Cashtab] [Alias] pt 6.2 - Implement getAliasesFromLocalForage
[Cashtab] [Alias] pt 6.3 - Implement updateAliases
[Cashtab] [Alias] pt 6.4 - Update getAliases() to extract both alias and address
[Cashtab] [Alias] pt 6.5 - Optimize getAllTxHistory to only make API calls for uncached tx history pages
[Cashtab] [Alias] pt 6.6 - Deprecate caching related mocks, @TODOs and reviewer logs
[Cashtab] [Alias] pt 7 - Mitigate edge cases for registration records
[Cashtab] [Alias] pt 8 - Enable alias lookup for Send XEC component
[Cashtab] [Alias] pt 9 - Enable alias lookup for Send Token component
[Cashtab] [Alias] pt 10 - Upgrade tx history to recognize alias registration txs
[Cashtab] [Alias] pt 11 - Set final registration fees and remove residual dev logs

Test Plan
  • npm test
  • npm start
  • navigate to the Alias page
  • if cached totalPaymentTxCount is out of sync with the onchain count, ensure app still triggers the refresh process and the logs show a list of validated aliases and their addresses matching what is onchain
  • attempt to register an existing alias and observe the duplicate alias error is still displayed and registration is not broadcasted
  • revisit the Alias page and observe the totalPaymentTxCount is in sync via the logs and no refresh process is triggered
  • register a new alias, revisit the Alias page, and observe totalPaymentTxCount is out of sync and the refresh process is triggered again
  • revisit the Alias page yet again, observe your new alias is displayed in the logs and totalPaymentTxCount is back in sync
  • switch to a new address and observe totalPaymentTxCount is still in sync since this cache is available app-wide

Diff Detail

Repository
rABC Bitcoin ABC
Branch
aliases
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 21877
Build 43389: Build Diffcashtab-tests
Build 43388: arc lint + arc unit

Event Timeline

emack requested review of this revision.Jan 26 2023, 12:57

image.png (379×521 px, 94 KB)

Looks like we are still reporting some duplicate aliases as valid. Should have no duplicates -- nbd if this is being handled later in the stack.

web/cashtab/src/utils/chronik.js
188 ↗(On Diff #37740)

not really an assumption as this is what is in the spec

This revision now requires changes to proceed.Jan 26 2023, 17:24
emack marked an inline comment as done.

updated comments

Looks like we are still reporting some duplicate aliases as valid. Should have no duplicates -- nbd if this is being handled later in the stack.

yup this is planned for pt 7 - Mitigate edge cases for registration records. Once the caching is in I want to do an end to end sweep for all edge cases.

This revision is now accepted and ready to land.Jan 27 2023, 16:36