rippled
Loading...
Searching...
No Matches
token.h
1#ifndef XRPL_TEST_JTX_NFT_H_INCLUDED
2#define XRPL_TEST_JTX_NFT_H_INCLUDED
3
4#include <test/jtx/Account.h>
5#include <test/jtx/Env.h>
6#include <test/jtx/owners.h>
7
8#include <xrpl/basics/strHex.h>
9
10#include <initializer_list>
11
12namespace ripple {
13namespace test {
14namespace jtx {
15
16namespace token {
17
20mint(jtx::Account const& account, std::uint32_t tokenTaxon = 0);
21
24{
25private:
27
28public:
30 {
31 }
32
33 void
34 operator()(Env&, JTx& jtx) const;
35};
36
38class issuer
39{
40private:
42
43public:
44 explicit issuer(jtx::Account const& issue) : issuer_(issue.human())
45 {
46 }
47
48 void
49 operator()(Env&, JTx& jtx) const;
50};
51
53class uri
54{
55private:
57
58public:
59 explicit uri(std::string const& u) : uri_(strHex(u))
60 {
61 }
62
63 void
64 operator()(Env&, JTx& jtx) const;
65};
66
68class amount
69{
70private:
72
73public:
74 explicit amount(STAmount const amount) : amount_(amount)
75 {
76 }
77
78 void
79 operator()(Env&, JTx& jtx) const;
80};
81
85 jtx::Env const& env,
86 jtx::Account const& account,
87 std::uint32_t nftokenTaxon,
89 std::uint16_t xferFee = 0);
90
93getID(
94 jtx::Env const& env,
95 jtx::Account const& account,
96 std::uint32_t tokenTaxon,
97 std::uint32_t nftSeq,
99 std::uint16_t xferFee = 0);
100
103burn(jtx::Account const& account, uint256 const& nftokenID);
104
108 jtx::Account const& account,
109 uint256 const& nftokenID,
110 STAmount const& amount);
111
113class owner
114{
115private:
117
118public:
119 explicit owner(jtx::Account const& ownedBy) : owner_(ownedBy.human())
120 {
121 }
122
123 void
124 operator()(Env&, JTx& jtx) const;
125};
126
129{
130private:
132
133public:
134 explicit expiration(std::uint32_t const& expires) : expires_(expires)
135 {
136 }
137
138 void
139 operator()(Env&, JTx& jtx) const;
140};
141
144{
145private:
147
148public:
149 explicit destination(jtx::Account const& dest) : dest_(dest.human())
150 {
151 }
152
153 void
154 operator()(Env&, JTx& jtx) const;
155};
156
160 jtx::Account const& account,
161 std::initializer_list<uint256> const& nftokenOffers = {});
162
165 jtx::Account const& account,
166 std::vector<uint256> const& nftokenOffers);
167
170{
171private:
173
174public:
175 explicit rootIndex(uint256 const& index) : rootIndex_(to_string(index))
176 {
177 }
178
179 void
180 operator()(Env&, JTx& jtx) const;
181};
182
185acceptBuyOffer(jtx::Account const& account, uint256 const& offerIndex);
186
189acceptSellOffer(jtx::Account const& account, uint256 const& offerIndex);
190
194 jtx::Account const& account,
195 uint256 const& buyOfferIndex,
196 uint256 const& sellOfferIndex);
197
200{
201private:
203
204public:
206 {
207 }
208
209 void
210 operator()(Env&, JTx& jtx) const;
211};
212
215setMinter(jtx::Account const& account, jtx::Account const& minter);
216
219clearMinter(jtx::Account const& account);
220
223modify(jtx::Account const& account, uint256 const& nftokenID);
224
225} // namespace token
226
227} // namespace jtx
228
229} // namespace test
230} // namespace ripple
231
232#endif // XRPL_TEST_JTX_NFT_H_INCLUDED
Represents a JSON value.
Definition json_value.h:130
Immutable cryptographic account descriptor.
Definition Account.h:20
A transaction testing environment.
Definition Env.h:102
Set the fee on a JTx.
Definition fee.h:18
Match set account flags.
Definition flags.h:109
Sets the optional amount field on an NFTokenMint.
Definition token.h:69
void operator()(Env &, JTx &jtx) const
Definition token.cpp:43
amount(STAmount const amount)
Definition token.h:74
Sets the optional NFTokenBrokerFee field in a brokerOffer transaction.
Definition token.h:200
brokerFee(STAmount const fee)
Definition token.h:205
void operator()(Env &, JTx &jtx) const
Definition token.cpp:194
Sets the optional Destination field on an NFTokenOffer.
Definition token.h:144
void operator()(Env &, JTx &jtx) const
Definition token.cpp:116
destination(jtx::Account const &dest)
Definition token.h:149
Sets the optional Expiration field on an NFTokenOffer.
Definition token.h:129
void operator()(Env &, JTx &jtx) const
Definition token.cpp:110
expiration(std::uint32_t const &expires)
Definition token.h:134
Sets the optional Issuer on an NFTokenMint.
Definition token.h:39
issuer(jtx::Account const &issue)
Definition token.h:44
void operator()(Env &, JTx &jtx) const
Definition token.cpp:31
Sets the optional Owner on an NFTokenOffer.
Definition token.h:114
owner(jtx::Account const &ownedBy)
Definition token.h:119
void operator()(Env &, JTx &jtx) const
Definition token.cpp:104
Sets the optional RootIndex field when canceling NFTokenOffers.
Definition token.h:170
void operator()(Env &, JTx &jtx) const
Definition token.cpp:154
rootIndex(uint256 const &index)
Definition token.h:175
Sets the optional URI on an NFTokenMint.
Definition token.h:54
uri(std::string const &u)
Definition token.h:59
void operator()(Env &, JTx &jtx) const
Definition token.cpp:37
Sets the optional TransferFee on an NFTokenMint.
Definition token.h:24
void operator()(Env &, JTx &jtx) const
Definition token.cpp:25
xferFee(std::uint16_t fee)
Definition token.h:29
Json::Value clearMinter(jtx::Account const &account)
Clear any authorized minter from an account root.
Definition token.cpp:208
uint256 getNextID(jtx::Env const &env, jtx::Account const &issuer, std::uint32_t nfTokenTaxon, std::uint16_t flags, std::uint16_t xferFee)
Get the next NFTokenID that will be issued.
Definition token.cpp:49
uint256 getID(jtx::Env const &env, jtx::Account const &issuer, std::uint32_t nfTokenTaxon, std::uint32_t nftSeq, std::uint16_t flags, std::uint16_t xferFee)
Get the NFTokenID for a particular nftSequence.
Definition token.cpp:63
Json::Value setMinter(jtx::Account const &account, jtx::Account const &minter)
Set the authorized minter on an account root.
Definition token.cpp:200
Json::Value createOffer(jtx::Account const &account, uint256 const &nftokenID, STAmount const &amount)
Create an NFTokenOffer.
Definition token.cpp:90
Json::Value acceptSellOffer(jtx::Account const &account, uint256 const &offerIndex)
Accept an NFToken sell offer.
Definition token.cpp:170
Json::Value modify(jtx::Account const &account, uint256 const &nftokenID)
Modify an NFToken.
Definition token.cpp:214
Json::Value acceptBuyOffer(jtx::Account const &account, uint256 const &offerIndex)
Accept an NFToken buy offer.
Definition token.cpp:160
Json::Value mint(jtx::Account const &account, std::uint32_t nfTokenTaxon)
Mint an NFToken.
Definition token.cpp:15
Json::Value burn(jtx::Account const &account, uint256 const &nftokenID)
Burn an NFToken.
Definition token.cpp:80
Json::Value cancelOffer(jtx::Account const &account, std::initializer_list< uint256 > const &nftokenOffers)
Cancel NFTokenOffers.
Definition token.cpp:138
Json::Value brokerOffers(jtx::Account const &account, uint256 const &buyOfferIndex, uint256 const &sellOfferIndex)
Broker two NFToken offers.
Definition token.cpp:180
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
std::string strHex(FwdIt begin, FwdIt end)
Definition strHex.h:11
std::string to_string(base_uint< Bits, Tag > const &a)
Definition base_uint.h:611
Execution context for applying a JSON transaction.
Definition JTx.h:26