XRPL Amount Models¶
An Amount is an object specifying a currency, a quantity of that currency, and the counterparty (issuer) on the trustline that holds the value. For XRP, there is no counterparty.
- class xrpl.models.amounts.IssuedCurrencyAmount(*args: List[Any], **kwargs: Dict[str, Any])¶
Bases:
xrpl.models.currencies.issued_currency.IssuedCurrency
Specifies an amount in an issued currency.
See https://xrpl.org/currency-formats.html#issued-currency-amounts.
- currency: str¶
This field is required.
- classmethod from_dict(value: Dict[str, Any]) xrpl.models.base_model.BaseModel ¶
Construct a new BaseModel from a dictionary of parameters.
- Parameters
value – The value to construct the BaseModel from.
- Returns
A new BaseModel object, constructed using the given parameters.
- Raises
XRPLModelException – If the dictionary provided is invalid.
- classmethod from_xrpl(value: Union[str, Dict[str, Any]]) xrpl.models.base_model.BaseModel ¶
Creates a BaseModel object based on a JSON-like dictionary of keys in the JSON format used by the binary codec, or an actual JSON string representing the same data.
- Parameters
value – The dictionary or JSON string to be instantiated.
- Returns
A BaseModel object instantiated from the input.
- classmethod is_dict_of_model(dictionary: Dict[str, Any]) bool ¶
Checks whether the provided
dictionary
is a dictionary representation of this class.Note: This only checks the exact model, and does not count model inheritance. This method returns
False
if the dictionary represents a subclass of this class.- Parameters
dictionary – The dictionary to check.
- Returns
True if dictionary is a
dict
representation of an instance of this class; False if not.
- is_valid() bool ¶
Returns whether this BaseModel is valid.
- Returns
Whether this BaseModel is valid.
- issuer: str¶
This field is required.
- to_dict() Dict[str, Any] ¶
Returns the dictionary representation of a BaseModel.
If not overridden, returns the object dict with all non-None values.
- Returns
The dictionary representation of a BaseModel.
- validate() None ¶
Raises if this object is invalid.
- Raises
XRPLModelException – if this object is invalid.
- value: str¶
This field is required.
- xrpl.models.amounts.is_issued_currency(amount: Union[xrpl.models.amounts.issued_currency_amount.IssuedCurrencyAmount, str]) bool ¶
Returns whether amount is an issued currency value, as opposed to an XRP value.
- Parameters
amount – The Amount object whose type is being checked.
- Returns
Whether the amount is an issued currency value.
- xrpl.models.amounts.is_xrp(amount: Union[xrpl.models.amounts.issued_currency_amount.IssuedCurrencyAmount, str]) bool ¶
Returns whether amount is an XRP value, as opposed to an issued currency.
- Parameters
amount – The Amount object whose type is being checked.
- Returns
Whether the amount is an XRP value.
- xrpl.models.amounts.Amount¶
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.amounts.issued_currency_amount.IssuedCurrencyAmount
,str
]