-
Notifications
You must be signed in to change notification settings - Fork 2
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 account balance before publishing tx #87
Conversation
You can preview the changes at : https://ca2765ac.smapp-lite-prod.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.
Please double check:
fill the details of the tx (exceeding the balance) and hit next,
it shows properly that the tx cannot be processed, all good here
hit back
use delete/backspace to remove input in the gas price field
it throws:
I checked the prod and it's all good there, so it apparently is smth with this PR
if (BigInt(acc.projected.balance) < fee) { | ||
return 'You have insufficient funds to pay for gas'; | ||
} |
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.
Was your intention to display the "insufficient funds for gas" in case the balance is enough to cover the tx amount but the gas fee exceeds the available balance?
Cause now these lines work only in case the gas is the only thing to pay (spawn), but in the regular tx only the "insufficient funds to send this amount" is displayed.
If it's intended to be like that then it's ok, IMHO no need to overcomplicate these alerts, it's just that the PR description left me a bit hesitating about the intent
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.
Got the same after some playing with numbers. Initially it worked.
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.
Was your intention to display the "insufficient funds for gas" in case the balance is enough to cover the tx amount but the gas fee exceeds the available balance?
Well, it will be shown for any transaction, when the balance is not enough to pay for a gas. Including the spend tx.
For example, try to send 0 SMH
with 10000 Smidge / unit
of gas price from the same test account (with 0.001 SMH), and you'll get this error message.
However, for spend tx there is additional condition, that checks that balance is equal or greater than amount + gas
. And if it is not — then it will show "insufficient funds to send this amount". Basically it means that you have enough to pay for gas, but you should send less :)
8d9e076
to
6900f8f
Compare
@monikasmolarek the bug is fixed. Thanks! |
You can preview the changes at : https://c3b444e5.smapp-lite-prod.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.
👌
Cannot get the same error. Minor things
And Wallet shows the first one when amount is enough, but gas fee is bigger than the rest of the balance. And message "insufficient funds to pay for gas" appears only in the case when Gas fee is bigger than balance. Gas price also allows (and keeps) values like 00100 |
Before allowing to publish transaction it checks for the projected account balance.
It checks the sufficient balance for:
It also shows a bit different red text on the confirmation page in case if some of the conditions does not pass: