Updated on 2026-08-14

This commit is contained in:
Tangem 2026-06-04 11:57:51 +04:00
parent 642190f7c6
commit 3a5144403b
19 changed files with 1033 additions and 49 deletions

View file

@ -4,6 +4,7 @@ import arrow.core.Option
import arrow.core.none
import arrow.core.some
import com.tangem.domain.models.account.Account
import com.tangem.domain.models.account.AccountStatus
import com.tangem.domain.models.account.PaymentAccountStatusValue
import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.models.currency.CryptoCurrencyStatus
@ -21,11 +22,7 @@ class GetPaymentAccountCryptoCurrencyStatusUseCase(
userWalletId: UserWalletId,
cryptoCurrency: CryptoCurrency,
): Flow<Pair<Account.Payment, CryptoCurrencyStatus>> {
return paymentAccountStatusSupplier(userWalletId).mapNotNull { accountStatus ->
val cryptoCurrencyStatus = when (val statusValue = accountStatus.value) {
is PaymentAccountStatusValue.Loaded -> statusValue.cryptoCurrencyStatus
else -> return@mapNotNull null
}
return invoke(userWalletId).mapNotNull { (accountStatus, cryptoCurrencyStatus) ->
if (cryptoCurrencyStatus.currency == cryptoCurrency) {
accountStatus.account to cryptoCurrencyStatus
} else {
@ -34,6 +31,16 @@ class GetPaymentAccountCryptoCurrencyStatusUseCase(
}
}
operator fun invoke(userWalletId: UserWalletId): Flow<Pair<AccountStatus.Payment, CryptoCurrencyStatus>> {
return paymentAccountStatusSupplier(userWalletId).mapNotNull { accountStatus ->
val cryptoCurrencyStatus = when (val statusValue = accountStatus.value) {
is PaymentAccountStatusValue.Loaded -> statusValue.cryptoCurrencyStatus
else -> return@mapNotNull null
}
accountStatus to cryptoCurrencyStatus
}
}
suspend fun invokeSync(
userWalletId: UserWalletId,
cryptoCurrency: CryptoCurrency,