Asset

@Serializable
data class Asset(val assetType: String, val assetCode: String? = null, val assetIssuer: String? = null)

Represents an asset in the Stellar network.

Assets can be either native (XLM) or credit assets issued by an account. For credit assets, the asset type, code, and issuer are all required.

This class is used in various Horizon API responses including paths, order books, and trades.

See also

Constructors

Link copied to clipboard
constructor(assetType: String, assetCode: String? = null, assetIssuer: String? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
@SerialName(value = "asset_code")
val assetCode: String?

The asset code (null for native)

Link copied to clipboard
@SerialName(value = "asset_issuer")
val assetIssuer: String?

The issuer account ID (null for native)

Link copied to clipboard
@SerialName(value = "asset_type")
val assetType: String

The type of asset (native, credit_alphanum4, credit_alphanum12)

Functions

Link copied to clipboard

Returns true if this asset is the native asset (XLM).

Link copied to clipboard

Returns a canonical string representation of the asset. For native assets, returns "native". For credit assets, returns "CODE:ISSUER".

Link copied to clipboard

Converts a Horizon API Asset to an SDK Asset.