Page MenuHomePhabricator

[Cashtab] Use wallet.state for balance on Send screen
ClosedPublic

Authored by josephroyking on Wed, Apr 28, 12:43.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCc32043f396be: [Cashtab] Use wallet.state for balance on Send screen
Summary

Similar to what was implemented on Wallet.js in D9443, the Send.js screen also must now use the wallet state value from local storage in order to immediately render correct balance before API call.

This diff also adds unit testing for Send.js page in order to implement the same tests for this added to Wallet.js in D9443. Unit testing had previously not been added to Send.js because it is complicated by the necessary mocking of BCHJS for unit tests. This problem was solved by adding the prop jestBCH to the Send component, which is only used in the unit tests. The loading context was also added to context mocks.

This diff is a patch. Currently, if a user quickly switches wallets, then checks the Send page, they will see the balance of the old wallet until the API call is returned.

Test Plan

npm start, switch wallet, check balance on Send page has updated to balance of new wallet

Diff Detail

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