Updated on 2026-08-14
This commit is contained in:
commit
40b163c06d
3 changed files with 15 additions and 2 deletions
|
|
@ -8,4 +8,5 @@ data class CryptoCurrencyCheck(
|
|||
val reserveAmount: BigDecimal?,
|
||||
val existentialDeposit: BigDecimal?,
|
||||
val utxoAmountLimit: UtxoAmountLimit?,
|
||||
val isAccountFunded: Boolean,
|
||||
)
|
||||
|
|
@ -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,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue