T2551
Depends on D13065
This diff implements the alias caching component to minimize API calls for alias tx history retrieval.
Overview
- upon load of Alias.js, it checks whether cached Alias objects exist. If it doesn't, then execute a full alias tx history retrieval.
- If cached Alias objects do exist, verify whether a refresh is required by comparing the cached and onchain tx counts.
- If a partial tx history refresh is required, retrieve the additional txs entries and concat them to the cached txs entries.
- There are now two alias caching objects, one being aliasTxHistory which stores an array of txs objects, and the other being aliases which is the list of aliases and their addresses.
- the updateAliases() function in useWallets updates the aliases cache object, while the updateCachedAliasTxHistory() function in useWallets updates the aliasTxHistory cache object
- getAllTxHistory() in chronik.js has been overloaded with an optional customStartPage which is used to indicate whether it should retrieve all tx history or a partial one starting from that page supplied.
[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 - Render list of Aliases owned by active wallet in Alias.js
[Cashtab] [Alias] pt 6.7 - Deprecate caching related mocks, @TODOs and reviewer logs
[Cashtab] [Alias] pt 7 - Mitigate edge cases for registration records (same rego in same block, validate emoji char counts)
[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