20#include <xrpld/rpc/Context.h>
21#include <xrpld/rpc/detail/RPCHelpers.h>
23#include <xrpl/beast/utility/Zero.h>
24#include <xrpl/json/json_value.h>
25#include <xrpl/protocol/ErrorCodes.h>
26#include <xrpl/protocol/Indexes.h>
27#include <xrpl/protocol/jss.h>
28#include <xrpl/protocol/serialize.h>
35 auto const hasVaultId = params.
isMember(jss::vault_id);
36 auto const hasOwner = params.
isMember(jss::owner);
37 auto const hasSeq = params.
isMember(jss::seq);
39 uint256 uNodeIndex = beast::zero;
40 if (hasVaultId && !hasOwner && !hasSeq)
49 else if (!hasVaultId && hasOwner && hasSeq)
51 auto const id = parseBase58<AccountID>(params[jss::owner].asString());
58 !(params[jss::seq].isInt() || params[jss::seq].isUInt()) ||
59 params[jss::seq].asDouble() <= 0.0 ||
87 auto const uNodeIndex =
89 if (uNodeIndex == beast::zero)
91 jvResult[jss::error] =
"malformedRequest";
95 auto const sleVault = lpLedger->read(
keylet::vault(uNodeIndex));
96 auto const sleIssuance = sleVault ==
nullptr
99 if (!sleVault || !sleIssuance)
101 jvResult[jss::error] =
"entryNotFound";
107 auto& share = vault[jss::shares];
110 jvResult[jss::vault] = vault;
static UInt const maxUInt
std::string asString() const
Returns the unquoted string value.
bool isMember(char const *key) const
Return true if the object has a member named key.
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
void inject_error(error_code_i code, JsonValue &json)
Add or update the json update to reflect the error code.
Status lookupLedger(std::shared_ptr< ReadView const > &ledger, JsonContext &context, Json::Value &result)
Look up a ledger from a request and fill a Json::Result with the data representing a ledger.
Keylet mptIssuance(std::uint32_t seq, AccountID const &issuer) noexcept
Keylet vault(AccountID const &owner, std::uint32_t seq) noexcept
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
static Expected< uint256, Json::Value > parseVault(Json::Value const ¶ms, Json::StaticString const fieldName)
Json::Value doVaultInfo(RPC::JsonContext &)