xrpld
Loading...
Searching...
No Matches
NFTSellOffers.cpp
1#include <xrpld/rpc/Context.h>
2#include <xrpld/rpc/handlers/orderbook/NFTOffersHelpers.h>
3
4#include <xrpl/basics/base_uint.h>
5#include <xrpl/json/json_value.h>
6#include <xrpl/protocol/ErrorCodes.h>
7#include <xrpl/protocol/Indexes.h>
8#include <xrpl/protocol/jss.h>
9
10namespace xrpl {
11
12json::Value
14{
15 if (!context.params.isMember(jss::nft_id))
16 return RPC::missingFieldError(jss::nft_id);
17
18 uint256 nftId;
19
20 if (!nftId.parseHex(context.params[jss::nft_id].asString()))
21 return RPC::invalidFieldError(jss::nft_id);
22
23 return enumerateNFTOffers(context, nftId, keylet::nftSells(nftId));
24}
25
26} // namespace xrpl
std::string asString() const
Returns the unquoted string value.
bool isMember(char const *key) const
Return true if the object has a member named key.
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
Definition base_uint.h:507
json::Value invalidFieldError(std::string const &name)
Definition ErrorCodes.h:273
json::Value missingFieldError(std::string const &name)
Definition ErrorCodes.h:231
Keylet nftSells(uint256 const &id) noexcept
The directory of sell offers for the specified NFT.
Definition Indexes.cpp:419
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
json::Value doNFTSellOffers(RPC::JsonContext &)
json::Value enumerateNFTOffers(RPC::JsonContext &context, uint256 const &nftId, Keylet const &directory)
BaseUInt< 256 > uint256
Definition base_uint.h:562
json::Value params
Definition Context.h:43