2#include <test/jtx/WSClient.h> 
    4#include "xrpl/beast/unit_test/suite.h" 
    5#include "xrpl/protocol/jss.h" 
   16        testcase(
"Specify well-known strings as ledger input");
 
   22        params[
"ledger"] = 
"validated";
 
   23        resp = env.
rpc(
"json", 
"book_changes", 
to_string(params));
 
   24        BEAST_EXPECT(!resp[jss::result].isMember(jss::error));
 
   25        BEAST_EXPECT(resp[jss::result][jss::status] == 
"success");
 
   26        BEAST_EXPECT(resp[jss::result][jss::validated] == 
true);
 
   28        params[
"ledger"] = 
"current";
 
   29        resp = env.
rpc(
"json", 
"book_changes", 
to_string(params));
 
   30        BEAST_EXPECT(!resp[jss::result].isMember(jss::error));
 
   31        BEAST_EXPECT(resp[jss::result][jss::status] == 
"success");
 
   32        BEAST_EXPECT(resp[jss::result][jss::validated] == 
false);
 
   34        params[
"ledger"] = 
"closed";
 
   35        resp = env.
rpc(
"json", 
"book_changes", 
to_string(params));
 
   36        BEAST_EXPECT(!resp[jss::result].isMember(jss::error));
 
   37        BEAST_EXPECT(resp[jss::result][jss::status] == 
"success");
 
   42        BEAST_EXPECT(resp[jss::result][jss::validated] == 
true);
 
   45        params[
"ledger"] = 
"non_conventional_ledger_input";
 
   46        resp = env.
rpc(
"json", 
"book_changes", 
to_string(params));
 
   47        BEAST_EXPECT(resp[jss::result].isMember(jss::error));
 
   48        BEAST_EXPECT(resp[jss::result][jss::status] != 
"success");
 
 
   55            "If ledger_hash or ledger_index is not specified, the behavior " 
   56            "must default to the `current` ledger");
 
   63        BEAST_EXPECT(!resp[jss::result].isMember(jss::error));
 
   64        BEAST_EXPECT(resp[jss::result][jss::status] == 
"success");
 
 
   79            featureCredentials | featurePermissionedDEX};
 
   83        auto const& [gw, domainOwner, alice, bob, carol, USD, domainID, credType] =
 
   91        env(
pay(bob, carol, USD(10)),
 
  101        auto const ledgerIndex = txResult[jss::ledger_index].
asInt();
 
  104        jvParams[jss::ledger_index] = ledgerIndex;
 
  106        auto jv = wsc->invoke(
"book_changes", jvParams);
 
  107        auto jrr = jv[jss::result];
 
  109        BEAST_EXPECT(jrr[jss::changes].size() == 1);
 
  111            jrr[jss::changes][0u][jss::domain].asString() ==
 
 
 
testcase_t testcase
Memberspace for declaring test cases.
 
virtual Config & config()=0
 
void run() override
Runs the suite.
 
void testConventionalLedgerInputStrings()
 
void testLedgerInputDefaultBehavior()
 
A transaction testing environment.
 
std::shared_ptr< STTx const > tx() const
Return the tx data for the last JTx.
 
bool close(NetClock::time_point closeTime, std::optional< std::chrono::milliseconds > consensusDelay=std::nullopt)
Close and advance the ledger.
 
Json::Value rpc(unsigned apiVersion, std::unordered_map< std::string, std::string > const &headers, std::string const &cmd, Args &&... args)
Execute an RPC command.
 
Set the expected result code for a JTx The test will fail if the code doesn't match.
 
Sets the SendMax on a JTx.
 
Json::Value pay(AccountID const &account, AccountID const &to, AnyAmount amount)
Create a payment.
 
FeatureBitset testable_amendments()
 
Json::Value offer(Account const &account, STAmount const &takerPays, STAmount const &takerGets, std::uint32_t flags)
Create an offer.
 
XRP_t const XRP
Converts to XRP Issue or STAmount.
 
std::unique_ptr< WSClient > makeWSClient(Config const &cfg, bool v2, unsigned rpc_version, std::unordered_map< std::string, std::string > const &headers)
Returns a client operating through WebSockets/S.
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
std::string to_string(base_uint< Bits, Tag > const &a)