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

Add include_deleted param to ledger_entry API #2725

Merged
merged 18 commits into from
Oct 1, 2024
Merged

Conversation

Kassaking7
Copy link
Contributor

High Level Overview of Change

Based on XRPLF/clio#1306

Context of Change

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

Did you update HISTORY.md?

  • Yes
  • No, this change does not impact library users

Test Plan

@pdp2121 pdp2121 requested review from ckeshava and pdp2121 July 9, 2024 14:47
@@ -35,7 +35,10 @@ export interface LedgerEntryRequest extends BaseRequest, LookupByLedgerRequest {
issuer?: string
}
}

/**
* If true, include latest version of the object that is not deleted in this ledger. The default is false.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use the exact description in the clio's issue for these params?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

should change the comment to whatever matches the spec/design. Also should clarify that this param is clio-only

@@ -204,5 +207,9 @@ export interface LedgerEntryResponse<T = LedgerEntry> extends BaseResponse {
/** The binary representation of the ledger object, as hexadecimal. */
node_binary?: string
validated?: boolean
/**
* If the object was deleted in this ledger, this field contains the sequence number of the transaction that deleted it
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should change the comment to match what is written in the design/spec. should mention it's clio-only

/**
* (Optional) Indicates the ledger index at which the object was deleted.
*/
deleted_ledger_index?: number
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include unit and integration tests that demonstrate the working of this flag? Are these flags enabled on any Clio (or) rippled instances?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flag is for Clio only so I guess we don't need a test for it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ckeshava there wouldn't be integration tests because this param is only available in clio, and currently the library doesn't support integration tests for clio

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel a unit test can be written to demonstrate the intended usage of include_deleted parameter.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A unit test file does not exist for this file, but it can be created under packages/xrpl/test/models. This is not a hard requirement, so I'll approve this PR.

@Kassaking7 Kassaking7 requested a review from ckeshava July 23, 2024 17:48
Copy link
Collaborator

@intelliot intelliot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only adds optional params

@justinr1234
Copy link
Collaborator

@CodeRabbit full review

@justinr1234
Copy link
Collaborator

@coderabbitai full review

Copy link

coderabbitai bot commented Sep 19, 2024

Actions performed

Full review triggered.

Copy link

coderabbitai bot commented Sep 19, 2024

Walkthrough

The updates to the xrpl.js library include significant changes across multiple versions, introducing new features, breaking changes, and enhancements. Key modifications involve the addition of optional properties in the LedgerEntryRequest and LedgerEntryResponse interfaces, allowing for improved handling of deleted objects. The library also introduces new API definitions and fields, along with updates to existing functionalities, ensuring better compliance with evolving standards in the XRPL ecosystem.

Changes

File Change Summary
packages/xrpl/HISTORY.md Updates across versions 4.0.0, 3.1.0, and 3.0.0, including breaking changes, new API definitions, and feature enhancements.
packages/xrpl/src/models/methods/ledgerEntry.ts Updated LedgerEntryRequest to include include_deleted property and LedgerEntryResponse to include deleted_ledger_index.

Poem

In the garden where the code does grow,
New features sprout, and changes flow.
With flags and fields, the ledger sings,
A rabbit's joy in the code it brings! 🐇✨
Hopping through updates, so bright and bold,
In the world of XRPL, watch the magic unfold!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (5)
packages/xrpl/src/models/methods/ledgerEntry.ts (3)

38-45: Improve the comment for include_deleted property

The implementation of the include_deleted property looks good. However, based on previous feedback, please consider the following improvements to the comment:

  1. Use the exact description from the Clio issue for consistency.
  2. Explicitly mention that this parameter is Clio-only at the beginning of the comment for better visibility.

Here's a suggested revision:

/**
 * (Clio-only) If set to true and the queried object has been deleted,
 * return its complete data prior to its deletion.
 * If set to false or not provided and the queried object has been deleted,
 * return objectNotFound (current behavior).
 * 
 * [Include the exact description from the Clio issue here]
 */
include_deleted?: boolean

214-217: Enhance the comment for deleted_ledger_index property

The implementation of the deleted_ledger_index property is correct. However, to maintain consistency with other comments in the file and provide more context, consider expanding the comment. Here's a suggested revision:

/**
 * (Optional) The ledger index at which the object was deleted.
 * This field is only present if the object has been deleted and the request
 * included `include_deleted: true`. It indicates the ledger version in which
 * the deletion occurred.
 */
deleted_ledger_index?: number

This expanded comment provides more context about when this field appears and its significance, which aligns better with the detailed comments used elsewhere in the file.


Line range hint 1-217: Consider adding unit tests and updating documentation

The changes look good overall. To further improve the implementation, consider the following:

  1. Add unit tests: As suggested in a previous review, it would be beneficial to add unit tests for the new include_deleted functionality. Although it's a Clio-only feature, unit tests can still verify the correct structure of requests and responses with these new properties.

  2. Update documentation: Ensure that any external documentation (e.g., API docs, README files) is updated to reflect these new properties and their Clio-only nature.

  3. Review related files: Check if there are any other files in the project that might need updates to accommodate these new properties (e.g., type definitions, constants, or utility functions).

Would you like assistance in drafting unit tests or identifying related files that might need updates?

packages/xrpl/HISTORY.md (2)

Line range hint 9-11: Unreleased changes section is empty

The "Unreleased Changes" section is currently empty. This is not an issue, but it might be worth considering adding a placeholder message like "No unreleased changes at this time" to make it clear that this section is intentionally empty.


Line range hint 35-50: Minor release with bug fixes and improvements: 3.1.0

This release includes several breaking changes despite being a minor version update:

  1. Flag name change from tfNoRippleDirect to tfNoDirectRipple
  2. Node.js version upgrade to 18
  3. Change in fetch implementation

While these changes are documented, it's unusual to have breaking changes in a minor version update. Consider whether this should have been a major version update instead.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 55892c8 and e9c7bc2.

📒 Files selected for processing (2)
  • packages/xrpl/HISTORY.md (1 hunks)
  • packages/xrpl/src/models/methods/ledgerEntry.ts (2 hunks)
🔇 Additional comments (4)
packages/xrpl/HISTORY.md (4)

Line range hint 1-7: LGTM: Clear and informative header

The header of the HISTORY.md file is well-structured and provides clear instructions for subscribing to release announcements. This is helpful for users who want to stay updated with the latest releases.


Line range hint 13-33: Major release with breaking changes: 4.0.0

This release includes significant breaking changes and new features:

  1. Default API version change to v2
  2. New API definitions and fields added
  3. Support for new amendments and features

These changes seem well-documented and appropriate for a major version bump. However, it's important to ensure that users are aware of the potential impact on their existing code.


Line range hint 52-76: Major release with significant changes: 3.0.0

This release includes numerous breaking changes and improvements:

  1. Removal of Node 14 support
  2. Replacement of several dependencies
  3. Changes to proxy configuration
  4. Redefinition of Transaction type

The changes are well-documented and appropriate for a major version update. The removal of polyfills and simplification of bundler configurations are positive improvements.


Line range hint 78-1014: Older version history

The remainder of the file contains detailed changelogs for older versions. These entries provide valuable historical context and seem to be well-maintained. No specific issues or concerns were identified in this section.

@pdp2121 pdp2121 merged commit be9b48b into XRPLF:main Oct 1, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants