Skip to content

Rename ticket properties in ledgerEntry model#3237

Open
Platonenkov wants to merge 3 commits into
XRPLF:mainfrom
Platonenkov:patch-1
Open

Rename ticket properties in ledgerEntry model#3237
Platonenkov wants to merge 3 commits into
XRPLF:mainfrom
Platonenkov:patch-1

Conversation

@Platonenkov
Copy link
Copy Markdown

@Platonenkov Platonenkov commented Mar 30, 2026

fix bug for ticket objects request

High Level Overview of Change

This PR fixes the ledger_entry request model for ticket objects in xrpl.js.

Changes made:

  • renamed ticket.owner to ticket.account
  • renamed ticket.ticket_sequence to ticket.ticket_seq

This aligns the request payload with the XRPL ledger_entry API specification for Ticket objects, where the object form of ticket requires account and ticket_seq.
https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/ledger-methods/ledger_entry#get-ticket-entry

Context of Change

The current model uses incorrect field names for ticket lookup requests:

  • owner
  • ticket_sequence

According to the official XRPL documentation, the correct fields are:

  • account
  • ticket_seq

Because of this mismatch, requests built using the current typed object shape do not match the API contract and fail when trying to retrieve Ticket ledger objects through ledger_entry. The documented Ticket request example also uses account and ticket_seq.

This change updates the TypeScript model so the library matches the official API and users can construct valid Ticket object requests.

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

Verified the change by reviewing the XRPL ledger_entry Ticket request specification and matching the request model to the documented parameter names:

  • ticket.account
  • ticket.ticket_seq

To reproduce:

  1. Build a ledger_entry request for a Ticket using object form.
  2. Use:
    {
      "command": "ledger_entry",
      "ticket": {
        "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
        "ticket_seq": 389
      },
      "ledger_index": "validated"
    }

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 30, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 15570a5b-4387-4298-b2ef-adece1bdb180

📥 Commits

Reviewing files that changed from the base of the PR and between 6840107 and 848c38a.

📒 Files selected for processing (3)
  • packages/xrpl/HISTORY.md
  • packages/xrpl/src/models/methods/ledgerEntry.ts
  • packages/xrpl/test/integration/requests/ledgerEntry.test.ts
✅ Files skipped from review due to trivial changes (2)
  • packages/xrpl/src/models/methods/ledgerEntry.ts
  • packages/xrpl/HISTORY.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/xrpl/test/integration/requests/ledgerEntry.test.ts

Walkthrough

The LedgerEntryRequest.ticket object's keys were renamed from { owner, ticket_sequence } to { account, ticket_seq }. A HISTORY.md entry documents this breaking change. A new integration test exercises fetching a Ticket ledger entry using the updated selector shape.

Changes

LedgerEntry request type and test

Layer / File(s) Summary
Data Shape
packages/xrpl/src/models/methods/ledgerEntry.ts
LedgerEntryRequest.ticket object-form keys renamed: owneraccount, ticket_sequenceticket_seq (union with string unchanged).
Test Flow / Helpers
packages/xrpl/test/integration/requests/ledgerEntry.test.ts
Updated imports to include LedgerEntryResponse, TicketCreate, Ticket model type, and testTransaction helper.
Integration Test
packages/xrpl/test/integration/requests/ledgerEntry.test.ts
Added fetches a Ticket object test: creates a Ticket via TicketCreate, submits it, calls ledger_entry with ticket: { account, ticket_seq }, and asserts the returned node is a Ticket with expected fields.
Release Notes
packages/xrpl/HISTORY.md
Added Unreleased Fixed bullet marked [Breaking change] describing the rename and advising updates to object-form ticket usage.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • kuan121
  • justinr1234

Poem

🐇 I nudged some keys in the ledger nest,
owner became account, ticket_seq the rest.
I hopped a test to fetch what I changed,
a Ticket returned — the paths rearranged.
Hooray for tidy types and a check well-ranged.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and clearly describes the main change: renaming ticket properties in the ledgerEntry model, which is the primary modification across all three files in this changeset.
Description check ✅ Passed The description comprehensively covers all required template sections including High Level Overview, Context of Change, Type of Change (breaking change marked), HISTORY.md confirmation, Test Plan, and a clear problem statement with specification references.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/xrpl/src/models/methods/ledgerEntry.ts (1)

184-196: ⚠️ Potential issue | 🟡 Minor

JSDoc comment is inconsistent with the new field names.

The documentation on lines 186-187 still references the old field names owner and ticket_sequence, but the actual fields are now account and ticket_seq. Update the JSDoc to match.

📝 Proposed fix for documentation
   /**
    * The Ticket object to retrieve. If a string, must be the object ID of the
-   * Ticket, as hexadecimal. If an object, the `owner` and `ticket_sequence`
+   * Ticket, as hexadecimal. If an object, the `account` and `ticket_seq`
    * sub-fields are required to uniquely specify the Ticket entry.
    */
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/xrpl/src/models/methods/ledgerEntry.ts` around lines 184 - 196,
Update the JSDoc for the ticket field to reflect the current property names:
replace references to `owner` and `ticket_sequence` with `account` and
`ticket_seq` so the comment matches the union type definition for ticket; ensure
the descriptive sentence(s) around the `ticket` property and its sub-fields
(`account`, `ticket_seq`) correctly describe them in the block above the
ticket?: { account: string; ticket_seq: number } | string declaration.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/xrpl/src/models/methods/ledgerEntry.ts`:
- Around line 192-194: Update documentation and release notes to clearly
describe the breaking rename of the ledger entry lookup fields: the request
fields in packages/xrpl/src/models/methods/ledgerEntry.ts have changed from
owner -> account and ticket_sequence -> ticket_seq; add a migration section
showing example payloads before and after, and mention versions where the change
takes effect. Also add a short compatibility shim in the SDK surface (e.g.,
input parsing for the ledgerEntry request handler) that accepts the old fields
('owner' and 'ticket_sequence') and maps them to the new properties ('account'
and 'ticket_seq') with a deprecation warning to guide users toward updating
their code. Ensure the changelog entry references the exact field names and the
file/class (ledgerEntry) so consumers can find and update usages.

---

Outside diff comments:
In `@packages/xrpl/src/models/methods/ledgerEntry.ts`:
- Around line 184-196: Update the JSDoc for the ticket field to reflect the
current property names: replace references to `owner` and `ticket_sequence` with
`account` and `ticket_seq` so the comment matches the union type definition for
ticket; ensure the descriptive sentence(s) around the `ticket` property and its
sub-fields (`account`, `ticket_seq`) correctly describe them in the block above
the ticket?: { account: string; ticket_seq: number } | string declaration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3013724a-fe00-410a-86a0-55c7cd8c1229

📥 Commits

Reviewing files that changed from the base of the PR and between 1af0e0d and b5c0da0.

📒 Files selected for processing (1)
  • packages/xrpl/src/models/methods/ledgerEntry.ts

Comment on lines +192 to +194
account: string
/** The Ticket Sequence number of the Ticket entry to retrieve. */
ticket_sequence: number
ticket_seq: number
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

XRPL ledger_entry API ticket object field names account ticket_seq

💡 Result:

In the XRPL ledger_entry API method, to retrieve a Ticket object, specify the "ticket" field as an object with subfields "account" (string - the account address owning the ticket) and "ticket_seq" (number - the ticket sequence number). Alternatively, use "ticket" as a string for the hex ledger entry ID. The Ticket ledger entry object itself includes these fields (plus common ledger entry fields like index, LedgerEntryType, Flags): - Account: String - Address of the owning account - TicketSequence: Number - The reserved sequence number (note the camelCase in JSON) Example request: { "ticket": { "account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", "ticket_seq": 389 }, "ledger_index": "validated" }

Citations:


These field names (account and ticket_seq) are correct and match the official XRPL ledger_entry API specification for ticket lookups.

This is a confirmed breaking change from the previous field names (owner and ticket_sequence). While the new names align with the official XRPL API, this will require migration guidance for existing consumers. Ensure release notes and documentation clearly communicate the rename with migration instructions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/xrpl/src/models/methods/ledgerEntry.ts` around lines 192 - 194,
Update documentation and release notes to clearly describe the breaking rename
of the ledger entry lookup fields: the request fields in
packages/xrpl/src/models/methods/ledgerEntry.ts have changed from owner ->
account and ticket_sequence -> ticket_seq; add a migration section showing
example payloads before and after, and mention versions where the change takes
effect. Also add a short compatibility shim in the SDK surface (e.g., input
parsing for the ledgerEntry request handler) that accepts the old fields
('owner' and 'ticket_sequence') and maps them to the new properties ('account'
and 'ticket_seq') with a deprecation warning to guide users toward updating
their code. Ensure the changelog entry references the exact field names and the
file/class (ledgerEntry) so consumers can find and update usages.

@@ -189,9 +189,9 @@ export interface LedgerEntryRequest extends BaseRequest, LookupByLedgerRequest {
ticket?:
Copy link
Copy Markdown
Collaborator

@kuan121 kuan121 Apr 6, 2026

Choose a reason for hiding this comment

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

This is a breaking change. Can you update

  1. HISTORY.md
  2. PR description where it currently claims that this isn't a breaking change that will impact library users

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

✅ done

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@kuan121 Do we need to do a major-version upgrade owing to this change? Clearly other users have not used ledger_entry RPC to fetch Ticket objects, hence this bug is being discovered for the first time.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Doesn't this seem more like a bug fix rather than a spec change? I don't think we need a major version update for this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think you yourself should decide what to do next. I have done everything that depends on me.

Copy link
Copy Markdown
Collaborator

@ckeshava ckeshava left a comment

Choose a reason for hiding this comment

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

@Platonenkov Thank you for this work. Can you also include an integration test under the ledger_entry RPC tests that verifies that Ticket objects are fetched correctly? This will ensure that future code changes will not cause this regression.

packages/xrpl/test/integration/requests/ledgerEntry.test.ts would be an appropriate file this type of test

@Platonenkov
Copy link
Copy Markdown
Author

@ckeshava

Comment on lines +69 to +73
const accountInfoResponse = await testContext.client.request({
command: 'account_info',
account: testContext.wallet.classicAddress,
})
const accSeq = accountInfoResponse.result.account_data.Sequence
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

FYI: For future work, you do not need to manually fill the account-sequence value, that can be populated by "autofill" methods in xrpl-py

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I understand this, but in this case it was necessary to calculate ticketSeq

ckeshava
ckeshava previously approved these changes May 4, 2026
@ckeshava
Copy link
Copy Markdown
Collaborator

ckeshava commented May 4, 2026

@Platonenkov please resolve the merge conflict and rebase

@Platonenkov
Copy link
Copy Markdown
Author

@Platonenkov please resolve the merge conflict and rebase

done ✅

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.

4 participants