Updated on 2026-08-14

This commit is contained in:
Tangem 2026-02-03 11:52:19 +01:00
parent c7941ee1f7
commit 2b327fd3e9
32 changed files with 853 additions and 0 deletions

View file

@ -0,0 +1,11 @@
package com.tangem.domain.models.earn
sealed interface EarnError {
data class HttpError(
val code: Int,
val message: String,
) : EarnError
data object NotHttpError : 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,26 @@
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: String,
val type: String,
val tokenId: String,
val tokenSymbol: String,
val tokenName: String,
val tokenAddress: String,
)

View file

@ -0,0 +1,16 @@
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 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>>