AssetTypeCreditAlphaNum4

Represents issued assets with codes 1-4 characters long.

This class is used for assets with short codes like "USD", "EUR", "BTC", etc.

Validation

  • Code length must be 1-4 characters

  • Code must contain only uppercase letters (A-Z) and digits (0-9)

  • Issuer must be a valid ed25519 public key (G... address)

Usage

val usd = AssetTypeCreditAlphaNum4("USD", "GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX")
val btc = AssetTypeCreditAlphaNum4("BTC", "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN")

Throws

if code length is not 1-4 characters or issuer is invalid

Constructors

Link copied to clipboard
constructor(code: String, issuer: String)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val code: String

The asset code (1-4 characters)

Link copied to clipboard
open override val issuer: String

The issuer's account ID (G... address)

Link copied to clipboard
open override val type: AssetTypeXdr

Returns the asset type.

Functions

Link copied to clipboard
open operator override fun compareTo(other: Asset): Int
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
suspend fun getContractId(network: Network): String

Returns the contract ID for this asset on the given network.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String

Returns a canonical string representation of this asset.

Link copied to clipboard
open override fun toXdr(): AssetXdr

Converts this asset to its XDR representation.