From 407dc269bd667770bf41b6961b8132ab3dbc7303 Mon Sep 17 00:00:00 2001 From: Omar Khan Date: Wed, 15 May 2024 18:21:30 -0400 Subject: [PATCH] refactor: use single Oracle class for Price Oracles (#704) * use single Oracle class for get_aggregate_price and ledger_entry to resolve duplicate name conflict. --- .../models/requests/test_get_aggregate_price.py | 2 +- xrpl/models/requests/get_aggregate_price.py | 15 +-------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/tests/unit/models/requests/test_get_aggregate_price.py b/tests/unit/models/requests/test_get_aggregate_price.py index dec902320..1a3f8e09b 100644 --- a/tests/unit/models/requests/test_get_aggregate_price.py +++ b/tests/unit/models/requests/test_get_aggregate_price.py @@ -2,7 +2,7 @@ from xrpl.models import XRPLModelException from xrpl.models.requests import GetAggregatePrice -from xrpl.models.requests.get_aggregate_price import Oracle +from xrpl.models.requests.ledger_entry import Oracle _ACCT_STR_1 = "rBwHKFS534tfG3mATXSycCnX8PAd3XJswj" _ORACLE_DOC_ID_1 = 1 diff --git a/xrpl/models/requests/get_aggregate_price.py b/xrpl/models/requests/get_aggregate_price.py index d8efdd017..9dd04275d 100644 --- a/xrpl/models/requests/get_aggregate_price.py +++ b/xrpl/models/requests/get_aggregate_price.py @@ -8,8 +8,7 @@ from dataclasses import dataclass, field from typing import Dict, List, Optional -from typing_extensions import TypedDict - +from xrpl.models.requests.ledger_entry import Oracle from xrpl.models.requests.request import Request, RequestMethod from xrpl.models.required import REQUIRED from xrpl.models.utils import require_kwargs_on_init @@ -49,15 +48,3 @@ def _get_errors(self: GetAggregatePrice) -> Dict[str, str]: "GetAggregatePrice" ] = "Oracles array must contain at least one element" return errors - - -@require_kwargs_on_init -@dataclass(frozen=True) -class Oracle(TypedDict): - """Represents one Oracle element. It is used in GetAggregatePrice request""" - - oracle_document_id: int = REQUIRED # type: ignore - """A unique identifier of the price oracle for the Account""" - - account: str = REQUIRED # type: ignore - """The XRPL account that controls the Oracle object"""