rippled
Loading...
Searching...
No Matches
NFTBuyOffers.cpp
1#include <xrpld/rpc/Context.h>
2#include <xrpld/rpc/handlers/orderbook/NFTOffersHelpers.h>
3
4#include <xrpl/protocol/ErrorCodes.h>
5#include <xrpl/protocol/RPCErr.h>
6#include <xrpl/protocol/jss.h>
7
8namespace xrpl {
9
12{
13 if (!context.params.isMember(jss::nft_id))
14 return RPC::missing_field_error(jss::nft_id);
15
16 uint256 nftId;
17
18 if (!nftId.parseHex(context.params[jss::nft_id].asString()))
19 return RPC::invalid_field_error(jss::nft_id);
20
21 return enumerateNFTOffers(context, nftId, keylet::nft_buys(nftId));
22}
23
24} // namespace xrpl
Represents a JSON value.
Definition json_value.h:130
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:476
Json::Value invalid_field_error(std::string const &name)
Definition ErrorCodes.h:273
Json::Value missing_field_error(std::string const &name)
Definition ErrorCodes.h:231
Keylet nft_buys(uint256 const &id) noexcept
The directory of buy offers for the specified NFT.
Definition Indexes.cpp:392
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
Json::Value enumerateNFTOffers(RPC::JsonContext &context, uint256 const &nftId, Keylet const &directory)
Json::Value doNFTBuyOffers(RPC::JsonContext &)
Json::Value params
Definition Context.h:43