Updated on 2026-08-14

This commit is contained in:
Tangem 2025-11-17 12:55:48 +02:00
parent 8b576c6492
commit d9bbb09aef
8 changed files with 35 additions and 19 deletions

View file

@ -20,6 +20,7 @@ import com.tangem.domain.transaction.models.AssetRequirementsCondition
import com.tangem.utils.Provider
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import com.tangem.utils.coroutines.runCatching
import com.tangem.utils.coroutines.runSuspendCatching
import com.tangem.utils.isNullOrZero
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.firstOrNull
@ -35,7 +36,7 @@ internal class DefaultRampManager(
userWallet: UserWallet,
cryptoCurrency: CryptoCurrency,
): ScenarioUnavailabilityReason {
val availabilityState = runCatching { getOnrampAvailableState(userWallet.walletId, cryptoCurrency) }
val availabilityState = runSuspendCatching { getOnrampAvailableState(userWallet.walletId, cryptoCurrency) }
.getOrNull()
?: ExpressAvailabilityState.Error
@ -84,7 +85,7 @@ internal class DefaultRampManager(
userWalletId: UserWalletId,
cryptoCurrency: CryptoCurrency,
): ScenarioUnavailabilityReason {
val availabilityState = runCatching {
val availabilityState = runSuspendCatching {
getExchangeableState(userWalletId, cryptoCurrency)
}.getOrNull() ?: ExpressAvailabilityState.Error
return availabilityState.toReason(cryptoCurrency.name)