From 540ee066e2e4cfa9393708eb4daa7b84c993810b Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 5 Nov 2025 20:52:32 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../yield/supply/impl/common/entity/YieldSupplyFeeUM.kt | 2 ++ .../supply/impl/common/ui/YieldSupplyActionContent.kt | 1 + .../approve/model/YieldSupplyApproveModel.kt | 1 + .../feepolicy/ui/YieldSupplyFeePolicyContent.kt | 3 ++- .../startearning/model/YieldSupplyStartEarningModel.kt | 3 +++ .../YieldSupplyStartEarningFeeContentTransformer.kt | 9 +++++++-- .../YieldSupplyStopEarningFeeContentTransformer.kt | 1 + 7 files changed, 17 insertions(+), 3 deletions(-) diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/entity/YieldSupplyFeeUM.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/entity/YieldSupplyFeeUM.kt index ccc975f7ff..ee74e2b820 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/entity/YieldSupplyFeeUM.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/entity/YieldSupplyFeeUM.kt @@ -13,6 +13,8 @@ internal sealed class YieldSupplyFeeUM { data class Content( val transactionDataList: ImmutableList, val feeFiatValue: TextReference, + // TODO move to FeePolicyUM + val estimatedFiatValue: TextReference, val tokenFeeFiatValue: TextReference, val maxNetworkFeeFiatValue: TextReference, val minTopUpFiatValue: TextReference, diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/ui/YieldSupplyActionContent.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/ui/YieldSupplyActionContent.kt index abc8b25b63..177149a2f3 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/ui/YieldSupplyActionContent.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/common/ui/YieldSupplyActionContent.kt @@ -149,6 +149,7 @@ private class YieldSupplyActionContentPreviewProvider : PreviewParameterProvider maxNetworkFeeFiatValue = stringReference("$8.50"), minTopUpFiatValue = stringReference("$50"), feeNoteValue = TextReference.EMPTY, + estimatedFiatValue = TextReference.EMPTY, ), isPrimaryButtonEnabled = false, isTransactionSending = false, diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/approve/model/YieldSupplyApproveModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/approve/model/YieldSupplyApproveModel.kt index 3e43bf02a5..bb92b7315b 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/approve/model/YieldSupplyApproveModel.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/approve/model/YieldSupplyApproveModel.kt @@ -255,6 +255,7 @@ internal class YieldSupplyApproveModel @Inject constructor( maxNetworkFeeFiatValue = TextReference.EMPTY, minTopUpFiatValue = TextReference.EMPTY, feeNoteValue = TextReference.EMPTY, + estimatedFiatValue = TextReference.EMPTY, ), ) } diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/feepolicy/ui/YieldSupplyFeePolicyContent.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/feepolicy/ui/YieldSupplyFeePolicyContent.kt index e6f33bab56..ec32b8e52b 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/feepolicy/ui/YieldSupplyFeePolicyContent.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/feepolicy/ui/YieldSupplyFeePolicyContent.kt @@ -86,7 +86,7 @@ internal fun YieldSupplyFeePolicyContent( .padding(horizontal = 16.dp), ) { val currentFee = when (yieldSupplyFeeUM) { - is YieldSupplyFeeUM.Content -> yieldSupplyFeeUM.tokenFeeFiatValue + is YieldSupplyFeeUM.Content -> yieldSupplyFeeUM.estimatedFiatValue YieldSupplyFeeUM.Error -> stringReference(StringsSigns.DASH_SIGN) YieldSupplyFeeUM.Loading -> null } @@ -184,6 +184,7 @@ private fun YieldSupplyFeePolicyContent_Preview() { stringReference("2.46 USDT"), ), ), + estimatedFiatValue = stringReference("$8.50"), ), tokenSymbol = "USDT", modifier = Modifier.background(TangemTheme.colors.background.primary), diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt index 357bd430ee..c205b40b6b 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/YieldSupplyStartEarningModel.kt @@ -63,6 +63,7 @@ internal class YieldSupplyStartEarningModel @Inject constructor( private val yieldSupplyActivateUseCase: YieldSupplyActivateUseCase, private val yieldSupplyMinAmountUseCase: YieldSupplyMinAmountUseCase, private val yieldSupplyGetMaxFeeUseCase: YieldSupplyGetMaxFeeUseCase, + private val yieldSupplyGetCurrentFeeUseCase: YieldSupplyGetCurrentFeeUseCase, private val yieldSupplyRepository: YieldSupplyRepository, ) : Model(), YieldSupplyNotificationsComponent.ModelCallback { @@ -138,6 +139,7 @@ internal class YieldSupplyStartEarningModel @Inject constructor( } val maxFee = yieldSupplyGetMaxFeeUseCase(userWallet, cryptoCurrencyStatus).getOrNull() ?: return + val estimatedFee = yieldSupplyGetCurrentFeeUseCase(userWallet, cryptoCurrencyStatus).getOrNull() ?: return val transactionListData = yieldSupplyStartEarningUseCase( userWalletId = userWallet.walletId, @@ -187,6 +189,7 @@ internal class YieldSupplyStartEarningModel @Inject constructor( updatedTransactionList = updatedTransactionList, feeValue = feeSum, maxNetworkFee = maxFee, + estimatedFeeValue = estimatedFee, minAmount = minAmount, ), ) diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/transformers/YieldSupplyStartEarningFeeContentTransformer.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/transformers/YieldSupplyStartEarningFeeContentTransformer.kt index 19696a8a93..8c189f61d8 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/transformers/YieldSupplyStartEarningFeeContentTransformer.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/startearning/model/transformers/YieldSupplyStartEarningFeeContentTransformer.kt @@ -25,6 +25,7 @@ internal class YieldSupplyStartEarningFeeContentTransformer( private val appCurrency: AppCurrency, private val updatedTransactionList: List, private val feeValue: BigDecimal, + private val estimatedFeeValue: BigDecimal, private val maxNetworkFee: YieldSupplyMaxFee, private val minAmount: BigDecimal, ) : Transformer { @@ -36,11 +37,14 @@ internal class YieldSupplyStartEarningFeeContentTransformer( val feeFiat = feeFiatRate?.let(feeValue::multiply) val feeFiatValueText = feeFiat.format { fiat(appCurrency.code, appCurrency.symbol) } + val estimatedFeeFiat = feeFiatRate?.let(estimatedFeeValue::multiply) + val estimatedFeeFiatValueText = estimatedFeeFiat.format { fiat(appCurrency.code, appCurrency.symbol) } + val tokenCryptoFee = tokenFiatRate?.let { rate -> - feeFiat?.divide(rate, cryptoCurrency.decimals, RoundingMode.HALF_UP) + estimatedFeeFiat?.divide(rate, cryptoCurrency.decimals, RoundingMode.HALF_UP) } val tokenCryptoFeeValueText = tokenCryptoFee.format { crypto(cryptoCurrency) } - val tokenFiatFeeValueText = feeFiat.format { fiat(appCurrency.code, appCurrency.symbol) } + val tokenFiatFeeValueText = estimatedFeeFiat.format { fiat(appCurrency.code, appCurrency.symbol) } val maxFeeCryptoValueText = maxNetworkFee.tokenMaxFee.format { crypto(cryptoCurrency) } val maxFiatFeeValueText = maxNetworkFee.fiatMaxFee.format { fiat(appCurrency.code, appCurrency.symbol) } @@ -79,6 +83,7 @@ internal class YieldSupplyStartEarningFeeContentTransformer( minTopUpFiatValue = stringReference(minAmountFiatText), feeNoteValue = feeNoteValue, minFeeNoteValue = minFeeNoteValue, + estimatedFiatValue = stringReference(estimatedFeeFiatValueText), ), ) } diff --git a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/stopearning/model/transformer/YieldSupplyStopEarningFeeContentTransformer.kt b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/stopearning/model/transformer/YieldSupplyStopEarningFeeContentTransformer.kt index 0f37c2194d..6c1881f305 100644 --- a/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/stopearning/model/transformer/YieldSupplyStopEarningFeeContentTransformer.kt +++ b/features/yield-supply/impl/src/main/java/com/tangem/features/yield/supply/impl/subcomponents/stopearning/model/transformer/YieldSupplyStopEarningFeeContentTransformer.kt @@ -38,6 +38,7 @@ internal class YieldSupplyStopEarningFeeContentTransformer( maxNetworkFeeFiatValue = TextReference.EMPTY, minTopUpFiatValue = TextReference.EMPTY, feeNoteValue = TextReference.EMPTY, + estimatedFiatValue = TextReference.EMPTY, ), ) }