# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from pyinjective.proto.cometbft.services.block.v1 import block_pb2 as cometbft_dot_services_dot_block_dot_v1_dot_block__pb2


class BlockServiceStub(object):
    """BlockService provides information about blocks
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.GetByHeight = channel.unary_unary(
                '/cometbft.services.block.v1.BlockService/GetByHeight',
                request_serializer=cometbft_dot_services_dot_block_dot_v1_dot_block__pb2.GetByHeightRequest.SerializeToString,
                response_deserializer=cometbft_dot_services_dot_block_dot_v1_dot_block__pb2.GetByHeightResponse.FromString,
                _registered_method=True)
        self.GetLatestHeight = channel.unary_stream(
                '/cometbft.services.block.v1.BlockService/GetLatestHeight',
                request_serializer=cometbft_dot_services_dot_block_dot_v1_dot_block__pb2.GetLatestHeightRequest.SerializeToString,
                response_deserializer=cometbft_dot_services_dot_block_dot_v1_dot_block__pb2.GetLatestHeightResponse.FromString,
                _registered_method=True)


class BlockServiceServicer(object):
    """BlockService provides information about blocks
    """

    def GetByHeight(self, request, context):
        """GetBlock retrieves the block information at a particular height.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetLatestHeight(self, request, context):
        """GetLatestHeight returns a stream of the latest block heights committed by
        the network. This is a long-lived stream that is only terminated by the
        server if an error occurs. The caller is expected to handle such
        disconnections and automatically reconnect.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_BlockServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'GetByHeight': grpc.unary_unary_rpc_method_handler(
                    servicer.GetByHeight,
                    request_deserializer=cometbft_dot_services_dot_block_dot_v1_dot_block__pb2.GetByHeightRequest.FromString,
                    response_serializer=cometbft_dot_services_dot_block_dot_v1_dot_block__pb2.GetByHeightResponse.SerializeToString,
            ),
            'GetLatestHeight': grpc.unary_stream_rpc_method_handler(
                    servicer.GetLatestHeight,
                    request_deserializer=cometbft_dot_services_dot_block_dot_v1_dot_block__pb2.GetLatestHeightRequest.FromString,
                    response_serializer=cometbft_dot_services_dot_block_dot_v1_dot_block__pb2.GetLatestHeightResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'cometbft.services.block.v1.BlockService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('cometbft.services.block.v1.BlockService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class BlockService(object):
    """BlockService provides information about blocks
    """

    @staticmethod
    def GetByHeight(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/cometbft.services.block.v1.BlockService/GetByHeight',
            cometbft_dot_services_dot_block_dot_v1_dot_block__pb2.GetByHeightRequest.SerializeToString,
            cometbft_dot_services_dot_block_dot_v1_dot_block__pb2.GetByHeightResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetLatestHeight(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_stream(
            request,
            target,
            '/cometbft.services.block.v1.BlockService/GetLatestHeight',
            cometbft_dot_services_dot_block_dot_v1_dot_block__pb2.GetLatestHeightRequest.SerializeToString,
            cometbft_dot_services_dot_block_dot_v1_dot_block__pb2.GetLatestHeightResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
