Regulated Asset
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"
)Content copied to clipboard
Access the underlying asset
val asset = regulatedAsset.toAsset()
val xdr = regulatedAsset.toXdr()Content copied to clipboard