1#ifndef XRPL_TEST_JTX_AMOUNT_H_INCLUDED
2#define XRPL_TEST_JTX_AMOUNT_H_INCLUDED
4#include <test/jtx/Account.h>
5#include <test/jtx/tags.h>
7#include <xrpl/basics/contract.h>
8#include <xrpl/protocol/Issue.h>
9#include <xrpl/protocol/STAmount.h>
10#include <xrpl/protocol/Units.h>
89 :
amount_((v > 0) ? v : -v, v < 0)
167 template <
typename A>
195 template <std::
integral T>
229 template <Val
idIssueType TIss>
270 template <
class T,
class = std::enable_if_t<std::is_
integral_v<T>>>
290 Throw<std::domain_error>(
"unrepresentable");
301 if (
double(d) / c != v)
302 Throw<std::domain_error>(
"unrepresentable");
306 if (
double(d) / c != v)
307 Throw<std::domain_error>(
"unrepresentable");
339template <
class Integer,
class = std::enable_if_t<std::is_
integral_v<Integer>>>
512 operator()(T v)
const
533 Throw<std::logic_error>(
"MPT is not supported");
constexpr bool holds() const
A currency issued by an account.
static rounding_mode getround()
void setIssuer(AccountID const &uIssuer)
int signum() const noexcept
constexpr value_type drops() const
Returns the number of drops.
Immutable cryptographic account descriptor.
std::string const & name() const
Return the name.
AccountID id() const
Returns the Account ID.
Converts to IOU Issue or STAmount.
PrettyAmount operator()(T v) const
friend BookSpec operator~(IOU const &iou)
IOU(Account const &account_, xrpl::Currency const ¤cy_)
None operator()(none_t) const
Returns None-of-Issue.
Converts to MPT Issue or STAmount.
friend BookSpec operator~(MPT const &mpt)
xrpl::MPTIssue mptIssue() const
Explicit conversion to MPTIssue or asset.
MPT(std::string const &n, xrpl::MPTID const &issuanceID_)
PrettyAmount operator()(epsilon_t) const
xrpl::MPTID const & mpt() const
PrettyAmount operator()(detail::epsilon_multiple) const
None operator()(none_t) const
Returns None-of-Issue.
any_t const any
Returns an amount representing "any issuer".
static epsilon_t const epsilon
std::ostream & operator<<(std::ostream &os, PrettyAmount const &amount)
XRP_t const XRP
Converts to XRP Issue or STAmount.
constexpr XRPAmount dropsPerXRP
bool operator!=(PrettyAmount const &lhs, PrettyAmount const &rhs)
bool operator==(Account const &lhs, Account const &rhs) noexcept
PrettyAmount drops(Integer i)
Returns an XRP PrettyAmount, which is trivially convertible to STAmount.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Issue const & xrpIssue()
Returns an asset specifier that represents XRP.
STAmount amountFromString(Asset const &asset, std::string const &amount)
Currency const & xrpCurrency()
XRP currency.
Json::Value to_json(Asset const &asset)
Currency const & noCurrency()
A placeholder for empty currencies.
AccountID const & xrpAccount()
Compute AccountID from public key.
Amount specifier with an option for any issuer.
AnyAmount(AnyAmount const &)=default
void to(AccountID const &id)
AnyAmount & operator=(AnyAmount const &)=default
AnyAmount(STAmount const &amount, any_t const *)
AnyAmount(STAmount const &amount)
BookSpec(AccountID const &account_, xrpl::Currency const ¤cy_)
Represents an XRP or IOU quantity This customizes the string conversion and supports XRP conversions ...
std::string const & name() const
PrettyAmount(T v, std::enable_if_t< sizeof(T) >=sizeof(int) &&std::is_unsigned_v< T > > *=nullptr)
drops
PrettyAmount(STAmount const &amount, std::string const &name)
PrettyAmount(PrettyAmount const &)=default
STAmount const & value() const
PrettyAmount(XRPAmount v)
drops
PrettyAmount & operator=(PrettyAmount const &)=default
PrettyAmount(T v, std::enable_if_t< sizeof(T) >=sizeof(int) &&std::is_integral_v< T > &&std::is_signed_v< T > > *=nullptr)
drops
PrettyAsset(Asset const &asset, std::uint32_t scale=1)
None operator()(none_t) const
PrettyAmount operator()(T v, Number::rounding_mode rounding=Number::getround()) const
Asset const & raw() const
PrettyAsset(A const &asset, std::uint32_t scale=1)
PrettyAmount operator()(Number v, Number::rounding_mode rounding=Number::getround()) const
None operator()(none_t) const
Returns None-of-XRP.
friend BookSpec operator~(XRP_t const &)
PrettyAmount operator()(double v) const
PrettyAmount operator()(Number v) const
Returns an amount of XRP as PrettyAmount, which is trivially convertible to STAmount.
PrettyAmount operator()(T v) const
Returns an amount of XRP as PrettyAmount, which is trivially convertible to STAmount.
AnyAmount operator()(STAmount const &sta) const
detail::epsilon_multiple operator()(std::size_t n) const