import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
//@ts-nocheck

import * as _m0 from "protobufjs/minimal";
import { createProtobufRpcClient } from "@cosmjs/stargate";
import { QueryChecksumsRequest, QueryChecksumsResponse, QueryCodeRequest, QueryCodeResponse } from "./query";
/** Query service for wasm module */

export class QueryClientImpl {
  constructor(rpc) {
    _defineProperty(this, "rpc", void 0);
    this.rpc = rpc;
    this.checksums = this.checksums.bind(this);
    this.code = this.code.bind(this);
  }
  checksums(request = {
    pagination: undefined
  }) {
    const data = QueryChecksumsRequest.encode(request).finish();
    const promise = this.rpc.request("ibc.lightclients.wasm.v1.Query", "Checksums", data);
    return promise.then(data => QueryChecksumsResponse.decode(new _m0.Reader(data)));
  }
  code(request) {
    const data = QueryCodeRequest.encode(request).finish();
    const promise = this.rpc.request("ibc.lightclients.wasm.v1.Query", "Code", data);
    return promise.then(data => QueryCodeResponse.decode(new _m0.Reader(data)));
  }
}
export const createRpcQueryExtension = base => {
  const rpc = createProtobufRpcClient(base);
  const queryService = new QueryClientImpl(rpc);
  return {
    checksums(request) {
      return queryService.checksums(request);
    },
    code(request) {
      return queryService.code(request);
    }
  };
};