Updated on 2026-08-14
This commit is contained in:
parent
321b764887
commit
33f9a0d452
21 changed files with 280 additions and 157 deletions
|
|
@ -1,12 +1,10 @@
|
|||
plugins {
|
||||
alias(deps.plugins.kotlin.jvm)
|
||||
alias(deps.plugins.kotlin.serialization)
|
||||
id("configuration")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
/** Domain */
|
||||
implementation(projects.domain.tokens.models)
|
||||
|
||||
/* Other */
|
||||
implementation(deps.moshi.adapters)
|
||||
implementation(deps.kotlin.serialization)
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.tangem.domain.express.models
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* Express asset model.
|
||||
*
|
||||
* @property id The unique identifier of the Express asset.
|
||||
* @property isExchangeAvailable Indicates if exchange is available for this asset.
|
||||
* @property isOnrampAvailable Indicates if onramp is available for this asset (nullable).
|
||||
*
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
@Serializable
|
||||
data class ExpressAsset(
|
||||
val id: ID,
|
||||
val isExchangeAvailable: Boolean,
|
||||
val isOnrampAvailable: Boolean?,
|
||||
) {
|
||||
|
||||
/**
|
||||
* Unique identifier for an Express asset, consisting of network ID and contract address.
|
||||
*
|
||||
* @property networkId The network ID of the asset.
|
||||
* @property contractAddress The contract address of the asset.
|
||||
*/
|
||||
@Serializable
|
||||
data class ID(val networkId: String, val contractAddress: String) {
|
||||
|
||||
companion object {
|
||||
|
||||
/**
|
||||
* Creates an [ID] instance, defaulting the contract address to "0" if null.
|
||||
*
|
||||
* @param networkId The network ID of the asset.
|
||||
* @param contractAddress The contract address of the asset, or null to default to "0".
|
||||
* @return An [ID] instance with the specified network ID and contract address.
|
||||
*/
|
||||
operator fun invoke(networkId: String, contractAddress: String?): ID {
|
||||
return ID(networkId = networkId, contractAddress = contractAddress ?: EMPTY_CONTRACT_ADDRESS_VALUE)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val EMPTY_CONTRACT_ADDRESS_VALUE = "0"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue