Updated on 2026-08-14
This commit is contained in:
parent
d28347ee21
commit
1b061d2d2b
6 changed files with 14 additions and 3 deletions
|
|
@ -155,9 +155,10 @@ internal class DefaultCurrencyChecksRepository(
|
|||
|
||||
override suspend fun getRentExemptionError(
|
||||
userWalletId: UserWalletId,
|
||||
currencyStatus: CryptoCurrencyStatus,
|
||||
currencyStatus: CryptoCurrencyStatus?,
|
||||
balanceAfterTransaction: BigDecimal,
|
||||
): CryptoCurrencyWarning.Rent? {
|
||||
if (currencyStatus == null) return null
|
||||
val rentData = walletManagersFacade.getRentInfo(userWalletId, currencyStatus.currency.network) ?: return null
|
||||
return when {
|
||||
balanceAfterTransaction.isZero() -> null
|
||||
|
|
|
|||
|
|
@ -14,9 +14,11 @@ class GetCurrencyCheckUseCase(
|
|||
private val dispatchers: CoroutineDispatcherProvider,
|
||||
) {
|
||||
|
||||
@Suppress("LongParameterList")
|
||||
suspend operator fun invoke(
|
||||
userWalletId: UserWalletId,
|
||||
currencyStatus: CryptoCurrencyStatus,
|
||||
feeCurrencyStatus: CryptoCurrencyStatus?,
|
||||
amount: BigDecimal?,
|
||||
fee: BigDecimal?,
|
||||
feeCurrencyBalanceAfterTransaction: BigDecimal?,
|
||||
|
|
@ -31,7 +33,7 @@ class GetCurrencyCheckUseCase(
|
|||
val existentialDeposit = currencyChecksRepository.getExistentialDeposit(userWalletId, network)
|
||||
val rentWarning = currencyChecksRepository.getRentExemptionError(
|
||||
userWalletId = userWalletId,
|
||||
currencyStatus = currencyStatus,
|
||||
currencyStatus = feeCurrencyStatus,
|
||||
balanceAfterTransaction = feeCurrencyBalanceAfterTransaction ?: BigDecimal.ZERO,
|
||||
)
|
||||
val isAccountFunded = recipientAddress?.let {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ interface CurrencyChecksRepository {
|
|||
*/
|
||||
suspend fun getRentExemptionError(
|
||||
userWalletId: UserWalletId,
|
||||
currencyStatus: CryptoCurrencyStatus,
|
||||
currencyStatus: CryptoCurrencyStatus?,
|
||||
balanceAfterTransaction: BigDecimal,
|
||||
): CryptoCurrencyWarning.Rent?
|
||||
}
|
||||
|
|
@ -136,6 +136,7 @@ internal class NotificationsModel @Inject constructor(
|
|||
val currencyCheck = getCurrencyCheckUseCase(
|
||||
userWalletId = userWalletId,
|
||||
currencyStatus = cryptoCurrencyStatus,
|
||||
feeCurrencyStatus = feeCryptoCurrencyStatus,
|
||||
amount = sendingAmount,
|
||||
fee = feeValue,
|
||||
recipientAddress = destinationAddress,
|
||||
|
|
|
|||
|
|
@ -772,6 +772,7 @@ internal class StakingModel @Inject constructor(
|
|||
val currencyStatus = getCurrencyCheckUseCase(
|
||||
userWalletId = userWalletId,
|
||||
currencyStatus = cryptoCurrencyStatus,
|
||||
feeCurrencyStatus = feeCryptoCurrencyStatus,
|
||||
amount = amount,
|
||||
fee = fee,
|
||||
feeCurrencyBalanceAfterTransaction = balanceAfterTransaction,
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ internal class SwapInteractorImpl @AssistedInject constructor(
|
|||
private val amountFormatter: AmountFormatter,
|
||||
private val rampStateManager: RampStateManager,
|
||||
private val singleAccountStatusListSupplier: SingleAccountStatusListSupplier,
|
||||
private val getFeePaidCryptoCurrencyStatusSyncUseCase: GetFeePaidCryptoCurrencyStatusSyncUseCase,
|
||||
private val accountsFeatureToggles: AccountsFeatureToggles,
|
||||
@Assisted private val userWalletId: UserWalletId,
|
||||
) : SwapInteractor {
|
||||
|
|
@ -631,9 +632,14 @@ internal class SwapInteractorImpl @AssistedInject constructor(
|
|||
} else {
|
||||
amount
|
||||
}
|
||||
val feePaidCurrencyStatus = getFeePaidCryptoCurrencyStatusSyncUseCase(
|
||||
userWalletId = userWalletId,
|
||||
cryptoCurrencyStatus = fromTokenStatus,
|
||||
).getOrNull()
|
||||
val currencyCheck = getCurrencyCheckUseCase(
|
||||
userWalletId = userWalletId,
|
||||
currencyStatus = fromTokenStatus,
|
||||
feeCurrencyStatus = feePaidCurrencyStatus,
|
||||
amount = amountToRequest.value,
|
||||
fee = fee,
|
||||
feeCurrencyBalanceAfterTransaction = balanceAfterTransaction,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue