3#include <test/jtx/Account.h>
4#include <test/jtx/tags.h>
6#include <xrpl/basics/contract.h>
7#include <xrpl/protocol/Indexes.h>
8#include <xrpl/protocol/Issue.h>
9#include <xrpl/protocol/STAmount.h>
10#include <xrpl/protocol/Units.h>
88 :
amount_((v > 0) ? v : -v, v < 0)
165 template <
typename A>
166 requires std::convertible_to<A, Asset>
175 [[nodiscard]]
Asset const&
191 template <std::
integral T>
224 template <Val
idIssueType TIss>
228 return asset_.holds<TIss>();
273 template <
class T,
class = std::enable_if_t<std::is_
integral_v<T>>>
303 if (
double(d) / c != v)
308 if (
double(d) / c != v)
341template <
class Integer,
class = std::enable_if_t<std::is_
integral_v<Integer>>>
541 operator()(T v)
const
A currency issued by an account.
Number is a floating point type that can represent a wide range of values.
static RoundingMode getround()
Immutable cryptographic account descriptor.
AccountID id() const
Returns the Account ID.
Converts to IOU Issue or STAmount.
IOU(Account account, xrpl::Currency const ¤cy)
None operator()(NoneT) const
Returns None-of-Issue.
PrettyAmount operator()(T v) const
friend BookSpec operator~(IOU const &iou)
Converts to MPT Issue or STAmount.
operator xrpl::MPTIssue() const
Implicit conversion to MPTIssue or asset.
friend BookSpec operator~(MPT const &mpt)
xrpl::MPTIssue mptIssue() const
Explicit conversion to MPTIssue or asset.
PrettyAmount operator()(detail::EpsilonMultiple) const
MPT(AccountID const &account, std::int32_t seq=0)
PrettyAmount operator()(EpsilonT) const
xrpl::MPTID const & mpt() const
MPT(std::string n, xrpl::MPTID const &issuanceID)
operator xrpl::Asset() const
None operator()(NoneT) const
Returns None-of-Issue.
static EpsilonT const kEpsilon
constexpr XRPAmount kJtxDropsPerXrp
XrpT const XRP
Converts to XRP Issue or STAmount.
std::ostream & operator<<(std::ostream &os, PrettyAmount const &amount)
AnyT const kAny
Returns an amount representing "any issuer".
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.
constexpr XRPAmount
Convert XRP to drops (integral types).
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Issue const & xrpIssue()
Returns an asset specifier that represents XRP.
T get(Section const §ion, std::string const &name, T const &defaultValue=T{})
Retrieve a key/value pair from a section.
int scale(Number const &number, Asset const &asset)
Get the scale of a Number for a given asset.
BaseUInt< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
STAmount amountFromString(Asset const &asset, std::string const &amount)
Currency const & xrpCurrency()
XRP currency.
json::Value toJson(Asset const &asset)
BaseUInt< 192 > MPTID
MPTID is a 192-bit value representing MPT Issuance ID, which is a concatenation of a 32-bit sequence ...
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
AccountID const & xrpAccount()
Compute AccountID from public key.
MPTID makeMptID(std::uint32_t sequence, AccountID const &account)
XRPL_NO_SANITIZE_ADDRESS void Throw(Args &&... args)
Amount specifier with an option for any issuer.
AnyAmount(AnyAmount const &)=default
AnyAmount(STAmount amount)
void to(AccountID const &id)
AnyAmount & operator=(AnyAmount const &)=default
AnyAmount(STAmount amount, AnyT const *)
AnyAmount operator()(STAmount const &sta) const
BookSpec(xrpl::Asset const &asset)
detail::EpsilonMultiple operator()(std::size_t n) const
Represents an XRP, IOU, or MPT quantity This customizes the string conversion and supports XRP conver...
PrettyAmount(STAmount amount, std::string name)
std::string const & name() const
PrettyAmount(T v, std::enable_if_t< sizeof(T) >=sizeof(int) &&std::is_unsigned_v< T > > *=nullptr)
drops
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(A const &asset, std::uint32_t scale=1)
PrettyAsset(Asset const &asset, std::uint32_t scale=1)
None operator()(NoneT) const
PrettyAmount operator()(Number v, Number::RoundingMode rounding=Number::getround()) const
Asset const & raw() const
PrettyAmount operator()(T v, Number::RoundingMode rounding=Number::getround()) const
PrettyAmount operator()(double v) const
PrettyAmount operator()(Number v) const
Returns an amount of XRP as PrettyAmount, which is trivially convertible to STAmount.
None operator()(NoneT) const
Returns None-of-XRP.
friend BookSpec operator~(XrpT const &)
PrettyAmount operator()(T v) const
Returns an amount of XRP as PrettyAmount, which is trivially convertible to STAmount.