XRPL Currency Models¶
The XRP Ledger has two kinds of money: XRP, and issued currencies. Both types have high precision, although their formats are different.
-
class
xrpl.models.currencies.
IssuedCurrency
(*args: List[Any], **kwargs: Dict[str, Any])¶ Bases:
xrpl.models.base_model.BaseModel
Specifies an amount in an issued currency, but without a value field. This format is used for some book order requests.
See https://xrpl.org/currency-formats.html#specifying-currency-amounts
-
currency
: str = <object object>¶ This field is required.
-
issuer
: str = <object object>¶ This field is required.
-
-
class
xrpl.models.currencies.
XRP
(*args: List[Any], **kwargs: Dict[str, Any])¶ Bases:
xrpl.models.base_model.BaseModel
Specifies XRP as a currency, without a value. Normally, you will not use this model as it does not specify an amount of XRP. In cases where you need to specify an amount of XRP, you will use a string. However, for some book order requests where currencies are specified without amounts, you may need to specify the use of XRP, without a value. In these cases, you will use this object.
See https://xrpl.org/currency-formats.html#specifying-currency-amounts
-
currency
: str = 'XRP'¶
-
classmethod
from_dict
(value: Dict[str, Any]) → xrpl.models.currencies.xrp.XRP¶ Construct a new XRP from a dictionary of parameters.
- Parameters
value – The value to construct the XRP from.
- Returns
A new XRP object, constructed using the given parameters.
- Raises
XRPLModelException – If the dictionary provided is invalid.
-
to_dict
() → Dict[str, Any]¶ Returns the dictionary representation of an XRP currency object.
- Returns
The dictionary representation of an XRP currency object.
-
-
xrpl.models.currencies.
Currency
¶ The central part of internal API.
This represents a generic version of type ‘origin’ with type arguments ‘params’. There are two kind of these aliases: user defined and special. The special ones are wrappers around builtin collections and ABCs in collections.abc. These must have ‘name’ always set. If ‘inst’ is False, then the alias can’t be instantiated, this is used by e.g. typing.List and typing.Dict.
alias of Union[xrpl.models.currencies.issued_currency.IssuedCurrency, xrpl.models.currencies.xrp.XRP]