From ad0f9678d7d5378ad243e3b5f95ad7d1a0e1b5ea Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 9 Apr 2025 11:08:28 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../usecase/ValidateWalletAddressUseCase.kt | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) 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 {