Updated on 2026-08-14

This commit is contained in:
Tangem 2024-10-29 14:31:53 +03:00
commit 652159dbce
316 changed files with 6242 additions and 3084 deletions

View file

@ -1,16 +0,0 @@
package com.tangem.domain.staking.model
import com.tangem.domain.staking.model.stakekit.BalanceType
import com.tangem.domain.staking.model.stakekit.Token
import com.tangem.domain.staking.model.stakekit.Yield
import java.math.BigDecimal
data class PendingTransaction(
val groupId: String?,
val token: Token,
val type: BalanceType,
val amount: BigDecimal,
val rawCurrencyId: String?,
val validator: Yield.Validator?,
val balancesId: Int,
)

View file

@ -3,5 +3,4 @@ package com.tangem.domain.staking.model
data class SubmitHashData(
val transactionHash: String,
val transactionId: String,
val pendingTransaction: PendingTransaction,
)

View file

@ -18,6 +18,11 @@ data class Yield(
val isAvailable: Boolean,
) {
val preferredValidators: List<Validator>
get() = validators.filter { it.preferred }
fun getCurrentToken(rawCurrencyId: String?) = tokens.firstOrNull { rawCurrencyId == it.coinGeckoId } ?: token
@Serializable
data class Status(
val enter: Boolean,
@ -130,8 +135,6 @@ data class Yield(
APR, // simple rate
UNKNOWN,
}
fun getCurrentToken(rawCurrencyId: String?) = tokens.firstOrNull { rawCurrencyId == it.coinGeckoId } ?: token
}
@Serializable

View file

@ -32,14 +32,6 @@ sealed class YieldBalance {
.distinctBy { it.validatorAddress }
.size
}
fun getBalancesUniqueId(): Int {
// need to exclude rewards because their amount may change frequently
return balance.items
.filter { it.type != BalanceType.REWARDS }
.map { it.amount.toString() + it.type.toString() + it.groupId }
.hashCode()
}
}
data object Empty : YieldBalance()

View file

@ -1,8 +1,12 @@
package com.tangem.domain.staking.model.stakekit.action
enum class StakingActionCommonType {
ENTER,
EXIT,
PENDING_REWARDS,
PENDING_OTHER,
sealed class StakingActionCommonType {
data object Enter : StakingActionCommonType()
data object Exit : StakingActionCommonType()
sealed class Pending : StakingActionCommonType() {
data object Restake : Pending()
data object Rewards : Pending()
data object Other : Pending()
}
}