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::chainLedgerType(JS(nunl), ripple::ltNEGATIVE_UNL),
118 LedgerTypeAttribute::deletionBlockerLedgerType(JS(mpt_issuance), ripple::ltMPTOKEN_ISSUANCE),
119 LedgerTypeAttribute::deletionBlockerLedgerType(JS(mptoken), ripple::ltMPTOKEN),
120 LedgerTypeAttribute::deletionBlockerLedgerType(JS(permissioned_domain), ripple::ltPERMISSIONED_DOMAIN),
121 LedgerTypeAttribute::accountOwnedLedgerType(JS(delegate), ripple::ltDELEGATE),
129 static constexpr auto
132 std::array<
char const*, std::size(kLEDGER_TYPES)> res{};
133 std::ranges::transform(kLEDGER_TYPES, std::begin(res), [](
auto const& item) {
return item.name_; });
142 static constexpr auto
145 constexpr auto kFILTER = [](
auto const& item) {
146 return item.category_ != LedgerTypeAttribute::LedgerCategory::Chain;
149 constexpr auto kACCOUNT_OWNED_COUNT =
150 std::count_if(std::begin(kLEDGER_TYPES), std::end(kLEDGER_TYPES), kFILTER);
151 std::array<char const*, kACCOUNT_OWNED_COUNT> res{};
152 auto it = std::begin(res);
153 std::ranges::for_each(kLEDGER_TYPES, [&](
auto const& item) {
167 static constexpr auto
170 constexpr auto kFILTER = [](
auto const& item) {
171 return item.category_ == LedgerTypeAttribute::LedgerCategory::DeletionBlocker;
174 constexpr auto kDELETION_BLOCKERS_COUNT =
175 std::count_if(std::begin(kLEDGER_TYPES), std::end(kLEDGER_TYPES), kFILTER);
176 std::array<ripple::LedgerEntryType, kDELETION_BLOCKERS_COUNT> res{};
177 auto it = std::begin(res);
178 std::ranges::for_each(kLEDGER_TYPES, [&](
auto const& item) {
193 static ripple::LedgerEntryType