rippled
Loading...
Searching...
No Matches
NFTokenOffer.h
1// This file is auto-generated. Do not edit.
2#pragma once
3
4#include <xrpl/protocol/STLedgerEntry.h>
5#include <xrpl/protocol/STParsedJSON.h>
6#include <xrpl/protocol/jss.h>
7#include <xrpl/protocol_autogen/LedgerEntryBase.h>
8#include <xrpl/protocol_autogen/LedgerEntryBuilderBase.h>
9#include <xrpl/json/json_value.h>
10
11#include <stdexcept>
12#include <optional>
13
14namespace xrpl::ledger_entries {
15
16class NFTokenOfferBuilder;
17
28{
29public:
30 static constexpr LedgerEntryType entryType = ltNFTOKEN_OFFER;
31
37 : LedgerEntryBase(std::move(sle))
38 {
39 // Verify ledger entry type
40 if (sle_->getType() != entryType)
41 {
42 throw std::runtime_error("Invalid ledger entry type for NFTokenOffer");
43 }
44 }
45
46 // Ledger entry-specific field getters
47
52 [[nodiscard]]
53 SF_ACCOUNT::type::value_type
54 getOwner() const
55 {
56 return this->sle_->at(sfOwner);
57 }
58
63 [[nodiscard]]
64 SF_UINT256::type::value_type
66 {
67 return this->sle_->at(sfNFTokenID);
68 }
69
74 [[nodiscard]]
75 SF_AMOUNT::type::value_type
76 getAmount() const
77 {
78 return this->sle_->at(sfAmount);
79 }
80
85 [[nodiscard]]
86 SF_UINT64::type::value_type
88 {
89 return this->sle_->at(sfOwnerNode);
90 }
91
96 [[nodiscard]]
97 SF_UINT64::type::value_type
99 {
100 return this->sle_->at(sfNFTokenOfferNode);
101 }
102
107 [[nodiscard]]
110 {
111 if (hasDestination())
112 return this->sle_->at(sfDestination);
113 return std::nullopt;
114 }
115
120 [[nodiscard]]
121 bool
123 {
124 return this->sle_->isFieldPresent(sfDestination);
125 }
126
131 [[nodiscard]]
134 {
135 if (hasExpiration())
136 return this->sle_->at(sfExpiration);
137 return std::nullopt;
138 }
139
144 [[nodiscard]]
145 bool
147 {
148 return this->sle_->isFieldPresent(sfExpiration);
149 }
150
155 [[nodiscard]]
156 SF_UINT256::type::value_type
158 {
159 return this->sle_->at(sfPreviousTxnID);
160 }
161
166 [[nodiscard]]
167 SF_UINT32::type::value_type
169 {
170 return this->sle_->at(sfPreviousTxnLgrSeq);
171 }
172};
173
181class NFTokenOfferBuilder : public LedgerEntryBuilderBase<NFTokenOfferBuilder>
182{
183public:
205
212 {
213 if (sle->at(sfLedgerEntryType) != ltNFTOKEN_OFFER)
214 {
215 throw std::runtime_error("Invalid ledger entry type for NFTokenOffer");
216 }
217 object_ = *sle;
218 }
219
228 {
229 object_[sfOwner] = value;
230 return *this;
231 }
232
239 {
240 object_[sfNFTokenID] = value;
241 return *this;
242 }
243
250 {
251 object_[sfAmount] = value;
252 return *this;
253 }
254
261 {
262 object_[sfOwnerNode] = value;
263 return *this;
264 }
265
272 {
273 object_[sfNFTokenOfferNode] = value;
274 return *this;
275 }
276
283 {
284 object_[sfDestination] = value;
285 return *this;
286 }
287
294 {
295 object_[sfExpiration] = value;
296 return *this;
297 }
298
305 {
306 object_[sfPreviousTxnID] = value;
307 return *this;
308 }
309
316 {
317 object_[sfPreviousTxnLgrSeq] = value;
318 return *this;
319 }
320
327 build(uint256 const& index)
328 {
329 return NFTokenOffer{std::make_shared<SLE>(std::move(object_), index)};
330 }
331};
332
333} // namespace xrpl::ledger_entries
Base class for type-safe ledger entry wrappers.
std::shared_ptr< SLE const > sle_
The underlying serialized ledger entry being wrapped.
Base class for all ledger entry builders.
Builder for NFTokenOffer ledger entries.
NFTokenOfferBuilder & setExpiration(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfExpiration (soeOPTIONAL)
NFTokenOfferBuilder & setOwner(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Ledger entry-specific field setters.
NFTokenOfferBuilder & setPreviousTxnID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfPreviousTxnID (soeREQUIRED)
NFTokenOfferBuilder & setDestination(std::decay_t< typename SF_ACCOUNT::type::value_type > const &value)
Set sfDestination (soeOPTIONAL)
NFTokenOfferBuilder & setAmount(std::decay_t< typename SF_AMOUNT::type::value_type > const &value)
Set sfAmount (soeREQUIRED)
NFTokenOfferBuilder & setNFTokenOfferNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfNFTokenOfferNode (soeREQUIRED)
NFTokenOfferBuilder & setOwnerNode(std::decay_t< typename SF_UINT64::type::value_type > const &value)
Set sfOwnerNode (soeREQUIRED)
NFTokenOfferBuilder & setPreviousTxnLgrSeq(std::decay_t< typename SF_UINT32::type::value_type > const &value)
Set sfPreviousTxnLgrSeq (soeREQUIRED)
NFTokenOfferBuilder(std::shared_ptr< SLE const > sle)
Construct a NFTokenOfferBuilder from an existing SLE object.
NFTokenOffer build(uint256 const &index)
Build and return the completed NFTokenOffer wrapper.
NFTokenOfferBuilder & setNFTokenID(std::decay_t< typename SF_UINT256::type::value_type > const &value)
Set sfNFTokenID (soeREQUIRED)
NFTokenOfferBuilder(std::decay_t< typename SF_ACCOUNT::type::value_type > const &owner, std::decay_t< typename SF_UINT256::type::value_type > const &nFTokenID, std::decay_t< typename SF_AMOUNT::type::value_type > const &amount, std::decay_t< typename SF_UINT64::type::value_type > const &ownerNode, std::decay_t< typename SF_UINT64::type::value_type > const &nFTokenOfferNode, std::decay_t< typename SF_UINT256::type::value_type > const &previousTxnID, std::decay_t< typename SF_UINT32::type::value_type > const &previousTxnLgrSeq)
Construct a new NFTokenOfferBuilder with required fields.
Ledger Entry: NFTokenOffer.
protocol_autogen::Optional< SF_UINT32::type::value_type > getExpiration() const
Get sfExpiration (soeOPTIONAL)
static constexpr LedgerEntryType entryType
protocol_autogen::Optional< SF_ACCOUNT::type::value_type > getDestination() const
Get sfDestination (soeOPTIONAL)
NFTokenOffer(std::shared_ptr< SLE const > sle)
Construct a NFTokenOffer ledger entry wrapper from an existing SLE object.
SF_AMOUNT::type::value_type getAmount() const
Get sfAmount (soeREQUIRED)
SF_UINT64::type::value_type getOwnerNode() const
Get sfOwnerNode (soeREQUIRED)
bool hasDestination() const
Check if sfDestination is present.
SF_UINT32::type::value_type getPreviousTxnLgrSeq() const
Get sfPreviousTxnLgrSeq (soeREQUIRED)
SF_UINT256::type::value_type getNFTokenID() const
Get sfNFTokenID (soeREQUIRED)
SF_ACCOUNT::type::value_type getOwner() const
Get sfOwner (soeREQUIRED)
bool hasExpiration() const
Check if sfExpiration is present.
SF_UINT256::type::value_type getPreviousTxnID() const
Get sfPreviousTxnID (soeREQUIRED)
SF_UINT64::type::value_type getNFTokenOfferNode() const
Get sfNFTokenOfferNode (soeREQUIRED)
T is_same_v
STL namespace.
LedgerEntryType
Identifiers for on-ledger objects.