From 27e9400b2aa2a85e21cb32148181fd127a622916 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 13 Apr 2026 15:39:33 +0400 Subject: [PATCH] Updated on 2026-08-14 --- .../feedback/DefaultFeedbackRepository.kt | 29 +++++++------------ .../tangem/data/feedback/di/FeedbackModule.kt | 3 -- .../data/staking/DefaultStakeKitRepository.kt | 12 +++++--- .../DefaultTransactionRepository.kt | 10 +++---- .../feedback/models/BlockchainErrorInfo.kt | 8 ++--- .../feedback/repository/FeedbackRepository.kt | 7 ++--- .../utils/EmailMessageBodyResolver.kt | 20 +++++-------- ...GetConstructedStakingTransactionUseCase.kt | 5 ++-- .../repositories/StakeKitRepository.kt | 4 +-- .../v2/send/confirm/model/SendConfirmModel.kt | 5 ++-- .../features/send/v2/send/model/SendModel.kt | 7 ++--- .../confirm/model/NFTSendConfirmModel.kt | 9 +++--- .../send/v2/sendnft/model/NFTSendModel.kt | 5 ++-- .../impl/presentation/model/StakingModel.kt | 18 +++++------- .../helpers/StakeKitTransactionSender.kt | 4 +-- .../swap/v2/impl/common/SwapAlertFactory.kt | 3 +- .../tangem/feature/swap/model/SwapModel.kt | 3 +- .../impl/common/YieldSupplyAlertFactory.kt | 3 +- 18 files changed, 67 insertions(+), 88 deletions(-) diff --git a/data/feedback/src/main/java/com/tangem/data/feedback/DefaultFeedbackRepository.kt b/data/feedback/src/main/java/com/tangem/data/feedback/DefaultFeedbackRepository.kt index 5f39f9f870..76ef2e52f0 100644 --- a/data/feedback/src/main/java/com/tangem/data/feedback/DefaultFeedbackRepository.kt +++ b/data/feedback/src/main/java/com/tangem/data/feedback/DefaultFeedbackRepository.kt @@ -1,7 +1,7 @@ package com.tangem.data.feedback import android.os.Build -import com.tangem.blockchain.common.Blockchain +import com.tangem.blockchainsdk.utils.toBlockchain import com.tangem.core.navigation.email.EmailSender import com.tangem.data.feedback.converters.BlockchainInfoConverter import com.tangem.data.feedback.converters.WalletMetaInfoConverter @@ -10,10 +10,10 @@ import com.tangem.datasource.local.walletmanager.WalletManagersStore import com.tangem.domain.common.wallets.UserWalletsListRepository import com.tangem.domain.feedback.models.* import com.tangem.domain.feedback.repository.FeedbackRepository +import com.tangem.domain.models.network.Network import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.UserWalletId -import com.tangem.domain.wallets.usecase.GetSelectedWalletUseCase import com.tangem.utils.logging.TangemLogger import com.tangem.utils.version.AppVersionProvider import kotlinx.coroutines.flow.MutableStateFlow @@ -23,23 +23,20 @@ import java.io.File /** * Implementation of [FeedbackRepository] * - * @property appLogsStore app logs store - * @property userWalletsListManager user wallets list manager - * @property userWalletsListRepository user wallets repository - * @property walletManagersStore wallet managers store - * @property emailSender email sender - * @property appVersionProvider app version provider + * @property appLogsStore app logs store + * @property userWalletsListRepository repository for getting user wallets + * @property walletManagersStore wallet managers store + * @property emailSender email sender + * @property appVersionProvider app version provider * [REDACTED_AUTHOR] */ -@Suppress("LongParameterList") internal class DefaultFeedbackRepository( private val appLogsStore: AppLogsStore, private val userWalletsListRepository: UserWalletsListRepository, private val walletManagersStore: WalletManagersStore, private val emailSender: EmailSender, private val appVersionProvider: AppVersionProvider, - private val getSelectedWalletUseCase: GetSelectedWalletUseCase, ) : FeedbackRepository { private val blockchainsErrors = MutableStateFlow>(emptyMap()) @@ -68,16 +65,12 @@ internal class DefaultFeedbackRepository( .map(BlockchainInfoConverter::convert) } - override suspend fun getBlockchainInfo( - userWalletId: UserWalletId, - blockchainId: String, - derivationPath: String?, - ): BlockchainInfo? { + override suspend fun getBlockchainInfo(userWalletId: UserWalletId, networkId: Network.ID): BlockchainInfo? { return walletManagersStore .getSyncOrNull( userWalletId = userWalletId, - blockchain = Blockchain.fromId(blockchainId), - derivationPath = derivationPath, + blockchain = networkId.toBlockchain(), + derivationPath = networkId.derivationPath.value, ) ?.let(BlockchainInfoConverter::convert) } @@ -91,7 +84,7 @@ internal class DefaultFeedbackRepository( } override fun saveBlockchainErrorInfo(error: BlockchainErrorInfo) { - val userWallet = getSelectedWalletUseCase.sync().getOrNull() ?: error("UserWallet is not selected") + val userWallet = userWalletsListRepository.selectedUserWallet.value ?: error("UserWallet is not selected") blockchainsErrors.update { map -> map.toMutableMap().apply { diff --git a/data/feedback/src/main/java/com/tangem/data/feedback/di/FeedbackModule.kt b/data/feedback/src/main/java/com/tangem/data/feedback/di/FeedbackModule.kt index db803a21d2..6d4d9176c1 100644 --- a/data/feedback/src/main/java/com/tangem/data/feedback/di/FeedbackModule.kt +++ b/data/feedback/src/main/java/com/tangem/data/feedback/di/FeedbackModule.kt @@ -9,7 +9,6 @@ import com.tangem.datasource.local.walletmanager.WalletManagersStore import com.tangem.domain.common.wallets.UserWalletsListRepository import com.tangem.domain.feedback.repository.FeedbackFeatureToggles import com.tangem.domain.feedback.repository.FeedbackRepository -import com.tangem.domain.wallets.usecase.GetSelectedWalletUseCase import com.tangem.utils.version.AppVersionProvider import dagger.Module import dagger.Provides @@ -29,7 +28,6 @@ internal object FeedbackModule { walletManagersStore: WalletManagersStore, emailSender: EmailSender, appVersionProvider: AppVersionProvider, - getSelectedWalletUseCase: GetSelectedWalletUseCase, ): FeedbackRepository { return DefaultFeedbackRepository( appLogsStore = appLogsStore, @@ -37,7 +35,6 @@ internal object FeedbackModule { emailSender = emailSender, appVersionProvider = appVersionProvider, userWalletsListRepository = userWalletsListRepository, - getSelectedWalletUseCase = getSelectedWalletUseCase, ) } diff --git a/data/staking/src/main/java/com/tangem/data/staking/DefaultStakeKitRepository.kt b/data/staking/src/main/java/com/tangem/data/staking/DefaultStakeKitRepository.kt index 8f0fd77aec..335d1a5dac 100644 --- a/data/staking/src/main/java/com/tangem/data/staking/DefaultStakeKitRepository.kt +++ b/data/staking/src/main/java/com/tangem/data/staking/DefaultStakeKitRepository.kt @@ -8,6 +8,7 @@ import com.tangem.blockchain.common.TransactionData import com.tangem.blockchain.common.TransactionStatus import com.tangem.blockchain.common.transaction.Fee import com.tangem.blockchainsdk.utils.fromNetworkId +import com.tangem.blockchainsdk.utils.toBlockchain import com.tangem.common.extensions.hexToBytes import com.tangem.common.extensions.toCompressedPublicKey import com.tangem.data.staking.converters.YieldConverter @@ -244,7 +245,7 @@ internal class DefaultStakeKitRepository( } override suspend fun constructTransaction( - networkId: String, + networkId: Network.RawID, fee: Fee, amount: Amount, transactionId: String, @@ -320,8 +321,11 @@ internal class DefaultStakeKitRepository( } } - private fun getTransactionDataType(networkId: String, unsignedTransaction: String): TransactionData.Compiled.Data { - return when (Blockchain.fromId(networkId)) { + private fun getTransactionDataType( + networkId: Network.RawID, + unsignedTransaction: String, + ): TransactionData.Compiled.Data { + return when (val blockchain = networkId.toBlockchain()) { Blockchain.Solana, Blockchain.Cosmos, -> TransactionData.Compiled.Data.Bytes(unsignedTransaction.hexToBytes()) @@ -335,7 +339,7 @@ internal class DefaultStakeKitRepository( ?: error("Failed to parse Tron StakeKit transaction") TransactionData.Compiled.Data.RawString(tronStakeKitTransaction.rawDataHex) } - else -> error("Unsupported blockchain") + else -> error("Unsupported blockchain: $blockchain") } } 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 17c0b17828..ae96776efa 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 @@ -61,7 +61,7 @@ internal class DefaultTransactionRepository( derivationPath = network.derivationPath.value, ) ?: error("Wallet manager not found") - val extras = txExtras ?: getMemoExtras(networkId = network.rawId, memo) + val extras = txExtras ?: getMemoExtras(networkId = network.id.rawId, memo) val patchedDestination = if (amount.type is AmountType.TokenYieldSupply) { walletManager.getYieldModuleAddress() @@ -128,7 +128,7 @@ internal class DefaultTransactionRepository( destination = destination, userWalletId = userWalletId, network = network, - txExtras = getMemoExtras(networkId = network.rawId, memo = memo) ?: extras, + txExtras = getMemoExtras(networkId = network.id.rawId, memo = memo) ?: extras, ) } @@ -262,7 +262,7 @@ internal class DefaultTransactionRepository( fee = fee ?: Fee.Common(amount = amount), destination = destination, ).copy( - extras = getMemoExtras(networkId = network.rawId, memo = memo), + extras = getMemoExtras(networkId = network.id.rawId, memo = memo), ) validator.validate(transactionData = transactionData) @@ -332,8 +332,8 @@ internal class DefaultTransactionRepository( } @Suppress("CyclomaticComplexMethod") - private fun getMemoExtras(networkId: String, memo: String?): TransactionExtras? { - val blockchain = Blockchain.fromId(networkId) + private fun getMemoExtras(networkId: Network.RawID, memo: String?): TransactionExtras? { + val blockchain = networkId.toBlockchain() if (memo == null) return null return when (blockchain) { Blockchain.Stellar -> { diff --git a/domain/feedback/models/src/main/kotlin/com/tangem/domain/feedback/models/BlockchainErrorInfo.kt b/domain/feedback/models/src/main/kotlin/com/tangem/domain/feedback/models/BlockchainErrorInfo.kt index fc76ba451b..bede31c929 100644 --- a/domain/feedback/models/src/main/kotlin/com/tangem/domain/feedback/models/BlockchainErrorInfo.kt +++ b/domain/feedback/models/src/main/kotlin/com/tangem/domain/feedback/models/BlockchainErrorInfo.kt @@ -1,11 +1,12 @@ package com.tangem.domain.feedback.models +import com.tangem.domain.models.network.Network + /** * Information about blockchain's operation error * * @property errorMessage message about error - * @property blockchainId blockchain id - * @property derivationPath derivation path + * @property networkId network ID * @property destinationAddress destination address * @property tokenSymbol token symbol or null, if it isn't operation with token * @property amount amount @@ -13,8 +14,7 @@ package com.tangem.domain.feedback.models */ data class BlockchainErrorInfo( val errorMessage: String, - val blockchainId: String, - val derivationPath: String?, + val networkId: Network.ID?, val destinationAddress: String, val tokenSymbol: String?, val amount: String, diff --git a/domain/feedback/src/main/java/com/tangem/domain/feedback/repository/FeedbackRepository.kt b/domain/feedback/src/main/java/com/tangem/domain/feedback/repository/FeedbackRepository.kt index 3661f00b48..0f3bb871b5 100644 --- a/domain/feedback/src/main/java/com/tangem/domain/feedback/repository/FeedbackRepository.kt +++ b/domain/feedback/src/main/java/com/tangem/domain/feedback/repository/FeedbackRepository.kt @@ -1,6 +1,7 @@ package com.tangem.domain.feedback.repository import com.tangem.domain.feedback.models.* +import com.tangem.domain.models.network.Network import com.tangem.domain.models.scan.ScanResponse import com.tangem.domain.models.wallet.UserWalletId import java.io.File @@ -17,11 +18,7 @@ interface FeedbackRepository { fun getPhoneInfo(): PhoneInfo - suspend fun getBlockchainInfo( - userWalletId: UserWalletId, - blockchainId: String, - derivationPath: String?, - ): BlockchainInfo? + suspend fun getBlockchainInfo(userWalletId: UserWalletId, networkId: Network.ID): BlockchainInfo? fun saveBlockchainErrorInfo(error: BlockchainErrorInfo) diff --git a/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageBodyResolver.kt b/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageBodyResolver.kt index 0d16f8c9c2..112112773f 100644 --- a/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageBodyResolver.kt +++ b/domain/feedback/src/main/java/com/tangem/domain/feedback/utils/EmailMessageBodyResolver.kt @@ -94,11 +94,10 @@ class EmailMessageBodyResolver( val userWalletId = requireNotNull(type.walletMetaInfo.userWalletId) { "UserWalletId must be not null" } val blockchainError = feedbackRepository.getBlockchainErrorInfo(userWalletId = userWalletId) - val blockchainInfo = blockchainError?.let { + val blockchainInfo = blockchainError?.networkId?.let { networkId -> feedbackRepository.getBlockchainInfo( userWalletId = userWalletId, - blockchainId = blockchainError.blockchainId, - derivationPath = blockchainError.derivationPath, + networkId = networkId, ) } @@ -159,11 +158,10 @@ class EmailMessageBodyResolver( val userWalletId = requireNotNull(walletMetaInfo.userWalletId) { "UserWalletId must be not null" } val blockchainError = feedbackRepository.getBlockchainErrorInfo(userWalletId = userWalletId) - val blockchainInfo = blockchainError?.let { + val blockchainInfo = blockchainError?.networkId?.let { networkId -> feedbackRepository.getBlockchainInfo( userWalletId = userWalletId, - blockchainId = blockchainError.blockchainId, - derivationPath = blockchainError.derivationPath, + networkId = networkId, ) } @@ -181,11 +179,10 @@ class EmailMessageBodyResolver( val userWalletId = requireNotNull(type.walletMetaInfo.userWalletId) { "UserWalletId must be not null" } val blockchainError = feedbackRepository.getBlockchainErrorInfo(userWalletId = userWalletId) - val blockchainInfo = blockchainError?.let { + val blockchainInfo = blockchainError?.networkId?.let { networkId -> feedbackRepository.getBlockchainInfo( userWalletId = userWalletId, - blockchainId = blockchainError.blockchainId, - derivationPath = blockchainError.derivationPath, + networkId = networkId, ) } @@ -210,11 +207,10 @@ class EmailMessageBodyResolver( val userWalletId = requireNotNull(type.walletMetaInfo.userWalletId) { "UserWalletId must be not null" } val blockchainError = feedbackRepository.getBlockchainErrorInfo(userWalletId = userWalletId) - val blockchainInfo = blockchainError?.let { + val blockchainInfo = blockchainError?.networkId?.let { networkId -> feedbackRepository.getBlockchainInfo( userWalletId = userWalletId, - blockchainId = blockchainError.blockchainId, - derivationPath = blockchainError.derivationPath, + networkId = networkId, ) } diff --git a/domain/staking/src/main/java/com/tangem/domain/staking/GetConstructedStakingTransactionUseCase.kt b/domain/staking/src/main/java/com/tangem/domain/staking/GetConstructedStakingTransactionUseCase.kt index 7242d70f51..d9f06df359 100644 --- a/domain/staking/src/main/java/com/tangem/domain/staking/GetConstructedStakingTransactionUseCase.kt +++ b/domain/staking/src/main/java/com/tangem/domain/staking/GetConstructedStakingTransactionUseCase.kt @@ -4,10 +4,11 @@ import arrow.core.Either import com.tangem.blockchain.common.Amount import com.tangem.blockchain.common.TransactionData import com.tangem.blockchain.common.transaction.Fee +import com.tangem.domain.models.network.Network import com.tangem.domain.staking.model.stakekit.StakingError import com.tangem.domain.staking.model.stakekit.transaction.StakingTransaction -import com.tangem.domain.staking.repositories.StakingErrorResolver import com.tangem.domain.staking.repositories.StakeKitRepository +import com.tangem.domain.staking.repositories.StakingErrorResolver class GetConstructedStakingTransactionUseCase( private val stakeKitRepository: StakeKitRepository, @@ -15,7 +16,7 @@ class GetConstructedStakingTransactionUseCase( ) { suspend operator fun invoke( - networkId: String, + networkId: Network.RawID, fee: Fee, amount: Amount, transactionId: String, diff --git a/domain/staking/src/main/java/com/tangem/domain/staking/repositories/StakeKitRepository.kt b/domain/staking/src/main/java/com/tangem/domain/staking/repositories/StakeKitRepository.kt index e614a685bc..876e026c8b 100644 --- a/domain/staking/src/main/java/com/tangem/domain/staking/repositories/StakeKitRepository.kt +++ b/domain/staking/src/main/java/com/tangem/domain/staking/repositories/StakeKitRepository.kt @@ -5,11 +5,11 @@ import com.tangem.blockchain.common.TransactionData import com.tangem.blockchain.common.transaction.Fee import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.network.Network +import com.tangem.domain.models.staking.NetworkType import com.tangem.domain.models.wallet.UserWalletId import com.tangem.domain.staking.model.StakingAvailability import com.tangem.domain.staking.model.StakingEntryInfo import com.tangem.domain.staking.model.StakingIntegrationID -import com.tangem.domain.models.staking.NetworkType import com.tangem.domain.staking.model.stakekit.Yield import com.tangem.domain.staking.model.stakekit.action.StakingAction import com.tangem.domain.staking.model.stakekit.action.StakingActionStatus @@ -55,7 +55,7 @@ interface StakeKitRepository { suspend fun estimateGas(userWalletId: UserWalletId, network: Network, params: ActionParams): StakingGasEstimate suspend fun constructTransaction( - networkId: String, + networkId: Network.RawID, fee: Fee, amount: Amount, transactionId: String, 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 4c9a5154ca..e201062981 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 @@ -74,10 +74,10 @@ import com.tangem.features.send.v2.subcomponents.amount.SendAmountReduceTrigger import com.tangem.utils.coroutines.CoroutineDispatcherProvider import com.tangem.utils.extensions.orZero import com.tangem.utils.extensions.stripZeroPlainString +import com.tangem.utils.logging.TangemLogger import com.tangem.utils.transformer.update import kotlinx.coroutines.flow.* import kotlinx.coroutines.launch -import com.tangem.utils.logging.TangemLogger import java.math.BigDecimal import javax.inject.Inject import com.tangem.features.send.v2.api.entity.FeeSelectorUM as FeeSelectorUMRedesigned @@ -281,8 +281,7 @@ internal class SendConfirmModel @Inject constructor( saveBlockchainErrorUseCase( error = BlockchainErrorInfo( errorMessage = errorMessage, - blockchainId = cryptoCurrency.network.rawId, - derivationPath = cryptoCurrency.network.derivationPath.value, + networkId = cryptoCurrency.network.id, destinationAddress = confirmData.enteredDestination.orEmpty(), tokenSymbol = if (amount?.type is AmountType.Token) { amount.currencySymbol diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/model/SendModel.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/model/SendModel.kt index de06ea2a08..3a0d2b40c8 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/model/SendModel.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/send/model/SendModel.kt @@ -18,6 +18,7 @@ import com.tangem.core.decompose.navigation.Router import com.tangem.core.ui.utils.parseBigDecimal import com.tangem.core.ui.utils.parseBigDecimalOrNull import com.tangem.domain.account.status.usecase.GetAccountCurrencyStatusUseCase +import com.tangem.domain.account.status.usecase.GetFeePaidCryptoCurrencyStatusSyncUseCase import com.tangem.domain.account.usecase.IsAccountsModeEnabledUseCase import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase import com.tangem.domain.appcurrency.model.AppCurrency @@ -33,7 +34,6 @@ import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.qrscanning.models.SourceType import com.tangem.domain.qrscanning.usecases.ListenToQrScanningUseCase import com.tangem.domain.qrscanning.usecases.ParseQrCodeUseCase -import com.tangem.domain.account.status.usecase.GetFeePaidCryptoCurrencyStatusSyncUseCase import com.tangem.domain.transaction.error.GetFeeError import com.tangem.domain.transaction.models.TransactionFeeExtended import com.tangem.domain.transaction.usecase.CreateTransferTransactionUseCase @@ -65,9 +65,9 @@ import com.tangem.features.send.v2.subcomponents.destination.model.transformers. import com.tangem.utils.coroutines.CoroutineDispatcherProvider import com.tangem.utils.coroutines.JobHolder import com.tangem.utils.coroutines.saveIn +import com.tangem.utils.logging.TangemLogger import kotlinx.coroutines.flow.* import kotlinx.coroutines.launch -import com.tangem.utils.logging.TangemLogger import javax.inject.Inject import kotlin.properties.Delegates @@ -528,8 +528,7 @@ internal class SendModel @Inject constructor( saveBlockchainErrorUseCase( error = BlockchainErrorInfo( errorMessage = errorMessage.orEmpty(), - blockchainId = cryptoCurrency.network.rawId, - derivationPath = cryptoCurrency.network.derivationPath.value, + networkId = cryptoCurrency.network.id, destinationAddress = "", tokenSymbol = "", amount = "", diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/confirm/model/NFTSendConfirmModel.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/confirm/model/NFTSendConfirmModel.kt index b15638b859..15754e5e6a 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/confirm/model/NFTSendConfirmModel.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/confirm/model/NFTSendConfirmModel.kt @@ -20,13 +20,13 @@ import com.tangem.core.ui.HoldToConfirmButtonFeatureToggles import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.extensions.stringReference -import com.tangem.domain.models.wallet.isHotWallet import com.tangem.datasource.local.nft.converter.NFTSdkAssetConverter import com.tangem.domain.feedback.GetWalletMetaInfoUseCase import com.tangem.domain.feedback.SaveBlockchainErrorUseCase import com.tangem.domain.feedback.SendFeedbackEmailUseCase import com.tangem.domain.feedback.models.BlockchainErrorInfo import com.tangem.domain.feedback.models.FeedbackEmailType +import com.tangem.domain.models.wallet.isHotWallet import com.tangem.domain.settings.IsSendTapHelpEnabledUseCase import com.tangem.domain.settings.NeverShowTapHelpUseCase import com.tangem.domain.transaction.usecase.CreateNFTTransferTransactionUseCase @@ -57,10 +57,10 @@ import com.tangem.features.send.v2.sendnft.confirm.model.transformers.NFTSendCon import com.tangem.features.send.v2.sendnft.ui.state.NFTSendUM import com.tangem.utils.coroutines.CoroutineDispatcherProvider import com.tangem.utils.extensions.stripZeroPlainString +import com.tangem.utils.logging.TangemLogger import com.tangem.utils.transformer.update import kotlinx.coroutines.flow.* import kotlinx.coroutines.launch -import com.tangem.utils.logging.TangemLogger import java.math.BigDecimal import javax.inject.Inject import com.tangem.features.send.v2.api.entity.FeeSelectorUM as FeeSelectorUMRedesigned @@ -197,8 +197,7 @@ internal class NFTSendConfirmModel @Inject constructor( saveBlockchainErrorUseCase( error = BlockchainErrorInfo( errorMessage = errorMessage, - blockchainId = cryptoCurrency.network.rawId, - derivationPath = cryptoCurrency.network.derivationPath.value, + networkId = cryptoCurrency.network.id, destinationAddress = confirmData.enteredDestination.orEmpty(), tokenSymbol = null, amount = params.nftAsset.amount?.toString().orEmpty(), @@ -379,7 +378,7 @@ internal class NFTSendConfirmModel @Inject constructor( flow = uiState, flow2 = params.currentRoute, transform = { state, route -> state to route }, - ).onEach { (state, route) -> + ).onEach { (state, _) -> val confirmUM = state.confirmUM params.callback.onResult( state.copy( diff --git a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/model/NFTSendModel.kt b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/model/NFTSendModel.kt index 54b8e11901..962b35e833 100644 --- a/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/model/NFTSendModel.kt +++ b/features/send-v2/impl/src/main/java/com/tangem/features/send/v2/sendnft/model/NFTSendModel.kt @@ -15,6 +15,7 @@ import com.tangem.core.decompose.model.ParamsContainer import com.tangem.core.decompose.navigation.Router import com.tangem.datasource.local.nft.converter.NFTSdkAssetConverter import com.tangem.domain.account.status.usecase.GetAccountCurrencyStatusUseCase +import com.tangem.domain.account.status.usecase.GetFeePaidCryptoCurrencyStatusSyncUseCase import com.tangem.domain.account.usecase.IsAccountsModeEnabledUseCase import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase import com.tangem.domain.appcurrency.model.AppCurrency @@ -27,7 +28,6 @@ import com.tangem.domain.models.account.Account import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.currency.CryptoCurrencyStatus import com.tangem.domain.models.wallet.UserWallet -import com.tangem.domain.account.status.usecase.GetFeePaidCryptoCurrencyStatusSyncUseCase import com.tangem.domain.tokens.MultiWalletCryptoCurrenciesProducer import com.tangem.domain.tokens.MultiWalletCryptoCurrenciesSupplier import com.tangem.domain.transaction.error.GetFeeError @@ -223,8 +223,7 @@ internal class NFTSendModel @Inject constructor( saveBlockchainErrorUseCase( error = BlockchainErrorInfo( errorMessage = errorMessage.orEmpty(), - blockchainId = cryptoCurrency.network.rawId, - derivationPath = cryptoCurrency.network.derivationPath.value, + networkId = cryptoCurrency.network.id, destinationAddress = "", tokenSymbol = null, amount = "", diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/model/StakingModel.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/model/StakingModel.kt index ccceb6379c..a2081de45c 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/model/StakingModel.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/model/StakingModel.kt @@ -2,6 +2,9 @@ package com.tangem.features.staking.impl.presentation.model import androidx.compose.runtime.Stable import arrow.core.getOrElse +import com.arkivanov.decompose.router.slot.SlotNavigation +import com.arkivanov.decompose.router.slot.activate +import com.arkivanov.decompose.router.slot.dismiss import com.tangem.blockchain.common.TransactionData import com.tangem.blockchain.common.transaction.Fee import com.tangem.blockchain.common.transaction.TransactionFee @@ -10,13 +13,8 @@ import com.tangem.common.routing.AppRouter import com.tangem.common.ui.amountScreen.converters.AmountReduceByTransformer.ReduceByData import com.tangem.common.ui.amountScreen.models.AmountState import com.tangem.common.ui.amountScreen.models.EnterAmountBoundary -import com.arkivanov.decompose.router.slot.SlotNavigation -import com.arkivanov.decompose.router.slot.activate -import com.arkivanov.decompose.router.slot.dismiss import com.tangem.common.ui.bottomsheet.permission.state.ApproveType import com.tangem.common.ui.bottomsheet.permission.state.GiveTxPermissionBottomSheetConfig -import com.tangem.features.approval.api.GiveApprovalComponent -import com.tangem.features.approval.api.GiveApprovalFeatureToggles import com.tangem.common.ui.notifications.NotificationUM import com.tangem.core.analytics.api.AnalyticsEventHandler import com.tangem.core.analytics.api.ParamsInterceptorHolder @@ -36,11 +34,11 @@ import com.tangem.core.ui.haptic.TangemHapticEffect import com.tangem.core.ui.haptic.VibratorHapticManager import com.tangem.core.ui.message.DialogMessage import com.tangem.domain.account.status.usecase.GetAccountCurrencyStatusUseCase +import com.tangem.domain.account.status.usecase.GetFeePaidCryptoCurrencyStatusSyncUseCase import com.tangem.domain.account.usecase.IsAccountsModeEnabledUseCase import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase -import com.tangem.utils.coroutines.AppCoroutineScope import com.tangem.domain.feedback.GetWalletMetaInfoUseCase import com.tangem.domain.feedback.SaveBlockchainErrorUseCase import com.tangem.domain.feedback.SendFeedbackEmailUseCase @@ -61,12 +59,13 @@ import com.tangem.domain.staking.model.stakekit.action.StakingAction import com.tangem.domain.staking.model.stakekit.action.StakingActionCommonType import com.tangem.domain.staking.model.stakekit.transaction.StakingTransaction import com.tangem.domain.staking.repositories.P2PEthPoolRepository -import com.tangem.domain.account.status.usecase.GetFeePaidCryptoCurrencyStatusSyncUseCase import com.tangem.domain.tokens.* import com.tangem.domain.transaction.error.GetFeeError import com.tangem.domain.transaction.usecase.* import com.tangem.domain.utils.convertToSdkAmount import com.tangem.domain.wallets.usecase.GetUserWalletUseCase +import com.tangem.features.approval.api.GiveApprovalComponent +import com.tangem.features.approval.api.GiveApprovalFeatureToggles import com.tangem.features.staking.api.StakingComponent import com.tangem.features.staking.impl.R import com.tangem.features.staking.impl.analytics.StakingParamsInterceptor @@ -100,13 +99,13 @@ import com.tangem.utils.TangemBlogUrlBuilder.RESOURCE_TO_LEARN_ABOUT_APPROVING_I import com.tangem.utils.coroutines.* import com.tangem.utils.extensions.isSingleItem import com.tangem.utils.extensions.orZero +import com.tangem.utils.logging.TangemLogger import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.flow.* import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking -import com.tangem.utils.logging.TangemLogger import java.math.BigDecimal import java.util.concurrent.CopyOnWriteArrayList import javax.inject.Inject @@ -1067,8 +1066,7 @@ internal class StakingModel @Inject constructor( saveBlockchainErrorUseCase( error = BlockchainErrorInfo( errorMessage = errorMessage, - blockchainId = network.rawId, - derivationPath = network.derivationPath.value, + networkId = network.id, destinationAddress = target?.address.orEmpty(), tokenSymbol = (cryptoCurrencyStatus.currency as? CryptoCurrency.Token)?.symbol, amount = amount?.run { value?.toPlainString() + currencySymbol }.orEmpty(), diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/helpers/StakeKitTransactionSender.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/helpers/StakeKitTransactionSender.kt index ca9f4e5992..8e16ba2154 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/helpers/StakeKitTransactionSender.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/helpers/StakeKitTransactionSender.kt @@ -33,13 +33,13 @@ import com.tangem.features.staking.impl.presentation.state.StakingUiState import com.tangem.features.staking.impl.presentation.state.utils.checkAndCalculateSubtractedAmount import com.tangem.features.staking.impl.presentation.state.utils.isCompositePendingActions import com.tangem.utils.extensions.orZero +import com.tangem.utils.logging.TangemLogger import dagger.assisted.Assisted import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.coroutineScope -import com.tangem.utils.logging.TangemLogger import java.math.BigDecimal @Suppress("LongParameterList") @@ -165,7 +165,7 @@ internal class StakeKitTransactionSender @AssistedInject constructor( ?.map { transaction -> async { getConstructedStakingTransactionUseCase( - networkId = cryptoCurrencyStatus.currency.network.rawId, + networkId = cryptoCurrencyStatus.currency.network.id.rawId, fee = fee, amount = amount.convertToSdkAmount(cryptoCurrencyStatus), transactionId = transaction.id, diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/common/SwapAlertFactory.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/common/SwapAlertFactory.kt index 22ead70b9b..7e53fda3a2 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/common/SwapAlertFactory.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/common/SwapAlertFactory.kt @@ -75,8 +75,7 @@ internal class SwapAlertFactory @Inject constructor( saveBlockchainErrorUseCase( error = BlockchainErrorInfo( errorMessage = errorMessage.orEmpty(), - blockchainId = cryptoCurrency?.network?.rawId.orEmpty(), - derivationPath = cryptoCurrency?.network?.derivationPath?.value.orEmpty(), + networkId = cryptoCurrency?.network?.id, destinationAddress = confirmData?.enteredDestination.orEmpty(), tokenSymbol = confirmData?.toCryptoCurrencyStatus?.currency?.symbol.orEmpty(), amount = confirmData?.enteredFromAmount?.toString().orEmpty(), diff --git a/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt b/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt index 5416aaad86..47be410214 100644 --- a/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt +++ b/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt @@ -2112,8 +2112,7 @@ internal class SwapModel @Inject constructor( saveBlockchainErrorUseCase( error = BlockchainErrorInfo( errorMessage = errorMessage, - blockchainId = network.rawId, - derivationPath = network.derivationPath.value, + networkId = network.id, destinationAddress = transaction?.txTo.orEmpty(), tokenSymbol = fromCurrencyStatus.currency.symbol, amount = dataState.amount.orEmpty(), diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/YieldSupplyAlertFactory.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/YieldSupplyAlertFactory.kt index cec6ab682a..d6de0e0316 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/YieldSupplyAlertFactory.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/YieldSupplyAlertFactory.kt @@ -61,8 +61,7 @@ class YieldSupplyAlertFactory @Inject constructor( saveBlockchainErrorUseCase( error = BlockchainErrorInfo( errorMessage = errorMessage.orEmpty(), - blockchainId = cryptoCurrency?.network?.rawId.orEmpty(), - derivationPath = cryptoCurrency?.network?.derivationPath?.value.orEmpty(), + networkId = cryptoCurrency?.network?.id, tokenSymbol = cryptoCurrency?.symbol.orEmpty(), destinationAddress = "", amount = "",