Skip to content

Commit

Permalink
refactor: use single Oracle class for Price Oracles (#704)
Browse files Browse the repository at this point in the history
* use single Oracle class for get_aggregate_price and ledger_entry to resolve duplicate name conflict.
  • Loading branch information
khancode authored May 15, 2024
1 parent ae2ac9c commit 407dc26
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
2 changes: 1 addition & 1 deletion tests/unit/models/requests/test_get_aggregate_price.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 1 addition & 14 deletions xrpl/models/requests/get_aggregate_price.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"""

0 comments on commit 407dc26

Please sign in to comment.