Updated on 2026-08-14
This commit is contained in:
parent
ecfdb944c5
commit
f004aaf1f3
4 changed files with 8 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.domain.staking.model
|
||||
|
||||
import com.tangem.domain.staking.model.stakekit.BalanceItem
|
||||
import com.tangem.domain.staking.model.stakekit.BalanceType
|
||||
import com.tangem.domain.staking.model.stakekit.Yield
|
||||
import java.math.BigDecimal
|
||||
|
|
@ -11,4 +12,5 @@ data class PendingTransaction(
|
|||
val rawCurrencyId: String?,
|
||||
val validator: Yield.Validator?,
|
||||
val balancesId: Int,
|
||||
val balanceItems: List<BalanceItem>, // TODO staking remove it
|
||||
)
|
||||
|
|
@ -35,7 +35,10 @@ sealed class YieldBalance {
|
|||
|
||||
fun getBalancesUniqueId(): Int {
|
||||
// need to exclude rewards because their amount may change frequently
|
||||
return balance.items.filter { it.type != BalanceType.REWARDS }.hashCode()
|
||||
return balance.items
|
||||
.filter { it.type != BalanceType.REWARDS }
|
||||
.map { it.amount.toString() + it.type.toString() + it.groupId + it.validatorAddress }
|
||||
.hashCode()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -294,6 +294,7 @@ internal class StakingTransactionSender @AssistedInject constructor(
|
|||
rawCurrencyId = cryptoCurrencyStatus.currency.id.rawCurrencyId,
|
||||
validator = (confirmationState.validatorState as? ValidatorState.Content)?.chosenValidator,
|
||||
balancesId = (cryptoCurrencyStatus.value.yieldBalance as? YieldBalance.Data)?.getBalancesUniqueId() ?: 0,
|
||||
balanceItems = (cryptoCurrencyStatus.value.yieldBalance as? YieldBalance.Data)?.balance?.items ?: emptyList()
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ internal class SetPossiblePendingTransactionTransformer(
|
|||
rawCurrencyId = balanceState.rawCurrencyId,
|
||||
validator = balanceState.validator,
|
||||
balancesId = balancesId,
|
||||
balanceItems = (cryptoCurrencyStatus.value.yieldBalance as? YieldBalance.Data)?.balance?.items ?: emptyList()
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue