From 74dea8f85ba19b2e2319d78f6df752a4692c340c Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 14 Jun 2023 18:28:02 +0400 Subject: [PATCH] Updated on 2026-08-14 --- .../presentation/viewmodels/AddCustomTokenViewModel.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/customtoken/impl/presentation/viewmodels/AddCustomTokenViewModel.kt b/app/src/main/java/com/tangem/tap/features/customtoken/impl/presentation/viewmodels/AddCustomTokenViewModel.kt index 1d886914c7..5ccb8e66e6 100644 --- a/app/src/main/java/com/tangem/tap/features/customtoken/impl/presentation/viewmodels/AddCustomTokenViewModel.kt +++ b/app/src/main/java/com/tangem/tap/features/customtoken/impl/presentation/viewmodels/AddCustomTokenViewModel.kt @@ -510,7 +510,7 @@ internal class AddCustomTokenViewModel @Inject constructor( val sameAddress = contractAddress == wrappedCurrency.token.contractAddress val sameBlockchain = Blockchain.fromNetworkId(networkSelectorValue.toNetworkId()) == wrappedCurrency.blockchain - val isSameDerivationPath = getDerivationPath()?.rawPath == wrappedCurrency.derivationPath + val isSameDerivationPath = getDerivationPath().isSameDerivationPath(wrappedCurrency.derivationPath) sameId && sameAddress && sameBlockchain && isSameDerivationPath } } @@ -522,10 +522,15 @@ internal class AddCustomTokenViewModel @Inject constructor( .filterIsInstance() .any { val networkSelectorValue = uiState.form.networkSelectorField.selectedItem.blockchain - networkSelectorValue == it.blockchain && getDerivationPath()?.rawPath == it.derivationPath + networkSelectorValue == it.blockchain && + getDerivationPath().isSameDerivationPath(it.derivationPath) } } + private fun DerivationPath?.isSameDerivationPath(rawDerivationPath: String?): Boolean { + return this == rawDerivationPath?.let { DerivationPath(it) } + } + private fun handleContractAddressErrorValidation(type: AddCustomTokenError) { when { isNetworkSelected() && type == AddCustomTokenError.InvalidContractAddress -> {