Skip to content
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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

vvava
Copy link
Contributor

@vvava vvava commented Oct 28, 2024

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 the to field -> swap should work as before

Screenshots:

Screen.Recording.2024-10-28.at.20.06.02.mov

Checklist for the author

Tick each of them when done or if not applicable.

  • I've covered new/modified business logic with Jest test cases.
  • I've tested the changes myself before sending it to code review and QA.

Comment on lines 118 to 120
token: AVAX_TOKEN,
fromToken: AVAX_TOKEN,
toToken: USDC_TOKEN,
Copy link
Member

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!? 😂

@@ -104,6 +105,30 @@ export function Swap() {
destAmount,
} = useSwapStateFunctions();

useEffect(() => {
if (!selectedFromToken && !selectedToToken) {
Copy link
Member

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

Copy link
Member

@meeh0w meeh0w left a 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

@vvava
Copy link
Contributor Author

vvava commented Oct 31, 2024

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

Copy link
Member

@meeh0w meeh0w left a 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 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants