chore: Update libxrpl to 3.2.0 (#3114)

This commit is contained in:
Sergey Kuznetsov
2026-06-25 11:19:12 +01:00
committed by GitHub
parent 3673586be3
commit 9b04d64a0e
257 changed files with 6174 additions and 6312 deletions

View File

@@ -6,5 +6,5 @@ find_package(
1.82
REQUIRED
CONFIG
COMPONENTS program_options coroutine system log log_setup
COMPONENTS program_options system log log_setup
)

View File

@@ -1,4 +1,4 @@
find_package(OpenSSL 1.1.1 REQUIRED CONFIG)
find_package(OpenSSL 3 REQUIRED CONFIG)
set_target_properties(
OpenSSL::SSL

View File

@@ -1,61 +1,76 @@
{
"version": "0.5",
"requires": [
"zlib/1.3.1#cac0f6daea041b0ccf42934163defb20%1774439233.809",
"zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1778091116.056",
"xxhash/0.8.3#681d36a0a6111fc56e5e45ea182c19cc%1765850149.987",
"xrpl/3.1.3#eabc6838b4553671bdde4b3aa1f8e3e6%1778495466.414",
"sqlite3/3.49.1#8631739a4c9b93bd3d6b753bac548a63%1765850149.926",
"xrpl/3.2.0#c3c124909c6461012758a4fab7c90cd5%1781569913.756",
"sqlite3/3.53.0#324ada52333108388a9a6108bfa96734%1778091117.311",
"spdlog/1.17.0#bcbaaf7147bda6ad24ffbd1ac3d7142c%1768312128.781",
"soci/4.0.3#fe32b9ad5eb47e79ab9e45a68f363945%1774450067.231",
"re2/20230301#ca3b241baec15bd31ea9187150e0b333%1765850148.103",
"snappy/1.1.10#968fef506ff261592ec30c574d4a7809%1765850147.878",
"secp256k1/0.7.1#481881709eb0bdd0185a12b912bbe8ad%1770910500.329",
"rocksdb/10.5.1#4a197eca381a3e5ae8adf8cffa5aacd0%1765850186.86",
"re2/20251105#8579cfd0bda4daf0683f9e3898f964b4%1774398111.888",
"rapidjson/cci.20220822#1b9d8c2256876a154172dc5cfbe447c6%1754325007.656",
"protobuf/3.21.12#44ee56c0a6eea0c19aeeaca680370b88%1764175361.456",
"openssl/1.1.1w#a8f0792d7c5121b954578a7149d23e03%1756223730.729",
"protobuf/6.33.5#d96d52ba5baaaa532f47bda866ad87a5%1774467363.12",
"openssl/3.6.2#4789bbf131b77d0515d15e094c8f697f%1778071755.506",
"nudb/2.0.9#11149c73f8f2baff9a0198fe25971fc7%1775040983.408",
"minizip/1.2.13#9e87d57804bd372d6d1e32b1871517a3%1754325004.374",
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504%1765850143.914",
"libuv/1.46.0#dc28c1f653fa197f00db5b577a6f6011%1754325003.592",
"libiconv/1.17#1e65319e945f2d31941a9d28cc13c058%1765842973.492",
"libbacktrace/cci.20210118#a7691bfccd8caaf66309df196790a5a1%1765842973.03",
"libarchive/3.8.1#ffee18995c706e02bf96e7a2f7042e0d%1765850144.736",
"libarchive/3.8.7#c446109bd1f1d8ba7936c94189bc50e6%1778091117.848",
"http_parser/2.9.4#98d91690d6fd021e9e624218a85d9d97%1754325001.385",
"gtest/1.17.0#5224b3b3ff3b4ce1133cbdd27d53ee7d%1768312129.152",
"grpc/1.50.1#02291451d1e17200293a409410d1c4e1%1756234248.958",
"grpc/1.78.1#b1a9e74b145cc471bed4dc64dc6eb2c1%1774467387.342",
"fmt/12.1.0#50abab23274d56bb8f42c94b3b9a40c7%1763984116.926",
"doctest/2.4.11#a4211dfc329a16ba9f280f9574025659%1756234220.819",
"ed25519/2015.03#ae761bdc52730a843f0809bdf6c1b1f6%1765850143.772",
"date/3.0.4#862e11e80030356b53c2c38599ceb32b%1765850143.772",
"cassandra-cpp-driver/2.17.0#bd3934138689482102c265d01288a316%1764175359.611",
"c-ares/1.34.6#545240bb1c40e2cacd4362d6b8967650%1774439234.681",
"bzip2/1.0.8#c470882369c2d95c5c77e970c0c7e321%1765850143.837",
"boost/1.83.0#91d8b1572534d2c334d6790e3c34d0c1%1764175359.61",
"boost/1.91.0#ea540ca2133d831b560036aa24dece3c%1778091165.282",
"benchmark/1.9.5#b885dc73ad67b40a55d45684d1c88ad1%1774363287.434",
"abseil/20230802.1#90ba607d4ee8fb5fb157c3db540671fc%1764175359.429"
"abseil/20250127.0#bb0baf1f362bc4a725a24eddd419b8f7%1774365460.196"
],
"build_requires": [
"zlib/1.3.1#cac0f6daea041b0ccf42934163defb20%1774439233.809",
"protobuf/3.21.12#44ee56c0a6eea0c19aeeaca680370b88%1764175361.456",
"zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb%1778091116.056",
"protobuf/6.33.5#d96d52ba5baaaa532f47bda866ad87a5%1774467363.12",
"cmake/4.3.0#b939a42e98f593fb34d3a8c5cc860359%1774439249.183",
"cmake/3.31.11#f325c933f618a1fcebc1e1c0babfd1ba%1774439246.719",
"b2/5.4.2#ffd6084a119587e70f11cd45d1a386e2%1774439233.447"
"b2/5.4.2#ffd6084a119587e70f11cd45d1a386e2%1774439233.447",
"abseil/20250127.0#bb0baf1f362bc4a725a24eddd419b8f7%1774365460.196"
],
"python_requires": [],
"overrides": {
"protobuf/3.21.12#44ee56c0a6eea0c19aeeaca680370b88": [
null,
"protobuf/3.21.12"
"zlib/[>=1.2.11 <2]": [
"zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb"
],
"boost/1.83.0#91d8b1572534d2c334d6790e3c34d0c1": [
"zlib/1.3.2": [
null,
"boost/1.83.0#91d8b1572534d2c334d6790e3c34d0c1"
"zlib/1.3.2#1cb806da49011867778ffb6ac7190fcb"
],
"boost/1.91.0": [
"boost/1.91.0#ea540ca2133d831b560036aa24dece3c"
],
"protobuf/[>=5.27.0 <7]": [
"protobuf/6.33.5"
],
"lz4/1.9.4": [
"lz4/1.10.0"
],
"boost/[>=1.83.0 <1.91.0]": [
"boost/1.83.0"
"boost/1.91.0"
],
"sqlite3/[>=3.44 <4]": [
"sqlite3/3.49.1"
"sqlite3/3.53.0"
],
"boost/1.83.0": [
"boost/1.91.0"
],
"lz4/[>=1.9.4 <2]": [
"lz4/1.10.0#59fc63cac7f10fbe8e05c7e62c2f3504"
]
},
"config_requires": []

View File

@@ -15,13 +15,9 @@ class ClioConan(ConanFile):
requires = [
"cassandra-cpp-driver/2.17.0",
"fmt/12.1.0",
"grpc/1.50.1",
"libbacktrace/cci.20210118",
"openssl/1.1.1w",
"protobuf/3.21.12",
"spdlog/1.17.0",
"xrpl/3.1.3",
"zlib/1.3.1",
"xrpl/3.2.0",
]
default_options = {
@@ -36,16 +32,28 @@ class ClioConan(ConanFile):
"protobuf/*:shared": False,
"protobuf/*:with_zlib": True,
"snappy/*:shared": False,
"xrpl/*:rocksdb": False,
"xrpl/*:rocksdb": True, # TODO: revert to false when includes are fixed in libxrpl
"xrpl/*:tests": False,
}
exports_sources = ("CMakeLists.txt", "cmake/*", "src/*")
def requirements(self):
self.requires("boost/1.83.0", force=True)
self.requires("gtest/1.17.0")
self.requires("benchmark/1.9.5")
# Clio's own code includes grpc (<grpcpp/...>) and openssl (via
# <boost/asio/ssl>) headers directly, but xrpl does not re-export them
# (only boost/date/xxhash are required with transitive_headers=True).
# So they must be direct requirements of clio to get their include dirs;
# the version pins match xrpl's, so this does not change any package_id.
self.requires("grpc/1.78.1")
self.requires("openssl/3.6.2")
# Pin the remaining transitive deps to the exact versions xrpl uses.
# override=True only sets the version when the package appears
# transitively (it does not make them direct deps), and matches xrpl's
# force=True boost pin that overrides nudb's `boost < 1.91.0` cap.
self.requires("boost/1.91.0", override=True)
self.requires("zlib/1.3.2", override=True)
def configure(self):
if self.settings.compiler == "apple-clang":

View File

@@ -105,7 +105,7 @@ MetricsHandler::operator()(
if (!postSuccessful) {
return web::ng::Response{
boost::beast::http::status::too_many_requests,
rpc::makeError(rpc::RippledError::rpcTOO_BUSY),
rpc::makeError(rpc::RippledError::RpcTooBusy),
request
};
}

View File

@@ -241,7 +241,7 @@ public:
} catch (std::exception const&) {
return web::ng::Response{
boost::beast::http::status::internal_server_error,
rpc::makeError(rpc::RippledError::rpcINTERNAL),
rpc::makeError(rpc::RippledError::RpcInternal),
request
};
}

View File

@@ -40,7 +40,7 @@ supportedAmendments()
bool
lookupAmendment(
auto const& allAmendments,
std::vector<ripple::uint256> const& ledgerAmendments,
std::vector<xrpl::uint256> const& ledgerAmendments,
std::string_view name
)
{
@@ -80,7 +80,7 @@ operator std::string_view() const
}
AmendmentKey::
operator ripple::uint256() const
operator xrpl::uint256() const
{
return Amendment::getAmendmentId(name);
}
@@ -92,14 +92,14 @@ AmendmentCenter::AmendmentCenter(std::shared_ptr<data::BackendInterface> const&
namespace vs = std::views;
rg::copy(
ripple::allAmendments() | vs::transform([&](auto const& p) {
xrpl::allAmendments() | vs::transform([&](auto const& p) {
auto const& [name, support] = p;
return Amendment{
.name = name,
.feature = Amendment::getAmendmentId(name),
.isSupportedByXRPL = support != ripple::AmendmentSupport::Unsupported,
.isSupportedByXRPL = support != xrpl::AmendmentSupport::Unsupported,
.isSupportedByClio = rg::contains(supportedAmendments(), name),
.isRetired = support == ripple::AmendmentSupport::Retired
.isRetired = support == xrpl::AmendmentSupport::Retired
};
}),
std::back_inserter(all_)
@@ -207,26 +207,25 @@ AmendmentCenter::operator[](AmendmentKey const& key) const
return getAmendment(key);
}
ripple::uint256
xrpl::uint256
Amendment::getAmendmentId(std::string_view name)
{
return ripple::sha512Half(ripple::Slice(name.data(), name.size()));
return xrpl::sha512Half(xrpl::Slice(name.data(), name.size()));
}
std::optional<std::vector<ripple::uint256>>
std::optional<std::vector<xrpl::uint256>>
AmendmentCenter::fetchAmendmentsList(boost::asio::yield_context yield, uint32_t seq) const
{
// the amendments should always be present on the ledger
auto const amendments =
backend_->fetchLedgerObject(ripple::keylet::amendments().key, seq, yield);
auto const amendments = backend_->fetchLedgerObject(xrpl::keylet::amendments().key, seq, yield);
if (not amendments.has_value())
throw std::runtime_error("Amendments ledger object must be present in the database");
ripple::SLE const amendmentsSLE{
ripple::SerialIter{amendments->data(), amendments->size()}, ripple::keylet::amendments().key
xrpl::SLE const amendmentsSLE{
xrpl::SerialIter{amendments->data(), amendments->size()}, xrpl::keylet::amendments().key
};
return amendmentsSLE[~ripple::sfAmendments];
return amendmentsSLE[~xrpl::sfAmendments];
}
} // namespace data

View File

@@ -134,6 +134,11 @@ struct Amendments {
REGISTER(fixIncludeKeyletFields);
REGISTER(fixTokenEscrowV1);
REGISTER(LendingProtocol);
REGISTER(MPTokensV2);
REGISTER(PermissionDelegationV1_1);
REGISTER(fixBatchInnerSigs);
REGISTER(fixCleanup3_1_3);
REGISTER(fixCleanup3_2_0);
// Obsolete but supported by libxrpl
REGISTER(CryptoConditionsSuite);
@@ -158,8 +163,6 @@ struct Amendments {
REGISTER(fix1512);
REGISTER(fix1523);
REGISTER(fix1528);
REGISTER(fixBatchInnerSigs);
REGISTER(fixCleanup3_1_3);
// NOLINTEND(readability-identifier-naming)
/** @endcond */
};
@@ -263,7 +266,7 @@ public:
operator[](AmendmentKey const& key) const final;
private:
[[nodiscard]] std::optional<std::vector<ripple::uint256>>
[[nodiscard]] std::optional<std::vector<xrpl::uint256>>
fetchAmendmentsList(boost::asio::yield_context yield, uint32_t seq) const;
};

View File

@@ -45,7 +45,7 @@ BackendInterface::finishWrites(std::uint32_t const ledgerSequence)
void
BackendInterface::writeLedgerObject(std::string&& key, std::uint32_t const seq, std::string&& blob)
{
ASSERT(key.size() == sizeof(ripple::uint256), "Key must be 256 bits");
ASSERT(key.size() == sizeof(xrpl::uint256), "Key must be 256 bits");
doWriteLedgerObject(std::move(key), seq, std::move(blob));
}
@@ -58,14 +58,14 @@ BackendInterface::hardFetchLedgerRangeNoThrow() const
// *** state data methods
std::optional<Blob>
BackendInterface::fetchLedgerObject(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t const sequence,
boost::asio::yield_context yield
) const
{
auto obj = cache_.get().get(key, sequence);
if (obj) {
LOG(log_.trace()) << "Cache hit - " << ripple::strHex(key);
LOG(log_.trace()) << "Cache hit - " << xrpl::strHex(key);
return obj;
}
@@ -80,7 +80,7 @@ BackendInterface::fetchLedgerObject(
std::optional<std::uint32_t>
BackendInterface::fetchLedgerObjectSeq(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t const sequence,
boost::asio::yield_context yield
) const
@@ -93,14 +93,14 @@ BackendInterface::fetchLedgerObjectSeq(
std::vector<Blob>
BackendInterface::fetchLedgerObjects(
std::vector<ripple::uint256> const& keys,
std::vector<xrpl::uint256> const& keys,
std::uint32_t const sequence,
boost::asio::yield_context yield
) const
{
std::vector<Blob> results;
results.resize(keys.size());
std::vector<ripple::uint256> misses;
std::vector<xrpl::uint256> misses;
for (size_t i = 0; i < keys.size(); ++i) {
auto obj = cache_.get().get(keys[i], sequence);
if (obj) {
@@ -126,25 +126,25 @@ BackendInterface::fetchLedgerObjects(
}
// Fetches the successor to key/index
std::optional<ripple::uint256>
std::optional<xrpl::uint256>
BackendInterface::fetchSuccessorKey(
ripple::uint256 key,
xrpl::uint256 key,
std::uint32_t const ledgerSequence,
boost::asio::yield_context yield
) const
{
auto succ = cache_.get().getSuccessor(key, ledgerSequence);
if (succ) {
LOG(log_.trace()) << "Cache hit - " << ripple::strHex(key);
LOG(log_.trace()) << "Cache hit - " << xrpl::strHex(key);
} else {
LOG(log_.trace()) << "Cache miss - " << ripple::strHex(key);
LOG(log_.trace()) << "Cache miss - " << xrpl::strHex(key);
}
return succ ? succ->key : doFetchSuccessorKey(key, ledgerSequence, yield);
}
std::optional<LedgerObject>
BackendInterface::fetchSuccessorObject(
ripple::uint256 key,
xrpl::uint256 key,
std::uint32_t const ledgerSequence,
boost::asio::yield_context yield
) const
@@ -162,7 +162,7 @@ BackendInterface::fetchSuccessorObject(
BookOffersPage
BackendInterface::fetchBookOffers(
ripple::uint256 const& book,
xrpl::uint256 const& book,
std::uint32_t const ledgerSequence,
std::uint32_t const limit,
boost::asio::yield_context yield
@@ -171,9 +171,9 @@ BackendInterface::fetchBookOffers(
// TODO try to speed this up. This can take a few seconds. The goal is
// to get it down to a few hundred milliseconds.
BookOffersPage page;
ripple::uint256 const bookEnd = ripple::getQualityNext(book);
ripple::uint256 uTipIndex = book;
std::vector<ripple::uint256> keys;
xrpl::uint256 const bookEnd = xrpl::getQualityNext(book);
xrpl::uint256 uTipIndex = book;
std::vector<xrpl::uint256> keys;
auto getMillis = [](auto diff) {
return std::chrono::duration_cast<std::chrono::milliseconds>(diff).count();
};
@@ -195,17 +195,17 @@ BackendInterface::fetchBookOffers(
uTipIndex = offerDir->key;
while (keys.size() < limit) {
++numPages;
ripple::STLedgerEntry const sle{
ripple::SerialIter{offerDir->blob.data(), offerDir->blob.size()}, offerDir->key
xrpl::STLedgerEntry const sle{
xrpl::SerialIter{offerDir->blob.data(), offerDir->blob.size()}, offerDir->key
};
auto indexes = sle.getFieldV256(ripple::sfIndexes);
auto indexes = sle.getFieldV256(xrpl::sfIndexes);
keys.insert(keys.end(), indexes.begin(), indexes.end());
auto next = sle.getFieldU64(ripple::sfIndexNext);
auto next = sle.getFieldU64(xrpl::sfIndexNext);
if (next == 0u) {
LOG(log_.trace()) << "Next is empty. breaking";
break;
}
auto nextKey = ripple::keylet::page(uTipIndex, next);
auto nextKey = xrpl::keylet::page(uTipIndex, next);
auto nextDir = fetchLedgerObject(nextKey.key, ledgerSequence, yield);
ASSERT(nextDir.has_value(), "Next dir must exist");
// NOLINTBEGIN(bugprone-unchecked-optional-access)
@@ -219,8 +219,8 @@ BackendInterface::fetchBookOffers(
auto mid = std::chrono::system_clock::now();
auto objs = fetchLedgerObjects(keys, ledgerSequence, yield);
for (size_t i = 0; i < keys.size() && i < limit; ++i) {
LOG(log_.trace()) << "Key = " << ripple::strHex(keys[i])
<< " blob = " << ripple::strHex(objs[i])
LOG(log_.trace()) << "Key = " << xrpl::strHex(keys[i])
<< " blob = " << xrpl::strHex(objs[i])
<< " ledgerSequence = " << ledgerSequence;
ASSERT(!objs[i].empty(), "Ledger object can't be empty");
page.offers.push_back({.key = keys[i], .blob = objs[i]});
@@ -236,7 +236,7 @@ BackendInterface::fetchBookOffers(
<< ". Fetching all objects took " << std::to_string(getMillis(end - mid))
<< " milliseconds. total time = " << std::to_string(getMillis(end - begin))
<< " milliseconds"
<< " book = " << ripple::strHex(book);
<< " book = " << xrpl::strHex(book);
return page;
}
@@ -295,7 +295,7 @@ BackendInterface::setRange(uint32_t min, uint32_t max, bool force)
LedgerPage
BackendInterface::fetchLedgerPage(
std::optional<ripple::uint256> const& cursor,
std::optional<xrpl::uint256> const& cursor,
std::uint32_t const ledgerSequence,
std::uint32_t const limit,
bool outOfOrder,
@@ -304,11 +304,11 @@ BackendInterface::fetchLedgerPage(
{
LedgerPage page;
std::vector<ripple::uint256> keys;
std::vector<xrpl::uint256> keys;
bool reachedEnd = false;
while (keys.size() < limit && !reachedEnd) {
ripple::uint256 const& curCursor = [&]() {
xrpl::uint256 const& curCursor = [&]() {
if (!keys.empty())
return keys.back();
return (cursor ? *cursor : kFirstKey);
@@ -331,10 +331,10 @@ BackendInterface::fetchLedgerPage(
page.objects.push_back({.key = keys[i], .blob = std::move(objects[i])});
} else if (!outOfOrder) {
LOG(log_.error()) << "Deleted or non-existent object in successor table. key = "
<< ripple::strHex(keys[i]) << " - seq = " << ledgerSequence;
<< xrpl::strHex(keys[i]) << " - seq = " << ledgerSequence;
std::stringstream msg;
for (size_t j = 0; j < objects.size(); ++j) {
msg << " - " << ripple::strHex(keys[j]);
msg << " - " << xrpl::strHex(keys[j]);
}
LOG(log_.error()) << msg.str();
@@ -348,12 +348,12 @@ BackendInterface::fetchLedgerPage(
return page;
}
std::optional<ripple::Fees>
std::optional<xrpl::Fees>
BackendInterface::fetchFees(std::uint32_t const seq, boost::asio::yield_context yield) const
{
ripple::Fees fees;
xrpl::Fees fees;
auto key = ripple::keylet::fees().key;
auto key = xrpl::keylet::fees().key;
auto bytes = fetchLedgerObject(key, seq, yield);
if (!bytes) {
@@ -361,17 +361,17 @@ BackendInterface::fetchFees(std::uint32_t const seq, boost::asio::yield_context
return {};
}
ripple::SerialIter it(bytes->data(), bytes->size());
ripple::SLE const sle{it, key};
xrpl::SerialIter it(bytes->data(), bytes->size());
xrpl::SLE const sle{it, key};
// XRPFees amendment introduced new fields for fees calculations.
// New fields are set and the old fields are removed via `set_fees` tx.
// Fallback to old fields if `set_fees` was not yet used to update the fields on this tx.
auto hasNewFields = false;
{
auto const baseFeeXRP = sle.at(~ripple::sfBaseFeeDrops);
auto const reserveBaseXRP = sle.at(~ripple::sfReserveBaseDrops);
auto const reserveIncrementXRP = sle.at(~ripple::sfReserveIncrementDrops);
auto const baseFeeXRP = sle.at(~xrpl::sfBaseFeeDrops);
auto const reserveBaseXRP = sle.at(~xrpl::sfReserveBaseDrops);
auto const reserveIncrementXRP = sle.at(~xrpl::sfReserveIncrementDrops);
if (baseFeeXRP)
fees.base = baseFeeXRP->xrp();
@@ -387,9 +387,9 @@ BackendInterface::fetchFees(std::uint32_t const seq, boost::asio::yield_context
if (not hasNewFields) {
// Fallback to old fields
auto const baseFee = sle.at(~ripple::sfBaseFee);
auto const reserveBase = sle.at(~ripple::sfReserveBase);
auto const reserveIncrement = sle.at(~ripple::sfReserveIncrement);
auto const baseFee = sle.at(~xrpl::sfBaseFee);
auto const reserveBase = sle.at(~xrpl::sfReserveBase);
auto const reserveIncrement = sle.at(~xrpl::sfReserveIncrement);
if (baseFee)
fees.base = baseFee.value();

View File

@@ -178,9 +178,9 @@ public:
*
* @param sequence The sequence number to fetch for
* @param yield The coroutine context
* @return The ripple::LedgerHeader if found; nullopt otherwise
* @return The xrpl::LedgerHeader if found; nullopt otherwise
*/
virtual std::optional<ripple::LedgerHeader>
virtual std::optional<xrpl::LedgerHeader>
fetchLedgerBySequence(std::uint32_t sequence, boost::asio::yield_context yield) const = 0;
/**
@@ -188,10 +188,10 @@ public:
*
* @param hash The hash to fetch for
* @param yield The coroutine context
* @return The ripple::LedgerHeader if found; nullopt otherwise
* @return The xrpl::LedgerHeader if found; nullopt otherwise
*/
virtual std::optional<ripple::LedgerHeader>
fetchLedgerByHash(ripple::uint256 const& hash, boost::asio::yield_context yield) const = 0;
virtual std::optional<xrpl::LedgerHeader>
fetchLedgerByHash(xrpl::uint256 const& hash, boost::asio::yield_context yield) const = 0;
/**
* @brief Fetches the latest ledger sequence.
@@ -218,9 +218,9 @@ public:
* @param pageSize The maximum number of accounts per page
* @param seq The accounts need to exist for this sequence
* @param yield The coroutine context
* @return A vector of ripple::uint256 representing the account roots
* @return A vector of xrpl::uint256 representing the account roots
*/
virtual std::vector<ripple::uint256>
virtual std::vector<xrpl::uint256>
fetchAccountRoots(
std::uint32_t number,
std::uint32_t pageSize,
@@ -262,7 +262,7 @@ public:
* @param yield The coroutine context
* @return Fees if fees are found; nullopt otherwise
*/
std::optional<ripple::Fees>
std::optional<xrpl::Fees>
fetchFees(std::uint32_t seq, boost::asio::yield_context yield) const;
/**
@@ -273,7 +273,7 @@ public:
* @return TransactionAndMetadata if transaction is found; nullopt otherwise
*/
virtual std::optional<TransactionAndMetadata>
fetchTransaction(ripple::uint256 const& hash, boost::asio::yield_context yield) const = 0;
fetchTransaction(xrpl::uint256 const& hash, boost::asio::yield_context yield) const = 0;
/**
* @brief Fetches multiple transactions.
@@ -284,7 +284,7 @@ public:
*/
virtual std::vector<TransactionAndMetadata>
fetchTransactions(
std::vector<ripple::uint256> const& hashes,
std::vector<xrpl::uint256> const& hashes,
boost::asio::yield_context yield
) const = 0;
@@ -300,7 +300,7 @@ public:
*/
virtual TransactionsAndCursor
fetchAccountTransactions(
ripple::AccountID const& account,
xrpl::AccountID const& account,
std::uint32_t limit,
bool forward,
std::optional<TransactionsCursor> const& txnCursor,
@@ -325,9 +325,9 @@ public:
*
* @param ledgerSequence The ledger sequence to fetch for
* @param yield The coroutine context
* @return Hashes as ripple::uint256 in a vector
* @return Hashes as xrpl::uint256 in a vector
*/
virtual std::vector<ripple::uint256>
virtual std::vector<xrpl::uint256>
fetchAllTransactionHashesInLedger(
std::uint32_t ledgerSequence,
boost::asio::yield_context yield
@@ -343,7 +343,7 @@ public:
*/
virtual std::optional<NFT>
fetchNFT(
ripple::uint256 const& tokenID,
xrpl::uint256 const& tokenID,
std::uint32_t ledgerSequence,
boost::asio::yield_context yield
) const = 0;
@@ -360,7 +360,7 @@ public:
*/
virtual TransactionsAndCursor
fetchNFTTransactions(
ripple::uint256 const& tokenID,
xrpl::uint256 const& tokenID,
std::uint32_t limit,
bool forward,
std::optional<TransactionsCursor> const& cursorIn,
@@ -381,11 +381,11 @@ public:
*/
virtual NFTsAndCursor
fetchNFTsByIssuer(
ripple::AccountID const& issuer,
xrpl::AccountID const& issuer,
std::optional<std::uint32_t> const& taxon,
std::uint32_t ledgerSequence,
std::uint32_t limit,
std::optional<ripple::uint256> const& cursorIn,
std::optional<xrpl::uint256> const& cursorIn,
boost::asio::yield_context yield
) const = 0;
@@ -401,9 +401,9 @@ public:
*/
virtual MPTHoldersAndCursor
fetchMPTHolders(
ripple::uint192 const& mptID,
xrpl::uint192 const& mptID,
std::uint32_t const limit,
std::optional<ripple::AccountID> const& cursorIn,
std::optional<xrpl::AccountID> const& cursorIn,
std::uint32_t const ledgerSequence,
boost::asio::yield_context yield
) const = 0;
@@ -426,7 +426,7 @@ public:
*/
virtual TransactionsAndCursor
fetchMPTokenIssuanceTransactions(
ripple::uint192 const& mptIssuanceID,
xrpl::uint192 const& mptIssuanceID,
std::uint32_t limit,
bool forward,
std::optional<TransactionsCursor> const& cursorIn,
@@ -454,8 +454,8 @@ public:
*/
virtual TransactionsAndCursor
fetchAccountMPTokenIssuanceTransactions(
ripple::uint192 const& mptIssuanceID,
ripple::AccountID const& account,
xrpl::uint192 const& mptIssuanceID,
xrpl::AccountID const& account,
std::uint32_t limit,
bool forward,
std::optional<TransactionsCursor> const& cursorIn,
@@ -475,7 +475,7 @@ public:
*/
std::optional<Blob>
fetchLedgerObject(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t sequence,
boost::asio::yield_context yield
) const;
@@ -492,7 +492,7 @@ public:
*/
std::optional<std::uint32_t>
fetchLedgerObjectSeq(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t sequence,
boost::asio::yield_context yield
) const;
@@ -511,7 +511,7 @@ public:
*/
std::vector<Blob>
fetchLedgerObjects(
std::vector<ripple::uint256> const& keys,
std::vector<xrpl::uint256> const& keys,
std::uint32_t sequence,
boost::asio::yield_context yield
) const;
@@ -526,7 +526,7 @@ public:
*/
virtual std::optional<Blob>
doFetchLedgerObject(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t sequence,
boost::asio::yield_context yield
) const = 0;
@@ -541,7 +541,7 @@ public:
*/
virtual std::optional<std::uint32_t>
doFetchLedgerObjectSeq(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t sequence,
boost::asio::yield_context yield
) const = 0;
@@ -556,7 +556,7 @@ public:
*/
virtual std::vector<Blob>
doFetchLedgerObjects(
std::vector<ripple::uint256> const& keys,
std::vector<xrpl::uint256> const& keys,
std::uint32_t sequence,
boost::asio::yield_context yield
) const = 0;
@@ -583,7 +583,7 @@ public:
*/
LedgerPage
fetchLedgerPage(
std::optional<ripple::uint256> const& cursor,
std::optional<xrpl::uint256> const& cursor,
std::uint32_t ledgerSequence,
std::uint32_t limit,
bool outOfOrder,
@@ -600,7 +600,7 @@ public:
*/
std::optional<LedgerObject>
fetchSuccessorObject(
ripple::uint256 key,
xrpl::uint256 key,
std::uint32_t ledgerSequence,
boost::asio::yield_context yield
) const;
@@ -617,9 +617,9 @@ public:
* @param yield The coroutine context
* @return The successor key on success; nullopt otherwise
*/
std::optional<ripple::uint256>
std::optional<xrpl::uint256>
fetchSuccessorKey(
ripple::uint256 key,
xrpl::uint256 key,
std::uint32_t ledgerSequence,
boost::asio::yield_context yield
) const;
@@ -632,9 +632,9 @@ public:
* @param yield The coroutine context
* @return The successor on success; nullopt otherwise
*/
virtual std::optional<ripple::uint256>
virtual std::optional<xrpl::uint256>
doFetchSuccessorKey(
ripple::uint256 key,
xrpl::uint256 key,
std::uint32_t ledgerSequence,
boost::asio::yield_context yield
) const = 0;
@@ -650,7 +650,7 @@ public:
*/
BookOffersPage
fetchBookOffers(
ripple::uint256 const& book,
xrpl::uint256 const& book,
std::uint32_t ledgerSequence,
std::uint32_t limit,
boost::asio::yield_context yield
@@ -717,7 +717,7 @@ public:
* @param blob r-value string serialization of ledger header.
*/
virtual void
writeLedger(ripple::LedgerHeader const& ledgerHeader, std::string&& blob) = 0;
writeLedger(xrpl::LedgerHeader const& ledgerHeader, std::string&& blob) = 0;
/**
* @brief Writes a new ledger object.

View File

@@ -101,11 +101,11 @@ public:
[[nodiscard]] NFTsAndCursor
fetchNFTsByIssuer(
ripple::AccountID const& issuer,
xrpl::AccountID const& issuer,
std::optional<std::uint32_t> const& taxon,
std::uint32_t const ledgerSequence,
std::uint32_t const limit,
std::optional<ripple::uint256> const& cursorIn,
std::optional<xrpl::uint256> const& cursorIn,
boost::asio::yield_context yield
) const override
{
@@ -115,7 +115,7 @@ public:
if (taxon.has_value()) {
auto r = schema_->selectNFTIDsByIssuerTaxon.bind(issuer);
r.bindAt(1, *taxon);
r.bindAt(2, cursorIn.value_or(ripple::uint256(0)));
r.bindAt(2, cursorIn.value_or(xrpl::uint256(0)));
r.bindAt(3, Limit{limit});
return r;
}
@@ -124,9 +124,8 @@ public:
r.bindAt(
1,
std::make_tuple(
cursorIn.has_value() ? ripple::nft::toUInt32(ripple::nft::getTaxon(*cursorIn))
: 0,
cursorIn.value_or(ripple::uint256(0))
cursorIn.has_value() ? xrpl::nft::toUInt32(xrpl::nft::getTaxon(*cursorIn)) : 0,
cursorIn.value_or(xrpl::uint256(0))
)
);
r.bindAt(2, Limit{limit});
@@ -142,8 +141,8 @@ public:
return {};
}
std::vector<ripple::uint256> nftIDs;
for (auto const [nftID] : extract<ripple::uint256>(idQueryResults))
std::vector<xrpl::uint256> nftIDs;
for (auto const [nftID] : extract<xrpl::uint256>(idQueryResults))
nftIDs.push_back(nftID);
if (nftIDs.empty())
@@ -177,11 +176,11 @@ public:
auto const nftUris = executor_.readEach(yield, selectNFTURIStatements);
for (auto i = 0u; i < nftIDs.size(); i++) {
if (auto const maybeRow = nftInfos[i].template get<uint32_t, ripple::AccountID, bool>();
if (auto const maybeRow = nftInfos[i].template get<uint32_t, xrpl::AccountID, bool>();
maybeRow.has_value()) {
auto [seq, owner, isBurned] = *maybeRow;
NFT nft(nftIDs[i], seq, owner, isBurned);
if (auto const maybeUri = nftUris[i].template get<ripple::Blob>();
if (auto const maybeUri = nftUris[i].template get<xrpl::Blob>();
maybeUri.has_value())
nft.uri = *maybeUri;
ret.nfts.push_back(nft);
@@ -190,7 +189,7 @@ public:
return ret;
}
[[nodiscard]] std::vector<ripple::uint256>
[[nodiscard]] std::vector<xrpl::uint256>
fetchAccountRoots(
std::uint32_t number,
std::uint32_t pageSize,
@@ -198,8 +197,8 @@ public:
boost::asio::yield_context yield
) const override
{
std::vector<ripple::uint256> liveAccounts;
std::optional<ripple::AccountID> lastItem;
std::vector<xrpl::uint256> liveAccounts;
std::optional<xrpl::AccountID> lastItem;
while (liveAccounts.size() < number) {
Statement const statement = lastItem
@@ -214,9 +213,9 @@ public:
break;
}
// The results should not contain duplicates, we just filter out deleted accounts
std::vector<ripple::uint256> fullAccounts;
for (auto [account] : extract<ripple::AccountID>(results)) {
fullAccounts.push_back(ripple::keylet::account(account).key);
std::vector<xrpl::uint256> fullAccounts;
for (auto [account] : extract<xrpl::AccountID>(results)) {
fullAccounts.push_back(xrpl::keylet::account(account).key);
lastItem = account;
}
auto const objs = this->doFetchLedgerObjects(fullAccounts, seq, yield);

View File

@@ -24,10 +24,10 @@
* @brief Struct used to keep track of what to write to account_transactions/account_tx tables.
*/
struct AccountTransactionsData {
boost::container::flat_set<ripple::AccountID> accounts;
boost::container::flat_set<xrpl::AccountID> accounts;
std::uint32_t ledgerSequence{};
std::uint32_t transactionIndex{};
ripple::uint256 txHash;
xrpl::uint256 txHash;
/**
* @brief Construct a new AccountTransactionsData object
@@ -35,7 +35,7 @@ struct AccountTransactionsData {
* @param meta The transaction metadata
* @param txHash The transaction hash
*/
AccountTransactionsData(ripple::TxMeta const& meta, ripple::uint256 const& txHash)
AccountTransactionsData(xrpl::TxMeta const& meta, xrpl::uint256 const& txHash)
: accounts(meta.getAffectedAccounts())
, ledgerSequence(meta.getLgrSeq())
, transactionIndex(meta.getIndex())
@@ -52,10 +52,10 @@ struct AccountTransactionsData {
* Gets written to nf_token_transactions table and the like.
*/
struct NFTTransactionsData {
ripple::uint256 tokenID;
xrpl::uint256 tokenID;
std::uint32_t ledgerSequence;
std::uint32_t transactionIndex;
ripple::uint256 txHash;
xrpl::uint256 txHash;
/**
* @brief Construct a new NFTTransactionsData object
@@ -65,9 +65,9 @@ struct NFTTransactionsData {
* @param txHash The transaction hash
*/
NFTTransactionsData(
ripple::uint256 const& tokenID,
ripple::TxMeta const& meta,
ripple::uint256 const& txHash
xrpl::uint256 const& tokenID,
xrpl::TxMeta const& meta,
xrpl::uint256 const& txHash
)
: tokenID(tokenID)
, ledgerSequence(meta.getLgrSeq())
@@ -91,11 +91,11 @@ struct NFTTransactionsData {
* objects.
*/
struct NFTsData {
ripple::uint256 tokenID;
xrpl::uint256 tokenID;
std::uint32_t ledgerSequence;
std::optional<std::uint32_t> transactionIndex;
ripple::AccountID owner;
std::optional<ripple::Blob> uri;
xrpl::AccountID owner;
std::optional<xrpl::Blob> uri;
bool isBurned = false;
bool onlyUriChanged = false; // Whether only the URI was changed
@@ -113,10 +113,10 @@ struct NFTsData {
* @param meta The transaction metadata
*/
NFTsData(
ripple::uint256 const& tokenID,
ripple::AccountID const& owner,
ripple::Blob const& uri,
ripple::TxMeta const& meta
xrpl::uint256 const& tokenID,
xrpl::AccountID const& owner,
xrpl::Blob const& uri,
xrpl::TxMeta const& meta
)
: tokenID(tokenID)
, ledgerSequence(meta.getLgrSeq())
@@ -137,9 +137,9 @@ struct NFTsData {
* @param isBurned Whether the NFT is burned
*/
NFTsData(
ripple::uint256 const& tokenID,
ripple::AccountID const& owner,
ripple::TxMeta const& meta,
xrpl::uint256 const& tokenID,
xrpl::AccountID const& owner,
xrpl::TxMeta const& meta,
bool isBurned
)
: tokenID(tokenID)
@@ -164,10 +164,10 @@ struct NFTsData {
* @param uri The URI
*/
NFTsData(
ripple::uint256 const& tokenID,
xrpl::uint256 const& tokenID,
std::uint32_t const ledgerSequence,
ripple::AccountID const& owner,
ripple::Blob const& uri
xrpl::AccountID const& owner,
xrpl::Blob const& uri
)
: tokenID(tokenID), ledgerSequence(ledgerSequence), owner(owner), uri(uri)
{
@@ -181,7 +181,7 @@ struct NFTsData {
* @param uri The new URI
*
*/
NFTsData(ripple::uint256 const& tokenID, ripple::TxMeta const& meta, ripple::Blob const& uri)
NFTsData(xrpl::uint256 const& tokenID, xrpl::TxMeta const& meta, xrpl::Blob const& uri)
: tokenID(tokenID)
, ledgerSequence(meta.getLgrSeq())
, transactionIndex(meta.getIndex())
@@ -195,8 +195,8 @@ struct NFTsData {
* @brief Represents an MPT and holder pair
*/
struct MPTHolderData {
ripple::uint192 mptID;
ripple::AccountID holder;
xrpl::uint192 mptID;
xrpl::AccountID holder;
};
/**
@@ -206,11 +206,11 @@ struct MPTHolderData {
* mptoken_issuance_transactions and account_mptoken_issuance_transactions.
*/
struct MPTokenIssuanceTransactionsData {
ripple::uint192 mptIssuanceID;
boost::container::flat_set<ripple::AccountID> accounts;
xrpl::uint192 mptIssuanceID;
boost::container::flat_set<xrpl::AccountID> accounts;
std::uint32_t ledgerSequence{};
std::uint32_t transactionIndex{};
ripple::uint256 txHash;
xrpl::uint256 txHash;
};
/**
@@ -246,25 +246,25 @@ isBookDir(T const& key, R const& object)
if (!isDirNode(object))
return false;
ripple::STLedgerEntry const sle{ripple::SerialIter{object.data(), object.size()}, key};
return !sle[~ripple::sfOwner].has_value();
xrpl::STLedgerEntry const sle{xrpl::SerialIter{object.data(), object.size()}, key};
return !sle[~xrpl::sfOwner].has_value();
}
/**
* @brief Get the book base.
*
* @param key The key to get the book base out of
* @return Book base as ripple::uint256
* @return Book base as xrpl::uint256
*/
template <typename T>
inline ripple::uint256
inline xrpl::uint256
getBookBase(T const& key)
{
static constexpr size_t kEySize = 24;
ASSERT(key.size() == ripple::uint256::size(), "Invalid key size {}", key.size());
ASSERT(key.size() == xrpl::uint256::size(), "Invalid key size {}", key.size());
ripple::uint256 ret;
xrpl::uint256 ret;
for (size_t i = 0; i < kEySize; ++i)
ret.data()[i] = key.data()[i];
@@ -272,15 +272,15 @@ getBookBase(T const& key)
}
/**
* @brief Stringify a ripple::uint256.
* @brief Stringify a xrpl::uint256.
*
* @param input The input value
* @return The input value as a string
*/
inline std::string
uint256ToString(ripple::uint256 const& input)
uint256ToString(xrpl::uint256 const& input)
{
return {reinterpret_cast<char const*>(input.data()), ripple::uint256::size()};
return {reinterpret_cast<char const*>(input.data()), xrpl::uint256::size()};
}
/** @brief The ripple epoch start timestamp. Midnight on 1st January 2000. */

View File

@@ -104,23 +104,23 @@ public:
[[nodiscard]] NFTsAndCursor
fetchNFTsByIssuer(
ripple::AccountID const& issuer,
xrpl::AccountID const& issuer,
std::optional<std::uint32_t> const& taxon,
std::uint32_t const ledgerSequence,
std::uint32_t const limit,
std::optional<ripple::uint256> const& cursorIn,
std::optional<xrpl::uint256> const& cursorIn,
boost::asio::yield_context yield
) const override
{
std::vector<ripple::uint256> nftIDs;
std::vector<xrpl::uint256> nftIDs;
if (taxon.has_value()) {
// Keyspace and ScyllaDB uses the same logic for taxon-filtered queries
nftIDs = fetchNFTIDsByTaxon(issuer, *taxon, limit, cursorIn, yield);
} else {
// Amazon Keyspaces Workflow for non-taxon queries
auto const startTaxon =
cursorIn.has_value() ? ripple::nft::toUInt32(ripple::nft::getTaxon(*cursorIn)) : 0;
auto const startTokenID = cursorIn.value_or(ripple::uint256(0));
cursorIn.has_value() ? xrpl::nft::toUInt32(xrpl::nft::getTaxon(*cursorIn)) : 0;
auto const startTokenID = cursorIn.value_or(xrpl::uint256(0));
Statement const firstQuery = schema_->selectNFTIDsByIssuerTaxon.bind(issuer);
firstQuery.bindAt(1, startTaxon);
@@ -129,7 +129,7 @@ public:
auto const firstRes = executor_.read(yield, firstQuery);
if (firstRes.has_value()) {
for (auto const [nftID] : extract<ripple::uint256>(*firstRes))
for (auto const [nftID] : extract<xrpl::uint256>(*firstRes))
nftIDs.push_back(nftID);
}
@@ -141,7 +141,7 @@ public:
auto const secondRes = executor_.read(yield, secondQuery);
if (secondRes.has_value()) {
for (auto const [nftID] : extract<ripple::uint256>(*secondRes))
for (auto const [nftID] : extract<xrpl::uint256>(*secondRes))
nftIDs.push_back(nftID);
}
}
@@ -160,9 +160,9 @@ public:
* @param pageSize The maximum number of accounts per page.
* @param seq The accounts need to exist at this ledger sequence.
* @param yield The coroutine context.
* @return A vector of ripple::uint256 representing the account root hashes.
* @return A vector of xrpl::uint256 representing the account root hashes.
*/
[[nodiscard]] std::vector<ripple::uint256>
[[nodiscard]] std::vector<xrpl::uint256>
fetchAccountRoots(
[[maybe_unused]] std::uint32_t number,
[[maybe_unused]] std::uint32_t pageSize,
@@ -175,42 +175,42 @@ public:
}
private:
[[nodiscard]] std::vector<ripple::uint256>
[[nodiscard]] std::vector<xrpl::uint256>
fetchNFTIDsByTaxon(
ripple::AccountID const& issuer,
xrpl::AccountID const& issuer,
std::uint32_t const taxon,
std::uint32_t const limit,
std::optional<ripple::uint256> const& cursorIn,
std::optional<xrpl::uint256> const& cursorIn,
boost::asio::yield_context yield
) const
{
std::vector<ripple::uint256> nftIDs;
std::vector<xrpl::uint256> nftIDs;
Statement const statement = schema_->selectNFTIDsByIssuerTaxon.bind(issuer);
statement.bindAt(1, taxon);
statement.bindAt(2, cursorIn.value_or(ripple::uint256(0)));
statement.bindAt(2, cursorIn.value_or(xrpl::uint256(0)));
statement.bindAt(3, Limit{limit});
auto const res = executor_.read(yield, statement);
if (res.has_value() && res->hasRows()) {
for (auto const [nftID] : extract<ripple::uint256>(*res))
for (auto const [nftID] : extract<xrpl::uint256>(*res))
nftIDs.push_back(nftID);
}
return nftIDs;
}
[[nodiscard]] std::vector<ripple::uint256>
[[nodiscard]] std::vector<xrpl::uint256>
fetchNFTIDsWithoutTaxon(
ripple::AccountID const& issuer,
xrpl::AccountID const& issuer,
std::uint32_t const limit,
std::optional<ripple::uint256> const& cursorIn,
std::optional<xrpl::uint256> const& cursorIn,
boost::asio::yield_context yield
) const
{
std::vector<ripple::uint256> nftIDs;
std::vector<xrpl::uint256> nftIDs;
auto const startTaxon =
cursorIn.has_value() ? ripple::nft::toUInt32(ripple::nft::getTaxon(*cursorIn)) : 0;
auto const startTokenID = cursorIn.value_or(ripple::uint256(0));
cursorIn.has_value() ? xrpl::nft::toUInt32(xrpl::nft::getTaxon(*cursorIn)) : 0;
auto const startTokenID = cursorIn.value_or(xrpl::uint256(0));
Statement firstQuery = schema_->selectNFTIDsByIssuerTaxon.bind(issuer);
firstQuery.bindAt(1, startTaxon);
@@ -219,7 +219,7 @@ private:
auto const firstRes = executor_.read(yield, firstQuery);
if (firstRes.has_value()) {
for (auto const [nftID] : extract<ripple::uint256>(*firstRes))
for (auto const [nftID] : extract<xrpl::uint256>(*firstRes))
nftIDs.push_back(nftID);
}
@@ -231,7 +231,7 @@ private:
auto const secondRes = executor_.read(yield, secondQuery);
if (secondRes.has_value()) {
for (auto const [nftID] : extract<ripple::uint256>(*secondRes))
for (auto const [nftID] : extract<xrpl::uint256>(*secondRes))
nftIDs.push_back(nftID);
}
}
@@ -244,7 +244,7 @@ private:
*/
[[nodiscard]] NFTsAndCursor
populateNFTsAndCreateCursor(
std::vector<ripple::uint256> const& nftIDs,
std::vector<xrpl::uint256> const& nftIDs,
std::uint32_t const ledgerSequence,
std::uint32_t const limit,
boost::asio::yield_context yield
@@ -283,11 +283,11 @@ private:
// Combine the results into final NFT objects.
for (auto i = 0u; i < nftIDs.size(); ++i) {
if (auto const maybeRow = nftInfos[i].template get<uint32_t, ripple::AccountID, bool>();
if (auto const maybeRow = nftInfos[i].template get<uint32_t, xrpl::AccountID, bool>();
maybeRow.has_value()) {
auto [seq, owner, isBurned] = *maybeRow;
NFT nft(nftIDs[i], seq, owner, isBurned);
if (auto const maybeUri = nftUris[i].template get<ripple::Blob>();
if (auto const maybeUri = nftUris[i].template get<xrpl::Blob>();
maybeUri.has_value())
nft.uri = *maybeUri;
ret.nfts.push_back(nft);

View File

@@ -112,7 +112,7 @@ LedgerCache::update(std::vector<etl::model::Object> const& objs, uint32_t seq)
}
std::optional<LedgerObject>
LedgerCache::getSuccessor(ripple::uint256 const& key, uint32_t seq) const
LedgerCache::getSuccessor(xrpl::uint256 const& key, uint32_t seq) const
{
if (disabled_ or not full_)
return {};
@@ -129,7 +129,7 @@ LedgerCache::getSuccessor(ripple::uint256 const& key, uint32_t seq) const
}
std::optional<LedgerObject>
LedgerCache::getPredecessor(ripple::uint256 const& key, uint32_t seq) const
LedgerCache::getPredecessor(xrpl::uint256 const& key, uint32_t seq) const
{
if (disabled_ or not full_)
return {};
@@ -145,7 +145,7 @@ LedgerCache::getPredecessor(ripple::uint256 const& key, uint32_t seq) const
}
std::optional<Blob>
LedgerCache::get(ripple::uint256 const& key, uint32_t seq) const
LedgerCache::get(xrpl::uint256 const& key, uint32_t seq) const
{
if (disabled_)
return {};
@@ -164,7 +164,7 @@ LedgerCache::get(ripple::uint256 const& key, uint32_t seq) const
}
std::optional<Blob>
LedgerCache::getDeleted(ripple::uint256 const& key, uint32_t seq) const
LedgerCache::getDeleted(xrpl::uint256 const& key, uint32_t seq) const
{
if (disabled_)
return std::nullopt;

View File

@@ -35,7 +35,7 @@ public:
Blob blob;
};
using CacheMap = std::map<ripple::uint256, CacheEntry>;
using CacheMap = std::map<xrpl::uint256, CacheEntry>;
private:
// counters for fetchLedgerObject(s) hit rate
@@ -95,7 +95,7 @@ private:
// temporary set to prevent background thread from writing already deleted data. not used when
// cache is full
std::unordered_set<ripple::uint256, ripple::hardened_hash<>> deletes_;
std::unordered_set<xrpl::uint256, xrpl::HardenedHash<>> deletes_;
public:
void
@@ -105,16 +105,16 @@ public:
update(std::vector<etl::model::Object> const& objs, uint32_t seq) override;
std::optional<Blob>
get(ripple::uint256 const& key, uint32_t seq) const override;
get(xrpl::uint256 const& key, uint32_t seq) const override;
std::optional<Blob>
getDeleted(ripple::uint256 const& key, uint32_t seq) const override;
getDeleted(xrpl::uint256 const& key, uint32_t seq) const override;
std::optional<LedgerObject>
getSuccessor(ripple::uint256 const& key, uint32_t seq) const override;
getSuccessor(xrpl::uint256 const& key, uint32_t seq) const override;
std::optional<LedgerObject>
getPredecessor(ripple::uint256 const& key, uint32_t seq) const override;
getPredecessor(xrpl::uint256 const& key, uint32_t seq) const override;
void
setDisabled() override;

View File

@@ -56,7 +56,7 @@ public:
* @return If found in cache, will return the cached Blob; otherwise nullopt is returned
*/
[[nodiscard]] virtual std::optional<Blob>
get(ripple::uint256 const& key, uint32_t seq) const = 0;
get(xrpl::uint256 const& key, uint32_t seq) const = 0;
/**
* @brief Fetch a recently deleted object by its key and sequence number.
@@ -66,7 +66,7 @@ public:
* @return If found in deleted cache, will return the cached Blob; otherwise nullopt is returned
*/
[[nodiscard]] virtual std::optional<Blob>
getDeleted(ripple::uint256 const& key, uint32_t seq) const = 0;
getDeleted(xrpl::uint256 const& key, uint32_t seq) const = 0;
/**
* @brief Gets a cached successor.
@@ -78,7 +78,7 @@ public:
* @return If found in cache, will return the cached successor; otherwise nullopt is returned
*/
[[nodiscard]] virtual std::optional<LedgerObject>
getSuccessor(ripple::uint256 const& key, uint32_t seq) const = 0;
getSuccessor(xrpl::uint256 const& key, uint32_t seq) const = 0;
/**
* @brief Gets a cached predcessor.
@@ -90,7 +90,7 @@ public:
* @return If found in cache, will return the cached predcessor; otherwise nullopt is returned
*/
[[nodiscard]] virtual std::optional<LedgerObject>
getPredecessor(ripple::uint256 const& key, uint32_t seq) const = 0;
getPredecessor(xrpl::uint256 const& key, uint32_t seq) const = 0;
/**
* @brief Disables the cache.

View File

@@ -11,7 +11,7 @@
namespace data {
/**
* @brief A simple cache holding one `ripple::LedgerHeader` to reduce DB lookups.
* @brief A simple cache holding one `xrpl::LedgerHeader` to reduce DB lookups.
*
* Used internally by backend implementations. When a ledger header is
* fetched via `FetchLedgerBySeq` (often triggered by RPC commands),
@@ -27,7 +27,7 @@ public:
* @brief Struct to store ledger header cache entry and the sequence it belongs to
*/
struct CacheEntry {
ripple::LedgerHeader ledger;
xrpl::LedgerHeader ledger;
uint32_t seq{};
/**

View File

@@ -20,7 +20,7 @@ using Blob = std::vector<unsigned char>;
* @brief Represents an object in the ledger.
*/
struct LedgerObject {
ripple::uint256 key;
xrpl::uint256 key;
Blob blob;
bool
@@ -32,7 +32,7 @@ struct LedgerObject {
*/
struct LedgerPage {
std::vector<LedgerObject> objects;
std::optional<ripple::uint256> cursor;
std::optional<xrpl::uint256> cursor;
};
/**
@@ -40,7 +40,7 @@ struct LedgerPage {
*/
struct BookOffersPage {
std::vector<LedgerObject> offers;
std::optional<ripple::uint256> cursor;
std::optional<xrpl::uint256> cursor;
};
/**
@@ -159,9 +159,9 @@ struct TransactionsAndCursor {
* @brief Represents a NFToken.
*/
struct NFT {
ripple::uint256 tokenID;
xrpl::uint256 tokenID;
std::uint32_t ledgerSequence{};
ripple::AccountID owner;
xrpl::AccountID owner;
Blob uri;
bool isBurned{};
@@ -176,9 +176,9 @@ struct NFT {
* @param uri The URI
* @param isBurned Whether the token is burned
*/
NFT(ripple::uint256 const& tokenID,
NFT(xrpl::uint256 const& tokenID,
std::uint32_t ledgerSequence,
ripple::AccountID const& owner,
xrpl::AccountID const& owner,
Blob uri,
bool isBurned)
: tokenID{tokenID}
@@ -197,9 +197,9 @@ struct NFT {
* @param owner The owner
* @param isBurned Whether the token is burned
*/
NFT(ripple::uint256 const& tokenID,
NFT(xrpl::uint256 const& tokenID,
std::uint32_t ledgerSequence,
ripple::AccountID const& owner,
xrpl::AccountID const& owner,
bool isBurned)
: NFT(tokenID, ledgerSequence, owner, {}, isBurned)
{
@@ -226,7 +226,7 @@ struct NFT {
*/
struct NFTsAndCursor {
std::vector<NFT> nfts;
std::optional<ripple::uint256> cursor;
std::optional<xrpl::uint256> cursor;
};
/**
@@ -234,7 +234,7 @@ struct NFTsAndCursor {
*/
struct MPTHoldersAndCursor {
std::vector<Blob> mptokens;
std::optional<ripple::AccountID> cursor;
std::optional<xrpl::AccountID> cursor;
};
/**
@@ -253,7 +253,7 @@ struct LedgerRange {
*/
struct Amendment {
std::string name;
ripple::uint256 feature;
xrpl::uint256 feature;
bool isSupportedByXRPL = false;
bool isSupportedByClio = false;
bool isRetired = false;
@@ -264,7 +264,7 @@ struct Amendment {
* @param name The name of the amendment
* @return The amendment Id as uint256
*/
static ripple::uint256
static xrpl::uint256
getAmendmentId(std::string_view const name);
/**
@@ -301,7 +301,7 @@ struct AmendmentKey {
operator std::string_view() const;
/** @brief Conversion to uint256 */
operator ripple::uint256() const;
operator xrpl::uint256() const;
/**
* @brief Comparison operators
@@ -312,14 +312,12 @@ struct AmendmentKey {
operator<=>(AmendmentKey const& other) const = default;
};
constexpr ripple::uint256 kFirstKey{
constexpr xrpl::uint256 kFirstKey{
"0000000000000000000000000000000000000000000000000000000000000000"
};
constexpr ripple::uint256 kLastKey{
constexpr xrpl::uint256 kLastKey{
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
};
constexpr ripple::uint256 kHi192{
"0000000000000000000000000000000000000000000000001111111111111111"
};
constexpr xrpl::uint256 kHi192{"0000000000000000000000000000000000000000000000001111111111111111"};
} // namespace data

View File

@@ -141,7 +141,7 @@ public:
TransactionsAndCursor
fetchAccountTransactions(
ripple::AccountID const& account,
xrpl::AccountID const& account,
std::uint32_t const limit,
bool forward,
std::optional<TransactionsCursor> const& txnCursor,
@@ -162,7 +162,7 @@ public:
auto cursor = txnCursor;
if (cursor) {
statement.bindAt(kTransactionCursorBindIndex, cursor->asTuple());
LOG(log_.debug()) << "account = " << ripple::strHex(account)
LOG(log_.debug()) << "account = " << xrpl::strHex(account)
<< " tuple = " << cursor->ledgerSequence << cursor->transactionIndex;
} else {
auto const seq = forward ? rng->minSequence : rng->maxSequence;
@@ -171,7 +171,7 @@ public:
statement.bindAt(
kTransactionCursorBindIndex, std::make_tuple(placeHolder, placeHolder)
);
LOG(log_.debug()) << "account = " << ripple::strHex(account) << " idx = " << seq
LOG(log_.debug()) << "account = " << xrpl::strHex(account) << " idx = " << seq
<< " tuple = " << placeHolder;
}
@@ -186,12 +186,11 @@ public:
return {};
}
std::vector<ripple::uint256> hashes = {};
std::vector<xrpl::uint256> hashes = {};
auto numRows = results.numRows();
LOG(log_.info()) << "num_rows = " << numRows;
for (auto [hash, data] :
extract<ripple::uint256, std::tuple<uint32_t, uint32_t>>(results)) {
for (auto [hash, data] : extract<xrpl::uint256, std::tuple<uint32_t, uint32_t>>(results)) {
hashes.push_back(hash);
if (--numRows == 0) {
LOG(log_.debug()) << "Setting cursor";
@@ -217,7 +216,7 @@ public:
}
void
writeLedger(ripple::LedgerHeader const& ledgerHeader, std::string&& blob) override
writeLedger(xrpl::LedgerHeader const& ledgerHeader, std::string&& blob) override
{
executor_.write(schema_->insertLedgerHeader, ledgerHeader.seq, std::move(blob));
@@ -246,7 +245,7 @@ public:
return std::nullopt;
}
std::optional<ripple::LedgerHeader>
std::optional<xrpl::LedgerHeader>
fetchLedgerBySequence(
std::uint32_t const sequence,
boost::asio::yield_context yield
@@ -260,7 +259,7 @@ public:
if (auto const& result = res.value(); result) {
if (auto const maybeValue = result.template get<std::vector<unsigned char>>();
maybeValue) {
auto const header = util::deserializeHeader(ripple::makeSlice(*maybeValue));
auto const header = util::deserializeHeader(xrpl::makeSlice(*maybeValue));
ledgerCache_.put(FetchLedgerCache::CacheEntry{header, sequence});
return header;
}
@@ -277,8 +276,8 @@ public:
return std::nullopt;
}
std::optional<ripple::LedgerHeader>
fetchLedgerByHash(ripple::uint256 const& hash, boost::asio::yield_context yield) const override
std::optional<xrpl::LedgerHeader>
fetchLedgerByHash(xrpl::uint256 const& hash, boost::asio::yield_context yield) const override
{
if (auto const res = executor_.read(yield, schema_->selectLedgerByHash, hash); res) {
if (auto const& result = res.value(); result) {
@@ -345,7 +344,7 @@ public:
return fetchTransactions(hashes, yield);
}
std::vector<ripple::uint256>
std::vector<xrpl::uint256>
fetchAllTransactionHashesInLedger(
std::uint32_t const ledgerSequence,
boost::asio::yield_context yield
@@ -367,8 +366,8 @@ public:
return {};
}
std::vector<ripple::uint256> hashes;
for (auto [hash] : extract<ripple::uint256>(result))
std::vector<xrpl::uint256> hashes;
for (auto [hash] : extract<xrpl::uint256>(result))
hashes.push_back(std::move(hash));
auto end = std::chrono::system_clock::now();
@@ -384,7 +383,7 @@ public:
std::optional<NFT>
fetchNFT(
ripple::uint256 const& tokenID,
xrpl::uint256 const& tokenID,
std::uint32_t const ledgerSequence,
boost::asio::yield_context yield
) const override
@@ -393,8 +392,7 @@ public:
if (not res)
return std::nullopt;
if (auto const maybeRow = res->template get<uint32_t, ripple::AccountID, bool>();
maybeRow) {
if (auto const maybeRow = res->template get<uint32_t, xrpl::AccountID, bool>(); maybeRow) {
auto [seq, owner, isBurned] = *maybeRow;
auto result = std::make_optional<NFT>(tokenID, seq, owner, isBurned);
@@ -411,7 +409,7 @@ public:
// one.
auto uriRes = executor_.read(yield, schema_->selectNFTURI, tokenID, ledgerSequence);
if (uriRes) {
if (auto const maybeUri = uriRes->template get<ripple::Blob>(); maybeUri)
if (auto const maybeUri = uriRes->template get<xrpl::Blob>(); maybeUri)
result->uri = *maybeUri;
}
@@ -424,7 +422,7 @@ public:
TransactionsAndCursor
fetchNFTTransactions(
ripple::uint256 const& tokenID,
xrpl::uint256 const& tokenID,
std::uint32_t const limit,
bool const forward,
std::optional<TransactionsCursor> const& cursorIn,
@@ -445,7 +443,7 @@ public:
auto cursor = cursorIn;
if (cursor) {
statement.bindAt(kTransactionCursorBindIndex, cursor->asTuple());
LOG(log_.debug()) << "token_id = " << ripple::strHex(tokenID)
LOG(log_.debug()) << "token_id = " << xrpl::strHex(tokenID)
<< " tuple = " << cursor->ledgerSequence << cursor->transactionIndex;
} else {
auto const seq = forward ? rng->minSequence : rng->maxSequence;
@@ -454,7 +452,7 @@ public:
statement.bindAt(
kTransactionCursorBindIndex, std::make_tuple(placeHolder, placeHolder)
);
LOG(log_.debug()) << "token_id = " << ripple::strHex(tokenID) << " idx = " << seq
LOG(log_.debug()) << "token_id = " << xrpl::strHex(tokenID) << " idx = " << seq
<< " tuple = " << placeHolder;
}
@@ -467,12 +465,11 @@ public:
return {};
}
std::vector<ripple::uint256> hashes = {};
std::vector<xrpl::uint256> hashes = {};
auto numRows = results.numRows();
LOG(log_.info()) << "num_rows = " << numRows;
for (auto [hash, data] :
extract<ripple::uint256, std::tuple<uint32_t, uint32_t>>(results)) {
for (auto [hash, data] : extract<xrpl::uint256, std::tuple<uint32_t, uint32_t>>(results)) {
hashes.push_back(hash);
if (--numRows == 0) {
LOG(log_.debug()) << "Setting cursor";
@@ -498,7 +495,7 @@ public:
TransactionsAndCursor
fetchMPTokenIssuanceTransactions(
ripple::uint192 const& mptIssuanceID,
xrpl::uint192 const& mptIssuanceID,
std::uint32_t const limit,
bool const forward,
std::optional<TransactionsCursor> const& cursorIn,
@@ -524,8 +521,8 @@ public:
TransactionsAndCursor
fetchAccountMPTokenIssuanceTransactions(
ripple::uint192 const& mptIssuanceID,
ripple::AccountID const& account,
xrpl::uint192 const& mptIssuanceID,
xrpl::AccountID const& account,
std::uint32_t const limit,
bool const forward,
std::optional<TransactionsCursor> const& cursorIn,
@@ -551,9 +548,9 @@ public:
MPTHoldersAndCursor
fetchMPTHolders(
ripple::uint192 const& mptID,
xrpl::uint192 const& mptID,
std::uint32_t const limit,
std::optional<ripple::AccountID> const& cursorIn,
std::optional<xrpl::AccountID> const& cursorIn,
std::uint32_t const ledgerSequence,
boost::asio::yield_context yield
) const override
@@ -562,7 +559,7 @@ public:
yield,
schema_->selectMPTHolders,
mptID,
cursorIn.value_or(ripple::AccountID(0)),
cursorIn.value_or(xrpl::AccountID(0)),
Limit{limit}
);
@@ -572,10 +569,10 @@ public:
return {};
}
std::vector<ripple::uint256> mptKeys;
std::optional<ripple::AccountID> cursor;
for (auto const [holder] : extract<ripple::AccountID>(holderResults)) {
mptKeys.push_back(ripple::keylet::mptoken(mptID, holder).key);
std::vector<xrpl::uint256> mptKeys;
std::optional<xrpl::AccountID> cursor;
for (auto const [holder] : extract<xrpl::AccountID>(holderResults)) {
mptKeys.push_back(xrpl::keylet::mptoken(mptID, holder).key);
cursor = holder;
}
@@ -596,13 +593,13 @@ public:
std::optional<Blob>
doFetchLedgerObject(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t const sequence,
boost::asio::yield_context yield
) const override
{
LOG(log_.debug()) << "Fetching ledger object for seq " << sequence
<< ", key = " << ripple::to_string(key);
<< ", key = " << xrpl::to_string(key);
if (auto const res = executor_.read(yield, schema_->selectObject, key, sequence); res) {
if (auto const result = res->template get<Blob>(); result) {
if (result->size())
@@ -619,13 +616,13 @@ public:
std::optional<std::uint32_t>
doFetchLedgerObjectSeq(
ripple::uint256 const& key,
xrpl::uint256 const& key,
std::uint32_t const sequence,
boost::asio::yield_context yield
) const override
{
LOG(log_.debug()) << "Fetching ledger object for seq " << sequence
<< ", key = " << ripple::to_string(key);
<< ", key = " << xrpl::to_string(key);
if (auto const res = executor_.read(yield, schema_->selectObject, key, sequence); res) {
if (auto const result = res->template get<Blob, std::uint32_t>(); result) {
auto [_, seq] = *result;
@@ -640,7 +637,7 @@ public:
}
std::optional<TransactionAndMetadata>
fetchTransaction(ripple::uint256 const& hash, boost::asio::yield_context yield) const override
fetchTransaction(xrpl::uint256 const& hash, boost::asio::yield_context yield) const override
{
if (auto const res = executor_.read(yield, schema_->selectTransaction, hash); res) {
if (auto const maybeValue = res->template get<Blob, Blob, uint32_t, uint32_t>();
@@ -657,16 +654,16 @@ public:
return std::nullopt;
}
std::optional<ripple::uint256>
std::optional<xrpl::uint256>
doFetchSuccessorKey(
ripple::uint256 key,
xrpl::uint256 key,
std::uint32_t const ledgerSequence,
boost::asio::yield_context yield
) const override
{
if (auto const res = executor_.read(yield, schema_->selectSuccessor, key, ledgerSequence);
res) {
if (auto const result = res->template get<ripple::uint256>(); result) {
if (auto const result = res->template get<xrpl::uint256>(); result) {
if (*result == kLastKey)
return std::nullopt;
return result;
@@ -682,7 +679,7 @@ public:
std::vector<TransactionAndMetadata>
fetchTransactions(
std::vector<ripple::uint256> const& hashes,
std::vector<xrpl::uint256> const& hashes,
boost::asio::yield_context yield
) const override
{
@@ -728,7 +725,7 @@ public:
std::vector<Blob>
doFetchLedgerObjects(
std::vector<ripple::uint256> const& keys,
std::vector<xrpl::uint256> const& keys,
std::uint32_t const sequence,
boost::asio::yield_context yield
) const override
@@ -777,7 +774,7 @@ public:
) const override
{
auto const [keys, timeDiff] =
util::timed([this, &ledgerSequence, yield]() -> std::vector<ripple::uint256> {
util::timed([this, &ledgerSequence, yield]() -> std::vector<xrpl::uint256> {
auto const res = executor_.read(yield, schema_->selectDiff, ledgerSequence);
if (not res) {
LOG(log_.error()) << "Could not fetch ledger diff: " << res.error()
@@ -792,8 +789,8 @@ public:
return {};
}
std::vector<ripple::uint256> resultKeys;
for (auto [key] : extract<ripple::uint256>(results))
std::vector<xrpl::uint256> resultKeys;
for (auto [key] : extract<xrpl::uint256>(results))
resultKeys.push_back(key);
return resultKeys;
@@ -1031,8 +1028,8 @@ public:
// to record the URI and link to the issuer_nf_tokens table.
if (record.uri) {
statements.push_back(schema_->insertIssuerNFT.bind(
ripple::nft::getIssuer(record.tokenID),
static_cast<uint32_t>(ripple::nft::getTaxon(record.tokenID)),
xrpl::nft::getIssuer(record.tokenID),
static_cast<uint32_t>(xrpl::nft::getTaxon(record.tokenID)),
record.tokenID
));
statements.push_back(schema_->insertNFTURI.bind(
@@ -1181,11 +1178,11 @@ protected:
return {};
}
std::vector<ripple::uint256> hashes = {};
std::vector<xrpl::uint256> hashes = {};
auto numRows = results.numRows();
for (auto const& [hash, data] :
extract<ripple::uint256, std::tuple<uint32_t, uint32_t>>(results)) {
extract<xrpl::uint256, std::tuple<uint32_t, uint32_t>>(results)) {
hashes.push_back(hash);
if (--numRows == 0) {

View File

@@ -58,14 +58,14 @@ public:
}
void
append(ripple::uint256 const& value) const
append(xrpl::uint256 const& value) const
{
auto const rc = cass_collection_append_bytes(
*this,
static_cast<cass_byte_t const*>(static_cast<unsigned char const*>(value.data())),
ripple::uint256::size()
xrpl::uint256::size()
);
throwErrorIfNeeded(rc, "Bind ripple::uint256");
throwErrorIfNeeded(rc, "Bind xrpl::uint256");
}
};
} // namespace data::cassandra::impl

View File

@@ -43,18 +43,18 @@ extractColumn(CassRow const* row, std::size_t idx)
using UintTupleType = std::tuple<uint32_t, uint32_t>;
using UCharVectorType = std::vector<unsigned char>;
if constexpr (std::is_same_v<DecayedType, ripple::uint256>) {
if constexpr (std::is_same_v<DecayedType, xrpl::uint256>) {
cass_byte_t const* buf = nullptr;
std::size_t bufSize = 0;
auto const rc = cass_value_get_bytes(cass_row_get_column(row, idx), &buf, &bufSize);
throwErrorIfNeeded(rc, "Extract ripple::uint256");
output = ripple::uint256::fromVoid(buf);
} else if constexpr (std::is_same_v<DecayedType, ripple::AccountID>) {
throwErrorIfNeeded(rc, "Extract xrpl::uint256");
output = xrpl::uint256::fromVoid(buf);
} else if constexpr (std::is_same_v<DecayedType, xrpl::AccountID>) {
cass_byte_t const* buf = nullptr;
std::size_t bufSize = 0;
auto const rc = cass_value_get_bytes(cass_row_get_column(row, idx), &buf, &bufSize);
throwErrorIfNeeded(rc, "Extract ripple::AccountID");
output = ripple::AccountID::fromVoid(buf);
throwErrorIfNeeded(rc, "Extract xrpl::AccountID");
output = xrpl::AccountID::fromVoid(buf);
} else if constexpr (std::is_same_v<DecayedType, UCharVectorType>) {
cass_byte_t const* buf = nullptr;
std::size_t bufSize = 0;

View File

@@ -93,18 +93,17 @@ public:
using DecayedType = std::decay_t<Type>;
using UCharVectorType = std::vector<unsigned char>;
using UintTupleType = std::tuple<uint32_t, uint32_t>;
using UintByteTupleType = std::tuple<uint32_t, ripple::uint256>;
using ByteVectorType = std::vector<ripple::uint256>;
using UintByteTupleType = std::tuple<uint32_t, xrpl::uint256>;
using ByteVectorType = std::vector<xrpl::uint256>;
if constexpr (
std::is_same_v<DecayedType, ripple::uint256> ||
std::is_same_v<DecayedType, ripple::uint192>
std::is_same_v<DecayedType, xrpl::uint256> || std::is_same_v<DecayedType, xrpl::uint192>
) {
auto const rc = bindBytes(value.data(), value.size());
throwErrorIfNeeded(rc, "Bind ripple::base_uint");
} else if constexpr (std::is_same_v<DecayedType, ripple::AccountID>) {
throwErrorIfNeeded(rc, "Bind xrpl::base_uint");
} else if constexpr (std::is_same_v<DecayedType, xrpl::AccountID>) {
auto const rc = bindBytes(value.data(), value.size());
throwErrorIfNeeded(rc, "Bind ripple::AccountID");
throwErrorIfNeeded(rc, "Bind xrpl::AccountID");
} else if constexpr (std::is_same_v<DecayedType, UCharVectorType>) {
auto const rc = bindBytes(value.data(), value.size());
throwErrorIfNeeded(rc, "Bind vector<unsigned char>");
@@ -122,7 +121,7 @@ public:
std::is_same_v<DecayedType, UintByteTupleType>
) {
auto const rc = cass_statement_bind_tuple(*this, idx, Tuple{std::forward<Type>(value)});
throwErrorIfNeeded(rc, "Bind tuple<uint32, uint32> or <uint32_t, ripple::uint256>");
throwErrorIfNeeded(rc, "Bind tuple<uint32, uint32> or <uint32_t, xrpl::uint256>");
} else if constexpr (std::is_same_v<DecayedType, ByteVectorType>) {
auto const rc =
cass_statement_bind_collection(*this, idx, Collection{std::forward<Type>(value)});

View File

@@ -62,14 +62,14 @@ public:
else if constexpr (std::is_convertible_v<DecayedType, int64_t>) {
auto const rc = cass_tuple_set_int64(*this, idx, std::forward<Type>(value));
throwErrorIfNeeded(rc, "Bind int64");
} else if constexpr (std::is_same_v<DecayedType, ripple::uint256>) {
} else if constexpr (std::is_same_v<DecayedType, xrpl::uint256>) {
auto const rc = cass_tuple_set_bytes(
*this,
idx,
static_cast<cass_byte_t const*>(static_cast<unsigned char const*>(value.data())),
value.size()
);
throwErrorIfNeeded(rc, "Bind ripple::uint256");
throwErrorIfNeeded(rc, "Bind xrpl::uint256");
} else {
// type not supported for binding
static_assert(util::Unsupported<DecayedType>);

View File

@@ -29,7 +29,7 @@ InputFile::readRaw(char* data, size_t size)
return not file_.fail();
}
ripple::uint256
xrpl::uint256
InputFile::hash() const
{
auto sum = shasum_;

View File

@@ -32,7 +32,7 @@ public:
bool
readRaw(char* data, size_t size);
ripple::uint256
xrpl::uint256
hash() const;
};
} // namespace data::impl

View File

@@ -17,17 +17,17 @@
namespace data::impl {
using Hash = ripple::uint256;
using Hash = xrpl::uint256;
using Separator = std::array<char, 16>;
static constexpr Separator kSeparator = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
namespace {
std::expected<std::pair<ripple::uint256, LedgerCache::CacheEntry>, std::string>
std::expected<std::pair<xrpl::uint256, LedgerCache::CacheEntry>, std::string>
readCacheEntry(InputFile& file, size_t i)
{
ripple::uint256 key;
if (not file.readRaw(reinterpret_cast<char*>(key.data()), ripple::base_uint<256>::bytes)) {
xrpl::uint256 key;
if (not file.readRaw(reinterpret_cast<char*>(key.data()), xrpl::BaseUInt<256>::kBytes)) {
return std::unexpected(fmt::format("Failed to read key at index {}", i));
}
@@ -81,7 +81,7 @@ LedgerCacheFile::write(DataView dataView)
file.write(kSeparator);
for (auto const& [k, v] : dataView.map) {
file.write(k.data(), decltype(k)::bytes);
file.write(k.data(), decltype(k)::kBytes);
file.write(v.seq);
file.write(v.blob.size());
file.writeRaw(reinterpret_cast<char const*>(v.blob.data()), v.blob.size());
@@ -89,14 +89,14 @@ LedgerCacheFile::write(DataView dataView)
file.write(kSeparator);
for (auto const& [k, v] : dataView.deleted) {
file.write(k.data(), decltype(k)::bytes);
file.write(k.data(), decltype(k)::kBytes);
file.write(v.seq);
file.write(v.blob.size());
file.writeRaw(reinterpret_cast<char const*>(v.blob.data()), v.blob.size());
}
file.write(kSeparator);
auto const hash = file.hash();
file.write(hash.data(), decltype(hash)::bytes);
file.write(hash.data(), decltype(hash)::kBytes);
// flush internal buffer explicitly before renaming
if (auto const expectedSuccess = file.close(); not expectedSuccess.has_value()) {
@@ -185,9 +185,9 @@ LedgerCacheFile::read(uint32_t minLatestSequence)
}
auto const dataHash = file.hash();
ripple::uint256 hashFromFile{};
xrpl::uint256 hashFromFile{};
if (not file.readRaw(
reinterpret_cast<char*>(hashFromFile.data()), decltype(hashFromFile)::bytes
reinterpret_cast<char*>(hashFromFile.data()), decltype(hashFromFile)::kBytes
)) {
return std::unexpected{"Error reading hash"};
}

View File

@@ -34,7 +34,7 @@ OutputFile::writeToFile(char const* data, size_t size)
shasum_.update(data, size);
}
ripple::uint256
xrpl::uint256
OutputFile::hash() const
{
auto sum = shasum_;

View File

@@ -39,7 +39,7 @@ public:
void
writeRaw(char const* data, size_t size);
ripple::uint256
xrpl::uint256
hash() const;
std::expected<void, std::string>

View File

@@ -8,16 +8,16 @@
#include <vector>
namespace etl {
std::vector<ripple::uint256>
std::vector<xrpl::uint256>
getMarkers(size_t numMarkers)
{
ASSERT(numMarkers <= 256, "Number of markers must be <= 256. Got: {}", numMarkers);
unsigned char const incr = 256 / numMarkers;
std::vector<ripple::uint256> markers;
std::vector<xrpl::uint256> markers;
markers.reserve(numMarkers);
ripple::uint256 base{0};
xrpl::uint256 base{0};
for (size_t i = 0; i < numMarkers; ++i) {
markers.push_back(base);
base.data()[0] += incr;

View File

@@ -130,7 +130,7 @@ public:
* @param numMarkers Total markers to partition for
* @return The markers
*/
std::vector<ripple::uint256>
std::vector<xrpl::uint256>
getMarkers(size_t numMarkers);
} // namespace etl

View File

@@ -298,7 +298,7 @@ ETLService::loadInitialLedgerIfNeeded()
auto [ledger, timeDiff] = ::util::timed<std::chrono::duration<double>>([this, seq]() {
return extractor_->extractLedgerOnly(seq).and_then(
[this, seq](auto&& data) -> std::optional<ripple::LedgerHeader> {
[this, seq](auto&& data) -> std::optional<xrpl::LedgerHeader> {
// TODO: loadInitialLedger in balancer should be called fetchEdgeKeys or
// similar
auto res = balancer_->loadInitialLedger(seq, *initialLoadObserver_);

View File

@@ -36,7 +36,7 @@ struct LoaderInterface {
* @param data The data to load
* @return Optional ledger header
*/
[[nodiscard]] virtual std::optional<ripple::LedgerHeader>
[[nodiscard]] virtual std::optional<xrpl::LedgerHeader>
loadInitialLedger(model::LedgerData const& data) = 0;
};

View File

@@ -1,16 +1,16 @@
#include "data/DBHelpers.hpp"
#include "util/Assert.hpp"
#include <ripple/protocol/STBase.h>
#include <ripple/protocol/STTx.h>
#include <ripple/protocol/TxMeta.h>
#include <xrpl/basics/base_uint.h>
#include <xrpl/protocol/LedgerFormats.h>
#include <xrpl/protocol/SField.h>
#include <xrpl/protocol/STBase.h>
#include <xrpl/protocol/STLedgerEntry.h>
#include <xrpl/protocol/STObject.h>
#include <xrpl/protocol/STTx.h>
#include <xrpl/protocol/Serializer.h>
#include <xrpl/protocol/TER.h>
#include <xrpl/protocol/TxMeta.h>
#include <optional>
#include <string>
@@ -19,23 +19,23 @@
namespace etl {
std::vector<MPTHolderData>
getMPTHolderFromTx(ripple::TxMeta const& txMeta, ripple::STTx const&)
getMPTHolderFromTx(xrpl::TxMeta const& txMeta, xrpl::STTx const&)
{
if (txMeta.getResultTER() != ripple::tesSUCCESS)
if (txMeta.getResultTER() != xrpl::tesSUCCESS)
return {};
std::vector<MPTHolderData> holders;
for (ripple::STObject const& node : txMeta.getNodes()) {
if (node.getFieldU16(ripple::sfLedgerEntryType) != ripple::ltMPTOKEN)
for (xrpl::STObject const& node : txMeta.getNodes()) {
if (node.getFieldU16(xrpl::sfLedgerEntryType) != xrpl::ltMPTOKEN)
continue;
if (node.getFName() == ripple::sfCreatedNode) {
auto const& newMPT = node.peekAtField(ripple::sfNewFields).downcast<ripple::STObject>();
if (node.getFName() == xrpl::sfCreatedNode) {
auto const& newMPT = node.peekAtField(xrpl::sfNewFields).downcast<xrpl::STObject>();
holders.push_back(
MPTHolderData{
.mptID = newMPT[ripple::sfMPTokenIssuanceID],
.holder = newMPT.getAccountID(ripple::sfAccount)
.mptID = newMPT[xrpl::sfMPTokenIssuanceID],
.holder = newMPT.getAccountID(xrpl::sfAccount)
}
);
}
@@ -49,19 +49,19 @@ getMPTHolderFromObj(std::string const& key, std::string const& blob)
{
// https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0033-multi-purpose-tokens#2121-mptoken-ledger-identifier
ASSERT(
key.size() == ripple::uint256::size(),
key.size() == xrpl::uint256::size(),
"The size of the key is expected to fit uint256 exactly"
);
ripple::STLedgerEntry const sle = ripple::STLedgerEntry(
ripple::SerialIter{blob.data(), blob.size()}, ripple::uint256::fromVoid(key.data())
xrpl::STLedgerEntry const sle = xrpl::STLedgerEntry(
xrpl::SerialIter{blob.data(), blob.size()}, xrpl::uint256::fromVoid(key.data())
);
if (sle.getFieldU16(ripple::sfLedgerEntryType) != ripple::ltMPTOKEN)
if (sle.getFieldU16(xrpl::sfLedgerEntryType) != xrpl::ltMPTOKEN)
return {};
auto const mptIssuanceID = sle[ripple::sfMPTokenIssuanceID];
auto const holder = sle.getAccountID(ripple::sfAccount);
auto const mptIssuanceID = sle[xrpl::sfMPTokenIssuanceID];
auto const holder = sle.getAccountID(xrpl::sfAccount);
return MPTHolderData{.mptID = mptIssuanceID, .holder = holder};
}

View File

@@ -3,8 +3,8 @@
#include "data/DBHelpers.hpp"
#include <ripple/protocol/STTx.h>
#include <ripple/protocol/TxMeta.h>
#include <xrpl/protocol/STTx.h>
#include <xrpl/protocol/TxMeta.h>
#include <optional>
#include <string>
@@ -21,7 +21,7 @@ namespace etl {
* failed or created no MPToken.
*/
std::vector<MPTHolderData>
getMPTHolderFromTx(ripple::TxMeta const& txMeta, ripple::STTx const& sttx);
getMPTHolderFromTx(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/**
* @brief Pull MPT data from ledger object via loadInitialLedger.

View File

@@ -28,7 +28,7 @@ namespace etl::model {
* incoming transactions by the Registry for its `onTransaction` and `onInitialTransaction` hooks.
* It's a compilation error to list the same transaction type more than once.
*/
template <ripple::TxType... Types>
template <xrpl::TxType... Types>
requires(util::hasNoDuplicates(Types...))
struct Spec {
static constexpr bool kSpecTag = true;
@@ -40,7 +40,7 @@ struct Spec {
* @return true if the transaction was requested; false otherwise
*/
[[nodiscard]] static constexpr bool
wants(ripple::TxType type) noexcept
wants(xrpl::TxType type) noexcept
{
return ((Types == type) || ...);
}
@@ -54,13 +54,13 @@ struct Transaction {
std::string metaRaw;
// unpacked blob and meta
ripple::STTx sttx;
ripple::TxMeta meta;
xrpl::STTx sttx;
xrpl::TxMeta meta;
// commonly used stuff
ripple::uint256 id;
xrpl::uint256 id;
std::string key; // key is the above id as a string of 32 characters
ripple::TxType type;
xrpl::TxType type;
/**
* @brief Compares Transaction objects to each other without considering sttx and meta fields
@@ -94,9 +94,9 @@ struct Object {
Deleted = 3,
};
ripple::uint256 key;
xrpl::uint256 key;
std::string keyRaw;
ripple::Blob data;
xrpl::Blob data;
std::string dataRaw;
std::string successor;
std::string predecessor;
@@ -127,7 +127,7 @@ struct LedgerData {
std::optional<std::vector<BookSuccessor>> successors;
std::optional<std::vector<std::string>> edgeKeys;
ripple::LedgerHeader header;
xrpl::LedgerHeader header;
std::string rawHeader;
uint32_t seq;
@@ -140,8 +140,8 @@ struct LedgerData {
operator==(LedgerData const& other) const
{
auto const serialized = [](auto const& hdr) {
ripple::Serializer ser;
ripple::addRaw(hdr, ser);
xrpl::Serializer ser;
xrpl::addRaw(hdr, ser);
return ser.getString();
};

View File

@@ -30,50 +30,50 @@
namespace etl {
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNftokenModifyData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
getNftokenModifyData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx)
{
auto const tokenID = sttx.getFieldH256(ripple::sfNFTokenID);
auto const tokenID = sttx.getFieldH256(xrpl::sfNFTokenID);
// note: sfURI is optional, if it is absent, we will update the uri as empty string
return {
{NFTTransactionsData(
sttx.getFieldH256(ripple::sfNFTokenID), txMeta, sttx.getTransactionID()
sttx.getFieldH256(xrpl::sfNFTokenID), txMeta, sttx.getTransactionID()
)},
NFTsData(tokenID, txMeta, sttx.getFieldVL(ripple::sfURI))
NFTsData(tokenID, txMeta, sttx.getFieldVL(xrpl::sfURI))
};
}
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenMintData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
getNFTokenMintData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx)
{
// To find the minted token ID, we put all tokenIDs referenced in the
// metadata from prior to the tx application into one vector, then all
// tokenIDs referenced in the metadata from after the tx application into
// another, then find the one tokenID that was added by this tx
// application.
std::vector<ripple::uint256> prevIDs;
std::vector<ripple::uint256> finalIDs;
std::vector<xrpl::uint256> prevIDs;
std::vector<xrpl::uint256> finalIDs;
// The owner is not necessarily the issuer, if using authorized minter
// flow. Determine owner from the ledger object ID of the NFTokenPages
// that were changed.
std::optional<ripple::AccountID> owner;
std::optional<xrpl::AccountID> owner;
for (ripple::STObject const& node : txMeta.getNodes()) {
if (node.getFieldU16(ripple::sfLedgerEntryType) != ripple::ltNFTOKEN_PAGE)
for (xrpl::STObject const& node : txMeta.getNodes()) {
if (node.getFieldU16(xrpl::sfLedgerEntryType) != xrpl::ltNFTOKEN_PAGE)
continue;
if (!owner)
owner = ripple::AccountID::fromVoid(node.getFieldH256(ripple::sfLedgerIndex).data());
owner = xrpl::AccountID::fromVoid(node.getFieldH256(xrpl::sfLedgerIndex).data());
if (node.getFName() == ripple::sfCreatedNode) {
ripple::STArray const& toAddNFTs = node.peekAtField(ripple::sfNewFields)
.downcast<ripple::STObject>()
.getFieldArray(ripple::sfNFTokens);
if (node.getFName() == xrpl::sfCreatedNode) {
xrpl::STArray const& toAddNFTs = node.peekAtField(xrpl::sfNewFields)
.downcast<xrpl::STObject>()
.getFieldArray(xrpl::sfNFTokens);
std::ranges::transform(
toAddNFTs,
std::back_inserter(finalIDs),
[](ripple::STObject const& nft) { return nft.getFieldH256(ripple::sfNFTokenID); }
[](xrpl::STObject const& nft) { return nft.getFieldH256(xrpl::sfNFTokenID); }
);
}
// Else it's modified, as there should never be a deleted NFToken page
@@ -88,27 +88,27 @@ getNFTokenMintData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
// However, there will always be NFTs listed in the final fields,
// as rippled outputs all fields in final fields even if they were
// not changed.
ripple::STObject const& previousFields =
node.peekAtField(ripple::sfPreviousFields).downcast<ripple::STObject>();
if (!previousFields.isFieldPresent(ripple::sfNFTokens))
xrpl::STObject const& previousFields =
node.peekAtField(xrpl::sfPreviousFields).downcast<xrpl::STObject>();
if (!previousFields.isFieldPresent(xrpl::sfNFTokens))
continue;
ripple::STArray const& toAddNFTs = previousFields.getFieldArray(ripple::sfNFTokens);
xrpl::STArray const& toAddNFTs = previousFields.getFieldArray(xrpl::sfNFTokens);
std::ranges::transform(
toAddNFTs,
std::back_inserter(prevIDs),
[](ripple::STObject const& nft) { return nft.getFieldH256(ripple::sfNFTokenID); }
[](xrpl::STObject const& nft) { return nft.getFieldH256(xrpl::sfNFTokenID); }
);
ripple::STArray const& toAddFinalNFTs = node.peekAtField(ripple::sfFinalFields)
.downcast<ripple::STObject>()
.getFieldArray(ripple::sfNFTokens);
xrpl::STArray const& toAddFinalNFTs = node.peekAtField(xrpl::sfFinalFields)
.downcast<xrpl::STObject>()
.getFieldArray(xrpl::sfNFTokens);
std::ranges::transform(
toAddFinalNFTs,
std::back_inserter(finalIDs),
[](ripple::STObject const& nft) { return nft.getFieldH256(ripple::sfNFTokenID); }
[](xrpl::STObject const& nft) { return nft.getFieldH256(xrpl::sfNFTokenID); }
);
}
}
@@ -130,14 +130,14 @@ getNFTokenMintData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
return {
{NFTTransactionsData(*finalMismatch, txMeta, sttx.getTransactionID())},
NFTsData(*finalMismatch, *owner, sttx.getFieldVL(ripple::sfURI), txMeta)
NFTsData(*finalMismatch, *owner, sttx.getFieldVL(xrpl::sfURI), txMeta)
};
}
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenBurnData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
getNFTokenBurnData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx)
{
ripple::uint256 const tokenID = sttx.getFieldH256(ripple::sfNFTokenID);
xrpl::uint256 const tokenID = sttx.getFieldH256(xrpl::sfNFTokenID);
std::vector<NFTTransactionsData> const txs = {
NFTTransactionsData(tokenID, txMeta, sttx.getTransactionID())
};
@@ -145,9 +145,9 @@ getNFTokenBurnData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
// Determine who owned the token when it was burned by finding an
// NFTokenPage that was deleted or modified that contains this
// tokenID.
for (ripple::STObject const& node : txMeta.getNodes()) {
if (node.getFieldU16(ripple::sfLedgerEntryType) != ripple::ltNFTOKEN_PAGE ||
node.getFName() == ripple::sfCreatedNode)
for (xrpl::STObject const& node : txMeta.getNodes()) {
if (node.getFieldU16(xrpl::sfLedgerEntryType) != xrpl::ltNFTOKEN_PAGE ||
node.getFName() == xrpl::sfCreatedNode)
continue;
// NFT burn can result in an NFTokenPage being modified to no longer
@@ -158,25 +158,25 @@ getNFTokenBurnData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
// deleted. In this case, we need to look in the PreviousFields.
// Otherwise, the page was not modified prior to deleting and we
// need to look in the FinalFields.
std::optional<ripple::STArray> prevNFTs;
std::optional<xrpl::STArray> prevNFTs;
if (node.isFieldPresent(ripple::sfPreviousFields)) {
ripple::STObject const& previousFields =
node.peekAtField(ripple::sfPreviousFields).downcast<ripple::STObject>();
if (previousFields.isFieldPresent(ripple::sfNFTokens))
prevNFTs = previousFields.getFieldArray(ripple::sfNFTokens);
} else if (node.getFName() == ripple::sfDeletedNode) {
prevNFTs = node.peekAtField(ripple::sfFinalFields)
.downcast<ripple::STObject>()
.getFieldArray(ripple::sfNFTokens);
if (node.isFieldPresent(xrpl::sfPreviousFields)) {
xrpl::STObject const& previousFields =
node.peekAtField(xrpl::sfPreviousFields).downcast<xrpl::STObject>();
if (previousFields.isFieldPresent(xrpl::sfNFTokens))
prevNFTs = previousFields.getFieldArray(xrpl::sfNFTokens);
} else if (node.getFName() == xrpl::sfDeletedNode) {
prevNFTs = node.peekAtField(xrpl::sfFinalFields)
.downcast<xrpl::STObject>()
.getFieldArray(xrpl::sfNFTokens);
}
if (!prevNFTs)
continue;
auto const nft = std::find_if(
prevNFTs->begin(), prevNFTs->end(), [&tokenID](ripple::STObject const& candidate) {
return candidate.getFieldH256(ripple::sfNFTokenID) == tokenID;
prevNFTs->begin(), prevNFTs->end(), [&tokenID](xrpl::STObject const& candidate) {
return candidate.getFieldH256(xrpl::sfNFTokenID) == tokenID;
}
);
if (nft != prevNFTs->end()) {
@@ -184,7 +184,7 @@ getNFTokenBurnData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
txs,
NFTsData(
tokenID,
ripple::AccountID::fromVoid(node.getFieldH256(ripple::sfLedgerIndex).data()),
xrpl::AccountID::fromVoid(node.getFieldH256(xrpl::sfLedgerIndex).data()),
txMeta,
true
)
@@ -198,18 +198,18 @@ getNFTokenBurnData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
}
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
getNFTokenAcceptOfferData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx)
{
// If we have the buy offer from this tx, we can determine the owner
// more easily by just looking at the owner of the accepted NFTokenOffer
// object.
if (sttx.isFieldPresent(ripple::sfNFTokenBuyOffer)) {
if (sttx.isFieldPresent(xrpl::sfNFTokenBuyOffer)) {
auto const affectedBuyOffer = std::find_if(
txMeta.getNodes().begin(),
txMeta.getNodes().end(),
[&sttx](ripple::STObject const& node) {
return node.getFieldH256(ripple::sfLedgerIndex) ==
sttx.getFieldH256(ripple::sfNFTokenBuyOffer);
[&sttx](xrpl::STObject const& node) {
return node.getFieldH256(xrpl::sfLedgerIndex) ==
sttx.getFieldH256(xrpl::sfNFTokenBuyOffer);
}
);
if (affectedBuyOffer == txMeta.getNodes().end()) {
@@ -218,13 +218,13 @@ getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
throw std::runtime_error(msg.str());
}
ripple::uint256 const tokenID = affectedBuyOffer->peekAtField(ripple::sfFinalFields)
.downcast<ripple::STObject>()
.getFieldH256(ripple::sfNFTokenID);
xrpl::uint256 const tokenID = affectedBuyOffer->peekAtField(xrpl::sfFinalFields)
.downcast<xrpl::STObject>()
.getFieldH256(xrpl::sfNFTokenID);
ripple::AccountID const owner = affectedBuyOffer->peekAtField(ripple::sfFinalFields)
.downcast<ripple::STObject>()
.getAccountID(ripple::sfOwner);
xrpl::AccountID const owner = affectedBuyOffer->peekAtField(xrpl::sfFinalFields)
.downcast<xrpl::STObject>()
.getAccountID(xrpl::sfOwner);
return {
{NFTTransactionsData(tokenID, txMeta, sttx.getTransactionID())},
NFTsData(tokenID, owner, txMeta, false)
@@ -233,9 +233,9 @@ getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
// Otherwise we have to infer the new owner from the affected nodes.
auto const affectedSellOffer = std::find_if(
txMeta.getNodes().begin(), txMeta.getNodes().end(), [&sttx](ripple::STObject const& node) {
return node.getFieldH256(ripple::sfLedgerIndex) ==
sttx.getFieldH256(ripple::sfNFTokenSellOffer);
txMeta.getNodes().begin(), txMeta.getNodes().end(), [&sttx](xrpl::STObject const& node) {
return node.getFieldH256(xrpl::sfLedgerIndex) ==
sttx.getFieldH256(xrpl::sfNFTokenSellOffer);
}
);
if (affectedSellOffer == txMeta.getNodes().end()) {
@@ -244,37 +244,37 @@ getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
throw std::runtime_error(msg.str());
}
ripple::uint256 const tokenID = affectedSellOffer->peekAtField(ripple::sfFinalFields)
.downcast<ripple::STObject>()
.getFieldH256(ripple::sfNFTokenID);
xrpl::uint256 const tokenID = affectedSellOffer->peekAtField(xrpl::sfFinalFields)
.downcast<xrpl::STObject>()
.getFieldH256(xrpl::sfNFTokenID);
ripple::AccountID const seller = affectedSellOffer->peekAtField(ripple::sfFinalFields)
.downcast<ripple::STObject>()
.getAccountID(ripple::sfOwner);
xrpl::AccountID const seller = affectedSellOffer->peekAtField(xrpl::sfFinalFields)
.downcast<xrpl::STObject>()
.getAccountID(xrpl::sfOwner);
for (ripple::STObject const& node : txMeta.getNodes()) {
if (node.getFieldU16(ripple::sfLedgerEntryType) != ripple::ltNFTOKEN_PAGE ||
node.getFName() == ripple::sfDeletedNode)
for (xrpl::STObject const& node : txMeta.getNodes()) {
if (node.getFieldU16(xrpl::sfLedgerEntryType) != xrpl::ltNFTOKEN_PAGE ||
node.getFName() == xrpl::sfDeletedNode)
continue;
ripple::AccountID const nodeOwner =
ripple::AccountID::fromVoid(node.getFieldH256(ripple::sfLedgerIndex).data());
xrpl::AccountID const nodeOwner =
xrpl::AccountID::fromVoid(node.getFieldH256(xrpl::sfLedgerIndex).data());
if (nodeOwner == seller)
continue;
ripple::STArray const& nfts = [&node] {
if (node.getFName() == ripple::sfCreatedNode) {
return node.peekAtField(ripple::sfNewFields)
.downcast<ripple::STObject>()
.getFieldArray(ripple::sfNFTokens);
xrpl::STArray const& nfts = [&node] {
if (node.getFName() == xrpl::sfCreatedNode) {
return node.peekAtField(xrpl::sfNewFields)
.downcast<xrpl::STObject>()
.getFieldArray(xrpl::sfNFTokens);
}
return node.peekAtField(ripple::sfFinalFields)
.downcast<ripple::STObject>()
.getFieldArray(ripple::sfNFTokens);
return node.peekAtField(xrpl::sfFinalFields)
.downcast<xrpl::STObject>()
.getFieldArray(xrpl::sfNFTokens);
}();
auto const nft = std::ranges::find_if(nfts, [&tokenID](ripple::STObject const& candidate) {
return candidate.getFieldH256(ripple::sfNFTokenID) == tokenID;
auto const nft = std::ranges::find_if(nfts, [&tokenID](xrpl::STObject const& candidate) {
return candidate.getFieldH256(xrpl::sfNFTokenID) == tokenID;
});
if (nft != nfts.end()) {
return {
@@ -294,16 +294,16 @@ getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
// transaction using this feature. This transaction also never returns an
// NFTsData because it does not change the state of an NFT itself.
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenCancelOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
getNFTokenCancelOfferData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx)
{
std::vector<NFTTransactionsData> txs;
for (ripple::STObject const& node : txMeta.getNodes()) {
if (node.getFieldU16(ripple::sfLedgerEntryType) != ripple::ltNFTOKEN_OFFER)
for (xrpl::STObject const& node : txMeta.getNodes()) {
if (node.getFieldU16(xrpl::sfLedgerEntryType) != xrpl::ltNFTOKEN_OFFER)
continue;
ripple::uint256 const tokenID = node.peekAtField(ripple::sfFinalFields)
.downcast<ripple::STObject>()
.getFieldH256(ripple::sfNFTokenID);
xrpl::uint256 const tokenID = node.peekAtField(xrpl::sfFinalFields)
.downcast<xrpl::STObject>()
.getFieldH256(xrpl::sfNFTokenID);
txs.emplace_back(tokenID, txMeta, sttx.getTransactionID());
}
@@ -322,39 +322,39 @@ getNFTokenCancelOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
// This transaction never returns an NFTokensData because it does not
// change the state of an NFT itself.
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenCreateOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
getNFTokenCreateOfferData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx)
{
return {
{NFTTransactionsData(
sttx.getFieldH256(ripple::sfNFTokenID), txMeta, sttx.getTransactionID()
sttx.getFieldH256(xrpl::sfNFTokenID), txMeta, sttx.getTransactionID()
)},
{}
};
}
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTDataFromTx(ripple::TxMeta const& txMeta, ripple::STTx const& sttx)
getNFTDataFromTx(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx)
{
if (txMeta.getResultTER() != ripple::tesSUCCESS)
if (txMeta.getResultTER() != xrpl::tesSUCCESS)
return {{}, {}};
switch (sttx.getTxnType()) {
case ripple::TxType::ttNFTOKEN_MINT:
case xrpl::TxType::ttNFTOKEN_MINT:
return getNFTokenMintData(txMeta, sttx);
case ripple::TxType::ttNFTOKEN_BURN:
case xrpl::TxType::ttNFTOKEN_BURN:
return getNFTokenBurnData(txMeta, sttx);
case ripple::TxType::ttNFTOKEN_ACCEPT_OFFER:
case xrpl::TxType::ttNFTOKEN_ACCEPT_OFFER:
return getNFTokenAcceptOfferData(txMeta, sttx);
case ripple::TxType::ttNFTOKEN_CANCEL_OFFER:
case xrpl::TxType::ttNFTOKEN_CANCEL_OFFER:
return getNFTokenCancelOfferData(txMeta, sttx);
case ripple::TxType::ttNFTOKEN_CREATE_OFFER:
case xrpl::TxType::ttNFTOKEN_CREATE_OFFER:
return getNFTokenCreateOfferData(txMeta, sttx);
case ripple::TxType::ttNFTOKEN_MODIFY:
case xrpl::TxType::ttNFTOKEN_MODIFY:
return getNftokenModifyData(txMeta, sttx);
default:
@@ -367,23 +367,23 @@ getNFTDataFromObj(std::uint32_t const seq, std::string const& key, std::string c
{
// https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0020-non-fungible-tokens#tokenpage-id-format
ASSERT(
key.size() == ripple::uint256::size(),
key.size() == xrpl::uint256::size(),
"The size of the key (token) is expected to fit uint256 exactly"
);
auto const sle = ripple::STLedgerEntry(
ripple::SerialIter{blob.data(), blob.size()}, ripple::uint256::fromVoid(key.data())
auto const sle = xrpl::STLedgerEntry(
xrpl::SerialIter{blob.data(), blob.size()}, xrpl::uint256::fromVoid(key.data())
);
if (sle.getFieldU16(ripple::sfLedgerEntryType) != ripple::ltNFTOKEN_PAGE)
if (sle.getFieldU16(xrpl::sfLedgerEntryType) != xrpl::ltNFTOKEN_PAGE)
return {};
auto const owner = ripple::AccountID::fromVoid(key.data());
auto const owner = xrpl::AccountID::fromVoid(key.data());
std::vector<NFTsData> nfts;
for (ripple::STObject const& node : sle.getFieldArray(ripple::sfNFTokens)) {
for (xrpl::STObject const& node : sle.getFieldArray(xrpl::sfNFTokens)) {
nfts.emplace_back(
node.getFieldH256(ripple::sfNFTokenID), seq, owner, node.getFieldVL(ripple::sfURI)
node.getFieldH256(xrpl::sfNFTokenID), seq, owner, node.getFieldVL(xrpl::sfURI)
);
}

View File

@@ -22,7 +22,7 @@ namespace etl {
* @return NFT URI change data as a pair of transactions and optional NFTsData
*/
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNftokenModifyData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx);
getNftokenModifyData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/**
* @brief Get the NFT Token mint data from a transaction
@@ -32,7 +32,7 @@ getNftokenModifyData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx);
* @return NFT Token mint data as a pair of transactions and optional NFTsData
*/
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenMintData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx);
getNFTokenMintData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/**
* @brief Get the NFT Token burn data from a transaction
@@ -42,7 +42,7 @@ getNFTokenMintData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx);
* @return NFT Token burn data as a pair of transactions and optional NFTsData
*/
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenBurnData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx);
getNFTokenBurnData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/**
* @brief Get the NFT Token accept offer data from a transaction
@@ -52,7 +52,7 @@ getNFTokenBurnData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx);
* @return NFT Token accept offer data as a pair of transactions and optional NFTsData
*/
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx);
getNFTokenAcceptOfferData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/**
* @brief Get the NFT Token cancel offer data from a transaction
@@ -62,7 +62,7 @@ getNFTokenAcceptOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
* @return NFT Token cancel offer data as a pair of transactions and optional NFTsData
*/
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenCancelOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx);
getNFTokenCancelOfferData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/**
* @brief Get the NFT Token create offer data from a transaction
@@ -72,7 +72,7 @@ getNFTokenCancelOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
* @return NFT Token create offer data as a pair of transactions and optional NFTsData
*/
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTokenCreateOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx);
getNFTokenCreateOfferData(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/**
* @brief Pull NFT data from TX via ETLService.
@@ -82,7 +82,7 @@ getNFTokenCreateOfferData(ripple::TxMeta const& txMeta, ripple::STTx const& sttx
* @return NFT transactions data as a pair of transactions and optional NFTsData
*/
std::pair<std::vector<NFTTransactionsData>, std::optional<NFTsData>>
getNFTDataFromTx(ripple::TxMeta const& txMeta, ripple::STTx const& sttx);
getNFTDataFromTx(xrpl::TxMeta const& txMeta, xrpl::STTx const& sttx);
/**
* @brief Pull NFT data from ledger object via loadInitialLedger.

View File

@@ -40,11 +40,11 @@ namespace etl {
* @code{.cpp}
* struct Ext {
* using spec = etl::model::Spec<
* ripple::TxType::ttNFTOKEN_BURN,
* ripple::TxType::ttNFTOKEN_ACCEPT_OFFER,
* ripple::TxType::ttNFTOKEN_CREATE_OFFER,
* ripple::TxType::ttNFTOKEN_CANCEL_OFFER,
* ripple::TxType::ttNFTOKEN_MINT>;
* xrpl::TxType::ttNFTOKEN_BURN,
* xrpl::TxType::ttNFTOKEN_ACCEPT_OFFER,
* xrpl::TxType::ttNFTOKEN_CREATE_OFFER,
* xrpl::TxType::ttNFTOKEN_CANCEL_OFFER,
* xrpl::TxType::ttNFTOKEN_MINT>;
*
* static void
* onInitialTransaction(uint32_t, etl::model::Transaction const&);

View File

@@ -26,22 +26,22 @@ namespace etl::impl {
AsyncGrpcCall::AsyncGrpcCall(
uint32_t seq,
ripple::uint256 const& marker,
std::optional<ripple::uint256> const& nextMarker
xrpl::uint256 const& marker,
std::optional<xrpl::uint256> const& nextMarker
)
{
request_.set_user("ETL");
request_.mutable_ledger()->set_sequence(seq);
if (marker.isNonZero())
request_.set_marker(marker.data(), ripple::uint256::size());
request_.set_marker(marker.data(), xrpl::uint256::size());
nextPrefix_ = nextMarker ? nextMarker->data()[0] : 0x00;
auto const prefix = marker.data()[0];
LOG(log_.debug()) << "Setting up AsyncGrpcCall. marker = " << ripple::strHex(marker)
<< ". prefix = " << ripple::strHex(std::string(1, prefix))
<< ". nextPrefix_ = " << ripple::strHex(std::string(1, nextPrefix_));
LOG(log_.debug()) << "Setting up AsyncGrpcCall. marker = " << xrpl::strHex(marker)
<< ". prefix = " << xrpl::strHex(std::string(1, prefix))
<< ". nextPrefix_ = " << xrpl::strHex(std::string(1, nextPrefix_));
ASSERT(
nextPrefix_ > prefix or nextPrefix_ == 0x00,
@@ -142,7 +142,7 @@ std::string
AsyncGrpcCall::getMarkerPrefix()
{
return next_->marker().empty() ? std::string{}
: ripple::strHex(std::string{next_->marker().data()[0]});
: xrpl::strHex(std::string{next_->marker().data()[0]});
}
// this is used to generate edgeKeys - keys that were the last one in the onInitialObjects list

View File

@@ -42,8 +42,8 @@ private:
public:
AsyncGrpcCall(
uint32_t seq,
ripple::uint256 const& marker,
std::optional<ripple::uint256> const& nextMarker
xrpl::uint256 const& marker,
std::optional<xrpl::uint256> const& nextMarker
);
static std::vector<AsyncGrpcCall>

View File

@@ -7,8 +7,8 @@
namespace etl::impl {
struct CursorPair {
ripple::uint256 start;
ripple::uint256 end;
xrpl::uint256 start;
xrpl::uint256 end;
};
struct BaseCursorProvider {

View File

@@ -105,7 +105,7 @@ private:
}
auto [start, end] = *cursor;
LOG(log_.debug()) << "Starting a cursor: " << ripple::strHex(start);
LOG(log_.debug()) << "Starting a cursor: " << xrpl::strHex(start);
while (not token.isStopRequested() and not cache_.get().isDisabled()) {
auto res =

View File

@@ -43,7 +43,7 @@ public:
}();
rg::sort(accountRoots);
std::vector<ripple::uint256> cursors{data::kFirstKey};
std::vector<xrpl::uint256> cursors{data::kFirstKey};
rg::copy(accountRoots.begin(), accountRoots.end(), std::back_inserter(cursors));
rg::sort(cursors);
cursors.push_back(data::kLastKey);

View File

@@ -43,8 +43,8 @@ public:
auto const range = backend_->fetchLedgerRange();
ASSERT(range.has_value(), "Ledger range is not available when cache is loading");
std::set<ripple::uint256> liveCursors;
std::set<ripple::uint256> deletedCursors;
std::set<xrpl::uint256> liveCursors;
std::set<xrpl::uint256> deletedCursors;
auto i = 0;
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
while (liveCursors.size() < numCursors_ and seq - i >= range->minSequence) {
@@ -67,7 +67,7 @@ public:
);
}
std::vector<ripple::uint256> cursors{data::kFirstKey};
std::vector<xrpl::uint256> cursors{data::kFirstKey};
rg::copy(
liveCursors | vs::take(std::min(liveCursors.size(), numCursors_)),
std::back_inserter(cursors)

View File

@@ -57,7 +57,7 @@ public:
rg::unique(diffs, [](auto const& a, auto const& b) { return a.key == b.key; });
diffs.erase(removalCursor, last);
std::vector<ripple::uint256> cursors{data::kFirstKey};
std::vector<xrpl::uint256> cursors{data::kFirstKey};
rg::copy(
diffs //
| vs::filter([](auto const& obj) { return not obj.blob.empty(); }) //

View File

@@ -10,6 +10,7 @@
#include "util/Profiler.hpp"
#include "util/log/Logger.hpp"
#include <xrpl/basics/Blob.h>
#include <xrpl/basics/Slice.h>
#include <xrpl/basics/base_uint.h>
#include <xrpl/protocol/STTx.h>
@@ -55,9 +56,10 @@ model::Transaction
extractTx(PBTxType tx, uint32_t seq)
{
auto raw = std::move(*tx.mutable_transaction_blob());
ripple::SerialIter it{raw.data(), raw.size()};
ripple::STTx const sttx{it};
ripple::TxMeta meta{sttx.getTransactionID(), seq, tx.metadata_blob()};
xrpl::SerialIter it{raw.data(), raw.size()};
xrpl::STTx const sttx{it};
auto const& metaBlob = tx.metadata_blob();
xrpl::TxMeta meta{sttx.getTransactionID(), seq, xrpl::Blob{metaBlob.begin(), metaBlob.end()}};
return {
.raw = std::move(raw),
@@ -90,7 +92,7 @@ extractTxs(PBTxListType transactions, uint32_t seq)
model::Object
extractObj(PBObjType obj)
{
auto const key = ripple::uint256::fromVoidChecked(obj.key());
auto const key = xrpl::uint256::fromVoidChecked(obj.key());
ASSERT(key.has_value(), "Failed to deserialize key from void");
if (!key)
return {};
@@ -162,7 +164,7 @@ auto
Extractor::unpack()
{
return [](auto&& data) {
auto header = ::util::deserializeHeader(ripple::makeSlice(data.ledger_header()));
auto header = ::util::deserializeHeader(xrpl::makeSlice(data.ledger_header()));
return std::make_optional<model::LedgerData>({
.transactions = extractTxs(

View File

@@ -65,7 +65,7 @@ class LedgerPublisher : public LedgerPublisherInterface {
std::shared_ptr<feed::SubscriptionManagerInterface> subscriptions_;
std::reference_wrapper<SystemState const> state_; // shared state for ETL
util::Mutex<std::chrono::time_point<ripple::NetClock>, std::shared_mutex> lastCloseTime_;
util::Mutex<std::chrono::time_point<xrpl::NetClock>, std::shared_mutex> lastCloseTime_;
std::reference_wrapper<util::prometheus::CounterInt> lastPublishSeconds_ =
PrometheusService::counterInt(
@@ -157,7 +157,7 @@ public:
* @param lgrInfo the ledger to publish
*/
void
publish(ripple::LedgerHeader const& lgrInfo)
publish(xrpl::LedgerHeader const& lgrInfo)
{
publishStrand_.submit([this, lgrInfo = lgrInfo] {
LOG(log_.info()) << "Publishing ledger " << std::to_string(lgrInfo.seq);
@@ -169,7 +169,7 @@ public:
// and don't publish
static constexpr std::uint32_t kMaxLedgerAgeSeconds = 600;
if (age < kMaxLedgerAgeSeconds) {
std::optional<ripple::Fees> fees =
std::optional<xrpl::Fees> fees =
data::synchronousAndRetryOnTimeout([&](auto yield) {
return backend_->fetchFees(lgrInfo.seq, yield);
});
@@ -188,12 +188,12 @@ public:
// order with transaction index
std::ranges::sort(transactions, [](auto const& t1, auto const& t2) {
ripple::SerialIter iter1{t1.metadata.data(), t1.metadata.size()};
ripple::STObject const object1(iter1, ripple::sfMetadata);
ripple::SerialIter iter2{t2.metadata.data(), t2.metadata.size()};
ripple::STObject const object2(iter2, ripple::sfMetadata);
return object1.getFieldU32(ripple::sfTransactionIndex) <
object2.getFieldU32(ripple::sfTransactionIndex);
xrpl::SerialIter iter1{t1.metadata.data(), t1.metadata.size()};
xrpl::STObject const object1(iter1, xrpl::sfMetadata);
xrpl::SerialIter iter2{t2.metadata.data(), t2.metadata.size()};
xrpl::STObject const object2(iter2, xrpl::sfMetadata);
return object1.getFieldU32(xrpl::sfTransactionIndex) <
object2.getFieldU32(xrpl::sfTransactionIndex);
});
for (auto const& txAndMeta : transactions)
@@ -275,7 +275,7 @@ public:
private:
void
setLastClose(std::chrono::time_point<ripple::NetClock> lastCloseTime)
setLastClose(std::chrono::time_point<xrpl::NetClock> lastCloseTime)
{
auto closeTime = lastCloseTime_.lock<std::scoped_lock>();
*closeTime = lastCloseTime;

View File

@@ -120,7 +120,7 @@ Loader::onInitialLoadGotMoreObjects(
}
}
std::optional<ripple::LedgerHeader>
std::optional<xrpl::LedgerHeader>
Loader::loadInitialLedger(model::LedgerData const& data)
{
try {

View File

@@ -67,7 +67,7 @@ public:
std::optional<std::string> lastKey
) override;
std::optional<ripple::LedgerHeader>
std::optional<xrpl::LedgerHeader>
loadInitialLedger(model::LedgerData const& data) override;
};

View File

@@ -31,7 +31,7 @@ MPTExt::onLedgerData(model::LedgerData const& data)
void
MPTExt::onInitialObject(uint32_t, model::Object const& obj)
{
LOG(log_.trace()) << "got initial object with key: " << ripple::strHex(obj.key);
LOG(log_.trace()) << "got initial object with key: " << xrpl::strHex(obj.key);
if (auto const mptHolder = getMPTHolderFromObj(obj.keyRaw, obj.dataRaw); mptHolder.has_value())
backend_->writeMPTHolders({*mptHolder});
}

View File

@@ -133,7 +133,7 @@ SuccessorExt::updateSuccessorFromCache(uint32_t seq, model::Object const& obj) c
if (isDeleted) {
auto const old = cache_.get().getDeleted(obj.key, seq - 1);
ASSERT(old.has_value(), "Deleted object {} must be in cache", ripple::strHex(obj.key));
ASSERT(old.has_value(), "Deleted object {} must be in cache", xrpl::strHex(obj.key));
checkBookBase = isBookDir(obj.key, *old); // NOLINT(bugprone-unchecked-optional-access)
} else {
@@ -161,7 +161,7 @@ void
SuccessorExt::updateBookSuccessor(
std::optional<data::LedgerObject> const& maybeSuccessor,
auto seq,
ripple::uint256 const& bookBase
xrpl::uint256 const& bookBase
) const
{
if (maybeSuccessor.has_value()) {
@@ -176,7 +176,7 @@ SuccessorExt::updateBookSuccessor(
void
SuccessorExt::writeSuccessors(uint32_t seq) const
{
ripple::uint256 prev = data::kFirstKey;
xrpl::uint256 prev = data::kFirstKey;
while (auto cur = cache_.get().getSuccessor(prev, seq)) {
if (prev == data::kFirstKey)
backend_->writeSuccessor(uint256ToString(prev), seq, uint256ToString(cur->key));
@@ -187,9 +187,7 @@ SuccessorExt::writeSuccessors(uint32_t seq) const
// make sure the base is not an actual object
if (not cache_.get().get(base, seq)) {
auto succ = cache_.get().getSuccessor(base, seq);
ASSERT(
succ.has_value(), "Book base {} must have a successor", ripple::strHex(base)
);
ASSERT(succ.has_value(), "Book base {} must have a successor", xrpl::strHex(base));
if (succ->key == cur->key) // NOLINT(bugprone-unchecked-optional-access)
backend_->writeSuccessor(uint256ToString(base), seq, uint256ToString(cur->key));
@@ -207,7 +205,7 @@ SuccessorExt::writeEdgeKeys(std::uint32_t seq, auto const& edgeKeys) const
{
for (auto const& key : edgeKeys) {
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
auto succ = cache_.get().getSuccessor(*ripple::uint256::fromVoidChecked(key), seq);
auto succ = cache_.get().getSuccessor(*xrpl::uint256::fromVoidChecked(key), seq);
if (succ)
backend_->writeSuccessor(auto{key}, seq, uint256ToString(succ->key));
}

View File

@@ -54,7 +54,7 @@ private:
updateBookSuccessor(
std::optional<data::LedgerObject> const& maybeSuccessor,
auto seq,
ripple::uint256 const& bookBase
xrpl::uint256 const& bookBase
) const;
void

View File

@@ -29,7 +29,7 @@ SubscriptionManager::unsubBookChanges(SubscriberSharedPtr const& subscriber)
void
SubscriptionManager::pubBookChanges(
ripple::LedgerHeader const& lgrInfo,
xrpl::LedgerHeader const& lgrInfo,
std::vector<data::TransactionAndMetadata> const& transactions
)
{
@@ -55,7 +55,7 @@ SubscriptionManager::unsubProposedTransactions(SubscriberSharedPtr const& subscr
void
SubscriptionManager::subProposedAccount(
ripple::AccountID const& account,
xrpl::AccountID const& account,
SubscriberSharedPtr const& subscriber
)
{
@@ -68,7 +68,7 @@ SubscriptionManager::subProposedAccount(
void
SubscriptionManager::unsubProposedAccount(
ripple::AccountID const& account,
xrpl::AccountID const& account,
SubscriberSharedPtr const& subscriber
)
{
@@ -99,8 +99,8 @@ SubscriptionManager::unsubLedger(SubscriberSharedPtr const& subscriber)
void
SubscriptionManager::pubLedger(
ripple::LedgerHeader const& lgrInfo,
ripple::Fees const& fees,
xrpl::LedgerHeader const& lgrInfo,
xrpl::Fees const& fees,
std::string const& ledgerRange,
std::uint32_t const txnCount
)
@@ -158,7 +158,7 @@ SubscriptionManager::unsubTransactions(SubscriberSharedPtr const& subscriber)
void
SubscriptionManager::subAccount(
ripple::AccountID const& account,
xrpl::AccountID const& account,
SubscriberSharedPtr const& subscriber
)
{
@@ -167,7 +167,7 @@ SubscriptionManager::subAccount(
void
SubscriptionManager::unsubAccount(
ripple::AccountID const& account,
xrpl::AccountID const& account,
SubscriberSharedPtr const& subscriber
)
{
@@ -175,13 +175,13 @@ SubscriptionManager::unsubAccount(
}
void
SubscriptionManager::subBook(ripple::Book const& book, SubscriberSharedPtr const& subscriber)
SubscriptionManager::subBook(xrpl::Book const& book, SubscriberSharedPtr const& subscriber)
{
transactionFeed_.sub(book, subscriber);
}
void
SubscriptionManager::unsubBook(ripple::Book const& book, SubscriberSharedPtr const& subscriber)
SubscriptionManager::unsubBook(xrpl::Book const& book, SubscriberSharedPtr const& subscriber)
{
transactionFeed_.unsub(book, subscriber);
}
@@ -189,7 +189,7 @@ SubscriptionManager::unsubBook(ripple::Book const& book, SubscriberSharedPtr con
void
SubscriptionManager::pubTransaction(
data::TransactionAndMetadata const& txMeta,
ripple::LedgerHeader const& lgrInfo
xrpl::LedgerHeader const& lgrInfo
)
{
transactionFeed_.pub(txMeta, lgrInfo, backend_, amendmentCenter_, networkID_);

View File

@@ -143,7 +143,7 @@ public:
*/
void
pubBookChanges(
ripple::LedgerHeader const& lgrInfo,
xrpl::LedgerHeader const& lgrInfo,
std::vector<data::TransactionAndMetadata> const& transactions
) final;
@@ -168,10 +168,7 @@ public:
* @param subscriber
*/
void
subProposedAccount(
ripple::AccountID const& account,
SubscriberSharedPtr const& subscriber
) final;
subProposedAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber) final;
/**
* @brief Unsubscribe to the proposed transactions feed for particular account.
@@ -180,7 +177,7 @@ public:
*/
void
unsubProposedAccount(
ripple::AccountID const& account,
xrpl::AccountID const& account,
SubscriberSharedPtr const& subscriber
) final;
@@ -216,8 +213,8 @@ public:
*/
void
pubLedger(
ripple::LedgerHeader const& lgrInfo,
ripple::Fees const& fees,
xrpl::LedgerHeader const& lgrInfo,
xrpl::Fees const& fees,
std::string const& ledgerRange,
std::uint32_t txnCount
) final;
@@ -285,7 +282,7 @@ public:
* @param subscriber
*/
void
subAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) final;
subAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber) final;
/**
* @brief Unsubscribe to the transactions feed for particular account.
@@ -293,7 +290,7 @@ public:
* @param subscriber The subscriber to unsubscribe
*/
void
unsubAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) final;
unsubAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber) final;
/**
* @brief Subscribe to the transactions feed, only receive feed when particular order book is
@@ -302,7 +299,7 @@ public:
* @param subscriber
*/
void
subBook(ripple::Book const& book, SubscriberSharedPtr const& subscriber) final;
subBook(xrpl::Book const& book, SubscriberSharedPtr const& subscriber) final;
/**
* @brief Unsubscribe to the transactions feed for particular order book.
@@ -310,7 +307,7 @@ public:
* @param subscriber
*/
void
unsubBook(ripple::Book const& book, SubscriberSharedPtr const& subscriber) final;
unsubBook(xrpl::Book const& book, SubscriberSharedPtr const& subscriber) final;
/**
* @brief Forward the transactions feed.
@@ -320,7 +317,7 @@ public:
void
pubTransaction(
data::TransactionAndMetadata const& txMeta,
ripple::LedgerHeader const& lgrInfo
xrpl::LedgerHeader const& lgrInfo
) final;
/**

View File

@@ -53,7 +53,7 @@ public:
*/
virtual void
pubBookChanges(
ripple::LedgerHeader const& lgrInfo,
xrpl::LedgerHeader const& lgrInfo,
std::vector<data::TransactionAndMetadata> const& transactions
) = 0;
@@ -78,7 +78,7 @@ public:
* @param subscriber
*/
virtual void
subProposedAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) = 0;
subProposedAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber) = 0;
/**
* @brief Unsubscribe to the proposed transactions feed for particular account.
@@ -86,10 +86,7 @@ public:
* @param subscriber
*/
virtual void
unsubProposedAccount(
ripple::AccountID const& account,
SubscriberSharedPtr const& subscriber
) = 0;
unsubProposedAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber) = 0;
/**
* @brief Forward the proposed transactions feed.
@@ -124,8 +121,8 @@ public:
*/
virtual void
pubLedger(
ripple::LedgerHeader const& lgrInfo,
ripple::Fees const& fees,
xrpl::LedgerHeader const& lgrInfo,
xrpl::Fees const& fees,
std::string const& ledgerRange,
std::uint32_t txnCount
) = 0;
@@ -193,7 +190,7 @@ public:
* @param subscriber
*/
virtual void
subAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) = 0;
subAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber) = 0;
/**
* @brief Unsubscribe to the transactions feed for particular account.
@@ -201,7 +198,7 @@ public:
* @param subscriber The subscriber to unsubscribe
*/
virtual void
unsubAccount(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber) = 0;
unsubAccount(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber) = 0;
/**
* @brief Subscribe to the transactions feed, only receive feed when particular order book is
@@ -210,7 +207,7 @@ public:
* @param subscriber
*/
virtual void
subBook(ripple::Book const& book, SubscriberSharedPtr const& subscriber) = 0;
subBook(xrpl::Book const& book, SubscriberSharedPtr const& subscriber) = 0;
/**
* @brief Unsubscribe to the transactions feed for particular order book.
@@ -218,7 +215,7 @@ public:
* @param subscriber
*/
virtual void
unsubBook(ripple::Book const& book, SubscriberSharedPtr const& subscriber) = 0;
unsubBook(xrpl::Book const& book, SubscriberSharedPtr const& subscriber) = 0;
/**
* @brief Forward the transactions feed.
@@ -228,7 +225,7 @@ public:
virtual void
pubTransaction(
data::TransactionAndMetadata const& txMeta,
ripple::LedgerHeader const& lgrInfo
xrpl::LedgerHeader const& lgrInfo
) = 0;
/**

View File

@@ -31,7 +31,7 @@ struct BookChangesFeed : public SingleFeedBase {
* @param transactions The transactions that were included in the ledger.
*/
void
pub(ripple::LedgerHeader const& lgrInfo,
pub(xrpl::LedgerHeader const& lgrInfo,
std::vector<data::TransactionAndMetadata> const& transactions)
{
SingleFeedBase::pub(boost::json::serialize(rpc::computeBookChanges(lgrInfo, transactions)));

View File

@@ -22,8 +22,8 @@ namespace feed::impl {
boost::json::object
LedgerFeed::makeLedgerPubMessage(
ripple::LedgerHeader const& lgrInfo,
ripple::Fees const& fees,
xrpl::LedgerHeader const& lgrInfo,
xrpl::Fees const& fees,
std::string const& ledgerRange,
uint32_t const txnCount,
uint32_t const networkID
@@ -80,8 +80,8 @@ LedgerFeed::sub(
void
LedgerFeed::pub(
ripple::LedgerHeader const& lgrInfo,
ripple::Fees const& fees,
xrpl::LedgerHeader const& lgrInfo,
xrpl::Fees const& fees,
std::string const& ledgerRange,
uint32_t const txnCount,
uint32_t const networkID

View File

@@ -59,8 +59,8 @@ public:
* @param networkID The network ID.
*/
void
pub(ripple::LedgerHeader const& lgrInfo,
ripple::Fees const& fees,
pub(xrpl::LedgerHeader const& lgrInfo,
xrpl::Fees const& fees,
std::string const& ledgerRange,
uint32_t txnCount,
uint32_t networkID);
@@ -68,8 +68,8 @@ public:
private:
static boost::json::object
makeLedgerPubMessage(
ripple::LedgerHeader const& lgrInfo,
ripple::Fees const& fees,
xrpl::LedgerHeader const& lgrInfo,
xrpl::Fees const& fees,
std::string const& ledgerRange,
uint32_t txnCount,
uint32_t networkID

View File

@@ -52,10 +52,7 @@ ProposedTransactionFeed::sub(SubscriberSharedPtr const& subscriber)
}
void
ProposedTransactionFeed::sub(
ripple::AccountID const& account,
SubscriberSharedPtr const& subscriber
)
ProposedTransactionFeed::sub(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber)
{
auto const added = accountSignal_.connectTrackableSlot(
subscriber, account, ProposedTransactionSlot(*this, subscriber)
@@ -78,7 +75,7 @@ ProposedTransactionFeed::unsub(SubscriberSharedPtr const& subscriber)
void
ProposedTransactionFeed::unsub(
ripple::AccountID const& account,
xrpl::AccountID const& account,
SubscriberSharedPtr const& subscriber
)
{
@@ -114,8 +111,7 @@ ProposedTransactionFeed::pub(boost::json::object const& receivedTxJson)
auto const transaction = receivedTxJson.at(JS(transaction)).as_object();
auto const accounts = rpc::getAccountsFromTransaction(transaction);
auto affectedAccounts =
std::unordered_set<ripple::AccountID>(accounts.cbegin(), accounts.cend());
auto affectedAccounts = std::unordered_set<xrpl::AccountID>(accounts.cbegin(), accounts.cend());
[[maybe_unused]] auto task =
strand_.execute([this, allVersionMsgs, affectedAccounts = std::move(affectedAccounts)]() {
@@ -154,7 +150,7 @@ ProposedTransactionFeed::unsubInternal(SubscriberPtr subscriber)
}
void
ProposedTransactionFeed::unsubInternal(ripple::AccountID const& account, SubscriberPtr subscriber)
ProposedTransactionFeed::unsubInternal(xrpl::AccountID const& account, SubscriberPtr subscriber)
{
if (accountSignal_.disconnect(subscriber, account)) {
LOG(logger_.info()) << subscriber->tag() << "Unsubscribed accounts_proposed " << account;

View File

@@ -62,7 +62,7 @@ class ProposedTransactionFeed {
std::reference_wrapper<util::prometheus::GaugeInt> subAllCount_;
std::reference_wrapper<util::prometheus::GaugeInt> subAccountCount_;
TrackableSignalMap<ripple::AccountID, Subscriber, AllVersionsMsgsPtrType> accountSignal_;
TrackableSignalMap<xrpl::AccountID, Subscriber, AllVersionsMsgsPtrType> accountSignal_;
TrackableSignal<Subscriber, AllVersionsMsgsPtrType> signal_;
public:
@@ -98,7 +98,7 @@ public:
* @param account The account to watch.
*/
void
sub(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber);
sub(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber);
/**
* @brief Unsubscribe to the proposed transaction feed.
@@ -113,7 +113,7 @@ public:
* @param account The account to unsubscribe.
*/
void
unsub(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber);
unsub(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber);
/**
* @brief Publishes the proposed transaction feed.
@@ -139,6 +139,6 @@ private:
unsubInternal(SubscriberPtr subscriber);
void
unsubInternal(ripple::AccountID const& account, SubscriberPtr subscriber);
unsubInternal(xrpl::AccountID const& account, SubscriberPtr subscriber);
};
} // namespace feed::impl

View File

@@ -18,6 +18,7 @@
#include <xrpl/json/json_value.h>
#include <xrpl/protocol/AccountID.h>
#include <xrpl/protocol/Book.h>
#include <xrpl/protocol/Issue.h>
#include <xrpl/protocol/LedgerFormats.h>
#include <xrpl/protocol/LedgerHeader.h>
#include <xrpl/protocol/NFTSyntheticSerializer.h>
@@ -68,7 +69,7 @@ TransactionFeed::sub(SubscriberSharedPtr const& subscriber)
}
void
TransactionFeed::sub(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber)
TransactionFeed::sub(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber)
{
auto const added = accountSignal_.connectTrackableSlot(
subscriber, account, TransactionSlot(*this, subscriber)
@@ -95,10 +96,7 @@ TransactionFeed::subProposed(SubscriberSharedPtr const& subscriber)
}
void
TransactionFeed::subProposed(
ripple::AccountID const& account,
SubscriberSharedPtr const& subscriber
)
TransactionFeed::subProposed(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber)
{
auto const added = accountProposedSignal_.connectTrackableSlot(
subscriber, account, TransactionSlot(*this, subscriber)
@@ -111,7 +109,7 @@ TransactionFeed::subProposed(
}
void
TransactionFeed::sub(ripple::Book const& book, SubscriberSharedPtr const& subscriber)
TransactionFeed::sub(xrpl::Book const& book, SubscriberSharedPtr const& subscriber)
{
auto const added =
bookSignal_.connectTrackableSlot(subscriber, book, TransactionSlot(*this, subscriber));
@@ -131,7 +129,7 @@ TransactionFeed::unsub(SubscriberSharedPtr const& subscriber)
}
void
TransactionFeed::unsub(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber)
TransactionFeed::unsub(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber)
{
unsubInternal(account, subscriber.get());
}
@@ -144,7 +142,7 @@ TransactionFeed::unsubProposed(SubscriberSharedPtr const& subscriber)
void
TransactionFeed::unsubProposed(
ripple::AccountID const& account,
xrpl::AccountID const& account,
SubscriberSharedPtr const& subscriber
)
{
@@ -152,7 +150,7 @@ TransactionFeed::unsubProposed(
}
void
TransactionFeed::unsub(ripple::Book const& book, SubscriberSharedPtr const& subscriber)
TransactionFeed::unsub(xrpl::Book const& book, SubscriberSharedPtr const& subscriber)
{
unsubInternal(book, subscriber.get());
}
@@ -178,7 +176,7 @@ TransactionFeed::bookSubCount() const
void
TransactionFeed::pub(
data::TransactionAndMetadata const& txMeta,
ripple::LedgerHeader const& lgrInfo,
xrpl::LedgerHeader const& lgrInfo,
std::shared_ptr<data::BackendInterface const> const& backend,
std::shared_ptr<data::AmendmentCenterInterface const> const& amendmentCenter,
uint32_t const networkID
@@ -186,12 +184,12 @@ TransactionFeed::pub(
{
auto [tx, meta] = rpc::deserializeTxPlusMeta(txMeta, lgrInfo.seq);
std::optional<ripple::STAmount> ownerFunds;
std::optional<xrpl::STAmount> ownerFunds;
if (tx->getTxnType() == ripple::ttOFFER_CREATE) {
auto const account = tx->getAccountID(ripple::sfAccount);
auto const amount = tx->getFieldAmount(ripple::sfTakerGets);
if (account != amount.issue().account) {
if (tx->getTxnType() == xrpl::ttOFFER_CREATE) {
auto const account = tx->getAccountID(xrpl::sfAccount);
auto const amount = tx->getFieldAmount(xrpl::sfTakerGets);
if (account != amount.get<xrpl::Issue>().account) {
auto fetchFundsSynchronous = [&]() {
data::synchronous([&](boost::asio::yield_context yield) {
ownerFunds = rpc::accountFunds(
@@ -215,8 +213,8 @@ TransactionFeed::pub(
rpc::insertDeliverMaxAlias(txnPubobj, version);
rpc::insertMPTIssuanceID(txnPubobj, tx, metaPubobj, meta);
Json::Value nftJson;
ripple::RPC::insertNFTSyntheticInJson(nftJson, tx, *meta);
json::Value nftJson;
xrpl::RPC::insertNFTSyntheticInJson(nftJson, tx, *meta);
auto const nftBoostJson = rpc::toBoostJson(nftJson).as_object();
if (nftBoostJson.contains(JS(meta)) && nftBoostJson.at(JS(meta)).is_object()) {
auto& metaObjInPub = pubObj.at(JS(meta)).as_object();
@@ -240,10 +238,10 @@ TransactionFeed::pub(
pubObj[JS(type)] = "transaction";
pubObj[JS(validated)] = true;
pubObj[JS(status)] = "closed";
pubObj[JS(close_time_iso)] = ripple::to_string_iso(lgrInfo.closeTime);
pubObj[JS(close_time_iso)] = xrpl::toStringIso(lgrInfo.closeTime);
pubObj[JS(ledger_index)] = lgrInfo.seq;
pubObj[JS(ledger_hash)] = ripple::strHex(lgrInfo.hash);
pubObj[JS(ledger_hash)] = xrpl::strHex(lgrInfo.hash);
if (version >= 2u) {
if (pubObj[txKey].as_object().contains(JS(hash))) {
pubObj[JS(hash)] = pubObj[txKey].as_object()[JS(hash)];
@@ -255,7 +253,7 @@ TransactionFeed::pub(
pubObj[JS(engine_result_code)] = meta->getResult();
std::string token;
std::string human;
ripple::transResultInfo(meta->getResultTER(), token, human);
xrpl::transResultInfo(meta->getResultTER(), token, human);
pubObj[JS(engine_result)] = token;
pubObj[JS(engine_result_message)] = human;
@@ -270,36 +268,36 @@ TransactionFeed::pub(
);
auto const affectedAccountsFlat = meta->getAffectedAccounts();
auto affectedAccounts = std::unordered_set<ripple::AccountID>(
auto affectedAccounts = std::unordered_set<xrpl::AccountID>(
affectedAccountsFlat.cbegin(), affectedAccountsFlat.cend()
);
std::unordered_set<ripple::Book> affectedBooks;
std::unordered_set<xrpl::Book> affectedBooks;
for (auto const& node : meta->getNodes()) {
if (node.getFieldU16(ripple::sfLedgerEntryType) == ripple::ltOFFER) {
ripple::SField const* field = nullptr;
if (node.getFieldU16(xrpl::sfLedgerEntryType) == xrpl::ltOFFER) {
xrpl::SField const* field = nullptr;
// We need a field that contains the TakerGets and TakerPays
// parameters.
if (node.getFName() == ripple::sfModifiedNode) {
field = &ripple::sfPreviousFields;
} else if (node.getFName() == ripple::sfCreatedNode) {
field = &ripple::sfNewFields;
} else if (node.getFName() == ripple::sfDeletedNode) {
field = &ripple::sfFinalFields;
if (node.getFName() == xrpl::sfModifiedNode) {
field = &xrpl::sfPreviousFields;
} else if (node.getFName() == xrpl::sfCreatedNode) {
field = &xrpl::sfNewFields;
} else if (node.getFName() == xrpl::sfDeletedNode) {
field = &xrpl::sfFinalFields;
}
if (field != nullptr) {
auto const data = dynamic_cast<ripple::STObject const*>(node.peekAtPField(*field));
auto const data = dynamic_cast<xrpl::STObject const*>(node.peekAtPField(*field));
if ((data != nullptr) && data->isFieldPresent(ripple::sfTakerPays) &&
data->isFieldPresent(ripple::sfTakerGets)) {
if ((data != nullptr) && data->isFieldPresent(xrpl::sfTakerPays) &&
data->isFieldPresent(xrpl::sfTakerGets)) {
// determine the OrderBook
ripple::Book const book{
data->getFieldAmount(ripple::sfTakerGets).issue(),
data->getFieldAmount(ripple::sfTakerPays).issue(),
(*data)[~ripple::sfDomainID]
xrpl::Book const book{
data->getFieldAmount(xrpl::sfTakerGets).get<xrpl::Issue>(),
data->getFieldAmount(xrpl::sfTakerPays).get<xrpl::Issue>(),
(*data)[~xrpl::sfDomainID]
};
if (!affectedBooks.contains(book)) {
affectedBooks.insert(book);
@@ -345,7 +343,7 @@ TransactionFeed::unsubInternal(SubscriberPtr subscriber)
}
void
TransactionFeed::unsubInternal(ripple::AccountID const& account, SubscriberPtr subscriber)
TransactionFeed::unsubInternal(xrpl::AccountID const& account, SubscriberPtr subscriber)
{
if (accountSignal_.disconnect(subscriber, account)) {
LOG(logger_.info()) << subscriber->tag() << "Unsubscribed account " << account;
@@ -360,13 +358,13 @@ TransactionFeed::unsubProposedInternal(SubscriberPtr subscriber)
}
void
TransactionFeed::unsubProposedInternal(ripple::AccountID const& account, SubscriberPtr subscriber)
TransactionFeed::unsubProposedInternal(xrpl::AccountID const& account, SubscriberPtr subscriber)
{
accountProposedSignal_.disconnect(subscriber, account);
}
void
TransactionFeed::unsubInternal(ripple::Book const& book, SubscriberPtr subscriber)
TransactionFeed::unsubInternal(xrpl::Book const& book, SubscriberPtr subscriber)
{
if (bookSignal_.disconnect(subscriber, book)) {
LOG(logger_.info()) << subscriber->tag() << "Unsubscribed book " << book;

View File

@@ -54,14 +54,14 @@ class TransactionFeed {
std::reference_wrapper<util::prometheus::GaugeInt> subAccountCount_;
std::reference_wrapper<util::prometheus::GaugeInt> subBookCount_;
TrackableSignalMap<ripple::AccountID, Subscriber, std::shared_ptr<AllVersionsMsgsType> const&>
TrackableSignalMap<xrpl::AccountID, Subscriber, std::shared_ptr<AllVersionsMsgsType> const&>
accountSignal_;
TrackableSignalMap<ripple::Book, Subscriber, std::shared_ptr<AllVersionsMsgsType> const&>
TrackableSignalMap<xrpl::Book, Subscriber, std::shared_ptr<AllVersionsMsgsType> const&>
bookSignal_;
TrackableSignal<Subscriber, std::shared_ptr<AllVersionsMsgsType> const&> signal_;
// Signals for proposed tx subscribers
TrackableSignalMap<ripple::AccountID, Subscriber, std::shared_ptr<AllVersionsMsgsType> const&>
TrackableSignalMap<xrpl::AccountID, Subscriber, std::shared_ptr<AllVersionsMsgsType> const&>
accountProposedSignal_;
TrackableSignal<Subscriber, std::shared_ptr<AllVersionsMsgsType> const&> txProposedSignal_;
@@ -100,7 +100,7 @@ public:
* @param account The account to watch.
*/
void
sub(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber);
sub(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber);
/**
* @brief Subscribe to the transaction feed, only receive the feed when particular order book is
@@ -109,7 +109,7 @@ public:
* @param book The order book to watch.
*/
void
sub(ripple::Book const& book, SubscriberSharedPtr const& subscriber);
sub(xrpl::Book const& book, SubscriberSharedPtr const& subscriber);
/**
* @brief Subscribe to the transaction feed for proposed transaction stream.
@@ -125,7 +125,7 @@ public:
* @param account The account to watch.
*/
void
subProposed(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber);
subProposed(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber);
/**
* @brief Unsubscribe to the transaction feed.
@@ -140,7 +140,7 @@ public:
* @param account The account to unsubscribe.
*/
void
unsub(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber);
unsub(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber);
/**
* @brief Unsubscribe to the transaction feed for proposed transaction stream.
@@ -155,7 +155,7 @@ public:
* @param account The account to unsubscribe.
*/
void
unsubProposed(ripple::AccountID const& account, SubscriberSharedPtr const& subscriber);
unsubProposed(xrpl::AccountID const& account, SubscriberSharedPtr const& subscriber);
/**
* @brief Unsubscribe to the transaction feed for particular order book.
@@ -163,7 +163,7 @@ public:
* @param book The book to unsubscribe.
*/
void
unsub(ripple::Book const& book, SubscriberSharedPtr const& subscriber);
unsub(xrpl::Book const& book, SubscriberSharedPtr const& subscriber);
/**
* @brief Publishes the transaction feed.
@@ -174,7 +174,7 @@ public:
*/
void
pub(data::TransactionAndMetadata const& txMeta,
ripple::LedgerHeader const& lgrInfo,
xrpl::LedgerHeader const& lgrInfo,
std::shared_ptr<data::BackendInterface const> const& backend,
std::shared_ptr<data::AmendmentCenterInterface const> const& amendmentCenter,
uint32_t networkID);
@@ -202,15 +202,15 @@ private:
unsubInternal(SubscriberPtr subscriber);
void
unsubInternal(ripple::AccountID const& account, SubscriberPtr subscriber);
unsubInternal(xrpl::AccountID const& account, SubscriberPtr subscriber);
void
unsubProposedInternal(SubscriberPtr subscriber);
void
unsubProposedInternal(ripple::AccountID const& account, SubscriberPtr subscriber);
unsubProposedInternal(xrpl::AccountID const& account, SubscriberPtr subscriber);
void
unsubInternal(ripple::Book const& book, SubscriberPtr subscriber);
unsubInternal(xrpl::Book const& book, SubscriberPtr subscriber);
};
} // namespace feed::impl

View File

@@ -17,7 +17,7 @@ ObjectsAdapter::onRowRead(TableObjectsDesc::Row const& row)
onStateRead_(ledgerSeq, std::nullopt);
return;
}
ripple::SLE sle{ripple::SerialIter{blob.data(), blob.size()}, key};
xrpl::SLE sle{xrpl::SerialIter{blob.data(), blob.size()}, key};
onStateRead_(ledgerSeq, std::make_optional(std::move(sle)));
}

View File

@@ -22,7 +22,7 @@ namespace migration::cassandra::impl {
* @brief The description of the objects table. It has to be a TableSpec.
*/
struct TableObjectsDesc {
using Row = std::tuple<ripple::uint256, std::uint32_t, data::Blob>;
using Row = std::tuple<xrpl::uint256, std::uint32_t, data::Blob>;
static constexpr char const* kPartitionKey = "key";
static constexpr char const* kTableName = "objects";
};
@@ -33,7 +33,7 @@ struct TableObjectsDesc {
*/
class ObjectsAdapter : public impl::FullTableScannerAdapterBase<TableObjectsDesc> {
public:
using OnStateRead = std::function<void(std::uint32_t, std::optional<ripple::SLE>)>;
using OnStateRead = std::function<void(std::uint32_t, std::optional<xrpl::SLE>)>;
/**
* @brief Construct a new Objects Adapter object

View File

@@ -11,9 +11,9 @@ TransactionsAdapter::onRowRead(TableTransactionsDesc::Row const& row)
{
auto const& [txHash, date, ledgerSeq, metaBlob, txBlob] = row;
ripple::SerialIter it{txBlob.data(), txBlob.size()};
ripple::STTx const sttx{it};
ripple::TxMeta const txMeta{sttx.getTransactionID(), ledgerSeq, metaBlob};
xrpl::SerialIter it{txBlob.data(), txBlob.size()};
xrpl::STTx const sttx{it};
xrpl::TxMeta const txMeta{sttx.getTransactionID(), ledgerSeq, metaBlob};
onTransactionRead_(sttx, txMeta);
}
} // namespace migration::cassandra::impl

View File

@@ -22,8 +22,7 @@ namespace migration::cassandra::impl {
*/
struct TableTransactionsDesc {
// hash, date, ledger_seq, metadata, transaction
using Row =
std::tuple<ripple::uint256, std::uint64_t, std::uint32_t, ripple::Blob, ripple::Blob>;
using Row = std::tuple<xrpl::uint256, std::uint64_t, std::uint32_t, xrpl::Blob, xrpl::Blob>;
static constexpr char const* kPartitionKey = "hash";
static constexpr char const* kTableName = "transactions";
};
@@ -34,7 +33,7 @@ struct TableTransactionsDesc {
*/
class TransactionsAdapter : public impl::FullTableScannerAdapterBase<TableTransactionsDesc> {
public:
using OnTransactionRead = std::function<void(ripple::STTx, ripple::TxMeta)>;
using OnTransactionRead = std::function<void(xrpl::STTx, xrpl::TxMeta)>;
/**
* @brief Construct a new Transactions Adapter object

View File

@@ -10,21 +10,20 @@
#include <xrpl/protocol/Issue.h>
#include <xrpl/protocol/SField.h>
#include <xrpl/protocol/STLedgerEntry.h>
#include <xrpl/protocol/UintTypes.h>
#include <cstdint>
#include <utility>
namespace rpc {
std::pair<ripple::STAmount, ripple::STAmount>
std::pair<xrpl::STAmount, xrpl::STAmount>
getAmmPoolHolds(
BackendInterface const& backend,
data::AmendmentCenterInterface const& amendmentCenter,
std::uint32_t sequence,
ripple::AccountID const& ammAccountID,
ripple::Issue const& issue1,
ripple::Issue const& issue2,
xrpl::AccountID const& ammAccountID,
xrpl::Issue const& issue1,
xrpl::Issue const& issue2,
bool freezeHandling,
boost::asio::yield_context yield
)
@@ -52,39 +51,39 @@ getAmmPoolHolds(
return std::make_pair(assetInBalance, assetOutBalance);
}
ripple::STAmount
xrpl::STAmount
getAmmLpHolds(
BackendInterface const& backend,
std::uint32_t sequence,
ripple::Currency const& cur1,
ripple::Currency const& cur2,
ripple::AccountID const& ammAccount,
ripple::AccountID const& lpAccount,
xrpl::Issue const& iss1,
xrpl::Issue const& iss2,
xrpl::AccountID const& ammAccount,
xrpl::AccountID const& lpAccount,
boost::asio::yield_context yield
)
{
auto const lptCurrency = ammLPTCurrency(cur1, cur2);
auto const lptCurrency = ammLPTCurrency(iss1, iss2);
// not using accountHolds because we don't need to check if the associated tokens of the LP are
// frozen
return ammAccountHolds(backend, sequence, lpAccount, lptCurrency, ammAccount, true, yield);
}
ripple::STAmount
xrpl::STAmount
getAmmLpHolds(
BackendInterface const& backend,
std::uint32_t sequence,
ripple::SLE const& ammSle,
ripple::AccountID const& lpAccount,
xrpl::SLE const& ammSle,
xrpl::AccountID const& lpAccount,
boost::asio::yield_context yield
)
{
return getAmmLpHolds(
backend,
sequence,
ammSle[ripple::sfAsset].get<ripple::Issue>().currency,
ammSle[ripple::sfAsset2].get<ripple::Issue>().currency,
ammSle[ripple::sfAccount],
ammSle[xrpl::sfAsset].get<xrpl::Issue>(),
ammSle[xrpl::sfAsset2].get<xrpl::Issue>(),
ammSle[xrpl::sfAccount],
lpAccount,
yield
);

View File

@@ -28,14 +28,14 @@ namespace rpc {
* @param yield The coroutine context
* @return The balances of the amm asset pair
*/
std::pair<ripple::STAmount, ripple::STAmount>
std::pair<xrpl::STAmount, xrpl::STAmount>
getAmmPoolHolds(
BackendInterface const& backend,
data::AmendmentCenterInterface const& amendmentCenter,
std::uint32_t sequence,
ripple::AccountID const& ammAccountID,
ripple::Issue const& issue1,
ripple::Issue const& issue2,
xrpl::AccountID const& ammAccountID,
xrpl::Issue const& issue1,
xrpl::Issue const& issue2,
bool freezeHandling,
boost::asio::yield_context yield
);
@@ -45,21 +45,21 @@ getAmmPoolHolds(
*
* @param backend The backend to use
* @param sequence The sequence number to use
* @param cur1 The first currency
* @param cur2 The second currency
* @param iss1 The first issue
* @param iss2 The second issue
* @param ammAccount The amm account
* @param lpAccount The lp account
* @param yield The coroutine context
* @return The lp token balance
*/
ripple::STAmount
xrpl::STAmount
getAmmLpHolds(
BackendInterface const& backend,
std::uint32_t sequence,
ripple::Currency const& cur1,
ripple::Currency const& cur2,
ripple::AccountID const& ammAccount,
ripple::AccountID const& lpAccount,
xrpl::Issue const& iss1,
xrpl::Issue const& iss2,
xrpl::AccountID const& ammAccount,
xrpl::AccountID const& lpAccount,
boost::asio::yield_context yield
);
@@ -73,12 +73,12 @@ getAmmLpHolds(
* @param yield The coroutine context
* @return The lp token balance
*/
ripple::STAmount
xrpl::STAmount
getAmmLpHolds(
BackendInterface const& backend,
std::uint32_t sequence,
ripple::SLE const& ammSle,
ripple::AccountID const& lpAccount,
xrpl::SLE const& ammSle,
xrpl::AccountID const& lpAccount,
boost::asio::yield_context yield
);

View File

@@ -37,13 +37,13 @@ namespace rpc {
* @brief Represents an entry in the book_changes' changes array.
*/
struct BookChange {
ripple::STAmount sideAVolume;
ripple::STAmount sideBVolume;
ripple::STAmount highRate;
ripple::STAmount lowRate;
ripple::STAmount openRate;
ripple::STAmount closeRate;
std::optional<ripple::uint256> domain;
xrpl::STAmount sideAVolume;
xrpl::STAmount sideBVolume;
xrpl::STAmount highRate;
xrpl::STAmount lowRate;
xrpl::STAmount openRate;
xrpl::STAmount closeRate;
std::optional<xrpl::uint256> domain;
};
/**
@@ -90,59 +90,59 @@ private:
private:
void
handleAffectedNode(ripple::STObject const& node)
handleAffectedNode(xrpl::STObject const& node)
{
auto const& metaType = node.getFName();
auto const nodeType = node.getFieldU16(ripple::sfLedgerEntryType);
auto const nodeType = node.getFieldU16(xrpl::sfLedgerEntryType);
// we only care about ripple::ltOFFER objects being modified or
// we only care about xrpl::ltOFFER objects being modified or
// deleted
if (nodeType != ripple::ltOFFER || metaType == ripple::sfCreatedNode)
if (nodeType != xrpl::ltOFFER || metaType == xrpl::sfCreatedNode)
return;
// if either FF or PF are missing we can't compute
// but generally these are cancelled rather than crossed
// so skipping them is consistent
if (!node.isFieldPresent(ripple::sfFinalFields) ||
!node.isFieldPresent(ripple::sfPreviousFields))
if (!node.isFieldPresent(xrpl::sfFinalFields) ||
!node.isFieldPresent(xrpl::sfPreviousFields))
return;
auto const& finalFields =
node.peekAtField(ripple::sfFinalFields).downcast<ripple::STObject>();
node.peekAtField(xrpl::sfFinalFields).downcast<xrpl::STObject>();
auto const& previousFields =
node.peekAtField(ripple::sfPreviousFields).downcast<ripple::STObject>();
node.peekAtField(xrpl::sfPreviousFields).downcast<xrpl::STObject>();
// defensive case that should never be hit
if (!finalFields.isFieldPresent(ripple::sfTakerGets) ||
!finalFields.isFieldPresent(ripple::sfTakerPays) ||
!previousFields.isFieldPresent(ripple::sfTakerGets) ||
!previousFields.isFieldPresent(ripple::sfTakerPays))
if (!finalFields.isFieldPresent(xrpl::sfTakerGets) ||
!finalFields.isFieldPresent(xrpl::sfTakerPays) ||
!previousFields.isFieldPresent(xrpl::sfTakerGets) ||
!previousFields.isFieldPresent(xrpl::sfTakerPays))
return;
// filter out any offers deleted by explicit offer cancels
if (metaType == ripple::sfDeletedNode && offerCancel_ &&
finalFields.getFieldU32(ripple::sfSequence) == *offerCancel_)
if (metaType == xrpl::sfDeletedNode && offerCancel_ &&
finalFields.getFieldU32(xrpl::sfSequence) == *offerCancel_)
return;
// compute the difference in gets and pays actually
// affected onto the offer
auto const deltaGets = finalFields.getFieldAmount(ripple::sfTakerGets) -
previousFields.getFieldAmount(ripple::sfTakerGets);
auto const deltaPays = finalFields.getFieldAmount(ripple::sfTakerPays) -
previousFields.getFieldAmount(ripple::sfTakerPays);
auto const deltaGets = finalFields.getFieldAmount(xrpl::sfTakerGets) -
previousFields.getFieldAmount(xrpl::sfTakerGets);
auto const deltaPays = finalFields.getFieldAmount(xrpl::sfTakerPays) -
previousFields.getFieldAmount(xrpl::sfTakerPays);
transformAndStore(deltaGets, deltaPays, finalFields[~ripple::sfDomainID]);
transformAndStore(deltaGets, deltaPays, finalFields[~xrpl::sfDomainID]);
}
void
transformAndStore(
ripple::STAmount const& deltaGets,
ripple::STAmount const& deltaPays,
std::optional<ripple::uint256> const& domain
xrpl::STAmount const& deltaGets,
xrpl::STAmount const& deltaPays,
std::optional<xrpl::uint256> const& domain
)
{
auto const g = to_string(deltaGets.issue());
auto const p = to_string(deltaPays.issue());
auto const g = to_string(deltaGets.get<xrpl::Issue>());
auto const p = to_string(deltaPays.get<xrpl::Issue>());
auto const noswap = [&]() {
if (isXRP(deltaGets))
@@ -154,15 +154,15 @@ private:
auto second = noswap ? deltaPays : deltaGets;
// defensively programmed, should (probably) never happen
if (second == beast::zero)
if (second == beast::kZero)
return;
auto const rate = divide(first, second, ripple::noIssue());
auto const rate = divide(first, second, xrpl::noIssue());
if (first < beast::zero)
if (first < beast::kZero)
first = -first;
if (second < beast::zero)
if (second < beast::kZero)
second = -second;
auto const key = noswap ? (g + '|' + p) : (p + '|' + g);
@@ -197,24 +197,24 @@ private:
handleBookChange(data::TransactionAndMetadata const& blob)
{
auto const [tx, meta] = rpc::deserializeTxPlusMeta(blob);
if (!tx || !meta || !tx->isFieldPresent(ripple::sfTransactionType))
if (!tx || !meta || !tx->isFieldPresent(xrpl::sfTransactionType))
return;
offerCancel_ = shouldCancelOffer(tx);
for (auto const& node : meta->getFieldArray(ripple::sfAffectedNodes))
for (auto const& node : meta->getFieldArray(xrpl::sfAffectedNodes))
handleAffectedNode(node);
}
static std::optional<uint32_t>
shouldCancelOffer(std::shared_ptr<ripple::STTx const> const& tx)
shouldCancelOffer(std::shared_ptr<xrpl::STTx const> const& tx)
{
switch (tx->getFieldU16(ripple::sfTransactionType)) {
switch (tx->getFieldU16(xrpl::sfTransactionType)) {
// in future if any other ways emerge to cancel an offer
// this switch makes them easy to add
case ripple::ttOFFER_CANCEL:
case ripple::ttOFFER_CREATE:
if (tx->isFieldPresent(ripple::sfOfferSequence))
return tx->getFieldU32(ripple::sfOfferSequence);
case xrpl::ttOFFER_CANCEL:
case xrpl::ttOFFER_CREATE:
if (tx->isFieldPresent(xrpl::sfOfferSequence))
return tx->getFieldU32(xrpl::sfOfferSequence);
[[fallthrough]];
default:
return std::nullopt;
@@ -232,12 +232,12 @@ private:
inline void
tag_invoke(boost::json::value_from_tag, boost::json::value& jv, BookChange const& change)
{
auto amountStr = [](ripple::STAmount const& amount) -> std::string {
auto amountStr = [](xrpl::STAmount const& amount) -> std::string {
return isXRP(amount) ? to_string(amount.xrp()) : to_string(amount.iou());
};
auto currencyStr = [](ripple::STAmount const& amount) -> std::string {
return isXRP(amount) ? "XRP_drops" : to_string(amount.issue());
auto currencyStr = [](xrpl::STAmount const& amount) -> std::string {
return isXRP(amount) ? "XRP_drops" : to_string(amount.get<xrpl::Issue>());
};
jv = {
@@ -252,7 +252,7 @@ tag_invoke(boost::json::value_from_tag, boost::json::value& jv, BookChange const
};
if (change.domain.has_value())
jv.as_object()[JS(domain)] = ripple::to_string(*change.domain);
jv.as_object()[JS(domain)] = xrpl::to_string(*change.domain);
}
/**
@@ -264,7 +264,7 @@ tag_invoke(boost::json::value_from_tag, boost::json::value& jv, BookChange const
*/
[[nodiscard]] boost::json::object
computeBookChanges(
ripple::LedgerHeader const& lgrInfo,
xrpl::LedgerHeader const& lgrInfo,
std::vector<data::TransactionAndMetadata> const& transactions
);

View File

@@ -34,36 +34,36 @@
namespace rpc::credentials {
bool
checkExpired(ripple::SLE const& sleCred, ripple::LedgerHeader const& ledger)
checkExpired(xrpl::SLE const& sleCred, xrpl::LedgerHeader const& ledger)
{
if (sleCred.isFieldPresent(ripple::sfExpiration)) {
std::uint32_t const exp = sleCred.getFieldU32(ripple::sfExpiration);
if (sleCred.isFieldPresent(xrpl::sfExpiration)) {
std::uint32_t const exp = sleCred.getFieldU32(xrpl::sfExpiration);
std::uint32_t const now = ledger.parentCloseTime.time_since_epoch().count();
return now > exp;
}
return false;
}
std::set<std::pair<ripple::AccountID, ripple::Slice>>
createAuthCredentials(ripple::STArray const& in)
std::set<std::pair<xrpl::AccountID, xrpl::Slice>>
createAuthCredentials(xrpl::STArray const& in)
{
std::set<std::pair<ripple::AccountID, ripple::Slice>> out;
std::set<std::pair<xrpl::AccountID, xrpl::Slice>> out;
for (auto const& cred : in)
out.insert({cred[ripple::sfIssuer], cred[ripple::sfCredentialType]});
out.insert({cred[xrpl::sfIssuer], cred[xrpl::sfCredentialType]});
return out;
}
ripple::STArray
xrpl::STArray
parseAuthorizeCredentials(boost::json::array const& jv)
{
ripple::STArray arr;
xrpl::STArray arr;
for (auto const& jo : jv) {
ASSERT(
jo.at(JS(issuer)).is_string(),
"issuer must be string, should already be checked in AuthorizeCredentialValidator"
);
auto const issuer = ripple::parseBase58<ripple::AccountID>(
auto const issuer = xrpl::parseBase58<xrpl::AccountID>(
static_cast<std::string>(jo.at(JS(issuer)).as_string())
);
ASSERT(
@@ -77,18 +77,18 @@ parseAuthorizeCredentials(boost::json::array const& jv)
"AuthorizeCredentialValidator"
);
auto const credentialType =
ripple::strUnHex(static_cast<std::string>(jo.at(JS(credential_type)).as_string()));
xrpl::strUnHex(static_cast<std::string>(jo.at(JS(credential_type)).as_string()));
ASSERT(
credentialType.has_value(),
"credential_type must be present, should already be checked in "
"AuthorizeCredentialValidator."
);
auto credential = ripple::STObject::makeInnerObject(ripple::sfCredential);
auto credential = xrpl::STObject::makeInnerObject(xrpl::sfCredential);
// NOLINTBEGIN(bugprone-unchecked-optional-access)
credential.setAccountID(ripple::sfIssuer, *issuer);
credential.setFieldVL(ripple::sfCredentialType, *credentialType);
credential.setAccountID(xrpl::sfIssuer, *issuer);
credential.setFieldVL(xrpl::sfCredentialType, *credentialType);
// NOLINTEND(bugprone-unchecked-optional-access)
arr.push_back(std::move(credential));
@@ -97,16 +97,16 @@ parseAuthorizeCredentials(boost::json::array const& jv)
return arr;
}
std::expected<ripple::STArray, Status>
std::expected<xrpl::STArray, Status>
fetchCredentialArray(
std::optional<boost::json::array> const& credID,
ripple::AccountID const& srcAcc,
xrpl::AccountID const& srcAcc,
BackendInterface const& backend,
ripple::LedgerHeader const& info,
xrpl::LedgerHeader const& info,
boost::asio::yield_context const& yield
)
{
ripple::STArray authCreds;
xrpl::STArray authCreds;
std::unordered_set<std::string_view> elems;
for (auto const& elem : *credID) { // NOLINT(bugprone-unchecked-optional-access)
ASSERT(
@@ -114,41 +114,39 @@ fetchCredentialArray(
);
if (elems.contains(elem.as_string()))
return Error{Status{RippledError::rpcBAD_CREDENTIALS, "duplicates in credentials."}};
return Error{Status{RippledError::RpcBadCredentials, "duplicates in credentials."}};
elems.insert(elem.as_string());
ripple::uint256 credHash;
xrpl::uint256 credHash;
ASSERT(
credHash.parseHex(boost::json::value_to<std::string>(elem)),
"should already be checked in validators.hpp that elem is a uint256 hex"
);
auto const credKeylet = ripple::keylet::credential(credHash).key;
auto const credKeylet = xrpl::keylet::credential(credHash).key;
auto const credLedgerObject = backend.fetchLedgerObject(credKeylet, info.seq, yield);
if (!credLedgerObject)
return Error{Status{RippledError::rpcBAD_CREDENTIALS, "credentials don't exist."}};
return Error{Status{RippledError::RpcBadCredentials, "credentials don't exist."}};
auto credIt = ripple::SerialIter{credLedgerObject->data(), credLedgerObject->size()};
auto const sleCred = ripple::SLE{credIt, credKeylet};
auto credIt = xrpl::SerialIter{credLedgerObject->data(), credLedgerObject->size()};
auto const sleCred = xrpl::SLE{credIt, credKeylet};
if ((sleCred.getType() != ripple::ltCREDENTIAL) ||
((sleCred.getFieldU32(ripple::sfFlags) & ripple::lsfAccepted) == 0u))
return Error{Status{RippledError::rpcBAD_CREDENTIALS, "credentials aren't accepted"}};
if ((sleCred.getType() != xrpl::ltCREDENTIAL) ||
((sleCred.getFieldU32(xrpl::sfFlags) & xrpl::lsfAccepted) == 0u))
return Error{Status{RippledError::RpcBadCredentials, "credentials aren't accepted"}};
if (credentials::checkExpired(sleCred, info))
return Error{Status{RippledError::rpcBAD_CREDENTIALS, "credentials are expired"}};
return Error{Status{RippledError::RpcBadCredentials, "credentials are expired"}};
if (sleCred.getAccountID(ripple::sfSubject) != srcAcc) {
if (sleCred.getAccountID(xrpl::sfSubject) != srcAcc) {
return Error{Status{
RippledError::rpcBAD_CREDENTIALS, "credentials don't belong to the root account"
RippledError::RpcBadCredentials, "credentials don't belong to the root account"
}};
}
auto credential = ripple::STObject::makeInnerObject(ripple::sfCredential);
credential.setAccountID(ripple::sfIssuer, sleCred.getAccountID(ripple::sfIssuer));
credential.setFieldVL(
ripple::sfCredentialType, sleCred.getFieldVL(ripple::sfCredentialType)
);
auto credential = xrpl::STObject::makeInnerObject(xrpl::sfCredential);
credential.setAccountID(xrpl::sfIssuer, sleCred.getAccountID(xrpl::sfIssuer));
credential.setFieldVL(xrpl::sfCredentialType, sleCred.getFieldVL(xrpl::sfCredentialType));
authCreds.push_back(std::move(credential));
}

View File

@@ -28,7 +28,7 @@ namespace rpc::credentials {
* @return true if credential not expired, false otherwise
*/
bool
checkExpired(ripple::SLE const& sleCred, ripple::LedgerHeader const& ledger);
checkExpired(xrpl::SLE const& sleCred, xrpl::LedgerHeader const& ledger);
/**
* @brief Creates authentication credential field (which is a set of pairs of AccountID and
@@ -37,8 +37,8 @@ checkExpired(ripple::SLE const& sleCred, ripple::LedgerHeader const& ledger);
* @param in The array of Credential objects to check
* @return Auth Credential array
*/
std::set<std::pair<ripple::AccountID, ripple::Slice>>
createAuthCredentials(ripple::STArray const& in);
std::set<std::pair<xrpl::AccountID, xrpl::Slice>>
createAuthCredentials(xrpl::STArray const& in);
/**
* @brief Parses each credential object and makes sure the credential type and values are correct
@@ -46,7 +46,7 @@ createAuthCredentials(ripple::STArray const& in);
* @param jv The boost json array of credentials to parse
* @return Array of credentials after parsing
*/
ripple::STArray
xrpl::STArray
parseAuthorizeCredentials(boost::json::array const& jv);
/**
@@ -59,12 +59,12 @@ parseAuthorizeCredentials(boost::json::array const& jv);
* @param yield The coroutine context
* @return Array of credential objects, error if failed otherwise
*/
std::expected<ripple::STArray, Status>
std::expected<xrpl::STArray, Status>
fetchCredentialArray(
std::optional<boost::json::array> const& credID,
ripple::AccountID const& srcAcc,
xrpl::AccountID const& srcAcc,
BackendInterface const& backend,
ripple::LedgerHeader const& info,
xrpl::LedgerHeader const& info,
boost::asio::yield_context const& yield
);

View File

@@ -34,7 +34,7 @@ operator<<(std::ostream& stream, Status const& status)
if (!status.message.empty()) {
stream << ", Message: " << status.message;
} else {
stream << ", Message: " << ripple::RPC::get_error_info(err).message;
stream << ", Message: " << xrpl::RPC::getErrorInfo(err).message;
}
},
[&stream, &status](ClioError err) {
@@ -164,11 +164,11 @@ makeError(
)
{
boost::json::object json;
auto const& info = ripple::RPC::get_error_info(err);
auto const& info = xrpl::RPC::getErrorInfo(err);
json["error"] = customError.value_or(info.token.c_str()).data();
json["error"] = customError.value_or(info.token.cStr()).data();
json["error_code"] = static_cast<uint32_t>(err);
json["error_message"] = customMessage.value_or(info.message.c_str()).data();
json["error_message"] = customMessage.value_or(info.message.cStr()).data();
json["status"] = "error";
json["type"] = "response";
@@ -204,7 +204,7 @@ makeError(Status const& status)
auto res = visit(
util::OverloadSet{
[&status, &wrapOptional](RippledError err) {
if (err == ripple::rpcUNKNOWN) {
if (err == xrpl::RpcUnknown) {
return boost::json::object{
{"error", status.message}, {"type", "response"}, {"status", "error"}
};

View File

@@ -24,7 +24,7 @@ enum class ClioError {
RpcFieldNotFoundTransaction = 5006,
RpcMalformedOracleDocumentId = 5007,
RpcMalformedAuthorizedCredentials = 5008,
// NOTE: RpcEntryNotFound is replaced with RippledError::rpcENTRY_NOT_FOUND
// NOTE: RpcEntryNotFound is replaced with RippledError::RpcEntryNotFound
// RpcEntryNotFound = 5009,
// special system errors start with 6000
@@ -51,7 +51,7 @@ struct ClioErrorInfo {
};
/** @brief Clio uses compatible Rippled error codes for most RPC errors. */
using RippledError = ripple::error_code_i;
using RippledError = xrpl::ErrorCodeI;
/**
* @brief Clio operates on a combination of Rippled and Custom Clio error codes.
@@ -63,7 +63,7 @@ using CombinedError = std::variant<RippledError, ClioError>;
/** @brief A status returned from any RPC handler. */
struct Status {
CombinedError code = RippledError::rpcSUCCESS;
CombinedError code = RippledError::RpcSuccess;
std::string error;
std::string message;
std::optional<boost::json::object> extraInfo;
@@ -94,7 +94,7 @@ struct Status {
*
* @param message The message
*/
explicit Status(std::string message) : code(ripple::rpcUNKNOWN), message(std::move(message))
explicit Status(std::string message) : code(xrpl::RpcUnknown), message(std::move(message))
{
}
@@ -131,7 +131,7 @@ struct Status {
operator bool() const
{
if (auto err = std::get_if<RippledError>(&code))
return *err != RippledError::rpcSUCCESS;
return *err != RippledError::RpcSuccess;
return true;
}

View File

@@ -83,7 +83,7 @@ makeHttpContext(
if (command == "subscribe" || command == "unsubscribe") {
return Error{
{RippledError::rpcBAD_SYNTAX,
{RippledError::RpcBadSyntax,
"Subscribe and unsubscribe are only allowed for websocket."}
};
}

View File

@@ -2,11 +2,11 @@
#include <xrpl/protocol/jss.h>
/** @brief Helper macro for borrowing from ripple::jss static (J)son (S)trings. */
#define JS(x) ripple::jss::x.c_str()
/** @brief Helper macro for borrowing from xrpl::jss static (J)son (S)trings. */
#define JS(x) xrpl::jss::x.cStr()
/** @brief Access the lower case copy of a static (J)son (S)tring. */
#define JSL(x) util::toLower(JS(x))
/** @brief Provides access to (SF)ield name (S)trings. */
#define SFS(x) ripple::x.jsonName.c_str()
#define SFS(x) xrpl::x.jsonName.cStr()

View File

@@ -135,7 +135,7 @@ public:
if (forwardingProxy_.shouldForward(ctx)) {
// Disallow forwarding of the admin api, only user api is allowed for security reasons.
if (isAdminCmd(ctx.method, ctx.params))
return Result{Status{RippledError::rpcNO_PERMISSION}};
return Result{Status{RippledError::RpcNoPermission}};
return forwardingProxy_.forward(ctx);
}
@@ -148,13 +148,13 @@ public:
if (backend_->isTooBusy()) {
LOG(log_.error()) << "Database is too busy. Rejecting request";
notifyTooBusy(); // TODO: should we add ctx.method if we have it?
return Result{Status{RippledError::rpcTOO_BUSY}};
return Result{Status{RippledError::RpcTooBusy}};
}
auto const method = handlerProvider_->getHandler(ctx.method);
if (!method) {
notifyUnknownCommand();
return Result{Status{RippledError::rpcUNKNOWN_COMMAND}};
return Result{Status{RippledError::RpcUnknownCommand}};
}
try {
@@ -182,12 +182,12 @@ public:
LOG(log_.error()) << "Database timeout";
notifyTooBusy();
return Result{Status{RippledError::rpcTOO_BUSY}};
return Result{Status{RippledError::RpcTooBusy}};
} catch (std::exception const& ex) {
LOG(log_.error()) << ctx.tag() << "Caught exception: " << ex.what();
notifyInternalError();
return Result{Status{RippledError::rpcINTERNAL}};
return Result{Status{RippledError::RpcInternal}};
}
}
@@ -333,13 +333,13 @@ private:
if (backend_->isTooBusy()) {
LOG(log_.error()) << "Database is too busy. Rejecting request";
notifyTooBusy(); // TODO: should we add ctx.method if we have it?
return Result{Status{RippledError::rpcTOO_BUSY}};
return Result{Status{RippledError::RpcTooBusy}};
}
auto const method = handlerProvider_->getHandler(ctx.method);
if (!method) {
notifyUnknownCommand();
return Result{Status{RippledError::rpcUNKNOWN_COMMAND}};
return Result{Status{RippledError::RpcUnknownCommand}};
}
try {
@@ -365,12 +365,12 @@ private:
LOG(log_.error()) << "Database timeout";
notifyTooBusy();
return Result{Status{RippledError::rpcTOO_BUSY}};
return Result{Status{RippledError::RpcTooBusy}};
} catch (std::exception const& ex) {
LOG(log_.error()) << ctx.tag() << "Caught exception: " << ex.what();
notifyInternalError();
return Result{Status{RippledError::rpcINTERNAL}};
return Result{Status{RippledError::RpcInternal}};
}
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -69,12 +69,12 @@ namespace rpc {
enum class NFTokenjson { ENABLE, DISABLE };
/**
* @brief Get a ripple::AccountID from its string representation
* @brief Get a xrpl::AccountID from its string representation
*
* @param account The string representation of the account
* @return The account ID or std::nullopt if the string is not a valid account
*/
std::optional<ripple::AccountID>
std::optional<xrpl::AccountID>
accountFromStringStrict(std::string const& account);
/**
@@ -85,7 +85,7 @@ accountFromStringStrict(std::string const& account);
* @return true if the SLE is owned by the account
*/
bool
isOwnedByAccount(ripple::SLE const& sle, ripple::AccountID const& accountID);
isOwnedByAccount(xrpl::SLE const& sle, xrpl::AccountID const& accountID);
/**
* @brief Get the start hint for the account
@@ -95,7 +95,7 @@ isOwnedByAccount(ripple::SLE const& sle, ripple::AccountID const& accountID);
* @return The start hint
*/
std::uint64_t
getStartHint(ripple::SLE const& sle, ripple::AccountID const& accountID);
getStartHint(xrpl::SLE const& sle, xrpl::AccountID const& accountID);
/**
* @brief Parse the account cursor from the JSON
@@ -113,7 +113,7 @@ parseAccountCursor(std::optional<std::string> jsonCursor);
* @param blobs The TransactionAndMetadata to deserialize
* @return The deserialized objects
*/
std::pair<std::shared_ptr<ripple::STTx const>, std::shared_ptr<ripple::STObject const>>
std::pair<std::shared_ptr<xrpl::STTx const>, std::shared_ptr<xrpl::STObject const>>
deserializeTxPlusMeta(data::TransactionAndMetadata const& blobs);
// TODO this function should probably be in a different file and namespace
@@ -124,7 +124,7 @@ deserializeTxPlusMeta(data::TransactionAndMetadata const& blobs);
* @param seq The sequence number to set
* @return The deserialized objects
*/
std::pair<std::shared_ptr<ripple::STTx const>, std::shared_ptr<ripple::TxMeta const>>
std::pair<std::shared_ptr<xrpl::STTx const>, std::shared_ptr<xrpl::TxMeta const>>
deserializeTxPlusMeta(data::TransactionAndMetadata const& blobs, std::uint32_t seq);
/**
@@ -175,8 +175,8 @@ insertDeliverMaxAlias(boost::json::object& txJson, std::uint32_t apiVersion);
bool
insertDeliveredAmount(
boost::json::object& metaJson,
std::shared_ptr<ripple::STTx const> const& txn,
std::shared_ptr<ripple::TxMeta const> const& meta,
std::shared_ptr<xrpl::STTx const> const& txn,
std::shared_ptr<xrpl::TxMeta const> const& meta,
uint32_t date
);
@@ -195,9 +195,9 @@ insertDeliveredAmount(
bool
insertMPTIssuanceID(
boost::json::object& txnJson,
std::shared_ptr<ripple::STTx const> const& txn,
std::shared_ptr<xrpl::STTx const> const& txn,
boost::json::object& metaJson,
std::shared_ptr<ripple::TxMeta const> const& meta
std::shared_ptr<xrpl::TxMeta const> const& meta
);
/**
@@ -207,7 +207,7 @@ insertMPTIssuanceID(
* @return The JSON object
*/
boost::json::object
toJson(ripple::STBase const& obj);
toJson(xrpl::STBase const& obj);
/**
* @brief Convert SLE to JSON
@@ -216,7 +216,7 @@ toJson(ripple::STBase const& obj);
* @return The JSON object
*/
boost::json::object
toJson(ripple::SLE const& sle);
toJson(xrpl::SLE const& sle);
/**
* @brief Convert a LedgerHeader to JSON object.
@@ -227,7 +227,7 @@ toJson(ripple::SLE const& sle);
* @return The JSON object.
*/
boost::json::object
toJson(ripple::LedgerHeader const& info, bool binary, std::uint32_t apiVersion);
toJson(xrpl::LedgerHeader const& info, bool binary, std::uint32_t apiVersion);
/**
* @brief Convert a TxMeta to JSON object.
@@ -236,9 +236,9 @@ toJson(ripple::LedgerHeader const& info, bool binary, std::uint32_t apiVersion);
* @return The JSON object.
*/
boost::json::object
toJson(ripple::TxMeta const& meta);
toJson(xrpl::TxMeta const& meta);
using RippledJson = Json::Value;
using RippledJson = json::Value;
/**
* @brief Convert a RippledJson to boost::json::value
@@ -260,8 +260,8 @@ toBoostJson(RippledJson const& value);
*/
boost::json::object
generatePubLedgerMessage(
ripple::LedgerHeader const& lgrInfo,
ripple::Fees const& fees,
xrpl::LedgerHeader const& lgrInfo,
xrpl::Fees const& fees,
std::string const& ledgerRange,
std::uint32_t txnCount
);
@@ -273,7 +273,7 @@ generatePubLedgerMessage(
* @param ctx The context of the request
* @return The ledger info or an error status
*/
std::expected<ripple::LedgerHeader, Status>
std::expected<xrpl::LedgerHeader, Status>
ledgerHeaderFromRequest(
std::shared_ptr<data::BackendInterface const> const& backend,
web::Context const& ctx
@@ -289,7 +289,7 @@ ledgerHeaderFromRequest(
* @param maxSeq The maximum sequence to search
* @return The ledger info or an error status
*/
std::expected<ripple::LedgerHeader, Status>
std::expected<xrpl::LedgerHeader, Status>
getLedgerHeaderFromHashOrSeq(
BackendInterface const& backend,
boost::asio::yield_context yield,
@@ -314,13 +314,13 @@ getLedgerHeaderFromHashOrSeq(
std::expected<AccountCursor, Status>
traverseOwnedNodes(
BackendInterface const& backend,
ripple::Keylet const& owner,
ripple::uint256 const& hexMarker,
xrpl::Keylet const& owner,
xrpl::uint256 const& hexMarker,
std::uint32_t startHint,
std::uint32_t sequence,
std::uint32_t limit,
boost::asio::yield_context yield,
std::function<void(ripple::SLE)> atOwnedNode
std::function<void(xrpl::SLE)> atOwnedNode
);
/**
@@ -341,12 +341,12 @@ traverseOwnedNodes(
std::expected<AccountCursor, Status>
traverseOwnedNodes(
BackendInterface const& backend,
ripple::AccountID const& accountID,
xrpl::AccountID const& accountID,
std::uint32_t sequence,
std::uint32_t limit,
std::optional<std::string> jsonCursor,
boost::asio::yield_context yield,
std::function<void(ripple::SLE)> atOwnedNode,
std::function<void(xrpl::SLE)> atOwnedNode,
bool nftIncluded = false
);
@@ -359,11 +359,11 @@ traverseOwnedNodes(
* @param context The context of the request
* @return The SLE or nullptr if not found
*/
std::shared_ptr<ripple::SLE const>
std::shared_ptr<xrpl::SLE const>
read(
std::shared_ptr<data::BackendInterface const> const& backend,
ripple::Keylet const& keylet,
ripple::LedgerHeader const& lgrInfo,
xrpl::Keylet const& keylet,
xrpl::LedgerHeader const& lgrInfo,
web::Context const& context
);
@@ -373,7 +373,7 @@ read(
* @param transaction The transaction
* @return A vector of accounts associated with the transaction
*/
std::vector<ripple::AccountID>
std::vector<xrpl::AccountID>
getAccountsFromTransaction(boost::json::object const& transaction);
/**
@@ -384,7 +384,7 @@ getAccountsFromTransaction(boost::json::object const& transaction);
* @return The blob
*/
std::vector<unsigned char>
ledgerHeaderToBlob(ripple::LedgerHeader const& info, bool includeHash = false);
ledgerHeaderToBlob(xrpl::LedgerHeader const& info, bool includeHash = false);
/**
* @brief Whether global frozen is set
@@ -399,7 +399,7 @@ bool
isGlobalFrozen(
BackendInterface const& backend,
std::uint32_t seq,
ripple::AccountID const& issuer,
xrpl::AccountID const& issuer,
boost::asio::yield_context yield
);
@@ -418,9 +418,9 @@ bool
isFrozen(
BackendInterface const& backend,
std::uint32_t sequence,
ripple::AccountID const& account,
ripple::Currency const& currency,
ripple::AccountID const& issuer,
xrpl::AccountID const& account,
xrpl::Currency const& currency,
xrpl::AccountID const& issuer,
boost::asio::yield_context yield
);
@@ -438,7 +438,7 @@ bool
fetchAndCheckAnyFlagsExists(
BackendInterface const& backend,
std::uint32_t sequence,
ripple::Keylet const& keylet,
xrpl::Keylet const& keylet,
std::vector<std::uint32_t> const& flags,
boost::asio::yield_context yield
);
@@ -461,9 +461,9 @@ bool
isDeepFrozen(
BackendInterface const& backend,
std::uint32_t sequence,
ripple::AccountID const& account,
ripple::Currency const& currency,
ripple::AccountID const& issuer,
xrpl::AccountID const& account,
xrpl::Currency const& currency,
xrpl::AccountID const& issuer,
boost::asio::yield_context yield
);
@@ -482,9 +482,9 @@ bool
isLPTokenFrozen(
BackendInterface const& backend,
std::uint32_t sequence,
ripple::AccountID const& account,
ripple::Issue const& asset,
ripple::Issue const& asset2,
xrpl::AccountID const& account,
xrpl::Issue const& asset,
xrpl::Issue const& asset2,
boost::asio::yield_context yield
);
@@ -499,13 +499,13 @@ isLPTokenFrozen(
* @param yield The coroutine context
* @return The account funds
*/
ripple::STAmount
xrpl::STAmount
accountFunds(
BackendInterface const& backend,
data::AmendmentCenterInterface const& amendmentCenter,
std::uint32_t sequence,
ripple::STAmount const& amount,
ripple::AccountID const& id,
xrpl::STAmount const& amount,
xrpl::AccountID const& id,
boost::asio::yield_context yield
);
@@ -522,14 +522,14 @@ accountFunds(
* @param yield The coroutine context
* @return The amount account holds
*/
ripple::STAmount
xrpl::STAmount
accountHolds(
BackendInterface const& backend,
data::AmendmentCenterInterface const& amendmentCenter,
std::uint32_t sequence,
ripple::AccountID const& account,
ripple::Currency const& currency,
ripple::AccountID const& issuer,
xrpl::AccountID const& account,
xrpl::Currency const& currency,
xrpl::AccountID const& issuer,
bool zeroIfFrozen,
boost::asio::yield_context yield
);
@@ -546,13 +546,13 @@ accountHolds(
* @param yield The coroutine context
* @return The amount account holds
*/
ripple::STAmount
xrpl::STAmount
ammAccountHolds(
BackendInterface const& backend,
std::uint32_t sequence,
ripple::AccountID const& account,
ripple::Currency const& currency,
ripple::AccountID const& issuer,
xrpl::AccountID const& account,
xrpl::Currency const& currency,
xrpl::AccountID const& issuer,
bool const zeroIfFrozen,
boost::asio::yield_context yield
);
@@ -566,11 +566,11 @@ ammAccountHolds(
* @param yield The coroutine context
* @return The transfer rate
*/
ripple::Rate
xrpl::Rate
transferRate(
BackendInterface const& backend,
std::uint32_t sequence,
ripple::AccountID const& issuer,
xrpl::AccountID const& issuer,
boost::asio::yield_context yield
);
@@ -583,11 +583,11 @@ transferRate(
* @param yield The coroutine context
* @return The XRP liquidity
*/
ripple::XRPAmount
xrpl::XRPAmount
xrpLiquid(
BackendInterface const& backend,
std::uint32_t sequence,
ripple::AccountID const& id,
xrpl::AccountID const& id,
boost::asio::yield_context yield
);
@@ -606,8 +606,8 @@ xrpLiquid(
boost::json::array
postProcessOrderBook(
std::vector<data::LedgerObject> const& offers,
ripple::Book const& book,
ripple::AccountID const& takerID,
xrpl::Book const& book,
xrpl::AccountID const& takerID,
data::BackendInterface const& backend,
data::AmendmentCenterInterface const& amendmentCenter,
std::uint32_t ledgerSequence,
@@ -624,12 +624,12 @@ postProcessOrderBook(
* @param domain The domain
* @return The book or an error status
*/
std::expected<ripple::Book, Status>
std::expected<xrpl::Book, Status>
parseBook(
ripple::Currency pays,
ripple::AccountID payIssuer,
ripple::Currency gets,
ripple::AccountID getIssuer,
xrpl::Currency pays,
xrpl::AccountID payIssuer,
xrpl::Currency gets,
xrpl::AccountID getIssuer,
std::optional<std::string> const& domain
);
@@ -639,7 +639,7 @@ parseBook(
* @param request The request
* @return The book or an error status
*/
std::expected<ripple::Book, Status>
std::expected<xrpl::Book, Status>
parseBook(boost::json::object const& request);
/**
@@ -648,17 +648,17 @@ parseBook(boost::json::object const& request);
* @param taker The taker as json
* @return The taker account or an error status
*/
std::expected<ripple::AccountID, Status>
std::expected<xrpl::AccountID, Status>
parseTaker(boost::json::value const& taker);
/**
* @brief Parse the json object into a ripple::Issue object.
* @brief Parse the json object into a xrpl::Issue object.
* @param issue The json object to parse. The accepted format is { "currency" : "USD", "issuer" :
* "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59" } or {"currency" : "XRP"}
* @return The ripple::Issue object.
* @exception raise Json::error exception if the json object is not in the accepted format.
* @return The xrpl::Issue object.
* @exception raise json::error exception if the json object is not in the accepted format.
*/
ripple::Issue
xrpl::Issue
parseIssue(boost::json::object const& issue);
/**
@@ -685,7 +685,7 @@ isAdminCmd(std::string const& method, boost::json::object const& request);
* @param request The request
* @return The NFTID or an error status
*/
std::expected<ripple::uint256, Status>
std::expected<xrpl::uint256, Status>
getNFTID(boost::json::object const& request);
/**
@@ -786,7 +786,7 @@ logDuration(
* @param value JSON value to parse from
* @return The parsed seed if successful; std::nullopt otherwise
*/
std::optional<ripple::Seed>
std::optional<xrpl::Seed>
parseRippleLibSeed(boost::json::value const& value);
/**
@@ -805,11 +805,11 @@ std::expected<AccountCursor, Status>
traverseNFTObjects(
BackendInterface const& backend,
std::uint32_t sequence,
ripple::AccountID const& accountID,
ripple::uint256 nextPage,
xrpl::AccountID const& accountID,
xrpl::uint256 nextPage,
std::uint32_t limit,
boost::asio::yield_context yield,
std::function<void(ripple::SLE)> atOwnedNode
std::function<void(xrpl::SLE)> atOwnedNode
);
/**
@@ -830,8 +830,8 @@ parseStringAsUInt(std::string const& value); // TODO: move to string utils or s
*/
bool
canHaveDeliveredAmount(
std::shared_ptr<ripple::STTx const> const& txn,
std::shared_ptr<ripple::TxMeta const> const& meta
std::shared_ptr<xrpl::STTx const> const& txn,
std::shared_ptr<xrpl::TxMeta const> const& meta
);
/**
@@ -843,10 +843,10 @@ canHaveDeliveredAmount(
* @param date The date of the ledger
* @return The delivered amount or std::nullopt if not available
*/
std::optional<ripple::STAmount>
std::optional<xrpl::STAmount>
getDeliveredAmount(
std::shared_ptr<ripple::STTx const> const& txn,
std::shared_ptr<ripple::TxMeta const> const& meta,
std::shared_ptr<xrpl::STTx const> const& txn,
std::shared_ptr<xrpl::TxMeta const> const& meta,
std::uint32_t ledgerSequence,
uint32_t date
);

View File

@@ -36,11 +36,11 @@ ValidateArrayAt::verify(boost::json::value& value, std::string_view key) const
return {}; // ignore. field does not exist, let 'required' fail instead
if (not value.as_object().at(key).is_array())
return Error{Status{RippledError::rpcINVALID_PARAMS}};
return Error{Status{RippledError::RpcInvalidParams}};
auto& arr = value.as_object().at(key).as_array();
if (idx_ >= arr.size())
return Error{Status{RippledError::rpcINVALID_PARAMS}};
return Error{Status{RippledError::RpcInvalidParams}};
auto& res = arr.at(idx_);
for (auto const& spec : specs_) {

View File

@@ -110,12 +110,12 @@ struct ToNumber final {
auto const strInt = boost::json::value_to<std::string>(value.as_object().at(key));
if (strInt.contains('.'))
return Error{Status{RippledError::rpcINVALID_PARAMS}}; // maybe a float
return Error{Status{RippledError::RpcInvalidParams}}; // maybe a float
try {
value.as_object()[key] = std::stoi(strInt);
} catch (std::exception& e) {
return Error{Status{RippledError::rpcINVALID_PARAMS}};
return Error{Status{RippledError::RpcInvalidParams}};
}
return {};
}

View File

@@ -149,7 +149,7 @@ struct Result {
* @brief A cursor object used to traverse nodes owned by an account.
*/
struct AccountCursor {
ripple::uint256 index;
xrpl::uint256 index;
std::uint32_t hint{};
/**
@@ -160,7 +160,7 @@ struct AccountCursor {
[[nodiscard]] std::string
toString() const
{
return ripple::strHex(index) + "," + std::to_string(hint);
return xrpl::strHex(index) + "," + std::to_string(hint);
}
/**

View File

@@ -33,7 +33,7 @@ Required::verify(boost::json::value const& value, std::string_view key)
{
if (not value.is_object() or not value.as_object().contains(key)) {
return Error{Status{
RippledError::rpcINVALID_PARAMS, "Required field '" + std::string{key} + "' missing"
RippledError::RpcInvalidParams, "Required field '" + std::string{key} + "' missing"
}};
}
@@ -49,12 +49,12 @@ TimeFormatValidator::verify(boost::json::value const& value, std::string_view ke
return {}; // ignore. field does not exist, let 'required' fail instead
if (not value.as_object().at(key).is_string())
return Error{Status{RippledError::rpcINVALID_PARAMS}};
return Error{Status{RippledError::RpcInvalidParams}};
auto const ret =
util::systemTpFromUtcStr(value_to<std::string>(value.as_object().at(key)), format_);
if (!ret)
return Error{Status{RippledError::rpcINVALID_PARAMS}};
return Error{Status{RippledError::RpcInvalidParams}};
return {};
}
@@ -79,22 +79,22 @@ checkIsU32Numeric(std::string_view sv)
CustomValidator CustomValidators::uint160HexStringValidator =
CustomValidator{[](boost::json::value const& value, std::string_view key) -> MaybeError {
return makeHexStringValidator<ripple::uint160>(value, key);
return makeHexStringValidator<xrpl::uint160>(value, key);
}};
CustomValidator CustomValidators::uint192HexStringValidator =
CustomValidator{[](boost::json::value const& value, std::string_view key) -> MaybeError {
return makeHexStringValidator<ripple::uint192>(value, key);
return makeHexStringValidator<xrpl::uint192>(value, key);
}};
CustomValidator CustomValidators::uint256HexStringValidator =
CustomValidator{[](boost::json::value const& value, std::string_view key) -> MaybeError {
return makeHexStringValidator<ripple::uint256>(value, key);
return makeHexStringValidator<xrpl::uint256>(value, key);
}};
CustomValidator CustomValidators::ledgerIndexValidator =
CustomValidator{[](boost::json::value const& value, std::string_view /* key */) -> MaybeError {
auto err = Error{Status{RippledError::rpcINVALID_PARAMS, "ledgerIndexMalformed"}};
auto err = Error{Status{RippledError::RpcInvalidParams, "ledgerIndexMalformed"}};
if (!value.is_string() && !(value.is_uint64() || value.is_int64()))
return err;
@@ -110,15 +110,15 @@ CustomValidator CustomValidators::ledgerTypeValidator =
CustomValidator{[](boost::json::value const& value, std::string_view key) -> MaybeError {
if (!value.is_string()) {
return Error{Status{
RippledError::rpcINVALID_PARAMS, fmt::format("Invalid field '{}', not string.", key)
RippledError::RpcInvalidParams, fmt::format("Invalid field '{}', not string.", key)
}};
}
auto const type =
util::LedgerTypes::getLedgerEntryTypeFromStr(boost::json::value_to<std::string>(value));
if (type == ripple::ltANY) {
if (type == xrpl::ltANY) {
return Error{
Status{RippledError::rpcINVALID_PARAMS, fmt::format("Invalid field '{}'.", key)}
Status{RippledError::RpcInvalidParams, fmt::format("Invalid field '{}'.", key)}
};
}
@@ -128,12 +128,12 @@ CustomValidator CustomValidators::ledgerTypeValidator =
CustomValidator CustomValidators::accountValidator =
CustomValidator{[](boost::json::value const& value, std::string_view key) -> MaybeError {
if (!value.is_string())
return Error{Status{RippledError::rpcINVALID_PARAMS, std::string(key) + "NotString"}};
return Error{Status{RippledError::RpcInvalidParams, std::string(key) + "NotString"}};
// TODO: we are using accountFromStringStrict from RPCHelpers, after we
// remove all old handler, this function can be moved to here
if (!accountFromStringStrict(boost::json::value_to<std::string>(value)))
return Error{Status{RippledError::rpcACT_MALFORMED, std::string(key) + "Malformed"}};
return Error{Status{RippledError::RpcActMalformed, std::string(key) + "Malformed"}};
return MaybeError{};
}};
@@ -141,10 +141,10 @@ CustomValidator CustomValidators::accountValidator =
CustomValidator CustomValidators::accountBase58Validator =
CustomValidator{[](boost::json::value const& value, std::string_view key) -> MaybeError {
if (!value.is_string())
return Error{Status{RippledError::rpcINVALID_PARAMS, std::string(key) + "NotString"}};
return Error{Status{RippledError::RpcInvalidParams, std::string(key) + "NotString"}};
auto const account =
util::parseBase58Wrapper<ripple::AccountID>(boost::json::value_to<std::string>(value));
util::parseBase58Wrapper<xrpl::AccountID>(boost::json::value_to<std::string>(value));
if (!account || account->isZero())
return Error{Status{ClioError::RpcMalformedAddress}};
@@ -154,13 +154,13 @@ CustomValidator CustomValidators::accountBase58Validator =
CustomValidator CustomValidators::accountMarkerValidator =
CustomValidator{[](boost::json::value const& value, std::string_view key) -> MaybeError {
if (!value.is_string())
return Error{Status{RippledError::rpcINVALID_PARAMS, std::string(key) + "NotString"}};
return Error{Status{RippledError::RpcInvalidParams, std::string(key) + "NotString"}};
// TODO: we are using parseAccountCursor from RPCHelpers, after we
// remove all old handler, this function can be moved to here
if (!parseAccountCursor(boost::json::value_to<std::string>(value))) {
// align with the current error message
return Error{Status{RippledError::rpcINVALID_PARAMS, "Malformed cursor."}};
return Error{Status{RippledError::RpcInvalidParams, "Malformed cursor."}};
}
return MaybeError{};
@@ -170,16 +170,16 @@ CustomValidator CustomValidators::accountTypeValidator =
CustomValidator{[](boost::json::value const& value, std::string_view key) -> MaybeError {
if (!value.is_string()) {
return Error{Status{
RippledError::rpcINVALID_PARAMS, fmt::format("Invalid field '{}', not string.", key)
RippledError::RpcInvalidParams, fmt::format("Invalid field '{}', not string.", key)
}};
}
auto const type = util::LedgerTypes::getAccountOwnedLedgerTypeFromStr(
boost::json::value_to<std::string>(value)
);
if (type == ripple::ltANY) {
if (type == xrpl::ltANY) {
return Error{
Status{RippledError::rpcINVALID_PARAMS, fmt::format("Invalid field '{}'.", key)}
Status{RippledError::RpcInvalidParams, fmt::format("Invalid field '{}'.", key)}
};
}
@@ -189,14 +189,14 @@ CustomValidator CustomValidators::accountTypeValidator =
CustomValidator CustomValidators::currencyValidator =
CustomValidator{[](boost::json::value const& value, std::string_view key) -> MaybeError {
if (!value.is_string())
return Error{Status{RippledError::rpcINVALID_PARAMS, std::string(key) + "NotString"}};
return Error{Status{RippledError::RpcInvalidParams, std::string(key) + "NotString"}};
auto const currencyStr = boost::json::value_to<std::string>(value);
if (currencyStr.empty())
return Error{Status{RippledError::rpcINVALID_PARAMS, std::string(key) + "IsEmpty"}};
return Error{Status{RippledError::RpcInvalidParams, std::string(key) + "IsEmpty"}};
ripple::Currency currency;
if (!ripple::to_currency(currency, currencyStr))
xrpl::Currency currency;
if (!xrpl::toCurrency(currency, currencyStr))
return Error{Status{ClioError::RpcMalformedCurrency, "malformedCurrency"}};
return MaybeError{};
@@ -205,20 +205,20 @@ CustomValidator CustomValidators::currencyValidator =
CustomValidator CustomValidators::issuerValidator =
CustomValidator{[](boost::json::value const& value, std::string_view key) -> MaybeError {
if (!value.is_string())
return Error{Status{RippledError::rpcINVALID_PARAMS, std::string(key) + "NotString"}};
return Error{Status{RippledError::RpcInvalidParams, std::string(key) + "NotString"}};
ripple::AccountID issuer;
xrpl::AccountID issuer;
// TODO: need to align with the error
if (!ripple::to_issuer(issuer, boost::json::value_to<std::string>(value))) {
if (!xrpl::toIssuer(issuer, boost::json::value_to<std::string>(value))) {
return Error{Status{
RippledError::rpcINVALID_PARAMS, fmt::format("Invalid field '{}', bad issuer.", key)
RippledError::RpcInvalidParams, fmt::format("Invalid field '{}', bad issuer.", key)
}};
}
if (issuer == ripple::noAccount()) {
if (issuer == xrpl::noAccount()) {
return Error{Status{
RippledError::rpcINVALID_PARAMS,
RippledError::RpcInvalidParams,
fmt::format("Invalid field '{}', bad issuer account one.", key)
}};
}
@@ -229,7 +229,7 @@ CustomValidator CustomValidators::issuerValidator =
CustomValidator CustomValidators::subscribeStreamValidator =
CustomValidator{[](boost::json::value const& value, std::string_view key) -> MaybeError {
if (!value.is_array())
return Error{Status{RippledError::rpcINVALID_PARAMS, std::string(key) + "NotArray"}};
return Error{Status{RippledError::RpcInvalidParams, std::string(key) + "NotArray"}};
static std::unordered_set<std::string> const kValidStreams = {
"ledger",
@@ -245,13 +245,13 @@ CustomValidator CustomValidators::subscribeStreamValidator =
};
for (auto const& v : value.as_array()) {
if (!v.is_string())
return Error{Status{RippledError::rpcINVALID_PARAMS, "streamNotString"}};
return Error{Status{RippledError::RpcInvalidParams, "streamNotString"}};
if (kNotSupportStreams.contains(boost::json::value_to<std::string>(v)))
return Error{Status{RippledError::rpcNOT_SUPPORTED}};
return Error{Status{RippledError::RpcNotSupported}};
if (not kValidStreams.contains(boost::json::value_to<std::string>(v)))
return Error{Status{RippledError::rpcSTREAM_MALFORMED}};
return Error{Status{RippledError::RpcStreamMalformed}};
}
return MaybeError{};
@@ -260,10 +260,10 @@ CustomValidator CustomValidators::subscribeStreamValidator =
CustomValidator CustomValidators::subscribeAccountsValidator =
CustomValidator{[](boost::json::value const& value, std::string_view key) -> MaybeError {
if (!value.is_array())
return Error{Status{RippledError::rpcINVALID_PARAMS, std::string(key) + "NotArray"}};
return Error{Status{RippledError::RpcInvalidParams, std::string(key) + "NotArray"}};
if (value.as_array().empty())
return Error{Status{RippledError::rpcACT_MALFORMED, std::string(key) + " malformed."}};
return Error{Status{RippledError::RpcActMalformed, std::string(key) + " malformed."}};
for (auto const& v : value.as_array()) {
auto obj = boost::json::object();
@@ -281,7 +281,7 @@ CustomValidator CustomValidators::subscribeAccountsValidator =
CustomValidator CustomValidators::currencyIssueValidator =
CustomValidator{[](boost::json::value const& value, std::string_view key) -> MaybeError {
if (not value.is_object())
return Error{Status{RippledError::rpcINVALID_PARAMS, std::string(key) + "NotObject"}};
return Error{Status{RippledError::RpcInvalidParams, std::string(key) + "NotObject"}};
try {
parseIssue(value.as_object());
@@ -300,7 +300,7 @@ CustomValidator CustomValidators::credentialTypeValidator =
}};
}
auto const& credTypeHex = ripple::strViewUnHex(value.as_string());
auto const& credTypeHex = xrpl::strViewUnHex(value.as_string());
if (!credTypeHex.has_value()) {
return Error{Status{
ClioError::RpcMalformedAuthorizedCredentials, std::string(key) + " NotHexString"
@@ -313,7 +313,7 @@ CustomValidator CustomValidators::credentialTypeValidator =
};
}
if (credTypeHex->size() > ripple::maxCredentialTypeLength) {
if (credTypeHex->size() > xrpl::kMaxCredentialTypeLength) {
return Error{Status{
ClioError::RpcMalformedAuthorizedCredentials,
std::string(key) + " greater than max length"
@@ -336,12 +336,12 @@ CustomValidator CustomValidators::authorizeCredentialValidator =
}};
}
if (authCred.size() > ripple::maxCredentialsArraySize) {
if (authCred.size() > xrpl::kMaxCredentialsArraySize) {
return Error{Status{
ClioError::RpcMalformedAuthorizedCredentials,
fmt::format(
"Max {} number of credentials in authorized_credentials array",
ripple::maxCredentialsArraySize
xrpl::kMaxCredentialsArraySize
)
}};
}

View File

@@ -69,7 +69,7 @@ public:
*
* @param value The JSON value representing the outer object
* @param key The key used to retrieve the tested value from the outer object
* @return `RippledError::rpcNOT_SUPPORTED` if the value matched; otherwise no error is returned
* @return `RippledError::RpcNotSupported` if the value matched; otherwise no error is returned
*/
[[nodiscard]] MaybeError
verify(boost::json::value const& value, std::string_view key) const
@@ -79,7 +79,7 @@ public:
auto const res = value_to<T>(value.as_object().at(key));
if (value_ == res) {
return Error{Status{
RippledError::rpcNOT_SUPPORTED,
RippledError::RpcNotSupported,
fmt::format("Not supported field '{}'s value '{}'", std::string{key}, res)
}};
}
@@ -99,7 +99,7 @@ public:
*
* @param value The JSON value representing the outer object
* @param key The key used to retrieve the tested value from the outer object
* @return `RippledError::rpcNOT_SUPPORTED` if the field is found; otherwise no error is
* @return `RippledError::RpcNotSupported` if the field is found; otherwise no error is
* returned
*/
[[nodiscard]] static MaybeError
@@ -107,7 +107,7 @@ public:
{
if (value.is_object() and value.as_object().contains(key)) {
return Error{Status{
RippledError::rpcNOT_SUPPORTED, "Not supported field '" + std::string{key} + '\''
RippledError::RpcNotSupported, "Not supported field '" + std::string{key} + '\''
}};
}
@@ -133,7 +133,7 @@ struct Type final {
*
* @param value The JSON value representing the outer object
* @param key The key used to retrieve the tested value from the outer object
* @return `RippledError::rpcINVALID_PARAMS` if validation failed; otherwise no error is
* @return `RippledError::RpcInvalidParams` if validation failed; otherwise no error is
* returned
*/
[[nodiscard]] MaybeError
@@ -146,7 +146,7 @@ struct Type final {
auto const convertible = (checkTypeAndClamp<Types>(res) || ...);
if (not convertible)
return Error{Status{RippledError::rpcINVALID_PARAMS}};
return Error{Status{RippledError::RpcInvalidParams}};
return {};
}
@@ -176,7 +176,7 @@ public:
*
* @param value The JSON value representing the outer object
* @param key The key used to retrieve the tested value from the outer object
* @return `RippledError::rpcINVALID_PARAMS` if validation failed; otherwise no error is
* @return `RippledError::RpcInvalidParams` if validation failed; otherwise no error is
* returned
*/
[[nodiscard]] MaybeError
@@ -192,7 +192,7 @@ public:
// TODO: may want a way to make this code more generic (e.g. use a free
// function that can be overridden for this comparison)
if (res < min_ || res > max_)
return Error{Status{RippledError::rpcINVALID_PARAMS}};
return Error{Status{RippledError::RpcInvalidParams}};
return {};
}
@@ -220,7 +220,7 @@ public:
*
* @param value The JSON value representing the outer object
* @param key The key used to retrieve the tested value from the outer object
* @return `RippledError::rpcINVALID_PARAMS` if validation failed; otherwise no error is
* @return `RippledError::RpcInvalidParams` if validation failed; otherwise no error is
* returned
*/
[[nodiscard]] MaybeError
@@ -234,7 +234,7 @@ public:
auto const res = value_to<Type>(value.as_object().at(key));
if (res < min_)
return Error{Status{RippledError::rpcINVALID_PARAMS}};
return Error{Status{RippledError::RpcInvalidParams}};
return {};
}
@@ -262,7 +262,7 @@ public:
*
* @param value The JSON value representing the outer object
* @param key The key used to retrieve the tested value from the outer object
* @return `RippledError::rpcINVALID_PARAMS` if validation failed; otherwise no error is
* @return `RippledError::RpcInvalidParams` if validation failed; otherwise no error is
* returned
*/
[[nodiscard]] MaybeError
@@ -276,7 +276,7 @@ public:
auto const res = value_to<Type>(value.as_object().at(key));
if (res > max_)
return Error{Status{RippledError::rpcINVALID_PARAMS}};
return Error{Status{RippledError::RpcInvalidParams}};
return {};
}
@@ -303,7 +303,7 @@ public:
*
* @param value The JSON value representing the outer object
* @param key The key used to retrieve the tested value from the outer object
* @return `RippledError::rpcINVALID_PARAMS` if validation failed; otherwise no error is
* @return `RippledError::RpcInvalidParams` if validation failed; otherwise no error is
* returned
*/
[[nodiscard]] MaybeError
@@ -332,7 +332,7 @@ public:
*
* @param value The JSON value representing the outer object
* @param key The key used to retrieve the tested value from the outer object
* @return `RippledError::rpcINVALID_PARAMS` if validation failed; otherwise no error is
* @return `RippledError::RpcInvalidParams` if validation failed; otherwise no error is
* returned
*/
[[nodiscard]] MaybeError
@@ -345,7 +345,7 @@ public:
auto const res = value_to<Type>(value.as_object().at(key));
if (res != original_)
return Error{Status{RippledError::rpcINVALID_PARAMS}};
return Error{Status{RippledError::RpcInvalidParams}};
return {};
}
@@ -389,7 +389,7 @@ public:
*
* @param value The JSON value representing the outer object
* @param key The key used to retrieve the tested value from the outer object
* @return `RippledError::rpcINVALID_PARAMS` if validation failed; otherwise no error is
* @return `RippledError::RpcInvalidParams` if validation failed; otherwise no error is
* returned
*/
[[nodiscard]] MaybeError
@@ -403,7 +403,7 @@ public:
auto const res = value_to<Type>(value.as_object().at(key));
if (std::find(std::begin(options_), std::end(options_), res) == std::end(options_)) {
return Error{
Status{RippledError::rpcINVALID_PARAMS, fmt::format("Invalid field '{}'.", key)}
Status{RippledError::RpcInvalidParams, fmt::format("Invalid field '{}'.", key)}
};
}
@@ -460,18 +460,18 @@ checkIsU32Numeric(std::string_view sv);
template <class HexType>
requires(
std::is_same_v<HexType, ripple::uint160> || std::is_same_v<HexType, ripple::uint192> ||
std::is_same_v<HexType, ripple::uint256>
std::is_same_v<HexType, xrpl::uint160> || std::is_same_v<HexType, xrpl::uint192> ||
std::is_same_v<HexType, xrpl::uint256>
)
MaybeError
makeHexStringValidator(boost::json::value const& value, std::string_view key)
{
if (!value.is_string())
return Error{Status{RippledError::rpcINVALID_PARAMS, std::string(key) + "NotString"}};
return Error{Status{RippledError::RpcInvalidParams, std::string(key) + "NotString"}};
HexType parsedInt;
if (!parsedInt.parseHex(value.as_string().c_str()))
return Error{Status{RippledError::rpcINVALID_PARAMS, std::string(key) + "Malformed"}};
return Error{Status{RippledError::RpcInvalidParams, std::string(key) + "Malformed"}};
return MaybeError{};
}
@@ -574,7 +574,7 @@ struct CustomValidators final {
static CustomValidator subscribeAccountsValidator;
/**
* @brief Validates an asset (ripple::Issue).
* @brief Validates an asset (xrpl::Issue).
*
* Used by amm_info.
*/
@@ -605,7 +605,7 @@ struct Hex256ItemType final {
*
* @param value the value to verify
* @param key The key used to retrieve the tested value from the outer object
* @return `RippledError::rpcINVALID_PARAMS` if validation failed; otherwise no error is
* @return `RippledError::RpcInvalidParams` if validation failed; otherwise no error is
* returned
*/
[[nodiscard]] static MaybeError
@@ -618,10 +618,10 @@ struct Hex256ItemType final {
// loop through each item in the array and make sure it is uint256 hex string
for (auto const& elem : res.as_array()) {
ripple::uint256 num;
xrpl::uint256 num;
if (!elem.is_string() || !num.parseHex(elem.as_string())) {
return Error{
Status{RippledError::rpcINVALID_PARAMS, "Item is not a valid uint256 type."}
Status{RippledError::RpcInvalidParams, "Item is not a valid uint256 type."}
};
}
}

View File

@@ -43,7 +43,7 @@
namespace {
std::string
toIso8601(ripple::NetClock::time_point tp)
toIso8601(xrpl::NetClock::time_point tp)
{
using namespace std::chrono;
static constexpr auto kRippleEpochOffset = seconds{kRippleEpochStart};
@@ -63,19 +63,19 @@ namespace rpc {
AMMInfoHandler::Result
AMMInfoHandler::process(AMMInfoHandler::Input const& input, Context const& ctx) const
{
using namespace ripple;
using namespace xrpl;
auto const hasInvalidParams = [&input] {
// no asset/asset2 can be specified if amm account is specified
if (input.ammAccount)
return input.issue1 != ripple::noIssue() || input.issue2 != ripple::noIssue();
return input.issue1 != xrpl::noIssue() || input.issue2 != xrpl::noIssue();
// both assets must be specified when amm account is not specified
return input.issue1 == ripple::noIssue() || input.issue2 == ripple::noIssue();
return input.issue1 == xrpl::noIssue() || input.issue2 == xrpl::noIssue();
}();
if (hasInvalidParams)
return Error{Status{RippledError::rpcINVALID_PARAMS}};
return Error{Status{RippledError::RpcInvalidParams}};
auto const range = sharedPtrBackend_->fetchLedgerRange();
ASSERT(range.has_value(), "AMMInfo's ledger range must be available");
@@ -96,23 +96,23 @@ AMMInfoHandler::process(AMMInfoHandler::Input const& input, Context const& ctx)
if (input.accountID) {
auto keylet = keylet::account(*input.accountID);
if (not sharedPtrBackend_->fetchLedgerObject(keylet.key, lgrInfo.seq, ctx.yield))
return Error{Status{RippledError::rpcACT_NOT_FOUND}};
return Error{Status{RippledError::RpcActNotFound}};
}
ripple::uint256 ammID;
xrpl::uint256 ammID;
if (input.ammAccount) {
auto const accountKeylet = keylet::account(*input.ammAccount);
auto const accountLedgerObject =
sharedPtrBackend_->fetchLedgerObject(accountKeylet.key, lgrInfo.seq, ctx.yield);
if (not accountLedgerObject)
return Error{Status{RippledError::rpcACT_MALFORMED}};
ripple::STLedgerEntry const sle{
ripple::SerialIter{accountLedgerObject->data(), accountLedgerObject->size()},
return Error{Status{RippledError::RpcActMalformed}};
xrpl::STLedgerEntry const sle{
xrpl::SerialIter{accountLedgerObject->data(), accountLedgerObject->size()},
accountKeylet.key
};
if (not sle.isFieldPresent(ripple::sfAMMID))
return Error{Status{RippledError::rpcACT_NOT_FOUND}};
ammID = sle.getFieldH256(ripple::sfAMMID);
if (not sle.isFieldPresent(xrpl::sfAMMID))
return Error{Status{RippledError::RpcActNotFound}};
ammID = sle.getFieldH256(xrpl::sfAMMID);
}
auto issue1 = input.issue1;
@@ -122,7 +122,7 @@ AMMInfoHandler::process(AMMInfoHandler::Input const& input, Context const& ctx)
sharedPtrBackend_->fetchLedgerObject(ammKeylet.key, lgrInfo.seq, ctx.yield);
if (not ammBlob)
return Error{Status{RippledError::rpcACT_NOT_FOUND}};
return Error{Status{RippledError::RpcActNotFound}};
auto const amm = SLE{SerialIter{ammBlob->data(), ammBlob->size()}, ammKeylet.key};
auto const ammAccountID = amm.getAccountID(sfAccount);
@@ -130,12 +130,12 @@ AMMInfoHandler::process(AMMInfoHandler::Input const& input, Context const& ctx)
keylet::account(ammAccountID).key, lgrInfo.seq, ctx.yield
);
if (not accBlob)
return Error{Status{RippledError::rpcACT_NOT_FOUND}};
return Error{Status{RippledError::RpcActNotFound}};
// If the issue1 and issue2 are not specified, we need to get them from the AMM.
// Otherwise we preserve the mapping of asset1 -> issue1 and asset2 -> issue2 as requested by
// the user.
if (issue1 == ripple::noIssue() and issue2 == ripple::noIssue()) {
if (issue1 == xrpl::noIssue() and issue2 == xrpl::noIssue()) {
issue1 = amm[sfAsset].get<Issue>();
issue2 = amm[sfAsset2].get<Issue>();
}
@@ -156,10 +156,10 @@ AMMInfoHandler::process(AMMInfoHandler::Input const& input, Context const& ctx)
Output response;
response.ledgerIndex = lgrInfo.seq;
response.ledgerHash = ripple::strHex(lgrInfo.hash);
response.amount1 = toBoostJson(asset1Balance.getJson(JsonOptions::none));
response.amount2 = toBoostJson(asset2Balance.getJson(JsonOptions::none));
response.lpToken = toBoostJson(lptAMMBalance.getJson(JsonOptions::none));
response.ledgerHash = xrpl::strHex(lgrInfo.hash);
response.amount1 = toBoostJson(asset1Balance.getJson(JsonOptions::Values::None));
response.amount2 = toBoostJson(asset2Balance.getJson(JsonOptions::Values::None));
response.lpToken = toBoostJson(lptAMMBalance.getJson(JsonOptions::Values::None));
response.tradingFee = amm[sfTradingFee];
response.ammAccount = to_string(ammAccountID);
@@ -181,8 +181,9 @@ AMMInfoHandler::process(AMMInfoHandler::Input const& input, Context const& ctx)
auto const timeSlot =
ammAuctionTimeSlot(lgrInfo.parentCloseTime.time_since_epoch().count(), auctionSlot);
auction[JS(time_interval)] = timeSlot ? *timeSlot : AUCTION_SLOT_TIME_INTERVALS;
auction[JS(price)] = toBoostJson(auctionSlot[sfPrice].getJson(JsonOptions::none));
auction[JS(time_interval)] = timeSlot ? *timeSlot : xrpl::kAuctionSlotTimeIntervals;
auction[JS(price)] =
toBoostJson(auctionSlot[sfPrice].getJson(JsonOptions::Values::None));
auction[JS(discounted_fee)] = auctionSlot[sfDiscountedFee];
auction[JS(account)] = to_string(auctionSlot.getAccountID(sfAccount));
auction[JS(expiration)] =
@@ -234,14 +235,14 @@ AMMInfoHandler::spec([[maybe_unused]] uint32_t apiVersion)
[](boost::json::value const& value, std::string_view key) -> MaybeError {
if (not value.is_string()) {
return Error{
Status{RippledError::rpcINVALID_PARAMS, std::string(key) + "NotString"}
Status{RippledError::RpcInvalidParams, std::string(key) + "NotString"}
};
}
try {
ripple::issueFromJson(boost::json::value_to<std::string>(value));
xrpl::issueFromJson(boost::json::value_to<std::string>(value));
} catch (std::runtime_error const&) {
return Error{Status{RippledError::rpcISSUE_MALFORMED}};
return Error{Status{RippledError::RpcIssueMalformed}};
}
return MaybeError{};
@@ -254,34 +255,34 @@ AMMInfoHandler::spec([[maybe_unused]] uint32_t apiVersion)
{JS(asset),
meta::WithCustomError{
validation::Type<std::string, boost::json::object>{},
Status(RippledError::rpcISSUE_MALFORMED)
Status(RippledError::RpcIssueMalformed)
},
meta::IfType<std::string>{kStringIssueValidator},
meta::IfType<boost::json::object>{
meta::WithCustomError{
validation::CustomValidators::currencyIssueValidator,
Status(RippledError::rpcISSUE_MALFORMED)
Status(RippledError::RpcIssueMalformed)
},
}},
{JS(asset2),
meta::WithCustomError{
validation::Type<std::string, boost::json::object>{},
Status(RippledError::rpcISSUE_MALFORMED)
Status(RippledError::RpcIssueMalformed)
},
meta::IfType<std::string>{kStringIssueValidator},
meta::IfType<boost::json::object>{
meta::WithCustomError{
validation::CustomValidators::currencyIssueValidator,
Status(RippledError::rpcISSUE_MALFORMED)
Status(RippledError::RpcIssueMalformed)
},
}},
{JS(amm_account),
meta::WithCustomError{
validation::CustomValidators::accountValidator, Status(RippledError::rpcACT_MALFORMED)
validation::CustomValidators::accountValidator, Status(RippledError::RpcActMalformed)
}},
{JS(account),
meta::WithCustomError{
validation::CustomValidators::accountValidator, Status(RippledError::rpcACT_MALFORMED)
validation::CustomValidators::accountValidator, Status(RippledError::RpcActMalformed)
}},
};

View File

@@ -51,10 +51,10 @@ public:
* @brief A struct to hold the input data for the command
*/
struct Input {
std::optional<ripple::AccountID> accountID;
std::optional<ripple::AccountID> ammAccount;
ripple::Issue issue1 = ripple::noIssue();
ripple::Issue issue2 = ripple::noIssue();
std::optional<xrpl::AccountID> accountID;
std::optional<xrpl::AccountID> ammAccount;
xrpl::Issue issue1 = xrpl::noIssue();
xrpl::Issue issue2 = xrpl::noIssue();
std::optional<std::string> ledgerHash;
std::optional<uint32_t> ledgerIndex;
};

View File

@@ -34,33 +34,33 @@ namespace rpc {
void
AccountChannelsHandler::addChannel(
std::vector<ChannelResponse>& jsonChannels,
ripple::SLE const& channelSle
xrpl::SLE const& channelSle
)
{
ChannelResponse channel;
channel.channelID = ripple::to_string(channelSle.key());
channel.account = ripple::to_string(channelSle.getAccountID(ripple::sfAccount));
channel.accountDestination = ripple::to_string(channelSle.getAccountID(ripple::sfDestination));
channel.amount = channelSle[ripple::sfAmount].getText();
channel.balance = channelSle[ripple::sfBalance].getText();
channel.settleDelay = channelSle[ripple::sfSettleDelay];
channel.channelID = xrpl::to_string(channelSle.key());
channel.account = xrpl::to_string(channelSle.getAccountID(xrpl::sfAccount));
channel.accountDestination = xrpl::to_string(channelSle.getAccountID(xrpl::sfDestination));
channel.amount = channelSle[xrpl::sfAmount].getText();
channel.balance = channelSle[xrpl::sfBalance].getText();
channel.settleDelay = channelSle[xrpl::sfSettleDelay];
if (publicKeyType(channelSle[ripple::sfPublicKey])) {
ripple::PublicKey const pk(channelSle[ripple::sfPublicKey]);
channel.publicKey = toBase58(ripple::TokenType::AccountPublic, pk);
if (publicKeyType(channelSle[xrpl::sfPublicKey])) {
xrpl::PublicKey const pk(channelSle[xrpl::sfPublicKey]);
channel.publicKey = toBase58(xrpl::TokenType::AccountPublic, pk);
channel.publicKeyHex = strHex(pk);
}
if (auto const& v = channelSle[~ripple::sfExpiration])
if (auto const& v = channelSle[~xrpl::sfExpiration])
channel.expiration = v;
if (auto const& v = channelSle[~ripple::sfCancelAfter])
if (auto const& v = channelSle[~xrpl::sfCancelAfter])
channel.cancelAfter = v;
if (auto const& v = channelSle[~ripple::sfSourceTag])
if (auto const& v = channelSle[~xrpl::sfSourceTag])
channel.sourceTag = v;
if (auto const& v = channelSle[~ripple::sfDestinationTag])
if (auto const& v = channelSle[~xrpl::sfDestinationTag])
channel.destinationTag = v;
jsonChannels.push_back(channel);
@@ -89,23 +89,22 @@ AccountChannelsHandler::process(
auto const accountID = accountFromStringStrict(input.account);
auto const accountLedgerObject = sharedPtrBackend_->fetchLedgerObject(
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
ripple::keylet::account(*accountID).key,
xrpl::keylet::account(*accountID).key,
lgrInfo.seq,
ctx.yield
);
if (!accountLedgerObject)
return Error{Status{RippledError::rpcACT_NOT_FOUND}};
return Error{Status{RippledError::RpcActNotFound}};
auto const destAccountID = input.destinationAccount
? accountFromStringStrict(*input.destinationAccount)
: std::optional<ripple::AccountID>{};
: std::optional<xrpl::AccountID>{};
Output response;
auto const addToResponse = [&](ripple::SLE const sle) {
if (sle.getType() == ripple::ltPAYCHAN &&
sle.getAccountID(ripple::sfAccount) == accountID &&
(!destAccountID || *destAccountID == sle.getAccountID(ripple::sfDestination))) {
auto const addToResponse = [&](xrpl::SLE const sle) {
if (sle.getType() == xrpl::ltPAYCHAN && sle.getAccountID(xrpl::sfAccount) == accountID &&
(!destAccountID || *destAccountID == sle.getAccountID(xrpl::sfDestination))) {
addChannel(response.channels, sle);
}
@@ -127,7 +126,7 @@ AccountChannelsHandler::process(
response.account = input.account;
response.limit = input.limit;
response.ledgerHash = ripple::strHex(lgrInfo.hash);
response.ledgerHash = xrpl::strHex(lgrInfo.hash);
response.ledgerIndex = lgrInfo.seq;
auto const nextMarker = *expectedNext;

View File

@@ -132,7 +132,7 @@ public:
private:
static void
addChannel(std::vector<ChannelResponse>& jsonChannels, ripple::SLE const& channelSle);
addChannel(std::vector<ChannelResponse>& jsonChannels, xrpl::SLE const& channelSle);
/**
* @brief Convert the Output to a JSON object

View File

@@ -12,6 +12,7 @@
#include <boost/json/value_to.hpp>
#include <xrpl/basics/strHex.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/Issue.h>
#include <xrpl/protocol/LedgerFormats.h>
#include <xrpl/protocol/LedgerHeader.h>
#include <xrpl/protocol/SField.h>
@@ -48,19 +49,19 @@ AccountCurrenciesHandler::process(
auto const accountLedgerObject = sharedPtrBackend_->fetchLedgerObject(
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
ripple::keylet::account(*accountID).key,
xrpl::keylet::account(*accountID).key,
lgrInfo.seq,
ctx.yield
);
if (!accountLedgerObject)
return Error{Status{RippledError::rpcACT_NOT_FOUND}};
return Error{Status{RippledError::RpcActNotFound}};
Output response;
auto const addToResponse = [&](ripple::SLE const sle) {
if (sle.getType() == ripple::ltRIPPLE_STATE) {
auto balance = sle.getFieldAmount(ripple::sfBalance);
auto const lowLimit = sle.getFieldAmount(ripple::sfLowLimit);
auto const highLimit = sle.getFieldAmount(ripple::sfHighLimit);
auto const addToResponse = [&](xrpl::SLE const sle) {
if (sle.getType() == xrpl::ltRIPPLE_STATE) {
auto balance = sle.getFieldAmount(xrpl::sfBalance);
auto const lowLimit = sle.getFieldAmount(xrpl::sfLowLimit);
auto const highLimit = sle.getFieldAmount(xrpl::sfHighLimit);
bool const viewLowest = (lowLimit.getIssuer() == accountID);
auto const lineLimit = viewLowest ? lowLimit : highLimit;
auto const lineLimitPeer = !viewLowest ? lowLimit : highLimit;
@@ -68,11 +69,17 @@ AccountCurrenciesHandler::process(
if (!viewLowest)
balance.negate();
if (balance < lineLimit)
response.receiveCurrencies.insert(ripple::to_string(balance.getCurrency()));
if (balance < lineLimit) {
response.receiveCurrencies.insert(
xrpl::to_string(balance.get<xrpl::Issue>().currency)
);
}
if ((-balance) < lineLimitPeer)
response.sendCurrencies.insert(ripple::to_string(balance.getCurrency()));
if ((-balance) < lineLimitPeer) {
response.sendCurrencies.insert(
xrpl::to_string(balance.get<xrpl::Issue>().currency)
);
}
}
return true;
@@ -89,7 +96,7 @@ AccountCurrenciesHandler::process(
addToResponse
);
response.ledgerHash = ripple::strHex(lgrInfo.hash);
response.ledgerHash = xrpl::strHex(lgrInfo.hash);
response.ledgerIndex = lgrInfo.seq;
return response;

View File

@@ -15,7 +15,7 @@
#include <boost/json/value.hpp>
#include <boost/json/value_to.hpp>
#include <xrpl/basics/strHex.h>
#include <xrpl/ledger/View.h>
#include <xrpl/ledger/helpers/AccountRootHelpers.h>
#include <xrpl/protocol/ErrorCodes.h>
#include <xrpl/protocol/Indexes.h>
#include <xrpl/protocol/LedgerFormats.h>
@@ -40,7 +40,7 @@ AccountInfoHandler::process(AccountInfoHandler::Input const& input, Context cons
if (!input.account && !input.ident) {
return Error{
Status{RippledError::rpcINVALID_PARAMS, ripple::RPC::missing_field_message(JS(account))}
Status{RippledError::RpcInvalidParams, xrpl::RPC::missingFieldMessage(JS(account))}
};
}
@@ -61,20 +61,20 @@ AccountInfoHandler::process(AccountInfoHandler::Input const& input, Context cons
auto const accountStr = input.account.value_or(input.ident.value_or(""));
auto const accountID = accountFromStringStrict(accountStr);
auto const accountKeylet =
ripple::keylet::account(*accountID); // NOLINT(bugprone-unchecked-optional-access)
xrpl::keylet::account(*accountID); // NOLINT(bugprone-unchecked-optional-access)
auto const accountLedgerObject =
sharedPtrBackend_->fetchLedgerObject(accountKeylet.key, lgrInfo.seq, ctx.yield);
if (!accountLedgerObject)
return Error{Status{RippledError::rpcACT_NOT_FOUND}};
return Error{Status{RippledError::RpcActNotFound}};
ripple::STLedgerEntry const sle{
ripple::SerialIter{accountLedgerObject->data(), accountLedgerObject->size()},
xrpl::STLedgerEntry const sle{
xrpl::SerialIter{accountLedgerObject->data(), accountLedgerObject->size()},
accountKeylet.key
};
if (!accountKeylet.check(sle))
return Error{Status{RippledError::rpcDB_DESERIALIZATION}};
return Error{Status{RippledError::RpcDbDeserialization}};
auto isEnabled = [this, &ctx, seq = lgrInfo.seq](auto key) {
return amendmentCenter_->isEnabled(ctx.yield, key, seq);
@@ -86,7 +86,7 @@ AccountInfoHandler::process(AccountInfoHandler::Input const& input, Context cons
Output out{
.ledgerIndex = lgrInfo.seq,
.ledgerHash = ripple::strHex(lgrInfo.hash),
.ledgerHash = xrpl::strHex(lgrInfo.hash),
.accountData = sle,
.isDisallowIncomingEnabled = isDisallowIncomingEnabled,
.isClawbackEnabled = isClawbackEnabled,
@@ -100,21 +100,21 @@ AccountInfoHandler::process(AccountInfoHandler::Input const& input, Context cons
// We put the SignerList in an array because of an anticipated
// future when we support multiple signer lists on one account.
auto const signersKey =
ripple::keylet::signers(*accountID); // NOLINT(bugprone-unchecked-optional-access)
xrpl::keylet::signers(*accountID); // NOLINT(bugprone-unchecked-optional-access)
// This code will need to be revisited if in the future we
// support multiple SignerLists on one account.
auto const signers =
sharedPtrBackend_->fetchLedgerObject(signersKey.key, lgrInfo.seq, ctx.yield);
out.signerLists = std::vector<ripple::STLedgerEntry>();
out.signerLists = std::vector<xrpl::STLedgerEntry>();
if (signers) {
ripple::STLedgerEntry const sleSigners{
ripple::SerialIter{signers->data(), signers->size()}, signersKey.key
xrpl::STLedgerEntry const sleSigners{
xrpl::SerialIter{signers->data(), signers->size()}, signersKey.key
};
if (!signersKey.check(sleSigners))
return Error{Status{RippledError::rpcDB_DESERIALIZATION}};
return Error{Status{RippledError::RpcDbDeserialization}};
out.signerLists->push_back(sleSigners);
}
@@ -137,34 +137,34 @@ tag_invoke(
{JS(validated), output.validated},
};
std::vector<std::pair<std::string_view, ripple::LedgerSpecificFlags>> lsFlags{{
{"defaultRipple", ripple::lsfDefaultRipple},
{"depositAuth", ripple::lsfDepositAuth},
{"disableMasterKey", ripple::lsfDisableMaster},
{"disallowIncomingXRP", ripple::lsfDisallowXRP},
{"globalFreeze", ripple::lsfGlobalFreeze},
{"noFreeze", ripple::lsfNoFreeze},
{"passwordSpent", ripple::lsfPasswordSpent},
{"requireAuthorization", ripple::lsfRequireAuth},
{"requireDestinationTag", ripple::lsfRequireDestTag},
std::vector<std::pair<std::string_view, xrpl::LedgerSpecificFlags>> lsFlags{{
{"defaultRipple", xrpl::lsfDefaultRipple},
{"depositAuth", xrpl::lsfDepositAuth},
{"disableMasterKey", xrpl::lsfDisableMaster},
{"disallowIncomingXRP", xrpl::lsfDisallowXRP},
{"globalFreeze", xrpl::lsfGlobalFreeze},
{"noFreeze", xrpl::lsfNoFreeze},
{"passwordSpent", xrpl::lsfPasswordSpent},
{"requireAuthorization", xrpl::lsfRequireAuth},
{"requireDestinationTag", xrpl::lsfRequireDestTag},
}};
if (output.isDisallowIncomingEnabled) {
std::vector<std::pair<std::string_view, ripple::LedgerSpecificFlags>> const
std::vector<std::pair<std::string_view, xrpl::LedgerSpecificFlags>> const
disallowIncomingFlags = {
{"disallowIncomingNFTokenOffer", ripple::lsfDisallowIncomingNFTokenOffer},
{"disallowIncomingCheck", ripple::lsfDisallowIncomingCheck},
{"disallowIncomingPayChan", ripple::lsfDisallowIncomingPayChan},
{"disallowIncomingTrustline", ripple::lsfDisallowIncomingTrustline},
{"disallowIncomingNFTokenOffer", xrpl::lsfDisallowIncomingNFTokenOffer},
{"disallowIncomingCheck", xrpl::lsfDisallowIncomingCheck},
{"disallowIncomingPayChan", xrpl::lsfDisallowIncomingPayChan},
{"disallowIncomingTrustline", xrpl::lsfDisallowIncomingTrustline},
};
lsFlags.insert(lsFlags.end(), disallowIncomingFlags.begin(), disallowIncomingFlags.end());
}
if (output.isClawbackEnabled)
lsFlags.emplace_back("allowTrustLineClawback", ripple::lsfAllowTrustLineClawback);
lsFlags.emplace_back("allowTrustLineClawback", xrpl::lsfAllowTrustLineClawback);
if (output.isTokenEscrowEnabled)
lsFlags.emplace_back("allowTrustLineLocking", ripple::lsfAllowTrustLineLocking);
lsFlags.emplace_back("allowTrustLineLocking", xrpl::lsfAllowTrustLineLocking);
boost::json::object acctFlags;
for (auto const& lsf : lsFlags)
@@ -172,7 +172,7 @@ tag_invoke(
jv.as_object()[JS(account_flags)] = std::move(acctFlags);
auto const pseudoFields = ripple::getPseudoAccountFields();
auto const pseudoFields = xrpl::getPseudoAccountFields();
for (auto const& pseudoField : pseudoFields) {
if (output.accountData.isFieldPresent(*pseudoField)) {
std::string_view name = pseudoField->fieldName;

View File

@@ -39,12 +39,12 @@ public:
struct Output {
uint32_t ledgerIndex;
std::string ledgerHash;
ripple::STLedgerEntry accountData;
xrpl::STLedgerEntry accountData;
bool isDisallowIncomingEnabled = false;
bool isClawbackEnabled = false;
bool isTokenEscrowEnabled = false;
uint32_t apiVersion;
std::optional<std::vector<ripple::STLedgerEntry>> signerLists;
std::optional<std::vector<xrpl::STLedgerEntry>> signerLists;
// validated should be sent via framework
bool validated = true;
};

View File

@@ -33,21 +33,21 @@ namespace rpc {
void
AccountLinesHandler::addLine(
std::vector<LineResponse>& lines,
ripple::SLE const& lineSle,
ripple::AccountID const& account,
std::optional<ripple::AccountID> const& peerAccount
xrpl::SLE const& lineSle,
xrpl::AccountID const& account,
std::optional<xrpl::AccountID> const& peerAccount
)
{
auto const flags = lineSle.getFieldU32(ripple::sfFlags);
auto const lowLimit = lineSle.getFieldAmount(ripple::sfLowLimit);
auto const highLimit = lineSle.getFieldAmount(ripple::sfHighLimit);
auto const flags = lineSle.getFieldU32(xrpl::sfFlags);
auto const lowLimit = lineSle.getFieldAmount(xrpl::sfLowLimit);
auto const highLimit = lineSle.getFieldAmount(xrpl::sfHighLimit);
auto const lowID = lowLimit.getIssuer();
auto const highID = highLimit.getIssuer();
auto const lowQualityIn = lineSle.getFieldU32(ripple::sfLowQualityIn);
auto const lowQualityOut = lineSle.getFieldU32(ripple::sfLowQualityOut);
auto const highQualityIn = lineSle.getFieldU32(ripple::sfHighQualityIn);
auto const highQualityOut = lineSle.getFieldU32(ripple::sfHighQualityOut);
auto balance = lineSle.getFieldAmount(ripple::sfBalance);
auto const lowQualityIn = lineSle.getFieldU32(xrpl::sfLowQualityIn);
auto const lowQualityOut = lineSle.getFieldU32(xrpl::sfLowQualityOut);
auto const highQualityIn = lineSle.getFieldU32(xrpl::sfHighQualityIn);
auto const highQualityOut = lineSle.getFieldU32(xrpl::sfHighQualityOut);
auto balance = lineSle.getFieldAmount(xrpl::sfBalance);
auto const viewLowest = (lowID == account);
auto const lineLimit = viewLowest ? lowLimit : highLimit;
@@ -62,30 +62,29 @@ AccountLinesHandler::addLine(
if (not viewLowest)
balance.negate();
bool const lineAuth = (flags & (viewLowest ? ripple::lsfLowAuth : ripple::lsfHighAuth)) != 0u;
bool const lineAuth = (flags & (viewLowest ? xrpl::lsfLowAuth : xrpl::lsfHighAuth)) != 0u;
bool const lineAuthPeer =
(flags & (not viewLowest ? ripple::lsfLowAuth : ripple::lsfHighAuth)) != 0u;
(flags & (not viewLowest ? xrpl::lsfLowAuth : xrpl::lsfHighAuth)) != 0u;
bool const lineNoRipple =
(flags & (viewLowest ? ripple::lsfLowNoRipple : ripple::lsfHighNoRipple)) != 0u;
(flags & (viewLowest ? xrpl::lsfLowNoRipple : xrpl::lsfHighNoRipple)) != 0u;
bool const lineNoRipplePeer =
(flags & (not viewLowest ? ripple::lsfLowNoRipple : ripple::lsfHighNoRipple)) != 0u;
bool const lineFreeze =
(flags & (viewLowest ? ripple::lsfLowFreeze : ripple::lsfHighFreeze)) != 0u;
(flags & (not viewLowest ? xrpl::lsfLowNoRipple : xrpl::lsfHighNoRipple)) != 0u;
bool const lineFreeze = (flags & (viewLowest ? xrpl::lsfLowFreeze : xrpl::lsfHighFreeze)) != 0u;
bool const lineFreezePeer =
(flags & (not viewLowest ? ripple::lsfLowFreeze : ripple::lsfHighFreeze)) != 0u;
(flags & (not viewLowest ? xrpl::lsfLowFreeze : xrpl::lsfHighFreeze)) != 0u;
bool const lineDeepFreeze =
(flags & (viewLowest ? ripple::lsfLowDeepFreeze : ripple::lsfHighDeepFreeze)) != 0u;
(flags & (viewLowest ? xrpl::lsfLowDeepFreeze : xrpl::lsfHighDeepFreeze)) != 0u;
bool const lineDeepFreezePeer =
(flags & (not viewLowest ? ripple::lsfLowDeepFreeze : ripple::lsfHighDeepFreeze)) != 0u;
(flags & (not viewLowest ? xrpl::lsfLowDeepFreeze : xrpl::lsfHighDeepFreeze)) != 0u;
ripple::STAmount const& saBalance = balance;
ripple::STAmount const& saLimit = lineLimit;
ripple::STAmount const& saLimitPeer = lineLimitPeer;
xrpl::STAmount const& saBalance = balance;
xrpl::STAmount const& saLimit = lineLimit;
xrpl::STAmount const& saLimitPeer = lineLimitPeer;
LineResponse line;
line.account = ripple::to_string(lineAccountIDPeer);
line.account = xrpl::to_string(lineAccountIDPeer);
line.balance = saBalance.getText();
line.currency = ripple::to_string(saBalance.issue().currency);
line.currency = xrpl::to_string(saBalance.get<xrpl::Issue>().currency);
line.limit = saLimit.getText();
line.limitPeer = saLimitPeer.getText();
line.qualityIn = lineQualityIn;
@@ -138,28 +137,28 @@ AccountLinesHandler::process(AccountLinesHandler::Input const& input, Context co
auto const accountID = accountFromStringStrict(input.account);
auto const accountLedgerObject = sharedPtrBackend_->fetchLedgerObject(
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
ripple::keylet::account(*accountID).key,
xrpl::keylet::account(*accountID).key,
lgrInfo.seq,
ctx.yield
);
if (not accountLedgerObject)
return Error{Status{RippledError::rpcACT_NOT_FOUND}};
return Error{Status{RippledError::RpcActNotFound}};
auto const peerAccountID =
input.peer ? accountFromStringStrict(*(input.peer)) : std::optional<ripple::AccountID>{};
input.peer ? accountFromStringStrict(*(input.peer)) : std::optional<xrpl::AccountID>{};
Output response;
response.lines.reserve(input.limit);
auto const addToResponse = [&](ripple::SLE const sle) {
if (sle.getType() == ripple::ltRIPPLE_STATE) {
auto const addToResponse = [&](xrpl::SLE const sle) {
if (sle.getType() == xrpl::ltRIPPLE_STATE) {
auto ignore = false;
if (input.ignoreDefault) {
if (sle.getFieldAmount(ripple::sfLowLimit).getIssuer() == accountID) {
ignore = ((sle.getFieldU32(ripple::sfFlags) & ripple::lsfLowReserve) == 0u);
if (sle.getFieldAmount(xrpl::sfLowLimit).getIssuer() == accountID) {
ignore = ((sle.getFieldU32(xrpl::sfFlags) & xrpl::lsfLowReserve) == 0u);
} else {
ignore = ((sle.getFieldU32(ripple::sfFlags) & ripple::lsfHighReserve) == 0u);
ignore = ((sle.getFieldU32(xrpl::sfFlags) & xrpl::lsfHighReserve) == 0u);
}
}
@@ -186,7 +185,7 @@ AccountLinesHandler::process(AccountLinesHandler::Input const& input, Context co
response.account = input.account;
response.limit = input.limit; // not documented,
// https://github.com/XRPLF/xrpl-dev-portal/issues/1838
response.ledgerHash = ripple::strHex(lgrInfo.hash);
response.ledgerHash = xrpl::strHex(lgrInfo.hash);
response.ledgerIndex = lgrInfo.seq;
if (nextMarker.isNonZero())

View File

@@ -114,12 +114,12 @@ public:
validation::Required{},
meta::WithCustomError{
validation::CustomValidators::accountValidator,
Status(RippledError::rpcACT_MALFORMED)
Status(RippledError::RpcActMalformed)
}},
{JS(peer),
meta::WithCustomError{
validation::CustomValidators::accountValidator,
Status(RippledError::rpcACT_MALFORMED)
Status(RippledError::RpcActMalformed)
}},
{JS(ignore_default), validation::Type<bool>{}},
{JS(ledger_hash), validation::CustomValidators::uint256HexStringValidator},
@@ -150,9 +150,9 @@ private:
static void
addLine(
std::vector<LineResponse>& lines,
ripple::SLE const& lineSle,
ripple::AccountID const& account,
std::optional<ripple::AccountID> const& peerAccount
xrpl::SLE const& lineSle,
xrpl::AccountID const& account,
std::optional<xrpl::AccountID> const& peerAccount
);
private:

View File

@@ -31,68 +31,68 @@ namespace rpc {
void
AccountMPTokenIssuancesHandler::addMPTokenIssuance(
std::vector<MPTokenIssuanceResponse>& issuances,
ripple::SLE const& sle,
ripple::AccountID const& account
xrpl::SLE const& sle,
xrpl::AccountID const& account
)
{
MPTokenIssuanceResponse issuance;
issuance.mpTokenIssuanceId = ripple::strHex(sle.key());
issuance.issuer = ripple::to_string(account);
issuance.sequence = sle.getFieldU32(ripple::sfSequence);
auto const flags = sle.getFieldU32(ripple::sfFlags);
issuance.mpTokenIssuanceId = xrpl::strHex(sle.key());
issuance.issuer = xrpl::to_string(account);
issuance.sequence = sle.getFieldU32(xrpl::sfSequence);
auto const flags = sle.getFieldU32(xrpl::sfFlags);
auto const setFlag = [&](std::optional<bool>& field, std::uint32_t mask) {
if ((flags & mask) != 0u)
field = true;
};
setFlag(issuance.mptLocked, ripple::lsfMPTLocked);
setFlag(issuance.mptCanLock, ripple::lsfMPTCanLock);
setFlag(issuance.mptRequireAuth, ripple::lsfMPTRequireAuth);
setFlag(issuance.mptCanEscrow, ripple::lsfMPTCanEscrow);
setFlag(issuance.mptCanTrade, ripple::lsfMPTCanTrade);
setFlag(issuance.mptCanTransfer, ripple::lsfMPTCanTransfer);
setFlag(issuance.mptCanClawback, ripple::lsfMPTCanClawback);
setFlag(issuance.mptLocked, xrpl::lsfMPTLocked);
setFlag(issuance.mptCanLock, xrpl::lsfMPTCanLock);
setFlag(issuance.mptRequireAuth, xrpl::lsfMPTRequireAuth);
setFlag(issuance.mptCanEscrow, xrpl::lsfMPTCanEscrow);
setFlag(issuance.mptCanTrade, xrpl::lsfMPTCanTrade);
setFlag(issuance.mptCanTransfer, xrpl::lsfMPTCanTransfer);
setFlag(issuance.mptCanClawback, xrpl::lsfMPTCanClawback);
if (sle.isFieldPresent(ripple::sfMutableFlags)) {
auto const mutableFlags = sle.getFieldU32(ripple::sfMutableFlags);
if (sle.isFieldPresent(xrpl::sfMutableFlags)) {
auto const mutableFlags = sle.getFieldU32(xrpl::sfMutableFlags);
auto const setMutableFlag = [&](std::optional<bool>& field, std::uint32_t mask) {
if ((mutableFlags & mask) != 0u)
field = true;
};
setMutableFlag(issuance.mptCanMutateCanLock, ripple::lsmfMPTCanMutateCanLock);
setMutableFlag(issuance.mptCanMutateRequireAuth, ripple::lsmfMPTCanMutateRequireAuth);
setMutableFlag(issuance.mptCanMutateCanEscrow, ripple::lsmfMPTCanMutateCanEscrow);
setMutableFlag(issuance.mptCanMutateCanTrade, ripple::lsmfMPTCanMutateCanTrade);
setMutableFlag(issuance.mptCanMutateCanTransfer, ripple::lsmfMPTCanMutateCanTransfer);
setMutableFlag(issuance.mptCanMutateCanClawback, ripple::lsmfMPTCanMutateCanClawback);
setMutableFlag(issuance.mptCanMutateMetadata, ripple::lsmfMPTCanMutateMetadata);
setMutableFlag(issuance.mptCanMutateTransferFee, ripple::lsmfMPTCanMutateTransferFee);
setMutableFlag(issuance.mptCanMutateCanLock, xrpl::lsmfMPTCanMutateCanLock);
setMutableFlag(issuance.mptCanMutateRequireAuth, xrpl::lsmfMPTCanMutateRequireAuth);
setMutableFlag(issuance.mptCanMutateCanEscrow, xrpl::lsmfMPTCanMutateCanEscrow);
setMutableFlag(issuance.mptCanMutateCanTrade, xrpl::lsmfMPTCanMutateCanTrade);
setMutableFlag(issuance.mptCanMutateCanTransfer, xrpl::lsmfMPTCanMutateCanTransfer);
setMutableFlag(issuance.mptCanMutateCanClawback, xrpl::lsmfMPTCanMutateCanClawback);
setMutableFlag(issuance.mptCanMutateMetadata, xrpl::lsmfMPTCanMutateMetadata);
setMutableFlag(issuance.mptCanMutateTransferFee, xrpl::lsmfMPTCanMutateTransferFee);
}
if (sle.isFieldPresent(ripple::sfTransferFee))
issuance.transferFee = sle.getFieldU16(ripple::sfTransferFee);
if (sle.isFieldPresent(xrpl::sfTransferFee))
issuance.transferFee = sle.getFieldU16(xrpl::sfTransferFee);
if (sle.isFieldPresent(ripple::sfAssetScale))
issuance.assetScale = sle.getFieldU8(ripple::sfAssetScale);
if (sle.isFieldPresent(xrpl::sfAssetScale))
issuance.assetScale = sle.getFieldU8(xrpl::sfAssetScale);
if (sle.isFieldPresent(ripple::sfMaximumAmount))
issuance.maximumAmount = sle.getFieldU64(ripple::sfMaximumAmount);
if (sle.isFieldPresent(xrpl::sfMaximumAmount))
issuance.maximumAmount = sle.getFieldU64(xrpl::sfMaximumAmount);
if (sle.isFieldPresent(ripple::sfOutstandingAmount))
issuance.outstandingAmount = sle.getFieldU64(ripple::sfOutstandingAmount);
if (sle.isFieldPresent(xrpl::sfOutstandingAmount))
issuance.outstandingAmount = sle.getFieldU64(xrpl::sfOutstandingAmount);
if (sle.isFieldPresent(ripple::sfLockedAmount))
issuance.lockedAmount = sle.getFieldU64(ripple::sfLockedAmount);
if (sle.isFieldPresent(xrpl::sfLockedAmount))
issuance.lockedAmount = sle.getFieldU64(xrpl::sfLockedAmount);
if (sle.isFieldPresent(ripple::sfMPTokenMetadata))
issuance.mptokenMetadata = ripple::strHex(sle.getFieldVL(ripple::sfMPTokenMetadata));
if (sle.isFieldPresent(xrpl::sfMPTokenMetadata))
issuance.mptokenMetadata = xrpl::strHex(sle.getFieldVL(xrpl::sfMPTokenMetadata));
if (sle.isFieldPresent(ripple::sfDomainID))
issuance.domainID = ripple::strHex(sle.getFieldH256(ripple::sfDomainID));
if (sle.isFieldPresent(xrpl::sfDomainID))
issuance.domainID = xrpl::strHex(sle.getFieldH256(xrpl::sfDomainID));
issuances.push_back(issuance);
}
@@ -120,19 +120,19 @@ AccountMPTokenIssuancesHandler::process(
auto const accountID = accountFromStringStrict(input.account);
auto const accountLedgerObject = sharedPtrBackend_->fetchLedgerObject(
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
ripple::keylet::account(*accountID).key,
xrpl::keylet::account(*accountID).key,
lgrInfo.seq,
ctx.yield
);
if (not accountLedgerObject.has_value())
return Error{Status{RippledError::rpcACT_NOT_FOUND}};
return Error{Status{RippledError::RpcActNotFound}};
Output response;
response.issuances.reserve(input.limit);
auto const addToResponse = [&](ripple::SLE const& sle) {
if (sle.getType() == ripple::ltMPTOKEN_ISSUANCE) {
auto const addToResponse = [&](xrpl::SLE const& sle) {
if (sle.getType() == xrpl::ltMPTOKEN_ISSUANCE) {
addMPTokenIssuance(response.issuances, sle, *accountID);
}
};
@@ -155,7 +155,7 @@ AccountMPTokenIssuancesHandler::process(
response.account = input.account;
response.limit = input.limit;
response.ledgerHash = ripple::strHex(lgrInfo.hash);
response.ledgerHash = xrpl::strHex(lgrInfo.hash);
response.ledgerIndex = lgrInfo.seq;
if (nextMarker.isNonZero())

View File

@@ -123,7 +123,7 @@ public:
validation::Required{},
meta::WithCustomError{
validation::CustomValidators::accountValidator,
Status(RippledError::rpcACT_MALFORMED)
Status(RippledError::RpcActMalformed)
}},
{JS(ledger_hash), validation::CustomValidators::uint256HexStringValidator},
{JS(limit),
@@ -152,8 +152,8 @@ private:
static void
addMPTokenIssuance(
std::vector<MPTokenIssuanceResponse>& issuances,
ripple::SLE const& sle,
ripple::AccountID const& account
xrpl::SLE const& sle,
xrpl::AccountID const& account
);
private:

View File

@@ -30,26 +30,26 @@
namespace rpc {
void
AccountMPTokensHandler::addMPToken(std::vector<MPTokenResponse>& mpts, ripple::SLE const& sle)
AccountMPTokensHandler::addMPToken(std::vector<MPTokenResponse>& mpts, xrpl::SLE const& sle)
{
MPTokenResponse token{};
auto const flags = sle.getFieldU32(ripple::sfFlags);
auto const flags = sle.getFieldU32(xrpl::sfFlags);
token.mpTokenId = ripple::strHex(sle.key());
token.account = ripple::to_string(sle.getAccountID(ripple::sfAccount));
token.mpTokenIssuanceId = ripple::strHex(sle.getFieldH192(ripple::sfMPTokenIssuanceID));
token.mptAmount = sle.getFieldU64(ripple::sfMPTAmount);
token.mpTokenId = xrpl::strHex(sle.key());
token.account = xrpl::to_string(sle.getAccountID(xrpl::sfAccount));
token.mpTokenIssuanceId = xrpl::strHex(sle.getFieldH192(xrpl::sfMPTokenIssuanceID));
token.mptAmount = sle.getFieldU64(xrpl::sfMPTAmount);
if (sle.isFieldPresent(ripple::sfLockedAmount))
token.lockedAmount = sle.getFieldU64(ripple::sfLockedAmount);
if (sle.isFieldPresent(xrpl::sfLockedAmount))
token.lockedAmount = sle.getFieldU64(xrpl::sfLockedAmount);
auto const setFlag = [&](std::optional<bool>& field, std::uint32_t mask) {
if ((flags & mask) != 0u)
field = true;
};
setFlag(token.mptLocked, ripple::lsfMPTLocked);
setFlag(token.mptAuthorized, ripple::lsfMPTAuthorized);
setFlag(token.mptLocked, xrpl::lsfMPTLocked);
setFlag(token.mptAuthorized, xrpl::lsfMPTAuthorized);
mpts.push_back(token);
}
@@ -77,19 +77,19 @@ AccountMPTokensHandler::process(
auto const accountID = accountFromStringStrict(input.account);
auto const accountLedgerObject = sharedPtrBackend_->fetchLedgerObject(
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
ripple::keylet::account(*accountID).key,
xrpl::keylet::account(*accountID).key,
lgrInfo.seq,
ctx.yield
);
if (not accountLedgerObject.has_value())
return Error{Status{RippledError::rpcACT_NOT_FOUND}};
return Error{Status{RippledError::RpcActNotFound}};
Output response;
response.mpts.reserve(input.limit);
auto const addToResponse = [&](ripple::SLE const& sle) {
if (sle.getType() == ripple::ltMPTOKEN) {
auto const addToResponse = [&](xrpl::SLE const& sle) {
if (sle.getType() == xrpl::ltMPTOKEN) {
addMPToken(response.mpts, sle);
}
};
@@ -112,7 +112,7 @@ AccountMPTokensHandler::process(
response.account = input.account;
response.limit = input.limit;
response.ledgerHash = ripple::strHex(lgrInfo.hash);
response.ledgerHash = xrpl::strHex(lgrInfo.hash);
response.ledgerIndex = lgrInfo.seq;
if (nextMarker.isNonZero())

View File

@@ -101,7 +101,7 @@ public:
validation::Required{},
meta::WithCustomError{
validation::CustomValidators::accountValidator,
Status(RippledError::rpcACT_MALFORMED)
Status(RippledError::RpcActMalformed)
}},
{JS(ledger_hash), validation::CustomValidators::uint256HexStringValidator},
{JS(limit),
@@ -128,7 +128,7 @@ public:
private:
static void
addMPToken(std::vector<MPTokenResponse>& mpts, ripple::SLE const& sle);
addMPToken(std::vector<MPTokenResponse>& mpts, xrpl::SLE const& sle);
private:
/**

View File

@@ -50,69 +50,69 @@ AccountNFTsHandler::process(AccountNFTsHandler::Input const& input, Context cons
auto const accountID = accountFromStringStrict(input.account);
auto const accountLedgerObject = sharedPtrBackend_->fetchLedgerObject(
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
ripple::keylet::account(*accountID).key,
xrpl::keylet::account(*accountID).key,
lgrInfo.seq,
ctx.yield
);
if (!accountLedgerObject)
return Error{Status{RippledError::rpcACT_NOT_FOUND}};
return Error{Status{RippledError::RpcActNotFound}};
auto response = Output{};
response.account = input.account;
response.limit = input.limit;
response.ledgerHash = ripple::strHex(lgrInfo.hash);
response.ledgerHash = xrpl::strHex(lgrInfo.hash);
response.ledgerIndex = lgrInfo.seq;
// if a marker was passed, start at the page specified in marker. Else, start at the max page
auto const pageKey = input.marker ? ripple::uint256{input.marker->c_str()}
auto const pageKey = input.marker ? xrpl::uint256{input.marker->c_str()}
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
: ripple::keylet::nftpage_max(*accountID).key;
: xrpl::keylet::nftpageMax(*accountID).key;
auto const blob = sharedPtrBackend_->fetchLedgerObject(pageKey, lgrInfo.seq, ctx.yield);
if (!blob) {
if (input.marker.has_value()) {
return Error{Status{
RippledError::rpcINVALID_PARAMS, "Marker field does not match any valid Page ID"
RippledError::RpcInvalidParams, "Marker field does not match any valid Page ID"
}};
}
return response;
}
std::optional<ripple::SLE const> page{
ripple::SLE{ripple::SerialIter{blob->data(), blob->size()}, pageKey}
std::optional<xrpl::SLE const> page{
xrpl::SLE{xrpl::SerialIter{blob->data(), blob->size()}, pageKey}
};
if (page->getType() != ripple::ltNFTOKEN_PAGE) {
if (page->getType() != xrpl::ltNFTOKEN_PAGE) {
return Error{
Status{RippledError::rpcINVALID_PARAMS, "Marker matches Page ID from another Account"}
Status{RippledError::RpcInvalidParams, "Marker matches Page ID from another Account"}
};
}
auto numPages = 0u;
while (page) {
auto const arr = page->getFieldArray(ripple::sfNFTokens);
auto const arr = page->getFieldArray(xrpl::sfNFTokens);
for (auto const& nft : arr) {
auto const nftokenID = nft[ripple::sfNFTokenID];
auto const nftokenID = nft[xrpl::sfNFTokenID];
response.nfts.push_back(toBoostJson(nft.getJson(ripple::JsonOptions::none)));
response.nfts.push_back(toBoostJson(nft.getJson(xrpl::JsonOptions::Values::None)));
auto& obj = response.nfts.back().as_object();
// Pull out the components of the nft ID.
obj[SFS(sfFlags)] = ripple::nft::getFlags(nftokenID);
obj[SFS(sfIssuer)] = to_string(ripple::nft::getIssuer(nftokenID));
obj[SFS(sfNFTokenTaxon)] = ripple::nft::toUInt32(ripple::nft::getTaxon(nftokenID));
obj[JS(nft_serial)] = ripple::nft::getSerial(nftokenID);
obj[SFS(sfFlags)] = xrpl::nft::getFlags(nftokenID);
obj[SFS(sfIssuer)] = to_string(xrpl::nft::getIssuer(nftokenID));
obj[SFS(sfNFTokenTaxon)] = xrpl::nft::toUInt32(xrpl::nft::getTaxon(nftokenID));
obj[JS(nft_serial)] = xrpl::nft::getSerial(nftokenID);
if (std::uint16_t const xferFee = {ripple::nft::getTransferFee(nftokenID)})
if (std::uint16_t const xferFee = {xrpl::nft::getTransferFee(nftokenID)})
obj[SFS(sfTransferFee)] = xferFee;
}
++numPages;
if (auto const npm = (*page)[~ripple::sfPreviousPageMin]) {
auto const nextKey = ripple::Keylet(ripple::ltNFTOKEN_PAGE, *npm);
if (auto const npm = (*page)[~xrpl::sfPreviousPageMin]) {
auto const nextKey = xrpl::Keylet(xrpl::ltNFTOKEN_PAGE, *npm);
if (numPages == input.limit) {
response.marker = to_string(nextKey.key);
return response;
@@ -122,7 +122,7 @@ AccountNFTsHandler::process(AccountNFTsHandler::Input const& input, Context cons
sharedPtrBackend_->fetchLedgerObject(nextKey.key, lgrInfo.seq, ctx.yield);
page.emplace(
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
ripple::SLE{ripple::SerialIter{nextBlob->data(), nextBlob->size()}, nextKey.key}
xrpl::SLE{xrpl::SerialIter{nextBlob->data(), nextBlob->size()}, nextKey.key}
);
} else {
page.reset();

View File

@@ -51,15 +51,15 @@ AccountObjectsHandler::process(AccountObjectsHandler::Input const& input, Contex
auto const accountID = accountFromStringStrict(input.account);
auto const accountLedgerObject = sharedPtrBackend_->fetchLedgerObject(
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
ripple::keylet::account(*accountID).key,
xrpl::keylet::account(*accountID).key,
lgrInfo.seq,
ctx.yield
);
if (!accountLedgerObject)
return Error{Status{RippledError::rpcACT_NOT_FOUND}};
return Error{Status{RippledError::RpcActNotFound}};
auto typeFilter = std::optional<std::vector<ripple::LedgerEntryType>>{};
auto typeFilter = std::optional<std::vector<xrpl::LedgerEntryType>>{};
if (input.deletionBlockersOnly) {
typeFilter.emplace();
@@ -73,12 +73,12 @@ AccountObjectsHandler::process(AccountObjectsHandler::Input const& input, Contex
typeFilter->push_back(type);
}
} else {
if (input.type && input.type != ripple::ltANY)
if (input.type && input.type != xrpl::ltANY)
typeFilter = {*input.type};
}
Output response;
auto const addToResponse = [&](ripple::SLE&& sle) {
auto const addToResponse = [&](xrpl::SLE&& sle) {
if (not typeFilter or
std::find(std::begin(*typeFilter), std::end(*typeFilter), sle.getType()) !=
std::end(*typeFilter)) {
@@ -101,7 +101,7 @@ AccountObjectsHandler::process(AccountObjectsHandler::Input const& input, Contex
if (not expectedNext.has_value())
return Error{expectedNext.error()};
response.ledgerHash = ripple::strHex(lgrInfo.hash);
response.ledgerHash = xrpl::strHex(lgrInfo.hash);
response.ledgerIndex = lgrInfo.seq;
response.limit = input.limit;
response.account = input.account;

View File

@@ -47,7 +47,7 @@ public:
uint32_t ledgerIndex{};
std::optional<std::string> marker;
uint32_t limit{};
std::vector<ripple::SLE> accountObjects;
std::vector<xrpl::SLE> accountObjects;
bool validated = true;
};
@@ -60,7 +60,7 @@ public:
std::optional<uint32_t> ledgerIndex;
uint32_t limit = kLimitDefault; // [10,400]
std::optional<std::string> marker;
std::optional<ripple::LedgerEntryType> type;
std::optional<xrpl::LedgerEntryType> type;
bool deletionBlockersOnly = false;
};

View File

@@ -29,20 +29,20 @@
namespace rpc {
void
AccountOffersHandler::addOffer(std::vector<Offer>& offers, ripple::SLE const& offerSle)
AccountOffersHandler::addOffer(std::vector<Offer>& offers, xrpl::SLE const& offerSle)
{
auto offer = AccountOffersHandler::Offer();
offer.takerPays = offerSle.getFieldAmount(ripple::sfTakerPays);
offer.takerGets = offerSle.getFieldAmount(ripple::sfTakerGets);
offer.seq = offerSle.getFieldU32(ripple::sfSequence);
offer.flags = offerSle.getFieldU32(ripple::sfFlags);
offer.takerPays = offerSle.getFieldAmount(xrpl::sfTakerPays);
offer.takerGets = offerSle.getFieldAmount(xrpl::sfTakerGets);
offer.seq = offerSle.getFieldU32(xrpl::sfSequence);
offer.flags = offerSle.getFieldU32(xrpl::sfFlags);
auto const quality = getQuality(offerSle.getFieldH256(ripple::sfBookDirectory));
auto const rate = ripple::amountFromQuality(quality);
auto const quality = getQuality(offerSle.getFieldH256(xrpl::sfBookDirectory));
auto const rate = xrpl::amountFromQuality(quality);
offer.quality = rate.getText();
if (offerSle.isFieldPresent(ripple::sfExpiration))
offer.expiration = offerSle.getFieldU32(ripple::sfExpiration);
if (offerSle.isFieldPresent(xrpl::sfExpiration))
offer.expiration = offerSle.getFieldU32(xrpl::sfExpiration);
offers.push_back(offer);
};
@@ -67,21 +67,21 @@ AccountOffersHandler::process(AccountOffersHandler::Input const& input, Context
auto const accountID = accountFromStringStrict(input.account);
auto const accountLedgerObject = sharedPtrBackend_->fetchLedgerObject(
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
ripple::keylet::account(*accountID).key,
xrpl::keylet::account(*accountID).key,
lgrInfo.seq,
ctx.yield
);
if (!accountLedgerObject)
return Error{Status{RippledError::rpcACT_NOT_FOUND}};
return Error{Status{RippledError::RpcActNotFound}};
Output response;
response.account = ripple::to_string(*accountID); // NOLINT(bugprone-unchecked-optional-access)
response.ledgerHash = ripple::strHex(lgrInfo.hash);
response.account = xrpl::to_string(*accountID); // NOLINT(bugprone-unchecked-optional-access)
response.ledgerHash = xrpl::strHex(lgrInfo.hash);
response.ledgerIndex = lgrInfo.seq;
auto const addToResponse = [&](ripple::SLE const sle) {
if (sle.getType() == ripple::ltOFFER)
auto const addToResponse = [&](xrpl::SLE const sle) {
if (sle.getType() == xrpl::ltOFFER)
addOffer(response.offers, sle);
return true;
@@ -145,13 +145,13 @@ tag_invoke(
if (offer.expiration)
jsonObject[JS(expiration)] = *offer.expiration;
auto const convertAmount = [&](char const* field, ripple::STAmount const& amount) {
auto const convertAmount = [&](char const* field, xrpl::STAmount const& amount) {
if (amount.native()) {
jsonObject[field] = amount.getText();
} else {
jsonObject[field] = {
{JS(currency), ripple::to_string(amount.getCurrency())},
{JS(issuer), ripple::to_string(amount.getIssuer())},
{JS(currency), xrpl::to_string(amount.get<xrpl::Issue>().currency)},
{JS(issuer), xrpl::to_string(amount.getIssuer())},
{JS(value), amount.getText()},
};
}

Some files were not shown because too many files have changed in this diff Show More