"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 ICS29 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.incentivizedPackets = this.incentivizedPackets.bind(this);
    this.incentivizedPacket = this.incentivizedPacket.bind(this);
    this.incentivizedPacketsForChannel = this.incentivizedPacketsForChannel.bind(this);
    this.totalRecvFees = this.totalRecvFees.bind(this);
    this.totalAckFees = this.totalAckFees.bind(this);
    this.totalTimeoutFees = this.totalTimeoutFees.bind(this);
    this.payee = this.payee.bind(this);
    this.counterpartyPayee = this.counterpartyPayee.bind(this);
    this.feeEnabledChannels = this.feeEnabledChannels.bind(this);
    this.feeEnabledChannel = this.feeEnabledChannel.bind(this);
  }
  return (0, _createClass2["default"])(QueryClientImpl, [{
    key: "incentivizedPackets",
    value: function incentivizedPackets(request) {
      var data = _query.QueryIncentivizedPacketsRequest.encode(request).finish();
      var promise = this.rpc.request("ibc.applications.fee.v1.Query", "IncentivizedPackets", data);
      return promise.then(function (data) {
        return _query.QueryIncentivizedPacketsResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "incentivizedPacket",
    value: function incentivizedPacket(request) {
      var data = _query.QueryIncentivizedPacketRequest.encode(request).finish();
      var promise = this.rpc.request("ibc.applications.fee.v1.Query", "IncentivizedPacket", data);
      return promise.then(function (data) {
        return _query.QueryIncentivizedPacketResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "incentivizedPacketsForChannel",
    value: function incentivizedPacketsForChannel(request) {
      var data = _query.QueryIncentivizedPacketsForChannelRequest.encode(request).finish();
      var promise = this.rpc.request("ibc.applications.fee.v1.Query", "IncentivizedPacketsForChannel", data);
      return promise.then(function (data) {
        return _query.QueryIncentivizedPacketsForChannelResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "totalRecvFees",
    value: function totalRecvFees(request) {
      var data = _query.QueryTotalRecvFeesRequest.encode(request).finish();
      var promise = this.rpc.request("ibc.applications.fee.v1.Query", "TotalRecvFees", data);
      return promise.then(function (data) {
        return _query.QueryTotalRecvFeesResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "totalAckFees",
    value: function totalAckFees(request) {
      var data = _query.QueryTotalAckFeesRequest.encode(request).finish();
      var promise = this.rpc.request("ibc.applications.fee.v1.Query", "TotalAckFees", data);
      return promise.then(function (data) {
        return _query.QueryTotalAckFeesResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "totalTimeoutFees",
    value: function totalTimeoutFees(request) {
      var data = _query.QueryTotalTimeoutFeesRequest.encode(request).finish();
      var promise = this.rpc.request("ibc.applications.fee.v1.Query", "TotalTimeoutFees", data);
      return promise.then(function (data) {
        return _query.QueryTotalTimeoutFeesResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "payee",
    value: function payee(request) {
      var data = _query.QueryPayeeRequest.encode(request).finish();
      var promise = this.rpc.request("ibc.applications.fee.v1.Query", "Payee", data);
      return promise.then(function (data) {
        return _query.QueryPayeeResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "counterpartyPayee",
    value: function counterpartyPayee(request) {
      var data = _query.QueryCounterpartyPayeeRequest.encode(request).finish();
      var promise = this.rpc.request("ibc.applications.fee.v1.Query", "CounterpartyPayee", data);
      return promise.then(function (data) {
        return _query.QueryCounterpartyPayeeResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "feeEnabledChannels",
    value: function feeEnabledChannels(request) {
      var data = _query.QueryFeeEnabledChannelsRequest.encode(request).finish();
      var promise = this.rpc.request("ibc.applications.fee.v1.Query", "FeeEnabledChannels", data);
      return promise.then(function (data) {
        return _query.QueryFeeEnabledChannelsResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "feeEnabledChannel",
    value: function feeEnabledChannel(request) {
      var data = _query.QueryFeeEnabledChannelRequest.encode(request).finish();
      var promise = this.rpc.request("ibc.applications.fee.v1.Query", "FeeEnabledChannel", data);
      return promise.then(function (data) {
        return _query.QueryFeeEnabledChannelResponse.decode(new _m0.Reader(data));
      });
    }
  }]);
}();
var createRpcQueryExtension = exports.createRpcQueryExtension = function createRpcQueryExtension(base) {
  var rpc = (0, _stargate.createProtobufRpcClient)(base);
  var queryService = new QueryClientImpl(rpc);
  return {
    incentivizedPackets: function incentivizedPackets(request) {
      return queryService.incentivizedPackets(request);
    },
    incentivizedPacket: function incentivizedPacket(request) {
      return queryService.incentivizedPacket(request);
    },
    incentivizedPacketsForChannel: function incentivizedPacketsForChannel(request) {
      return queryService.incentivizedPacketsForChannel(request);
    },
    totalRecvFees: function totalRecvFees(request) {
      return queryService.totalRecvFees(request);
    },
    totalAckFees: function totalAckFees(request) {
      return queryService.totalAckFees(request);
    },
    totalTimeoutFees: function totalTimeoutFees(request) {
      return queryService.totalTimeoutFees(request);
    },
    payee: function payee(request) {
      return queryService.payee(request);
    },
    counterpartyPayee: function counterpartyPayee(request) {
      return queryService.counterpartyPayee(request);
    },
    feeEnabledChannels: function feeEnabledChannels(request) {
      return queryService.feeEnabledChannels(request);
    },
    feeEnabledChannel: function feeEnabledChannel(request) {
      return queryService.feeEnabledChannel(request);
    }
  };
};