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/STXChainBridge.h>
15#include <xrpl/protocol/SeqProxy.h>
16#include <xrpl/protocol/UintTypes.h>
17
18#include <array>
19#include <cstdint>
20#include <functional>
21#include <set>
22#include <utility>
23
24namespace xrpl {
40namespace keylet {
41
46account(AccountID const& id) noexcept;
47
51Keylet const&
52amendments() noexcept;
53
58child(UInt256 const& key) noexcept;
59
66Keylet const&
67skip() noexcept;
68
81skip(LedgerIndex ledger) noexcept;
82
86Keylet const&
87feeSettings() noexcept;
88
92Keylet const&
93negativeUNL() noexcept;
94
99book(Book const& b);
100
110Keylet
111trustLine(AccountID const& id0, AccountID const& id1, Currency const& currency) noexcept;
112
113inline Keylet
114trustLine(AccountID const& id, Issue const& issue) noexcept
115{
116 return trustLine(id, issue.account, issue.currency);
117}
118
119
124Keylet
125offer(AccountID const& id, SeqProxy const& seq) noexcept;
126
127inline Keylet
128offer(UInt256 const& key) noexcept
129{
130 return {ltOFFER, key};
131}
132
133
137Keylet
138quality(Keylet const& k, std::uint64_t const q) noexcept;
139
143Keylet
144next(Keylet const& k);
145
150Keylet
151ticket(AccountID const& id, SeqProxy const& ticketSeq);
152
153inline Keylet
154ticket(UInt256 const& key)
155{
156 return {ltTICKET, key};
157}
158
159
163Keylet
164signerList(AccountID const& account) noexcept;
165
169Keylet
170sponsorship(AccountID const& sponsor, AccountID const& sponsee) noexcept;
171
176Keylet
177check(AccountID const& id, SeqProxy const& seq) noexcept;
178
179inline Keylet
180check(UInt256 const& key) noexcept
181{
182 return {ltCHECK, key};
183}
184
185
190Keylet
191txProposal(AccountID const& target, std::uint32_t ticketSequence) noexcept;
192
193inline Keylet
194txProposal(UInt256 const& key) noexcept
195{
196 return {ltTRANSACTION_PROPOSAL, key};
197}
198
199
204Keylet
205depositPreauth(AccountID const& owner, AccountID const& preauthorized) noexcept;
206
207Keylet
209 AccountID const& owner,
210 std::set<std::pair<AccountID, Slice>> const& authCreds) noexcept;
211
212inline Keylet
213depositPreauth(UInt256 const& key) noexcept
214{
215 return {ltDEPOSIT_PREAUTH, key};
216}
217
218
219//------------------------------------------------------------------------------
220
224Keylet
225unchecked(UInt256 const& key) noexcept;
226
230Keylet
231ownerDir(AccountID const& id) noexcept;
232
237Keylet
238page(UInt256 const& root, std::uint64_t const index = 0) noexcept;
239
240inline Keylet
241page(Keylet const& root, std::uint64_t const index = 0) noexcept
242{
243 XRPL_ASSERT(root.type == ltDIR_NODE, "xrpl::keylet::page : valid root type");
244 return page(root.key, index);
245}
246
247
251Keylet
252escrow(AccountID const& src, SeqProxy const& seq) noexcept;
253
257Keylet
258payChannel(AccountID const& src, AccountID const& dst, SeqProxy const& seq) noexcept;
259
272Keylet
273nftokenPageMin(AccountID const& owner);
274
278Keylet
279nftokenPageMax(AccountID const& owner);
280
281Keylet
282nftokenPage(Keylet const& k, UInt256 const& token);
284
288Keylet
289nftokenOffer(AccountID const& owner, SeqProxy const& seq);
290
291inline Keylet
293{
294 return {ltNFTOKEN_OFFER, offer};
295}
296
300Keylet
301nftBuys(UInt256 const& id) noexcept;
302
306Keylet
307nftSells(UInt256 const& id) noexcept;
308
312Keylet
313amm(Asset const& issue1, Asset const& issue2) noexcept;
314
315Keylet
316amm(UInt256 const& amm) noexcept;
317
321Keylet
322delegate(AccountID const& account, AccountID const& authorizedAccount) noexcept;
323
324Keylet
326
327// `seq` is stored as `sfXChainClaimID` in the object
328Keylet
330
331// `seq` is stored as `sfXChainAccountCreateCount` in the object
332Keylet
334
335Keylet
336did(AccountID const& account) noexcept;
337
338Keylet
339oracle(AccountID const& account, std::uint32_t const documentID) noexcept;
340
341Keylet
342credential(AccountID const& subject, AccountID const& issuer, Slice const& credType) noexcept;
343
344inline Keylet
345credential(UInt256 const& key) noexcept
346{
347 return {ltCREDENTIAL, key};
348}
349
350Keylet
351mptokenIssuance(MPTID const& issuanceID) noexcept;
352
353inline Keylet
354mptokenIssuance(UInt256 const& issuanceKey)
355{
356 return {ltMPTOKEN_ISSUANCE, issuanceKey};
357}
358
359Keylet
360mptoken(MPTID const& issuanceID, AccountID const& holder) noexcept;
361
362inline Keylet
363mptoken(UInt256 const& mptokenKey)
364{
365 return {ltMPTOKEN, mptokenKey};
366}
367
368Keylet
369mptoken(UInt256 const& issuanceKey, AccountID const& holder) noexcept;
370
371Keylet
372vault(AccountID const& owner, SeqProxy const& seq) noexcept;
373
374inline Keylet
375vault(UInt256 const& vaultKey)
376{
377 return {ltVAULT, vaultKey};
378}
379
380Keylet
381loanBroker(AccountID const& owner, SeqProxy const& seq) noexcept;
382
383inline Keylet
385{
386 return {ltLOAN_BROKER, key};
387}
388
389Keylet
390loan(UInt256 const& loanBrokerID, SeqProxy const& loanSeq) noexcept;
391
392inline Keylet
393loan(UInt256 const& key)
394{
395 return {ltLOAN, key};
396}
397
398Keylet
399permissionedDomain(AccountID const& account, SeqProxy const& seq) noexcept;
400
401Keylet
402permissionedDomain(UInt256 const& domainID) noexcept;
403} // namespace keylet
404
405// Everything below is deprecated and should be removed in favor of keylets:
406
408getBookBase(Book const& book);
409
411getQualityNext(UInt256 const& uBase);
412
413// VFALCO This name could be better
415getQuality(UInt256 const& uBase);
416
417template <class... KeyletParams>
418// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
425
426// This list should include all of the keylet functions that take a single AccountID parameter.
428
429MPTID
430makeMptID(std::uint32_t const sequence, AccountID const& account);
431
432} // namespace xrpl
Lightweight wrapper to tag static string.
Definition json_value.h:48
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:40
Keylet const & skip() noexcept
The index of the "short" skip list.
Definition Indexes.cpp:232
Keylet nftokenOffer(AccountID const &owner, SeqProxy const &seq)
An offer from an account to buy or sell an NFT.
Definition Indexes.cpp:453
Keylet oracle(AccountID const &account, std::uint32_t const documentID) noexcept
Definition Indexes.cpp:561
Keylet next(Keylet const &k)
The directory for the next lower quality.
Definition Indexes.cpp:325
Keylet payChannel(AccountID const &src, AccountID const &dst, SeqProxy const &seq) noexcept
A PaymentChannel.
Definition Indexes.cpp:424
Keylet const & negativeUNL() noexcept
The (fixed) index of the object containing the ledger negativeUNL.
Definition Indexes.cpp:262
Keylet escrow(AccountID const &src, SeqProxy const &seq) noexcept
An escrow entry.
Definition Indexes.cpp:418
Keylet did(AccountID const &account) noexcept
Definition Indexes.cpp:555
Keylet quality(Keylet const &k, std::uint64_t const q) noexcept
The initial directory page for a specific quality.
Definition Indexes.cpp:304
Keylet offer(AccountID const &id, SeqProxy const &seq) noexcept
An offer from an account.
Definition Indexes.cpp:298
Keylet depositPreauth(AccountID const &owner, AccountID const &preauthorized) noexcept
A DepositPreauth.
Definition Indexes.cpp:374
Keylet nftokenPage(Keylet const &k, UInt256 const &token)
Definition Indexes.cpp:446
Keylet book(Book const &b)
The beginning of an order book.
Definition Indexes.cpp:269
Keylet bridge(STXChainBridge const &bridge, STXChainBridge::ChainType chainType)
Definition Indexes.cpp:517
Keylet const & feeSettings() noexcept
The (fixed) index of the object containing the ledger fees.
Definition Indexes.cpp:255
Keylet const & amendments() noexcept
The index of the amendment table.
Definition Indexes.cpp:248
Keylet signerList(AccountID const &account) noexcept
A SignerList.
Definition Indexes.cpp:348
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Definition Indexes.cpp:403
Keylet txProposal(AccountID const &target, std::uint32_t ticketSequence) noexcept
A TransactionProposal.
Definition Indexes.cpp:366
Keylet check(AccountID const &id, SeqProxy const &seq) noexcept
A Check.
Definition Indexes.cpp:360
Keylet amm(Asset const &issue1, Asset const &issue2) noexcept
AMM entry.
Definition Indexes.cpp:471
Keylet nftokenPageMin(AccountID const &owner)
NFT page keylets.
Definition Indexes.cpp:430
Keylet unchecked(UInt256 const &key) noexcept
Any ledger entry.
Definition Indexes.cpp:397
Keylet ticket(AccountID const &id, SeqProxy const &ticketSeq)
A ticket belonging to an account.
Definition Indexes.cpp:332
Keylet vault(AccountID const &owner, SeqProxy const &seq) noexcept
Definition Indexes.cpp:591
Keylet permissionedDomain(AccountID const &account, SeqProxy const &seq) noexcept
Definition Indexes.cpp:609
Keylet nftokenPageMax(AccountID const &owner)
A keylet for the owner's last possible NFT page.
Definition Indexes.cpp:438
Keylet page(UInt256 const &root, std::uint64_t const index=0) noexcept
A page in a directory.
Definition Indexes.cpp:409
Keylet mptoken(MPTID const &issuanceID, AccountID const &holder) noexcept
Definition Indexes.cpp:573
Keylet delegate(AccountID const &account, AccountID const &authorizedAccount) noexcept
A keylet for Delegate object.
Definition Indexes.cpp:511
Keylet loanBroker(AccountID const &owner, SeqProxy const &seq) noexcept
Definition Indexes.cpp:597
Keylet account(AccountID const &id) noexcept
AccountID root.
Definition Indexes.cpp:220
Keylet xChainClaimID(STXChainBridge const &bridge, std::uint64_t const seq)
Definition Indexes.cpp:527
Keylet sponsorship(AccountID const &sponsor, AccountID const &sponsee) noexcept
A Sponsorship.
Definition Indexes.cpp:354
Keylet nftSells(UInt256 const &id) noexcept
The directory of sell offers for the specified NFT.
Definition Indexes.cpp:465
Keylet nftBuys(UInt256 const &id) noexcept
The directory of buy offers for the specified NFT.
Definition Indexes.cpp:459
Keylet loan(UInt256 const &loanBrokerID, SeqProxy const &loanSeq) noexcept
Definition Indexes.cpp:603
Keylet xChainCreateAccountClaimID(STXChainBridge const &bridge, std::uint64_t const seq)
Definition Indexes.cpp:541
Keylet credential(AccountID const &subject, AccountID const &issuer, Slice const &credType) noexcept
Definition Indexes.cpp:585
Keylet child(UInt256 const &key) noexcept
Any item that can be in an owner dir.
Definition Indexes.cpp:226
Keylet mptokenIssuance(MPTID const &issuanceID) noexcept
Definition Indexes.cpp:567
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:275
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:123
std::uint32_t LedgerIndex
A ledger index.
Definition Protocol.h:382
std::uint64_t getQuality(UInt256 const &uBase)
Definition Indexes.cpp:194
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:186
Number root(Number f, unsigned d)
BaseUInt< 256 > UInt256
Definition base_uint.h:580
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:206
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:39
bool includeInTests
Definition Indexes.h:423
std::function< Keylet(KeyletParams...)> function
Definition Indexes.h:421
json::StaticString expectedLEName
Definition Indexes.h:422
A pair of SHAMap key and LedgerEntryType.
Definition Keylet.h:20