diff --git a/data/transaction/src/main/java/com/tangem/data/transaction/DefaultTransactionRepository.kt b/data/transaction/src/main/java/com/tangem/data/transaction/DefaultTransactionRepository.kt index 7179221efb..437fbe7c78 100644 --- a/data/transaction/src/main/java/com/tangem/data/transaction/DefaultTransactionRepository.kt +++ b/data/transaction/src/main/java/com/tangem/data/transaction/DefaultTransactionRepository.kt @@ -240,15 +240,19 @@ internal class DefaultTransactionRepository( val validator = walletManager as? TransactionValidator if (validator != null) { - val transactionData = walletManager.createTransaction( - amount = amount, - fee = fee ?: Fee.Common(amount = amount), - destination = destination, - ).copy( - extras = getMemoExtras(networkId = network.rawId, memo = memo), - ) + try { + val transactionData = walletManager.createTransaction( + amount = amount, + fee = fee ?: Fee.Common(amount = amount), + destination = destination, + ).copy( + extras = getMemoExtras(networkId = network.rawId, memo = memo), + ) - validator.validate(transactionData = transactionData) + validator.validate(transactionData = transactionData) + } catch (ex: Exception) { + Result.failure(ex) + } } else { Timber.e("${walletManager?.wallet?.blockchain} does not support transaction validation") Result.success(Unit) diff --git a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/ValidateTransactionUseCase.kt b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/ValidateTransactionUseCase.kt index 499e222199..64db5bebf9 100644 --- a/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/ValidateTransactionUseCase.kt +++ b/domain/transaction/src/main/java/com/tangem/domain/transaction/usecase/ValidateTransactionUseCase.kt @@ -21,14 +21,12 @@ class ValidateTransactionUseCase( destination: String, userWalletId: UserWalletId, network: Network, - ): Either = Either.catch { - transactionRepository.validateTransaction( - amount = amount, - fee = fee, - memo = memo, - destination = destination, - userWalletId = userWalletId, - network = network, - ).fold(onSuccess = { Unit.right() }, onFailure = { it.left() }) - } + ): Either = transactionRepository.validateTransaction( + amount = amount, + fee = fee, + memo = memo, + destination = destination, + userWalletId = userWalletId, + network = network, + ).fold(onSuccess = { Unit.right() }, onFailure = { it.left() }) } \ No newline at end of file diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/model/SendConfirmModel.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/model/SendConfirmModel.kt index 1fb318f5c1..284f09ebbf 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/model/SendConfirmModel.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/confirm/model/SendConfirmModel.kt @@ -139,8 +139,16 @@ internal class SendConfirmModel @Inject constructor( reduceAmountBy = amountState?.reduceAmountBy.orZero(), isIgnoreReduce = amountState?.isIgnoreReduce == true, enteredDestination = destinationUM?.addressTextField?.actualAddress, - fee = feeSelectorUM?.selectedFee, - feeError = (feeUM?.feeSelectorUM as? FeeSelectorUM.Error)?.error, + fee = if (uiState.value.isRedesignEnabled) { + feeUMV2?.selectedFeeItem?.fee + } else { + feeSelectorUM?.selectedFee + }, + feeError = if (uiState.value.isRedesignEnabled) { + (uiState.value.feeSelectorUM as? FeeSelectorUMRedesigned.Error)?.error + } else { + (feeUM?.feeSelectorUM as? FeeSelectorUM.Error)?.error + }, ) private var sendIdleTimer: Long = 0L