20 #include <ripple/app/main/Application.h>
21 #include <ripple/app/tx/impl/details/NFTokenUtils.h>
22 #include <ripple/json/json_writer.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/LedgerFormats.h>
28 #include <ripple/protocol/jss.h>
29 #include <ripple/protocol/nftPageMask.h>
30 #include <ripple/resource/Fees.h>
31 #include <ripple/rpc/Context.h>
32 #include <ripple/rpc/impl/RPCHelpers.h>
33 #include <ripple/rpc/impl/Tuning.h>
54 auto const& params = context.
params;
55 if (!params.isMember(jss::account))
60 if (ledger ==
nullptr)
63 auto id = parseBase58<AccountID>(params[jss::account].asString());
69 auto const accountID{std::move(
id.value())};
80 if (params.isMember(jss::marker))
82 auto const& m = params[jss::marker];
95 ledger->
succ(first.key, last.key.next()).value_or(last.key)));
101 bool pastMarker = marker.
isZero();
107 for (
auto const& o : arr)
123 if (!pastMarker && maskedNftokenID < maskedMarker)
126 if (!pastMarker && maskedNftokenID == maskedMarker &&
147 result[jss::limit] = limit;
159 result[jss::account] =
toBase58(accountID);
167 auto const& params = context.
params;
168 if (!params.isMember(jss::account))
173 if (ledger ==
nullptr)
176 auto const id = parseBase58<AccountID>(params[jss::account].asString());
182 auto const accountID{std::move(
id.value())};
189 if (params.isMember(jss::deletion_blockers_only) &&
190 params[jss::deletion_blockers_only].asBool())
196 }
static constexpr deletionBlockers[] = {
204 typeFilter->reserve(
std::size(deletionBlockers));
206 for (
auto [name, type] : deletionBlockers)
208 if (params.isMember(jss::type) && name != params[jss::type])
213 typeFilter->push_back(type);
223 rpcStatus.inject(result);
226 else if (type !=
ltANY)
238 if (params.isMember(jss::marker))
240 auto const& marker = params[jss::marker];
241 if (!marker.isString())
271 result[jss::account] =
toBase58(accountID);
Json::Value doAccountNFTs(RPC::JsonContext &context)
General RPC command that can retrieve objects in the account root.
A pair of SHAMap key and LedgerEntryType.
std::uint16_t getFlags(uint256 const &id)
Json::Value rpcError(int iError)
@ ltANY
A special type, matching any ledger entry type.
const Charge feeMediumBurdenRPC
const SF_UINT256 sfNFTokenID
@ arrayValue
array value (ordered list)
Json::Value doAccountObjects(RPC::JsonContext &context)
static constexpr LimitRange accountNFTokens
Limits for the account_nftokens command, in pages.
bool getAccountObjects(ReadView const &ledger, AccountID const &account, std::optional< std::vector< LedgerEntryType >> const &typeFilter, uint256 dirIndex, uint256 entryIndex, std::uint32_t const limit, Json::Value &jvResult)
Gathers all objects for an account in a ledger.
Resource::Charge & loadType
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
@ ltCHECK
A ledger object which describes a check.
const Json::StaticString jsonName
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 expected_field_error(std::string const &name, std::string const &type)
const SF_UINT16 sfTransferFee
constexpr uint256 pageMask(std::string_view("0000000000000000000000000000000000000000ffffffffffffffffffffffff"))
Json::Value missing_field_error(std::string const &name)
AccountID getIssuer(uint256 const &id)
Keylet nftpage_min(AccountID const &owner)
NFT page keylets.
Keylet nftpage(Keylet const &k, uint256 const &token)
Value & append(const Value &value)
Append value to array at the end.
Keylet account(AccountID const &id) noexcept
AccountID root.
std::uint32_t toUInt32(Taxon t)
@ ltESCROW
A ledger object describing a single escrow.
Keylet nftpage_max(AccountID const &owner)
A keylet for the owner's last possible NFT page.
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
std::uint32_t getSerial(uint256 const &id)
virtual std::optional< key_type > succ(key_type const &key, std::optional< key_type > const &last=std::nullopt) const =0
Return the key of the next state item.
static constexpr LimitRange accountObjects
Limits for the account_objects command.
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
@ ltNFTOKEN_PAGE
A ledger object which contains a list of NFTs.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
LedgerEntryType
Identifiers for on-ledger objects.
const SF_ACCOUNT sfIssuer
std::pair< RPC::Status, LedgerEntryType > chooseLedgerEntryType(Json::Value const ¶ms)
Lightweight wrapper to tag static string.
const SF_UINT256 sfNextPageMin
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
const SF_UINT32 sfNFTokenTaxon
@ ltRIPPLE_STATE
A ledger object which describes a bidirectional trust line.
std::uint16_t getTransferFee(uint256 const &id)
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
Taxon getTaxon(uint256 const &id)
void inject_error(error_code_i code, JsonValue &json)
Add or update the json update to reflect the error code.
Json::Value invalid_field_error(std::string const &name)
@ ltPAYCHAN
A ledger object describing a single unidirectional XRP payment channel.