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

chore: allow enough balance check to return unknown state #3106

Merged
merged 8 commits into from
Sep 7, 2023

Conversation

anxolin
Copy link
Contributor

@anxolin anxolin commented Sep 5, 2023

Summary

Handle the UNKNOWN state for the check that verifies if the user has enough balance (used for quotes)

The app will need to know the balance of the user to decide if its using verified quotes or not.
The balance/allowance is fetched in an async call. Meaning that we can be in a state where we don't know if we have the balance or not.

The app was defaulting to "Yes, it has balance" if we were not sure.

See image below:

image

image

Now we handle the undefined case, so we don't use verified quotes:
image

Bonus

I saw we were, in some cases making a request with the same sell token and buy token.

Its only temporal, probably due two the app being on a loading state. We will need to improve this part.

I added a small improvement, so we just don't query the API in this case 4d4b932

To Test

  • Create 2 limit orders using all your balance (price should be so that at least one executes fully). They should use all your balance for a token
  • Once 1 executes, the other will have no balance
  • In this case, we should see we quote only optimal quotes (check network tab)

@vercel
Copy link

vercel bot commented Sep 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
swap-dev ✅ Ready (Inspect) Visit Preview Sep 7, 2023 10:29am

🌃 Cosmos ↗︎

@anxolin anxolin changed the base branch from develop to release/1.47.0 September 5, 2023 11:24
@anxolin anxolin merged commit cadc7ad into release/1.47.0 Sep 7, 2023
7 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2023
@alfetopito alfetopito deleted the fix-verified-quote-issue branch September 8, 2023 09:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants