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
191depositPreauth(AccountID const& owner, AccountID const& preauthorized) noexcept;
192
193Keylet
195 AccountID const& owner,
196 std::set<std::pair<AccountID, Slice>> const& authCreds) noexcept;
197
198inline Keylet
199depositPreauth(uint256 const& key) noexcept
200{
201 return {ltDEPOSIT_PREAUTH, key};
202}
203
204
205//------------------------------------------------------------------------------
206
210Keylet
211unchecked(uint256 const& key) noexcept;
212
216Keylet
217ownerDir(AccountID const& id) noexcept;
218
223Keylet
224page(uint256 const& root, std::uint64_t const index = 0) noexcept;
225
226inline Keylet
227page(Keylet const& root, std::uint64_t const index = 0) noexcept
228{
229 XRPL_ASSERT(root.type == ltDIR_NODE, "xrpl::keylet::page : valid root type");
230 return page(root.key, index);
231}
232
233
237Keylet
238escrow(AccountID const& src, SeqProxy const& seq) noexcept;
239
243Keylet
244payChannel(AccountID const& src, AccountID const& dst, SeqProxy const& seq) noexcept;
245
258Keylet
259nftokenPageMin(AccountID const& owner);
260
264Keylet
265nftokenPageMax(AccountID const& owner);
266
267Keylet
268nftokenPage(Keylet const& k, uint256 const& token);
270
274Keylet
275nftokenOffer(AccountID const& owner, SeqProxy const& seq);
276
277inline Keylet
279{
280 return {ltNFTOKEN_OFFER, offer};
281}
282
286Keylet
287nftBuys(uint256 const& id) noexcept;
288
292Keylet
293nftSells(uint256 const& id) noexcept;
294
298Keylet
299amm(Asset const& issue1, Asset const& issue2) noexcept;
300
301Keylet
302amm(uint256 const& amm) noexcept;
303
307Keylet
308delegate(AccountID const& account, AccountID const& authorizedAccount) noexcept;
309
310Keylet
312
313// `seq` is stored as `sfXChainClaimID` in the object
314Keylet
316
317// `seq` is stored as `sfXChainAccountCreateCount` in the object
318Keylet
320
321Keylet
322did(AccountID const& account) noexcept;
323
324Keylet
325oracle(AccountID const& account, std::uint32_t const documentID) noexcept;
326
327Keylet
328credential(AccountID const& subject, AccountID const& issuer, Slice const& credType) noexcept;
329
330inline Keylet
331credential(uint256 const& key) noexcept
332{
333 return {ltCREDENTIAL, key};
334}
335
336Keylet
337mptokenIssuance(MPTID const& issuanceID) noexcept;
338
339inline Keylet
340mptokenIssuance(uint256 const& issuanceKey)
341{
342 return {ltMPTOKEN_ISSUANCE, issuanceKey};
343}
344
345Keylet
346mptoken(MPTID const& issuanceID, AccountID const& holder) noexcept;
347
348inline Keylet
349mptoken(uint256 const& mptokenKey)
350{
351 return {ltMPTOKEN, mptokenKey};
352}
353
354Keylet
355mptoken(uint256 const& issuanceKey, AccountID const& holder) noexcept;
356
357Keylet
358vault(AccountID const& owner, SeqProxy const& seq) noexcept;
359
360inline Keylet
361vault(uint256 const& vaultKey)
362{
363 return {ltVAULT, vaultKey};
364}
365
366Keylet
367loanBroker(AccountID const& owner, SeqProxy const& seq) noexcept;
368
369inline Keylet
371{
372 return {ltLOAN_BROKER, key};
373}
374
375Keylet
376loan(uint256 const& loanBrokerID, SeqProxy const& loanSeq) noexcept;
377
378inline Keylet
379loan(uint256 const& key)
380{
381 return {ltLOAN, key};
382}
383
384Keylet
385permissionedDomain(AccountID const& account, SeqProxy const& seq) noexcept;
386
387Keylet
388permissionedDomain(uint256 const& domainID) noexcept;
389} // namespace keylet
390
391// Everything below is deprecated and should be removed in favor of keylets:
392
394getBookBase(Book const& book);
395
397getQualityNext(uint256 const& uBase);
398
399// VFALCO This name could be better
401getQuality(uint256 const& uBase);
402
403template <class... KeyletParams>
404// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
411
412// This list should include all of the keylet functions that take a single AccountID parameter.
414
415MPTID
416makeMptID(std::uint32_t const sequence, AccountID const& account);
417
418} // 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:210
Keylet nftokenOffer(AccountID const &owner, SeqProxy const &seq)
An offer from an account to buy or sell an NFT.
Definition Indexes.cpp:423
Keylet oracle(AccountID const &account, std::uint32_t const documentID) noexcept
Definition Indexes.cpp:531
Keylet next(Keylet const &k)
The directory for the next lower quality.
Definition Indexes.cpp:303
Keylet payChannel(AccountID const &src, AccountID const &dst, SeqProxy const &seq) noexcept
A PaymentChannel.
Definition Indexes.cpp:394
Keylet const & negativeUNL() noexcept
The (fixed) index of the object containing the ledger negativeUNL.
Definition Indexes.cpp:240
Keylet escrow(AccountID const &src, SeqProxy const &seq) noexcept
An escrow entry.
Definition Indexes.cpp:388
Keylet did(AccountID const &account) noexcept
Definition Indexes.cpp:525
Keylet quality(Keylet const &k, std::uint64_t const q) noexcept
The initial directory page for a specific quality.
Definition Indexes.cpp:282
Keylet offer(AccountID const &id, SeqProxy const &seq) noexcept
An offer from an account.
Definition Indexes.cpp:276
Keylet unchecked(uint256 const &key) noexcept
Any ledger entry.
Definition Indexes.cpp:367
Keylet depositPreauth(AccountID const &owner, AccountID const &preauthorized) noexcept
A DepositPreauth.
Definition Indexes.cpp:344
Keylet loan(uint256 const &loanBrokerID, SeqProxy const &loanSeq) noexcept
Definition Indexes.cpp:573
Keylet book(Book const &b)
The beginning of an order book.
Definition Indexes.cpp:247
Keylet bridge(STXChainBridge const &bridge, STXChainBridge::ChainType chainType)
Definition Indexes.cpp:487
Keylet const & feeSettings() noexcept
The (fixed) index of the object containing the ledger fees.
Definition Indexes.cpp:233
Keylet const & amendments() noexcept
The index of the amendment table.
Definition Indexes.cpp:226
Keylet signerList(AccountID const &account) noexcept
A SignerList.
Definition Indexes.cpp:326
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Definition Indexes.cpp:373
Keylet check(AccountID const &id, SeqProxy const &seq) noexcept
A Check.
Definition Indexes.cpp:338
Keylet amm(Asset const &issue1, Asset const &issue2) noexcept
AMM entry.
Definition Indexes.cpp:441
Keylet nftokenPageMin(AccountID const &owner)
NFT page keylets.
Definition Indexes.cpp:400
Keylet ticket(AccountID const &id, SeqProxy const &ticketSeq)
A ticket belonging to an account.
Definition Indexes.cpp:310
Keylet child(uint256 const &key) noexcept
Any item that can be in an owner dir.
Definition Indexes.cpp:204
Keylet page(uint256 const &root, std::uint64_t const index=0) noexcept
A page in a directory.
Definition Indexes.cpp:379
Keylet nftokenPage(Keylet const &k, uint256 const &token)
Definition Indexes.cpp:416
Keylet vault(AccountID const &owner, SeqProxy const &seq) noexcept
Definition Indexes.cpp:561
Keylet permissionedDomain(AccountID const &account, SeqProxy const &seq) noexcept
Definition Indexes.cpp:579
Keylet nftokenPageMax(AccountID const &owner)
A keylet for the owner's last possible NFT page.
Definition Indexes.cpp:408
Keylet mptoken(MPTID const &issuanceID, AccountID const &holder) noexcept
Definition Indexes.cpp:543
Keylet nftSells(uint256 const &id) noexcept
The directory of sell offers for the specified NFT.
Definition Indexes.cpp:435
Keylet nftBuys(uint256 const &id) noexcept
The directory of buy offers for the specified NFT.
Definition Indexes.cpp:429
Keylet delegate(AccountID const &account, AccountID const &authorizedAccount) noexcept
A keylet for Delegate object.
Definition Indexes.cpp:481
Keylet loanBroker(AccountID const &owner, SeqProxy const &seq) noexcept
Definition Indexes.cpp:567
Keylet account(AccountID const &id) noexcept
AccountID root.
Definition Indexes.cpp:198
Keylet xChainClaimID(STXChainBridge const &bridge, std::uint64_t const seq)
Definition Indexes.cpp:497
Keylet sponsorship(AccountID const &sponsor, AccountID const &sponsee) noexcept
A Sponsorship.
Definition Indexes.cpp:332
Keylet xChainCreateAccountClaimID(STXChainBridge const &bridge, std::uint64_t const seq)
Definition Indexes.cpp:511
Keylet credential(AccountID const &subject, AccountID const &issuer, Slice const &credType) noexcept
Definition Indexes.cpp:555
Keylet mptokenIssuance(MPTID const &issuanceID) noexcept
Definition Indexes.cpp:537
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:253
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
std::uint32_t LedgerIndex
A ledger index.
Definition Protocol.h:370
std::uint64_t getQuality(uint256 const &uBase)
Definition Indexes.cpp:172
BaseUInt< 160, detail::CurrencyTag > Currency
Currency is a hash representing a specific currency.
Definition UintTypes.h:42
Number root(Number f, unsigned d)
uint256 getQualityNext(uint256 const &uBase)
Definition Indexes.cpp:164
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
uint256 getBookBase(Book const &book)
Definition Indexes.cpp:122
MPTID makeMptID(std::uint32_t const sequence, AccountID const &account)
Definition Indexes.cpp:184
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
BaseUInt< 256 > uint256
Definition base_uint.h:580
bool includeInTests
Definition Indexes.h:409
std::function< Keylet(KeyletParams...)> function
Definition Indexes.h:407
json::StaticString expectedLEName
Definition Indexes.h:408
A pair of SHAMap key and LedgerEntryType.
Definition Keylet.h:20