mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-21 11:05:51 +00:00
Add 'type' param to ledger_data and ledger rpc commands (RIPD-1446):
The 'type' field allows the rpc client to specify what type of ledger
entries to retrieve. The available types are:
"account"
"amendments"
"directory"
"fee"
"hashes"
"offer"
"signer_list"
"state"
"ticket"
This commit is contained in:
committed by
Nik Bougalis
parent
fab3ec0b56
commit
1a7a6f22e2
@@ -652,6 +652,44 @@ class LedgerRPC_test : public beast::unit_test::suite
|
||||
|
||||
}
|
||||
|
||||
void testLedgerAccountsType()
|
||||
{
|
||||
testcase("Ledger Request, Accounts Option");
|
||||
using namespace test::jtx;
|
||||
|
||||
Env env {*this};
|
||||
|
||||
env.close();
|
||||
|
||||
std::string index;
|
||||
{
|
||||
Json::Value jvParams;
|
||||
jvParams[jss::ledger_index] = 3u;
|
||||
jvParams[jss::accounts] = true;
|
||||
jvParams[jss::expand] = true;
|
||||
jvParams[jss::type] = "hashes";
|
||||
auto const jrr = env.rpc ( "json", "ledger", to_string(jvParams) ) [jss::result];
|
||||
BEAST_EXPECT(jrr[jss::ledger].isMember(jss::accountState));
|
||||
BEAST_EXPECT(jrr[jss::ledger][jss::accountState].isArray());
|
||||
BEAST_EXPECT(jrr[jss::ledger][jss::accountState].size() == 1u);
|
||||
BEAST_EXPECT(jrr[jss::ledger][jss::accountState][0u]["LedgerEntryType"]
|
||||
== "LedgerHashes");
|
||||
index = jrr[jss::ledger][jss::accountState][0u]["index"].asString();
|
||||
}
|
||||
{
|
||||
Json::Value jvParams;
|
||||
jvParams[jss::ledger_index] = 3u;
|
||||
jvParams[jss::accounts] = true;
|
||||
jvParams[jss::expand] = false;
|
||||
jvParams[jss::type] = "hashes";
|
||||
auto const jrr = env.rpc ( "json", "ledger", to_string(jvParams) ) [jss::result];
|
||||
BEAST_EXPECT(jrr[jss::ledger].isMember(jss::accountState));
|
||||
BEAST_EXPECT(jrr[jss::ledger][jss::accountState].isArray());
|
||||
BEAST_EXPECT(jrr[jss::ledger][jss::accountState].size() == 1u);
|
||||
BEAST_EXPECT(jrr[jss::ledger][jss::accountState][0u] == index);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
void run ()
|
||||
{
|
||||
@@ -668,6 +706,7 @@ public:
|
||||
testLookupLedger();
|
||||
testNoQueue();
|
||||
testQueue();
|
||||
testLedgerAccountsType();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user