From f4b8fdafa4d82b5489d0297dfcb9d7cd4bc9d236 Mon Sep 17 00:00:00 2001 From: Esenbek Date: Tue, 18 Jul 2023 15:22:34 +0600 Subject: [PATCH] CEX Withdraw: Allow all available balance when feeFromAmount is true --- .../Modules/CexWithdraw/CexWithdrawService.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/CexWithdraw/CexWithdrawService.swift b/UnstoppableWallet/UnstoppableWallet/Modules/CexWithdraw/CexWithdrawService.swift index 2c08ba823a..9bf210deec 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/CexWithdraw/CexWithdrawService.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/CexWithdraw/CexWithdrawService.swift @@ -59,8 +59,12 @@ class CexWithdrawService { } private func syncAvailableBalance() { - let fee = calculateFee(amount: cexAsset.freeBalance, feeFromAmount: feeFromAmount) - _availableBalance = fee < cexAsset.freeBalance ? cexAsset.freeBalance - fee : 0 + if feeFromAmount { + _availableBalance = cexAsset.freeBalance + } else { + let fee = calculateFee(amount: cexAsset.freeBalance, feeFromAmount: feeFromAmount) + _availableBalance = fee < cexAsset.freeBalance ? cexAsset.freeBalance - fee : 0 + } } private func validateAmount() throws {