Skip to content

Display correct ETH amount in User Wallet#2016

Merged
rdig merged 1 commit intomasterfrom
fix/2011-user-eth-card-doesnt-display-correct-value
Feb 3, 2020
Merged

Display correct ETH amount in User Wallet#2016
rdig merged 1 commit intomasterfrom
fix/2011-user-eth-card-doesnt-display-correct-value

Conversation

@rdig
Copy link
Member

@rdig rdig commented Jan 31, 2020

Description

This PR adds in a simple fix in order to display to correct ETH amount in the user wallet's cards list.

What is happening in the background is that for ETH, we're using the provider to make a getBalance call to the network and fetch that address's current balance.

For other tokens, we just use the our contracts' internal book-keeping to get the balance.

Now, that get balance call is async, as it should be, but we we're waiting for it resolve, and just returned the unresolved promise, as a string:

Screenshot from 2020-01-31 14-20-16

Our <Numeral /> component either did some clever converting, or fell back to a default value to produce that 0.00385.... value you see in the before screenshot.

The fix for this, was just to wait for that promise to finish, which returns a BigNumber, and that, converted to a string, gets us the actual value in wei:

Screenshot from 2020-01-31 14-20-48

Changes

  • token gql resolver, wait for getBalance call to resolve

Screenshots

Before:
Screenshot from 2020-01-31 14-16-39

After:
Screenshot from 2020-01-31 14-23-04

Resolves #2011

@rdig rdig requested review from ceolson01 and chmanie January 31, 2020 12:30
@rdig rdig self-assigned this Jan 31, 2020
Copy link
Contributor

@ceolson01 ceolson01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha! Good find, good fix 💪

Copy link
Member

@chmanie chmanie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Urgh, what a major oversight. Thanks for fixing this!

@rdig rdig force-pushed the fix/2011-user-eth-card-doesnt-display-correct-value branch from c7e5de2 to 7493481 Compare February 3, 2020 09:08
@rdig rdig merged commit 31e4878 into master Feb 3, 2020
@rdig rdig deleted the fix/2011-user-eth-card-doesnt-display-correct-value branch February 3, 2020 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User's wallet ETH Card doesn't display the actual value

3 participants