diff --git a/CHANGELOG.md b/CHANGELOG.md index da36873b9..ac923410b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [[Unreleased]] +### Fixed +- Fix [error in the type filter](https://github.com/XRPLF/xrpl-py/issues/888) of the account_objects request. + ## [[4.4.0]] - 2025-12-16 ### Added diff --git a/tests/integration/reqs/test_account_objects.py b/tests/integration/reqs/test_account_objects.py index 4606c5ed5..6b01066ae 100644 --- a/tests/integration/reqs/test_account_objects.py +++ b/tests/integration/reqs/test_account_objects.py @@ -13,3 +13,24 @@ async def test_basic_functionality(self, client): ) ) self.assertTrue(response.is_successful()) + + @test_async_and_sync(globals()) + async def test_type_filter(self, client): + response = await client.request( + AccountObjects( + account=WALLET.address, + type="Escrow", + ) + ) + self.assertTrue(response.is_successful()) + self.assertIsNotNone(response.result["account_objects"]) + + # test case-insensitive type filter + response = await client.request( + AccountObjects( + account=WALLET.address, + type="mPtOkeNisSuance", + ) + ) + self.assertTrue(response.is_successful()) + self.assertIsNotNone(response.result["account_objects"]) diff --git a/xrpl/models/requests/account_objects.py b/xrpl/models/requests/account_objects.py index 07aa9154f..b59a2e0af 100644 --- a/xrpl/models/requests/account_objects.py +++ b/xrpl/models/requests/account_objects.py @@ -9,7 +9,7 @@ from dataclasses import dataclass, field from enum import Enum -from typing import Any, Optional +from typing import Any, Optional, Union from xrpl.models.requests.request import LookupByLedgerRequest, Request, RequestMethod from xrpl.models.required import REQUIRED @@ -65,7 +65,7 @@ class AccountObjects(Request, LookupByLedgerRequest): """ method: RequestMethod = field(default=RequestMethod.ACCOUNT_OBJECTS, init=False) - type: Optional[AccountObjectType] = None + type: Optional[Union[AccountObjectType, str]] = None deletion_blockers_only: bool = False limit: Optional[int] = None # marker data shape is actually undefined in the spec, up to the