Updated on 2026-08-14

This commit is contained in:
Tangem 2025-05-19 16:17:51 +04:00
parent 4c8537529a
commit 33b7a53905
37 changed files with 396 additions and 365 deletions

View file

@ -2,11 +2,11 @@ package com.tangem.data.networks.utils
import com.tangem.domain.models.StatusSource
import com.tangem.domain.models.network.Network
import com.tangem.domain.models.network.TxInfo
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.domain.tokens.model.CryptoCurrencyAmountStatus
import com.tangem.domain.tokens.model.NetworkAddress
import com.tangem.domain.tokens.model.NetworkStatus
import com.tangem.domain.txhistory.models.TxHistoryItem
import com.tangem.domain.walletmanager.model.Address
import com.tangem.domain.walletmanager.model.CryptoCurrencyAmount
import com.tangem.domain.walletmanager.model.CryptoCurrencyTransaction
@ -116,7 +116,7 @@ object NetworkStatusFactory {
private fun formatTransactions(
transactions: Set<CryptoCurrencyTransaction>,
currencies: Set<CryptoCurrency>,
): Map<CryptoCurrency.ID, Set<TxHistoryItem>> {
): Map<CryptoCurrency.ID, Set<TxInfo>> {
if (transactions.isEmpty()) return emptyMap()
return currencies
@ -137,8 +137,8 @@ object NetworkStatusFactory {
.toMap()
}
private fun createCurrentTransactions(transactions: Set<CryptoCurrencyTransaction>): Set<TxHistoryItem> {
return transactions.mapTo(hashSetOf()) { it.txHistoryItem }
private fun createCurrentTransactions(transactions: Set<CryptoCurrencyTransaction>): Set<TxInfo> {
return transactions.mapTo(hashSetOf()) { it.txInfo }
}
private fun getNetworkAddress(selectedAddress: String, availableAddresses: Set<Address>): NetworkAddress {

View file

@ -6,11 +6,11 @@ import com.tangem.common.test.domain.token.MockCryptoCurrencyFactory
import com.tangem.common.test.domain.walletmanager.MockUpdateWalletManagerResultFactory
import com.tangem.domain.models.StatusSource
import com.tangem.domain.models.network.Network
import com.tangem.domain.models.network.TxInfo
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.domain.tokens.model.CryptoCurrencyAmountStatus
import com.tangem.domain.tokens.model.NetworkAddress
import com.tangem.domain.tokens.model.NetworkStatus
import com.tangem.domain.txhistory.models.TxHistoryItem
import com.tangem.domain.walletmanager.model.Address
import com.tangem.domain.walletmanager.model.UpdateWalletManagerResult
import org.junit.Test
@ -57,17 +57,17 @@ internal class NetworkStatusFactoryTest(private val model: Model) {
val currencies = with(MockCryptoCurrencyFactory()) { setOf(ethereum, createToken(Blockchain.Ethereum)) }
val txHistoryItem = TxHistoryItem(
val txInfo = TxInfo(
txHash = "erroribus",
timestampInMillis = 2771,
isOutgoing = false,
destinationType = TxHistoryItem.DestinationType.Single(
addressType = TxHistoryItem.AddressType.User("0x1"),
destinationType = TxInfo.DestinationType.Single(
addressType = TxInfo.AddressType.User("0x1"),
),
sourceType = TxHistoryItem.SourceType.Single("0x2"),
sourceType = TxInfo.SourceType.Single("0x2"),
interactionAddressType = null,
status = TxHistoryItem.TransactionStatus.Confirmed,
type = TxHistoryItem.TransactionType.Transfer,
status = TxInfo.TransactionStatus.Confirmed,
type = TxInfo.TransactionType.Transfer,
amount = BigDecimal.ONE,
)
@ -218,7 +218,7 @@ internal class NetworkStatusFactoryTest(private val model: Model) {
currencies.last().id to CryptoCurrencyAmountStatus.NotFound,
),
pendingTransactions = mapOf(
currencies.first().id to setOf(txHistoryItem),
currencies.first().id to setOf(txInfo),
currencies.last().id to setOf(),
),
source = StatusSource.ACTUAL,