27 lines
664 B
Python
Raw Normal View History

2025-10-03 22:27:30 +02:00
from abc import ABC, abstractmethod
2025-11-03 13:17:19 +01:00
from typing import TYPE_CHECKING, 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
2025-11-03 13:17:19 +01:00
if TYPE_CHECKING:
from core.app import NBESettings
2025-10-03 22:27:30 +02:00
class NodeApi(ABC):
2025-11-03 13:17:19 +01:00
@abstractmethod
def __init__(self, _settings: "NBESettings"):
pass
2025-10-03 22:27:30 +02:00
@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