rippled
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
xrpl::test::jtx::MPTTester Class Reference

#include <mpt.h>

Collaboration diagram for xrpl::test::jtx::MPTTester:
Collaboration graph
[legend]

Public Member Functions

 MPTTester (Env &env, Account const &issuer, MPTInit const &constr={})
 
 MPTTester (MPTInitDef const &constr)
 
 MPTTester (Env &env, Account const &issuer, MPTID const &id, std::vector< Account > const &holders={}, bool close=true)
 
 operator MPT () const
 
void create (MPTCreate const &arg=MPTCreate{})
 
void destroy (MPTDestroy const &arg=MPTDestroy{})
 
void authorize (MPTAuthorize const &arg=MPTAuthorize{})
 
void authorizeHolders (Holders const &holders)
 
void set (MPTSet const &set={})
 
bool checkDomainID (std::optional< uint256 > expected) const
 
bool checkMPTokenAmount (Account const &holder, std::int64_t expectedAmount) const
 
bool checkMPTokenOutstandingAmount (std::int64_t expectedAmount) const
 
bool checkFlags (uint32_t const expectedFlags, std::optional< Account > const &holder=std::nullopt) const
 
bool checkMetadata (std::string const &metadata) const
 
bool isMetadataPresent () const
 
bool checkTransferFee (std::uint16_t transferFee) const
 
bool isTransferFeePresent () const
 
Account const & issuer () const
 
Account const & holder (std::string const &h) const
 
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)
 
void claw (Account const &issuer, Account const &holder, std::int64_t amount, std::optional< TER > err=std::nullopt)
 
PrettyAmount mpt (std::int64_t amount) const
 
MPTID const & issuanceID () const
 
std::int64_t getBalance (Account const &account) const
 
MPT operator[] (std::string const &name) const
 
PrettyAmount operator() (std::uint64_t amount) const
 
 operator Asset () const
 

Static Public Member Functions

static Json::Value createjv (MPTCreate const &arg=MPTCreate{})
 
static Json::Value destroyjv (MPTDestroy const &arg=MPTDestroy{})
 
static Json::Value authorizejv (MPTAuthorize const &arg=MPTAuthorize{})
 
static Json::Value setjv (MPTSet const &set={})
 

Private Types

using SLEP = SLE::const_pointer
 

Private Member Functions

bool forObject (std::function< bool(SLEP const &sle)> const &cb, std::optional< Account > const &holder=std::nullopt) const
 
template<typename A >
TER submit (A const &arg, Json::Value const &jv)
 
std::uint32_t getFlags (std::optional< Account > const &holder) const
 

Static Private Member Functions

static std::unordered_map< std::string, AccountmakeHolders (std::vector< Account > const &holders)
 

Private Attributes

Envenv_
 
Account const issuer_
 
std::unordered_map< std::string, Account > const holders_
 
std::optional< MPTIDid_
 
bool close_
 

Detailed Description

Definition at line 162 of file mpt.h.

Member Typedef Documentation

◆ SLEP

Definition at line 280 of file mpt.h.

Constructor & Destructor Documentation

◆ MPTTester() [1/3]

xrpl::test::jtx::MPTTester::MPTTester ( Env env,
Account const &  issuer,
MPTInit const &  constr = {} 
)

Definition at line 41 of file mpt.cpp.

◆ MPTTester() [2/3]

xrpl::test::jtx::MPTTester::MPTTester ( MPTInitDef const &  constr)

Definition at line 101 of file mpt.cpp.

◆ MPTTester() [3/3]

xrpl::test::jtx::MPTTester::MPTTester ( Env env,
Account const &  issuer,
MPTID const &  id,
std::vector< Account > const &  holders = {},
bool  close = true 
)

Definition at line 69 of file mpt.cpp.

Member Function Documentation

◆ operator MPT()

xrpl::test::jtx::MPTTester::operator MPT ( ) const

Definition at line 112 of file mpt.cpp.

◆ create()

void xrpl::test::jtx::MPTTester::create ( MPTCreate const &  arg = MPTCreate{})

Definition at line 144 of file mpt.cpp.

◆ createjv()

Json::Value xrpl::test::jtx::MPTTester::createjv ( MPTCreate const &  arg = MPTCreate{})
static

Definition at line 120 of file mpt.cpp.

◆ destroy()

void xrpl::test::jtx::MPTTester::destroy ( MPTDestroy const &  arg = MPTDestroy{})

Definition at line 216 of file mpt.cpp.

◆ destroyjv()

Json::Value xrpl::test::jtx::MPTTester::destroyjv ( MPTDestroy const &  arg = MPTDestroy{})
static

Definition at line 203 of file mpt.cpp.

◆ authorize()

void xrpl::test::jtx::MPTTester::authorize ( MPTAuthorize const &  arg = MPTAuthorize{})

Definition at line 252 of file mpt.cpp.

◆ authorizejv()

Json::Value xrpl::test::jtx::MPTTester::authorizejv ( MPTAuthorize const &  arg = MPTAuthorize{})
static

Definition at line 236 of file mpt.cpp.

◆ authorizeHolders()

void xrpl::test::jtx::MPTTester::authorizeHolders ( Holders const &  holders)

Definition at line 316 of file mpt.cpp.

◆ set()

void xrpl::test::jtx::MPTTester::set ( MPTSet const &  set = {})

Definition at line 360 of file mpt.cpp.

◆ setjv()

Json::Value xrpl::test::jtx::MPTTester::setjv ( MPTSet const &  set = {})
static

Definition at line 325 of file mpt.cpp.

◆ checkDomainID()

bool xrpl::test::jtx::MPTTester::checkDomainID ( std::optional< uint256 expected) const

Definition at line 447 of file mpt.cpp.

◆ checkMPTokenAmount()

bool xrpl::test::jtx::MPTTester::checkMPTokenAmount ( Account const &  holder,
std::int64_t  expectedAmount 
) const

Definition at line 457 of file mpt.cpp.

◆ checkMPTokenOutstandingAmount()

bool xrpl::test::jtx::MPTTester::checkMPTokenOutstandingAmount ( std::int64_t  expectedAmount) const

Definition at line 467 of file mpt.cpp.

◆ checkFlags()

bool xrpl::test::jtx::MPTTester::checkFlags ( uint32_t const  expectedFlags,
std::optional< Account > const &  holder = std::nullopt 
) const

Definition at line 475 of file mpt.cpp.

◆ checkMetadata()

bool xrpl::test::jtx::MPTTester::checkMetadata ( std::string const &  metadata) const

Definition at line 483 of file mpt.cpp.

◆ isMetadataPresent()

bool xrpl::test::jtx::MPTTester::isMetadataPresent ( ) const

Definition at line 494 of file mpt.cpp.

◆ checkTransferFee()

bool xrpl::test::jtx::MPTTester::checkTransferFee ( std::uint16_t  transferFee) const

Definition at line 502 of file mpt.cpp.

◆ isTransferFeePresent()

bool xrpl::test::jtx::MPTTester::isTransferFeePresent ( ) const

Definition at line 512 of file mpt.cpp.

◆ issuer()

Account const & xrpl::test::jtx::MPTTester::issuer ( ) const

Definition at line 236 of file mpt.h.

◆ holder()

Account const & xrpl::test::jtx::MPTTester::holder ( std::string const &  h) const

Definition at line 227 of file mpt.cpp.

◆ pay()

void xrpl::test::jtx::MPTTester::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 
)

Definition at line 520 of file mpt.cpp.

◆ claw()

void xrpl::test::jtx::MPTTester::claw ( Account const &  issuer,
Account const &  holder,
std::int64_t  amount,
std::optional< TER err = std::nullopt 
)

Definition at line 571 of file mpt.cpp.

◆ mpt()

PrettyAmount xrpl::test::jtx::MPTTester::mpt ( std::int64_t  amount) const

Definition at line 594 of file mpt.cpp.

◆ issuanceID()

MPTID const & xrpl::test::jtx::MPTTester::issuanceID ( ) const

Definition at line 261 of file mpt.h.

◆ getBalance()

std::int64_t xrpl::test::jtx::MPTTester::getBalance ( Account const &  account) const

Definition at line 609 of file mpt.cpp.

◆ operator[]()

MPT xrpl::test::jtx::MPTTester::operator[] ( std::string const &  name) const

Definition at line 641 of file mpt.cpp.

◆ operator()()

PrettyAmount xrpl::test::jtx::MPTTester::operator() ( std::uint64_t  amount) const

Definition at line 647 of file mpt.cpp.

◆ operator Asset()

xrpl::test::jtx::MPTTester::operator Asset ( ) const

Definition at line 601 of file mpt.cpp.

◆ forObject()

bool xrpl::test::jtx::MPTTester::forObject ( std::function< bool(SLEP const &sle)> const &  cb,
std::optional< Account > const &  holder = std::nullopt 
) const
private

Definition at line 433 of file mpt.cpp.

◆ submit()

template<typename A >
TER xrpl::test::jtx::MPTTester::submit ( A const &  arg,
Json::Value const &  jv 
)
private

Definition at line 288 of file mpt.h.

◆ makeHolders()

std::unordered_map< std::string, Account > xrpl::test::jtx::MPTTester::makeHolders ( std::vector< Account > const &  holders)
staticprivate

Definition at line 29 of file mpt.cpp.

◆ getFlags()

std::uint32_t xrpl::test::jtx::MPTTester::getFlags ( std::optional< Account > const &  holder) const
private

Definition at line 627 of file mpt.cpp.

Member Data Documentation

◆ env_

Env& xrpl::test::jtx::MPTTester::env_
private

Definition at line 164 of file mpt.h.

◆ issuer_

Account const xrpl::test::jtx::MPTTester::issuer_
private

Definition at line 165 of file mpt.h.

◆ holders_

std::unordered_map<std::string, Account> const xrpl::test::jtx::MPTTester::holders_
private

Definition at line 166 of file mpt.h.

◆ id_

std::optional<MPTID> xrpl::test::jtx::MPTTester::id_
private

Definition at line 167 of file mpt.h.

◆ close_

bool xrpl::test::jtx::MPTTester::close_
private

Definition at line 168 of file mpt.h.