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

👛 Max fee calculation bug while swapping from ETH #22036

Open
4 tasks
shivekkhurana opened this issue Feb 7, 2025 · 2 comments · May be fixed by #22048
Open
4 tasks

👛 Max fee calculation bug while swapping from ETH #22036

shivekkhurana opened this issue Feb 7, 2025 · 2 comments · May be fixed by #22048
Assignees
Labels
wallet-core Issues for mobile wallet team
Milestone

Comments

@shivekkhurana
Copy link
Contributor

Problem

There is a bug in fee calculation when clicking on the Max button for ETH on swaps.

Actual behavior

The Max button fills the send field with all available ETH. This leaves no ETH to pay gas, leading to an error.

Expected behavior

The Max button fills the send field with "total eth - max gas fee" instead of all ETH. Max gas fee changes on a fixed interval, and the backend emits and event when the change happens.

For the sake of UX, let's not update the from field after it has been computed once

Reproduction

  1. Click on the Max button for ETH on swaps.
  2. Observe the error "not enough ETH for fees".

Acceptance criteria

  • On pressing Max button while swapping from ETH, the from field of the swap should be filled with available ETH - max gas fee
  • The second token can be defaulted to USDT
  • This change should not affect any other token
  • When a new quote is received for updated max gas fee, we don't change ETH in from field, and this might run into ''not enough gas error" - we accept this risk.

Additional Information

  • Status version: nightly
  • Operating System: Android, iOS
@shivekkhurana shivekkhurana added the wallet-core Issues for mobile wallet team label Feb 7, 2025
@shivekkhurana shivekkhurana added this to the 2.33.0 milestone Feb 7, 2025
@mohsen-ghafouri mohsen-ghafouri moved this from Next to In Progress in Status Desktop/Mobile Board Feb 7, 2025
@shivekkhurana
Copy link
Contributor Author

Had a call with Mohsen and we decide on a slighly updated flow:

1- If the user selects Eth for sending, we fetch the current send fee, and then the max button shows available-fee.
2- Until the fee is being fetched, there is no max button, only a skeleton.

If this is too hard, we'll hide the max button for Ethereum. In that case, this ticket will need a rewrite.

@mohsen-ghafouri
Copy link
Contributor

@shivekkhurana As I checked The fee comes with swap proposal details, and we will have this data once user enter some amount. so in initial state as we don't have fee before user enter any amount, then displaying max balance doesn't make sense for ETH.
for this ticket i'm going to hide Max button for Ethereum, until we have fee. please let me know if you have any other suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wallet-core Issues for mobile wallet team
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants