Updated on 2026-08-14

This commit is contained in:
Tangem 2024-02-28 15:38:53 +00:00
parent e637ebdba0
commit 54cb670f22
3 changed files with 16 additions and 7 deletions

View file

@ -17,6 +17,7 @@ import com.tangem.blockchain.common.transaction.Fee
import com.tangem.blockchain.common.transaction.TransactionFee
import com.tangem.blockchain.extensions.Result
import com.tangem.blockchain.extensions.SimpleResult
import com.tangem.blockchain.externallinkprovider.TxExploreState
import com.tangem.blockchain.network.ResultChecker
import com.tangem.common.core.TangemSdkError
import com.tangem.common.extensions.hexToBytes
@ -117,7 +118,10 @@ class TransactionManagerImpl(
override fun getExplorerTransactionLink(networkId: String, txAddress: String): String {
val blockchain = Blockchain.fromNetworkId(networkId) ?: error("blockchain not found")
return blockchain.getExploreTxUrl(txAddress)
return when (val txUrlState = blockchain.getExploreTxUrl(txAddress)) {
TxExploreState.Unsupported -> ""
is TxExploreState.Url -> txUrlState.url
}
}
override fun getMemoExtras(networkId: String, memo: String?): TransactionExtras? {

View file

@ -4,6 +4,7 @@ import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.PagingData
import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchain.externallinkprovider.TxExploreState
import com.tangem.data.common.cache.CacheRegistry
import com.tangem.data.txhistory.repository.paging.TxHistoryPagingSource
import com.tangem.datasource.local.txhistory.TxHistoryItemsStore
@ -69,11 +70,9 @@ class DefaultTxHistoryRepository(
override fun getTxExploreUrl(txHash: String, networkId: Network.ID): String {
val blockchain = Blockchain.fromId(networkId.value)
// TODO: Fix ton tx urls [REDACTED_TASK_KEY]
return if (blockchain == Blockchain.TON || blockchain == Blockchain.TONTestnet) {
""
} else {
blockchain.getExploreTxUrl(txHash)
return when (val txExploreState = blockchain.getExploreTxUrl(txHash)) {
is TxExploreState.Url -> txExploreState.url
is TxExploreState.Unsupported -> ""
}
}

View file

@ -1,6 +1,7 @@
package com.tangem.data.visa.utils
import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchain.externallinkprovider.TxExploreState
import com.tangem.domain.visa.model.VisaTxDetails
import com.tangem.lib.visa.model.VisaTxHistoryResponse
@ -43,7 +44,12 @@ internal class VisaTxDetailsFactory {
txHash = request.txHash,
txStatus = request.txStatus,
fiatCurrency = findCurrencyByNumericCode(request.transactionCurrencyCode),
exploreUrl = request.txHash?.let(walletBlockchain::getExploreTxUrl),
exploreUrl = request.txHash?.let {
when (val txUrl = walletBlockchain.getExploreTxUrl(it)) {
is TxExploreState.Url -> txUrl.url
is TxExploreState.Unsupported -> ""
}
},
)
}
}