Updated on 2026-08-14

This commit is contained in:
Tangem 2026-02-06 12:40:48 +03:00
commit 870c3fa9d3
291 changed files with 4985 additions and 5870 deletions

View file

@ -0,0 +1,16 @@
package com.tangem.domain.models.earn
import java.util.UUID
sealed interface EarnError {
data class HttpError(
val id: String = UUID.randomUUID().toString(),
val code: Int,
val message: String,
) : EarnError
data class NotHttpError(
val id: String = UUID.randomUUID().toString(),
) : EarnError
}

View file

@ -0,0 +1,14 @@
package com.tangem.domain.models.earn
import kotlinx.serialization.Serializable
/**
* Model for networks in Earn.
* @param networkId - id of network
* @param isAdded - is exists in any user's wallet
*/
@Serializable
data class EarnNetwork(
val networkId: String,
val isAdded: Boolean,
)

View file

@ -0,0 +1,5 @@
package com.tangem.domain.models.earn
import arrow.core.Either
typealias EarnNetworks = Either<EarnError, List<EarnNetwork>>

View file

@ -0,0 +1,35 @@
package com.tangem.domain.models.earn
import kotlinx.serialization.Serializable
/**
* Model of earn token.
* @param apy - percent of earning
* @param networkId - id of network
* @param rewardType - apr or apy
* @param type - staking or yield
* @param tokenSymbol - symbol of token (ex. "ATOM")
* @param tokenName - name of token (ex. "Cosmos Hub")
* @param tokenId - id of token (ex. "cosmos")
* @param tokenAddress - address of contract
*/
@Serializable
data class EarnToken(
val apy: String,
val networkId: String,
val rewardType: EarnRewardType,
val type: EarnType,
val tokenId: String,
val tokenSymbol: String,
val tokenName: String,
val tokenAddress: String,
val decimalCount: Int?,
)
enum class EarnRewardType {
APR, APY
}
enum class EarnType {
STAKING, YIELD
}

View file

@ -0,0 +1,17 @@
package com.tangem.domain.models.earn
import com.tangem.domain.models.currency.CryptoCurrency
import kotlinx.serialization.Serializable
/**
* Represents an earn token and its associated cryptocurrency. This model is only for main account.
*
* @property earnToken The earn token details.
* @property cryptoCurrency Use this [CryptoCurrency] only for creating the cryptoCurrencyIcon!!!!
*/
@Serializable
data class EarnTokenWithCurrency(
val networkName: String,
val earnToken: EarnToken,
val cryptoCurrency: CryptoCurrency,
)

View file

@ -0,0 +1,5 @@
package com.tangem.domain.models.earn
import arrow.core.Either
typealias EarnTopToken = Either<EarnError, List<EarnTokenWithCurrency>>

View file

@ -110,4 +110,5 @@ val UserWallet.isLocked
is UserWallet.Hot -> isLocked
}
inline val UserWallet.isHotWallet get() = this is UserWallet.Hot
inline val UserWallet.isHotWallet get() = this is UserWallet.Hot
inline val UserWallet.isColdWallet get() = this is UserWallet.Cold