@@ -98,6 +98,45 @@ def test_valid_mpt_clawback_without_amount(self):
9898 )
9999 self .assertTrue (txn .is_valid ())
100100
101+ def test_mpt_clawback_amount_type_mismatch (self ):
102+ """asset is MPTCurrency but amount is IssuedCurrencyAmount."""
103+ with self .assertRaises (XRPLModelException ) as error :
104+ AMMClawback (
105+ account = _ISSUER_ACCOUNT ,
106+ holder = _HOLDER_ACCOUNT ,
107+ asset = MPTCurrency (mpt_issuance_id = _MPT_ISSUANCE_ID_1 ),
108+ asset2 = MPTCurrency (mpt_issuance_id = _MPT_ISSUANCE_ID_2 ),
109+ amount = IssuedCurrencyAmount (
110+ currency = "ETH" ,
111+ issuer = _ISSUER_ACCOUNT ,
112+ value = "100" ,
113+ ),
114+ )
115+ self .assertEqual (
116+ error .exception .args [0 ],
117+ "{'AMMClawback': 'Mismatch between Asset and Amount Currency types. "
118+ + "Asset is MPTCurrency whereas Amount is not.'}" ,
119+ )
120+
121+ def test_mpt_clawback_mismatched_issuance_id (self ):
122+ """asset and amount are both MPT but have different mpt_issuance_id."""
123+ with self .assertRaises (XRPLModelException ) as error :
124+ AMMClawback (
125+ account = _ISSUER_ACCOUNT ,
126+ holder = _HOLDER_ACCOUNT ,
127+ asset = MPTCurrency (mpt_issuance_id = _MPT_ISSUANCE_ID_1 ),
128+ asset2 = MPTCurrency (mpt_issuance_id = _MPT_ISSUANCE_ID_2 ),
129+ amount = MPTAmount (
130+ mpt_issuance_id = _MPT_ISSUANCE_ID_2 ,
131+ value = "10" ,
132+ ),
133+ )
134+ self .assertEqual (
135+ error .exception .args [0 ],
136+ "{'AMMClawback': 'Mismatch in the Asset.mpt_issuance_id and "
137+ + "Amount.mpt_issuance_id fields'}" ,
138+ )
139+
101140 def test_mpt_clawback_non_hex_characters (self ):
102141 bad_id = "Z" * MPT_ISSUANCE_ID_LENGTH
103142 with self .assertRaises (XRPLModelException ) as error :
0 commit comments