diff --git a/core/datasource/src/main/java/com/tangem/datasource/local/network/entity/NetworkStatusDM.kt b/core/datasource/src/main/java/com/tangem/datasource/local/network/entity/NetworkStatusDM.kt
index 8d7cd539c0..f05d2b8240 100644
--- a/core/datasource/src/main/java/com/tangem/datasource/local/network/entity/NetworkStatusDM.kt
+++ b/core/datasource/src/main/java/com/tangem/datasource/local/network/entity/NetworkStatusDM.kt
@@ -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,
diff --git a/data/networks/detekt-baseline-debug.xml b/data/networks/detekt-baseline-debug.xml
deleted file mode 100644
index 981dd137d6..0000000000
--- a/data/networks/detekt-baseline-debug.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- MultilineLambdaItParameter:CommonNetworkStatusFetcher.kt$CommonNetworkStatusFetcher${ Timber.e("Failed to fetch network status for $userWalletId [${network.rawId}]: $it") networksStatusesStore.setSourceAsOnlyCache(userWalletId = userWalletId, network = network) }
- MultilineLambdaItParameter:DefaultMultiNetworkStatusFetcher.kt$DefaultMultiNetworkStatusFetcher${ networksStatusesStore.setSourceAsOnlyCache( userWalletId = params.userWalletId, networks = params.networks, ) raise(it) }
- MultilineLambdaItParameter:DefaultNetworksRepository.kt$DefaultNetworksRepository${ Timber.e(it, "Unable to create wallet currencies") return emptyList() }
- MultilineLambdaItParameter:DefaultNetworksRepository.kt$DefaultNetworksRepository${ Timber.e(it, "Unable to create wallet currencies") return@withContext }
- 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, ) }
- MultilineLambdaItParameter:NetworkAmountsConverter.kt$NetworkAmountsConverter${ val currencyId = currencyIdConverter.convert(value = it.id) val amount = NetworkStatus.Amount.Loaded(value = it.amount) currencyId to amount }
- MultilineLambdaItParameter:NetworkStatusSupplierModule.kt$NetworkStatusSupplierModule.<no name provided>${ "single_network_status_${it.userWalletId.stringValue}_${it.network.rawId}_" + it.network.derivationPath.value }
- 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 }
- SuspendFunSwallowedCancellation:DefaultNetworksRepository.kt$DefaultNetworksRepository$runCatching
-
-
diff --git a/data/networks/src/main/java/com/tangem/data/networks/converters/NetworkAmountsConverter.kt b/data/networks/src/main/java/com/tangem/data/networks/converters/NetworkAmountsConverter.kt
index a2876c0071..dc74b16cd8 100644
--- a/data/networks/src/main/java/com/tangem/data/networks/converters/NetworkAmountsConverter.kt
+++ b/data/networks/src/main/java/com/tangem/data/networks/converters/NetworkAmountsConverter.kt
@@ -12,33 +12,33 @@ private typealias AmountsDomainModel = Map {
- 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,
)
}
diff --git a/data/networks/src/main/java/com/tangem/data/networks/converters/CurrencyIdConverter.kt b/data/networks/src/main/java/com/tangem/data/networks/converters/NetworkCurrencyIdConverter.kt
similarity index 86%
rename from data/networks/src/main/java/com/tangem/data/networks/converters/CurrencyIdConverter.kt
rename to data/networks/src/main/java/com/tangem/data/networks/converters/NetworkCurrencyIdConverter.kt
index 728b1db741..8bef0658ac 100644
--- a/data/networks/src/main/java/com/tangem/data/networks/converters/CurrencyIdConverter.kt
+++ b/data/networks/src/main/java/com/tangem/data/networks/converters/NetworkCurrencyIdConverter.kt
@@ -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 {
@@ -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)
}
}
}
\ No newline at end of file
diff --git a/data/networks/src/main/java/com/tangem/data/networks/converters/NetworkStatusDataModelConverter.kt b/data/networks/src/main/java/com/tangem/data/networks/converters/NetworkStatusDataModelConverter.kt
index d876b01234..7f0d1b6fd3 100644
--- a/data/networks/src/main/java/com/tangem/data/networks/converters/NetworkStatusDataModelConverter.kt
+++ b/data/networks/src/main/java/com/tangem/data/networks/converters/NetworkStatusDataModelConverter.kt
@@ -18,11 +18,11 @@ internal object NetworkStatusDataModelConverter : Converter
internal class NetworkYieldSupplyStatusConverter(
- rawNetworkId: String,
+ blockchainId: String,
derivationPath: Network.DerivationPath,
) : TwoWayConverter {
- 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
diff --git a/data/networks/src/main/java/com/tangem/data/networks/converters/SimpleNetworkStatusConverter.kt b/data/networks/src/main/java/com/tangem/data/networks/converters/SimpleNetworkStatusConverter.kt
index b82bfb9455..940cfdea59 100644
--- a/data/networks/src/main/java/com/tangem/data/networks/converters/SimpleNetworkStatusConverter.kt
+++ b/data/networks/src/main/java/com/tangem/data/networks/converters/SimpleNetworkStatusConverter.kt
@@ -25,15 +25,15 @@ internal object SimpleNetworkStatusConverter : Converter
+ 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}" },
- ) {}
+ )
}
}
\ No newline at end of file
diff --git a/data/networks/src/main/java/com/tangem/data/networks/multi/DefaultMultiNetworkStatusFetcher.kt b/data/networks/src/main/java/com/tangem/data/networks/multi/DefaultMultiNetworkStatusFetcher.kt
index b039edc5ba..e429c134da 100644
--- a/data/networks/src/main/java/com/tangem/data/networks/multi/DefaultMultiNetworkStatusFetcher.kt
+++ b/data/networks/src/main/java/com/tangem/data/networks/multi/DefaultMultiNetworkStatusFetcher.kt
@@ -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)
},
)
diff --git a/data/networks/src/main/java/com/tangem/data/networks/repository/DefaultNetworksRepository.kt b/data/networks/src/main/java/com/tangem/data/networks/repository/DefaultNetworksRepository.kt
index b5a2fb854c..defc120690 100644
--- a/data/networks/src/main/java/com/tangem/data/networks/repository/DefaultNetworksRepository.kt
+++ b/data/networks/src/main/java/com/tangem/data/networks/repository/DefaultNetworksRepository.kt
@@ -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 {
- 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 {
- 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? {
diff --git a/data/networks/src/test/java/com/tangem/data/networks/converters/NetworkAmountsConverterTest.kt b/data/networks/src/test/java/com/tangem/data/networks/converters/NetworkAmountsConverterTest.kt
index 5bbe4daf2d..4ca75519b9 100644
--- a/data/networks/src/test/java/com/tangem/data/networks/converters/NetworkAmountsConverterTest.kt
+++ b/data/networks/src/test/java/com/tangem/data/networks/converters/NetworkAmountsConverterTest.kt
@@ -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),
)
diff --git a/data/networks/src/test/java/com/tangem/data/networks/converters/CurrencyIdConverterTest.kt b/data/networks/src/test/java/com/tangem/data/networks/converters/NetworkCurrencyIdConverterTest.kt
similarity index 84%
rename from data/networks/src/test/java/com/tangem/data/networks/converters/CurrencyIdConverterTest.kt
rename to data/networks/src/test/java/com/tangem/data/networks/converters/NetworkCurrencyIdConverterTest.kt
index 9cdcc4810e..9e129e6cd4 100644
--- a/data/networks/src/test/java/com/tangem/data/networks/converters/CurrencyIdConverterTest.kt
+++ b/data/networks/src/test/java/com/tangem/data/networks/converters/NetworkCurrencyIdConverterTest.kt
@@ -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 = 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(
diff --git a/data/networks/src/test/java/com/tangem/data/networks/converters/NetworkStatusDataModelConverterTest.kt b/data/networks/src/test/java/com/tangem/data/networks/converters/NetworkStatusDataModelConverterTest.kt
index b995196d80..a667da490a 100644
--- a/data/networks/src/test/java/com/tangem/data/networks/converters/NetworkStatusDataModelConverterTest.kt
+++ b/data/networks/src/test/java/com/tangem/data/networks/converters/NetworkStatusDataModelConverterTest.kt
@@ -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"),
diff --git a/data/networks/src/test/java/com/tangem/data/networks/converters/NetworkYieldSupplyStatusConverterTest.kt b/data/networks/src/test/java/com/tangem/data/networks/converters/NetworkYieldSupplyStatusConverterTest.kt
index af36491079..b18f2e14d2 100644
--- a/data/networks/src/test/java/com/tangem/data/networks/converters/NetworkYieldSupplyStatusConverterTest.kt
+++ b/data/networks/src/test/java/com/tangem/data/networks/converters/NetworkYieldSupplyStatusConverterTest.kt
@@ -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
diff --git a/domain/models/src/main/kotlin/com/tangem/domain/models/network/Network.kt b/domain/models/src/main/kotlin/com/tangem/domain/models/network/Network.kt
index 489ede3a4d..028a16d2a2 100644
--- a/domain/models/src/main/kotlin/com/tangem/domain/models/network/Network.kt
+++ b/domain/models/src/main/kotlin/com/tangem/domain/models/network/Network.kt
@@ -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
diff --git a/domain/networks/detekt-baseline-main.xml b/domain/networks/detekt-baseline-main.xml
deleted file mode 100644
index eaf966bb38..0000000000
--- a/domain/networks/detekt-baseline-main.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
- UnnecessaryAbstractClass:MultiNetworkStatusSupplier.kt$MultiNetworkStatusSupplier$MultiNetworkStatusSupplier
- UnnecessaryAbstractClass:SingleNetworkStatusSupplier.kt$SingleNetworkStatusSupplier$SingleNetworkStatusSupplier
-
-
diff --git a/domain/networks/src/main/java/com/tangem/domain/networks/multi/MultiNetworkStatusSupplier.kt b/domain/networks/src/main/java/com/tangem/domain/networks/multi/MultiNetworkStatusSupplier.kt
index 65d7623cdc..ea96369684 100644
--- a/domain/networks/src/main/java/com/tangem/domain/networks/multi/MultiNetworkStatusSupplier.kt
+++ b/domain/networks/src/main/java/com/tangem/domain/networks/multi/MultiNetworkStatusSupplier.kt
@@ -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>()
\ No newline at end of file
diff --git a/domain/networks/src/main/java/com/tangem/domain/networks/single/SingleNetworkStatusSupplier.kt b/domain/networks/src/main/java/com/tangem/domain/networks/single/SingleNetworkStatusSupplier.kt
index 8fc7770c0f..117216c91f 100644
--- a/domain/networks/src/main/java/com/tangem/domain/networks/single/SingleNetworkStatusSupplier.kt
+++ b/domain/networks/src/main/java/com/tangem/domain/networks/single/SingleNetworkStatusSupplier.kt
@@ -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()
\ No newline at end of file
diff --git a/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainUtils.kt b/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainUtils.kt
index fe00a42eb6..f3e5669802 100644
--- a/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainUtils.kt
+++ b/libs/crypto/src/main/java/com/tangem/lib/crypto/BlockchainUtils.kt
@@ -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