Updated on 2026-08-14

This commit is contained in:
Tangem 2026-02-19 11:10:14 +04:00
parent 7b5b4753a7
commit 4e4e360ae1
5 changed files with 39 additions and 41 deletions

View file

@ -23,7 +23,7 @@ interface WalletAddressServiceRepository {
suspend fun validateAddress(userWalletId: UserWalletId, network: Network, address: String): Boolean
fun validateMemo(network: Network, memo: String): Boolean
suspend fun validateMemo(userWalletId: UserWalletId, network: Network, memo: String): Boolean
suspend fun parseSharedAddress(input: String, network: Network): ParsedQrCode
}

View file

@ -3,7 +3,8 @@ package com.tangem.domain.transaction.usecase
import arrow.core.Either
import arrow.core.left
import arrow.core.right
import com.tangem.domain.models.network.Network
import com.tangem.domain.models.currency.CryptoCurrency
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.transaction.WalletAddressServiceRepository
import com.tangem.domain.transaction.error.ValidateMemoError
@ -14,9 +15,17 @@ class ValidateWalletMemoUseCase(
private val walletAddressServiceRepository: WalletAddressServiceRepository,
) {
operator fun invoke(network: Network, memo: String): Either<ValidateMemoError, Unit> {
suspend operator fun invoke(
userWalletId: UserWalletId,
cryptoCurrency: CryptoCurrency,
memo: String,
): Either<ValidateMemoError, Unit> {
return try {
val isValidMemo = walletAddressServiceRepository.validateMemo(network, memo)
val isValidMemo = walletAddressServiceRepository.validateMemo(
userWalletId = userWalletId,
network = cryptoCurrency.network,
memo = memo,
)
if (isValidMemo) {
Unit.right()
} else {