Show / Hide Table of Contents

Class MPTokenMetadataSchema

Represents the standardized metadata schema for Multi-Purpose Tokens (MPTs) as defined by XLS-89 (Multi-Purpose Token Metadata Schema). This schema defines a baseline set of fields that support reliable parsing and integration across block explorers, indexers, wallets, and cross-chain applications. The metadata is stored on-chain in the MPTokenMetadata field (max 1024 bytes).

This class does not enforce field-level validation rules (e.g. ticker charset, required asset_subclass when asset_class=rwa). The XRP Ledger server validates the raw hex blob at transaction submission time. This design matches the xrpl.js approach where MPTokenMetadata is treated as freeform.

https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0089-multi-purpose-token-metadata-schema
Inheritance
object
MPTokenMetadataSchema
Namespace: Xrpl.Models.Utils
Assembly: Xrpl.dll
Syntax
public class MPTokenMetadataSchema

Fields

| Edit this page View Source

LongToShortKeys

Long-to-short key mapping for top-level metadata fields (XLS-89 section 3).

Declaration
public static readonly Dictionary<string, string> LongToShortKeys
Field Value
Type Description
Dictionary<string, string>
| Edit this page View Source

ShortToLongKeys

Short-to-long key mapping for top-level metadata fields (XLS-89 section 3).

Declaration
public static readonly Dictionary<string, string> ShortToLongKeys
Field Value
Type Description
Dictionary<string, string>
| Edit this page View Source

UriLongToShortKeys

Long-to-short key mapping for URI nested objects (XLS-89 section 3).

Declaration
public static readonly Dictionary<string, string> UriLongToShortKeys
Field Value
Type Description
Dictionary<string, string>
| Edit this page View Source

UriShortToLongKeys

Short-to-long key mapping for URI nested objects (XLS-89 section 3).

Declaration
public static readonly Dictionary<string, string> UriShortToLongKeys
Field Value
Type Description
Dictionary<string, string>

Properties

| Edit this page View Source

AdditionalInfo

Freeform key-value data for additional information about the token.

Declaration
public Dictionary<string, object> AdditionalInfo { get; set; }
Property Value
Type Description
Dictionary<string, object>
| Edit this page View Source

AssetClass

Top-level asset classification: rwa, memes, wrapped, gaming, defi, or other.

Declaration
public string AssetClass { get; set; }
Property Value
Type Description
string
| Edit this page View Source

AssetSubclass

Asset subcategory. Required when AssetClass is "rwa". Values: stablecoin, commodity, real_estate, private_credit, equity, treasury, other.

Declaration
public string AssetSubclass { get; set; }
Property Value
Type Description
string
| Edit this page View Source

Description

Short description of the token.

Declaration
public string Description { get; set; }
Property Value
Type Description
string
| Edit this page View Source

Icon

URI to the token icon image.

Declaration
public string Icon { get; set; }
Property Value
Type Description
string
| Edit this page View Source

IssuerName

Name of the token issuer.

Declaration
public string IssuerName { get; set; }
Property Value
Type Description
string
| Edit this page View Source

Name

Display name of the token.

Declaration
public string Name { get; set; }
Property Value
Type Description
string
| Edit this page View Source

Ticker

Ticker symbol for the token. Required, max 6 characters, uppercase A-Z and 0-9.

Declaration
public string Ticker { get; set; }
Property Value
Type Description
string
| Edit this page View Source

Uris

List of related URIs (website, social, docs, other).

Declaration
public List<MPTokenMetadataUri> Uris { get; set; }
Property Value
Type Description
List<MPTokenMetadataUri>

Methods

| Edit this page View Source

FromHex(string)

Deserializes an MPTokenMetadataSchema from a hex-encoded string. Returns null if the input is null, empty, contains invalid hex, or does not represent valid XLS-89 JSON metadata.

Declaration
public static MPTokenMetadataSchema FromHex(string hex)
Parameters
Type Name Description
string hex

Hex-encoded metadata string.

Returns
Type Description
MPTokenMetadataSchema

Deserialized MPTokenMetadataSchema or null.

| Edit this page View Source

FromJson(string)

Deserializes an MPTokenMetadataSchema from a JSON string. Supports both short keys (t, n, d, ...) and long keys (ticker, name, desc, ...).

Declaration
public static MPTokenMetadataSchema FromJson(string json)
Parameters
Type Name Description
string json

JSON string containing token metadata.

Returns
Type Description
MPTokenMetadataSchema

Deserialized MPTokenMetadataSchema.

| Edit this page View Source

GetByteSize()

Returns the byte size of the serialized compact JSON (UTF-8). Useful to check the size before submitting on-chain.

Declaration
public int GetByteSize()
Returns
Type Description
int

Size in bytes of the compact JSON representation.

| Edit this page View Source

ToHex()

Serializes this metadata to a compact JSON string and returns it as an uppercase hex string. Throws System.InvalidOperationException if the result exceeds the 1024-byte limit (XLS-89).

Declaration
public string ToHex()
Returns
Type Description
string

Uppercase hex-encoded string of the compact JSON metadata.

| Edit this page View Source

ToJson(bool)

Serializes this metadata to a compact JSON string.

Declaration
public string ToJson(bool useShortKeys = true)
Parameters
Type Name Description
bool useShortKeys

If true, uses short keys (t, n, d, ...); otherwise uses long keys.

Returns
Type Description
string

Compact JSON string of the token metadata.

| Edit this page View Source

TryFromHex(string, out MPTokenMetadataSchema)

Attempts to deserialize an MPTokenMetadataSchema from a hex-encoded string. Returns false if the hex is invalid, not valid UTF-8, or not valid XLS-89 JSON.

Declaration
public static bool TryFromHex(string hex, out MPTokenMetadataSchema schema)
Parameters
Type Name Description
string hex

Hex-encoded metadata string.

MPTokenMetadataSchema schema

The deserialized schema, or null on failure.

Returns
Type Description
bool

True if deserialization succeeded; false otherwise.

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX