xrpld
Loading...
Searching...
No Matches
NFTokenHelpers.h
1#pragma once
2
3#include <xrpl/basics/Slice.h>
4#include <xrpl/basics/base_uint.h>
5#include <xrpl/beast/utility/Journal.h>
6#include <xrpl/ledger/ApplyView.h>
7#include <xrpl/ledger/ReadView.h>
8#include <xrpl/protocol/AccountID.h>
9#include <xrpl/protocol/Issue.h>
10#include <xrpl/protocol/Keylet.h>
11#include <xrpl/protocol/Rules.h>
12#include <xrpl/protocol/STAmount.h>
13#include <xrpl/protocol/STLedgerEntry.h>
14#include <xrpl/protocol/STObject.h>
15#include <xrpl/protocol/SeqProxy.h>
16#include <xrpl/protocol/TER.h>
17#include <xrpl/protocol/TxFlags.h>
18#include <xrpl/protocol/XRPAmount.h>
19
20#include <cstddef>
21#include <cstdint>
22#include <optional>
23#include <utility>
24
25namespace xrpl::nft {
26
33 ApplyView& view,
34 Keylet const& directory,
35 std::size_t maxDeletableOffers);
36
41findToken(ReadView const& view, AccountID const& owner, uint256 const& nftokenID);
42
56findTokenAndPage(ApplyView& view, AccountID const& owner, uint256 const& nftokenID);
57
61TER
63
67TER
68removeToken(ApplyView& view, AccountID const& owner, uint256 const& nftokenID);
69
70TER
71removeToken(ApplyView& view, AccountID const& owner, uint256 const& nftokenID, SLE::ref page);
72
83bool
85
91bool
93
94bool
95compareTokens(uint256 const& a, uint256 const& b);
96
97TER
99 ApplyView& view,
100 AccountID const& owner,
101 uint256 const& nftokenID,
102 std::optional<xrpl::Slice> const& uri);
103
107NotTEC
109 AccountID const& acctID,
110 STAmount const& amount,
111 std::optional<AccountID> const& dest,
112 std::optional<std::uint32_t> const& expiration,
113 std::uint16_t nftFlags,
114 Rules const& rules,
115 std::optional<AccountID> const& owner = std::nullopt,
116 std::uint32_t txFlags = tfSellNFToken);
117
121TER
123 ReadView const& view,
124 AccountID const& acctID,
125 AccountID const& nftIssuer,
126 STAmount const& amount,
127 std::optional<AccountID> const& dest,
128 std::uint16_t nftFlags,
129 std::uint16_t xferFee,
131 std::optional<AccountID> const& owner = std::nullopt,
132 std::uint32_t txFlags = tfSellNFToken);
133
137TER
139 ApplyView& view,
140 AccountID const& acctID,
141 STAmount const& amount,
142 std::optional<AccountID> const& dest,
143 std::optional<std::uint32_t> const& expiration,
144 SeqProxy seqProxy,
145 uint256 const& nftokenID,
146 XRPAmount const& priorBalance,
148 std::uint32_t txFlags = tfSellNFToken);
149
150TER
152 ReadView const& view,
153 AccountID const id,
154 beast::Journal const j,
155 Issue const& issue);
156
157TER
159 ReadView const& view,
160 AccountID const id,
161 beast::Journal const j,
162 Issue const& issue);
163
164} // namespace xrpl::nft
A generic endpoint for log messages.
Definition Journal.h:44
Writeable view to a ledger, for applying a transaction.
Definition ApplyView.h:134
A currency issued by an account.
Definition Issue.h:18
A view into a ledger.
Definition ReadView.h:41
Rules controlling protocol behavior.
Definition Rules.h:40
std::shared_ptr< STLedgerEntry > const & ref
std::shared_ptr< STLedgerEntry > pointer
A type that represents either a sequence value or a ticket value.
Definition SeqProxy.h:37
STL namespace.
TER tokenOfferCreatePreclaim(ReadView const &view, AccountID const &acctID, AccountID const &nftIssuer, STAmount const &amount, std::optional< AccountID > const &dest, std::uint16_t nftFlags, std::uint16_t xferFee, beast::Journal j, std::optional< AccountID > const &owner=std::nullopt, std::uint32_t txFlags=tfSellNFToken)
Preclaim checks shared by NFTokenCreateOffer and NFTokenMint.
TER insertToken(ApplyView &view, AccountID owner, STObject &&nft)
Insert the token in the owner's token directory.
TER changeTokenURI(ApplyView &view, AccountID const &owner, uint256 const &nftokenID, std::optional< xrpl::Slice > const &uri)
TER removeToken(ApplyView &view, AccountID const &owner, uint256 const &nftokenID)
Remove the token from the owner's token directory.
TER checkTrustlineDeepFrozen(ReadView const &view, AccountID const id, beast::Journal const j, Issue const &issue)
TER checkTrustlineAuthorized(ReadView const &view, AccountID const id, beast::Journal const j, Issue const &issue)
std::size_t removeTokenOffersWithLimit(ApplyView &view, Keylet const &directory, std::size_t maxDeletableOffers)
Delete up to a specified number of offers from the specified token offer directory.
std::optional< STObject > findToken(ReadView const &view, AccountID const &owner, uint256 const &nftokenID)
Finds the specified token in the owner's token directory.
bool compareTokens(uint256 const &a, uint256 const &b)
TER tokenOfferCreateApply(ApplyView &view, AccountID const &acctID, STAmount const &amount, std::optional< AccountID > const &dest, std::optional< std::uint32_t > const &expiration, SeqProxy seqProxy, uint256 const &nftokenID, XRPAmount const &priorBalance, beast::Journal j, std::uint32_t txFlags=tfSellNFToken)
doApply implementation shared by NFTokenCreateOffer and NFTokenMint
bool repairNFTokenDirectoryLinks(ApplyView &view, AccountID const &owner)
Repairs the links in an NFTokenPage directory.
NotTEC tokenOfferCreatePreflight(AccountID const &acctID, STAmount const &amount, std::optional< AccountID > const &dest, std::optional< std::uint32_t > const &expiration, std::uint16_t nftFlags, Rules const &rules, std::optional< AccountID > const &owner=std::nullopt, std::uint32_t txFlags=tfSellNFToken)
Preflight checks shared by NFTokenCreateOffer and NFTokenMint.
bool deleteTokenOffer(ApplyView &view, SLE::ref offer)
Deletes the given token offer.
std::optional< TokenAndPage > findTokenAndPage(ApplyView &view, AccountID const &owner, uint256 const &nftokenID)
TERSubset< CanCvtToNotTEC > NotTEC
Definition TER.h:607
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition AccountID.h:34
TERSubset< CanCvtToTER > TER
Definition TER.h:647
BaseUInt< 256 > uint256
Definition base_uint.h:580
A pair of SHAMap key and LedgerEntryType.
Definition Keylet.h:20
TokenAndPage(STObject token, SLE::pointer page)