mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-05 01:37:00 +00:00
refactor: Use more scoped enums (#7086)
This commit is contained in:
@@ -62,9 +62,9 @@ class AccountCurrencies_test : public beast::unit_test::Suite
|
||||
testInvalidAccountParam(1);
|
||||
testInvalidAccountParam(1.1);
|
||||
testInvalidAccountParam(true);
|
||||
testInvalidAccountParam(json::Value(json::NullValue));
|
||||
testInvalidAccountParam(json::Value(json::ObjectValue));
|
||||
testInvalidAccountParam(json::Value(json::ArrayValue));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Null));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Object));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Array));
|
||||
}
|
||||
|
||||
{
|
||||
@@ -80,9 +80,9 @@ class AccountCurrencies_test : public beast::unit_test::Suite
|
||||
testInvalidIdentParam(1);
|
||||
testInvalidIdentParam(1.1);
|
||||
testInvalidIdentParam(true);
|
||||
testInvalidIdentParam(json::Value(json::NullValue));
|
||||
testInvalidIdentParam(json::Value(json::ObjectValue));
|
||||
testInvalidIdentParam(json::Value(json::ArrayValue));
|
||||
testInvalidIdentParam(json::Value(json::ValueType::Null));
|
||||
testInvalidIdentParam(json::Value(json::ValueType::Object));
|
||||
testInvalidIdentParam(json::Value(json::ValueType::Array));
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -75,9 +75,9 @@ public:
|
||||
testInvalidAccountParam(1);
|
||||
testInvalidAccountParam(1.1);
|
||||
testInvalidAccountParam(true);
|
||||
testInvalidAccountParam(json::Value(json::NullValue));
|
||||
testInvalidAccountParam(json::Value(json::ObjectValue));
|
||||
testInvalidAccountParam(json::Value(json::ArrayValue));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Null));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Object));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Array));
|
||||
}
|
||||
{
|
||||
// Cannot pass a non-string into the `ident` param
|
||||
@@ -93,9 +93,9 @@ public:
|
||||
testInvalidIdentParam(1);
|
||||
testInvalidIdentParam(1.1);
|
||||
testInvalidIdentParam(true);
|
||||
testInvalidIdentParam(json::Value(json::NullValue));
|
||||
testInvalidIdentParam(json::Value(json::ObjectValue));
|
||||
testInvalidIdentParam(json::Value(json::ArrayValue));
|
||||
testInvalidIdentParam(json::Value(json::ValueType::Null));
|
||||
testInvalidIdentParam(json::Value(json::ValueType::Object));
|
||||
testInvalidIdentParam(json::Value(json::ValueType::Array));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,9 +75,9 @@ public:
|
||||
testInvalidAccountParam(1);
|
||||
testInvalidAccountParam(1.1);
|
||||
testInvalidAccountParam(true);
|
||||
testInvalidAccountParam(json::Value(json::NullValue));
|
||||
testInvalidAccountParam(json::Value(json::ObjectValue));
|
||||
testInvalidAccountParam(json::Value(json::ArrayValue));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Null));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Object));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Array));
|
||||
}
|
||||
Account const alice{"alice"};
|
||||
{
|
||||
@@ -215,7 +215,7 @@ public:
|
||||
// Invalid index
|
||||
json::Value params;
|
||||
params[jss::account] = alice.human();
|
||||
params[jss::ledger_index] = json::ObjectValue;
|
||||
params[jss::ledger_index] = json::ValueType::Object;
|
||||
auto const lines = env.rpc("json", "account_lines", to_string(params))[jss::result];
|
||||
BEAST_EXPECT(lines[jss::error] == "invalidParams");
|
||||
BEAST_EXPECT(
|
||||
@@ -528,7 +528,7 @@ public:
|
||||
jv[jss::TransactionType] = jss::PaymentChannelCreate;
|
||||
jv[jss::Account] = account.human();
|
||||
jv[jss::Destination] = to.human();
|
||||
jv[jss::Amount] = amount.getJson(JsonOptions::KNone);
|
||||
jv[jss::Amount] = amount.getJson(JsonOptions::Values::None);
|
||||
jv["SettleDelay"] = settleDelay.count();
|
||||
jv["PublicKey"] = strHex(pk.slice());
|
||||
return jv;
|
||||
@@ -618,7 +618,7 @@ public:
|
||||
// the list will be empty for most calls.
|
||||
auto getNextLine =
|
||||
[](Env& env, Account const& alice, std::optional<std::string> const marker) {
|
||||
json::Value params(json::ObjectValue);
|
||||
json::Value params(json::ValueType::Object);
|
||||
params[jss::account] = alice.human();
|
||||
params[jss::limit] = 1;
|
||||
if (marker)
|
||||
|
||||
@@ -144,9 +144,9 @@ public:
|
||||
testInvalidAccountParam(1);
|
||||
testInvalidAccountParam(1.1);
|
||||
testInvalidAccountParam(true);
|
||||
testInvalidAccountParam(json::Value(json::NullValue));
|
||||
testInvalidAccountParam(json::Value(json::ObjectValue));
|
||||
testInvalidAccountParam(json::Value(json::ArrayValue));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Null));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Object));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Array));
|
||||
}
|
||||
// test error on malformed account string.
|
||||
{
|
||||
@@ -674,7 +674,7 @@ public:
|
||||
jvEscrow[jss::TransactionType] = jss::EscrowCreate;
|
||||
jvEscrow[jss::Account] = gw.human();
|
||||
jvEscrow[jss::Destination] = gw.human();
|
||||
jvEscrow[jss::Amount] = XRP(100).value().getJson(JsonOptions::KNone);
|
||||
jvEscrow[jss::Amount] = XRP(100).value().getJson(JsonOptions::Values::None);
|
||||
jvEscrow[sfFinishAfter.jsonName] = env.now().time_since_epoch().count() + 1;
|
||||
env(jvEscrow);
|
||||
env.close();
|
||||
@@ -860,7 +860,7 @@ public:
|
||||
jvPayChan[jss::TransactionType] = jss::PaymentChannelCreate;
|
||||
jvPayChan[jss::Account] = gw.human();
|
||||
jvPayChan[jss::Destination] = alice.human();
|
||||
jvPayChan[jss::Amount] = XRP(300).value().getJson(JsonOptions::KNone);
|
||||
jvPayChan[jss::Amount] = XRP(300).value().getJson(JsonOptions::Values::None);
|
||||
jvPayChan[sfSettleDelay.jsonName] = 24 * 60 * 60;
|
||||
jvPayChan[sfPublicKey.jsonName] = strHex(gw.pk().slice());
|
||||
env(jvPayChan);
|
||||
@@ -1180,9 +1180,9 @@ public:
|
||||
testInvalidAccountParam(1);
|
||||
testInvalidAccountParam(1.1);
|
||||
testInvalidAccountParam(true);
|
||||
testInvalidAccountParam(json::Value(json::NullValue));
|
||||
testInvalidAccountParam(json::Value(json::ObjectValue));
|
||||
testInvalidAccountParam(json::Value(json::ArrayValue));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Null));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Object));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Array));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -212,9 +212,9 @@ public:
|
||||
testInvalidAccountParam(1);
|
||||
testInvalidAccountParam(1.1);
|
||||
testInvalidAccountParam(true);
|
||||
testInvalidAccountParam(json::Value(json::NullValue));
|
||||
testInvalidAccountParam(json::Value(json::ObjectValue));
|
||||
testInvalidAccountParam(json::Value(json::ArrayValue));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Null));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Object));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Array));
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -374,9 +374,9 @@ class AccountTx_test : public beast::unit_test::Suite
|
||||
testInvalidAccountParam(1);
|
||||
testInvalidAccountParam(1.1);
|
||||
testInvalidAccountParam(true);
|
||||
testInvalidAccountParam(json::Value(json::NullValue));
|
||||
testInvalidAccountParam(json::Value(json::ObjectValue));
|
||||
testInvalidAccountParam(json::Value(json::ArrayValue));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Null));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Object));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Array));
|
||||
}
|
||||
// test binary and forward for bool/non bool values
|
||||
{
|
||||
@@ -449,13 +449,13 @@ class AccountTx_test : public beast::unit_test::Suite
|
||||
RPC::expectedFieldMessage(jss::limit, "unsigned integer"));
|
||||
|
||||
// Test case: limit = [] should fail (array instead of integer)
|
||||
p[jss::limit] = json::Value(json::ArrayValue);
|
||||
p[jss::limit] = json::Value(json::ValueType::Array);
|
||||
BEAST_EXPECT(
|
||||
env.rpc("json", "account_tx", to_string(p))[jss::result][jss::error_message] ==
|
||||
RPC::expectedFieldMessage(jss::limit, "unsigned integer"));
|
||||
|
||||
// Test case: limit = {} should fail (object instead of integer)
|
||||
p[jss::limit] = json::Value(json::ObjectValue);
|
||||
p[jss::limit] = json::Value(json::ValueType::Object);
|
||||
BEAST_EXPECT(
|
||||
env.rpc("json", "account_tx", to_string(p))[jss::result][jss::error_message] ==
|
||||
RPC::expectedFieldMessage(jss::limit, "unsigned integer"));
|
||||
@@ -467,7 +467,7 @@ class AccountTx_test : public beast::unit_test::Suite
|
||||
RPC::expectedFieldMessage(jss::limit, "unsigned integer"));
|
||||
|
||||
// Test case: limit = ["limit"] should fail (array with string)
|
||||
p[jss::limit] = json::Value(json::ArrayValue);
|
||||
p[jss::limit] = json::Value(json::ValueType::Array);
|
||||
p[jss::limit].append("limit");
|
||||
BEAST_EXPECT(
|
||||
env.rpc("json", "account_tx", to_string(p))[jss::result][jss::error_message] ==
|
||||
@@ -475,7 +475,7 @@ class AccountTx_test : public beast::unit_test::Suite
|
||||
|
||||
// Test case: limit = {"limit": 10} should fail (object with
|
||||
// property)
|
||||
p[jss::limit] = json::Value(json::ObjectValue);
|
||||
p[jss::limit] = json::Value(json::ValueType::Object);
|
||||
p[jss::limit][jss::limit] = 10;
|
||||
BEAST_EXPECT(
|
||||
env.rpc("json", "account_tx", to_string(p))[jss::result][jss::error_message] ==
|
||||
@@ -537,7 +537,7 @@ class AccountTx_test : public beast::unit_test::Suite
|
||||
escrow[jss::TransactionType] = jss::EscrowCreate;
|
||||
escrow[jss::Account] = account.human();
|
||||
escrow[jss::Destination] = to.human();
|
||||
escrow[jss::Amount] = amount.getJson(JsonOptions::KNone);
|
||||
escrow[jss::Amount] = amount.getJson(JsonOptions::Values::None);
|
||||
return escrow;
|
||||
};
|
||||
|
||||
@@ -583,7 +583,7 @@ class AccountTx_test : public beast::unit_test::Suite
|
||||
payChanCreate[jss::TransactionType] = jss::PaymentChannelCreate;
|
||||
payChanCreate[jss::Account] = alice.human();
|
||||
payChanCreate[jss::Destination] = gw.human();
|
||||
payChanCreate[jss::Amount] = XRP(500).value().getJson(JsonOptions::KNone);
|
||||
payChanCreate[jss::Amount] = XRP(500).value().getJson(JsonOptions::Values::None);
|
||||
payChanCreate[sfSettleDelay.jsonName] = NetClock::duration{100s}.count();
|
||||
payChanCreate[sfPublicKey.jsonName] = strHex(alice.pk().slice());
|
||||
env(payChanCreate, Sig(alie));
|
||||
@@ -596,7 +596,7 @@ class AccountTx_test : public beast::unit_test::Suite
|
||||
payChanFund[jss::TransactionType] = jss::PaymentChannelFund;
|
||||
payChanFund[jss::Account] = alice.human();
|
||||
payChanFund[sfChannel.jsonName] = payChanIndex;
|
||||
payChanFund[jss::Amount] = XRP(200).value().getJson(JsonOptions::KNone);
|
||||
payChanFund[jss::Amount] = XRP(200).value().getJson(JsonOptions::Values::None);
|
||||
env(payChanFund, Sig(alie));
|
||||
env.close();
|
||||
}
|
||||
@@ -841,7 +841,8 @@ class AccountTx_test : public beast::unit_test::Suite
|
||||
auto const& tx0(jv[jss::transactions][0u][jss::tx]);
|
||||
BEAST_EXPECT(tx0[jss::TransactionType] == txType);
|
||||
|
||||
std::string const txHash{env.tx()->getJson(JsonOptions::KNone)[jss::hash].asString()};
|
||||
std::string const txHash{
|
||||
env.tx()->getJson(JsonOptions::Values::None)[jss::hash].asString()};
|
||||
BEAST_EXPECT(tx0[jss::hash] == txHash);
|
||||
};
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class AmendmentBlocked_test : public beast::unit_test::Suite
|
||||
pfReq[jss::subcommand] = "create";
|
||||
pfReq[jss::source_account] = alice.human();
|
||||
pfReq[jss::destination_account] = bob.human();
|
||||
pfReq[jss::destination_amount] = bob["USD"](20).value().getJson(JsonOptions::KNone);
|
||||
pfReq[jss::destination_amount] = bob["USD"](20).value().getJson(JsonOptions::Values::None);
|
||||
jr = wsc->invoke("path_find", pfReq)[jss::result];
|
||||
BEAST_EXPECT(
|
||||
jr.isMember(jss::alternatives) && jr[jss::alternatives].isArray() &&
|
||||
@@ -140,7 +140,7 @@ class AmendmentBlocked_test : public beast::unit_test::Suite
|
||||
pfReq[jss::subcommand] = "create";
|
||||
pfReq[jss::source_account] = alice.human();
|
||||
pfReq[jss::destination_account] = bob.human();
|
||||
pfReq[jss::destination_amount] = bob["USD"](20).value().getJson(JsonOptions::KNone);
|
||||
pfReq[jss::destination_amount] = bob["USD"](20).value().getJson(JsonOptions::Values::None);
|
||||
jr = wsc->invoke("path_find", pfReq)[jss::result];
|
||||
BEAST_EXPECT(
|
||||
jr.isMember(jss::alternatives) && jr[jss::alternatives].isArray() &&
|
||||
|
||||
@@ -99,7 +99,8 @@ public:
|
||||
env(pay(bob, carol, USD(10)), Path(~USD), Sendmax(XRP(10)), Domain(domainID));
|
||||
env.close();
|
||||
|
||||
std::string const txHash{env.tx()->getJson(JsonOptions::KNone)[jss::hash].asString()};
|
||||
std::string const txHash{
|
||||
env.tx()->getJson(JsonOptions::Values::None)[jss::hash].asString()};
|
||||
|
||||
json::Value const txResult = env.rpc("tx", txHash)[jss::result];
|
||||
auto const ledgerIndex = txResult[jss::ledger_index].asInt();
|
||||
|
||||
@@ -76,9 +76,9 @@ public:
|
||||
|
||||
{
|
||||
// RPC subscribe to books stream
|
||||
books[jss::books] = json::ArrayValue;
|
||||
books[jss::books] = json::ValueType::Array;
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::taker_gets][jss::currency] = "XRP";
|
||||
j[jss::taker_pays][jss::currency] = "USD";
|
||||
@@ -109,8 +109,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -153,9 +153,9 @@ public:
|
||||
|
||||
{
|
||||
// RPC subscribe to books stream
|
||||
books[jss::books] = json::ArrayValue;
|
||||
books[jss::books] = json::ValueType::Array;
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::taker_gets][jss::currency] = "XRP";
|
||||
j[jss::taker_pays][jss::currency] = "USD";
|
||||
@@ -175,10 +175,10 @@ public:
|
||||
jv[jss::result].isMember(jss::offers) && jv[jss::result][jss::offers].size() == 1);
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::offers][0u][jss::TakerGets] ==
|
||||
XRP(200).value().getJson(JsonOptions::KNone));
|
||||
XRP(200).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::offers][0u][jss::TakerPays] ==
|
||||
usd(100).value().getJson(JsonOptions::KNone));
|
||||
usd(100).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(!jv[jss::result].isMember(jss::asks));
|
||||
BEAST_EXPECT(!jv[jss::result].isMember(jss::bids));
|
||||
}
|
||||
@@ -192,8 +192,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -229,9 +229,9 @@ public:
|
||||
|
||||
{
|
||||
// RPC subscribe to books stream
|
||||
books[jss::books] = json::ArrayValue;
|
||||
books[jss::books] = json::ValueType::Array;
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::both] = true;
|
||||
j[jss::taker_gets][jss::currency] = "XRP";
|
||||
@@ -264,8 +264,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -278,8 +278,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == XRP(75).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == usd(100).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == XRP(75).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == usd(100).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -315,9 +315,9 @@ public:
|
||||
|
||||
{
|
||||
// RPC subscribe to books stream
|
||||
books[jss::books] = json::ArrayValue;
|
||||
books[jss::books] = json::ValueType::Array;
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::both] = true;
|
||||
j[jss::taker_gets][jss::currency] = "XRP";
|
||||
@@ -340,16 +340,16 @@ public:
|
||||
jv[jss::result].isMember(jss::bids) && jv[jss::result][jss::bids].size() == 1);
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::asks][0u][jss::TakerGets] ==
|
||||
usd(100).value().getJson(JsonOptions::KNone));
|
||||
usd(100).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::asks][0u][jss::TakerPays] ==
|
||||
XRP(500).value().getJson(JsonOptions::KNone));
|
||||
XRP(500).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::bids][0u][jss::TakerGets] ==
|
||||
XRP(200).value().getJson(JsonOptions::KNone));
|
||||
XRP(200).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::bids][0u][jss::TakerPays] ==
|
||||
usd(100).value().getJson(JsonOptions::KNone));
|
||||
usd(100).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(!jv[jss::result].isMember(jss::offers));
|
||||
}
|
||||
|
||||
@@ -362,8 +362,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -376,8 +376,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == XRP(75).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == usd(100).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == XRP(75).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == usd(100).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -408,16 +408,16 @@ public:
|
||||
|
||||
{
|
||||
// RPC subscribe to books stream
|
||||
books[jss::books] = json::ArrayValue;
|
||||
books[jss::books] = json::ValueType::Array;
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::taker_gets][jss::currency] = "XRP";
|
||||
j[jss::taker_pays][jss::currency] = "USD";
|
||||
j[jss::taker_pays][jss::issuer] = Account("alice").human();
|
||||
}
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::taker_gets][jss::currency] = "CNY";
|
||||
j[jss::taker_gets][jss::issuer] = Account("alice").human();
|
||||
@@ -449,8 +449,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -470,8 +470,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == jpy(100).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == cny(700).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == jpy(100).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == cny(700).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -522,16 +522,16 @@ public:
|
||||
|
||||
{
|
||||
// RPC subscribe to books stream
|
||||
books[jss::books] = json::ArrayValue;
|
||||
books[jss::books] = json::ValueType::Array;
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::taker_gets][jss::currency] = "XRP";
|
||||
j[jss::taker_pays][jss::currency] = "USD";
|
||||
j[jss::taker_pays][jss::issuer] = Account("alice").human();
|
||||
}
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::taker_gets][jss::currency] = "CNY";
|
||||
j[jss::taker_gets][jss::issuer] = Account("alice").human();
|
||||
@@ -552,16 +552,16 @@ public:
|
||||
jv[jss::result].isMember(jss::offers) && jv[jss::result][jss::offers].size() == 2);
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::offers][0u][jss::TakerGets] ==
|
||||
XRP(200).value().getJson(JsonOptions::KNone));
|
||||
XRP(200).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::offers][0u][jss::TakerPays] ==
|
||||
usd(100).value().getJson(JsonOptions::KNone));
|
||||
usd(100).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::offers][1u][jss::TakerGets] ==
|
||||
cny(200).value().getJson(JsonOptions::KNone));
|
||||
cny(200).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::offers][1u][jss::TakerPays] ==
|
||||
jpy(100).value().getJson(JsonOptions::KNone));
|
||||
jpy(100).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(!jv[jss::result].isMember(jss::asks));
|
||||
BEAST_EXPECT(!jv[jss::result].isMember(jss::bids));
|
||||
}
|
||||
@@ -575,8 +575,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -596,8 +596,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == jpy(100).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == cny(700).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == jpy(100).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == cny(700).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -635,9 +635,9 @@ public:
|
||||
|
||||
{
|
||||
// RPC subscribe to books stream
|
||||
books[jss::books] = json::ArrayValue;
|
||||
books[jss::books] = json::ValueType::Array;
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::both] = true;
|
||||
j[jss::taker_gets][jss::currency] = "XRP";
|
||||
@@ -645,7 +645,7 @@ public:
|
||||
j[jss::taker_pays][jss::issuer] = Account("alice").human();
|
||||
}
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::both] = true;
|
||||
j[jss::taker_gets][jss::currency] = "CNY";
|
||||
@@ -679,8 +679,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -693,8 +693,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == XRP(75).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == usd(100).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == XRP(75).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == usd(100).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -707,8 +707,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == jpy(100).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == cny(700).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == jpy(100).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == cny(700).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -721,8 +721,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == cny(75).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == jpy(100).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == cny(75).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == jpy(100).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -766,9 +766,9 @@ public:
|
||||
|
||||
{
|
||||
// RPC subscribe to books stream
|
||||
books[jss::books] = json::ArrayValue;
|
||||
books[jss::books] = json::ValueType::Array;
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::both] = true;
|
||||
j[jss::taker_gets][jss::currency] = "XRP";
|
||||
@@ -777,7 +777,7 @@ public:
|
||||
}
|
||||
// RPC subscribe to books stream
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::both] = true;
|
||||
j[jss::taker_gets][jss::currency] = "CNY";
|
||||
@@ -801,28 +801,28 @@ public:
|
||||
jv[jss::result].isMember(jss::bids) && jv[jss::result][jss::bids].size() == 2);
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::asks][0u][jss::TakerGets] ==
|
||||
usd(100).value().getJson(JsonOptions::KNone));
|
||||
usd(100).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::asks][0u][jss::TakerPays] ==
|
||||
XRP(500).value().getJson(JsonOptions::KNone));
|
||||
XRP(500).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::asks][1u][jss::TakerGets] ==
|
||||
jpy(100).value().getJson(JsonOptions::KNone));
|
||||
jpy(100).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::asks][1u][jss::TakerPays] ==
|
||||
cny(500).value().getJson(JsonOptions::KNone));
|
||||
cny(500).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::bids][0u][jss::TakerGets] ==
|
||||
XRP(200).value().getJson(JsonOptions::KNone));
|
||||
XRP(200).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::bids][0u][jss::TakerPays] ==
|
||||
usd(100).value().getJson(JsonOptions::KNone));
|
||||
usd(100).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::bids][1u][jss::TakerGets] ==
|
||||
cny(200).value().getJson(JsonOptions::KNone));
|
||||
cny(200).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::bids][1u][jss::TakerPays] ==
|
||||
jpy(100).value().getJson(JsonOptions::KNone));
|
||||
jpy(100).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(!jv[jss::result].isMember(jss::offers));
|
||||
}
|
||||
|
||||
@@ -835,8 +835,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == usd(100).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == XRP(700).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -849,8 +849,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == XRP(75).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == usd(100).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == XRP(75).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == usd(100).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -863,8 +863,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == jpy(100).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == cny(700).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == jpy(100).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == cny(700).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -877,8 +877,8 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
|
||||
auto const& t = jv[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == cny(75).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerPays] == jpy(100).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerGets] == cny(75).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::TakerPays] == jpy(100).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -909,9 +909,9 @@ public:
|
||||
|
||||
json::Value books;
|
||||
{
|
||||
books[jss::books] = json::ArrayValue;
|
||||
books[jss::books] = json::ValueType::Array;
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::taker_gets][jss::currency] = "XRP";
|
||||
j[jss::taker_pays][jss::currency] = "USD";
|
||||
@@ -968,8 +968,9 @@ public:
|
||||
BEAST_EXPECT(jrOffer[sfLedgerEntryType.fieldName] == jss::Offer);
|
||||
BEAST_EXPECT(jrOffer[sfOwnerNode.fieldName] == "0");
|
||||
BEAST_EXPECT(jrOffer[sfSequence.fieldName] == 5);
|
||||
BEAST_EXPECT(jrOffer[jss::TakerGets] == usd(10).value().getJson(JsonOptions::KNone));
|
||||
BEAST_EXPECT(jrOffer[jss::TakerPays] == XRP(4000).value().getJson(JsonOptions::KNone));
|
||||
BEAST_EXPECT(jrOffer[jss::TakerGets] == usd(10).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jrOffer[jss::TakerPays] == XRP(4000).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(jrOffer[jss::owner_funds] == "100");
|
||||
BEAST_EXPECT(jrOffer[jss::quality] == "400000000");
|
||||
|
||||
@@ -977,9 +978,9 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jval) {
|
||||
auto const& t = jval[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == usd(10).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerGets] == usd(10).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::owner_funds] == "100" &&
|
||||
t[jss::TakerPays] == XRP(4000).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerPays] == XRP(4000).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
|
||||
env(offer(bob, XRP(2000), usd(5)));
|
||||
@@ -988,9 +989,9 @@ public:
|
||||
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jval) {
|
||||
auto const& t = jval[jss::transaction];
|
||||
return t[jss::TransactionType] == jss::OfferCreate &&
|
||||
t[jss::TakerGets] == usd(5).value().getJson(JsonOptions::KNone) &&
|
||||
t[jss::TakerGets] == usd(5).value().getJson(JsonOptions::Values::None) &&
|
||||
t[jss::owner_funds] == "50" &&
|
||||
t[jss::TakerPays] == XRP(2000).value().getJson(JsonOptions::KNone);
|
||||
t[jss::TakerPays] == XRP(2000).value().getJson(JsonOptions::Values::None);
|
||||
}));
|
||||
|
||||
jv = wsc->invoke("book_offers", jvParams);
|
||||
@@ -1012,8 +1013,10 @@ public:
|
||||
BEAST_EXPECT(jrNextOffer[sfLedgerEntryType.fieldName] == jss::Offer);
|
||||
BEAST_EXPECT(jrNextOffer[sfOwnerNode.fieldName] == "0");
|
||||
BEAST_EXPECT(jrNextOffer[sfSequence.fieldName] == 5);
|
||||
BEAST_EXPECT(jrNextOffer[jss::TakerGets] == usd(5).value().getJson(JsonOptions::KNone));
|
||||
BEAST_EXPECT(jrNextOffer[jss::TakerPays] == XRP(2000).value().getJson(JsonOptions::KNone));
|
||||
BEAST_EXPECT(
|
||||
jrNextOffer[jss::TakerGets] == usd(5).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jrNextOffer[jss::TakerPays] == XRP(2000).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(jrNextOffer[jss::owner_funds] == "50");
|
||||
BEAST_EXPECT(jrNextOffer[jss::quality] == "400000000");
|
||||
|
||||
@@ -1044,8 +1047,8 @@ public:
|
||||
return false;
|
||||
auto const& t = (*maybeJv)[jss::transaction];
|
||||
if (t[jss::TransactionType] != jss::OfferCreate ||
|
||||
t[jss::TakerGets] != takerGets.value().getJson(JsonOptions::KNone) ||
|
||||
t[jss::TakerPays] != takerPays.value().getJson(JsonOptions::KNone))
|
||||
t[jss::TakerGets] != takerGets.value().getJson(JsonOptions::Values::None) ||
|
||||
t[jss::TakerPays] != takerPays.value().getJson(JsonOptions::Values::None))
|
||||
return false;
|
||||
// Make sure no other message is waiting
|
||||
return wsc->getMsg(timeout) == std::nullopt;
|
||||
@@ -1093,9 +1096,9 @@ public:
|
||||
json::Value books;
|
||||
{
|
||||
// RPC subscribe to books stream
|
||||
books[jss::books] = json::ArrayValue;
|
||||
books[jss::books] = json::ValueType::Array;
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = false;
|
||||
j[jss::taker_gets][jss::currency] = "XRP";
|
||||
j[jss::taker_pays][jss::currency] = "USD";
|
||||
@@ -1169,9 +1172,9 @@ public:
|
||||
|
||||
{
|
||||
// RPC subscribe to multiple book streams
|
||||
books[jss::books] = json::ArrayValue;
|
||||
books[jss::books] = json::ValueType::Array;
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = false;
|
||||
j[jss::taker_gets][jss::currency] = "XRP";
|
||||
j[jss::taker_pays][jss::currency] = "USD";
|
||||
@@ -1179,7 +1182,7 @@ public:
|
||||
}
|
||||
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = false;
|
||||
j[jss::taker_gets][jss::currency] = "EUR";
|
||||
j[jss::taker_gets][jss::issuer] = gw.human();
|
||||
@@ -1233,7 +1236,7 @@ public:
|
||||
{
|
||||
json::Value jvParams;
|
||||
jvParams[jss::ledger_index] = "validated";
|
||||
jvParams[jss::taker_pays] = json::ObjectValue;
|
||||
jvParams[jss::taker_pays] = json::ValueType::Object;
|
||||
auto const jrr = env.rpc("json", "book_offers", to_string(jvParams))[jss::result];
|
||||
BEAST_EXPECT(jrr[jss::error] == "invalidParams");
|
||||
BEAST_EXPECT(jrr[jss::error_message] == "Missing field 'taker_gets'.");
|
||||
@@ -1243,7 +1246,7 @@ public:
|
||||
json::Value jvParams;
|
||||
jvParams[jss::ledger_index] = "validated";
|
||||
jvParams[jss::taker_pays] = "not an object";
|
||||
jvParams[jss::taker_gets] = json::ObjectValue;
|
||||
jvParams[jss::taker_gets] = json::ValueType::Object;
|
||||
auto const jrr = env.rpc("json", "book_offers", to_string(jvParams))[jss::result];
|
||||
BEAST_EXPECT(jrr[jss::error] == "invalidParams");
|
||||
BEAST_EXPECT(jrr[jss::error_message] == "Invalid field 'taker_pays', not object.");
|
||||
@@ -1252,7 +1255,7 @@ public:
|
||||
{
|
||||
json::Value jvParams;
|
||||
jvParams[jss::ledger_index] = "validated";
|
||||
jvParams[jss::taker_pays] = json::ObjectValue;
|
||||
jvParams[jss::taker_pays] = json::ValueType::Object;
|
||||
jvParams[jss::taker_gets] = "not an object";
|
||||
auto const jrr = env.rpc("json", "book_offers", to_string(jvParams))[jss::result];
|
||||
BEAST_EXPECT(jrr[jss::error] == "invalidParams");
|
||||
@@ -1262,8 +1265,8 @@ public:
|
||||
{
|
||||
json::Value jvParams;
|
||||
jvParams[jss::ledger_index] = "validated";
|
||||
jvParams[jss::taker_pays] = json::ObjectValue;
|
||||
jvParams[jss::taker_gets] = json::ObjectValue;
|
||||
jvParams[jss::taker_pays] = json::ValueType::Object;
|
||||
jvParams[jss::taker_gets] = json::ValueType::Object;
|
||||
auto const jrr = env.rpc("json", "book_offers", to_string(jvParams))[jss::result];
|
||||
BEAST_EXPECT(jrr[jss::error] == "invalidParams");
|
||||
BEAST_EXPECT(jrr[jss::error_message] == "Missing field 'taker_pays.currency'.");
|
||||
@@ -1273,7 +1276,7 @@ public:
|
||||
json::Value jvParams;
|
||||
jvParams[jss::ledger_index] = "validated";
|
||||
jvParams[jss::taker_pays][jss::currency] = 1;
|
||||
jvParams[jss::taker_gets] = json::ObjectValue;
|
||||
jvParams[jss::taker_gets] = json::ValueType::Object;
|
||||
auto const jrr = env.rpc("json", "book_offers", to_string(jvParams))[jss::result];
|
||||
BEAST_EXPECT(jrr[jss::error] == "invalidParams");
|
||||
BEAST_EXPECT(
|
||||
@@ -1284,7 +1287,7 @@ public:
|
||||
json::Value jvParams;
|
||||
jvParams[jss::ledger_index] = "validated";
|
||||
jvParams[jss::taker_pays][jss::currency] = "XRP";
|
||||
jvParams[jss::taker_gets] = json::ObjectValue;
|
||||
jvParams[jss::taker_gets] = json::ValueType::Object;
|
||||
auto const jrr = env.rpc("json", "book_offers", to_string(jvParams))[jss::result];
|
||||
BEAST_EXPECT(jrr[jss::error] == "invalidParams");
|
||||
BEAST_EXPECT(jrr[jss::error_message] == "Missing field 'taker_gets.currency'.");
|
||||
@@ -1568,7 +1571,7 @@ public:
|
||||
BEAST_EXPECT(
|
||||
jrr[jss::offers].size() == (asAdmin ? RPC::Tuning::kBOOK_OFFERS.rmax + 1 : 0u));
|
||||
|
||||
jvParams[jss::limit] = json::NullValue;
|
||||
jvParams[jss::limit] = json::ValueType::Null;
|
||||
jrr = env.rpc("json", "book_offers", to_string(jvParams))[jss::result];
|
||||
BEAST_EXPECT(jrr[jss::offers].isArray());
|
||||
BEAST_EXPECT(
|
||||
@@ -1610,8 +1613,10 @@ public:
|
||||
BEAST_EXPECT(jrOffer[jss::Flags] == 0);
|
||||
BEAST_EXPECT(jrOffer[sfLedgerEntryType.fieldName] == jss::Offer);
|
||||
BEAST_EXPECT(jrOffer[sfOwnerNode.fieldName] == "0");
|
||||
BEAST_EXPECT(jrOffer[jss::TakerGets] == usd(10).value().getJson(JsonOptions::KNone));
|
||||
BEAST_EXPECT(jrOffer[jss::TakerPays] == XRP(10).value().getJson(JsonOptions::KNone));
|
||||
BEAST_EXPECT(
|
||||
jrOffer[jss::TakerGets] == usd(10).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jrOffer[jss::TakerPays] == XRP(10).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(jrOffer[sfDomainID.jsonName].asString() == to_string(domainID));
|
||||
};
|
||||
|
||||
@@ -1635,10 +1640,10 @@ public:
|
||||
jv[jss::result].isMember(jss::offers) && jv[jss::result][jss::offers].size() == 1);
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::offers][0u][jss::TakerGets] ==
|
||||
usd(10).value().getJson(JsonOptions::KNone));
|
||||
usd(10).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::offers][0u][jss::TakerPays] ==
|
||||
XRP(10).value().getJson(JsonOptions::KNone));
|
||||
XRP(10).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::offers][0u][sfDomainID.jsonName].asString() ==
|
||||
to_string(domainID));
|
||||
@@ -1662,9 +1667,9 @@ public:
|
||||
// subscribe to domain book should return domain offer
|
||||
{
|
||||
json::Value books;
|
||||
books[jss::books] = json::ArrayValue;
|
||||
books[jss::books] = json::ValueType::Array;
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::taker_pays][jss::currency] = "XRP";
|
||||
j[jss::taker_gets][jss::currency] = "USD";
|
||||
@@ -1681,9 +1686,9 @@ public:
|
||||
// subscribe to open book should not return domain offer
|
||||
{
|
||||
json::Value books;
|
||||
books[jss::books] = json::ArrayValue;
|
||||
books[jss::books] = json::ValueType::Array;
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::taker_pays][jss::currency] = "XRP";
|
||||
j[jss::taker_gets][jss::currency] = "USD";
|
||||
@@ -1733,8 +1738,10 @@ public:
|
||||
BEAST_EXPECT(jrOffer[jss::Flags] == lsfHybrid);
|
||||
BEAST_EXPECT(jrOffer[sfLedgerEntryType.fieldName] == jss::Offer);
|
||||
BEAST_EXPECT(jrOffer[sfOwnerNode.fieldName] == "0");
|
||||
BEAST_EXPECT(jrOffer[jss::TakerGets] == usd(10).value().getJson(JsonOptions::KNone));
|
||||
BEAST_EXPECT(jrOffer[jss::TakerPays] == XRP(10).value().getJson(JsonOptions::KNone));
|
||||
BEAST_EXPECT(
|
||||
jrOffer[jss::TakerGets] == usd(10).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jrOffer[jss::TakerPays] == XRP(10).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(jrOffer[sfDomainID.jsonName].asString() == to_string(domainID));
|
||||
BEAST_EXPECT(jrOffer[sfAdditionalBooks.jsonName].size() == 1);
|
||||
};
|
||||
@@ -1758,10 +1765,10 @@ public:
|
||||
jv[jss::result].isMember(jss::offers) && jv[jss::result][jss::offers].size() == 1);
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::offers][0u][jss::TakerGets] ==
|
||||
usd(10).value().getJson(JsonOptions::KNone));
|
||||
usd(10).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::offers][0u][jss::TakerPays] ==
|
||||
XRP(10).value().getJson(JsonOptions::KNone));
|
||||
XRP(10).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
jv[jss::result][jss::offers][0u][sfDomainID.jsonName].asString() ==
|
||||
to_string(domainID));
|
||||
@@ -1785,9 +1792,9 @@ public:
|
||||
// subscribe to domain book should return hybrid offer
|
||||
{
|
||||
json::Value books;
|
||||
books[jss::books] = json::ArrayValue;
|
||||
books[jss::books] = json::ValueType::Array;
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::taker_pays][jss::currency] = "XRP";
|
||||
j[jss::taker_gets][jss::currency] = "USD";
|
||||
@@ -1809,9 +1816,9 @@ public:
|
||||
// subscribe to open book should return hybrid offer
|
||||
{
|
||||
json::Value books;
|
||||
books[jss::books] = json::ArrayValue;
|
||||
books[jss::books] = json::ValueType::Array;
|
||||
{
|
||||
auto& j = books[jss::books].append(json::ObjectValue);
|
||||
auto& j = books[jss::books].append(json::ValueType::Object);
|
||||
j[jss::snapshot] = true;
|
||||
j[jss::taker_pays][jss::currency] = "XRP";
|
||||
j[jss::taker_gets][jss::currency] = "USD";
|
||||
|
||||
@@ -245,9 +245,9 @@ class DeliveredAmount_test : public beast::unit_test::Suite
|
||||
{
|
||||
json::Value stream;
|
||||
// RPC subscribe to ledger stream
|
||||
stream[jss::streams] = json::ArrayValue;
|
||||
stream[jss::streams] = json::ValueType::Array;
|
||||
stream[jss::streams].append("ledger");
|
||||
stream[jss::accounts] = json::ArrayValue;
|
||||
stream[jss::accounts] = json::ValueType::Array;
|
||||
stream[jss::accounts].append(toBase58(alice.id()));
|
||||
stream[jss::accounts].append(toBase58(bob.id()));
|
||||
stream[jss::accounts].append(toBase58(carol.id()));
|
||||
@@ -368,15 +368,17 @@ class DeliveredAmount_test : public beast::unit_test::Suite
|
||||
env.close();
|
||||
|
||||
// Get the hash for the most recent transaction.
|
||||
std::string txHash{env.tx()->getJson(JsonOptions::KNone)[jss::hash].asString()};
|
||||
std::string txHash{env.tx()->getJson(JsonOptions::Values::None)[jss::hash].asString()};
|
||||
json::Value meta = env.rpc("tx", txHash)[jss::result][jss::meta];
|
||||
|
||||
if (features[fixMPTDeliveredAmount])
|
||||
{
|
||||
BEAST_EXPECT(
|
||||
meta[sfDeliveredAmount.jsonName] == STAmount{mpt(800)}.getJson(JsonOptions::KNone));
|
||||
meta[sfDeliveredAmount.jsonName] ==
|
||||
STAmount{mpt(800)}.getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
meta[jss::delivered_amount] == STAmount{mpt(800)}.getJson(JsonOptions::KNone));
|
||||
meta[jss::delivered_amount] ==
|
||||
STAmount{mpt(800)}.getJson(JsonOptions::Values::None));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -387,15 +389,17 @@ class DeliveredAmount_test : public beast::unit_test::Suite
|
||||
env(pay(bob, carol, mpt(1000)), Sendmax(mpt(1200)), Txflags(tfPartialPayment));
|
||||
env.close();
|
||||
|
||||
txHash = env.tx()->getJson(JsonOptions::KNone)[jss::hash].asString();
|
||||
txHash = env.tx()->getJson(JsonOptions::Values::None)[jss::hash].asString();
|
||||
meta = env.rpc("tx", txHash)[jss::result][jss::meta];
|
||||
|
||||
if (features[fixMPTDeliveredAmount])
|
||||
{
|
||||
BEAST_EXPECT(
|
||||
meta[sfDeliveredAmount.jsonName] == STAmount{mpt(960)}.getJson(JsonOptions::KNone));
|
||||
meta[sfDeliveredAmount.jsonName] ==
|
||||
STAmount{mpt(960)}.getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
meta[jss::delivered_amount] == STAmount{mpt(960)}.getJson(JsonOptions::KNone));
|
||||
meta[jss::delivered_amount] ==
|
||||
STAmount{mpt(960)}.getJson(JsonOptions::Values::None));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
std::string const& ledger = "",
|
||||
std::vector<std::string> const& credentials = {})
|
||||
{
|
||||
json::Value args{json::ObjectValue};
|
||||
json::Value args{json::ValueType::Object};
|
||||
args[jss::source_account] = source.human();
|
||||
args[jss::destination_account] = dest.human();
|
||||
if (!ledger.empty())
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
|
||||
if (!credentials.empty())
|
||||
{
|
||||
auto& arr(args[jss::credentials] = json::ArrayValue);
|
||||
auto& arr(args[jss::credentials] = json::ValueType::Array);
|
||||
for (auto const& s : credentials)
|
||||
arr.append(s);
|
||||
}
|
||||
@@ -331,7 +331,7 @@ public:
|
||||
testcase("deposit_authorized with credentials failure: empty array.");
|
||||
|
||||
auto args = depositAuthArgs(alice, becky, "validated");
|
||||
args[jss::credentials] = json::ArrayValue;
|
||||
args[jss::credentials] = json::ValueType::Array;
|
||||
|
||||
auto const jv = env.rpc("json", "deposit_authorized", args.toStyledString());
|
||||
checkCredentialsResponse(jv[jss::result], alice, becky, false, {}, "invalidParams");
|
||||
@@ -343,7 +343,7 @@ public:
|
||||
"credentials");
|
||||
|
||||
auto args = depositAuthArgs(alice, becky, "validated");
|
||||
args[jss::credentials] = json::ArrayValue;
|
||||
args[jss::credentials] = json::ValueType::Array;
|
||||
args[jss::credentials].append(1);
|
||||
args[jss::credentials].append(3);
|
||||
|
||||
@@ -357,7 +357,7 @@ public:
|
||||
"credentials");
|
||||
|
||||
auto args = depositAuthArgs(alice, becky, "validated");
|
||||
args[jss::credentials] = json::ArrayValue;
|
||||
args[jss::credentials] = json::ValueType::Array;
|
||||
args[jss::credentials].append("hello world");
|
||||
|
||||
auto const jv = env.rpc("json", "deposit_authorized", args.toStyledString());
|
||||
|
||||
@@ -258,9 +258,9 @@ class Feature_test : public beast::unit_test::Suite
|
||||
testInvalidParam(1);
|
||||
testInvalidParam(1.1);
|
||||
testInvalidParam(true);
|
||||
testInvalidParam(json::Value(json::NullValue));
|
||||
testInvalidParam(json::Value(json::ObjectValue));
|
||||
testInvalidParam(json::Value(json::ArrayValue));
|
||||
testInvalidParam(json::Value(json::ValueType::Null));
|
||||
testInvalidParam(json::Value(json::ValueType::Object));
|
||||
testInvalidParam(json::Value(json::ValueType::Array));
|
||||
|
||||
{
|
||||
auto jrr = env.rpc("feature", "AllTheThings")[jss::result];
|
||||
|
||||
@@ -2602,7 +2602,7 @@ public:
|
||||
result[jss::tx_json].isMember(jss::Fee) && result[jss::tx_json][jss::Fee] == "10");
|
||||
BEAST_EXPECT(
|
||||
result[jss::tx_json].isMember(jss::Sequence) &&
|
||||
result[jss::tx_json][jss::Sequence].isConvertibleTo(json::ValueType::UintValue));
|
||||
result[jss::tx_json][jss::Sequence].isConvertibleTo(json::ValueType::UInt));
|
||||
}
|
||||
|
||||
{
|
||||
@@ -2629,7 +2629,7 @@ public:
|
||||
result[jss::tx_json][jss::Fee] == "7813");
|
||||
BEAST_EXPECT(
|
||||
result[jss::tx_json].isMember(jss::Sequence) &&
|
||||
result[jss::tx_json][jss::Sequence].isConvertibleTo(json::ValueType::UintValue));
|
||||
result[jss::tx_json][jss::Sequence].isConvertibleTo(json::ValueType::UInt));
|
||||
|
||||
env.close();
|
||||
}
|
||||
@@ -2655,7 +2655,7 @@ public:
|
||||
result[jss::tx_json].isMember(jss::Fee) && result[jss::tx_json][jss::Fee] == "47");
|
||||
BEAST_EXPECT(
|
||||
result[jss::tx_json].isMember(jss::Sequence) &&
|
||||
result[jss::tx_json][jss::Sequence].isConvertibleTo(json::ValueType::UintValue));
|
||||
result[jss::tx_json][jss::Sequence].isConvertibleTo(json::ValueType::UInt));
|
||||
}
|
||||
|
||||
{
|
||||
@@ -2687,7 +2687,7 @@ public:
|
||||
result[jss::tx_json][jss::Fee] == "6806");
|
||||
BEAST_EXPECT(
|
||||
result[jss::tx_json].isMember(jss::Sequence) &&
|
||||
result[jss::tx_json][jss::Sequence].isConvertibleTo(json::ValueType::UintValue));
|
||||
result[jss::tx_json][jss::Sequence].isConvertibleTo(json::ValueType::UInt));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
{
|
||||
json::Value params;
|
||||
params[jss::key_type] = "secp256k1";
|
||||
params[jss::seed] = json::ObjectValue;
|
||||
params[jss::seed] = json::ValueType::Object;
|
||||
auto result = walletPropose(params);
|
||||
BEAST_EXPECT(containsError(result));
|
||||
BEAST_EXPECT(result[jss::error_message] == "Invalid field 'seed', not string.");
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
{
|
||||
json::Value params;
|
||||
params[jss::key_type] = "ed25519";
|
||||
params[jss::seed_hex] = json::ArrayValue;
|
||||
params[jss::seed_hex] = json::ValueType::Array;
|
||||
auto result = walletPropose(params);
|
||||
BEAST_EXPECT(containsError(result));
|
||||
BEAST_EXPECT(result[jss::error_message] == "Invalid field 'seed_hex', not string.");
|
||||
@@ -272,7 +272,7 @@ public:
|
||||
|
||||
{
|
||||
json::Value params;
|
||||
params[jss::key_type] = json::ObjectValue;
|
||||
params[jss::key_type] = json::ValueType::Object;
|
||||
params[jss::seed_hex] = common::gMasterSeedHex;
|
||||
auto result = walletPropose(params);
|
||||
BEAST_EXPECT(containsError(result));
|
||||
@@ -281,7 +281,7 @@ public:
|
||||
|
||||
{
|
||||
json::Value params;
|
||||
params[jss::key_type] = json::ArrayValue;
|
||||
params[jss::key_type] = json::ValueType::Array;
|
||||
params[jss::seed] = common::gMasterSeed;
|
||||
auto result = walletPropose(params);
|
||||
BEAST_EXPECT(containsError(result));
|
||||
@@ -410,7 +410,7 @@ public:
|
||||
{
|
||||
json::Value params;
|
||||
json::Value error;
|
||||
params[jss::secret] = json::ArrayValue;
|
||||
params[jss::secret] = json::ValueType::Array;
|
||||
params[jss::secret].append("array:0");
|
||||
|
||||
auto ret = keypairForSignature(params, error);
|
||||
@@ -422,7 +422,7 @@ public:
|
||||
{
|
||||
json::Value params;
|
||||
json::Value error;
|
||||
params[jss::secret] = json::ObjectValue;
|
||||
params[jss::secret] = json::ValueType::Object;
|
||||
params[jss::secret]["string"] = "string";
|
||||
params[jss::secret]["number"] = 702;
|
||||
|
||||
@@ -463,7 +463,7 @@ public:
|
||||
{
|
||||
json::Value params;
|
||||
json::Value error;
|
||||
params[jss::key_type] = json::ObjectValue;
|
||||
params[jss::key_type] = json::ValueType::Object;
|
||||
params[jss::seed_hex] = common::gMasterSeedHex;
|
||||
|
||||
auto ret = keypairForSignature(params, error);
|
||||
@@ -475,7 +475,7 @@ public:
|
||||
{
|
||||
json::Value params;
|
||||
json::Value error;
|
||||
params[jss::key_type] = json::ArrayValue;
|
||||
params[jss::key_type] = json::ValueType::Array;
|
||||
params[jss::seed] = common::gMasterSeed;
|
||||
|
||||
auto ret = keypairForSignature(params, error);
|
||||
@@ -501,7 +501,7 @@ public:
|
||||
json::Value params;
|
||||
json::Value error;
|
||||
params[jss::key_type] = "secp256k1";
|
||||
params[jss::passphrase] = json::ObjectValue;
|
||||
params[jss::passphrase] = json::ValueType::Object;
|
||||
|
||||
auto ret = keypairForSignature(params, error);
|
||||
BEAST_EXPECT(containsError(error));
|
||||
@@ -513,7 +513,7 @@ public:
|
||||
json::Value params;
|
||||
json::Value error;
|
||||
params[jss::key_type] = "secp256k1";
|
||||
params[jss::passphrase] = json::ArrayValue;
|
||||
params[jss::passphrase] = json::ValueType::Array;
|
||||
|
||||
auto ret = keypairForSignature(params, error);
|
||||
BEAST_EXPECT(containsError(error));
|
||||
@@ -550,7 +550,7 @@ public:
|
||||
json::Value params;
|
||||
json::Value error;
|
||||
params[jss::key_type] = "secp256k1";
|
||||
params[jss::seed] = json::ObjectValue;
|
||||
params[jss::seed] = json::ValueType::Object;
|
||||
|
||||
auto ret = keypairForSignature(params, error);
|
||||
BEAST_EXPECT(containsError(error));
|
||||
@@ -562,7 +562,7 @@ public:
|
||||
json::Value params;
|
||||
json::Value error;
|
||||
params[jss::key_type] = "secp256k1";
|
||||
params[jss::seed] = json::ArrayValue;
|
||||
params[jss::seed] = json::ValueType::Array;
|
||||
|
||||
auto ret = keypairForSignature(params, error);
|
||||
BEAST_EXPECT(containsError(error));
|
||||
@@ -623,7 +623,7 @@ public:
|
||||
json::Value params;
|
||||
json::Value error;
|
||||
params[jss::key_type] = "secp256k1";
|
||||
params[jss::seed_hex] = json::ObjectValue;
|
||||
params[jss::seed_hex] = json::ValueType::Object;
|
||||
|
||||
auto ret = keypairForSignature(params, error);
|
||||
BEAST_EXPECT(containsError(error));
|
||||
@@ -635,7 +635,7 @@ public:
|
||||
json::Value params;
|
||||
json::Value error;
|
||||
params[jss::key_type] = "secp256k1";
|
||||
params[jss::seed_hex] = json::ArrayValue;
|
||||
params[jss::seed_hex] = json::ValueType::Array;
|
||||
|
||||
auto ret = keypairForSignature(params, error);
|
||||
BEAST_EXPECT(containsError(error));
|
||||
|
||||
@@ -333,7 +333,7 @@ public:
|
||||
jv[jss::TransactionType] = jss::EscrowCreate;
|
||||
jv[jss::Account] = Account{"bob5"}.human();
|
||||
jv[jss::Destination] = Account{"bob6"}.human();
|
||||
jv[jss::Amount] = XRP(50).value().getJson(JsonOptions::KNone);
|
||||
jv[jss::Amount] = XRP(50).value().getJson(JsonOptions::Values::None);
|
||||
jv[sfFinishAfter.fieldName] =
|
||||
NetClock::time_point{env.now() + 10s}.time_since_epoch().count();
|
||||
env(jv);
|
||||
@@ -344,7 +344,7 @@ public:
|
||||
jv[jss::TransactionType] = jss::PaymentChannelCreate;
|
||||
jv[jss::Account] = Account{"bob6"}.human();
|
||||
jv[jss::Destination] = Account{"bob7"}.human();
|
||||
jv[jss::Amount] = XRP(100).value().getJson(JsonOptions::KNone);
|
||||
jv[jss::Amount] = XRP(100).value().getJson(JsonOptions::Values::None);
|
||||
jv[jss::SettleDelay] = NetClock::duration{10s}.count();
|
||||
jv[sfPublicKey.fieldName] = strHex(Account{"bob6"}.pk().slice());
|
||||
jv[sfCancelAfter.fieldName] =
|
||||
|
||||
@@ -163,7 +163,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
if (msg.empty())
|
||||
{
|
||||
BEAST_EXPECTS(
|
||||
jv[jss::error_message] == json::NullValue || jv[jss::error_message] == "",
|
||||
jv[jss::error_message] == json::ValueType::Null || jv[jss::error_message] == "",
|
||||
"Expected no error message, received \"" + jv[jss::error_message].asString() +
|
||||
"\", at line " + std::to_string(location.line()) + ", " + jv.toStyledString());
|
||||
}
|
||||
@@ -181,13 +181,13 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
getBadValues(FieldType fieldType)
|
||||
{
|
||||
static json::Value const kINJECT_OBJECT = []() {
|
||||
json::Value obj(json::ObjectValue);
|
||||
json::Value obj(json::ValueType::Object);
|
||||
obj[jss::account] = "rhigTLJJyXXSRUyRCQtqi1NoAZZzZnS4KU";
|
||||
obj[jss::ledger_index] = "validated";
|
||||
return obj;
|
||||
}();
|
||||
static json::Value const kINJECT_ARRAY = []() {
|
||||
json::Value arr(json::ArrayValue);
|
||||
json::Value arr(json::ValueType::Array);
|
||||
arr[0u] = "rhigTLJJyXXSRUyRCQtqi1NoAZZzZnS4KU";
|
||||
arr[1u] = "validated";
|
||||
return arr;
|
||||
@@ -210,11 +210,11 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
"USD", // 14
|
||||
"USDollars", // 15
|
||||
"5233D68B4D44388F98559DE42903767803EFA7C1F8D01413FC16EE6B01403D"
|
||||
"6D", // 16
|
||||
json::ArrayValue, // 17
|
||||
json::ObjectValue, // 18
|
||||
kINJECT_OBJECT, // 19
|
||||
kINJECT_ARRAY // 20
|
||||
"6D", // 16
|
||||
json::ValueType::Array, // 17
|
||||
json::ValueType::Object, // 18
|
||||
kINJECT_OBJECT, // 19
|
||||
kINJECT_ARRAY // 20
|
||||
};
|
||||
|
||||
auto remove = [&](std::vector<std::uint8_t> indices) -> std::vector<json::Value> {
|
||||
@@ -275,13 +275,13 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
getCorrectValue(json::StaticString fieldName)
|
||||
{
|
||||
static json::Value const kTWO_ACCOUNT_ARRAY = []() {
|
||||
json::Value arr(json::ArrayValue);
|
||||
json::Value arr(json::ValueType::Array);
|
||||
arr[0u] = "rhigTLJJyXXSRUyRCQtqi1NoAZZzZnS4KU";
|
||||
arr[1u] = "r4MrUGTdB57duTnRs6KbsRGQXgkseGb1b5";
|
||||
return arr;
|
||||
}();
|
||||
static json::Value const kISSUE_OBJECT = []() {
|
||||
json::Value arr(json::ObjectValue);
|
||||
json::Value arr(json::ValueType::Object);
|
||||
arr[jss::currency] = "XRP";
|
||||
return arr;
|
||||
}();
|
||||
@@ -292,7 +292,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
case FieldType::AccountField:
|
||||
return "r4MrUGTdB57duTnRs6KbsRGQXgkseGb1b5";
|
||||
case FieldType::ArrayField:
|
||||
return json::ArrayValue;
|
||||
return json::ValueType::Array;
|
||||
case FieldType::BlobField:
|
||||
return "ABCDEF";
|
||||
case FieldType::CurrencyField:
|
||||
@@ -359,7 +359,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
}
|
||||
if (required)
|
||||
{
|
||||
tryField(json::NullValue);
|
||||
tryField(json::ValueType::Null);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -384,7 +384,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
checkErrorValue(
|
||||
jrr, "malformedRequest", RPC::missingFieldMessage(fieldName.cStr()), location);
|
||||
|
||||
correctRequest[parentFieldName][fieldName] = json::NullValue;
|
||||
correctRequest[parentFieldName][fieldName] = json::ValueType::Null;
|
||||
json::Value const jrr2 = env.rpc(
|
||||
apiVersion, "json", "ledger_entry", to_string(correctRequest))[jss::result];
|
||||
checkErrorValue(
|
||||
@@ -451,7 +451,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
location);
|
||||
|
||||
json::Value correctOutput;
|
||||
correctOutput[parentField] = json::ObjectValue;
|
||||
correctOutput[parentField] = json::ValueType::Object;
|
||||
for (auto const& subfield : subfields)
|
||||
{
|
||||
correctOutput[parentField][subfield.fieldName] = getCorrectValue(subfield.fieldName);
|
||||
@@ -528,7 +528,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
forAllApiVersions([&, this](unsigned apiVersion) {
|
||||
// "features" is not an option supported by ledger_entry.
|
||||
{
|
||||
json::Value jvParams = json::ObjectValue;
|
||||
json::Value jvParams = json::ValueType::Object;
|
||||
jvParams[jss::features] =
|
||||
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
"AAAAAAAAAA";
|
||||
@@ -759,14 +759,14 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
|
||||
{
|
||||
json::Value jvParams;
|
||||
json::Value ammParams(json::ObjectValue);
|
||||
json::Value ammParams(json::ValueType::Object);
|
||||
{
|
||||
json::Value obj(json::ObjectValue);
|
||||
json::Value obj(json::ValueType::Object);
|
||||
obj[jss::currency] = "XRP";
|
||||
ammParams[jss::asset] = obj;
|
||||
}
|
||||
{
|
||||
json::Value const obj(json::ObjectValue);
|
||||
json::Value const obj(json::ValueType::Object);
|
||||
ammParams[jss::asset2] = toJson(usd.raw());
|
||||
}
|
||||
jvParams[jss::amm] = ammParams;
|
||||
@@ -1047,7 +1047,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
jvParams[jss::ledger_index] = jss::validated;
|
||||
jvParams[jss::deposit_preauth][jss::owner] = bob.human();
|
||||
|
||||
jvParams[jss::deposit_preauth][jss::authorized_credentials] = json::ArrayValue;
|
||||
jvParams[jss::deposit_preauth][jss::authorized_credentials] = json::ValueType::Array;
|
||||
auto& arr(jvParams[jss::deposit_preauth][jss::authorized_credentials]);
|
||||
|
||||
json::Value jo;
|
||||
@@ -1070,7 +1070,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
jvParams[jss::deposit_preauth][jss::owner] = bob.human();
|
||||
|
||||
auto tryField = [&](json::Value fieldValue) -> void {
|
||||
json::Value arr = json::ArrayValue;
|
||||
json::Value arr = json::ValueType::Array;
|
||||
json::Value jo;
|
||||
jo[jss::issuer] = fieldValue;
|
||||
jo[jss::credential_type] = strHex(std::string_view(credType));
|
||||
@@ -1090,7 +1090,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
tryField(value);
|
||||
}
|
||||
tryField(json::NullValue);
|
||||
tryField(json::ValueType::Null);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -1099,7 +1099,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
jvParams[jss::ledger_index] = jss::validated;
|
||||
jvParams[jss::deposit_preauth][jss::owner] = bob.human();
|
||||
|
||||
jvParams[jss::deposit_preauth][jss::authorized_credentials] = json::ArrayValue;
|
||||
jvParams[jss::deposit_preauth][jss::authorized_credentials] = json::ValueType::Array;
|
||||
auto& arr(jvParams[jss::deposit_preauth][jss::authorized_credentials]);
|
||||
|
||||
json::Value jo;
|
||||
@@ -1121,7 +1121,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
jvParams[jss::deposit_preauth][jss::owner] = bob.human();
|
||||
|
||||
auto tryField = [&](json::Value fieldValue) -> void {
|
||||
json::Value arr = json::ArrayValue;
|
||||
json::Value arr = json::ValueType::Array;
|
||||
json::Value jo;
|
||||
jo[jss::issuer] = issuer.human();
|
||||
jo[jss::credential_type] = fieldValue;
|
||||
@@ -1141,7 +1141,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
tryField(value);
|
||||
}
|
||||
tryField(json::NullValue);
|
||||
tryField(json::ValueType::Null);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -1151,7 +1151,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
jvParams[jss::deposit_preauth][jss::owner] = bob.human();
|
||||
jvParams[jss::deposit_preauth][jss::authorized] = alice.human();
|
||||
|
||||
jvParams[jss::deposit_preauth][jss::authorized_credentials] = json::ArrayValue;
|
||||
jvParams[jss::deposit_preauth][jss::authorized_credentials] = json::ValueType::Array;
|
||||
auto& arr(jvParams[jss::deposit_preauth][jss::authorized_credentials]);
|
||||
|
||||
json::Value jo;
|
||||
@@ -1187,7 +1187,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
json::Value jvParams;
|
||||
jvParams[jss::ledger_index] = jss::validated;
|
||||
jvParams[jss::deposit_preauth][jss::owner] = bob.human();
|
||||
jvParams[jss::deposit_preauth][jss::authorized_credentials] = json::ArrayValue;
|
||||
jvParams[jss::deposit_preauth][jss::authorized_credentials] = json::ValueType::Array;
|
||||
auto& arr(jvParams[jss::deposit_preauth][jss::authorized_credentials]);
|
||||
arr.append("foobar");
|
||||
|
||||
@@ -1203,9 +1203,9 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
json::Value jvParams;
|
||||
jvParams[jss::ledger_index] = jss::validated;
|
||||
jvParams[jss::deposit_preauth][jss::owner] = bob.human();
|
||||
jvParams[jss::deposit_preauth][jss::authorized_credentials] = json::ArrayValue;
|
||||
jvParams[jss::deposit_preauth][jss::authorized_credentials] = json::ValueType::Array;
|
||||
auto& arr(jvParams[jss::deposit_preauth][jss::authorized_credentials]);
|
||||
json::Value payload = json::ArrayValue;
|
||||
json::Value payload = json::ValueType::Array;
|
||||
payload.append(42);
|
||||
arr.append(std::move(payload));
|
||||
|
||||
@@ -1221,7 +1221,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
json::Value jvParams;
|
||||
jvParams[jss::ledger_index] = jss::validated;
|
||||
jvParams[jss::deposit_preauth][jss::owner] = bob.human();
|
||||
jvParams[jss::deposit_preauth][jss::authorized_credentials] = json::ArrayValue;
|
||||
jvParams[jss::deposit_preauth][jss::authorized_credentials] = json::ValueType::Array;
|
||||
|
||||
auto const jrr = env.rpc("json", "ledger_entry", to_string(jvParams));
|
||||
checkErrorValue(
|
||||
@@ -1240,7 +1240,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
json::Value jvParams;
|
||||
jvParams[jss::ledger_index] = jss::validated;
|
||||
jvParams[jss::deposit_preauth][jss::owner] = bob.human();
|
||||
jvParams[jss::deposit_preauth][jss::authorized_credentials] = json::ArrayValue;
|
||||
jvParams[jss::deposit_preauth][jss::authorized_credentials] = json::ValueType::Array;
|
||||
|
||||
auto& arr(jvParams[jss::deposit_preauth][jss::authorized_credentials]);
|
||||
|
||||
@@ -1305,7 +1305,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Locate directory by directory root.
|
||||
json::Value jvParams;
|
||||
jvParams[jss::directory] = json::ObjectValue;
|
||||
jvParams[jss::directory] = json::ValueType::Object;
|
||||
jvParams[jss::directory][jss::dir_root] = dirRootIndex;
|
||||
json::Value const jrr =
|
||||
env.rpc("json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
@@ -1314,7 +1314,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Locate directory by owner.
|
||||
json::Value jvParams;
|
||||
jvParams[jss::directory] = json::ObjectValue;
|
||||
jvParams[jss::directory] = json::ValueType::Object;
|
||||
jvParams[jss::directory][jss::owner] = alice.human();
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
json::Value const jrr =
|
||||
@@ -1324,7 +1324,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Locate directory by directory root and sub_index.
|
||||
json::Value jvParams;
|
||||
jvParams[jss::directory] = json::ObjectValue;
|
||||
jvParams[jss::directory] = json::ValueType::Object;
|
||||
jvParams[jss::directory][jss::dir_root] = dirRootIndex;
|
||||
jvParams[jss::directory][jss::sub_index] = 1;
|
||||
json::Value const jrr =
|
||||
@@ -1335,7 +1335,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Locate directory by owner and sub_index.
|
||||
json::Value jvParams;
|
||||
jvParams[jss::directory] = json::ObjectValue;
|
||||
jvParams[jss::directory] = json::ValueType::Object;
|
||||
jvParams[jss::directory][jss::owner] = alice.human();
|
||||
jvParams[jss::directory][jss::sub_index] = 1;
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
@@ -1354,7 +1354,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Non-integer sub_index.
|
||||
json::Value jvParams;
|
||||
jvParams[jss::directory] = json::ObjectValue;
|
||||
jvParams[jss::directory] = json::ValueType::Object;
|
||||
jvParams[jss::directory][jss::dir_root] = dirRootIndex;
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
testMalformedSubfield(
|
||||
@@ -1369,7 +1369,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Malformed owner entry.
|
||||
json::Value jvParams;
|
||||
jvParams[jss::directory] = json::ObjectValue;
|
||||
jvParams[jss::directory] = json::ValueType::Object;
|
||||
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
testMalformedSubfield(
|
||||
@@ -1384,7 +1384,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Malformed directory object. Specifies both dir_root and owner.
|
||||
json::Value jvParams;
|
||||
jvParams[jss::directory] = json::ObjectValue;
|
||||
jvParams[jss::directory] = json::ValueType::Object;
|
||||
jvParams[jss::directory][jss::owner] = alice.human();
|
||||
jvParams[jss::directory][jss::dir_root] = dirRootIndex;
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
@@ -1396,7 +1396,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Incomplete directory object. Missing both dir_root and owner.
|
||||
json::Value jvParams;
|
||||
jvParams[jss::directory] = json::ObjectValue;
|
||||
jvParams[jss::directory] = json::ValueType::Object;
|
||||
jvParams[jss::directory][jss::sub_index] = 1;
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
json::Value const jrr =
|
||||
@@ -1425,7 +1425,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
jv[jss::TransactionType] = jss::EscrowCreate;
|
||||
jv[jss::Account] = account.human();
|
||||
jv[jss::Destination] = to.human();
|
||||
jv[jss::Amount] = amount.getJson(JsonOptions::KNone);
|
||||
jv[jss::Amount] = amount.getJson(JsonOptions::Values::None);
|
||||
jv[sfFinishAfter.jsonName] = cancelAfter.time_since_epoch().count() + 2;
|
||||
return jv;
|
||||
};
|
||||
@@ -1439,7 +1439,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Request the escrow using owner and sequence.
|
||||
json::Value jvParams;
|
||||
jvParams[jss::escrow] = json::ObjectValue;
|
||||
jvParams[jss::escrow] = json::ValueType::Object;
|
||||
jvParams[jss::escrow][jss::owner] = alice.human();
|
||||
jvParams[jss::escrow][jss::seq] = env.seq(alice) - 1;
|
||||
json::Value const jrr =
|
||||
@@ -1645,7 +1645,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Request the offer using owner and sequence.
|
||||
json::Value jvParams;
|
||||
jvParams[jss::offer] = json::ObjectValue;
|
||||
jvParams[jss::offer] = json::ValueType::Object;
|
||||
jvParams[jss::offer][jss::account] = alice.human();
|
||||
jvParams[jss::offer][jss::seq] = env.seq(alice) - 1;
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
@@ -1694,7 +1694,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
jv[jss::TransactionType] = jss::PaymentChannelCreate;
|
||||
jv[jss::Account] = account.human();
|
||||
jv[jss::Destination] = to.human();
|
||||
jv[jss::Amount] = amount.getJson(JsonOptions::KNone);
|
||||
jv[jss::Amount] = amount.getJson(JsonOptions::Values::None);
|
||||
jv[sfSettleDelay.jsonName] = settleDelay.count();
|
||||
jv[sfPublicKey.jsonName] = strHex(pk.slice());
|
||||
return jv;
|
||||
@@ -1758,8 +1758,8 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Request the trust line using the accounts and currency.
|
||||
json::Value jvParams;
|
||||
jvParams[fieldName] = json::ObjectValue;
|
||||
jvParams[fieldName][jss::accounts] = json::ArrayValue;
|
||||
jvParams[fieldName] = json::ValueType::Object;
|
||||
jvParams[fieldName][jss::accounts] = json::ValueType::Array;
|
||||
jvParams[fieldName][jss::accounts][0u] = alice.human();
|
||||
jvParams[fieldName][jss::accounts][1u] = gw.human();
|
||||
jvParams[fieldName][jss::currency] = "USD";
|
||||
@@ -1782,8 +1782,8 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// ripple_state one of the accounts is missing.
|
||||
json::Value jvParams;
|
||||
jvParams[fieldName] = json::ObjectValue;
|
||||
jvParams[fieldName][jss::accounts] = json::ArrayValue;
|
||||
jvParams[fieldName] = json::ValueType::Object;
|
||||
jvParams[fieldName][jss::accounts] = json::ValueType::Array;
|
||||
jvParams[fieldName][jss::accounts][0u] = alice.human();
|
||||
jvParams[fieldName][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
@@ -1798,8 +1798,8 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// ripple_state more than 2 accounts.
|
||||
json::Value jvParams;
|
||||
jvParams[fieldName] = json::ObjectValue;
|
||||
jvParams[fieldName][jss::accounts] = json::ArrayValue;
|
||||
jvParams[fieldName] = json::ValueType::Object;
|
||||
jvParams[fieldName][jss::accounts] = json::ValueType::Array;
|
||||
jvParams[fieldName][jss::accounts][0u] = alice.human();
|
||||
jvParams[fieldName][jss::accounts][1u] = gw.human();
|
||||
jvParams[fieldName][jss::accounts][2u] = alice.human();
|
||||
@@ -1816,11 +1816,11 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// ripple_state account[0] / account[1] is not an account.
|
||||
json::Value jvParams;
|
||||
jvParams[fieldName] = json::ObjectValue;
|
||||
jvParams[fieldName] = json::ValueType::Object;
|
||||
auto tryField = [&](json::Value badAccount) -> void {
|
||||
{
|
||||
// account[0]
|
||||
jvParams[fieldName][jss::accounts] = json::ArrayValue;
|
||||
jvParams[fieldName][jss::accounts] = json::ValueType::Array;
|
||||
jvParams[fieldName][jss::accounts][0u] = badAccount;
|
||||
jvParams[fieldName][jss::accounts][1u] = gw.human();
|
||||
jvParams[fieldName][jss::currency] = "USD";
|
||||
@@ -1835,7 +1835,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
|
||||
{
|
||||
// account[1]
|
||||
jvParams[fieldName][jss::accounts] = json::ArrayValue;
|
||||
jvParams[fieldName][jss::accounts] = json::ValueType::Array;
|
||||
jvParams[fieldName][jss::accounts][0u] = alice.human();
|
||||
jvParams[fieldName][jss::accounts][1u] = badAccount;
|
||||
jvParams[fieldName][jss::currency] = "USD";
|
||||
@@ -1854,13 +1854,13 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
tryField(value);
|
||||
}
|
||||
tryField(json::NullValue);
|
||||
tryField(json::ValueType::Null);
|
||||
}
|
||||
{
|
||||
// ripple_state account[0] == account[1].
|
||||
json::Value jvParams;
|
||||
jvParams[fieldName] = json::ObjectValue;
|
||||
jvParams[fieldName][jss::accounts] = json::ArrayValue;
|
||||
jvParams[fieldName] = json::ValueType::Object;
|
||||
jvParams[fieldName][jss::accounts] = json::ValueType::Array;
|
||||
jvParams[fieldName][jss::accounts][0u] = alice.human();
|
||||
jvParams[fieldName][jss::accounts][1u] = alice.human();
|
||||
jvParams[fieldName][jss::currency] = "USD";
|
||||
@@ -1920,7 +1920,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Second real ticket requested by account and sequence.
|
||||
json::Value jvParams;
|
||||
jvParams[jss::ticket] = json::ObjectValue;
|
||||
jvParams[jss::ticket] = json::ValueType::Object;
|
||||
jvParams[jss::ticket][jss::account] = env.master.human();
|
||||
jvParams[jss::ticket][jss::ticket_seq] = tkt1 + 1;
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
@@ -1932,7 +1932,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Not a valid ticket requested by account and sequence.
|
||||
json::Value jvParams;
|
||||
jvParams[jss::ticket] = json::ObjectValue;
|
||||
jvParams[jss::ticket] = json::ValueType::Object;
|
||||
jvParams[jss::ticket][jss::account] = env.master.human();
|
||||
jvParams[jss::ticket][jss::ticket_seq] = tkt1 + 2;
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
@@ -2129,7 +2129,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Request the MPToken using its owner + mptIssuanceID.
|
||||
json::Value jvParams;
|
||||
jvParams[jss::mptoken] = json::ObjectValue;
|
||||
jvParams[jss::mptoken] = json::ValueType::Object;
|
||||
jvParams[jss::mptoken][jss::account] = bob.human();
|
||||
jvParams[jss::mptoken][jss::mpt_issuance_id] = strHex(mptAlice.issuanceID());
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
@@ -2141,7 +2141,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Request the MPToken using a bad mptIssuanceID.
|
||||
json::Value jvParams;
|
||||
jvParams[jss::mptoken] = json::ObjectValue;
|
||||
jvParams[jss::mptoken] = json::ValueType::Object;
|
||||
jvParams[jss::mptoken][jss::account] = bob.human();
|
||||
jvParams[jss::mptoken][jss::mpt_issuance_id] = badMptID;
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
@@ -2302,7 +2302,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
// "field":null
|
||||
json::Value params;
|
||||
params[jss::ledger_index] = jss::validated;
|
||||
params[field] = json::NullValue;
|
||||
params[field] = json::ValueType::Null;
|
||||
auto const jv = env.rpc("json", "ledger_entry", to_string(params));
|
||||
checkResult(false, jv, expectedType, "malformedRequest");
|
||||
BEAST_EXPECT(!jv[jss::result].isMember(jss::index));
|
||||
@@ -2499,7 +2499,7 @@ class LedgerEntry_test : public beast::unit_test::Suite
|
||||
// "hashes":null
|
||||
json::Value params;
|
||||
params[jss::ledger_index] = jss::validated;
|
||||
params[jss::hashes] = json::NullValue;
|
||||
params[jss::hashes] = json::ValueType::Null;
|
||||
auto jv = env.rpc("json", "ledger_entry", to_string(params));
|
||||
checkResult(false, jv, 0, "malformedRequest");
|
||||
BEAST_EXPECT(!jv[jss::result].isMember(jss::index));
|
||||
@@ -2696,7 +2696,8 @@ class LedgerEntry_XChain_test : public beast::unit_test::Suite,
|
||||
BEAST_EXPECT(jv[jss::error] == err);
|
||||
if (msg.empty())
|
||||
{
|
||||
BEAST_EXPECT(jv[jss::error_message] == json::NullValue || jv[jss::error_message] == "");
|
||||
BEAST_EXPECT(
|
||||
jv[jss::error_message] == json::ValueType::Null || jv[jss::error_message] == "");
|
||||
}
|
||||
else if (BEAST_EXPECT(jv.isMember(jss::error_message)))
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ class LedgerHeader_test : public beast::unit_test::Suite
|
||||
using namespace test::jtx;
|
||||
Env env{*this, envconfig(noAdmin)};
|
||||
|
||||
json::Value params{json::ObjectValue};
|
||||
json::Value params{json::ValueType::Object};
|
||||
params[jss::api_version] = 1;
|
||||
params[jss::ledger_index] = "current";
|
||||
auto const result = env.client().invoke("ledger_header", params)[jss::result];
|
||||
@@ -33,7 +33,7 @@ class LedgerHeader_test : public beast::unit_test::Suite
|
||||
using namespace test::jtx;
|
||||
Env env{*this, envconfig(noAdmin)};
|
||||
|
||||
json::Value params{json::ObjectValue};
|
||||
json::Value params{json::ValueType::Object};
|
||||
params[jss::api_version] = 1;
|
||||
params[jss::ledger_index] = "validated";
|
||||
auto const result = env.client().invoke("ledger_header", params)[jss::result];
|
||||
@@ -50,7 +50,7 @@ class LedgerHeader_test : public beast::unit_test::Suite
|
||||
using namespace test::jtx;
|
||||
Env env{*this, envconfig(noAdmin)};
|
||||
|
||||
json::Value params{json::ObjectValue};
|
||||
json::Value params{json::ValueType::Object};
|
||||
params[jss::api_version] = 2;
|
||||
auto const result = env.client().invoke("ledger_header", params)[jss::result];
|
||||
BEAST_EXPECT(result[jss::error] == "unknownCmd");
|
||||
|
||||
@@ -38,7 +38,8 @@ class LedgerRPC_test : public beast::unit_test::Suite
|
||||
BEAST_EXPECT(jv[jss::error] == err);
|
||||
if (msg.empty())
|
||||
{
|
||||
BEAST_EXPECT(jv[jss::error_message] == json::NullValue || jv[jss::error_message] == "");
|
||||
BEAST_EXPECT(
|
||||
jv[jss::error_message] == json::ValueType::Null || jv[jss::error_message] == "");
|
||||
}
|
||||
else if (BEAST_EXPECT(jv.isMember(jss::error_message)))
|
||||
{
|
||||
|
||||
@@ -342,7 +342,7 @@ public:
|
||||
// The current HTTP/S ServerHandler returns an HTTP 403 error code here
|
||||
// rather than a noPermission JSON error. The JSONRPCClient just eats
|
||||
// that error and returns an null result.
|
||||
BEAST_EXPECT(result.type() == json::NullValue);
|
||||
BEAST_EXPECT(result.type() == json::ValueType::Null);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -76,9 +76,9 @@ class NoRippleCheck_test : public beast::unit_test::Suite
|
||||
testInvalidAccountParam(1);
|
||||
testInvalidAccountParam(1.1);
|
||||
testInvalidAccountParam(true);
|
||||
testInvalidAccountParam(json::Value(json::NullValue));
|
||||
testInvalidAccountParam(json::Value(json::ObjectValue));
|
||||
testInvalidAccountParam(json::Value(json::ArrayValue));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Null));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Object));
|
||||
testInvalidAccountParam(json::Value(json::ValueType::Array));
|
||||
}
|
||||
|
||||
{ // invalid role field
|
||||
@@ -153,7 +153,7 @@ class NoRippleCheck_test : public beast::unit_test::Suite
|
||||
json::Value params;
|
||||
params[jss::account] = Account{"nobody"}.human();
|
||||
params[jss::role] = "user";
|
||||
params[jss::ledger] = json::ObjectValue;
|
||||
params[jss::ledger] = json::ValueType::Object;
|
||||
auto const result = env.rpc("json", "noripple_check", to_string(params))[jss::result];
|
||||
BEAST_EXPECT(result[jss::error] == "invalidParams");
|
||||
BEAST_EXPECT(
|
||||
@@ -241,7 +241,7 @@ class NoRippleCheck_test : public beast::unit_test::Suite
|
||||
result[jss::transactions][txs.size() - 1][jss::TransactionType] == jss::TrustSet);
|
||||
BEAST_EXPECT(
|
||||
result[jss::transactions][txs.size() - 1][jss::LimitAmount] ==
|
||||
gw["USD"](100).value().getJson(JsonOptions::KNone));
|
||||
gw["USD"](100).value().getJson(JsonOptions::Values::None));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -293,11 +293,11 @@ class NoRippleCheckLimits_test : public beast::unit_test::Suite
|
||||
Endpoint::fromString(test::getEnvLocalhostAddr()));
|
||||
|
||||
// if we go above the warning threshold, reset
|
||||
if (c.balance() > WarningThreshold)
|
||||
if (c.balance() > kWARNING_THRESHOLD)
|
||||
{
|
||||
using ct = beast::AbstractClock<steady_clock>;
|
||||
c.entry().local_balance =
|
||||
DecayingSample<DecayWindowSeconds, ct>{steady_clock::now()};
|
||||
DecayingSample<kDECAY_WINDOW_SECONDS, ct>{steady_clock::now()};
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ class OwnerInfo_test : public beast::unit_test::Suite
|
||||
json::Value params;
|
||||
params[jss::account] = Account{"bob"}.human();
|
||||
auto const result = env.rpc("json", "owner_info", to_string(params))[jss::result];
|
||||
BEAST_EXPECT(result[jss::accepted] == json::ObjectValue);
|
||||
BEAST_EXPECT(result[jss::current] == json::ObjectValue);
|
||||
BEAST_EXPECT(result[jss::accepted] == json::ValueType::Object);
|
||||
BEAST_EXPECT(result[jss::current] == json::ValueType::Object);
|
||||
BEAST_EXPECT(result[jss::status] == "success");
|
||||
}
|
||||
}
|
||||
@@ -103,21 +103,23 @@ class OwnerInfo_test : public beast::unit_test::Suite
|
||||
BEAST_EXPECT(
|
||||
lines[0u][sfBalance.fieldName] ==
|
||||
(STAmount{Issue{toCurrency("CNY"), noAccount()}, 0}.value().getJson(
|
||||
JsonOptions::KNone)));
|
||||
JsonOptions::Values::None)));
|
||||
BEAST_EXPECT(
|
||||
lines[0u][sfHighLimit.fieldName] ==
|
||||
alice["CNY"](1000).value().getJson(JsonOptions::KNone));
|
||||
alice["CNY"](1000).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
lines[0u][sfLowLimit.fieldName] == gw["CNY"](0).value().getJson(JsonOptions::KNone));
|
||||
lines[0u][sfLowLimit.fieldName] ==
|
||||
gw["CNY"](0).value().getJson(JsonOptions::Values::None));
|
||||
|
||||
BEAST_EXPECT(
|
||||
lines[1u][sfBalance.fieldName] ==
|
||||
(STAmount{Issue{toCurrency("USD"), noAccount()}, 0}.value().getJson(
|
||||
JsonOptions::KNone)));
|
||||
JsonOptions::Values::None)));
|
||||
BEAST_EXPECT(
|
||||
lines[1u][sfHighLimit.fieldName] ==
|
||||
alice["USD"](1000).value().getJson(JsonOptions::KNone));
|
||||
BEAST_EXPECT(lines[1u][sfLowLimit.fieldName] == usd(0).value().getJson(JsonOptions::KNone));
|
||||
alice["USD"](1000).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
lines[1u][sfLowLimit.fieldName] == usd(0).value().getJson(JsonOptions::Values::None));
|
||||
|
||||
if (!BEAST_EXPECT(result[jss::accepted].isMember(jss::offers)))
|
||||
return;
|
||||
@@ -127,9 +129,10 @@ class OwnerInfo_test : public beast::unit_test::Suite
|
||||
|
||||
BEAST_EXPECT(offers[0u][jss::Account] == alice.human());
|
||||
BEAST_EXPECT(
|
||||
offers[0u][sfTakerGets.fieldName] == XRP(1000).value().getJson(JsonOptions::KNone));
|
||||
offers[0u][sfTakerGets.fieldName] ==
|
||||
XRP(1000).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
offers[0u][sfTakerPays.fieldName] == usd(1).value().getJson(JsonOptions::KNone));
|
||||
offers[0u][sfTakerPays.fieldName] == usd(1).value().getJson(JsonOptions::Values::None));
|
||||
|
||||
// current ledger entry
|
||||
if (!BEAST_EXPECT(result[jss::current].isMember(jss::ripple_lines)))
|
||||
@@ -141,22 +144,24 @@ class OwnerInfo_test : public beast::unit_test::Suite
|
||||
BEAST_EXPECT(
|
||||
lines[0u][sfBalance.fieldName] ==
|
||||
(STAmount{Issue{toCurrency("CNY"), noAccount()}, -50}.value().getJson(
|
||||
JsonOptions::KNone)));
|
||||
JsonOptions::Values::None)));
|
||||
BEAST_EXPECT(
|
||||
lines[0u][sfHighLimit.fieldName] ==
|
||||
alice["CNY"](1000).value().getJson(JsonOptions::KNone));
|
||||
alice["CNY"](1000).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
lines[0u][sfLowLimit.fieldName] == gw["CNY"](0).value().getJson(JsonOptions::KNone));
|
||||
lines[0u][sfLowLimit.fieldName] ==
|
||||
gw["CNY"](0).value().getJson(JsonOptions::Values::None));
|
||||
|
||||
BEAST_EXPECT(
|
||||
lines[1u][sfBalance.fieldName] ==
|
||||
(STAmount{Issue{toCurrency("USD"), noAccount()}, -50}.value().getJson(
|
||||
JsonOptions::KNone)));
|
||||
JsonOptions::Values::None)));
|
||||
BEAST_EXPECT(
|
||||
lines[1u][sfHighLimit.fieldName] ==
|
||||
alice["USD"](1000).value().getJson(JsonOptions::KNone));
|
||||
alice["USD"](1000).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
lines[1u][sfLowLimit.fieldName] == gw["USD"](0).value().getJson(JsonOptions::KNone));
|
||||
lines[1u][sfLowLimit.fieldName] ==
|
||||
gw["USD"](0).value().getJson(JsonOptions::Values::None));
|
||||
|
||||
if (!BEAST_EXPECT(result[jss::current].isMember(jss::offers)))
|
||||
return;
|
||||
@@ -168,9 +173,10 @@ class OwnerInfo_test : public beast::unit_test::Suite
|
||||
BEAST_EXPECT(offers[1u] == result[jss::accepted][jss::offers][0u]);
|
||||
BEAST_EXPECT(offers[0u][jss::Account] == alice.human());
|
||||
BEAST_EXPECT(
|
||||
offers[0u][sfTakerGets.fieldName] == XRP(1000).value().getJson(JsonOptions::KNone));
|
||||
offers[0u][sfTakerGets.fieldName] ==
|
||||
XRP(1000).value().getJson(JsonOptions::Values::None));
|
||||
BEAST_EXPECT(
|
||||
offers[0u][sfTakerPays.fieldName] == cny(2).value().getJson(JsonOptions::KNone));
|
||||
offers[0u][sfTakerPays.fieldName] == cny(2).value().getJson(JsonOptions::Values::None));
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
testcase("ChooseLedgerEntryType");
|
||||
|
||||
// Test no type.
|
||||
json::Value tx = json::ObjectValue;
|
||||
json::Value tx = json::ValueType::Object;
|
||||
auto result = RPC::chooseLedgerEntryType(tx);
|
||||
BEAST_EXPECT(result.first == RPC::Status::kOK);
|
||||
BEAST_EXPECT(result.second == 0);
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
std::unique_ptr<AbstractClient> client =
|
||||
useWS ? makeWSClient(env.app().config()) : makeJSONRPCClient(env.app().config());
|
||||
|
||||
json::Value tx = json::ObjectValue;
|
||||
json::Value tx = json::ValueType::Object;
|
||||
tx[jss::tx_json] = pay(alice, bob, XRP(1));
|
||||
tx[jss::secret] = toBase58(generateSeed("alice"));
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
{
|
||||
// RPC subscribe to transactions stream
|
||||
json::Value jv;
|
||||
jv[jss::streams] = json::ArrayValue;
|
||||
jv[jss::streams] = json::ValueType::Array;
|
||||
jv[jss::streams].append("transactions");
|
||||
jv = wsc->invoke("subscribe", jv);
|
||||
BEAST_EXPECT(jv[jss::status] == "success");
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
{
|
||||
// RPC unsubscribe to transactions stream
|
||||
json::Value jv;
|
||||
jv[jss::streams] = json::ArrayValue;
|
||||
jv[jss::streams] = json::ValueType::Array;
|
||||
jv[jss::streams].append("transactions");
|
||||
jv = wsc->invoke("unsubscribe", jv);
|
||||
if (wsc->version() == 2)
|
||||
@@ -242,7 +242,7 @@ public:
|
||||
{
|
||||
// RPC subscribe to ledger stream
|
||||
json::Value jv;
|
||||
jv[jss::streams] = json::ArrayValue;
|
||||
jv[jss::streams] = json::ValueType::Array;
|
||||
jv[jss::streams].append("ledger");
|
||||
jv = wsc->invoke("subscribe", jv);
|
||||
if (wsc->version() == 2)
|
||||
@@ -276,7 +276,7 @@ public:
|
||||
{
|
||||
// RPC unsubscribe to ledger stream
|
||||
json::Value jv;
|
||||
jv[jss::streams] = json::ArrayValue;
|
||||
jv[jss::streams] = json::ValueType::Array;
|
||||
jv[jss::streams].append("ledger");
|
||||
jv = wsc->invoke("unsubscribe", jv);
|
||||
if (wsc->version() == 2)
|
||||
@@ -295,7 +295,7 @@ public:
|
||||
{
|
||||
// RPC subscribe to ledger stream
|
||||
json::Value jv;
|
||||
jv[jss::streams] = json::ArrayValue;
|
||||
jv[jss::streams] = json::ValueType::Array;
|
||||
jv[jss::streams].append("ledger");
|
||||
jv = wsc->invoke("subscribe", jv);
|
||||
if (wsc->version() == 2)
|
||||
@@ -329,7 +329,7 @@ public:
|
||||
{
|
||||
// RPC unsubscribe to ledger stream
|
||||
json::Value jv;
|
||||
jv[jss::streams] = json::ArrayValue;
|
||||
jv[jss::streams] = json::ValueType::Array;
|
||||
jv[jss::streams].append("ledger");
|
||||
jv = wsc->invoke("unsubscribe", jv);
|
||||
if (wsc->version() == 2)
|
||||
@@ -378,7 +378,7 @@ public:
|
||||
{
|
||||
// RPC subscribe to accounts_proposed stream
|
||||
json::Value jv;
|
||||
jv[jss::accounts_proposed] = json::ArrayValue;
|
||||
jv[jss::accounts_proposed] = json::ValueType::Array;
|
||||
jv[jss::accounts_proposed].append(Account("alice").human());
|
||||
jv = wsc->invoke("subscribe", jv);
|
||||
if (wsc->version() == 2)
|
||||
@@ -416,7 +416,7 @@ public:
|
||||
{
|
||||
// RPC unsubscribe to accounts_proposed stream
|
||||
json::Value jv;
|
||||
jv[jss::accounts_proposed] = json::ArrayValue;
|
||||
jv[jss::accounts_proposed] = json::ValueType::Array;
|
||||
jv[jss::accounts_proposed].append(Account("alice").human());
|
||||
jv = wsc->invoke("unsubscribe", jv);
|
||||
if (wsc->version() == 2)
|
||||
|
||||
@@ -66,7 +66,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
{
|
||||
auto const unHexed = strUnHex(result[jss::tx_blob].asString());
|
||||
SerialIter sitTrans(makeSlice(*unHexed)); // NOLINT(bugprone-unchecked-optional-access)
|
||||
txJson = STObject(std::ref(sitTrans), kSF_GENERIC).getJson(JsonOptions::KNone);
|
||||
txJson = STObject(std::ref(sitTrans), kSF_GENERIC).getJson(JsonOptions::Values::None);
|
||||
}
|
||||
BEAST_EXPECT(txJson[jss::TransactionType] == tx[jss::TransactionType]);
|
||||
BEAST_EXPECT(txJson[jss::Account] == tx[jss::Account]);
|
||||
@@ -162,7 +162,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
{
|
||||
auto unHexed = strUnHex(txResult[jss::meta_blob].asString());
|
||||
SerialIter sitTrans(makeSlice(*unHexed)); // NOLINT(bugprone-unchecked-optional-access)
|
||||
return STObject(std::ref(sitTrans), kSF_GENERIC).getJson(JsonOptions::KNone);
|
||||
return STObject(std::ref(sitTrans), kSF_GENERIC).getJson(JsonOptions::Values::None);
|
||||
}
|
||||
|
||||
return txResult[jss::meta];
|
||||
@@ -179,7 +179,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
|
||||
{
|
||||
// No params
|
||||
json::Value const params = json::ObjectValue;
|
||||
json::Value const params = json::ValueType::Object;
|
||||
auto const resp = env.rpc("json", "simulate", to_string(params));
|
||||
BEAST_EXPECT(
|
||||
resp[jss::result][jss::error_message] ==
|
||||
@@ -187,8 +187,8 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
}
|
||||
{
|
||||
// Providing both `tx_json` and `tx_blob`
|
||||
json::Value params = json::ObjectValue;
|
||||
params[jss::tx_json] = json::ObjectValue;
|
||||
json::Value params = json::ValueType::Object;
|
||||
params[jss::tx_json] = json::ValueType::Object;
|
||||
params[jss::tx_blob] = "1200";
|
||||
|
||||
auto const resp = env.rpc("json", "simulate", to_string(params));
|
||||
@@ -198,7 +198,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
}
|
||||
{
|
||||
// `binary` isn't a boolean
|
||||
json::Value params = json::ObjectValue;
|
||||
json::Value params = json::ValueType::Object;
|
||||
params[jss::tx_blob] = "1200";
|
||||
params[jss::binary] = "100";
|
||||
auto const resp = env.rpc("json", "simulate", to_string(params));
|
||||
@@ -206,7 +206,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
}
|
||||
{
|
||||
// Invalid `tx_blob`
|
||||
json::Value params = json::ObjectValue;
|
||||
json::Value params = json::ValueType::Object;
|
||||
params[jss::tx_blob] = "12";
|
||||
|
||||
auto const resp = env.rpc("json", "simulate", to_string(params));
|
||||
@@ -214,8 +214,8 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
}
|
||||
{
|
||||
// Empty `tx_json`
|
||||
json::Value params = json::ObjectValue;
|
||||
params[jss::tx_json] = json::ObjectValue;
|
||||
json::Value params = json::ValueType::Object;
|
||||
params[jss::tx_json] = json::ValueType::Object;
|
||||
|
||||
auto const resp = env.rpc("json", "simulate", to_string(params));
|
||||
BEAST_EXPECT(
|
||||
@@ -223,8 +223,8 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
}
|
||||
{
|
||||
// No tx.Account
|
||||
json::Value params = json::ObjectValue;
|
||||
json::Value txJson = json::ObjectValue;
|
||||
json::Value params = json::ValueType::Object;
|
||||
json::Value txJson = json::ValueType::Object;
|
||||
txJson[jss::TransactionType] = jss::Payment;
|
||||
params[jss::tx_json] = txJson;
|
||||
|
||||
@@ -233,7 +233,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
}
|
||||
{
|
||||
// Empty `tx_blob`
|
||||
json::Value params = json::ObjectValue;
|
||||
json::Value params = json::ValueType::Object;
|
||||
params[jss::tx_blob] = "";
|
||||
|
||||
auto const resp = env.rpc("json", "simulate", to_string(params));
|
||||
@@ -249,7 +249,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
}
|
||||
{
|
||||
// Non-object `tx_json`
|
||||
json::Value params = json::ObjectValue;
|
||||
json::Value params = json::ValueType::Object;
|
||||
params[jss::tx_json] = "";
|
||||
|
||||
auto const resp = env.rpc("json", "simulate", to_string(params));
|
||||
@@ -258,9 +258,9 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
}
|
||||
{
|
||||
// `seed` field included
|
||||
json::Value params = json::ObjectValue;
|
||||
json::Value params = json::ValueType::Object;
|
||||
params[jss::seed] = "random_data";
|
||||
json::Value txJson = json::ObjectValue;
|
||||
json::Value txJson = json::ValueType::Object;
|
||||
txJson[jss::TransactionType] = jss::AccountSet;
|
||||
txJson[jss::Account] = env.master.human();
|
||||
params[jss::tx_json] = txJson;
|
||||
@@ -269,9 +269,9 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
}
|
||||
{
|
||||
// `secret` field included
|
||||
json::Value params = json::ObjectValue;
|
||||
json::Value params = json::ValueType::Object;
|
||||
params[jss::secret] = "random_data";
|
||||
json::Value txJson = json::ObjectValue;
|
||||
json::Value txJson = json::ValueType::Object;
|
||||
txJson[jss::TransactionType] = jss::AccountSet;
|
||||
txJson[jss::Account] = env.master.human();
|
||||
params[jss::tx_json] = txJson;
|
||||
@@ -280,9 +280,9 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
}
|
||||
{
|
||||
// `seed_hex` field included
|
||||
json::Value params = json::ObjectValue;
|
||||
json::Value params = json::ValueType::Object;
|
||||
params[jss::seed_hex] = "random_data";
|
||||
json::Value txJson = json::ObjectValue;
|
||||
json::Value txJson = json::ValueType::Object;
|
||||
txJson[jss::TransactionType] = jss::AccountSet;
|
||||
txJson[jss::Account] = env.master.human();
|
||||
params[jss::tx_json] = txJson;
|
||||
@@ -291,9 +291,9 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
}
|
||||
{
|
||||
// `passphrase` field included
|
||||
json::Value params = json::ObjectValue;
|
||||
json::Value params = json::ValueType::Object;
|
||||
params[jss::passphrase] = "random_data";
|
||||
json::Value txJson = json::ObjectValue;
|
||||
json::Value txJson = json::ValueType::Object;
|
||||
txJson[jss::TransactionType] = jss::AccountSet;
|
||||
txJson[jss::Account] = env.master.human();
|
||||
params[jss::tx_json] = txJson;
|
||||
@@ -302,8 +302,8 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
}
|
||||
{
|
||||
// Invalid transaction
|
||||
json::Value params = json::ObjectValue;
|
||||
json::Value txJson = json::ObjectValue;
|
||||
json::Value params = json::ValueType::Object;
|
||||
json::Value txJson = json::ValueType::Object;
|
||||
txJson[jss::TransactionType] = jss::Payment;
|
||||
txJson[jss::Account] = env.master.human();
|
||||
params[jss::tx_json] = txJson;
|
||||
@@ -316,7 +316,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Bad account
|
||||
json::Value params;
|
||||
json::Value txJson = json::ObjectValue;
|
||||
json::Value txJson = json::ValueType::Object;
|
||||
txJson[jss::TransactionType] = jss::AccountSet;
|
||||
txJson[jss::Account] = "badAccount";
|
||||
params[jss::tx_json] = txJson;
|
||||
@@ -330,7 +330,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Account doesn't exist for Sequence autofill
|
||||
json::Value params;
|
||||
json::Value txJson = json::ObjectValue;
|
||||
json::Value txJson = json::ValueType::Object;
|
||||
txJson[jss::TransactionType] = jss::AccountSet;
|
||||
txJson[jss::Account] = alice.human();
|
||||
params[jss::tx_json] = txJson;
|
||||
@@ -341,7 +341,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Invalid Signers field
|
||||
json::Value params;
|
||||
json::Value txJson = json::ObjectValue;
|
||||
json::Value txJson = json::ValueType::Object;
|
||||
txJson[jss::TransactionType] = jss::AccountSet;
|
||||
txJson[jss::Account] = env.master.human();
|
||||
txJson[sfSigners] = "1";
|
||||
@@ -353,10 +353,10 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Invalid Signers field
|
||||
json::Value params;
|
||||
json::Value txJson = json::ObjectValue;
|
||||
json::Value txJson = json::ValueType::Object;
|
||||
txJson[jss::TransactionType] = jss::AccountSet;
|
||||
txJson[jss::Account] = env.master.human();
|
||||
txJson[sfSigners] = json::ArrayValue;
|
||||
txJson[sfSigners] = json::ValueType::Array;
|
||||
txJson[sfSigners].append("1");
|
||||
params[jss::tx_json] = txJson;
|
||||
|
||||
@@ -366,7 +366,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Invalid transaction
|
||||
json::Value params;
|
||||
json::Value txJson = json::ObjectValue;
|
||||
json::Value txJson = json::ValueType::Object;
|
||||
txJson[jss::TransactionType] = jss::AccountSet;
|
||||
txJson[jss::Account] = env.master.human();
|
||||
txJson["foo"] = "bar";
|
||||
@@ -378,7 +378,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
}
|
||||
{
|
||||
// non-`"binary"` second param for CLI
|
||||
json::Value txJson = json::ObjectValue;
|
||||
json::Value txJson = json::ValueType::Object;
|
||||
txJson[jss::TransactionType] = jss::AccountSet;
|
||||
txJson[jss::Account] = alice.human();
|
||||
auto const resp = env.rpc("simulate", to_string(txJson), "1");
|
||||
@@ -387,7 +387,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Signed transaction
|
||||
json::Value params;
|
||||
json::Value txJson = json::ObjectValue;
|
||||
json::Value txJson = json::ValueType::Object;
|
||||
txJson[jss::TransactionType] = jss::AccountSet;
|
||||
txJson[jss::Account] = env.master.human();
|
||||
txJson[jss::TxnSignature] = "1200ABCD";
|
||||
@@ -400,10 +400,10 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
{
|
||||
// Signed multisig transaction
|
||||
json::Value params;
|
||||
json::Value txJson = json::ObjectValue;
|
||||
json::Value txJson = json::ValueType::Object;
|
||||
txJson[jss::TransactionType] = jss::AccountSet;
|
||||
txJson[jss::Account] = env.master.human();
|
||||
txJson[sfSigners] = json::ArrayValue;
|
||||
txJson[sfSigners] = json::ValueType::Array;
|
||||
{
|
||||
json::Value signer;
|
||||
signer[jss::Account] = alice.human();
|
||||
@@ -723,7 +723,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
// test with autofill
|
||||
testTx(env, tx, validateOutput, false);
|
||||
|
||||
tx[sfSigners] = json::ArrayValue;
|
||||
tx[sfSigners] = json::ValueType::Array;
|
||||
{
|
||||
json::Value signer;
|
||||
signer[jss::Account] = becky.human();
|
||||
@@ -837,7 +837,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
tx[sfDomain] = kNEW_DOMAIN;
|
||||
// master key is disabled, so this is invalid
|
||||
tx[jss::SigningPubKey] = strHex(env.master.pk().slice());
|
||||
tx[sfSigners] = json::ArrayValue;
|
||||
tx[sfSigners] = json::ValueType::Array;
|
||||
{
|
||||
json::Value signer;
|
||||
signer[jss::Account] = becky.human();
|
||||
@@ -900,7 +900,7 @@ class Simulate_test : public beast::unit_test::Suite
|
||||
tx[jss::Account] = alice.human();
|
||||
tx[jss::TransactionType] = jss::AccountSet;
|
||||
tx[sfDomain] = kNEW_DOMAIN;
|
||||
tx[sfSigners] = json::ArrayValue;
|
||||
tx[sfSigners] = json::ValueType::Array;
|
||||
{
|
||||
json::Value signer;
|
||||
signer[jss::Account] = becky.human();
|
||||
|
||||
@@ -60,8 +60,8 @@ public:
|
||||
testInvalidFailHard(1);
|
||||
testInvalidFailHard(0);
|
||||
testInvalidFailHard(1.5);
|
||||
testInvalidFailHard(json::Value(json::ObjectValue));
|
||||
testInvalidFailHard(json::Value(json::ArrayValue));
|
||||
testInvalidFailHard(json::Value(json::ValueType::Object));
|
||||
testInvalidFailHard(json::Value(json::ValueType::Array));
|
||||
|
||||
// Valid boolean values should work (not return invalidParams)
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
|
||||
{
|
||||
// RPC subscribe to server stream
|
||||
stream[jss::streams] = json::ArrayValue;
|
||||
stream[jss::streams] = json::ValueType::Array;
|
||||
stream[jss::streams].append("server");
|
||||
auto jv = wsc->invoke("subscribe", stream);
|
||||
if (wsc->version() == 2)
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
|
||||
{
|
||||
// RPC subscribe to ledger stream
|
||||
stream[jss::streams] = json::ArrayValue;
|
||||
stream[jss::streams] = json::ValueType::Array;
|
||||
stream[jss::streams].append("ledger");
|
||||
auto jv = wsc->invoke("subscribe", stream);
|
||||
if (wsc->version() == 2)
|
||||
@@ -195,7 +195,7 @@ public:
|
||||
|
||||
{
|
||||
// RPC subscribe to transactions stream
|
||||
stream[jss::streams] = json::ArrayValue;
|
||||
stream[jss::streams] = json::ValueType::Array;
|
||||
stream[jss::streams].append("transactions");
|
||||
auto jv = wsc->invoke("subscribe", stream);
|
||||
if (wsc->version() == 2)
|
||||
@@ -267,8 +267,8 @@ public:
|
||||
|
||||
{
|
||||
// RPC subscribe to accounts stream
|
||||
stream = json::ObjectValue;
|
||||
stream[jss::accounts] = json::ArrayValue;
|
||||
stream = json::ValueType::Object;
|
||||
stream[jss::accounts] = json::ValueType::Array;
|
||||
stream[jss::accounts].append(Account("alice").human());
|
||||
auto jv = wsc->invoke("subscribe", stream);
|
||||
if (wsc->version() == 2)
|
||||
@@ -326,12 +326,12 @@ public:
|
||||
return cfg;
|
||||
}));
|
||||
auto wsc = makeWSClient(env.app().config());
|
||||
json::Value stream{json::ObjectValue};
|
||||
json::Value stream{json::ValueType::Object};
|
||||
|
||||
{
|
||||
// RPC subscribe to transactions stream
|
||||
stream[jss::api_version] = 2;
|
||||
stream[jss::streams] = json::ArrayValue;
|
||||
stream[jss::streams] = json::ValueType::Array;
|
||||
stream[jss::streams].append("transactions");
|
||||
auto jv = wsc->invoke("subscribe", stream);
|
||||
if (wsc->version() == 2)
|
||||
@@ -401,7 +401,7 @@ public:
|
||||
|
||||
{
|
||||
// RPC subscribe to manifests stream
|
||||
stream[jss::streams] = json::ArrayValue;
|
||||
stream[jss::streams] = json::ValueType::Array;
|
||||
stream[jss::streams].append("manifests");
|
||||
auto jv = wsc->invoke("subscribe", stream);
|
||||
if (wsc->version() == 2)
|
||||
@@ -447,7 +447,7 @@ public:
|
||||
|
||||
{
|
||||
// RPC subscribe to validations stream
|
||||
stream[jss::streams] = json::ArrayValue;
|
||||
stream[jss::streams] = json::ValueType::Array;
|
||||
stream[jss::streams].append("validations");
|
||||
auto jv = wsc->invoke("subscribe", stream);
|
||||
if (wsc->version() == 2)
|
||||
@@ -546,7 +546,7 @@ public:
|
||||
jv[jss::url] = "http://localhost/events";
|
||||
jv[jss::url_username] = "admin";
|
||||
jv[jss::url_password] = "password";
|
||||
jv[jss::streams] = json::ArrayValue;
|
||||
jv[jss::streams] = json::ValueType::Array;
|
||||
jv[jss::streams][0u] = "validations";
|
||||
auto jr = env.rpc("json", "subscribe", to_string(jv))[jss::result];
|
||||
BEAST_EXPECT(jr[jss::status] == "success");
|
||||
@@ -616,13 +616,13 @@ public:
|
||||
}
|
||||
|
||||
std::initializer_list<json::Value> const nonArrays{
|
||||
json::NullValue,
|
||||
json::IntValue,
|
||||
json::UintValue,
|
||||
json::RealValue,
|
||||
json::ValueType::Null,
|
||||
json::ValueType::Int,
|
||||
json::ValueType::UInt,
|
||||
json::ValueType::Real,
|
||||
"",
|
||||
json::BooleanValue,
|
||||
json::ObjectValue};
|
||||
json::ValueType::Boolean,
|
||||
json::ValueType::Object};
|
||||
|
||||
for (auto const& f : {jss::accounts_proposed, jss::accounts})
|
||||
{
|
||||
@@ -637,7 +637,7 @@ public:
|
||||
|
||||
{
|
||||
json::Value jv;
|
||||
jv[f] = json::ArrayValue;
|
||||
jv[f] = json::ValueType::Array;
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
BEAST_EXPECT(jr[jss::error] == "actMalformed");
|
||||
BEAST_EXPECT(jr[jss::error_message] == "Account malformed.");
|
||||
@@ -655,7 +655,7 @@ public:
|
||||
|
||||
{
|
||||
json::Value jv;
|
||||
jv[jss::books] = json::ArrayValue;
|
||||
jv[jss::books] = json::ValueType::Array;
|
||||
jv[jss::books][0u] = 1;
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
BEAST_EXPECT(jr[jss::error] == "invalidParams");
|
||||
@@ -664,10 +664,10 @@ public:
|
||||
|
||||
{
|
||||
json::Value jv;
|
||||
jv[jss::books] = json::ArrayValue;
|
||||
jv[jss::books][0u] = json::ObjectValue;
|
||||
jv[jss::books][0u][jss::taker_gets] = json::ObjectValue;
|
||||
jv[jss::books][0u][jss::taker_pays] = json::ObjectValue;
|
||||
jv[jss::books] = json::ValueType::Array;
|
||||
jv[jss::books][0u] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_gets] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_pays] = json::ValueType::Object;
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
|
||||
BEAST_EXPECT(jr[jss::error] == "srcCurMalformed");
|
||||
@@ -676,10 +676,10 @@ public:
|
||||
|
||||
{
|
||||
json::Value jv;
|
||||
jv[jss::books] = json::ArrayValue;
|
||||
jv[jss::books][0u] = json::ObjectValue;
|
||||
jv[jss::books][0u][jss::taker_gets] = json::ObjectValue;
|
||||
jv[jss::books][0u][jss::taker_pays] = json::ObjectValue;
|
||||
jv[jss::books] = json::ValueType::Array;
|
||||
jv[jss::books][0u] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_gets] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_pays] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_pays][jss::currency] = "ZZZZ";
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
BEAST_EXPECT(jr[jss::error] == "srcCurMalformed");
|
||||
@@ -688,10 +688,10 @@ public:
|
||||
|
||||
{
|
||||
json::Value jv;
|
||||
jv[jss::books] = json::ArrayValue;
|
||||
jv[jss::books][0u] = json::ObjectValue;
|
||||
jv[jss::books][0u][jss::taker_gets] = json::ObjectValue;
|
||||
jv[jss::books][0u][jss::taker_pays] = json::ObjectValue;
|
||||
jv[jss::books] = json::ValueType::Array;
|
||||
jv[jss::books][0u] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_gets] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_pays] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_pays][jss::currency] = "USD";
|
||||
jv[jss::books][0u][jss::taker_pays][jss::issuer] = 1;
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
@@ -701,10 +701,10 @@ public:
|
||||
|
||||
{
|
||||
json::Value jv;
|
||||
jv[jss::books] = json::ArrayValue;
|
||||
jv[jss::books][0u] = json::ObjectValue;
|
||||
jv[jss::books][0u][jss::taker_gets] = json::ObjectValue;
|
||||
jv[jss::books][0u][jss::taker_pays] = json::ObjectValue;
|
||||
jv[jss::books] = json::ValueType::Array;
|
||||
jv[jss::books][0u] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_gets] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_pays] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_pays][jss::currency] = "USD";
|
||||
jv[jss::books][0u][jss::taker_pays][jss::issuer] = Account{"gateway"}.human() + "DEAD";
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
@@ -714,11 +714,11 @@ public:
|
||||
|
||||
{
|
||||
json::Value jv;
|
||||
jv[jss::books] = json::ArrayValue;
|
||||
jv[jss::books][0u] = json::ObjectValue;
|
||||
jv[jss::books] = json::ValueType::Array;
|
||||
jv[jss::books][0u] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_pays] =
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::KIncludeDate);
|
||||
jv[jss::books][0u][jss::taker_gets] = json::ObjectValue;
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::Values::IncludeDate);
|
||||
jv[jss::books][0u][jss::taker_gets] = json::ValueType::Object;
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
// NOTE: this error is slightly incongruous with the equivalent source currency error
|
||||
BEAST_EXPECT(jr[jss::error] == "dstAmtMalformed");
|
||||
@@ -728,10 +728,10 @@ public:
|
||||
|
||||
{
|
||||
json::Value jv;
|
||||
jv[jss::books] = json::ArrayValue;
|
||||
jv[jss::books][0u] = json::ObjectValue;
|
||||
jv[jss::books] = json::ValueType::Array;
|
||||
jv[jss::books][0u] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_pays] =
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::KIncludeDate);
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::Values::IncludeDate);
|
||||
jv[jss::books][0u][jss::taker_gets][jss::currency] = "ZZZZ";
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
// NOTE: this error is slightly incongruous with the
|
||||
@@ -743,10 +743,10 @@ public:
|
||||
|
||||
{
|
||||
json::Value jv;
|
||||
jv[jss::books] = json::ArrayValue;
|
||||
jv[jss::books][0u] = json::ObjectValue;
|
||||
jv[jss::books] = json::ValueType::Array;
|
||||
jv[jss::books][0u] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_pays] =
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::KIncludeDate);
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::Values::IncludeDate);
|
||||
jv[jss::books][0u][jss::taker_gets][jss::currency] = "USD";
|
||||
jv[jss::books][0u][jss::taker_gets][jss::issuer] = 1;
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
@@ -756,10 +756,10 @@ public:
|
||||
|
||||
{
|
||||
json::Value jv;
|
||||
jv[jss::books] = json::ArrayValue;
|
||||
jv[jss::books][0u] = json::ObjectValue;
|
||||
jv[jss::books] = json::ValueType::Array;
|
||||
jv[jss::books][0u] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_pays] =
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::KIncludeDate);
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::Values::IncludeDate);
|
||||
jv[jss::books][0u][jss::taker_gets][jss::currency] = "USD";
|
||||
jv[jss::books][0u][jss::taker_gets][jss::issuer] = Account{"gateway"}.human() + "DEAD";
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
@@ -769,12 +769,12 @@ public:
|
||||
|
||||
{
|
||||
json::Value jv;
|
||||
jv[jss::books] = json::ArrayValue;
|
||||
jv[jss::books][0u] = json::ObjectValue;
|
||||
jv[jss::books] = json::ValueType::Array;
|
||||
jv[jss::books][0u] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_pays] =
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::KIncludeDate);
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::Values::IncludeDate);
|
||||
jv[jss::books][0u][jss::taker_gets] =
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::KIncludeDate);
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::Values::IncludeDate);
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
BEAST_EXPECT(jr[jss::error] == "badMarket");
|
||||
BEAST_EXPECT(jr[jss::error_message] == "No such market.");
|
||||
@@ -791,7 +791,7 @@ public:
|
||||
|
||||
{
|
||||
json::Value jv;
|
||||
jv[jss::streams] = json::ArrayValue;
|
||||
jv[jss::streams] = json::ValueType::Array;
|
||||
jv[jss::streams][0u] = 1;
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
BEAST_EXPECT(jr[jss::error] == "malformedStream");
|
||||
@@ -800,7 +800,7 @@ public:
|
||||
|
||||
{
|
||||
json::Value jv;
|
||||
jv[jss::streams] = json::ArrayValue;
|
||||
jv[jss::streams] = json::ValueType::Array;
|
||||
jv[jss::streams][0u] = "not_a_stream";
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
BEAST_EXPECT(jr[jss::error] == "malformedStream");
|
||||
@@ -812,10 +812,10 @@ public:
|
||||
// invalid taker - not a string
|
||||
{
|
||||
json::Value jv;
|
||||
jv[jss::books] = json::ArrayValue;
|
||||
jv[jss::books][0u] = json::ObjectValue;
|
||||
jv[jss::books] = json::ValueType::Array;
|
||||
jv[jss::books][0u] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_pays] =
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::KIncludeDate);
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::Values::IncludeDate);
|
||||
jv[jss::books][0u][jss::taker_gets][jss::currency] = "XRP";
|
||||
jv[jss::books][0u][jss::taker] = 1;
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
@@ -826,10 +826,10 @@ public:
|
||||
// invalid taker - malformed account string
|
||||
{
|
||||
json::Value jv;
|
||||
jv[jss::books] = json::ArrayValue;
|
||||
jv[jss::books][0u] = json::ObjectValue;
|
||||
jv[jss::books] = json::ValueType::Array;
|
||||
jv[jss::books][0u] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_pays] =
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::KIncludeDate);
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::Values::IncludeDate);
|
||||
jv[jss::books][0u][jss::taker_gets][jss::currency] = "XRP";
|
||||
jv[jss::books][0u][jss::taker] = "not_an_account";
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
@@ -840,10 +840,10 @@ public:
|
||||
// invalid taker - account string with extra characters
|
||||
{
|
||||
json::Value jv;
|
||||
jv[jss::books] = json::ArrayValue;
|
||||
jv[jss::books][0u] = json::ObjectValue;
|
||||
jv[jss::books] = json::ValueType::Array;
|
||||
jv[jss::books][0u] = json::ValueType::Object;
|
||||
jv[jss::books][0u][jss::taker_pays] =
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::KIncludeDate);
|
||||
Account{"gateway"}["USD"](1).value().getJson(JsonOptions::Values::IncludeDate);
|
||||
jv[jss::books][0u][jss::taker_gets][jss::currency] = "XRP";
|
||||
jv[jss::books][0u][jss::taker] = Account{"alice"}.human() + "DEAD";
|
||||
auto const jr = wsc->invoke(method, jv)[jss::result];
|
||||
@@ -1033,7 +1033,7 @@ public:
|
||||
Env env(*this, singleThreadIo(envconfig()));
|
||||
auto wscTxHistory = makeWSClient(env.app().config());
|
||||
json::Value request;
|
||||
request[jss::account_history_tx_stream] = json::ObjectValue;
|
||||
request[jss::account_history_tx_stream] = json::ValueType::Object;
|
||||
request[jss::account_history_tx_stream][jss::account] = alice.human();
|
||||
auto jv = wscTxHistory->invoke("subscribe", request);
|
||||
if (!BEAST_EXPECT(goodSubRPC(jv)))
|
||||
@@ -1076,7 +1076,7 @@ public:
|
||||
Env env(*this, singleThreadIo(envconfig()));
|
||||
auto wscTxHistory = makeWSClient(env.app().config());
|
||||
json::Value request;
|
||||
request[jss::account_history_tx_stream] = json::ObjectValue;
|
||||
request[jss::account_history_tx_stream] = json::ValueType::Object;
|
||||
request[jss::account_history_tx_stream][jss::account] =
|
||||
"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh";
|
||||
auto jv = wscTxHistory->invoke("subscribe", request);
|
||||
@@ -1159,8 +1159,8 @@ public:
|
||||
BEAST_EXPECT(env.syncClose());
|
||||
|
||||
// subscribe account
|
||||
json::Value stream = json::ObjectValue;
|
||||
stream[jss::accounts] = json::ArrayValue;
|
||||
json::Value stream = json::ValueType::Object;
|
||||
stream[jss::accounts] = json::ValueType::Array;
|
||||
stream[jss::accounts].append(alice.human());
|
||||
auto jv = wscAccount->invoke("subscribe", stream);
|
||||
|
||||
@@ -1172,7 +1172,7 @@ public:
|
||||
|
||||
// subscribe account tx history
|
||||
json::Value request;
|
||||
request[jss::account_history_tx_stream] = json::ObjectValue;
|
||||
request[jss::account_history_tx_stream] = json::ValueType::Object;
|
||||
request[jss::account_history_tx_stream][jss::account] = alice.human();
|
||||
jv = wscTxHistory->invoke("subscribe", request);
|
||||
|
||||
@@ -1236,7 +1236,7 @@ public:
|
||||
|
||||
// subscribe
|
||||
json::Value request;
|
||||
request[jss::account_history_tx_stream] = json::ObjectValue;
|
||||
request[jss::account_history_tx_stream] = json::ValueType::Object;
|
||||
request[jss::account_history_tx_stream][jss::account] = carol.human();
|
||||
auto ws = makeWSClient(env.app().config());
|
||||
auto jv = ws->invoke("subscribe", request);
|
||||
@@ -1270,7 +1270,7 @@ public:
|
||||
|
||||
// subscribe
|
||||
json::Value request;
|
||||
request[jss::account_history_tx_stream] = json::ObjectValue;
|
||||
request[jss::account_history_tx_stream] = json::ValueType::Object;
|
||||
request[jss::account_history_tx_stream][jss::account] = carol.human();
|
||||
auto wscLong = makeWSClient(env.app().config());
|
||||
auto jv = wscLong->invoke("subscribe", request);
|
||||
@@ -1324,7 +1324,7 @@ public:
|
||||
auto wsc = makeWSClient(env.app().config());
|
||||
|
||||
json::Value streams;
|
||||
streams[jss::streams] = json::ArrayValue;
|
||||
streams[jss::streams] = json::ValueType::Array;
|
||||
streams[jss::streams][0u] = "book_changes";
|
||||
|
||||
auto jv = wsc->invoke("subscribe", streams);
|
||||
@@ -1380,7 +1380,7 @@ public:
|
||||
|
||||
auto wsc = test::makeWSClient(env.app().config());
|
||||
json::Value stream;
|
||||
stream[jss::streams] = json::ArrayValue;
|
||||
stream[jss::streams] = json::ValueType::Array;
|
||||
stream[jss::streams].append("transactions");
|
||||
auto jv = wsc->invoke("subscribe", stream);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class TransactionEntry_test : public beast::unit_test::Suite
|
||||
}
|
||||
|
||||
{
|
||||
json::Value params{json::ObjectValue};
|
||||
json::Value params{json::ValueType::Object};
|
||||
params[jss::ledger] = 20;
|
||||
auto const result = env.client().invoke("transaction_entry", params)[jss::result];
|
||||
BEAST_EXPECT(result[jss::error] == "lgrNotFound");
|
||||
@@ -52,7 +52,7 @@ class TransactionEntry_test : public beast::unit_test::Suite
|
||||
}
|
||||
|
||||
{
|
||||
json::Value params{json::ObjectValue};
|
||||
json::Value params{json::ValueType::Object};
|
||||
params[jss::ledger] = "current";
|
||||
params[jss::tx_hash] = "DEADBEEF";
|
||||
auto const result = env.client().invoke("transaction_entry", params)[jss::result];
|
||||
@@ -61,7 +61,7 @@ class TransactionEntry_test : public beast::unit_test::Suite
|
||||
}
|
||||
|
||||
{
|
||||
json::Value params{json::ObjectValue};
|
||||
json::Value params{json::ValueType::Object};
|
||||
params[jss::ledger] = "closed";
|
||||
params[jss::tx_hash] = "DEADBEEF";
|
||||
auto const result = env.client().invoke("transaction_entry", params)[jss::result];
|
||||
@@ -151,7 +151,7 @@ class TransactionEntry_test : public beast::unit_test::Suite
|
||||
std::string const closeTimeIso = "") {
|
||||
// first request using ledger_index to lookup
|
||||
json::Value const resIndex{[&env, index, &txhash, apiVersion]() {
|
||||
json::Value params{json::ObjectValue};
|
||||
json::Value params{json::ValueType::Object};
|
||||
params[jss::ledger_index] = index;
|
||||
params[jss::tx_hash] = txhash;
|
||||
params[jss::api_version] = apiVersion;
|
||||
@@ -206,7 +206,7 @@ class TransactionEntry_test : public beast::unit_test::Suite
|
||||
// second request using ledger_hash to lookup and verify
|
||||
// both responses match
|
||||
{
|
||||
json::Value params{json::ObjectValue};
|
||||
json::Value params{json::ValueType::Object};
|
||||
params[jss::ledger_hash] = resIndex[jss::ledger_hash];
|
||||
params[jss::tx_hash] = txhash;
|
||||
params[jss::api_version] = apiVersion;
|
||||
|
||||
@@ -36,7 +36,7 @@ class TransactionHistory_test : public beast::unit_test::Suite
|
||||
|
||||
{
|
||||
// test at 1 greater than the allowed non-admin limit
|
||||
json::Value params{json::ObjectValue};
|
||||
json::Value params{json::ValueType::Object};
|
||||
params[jss::start] = 10001; // limited to <= 10000 for non admin
|
||||
auto const result = env.client().invoke("tx_history", params)[jss::result];
|
||||
BEAST_EXPECT(result[jss::error] == "noPermission");
|
||||
@@ -51,7 +51,7 @@ class TransactionHistory_test : public beast::unit_test::Suite
|
||||
using namespace test::jtx;
|
||||
Env env{*this, envconfig(noAdmin)};
|
||||
|
||||
json::Value params{json::ObjectValue};
|
||||
json::Value params{json::ValueType::Object};
|
||||
params[jss::api_version] = 2;
|
||||
auto const result = env.client().invoke("tx_history", params)[jss::result];
|
||||
BEAST_EXPECT(result[jss::error] == "unknownCmd");
|
||||
@@ -86,7 +86,7 @@ class TransactionHistory_test : public beast::unit_test::Suite
|
||||
|
||||
// verify the latest transaction in env (offer)
|
||||
// is available in tx_history.
|
||||
json::Value params{json::ObjectValue};
|
||||
json::Value params{json::ValueType::Object};
|
||||
params[jss::start] = 0;
|
||||
auto result = env.client().invoke("tx_history", params)[jss::result];
|
||||
if (!BEAST_EXPECT(result[jss::txs].isArray() && result[jss::txs].size() > 0))
|
||||
@@ -94,7 +94,7 @@ class TransactionHistory_test : public beast::unit_test::Suite
|
||||
|
||||
// search for a tx in history matching the last offer
|
||||
bool const txFound = [&] {
|
||||
auto const toFind = env.tx()->getJson(JsonOptions::KNone);
|
||||
auto const toFind = env.tx()->getJson(JsonOptions::Values::None);
|
||||
for (auto tx : result[jss::txs])
|
||||
{
|
||||
tx.removeMember(jss::inLedger);
|
||||
@@ -113,7 +113,7 @@ class TransactionHistory_test : public beast::unit_test::Suite
|
||||
std::unordered_map<std::string, unsigned> typeCounts;
|
||||
while (start < 120)
|
||||
{
|
||||
json::Value params{json::ObjectValue};
|
||||
json::Value params{json::ValueType::Object};
|
||||
params[jss::start] = start;
|
||||
auto result = env.client().invoke("tx_history", params)[jss::result];
|
||||
if (!BEAST_EXPECT(result[jss::txs].isArray() && result[jss::txs].size() > 0))
|
||||
@@ -133,7 +133,7 @@ class TransactionHistory_test : public beast::unit_test::Suite
|
||||
|
||||
// also, try a request with max non-admin start value
|
||||
{
|
||||
json::Value params{json::ObjectValue};
|
||||
json::Value params{json::ValueType::Object};
|
||||
params[jss::start] = 10000; // limited to <= 10000 for non admin
|
||||
auto const result = env.client().invoke("tx_history", params)[jss::result];
|
||||
BEAST_EXPECT(result[jss::status] == "success");
|
||||
|
||||
@@ -697,7 +697,7 @@ class Transaction_test : public beast::unit_test::Suite
|
||||
|
||||
json::Value params;
|
||||
params[jss::id] = 1;
|
||||
auto const hash = env.tx()->getJson(JsonOptions::KNone)[jss::hash];
|
||||
auto const hash = env.tx()->getJson(JsonOptions::Values::None)[jss::hash];
|
||||
params[jss::transaction] = hash;
|
||||
auto const jrr = env.rpc("json", "tx", to_string(params))[jss::result];
|
||||
BEAST_EXPECT(jrr[jss::hash] == hash);
|
||||
@@ -771,7 +771,7 @@ class Transaction_test : public beast::unit_test::Suite
|
||||
std::shared_ptr<STObject const> const meta =
|
||||
env.closed()->txRead(env.tx()->getTransactionID()).second;
|
||||
|
||||
json::Value expected = txn->getJson(JsonOptions::KNone);
|
||||
json::Value expected = txn->getJson(JsonOptions::Values::None);
|
||||
expected[jss::DeliverMax] = expected[jss::Amount];
|
||||
if (apiVersion > 1)
|
||||
{
|
||||
@@ -780,7 +780,7 @@ class Transaction_test : public beast::unit_test::Suite
|
||||
}
|
||||
|
||||
json::Value const result = {[&env, txn, apiVersion]() {
|
||||
json::Value params{json::ObjectValue};
|
||||
json::Value params{json::ValueType::Object};
|
||||
params[jss::transaction] = to_string(txn->getTransactionID());
|
||||
params[jss::binary] = false;
|
||||
params[jss::api_version] = apiVersion;
|
||||
@@ -847,7 +847,7 @@ class Transaction_test : public beast::unit_test::Suite
|
||||
std::string const expectedMetaBlob = serializeHex(*meta);
|
||||
|
||||
json::Value const result = [&env, txn, apiVersion]() {
|
||||
json::Value params{json::ObjectValue};
|
||||
json::Value params{json::ValueType::Object};
|
||||
params[jss::transaction] = to_string(txn->getTransactionID());
|
||||
params[jss::binary] = true;
|
||||
params[jss::api_version] = apiVersion;
|
||||
|
||||
@@ -91,12 +91,12 @@ class Version_test : public beast::unit_test::Suite
|
||||
? RPC::kAPI_INVALID_VERSION
|
||||
: RPC::kAPI_VERSION_IF_UNSPECIFIED;
|
||||
|
||||
json::Value const jArray = json::Value(json::ArrayValue);
|
||||
json::Value const jNull = json::Value(json::NullValue);
|
||||
json::Value const jArray = json::Value(json::ValueType::Array);
|
||||
json::Value const jNull = json::Value(json::ValueType::Null);
|
||||
BEAST_EXPECT(RPC::getAPIVersionNumber(jArray, false) == versionIfUnspecified);
|
||||
BEAST_EXPECT(RPC::getAPIVersionNumber(jNull, false) == versionIfUnspecified);
|
||||
|
||||
json::Value jObject = json::Value(json::ObjectValue);
|
||||
json::Value jObject = json::Value(json::ValueType::Object);
|
||||
BEAST_EXPECT(RPC::getAPIVersionNumber(jObject, false) == versionIfUnspecified);
|
||||
jObject[jss::api_version] = RPC::kAPI_VERSION_IF_UNSPECIFIED.value;
|
||||
BEAST_EXPECT(RPC::getAPIVersionNumber(jObject, false) == versionIfUnspecified);
|
||||
|
||||
Reference in New Issue
Block a user