44 enum class LedgerCategory {
51 ripple::LedgerEntryType type_ = ripple::ltANY;
52 char const* name_ =
nullptr;
53 LedgerCategory category_ = LedgerCategory::Invalid;
55 constexpr LedgerTypeAttribute(
char const* name, ripple::LedgerEntryType type, LedgerCategory category)
56 : type_(type), name_(name), category_(category)
62 chainLedgerType(
char const* name, ripple::LedgerEntryType type)
68 accountOwnedLedgerType(
char const* name, ripple::LedgerEntryType type)
74 deletionBlockerLedgerType(
char const* name, ripple::LedgerEntryType type)
90 static constexpr LedgerTypeAttributeList
const kLEDGER_TYPES{
91 LedgerTypeAttribute::accountOwnedLedgerType(JS(account), ripple::ltACCOUNT_ROOT),
92 LedgerTypeAttribute::chainLedgerType(JS(amendments), ripple::ltAMENDMENTS),
93 LedgerTypeAttribute::deletionBlockerLedgerType(JS(check), ripple::ltCHECK),
94 LedgerTypeAttribute::accountOwnedLedgerType(JS(deposit_preauth), ripple::ltDEPOSIT_PREAUTH),
96 LedgerTypeAttribute::chainLedgerType(JS(directory), ripple::ltDIR_NODE),
97 LedgerTypeAttribute::deletionBlockerLedgerType(JS(escrow), ripple::ltESCROW),
98 LedgerTypeAttribute::chainLedgerType(JS(fee), ripple::ltFEE_SETTINGS),
99 LedgerTypeAttribute::chainLedgerType(JS(hashes), ripple::ltLEDGER_HASHES),
100 LedgerTypeAttribute::accountOwnedLedgerType(JS(offer), ripple::ltOFFER),
101 LedgerTypeAttribute::deletionBlockerLedgerType(JS(payment_channel), ripple::ltPAYCHAN),
102 LedgerTypeAttribute::accountOwnedLedgerType(JS(signer_list), ripple::ltSIGNER_LIST),
103 LedgerTypeAttribute::deletionBlockerLedgerType(JS(state), ripple::ltRIPPLE_STATE),
104 LedgerTypeAttribute::accountOwnedLedgerType(JS(ticket), ripple::ltTICKET),
105 LedgerTypeAttribute::accountOwnedLedgerType(JS(nft_offer), ripple::ltNFTOKEN_OFFER),
106 LedgerTypeAttribute::deletionBlockerLedgerType(JS(nft_page), ripple::ltNFTOKEN_PAGE),
107 LedgerTypeAttribute::accountOwnedLedgerType(JS(amm), ripple::ltAMM),
108 LedgerTypeAttribute::deletionBlockerLedgerType(JS(bridge), ripple::ltBRIDGE),
109 LedgerTypeAttribute::deletionBlockerLedgerType(JS(xchain_owned_claim_id), ripple::ltXCHAIN_OWNED_CLAIM_ID),
110 LedgerTypeAttribute::deletionBlockerLedgerType(
111 JS(xchain_owned_create_account_claim_id),
112 ripple::ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID
114 LedgerTypeAttribute::accountOwnedLedgerType(JS(did), ripple::ltDID),
115 LedgerTypeAttribute::accountOwnedLedgerType(JS(oracle), ripple::ltORACLE),
116 LedgerTypeAttribute::accountOwnedLedgerType(JS(credential), ripple::ltCREDENTIAL),
117 LedgerTypeAttribute::accountOwnedLedgerType(JS(vault), ripple::ltVAULT),
118 LedgerTypeAttribute::chainLedgerType(JS(nunl), ripple::ltNEGATIVE_UNL),
119 LedgerTypeAttribute::deletionBlockerLedgerType(JS(mpt_issuance), ripple::ltMPTOKEN_ISSUANCE),
120 LedgerTypeAttribute::deletionBlockerLedgerType(JS(mptoken), ripple::ltMPTOKEN),
121 LedgerTypeAttribute::deletionBlockerLedgerType(JS(permissioned_domain), ripple::ltPERMISSIONED_DOMAIN),
122 LedgerTypeAttribute::accountOwnedLedgerType(JS(delegate), ripple::ltDELEGATE),
130 static constexpr auto
133 std::array<
char const*, std::size(kLEDGER_TYPES)> res{};
134 std::ranges::transform(kLEDGER_TYPES, std::begin(res), [](
auto const& item) {
return item.name_; });
143 static constexpr auto
146 constexpr auto kFILTER = [](
auto const& item) {
147 return item.category_ != LedgerTypeAttribute::LedgerCategory::Chain;
150 constexpr auto kACCOUNT_OWNED_COUNT =
151 std::count_if(std::begin(kLEDGER_TYPES), std::end(kLEDGER_TYPES), kFILTER);
152 std::array<char const*, kACCOUNT_OWNED_COUNT> res{};
153 auto it = std::begin(res);
154 std::ranges::for_each(kLEDGER_TYPES, [&](
auto const& item) {
168 static constexpr auto
171 constexpr auto kFILTER = [](
auto const& item) {
172 return item.category_ == LedgerTypeAttribute::LedgerCategory::DeletionBlocker;
175 constexpr auto kDELETION_BLOCKERS_COUNT =
176 std::count_if(std::begin(kLEDGER_TYPES), std::end(kLEDGER_TYPES), kFILTER);
177 std::array<ripple::LedgerEntryType, kDELETION_BLOCKERS_COUNT> res{};
178 auto it = std::begin(res);
179 std::ranges::for_each(kLEDGER_TYPES, [&](
auto const& item) {
194 static ripple::LedgerEntryType