1#include <xrpl/protocol/NFTokenID.h>
3#include <xrpl/basics/base_uint.h>
4#include <xrpl/json/json_value.h>
5#include <xrpl/protocol/LedgerFormats.h>
6#include <xrpl/protocol/SField.h>
7#include <xrpl/protocol/STArray.h>
8#include <xrpl/protocol/STObject.h>
9#include <xrpl/protocol/STTx.h>
10#include <xrpl/protocol/TER.h>
11#include <xrpl/protocol/TxFormats.h>
12#include <xrpl/protocol/TxMeta.h>
13#include <xrpl/protocol/jss.h>
29 TxType const tt = serializedTx->getTxnType();
30 if (tt != ttNFTOKEN_MINT && tt != ttNFTOKEN_ACCEPT_OFFER && tt != ttNFTOKEN_CANCEL_OFFER)
51 if (node.getFieldU16(sfLedgerEntryType) != ltNFTOKEN_PAGE)
54 SField const& fName = node.getFName();
55 if (fName == sfCreatedNode)
58 node.peekAtField(sfNewFields).
downcast<
STObject>().getFieldArray(sfNFTokens);
61 return nft.getFieldH256(sfNFTokenID);
64 else if (fName == sfModifiedNode)
83 return nft.getFieldH256(sfNFTokenID);
87 node.peekAtField(sfFinalFields).
downcast<
STObject>().getFieldArray(sfNFTokens);
90 return nft.getFieldH256(sfNFTokenID);
97 if (finalIDs.
size() != prevIDs.
size() + 1)
106 if (diff.in1 == finalIDs.
end())
118 if (node.getFieldU16(sfLedgerEntryType) != ltNFTOKEN_OFFER ||
119 node.getFName() != sfDeletedNode)
122 auto const& toAddNFT =
123 node.peekAtField(sfFinalFields).downcast<
STObject>().getFieldH256(sfNFTokenID);
131 tokenIDResult.
erase(uniq.begin(), uniq.end());
132 return tokenIDResult;
139 TxMeta const& transactionMeta)
145 if (
auto const type = transaction->getTxnType(); type == ttNFTOKEN_MINT)
151 else if (type == ttNFTOKEN_ACCEPT_OFFER)
158 else if (type == ttNFTOKEN_CANCEL_OFFER)
163 for (
auto const& nftID : result)
T back_inserter(T... args)
Value & append(Value const &value)
Append value to array at the end.
STArray const & getFieldArray(SField const &field) const
bool isFieldPresent(SField const &field) const
STBase const & peekAtField(SField const &field) const
@ Array
array value (ordered list)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::vector< uint256 > getNFTokenIDFromDeletedOffer(TxMeta const &transactionMeta)
TxType
Transaction type identifiers.
bool canHaveNFTokenID(std::shared_ptr< STTx const > const &serializedTx, TxMeta const &transactionMeta)
Add a nftoken_ids field to the meta output parameter.
std::string to_string(BaseUInt< Bits, Tag > const &a)
void insertNFTokenID(json::Value &response, std::shared_ptr< STTx const > const &transaction, TxMeta const &transactionMeta)
bool isTesSuccess(TER x) noexcept
std::optional< uint256 > getNFTokenIDFromPage(TxMeta const &transactionMeta)