xrpld
Loading...
Searching...
No Matches
Indexes.h
1#pragma once
2
3#include <xrpl/basics/Slice.h>
4#include <xrpl/basics/base_uint.h>
5#include <xrpl/beast/utility/instrumentation.h>
6#include <xrpl/json/json_value.h>
7#include <xrpl/protocol/AccountID.h>
8#include <xrpl/protocol/Asset.h>
9#include <xrpl/protocol/Book.h>
10#include <xrpl/protocol/Issue.h>
11#include <xrpl/protocol/Keylet.h>
12#include <xrpl/protocol/LedgerFormats.h>
13#include <xrpl/protocol/Protocol.h>
14#include <xrpl/protocol/SeqProxy.h>
15#include <xrpl/protocol/UintTypes.h>
16
17#include <array>
18#include <cstdint>
19#include <functional>
20#include <set>
21#include <utility>
22
23namespace xrpl {
39namespace keylet {
40
45account(AccountID const& id) noexcept;
46
50Keylet const&
51amendments() noexcept;
52
57child(UInt256 const& key) noexcept;
58
65Keylet const&
66skip() noexcept;
67
80skip(LedgerIndex ledger) noexcept;
81
85Keylet const&
86feeSettings() noexcept;
87
91Keylet const&
92negativeUNL() noexcept;
93
98book(Book const& b);
99
109Keylet
110trustLine(AccountID const& id0, AccountID const& id1, Currency const& currency) noexcept;
111
112inline Keylet
113trustLine(AccountID const& id, Issue const& issue) noexcept
114{
115 return trustLine(id, issue.account, issue.currency);
116}
117
118
123Keylet
124offer(AccountID const& id, SeqProxy const& seq) noexcept;
125
126inline Keylet
127offer(UInt256 const& key) noexcept
128{
129 return {ltOFFER, key};
130}
131
132
136Keylet
137quality(Keylet const& k, std::uint64_t const q) noexcept;
138
142Keylet
143next(Keylet const& k);
144
149Keylet
150ticket(AccountID const& id, SeqProxy const& ticketSeq);
151
152inline Keylet
153ticket(UInt256 const& key)
154{
155 return {ltTICKET, key};
156}
157
158
162Keylet
163signerList(AccountID const& account) noexcept;
164
168Keylet
169sponsorship(AccountID const& sponsor, AccountID const& sponsee) noexcept;
170
175Keylet
176check(AccountID const& id, SeqProxy const& seq) noexcept;
177
178inline Keylet
179check(UInt256 const& key) noexcept
180{
181 return {ltCHECK, key};
182}
183
184
189Keylet
190txProposal(AccountID const& target, std::uint32_t ticketSequence) noexcept;
191
192inline Keylet
193txProposal(UInt256 const& key) noexcept
194{
195 return {ltTRANSACTION_PROPOSAL, key};
196}
197
198
203Keylet
204depositPreauth(AccountID const& owner, AccountID const& preauthorized) noexcept;
205
206Keylet
208 AccountID const& owner,
209 std::set<std::pair<AccountID, Slice>> const& authCreds) noexcept;
210
211inline Keylet
212depositPreauth(UInt256 const& key) noexcept
213{
214 return {ltDEPOSIT_PREAUTH, key};
215}
216
217
218//------------------------------------------------------------------------------
219
223Keylet
224unchecked(UInt256 const& key) noexcept;
225
229Keylet
230ownerDir(AccountID const& id) noexcept;
231
236Keylet
237page(UInt256 const& root, std::uint64_t const index = 0) noexcept;
238
239inline Keylet
240page(Keylet const& root, std::uint64_t const index = 0) noexcept
241{
242 XRPL_ASSERT(root.type == ltDIR_NODE, "xrpl::keylet::page : valid root type");
243 return page(root.key, index);
244}
245
246
250Keylet
251escrow(AccountID const& src, SeqProxy const& seq) noexcept;
252
256Keylet
257payChannel(AccountID const& src, AccountID const& dst, SeqProxy const& seq) noexcept;
258
271Keylet
272nftokenPageMin(AccountID const& owner);
273
277Keylet
278nftokenPageMax(AccountID const& owner);
279
280Keylet
281nftokenPage(Keylet const& k, UInt256 const& token);
283
287Keylet
288nftokenOffer(AccountID const& owner, SeqProxy const& seq);
289
290inline Keylet
292{
293 return {ltNFTOKEN_OFFER, offer};
294}
295
299Keylet
300nftBuys(UInt256 const& id) noexcept;
301
305Keylet
306nftSells(UInt256 const& id) noexcept;
307
311Keylet
312amm(Asset const& issue1, Asset const& issue2) noexcept;
313
314Keylet
315amm(UInt256 const& amm) noexcept;
316
320Keylet
321delegate(AccountID const& account, AccountID const& authorizedAccount) noexcept;
322
323Keylet
324did(AccountID const& account) noexcept;
325
326Keylet
327oracle(AccountID const& account, std::uint32_t const documentID) noexcept;
328
329Keylet
330credential(AccountID const& subject, AccountID const& issuer, Slice const& credType) noexcept;
331
332inline Keylet
333credential(UInt256 const& key) noexcept
334{
335 return {ltCREDENTIAL, key};
336}
337
338Keylet
339mptokenIssuance(MPTID const& issuanceID) noexcept;
340
341inline Keylet
342mptokenIssuance(UInt256 const& issuanceKey)
343{
344 return {ltMPTOKEN_ISSUANCE, issuanceKey};
345}
346
347Keylet
348mptoken(MPTID const& issuanceID, AccountID const& holder) noexcept;
349
350inline Keylet
351mptoken(UInt256 const& mptokenKey)
352{
353 return {ltMPTOKEN, mptokenKey};
354}
355
356Keylet
357mptoken(UInt256 const& issuanceKey, AccountID const& holder) noexcept;
358
359Keylet
360vault(AccountID const& owner, SeqProxy const& seq) noexcept;
361
362inline Keylet
363vault(UInt256 const& vaultKey)
364{
365 return {ltVAULT, vaultKey};
366}
367
368Keylet
369loanBroker(AccountID const& owner, SeqProxy const& seq) noexcept;
370
371inline Keylet
373{
374 return {ltLOAN_BROKER, key};
375}
376
377Keylet
378loan(UInt256 const& loanBrokerID, SeqProxy const& loanSeq) noexcept;
379
380inline Keylet
381loan(UInt256 const& key)
382{
383 return {ltLOAN, key};
384}
385
386Keylet
387permissionedDomain(AccountID const& account, SeqProxy const& seq) noexcept;
388
389Keylet
390permissionedDomain(UInt256 const& domainID) noexcept;
391} // namespace keylet
392
393// Everything below is deprecated and should be removed in favor of keylets:
394
396getBookBase(Book const& book);
397
399getQualityNext(UInt256 const& uBase);
400
401// VFALCO This name could be better
403getQuality(UInt256 const& uBase);
404
405template <class... KeyletParams>
406// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
413
414// This list should include all of the keylet functions that take a single AccountID parameter.
416
417MPTID
418makeMptID(std::uint32_t const sequence, AccountID const& account);
419
420} // namespace xrpl
Lightweight wrapper to tag static string.
Definition json_value.h:52
Specifies an order book.
Definition Book.h:28
A currency issued by an account.
Definition Issue.h:18
A type that represents either a sequence value or a ticket value.
Definition SeqProxy.h:37
An immutable linear range of bytes.
Definition Slice.h:28
STL namespace.
Keylet computation functions.
Definition Indexes.h:39
Keylet const & skip() noexcept
The index of the "short" skip list.
Definition Indexes.cpp:245
Keylet nftokenOffer(AccountID const &owner, SeqProxy const &seq)
An offer from an account to buy or sell an NFT.
Definition Indexes.cpp:465
Keylet oracle(AccountID const &account, std::uint32_t const documentID) noexcept
Definition Indexes.cpp:535
Keylet next(Keylet const &k)
The directory for the next lower quality.
Definition Indexes.cpp:337
Keylet payChannel(AccountID const &src, AccountID const &dst, SeqProxy const &seq) noexcept
A PaymentChannel.
Definition Indexes.cpp:436
Keylet const & negativeUNL() noexcept
The (fixed) index of the object containing the ledger negativeUNL.
Definition Indexes.cpp:274
Keylet escrow(AccountID const &src, SeqProxy const &seq) noexcept
An escrow entry.
Definition Indexes.cpp:430
Keylet did(AccountID const &account) noexcept
Definition Indexes.cpp:529
Keylet quality(Keylet const &k, std::uint64_t const q) noexcept
The initial directory page for a specific quality.
Definition Indexes.cpp:316
Keylet offer(AccountID const &id, SeqProxy const &seq) noexcept
An offer from an account.
Definition Indexes.cpp:310
Keylet depositPreauth(AccountID const &owner, AccountID const &preauthorized) noexcept
A DepositPreauth.
Definition Indexes.cpp:386
Keylet nftokenPage(Keylet const &k, UInt256 const &token)
Definition Indexes.cpp:458
Keylet book(Book const &b)
The beginning of an order book.
Definition Indexes.cpp:281
Keylet const & feeSettings() noexcept
The (fixed) index of the object containing the ledger fees.
Definition Indexes.cpp:267
Keylet const & amendments() noexcept
The index of the amendment table.
Definition Indexes.cpp:260
Keylet signerList(AccountID const &account) noexcept
A SignerList.
Definition Indexes.cpp:360
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Definition Indexes.cpp:415
Keylet txProposal(AccountID const &target, std::uint32_t ticketSequence) noexcept
A TransactionProposal.
Definition Indexes.cpp:378
Keylet check(AccountID const &id, SeqProxy const &seq) noexcept
A Check.
Definition Indexes.cpp:372
Keylet amm(Asset const &issue1, Asset const &issue2) noexcept
AMM entry.
Definition Indexes.cpp:483
Keylet nftokenPageMin(AccountID const &owner)
NFT page keylets.
Definition Indexes.cpp:442
Keylet unchecked(UInt256 const &key) noexcept
Any ledger entry.
Definition Indexes.cpp:409
Keylet ticket(AccountID const &id, SeqProxy const &ticketSeq)
A ticket belonging to an account.
Definition Indexes.cpp:344
Keylet vault(AccountID const &owner, SeqProxy const &seq) noexcept
Definition Indexes.cpp:565
Keylet permissionedDomain(AccountID const &account, SeqProxy const &seq) noexcept
Definition Indexes.cpp:583
Keylet nftokenPageMax(AccountID const &owner)
A keylet for the owner's last possible NFT page.
Definition Indexes.cpp:450
Keylet page(UInt256 const &root, std::uint64_t const index=0) noexcept
A page in a directory.
Definition Indexes.cpp:421
Keylet mptoken(MPTID const &issuanceID, AccountID const &holder) noexcept
Definition Indexes.cpp:547
Keylet delegate(AccountID const &account, AccountID const &authorizedAccount) noexcept
A keylet for Delegate object.
Definition Indexes.cpp:523
Keylet loanBroker(AccountID const &owner, SeqProxy const &seq) noexcept
Definition Indexes.cpp:571
Keylet account(AccountID const &id) noexcept
AccountID root.
Definition Indexes.cpp:233
Keylet sponsorship(AccountID const &sponsor, AccountID const &sponsee) noexcept
A Sponsorship.
Definition Indexes.cpp:366
Keylet nftSells(UInt256 const &id) noexcept
The directory of sell offers for the specified NFT.
Definition Indexes.cpp:477
Keylet nftBuys(UInt256 const &id) noexcept
The directory of buy offers for the specified NFT.
Definition Indexes.cpp:471
Keylet loan(UInt256 const &loanBrokerID, SeqProxy const &loanSeq) noexcept
Definition Indexes.cpp:577
Keylet credential(AccountID const &subject, AccountID const &issuer, Slice const &credType) noexcept
Definition Indexes.cpp:559
Keylet child(UInt256 const &key) noexcept
Any item that can be in an owner dir.
Definition Indexes.cpp:239
Keylet mptokenIssuance(MPTID const &issuanceID) noexcept
Definition Indexes.cpp:541
Keylet trustLine(AccountID const &id0, AccountID const &id1, Currency const &currency) noexcept
The index of a trust line for a given currency.
Definition Indexes.cpp:287
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
UInt256 getBookBase(Book const &book)
Definition Indexes.cpp:136
std::uint32_t LedgerIndex
A ledger index.
Definition Protocol.h:409
std::uint64_t getQuality(UInt256 const &uBase)
Definition Indexes.cpp:207
BaseUInt< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
Definition UintTypes.h:42
UInt256 getQualityNext(UInt256 const &uBase)
Definition Indexes.cpp:199
Number root(Number f, unsigned d)
BaseUInt< 256 > UInt256
Definition base_uint.h:581
BaseUInt< 192 > MPTID
MPTID is a 192-bit value representing MPT Issuance ID, which is a concatenation of a 32-bit sequence ...
Definition UintTypes.h:54
MPTID makeMptID(std::uint32_t const sequence, AccountID const &account)
Definition Indexes.cpp:219
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition AccountID.h:34
std::array< KeyletDesc< AccountID const & >, 6 > const kDirectAccountKeylets
Definition Indexes.cpp:37
bool includeInTests
Definition Indexes.h:411
std::function< Keylet(KeyletParams...)> function
Definition Indexes.h:409
json::StaticString expectedLEName
Definition Indexes.h:410
A pair of SHAMap key and LedgerEntryType.
Definition Keylet.h:20