mirror of
https://github.com/XRPLF/clio.git
synced 2026-09-28 07:58:10 +00:00
Remove forwarders
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
#include "rpc/RPCHelpers.hpp"
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "util/AccountUtils.hpp"
|
||||
#include "util/LedgerUtils.hpp"
|
||||
#include "util/TimeUtils.hpp"
|
||||
|
||||
#include <boost/json/object.hpp>
|
||||
@@ -12,6 +11,7 @@
|
||||
#include <boost/json/value_to.hpp>
|
||||
#include <fmt/format.h>
|
||||
#include <rpcspec/Errors.hpp>
|
||||
#include <rpcspec/LedgerTypes.hpp>
|
||||
#include <xrpl/basics/StringUtilities.h>
|
||||
#include <xrpl/basics/base_uint.h>
|
||||
#include <xrpl/protocol/AccountID.h>
|
||||
@@ -116,8 +116,7 @@ CustomValidator CustomValidators::ledgerTypeValidator =
|
||||
}};
|
||||
}
|
||||
|
||||
auto const type =
|
||||
util::LedgerTypes::getLedgerEntryTypeFromStr(boost::json::value_to<std::string>(value));
|
||||
auto const type = spec::ledgerEntryTypeFromStr(boost::json::value_to<std::string>(value));
|
||||
if (type == xrpl::ltANY) {
|
||||
return Error{
|
||||
Status{RippledError::RpcInvalidParams, fmt::format("Invalid field '{}'.", key)}
|
||||
@@ -176,9 +175,8 @@ CustomValidator CustomValidators::accountTypeValidator =
|
||||
}};
|
||||
}
|
||||
|
||||
auto const type = util::LedgerTypes::getAccountOwnedLedgerTypeFromStr(
|
||||
boost::json::value_to<std::string>(value)
|
||||
);
|
||||
auto const type =
|
||||
spec::accountOwnedLedgerTypeFromStr(boost::json::value_to<std::string>(value));
|
||||
if (type == xrpl::ltANY) {
|
||||
return Error{
|
||||
Status{RippledError::RpcInvalidParams, fmt::format("Invalid field '{}'.", key)}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <boost/json/value.hpp>
|
||||
#include <boost/json/value_to.hpp>
|
||||
#include <rpcspec/Errors.hpp>
|
||||
#include <rpcspec/LedgerTypes.hpp>
|
||||
#include <xrpl/basics/strHex.h>
|
||||
#include <xrpl/protocol/Indexes.h>
|
||||
#include <xrpl/protocol/LedgerFormats.h>
|
||||
@@ -160,7 +161,7 @@ tag_invoke(boost::json::value_to_tag<AccountObjectsHandler::Input>, boost::json:
|
||||
}
|
||||
|
||||
if (jsonObject.contains(JS(type))) {
|
||||
input.type = util::LedgerTypes::getAccountOwnedLedgerTypeFromStr(
|
||||
input.type = spec::accountOwnedLedgerTypeFromStr(
|
||||
boost::json::value_to<std::string>(jv.at(JS(type)))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "rpc/common/Types.hpp"
|
||||
#include "util/Assert.hpp"
|
||||
#include "util/JsonUtils.hpp"
|
||||
#include "util/LedgerUtils.hpp"
|
||||
#include "util/log/Logger.hpp"
|
||||
|
||||
#include <boost/json/conversion.hpp>
|
||||
@@ -14,6 +13,7 @@
|
||||
#include <boost/json/value.hpp>
|
||||
#include <boost/json/value_to.hpp>
|
||||
#include <rpcspec/Errors.hpp>
|
||||
#include <rpcspec/LedgerTypes.hpp>
|
||||
#include <xrpl/basics/base_uint.h>
|
||||
#include <xrpl/basics/strHex.h>
|
||||
#include <xrpl/protocol/LedgerFormats.h>
|
||||
@@ -215,9 +215,8 @@ tag_invoke(boost::json::value_to_tag<LedgerDataHandler::Input>, boost::json::val
|
||||
}
|
||||
|
||||
if (jsonObject.contains(JS(type))) {
|
||||
input.type = util::LedgerTypes::getLedgerEntryTypeFromStr(
|
||||
boost::json::value_to<std::string>(jv.at(JS(type)))
|
||||
);
|
||||
input.type =
|
||||
spec::ledgerEntryTypeFromStr(boost::json::value_to<std::string>(jv.at(JS(type))));
|
||||
}
|
||||
|
||||
return input;
|
||||
|
||||
@@ -33,7 +33,6 @@ target_sources(
|
||||
Taggable.cpp
|
||||
TerminationHandler.cpp
|
||||
TimeUtils.cpp
|
||||
LedgerUtils.cpp
|
||||
MPTIssuanceUtils.cpp
|
||||
config/Array.cpp
|
||||
config/ArrayView.cpp
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#include "util/LedgerUtils.hpp"
|
||||
|
||||
#include <rpcspec/LedgerTypes.hpp>
|
||||
#include <xrpl/protocol/LedgerFormats.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace util {
|
||||
|
||||
xrpl::LedgerEntryType
|
||||
LedgerTypes::getLedgerEntryTypeFromStr(std::string const& entryName)
|
||||
{
|
||||
return rpc::spec::ledgerEntryTypeFromStr(entryName);
|
||||
}
|
||||
|
||||
xrpl::LedgerEntryType
|
||||
LedgerTypes::getAccountOwnedLedgerTypeFromStr(std::string const& entryName)
|
||||
{
|
||||
return rpc::spec::accountOwnedLedgerTypeFromStr(entryName);
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
@@ -63,26 +63,6 @@ public:
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the xrpl::LedgerEntryType from the given string.
|
||||
*
|
||||
* @param entryName The name or canonical name (case-insensitive) of the ledger entry type for
|
||||
* all categories
|
||||
* @return The xrpl::LedgerEntryType of the given string, returns ltANY if not found.
|
||||
*/
|
||||
static xrpl::LedgerEntryType
|
||||
getLedgerEntryTypeFromStr(std::string const& entryName);
|
||||
|
||||
/**
|
||||
* @brief Returns the xrpl::LedgerEntryType from the given string.
|
||||
*
|
||||
* @param entryName The name or canonical name (case-insensitive) of the ledger entry type for
|
||||
* account owned category
|
||||
* @return The xrpl::LedgerEntryType of the given string, returns ltANY if not found.
|
||||
*/
|
||||
static xrpl::LedgerEntryType
|
||||
getAccountOwnedLedgerTypeFromStr(std::string const& entryName);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "util/LedgerUtils.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <rpcspec/LedgerTypes.hpp>
|
||||
#include <xrpl/protocol/LedgerFormats.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
|
||||
@@ -55,16 +56,16 @@ TEST(LedgerUtilsTests, LedgerObjectTypeList)
|
||||
|
||||
TEST(LedgerUtilsTests, StrToType)
|
||||
{
|
||||
EXPECT_EQ(util::LedgerTypes::getLedgerEntryTypeFromStr("mess"), xrpl::ltANY);
|
||||
EXPECT_EQ(util::LedgerTypes::getLedgerEntryTypeFromStr("tomato"), xrpl::ltANY);
|
||||
EXPECT_EQ(util::LedgerTypes::getLedgerEntryTypeFromStr("account"), xrpl::ltACCOUNT_ROOT);
|
||||
EXPECT_EQ(util::LedgerTypes::getLedgerEntryTypeFromStr("AccoUnt"), xrpl::ltANY);
|
||||
EXPECT_EQ(util::LedgerTypes::getLedgerEntryTypeFromStr("AccountRoot"), xrpl::ltACCOUNT_ROOT);
|
||||
EXPECT_EQ(util::LedgerTypes::getLedgerEntryTypeFromStr("ACCOUNTRoot"), xrpl::ltACCOUNT_ROOT);
|
||||
EXPECT_EQ(rpc::spec::ledgerEntryTypeFromStr("mess"), xrpl::ltANY);
|
||||
EXPECT_EQ(rpc::spec::ledgerEntryTypeFromStr("tomato"), xrpl::ltANY);
|
||||
EXPECT_EQ(rpc::spec::ledgerEntryTypeFromStr("account"), xrpl::ltACCOUNT_ROOT);
|
||||
EXPECT_EQ(rpc::spec::ledgerEntryTypeFromStr("AccoUnt"), xrpl::ltANY);
|
||||
EXPECT_EQ(rpc::spec::ledgerEntryTypeFromStr("AccountRoot"), xrpl::ltACCOUNT_ROOT);
|
||||
EXPECT_EQ(rpc::spec::ledgerEntryTypeFromStr("ACCOUNTRoot"), xrpl::ltACCOUNT_ROOT);
|
||||
|
||||
constexpr auto kTypes = util::LedgerTypes::getLedgerEntryTypeStrList();
|
||||
std::ranges::for_each(kTypes, [](auto const& typeStr) {
|
||||
EXPECT_NE(util::LedgerTypes::getLedgerEntryTypeFromStr(typeStr), xrpl::ltANY);
|
||||
EXPECT_NE(rpc::spec::ledgerEntryTypeFromStr(typeStr), xrpl::ltANY);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -193,7 +194,7 @@ class LedgerEntryTypeFromStrTest : public ::testing::TestWithParam<LedgerEntryTy
|
||||
TEST_P(LedgerEntryTypeFromStrTest, GetLedgerEntryTypeFromStr)
|
||||
{
|
||||
auto const& param = GetParam();
|
||||
auto const result = util::LedgerTypes::getLedgerEntryTypeFromStr(param.input);
|
||||
auto const result = rpc::spec::ledgerEntryTypeFromStr(param.input);
|
||||
EXPECT_EQ(result, param.expected) << param.input;
|
||||
}
|
||||
|
||||
@@ -217,7 +218,7 @@ class AccountOwnedLedgerTypeFromStrTest : public ::testing::TestWithParam<Ledger
|
||||
TEST_P(AccountOwnedLedgerTypeFromStrTest, GetAccountOwnedLedgerTypeFromStr)
|
||||
{
|
||||
auto const& param = GetParam();
|
||||
auto const result = util::LedgerTypes::getAccountOwnedLedgerTypeFromStr(param.input);
|
||||
auto const result = rpc::spec::accountOwnedLedgerTypeFromStr(param.input);
|
||||
EXPECT_EQ(result, param.expected);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user