rippled
Loading...
Searching...
No Matches
NFTokenUtils.h
1#pragma once
2
3#include <xrpl/basics/base_uint.h>
4#include <xrpl/ledger/ApplyView.h>
5#include <xrpl/protocol/AccountID.h>
6#include <xrpl/protocol/TER.h>
7#include <xrpl/protocol/TxFlags.h>
8#include <xrpl/protocol/nft.h>
9#include <xrpl/tx/Transactor.h>
10
11namespace xrpl {
12
13namespace nft {
14
19 ApplyView& view,
20 Keylet const& directory,
21 std::size_t maxDeletableOffers);
22
24TER
25notTooManyOffers(ReadView const& view, uint256 const& nftokenID);
26
29findToken(ReadView const& view, AccountID const& owner, uint256 const& nftokenID);
30
33{
36
38 : token(token_), page(std::move(page_))
39 {
40 }
41};
43findTokenAndPage(ApplyView& view, AccountID const& owner, uint256 const& nftokenID);
44
46TER
47insertToken(ApplyView& view, AccountID owner, STObject&& nft);
48
50TER
51removeToken(ApplyView& view, AccountID const& owner, uint256 const& nftokenID);
52
53TER
55 ApplyView& view,
56 AccountID const& owner,
57 uint256 const& nftokenID,
58 std::shared_ptr<SLE> const& page);
59
69bool
71
76bool
78
79bool
80compareTokens(uint256 const& a, uint256 const& b);
81
82TER
84 ApplyView& view,
85 AccountID const& owner,
86 uint256 const& nftokenID,
88
92 AccountID const& acctID,
93 STAmount const& amount,
94 std::optional<AccountID> const& dest,
95 std::optional<std::uint32_t> const& expiration,
96 std::uint16_t nftFlags,
97 Rules const& rules,
99 std::uint32_t txFlags = tfSellNFToken);
100
102TER
104 ReadView const& view,
105 AccountID const& acctID,
106 AccountID const& nftIssuer,
107 STAmount const& amount,
108 std::optional<AccountID> const& dest,
109 std::uint16_t nftFlags,
110 std::uint16_t xferFee,
113 std::uint32_t txFlags = tfSellNFToken);
114
116TER
118 ApplyView& view,
119 AccountID const& acctID,
120 STAmount const& amount,
121 std::optional<AccountID> const& dest,
122 std::optional<std::uint32_t> const& expiration,
123 SeqProxy seqProxy,
124 uint256 const& nftokenID,
125 XRPAmount const& priorBalance,
127 std::uint32_t txFlags = tfSellNFToken);
128
129TER
131 ReadView const& view,
132 AccountID const id,
133 beast::Journal const j,
134 Issue const& issue);
135
136TER
138 ReadView const& view,
139 AccountID const id,
140 beast::Journal const j,
141 Issue const& issue);
142
143} // namespace nft
144
145} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:40
Writeable view to a ledger, for applying a transaction.
Definition ApplyView.h:116
A currency issued by an account.
Definition Issue.h:13
A view into a ledger.
Definition ReadView.h:31
Rules controlling protocol behavior.
Definition Rules.h:18
A type that represents either a sequence value or a ticket value.
Definition SeqProxy.h:36
T is_same_v
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 notTooManyOffers(ReadView const &view, uint256 const &nftokenID)
Returns tesSUCCESS if NFToken has few enough offers that it can be burned.
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.
std::optional< TokenAndPage > findTokenAndPage(ApplyView &view, AccountID const &owner, uint256 const &nftokenID)
bool deleteTokenOffer(ApplyView &view, std::shared_ptr< SLE > const &offer)
Deletes the given token offer.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition AccountID.h:28
base_uint< 256 > uint256
Definition base_uint.h:531
TERSubset< CanCvtToTER > TER
Definition TER.h:622
Finds the token in the owner's token directory.
TokenAndPage(STObject const &token_, std::shared_ptr< SLE > page_)
std::shared_ptr< SLE > page