diff --git a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/ValidateWalletAddressUseCase.kt b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/ValidateWalletAddressUseCase.kt index c5a93fdc80..026dca2e67 100644 --- a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/ValidateWalletAddressUseCase.kt +++ b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/ValidateWalletAddressUseCase.kt @@ -26,15 +26,14 @@ class ValidateWalletAddressUseCase( address: String, currencyAddress: Set?, ): AddressValidationResult { + val decodedXAddress = BlockchainUtils.decodeRippleXAddress(address, network.id.value) val isUtxoConsolidationAvailable = walletManagersFacade.checkUtxoConsolidationAvailability(userWalletId, network) - val isCurrentAddress = currencyAddress?.any { it.value == address } ?: true + + val addressToValidate = decodedXAddress?.address ?: address + val isCurrentAddress = currencyAddress?.any { it.value == addressToValidate } ?: true val isForbidSelfSend = isCurrentAddress && !isUtxoConsolidationAvailable - - val decodedXAddress = BlockchainUtils.decodeRippleXAddress(address, network.id.value) - val addressToValidate = decodedXAddress?.address ?: address - val isValidAddress = walletAddressServiceRepository.validateAddress(userWalletId, network, addressToValidate) return when { @@ -51,15 +50,14 @@ class ValidateWalletAddressUseCase( address: String, senderAddresses: List, ): AddressValidationResult { + val decodedXAddress = BlockchainUtils.decodeRippleXAddress(address, network.id.value) val isUtxoConsolidationAvailable = walletManagersFacade.checkUtxoConsolidationAvailability(userWalletId, network) - val isCurrentAddress = senderAddresses.any { it.address == address } + + val addressToValidate = decodedXAddress?.address ?: address + val isCurrentAddress = senderAddresses.any { it.address == addressToValidate } val isForbidSelfSend = isCurrentAddress && !isUtxoConsolidationAvailable - - val decodedXAddress = BlockchainUtils.decodeRippleXAddress(address, network.id.value) - val addressToValidate = decodedXAddress?.address ?: address - val isValidAddress = walletAddressServiceRepository.validateAddress(userWalletId, network, addressToValidate) return when {