|
19 | 19 | ) |
20 | 20 | from soroscan.models import ( |
21 | 21 | ContractEvent, |
| 22 | + ContractEventTypeInfo, |
22 | 23 | ContractStats, |
23 | 24 | EventEntry, |
24 | 25 | PaginatedResponse, |
@@ -302,6 +303,21 @@ def get_contract_stats(self, contract_id: str) -> ContractStats: |
302 | 303 | data = self._handle_response(response) |
303 | 304 | return ContractStats.model_validate(data) |
304 | 305 |
|
| 306 | + def get_contract_event_types(self, contract_id: str) -> list[ContractEventTypeInfo]: |
| 307 | + """ |
| 308 | + Get event types and their counts for a specific contract (SC-17). |
| 309 | +
|
| 310 | + Args: |
| 311 | + contract_id: Contract address (C...) |
| 312 | +
|
| 313 | + Returns: |
| 314 | + List of event type info with counts and first/last seen timestamps |
| 315 | + """ |
| 316 | + url = urljoin(self.base_url, f"/api/contracts/{contract_id}/event-types/") |
| 317 | + response = self._client.get(url, headers=self._get_headers()) |
| 318 | + data = self._handle_response(response) |
| 319 | + return [ContractEventTypeInfo.model_validate(item) for item in data] |
| 320 | + |
305 | 321 | def get_events( |
306 | 322 | self, |
307 | 323 | contract_id: str | None = None, |
@@ -809,6 +825,21 @@ async def get_contract_stats(self, contract_id: str) -> ContractStats: |
809 | 825 | data = self._handle_response(response) |
810 | 826 | return ContractStats.model_validate(data) |
811 | 827 |
|
| 828 | + async def get_contract_event_types(self, contract_id: str) -> list[ContractEventTypeInfo]: |
| 829 | + """ |
| 830 | + Get event types and their counts for a specific contract (SC-17). |
| 831 | +
|
| 832 | + Args: |
| 833 | + contract_id: Contract address (C...) |
| 834 | +
|
| 835 | + Returns: |
| 836 | + List of event type info with counts and first/last seen timestamps |
| 837 | + """ |
| 838 | + url = urljoin(self.base_url, f"/api/contracts/{contract_id}/event-types/") |
| 839 | + response = await self._client.get(url, headers=self._get_headers()) |
| 840 | + data = self._handle_response(response) |
| 841 | + return [ContractEventTypeInfo.model_validate(item) for item in data] |
| 842 | + |
812 | 843 | async def get_events( |
813 | 844 | self, |
814 | 845 | contract_id: str | None = None, |
|
0 commit comments