From f9226ab6bf8fb017a65febaee1a60cb84e866fd5 Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 6 Feb 2026 13:54:38 +0500 Subject: [PATCH] Updated on 2026-08-14 --- common/build.gradle.kts | 4 ++ .../tangem/common/CryptoCurrencyStatusExt.kt | 33 ++++++++++++++++ .../com/tangem/common}/StakingBalanceExt.kt | 2 +- common/ui/build.gradle.kts | 1 + .../ui/tokens/TokenItemStateConverter.kt | 39 ++++++------------- data/tokens/build.gradle.kts | 1 + .../DefaultCurrencyChecksRepository.kt | 2 +- domain/tokens/build.gradle.kts | 1 + .../tokens/operations/TokenListFactory.kt | 16 ++------ .../operations/TotalFiatBalanceCalculator.kt | 2 +- .../OnrampTokenItemStateConverterFactory.kt | 18 +++++++-- .../referral/model/AccountAwardConverter.kt | 18 +++++++-- .../impl/presentation/model/StakingModel.kt | 2 +- .../converters/AccountTokenItemConverter.kt | 18 +++++++-- ...TokenDetailsBalanceSelectStateConverter.kt | 2 +- .../TokenDetailsLoadedBalanceConverter.kt | 2 +- .../TokenDetailsStakingInfoConverter.kt | 4 +- .../CryptoCurrencyToDraggableItemConverter.kt | 2 +- ...ryptoCurrencyToDraggableItemConverterV2.kt | 2 +- 19 files changed, 106 insertions(+), 63 deletions(-) create mode 100644 common/src/main/kotlin/com/tangem/common/CryptoCurrencyStatusExt.kt rename {domain/staking/src/main/java/com/tangem/domain/staking/utils => common/src/main/kotlin/com/tangem/common}/StakingBalanceExt.kt (98%) diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 055efc6a2a..30cd9f7258 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -13,6 +13,10 @@ android { dependencies { implementation(projects.core.utils) + api(projects.domain.models) + api(projects.domain.appCurrency.models) + api(projects.domain.staking.models) + api(projects.libs.crypto) // region Firebase libraries implementation(platform(deps.firebase.bom)) diff --git a/common/src/main/kotlin/com/tangem/common/CryptoCurrencyStatusExt.kt b/common/src/main/kotlin/com/tangem/common/CryptoCurrencyStatusExt.kt new file mode 100644 index 0000000000..038cdc2eba --- /dev/null +++ b/common/src/main/kotlin/com/tangem/common/CryptoCurrencyStatusExt.kt @@ -0,0 +1,33 @@ +package com.tangem.common + +import com.tangem.domain.models.currency.CryptoCurrencyStatus +import com.tangem.domain.models.staking.StakingBalance +import com.tangem.utils.extensions.orZero +import java.math.BigDecimal + +/** + * Calculates the total fiat amount by adding the main fiat amount and the fiat value of the staked balance. + */ +fun CryptoCurrencyStatus.getTotalFiatAmount(): BigDecimal? { + val fiatAmount = value.fiatAmount + + val fiatStakedBalance = value.fiatRate?.times(getStakedBalance().orZero()) ?: return fiatAmount + val totalAmount = fiatAmount?.plus(fiatStakedBalance) ?: return fiatStakedBalance + + return totalAmount +} + +/** + * Calculates the total cryptocurrency amount by adding the main crypto amount and the staked balance. + */ +fun CryptoCurrencyStatus.getTotalCryptoAmount(): BigDecimal? { + val cryptoAmount = value.amount + + val cryptoStakedBalance = getStakedBalance() ?: return cryptoAmount + val totalAmount = cryptoAmount?.plus(cryptoStakedBalance) ?: return cryptoStakedBalance + + return totalAmount +} + +private fun CryptoCurrencyStatus.getStakedBalance() = (value.stakingBalance as? StakingBalance.Data) + ?.getTotalWithRewardsStakingBalance(blockchainId = currency.network.rawId) \ No newline at end of file diff --git a/domain/staking/src/main/java/com/tangem/domain/staking/utils/StakingBalanceExt.kt b/common/src/main/kotlin/com/tangem/common/StakingBalanceExt.kt similarity index 98% rename from domain/staking/src/main/java/com/tangem/domain/staking/utils/StakingBalanceExt.kt rename to common/src/main/kotlin/com/tangem/common/StakingBalanceExt.kt index 66c7a151db..9994416d24 100644 --- a/domain/staking/src/main/java/com/tangem/domain/staking/utils/StakingBalanceExt.kt +++ b/common/src/main/kotlin/com/tangem/common/StakingBalanceExt.kt @@ -1,4 +1,4 @@ -package com.tangem.domain.staking.utils +package com.tangem.common import com.tangem.domain.models.staking.BalanceType import com.tangem.domain.models.staking.StakingBalance diff --git a/common/ui/build.gradle.kts b/common/ui/build.gradle.kts index 9583112c85..1714d0affb 100644 --- a/common/ui/build.gradle.kts +++ b/common/ui/build.gradle.kts @@ -9,6 +9,7 @@ android { } dependencies { + api(projects.common) /** Compose */ implementation(deps.compose.material3) diff --git a/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenItemStateConverter.kt b/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenItemStateConverter.kt index 6211063758..4ffc157fb0 100644 --- a/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenItemStateConverter.kt +++ b/common/ui/src/main/java/com/tangem/common/ui/tokens/TokenItemStateConverter.kt @@ -1,5 +1,7 @@ package com.tangem.common.ui.tokens +import com.tangem.common.getTotalCryptoAmount +import com.tangem.common.getTotalFiatAmount import com.tangem.common.ui.R import com.tangem.core.ui.components.currency.icon.CurrencyIconState import com.tangem.core.ui.components.currency.icon.converter.CryptoCurrencyToIconStateConverter @@ -25,11 +27,8 @@ import com.tangem.domain.staking.model.StakingAvailability import com.tangem.domain.staking.model.StakingOption import com.tangem.domain.staking.model.common.RewardInfo import com.tangem.domain.staking.model.common.RewardType -import com.tangem.domain.staking.utils.getTotalWithRewardsStakingBalance import com.tangem.lib.crypto.BlockchainUtils -import com.tangem.utils.StringsSigns.DASH_SIGN import com.tangem.utils.converter.Converter -import com.tangem.utils.extensions.orZero import kotlinx.collections.immutable.toImmutableList import java.math.BigDecimal @@ -156,29 +155,6 @@ class TokenItemStateConverter( } companion object { - - fun CryptoCurrencyStatus.getFormattedFiatAmount(appCurrency: AppCurrency): String { - val fiatAmount = value.fiatAmount ?: return DASH_SIGN - - val fiatYieldBalance = value.fiatRate?.times(getStakedBalance()).orZero() - val totalAmount = fiatAmount.plus(fiatYieldBalance) - - return totalAmount.format { - fiat(fiatCurrencyCode = appCurrency.code, fiatCurrencySymbol = appCurrency.symbol) - } - } - - fun CryptoCurrencyStatus.getFormattedCryptoAmount(): String { - val cryptoAmount = value.amount ?: return DASH_SIGN - - val totalAmount = cryptoAmount.plus(getStakedBalance()) - - return totalAmount.format { crypto(currency) } - } - - private fun CryptoCurrencyStatus.getStakedBalance() = (value.stakingBalance as? StakingBalance.Data) - ?.getTotalWithRewardsStakingBalance(blockchainId = currency.network.rawId).orZero() - private fun createTitleState( currencyStatus: CryptoCurrencyStatus, yieldModuleApyMap: Map, @@ -348,7 +324,9 @@ class TokenItemStateConverter( is CryptoCurrencyStatus.NoAccount, -> { TokenItemState.Subtitle2State.TextContent( - text = status.getFormattedCryptoAmount(), + text = status.getTotalCryptoAmount().format { + crypto(status.currency) + }, isFlickering = status.value.isFlickering(), ) } @@ -371,7 +349,12 @@ class TokenItemStateConverter( is CryptoCurrencyStatus.NoAccount, -> { TokenItemState.FiatAmountState.Content( - text = status.getFormattedFiatAmount(appCurrency = appCurrency), + text = status.getTotalFiatAmount().format { + fiat( + fiatCurrencyCode = appCurrency.code, + fiatCurrencySymbol = appCurrency.symbol, + ) + }, isFlickering = status.value.isFlickering(), icons = buildList { if (status.value.yieldSupplyStatus?.isActive == true && diff --git a/data/tokens/build.gradle.kts b/data/tokens/build.gradle.kts index 171fb3f750..1a97b297ef 100644 --- a/data/tokens/build.gradle.kts +++ b/data/tokens/build.gradle.kts @@ -44,6 +44,7 @@ dependencies { implementation(projects.core.datasource) implementation(projects.core.utils) implementation(projects.libs.blockchainSdk) + implementation(projects.common) // endregion // region Project - Features API diff --git a/data/tokens/src/main/kotlin/com/tangem/data/tokens/repository/DefaultCurrencyChecksRepository.kt b/data/tokens/src/main/kotlin/com/tangem/data/tokens/repository/DefaultCurrencyChecksRepository.kt index a24dc8b95b..b1ecc1457c 100644 --- a/data/tokens/src/main/kotlin/com/tangem/data/tokens/repository/DefaultCurrencyChecksRepository.kt +++ b/data/tokens/src/main/kotlin/com/tangem/data/tokens/repository/DefaultCurrencyChecksRepository.kt @@ -3,13 +3,13 @@ package com.tangem.data.tokens.repository import com.tangem.blockchain.blockchains.ethereum.eip1559.isGaslessTxSupported import com.tangem.blockchain.blockchains.polkadot.ExistentialDepositProvider import com.tangem.blockchain.common.* +import com.tangem.common.getTotalStakingBalance import com.tangem.data.tokens.converters.UtxoConverter import com.tangem.domain.models.currency.CryptoCurrency import com.tangem.domain.models.currency.CryptoCurrencyStatus import com.tangem.domain.models.network.Network import com.tangem.domain.models.staking.StakingBalance import com.tangem.domain.models.wallet.UserWalletId -import com.tangem.domain.staking.utils.getTotalStakingBalance import com.tangem.domain.tokens.model.CurrencyAmount import com.tangem.domain.tokens.model.blockchains.UtxoAmountLimit import com.tangem.domain.tokens.model.warnings.CryptoCurrencyWarning diff --git a/domain/tokens/build.gradle.kts b/domain/tokens/build.gradle.kts index 005eba3ef1..c2a83d7894 100644 --- a/domain/tokens/build.gradle.kts +++ b/domain/tokens/build.gradle.kts @@ -46,6 +46,7 @@ dependencies { implementation(projects.core.configToggles) implementation(projects.core.utils) implementation(projects.libs.crypto) + implementation(projects.common) /** Android - Other */ implementation(deps.androidx.paging.runtime) diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TokenListFactory.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TokenListFactory.kt index 14fb123230..987cc6b547 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TokenListFactory.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TokenListFactory.kt @@ -2,16 +2,14 @@ package com.tangem.domain.tokens.operations import arrow.core.NonEmptyList import arrow.core.toNonEmptyListOrNull +import com.tangem.common.getTotalFiatAmount import com.tangem.domain.models.TokensGroupType import com.tangem.domain.models.TokensSortType import com.tangem.domain.models.TotalFiatBalance import com.tangem.domain.models.currency.CryptoCurrencyStatus -import com.tangem.domain.models.staking.StakingBalance import com.tangem.domain.models.tokenlist.TokenList import com.tangem.domain.models.tokenlist.TokenList.GroupedByNetwork.NetworkGroup -import com.tangem.domain.staking.utils.getTotalWithRewardsStakingBalance import com.tangem.utils.extensions.orZero -import java.math.BigDecimal /** * This factory creates a [TokenList] based on the provided list of [CryptoCurrencyStatus], [TokensGroupType], @@ -103,7 +101,7 @@ object TokenListFactory { if (hasLoading) return this sortedByDescending { group -> - group.currencies.sumOf { it.calculateBalance() } + group.currencies.sumOf { it.getTotalFiatAmount().orZero() } } } } @@ -117,16 +115,8 @@ object TokenListFactory { if (hasLoading) return this - sortedByDescending { it.calculateBalance() } + sortedByDescending { it.getTotalFiatAmount().orZero() } } } } - - private fun CryptoCurrencyStatus.calculateBalance(): BigDecimal { - val stakingBalance = value.stakingBalance as? StakingBalance.Data - val totalStakingBalance = stakingBalance?.getTotalWithRewardsStakingBalance(currency.network.rawId).orZero() - val totalFiatStakingBalance = totalStakingBalance.multiply(value.fiatRate.orZero()) - - return value.fiatAmount?.plus(totalFiatStakingBalance).orZero() - } } \ No newline at end of file diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TotalFiatBalanceCalculator.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TotalFiatBalanceCalculator.kt index db2f29b764..a36b6672f3 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TotalFiatBalanceCalculator.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/TotalFiatBalanceCalculator.kt @@ -2,13 +2,13 @@ package com.tangem.domain.tokens.operations import arrow.core.NonEmptyList import arrow.core.toNonEmptyListOrNull +import com.tangem.common.getTotalWithRewardsStakingBalance import com.tangem.domain.models.StatusSource import com.tangem.domain.models.TotalFiatBalance import com.tangem.domain.models.currency.CryptoCurrencyStatus import com.tangem.domain.models.getResultStatusSource import com.tangem.domain.models.staking.StakingBalance import com.tangem.domain.models.tokenlist.TokenList -import com.tangem.domain.staking.utils.getTotalWithRewardsStakingBalance import com.tangem.lib.crypto.BlockchainUtils import com.tangem.utils.extensions.orZero import java.math.BigDecimal diff --git a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/tokenlist/entity/utils/OnrampTokenItemStateConverterFactory.kt b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/tokenlist/entity/utils/OnrampTokenItemStateConverterFactory.kt index 44bf47cd76..7939ad13ad 100644 --- a/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/tokenlist/entity/utils/OnrampTokenItemStateConverterFactory.kt +++ b/features/onramp/impl/src/main/kotlin/com/tangem/features/onramp/tokenlist/entity/utils/OnrampTokenItemStateConverterFactory.kt @@ -1,13 +1,16 @@ package com.tangem.features.onramp.tokenlist.entity.utils +import com.tangem.common.getTotalCryptoAmount +import com.tangem.common.getTotalFiatAmount import com.tangem.common.ui.tokens.TokenItemStateConverter -import com.tangem.common.ui.tokens.TokenItemStateConverter.Companion.getFormattedCryptoAmount -import com.tangem.common.ui.tokens.TokenItemStateConverter.Companion.getFormattedFiatAmount import com.tangem.common.ui.tokens.TokenItemStateConverter.Companion.isFlickering import com.tangem.core.ui.components.currency.icon.converter.CryptoCurrencyToIconStateConverter import com.tangem.core.ui.components.token.state.TokenItemState import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.stringReference +import com.tangem.core.ui.format.bigdecimal.crypto +import com.tangem.core.ui.format.bigdecimal.fiat +import com.tangem.core.ui.format.bigdecimal.format import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.models.currency.CryptoCurrencyStatus @@ -112,7 +115,9 @@ internal object OnrampTokenItemStateConverterFactory { is CryptoCurrencyStatus.NoAccount, -> { TokenItemState.Subtitle2State.TextContent( - text = status.getFormattedCryptoAmount(), + text = status.getTotalCryptoAmount().format { + crypto(cryptoCurrency = status.currency) + }, isFlickering = status.value.isFlickering(), ) } @@ -136,7 +141,12 @@ internal object OnrampTokenItemStateConverterFactory { is CryptoCurrencyStatus.NoAccount, -> { TokenItemState.FiatAmountState.TextContent( - text = status.getFormattedFiatAmount(appCurrency = appCurrency), + text = status.getTotalFiatAmount().format { + fiat( + fiatCurrencyCode = appCurrency.code, + fiatCurrencySymbol = appCurrency.symbol, + ) + }, isAvailable = isAvailable, isFlickering = status.value.isFlickering(), ) diff --git a/features/referral/impl/src/main/java/com/tangem/feature/referral/model/AccountAwardConverter.kt b/features/referral/impl/src/main/java/com/tangem/feature/referral/model/AccountAwardConverter.kt index e5ad207a29..cc1e154773 100644 --- a/features/referral/impl/src/main/java/com/tangem/feature/referral/model/AccountAwardConverter.kt +++ b/features/referral/impl/src/main/java/com/tangem/feature/referral/model/AccountAwardConverter.kt @@ -1,14 +1,17 @@ package com.tangem.feature.referral.model +import com.tangem.common.getTotalCryptoAmount +import com.tangem.common.getTotalFiatAmount import com.tangem.common.ui.account.CryptoPortfolioIconConverter import com.tangem.common.ui.account.PortfolioSelectUM import com.tangem.common.ui.account.toUM -import com.tangem.common.ui.tokens.TokenItemStateConverter.Companion.getFormattedCryptoAmount -import com.tangem.common.ui.tokens.TokenItemStateConverter.Companion.getFormattedFiatAmount import com.tangem.common.ui.tokens.TokenItemStateConverter.Companion.isFlickering import com.tangem.core.ui.components.currency.icon.converter.CryptoCurrencyToIconStateConverter import com.tangem.core.ui.components.token.state.TokenItemState import com.tangem.core.ui.extensions.stringReference +import com.tangem.core.ui.format.bigdecimal.crypto +import com.tangem.core.ui.format.bigdecimal.fiat +import com.tangem.core.ui.format.bigdecimal.format import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.models.account.AccountStatus import com.tangem.domain.models.currency.CryptoCurrency @@ -35,10 +38,17 @@ internal class AccountAwardConverter( iconState = CryptoCurrencyToIconStateConverter().convert(currency), titleState = TokenItemState.TitleState.Content(stringReference(currency.name)), fiatAmountState = TokenItemState.FiatAmountState.Content( - text = accountAwardToken.getFormattedFiatAmount(appCurrency = appCurrency), + text = accountAwardToken.getTotalFiatAmount().format { + fiat( + fiatCurrencyCode = appCurrency.code, + fiatCurrencySymbol = appCurrency.symbol, + ) + }, ), subtitle2State = TokenItemState.Subtitle2State.TextContent( - text = accountAwardToken.getFormattedCryptoAmount(), + text = accountAwardToken.getTotalCryptoAmount().format { + crypto(cryptoCurrency = currency) + }, isFlickering = accountAwardToken.value.isFlickering(), ), subtitleState = TokenItemState.SubtitleState.TextContent(stringReference(currency.symbol)), diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/model/StakingModel.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/model/StakingModel.kt index a70dfc89f5..3ace74e0f1 100644 --- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/model/StakingModel.kt +++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/model/StakingModel.kt @@ -5,6 +5,7 @@ import arrow.core.getOrElse import com.tangem.blockchain.common.TransactionData import com.tangem.blockchain.common.transaction.Fee import com.tangem.blockchain.common.transaction.TransactionFee +import com.tangem.common.getValidatorsCount import com.tangem.common.routing.AppRouter import com.tangem.common.ui.amountScreen.converters.AmountReduceByTransformer import com.tangem.common.ui.amountScreen.converters.AmountReduceByTransformer.ReduceByData @@ -53,7 +54,6 @@ import com.tangem.domain.staking.model.stakekit.action.StakingAction import com.tangem.domain.staking.model.stakekit.action.StakingActionCommonType import com.tangem.domain.staking.model.stakekit.transaction.StakingTransaction import com.tangem.domain.staking.repositories.P2PEthPoolRepository -import com.tangem.domain.staking.utils.getValidatorsCount import com.tangem.domain.tokens.* import com.tangem.domain.transaction.error.GetFeeError import com.tangem.domain.transaction.usecase.* diff --git a/features/swap/impl/src/main/java/com/tangem/feature/swap/converters/AccountTokenItemConverter.kt b/features/swap/impl/src/main/java/com/tangem/feature/swap/converters/AccountTokenItemConverter.kt index 4315d780ac..adcecd045b 100644 --- a/features/swap/impl/src/main/java/com/tangem/feature/swap/converters/AccountTokenItemConverter.kt +++ b/features/swap/impl/src/main/java/com/tangem/feature/swap/converters/AccountTokenItemConverter.kt @@ -1,15 +1,18 @@ package com.tangem.feature.swap.converters +import com.tangem.common.getTotalCryptoAmount +import com.tangem.common.getTotalFiatAmount import com.tangem.common.ui.account.AccountCryptoPortfolioItemStateConverter import com.tangem.common.ui.tokens.TokenItemStateConverter -import com.tangem.common.ui.tokens.TokenItemStateConverter.Companion.getFormattedCryptoAmount -import com.tangem.common.ui.tokens.TokenItemStateConverter.Companion.getFormattedFiatAmount import com.tangem.common.ui.tokens.TokenItemStateConverter.Companion.isFlickering import com.tangem.core.ui.components.currency.icon.converter.CryptoCurrencyToIconStateConverter import com.tangem.core.ui.components.token.state.TokenItemState import com.tangem.core.ui.components.tokenlist.state.TokensListItemUM import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.stringReference +import com.tangem.core.ui.format.bigdecimal.crypto +import com.tangem.core.ui.format.bigdecimal.fiat +import com.tangem.core.ui.format.bigdecimal.format import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.models.TotalFiatBalance import com.tangem.domain.models.currency.CryptoCurrencyStatus @@ -108,7 +111,9 @@ internal class AccountTokenItemConverter( is CryptoCurrencyStatus.NoAccount, -> { TokenItemState.Subtitle2State.TextContent( - text = status.getFormattedCryptoAmount(), + text = status.getTotalCryptoAmount().format { + crypto(cryptoCurrency = status.currency) + }, isFlickering = status.value.isFlickering(), ) } @@ -132,7 +137,12 @@ internal class AccountTokenItemConverter( is CryptoCurrencyStatus.NoAccount, -> { TokenItemState.FiatAmountState.TextContent( - text = status.getFormattedFiatAmount(appCurrency = appCurrency), + text = status.getTotalFiatAmount().format { + fiat( + fiatCurrencyCode = appCurrency.code, + fiatCurrencySymbol = appCurrency.symbol, + ) + }, isAvailable = isAvailable, isFlickering = status.value.isFlickering(), ) diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsBalanceSelectStateConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsBalanceSelectStateConverter.kt index 0f9a0741ac..4bc8dfbebf 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsBalanceSelectStateConverter.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsBalanceSelectStateConverter.kt @@ -1,12 +1,12 @@ package com.tangem.feature.tokendetails.presentation.tokendetails.state.factory +import com.tangem.common.getTotalWithRewardsStakingBalance import com.tangem.core.ui.format.bigdecimal.crypto import com.tangem.core.ui.format.bigdecimal.fiat import com.tangem.core.ui.format.bigdecimal.format import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.models.currency.CryptoCurrencyStatus import com.tangem.domain.models.staking.StakingBalance -import com.tangem.domain.staking.utils.getTotalWithRewardsStakingBalance import com.tangem.feature.tokendetails.presentation.tokendetails.state.* import com.tangem.feature.tokendetails.presentation.tokendetails.state.utils.getBalance import com.tangem.utils.Provider diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt index 44384391ba..0b10013609 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsLoadedBalanceConverter.kt @@ -1,6 +1,7 @@ package com.tangem.feature.tokendetails.presentation.tokendetails.state.factory import arrow.core.Either +import com.tangem.common.getTotalWithRewardsStakingBalance import com.tangem.core.ui.components.marketprice.MarketPriceBlockState import com.tangem.core.ui.components.marketprice.PriceChangeState import com.tangem.core.ui.components.marketprice.PriceChangeType @@ -10,7 +11,6 @@ import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.models.StatusSource import com.tangem.domain.models.currency.CryptoCurrencyStatus import com.tangem.domain.models.staking.StakingBalance -import com.tangem.domain.staking.utils.getTotalWithRewardsStakingBalance import com.tangem.domain.tokens.error.CurrencyStatusError import com.tangem.feature.tokendetails.presentation.tokendetails.model.TokenDetailsClickIntents import com.tangem.feature.tokendetails.presentation.tokendetails.state.BalanceType diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsStakingInfoConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsStakingInfoConverter.kt index ebf27e2456..4d2e2e0835 100644 --- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsStakingInfoConverter.kt +++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenDetailsStakingInfoConverter.kt @@ -1,5 +1,7 @@ package com.tangem.feature.tokendetails.presentation.tokendetails.state.factory +import com.tangem.common.getRewardStakingBalance +import com.tangem.common.getTotalStakingBalance import com.tangem.core.ui.extensions.TextReference import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.extensions.stringReference @@ -13,8 +15,6 @@ import com.tangem.domain.models.staking.RewardBlockType import com.tangem.domain.models.staking.StakingBalance import com.tangem.domain.staking.model.StakingAvailability import com.tangem.domain.staking.model.StakingEntryInfo -import com.tangem.domain.staking.utils.getRewardStakingBalance -import com.tangem.domain.staking.utils.getTotalStakingBalance import com.tangem.feature.tokendetails.presentation.tokendetails.model.TokenDetailsClickIntents import com.tangem.feature.tokendetails.presentation.tokendetails.state.IconState import com.tangem.feature.tokendetails.presentation.tokendetails.state.StakingBlockUM diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/organizetokens/utils/converter/items/CryptoCurrencyToDraggableItemConverter.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/organizetokens/utils/converter/items/CryptoCurrencyToDraggableItemConverter.kt index 4955e962ed..79ea585f1d 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/organizetokens/utils/converter/items/CryptoCurrencyToDraggableItemConverter.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/organizetokens/utils/converter/items/CryptoCurrencyToDraggableItemConverter.kt @@ -1,5 +1,6 @@ package com.tangem.feature.wallet.presentation.organizetokens.utils.converter.items +import com.tangem.common.getTotalWithRewardsStakingBalance import com.tangem.core.ui.components.currency.icon.converter.CryptoCurrencyToIconStateConverter import com.tangem.core.ui.components.token.state.TokenItemState import com.tangem.core.ui.extensions.stringReference @@ -9,7 +10,6 @@ import com.tangem.core.ui.format.bigdecimal.format import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.models.currency.CryptoCurrencyStatus import com.tangem.domain.models.staking.StakingBalance -import com.tangem.domain.staking.utils.getTotalWithRewardsStakingBalance import com.tangem.feature.wallet.presentation.organizetokens.model.DraggableItem import com.tangem.feature.wallet.presentation.organizetokens.utils.common.getGroupHeaderId import com.tangem.feature.wallet.presentation.organizetokens.utils.common.getTokenItemId diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/organizetokens/utils/converter/items/CryptoCurrencyToDraggableItemConverterV2.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/organizetokens/utils/converter/items/CryptoCurrencyToDraggableItemConverterV2.kt index 2851d268b6..478351d5dc 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/organizetokens/utils/converter/items/CryptoCurrencyToDraggableItemConverterV2.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/organizetokens/utils/converter/items/CryptoCurrencyToDraggableItemConverterV2.kt @@ -10,7 +10,7 @@ import com.tangem.domain.account.status.model.AccountCryptoCurrencyStatus import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.models.currency.CryptoCurrencyStatus import com.tangem.domain.models.staking.StakingBalance -import com.tangem.domain.staking.utils.getTotalWithRewardsStakingBalance +import com.tangem.common.getTotalWithRewardsStakingBalance import com.tangem.feature.wallet.presentation.organizetokens.model.DraggableItem import com.tangem.feature.wallet.presentation.organizetokens.utils.common.getGroupHeaderId import com.tangem.feature.wallet.presentation.organizetokens.utils.common.getTokenItemId