Page MenuHomePhabricator

[Cashtab] load wallet from storage before calling API
ClosedPublic

Authored by josephroyking on Fri, Apr 23, 15:29.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCb612be7f9aec: [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.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Removing comments used in development, marking mock as generated

Removing obsolete dev comment

Handle case of cashtab user loading with unmigrated wallets, ensure that wallet object state is kept current

Allow useEffect call to update savedWallets list in Configure.js; do not call it twice with the previous wallet

This revision is now accepted and ready to land.Tue, Apr 27, 15:30