Skip to content

Conversation

Copy link

Copilot AI commented Dec 5, 2025

High Level Overview of Change

Updates AccountObjects.type field to accept both AccountObjectType enum and LedgerEntryType enum values, supporting canonical ledger entry names added in rippled 2.4.0.

Context of Change

rippled 2.4.0 added support for canonical ledger entry names (XRPLF/rippled#5271), but the AccountObjects model only accepted AccountObjectType enum values, rejecting valid requests using LedgerEntryType.

# Previously only this worked:
AccountObjects(account=wallet.address, type=AccountObjectType.ESCROW)

# Now both work:
AccountObjects(account=wallet.address, type=LedgerEntryType.ESCROW)  # canonical ledger entry type
AccountObjects(account=wallet.address, type=AccountObjectType.ESCROW)  # original enum

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)

Did you update CHANGELOG.md?

  • No, this change does not impact library users

Test Plan

  • Added unit tests for AccountObjectType and LedgerEntryType enum values in tests/unit/models/requests/test_account_objects.py
  • Verified all 734 existing unit tests pass
Original prompt

This section details on the original issue you should resolve

<issue_title>account_objects model unnecessarily fails validation when using canonical ledger entry name in "type" field</issue_title>
<issue_description>rippled version 2.4.0 added support for canonical ledger entry names ( XRPLF/rippled#5271 ) but the AccountObjects request model hasn't been updated, so it rejects such usage.

example request:

response = client.request(AccountObjects(
            account=wallet.address,
            ledger_hash=ledger_hash,
            type="Escrow",
            marker=marker
        ))

Should be valid but fails with this error:

{'type': "type is <class 'str'>, expected typing.Optional[xrpl.models.requests.account_objects.AccountObjectType]"}
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 5, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

@mvadari
Copy link
Collaborator

mvadari commented Dec 5, 2025

Update AccountObjects.type field to accept both AccountObjectType enum and str using Union[AccountObjectType, str]

@copilot it should actually be Union[AccountObjectType, LedgerEntryType]

Copilot AI changed the title [WIP] Fix validation for AccountObjects model using canonical ledger entry names Allow string type values in AccountObjects request for canonical ledger entry names Dec 5, 2025
Copilot AI requested a review from mvadari December 5, 2025 15:55
Copilot finished work on behalf of mvadari December 5, 2025 15:55
Copy link
Author

Copilot AI commented Dec 5, 2025

Update AccountObjects.type field to accept both AccountObjectType enum and str using Union[AccountObjectType, str]

@copilot it should actually be Union[AccountObjectType, LedgerEntryType]

Updated to use Union[AccountObjectType, LedgerEntryType] instead of str in commit 339a0e9. The type field now accepts both the original AccountObjectType enum and the LedgerEntryType enum for canonical ledger entry names.

Copilot AI changed the title Allow string type values in AccountObjects request for canonical ledger entry names Allow LedgerEntryType values in AccountObjects request for canonical ledger entry names Dec 5, 2025
Copilot finished work on behalf of mvadari December 5, 2025 16:07
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.

account_objects model unnecessarily fails validation when using canonical ledger entry name in "type" field

2 participants