Updated on 2026-08-14

This commit is contained in:
Tangem 2024-06-26 13:21:24 +05:00
parent 1d0d0da8bc
commit 8882b38a51

View file

@ -595,13 +595,15 @@ internal class AddCustomTokenViewModel @Inject constructor(
}
private fun isTokenAlreadyAdded(): Boolean {
val networkSelectorValue = uiState.form.networkSelectorField.selectedItem.blockchain
val networkId = Blockchain.fromNetworkId(networkSelectorValue.toNetworkId())?.id
val contractAddress = convertTokenAddress(
blockchain = networkSelectorValue,
address = uiState.form.contractAddressInputField.value,
)
return currentCryptoCurrencies
.filterIsInstance<CryptoCurrency.Token>()
.any { token ->
val contractAddress = uiState.form.contractAddressInputField.value
val networkSelectorValue = uiState.form.networkSelectorField.selectedItem.blockchain
val networkId = Blockchain.fromNetworkId(networkSelectorValue.toNetworkId())?.id
val sameId = if (!token.isCustom) {
// todo after move foundToken to CryptoCurrency model, use only id
foundToken?.id == token.id.rawCurrencyId