import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import * as _m0 from "protobufjs/minimal";
import { createProtobufRpcClient } from "@cosmjs/stargate";
import { QueryScheduleRequest, QueryScheduleResponse, QuerySchedulesRequest, QuerySchedulesResponse } from "./query";
/** Query defines the gRPC querier service for the incentives module */

export class QueryClientImpl {
  constructor(rpc) {
    _defineProperty(this, "rpc", void 0);
    this.rpc = rpc;
    this.schedule = this.schedule.bind(this);
    this.schedules = this.schedules.bind(this);
  }
  schedule(request) {
    const data = QueryScheduleRequest.encode(request).finish();
    const promise = this.rpc.request("mars.incentives.v1beta1.Query", "Schedule", data);
    return promise.then(data => QueryScheduleResponse.decode(new _m0.Reader(data)));
  }
  schedules(request = {
    pagination: undefined
  }) {
    const data = QuerySchedulesRequest.encode(request).finish();
    const promise = this.rpc.request("mars.incentives.v1beta1.Query", "Schedules", data);
    return promise.then(data => QuerySchedulesResponse.decode(new _m0.Reader(data)));
  }
}
export const createRpcQueryExtension = base => {
  const rpc = createProtobufRpcClient(base);
  const queryService = new QueryClientImpl(rpc);
  return {
    schedule(request) {
      return queryService.schedule(request);
    },
    schedules(request) {
      return queryService.schedules(request);
    }
  };
};