20 #include <ripple/ledger/ReadView.h>
21 #include <ripple/net/RPCErr.h>
22 #include <ripple/protocol/ErrorCodes.h>
23 #include <ripple/protocol/Indexes.h>
24 #include <ripple/protocol/jss.h>
25 #include <ripple/rpc/Context.h>
26 #include <ripple/rpc/impl/RPCHelpers.h>
43 if (!params.
isMember(jss::source_account))
45 if (!params[jss::source_account].isString())
50 auto srcID = parseBase58<AccountID>(params[jss::source_account].asString());
53 auto const srcAcct{std::move(srcID.value())};
56 if (!params.
isMember(jss::destination_account))
58 if (!params[jss::destination_account].isString())
64 parseBase58<AccountID>(params[jss::destination_account].asString());
67 auto const dstAcct{std::move(dstID.value())};
92 bool depositAuthorized{
true};
93 if (srcAcct != dstAcct)
100 auto const sleDepositAuth =
102 depositAuthorized =
static_cast<bool>(sleDepositAuth);
105 result[jss::source_account] = params[jss::source_account].
asString();
106 result[jss::destination_account] =
107 params[jss::destination_account].
asString();
109 result[jss::deposit_authorized] = depositAuthorized;
Json::Value rpcError(int iError)
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.
Json::Value missing_field_error(std::string const &name)
std::string expected_field_message(std::string const &name, std::string const &type)
Keylet account(AccountID const &id) noexcept
AccountID root.
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
bool isMember(const char *key) const
Return true if the object has a member named key.
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.
Json::Value doDepositAuthorized(RPC::JsonContext &context)
Keylet depositPreauth(AccountID const &owner, AccountID const &preauthorized) noexcept
A DepositPreauth.
void inject_error(error_code_i code, JsonValue &json)
Add or update the json update to reflect the error code.
Json::Value make_error(error_code_i code)
Returns a new json object that reflects the error code.
std::string asString() const
Returns the unquoted string value.