HomePhabricator

[Cashtab] load wallet from storage before calling API

Description

[Cashtab] load wallet from storage before calling API

Summary:
Reconfigure wallet loading and activation functions to pull directly from local storage (if present) before any API call

Includes unit test to make sure wallet page still loads correctly for users who have not yet opened Cashtab in recent enough version to save wallet.state to local storage. The wallet.state object retains some artefacts to support this edge case legacy user.

Note: some other features I considered adding in this diff but should have their own diff: disable notifications for incoming txs when user switches wallet, make user wallet selection a dropdown from the Wallet page

Test Plan:
npm test to confirm new unit tests

npm start and observe wallet loads faster and does not flash incorrect balance before loading
Navigate to settings page and activate a different wallet. Observe activation is almost instant.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
Joey King <joseph.roy.king@gmail.com>Authored on Apr 20 2021, 19:30
bytesofmanPushed on Apr 27 2021, 15:39
Reviewer
Restricted Project
Differential Revision
D9443: [Cashtab] load wallet from storage before calling API
Parents
rABCd7f5657808e3: [refactor] extract function for past activation tests
Branches
Unknown
Tags
Unknown