From e2f158f79869cfe70db7da80a8539b61f7916aa6 Mon Sep 17 00:00:00 2001 From: Mateusz <169154504+donbagger@users.noreply.github.com> Date: Tue, 14 Apr 2026 12:58:05 +0200 Subject: [PATCH] feat: add time range filters and token social fields - get_transactions: new from_timestamp/to_timestamp params for time-range filtering (results capped to last 7 days) - TokenDetails/TokenDetailsLight: added telegram and twitter fields Upstream: dexpaprika-go commits 5233dc0, 8af5491 Co-Authored-By: Claude Opus 4.6 (1M context) --- dexpaprika_sdk/api/pools.py | 28 ++++++++++++++++------------ dexpaprika_sdk/models/tokens.py | 4 ++++ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/dexpaprika_sdk/api/pools.py b/dexpaprika_sdk/api/pools.py index de6f10b..9a5b07f 100644 --- a/dexpaprika_sdk/api/pools.py +++ b/dexpaprika_sdk/api/pools.py @@ -253,26 +253,30 @@ def get_ohlcv( return [OHLCVRecord(**item) for item in data] def get_transactions( - self, - network_id: str, - pool_address: str, - page: int = 0, - limit: int = 10, - cursor: Optional[str] = None + self, + network_id: str, + pool_address: str, + page: int = 0, + limit: int = 10, + cursor: Optional[str] = None, + from_timestamp: Optional[int] = None, + to_timestamp: Optional[int] = None ) -> TransactionsResponse: """ Get transactions of a pool on a network. - + Args: network_id: Network ID (e.g., "ethereum", "solana") pool_address: Pool address or identifier page: Page number for pagination limit: Number of items per page cursor: Transaction ID used for cursor-based pagination - + from_timestamp: Filter transactions starting from this UNIX timestamp (inclusive). Results capped to last 7 days. + to_timestamp: Filter transactions up to this UNIX timestamp (exclusive). Must be after from_timestamp. + Returns: Response containing a list of transactions - + Raises: ValueError: If any parameter is invalid """ @@ -281,11 +285,11 @@ def get_transactions( self._validate_required("pool_address", pool_address) self._validate_range("page", page, min_val=0) self._validate_range("limit", limit, min_val=1, max_val=100) - + # Get txs - params = {"page": page, "limit": limit, "cursor": cursor} + params = {"page": page, "limit": limit, "cursor": cursor, "from": from_timestamp, "to": to_timestamp} params = self._clean_params(params) - + data = self._get(f"/networks/{network_id}/pools/{pool_address}/transactions", params=params) return TransactionsResponse(**data) diff --git a/dexpaprika_sdk/models/tokens.py b/dexpaprika_sdk/models/tokens.py index 8e72590..c5f22c8 100644 --- a/dexpaprika_sdk/models/tokens.py +++ b/dexpaprika_sdk/models/tokens.py @@ -36,6 +36,8 @@ class TokenDetails(BaseModel): total_supply: Optional[float] = Field(None, description="Total supply of the token (may be None for some chains like Solana)") description: str = Field("", description="Token description") website: str = Field("", description="Token website URL") + telegram: str = Field("", description="Official Telegram URL for the token/project") + twitter: str = Field("", description="Official Twitter URL for the token/project") explorer: str = Field("", description="Token explorer URL") added_at: str = Field(..., description="When the token was added to the system") summary: Optional[TokenSummary] = Field(None, description="Token summary metrics") @@ -53,6 +55,8 @@ class TokenDetailsLight(BaseModel): total_supply: Optional[float] = Field(None, description="Total supply of the token (may be None for some chains like Solana)") description: str = Field("", description="Token description") website: str = Field("", description="Token website URL") + telegram: str = Field("", description="Official Telegram URL for the token/project") + twitter: str = Field("", description="Official Twitter URL for the token/project") explorer: str = Field("", description="Token explorer URL") added_at: Optional[str] = Field(None, description="When the token was added to the system") price_usd: Optional[float] = Field(None, description="Current price in USD")