-
Notifications
You must be signed in to change notification settings - Fork 191
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
chore: clean up of trade related slices and selectors #6035
Conversation
Current dependencies on/for this PR: This stack of pull requests is managed by Graphite. |
'getIsTradingActiveApi: error getting trading status', | ||
) | ||
|
||
export const GET_TRADE_QUOTE_POLLING_INTERVAL = 20_000 |
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.
Very nitpicky but move somewhere at the very top or to a constant file
|
||
// hydrate crypto market data for buy and sell assets | ||
await dispatch( | ||
marketApi.endpoints.findByAssetIds.initiate([sellAsset.assetId, buyAsset.assetId]), |
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.
Very nitpicky and not introduced by this PR but could pass an object instead so we don't ever get in a situation where we pass these in the wrong order
// this should never be needed but here for paranoia | ||
if (!sellAssetUsdRate) throw Error('missing sellAssetUsdRate') |
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.
💜
unorderedQuotes.filter(({ errors }) => errors.length > 0), | ||
happyQuotes.length, | ||
) | ||
const orderedQuotes: ApiQuote[] = [...happyQuotes, ...errorQuotes] |
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.
Not introduced by this PR but concat if we feel like it, doesn't really matter but OCD
selectQuoteSellAmountCryptoPrecision, | ||
selectInputSellAssetUsdRate, | ||
(sellAmountCryptoPrecision, sellAssetUsdRate) => { |
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.
Can reflect the vernacular input/quote in the callback if we want to, to signify the intent that this is intended and not a mistake?
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.
Very first pass - didn't notice anything that seems obviously wrong here. To be followed-up with extensive runtime testing
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.
Note, this has been tested locally against develop (which had the dangerous sell amount warning fix at the time of testing), not prod. Haven't noticed any regression here, so assuming this gets a second stamp and ops are happy with this as well, get in.
Quotes flows
Account address balances and sorting
The right assets are displayed and are properly sorted
- This diff
- Develop
Account selection is happy and the right balances are reflected
- This diff
- Develop
Quotes getting
Not enough asset for gas
- This diff
- Develop
Dangerous amounts
- This diff
- Develop
Safe amounts
- This diff
- Develop
Manual receive address required
- This diff
- Develop
Manual address entered
- This diff
- Develop
Max token swaps
- This diff
- Develop
FOX - ETH (0x)
- This diff
- Develop
WETH - AVAX (1inch)
- This diff
- Develop
ETH - DOGE (custom receive address)
- This diff
- Develop
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.
Tested against develop and noticed no regressions in quote data.
I did see some differences in the way we are handling error messages (we are surfacing them more), but I believe this is expected.
Description
All 'round cleanup of slices and selectors related to trading:
swapperApi
andswappersApi
intoswapperApi
swappersSlice
totradeInputSlice
as it manages all state related to trade input parameters*Input*
vernacular*Quote*
vernaculartradeInputSlice
Pull Request Type
Issue (if applicable)
closes #5742
Risk
High risk. Refactors selectors on one of our most impactful parts of our platform.
Testing
Compare to production, as there should be zero functoinal change introduce with this PR:
Engineering
Operations
Screenshots (if applicable)