Updated on 2026-08-14

This commit is contained in:
Tangem 2024-04-12 17:20:20 +05:00
parent 16c1a70a4b
commit 7d15269083
5 changed files with 44 additions and 11 deletions

View file

@ -9,6 +9,7 @@ import com.tangem.data.common.cache.CacheRegistry
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.common.extensions.fromNetworkId
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.domain.tokens.model.Network
import com.tangem.domain.txhistory.models.Page
@ -69,6 +70,7 @@ class DefaultTxHistoryRepository(
return pager.flow
}
@Deprecated("Replace with getTxExploreUrl [UserWalletId, Network] instead")
override fun getTxExploreUrl(txHash: String, networkId: Network.ID): String {
val blockchain = Blockchain.fromId(networkId.value)
return when (val txExploreState = blockchain.getExploreTxUrl(txHash)) {
@ -77,6 +79,19 @@ class DefaultTxHistoryRepository(
}
}
override suspend fun getTxExploreUrl(userWalletId: UserWalletId, network: Network): String {
val blockchain = Blockchain.fromNetworkId(network.id.value)
val walletManager = walletManagersFacade.getOrCreateWalletManager(
userWalletId = userWalletId,
network = network,
)
val lastTxHash = walletManager?.wallet?.recentTransactions?.last()?.hash.orEmpty()
return when (val txExploreState = blockchain?.getExploreTxUrl(lastTxHash)) {
is TxExploreState.Url -> txExploreState.url
else -> ""
}
}
override suspend fun getFixedSizeTxHistoryItems(
userWalletId: UserWalletId,
currency: CryptoCurrency,