1#include <xrpld/rpc/Context.h>
2#include <xrpld/rpc/detail/RPCLedgerHelpers.h>
3#include <xrpld/rpc/detail/TrustLine.h>
5#include <xrpl/json/json_value.h>
6#include <xrpl/ledger/ReadView.h>
7#include <xrpl/protocol/AccountID.h>
8#include <xrpl/protocol/ErrorCodes.h>
9#include <xrpl/protocol/Indexes.h>
10#include <xrpl/protocol/RPCErr.h>
11#include <xrpl/protocol/STAmount.h>
12#include <xrpl/protocol/UintTypes.h>
13#include <xrpl/protocol/jss.h>
24 auto& params = context.
params;
26 if (!(params.isMember(jss::account) || params.isMember(jss::ident)))
30 if (params.isMember(jss::account))
32 if (!params[jss::account].isString())
34 strIdent = params[jss::account].asString();
36 else if (params.isMember(jss::ident))
38 if (!params[jss::ident].isString())
40 strIdent = params[jss::ident].asString();
56 auto const accountID{
id.value()};
64 STAmount const& saBalance = rspEntry.getBalance();
66 if (saBalance < rspEntry.getLimit())
68 if ((-saBalance) < rspEntry.getLimitPeer())
76 for (
auto const& c : send)
80 for (
auto const& c : receive)
Value & append(Value const &value)
Append value to array at the end.
A currency issued by an account.
static std::vector< RPCTrustLine > getItems(AccountID const &accountID, ReadView const &view)
constexpr TIss const & get() const
@ Array
array value (ordered list)
Status lookupLedger(std::shared_ptr< ReadView const > &ledger, JsonContext const &context, json::Value &result)
Looks up a ledger from a request and fills a json::Value with ledger data.
void injectError(ErrorCodeI code, json::Value &json)
Add or update the json update to reflect the error code.
json::Value invalidFieldError(std::string const &name)
json::Value missingFieldError(std::string const &name)
Keylet account(AccountID const &id) noexcept
AccountID root.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::optional< AccountID > parseBase58(std::string const &s)
Parse AccountID from checked, base58 string.
std::string to_string(BaseUInt< Bits, Tag > const &a)
json::Value rpcError(ErrorCodeI iError)
json::Value doAccountCurrencies(RPC::JsonContext &context)
Currency const & badCurrency()
We deliberately disallow the currency that looks like "XRP" because too many people were using it ins...