47 enum class LedgerCategory {
54 ripple::LedgerEntryType type_ = ripple::ltANY;
55 char const* name_ =
nullptr;
56 char const* rpcName_ =
nullptr;
57 LedgerCategory category_ = LedgerCategory::Invalid;
62 ripple::LedgerEntryType type,
63 LedgerCategory category
65 : type_{type}, name_{name}, rpcName_{rpcName}, category_{category}
71 chainLedgerType(
char const* name,
char const* rpcName, ripple::LedgerEntryType type)
77 accountOwnedLedgerType(
char const* name,
char const* rpcName, ripple::LedgerEntryType type)
83 deletionBlockerLedgerType(
char const* name,
char const* rpcName, ripple::LedgerEntryType type)
100 static constexpr LedgerTypeAttributeList
const kLEDGER_TYPES{
101 LedgerTypeAttribute::accountOwnedLedgerType(JS(AccountRoot), JS(account), ripple::ltACCOUNT_ROOT),
102 LedgerTypeAttribute::chainLedgerType(JS(Amendments), JS(amendments), ripple::ltAMENDMENTS),
103 LedgerTypeAttribute::deletionBlockerLedgerType(JS(Check), JS(check), ripple::ltCHECK),
104 LedgerTypeAttribute::accountOwnedLedgerType(JS(DepositPreauth), JS(deposit_preauth), ripple::ltDEPOSIT_PREAUTH),
106 LedgerTypeAttribute::chainLedgerType(JS(DirectoryNode), JS(directory), ripple::ltDIR_NODE),
107 LedgerTypeAttribute::deletionBlockerLedgerType(JS(Escrow), JS(escrow), ripple::ltESCROW),
108 LedgerTypeAttribute::chainLedgerType(JS(FeeSettings), JS(fee), ripple::ltFEE_SETTINGS),
109 LedgerTypeAttribute::chainLedgerType(JS(LedgerHashes), JS(hashes), ripple::ltLEDGER_HASHES),
110 LedgerTypeAttribute::accountOwnedLedgerType(JS(Offer), JS(offer), ripple::ltOFFER),
111 LedgerTypeAttribute::deletionBlockerLedgerType(JS(PayChannel), JS(payment_channel), ripple::ltPAYCHAN),
112 LedgerTypeAttribute::accountOwnedLedgerType(JS(SignerList), JS(signer_list), ripple::ltSIGNER_LIST),
113 LedgerTypeAttribute::deletionBlockerLedgerType(JS(RippleState), JS(state), ripple::ltRIPPLE_STATE),
114 LedgerTypeAttribute::accountOwnedLedgerType(JS(Ticket), JS(ticket), ripple::ltTICKET),
115 LedgerTypeAttribute::accountOwnedLedgerType(JS(NFTokenOffer), JS(nft_offer), ripple::ltNFTOKEN_OFFER),
116 LedgerTypeAttribute::deletionBlockerLedgerType(JS(NFTokenPage), JS(nft_page), ripple::ltNFTOKEN_PAGE),
117 LedgerTypeAttribute::accountOwnedLedgerType(JS(AMM), JS(amm), ripple::ltAMM),
118 LedgerTypeAttribute::deletionBlockerLedgerType(JS(Bridge), JS(bridge), ripple::ltBRIDGE),
119 LedgerTypeAttribute::deletionBlockerLedgerType(
120 JS(XChainOwnedClaimID),
121 JS(xchain_owned_claim_id),
122 ripple::ltXCHAIN_OWNED_CLAIM_ID
124 LedgerTypeAttribute::deletionBlockerLedgerType(
125 JS(XChainOwnedCreateAccountClaimID),
126 JS(xchain_owned_create_account_claim_id),
127 ripple::ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID
129 LedgerTypeAttribute::accountOwnedLedgerType(JS(DID), JS(did), ripple::ltDID),
130 LedgerTypeAttribute::accountOwnedLedgerType(JS(Oracle), JS(oracle), ripple::ltORACLE),
131 LedgerTypeAttribute::accountOwnedLedgerType(JS(Credential), JS(credential), ripple::ltCREDENTIAL),
132 LedgerTypeAttribute::accountOwnedLedgerType(JS(Vault), JS(vault), ripple::ltVAULT),
133 LedgerTypeAttribute::chainLedgerType(JS(NegativeUNL), JS(nunl), ripple::ltNEGATIVE_UNL),
134 LedgerTypeAttribute::deletionBlockerLedgerType(
137 ripple::ltMPTOKEN_ISSUANCE
139 LedgerTypeAttribute::deletionBlockerLedgerType(JS(MPToken), JS(mptoken), ripple::ltMPTOKEN),
140 LedgerTypeAttribute::deletionBlockerLedgerType(
141 JS(PermissionedDomain),
142 JS(permissioned_domain),
143 ripple::ltPERMISSIONED_DOMAIN
145 LedgerTypeAttribute::accountOwnedLedgerType(JS(Delegate), JS(delegate), ripple::ltDELEGATE),
153 static constexpr auto
156 std::array<
char const*, std::size(kLEDGER_TYPES)> res{};
157 std::ranges::transform(kLEDGER_TYPES, std::begin(res), [](
auto const& item) {
return item.rpcName_; });
166 static constexpr auto
169 constexpr auto kFILTER = [](
auto const& item) {
170 return item.category_ == LedgerTypeAttribute::LedgerCategory::DeletionBlocker;
173 constexpr auto kDELETION_BLOCKERS_COUNT =
174 std::count_if(std::begin(kLEDGER_TYPES), std::end(kLEDGER_TYPES), kFILTER);
175 std::array<ripple::LedgerEntryType, kDELETION_BLOCKERS_COUNT> res{};
176 auto it = std::begin(res);
177 std::ranges::for_each(kLEDGER_TYPES, [&](
auto const& item) {
192 static ripple::LedgerEntryType
202 static ripple::LedgerEntryType
206 static std::optional<std::reference_wrapper<impl::LedgerTypeAttribute const>>
207 getLedgerTypeAttributeFromStr(std::string
const& entryName);