1#include <xrpld/rpc/Context.h>
2#include <xrpld/rpc/detail/RPCLedgerHelpers.h>
4#include <xrpl/beast/utility/Zero.h>
5#include <xrpl/json/json_value.h>
6#include <xrpl/protocol/ErrorCodes.h>
7#include <xrpl/protocol/Indexes.h>
8#include <xrpl/protocol/jss.h>
9#include <xrpl/protocol/serialize.h>
16 auto const hasVaultId = params.
isMember(jss::vault_id);
17 auto const hasOwner = params.
isMember(jss::owner);
18 auto const hasSeq = params.
isMember(jss::seq);
20 uint256 uNodeIndex = beast::zero;
21 if (hasVaultId && !hasOwner && !hasSeq)
30 else if (!hasVaultId && hasOwner && hasSeq)
32 auto const id = parseBase58<AccountID>(params[jss::owner].asString());
39 !(params[jss::seq].isInt() || params[jss::seq].isUInt()) ||
40 params[jss::seq].asDouble() <= 0.0 ||
68 auto const uNodeIndex =
70 if (uNodeIndex == beast::zero)
72 jvResult[jss::error] =
"malformedRequest";
76 auto const sleVault = lpLedger->read(
keylet::vault(uNodeIndex));
77 auto const sleIssuance = sleVault ==
nullptr
80 if (!sleVault || !sleIssuance)
82 jvResult[jss::error] =
"entryNotFound";
88 auto& share = vault[jss::shares];
91 jvResult[jss::vault] = vault;
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.
static constexpr UInt maxUInt
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 &)