Updated on 2026-08-14
This commit is contained in:
parent
3269095c97
commit
6f21916cb2
1 changed files with 17 additions and 3 deletions
|
|
@ -2,6 +2,8 @@ package com.tangem.data.onramp
|
|||
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchainsdk.utils.ExcludedBlockchains
|
||||
import com.tangem.blockchainsdk.utils.NEW_POLYGON_NAME
|
||||
import com.tangem.blockchainsdk.utils.OLD_POLYGON_NAME
|
||||
import com.tangem.blockchainsdk.utils.fromNetworkId
|
||||
import com.tangem.core.analytics.api.AnalyticsEventHandler
|
||||
import com.tangem.core.analytics.models.event.MainScreenAnalyticsEvent
|
||||
|
|
@ -141,9 +143,11 @@ internal class DefaultHotCryptoRepository(
|
|||
val (userWallet, tokens) = walletWithTokens
|
||||
|
||||
return copy(
|
||||
tokens = this.tokens.filter { hotToken ->
|
||||
!tokens.hasAlreadyAdded(hotToken) && userWallet.canHandleHotCrypto(hotToken)
|
||||
},
|
||||
tokens = this.tokens
|
||||
.filter { hotToken ->
|
||||
!tokens.hasAlreadyAdded(hotToken) && userWallet.canHandleHotCrypto(hotToken)
|
||||
}
|
||||
.applyTokensIdMigrations(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -154,6 +158,16 @@ internal class DefaultHotCryptoRepository(
|
|||
}
|
||||
}
|
||||
|
||||
private fun List<HotCryptoResponse.Token>.applyTokensIdMigrations(): List<HotCryptoResponse.Token> {
|
||||
return this.map {
|
||||
if (it.id == OLD_POLYGON_NAME) {
|
||||
it.copy(id = NEW_POLYGON_NAME)
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: [REDACTED_JIRA]
|
||||
private fun UserWallet.canHandleHotCrypto(hotToken: HotCryptoResponse.Token): Boolean {
|
||||
val isToken = hotToken.contractAddress != null && hotToken.decimalCount != null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue