-
Notifications
You must be signed in to change notification settings - Fork 9
Check for balance before auto-selecting token options for purhcase #440
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
Check for balance before auto-selecting token options for purhcase #440
Conversation
Deploying web-sdk-react-example with
|
Latest commit: |
d65e8f6
|
Status: | ✅ Deploy successful! |
Preview URL: | https://d0f008f1.web-sdk-react-example.pages.dev |
Branch Preview URL: | https://fix-checkout-button-enabled.web-sdk-react-example.pages.dev |
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.
Two comments:
-
The console.logs should be cleaned up prior to merging.
-
I see from the title of the PR that there seems to be a problem with the state of the button. I'm assuming it's getting stuck in a particular state such as disabled?
That being said, the code being deleted shouldn't be deleted outright. It's meant to autoselect the first available option—either the main currency or a swap option—which was a QOL feature that was requested in the past. We should keep that functionality in.
I would say we need to go deeper on the bug we are trying to fix here. I lack details personally. Is it possible to have more details?
Just intuitively though… I know that recently the swap API has been changed and that, at least temporarily, it can return options for which the user doesn't have any funds. This wasn't the case before, and it's likely causing an unexpected side effect with this logic.
The deleted code in the PR seems to assume that the user always has enough funds when autoselecting the swap option (because it's not making any balance checks, unlike the main currency), but that's not true anymore. I can imagine the code auto-selecting a swap option for which the user does not have enough funds, which I believe would make the buy button stuck in a disabled state…
To recap, we shouldn't delete this code (though we could improve it—it looks so bad 😆), we should dig deeper into the bug which prompted this PR and keep in mind my hypothesis outlined above, since I think that might be the issue. Also, with hindsight, a line or two of comments for what the code is doing would have been helpful.
Thanks for the review @SamueleA. I'll look into this again, I think it was a quick fix for an issue we had which might not exist now because of some other fixes we did, I'll check and get back on this. |
No description provided.