Skip to content

Commit 6979324

Browse files
ckeshavakhancode
andauthored
fix: update error msg for MPT float inputs; fix #796 (#813)
--------- Co-authored-by: Omar Khan <[email protected]>
1 parent 8c82350 commit 6979324

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

xrpl/core/binarycodec/types/amount.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ def verify_mpt_value(mpt_value: str) -> None:
125125
"""
126126
# Contains no decimal point
127127
if not _contains_decimal(mpt_value):
128-
raise XRPLBinaryCodecException(f"{mpt_value} is an invalid MPT amount.")
128+
raise XRPLBinaryCodecException(
129+
f"{mpt_value} is a decimal value. Please use string type to represent it."
130+
)
129131

130132
decimal = None
131133
try:

xrpl/models/amounts/mpt_amount.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from dataclasses import dataclass
6-
from typing import Dict, Union
6+
from typing import Dict
77

88
from typing_extensions import Self
99

@@ -24,7 +24,7 @@ class MPTAmount(BaseModel):
2424
:meta hide-value:
2525
"""
2626

27-
value: Union[str, int, float] = REQUIRED # type: ignore
27+
value: str = REQUIRED # type: ignore
2828
"""
2929
This field is required.
3030

0 commit comments

Comments
 (0)