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

Make distinction between STX "wallet balance" and available balance based on pending transfers/fees/swaps #3389

Open
314159265359879 opened this issue Mar 8, 2023 · 2 comments
Labels
area:broadcasting area:send bug Functionality broken bug-p3 Non-critical functionality broken for many users, or there are clear workarounds

Comments

@314159265359879
Copy link
Contributor

This is confusing for users "Available balance is 0.03" but I can't send 0.028 STX...

This is what is really going on

  • There is a balance of 0.03 in the wallet
  • there is a pending transaction for 0.002 + 0.003 STX fee
    the "available balance = 0.025 STX" because it should be calculated as available in the wallet minus STX transfers out minus fees pending. And transactions with postconditions "transfer exactly x STX out" could also be subtraced from the balance to arrive at the most accurate available balance (for example a swap transaction STX --> xBTC on alexlab.co).

The current wallet version 4.6.0 will let me send 0.027 with a 0.003 STX fee which is just as impossible (available is 0.025). It does not yet take into account fees, it should.

image

image

The pending transaction here will remain pending until it is dropped.
image

Related to solutions for: #3338

@314159265359879 314159265359879 added bug Functionality broken bug-p3 Non-critical functionality broken for many users, or there are clear workarounds area:send labels Mar 8, 2023
@314159265359879
Copy link
Contributor Author

I believe this is going to help resolve this issue: #3178

@github-project-automation github-project-automation bot moved this to Enhancements backlog in Hiro Wallet (DEPRECATED) Mar 9, 2023
@markmhendrickson markmhendrickson moved this from Enhancements backlog to Bugs backlog in Hiro Wallet (DEPRECATED) Mar 9, 2023
@markmhendrickson
Copy link
Collaborator

This may be very tricky to handle purely on the client-side. We may need new API functionality that helps calculate the effective available balance we should use in the wallet.

We could push this idea more and be even more conservative in cases in which a contract execution is pending in the mempool with a post condition for transferring an asset "up to" a particular amount (not just "exactly" an amount). The API could possibly provide this second, more conservative "worst case available" amount that the wallet could use to display a warning, but not block (e.g. "You have transactions pending that could result in spending more assets than you have available to make this one. Are you sure you want to proceed?").

@314159265359879 Mind creating a relevant issue in the API repo to help push this along?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:broadcasting area:send bug Functionality broken bug-p3 Non-critical functionality broken for many users, or there are clear workarounds
Projects
None yet
Development

No branches or pull requests

2 participants