Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support canonical ledger entry names in ledger/ledger_data/account_objects "type" field. #4393

Open
mDuo13 opened this issue Jan 19, 2023 · 6 comments
Assignees
Labels
API Change Feature Request Used to indicate requests to add new features Good First Issue Great issue for a new contributor Tech Debt Non-urgent improvements Will Need Documentation

Comments

@mDuo13
Copy link
Collaborator

mDuo13 commented Jan 19, 2023

Summary

The ledger, ledger_data , and account_objects methods accept a type field to filter the results to specific types of ledger entries. The values you pass in aren't always possible to determine from the entries' canonical JSON names so it's kind of a guessing game.

Since all of these methods are returning raw/canonical ledger entries anyway it would make more sense if the type field of these requests matched the canonical names as they appear in the LedgerEntryType field. Maybe for convenience they could be case-insensitive.

Motivation

Would you be able to guess all of the short names in this table?

Canonical Name Short Name
AccountRoot account 😉
Amendments amendments
Check check
DepositPreauth deposit_preauth
DirectoryNode directory 😩
Escrow escrow
FeeSettings fee 😮
LedgerHashes hashes 😑
NegativeUNL (No short name defined—can't filter by this type.)
NFTokenOffer nft_offer 🤔
NFTokenPage nft_page 🆕
Offer offer
PayChannel payment_channel 😅
RippleState state 😓
SignerList signer_list
Ticket ticket

(Emoji are not part of the names, I just added them as reactions to point out the less obvious ones.)

These short names also have to be manually added to the API methods whenever new types of ledger objects are implemented.

Solution

Modify these APIs (and any others that have a similar field, though I can't think of them offhand) so that type accepts the canonical name, case-insensitive. For backwards compatibility, continue to also support the existing short names (but mark them deprecated in the documentation).

Preferably, also do it in such a way that when someone develops a new ledger entry type, these methods support filtering on the new type using the canonical name with no new/additional code to the methods.

Relevant Source Code

{jss::fee, ltFEE_SETTINGS},

@mDuo13 mDuo13 added Feature Request Used to indicate requests to add new features API Change labels Jan 19, 2023
@intelliot intelliot added Good First Issue Great issue for a new contributor Tech Debt Non-urgent improvements Will Need Documentation labels Jun 27, 2023
@intelliot
Copy link
Collaborator

Consider adding to table: nft_page

@intelliot
Copy link
Collaborator

Given that Clio is intended to be a full replacement of the rippled API (for clients), this issue likely makes more sense for Clio to consider. With the lack of developer demand, the rippled behavior will be left alone.

@intelliot
Copy link
Collaborator

Canonical Name Short Name
MPToken mptoken
MPTokenIssuance mpt_issuance

@bthomee - is there any appetite for someone on the team to pick this up? It is a Good First Issue, perhaps good for someone relatively newer on the team.

To reiterate - the ask is for type to accept the Canonical Name and be case-insensitive. Support for the current short names should be kept so it's not a breaking change.

@mvadari
Copy link
Collaborator

mvadari commented Jan 28, 2025

IMO these should not be case insensitive, but should just be converting the canonical name from PascalCase to snake_case.

@intelliot
Copy link
Collaborator

We should satisfy the original request by OP: Support canonical ledger entry names in ledger/ledger_data/account_objects "type" field. So when I want MPTokenIssuance, let me just request MPTokenIssuance.

In addition to that, if the APIs accept case-insensitive and/or snake_case names, that is fine.

@bthomee
Copy link
Collaborator

bthomee commented Feb 1, 2025

We should satisfy the original request by OP: Support canonical ledger entry names in ledger/ledger_data/account_objects "type" field. So when I want MPTokenIssuance, let me just request MPTokenIssuance.

In addition to that, if the APIs accept case-insensitive and/or snake_case names, that is fine.

Am I'm new to the team I figured this would be a Good First Issue for me. I took a stab at it in #5271 using case-insensitive filtering by canonical name, and marking the use of the RPC name as deprecated, both in a comment and in the API changelog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Change Feature Request Used to indicate requests to add new features Good First Issue Great issue for a new contributor Tech Debt Non-urgent improvements Will Need Documentation
Projects
None yet
Development

No branches or pull requests

6 participants
@intelliot @mDuo13 @mvadari @bthomee @vvysokikh1 and others