@@ -137,6 +137,12 @@ export interface XrpCoinConstructorOptions extends AccountConstructorOptions {
137137 contractAddress : string ;
138138}
139139
140+ export interface XrpMptCoinConstructorOptions extends AccountConstructorOptions {
141+ mptIssuanceId : string ; // 48-char hex MPTokenIssuanceID — stored as contractAddress
142+ canTransfer : boolean ; // immutable lsfMPTCanTransfer (0x0008) flag
143+ assetScale : number ; // immutable AssetScale from MPTokenIssuanceCreate
144+ }
145+
140146export interface SuiCoinConstructorOptions extends AccountConstructorOptions {
141147 packageId : string ;
142148 module : string ;
@@ -607,6 +613,25 @@ export class XrpCoin extends AccountCoinToken {
607613 }
608614}
609615
616+ /**
617+ * XRP Ledger Multi-Purpose Token (MPT) — MPTokensV1 amendment.
618+ * Identified by a 48-char hex MPTokenIssuanceID stored as contractAddress.
619+ * Uses account_objects (not account_lines). No issuer::currency pattern.
620+ * Named xrp:<token_name> — same pattern as trust-line tokens.
621+ */
622+ export class XrpMptCoin extends AccountCoinToken {
623+ public readonly contractAddress : string ; // MPTokenIssuanceID
624+ public readonly canTransfer : boolean ; // immutable — set at MPTokenIssuanceCreate
625+ public readonly assetScale : number ; // immutable — set at MPTokenIssuanceCreate
626+
627+ constructor ( options : XrpMptCoinConstructorOptions ) {
628+ super ( { ...options } ) ;
629+ this . contractAddress = options . mptIssuanceId ;
630+ this . canTransfer = options . canTransfer ;
631+ this . assetScale = options . assetScale ;
632+ }
633+ }
634+
610635export class SuiCoin extends AccountCoinToken {
611636 public packageId : string ;
612637 public module : string ;
@@ -3313,6 +3338,85 @@ export function txrpToken(
33133338 ) ;
33143339}
33153340
3341+ /**
3342+ * Factory function for mainnet XRP MPT token instances.
3343+ *
3344+ * @param id uuid v4
3345+ * @param name unique identifier of the token, e.g. "xrp:my_mpt"
3346+ * @param fullName Complete human-readable name of the token
3347+ * @param mptIssuanceId 48-char hex MPTokenIssuanceID
3348+ * @param canTransfer immutable lsfMPTCanTransfer flag from MPTokenIssuanceCreate
3349+ * @param assetScale immutable display decimal places from MPTokenIssuanceCreate (also used as decimalPlaces)
3350+ * @param asset UnderlyingAsset enum value
3351+ * @param features Optional coin features
3352+ * @param network Optional network override (defaults to mainnet XRP)
3353+ */
3354+ export function xrpMptToken (
3355+ id : string ,
3356+ name : string ,
3357+ fullName : string ,
3358+ mptIssuanceId : string ,
3359+ canTransfer : boolean ,
3360+ assetScale : number ,
3361+ asset : UnderlyingAsset ,
3362+ features : CoinFeature [ ] = AccountCoin . DEFAULT_FEATURES ,
3363+ prefix = '' ,
3364+ suffix : string = name . toUpperCase ( ) ,
3365+ network : AccountNetwork = Networks . main . xrp ,
3366+ primaryKeyCurve : KeyCurve = KeyCurve . Secp256k1
3367+ ) {
3368+ return Object . freeze (
3369+ new XrpMptCoin ( {
3370+ id,
3371+ name,
3372+ fullName,
3373+ network,
3374+ mptIssuanceId,
3375+ canTransfer,
3376+ assetScale,
3377+ prefix,
3378+ suffix,
3379+ features,
3380+ decimalPlaces : assetScale , // assetScale IS the display decimal places — same concept as decimalPlaces elsewhere
3381+ asset,
3382+ isToken : true ,
3383+ primaryKeyCurve,
3384+ baseUnit : BaseUnit . XRP ,
3385+ } )
3386+ ) ;
3387+ }
3388+
3389+ /**
3390+ * Factory function for testnet XRP MPT token instances.
3391+ */
3392+ export function txrpMptToken (
3393+ id : string ,
3394+ name : string ,
3395+ fullName : string ,
3396+ mptIssuanceId : string ,
3397+ canTransfer : boolean ,
3398+ assetScale : number ,
3399+ asset : UnderlyingAsset ,
3400+ features : CoinFeature [ ] = AccountCoin . DEFAULT_FEATURES ,
3401+ prefix = '' ,
3402+ suffix : string = name . toUpperCase ( ) ,
3403+ network : AccountNetwork = Networks . test . xrp
3404+ ) {
3405+ return xrpMptToken (
3406+ id ,
3407+ name ,
3408+ fullName ,
3409+ mptIssuanceId ,
3410+ canTransfer ,
3411+ assetScale ,
3412+ asset ,
3413+ features ,
3414+ prefix ,
3415+ suffix ,
3416+ network
3417+ ) ;
3418+ }
3419+
33163420/**
33173421 * Factory function for sui token instances.
33183422 *
0 commit comments