HomePhabricator

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

Description

[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

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
Joey King <joseph.roy.king@gmail.com>Authored on Apr 28 2021, 12:39
bytesofmanPushed on Apr 29 2021, 11:36
Reviewer
Restricted Project
Differential Revision
D9451: [Cashtab] Use wallet.state for balance on Send screen
Parents
rABCe41dcedf767e: [Automated] Update timing.json
Branches
Unknown
Tags
Unknown