[Cashtab][Alias] Pending Aliases
Summary:
Updates Cashtab to handle pending aliases via the /address/ endpoint.
Design considerations:
- When the user broadcasts a new alias via Alias.js there is network propagation time to consider before the pending alias is picked up by alias-server and exposured via the /address/ endpoint.
- To mitigate this, the newly successfully broadcasted alias is locally appended to the existing pending dropdown list in Cashtab.
- This ensures the user will not notice any delay in the UI between the point of registration broadcast and the next alias refresh interval, which is up to 30 seconds, which will then re-sync Cashtab with the updated pending list from alias-server.
- If the pending alias was not successfully confirmed for this wallet, the alias refresh interval will reflect this between the Registered Aliases and Pending Aliases dropdowns.
- There is a potential edge case where the user broadcasts a registration right before a scheduled interval alias refresh, and if the pending alias was not propagated to alias-server for that particular alias refresh event, then that local pending alias would disappear from the pending dropdown. However this is only temporary because the subsequent alias refresh interval (within 30 seconds) will bring it back in sync using the updated alias-server data as the source of truth. Hence I believe this rare occurance is negligible.
- Upon alias-server outage, I purposely did not set a pop up alert for this otherwise an extended downtime with alias-server will result in a constant pop up every 30 seconds courtesy of the refresh interval regardless of which page the user is on.
Test Plan:
- Register a new alias and observe it is displayed in the Pending Aliases dropdown
- Register another alias and observe it is added to the previous pending alias
- Wait for the registration tx to receive one confirmation, verify the alias has now moved from the Pending Aliases to the Registered Aliases dropdown
- Register another alias, close Cashtab. When the tx receives one confirmation (monitor via explorer), open Cashtab and ensure this pending alias has moved into the Registered Aliases dropdown.
- Use an invalid endpoint for the refreshAliases function in useWallet and ensure it disables the Register Alias button and both dropdowns are showing Error: Unable to retrieve aliases.
- Use an invalid endpoint for the alias registration process in Alias.js and ensure the registration process is disabled in the UI
- Attempt to register an alias that already has a pending tx for this wallet and observe a non-blocking warning underneath the input field. Click Register Alias and ensure it is broadcasted. Once confirmed, both instances are removed from Pending list and a single successful alias is added to Registered Aliases.
Reviewers: #bitcoin_abc, Fabien, bytesofman
Reviewed By: #bitcoin_abc, Fabien, bytesofman
Subscribers: Fabien, bytesofman
Differential Revision: https://reviews.bitcoinabc.org/D14611