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 -> {