diff --git a/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/warnings/CryptoCurrencyCheck.kt b/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/warnings/CryptoCurrencyCheck.kt index 04018ed4aa..780c6c48fe 100644 --- a/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/warnings/CryptoCurrencyCheck.kt +++ b/domain/tokens/models/src/main/java/com/tangem/domain/tokens/model/warnings/CryptoCurrencyCheck.kt @@ -8,4 +8,5 @@ data class CryptoCurrencyCheck( val reserveAmount: BigDecimal?, val existentialDeposit: BigDecimal?, val utxoAmountLimit: UtxoAmountLimit?, + val isAccountFunded: Boolean, ) \ No newline at end of file diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCurrencyCheckUseCase.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCurrencyCheckUseCase.kt index 4e74a21591..f335e654bf 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCurrencyCheckUseCase.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/GetCurrencyCheckUseCase.kt @@ -15,11 +15,19 @@ class GetCurrencyCheckUseCase( currencyStatus: CryptoCurrencyStatus, amount: BigDecimal?, fee: BigDecimal?, + recipientAddress: String? = null, ): CryptoCurrencyCheck { val network = currencyStatus.currency.network val dustValue = currencyChecksRepository.getDustValue(userWalletId, network) val reserveAmount = currencyChecksRepository.getReserveAmount(userWalletId, network) val existentialDeposit = currencyChecksRepository.getExistentialDeposit(userWalletId, network) + val isAccountFunded = recipientAddress?.let { + currencyChecksRepository.checkIfAccountFunded( + userWalletId, + network, + recipientAddress, + ) + } ?: false val utxoAmountLimit = if (amount != null && fee != null) { currencyChecksRepository.checkUtxoAmountLimit( userWalletId = userWalletId, @@ -36,6 +44,7 @@ class GetCurrencyCheckUseCase( reserveAmount = reserveAmount, existentialDeposit = existentialDeposit, utxoAmountLimit = utxoAmountLimit, + isAccountFunded = isAccountFunded, ) } } \ No newline at end of file diff --git a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/confirm/SendNotificationFactory.kt b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/confirm/SendNotificationFactory.kt index 23f483ef38..48ec5be5b1 100644 --- a/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/confirm/SendNotificationFactory.kt +++ b/features/send/impl/src/main/java/com/tangem/features/send/impl/presentation/state/confirm/SendNotificationFactory.kt @@ -45,7 +45,7 @@ import kotlinx.coroutines.flow.map import java.math.BigDecimal @Suppress("LongParameterList", "LargeClass") -internal class SendNotificationFactory constructor( +internal class SendNotificationFactory( private val analyticsEventHandler: AnalyticsEventHandler, private val validateTransactionUseCase: ValidateTransactionUseCase, private val getCurrencyCheckUseCase: GetCurrencyCheckUseCase, @@ -90,11 +90,14 @@ internal class SendNotificationFactory constructor( reduceAmountBy = reduceAmountBy, ) val feeError = (feeState.feeSelectorState as? FeeSelectorState.Error)?.error + + val recipientAddress = state.recipientState?.addressTextField?.value val currencyCheck = getCurrencyCheckUseCase( userWalletId = userWalletId, currencyStatus = cryptoCurrencyStatus, amount = sendingAmount, fee = feeValue, + recipientAddress = recipientAddress, ) buildList { addErrorNotifications( @@ -187,7 +190,7 @@ internal class SendNotificationFactory constructor( reserveAmount = currencyCheck.reserveAmount, sendingAmount = sendingAmount, cryptoCurrency = currency, - isAccountFunded = false, + isAccountFunded = currencyCheck.isAccountFunded, ) }