1#include <xrpld/rpc/handlers/account/AccountCurrencies.h>
3#include <xrpld/rpc/Context.h>
4#include <xrpld/rpc/detail/RPCLedgerHelpers.h>
5#include <xrpld/rpc/detail/TrustLine.h>
7#include <xrpl/json/json_value.h>
8#include <xrpl/protocol/ErrorCodes.h>
9#include <xrpl/protocol/Indexes.h>
10#include <xrpl/protocol/STAmount.h>
11#include <xrpl/protocol/UintTypes.h>
12#include <xrpl/protocol/jss.h>
14#include <rpcspec/Errors.hpp>
24std::expected<AccountCurrenciesHandler::Output, ::rpc::Status>
29 status != ::rpc::Status::kOK)
32 if (!input.account.has_value())
37 auto const& accountID = *input.account;
44 STAmount const& saBalance = rspEntry.getBalance();
46 if (saBalance < rspEntry.getLimit())
48 if ((-saBalance) < rspEntry.getLimitPeer())
70 for (
auto const& c : output.
send)
74 for (
auto const& c : output.
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
std::reference_wrapper< JsonContext > context_
std::expected< Output, ::rpc::Status > process(Input const &input) const
Process the request.
AccountCurrenciesHandler(JsonContext &context)
Construct a handler for a single request.
void writeResult(json::Value &value, Output const &output) const
Write the output of process() into the response.
@ Array
array value (ordered list)
Keylet account(AccountID const &id) noexcept
AccountID root.
The api_version numbers this server serves.
void injectError(ErrorCodeI code, json::Value &json)
Add or update the json update to reflect the error code.
::rpc::Status getLedger(T &ledger, UInt256 const &ledgerHash, Context const &context)
Retrieves a ledger by its hash.
void injectLedgerFields(ReadView const &ledger, Context const &context, json::Value &result)
Writes the fields that identify a ledger into a result.
std::string to_string(BaseUInt< Bits, Tag > const &a)
Currency const & badCurrency()
We deliberately disallow the currency that looks like "XRP" because too many people were using it ins...
The data an account_currencies request produces, written out by writeResult().
std::optional< ErrorCodeI > error
An error written with the ledger fields.
std::set< Currency > receive
Currencies the account can receive.
std::shared_ptr< ReadView const > ledger
The ledger the request selected.
std::set< Currency > send
Currencies the account can send.