UPDATE: bnb fee calculation logic
-
Prevent a user from swapping all BNB. Leave enough for at least 1 tx.
-
Don't try to submit the transaction if the user doesn't have enough BNB to cover gas.
-
Handle any error and tell the user exactly what they don't have enough of.
-
Ideally don't get into a situation where binance will error. We should be adjusting the balance BEFORE sending the transaction so this error will never happen unless the user happens to be sending assets out from another app eg. trust wallet.
-
when users are trying to select 100% of their balance, just show them
MAX balance - 1
SOLUTION:
Build global useFee
hooks so it can be used anywhere in the app.
Edited by thorchy