From d1189ffda21c2e93678e809e82bb682a69d377b9 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 26 Jan 2026 10:11:00 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../repository/DefaultTxHistoryRepository.kt | 5 ++--- .../txhistory/repository/TxHistoryRepository.kt | 3 +-- .../usecase/GetExplorerTransactionUrlUseCase.kt | 15 ++++----------- .../v2/send/confirm/model/SendConfirmModel.kt | 1 - .../sendnft/confirm/model/NFTSendConfirmModel.kt | 1 - .../state/helpers/P2PEthPoolTransactionSender.kt | 2 +- .../state/helpers/StakeKitTransactionSender.kt | 2 +- .../confirm/model/SendWithSwapConfirmModel.kt | 1 - .../com/tangem/feature/swap/model/SwapModel.kt | 1 - .../tokendetails/model/TokenDetailsModel.kt | 1 - .../features/txhistory/model/TxHistoryModel.kt | 1 - .../model/intents/WalletContentClickIntents.kt | 1 - 12 files changed, 9 insertions(+), 25 deletions(-) diff --git a/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/repository/DefaultTxHistoryRepository.kt b/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/repository/DefaultTxHistoryRepository.kt index 85277a038f..b668562534 100644 --- a/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/repository/DefaultTxHistoryRepository.kt +++ b/data/txhistory/src/main/kotlin/com/tangem/data/txhistory/repository/DefaultTxHistoryRepository.kt @@ -10,7 +10,6 @@ import com.tangem.data.txhistory.repository.paging.TxHistoryPagingSource import com.tangem.datasource.local.txhistory.TxHistoryItemsStore import com.tangem.datasource.local.userwallet.UserWalletsStore import com.tangem.domain.models.currency.CryptoCurrency -import com.tangem.domain.models.network.Network import com.tangem.domain.models.network.TxInfo import com.tangem.domain.models.wallet.UserWallet import com.tangem.domain.models.wallet.UserWalletId @@ -75,8 +74,8 @@ class DefaultTxHistoryRepository( return pager.flow } - override fun getTxExploreUrl(txHash: String, networkId: Network.ID, currency: CryptoCurrency): String { - val blockchain = networkId.toBlockchain() + override fun getTxExploreUrl(txHash: String, currency: CryptoCurrency): String { + val blockchain = currency.network.id.toBlockchain() val txExploreState = when (currency) { is CryptoCurrency.Token -> blockchain.getTokenExplorerTxUrl(txHash) else -> blockchain.getExploreTxUrl(txHash) diff --git a/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/repository/TxHistoryRepository.kt b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/repository/TxHistoryRepository.kt index 31a250f6f3..8c32f37312 100644 --- a/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/repository/TxHistoryRepository.kt +++ b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/repository/TxHistoryRepository.kt @@ -2,7 +2,6 @@ package com.tangem.domain.txhistory.repository import androidx.paging.PagingData import com.tangem.domain.models.currency.CryptoCurrency -import com.tangem.domain.models.network.Network import com.tangem.domain.models.network.TxInfo import com.tangem.domain.txhistory.models.TxHistoryListError import com.tangem.domain.txhistory.models.TxHistoryStateError @@ -22,7 +21,7 @@ interface TxHistoryRepository { refresh: Boolean, ): Flow> - fun getTxExploreUrl(txHash: String, networkId: Network.ID, currency: CryptoCurrency): String + fun getTxExploreUrl(txHash: String, currency: CryptoCurrency): String @Throws(TxHistoryListError::class) suspend fun getFixedSizeTxHistoryItems( diff --git a/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/usecase/GetExplorerTransactionUrlUseCase.kt b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/usecase/GetExplorerTransactionUrlUseCase.kt index f1077a0d22..27520c8d46 100644 --- a/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/usecase/GetExplorerTransactionUrlUseCase.kt +++ b/domain/txhistory/src/main/kotlin/com/tangem/domain/txhistory/usecase/GetExplorerTransactionUrlUseCase.kt @@ -4,19 +4,12 @@ import arrow.core.Either import arrow.core.raise.catch import arrow.core.raise.either import com.tangem.domain.models.currency.CryptoCurrency -import com.tangem.domain.models.network.Network import com.tangem.domain.txhistory.models.TxStatusError import com.tangem.domain.txhistory.repository.TxHistoryRepository -import javax.inject.Inject -class GetExplorerTransactionUrlUseCase @Inject constructor( - private val repository: TxHistoryRepository, -) { - operator fun invoke( - txHash: String, - networkId: Network.ID, - currency: CryptoCurrency, - ): Either { +class GetExplorerTransactionUrlUseCase(private val repository: TxHistoryRepository) { + + operator fun invoke(txHash: String, currency: CryptoCurrency): Either { return either { catch( block = { @@ -24,7 +17,7 @@ class GetExplorerTransactionUrlUseCase @Inject constructor( raise(TxStatusError.EmptyUrlError) } - repository.getTxExploreUrl(txHash, networkId, currency).ifEmpty { + repository.getTxExploreUrl(txHash, currency).ifEmpty { raise(TxStatusError.EmptyUrlError) } }, 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 3fb95ef65c..45bea2d435 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 @@ -482,7 +482,6 @@ internal class SendConfirmModel @Inject constructor( private fun updateTransactionStatus(txData: TransactionData.Uncompiled, txHash: String) { val txUrl = getExplorerTransactionUrlUseCase( txHash = txHash.ifEmpty { txData.hash.orEmpty() }, - networkId = cryptoCurrency.network.id, currency = cryptoCurrency, ).getOrNull().orEmpty() _uiState.update(SendConfirmSentStateTransformer(txData, txUrl)) 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 f71f93d745..62ee3117f2 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 @@ -334,7 +334,6 @@ internal class NFTSendConfirmModel @Inject constructor( private fun updateTransactionStatus(txData: TransactionData.Uncompiled) { val txUrl = getExplorerTransactionUrlUseCase( txHash = txData.hash.orEmpty(), - networkId = cryptoCurrency.network.id, currency = cryptoCurrency, ).getOrElse { "" } _uiState.update(NFTSendConfirmSentStateTransformer(txData, txUrl)) diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/helpers/P2PEthPoolTransactionSender.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/helpers/P2PEthPoolTransactionSender.kt index 672f9ea61c..c0235b3a91 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/helpers/P2PEthPoolTransactionSender.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/helpers/P2PEthPoolTransactionSender.kt @@ -76,7 +76,7 @@ internal class P2PEthPoolTransactionSender @AssistedInject constructor( ifRight = { broadcastResult -> val txUrl = getExplorerTransactionUrlUseCase( txHash = broadcastResult.hash, - networkId = cryptoCurrencyStatus.currency.network.id, + currency = cryptoCurrencyStatus.currency, ).getOrNull().orEmpty() balanceUpdater.updateAfterTransaction() 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 f1b004afe8..c0e37364e6 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 @@ -261,7 +261,7 @@ internal class StakeKitTransactionSender @AssistedInject constructor( val txUrl = getExplorerTransactionUrlUseCase( txHash = transactionHashes.last(), - networkId = cryptoCurrencyStatus.currency.network.id, + currency = cryptoCurrencyStatus.currency, ).getOrNull().orEmpty() balanceUpdater.updateAfterTransaction() diff --git a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/confirm/model/SendWithSwapConfirmModel.kt b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/confirm/model/SendWithSwapConfirmModel.kt index e537c5d4f5..d2d3497c2f 100644 --- a/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/confirm/model/SendWithSwapConfirmModel.kt +++ b/features/swap-v2/impl/src/main/java/com/tangem/features/swap/v2/impl/sendviaswap/confirm/model/SendWithSwapConfirmModel.kt @@ -329,7 +329,6 @@ internal class SendWithSwapConfirmModel @Inject constructor( onSendSuccess = { txHash, timestamp, data -> val txUrl = getExplorerTransactionUrlUseCase( txHash = txHash, - networkId = primaryCurrencyStatus.currency.network.id, currency = primaryCurrencyStatus.currency, ).getOrNull().orEmpty() sendSuccessAnalytics() 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 2362a1d4fb..9a4b5d8027 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 @@ -975,7 +975,6 @@ internal class SwapModel @Inject constructor( ) val url = getExplorerTransactionUrlUseCase( txHash = swapTransactionState.txHash, - networkId = fromCurrency.currency.network.id, currency = fromCurrency.currency, ).getOrElse { Timber.i("tx hash explore not supported") diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt index 89e4eaf9db..6a929eb75f 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/model/TokenDetailsModel.kt @@ -831,7 +831,6 @@ internal class TokenDetailsModel @Inject constructor( override fun onTransactionClick(txHash: String) { getExplorerTransactionUrlUseCase( txHash = txHash, - networkId = cryptoCurrency.network.id, currency = cryptoCurrency, ).fold( ifLeft = { Timber.e(it.toString()) }, diff --git a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt index 88c8216469..d587d9b46c 100644 --- a/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt +++ b/features/txhistory/impl/src/main/kotlin/com/tangem/features/txhistory/model/TxHistoryModel.kt @@ -221,7 +221,6 @@ internal class TxHistoryModel @Inject constructor( override fun openTxInExplorer(txHash: String) { getExplorerTransactionUrlUseCase( txHash = txHash, - networkId = params.currency.network.id, currency = params.currency, ).fold( ifLeft = { Timber.e(it.toString()) }, diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletContentClickIntents.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletContentClickIntents.kt index 59b10dac36..b9373e40e8 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletContentClickIntents.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/intents/WalletContentClickIntents.kt @@ -299,7 +299,6 @@ internal class WalletContentClickIntentsImplementor @Inject constructor( getExplorerTransactionUrlUseCase( txHash = txHash, - networkId = currency.network.id, currency = currency, ).fold( ifLeft = { Timber.e(it.toString()) },