27class LedgerTypeAttribute {
28 enum class LedgerCategory {
35 ripple::LedgerEntryType type_ = ripple::ltANY;
36 char const* name_ =
nullptr;
37 char const* rpcName_ =
nullptr;
38 LedgerCategory category_ = LedgerCategory::Invalid;
40 constexpr LedgerTypeAttribute(
43 ripple::LedgerEntryType type,
44 LedgerCategory category
46 : type_{type}, name_{name}, rpcName_{rpcName}, category_{category}
51 static constexpr LedgerTypeAttribute
52 chainLedgerType(
char const* name,
char const* rpcName, ripple::LedgerEntryType type)
54 return LedgerTypeAttribute(name, rpcName, type, LedgerCategory::Chain);
57 static constexpr LedgerTypeAttribute
58 accountOwnedLedgerType(
char const* name,
char const* rpcName, ripple::LedgerEntryType type)
60 return LedgerTypeAttribute(name, rpcName, type, LedgerCategory::AccountOwned);
63 static constexpr LedgerTypeAttribute
64 deletionBlockerLedgerType(
char const* name,
char const* rpcName, ripple::LedgerEntryType type)
66 return LedgerTypeAttribute(name, rpcName, type, LedgerCategory::DeletionBlocker);
79 using LedgerTypeAttributeList = LedgerTypeAttribute[];
81 static constexpr LedgerTypeAttributeList
const kLEDGER_TYPES{
82 LedgerTypeAttribute::accountOwnedLedgerType(
85 ripple::ltACCOUNT_ROOT
87 LedgerTypeAttribute::chainLedgerType(JS(Amendments), JS(amendments), ripple::ltAMENDMENTS),
88 LedgerTypeAttribute::deletionBlockerLedgerType(JS(Check), JS(check), ripple::ltCHECK),
89 LedgerTypeAttribute::accountOwnedLedgerType(
92 ripple::ltDEPOSIT_PREAUTH
95 LedgerTypeAttribute::chainLedgerType(JS(DirectoryNode), JS(directory), ripple::ltDIR_NODE),
96 LedgerTypeAttribute::deletionBlockerLedgerType(JS(Escrow), JS(escrow), ripple::ltESCROW),
97 LedgerTypeAttribute::chainLedgerType(JS(FeeSettings), JS(fee), ripple::ltFEE_SETTINGS),
98 LedgerTypeAttribute::chainLedgerType(JS(LedgerHashes), JS(hashes), ripple::ltLEDGER_HASHES),
99 LedgerTypeAttribute::accountOwnedLedgerType(JS(Offer), JS(offer), ripple::ltOFFER),
100 LedgerTypeAttribute::deletionBlockerLedgerType(
105 LedgerTypeAttribute::accountOwnedLedgerType(
108 ripple::ltSIGNER_LIST
110 LedgerTypeAttribute::deletionBlockerLedgerType(
113 ripple::ltRIPPLE_STATE
115 LedgerTypeAttribute::accountOwnedLedgerType(JS(Ticket), JS(ticket), ripple::ltTICKET),
116 LedgerTypeAttribute::accountOwnedLedgerType(
119 ripple::ltNFTOKEN_OFFER
121 LedgerTypeAttribute::deletionBlockerLedgerType(
124 ripple::ltNFTOKEN_PAGE
126 LedgerTypeAttribute::accountOwnedLedgerType(JS(AMM), JS(amm), ripple::ltAMM),
127 LedgerTypeAttribute::deletionBlockerLedgerType(JS(Bridge), JS(bridge), ripple::ltBRIDGE),
128 LedgerTypeAttribute::deletionBlockerLedgerType(
129 JS(XChainOwnedClaimID),
130 JS(xchain_owned_claim_id),
131 ripple::ltXCHAIN_OWNED_CLAIM_ID
133 LedgerTypeAttribute::deletionBlockerLedgerType(
134 JS(XChainOwnedCreateAccountClaimID),
135 JS(xchain_owned_create_account_claim_id),
136 ripple::ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID
138 LedgerTypeAttribute::accountOwnedLedgerType(JS(DID), JS(did), ripple::ltDID),
139 LedgerTypeAttribute::accountOwnedLedgerType(JS(Oracle), JS(oracle), ripple::ltORACLE),
140 LedgerTypeAttribute::accountOwnedLedgerType(
145 LedgerTypeAttribute::accountOwnedLedgerType(JS(Vault), JS(vault), ripple::ltVAULT),
146 LedgerTypeAttribute::chainLedgerType(JS(NegativeUNL), JS(nunl), ripple::ltNEGATIVE_UNL),
147 LedgerTypeAttribute::deletionBlockerLedgerType(
150 ripple::ltMPTOKEN_ISSUANCE
152 LedgerTypeAttribute::deletionBlockerLedgerType(JS(MPToken), JS(mptoken), ripple::ltMPTOKEN),
153 LedgerTypeAttribute::deletionBlockerLedgerType(
154 JS(PermissionedDomain),
155 JS(permissioned_domain),
156 ripple::ltPERMISSIONED_DOMAIN
158 LedgerTypeAttribute::accountOwnedLedgerType(JS(Delegate), JS(delegate), ripple::ltDELEGATE),
166 static constexpr auto
169 std::array<
char const*, std::size(kLEDGER_TYPES)> res{};
170 std::ranges::transform(kLEDGER_TYPES, std::begin(res), [](
auto const& item) {
171 return item.rpcName_;
181 static constexpr auto
184 constexpr auto kFILTER = [](
auto const& item) {
185 return item.category_ == LedgerTypeAttribute::LedgerCategory::DeletionBlocker;
188 constexpr auto kDELETION_BLOCKERS_COUNT =
189 std::count_if(std::begin(kLEDGER_TYPES), std::end(kLEDGER_TYPES), kFILTER);
190 std::array<ripple::LedgerEntryType, kDELETION_BLOCKERS_COUNT> res{};
191 auto it = std::begin(res);
192 std::ranges::for_each(kLEDGER_TYPES, [&](
auto const& item) {
208 static ripple::LedgerEntryType
218 static ripple::LedgerEntryType
222 static std::optional<std::reference_wrapper<impl::LedgerTypeAttribute const>>
223 getLedgerTypeAttributeFromStr(std::string
const& entryName);