Updated on 2026-08-14
This commit is contained in:
parent
7b5b4753a7
commit
4e4e360ae1
5 changed files with 39 additions and 41 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue