1#include <xrpld/rpc/detail/RPCHelpers.h> 
    3#include <xrpl/basics/StringUtilities.h> 
    4#include <xrpl/basics/strHex.h> 
    5#include <xrpl/beast/core/LexicalCast.h> 
    6#include <xrpl/json/json_errors.h> 
    7#include <xrpl/protocol/ErrorCodes.h> 
    8#include <xrpl/protocol/Indexes.h> 
    9#include <xrpl/protocol/RPCErr.h> 
   10#include <xrpl/protocol/STXChainBridge.h> 
   11#include <xrpl/protocol/jss.h> 
   17namespace LedgerEntryHelpers {
 
   26    json[jss::error] = err.value_or(
"malformedRequest");
 
   28    json[jss::error_message] = std::move(error);
 
 
   40    json[jss::error] = err;
 
   42    json[jss::error_message] = std::move(error);
 
 
   50    json[jss::error] = err;
 
   52    json[jss::error_message] = message;
 
 
   62    for (
auto const field : fields)
 
 
   88    if (
auto obj = parse<T>(params[fieldName]))
 
 
  102    auto const account = parseBase58<AccountID>(param.
asString());
 
  103    if (!account || account->isZero())
 
 
  117    return required<AccountID>(params, fieldName, err, 
"AccountID");
 
 
  127    if (!blob || blob->empty() || blob->size() > maxLength)
 
 
  144    if (
auto blob = 
parseHexBlob(params[fieldName], maxLength))
 
 
  174    return required<std::uint32_t>(params, fieldName, err, 
"number");
 
 
  196    return required<uint256>(params, fieldName, err, 
"Hash256");
 
 
  218    return required<uint192>(params, fieldName, err, 
"Hash192");
 
 
  226            {jss::LockingChainDoor,
 
  227             jss::LockingChainIssue,
 
  228             jss::IssuingChainDoor,
 
  229             jss::IssuingChainIssue});
 
  236        params, jss::LockingChainDoor, 
"malformedLockingChainDoor");
 
  237    if (!lockingChainDoor)
 
  243        params, jss::IssuingChainDoor, 
"malformedIssuingChainDoor");
 
  244    if (!issuingChainDoor)
 
  249    Issue lockingChainIssue;
 
  252        lockingChainIssue = 
issueFromJson(params[jss::LockingChainIssue]);
 
  257            "malformedIssue", jss::LockingChainIssue, 
"Issue");
 
  260    Issue issuingChainIssue;
 
  263        issuingChainIssue = 
issueFromJson(params[jss::IssuingChainIssue]);
 
  268            "malformedIssue", jss::IssuingChainIssue, 
"Issue");
 
 
 
Lightweight wrapper to tag static string.
 
std::string asString() const
Returns the unquoted string value.
 
bool isNull() const
isNull() tests to see if this field is null.
 
bool isMember(char const *key) const
Return true if the object has a member named key.
 
A currency issued by an account.
 
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
 
@ objectValue
object value (collection of name/value pairs).
 
bool lexicalCastChecked(Out &out, In in)
Intelligently convert from one type to another.
 
std::optional< Blob > parseHexBlob(Json::Value const ¶m, std::size_t maxLength)
 
Expected< T, Json::Value > required(Json::Value const ¶ms, Json::StaticString const fieldName, std::string const &err, std::string const &expectedType)
 
Expected< STXChainBridge, Json::Value > parseBridgeFields(Json::Value const ¶ms)
 
Unexpected< Json::Value > malformedError(std::string const &err, std::string const &message)
 
Unexpected< Json::Value > invalidFieldError(std::string const &err, Json::StaticString const field, std::string const &type)
 
std::optional< T > parse(Json::Value const ¶m)
 
Expected< uint256, Json::Value > requiredUInt256(Json::Value const ¶ms, Json::StaticString const fieldName, std::string const &err)
 
Unexpected< Json::Value > missingFieldError(Json::StaticString const field, std::optional< std::string > err=std::nullopt)
 
Expected< bool, Json::Value > hasRequired(Json::Value const ¶ms, std::initializer_list< Json::StaticString > fields, std::optional< std::string > err=std::nullopt)
 
Expected< AccountID, Json::Value > requiredAccountID(Json::Value const ¶ms, Json::StaticString const fieldName, std::string const &err)
 
Expected< std::uint32_t, Json::Value > requiredUInt32(Json::Value const ¶ms, Json::StaticString const fieldName, std::string const &err)
 
Expected< uint192, Json::Value > requiredUInt192(Json::Value const ¶ms, Json::StaticString const fieldName, std::string const &err)
 
Expected< Blob, Json::Value > requiredHexBlob(Json::Value const ¶ms, Json::StaticString const fieldName, std::size_t maxLength, std::string const &err)
 
std::string missing_field_message(std::string const &name)
 
std::string expected_field_message(std::string const &name, std::string const &type)
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
std::optional< Blob > strUnHex(std::size_t strSize, Iterator begin, Iterator end)
 
Issue issueFromJson(Json::Value const &v)