diff --git a/core/res/src/main/res/values-de/strings.xml b/core/res/src/main/res/values-de/strings.xml
index 21258cdee1..cc74abea34 100644
--- a/core/res/src/main/res/values-de/strings.xml
+++ b/core/res/src/main/res/values-de/strings.xml
@@ -835,8 +835,8 @@
Wallet-Einstellungen
Tangem
Verwende %s oder scanne eine Karte, um den Zugriff auf deine Wallet freizuschalten.
- Die Genehmigung des Swaps ist im Gange und wird in Kürze abgeschlossen sein.
- Genehmigung in Arbeit
+ Das Genehmigungsverfahren ist derzeit im Gange und wird in Kürze abgeschlossen sein
+ Genehmigung läuft
Es scheint, dass die Aktivierung der Karte nicht korrekt abgeschlossen wurde. Dies kann an einem Problem mit dem NFC-Modul deines Gerätes oder an einem falschen Tippen der Karte auf dein Gerät liegen. Bitte wende dich an unser Support-Team, um Unterstützung zu erhalten.
Aktivierungsfehler
Laut den Entwicklern des BNB-Netzes wird die Unterstützung für den BEP-2-Standard im Juni 2024 enden. Um den Verlust von Vermögenswerten mit diesem Standard zu vermeiden, konvertiere bitte in den BEP-20 Standard. Nutze gerne unseren Swap-Service, um sie auf das BNB Smart Chain Netzwerk zu übertragen.
@@ -854,12 +854,16 @@
Netzwerk erfordert eine Mindesteinzahlung
Der Swap wird nach Abschluss der Transaktion %s verfügbar sein.
Du hast aktive Transaktion
+ Die Genehmigung des Swaps ist im Gange und wird in Kürze abgeschlossen sein.
+ Genehmigung in Arbeit
Der Mindestbetrag für den Tausch beträgt %1$s. Bitte stelle sicher, dass der Restsaldo nach dem Swap nicht unter %2$s liegt.
Du hast keine %s Coins in deiner Liste
Keine Token zum Tauschen verfügbar
Um eine Transaktion durchzuführen, du etwas etwas einzahlen %1$s %2$s
Die Gebühr %s kann nicht gedeckt werden
Der zu erhaltende Betrag muss mindestens %s betragen
+ Dies kann passieren, weil der Anbieter derzeit nicht in der Lage ist, dein ausgewähltes Paar zu swappen. Bitte warte einen Moment und versuche es später erneut. (Code %@)
+ Ausgewähltes Paar vorübergehend nicht verfügbar
Service vorübergehend nicht verfügbar
Die Menge der zu tauschenden Token darf folgende Werte nicht überschreiten %s
Der zu tauschende Betrag muss mindestens %s betragen
diff --git a/core/res/src/main/res/values-ja/strings.xml b/core/res/src/main/res/values-ja/strings.xml
index 046d0156bc..70892f297f 100644
--- a/core/res/src/main/res/values-ja/strings.xml
+++ b/core/res/src/main/res/values-ja/strings.xml
@@ -98,6 +98,7 @@
有効にする
有効
エラー
+ 交換
移動する
取引履歴を調べる
エクスプローラー
@@ -823,8 +824,8 @@
ウォレット設定
Tangem
%sを使用するか、カードをスキャンしてウォレットにアクセスしてください
- スワップの承認は現在進行中で、まもなく完了する予定です。
- 承認が進行中
+ 許可付与のプロセスは現在進行中であり、まもなく完了する予定です。
+ 承認中
カードのアクティベーションが正しく完了しませんでした。デバイスの NFCモジュールに問題があるか、カードをデバイスに正しくタップしていないことが原因かもしれません。サポートチームにお問い合わせください。
アクティベーションに失敗しました
BNBネットワーク開発者によると、BEP-2規格のサポートは2024年6月に終了します。この規格の資産を失わないために、BEP-20規格に変換してください。BNBスマートチェーンネットワークへ移行するには、Tangemのスワップサービスをご利用ください。
@@ -842,6 +843,8 @@
ネットワークには最低残高が必要です
スワップは、%s の取引完了後に利用可能となります。
アクティブな取引があります
+ スワップの承認は現在進行中で、まもなく完了する予定です。
+ 承認が進行中
最低のスワップ金額は%1$s です。スワップ後の残金が%2$s を下回らないようにしてください。
あなたのリストには、交換可能な %s トークンがありません。
スワップ可能なトークンがありません
diff --git a/core/res/src/main/res/values-ru/strings.xml b/core/res/src/main/res/values-ru/strings.xml
index fe433aaed9..723c6c4ffb 100644
--- a/core/res/src/main/res/values-ru/strings.xml
+++ b/core/res/src/main/res/values-ru/strings.xml
@@ -684,7 +684,7 @@
Стейкинг дает возможность вам получать %1$s. Награда будет зачисляться каждую неделю.
Получите награду за стейкинг
Награда перестанет начисляться сразу после завершения стейкинга. Процесс завершения длится %s.
- Повторный стейкинг
+ Сменить валидатора
Застейкать вознаграждения
Отозвать
Переголосовать
@@ -702,6 +702,7 @@
Стейкинг закрыт
Застейкать еще
Застейкать %s
+ Вывести %s
Разблокировать
Выведено из стейкинга
Проверьте процесс завершения стейкинга, чтобы вывести свои средства.
diff --git a/core/res/src/main/res/values-uk-rUA/strings.xml b/core/res/src/main/res/values-uk-rUA/strings.xml
index 62d3baa6e6..10a8cd574b 100644
--- a/core/res/src/main/res/values-uk-rUA/strings.xml
+++ b/core/res/src/main/res/values-uk-rUA/strings.xml
@@ -704,7 +704,7 @@
Місяць
Тиждень
Винагороди
- Застейкати
+ Стейкінг закрито
Застейкати більше
Застейкати %s
Зняти зі стейкінгу %s
@@ -869,6 +869,7 @@
Щоб здійснити транзакцію, вам потрібно внести трохи %1$s %2$s
Неможливо покрити комісію %s
Сума отримання не може бути меншою за %s
+ Це може статися тому, що провайдер наразі не може обміняти обрану пару. Будь ласка, зачекайте трохи та спробуйте ще раз. (Код %@)
Сервіс тимчасово недоступний
Сума до обміну не повинна перевищувати %s
Сума для обміну має бути не менше %s
diff --git a/core/res/src/main/res/values-zh-rTW/strings.xml b/core/res/src/main/res/values-zh-rTW/strings.xml
index eb5bc2de81..3c2329daab 100644
--- a/core/res/src/main/res/values-zh-rTW/strings.xml
+++ b/core/res/src/main/res/values-zh-rTW/strings.xml
@@ -63,6 +63,7 @@
否
OK
主卡片
+ %1$s-%2$s
拒絕
重新命名
保存設置
diff --git a/core/res/src/main/res/values/strings.xml b/core/res/src/main/res/values/strings.xml
index 79135b1d0d..08e26457c7 100644
--- a/core/res/src/main/res/values/strings.xml
+++ b/core/res/src/main/res/values/strings.xml
@@ -669,10 +669,10 @@
The allocated time for activating participation in staking.
Migrate
Native staking
- Staking allow you to earn %1$s. Your staking rewards arrive every day.
- Staking allow you to earn %1$s. Your staking rewards arrive every hour.
- Staking allow you to earn %1$s. Your staking rewards arrive every month.
- Staking allow you to earn %1$s. Your staking rewards arrive every week.
+ Staking allows you to earn %1$s. Your staking rewards arrive every day.
+ Staking allows you to earn %1$s. Your staking rewards arrive every hour.
+ Staking allows you to earn %1$s. Your staking rewards arrive every month.
+ Staking allows you to earn %1$s. Your staking rewards arrive every week.
Earn staking rewards
Rewards stop accruing immediately after you unstake. The unstaking process takes %s.
Rebond
diff --git a/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingRepository.kt b/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingRepository.kt
index c4b9b8fad1..07357b9c71 100644
--- a/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingRepository.kt
+++ b/data/staking/src/main/java/com/tangem/data/staking/DefaultStakingRepository.kt
@@ -148,8 +148,8 @@ internal class DefaultStakingRepository(
val yield = getYield(cryptoCurrencyId, symbol)
StakingEntryInfo(
- interestRate = requireNotNull(yield.validators.maxByOrNull { it.apr.orZero() }?.apr),
- periodInDays = yield.metadata.cooldownPeriod.days,
+ apr = requireNotNull(yield.validators.maxByOrNull { it.apr.orZero() }?.apr),
+ rewardSchedule = yield.metadata.rewardSchedule,
tokenSymbol = yield.token.symbol,
)
}
diff --git a/domain/staking/models/src/main/kotlin/com/tangem/domain/staking/model/StakingEntryInfo.kt b/domain/staking/models/src/main/kotlin/com/tangem/domain/staking/model/StakingEntryInfo.kt
index 691aece740..c400337e61 100644
--- a/domain/staking/models/src/main/kotlin/com/tangem/domain/staking/model/StakingEntryInfo.kt
+++ b/domain/staking/models/src/main/kotlin/com/tangem/domain/staking/model/StakingEntryInfo.kt
@@ -1,9 +1,10 @@
package com.tangem.domain.staking.model
+import com.tangem.domain.staking.model.stakekit.Yield
import java.math.BigDecimal
data class StakingEntryInfo(
- val interestRate: BigDecimal,
- val periodInDays: Int,
+ val apr: BigDecimal,
+ val rewardSchedule: Yield.Metadata.RewardSchedule,
val tokenSymbol: String,
)
\ No newline at end of file
diff --git a/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/repository/MockStakingRepository.kt b/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/repository/MockStakingRepository.kt
index a19fea75b9..59137dec80 100644
--- a/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/repository/MockStakingRepository.kt
+++ b/domain/tokens/src/test/kotlin/com/tangem/domain/tokens/repository/MockStakingRepository.kt
@@ -32,9 +32,9 @@ class MockStakingRepository : StakingRepository {
override suspend fun getEntryInfo(cryptoCurrencyId: CryptoCurrency.ID, symbol: String): StakingEntryInfo =
StakingEntryInfo(
- interestRate = 1.toBigDecimal(),
- periodInDays = 2,
+ apr = 1.toBigDecimal(),
tokenSymbol = "SOL",
+ rewardSchedule = Yield.Metadata.RewardSchedule.DAY,
)
override suspend fun getYield(cryptoCurrencyId: CryptoCurrency.ID, symbol: String): Yield = Yield(
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/FeeState.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/FeeState.kt
index ad93ecd3a3..d74bc8fe32 100644
--- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/FeeState.kt
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/FeeState.kt
@@ -6,7 +6,7 @@ import com.tangem.domain.appcurrency.model.AppCurrency
import java.math.BigDecimal
@Immutable
-sealed class FeeState {
+internal sealed class FeeState {
data class Content(
val fee: Fee?,
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/InnerConfirmationStakingState.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/InnerConfirmationStakingState.kt
index babc93a2dd..29ce1f54f5 100644
--- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/InnerConfirmationStakingState.kt
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/InnerConfirmationStakingState.kt
@@ -1,6 +1,6 @@
package com.tangem.features.staking.impl.presentation.state
-enum class InnerConfirmationStakingState {
+internal enum class InnerConfirmationStakingState {
ASSENT,
IN_PROGRESS,
COMPLETED,
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/StakingNotification.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/StakingNotification.kt
index c338f2c047..f9da881678 100644
--- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/StakingNotification.kt
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/StakingNotification.kt
@@ -1,10 +1,7 @@
package com.tangem.features.staking.impl.presentation.state
import com.tangem.core.ui.components.notifications.NotificationConfig
-import com.tangem.core.ui.extensions.TextReference
-import com.tangem.core.ui.extensions.resourceReference
-import com.tangem.core.ui.extensions.stringReference
-import com.tangem.core.ui.extensions.wrappedList
+import com.tangem.core.ui.extensions.*
import com.tangem.features.staking.impl.R
internal sealed class StakingNotification(val config: NotificationConfig) {
@@ -50,14 +47,10 @@ internal sealed class StakingNotification(val config: NotificationConfig) {
),
) {
data class EarnRewards(
- val subtitleResourceId: Int,
- val currencyName: String,
+ val subtitleText: TextReference,
) : Warning(
title = resourceReference(R.string.staking_notification_earn_rewards_title),
- subtitle = resourceReference(
- subtitleResourceId,
- wrappedList(currencyName),
- ),
+ subtitle = subtitleText,
)
data class Unstake(
@@ -66,7 +59,13 @@ internal sealed class StakingNotification(val config: NotificationConfig) {
title = resourceReference(R.string.common_unstake),
subtitle = resourceReference(
R.string.staking_notification_unstake_text,
- wrappedList(cooldownPeriodDays, cooldownPeriodDays),
+ wrappedList(
+ pluralReference(
+ id = R.plurals.common_days,
+ count = cooldownPeriodDays,
+ formatArgs = wrappedList(cooldownPeriodDays),
+ ),
+ ),
),
)
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/StakingUiState.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/StakingUiState.kt
index 4b000bc130..0d7e1081b8 100644
--- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/StakingUiState.kt
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/StakingUiState.kt
@@ -9,8 +9,8 @@ import com.tangem.core.ui.event.StateEvent
import com.tangem.core.ui.extensions.TextReference
import com.tangem.domain.staking.model.stakekit.PendingAction
import com.tangem.domain.staking.model.stakekit.action.StakingActionCommonType
+import com.tangem.features.staking.impl.presentation.state.bottomsheet.InfoType
import com.tangem.features.staking.impl.presentation.state.events.StakingEvent
-import com.tangem.features.staking.impl.presentation.state.transformers.InfoType
import com.tangem.features.staking.impl.presentation.viewmodel.StakingClickIntents
import kotlinx.collections.immutable.ImmutableList
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/bottomsheet/InfoType.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/bottomsheet/InfoType.kt
new file mode 100644
index 0000000000..b923734491
--- /dev/null
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/bottomsheet/InfoType.kt
@@ -0,0 +1,9 @@
+package com.tangem.features.staking.impl.presentation.state.bottomsheet
+
+internal enum class InfoType {
+ ANNUAL_PERCENTAGE_RATE,
+ UNBONDING_PERIOD,
+ REWARD_CLAIMING,
+ WARMUP_PERIOD,
+ REWARD_SCHEDULE,
+}
\ No newline at end of file
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/bottomsheet/StakingInfoBottomSheetConfig.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/bottomsheet/StakingInfoBottomSheetConfig.kt
index f8cc06e495..12b327a0d0 100644
--- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/bottomsheet/StakingInfoBottomSheetConfig.kt
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/bottomsheet/StakingInfoBottomSheetConfig.kt
@@ -3,7 +3,7 @@ package com.tangem.features.staking.impl.presentation.state.bottomsheet
import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent
import com.tangem.core.ui.extensions.TextReference
-data class StakingInfoBottomSheetConfig(
+internal data class StakingInfoBottomSheetConfig(
val title: TextReference,
val text: TextReference,
) : TangemBottomSheetConfigContent
\ No newline at end of file
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/previewdata/ConfirmationStatePreviewData.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/previewdata/ConfirmationStatePreviewData.kt
index 807e584ca3..f8a64a3695 100644
--- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/previewdata/ConfirmationStatePreviewData.kt
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/previewdata/ConfirmationStatePreviewData.kt
@@ -3,6 +3,8 @@ package com.tangem.features.staking.impl.presentation.state.previewdata
import com.tangem.blockchain.common.Amount
import com.tangem.blockchain.common.AmountType.Coin
import com.tangem.blockchain.common.transaction.Fee
+import com.tangem.core.ui.extensions.resourceReference
+import com.tangem.core.ui.extensions.wrappedList
import com.tangem.domain.appcurrency.model.AppCurrency
import com.tangem.domain.staking.model.stakekit.Yield
import com.tangem.features.staking.impl.R
@@ -81,8 +83,10 @@ internal object ConfirmationStatePreviewData {
footerText = "You stake \$715.11 and will be receiving ~\$35 monthly",
notifications = persistentListOf(
StakingNotification.Warning.EarnRewards(
- currencyName = "Solana",
- subtitleResourceId = R.string.staking_notification_earn_rewards_text_period_day,
+ subtitleText = resourceReference(
+ id = R.string.staking_notification_earn_rewards_text_period_day,
+ formatArgs = wrappedList("Solana"),
+ ),
),
),
transactionDoneState = TransactionDoneState.Empty,
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/stub/StakingClickIntentsStub.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/stub/StakingClickIntentsStub.kt
index 55d130824f..7220af1f41 100644
--- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/stub/StakingClickIntentsStub.kt
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/stub/StakingClickIntentsStub.kt
@@ -4,12 +4,12 @@ import com.tangem.domain.staking.model.stakekit.PendingAction
import com.tangem.domain.staking.model.stakekit.Yield
import com.tangem.domain.staking.model.stakekit.action.StakingActionCommonType
import com.tangem.features.staking.impl.presentation.state.BalanceState
-import com.tangem.features.staking.impl.presentation.state.transformers.InfoType
+import com.tangem.features.staking.impl.presentation.state.bottomsheet.InfoType
import com.tangem.features.staking.impl.presentation.viewmodel.StakingClickIntents
import kotlinx.collections.immutable.ImmutableList
@Suppress("TooManyFunctions")
-object StakingClickIntentsStub : StakingClickIntents {
+internal object StakingClickIntentsStub : StakingClickIntents {
override fun onBackClick() {}
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/SetConfirmationStateLoadingTransformer.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/SetConfirmationStateLoadingTransformer.kt
index 1e77078e6e..07ba1f9fce 100644
--- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/SetConfirmationStateLoadingTransformer.kt
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/SetConfirmationStateLoadingTransformer.kt
@@ -1,5 +1,7 @@
package com.tangem.features.staking.impl.presentation.state.transformers
+import com.tangem.core.ui.extensions.resourceReference
+import com.tangem.core.ui.extensions.wrappedList
import com.tangem.domain.staking.model.stakekit.Yield
import com.tangem.domain.staking.model.stakekit.action.StakingActionCommonType
import com.tangem.features.staking.impl.R
@@ -45,8 +47,10 @@ internal class SetConfirmationStateLoadingTransformer(
)
} else {
StakingNotification.Warning.EarnRewards(
- currencyName = yield.token.name,
- subtitleResourceId = getEarnRewardsPeriod(yield.metadata.rewardSchedule),
+ subtitleText = resourceReference(
+ id = getEarnRewardsPeriod(yield.metadata.rewardSchedule),
+ formatArgs = wrappedList(yield.token.name),
+ ),
)
},
)
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/SetInitialDataStateTransformer.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/SetInitialDataStateTransformer.kt
index 8d8a69e019..2c0bcbef78 100644
--- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/SetInitialDataStateTransformer.kt
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/SetInitialDataStateTransformer.kt
@@ -18,6 +18,7 @@ import com.tangem.features.staking.impl.presentation.state.StakingStates
import com.tangem.features.staking.impl.presentation.state.StakingUiState
import com.tangem.features.staking.impl.presentation.state.TransactionDoneState
import com.tangem.features.staking.impl.presentation.state.ValidatorState
+import com.tangem.features.staking.impl.presentation.state.bottomsheet.InfoType
import com.tangem.features.staking.impl.presentation.state.converters.RewardsValidatorStateConverter
import com.tangem.features.staking.impl.presentation.state.converters.YieldBalancesConverter
import com.tangem.features.staking.impl.presentation.viewmodel.StakingClickIntents
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/ShowInfoBottomSheetStateTransformer.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/ShowInfoBottomSheetStateTransformer.kt
index 06f89bdd94..f0e0ade2cc 100644
--- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/ShowInfoBottomSheetStateTransformer.kt
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/ShowInfoBottomSheetStateTransformer.kt
@@ -4,6 +4,7 @@ import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.features.staking.impl.R
import com.tangem.features.staking.impl.presentation.state.StakingUiState
+import com.tangem.features.staking.impl.presentation.state.bottomsheet.InfoType
import com.tangem.features.staking.impl.presentation.state.bottomsheet.StakingInfoBottomSheetConfig
import com.tangem.utils.transformer.Transformer
@@ -42,12 +43,4 @@ internal class ShowInfoBottomSheetStateTransformer(
),
)
}
-}
-
-enum class InfoType {
- ANNUAL_PERCENTAGE_RATE,
- UNBONDING_PERIOD,
- REWARD_CLAIMING,
- WARMUP_PERIOD,
- REWARD_SCHEDULE,
}
\ No newline at end of file
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/amount/AmountChangeStateTransformer.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/amount/AmountChangeStateTransformer.kt
index b87f8a0251..098e959f7c 100644
--- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/amount/AmountChangeStateTransformer.kt
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/amount/AmountChangeStateTransformer.kt
@@ -8,8 +8,8 @@ import com.tangem.utils.transformer.Transformer
internal class AmountChangeStateTransformer(
private val cryptoCurrencyStatus: CryptoCurrencyStatus,
- private val yield: Yield,
private val value: String,
+ yield: Yield,
) : Transformer {
private val amountRequirementStateTransformer = AmountRequirementStateTransformer(
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/amount/AmountMaxValueStateTransformer.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/amount/AmountMaxValueStateTransformer.kt
index ae53eab63e..6314597d0d 100644
--- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/amount/AmountMaxValueStateTransformer.kt
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/state/transformers/amount/AmountMaxValueStateTransformer.kt
@@ -9,7 +9,7 @@ import com.tangem.utils.transformer.Transformer
internal class AmountMaxValueStateTransformer(
private val cryptoCurrencyStatus: CryptoCurrencyStatus,
- private val yield: Yield,
+ yield: Yield,
) : Transformer {
private val amountRequirementStateTransformer = AmountRequirementStateTransformer(
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingClickIntents.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingClickIntents.kt
index f8fb30cfa9..fee1e2115d 100644
--- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingClickIntents.kt
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingClickIntents.kt
@@ -5,7 +5,7 @@ import com.tangem.domain.staking.model.stakekit.PendingAction
import com.tangem.domain.staking.model.stakekit.Yield
import com.tangem.domain.staking.model.stakekit.action.StakingActionCommonType
import com.tangem.features.staking.impl.presentation.state.BalanceState
-import com.tangem.features.staking.impl.presentation.state.transformers.InfoType
+import com.tangem.features.staking.impl.presentation.state.bottomsheet.InfoType
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
diff --git a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt
index 209c6c9304..3dbc94500f 100644
--- a/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt
+++ b/features/staking/impl/src/main/java/com/tangem/features/staking/impl/presentation/viewmodel/StakingViewModel.kt
@@ -43,6 +43,7 @@ import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.domain.wallets.usecase.GetUserWalletUseCase
import com.tangem.features.staking.impl.navigation.InnerStakingRouter
import com.tangem.features.staking.impl.presentation.state.*
+import com.tangem.features.staking.impl.presentation.state.bottomsheet.InfoType
import com.tangem.features.staking.impl.presentation.state.events.StakingEventFactory
import com.tangem.features.staking.impl.presentation.state.transformers.*
import com.tangem.features.staking.impl.presentation.state.transformers.amount.AmountChangeStateTransformer
@@ -327,7 +328,7 @@ internal class StakingViewModel @Inject constructor(
}
override fun onInitialInfoBannerClick() {
- // innerRouter.openUrl(WHAT_IS_STAKING_ARTICLE_URL)
+ innerRouter.openUrl(WHAT_IS_STAKING_ARTICLE_URL)
}
override fun onInfoClick(infoType: InfoType) {
@@ -339,7 +340,7 @@ internal class StakingViewModel @Inject constructor(
}
override fun onAmountValueChange(value: String) {
- stateController.update(AmountChangeStateTransformer(cryptoCurrencyStatus, yield, value))
+ stateController.update(AmountChangeStateTransformer(cryptoCurrencyStatus, value, yield))
}
override fun onAmountPasteTriggerDismiss() {
@@ -369,7 +370,7 @@ internal class StakingViewModel @Inject constructor(
StakingActionCommonType.PENDING_OTHER
}
stateController.update(ValidatorSelectChangeTransformer(activeStake.validator))
- stateController.update(AmountChangeStateTransformer(cryptoCurrencyStatus, yield, activeStake.cryptoValue))
+ stateController.update(AmountChangeStateTransformer(cryptoCurrencyStatus, activeStake.cryptoValue, yield))
onNextClick(actionType, activeStake.pendingActions)
}
@@ -696,7 +697,7 @@ internal class StakingViewModel @Inject constructor(
}
private companion object {
- const val WHAT_IS_STAKING_ARTICLE_URL = "TODO staking"
+ const val WHAT_IS_STAKING_ARTICLE_URL = "https://tangem.com/en/blog/post/how-to-stake-cryptocurrency/"
const val ALLOWANCE_UPDATE_DELAY = 10_000L
const val BALANCE_UPDATE_DELAY = 11_000L
}
diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/TokenDetailsPreviewData.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/TokenDetailsPreviewData.kt
index e7625b4013..9c69cd0b55 100644
--- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/TokenDetailsPreviewData.kt
+++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/TokenDetailsPreviewData.kt
@@ -143,9 +143,14 @@ internal object TokenDetailsPreviewData {
val stakingErrorBlock = StakingBlockUM.Error(iconState)
val stakingAvailableBlock = StakingBlockUM.StakeAvailable(
- interestRate = "7.38",
- periodInDays = 4,
- tokenSymbol = "XLM",
+ titleText = resourceReference(
+ id = R.string.token_details_staking_block_title,
+ formatArgs = wrappedList("3.27%"),
+ ),
+ subtitleText = resourceReference(
+ id = R.string.staking_notification_earn_rewards_text_period_day,
+ formatArgs = wrappedList("Solana"),
+ ),
iconState = iconState,
onStakeClicked = {},
)
diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/StakingBlockUM.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/StakingBlockUM.kt
index 91d76db70d..b29d476a32 100644
--- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/StakingBlockUM.kt
+++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/StakingBlockUM.kt
@@ -21,9 +21,8 @@ internal sealed interface StakingBlockUM {
data class StakeAvailable(
val iconState: IconState,
- val interestRate: String,
- val periodInDays: Int,
- val tokenSymbol: String,
+ val titleText: TextReference,
+ val subtitleText: TextReference,
val onStakeClicked: () -> Unit,
) : StakingBlockUM
}
\ No newline at end of file
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 6aa3923cd9..0555333c41 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
@@ -22,6 +22,7 @@ import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenDeta
import com.tangem.feature.tokendetails.presentation.tokendetails.state.components.TokenDetailsNotification
import com.tangem.feature.tokendetails.presentation.tokendetails.state.factory.txhistory.TokenDetailsTxHistoryTransactionStateConverter
import com.tangem.feature.tokendetails.presentation.tokendetails.state.utils.getBalance
+import com.tangem.feature.tokendetails.presentation.tokendetails.state.utils.getStringResourceId
import com.tangem.feature.tokendetails.presentation.tokendetails.viewmodels.TokenDetailsClickIntents
import com.tangem.features.staking.api.featuretoggles.StakingFeatureToggles
import com.tangem.features.tokendetails.impl.R
@@ -191,13 +192,19 @@ internal class TokenDetailsLoadedBalanceConverter(
stakingEntryInfo: StakingEntryInfo,
iconState: IconState,
): StakingBlockUM.StakeAvailable {
+ val apr = BigDecimalFormatter.formatPercent(
+ percent = stakingEntryInfo.apr,
+ useAbsoluteValue = true,
+ )
return StakingBlockUM.StakeAvailable(
- interestRate = BigDecimalFormatter.formatPercent(
- percent = stakingEntryInfo.interestRate,
- useAbsoluteValue = true,
+ titleText = resourceReference(
+ id = R.string.token_details_staking_block_title,
+ formatArgs = wrappedList(apr),
+ ),
+ subtitleText = resourceReference(
+ id = stakingEntryInfo.rewardSchedule.getStringResourceId(),
+ formatArgs = wrappedList(stakingEntryInfo.tokenSymbol),
),
- periodInDays = stakingEntryInfo.periodInDays,
- tokenSymbol = stakingEntryInfo.tokenSymbol,
iconState = iconState,
onStakeClicked = clickIntents::onStakeBannerClick,
)
diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenStakingStateConverter.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenStakingStateConverter.kt
index 3bc3e36023..b12e12eb53 100644
--- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenStakingStateConverter.kt
+++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/factory/TokenStakingStateConverter.kt
@@ -1,12 +1,16 @@
package com.tangem.feature.tokendetails.presentation.tokendetails.state.factory
import arrow.core.Either
+import com.tangem.core.ui.extensions.resourceReference
+import com.tangem.core.ui.extensions.wrappedList
import com.tangem.core.ui.utils.BigDecimalFormatter
import com.tangem.domain.staking.model.StakingEntryInfo
import com.tangem.domain.staking.model.stakekit.StakingError
import com.tangem.feature.tokendetails.presentation.tokendetails.state.StakingBlockUM
import com.tangem.feature.tokendetails.presentation.tokendetails.state.TokenDetailsState
+import com.tangem.feature.tokendetails.presentation.tokendetails.state.utils.getStringResourceId
import com.tangem.feature.tokendetails.presentation.tokendetails.viewmodels.TokenDetailsClickIntents
+import com.tangem.features.tokendetails.impl.R
import com.tangem.utils.Provider
import com.tangem.utils.converter.Converter
@@ -24,14 +28,20 @@ internal class TokenStakingStateConverter(
ifLeft = {
StakingBlockUM.Error(iconState = iconState)
},
- ifRight = {
+ ifRight = { stakingEntryInfo ->
+ val apr = BigDecimalFormatter.formatPercent(
+ percent = stakingEntryInfo.apr,
+ useAbsoluteValue = true,
+ )
StakingBlockUM.StakeAvailable(
- interestRate = BigDecimalFormatter.formatPercent(
- percent = it.interestRate,
- useAbsoluteValue = true,
+ titleText = resourceReference(
+ id = R.string.token_details_staking_block_title,
+ formatArgs = wrappedList(apr),
+ ),
+ subtitleText = resourceReference(
+ id = stakingEntryInfo.rewardSchedule.getStringResourceId(),
+ formatArgs = wrappedList(stakingEntryInfo.tokenSymbol),
),
- periodInDays = it.periodInDays,
- tokenSymbol = it.tokenSymbol,
iconState = iconState,
onStakeClicked = clickIntents::onStakeBannerClick,
)
diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/utils/BalanceUtils.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/utils/BalanceUtils.kt
index faa0144943..fe714ff2ca 100644
--- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/utils/BalanceUtils.kt
+++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/utils/BalanceUtils.kt
@@ -3,7 +3,7 @@ package com.tangem.feature.tokendetails.presentation.tokendetails.state.utils
import com.tangem.feature.tokendetails.presentation.tokendetails.state.BalanceType
import java.math.BigDecimal
-fun BigDecimal.getBalance(selectedBalanceType: BalanceType, stakingAmount: BigDecimal?): BigDecimal {
+internal fun BigDecimal.getBalance(selectedBalanceType: BalanceType, stakingAmount: BigDecimal?): BigDecimal {
return if (selectedBalanceType == BalanceType.ALL && stakingAmount != null) {
this.plus(stakingAmount)
} else {
diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/utils/RewardScheduleUtils.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/utils/RewardScheduleUtils.kt
new file mode 100644
index 0000000000..8bb6550f79
--- /dev/null
+++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/state/utils/RewardScheduleUtils.kt
@@ -0,0 +1,26 @@
+package com.tangem.feature.tokendetails.presentation.tokendetails.state.utils
+
+import com.tangem.domain.staking.model.stakekit.Yield
+import com.tangem.features.tokendetails.impl.R
+
+internal fun Yield.Metadata.RewardSchedule.getStringResourceId(): Int {
+ return when (this) {
+ Yield.Metadata.RewardSchedule.BLOCK,
+ Yield.Metadata.RewardSchedule.DAY,
+ Yield.Metadata.RewardSchedule.ERA,
+ Yield.Metadata.RewardSchedule.EPOCH,
+ -> R.string.staking_notification_earn_rewards_text_period_day
+
+ Yield.Metadata.RewardSchedule.HOUR,
+ -> R.string.staking_notification_earn_rewards_text_period_hour
+
+ Yield.Metadata.RewardSchedule.WEEK,
+ -> R.string.staking_notification_earn_rewards_text_period_week
+
+ Yield.Metadata.RewardSchedule.MONTH,
+ -> R.string.staking_notification_earn_rewards_text_period_month
+
+ else
+ -> R.string.staking_notification_earn_rewards_text_period_day
+ }
+}
\ No newline at end of file
diff --git a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/staking/TokenStakingBlock.kt b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/staking/TokenStakingBlock.kt
index c2d7940cbc..9d0087292d 100644
--- a/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/staking/TokenStakingBlock.kt
+++ b/features/tokendetails/impl/src/main/kotlin/com/tangem/feature/tokendetails/presentation/tokendetails/ui/components/staking/TokenStakingBlock.kt
@@ -17,6 +17,8 @@ import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameter
import com.tangem.core.ui.components.RectangleShimmer
import com.tangem.core.ui.components.SecondaryButton
import com.tangem.core.ui.components.SpacerW8
+import com.tangem.core.ui.extensions.TextReference
+import com.tangem.core.ui.extensions.resolveReference
import com.tangem.core.ui.res.TangemTheme
import com.tangem.core.ui.res.TangemThemePreview
import com.tangem.core.ui.utils.getGreyScaleColorFilter
@@ -86,10 +88,7 @@ private fun StakingAvailableContent(state: StakingBlockUM.StakeAvailable, modifi
SpacerW8()
Column {
Text(
- text = stringResource(
- R.string.token_details_staking_block_title,
- state.interestRate,
- ),
+ text = state.titleText.resolveReference(),
color = TangemTheme.colors.text.primary1,
style = TangemTheme.typography.subtitle2,
)
@@ -97,11 +96,7 @@ private fun StakingAvailableContent(state: StakingBlockUM.StakeAvailable, modifi
Spacer(modifier = Modifier.size(TangemTheme.dimens.size4))
Text(
- text = stringResource(
- R.string.token_details_staking_block_subtitle,
- state.tokenSymbol,
- state.periodInDays,
- ),
+ text = state.subtitleText.resolveReference(),
color = TangemTheme.colors.text.tertiary,
style = TangemTheme.typography.body2,
)
@@ -161,8 +156,9 @@ private fun StakingLoading(iconState: IconState, modifier: Modifier = Modifier)
}
SecondaryButton(
modifier = Modifier.fillMaxWidth(),
- text = "Loading", // TODO staking
- onClick = { /* [REDACTED_TODO_COMMENT] */ },
+ showProgress = true,
+ text = TextReference.EMPTY.resolveReference(),
+ onClick = { /* no-op */ },
)
}
}