-
Notifications
You must be signed in to change notification settings - Fork 102
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
322/store quote info on redux #555
Conversation
CLA Assistant Lite All Contributors have signed the CLA. |
|
Hey @alfetopito , I can't see 'oppositeAmount' for 'refreshQuote' request, but I can see it for 'rupdateQuote' in Mainnet and GC. Also, I see duplicating requests, and one of them does not contain opposite amount. Is it OK? |
You are looking at the |
@alfetopito , thanks for explanation! |
don't really understand why we need the oppositeAmount. also the issue linked is the wrong one i believe, code looks ok tho! |
We will need to add to the metadata of every order both sell and buy amounts returned in the quote response. Right now, only one of those (buy or sell, depending on the order type) is stored. As said, aware this is not the best name, happy to hear suggestions :)
You are right, wrong issue id 🤦 . Correct one -> #332 |
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.
@@ -99,5 +99,5 @@ export function toPriceInformation(priceRaw: CoinGeckoUsdQuote | null): PriceInf | |||
} | |||
|
|||
const { usd } = priceRaw[token] | |||
return { amount: usd.toString(), token } | |||
return { amount: usd.toString(), token, oppositeAmount: '1' } |
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 find oppositeAmount missliading.
If we can really not add from/to, would it be better amountInputted
or something?
What I mentioned yesterday is. Why do we need to change the quote object here? Maybe we can avoid modifying it. We already have the state of the original inputed amount from the user in our state. We just need to include that in the quote object of the meta-data of the order when we submit the order. This metadata could have normal names as suggested in the document (no backward compatibility issues, because is a new metadata) |
As Anxo points out, the information needed (sell and buy amounts) are already in the context. Namely Thus this change is unnecessary. When there's a |
Summary
Part of #332
Making both sell and buy amounts returned with the quote available in redux context
These amounts will later be stored in the order metadata to calculate real surplus (difference between quote prices and executed prices)
To Test
price
price/refreshQuote
actionprice -> quotes -> 1 -> <token address> -> price
oppositeAmount
populated