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),
128 static constexpr auto
131 std::array<
char const*, std::size(kLEDGER_TYPES)> res{};
132 std::ranges::transform(kLEDGER_TYPES, std::begin(res), [](
auto const& item) {
return item.name_; });
141 static constexpr auto
144 constexpr auto kFILTER = [](
auto const& item) {
145 return item.category_ != LedgerTypeAttribute::LedgerCategory::Chain;
148 constexpr auto kACCOUNT_OWNED_COUNT =
149 std::count_if(std::begin(kLEDGER_TYPES), std::end(kLEDGER_TYPES), kFILTER);
150 std::array<char const*, kACCOUNT_OWNED_COUNT> res{};
151 auto it = std::begin(res);
152 std::ranges::for_each(kLEDGER_TYPES, [&](
auto const& item) {
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