"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.createRpcQueryExtension = exports.QueryClientImpl = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _m0 = _interopRequireWildcard(require("protobufjs/minimal"));
var _stargate = require("@cosmjs/stargate");
var _query = require("./query");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
//@ts-nocheck
/** Query defines the gRPC querier service. */
var QueryClientImpl = exports.QueryClientImpl = /*#__PURE__*/function () {
  function QueryClientImpl(rpc) {
    (0, _classCallCheck2["default"])(this, QueryClientImpl);
    (0, _defineProperty2["default"])(this, "rpc", void 0);
    this.rpc = rpc;
    this.params = this.params.bind(this);
    this.entity = this.entity.bind(this);
    this.entityMetaData = this.entityMetaData.bind(this);
    this.entityIidDocument = this.entityIidDocument.bind(this);
    this.entityVerified = this.entityVerified.bind(this);
    this.entityList = this.entityList.bind(this);
  }
  return (0, _createClass2["default"])(QueryClientImpl, [{
    key: "params",
    value: function params() {
      var request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var data = _query.QueryParamsRequest.encode(request).finish();
      var promise = this.rpc.request("ixo.entity.v1beta1.Query", "Params", data);
      return promise.then(function (data) {
        return _query.QueryParamsResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "entity",
    value: function entity(request) {
      var data = _query.QueryEntityRequest.encode(request).finish();
      var promise = this.rpc.request("ixo.entity.v1beta1.Query", "Entity", data);
      return promise.then(function (data) {
        return _query.QueryEntityResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "entityMetaData",
    value: function entityMetaData(request) {
      var data = _query.QueryEntityMetadataRequest.encode(request).finish();
      var promise = this.rpc.request("ixo.entity.v1beta1.Query", "EntityMetaData", data);
      return promise.then(function (data) {
        return _query.QueryEntityMetadataResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "entityIidDocument",
    value: function entityIidDocument(request) {
      var data = _query.QueryEntityIidDocumentRequest.encode(request).finish();
      var promise = this.rpc.request("ixo.entity.v1beta1.Query", "EntityIidDocument", data);
      return promise.then(function (data) {
        return _query.QueryEntityIidDocumentResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "entityVerified",
    value: function entityVerified(request) {
      var data = _query.QueryEntityVerifiedRequest.encode(request).finish();
      var promise = this.rpc.request("ixo.entity.v1beta1.Query", "EntityVerified", data);
      return promise.then(function (data) {
        return _query.QueryEntityVerifiedResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "entityList",
    value: function entityList() {
      var request = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
        pagination: undefined
      };
      var data = _query.QueryEntityListRequest.encode(request).finish();
      var promise = this.rpc.request("ixo.entity.v1beta1.Query", "EntityList", data);
      return promise.then(function (data) {
        return _query.QueryEntityListResponse.decode(new _m0.Reader(data));
      });
    }
  }]);
}();
var createRpcQueryExtension = exports.createRpcQueryExtension = function createRpcQueryExtension(base) {
  var rpc = (0, _stargate.createProtobufRpcClient)(base);
  var queryService = new QueryClientImpl(rpc);
  return {
    params: function params(request) {
      return queryService.params(request);
    },
    entity: function entity(request) {
      return queryService.entity(request);
    },
    entityMetaData: function entityMetaData(request) {
      return queryService.entityMetaData(request);
    },
    entityIidDocument: function entityIidDocument(request) {
      return queryService.entityIidDocument(request);
    },
    entityVerified: function entityVerified(request) {
      return queryService.entityVerified(request);
    },
    entityList: function entityList(request) {
      return queryService.entityList(request);
    }
  };
};