# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

from chainrpc import chainnotifier_pb2 as chainrpc_dot_chainnotifier__pb2


class ChainNotifierStub(object):
  # missing associated documentation comment in .proto file
  pass

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

    Args:
      channel: A grpc.Channel.
    """
    self.RegisterConfirmationsNtfn = channel.unary_stream(
        '/chainrpc.ChainNotifier/RegisterConfirmationsNtfn',
        request_serializer=chainrpc_dot_chainnotifier__pb2.ConfRequest.SerializeToString,
        response_deserializer=chainrpc_dot_chainnotifier__pb2.ConfEvent.FromString,
        )
    self.RegisterSpendNtfn = channel.unary_stream(
        '/chainrpc.ChainNotifier/RegisterSpendNtfn',
        request_serializer=chainrpc_dot_chainnotifier__pb2.SpendRequest.SerializeToString,
        response_deserializer=chainrpc_dot_chainnotifier__pb2.SpendEvent.FromString,
        )
    self.RegisterBlockEpochNtfn = channel.unary_stream(
        '/chainrpc.ChainNotifier/RegisterBlockEpochNtfn',
        request_serializer=chainrpc_dot_chainnotifier__pb2.BlockEpoch.SerializeToString,
        response_deserializer=chainrpc_dot_chainnotifier__pb2.BlockEpoch.FromString,
        )


class ChainNotifierServicer(object):
  # missing associated documentation comment in .proto file
  pass

  def RegisterConfirmationsNtfn(self, request, context):
    """
    RegisterConfirmationsNtfn is a synchronous response-streaming RPC that
    registers an intent for a client to be notified once a confirmation request
    has reached its required number of confirmations on-chain.

    A client can specify whether the confirmation request should be for a
    particular transaction by its hash or for an output script by specifying a
    zero hash.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def RegisterSpendNtfn(self, request, context):
    """
    RegisterSpendNtfn is a synchronous response-streaming RPC that registers an
    intent for a client to be notification once a spend request has been spent
    by a transaction that has confirmed on-chain.

    A client can specify whether the spend request should be for a particular
    outpoint  or for an output script by specifying a zero outpoint.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def RegisterBlockEpochNtfn(self, request, context):
    """
    RegisterBlockEpochNtfn is a synchronous response-streaming RPC that
    registers an intent for a client to be notified of blocks in the chain. The
    stream will return a hash and height tuple of a block for each new/stale
    block in the chain. It is the client's responsibility to determine whether
    the tuple returned is for a new or stale block in the chain.

    A client can also request a historical backlog of blocks from a particular
    point. This allows clients to be idempotent by ensuring that they do not
    missing processing a single block within the chain.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_ChainNotifierServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'RegisterConfirmationsNtfn': grpc.unary_stream_rpc_method_handler(
          servicer.RegisterConfirmationsNtfn,
          request_deserializer=chainrpc_dot_chainnotifier__pb2.ConfRequest.FromString,
          response_serializer=chainrpc_dot_chainnotifier__pb2.ConfEvent.SerializeToString,
      ),
      'RegisterSpendNtfn': grpc.unary_stream_rpc_method_handler(
          servicer.RegisterSpendNtfn,
          request_deserializer=chainrpc_dot_chainnotifier__pb2.SpendRequest.FromString,
          response_serializer=chainrpc_dot_chainnotifier__pb2.SpendEvent.SerializeToString,
      ),
      'RegisterBlockEpochNtfn': grpc.unary_stream_rpc_method_handler(
          servicer.RegisterBlockEpochNtfn,
          request_deserializer=chainrpc_dot_chainnotifier__pb2.BlockEpoch.FromString,
          response_serializer=chainrpc_dot_chainnotifier__pb2.BlockEpoch.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'chainrpc.ChainNotifier', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))
