xrpld
Loading...
Searching...
No Matches
NFTokenHelpers.h
1#pragma once
2
3#include <xrpl/basics/Log.h>
4#include <xrpl/basics/base_uint.h>
5#include <xrpl/ledger/ApplyView.h>
6#include <xrpl/protocol/AccountID.h>
7#include <xrpl/protocol/TER.h>
8#include <xrpl/protocol/TxFlags.h>
9#include <xrpl/protocol/nft.h>
10
11#include <utility>
12
13namespace xrpl::nft {
14
19 ApplyView& view,
20 Keylet const& directory,
21 std::size_t maxDeletableOffers);
22
25findToken(ReadView const& view, AccountID const& owner, uint256 const& nftokenID);
26
38findTokenAndPage(ApplyView& view, AccountID const& owner, uint256 const& nftokenID);
39
41TER
43
45TER
46removeToken(ApplyView& view, AccountID const& owner, uint256 const& nftokenID);
47
48TER
49removeToken(ApplyView& view, AccountID const& owner, uint256 const& nftokenID, SLE::ref page);
50
60bool
62
67bool
69
70bool
71compareTokens(uint256 const& a, uint256 const& b);
72
73TER
75 ApplyView& view,
76 AccountID const& owner,
77 uint256 const& nftokenID,
79
83 AccountID const& acctID,
84 STAmount const& amount,
85 std::optional<AccountID> const& dest,
86 std::optional<std::uint32_t> const& expiration,
87 std::uint16_t nftFlags,
88 Rules const& rules,
89 std::optional<AccountID> const& owner = std::nullopt,
90 std::uint32_t txFlags = tfSellNFToken);
91
93TER
95 ReadView const& view,
96 AccountID const& acctID,
97 AccountID const& nftIssuer,
98 STAmount const& amount,
99 std::optional<AccountID> const& dest,
100 std::uint16_t nftFlags,
101 std::uint16_t xferFee,
103 std::optional<AccountID> const& owner = std::nullopt,
104 std::uint32_t txFlags = tfSellNFToken);
105
107TER
109 ApplyView& view,
110 AccountID const& acctID,
111 STAmount const& amount,
112 std::optional<AccountID> const& dest,
113 std::optional<std::uint32_t> const& expiration,
114 SeqProxy seqProxy,
115 uint256 const& nftokenID,
116 XRPAmount const& priorBalance,
118 std::uint32_t txFlags = tfSellNFToken);
119
120TER
122 ReadView const& view,
123 AccountID const id,
124 beast::Journal const j,
125 Issue const& issue);
126
127TER
129 ReadView const& view,
130 AccountID const id,
131 beast::Journal const j,
132 Issue const& issue);
133
134} // namespace xrpl::nft
A generic endpoint for log messages.
Definition Journal.h:38
Writeable view to a ledger, for applying a transaction.
Definition ApplyView.h:118
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:33
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:36
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:594
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition AccountID.h:28
TERSubset< CanCvtToTER > TER
Definition TER.h:634
BaseUInt< 256 > uint256
Definition base_uint.h:562
A pair of SHAMap key and LedgerEntryType.
Definition Keylet.h:19
TokenAndPage(STObject token, SLE::pointer page)