Updated on 2026-08-14
This commit is contained in:
parent
b0d5ab72e1
commit
297eb15571
4 changed files with 13 additions and 23 deletions
|
|
@ -18,6 +18,7 @@ interface TangemTechApi {
|
|||
@Query("contractAddress") contractAddress: String? = null,
|
||||
@Query("exchangeable") exchangeable: Boolean? = null,
|
||||
@Query("networkIds") networkIds: String? = null,
|
||||
@Query("networkId") networkId: String? = null,
|
||||
@Query("active") active: Boolean? = null,
|
||||
@Query("searchText") searchText: String? = null,
|
||||
@Query("offset") offset: Int? = null,
|
||||
|
|
|
|||
|
|
@ -33,19 +33,17 @@ internal class DefaultPromoRepository(
|
|||
}
|
||||
|
||||
override suspend fun getOkxPromoBanner(): PromoBanner? {
|
||||
// TODO disabled for 5.12, enable for 5.12.1
|
||||
return null
|
||||
// return runCatching(dispatchers.io) {
|
||||
// promoResponseConverter.convert(
|
||||
// tangemApi.getPromotionInfo(OKX)
|
||||
// .getOrThrow(),
|
||||
// )
|
||||
// }.getOrNull()
|
||||
return runCatching(dispatchers.io) {
|
||||
promoResponseConverter.convert(
|
||||
tangemApi.getPromotionInfo(OKX)
|
||||
.getOrThrow(),
|
||||
)
|
||||
}.getOrNull()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val CHANGELLY_NAME = "changelly"
|
||||
private const val TRAVALA = "travala"
|
||||
// private const val OKX = "okx"
|
||||
private const val OKX = "okx"
|
||||
}
|
||||
}
|
||||
|
|
@ -429,22 +429,12 @@ internal class DefaultCurrenciesRepository(
|
|||
val token = withContext(dispatchers.io) {
|
||||
val foundToken = tangemTechApi.getCoins(
|
||||
contractAddress = contractAddress,
|
||||
networkIds = networkId,
|
||||
networkId = networkId,
|
||||
)
|
||||
.getOrThrow()
|
||||
.coins
|
||||
.firstNotNullOfOrNull { coin ->
|
||||
val networksWithTheSameAddress = coin.networks.filter { network ->
|
||||
(network.contractAddress != null || network.decimalCount != null) &&
|
||||
network.contractAddress?.equals(contractAddress, ignoreCase = true) == true
|
||||
}
|
||||
|
||||
if (networksWithTheSameAddress.isNotEmpty()) {
|
||||
coin.copy(networks = networksWithTheSameAddress)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} ?: error("Token not found")
|
||||
.firstOrNull()
|
||||
?: error("Token not found")
|
||||
val network = foundToken.networks.firstOrNull { it.networkId == networkId } ?: error("Network not found")
|
||||
CryptoCurrencyFactory.Token(
|
||||
symbol = foundToken.symbol,
|
||||
|
|
|
|||
|
|
@ -142,9 +142,9 @@ internal class TokenDetailsSwapTransactionsStateConverter(
|
|||
txUrl: String?,
|
||||
refundToken: CryptoCurrency?,
|
||||
): ExchangeStatusNotifications? {
|
||||
if (txUrl == null) return null
|
||||
return when (status) {
|
||||
ExchangeStatus.Failed -> {
|
||||
if (txUrl == null) return null
|
||||
ExchangeStatusNotifications.Failed {
|
||||
analyticsEventsHandlerProvider().send(
|
||||
TokenExchangeAnalyticsEvent.GoToProviderFail(cryptoCurrency.symbol),
|
||||
|
|
@ -153,6 +153,7 @@ internal class TokenDetailsSwapTransactionsStateConverter(
|
|||
}
|
||||
}
|
||||
ExchangeStatus.Verifying -> {
|
||||
if (txUrl == null) return null
|
||||
ExchangeStatusNotifications.NeedVerification {
|
||||
analyticsEventsHandlerProvider().send(
|
||||
TokenExchangeAnalyticsEvent.GoToProviderKYC(cryptoCurrency.symbol),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue