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 #721

Merged
merged 19 commits into from
Oct 26, 2024
Merged

Conversation

Kassaking7
Copy link
Contributor

@Kassaking7 Kassaking7 commented Jul 3, 2024

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 CHANGELOG.md?

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

Test Plan

Summary by CodeRabbit

  • New Features
    • Introduced support for the DeliverMax field in Payment transactions.
    • Added support for the feature RPC.
    • New optional parameter include_deleted for querying ledger entries.
  • Bug Fixes
    • Resolved issues allowing empty strings in DIDSet transactions.
    • Removed deprecated parameters from the ledger request model.
  • Breaking Changes
    • Removed support for Python 3.7; Python 3.8 is now the default.
    • Updated default API for requests to rippled API v2.

@pdp2121 pdp2121 requested a review from ckeshava July 9, 2024 15:20
@@ -264,6 +264,8 @@ class LedgerEntry(Request, LookupByLedgerRequest):
binary: bool = False
nft_page: Optional[str] = None
"""Must be the object ID of the NFToken page, as hexadecimal"""
include_deleted: Optional[bool] = None
"""This parameter is supported only by Clio servers"""
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 also add a link to the documentation reference for this 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.

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 one is still on progress (XRPLF/clio#1306) so it's not in XRPL docs for now. Do I need to add that link to ledger_entry.py?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, I see. It would have been helpful to add the docs link, but it's not absolutely essential.

@@ -264,6 +264,8 @@ class LedgerEntry(Request, LookupByLedgerRequest):
binary: bool = False
nft_page: Optional[str] = None
"""Must be the object ID of the NFToken page, as hexadecimal"""
include_deleted: Optional[bool] = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why does the xrpl-py client library not contain the deleted_ledger_index parameter? I observed it in the javascript client library

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since there's no response class in ledger_entry.py so I assume we don't need it? For js one there's already a response class(interface) so I just add deleted_ledger_index to that class.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, Python doesn't have response models.

@Kassaking7 Kassaking7 requested a review from ckeshava July 11, 2024 15:38
@ckeshava
Copy link
Collaborator

@Kassaking7 please let us know if this PR is ready to be merged

Copy link
Contributor

coderabbitai bot commented Oct 25, 2024

Walkthrough

The changes in this pull request involve significant updates to the project's changelog and the LedgerEntry request model. Key modifications include the removal of Python 3.7 support, updates to the default API for requests, and the addition of new features such as the include_deleted parameter in the LedgerEntry class. Deprecated parameters have been removed, and various fixes have been implemented to enhance functionality and error handling across different versions of the project.

Changes

File Change Summary
CHANGELOG.md Updated to reflect breaking changes, new features, fixes, and removals; removed Python 3.7 support; established Python 3.8 as default; updated API to rippled API v2; added support for DeliverMax field, feature RPC, and include_deleted parameter; removed deprecated parameters from ledger request model.
xrpl/models/requests/ledger_entry.py Added include_deleted parameter to LedgerEntry class; updated validation logic in _get_errors method.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API
    participant LedgerEntry

    Client->>API: Request ledger entry with include_deleted
    API->>LedgerEntry: Process request
    LedgerEntry->>LedgerEntry: Validate parameters
    LedgerEntry-->>API: Return ledger entry data
    API-->>Client: Send response with ledger entry data
Loading

🐇 "In the code where changes abound,
A new path for queries is found.
With features bright and bugs now tamed,
Our ledger sings, no longer shamed.
Python 3.8, we leap and cheer,
For every update brings us near!" 🐇


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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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
Contributor

@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: 1

🧹 Outside diff range and nitpick comments (1)
xrpl/models/requests/ledger_entry.py (1)

267-268: Enhance the documentation for the include_deleted parameter.

While the current docstring indicates Clio server support, it would be helpful to:

  1. Describe the parameter's purpose and effect
  2. Add a reference to the Clio issue for context

Consider updating the docstring to:

     include_deleted: Optional[bool] = None
-    """This parameter is supported only by Clio servers"""
+    """
+    Optional parameter to include deleted ledger entries in the response.
+    This parameter is supported only by Clio servers.
+    See: https://github.com/XRPLF/clio/issues/1306
+    """
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between fd278e0 and 1512949.

📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • xrpl/models/requests/ledger_entry.py (1 hunks)
🔇 Additional comments (2)
xrpl/models/requests/ledger_entry.py (1)

267-267: Consider adding validation for include_deleted.

The parameter is added but there's no validation logic in _get_errors(). While this might be intentional since it's an optional parameter, consider whether any validation is needed (e.g., ensuring it's only used with certain query parameters).

Let's check if similar parameters have validation:

CHANGELOG.md (1)

Line range hint 1-1: Request for additional files.

The changelog entry and AI summary indicate changes to the LedgerEntry request model, but these implementation files are not provided for review. Please include the following files to ensure a comprehensive review:

  • The file containing the LedgerEntry request model implementation (likely xrpl/models/requests/ledger_entry.py)

CHANGELOG.md Outdated
@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Support for the Price Oracles amendment (XLS-47).
- Add `nfts_by_issuer` clio-only API definition
- Included `ctid` field in the `tx` request.
- Add `include_deleted` to ledger_entry request
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Move the include_deleted entry to the "Unreleased" section.

The changelog entry for adding include_deleted to ledger_entry request is currently under version 2.6.0, which is a released version. Since this is a new feature being added in PR #721, it should be documented under the "Unreleased" section instead.

Apply this diff to move the entry:

 ## [[Unreleased]]
 
 ### BREAKING CHANGE:
 - Remove Python 3.7 support to fix dependency installation and use 3.8 as new default.
+
+### Added
+- Add `include_deleted` to ledger_entry request
 
 ## [2.6.0] - 2024-06-03
 
 ### Added
 - Support for the Price Oracles amendment (XLS-47).
 - Add `nfts_by_issuer` clio-only API definition
 - Included `ctid` field in the `tx` request.
-- Add `include_deleted` to ledger_entry request
 - `from_xrpl` method accepts input dictionary keys exclusively in the proper XRPL format.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- Add `include_deleted` to ledger_entry request
## [[Unreleased]]
### BREAKING CHANGE:
- Remove Python 3.7 support to fix dependency installation and use 3.8 as new default.
### Added
- Add `include_deleted` to ledger_entry request
## [2.6.0] - 2024-06-03
### Added
- Support for the Price Oracles amendment (XLS-47).
- Add `nfts_by_issuer` clio-only API definition
- Included `ctid` field in the `tx` request.
- `from_xrpl` method accepts input dictionary keys exclusively in the proper XRPL format.

@Kassaking7
Copy link
Contributor Author

@Kassaking7 please let us know if this PR is ready to be merged

Yes, this PR is good to be merged

Copy link
Contributor

@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 (1)
CHANGELOG.md (1)

10-11: Enhance the changelog entry description.

The current entry could be more descriptive to help users understand the feature's purpose and limitations. Also, there's a minor grammar issue with the repeated word "Add".

Apply this diff to improve the description:

 ### Added
-Add `include_deleted` to ledger_entry request
+- `include_deleted` parameter in ledger_entry request to allow retrieving deleted ledger entries (Clio servers only)
🧰 Tools
🪛 LanguageTool

[grammar] ~10-~10: You’ve repeated a verb. Did you mean to only write one of them?
Context: ...c/v2.0.0.html). ## [[Unreleased]] ### Added - Add include_deleted to ledger_entry reque...

(REPEATED_VERBS)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1512949 and 28db48a.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
CHANGELOG.md

[grammar] ~10-~10: You’ve repeated a verb. Did you mean to only write one of them?
Context: ...c/v2.0.0.html). ## [[Unreleased]] ### Added - Add include_deleted to ledger_entry reque...

(REPEATED_VERBS)

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.

5 participants