Allow LedgerEntryType values in AccountObjects request for canonical ledger entry names
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 (https://github.com/XRPLF/rippled/pull/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
- [x] Bug fix (non-breaking change which fixes an issue)
- [x] 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
AccountObjectTypeandLedgerEntryTypeenum values intests/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>
rippledversion 2.4.0 added support for canonical ledger entry names ( https://github.com/XRPLF/rippled/pull/5271 ) but theAccountObjectsrequest 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>
- Fixes XRPLF/xrpl-py#888
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.