xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
xrpld
rpc
handlers
orderbook
NFTBuyOffers.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
10
namespace
xrpl
{
11
12
json::Value
13
doNFTBuyOffers
(
rpc::JsonContext
& context)
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::nftBuys
(nftId));
24
}
25
26
}
// namespace xrpl
json::Value::asString
std::string asString() const
Returns the unquoted string value.
Definition
json_value.cpp:494
json::Value::isMember
bool isMember(char const *key) const
Return true if the object has a member named key.
Definition
json_value.cpp:1049
xrpl::BaseUInt::parseHex
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
Definition
base_uint.h:525
xrpl::keylet::nftBuys
Keylet nftBuys(UInt256 const &id) noexcept
The directory of buy offers for the specified NFT.
Definition
Indexes.cpp:459
xrpl::rpc::invalidFieldError
json::Value invalidFieldError(std::string const &name)
Definition
ErrorCodes.h:285
xrpl::rpc::missingFieldError
json::Value missingFieldError(std::string const &name)
Definition
ErrorCodes.h:243
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::enumerateNFTOffers
json::Value enumerateNFTOffers(rpc::JsonContext &context, UInt256 const &nftId, Keylet const &directory)
Definition
NFTOffersHelpers.h:55
xrpl::doNFTBuyOffers
json::Value doNFTBuyOffers(rpc::JsonContext &)
Definition
NFTBuyOffers.cpp:13
xrpl::UInt256
BaseUInt< 256 > UInt256
Definition
base_uint.h:580
xrpl::rpc::JsonContext
Definition
Context.h:41
xrpl::rpc::JsonContext::params
json::Value params
Definition
Context.h:51
Generated by
1.17.0