-
Notifications
You must be signed in to change notification settings - Fork 5k
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 #9872 - Show price difference warning on swaps price quote #9899
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
ff1429e
to
e6f5f18
Compare
I think that if there is a balance warning being shown, we should not show the price difference warning. Because the price difference warning will not matter if the user can't actually submit the swap. |
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.
Code looks good overall. Two requested changes. Also, I am going to check with Jake about the copy.
6c67e78
to
5671855
Compare
Need to incorporate the copy changes discussed here https://consensys.slack.com/archives/C01CZRZ9H0T/p1605800606242600 |
5671855
to
3e0ab86
Compare
Per @jakehaugen, we need to update the following:
|
@jakehaugen @danjm I believe I've found a blocker to this: we are not given a value for the destination token in the quotes we get returned from the API (as far as I can tell). For example, if I want to swap 5 $ETH for {x} $LINK, we do get told how many $LINK we'd get in return, but we don't get the value of 1 $LINK, nor do we get a total dollar value. We do know the |
@darkwing The necessary API updates is now on prod. You can see it in the response to a trades request. For example: https://api.metaswap.codefi.network/trades?destinationToken=0x6b175474e89094c44da98b954eedeac495271d0f&sourceToken=0x0000000000000000000000000000000000000000&sourceAmount=1000000000000000000&slippage=2&timeout=10000&walletAddress=0x91224fd5662db33409e0278bc427ff18535ebb22 |
dcd8eea
to
c9d3065
Compare
@darkwing bumping up a previous comment I made:
although, looking at the code, I am not sure why the price difference warning is showing at the same time as the insufficient eth warning... |
If you're referring to the screenshots I posted, I set |
This is how it will look when no insufficient warning is present on full screen: Edit: to recreate, you can disable the display of the insufficient warning but leave its containing div where it is, and also disable the logic that hides the price difference warning when there is insufficient balance This is because of the space that the insufficient eth warning container takes up. It would be best for the price difference warning to be centered. |
let priceDifferenceMessage = '' | ||
if (priceSlippage.calculationError) { | ||
// An error was returned by the API; show it to the user | ||
priceDifferenceMessage = priceSlippage.calculationError |
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.
This could be a bad assumption, but if there is a calculation error, we show it to the user directly. Thoughts?
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.
I think in this case we should just show the "unknown impact" message.
8c28cf9
to
8b606b8
Compare
8b606b8
to
7bf44da
Compare
…nsufficient message block when message not shown
97ddfa0
to
e56281d
Compare
One other change that is needed here: the places where we set a |
f4532ef
to
0918248
Compare
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.
LGTM
Fixes: #9872
Explanation: Implements the price difference warning for swaps quotes (https://www.figma.com/file/fDtda1cs3MmPXw1MgKswZc?embed_host=notion&kind=&node-id=1533%3A1064&viewer=1)