rippled
Namespaces | Classes | Typedefs | Functions | Variables
ripple::test::jtx Namespace Reference

Namespaces

 check
 Check operations.
 
 deposit
 Deposit preauthorize operations.
 
 detail
 
 ticket
 Ticket operations.
 
 token
 

Classes

class  Account
 Immutable cryptographic account descriptor. More...
 
struct  account_txn_id
 
struct  any_t
 
struct  AnyAmount
 Amount specifier with an option for any issuer. More...
 
struct  autofill_t
 
class  balance
 A balance matches. More...
 
struct  basic_prop
 
struct  BookSpec
 
class  delivermin
 Sets the DeliverMin on a JTx. More...
 
class  dest_tag
 Set DestinationTag on a JTx. More...
 
struct  disabled_t
 
struct  dtag
 Set the destination tag on a JTx. More...
 
class  Env
 A transaction testing environment. More...
 
class  Env_ss
 A transaction testing environment wrapper. More...
 
struct  epsilon_t
 
class  expiration
 Set Expiration on a JTx. More...
 
class  fee
 Set the fee on a JTx. More...
 
class  flags
 Match set account flags. More...
 
struct  invoice_id
 
class  IOU
 Converts to IOU Issue or STAmount. More...
 
class  json
 Inject raw JSON. More...
 
struct  JTx
 Execution context for applying a JSON transaction. More...
 
struct  last_ledger_seq
 
class  memo
 Add a memo to a JTx. More...
 
class  memodata
 
class  memoformat
 
class  memondata
 
class  memonformat
 
class  memontype
 
class  memotype
 
class  msig
 Set a multisignature on a JTx. More...
 
class  nflags
 Match clear account flags. More...
 
struct  None
 
struct  none_t
 
class  owner_count
 
class  owners
 Match the number of items in the account's owner directory. More...
 
struct  parse_error
 Thrown when parse fails. More...
 
class  path
 Add a path. More...
 
class  paths
 Set Paths, SendMax on a JTx. More...
 
struct  PrettyAmount
 Represents an XRP or IOU quantity This customizes the string conversion and supports XRP conversions from integer and floating point. More...
 
struct  prop
 Set a property on a JTx. More...
 
struct  prop_type
 
class  qualityIn
 Sets the literal QualityIn on a trust JTx. More...
 
class  qualityInPercent
 Sets the QualityIn on a trust JTx. More...
 
class  qualityOut
 Sets the literal QualityOut on a trust JTx. More...
 
class  qualityOutPercent
 Sets the QualityOut on a trust JTx as a percentage. More...
 
class  require
 Check a set of conditions. More...
 
class  sendmax
 Sets the SendMax on a JTx. More...
 
struct  seq
 Set the sequence number on a JTx. More...
 
class  sig
 Set the regular signature on a JTx. More...
 
struct  signer
 A signer in a SignerList. More...
 
class  source_tag
 Set SourceTag on a JTx. More...
 
struct  stag
 Set the source tag on a JTx. More...
 
class  SuiteLogs
 
class  ter
 Set the expected result code for a JTx The test will fail if the code doesn't match. More...
 
class  txflags
 Set the flags on a JTx. More...
 
struct  XRP_t
 

Typedefs

using checks = owner_count< ltCHECK >
 Match the number of checks on the account. More...
 
using siglists = owner_count< ltSIGNER_LIST >
 The number of signer lists matches. More...
 
using lines = owner_count< ltRIPPLE_STATE >
 Match the number of trust lines in the account's owner directory. More...
 
using offers = owner_count< ltOFFER >
 Match the number of offers in the account's owner directory. More...
 
using require_t = std::function< void(Env &)>
 
using requires_t = std::vector< require_t >
 
using tickets = owner_count< ltTICKET >
 Match the number of tickets on the account. More...
 

Functions

bool operator== (Account const &lhs, Account const &rhs) noexcept
 
template<class Hasher >
void hash_append (Hasher &h, Account const &v) noexcept
 
bool operator< (Account const &lhs, Account const &rhs) noexcept
 
Json::Value acctdelete (Account const &account, Account const &dest)
 Delete account. More...
 
bool operator== (PrettyAmount const &lhs, PrettyAmount const &rhs)
 
bool operator!= (PrettyAmount const &lhs, PrettyAmount const &rhs)
 
std::ostreamoperator<< (std::ostream &os, PrettyAmount const &amount)
 
template<class Integer , class = std::enable_if_t<std::is_integral_v<Integer>>>
PrettyAmount drops (Integer i)
 Returns an XRP PrettyAmount, which is trivially convertible to STAmount. More...
 
PrettyAmount drops (XRPAmount i)
 Returns an XRP PrettyAmount, which is trivially convertible to STAmount. More...
 
std::ostreamoperator<< (std::ostream &os, IOU const &iou)
 
template<class... Args>
std::array< Account, 1+sizeof...(Args)> noripple (Account const &account, Args const &... args)
 Designate accounts as no-ripple in Env::fund. More...
 
FeatureBitset supported_amendments ()
 
std::unique_ptr< Configenvconfig ()
 creates and initializes a default configuration for jtx::Env More...
 
template<class F , class... Args>
std::unique_ptr< Configenvconfig (F &&modfunc, Args &&... args)
 creates and initializes a default configuration for jtx::Env and invokes the provided function/lambda with the configuration object. More...
 
std::unique_ptr< Configno_admin (std::unique_ptr< Config >)
 adjust config so no admin ports are enabled More...
 
std::unique_ptr< Configsecure_gateway (std::unique_ptr< Config >)
 
std::unique_ptr< Configadmin_localnet (std::unique_ptr< Config >)
 
std::unique_ptr< Configsecure_gateway_localnet (std::unique_ptr< Config >)
 
std::unique_ptr< Configvalidator (std::unique_ptr< Config >, std::string const &)
 adjust configuration with params needed to be a validator More...
 
std::unique_ptr< Configport_increment (std::unique_ptr< Config >, int)
 adjust the default configured server ports by a specified value More...
 
std::unique_ptr< ConfigaddGrpcConfig (std::unique_ptr< Config >)
 add a grpc address and port to config More...
 
std::unique_ptr< ConfigaddGrpcConfigWithSecureGateway (std::unique_ptr< Config >, std::string const &secureGateway)
 add a grpc address, port and secure_gateway to config More...
 
Json::Value fset (Account const &account, std::uint32_t on, std::uint32_t off=0)
 Add and/or remove flag. More...
 
Json::Value fclear (Account const &account, std::uint32_t off)
 Remove account flag. More...
 
template<typename T >
static std::string to_places (const T d, std::uint8_t places)
 
Json::Value signers (Account const &account, std::uint32_t quorum, std::vector< signer > const &v)
 
Json::Value signers (Account const &account, none_t)
 Remove a signer list. More...
 
Json::Value offer (Account const &account, STAmount const &takerPays, STAmount const &takerGets, std::uint32_t flags=0)
 Create an offer. More...
 
Json::Value offer_cancel (Account const &account, std::uint32_t offerSeq)
 Cancel an offer. More...
 
Json::Value pay (Account const &account, Account const &to, AnyAmount amount)
 Create a payment. More...
 
static void insertQualityIntoJtx (SField const &field, std::uint32_t value, JTx &jt)
 
Json::Value rate (Account const &account, double multiplier)
 Set a transfer rate. More...
 
Json::Value regkey (Account const &account, disabled_t)
 Disable the regular key. More...
 
Json::Value regkey (Account const &account, Account const &signer)
 Set a regular key. More...
 
Json::Value trust (Account const &account, STAmount const &amount, std::uint32_t flags=0)
 Modify a trust line. More...
 
Json::Value trust (Account const &account, STAmount const &amount, Account const &peer, std::uint32_t flags)
 Change flags on a trust line. More...
 
STObject parse (Json::Value const &jv)
 Convert JSON to STObject. More...
 
void sign (Json::Value &jv, Account const &account)
 Sign automatically. More...
 
void fill_fee (Json::Value &jv, ReadView const &view)
 Set the fee automatically. More...
 
void fill_seq (Json::Value &jv, ReadView const &view)
 Set the sequence number automatically. More...
 
Json::Value noop (Account const &account)
 The null transaction. More...
 
template<class... Args>
require_t required (Args const &... args)
 Compose many condition functors into one. More...
 

Variables

constexpr XRPAmount dropsPerXRP {1'000'000}
 
const XRP_t XRP {}
 Converts to XRP Issue or STAmount. More...
 
static const epsilon_t epsilon
 
const any_t any {}
 Returns an amount representing "any issuer". More...
 
constexpr auto defaultseed = "shUwVw52ofnCUX5m7kPTKzJdr4HEH"
 
static const none_t none
 
static const autofill_t autofill
 
static const disabled_t disabled
 

Typedef Documentation

◆ checks

Match the number of checks on the account.

Definition at line 68 of file check.h.

◆ siglists

The number of signer lists matches.

Definition at line 116 of file multisign.h.

◆ lines

Match the number of trust lines in the account's owner directory.

Definition at line 86 of file owners.h.

◆ offers

Match the number of offers in the account's owner directory.

Definition at line 89 of file owners.h.

◆ require_t

Definition at line 32 of file requires.h.

◆ requires_t

Definition at line 33 of file requires.h.

◆ tickets

Match the number of tickets on the account.

Definition at line 64 of file ticket.h.

Function Documentation

◆ operator==() [1/2]

bool ripple::test::jtx::operator== ( Account const &  lhs,
Account const &  rhs 
)
noexcept

Definition at line 149 of file Account.h.

◆ hash_append()

template<class Hasher >
void ripple::test::jtx::hash_append ( Hasher &  h,
Account const &  v 
)
noexcept

Definition at line 156 of file Account.h.

◆ operator<()

bool ripple::test::jtx::operator< ( Account const &  lhs,
Account const &  rhs 
)
noexcept

Definition at line 162 of file Account.h.

◆ acctdelete()

Json::Value ripple::test::jtx::acctdelete ( jtx::Account const &  account,
jtx::Account const &  dest 
)

Delete account.

If successful transfer remaining XRP to dest.

Definition at line 29 of file acctdelete.cpp.

◆ operator==() [2/2]

bool ripple::test::jtx::operator== ( PrettyAmount const &  lhs,
PrettyAmount const &  rhs 
)

Definition at line 138 of file amount.h.

◆ operator!=()

bool ripple::test::jtx::operator!= ( PrettyAmount const &  lhs,
PrettyAmount const &  rhs 
)

Definition at line 144 of file amount.h.

◆ operator<<() [1/2]

std::ostream & ripple::test::jtx::operator<< ( std::ostream os,
PrettyAmount const &  amount 
)

Definition at line 73 of file amount.cpp.

◆ drops() [1/2]

template<class Integer , class = std::enable_if_t<std::is_integral_v<Integer>>>
PrettyAmount ripple::test::jtx::drops ( Integer  i)

Returns an XRP PrettyAmount, which is trivially convertible to STAmount.

Example: drops(10) Returns PrettyAmount of 10 drops

Definition at line 241 of file amount.h.

◆ drops() [2/2]

PrettyAmount ripple::test::jtx::drops ( XRPAmount  i)

Returns an XRP PrettyAmount, which is trivially convertible to STAmount.

Example: drops(view->fee().basefee) Returns PrettyAmount of 10 drops

Definition at line 252 of file amount.h.

◆ operator<<() [2/2]

std::ostream & ripple::test::jtx::operator<< ( std::ostream os,
IOU const &  iou 
)

Definition at line 120 of file amount.cpp.

◆ noripple()

template<class... Args>
std::array<Account, 1 + sizeof...(Args)> ripple::test::jtx::noripple ( Account const &  account,
Args const &...  args 
)

Designate accounts as no-ripple in Env::fund.

Definition at line 64 of file Env.h.

◆ supported_amendments()

FeatureBitset ripple::test::jtx::supported_amendments ( )

Definition at line 70 of file Env.h.

◆ envconfig() [1/2]

std::unique_ptr<Config> ripple::test::jtx::envconfig ( )

creates and initializes a default configuration for jtx::Env

Returns
unique_ptr to Config instance

Definition at line 49 of file envconfig.h.

◆ envconfig() [2/2]

template<class F , class... Args>
std::unique_ptr<Config> ripple::test::jtx::envconfig ( F &&  modfunc,
Args &&...  args 
)

creates and initializes a default configuration for jtx::Env and invokes the provided function/lambda with the configuration object.

Parameters
modfunccallable function or lambda to modify the default config. The first argument to the function must be std::unique_ptr to ripple::Config. The function takes ownership of the unique_ptr and relinquishes ownership by returning a unique_ptr.
argsadditional arguments that will be passed to the config modifier function (optional)
Returns
unique_ptr to Config instance

Definition at line 70 of file envconfig.h.

◆ no_admin()

std::unique_ptr< Config > ripple::test::jtx::no_admin ( std::unique_ptr< Config cfg)

adjust config so no admin ports are enabled

this is intended for use with envconfig, as in envconfig(no_admin)

Parameters
cfgconfig instance to be modified
Returns
unique_ptr to Config instance

Definition at line 79 of file envconfig.cpp.

◆ secure_gateway()

std::unique_ptr< Config > ripple::test::jtx::secure_gateway ( std::unique_ptr< Config cfg)

Definition at line 87 of file envconfig.cpp.

◆ admin_localnet()

std::unique_ptr< Config > ripple::test::jtx::admin_localnet ( std::unique_ptr< Config cfg)

Definition at line 96 of file envconfig.cpp.

◆ secure_gateway_localnet()

std::unique_ptr< Config > ripple::test::jtx::secure_gateway_localnet ( std::unique_ptr< Config cfg)

Definition at line 104 of file envconfig.cpp.

◆ validator()

std::unique_ptr< Config > ripple::test::jtx::validator ( std::unique_ptr< Config cfg,
std::string const &  seed 
)

adjust configuration with params needed to be a validator

this is intended for use with envconfig, as in envconfig(validator, myseed)

Parameters
cfgconfig instance to be modified
seedseed string for use in secret key generation. A fixed default value will be used if this string is empty
Returns
unique_ptr to Config instance

Definition at line 116 of file envconfig.cpp.

◆ port_increment()

std::unique_ptr< Config > ripple::test::jtx::port_increment ( std::unique_ptr< Config cfg,
int  increment 
)

adjust the default configured server ports by a specified value

This is intended for use with envconfig, as in envconfig(port_increment, 5)

Parameters
cfgconfig instance to be modified
intamount by which to increment the existing server port values in the config
Returns
unique_ptr to Config instance

Definition at line 125 of file envconfig.cpp.

◆ addGrpcConfig()

std::unique_ptr< Config > ripple::test::jtx::addGrpcConfig ( std::unique_ptr< Config cfg)

add a grpc address and port to config

This is intended for use with envconfig, for tests that require a grpc server. If this function is not called, grpc server will not start

Parameters
cfgconfig instance to be modified

Definition at line 140 of file envconfig.cpp.

◆ addGrpcConfigWithSecureGateway()

std::unique_ptr< Config > ripple::test::jtx::addGrpcConfigWithSecureGateway ( std::unique_ptr< Config cfg,
std::string const &  secureGateway 
)

add a grpc address, port and secure_gateway to config

This is intended for use with envconfig, for tests that require a grpc server. If this function is not called, grpc server will not start

Parameters
cfgconfig instance to be modified

Definition at line 149 of file envconfig.cpp.

◆ fset()

Json::Value ripple::test::jtx::fset ( Account const &  account,
std::uint32_t  on,
std::uint32_t  off = 0 
)

Add and/or remove flag.

Definition at line 28 of file flags.cpp.

◆ fclear()

Json::Value ripple::test::jtx::fclear ( Account const &  account,
std::uint32_t  off 
)

Remove account flag.

Definition at line 40 of file flags.h.

◆ to_places()

template<typename T >
static std::string ripple::test::jtx::to_places ( const T  d,
std::uint8_t  places 
)
static

Definition at line 57 of file amount.cpp.

◆ signers() [1/2]

Json::Value ripple::test::jtx::signers ( Account const &  account,
std::uint32_t  quorum,
std::vector< signer > const &  v 
)

Definition at line 35 of file multisign.cpp.

◆ signers() [2/2]

Json::Value ripple::test::jtx::signers ( Account const &  account,
none_t   
)

Remove a signer list.

Definition at line 58 of file multisign.cpp.

◆ offer()

Json::Value ripple::test::jtx::offer ( Account const &  account,
STAmount const &  takerPays,
STAmount const &  takerGets,
std::uint32_t  flags 
)

Create an offer.

Definition at line 28 of file offer.cpp.

◆ offer_cancel()

Json::Value ripple::test::jtx::offer_cancel ( Account const &  account,
std::uint32_t  offerSeq 
)

Cancel an offer.

Definition at line 45 of file offer.cpp.

◆ pay()

Json::Value ripple::test::jtx::pay ( Account const &  account,
Account const &  to,
AnyAmount  amount 
)

Create a payment.

Definition at line 29 of file pay.cpp.

◆ insertQualityIntoJtx()

static void ripple::test::jtx::insertQualityIntoJtx ( SField const &  field,
std::uint32_t  value,
JTx jt 
)
static

Definition at line 41 of file quality2.cpp.

◆ rate()

Json::Value ripple::test::jtx::rate ( Account const &  account,
double  multiplier 
)

Set a transfer rate.

Definition at line 30 of file rate.cpp.

◆ regkey() [1/2]

Json::Value ripple::test::jtx::regkey ( Account const &  account,
disabled_t   
)

Disable the regular key.

Definition at line 28 of file regkey.cpp.

◆ regkey() [2/2]

Json::Value ripple::test::jtx::regkey ( Account const &  account,
Account const &  signer 
)

Set a regular key.

Definition at line 37 of file regkey.cpp.

◆ trust() [1/2]

Json::Value ripple::test::jtx::trust ( Account const &  account,
STAmount const &  amount,
std::uint32_t  flags 
)

Modify a trust line.

Definition at line 30 of file trust.cpp.

◆ trust() [2/2]

Json::Value ripple::test::jtx::trust ( Account const &  account,
STAmount const &  amount,
Account const &  peer,
std::uint32_t  flags 
)

Change flags on a trust line.

Definition at line 43 of file trust.cpp.

◆ parse()

STObject ripple::test::jtx::parse ( Json::Value const &  jv)

Convert JSON to STObject.

This throws on failure, the JSON must be correct.

Note
Testing malformed JSON is beyond the scope of this set of unit test routines.

Definition at line 35 of file utility.cpp.

◆ sign()

void ripple::test::jtx::sign ( Json::Value jv,
Account const &  account 
)

Sign automatically.

Note
This only works on accounts with multi-signing off.

Definition at line 44 of file utility.cpp.

◆ fill_fee()

void ripple::test::jtx::fill_fee ( Json::Value jv,
ReadView const &  view 
)

Set the fee automatically.

Definition at line 55 of file utility.cpp.

◆ fill_seq()

void ripple::test::jtx::fill_seq ( Json::Value jv,
ReadView const &  view 
)

Set the sequence number automatically.

Definition at line 63 of file utility.cpp.

◆ noop()

Json::Value ripple::test::jtx::noop ( Account const &  account)

The null transaction.

Definition at line 31 of file noop.h.

◆ required()

template<class... Args>
require_t ripple::test::jtx::required ( Args const &...  args)

Compose many condition functors into one.

Definition at line 47 of file require.h.

Variable Documentation

◆ dropsPerXRP

constexpr XRPAmount ripple::test::jtx::dropsPerXRP {1'000'000}
constexpr

Definition at line 67 of file amount.h.

◆ XRP

const XRP_t ripple::test::jtx::XRP {}

Converts to XRP Issue or STAmount.

Examples: XRP Converts to the XRP Issue XRP(10) Returns STAmount of 10 XRP

Definition at line 105 of file amount.cpp.

◆ epsilon

const epsilon_t ripple::test::jtx::epsilon
static

Definition at line 282 of file amount.h.

◆ any

const any_t ripple::test::jtx::any {}

Returns an amount representing "any issuer".

Note
With respect to what the recipient will accept

Definition at line 126 of file amount.cpp.

◆ defaultseed

constexpr auto ripple::test::jtx::defaultseed = "shUwVw52ofnCUX5m7kPTKzJdr4HEH"
constexpr

Definition at line 113 of file envconfig.cpp.

◆ none

const none_t ripple::test::jtx::none
static

Definition at line 34 of file tags.h.

◆ autofill

const autofill_t ripple::test::jtx::autofill
static

Definition at line 42 of file tags.h.

◆ disabled

const disabled_t ripple::test::jtx::disabled
static

Definition at line 50 of file tags.h.