create

fun create(canonicalForm: String): Asset

Parses an asset string and returns the equivalent Asset instance.

The asset string is expected to be either:

  • "native" for the native asset (Lumens)

  • "CODE:ISSUER" for issued assets (AlphaNum4 or AlphaNum12)

Return

Asset instance (AssetTypeNative, AssetTypeCreditAlphaNum4, or AssetTypeCreditAlphaNum12)

Parameters

canonicalForm

Canonical string representation of an asset

See also

Throws

if the asset string is invalid


fun create(type: String?, code: String?, issuer: String?): Asset

Creates an asset from individual components.

Return

Asset instance

Parameters

type

The asset type ("native" or null for auto-detection)

code

The asset code (null for native)

issuer

The asset issuer (null for native)

Throws

if the parameters are invalid