1#include <xrpl/basics/Slice.h>
2#include <xrpl/basics/base_uint.h>
3#include <xrpl/basics/safe_cast.h>
4#include <xrpl/beast/utility/instrumentation.h>
5#include <xrpl/protocol/AccountID.h>
6#include <xrpl/protocol/Asset.h>
7#include <xrpl/protocol/Book.h>
8#include <xrpl/protocol/Indexes.h>
9#include <xrpl/protocol/LedgerFormats.h>
10#include <xrpl/protocol/Protocol.h>
11#include <xrpl/protocol/SField.h>
12#include <xrpl/protocol/STXChainBridge.h>
13#include <xrpl/protocol/SeqProxy.h>
14#include <xrpl/protocol/UintTypes.h>
15#include <xrpl/protocol/digest.h>
16#include <xrpl/protocol/nftPageMask.h>
18#include <boost/endian/conversion.hpp>
90template <
class... Args>
94 return sha512Half(safe_cast<std::uint16_t>(space), args...);
100 XRPL_ASSERT(
isConsistent(book),
"xrpl::getBookBase : input is consistent");
125 static constexpr uint256 nextQuality(
126 "0000000000000000000000000000000000000000000000010000000000000000");
127 return uBase + nextQuality;
147 XRPL_ASSERT(ticketSeq.
isTicket(),
"xrpl::getTicketIndex : valid input");
155 sequence = boost::endian::native_to_big(sequence);
156 memcpy(u.
data(), &sequence,
sizeof(sequence));
157 memcpy(u.
data() +
sizeof(sequence), account.data(),
sizeof(account));
265 k.type == ltDIR_NODE,
"xrpl::keylet::quality : valid input type");
277 return {ltDIR_NODE, x};
284 k.
type == ltDIR_NODE,
285 "xrpl::keylet::next_t::operator() : valid input type");
338 hashes.
reserve(authCreds.size());
339 for (
auto const& o : authCreds)
365 return {ltDIR_NODE, key};
389 return {ltNFTOKEN_PAGE,
uint256{buf}};
397 return {ltNFTOKEN_PAGE,
id};
404 k.
type == ltNFTOKEN_PAGE,
"xrpl::keylet::nftpage : valid input type");
405 return {ltNFTOKEN_PAGE, (k.
key & ~nft::pageMask) + (token &
nft::pageMask)};
430 auto const& [minI, maxI] =
460 auto const& issue =
bridge.issue(chainType);
471 ltXCHAIN_OWNED_CLAIM_ID,
474 bridge.lockingChainDoor(),
475 bridge.lockingChainIssue(),
476 bridge.issuingChainDoor(),
477 bridge.issuingChainIssue(),
485 ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID,
488 bridge.lockingChainDoor(),
489 bridge.lockingChainIssue(),
490 bridge.issuingChainDoor(),
491 bridge.issuingChainIssue(),
538 Slice const& credType)
noexcept
567 ltPERMISSIONED_DOMAIN,
574 return {ltPERMISSIONED_DOMAIN, domainID};
std::optional< uint256 > domain
A currency issued by an account.
A type that represents either a sequence value or a ticket value.
constexpr bool isTicket() const
constexpr std::uint32_t value() const
An immutable linear range of bytes.
static constexpr std::size_t size()
T emplace_back(T... args)
Keylet const & skip() noexcept
The index of the "short" skip list.
Keylet quality(Keylet const &k, std::uint64_t q) noexcept
The initial directory page for a specific quality.
Keylet signers(AccountID const &account) noexcept
A SignerList.
Keylet oracle(AccountID const &account, std::uint32_t const &documentID) noexcept
Keylet const & negativeUNL() noexcept
The (fixed) index of the object containing the ledger negativeUNL.
Keylet did(AccountID const &account) noexcept
Keylet nftpage_max(AccountID const &owner)
A keylet for the owner's last possible NFT page.
Keylet nftoffer(AccountID const &owner, std::uint32_t seq)
An offer from an account to buy or sell an NFT.
Keylet unchecked(uint256 const &key) noexcept
Any ledger entry.
Keylet depositPreauth(AccountID const &owner, AccountID const &preauthorized) noexcept
A DepositPreauth.
Keylet nftpage(Keylet const &k, uint256 const &token)
Keylet loanbroker(AccountID const &owner, std::uint32_t seq) noexcept
Keylet escrow(AccountID const &src, std::uint32_t seq) noexcept
An escrow entry.
Keylet bridge(STXChainBridge const &bridge, STXChainBridge::ChainType chainType)
Keylet const & amendments() noexcept
The index of the amendment table.
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Keylet nft_buys(uint256 const &id) noexcept
The directory of buy offers for the specified NFT.
Keylet payChan(AccountID const &src, AccountID const &dst, std::uint32_t seq) noexcept
A PaymentChannel.
Keylet mptIssuance(std::uint32_t seq, AccountID const &issuer) noexcept
Keylet check(AccountID const &id, std::uint32_t seq) noexcept
A Check.
Keylet amm(Asset const &issue1, Asset const &issue2) noexcept
AMM entry.
Keylet loan(uint256 const &loanBrokerID, std::uint32_t loanSeq) noexcept
Keylet offer(AccountID const &id, std::uint32_t seq) noexcept
An offer from an account.
Keylet child(uint256 const &key) noexcept
Any item that can be in an owner dir.
Keylet vault(AccountID const &owner, std::uint32_t seq) noexcept
Keylet line(AccountID const &id0, AccountID const &id1, Currency const ¤cy) noexcept
The index of a trust line for a given currency.
Keylet nftpage_min(AccountID const &owner)
NFT page keylets.
Keylet xChainCreateAccountClaimID(STXChainBridge const &bridge, std::uint64_t seq)
Keylet mptoken(MPTID const &issuanceID, AccountID const &holder) noexcept
Keylet nft_sells(uint256 const &id) noexcept
The directory of sell offers for the specified NFT.
Keylet delegate(AccountID const &account, AccountID const &authorizedAccount) noexcept
A keylet for Delegate object.
Keylet account(AccountID const &id) noexcept
AccountID root.
Keylet const & fees() noexcept
The (fixed) index of the object containing the ledger fees.
Keylet permissionedDomain(AccountID const &account, std::uint32_t seq) noexcept
Keylet page(uint256 const &root, std::uint64_t index=0) noexcept
A page in a directory.
Keylet credential(AccountID const &subject, AccountID const &issuer, Slice const &credType) noexcept
Keylet xChainClaimID(STXChainBridge const &bridge, std::uint64_t seq)
uint256 constexpr pageMask(std::string_view("0000000000000000000000000000000000000000ffffffffffffffffffffffff"))
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool isConsistent(Book const &book)
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
uint256 getTicketIndex(AccountID const &account, std::uint32_t uSequence)
std::uint64_t getQuality(uint256 const &uBase)
static uint256 indexHash(LedgerNameSpace space, Args const &... args)
base_uint< 192 > MPTID
MPTID is a 192-bit value representing MPT Issuance ID, which is a concatenation of a 32-bit sequence ...
uint256 getQualityNext(uint256 const &uBase)
LedgerNameSpace
Type-specific prefix for calculating ledger indices.
@ XCHAIN_CREATE_ACCOUNT_CLAIM_ID
@ DEPOSIT_PREAUTH_CREDENTIALS
uint256 getBookBase(Book const &book)
@ ltANY
A special type, matching any ledger entry type.
@ ltCHILD
A special type, matching any ledger type except directory nodes.
MPTID makeMptID(std::uint32_t sequence, AccountID const &account)
A pair of SHAMap key and LedgerEntryType.
Keylet operator()(Book const &b) const
Keylet operator()(Keylet const &k) const
Keylet operator()(AccountID const &id, std::uint32_t ticketSeq) const