-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: add default tokens to swap #84
base: main
Are you sure you want to change the base?
Conversation
src/pages/Swap/Swap.tsx
Outdated
token: AVAX_TOKEN, | ||
fromToken: AVAX_TOKEN, | ||
toToken: USDC_TOKEN, |
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 related to this PR, but the fact we need to provide token
, fromToken
and toToken
here breaks my brain. 🤯 Why three values!? 😂
src/pages/Swap/Swap.tsx
Outdated
@@ -104,6 +105,30 @@ export function Swap() { | |||
destAmount, | |||
} = useSwapStateFunctions(); | |||
|
|||
useEffect(() => { | |||
if (!selectedFromToken && !selectedToToken) { |
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 check alone does not quite work, tokens are not restored when I close and re-open extension.
Prod build:
Screen.Recording.2024-10-29.at.09.05.07.mov
This branch:
Screen.Recording.2024-10-29.at.09.04.21.mov
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.
There is still something wrong with remembering the values. It sometimes works and sometimes doesn't. There's probably a race condition somewhere.
Screen.Recording.2024-10-31.at.11.53.19.mov
Yeah, something is wrong there, I'm fixing it |
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.
Looks like it's working now 👏
Description
We want to add default tokens to the Swap page
Changes
Set the AVAX and USDC tokens as default transaction pairs.
Testing
Go to the swap page -> you should see the AVAX in the
from
and the USDC in theto
field -> swap should work as beforeScreenshots:
Screen.Recording.2024-10-28.at.20.06.02.mov
Checklist for the author
Tick each of them when done or if not applicable.