CurrencyDocumentation

public final class CurrencyDocumentation : Sendable

Represents currency and asset information from a stellar.toml file.

This class parses and provides access to the CURRENCIES section of a domain’s stellar.toml file. It contains comprehensive metadata about Stellar assets including both classic assets and Soroban token contracts.

Asset information includes identification (code, issuer, contract), metadata (name, description, image), supply information, anchor details for backed assets, and regulatory information for compliant assets.

Developers use this class to discover asset properties when integrating with anchors, displaying asset information in wallets, or implementing regulatory compliance features.

See also:

  • [StellarToml] for the main stellar.toml parser
  • SEP-0001
  • SEP-0008 for regulated assets
  • SEP-0041 for Soroban token metadata
  • string (<= 12 char) Token code

    Declaration

    Swift

    public let code: String?
  • string (<= 12 char) A pattern with ? as a single character wildcard. Allows a [[CURRENCIES]] entry to apply to multiple assets that share the same info. An example is futures, where the only difference between issues is the date of the contract. E.g. CORN???????? to match codes such as CORN20180604.

    Declaration

    Swift

    public let codeTemplate: String?
  • G… string Token issuer Stellar public key

    Declaration

    Swift

    public let issuer: String?
  • C… string Contract ID of the token contract (REQUIRED for Soroban tokens per SEP-41)

    Declaration

    Swift

    public let contract: String?
  • Alternately, stellar.toml can link out to a separate TOML file for each currency by specifying toml=“https://DOMAIN/.well-known/CURRENCY.toml” as the currency’s only field.

    Declaration

    Swift

    public let toml: String?
  • Status of token. One of live, dead, test, or private. Allows issuer to mark whether token is dead/for testing/for private use or is live and should be listed in live exchanges.

    Declaration

    Swift

    public let status: String?
  • int (0 to 7) Preference for number of decimals to show when a client displays currency balance

    Declaration

    Swift

    public let displayDecimals: Int?
  • string (<= 20 char) A short name for the token

    Declaration

    Swift

    public let name: String?
  • Description of token and what it represents

    Declaration

    Swift

    public let desc: String?
  • Conditions on token

    Declaration

    Swift

    public let conditions: String?
  • URL to image representing token

    Declaration

    Swift

    public let image: String?
  • Fixed number of tokens, if the number of tokens issued will never change

    Declaration

    Swift

    public let fixedNumber: Int?
  • Max number of tokens, if there will never be more than max_number tokens

    Declaration

    Swift

    public let maxNumber: Int?
  • The number of tokens is dilutable at the issuer’s discretion

    Declaration

    Swift

    public let isUnlimited: Bool?
  • true if token can be redeemed for underlying asset, otherwise false

    Declaration

    Swift

    public let isAssetAnchored: Bool?
  • Type of asset anchored. Can be fiat, crypto, nft, stock, bond, commodity, realestate, or other.

    Declaration

    Swift

    public let anchorAssetType: String?
  • If anchored token, asset that token is anchored to. E.g. USD, BTC, SBUX, Address of real-estate investment property.

    Declaration

    Swift

    public let anchorAsset: String?
  • URL to attestation or other proof, evidence, or verification of reserves, such as third-party audits.

    Declaration

    Swift

    public let attestationOfReserve: String?
  • If anchored token, these are instructions to redeem the underlying asset from tokens.

    Declaration

    Swift

    public let redemptionInstructions: String?
  • list of crypto address strings If this is an anchored crypto token, list of one or more public addresses that hold the assets for which you are issuing tokens.

    Declaration

    Swift

    public let collateralAddresses: [String]
  • list of message strings Messages stating that funds in the collateral_addresses list are reserved to back the issued asset. See below for details.

    Declaration

    Swift

    public let collateralAddressMessages: [String]
  • list of signature strings These prove you control the collateral_addresses. For each address you list, sign the entry in collateral_address_messages with the address’s private key and add the resulting string to this list as a base64-encoded raw signature.

    Declaration

    Swift

    public let collateralAddressSignatures: [String]
  • indicates whether or not this is a sep0008 regulated asset. If missing, false is assumed.

    Declaration

    Swift

    public let regulated: Bool?
  • url of a sep0008 compliant approval service that signs validated transactions.

    Declaration

    Swift

    public let approvalServer: String?
  • a human readable string that explains the issuer’s requirements for approving transactions.

    Declaration

    Swift

    public let approvalCriteria: String?
  • Initializes currency documentation from a parsed TOML document.

    Declaration

    Swift

    public init(fromToml toml: Toml)

    Parameters

    toml

    The parsed TOML document containing currency information