mirror of
https://github.com/logos-blockchain/logos-blockchain-block-explorer-template.git
synced 2026-07-04 14:19:25 +00:00
32 lines
815 B
Python
32 lines
815 B
Python
from abc import ABC, abstractmethod
|
|
from typing import TYPE_CHECKING, AsyncIterator, Optional
|
|
|
|
from node.api.serializers.block import BlockSerializer
|
|
from node.api.serializers.health import HealthSerializer
|
|
from node.api.serializers.info import InfoSerializer
|
|
|
|
if TYPE_CHECKING:
|
|
from core.app import NBESettings
|
|
|
|
|
|
class NodeApi(ABC):
|
|
@abstractmethod
|
|
def __init__(self, _settings: "NBESettings"):
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def get_health(self) -> HealthSerializer:
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def get_info(self) -> InfoSerializer:
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def get_block_by_hash(self, block_hash: str) -> Optional[BlockSerializer]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def get_blocks_stream(self) -> AsyncIterator[BlockSerializer]:
|
|
pass
|