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)
75 auto const& previousFields = node.peekAtField(sfPreviousFields).downcast<
STObject>();
76 if (!previousFields.isFieldPresent(sfNFTokens))
79 STArray const& toAddPrevNFTs = previousFields.getFieldArray(sfNFTokens);
82 return nft.getFieldH256(sfNFTokenID);
86 node.peekAtField(sfFinalFields).
downcast<
STObject>().getFieldArray(sfNFTokens);
89 return nft.getFieldH256(sfNFTokenID);
96 if (finalIDs.
size() != prevIDs.
size() + 1)
105 if (diff.in1 == finalIDs.
end())
117 if (node.getFieldU16(sfLedgerEntryType) != ltNFTOKEN_OFFER ||
118 node.getFName() != sfDeletedNode)
121 auto const& toAddNFT =
122 node.peekAtField(sfFinalFields).downcast<
STObject>().getFieldH256(sfNFTokenID);
130 tokenIDResult.
erase(uniq.begin(), uniq.end());
131 return tokenIDResult;
138 TxMeta const& transactionMeta)
144 if (
auto const type = transaction->getTxnType(); type == ttNFTOKEN_MINT)
150 else if (type == ttNFTOKEN_ACCEPT_OFFER)
157 else if (type == ttNFTOKEN_CANCEL_OFFER)
162 for (
auto const& nftID : result)
T back_inserter(T... args)
Value & append(Value const &value)
Append value to array at the end.
@ 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)