RegulatedAsset

class RegulatedAsset(val code: String, val issuer: String, val approvalServer: String, val approvalCriteria: String? = null) : Comparable<RegulatedAsset>

Represents a regulated asset on the Stellar network that requires approval before transactions can be submitted.

Regulated assets (SEP-8) are issued assets that have the auth_required flag set and specify an approval_server in the issuer's stellar.toml file. Transactions involving these assets must be submitted to the approval server for authorization before they can be sent to the Stellar network.

This class wraps a standard Stellar Asset (AlphaNum4 or AlphaNum12) and adds the approval server URL and optional approval criteria from the stellar.toml configuration.

Usage

Create a regulated asset

val regulatedAsset = RegulatedAsset(
code = "GOAT",
issuer = "GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX",
approvalServer = "https://example.com/tx_approve",
approvalCriteria = "Transactions must be below 500 GOAT per account per day"
)

Access the underlying asset

val asset = regulatedAsset.toAsset()
val xdr = regulatedAsset.toXdr()

See also

Constructors

Link copied to clipboard
constructor(code: String, issuer: String, approvalServer: String, approvalCriteria: String? = null)

Properties

Link copied to clipboard

Optional human-readable criteria describing the approval requirements

Link copied to clipboard

The URL of the approval server for this asset

Link copied to clipboard

The asset code (1-12 characters)

Link copied to clipboard

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

Link copied to clipboard

Returns the asset type of the underlying asset.

Functions

Link copied to clipboard
open operator override fun compareTo(other: RegulatedAsset): Int
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun toAsset(): Asset

Returns the underlying Asset instance.

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

Returns the canonical string representation of this asset in "CODE:ISSUER" format.

Link copied to clipboard

Converts the underlying asset to its XDR representation.