1#ifndef XRPL_TEST_JTX_MPT_H_INCLUDED
2#define XRPL_TEST_JTX_MPT_H_INCLUDED
4#include <test/jtx/Account.h>
5#include <test/jtx/Env.h>
6#include <test/jtx/ter.h>
7#include <test/jtx/txflags.h>
9#include <xrpl/protocol/UintTypes.h>
179 operator MPT()
const;
185 createjv(MPTCreate
const& arg = MPTCreate{});
188 destroy(MPTDestroy
const& arg = MPTDestroy{});
191 destroyjv(MPTDestroy
const& arg = MPTDestroy{});
194 authorize(MPTAuthorize
const& arg = MPTAuthorize{});
197 authorizejv(MPTAuthorize
const& arg = MPTAuthorize{});
203 set(MPTSet
const& set = {});
206 setjv(MPTSet
const& set = {});
220 uint32_t
const expectedFlags,
264 Throw<std::logic_error>(
"Uninitialized issuanceID");
277 operator Asset()
const;
286 template <
typename A>
292 txflags(arg.flags.value_or(0)),
std::shared_ptr< STLedgerEntry const > const_pointer
Immutable cryptographic account descriptor.
A transaction testing environment.
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
TER ter() const
Return the TER for the last JTx.
beast::unit_test::suite & test
void require(Args const &... args)
Check a set of requirements.
std::unordered_map< std::string, Account > const holders_
bool forObject(std::function< bool(SLEP const &sle)> const &cb, std::optional< Account > const &holder=std::nullopt) const
void set(MPTSet const &set={})
bool checkMPTokenAmount(Account const &holder, std::int64_t expectedAmount) const
std::optional< MPTID > id_
void pay(Account const &src, Account const &dest, std::int64_t amount, std::optional< TER > err=std::nullopt, std::optional< std::vector< std::string > > credentials=std::nullopt)
Account const & holder(std::string const &h) const
void create(MPTCreate const &arg=MPTCreate{})
bool isTransferFeePresent() const
bool checkMetadata(std::string const &metadata) const
bool checkFlags(uint32_t const expectedFlags, std::optional< Account > const &holder=std::nullopt) const
bool isMetadataPresent() const
MPT operator[](std::string const &name) const
void authorizeHolders(Holders const &holders)
Account const & issuer() const
void authorize(MPTAuthorize const &arg=MPTAuthorize{})
MPTID const & issuanceID() const
std::int64_t getBalance(Account const &account) const
void claw(Account const &issuer, Account const &holder, std::int64_t amount, std::optional< TER > err=std::nullopt)
TER submit(A const &arg, Json::Value const &jv)
static Json::Value setjv(MPTSet const &set={})
static Json::Value destroyjv(MPTDestroy const &arg=MPTDestroy{})
static Json::Value createjv(MPTCreate const &arg=MPTCreate{})
PrettyAmount mpt(std::int64_t amount) const
static Json::Value authorizejv(MPTAuthorize const &arg=MPTAuthorize{})
bool checkTransferFee(std::uint16_t transferFee) const
bool checkDomainID(std::optional< uint256 > expected) const
std::uint32_t getFlags(std::optional< Account > const &holder) const
static std::unordered_map< std::string, Account > makeHolders(std::vector< Account > const &holders)
PrettyAmount operator()(std::uint64_t amount) const
bool checkMPTokenOutstandingAmount(std::int64_t expectedAmount) const
Converts to MPT Issue or STAmount.
MPTTester const & tester_
std::int64_t const amount_
mptbalance(MPTTester &tester, Account const &account, std::int64_t amount)
void operator()(Env &env) const
std::optional< Account > holder_
mptflags(MPTTester &tester, std::uint32_t flags, std::optional< Account > const &holder=std::nullopt)
void operator()(Env &env) const
Match the number of items in the account's owner directory.
std::function< bool()> cb_
requireAny(std::function< bool()> const &cb)
void operator()(Env &env) const
Set the expected result code for a JTx The test will fail if the code doesn't match.
static MPTInit const mptInitNoFund
std::vector< Account > Holders
XRP_t const XRP
Converts to XRP Issue or STAmount.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
constexpr std::uint32_t const tfMPTCanTransfer
constexpr std::uint32_t const tfMPTCanTrade
std::optional< std::uint32_t > ownerCount
std::optional< std::uint32_t > holderCount
std::optional< Account > holder
std::optional< Account > account
std::optional< std::uint8_t > assetScale
static std::vector< Account > AllHolders
std::optional< std::uint32_t > mutableFlags
std::optional< std::uint32_t > holderCount
std::optional< std::string > metadata
std::optional< uint256 > domainID
std::optional< std::uint64_t > maxAmt
std::optional< std::uint32_t > ownerCount
std::optional< Account > issuer
std::optional< std::pair< std::vector< Account >, std::uint64_t > > pay
std::optional< std::uint16_t > transferFee
std::optional< std::vector< Account > > authorize
std::optional< Account > issuer
std::optional< std::uint32_t > holderCount
std::optional< std::uint32_t > ownerCount
std::uint16_t transferFee
std::optional< std::uint64_t > maxAmt
std::optional< std::uint64_t > pay
std::optional< MPTCreate > create
PrettyAmount const xrpHolders
std::optional< uint256 > domainID
std::optional< Account > account
std::optional< std::uint32_t > holderCount
std::optional< std::uint16_t > transferFee
std::optional< std::variant< Account, AccountID > > holder
std::optional< std::uint32_t > mutableFlags
std::optional< std::string > metadata
std::optional< std::uint32_t > ownerCount
std::optional< Account > delegate
Represents an XRP or IOU quantity This customizes the string conversion and supports XRP conversions ...