1#include <xrpl/tx/transactors/nft/NFTokenCancelOffer.h>
3#include <xrpl/basics/Log.h>
4#include <xrpl/basics/base_uint.h>
5#include <xrpl/ledger/View.h>
6#include <xrpl/ledger/helpers/NFTokenHelpers.h>
7#include <xrpl/protocol/Feature.h>
8#include <xrpl/protocol/Indexes.h>
9#include <xrpl/protocol/LedgerFormats.h>
10#include <xrpl/protocol/Protocol.h>
11#include <xrpl/protocol/SField.h>
12#include <xrpl/protocol/STLedgerEntry.h>
13#include <xrpl/protocol/STTx.h>
14#include <xrpl/protocol/STVector256.h>
15#include <xrpl/protocol/TER.h>
16#include <xrpl/protocol/XRPAmount.h>
17#include <xrpl/tx/Transactor.h>
25 auto const& offerIds = ctx.
tx[sfNFTokenOffers];
48 auto const account = ctx.
tx[sfAccount];
50 auto const& ids = ctx.
tx[sfNFTokenOffers];
62 if (offer->getType() != ltNFTOKEN_OFFER)
70 if ((*offer)[sfOwner] == account)
74 if (
auto const dest = (*offer)[~sfDestination]; dest == account)
89 for (
auto const&
id :
ctx_.tx[sfNFTokenOffers])
95 JLOG(
j_.fatal()) <<
"Unable to delete token offer " <<
id <<
" (ledger " <<
view().
seq()
T adjacent_find(T... args)
A generic endpoint for log messages.
static NotTEC preflight(PreflightContext const &ctx)
static TER preclaim(PreclaimContext const &ctx)
void visitInvariantEntry(bool isDelete, SLE::const_ref before, SLE::const_ref after) override
Inspect a single ledger entry modified by this transaction.
bool finalizeInvariants(STTx const &tx, TER result, XRPAmount fee, ReadView const &view, beast::Journal const &j) override
Check transaction-specific post-conditions after all entries have been visited.
virtual SLE::const_pointer read(Keylet const &k) const =0
Return the state item associated with a key.
LedgerIndex seq() const
Returns the sequence number of the base ledger.
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
std::shared_ptr< STLedgerEntry const > const & const_ref
STVector256 const & getFieldV256(SField const &field) const
std::vector< uint256 >::iterator end()
Keylet child(uint256 const &key) noexcept
Any item that can be in an owner dir.
Keylet nftokenOffer(AccountID const &owner, std::uint32_t seq)
An offer from an account to buy or sell an NFT.
bool deleteTokenOffer(ApplyView &view, SLE::ref offer)
Deletes the given token offer.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool hasExpired(ReadView const &view, std::optional< std::uint32_t > const &exp)
Determines whether the given expiration time has passed.
TERSubset< CanCvtToNotTEC > NotTEC
constexpr std::size_t kMaxTokenOfferCancelCount
The maximum number of token offers that can be canceled at once.
TERSubset< CanCvtToTER > TER
State information when determining if a tx is likely to claim a fee.
State information when preflighting a tx.