2025-10-03 22:27:30 +02:00
|
|
|
from abc import ABC, abstractmethod
|
2025-10-15 20:53:52 +02:00
|
|
|
from typing import AsyncIterator, List
|
2025-10-03 22:27:30 +02:00
|
|
|
|
2025-10-30 11:48:34 +01:00
|
|
|
from node.api.serializers.block import BlockSerializer
|
|
|
|
|
from node.api.serializers.health import HealthSerializer
|
2025-10-03 22:27:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class NodeApi(ABC):
|
|
|
|
|
@abstractmethod
|
2025-10-30 11:48:34 +01:00
|
|
|
async def get_health(self) -> HealthSerializer:
|
2025-10-03 22:27:30 +02:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
@abstractmethod
|
2025-10-30 11:48:34 +01:00
|
|
|
async def get_blocks(self, **kwargs) -> List[BlockSerializer]:
|
2025-10-15 20:53:52 +02:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
@abstractmethod
|
2025-10-30 11:48:34 +01:00
|
|
|
async def get_blocks_stream(self) -> AsyncIterator[List[BlockSerializer]]:
|
2025-10-03 22:27:30 +02:00
|
|
|
pass
|