Updated on 2026-08-14

This commit is contained in:
Tangem 2026-04-10 14:20:59 +04:00
parent d0ef5c70cd
commit 948a63d6b6
19 changed files with 117 additions and 133 deletions

View file

@ -29,11 +29,12 @@ sealed interface NetworkStatusDM {
/**
* Verified
*
* @property networkId network id
* @property derivationPath derivation path
* @property selectedAddress selected address
* @property availableAddresses available addresses
* @property amounts amounts
* @property networkId network id
* @property derivationPath derivation path
* @property selectedAddress selected address
* @property availableAddresses available addresses
* @property amounts amounts
* @property yieldSupplyStatuses yield supply statuses
*/
@NameLabel("amounts")
data class Verified(
@ -65,6 +66,11 @@ sealed interface NetworkStatusDM {
@Json(name = "error_message") val errorMessage: String,
) : NetworkStatusDM
/**
* Id
*
* @property value blockchain id [com.tangem.blockchain.common.Blockchain.id]
*/
@JsonClass(generateAdapter = true)
data class ID(
@Json(name = "value") val value: String,

View file

@ -1,15 +0,0 @@
<?xml version="1.0" ?>
<SmellBaseline>
<ManuallySuppressedIssues/>
<CurrentIssues>
<ID>MultilineLambdaItParameter:CommonNetworkStatusFetcher.kt$CommonNetworkStatusFetcher${ Timber.e("Failed to fetch network status for $userWalletId [${network.rawId}]: $it") networksStatusesStore.setSourceAsOnlyCache(userWalletId = userWalletId, network = network) }</ID>
<ID>MultilineLambdaItParameter:DefaultMultiNetworkStatusFetcher.kt$DefaultMultiNetworkStatusFetcher${ networksStatusesStore.setSourceAsOnlyCache( userWalletId = params.userWalletId, networks = params.networks, ) raise(it) }</ID>
<ID>MultilineLambdaItParameter:DefaultNetworksRepository.kt$DefaultNetworksRepository${ Timber.e(it, "Unable to create wallet currencies") return emptyList() }</ID>
<ID>MultilineLambdaItParameter:DefaultNetworksRepository.kt$DefaultNetworksRepository${ Timber.e(it, "Unable to create wallet currencies") return@withContext }</ID>
<ID>MultilineLambdaItParameter:NetworkAmountsConverter.kt$NetworkAmountsConverter${ val amount = it.value as? NetworkStatus.Amount.Loaded ?: return@mapNotNull null CurrencyAmount( id = currencyIdConverter.convertBack(value = it.key), amount = amount.value, ) }</ID>
<ID>MultilineLambdaItParameter:NetworkAmountsConverter.kt$NetworkAmountsConverter${ val currencyId = currencyIdConverter.convert(value = it.id) val amount = NetworkStatus.Amount.Loaded(value = it.amount) currencyId to amount }</ID>
<ID>MultilineLambdaItParameter:NetworkStatusSupplierModule.kt$NetworkStatusSupplierModule.&lt;no name provided&gt;${ "single_network_status_${it.userWalletId.stringValue}_${it.network.rawId}_" + it.network.derivationPath.value }</ID>
<ID>MultilineLambdaItParameter:NetworkYieldSupplyStatusConverter.kt$NetworkYieldSupplyStatusConverter${ val id = currencyIdConverter.convert(value = it.id) val status = YieldSupplyStatus( isActive = it.isActive, isInitialized = it.isInitialized, isAllowedToSpend = it.isAllowedToSpend, effectiveProtocolBalance = it.effectiveProtocolBalance, ) id to status }</ID>
<ID>SuspendFunSwallowedCancellation:DefaultNetworksRepository.kt$DefaultNetworksRepository$runCatching</ID>
</CurrentIssues>
</SmellBaseline>

View file

@ -12,33 +12,33 @@ private typealias AmountsDomainModel = Map<CryptoCurrency.ID, NetworkStatus.Amou
/**
* Converter from [AmountsDataModel] to [AmountsDomainModel] and vice versa
*
* @param rawNetworkId the raw network ID associated with the currency
* @param blockchainId the blockchain ID associated with the network (e.g. `Blockchain.id`)
* @param derivationPath the derivation path used for the network
*
[REDACTED_AUTHOR]
*/
internal class NetworkAmountsConverter(
rawNetworkId: String,
blockchainId: String,
derivationPath: Network.DerivationPath,
) : TwoWayConverter<AmountsDataModel, AmountsDomainModel> {
private val currencyIdConverter = CurrencyIdConverter(rawNetworkId, derivationPath)
private val currencyIdConverter = NetworkCurrencyIdConverter(blockchainId, derivationPath)
override fun convert(value: AmountsDataModel): AmountsDomainModel {
return value.associate {
val currencyId = currencyIdConverter.convert(value = it.id)
val amount = NetworkStatus.Amount.Loaded(value = it.amount)
return value.associate { currencyAmount ->
val currencyId = currencyIdConverter.convert(value = currencyAmount.id)
val amount = NetworkStatus.Amount.Loaded(value = currencyAmount.amount)
currencyId to amount
}
}
override fun convertBack(value: AmountsDomainModel): AmountsDataModel {
return value.mapNotNull {
val amount = it.value as? NetworkStatus.Amount.Loaded ?: return@mapNotNull null
return value.mapNotNull { (currencyId, networkAmount) ->
val amount = networkAmount as? NetworkStatus.Amount.Loaded ?: return@mapNotNull null
CurrencyAmount(
id = currencyIdConverter.convertBack(value = it.key),
id = currencyIdConverter.convertBack(value = currencyId),
amount = amount.value,
)
}

View file

@ -1,6 +1,6 @@
package com.tangem.data.networks.converters
import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchainsdk.utils.toBlockchain
import com.tangem.blockchainsdk.utils.toCoinId
import com.tangem.datasource.local.network.entity.NetworkStatusDM.CurrencyId
import com.tangem.datasource.local.network.entity.NetworkStatusDM.CurrencyId.Companion.CONTRACT_ADDRESS_DELIMITER
@ -12,13 +12,13 @@ import com.tangem.domain.models.currency.CryptoCurrency.ID.Suffix as CurrencyIdS
/**
* Converts between [CurrencyId] and [CryptoCurrency.ID].
*
* @property rawNetworkId the raw network ID associated with the currency
* @property blockchainId the blockchain ID associated with the currency
* @property derivationPath the derivation path used for the network
*
[REDACTED_AUTHOR]
*/
internal class CurrencyIdConverter(
private val rawNetworkId: String,
internal class NetworkCurrencyIdConverter(
private val blockchainId: String,
private val derivationPath: Network.DerivationPath,
) : TwoWayConverter<CurrencyId, CryptoCurrency.ID> {
@ -31,7 +31,7 @@ internal class CurrencyIdConverter(
return if (contractAddress.isNullOrBlank()) {
getCoinId(
coinId = rawId.takeUnless { it.isNullOrBlank() }
?: error("Coin id is null for $rawNetworkId with $derivationPath"),
?: error("Coin id is null for $blockchainId with $derivationPath"),
)
} else {
getTokenId(
@ -43,14 +43,12 @@ internal class CurrencyIdConverter(
override fun convertBack(value: CryptoCurrency.ID): CurrencyId {
return if (value.isCoin) {
CurrencyId.createCoinId(
coinId = Blockchain.fromId(value.rawNetworkId).toCoinId(),
)
CurrencyId.createCoinId(coinId = value.toBlockchain().toCoinId())
} else {
CurrencyId.createTokenId(
rawTokenId = value.rawCurrencyId?.value,
contractAddress = requireNotNull(value.contractAddress) {
"Token contractAddress is null for token id: $this"
"Token contractAddress is null for token id: $value"
},
)
}
@ -82,17 +80,17 @@ internal class CurrencyIdConverter(
return when (derivationPath) {
is Network.DerivationPath.Card -> {
CryptoCurrency.ID.Body.NetworkIdWithDerivationPath(
rawId = rawNetworkId,
rawId = blockchainId,
derivationPath = derivationPath.value,
)
}
is Network.DerivationPath.Custom -> {
CryptoCurrency.ID.Body.NetworkIdWithDerivationPath(
rawId = rawNetworkId,
rawId = blockchainId,
derivationPath = derivationPath.value,
)
}
is Network.DerivationPath.None -> CryptoCurrency.ID.Body.NetworkId(rawNetworkId)
is Network.DerivationPath.None -> CryptoCurrency.ID.Body.NetworkId(blockchainId)
}
}
}

View file

@ -18,11 +18,11 @@ internal object NetworkStatusDataModelConverter : Converter<NetworkStatus, Netwo
val address = NetworkAddressConverter.convertBack(value = status.address)
val blockchainId = value.network.toBlockchain().id
val amountsConverter = NetworkAmountsConverter(
rawNetworkId = blockchainId,
blockchainId = blockchainId,
derivationPath = value.network.derivationPath,
)
val yieldSupplyStatusConverter = NetworkYieldSupplyStatusConverter(
rawNetworkId = blockchainId,
blockchainId = blockchainId,
derivationPath = value.network.derivationPath,
)

View file

@ -10,20 +10,20 @@ private typealias YieldSupplyStatusDataModel = List<NetworkStatusDM.YieldSupplyS
private typealias YieldSupplyStatusDomainModel = Map<CryptoCurrency.ID, YieldSupplyStatus?>
internal class NetworkYieldSupplyStatusConverter(
rawNetworkId: String,
blockchainId: String,
derivationPath: Network.DerivationPath,
) : TwoWayConverter<YieldSupplyStatusDataModel, YieldSupplyStatusDomainModel> {
private val currencyIdConverter = CurrencyIdConverter(rawNetworkId, derivationPath)
private val currencyIdConverter = NetworkCurrencyIdConverter(blockchainId, derivationPath)
override fun convert(value: YieldSupplyStatusDataModel): YieldSupplyStatusDomainModel {
return value.associate {
val id = currencyIdConverter.convert(value = it.id)
return value.associate { yieldSupplyStatus ->
val id = currencyIdConverter.convert(value = yieldSupplyStatus.id)
val status = YieldSupplyStatus(
isActive = it.isActive,
isInitialized = it.isInitialized,
isAllowedToSpend = it.isAllowedToSpend,
effectiveProtocolBalance = it.effectiveProtocolBalance,
isActive = yieldSupplyStatus.isActive,
isInitialized = yieldSupplyStatus.isInitialized,
isAllowedToSpend = yieldSupplyStatus.isAllowedToSpend,
effectiveProtocolBalance = yieldSupplyStatus.effectiveProtocolBalance,
)
id to status

View file

@ -25,15 +25,15 @@ internal object SimpleNetworkStatusConverter : Converter<NetworkStatusDM, Simple
)
val derivationPath = NetworkDerivationPathConverter.convert(value = value.derivationPath)
val rawNetworkId = value.networkId.value
val blockchainId = value.networkId.value
val amountsConverter = NetworkAmountsConverter(
rawNetworkId = rawNetworkId,
blockchainId = blockchainId,
derivationPath = derivationPath,
)
val yieldSupplyStatusConverter = NetworkYieldSupplyStatusConverter(
rawNetworkId = rawNetworkId,
blockchainId = blockchainId,
derivationPath = derivationPath,
)
@ -57,11 +57,9 @@ internal object SimpleNetworkStatusConverter : Converter<NetworkStatusDM, Simple
}
}
val rawId = Blockchain.fromId(rawNetworkId).toNetworkId()
return SimpleNetworkStatus(
id = Network.ID(
value = rawId,
value = Blockchain.fromId(blockchainId).toNetworkId(),
derivationPath = NetworkDerivationPathConverter.convert(value = value.derivationPath),
),
value = status,

View file

@ -17,21 +17,26 @@ internal object NetworkStatusSupplierModule {
@Provides
@Singleton
fun provideSingleNetworkStatusSupplier(factory: SingleNetworkStatusProducer.Factory): SingleNetworkStatusSupplier {
return object : SingleNetworkStatusSupplier(
return SingleNetworkStatusSupplier(
factory = factory,
keyCreator = {
"single_network_status_${it.userWalletId.stringValue}_${it.network.rawId}_" +
it.network.derivationPath.value
keyCreator = { params ->
listOf(
"single_network_status",
params.userWalletId.stringValue,
params.network.rawId,
params.network.derivationPath.value,
)
.joinToString(separator = "_")
},
) {}
)
}
@Provides
@Singleton
fun provideMultiNetworkStatusSupplier(factory: MultiNetworkStatusProducer.Factory): MultiNetworkStatusSupplier {
return object : MultiNetworkStatusSupplier(
return MultiNetworkStatusSupplier(
factory = factory,
keyCreator = { "multi_networks_statuses_${it.userWalletId.stringValue}" },
) {}
)
}
}

View file

@ -40,13 +40,13 @@ internal class DefaultMultiNetworkStatusFetcher @Inject constructor(
val networksCurrencies = catch(
block = { createNetworksCurrenciesMap(params) },
catch = {
catch = { error ->
networksStatusesStore.setSourceAsOnlyCache(
userWalletId = params.userWalletId,
networks = params.networks,
)
raise(it)
raise(error)
},
)

View file

@ -11,6 +11,7 @@ import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.networks.repository.NetworksRepository
import com.tangem.domain.walletmanager.WalletManagersFacade
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import com.tangem.utils.coroutines.runSuspendCatching
import com.tangem.utils.logging.TangemLogger
import kotlinx.coroutines.withContext
@ -33,13 +34,12 @@ internal class DefaultNetworksRepository(
override suspend fun fetchPendingTransactions(userWalletId: UserWalletId, network: Network) {
withContext(dispatchers.default) {
val currencies = runCatching {
val currencies = runSuspendCatching {
cardCryptoCurrencyFactory.create(userWalletId = userWalletId, network = network)
}.getOrElse { error ->
TangemLogger.e("Unable to create wallet currencies", error)
return@withContext
}
.getOrElse { error ->
TangemLogger.e("Unable to create wallet currencies", error)
return@withContext
}
fetchPendingTransactions(userWalletId = userWalletId, network = network, currencies = currencies)
}
@ -49,34 +49,34 @@ internal class DefaultNetworksRepository(
userWalletId: UserWalletId,
network: Network,
): List<CryptoCurrencyAddress> {
return runCatching { cardCryptoCurrencyFactory.create(userWalletId = userWalletId, network = network) }
.getOrElse { error ->
TangemLogger.e("Unable to create wallet currencies", error)
return emptyList()
}
.map { currency ->
CryptoCurrencyAddress(
cryptoCurrency = currency,
address = getDefaultAddress(userWalletId, network).orEmpty(),
)
}
return runSuspendCatching {
cardCryptoCurrencyFactory.create(userWalletId = userWalletId, network = network)
}.getOrElse { error ->
TangemLogger.e("Unable to create wallet currencies", error)
return emptyList()
}.map { currency ->
CryptoCurrencyAddress(
cryptoCurrency = currency,
address = getDefaultAddress(userWalletId, network).orEmpty(),
)
}
}
override suspend fun getNetworkAddresses(
userWalletId: UserWalletId,
network: Network.RawID,
): List<CryptoCurrencyAddress> {
return runCatching { cardCryptoCurrencyFactory.createByRawId(userWalletId = userWalletId, network = network) }
.getOrElse { error ->
TangemLogger.e("Unable to create wallet currencies", error)
return emptyList()
}
.map { currency ->
CryptoCurrencyAddress(
cryptoCurrency = currency,
address = getDefaultAddress(userWalletId, currency.network).orEmpty(),
)
}
return runSuspendCatching {
cardCryptoCurrencyFactory.createByRawId(userWalletId = userWalletId, network = network)
}.getOrElse { error ->
TangemLogger.e("Unable to create wallet currencies", error)
return emptyList()
}.map { currency ->
CryptoCurrencyAddress(
cryptoCurrency = currency,
address = getDefaultAddress(userWalletId, currency.network).orEmpty(),
)
}
}
override suspend fun getDefaultAddress(userWalletId: UserWalletId, network: Network): String? {

View file

@ -16,10 +16,10 @@ import java.math.BigDecimal
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
internal class NetworkAmountsConverterTest {
private val rawNetworkId = "ETH"
private val rawNetworkId = "ethereum"
private val derivationPath = Network.DerivationPath.Card(value = "m/44'/60'/0'/0/0")
private val derivationPathHashCode = "-1843072795"
private val converter = NetworkAmountsConverter(rawNetworkId = rawNetworkId, derivationPath = derivationPath)
private val converter = NetworkAmountsConverter(blockchainId = rawNetworkId, derivationPath = derivationPath)
@Test
fun convert() {
@ -47,12 +47,12 @@ internal class NetworkAmountsConverterTest {
// Assert
val expected = mapOf(
ID.fromValue("coin⟨ETH$derivationPathHashCode⟩ethereum") to Loaded(value = BigDecimal.ONE),
ID.fromValue("coin⟨ethereum$derivationPathHashCode⟩ethereum") to Loaded(value = BigDecimal.ONE),
ID.fromValue(
value = "token⟨ETH$derivationPathHashCode⟩usdt⚓0xdAC17F958D2ee523a2206206994597C13D831ec7",
value = "token⟨ethereum$derivationPathHashCode⟩usdt⚓0xdAC17F958D2ee523a2206206994597C13D831ec7",
) to Loaded(value = BigDecimal.ZERO),
ID.fromValue(
value = "token⟨ETH$derivationPathHashCode⟩0xdAC17F958D2ee523a2206206994597C13D831ec7",
value = "token⟨ethereum$derivationPathHashCode⟩0xdAC17F958D2ee523a2206206994597C13D831ec7",
) to Loaded(value = BigDecimal.TEN),
)
@ -63,12 +63,12 @@ internal class NetworkAmountsConverterTest {
fun convertBack() {
// Arrange
val value = mapOf(
ID.fromValue("coin⟨ETH$derivationPathHashCode⟩ethereum") to Loaded(value = BigDecimal.ONE),
ID.fromValue("coin⟨ethereum$derivationPathHashCode⟩ethereum") to Loaded(value = BigDecimal.ONE),
ID.fromValue(
value = "token⟨ETH$derivationPathHashCode⟩usdt⚓0xdAC17F958D2ee523a2206206994597C13D831ec7",
value = "token⟨ethereum$derivationPathHashCode⟩usdt⚓0xdAC17F958D2ee523a2206206994597C13D831ec7",
) to Loaded(value = BigDecimal.ZERO),
ID.fromValue(
value = "token⟨ETH$derivationPathHashCode⟩0xdAC17F958D2ee523a2206206994597C13D831ec7",
value = "token⟨ethereum$derivationPathHashCode⟩0xdAC17F958D2ee523a2206206994597C13D831ec7",
) to Loaded(value = BigDecimal.TEN),
)

View file

@ -13,12 +13,12 @@ import org.junit.jupiter.params.ParameterizedTest
[REDACTED_AUTHOR]
*/
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class CurrencyIdConverterTest {
class NetworkCurrencyIdConverterTest {
private val rawNetworkId = "ETH"
private val rawNetworkId = "ethereum"
private val derivationPath = Network.DerivationPath.Card(value = "m/44'/60'/0'/0/0")
private val derivationPathHashCode = "-1843072795"
private val converter = CurrencyIdConverter(rawNetworkId = rawNetworkId, derivationPath = derivationPath)
private val converter = NetworkCurrencyIdConverter(blockchainId = rawNetworkId, derivationPath = derivationPath)
@Nested
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@ -48,7 +48,7 @@ class CurrencyIdConverterTest {
ConvertModel(
value = CurrencyId.createCoinId("ethereum"),
expected = Result.success(
CryptoCurrency.ID.fromValue(value = "coin⟨ETH$derivationPathHashCode⟩ethereum"),
CryptoCurrency.ID.fromValue(value = "coin⟨ethereum$derivationPathHashCode⟩ethereum"),
),
),
ConvertModel(
@ -71,7 +71,7 @@ class CurrencyIdConverterTest {
),
expected = Result.success(
CryptoCurrency.ID.fromValue(
value = "token⟨ETH$derivationPathHashCode⟩usdt⚓0xdAC17F958D2ee523a2206206994597C13D831ec7",
value = "token⟨ethereum$derivationPathHashCode⟩usdt⚓0xdAC17F958D2ee523a2206206994597C13D831ec7",
),
),
),
@ -82,7 +82,7 @@ class CurrencyIdConverterTest {
),
expected = Result.success(
CryptoCurrency.ID.fromValue(
value = "token⟨ETH$derivationPathHashCode⟩0xdAC17F958D2ee523a2206206994597C13D831ec7",
value = "token⟨ethereum$derivationPathHashCode⟩0xdAC17F958D2ee523a2206206994597C13D831ec7",
),
),
),
@ -93,7 +93,7 @@ class CurrencyIdConverterTest {
),
expected = Result.success(
CryptoCurrency.ID.fromValue(
value = "token⟨ETH$derivationPathHashCode⟩0xdAC17F958D2ee523a2206206994597C13D831ec7",
value = "token⟨ethereum$derivationPathHashCode⟩0xdAC17F958D2ee523a2206206994597C13D831ec7",
),
),
),
@ -104,7 +104,7 @@ class CurrencyIdConverterTest {
),
expected = Result.success(
CryptoCurrency.ID.fromValue(
value = "token⟨ETH$derivationPathHashCode⟩0xdAC17F958D2ee523a2206206994597C13D831ec7",
value = "token⟨ethereum$derivationPathHashCode⟩0xdAC17F958D2ee523a2206206994597C13D831ec7",
),
),
),
@ -114,7 +114,7 @@ class CurrencyIdConverterTest {
contractAddress = "",
),
expected = Result.success(
CryptoCurrency.ID.fromValue(value = "coin⟨ETH$derivationPathHashCode⟩usdt"),
CryptoCurrency.ID.fromValue(value = "coin⟨ethereum$derivationPathHashCode⟩usdt"),
),
),
ConvertModel(
@ -123,7 +123,7 @@ class CurrencyIdConverterTest {
contractAddress = " ",
),
expected = Result.success(
CryptoCurrency.ID.fromValue(value = "coin⟨ETH$derivationPathHashCode⟩usdt"),
CryptoCurrency.ID.fromValue(value = "coin⟨ethereum$derivationPathHashCode⟩usdt"),
),
),
)
@ -154,14 +154,14 @@ class CurrencyIdConverterTest {
private fun provideTestModels(): Collection<ConvertBackModel> = listOf(
ConvertBackModel(
value = CryptoCurrency.ID.fromValue("coin⟨ETH$derivationPathHashCode⟩ethereum"),
value = CryptoCurrency.ID.fromValue("coin⟨ethereum$derivationPathHashCode⟩ethereum"),
expected = Result.success(
CurrencyId.createCoinId("ethereum"),
),
),
ConvertBackModel(
value = CryptoCurrency.ID.fromValue(
value = "token⟨ETH$derivationPathHashCode⟩usdt⚓0xdAC17F958D2ee523a2206206994597C13D831ec7",
value = "token⟨ethereum$derivationPathHashCode⟩usdt⚓0xdAC17F958D2ee523a2206206994597C13D831ec7",
),
expected = Result.success(
CurrencyId.createTokenId(
@ -172,7 +172,7 @@ class CurrencyIdConverterTest {
),
ConvertBackModel(
value = CryptoCurrency.ID.fromValue(
value = "token⟨ETH$derivationPathHashCode⟩0xdAC17F958D2ee523a2206206994597C13D831ec7",
value = "token⟨ethereum$derivationPathHashCode⟩0xdAC17F958D2ee523a2206206994597C13D831ec7",
),
expected = Result.success(
CurrencyId.createTokenId(

View file

@ -50,7 +50,7 @@ internal class NetworkStatusDataModelConverterTest {
),
),
amounts = mapOf(
ID.fromValue(value = "coin⟨ETH→0⟩ethereum") to Amount.Loaded(value = BigDecimal.ZERO),
ID.fromValue(value = "coin⟨ethereum→0⟩ethereum") to Amount.Loaded(value = BigDecimal.ZERO),
ID(
prefix = Prefix.COIN_PREFIX,
body = Body.NetworkId(rawId = "BTC"),

View file

@ -13,7 +13,7 @@ import java.math.BigDecimal
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
internal class NetworkYieldSupplyStatusConverterTest {
private val rawNetworkId = "ETH"
private val rawNetworkId = "ethereum"
private val derivationPath = Network.DerivationPath.Card(value = "m/44'/60'/0'/0/0")
private val derivationPathHashCode = "-1843072795"
private val converter = NetworkYieldSupplyStatusConverter(rawNetworkId, derivationPath)
@ -38,8 +38,8 @@ internal class NetworkYieldSupplyStatusConverterTest {
// Assert
val expected = mapOf(
ID.fromValue("coin⟨ETH$derivationPathHashCode⟩ethereum") to domainStatus,
ID.fromValue("token⟨ETH$derivationPathHashCode⟩usdt⚓0x1") to domainStatus,
ID.fromValue("coin⟨ethereum$derivationPathHashCode⟩ethereum") to domainStatus,
ID.fromValue("token⟨ethereum$derivationPathHashCode⟩usdt⚓0x1") to domainStatus,
)
Truth.assertThat(actual).containsExactlyEntriesIn(expected)
@ -49,9 +49,9 @@ internal class NetworkYieldSupplyStatusConverterTest {
fun convertBack() {
// Arrange
val value = mapOf(
ID.fromValue("coin⟨ETH$derivationPathHashCode⟩ethereum") to domainStatus,
ID.fromValue("token⟨ETH$derivationPathHashCode⟩usdt⚓0x1") to domainStatus,
ID.fromValue("token⟨ETH$derivationPathHashCode⟩usdc⚓0x1") to null,
ID.fromValue("coin⟨ethereum$derivationPathHashCode⟩ethereum") to domainStatus,
ID.fromValue("token⟨ethereum$derivationPathHashCode⟩usdt⚓0x1") to domainStatus,
ID.fromValue("token⟨ethereum$derivationPathHashCode⟩usdc⚓0x1") to null,
)
// Act

View file

@ -47,7 +47,7 @@ data class Network(
/**
* Represents a unique identifier for a blockchain network
*
* @property rawId raw network ID
* @property rawId raw network ID (backend id)
* @property derivationPath derivation path
*/
@Serializable

View file

@ -1,8 +0,0 @@
<?xml version="1.0" ?>
<SmellBaseline>
<ManuallySuppressedIssues/>
<CurrentIssues>
<ID>UnnecessaryAbstractClass:MultiNetworkStatusSupplier.kt$MultiNetworkStatusSupplier$MultiNetworkStatusSupplier</ID>
<ID>UnnecessaryAbstractClass:SingleNetworkStatusSupplier.kt$SingleNetworkStatusSupplier$SingleNetworkStatusSupplier</ID>
</CurrentIssues>
</SmellBaseline>

View file

@ -11,7 +11,7 @@ import com.tangem.domain.models.network.NetworkStatus
*
[REDACTED_AUTHOR]
*/
abstract class MultiNetworkStatusSupplier(
open class MultiNetworkStatusSupplier(
override val factory: MultiNetworkStatusProducer.Factory,
override val keyCreator: (MultiNetworkStatusProducer.Params) -> String,
) : FlowCachingSupplier<MultiNetworkStatusProducer, MultiNetworkStatusProducer.Params, Set<NetworkStatus>>()

View file

@ -11,7 +11,7 @@ import com.tangem.domain.models.network.NetworkStatus
*
[REDACTED_AUTHOR]
*/
abstract class SingleNetworkStatusSupplier(
open class SingleNetworkStatusSupplier(
override val factory: SingleNetworkStatusProducer.Factory,
override val keyCreator: (SingleNetworkStatusProducer.Params) -> String,
) : FlowCachingSupplier<SingleNetworkStatusProducer, SingleNetworkStatusProducer.Params, NetworkStatus>()

View file

@ -42,7 +42,7 @@ object BlockchainUtils {
return blockchain == Blockchain.Bitcoin || blockchain == Blockchain.BitcoinTestnet
}
/** Checks if the current [blockchainId] uses a custom fee converter */
/** Checks if the current [networkId] uses a custom fee converter */
fun isUseBitcoinFeeConverter(networkId: String): Boolean {
val blockchain = networkId.toBlockchain()
return isBitcoin(networkId) || blockchain == Blockchain.Fact0rn