-
Notifications
You must be signed in to change notification settings - Fork 910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix wrongly computed insufficient funds errors #13347
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -216,24 +222,48 @@ export default function useSwap ({ fromAsset: fromAssetProp, toAsset: toAssetPro | |||
|
|||
const isSwapButtonDisabled = React.useMemo(() => { | |||
return ( | |||
// Prevent creating a swap transaction with stale parameters if fetching |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work on these comments
josheleonard
approved these changes
May 16, 2022
When an amount is undefined, we should not conclusively return a result in .gt and .lt methods in Amount class. This prevents intermittent error messages in the UI while balances are fetched.
51f47c6
to
d8bd5ec
Compare
A Storybook has been deployed to preview UI for the latest push |
Douglashdaniel
approved these changes
May 17, 2022
7 tasks
Verification passed on
13347.mov |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes multiple issues with insufficient funds checks in the transaction confirmation panel.
ETHSwap
transactions had wrong computation of fiat amounts. 92587af51ab70dd46974f2c19428bd9f38c772e0Resolves brave/brave-browser#22877.
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Demo:
Before
Wrong fiat amounts
Disappearing "Insufficient funds error" text
cc: @srirambv I believe you had logged this at some point, but I can't find the issue.
Screen.Recording.2022-05-16.at.21.14.25.mov
After
No disappearing error text, and correct computation of fiat amount
Screen.Recording.2022-05-16.at.21.08.22.mov
Confirm button is disabled on page load while balances are being fetched
Screen.Recording.2022-05-16.at.22.13.59.mov
Note: This is not entirely new behaviour, but ensures that Confirm button is not disabled due to
insufficientFundsError
being false for redux state not being ready.