20 #include <ripple/app/main/Application.h>
21 #include <ripple/basics/StringUtilities.h>
22 #include <ripple/basics/strHex.h>
23 #include <ripple/ledger/ReadView.h>
24 #include <ripple/net/RPCErr.h>
25 #include <ripple/protocol/ErrorCodes.h>
26 #include <ripple/protocol/Indexes.h>
27 #include <ripple/protocol/jss.h>
28 #include <ripple/rpc/Context.h>
29 #include <ripple/rpc/impl/RPCHelpers.h>
48 bool bNodeBinary =
false;
58 auto const account = parseBase58<AccountID>(
60 if (!account || account->
isZero())
61 jvResult[jss::error] =
"malformedAddress";
80 uNodeIndex = beast::zero;
81 jvResult[jss::error] =
"malformedRequest";
90 jvResult[jss::error] =
"malformedRequest";
94 auto const owner = parseBase58<AccountID>(
97 auto const authorized = parseBase58<AccountID>(
98 context.
params[jss::deposit_preauth][jss::authorized]
102 jvResult[jss::error] =
"malformedOwner";
104 jvResult[jss::error] =
"malformedAuthorized";
114 jvResult[jss::error] =
"malformedRequest";
124 jvResult[jss::error] =
"malformedRequest";
130 ? context.
params[jss::directory][jss::sub_index].
asUInt()
138 jvResult[jss::error] =
"malformedRequest";
144 context.
params[jss::directory][jss::dir_root]
152 auto const ownerID = parseBase58<AccountID>(
157 jvResult[jss::error] =
"malformedAddress";
167 jvResult[jss::error] =
"malformedRequest";
183 jvResult[jss::error] =
"malformedRequest";
187 auto const id = parseBase58<AccountID>(
190 jvResult[jss::error] =
"malformedOwner";
210 jvResult[jss::error] =
"malformedRequest";
214 auto const id = parseBase58<AccountID>(
217 jvResult[jss::error] =
"malformedAddress";
237 !jvRippleState.
isMember(jss::currency) ||
238 !jvRippleState.
isMember(jss::accounts) ||
239 !jvRippleState[jss::accounts].
isArray() ||
240 2 != jvRippleState[jss::accounts].
size() ||
241 !jvRippleState[jss::accounts][0u].
isString() ||
242 !jvRippleState[jss::accounts][1u].
isString() ||
243 (jvRippleState[jss::accounts][0u].
asString() ==
244 jvRippleState[jss::accounts][1u].
asString()))
246 jvResult[jss::error] =
"malformedRequest";
250 auto const id1 = parseBase58<AccountID>(
251 jvRippleState[jss::accounts][0u].asString());
252 auto const id2 = parseBase58<AccountID>(
253 jvRippleState[jss::accounts][1u].asString());
256 jvResult[jss::error] =
"malformedAddress";
259 uCurrency, jvRippleState[jss::currency].asString()))
261 jvResult[jss::error] =
"malformedCurrency";
281 jvResult[jss::error] =
"malformedRequest";
285 auto const id = parseBase58<AccountID>(
288 jvResult[jss::error] =
"malformedAddress";
291 *
id, context.
params[jss::ticket][jss::ticket_seq].
asUInt());
296 jvResult[jss::error] =
"unknownOption";
308 jvResult[jss::error] =
"entryNotFound";
311 (expectedType !=
ltANY) && (expectedType != sleNode->getType()))
313 jvResult[jss::error] =
"malformedRequest";
315 else if (bNodeBinary)
322 jvResult[jss::index] =
to_string(uNodeIndex);
327 jvResult[jss::index] =
to_string(uNodeIndex);
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
bool to_currency(Currency ¤cy, std::string const &code)
Tries to convert a string to a Currency, returns true on success.
Json::Value doLedgerEntry(RPC::JsonContext &)
@ ltANY
Special type, anything This is used when the type in the Keylet is unknown, such as when building met...
Keylet offer(AccountID const &id, std::uint32_t seq) noexcept
An offer from an account.
bool isNull() const
isNull() tests to see if this field is null.
std::string to_string(ListDisposition disposition)
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.
uint256 getTicketIndex(AccountID const &account, std::uint32_t ticketSeq)
Keylet escrow(AccountID const &src, std::uint32_t seq) noexcept
An escrow entry.
static bool authorized(Port const &port, std::map< std::string, std::string > const &h)
Keylet account(AccountID const &id) noexcept
AccountID root.
Keylet page(uint256 const &key, std::uint64_t index) noexcept
A page in a directory.
bool SetHex(const char *psz, bool bStrict=false)
Parse a hex string into a base_uint The input can be:
UInt size() const
Number of values in array or object.
bool isMember(const char *key) const
Return true if the object has a member named key.
Keylet line(AccountID const &id0, AccountID const &id1, Currency const ¤cy) noexcept
The index of a trust line for a given currency.
Keylet unchecked(uint256 const &key) noexcept
Any ledger entry.
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
LedgerEntryType
Ledger entry types.
Blob const & peekData() const
std::string strHex(FwdIt begin, FwdIt end)
@ ltDIR_NODE
Directory node.
Keylet depositPreauth(AccountID const &owner, AccountID const &preauthorized) noexcept
A DepositPreauth.
std::string asString() const
Returns the unquoted string value.