import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import { BinaryReader } from "../binary";
import { createProtobufRpcClient } from "@cosmjs/stargate";
import { QueryParamsRequest, QueryParamsResponse, QueryTasksRequest, QueryTasksResponse, QueryGetRewardRequest, QueryGetRewardResponse, QueryAllRewardsRequest, QueryAllRewardsResponse } from "./query";
/** Query defines the gRPC querier service. */

export class QueryClientImpl {
  constructor(rpc) {
    _defineProperty(this, "rpc", void 0);
    this.rpc = rpc;
    this.params = this.params.bind(this);
    this.tasks = this.tasks.bind(this);
    this.reward = this.reward.bind(this);
    this.rewardsAll = this.rewardsAll.bind(this);
  }
  params(request = {}) {
    const data = QueryParamsRequest.encode(request).finish();
    const promise = this.rpc.request("gitopia.gitopia.rewards.Query", "Params", data);
    return promise.then(data => QueryParamsResponse.decode(new BinaryReader(data)));
  }
  tasks(request) {
    const data = QueryTasksRequest.encode(request).finish();
    const promise = this.rpc.request("gitopia.gitopia.rewards.Query", "Tasks", data);
    return promise.then(data => QueryTasksResponse.decode(new BinaryReader(data)));
  }
  reward(request) {
    const data = QueryGetRewardRequest.encode(request).finish();
    const promise = this.rpc.request("gitopia.gitopia.rewards.Query", "Reward", data);
    return promise.then(data => QueryGetRewardResponse.decode(new BinaryReader(data)));
  }
  rewardsAll(request = {
    pagination: undefined
  }) {
    const data = QueryAllRewardsRequest.encode(request).finish();
    const promise = this.rpc.request("gitopia.gitopia.rewards.Query", "RewardsAll", data);
    return promise.then(data => QueryAllRewardsResponse.decode(new BinaryReader(data)));
  }
}
export const createRpcQueryExtension = base => {
  const rpc = createProtobufRpcClient(base);
  const queryService = new QueryClientImpl(rpc);
  return {
    params(request) {
      return queryService.params(request);
    },
    tasks(request) {
      return queryService.tasks(request);
    },
    reward(request) {
      return queryService.reward(request);
    },
    rewardsAll(request) {
      return queryService.rewardsAll(request);
    }
  };
};