// package: injective_spot_exchange_rpc
// file: injective_spot_exchange_rpc.proto

import * as injective_spot_exchange_rpc_pb from "./injective_spot_exchange_rpc_pb";
import {grpc} from "@improbable-eng/grpc-web";

type InjectiveSpotExchangeRPCMarkets = {
  readonly methodName: string;
  readonly service: typeof InjectiveSpotExchangeRPC;
  readonly requestStream: false;
  readonly responseStream: false;
  readonly requestType: typeof injective_spot_exchange_rpc_pb.MarketsRequest;
  readonly responseType: typeof injective_spot_exchange_rpc_pb.MarketsResponse;
};

type InjectiveSpotExchangeRPCMarket = {
  readonly methodName: string;
  readonly service: typeof InjectiveSpotExchangeRPC;
  readonly requestStream: false;
  readonly responseStream: false;
  readonly requestType: typeof injective_spot_exchange_rpc_pb.MarketRequest;
  readonly responseType: typeof injective_spot_exchange_rpc_pb.MarketResponse;
};

type InjectiveSpotExchangeRPCStreamMarkets = {
  readonly methodName: string;
  readonly service: typeof InjectiveSpotExchangeRPC;
  readonly requestStream: false;
  readonly responseStream: true;
  readonly requestType: typeof injective_spot_exchange_rpc_pb.StreamMarketsRequest;
  readonly responseType: typeof injective_spot_exchange_rpc_pb.StreamMarketsResponse;
};

type InjectiveSpotExchangeRPCOrderbook = {
  readonly methodName: string;
  readonly service: typeof InjectiveSpotExchangeRPC;
  readonly requestStream: false;
  readonly responseStream: false;
  readonly requestType: typeof injective_spot_exchange_rpc_pb.OrderbookRequest;
  readonly responseType: typeof injective_spot_exchange_rpc_pb.OrderbookResponse;
};

type InjectiveSpotExchangeRPCOrderbooks = {
  readonly methodName: string;
  readonly service: typeof InjectiveSpotExchangeRPC;
  readonly requestStream: false;
  readonly responseStream: false;
  readonly requestType: typeof injective_spot_exchange_rpc_pb.OrderbooksRequest;
  readonly responseType: typeof injective_spot_exchange_rpc_pb.OrderbooksResponse;
};

type InjectiveSpotExchangeRPCStreamOrderbook = {
  readonly methodName: string;
  readonly service: typeof InjectiveSpotExchangeRPC;
  readonly requestStream: false;
  readonly responseStream: true;
  readonly requestType: typeof injective_spot_exchange_rpc_pb.StreamOrderbookRequest;
  readonly responseType: typeof injective_spot_exchange_rpc_pb.StreamOrderbookResponse;
};

type InjectiveSpotExchangeRPCOrders = {
  readonly methodName: string;
  readonly service: typeof InjectiveSpotExchangeRPC;
  readonly requestStream: false;
  readonly responseStream: false;
  readonly requestType: typeof injective_spot_exchange_rpc_pb.OrdersRequest;
  readonly responseType: typeof injective_spot_exchange_rpc_pb.OrdersResponse;
};

type InjectiveSpotExchangeRPCStreamOrders = {
  readonly methodName: string;
  readonly service: typeof InjectiveSpotExchangeRPC;
  readonly requestStream: false;
  readonly responseStream: true;
  readonly requestType: typeof injective_spot_exchange_rpc_pb.StreamOrdersRequest;
  readonly responseType: typeof injective_spot_exchange_rpc_pb.StreamOrdersResponse;
};

type InjectiveSpotExchangeRPCTrades = {
  readonly methodName: string;
  readonly service: typeof InjectiveSpotExchangeRPC;
  readonly requestStream: false;
  readonly responseStream: false;
  readonly requestType: typeof injective_spot_exchange_rpc_pb.TradesRequest;
  readonly responseType: typeof injective_spot_exchange_rpc_pb.TradesResponse;
};

type InjectiveSpotExchangeRPCStreamTrades = {
  readonly methodName: string;
  readonly service: typeof InjectiveSpotExchangeRPC;
  readonly requestStream: false;
  readonly responseStream: true;
  readonly requestType: typeof injective_spot_exchange_rpc_pb.StreamTradesRequest;
  readonly responseType: typeof injective_spot_exchange_rpc_pb.StreamTradesResponse;
};

type InjectiveSpotExchangeRPCSubaccountOrdersList = {
  readonly methodName: string;
  readonly service: typeof InjectiveSpotExchangeRPC;
  readonly requestStream: false;
  readonly responseStream: false;
  readonly requestType: typeof injective_spot_exchange_rpc_pb.SubaccountOrdersListRequest;
  readonly responseType: typeof injective_spot_exchange_rpc_pb.SubaccountOrdersListResponse;
};

type InjectiveSpotExchangeRPCSubaccountTradesList = {
  readonly methodName: string;
  readonly service: typeof InjectiveSpotExchangeRPC;
  readonly requestStream: false;
  readonly responseStream: false;
  readonly requestType: typeof injective_spot_exchange_rpc_pb.SubaccountTradesListRequest;
  readonly responseType: typeof injective_spot_exchange_rpc_pb.SubaccountTradesListResponse;
};

export class InjectiveSpotExchangeRPC {
  static readonly serviceName: string;
  static readonly Markets: InjectiveSpotExchangeRPCMarkets;
  static readonly Market: InjectiveSpotExchangeRPCMarket;
  static readonly StreamMarkets: InjectiveSpotExchangeRPCStreamMarkets;
  static readonly Orderbook: InjectiveSpotExchangeRPCOrderbook;
  static readonly Orderbooks: InjectiveSpotExchangeRPCOrderbooks;
  static readonly StreamOrderbook: InjectiveSpotExchangeRPCStreamOrderbook;
  static readonly Orders: InjectiveSpotExchangeRPCOrders;
  static readonly StreamOrders: InjectiveSpotExchangeRPCStreamOrders;
  static readonly Trades: InjectiveSpotExchangeRPCTrades;
  static readonly StreamTrades: InjectiveSpotExchangeRPCStreamTrades;
  static readonly SubaccountOrdersList: InjectiveSpotExchangeRPCSubaccountOrdersList;
  static readonly SubaccountTradesList: InjectiveSpotExchangeRPCSubaccountTradesList;
}

export type ServiceError = { message: string, code: number; metadata: grpc.Metadata }
export type Status = { details: string, code: number; metadata: grpc.Metadata }

interface UnaryResponse {
  cancel(): void;
}
interface ResponseStream<T> {
  cancel(): void;
  on(type: 'data', handler: (message: T) => void): ResponseStream<T>;
  on(type: 'end', handler: (status?: Status) => void): ResponseStream<T>;
  on(type: 'status', handler: (status: Status) => void): ResponseStream<T>;
}
interface RequestStream<T> {
  write(message: T): RequestStream<T>;
  end(): void;
  cancel(): void;
  on(type: 'end', handler: (status?: Status) => void): RequestStream<T>;
  on(type: 'status', handler: (status: Status) => void): RequestStream<T>;
}
interface BidirectionalStream<ReqT, ResT> {
  write(message: ReqT): BidirectionalStream<ReqT, ResT>;
  end(): void;
  cancel(): void;
  on(type: 'data', handler: (message: ResT) => void): BidirectionalStream<ReqT, ResT>;
  on(type: 'end', handler: (status?: Status) => void): BidirectionalStream<ReqT, ResT>;
  on(type: 'status', handler: (status: Status) => void): BidirectionalStream<ReqT, ResT>;
}

export class InjectiveSpotExchangeRPCClient {
  readonly serviceHost: string;

  constructor(serviceHost: string, options?: grpc.RpcOptions);
  markets(
    requestMessage: injective_spot_exchange_rpc_pb.MarketsRequest,
    metadata: grpc.Metadata,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.MarketsResponse|null) => void
  ): UnaryResponse;
  markets(
    requestMessage: injective_spot_exchange_rpc_pb.MarketsRequest,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.MarketsResponse|null) => void
  ): UnaryResponse;
  market(
    requestMessage: injective_spot_exchange_rpc_pb.MarketRequest,
    metadata: grpc.Metadata,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.MarketResponse|null) => void
  ): UnaryResponse;
  market(
    requestMessage: injective_spot_exchange_rpc_pb.MarketRequest,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.MarketResponse|null) => void
  ): UnaryResponse;
  streamMarkets(requestMessage: injective_spot_exchange_rpc_pb.StreamMarketsRequest, metadata?: grpc.Metadata): ResponseStream<injective_spot_exchange_rpc_pb.StreamMarketsResponse>;
  orderbook(
    requestMessage: injective_spot_exchange_rpc_pb.OrderbookRequest,
    metadata: grpc.Metadata,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.OrderbookResponse|null) => void
  ): UnaryResponse;
  orderbook(
    requestMessage: injective_spot_exchange_rpc_pb.OrderbookRequest,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.OrderbookResponse|null) => void
  ): UnaryResponse;
  orderbooks(
    requestMessage: injective_spot_exchange_rpc_pb.OrderbooksRequest,
    metadata: grpc.Metadata,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.OrderbooksResponse|null) => void
  ): UnaryResponse;
  orderbooks(
    requestMessage: injective_spot_exchange_rpc_pb.OrderbooksRequest,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.OrderbooksResponse|null) => void
  ): UnaryResponse;
  streamOrderbook(requestMessage: injective_spot_exchange_rpc_pb.StreamOrderbookRequest, metadata?: grpc.Metadata): ResponseStream<injective_spot_exchange_rpc_pb.StreamOrderbookResponse>;
  orders(
    requestMessage: injective_spot_exchange_rpc_pb.OrdersRequest,
    metadata: grpc.Metadata,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.OrdersResponse|null) => void
  ): UnaryResponse;
  orders(
    requestMessage: injective_spot_exchange_rpc_pb.OrdersRequest,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.OrdersResponse|null) => void
  ): UnaryResponse;
  streamOrders(requestMessage: injective_spot_exchange_rpc_pb.StreamOrdersRequest, metadata?: grpc.Metadata): ResponseStream<injective_spot_exchange_rpc_pb.StreamOrdersResponse>;
  trades(
    requestMessage: injective_spot_exchange_rpc_pb.TradesRequest,
    metadata: grpc.Metadata,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.TradesResponse|null) => void
  ): UnaryResponse;
  trades(
    requestMessage: injective_spot_exchange_rpc_pb.TradesRequest,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.TradesResponse|null) => void
  ): UnaryResponse;
  streamTrades(requestMessage: injective_spot_exchange_rpc_pb.StreamTradesRequest, metadata?: grpc.Metadata): ResponseStream<injective_spot_exchange_rpc_pb.StreamTradesResponse>;
  subaccountOrdersList(
    requestMessage: injective_spot_exchange_rpc_pb.SubaccountOrdersListRequest,
    metadata: grpc.Metadata,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.SubaccountOrdersListResponse|null) => void
  ): UnaryResponse;
  subaccountOrdersList(
    requestMessage: injective_spot_exchange_rpc_pb.SubaccountOrdersListRequest,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.SubaccountOrdersListResponse|null) => void
  ): UnaryResponse;
  subaccountTradesList(
    requestMessage: injective_spot_exchange_rpc_pb.SubaccountTradesListRequest,
    metadata: grpc.Metadata,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.SubaccountTradesListResponse|null) => void
  ): UnaryResponse;
  subaccountTradesList(
    requestMessage: injective_spot_exchange_rpc_pb.SubaccountTradesListRequest,
    callback: (error: ServiceError|null, responseMessage: injective_spot_exchange_rpc_pb.SubaccountTradesListResponse|null) => void
  ): UnaryResponse;
}

