Updated on 2026-08-14

This commit is contained in:
Tangem 2021-04-09 15:15:38 +03:00
parent bc8bb381b3
commit c63fe7289b

View file

@ -78,11 +78,17 @@ class AmountMiddleware {
}
private fun setMaxAmount(appState: AppState?, dispatch: (Action) -> Unit) {
val amountState = appState?.sendState?.amountState ?: return
val sendState = appState?.sendState ?: return
dispatch(AmountAction.SetAmount(sendState.amountState.balanceCrypto, false))
if (sendState.addressPayIdState.destinationWalletAddress == null || sendState.addressPayIdState.error != null) {
// if the destination address is empty or it has an error - prevent requesting the fee
return
}
dispatch(AmountAction.SetAmount(amountState.balanceCrypto, false))
dispatch(FeeAction.RequestFee)
if (!amountState.isCoinAmount()) return
if (!sendState.amountState.isCoinAmount()) return
dispatch(FeeAction.ChangeLayoutVisibility(main = true, controls = true, chipGroup = true))
dispatch(FeeActionUi.ChangeIncludeFee(true))