-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
feat(suite-native): send form normal fee level validation #14348
Conversation
precomposedFeeLevels, | ||
} = context; | ||
|
||
// transaction amount + normal fee has to be lower than account balance |
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.
How is this comment relevant to the following line? 🤔 It's not obvious at all.
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.
better comment added in 5189ad1
const DEFAULT_VALUES = [ | ||
{ | ||
amount: '', | ||
address: '', | ||
fiat: '', | ||
}, | ||
] as const satisfies SendOutputsFormValues['outputs']; |
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.
❤️
useEffect(() => { | ||
if (watchedFormValues && isValid) debounce(storeFormDraftIfValid); | ||
}, [isValid, storeFormDraftIfValid, watchedFormValues, debounce]); | ||
if (!account) return; |
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.
Would it make sense to move this at the very beginning of the callback block and change like this?
if (!account) return; | |
if (!account || !networkFeeInfo) return; |
5189ad1
to
0adad27
Compare
@yanascz In the end, the solution utilizes the calculation of send max with the normal fee level, as you suggested. So the normal fee send max amount is calculated right away when the user enters the send form screen and recalculated if the address is changed. Like this, we have a numeric value to compare with the amount, and we don't have to recalculate fees on every change. The solution of calculating send max was inspired by desktop implementation. Hit me up in Slack if you need to clarify anything. The original Commits were squashed and force-pushed because the new solution conflicted with the original one. Please do the full review again 🙏. |
0adad27
to
b96ce1d
Compare
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.
👏 It was hard for me to understand, but after a huddle consultation it makes sense to me now.
Description
(X + normal fee) > available balance
form shows error and user can not continue until he lowers the amountRelated Issue
Resolve #13782
Screenshots: