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