"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.LCDQueryClient = void 0;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
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 LCDQueryClient = /*#__PURE__*/function () {
  function LCDQueryClient(_ref) {
    var requestClient = _ref.requestClient;
    (0, _classCallCheck2["default"])(this, LCDQueryClient);
    (0, _defineProperty2["default"])(this, "req", void 0);
    this.req = requestClient;
    this.params = this.params.bind(this);
    this.bandRelayers = this.bandRelayers.bind(this);
    this.bandPriceStates = this.bandPriceStates.bind(this);
    this.bandIBCPriceStates = this.bandIBCPriceStates.bind(this);
    this.priceFeedPriceStates = this.priceFeedPriceStates.bind(this);
    this.coinbasePriceStates = this.coinbasePriceStates.bind(this);
    this.providerPriceState = this.providerPriceState.bind(this);
    this.oracleModuleState = this.oracleModuleState.bind(this);
    this.historicalPriceRecords = this.historicalPriceRecords.bind(this);
    this.oracleVolatility = this.oracleVolatility.bind(this);
    this.oracleProvidersInfo = this.oracleProvidersInfo.bind(this);
    this.oracleProviderPrices = this.oracleProviderPrices.bind(this);
  }
  /* Retrieves oracle params */
  (0, _createClass2["default"])(LCDQueryClient, [{
    key: "params",
    value: function () {
      var _params2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
        var _params,
          endpoint,
          _args = arguments;
        return _regenerator["default"].wrap(function _callee$(_context) {
          while (1) switch (_context.prev = _context.next) {
            case 0:
              _params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
              endpoint = "injective/oracle/v1beta1/params";
              _context.next = 4;
              return this.req.get(endpoint);
            case 4:
              return _context.abrupt("return", _context.sent);
            case 5:
            case "end":
              return _context.stop();
          }
        }, _callee, this);
      }));
      function params() {
        return _params2.apply(this, arguments);
      }
      return params;
    }() /* Retrieves the band relayers */
  }, {
    key: "bandRelayers",
    value: function () {
      var _bandRelayers = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
        var _params,
          endpoint,
          _args2 = arguments;
        return _regenerator["default"].wrap(function _callee2$(_context2) {
          while (1) switch (_context2.prev = _context2.next) {
            case 0:
              _params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
              endpoint = "injective/oracle/v1beta1/band_relayers";
              _context2.next = 4;
              return this.req.get(endpoint);
            case 4:
              return _context2.abrupt("return", _context2.sent);
            case 5:
            case "end":
              return _context2.stop();
          }
        }, _callee2, this);
      }));
      function bandRelayers() {
        return _bandRelayers.apply(this, arguments);
      }
      return bandRelayers;
    }() /* Retrieves the state for all band price feeds */
  }, {
    key: "bandPriceStates",
    value: function () {
      var _bandPriceStates = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
        var _params,
          endpoint,
          _args3 = arguments;
        return _regenerator["default"].wrap(function _callee3$(_context3) {
          while (1) switch (_context3.prev = _context3.next) {
            case 0:
              _params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
              endpoint = "injective/oracle/v1beta1/band_price_states";
              _context3.next = 4;
              return this.req.get(endpoint);
            case 4:
              return _context3.abrupt("return", _context3.sent);
            case 5:
            case "end":
              return _context3.stop();
          }
        }, _callee3, this);
      }));
      function bandPriceStates() {
        return _bandPriceStates.apply(this, arguments);
      }
      return bandPriceStates;
    }() /* Retrieves the state for all band ibc price feeds */
  }, {
    key: "bandIBCPriceStates",
    value: function () {
      var _bandIBCPriceStates = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
        var _params,
          endpoint,
          _args4 = arguments;
        return _regenerator["default"].wrap(function _callee4$(_context4) {
          while (1) switch (_context4.prev = _context4.next) {
            case 0:
              _params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
              endpoint = "injective/oracle/v1beta1/band_ibc_price_states";
              _context4.next = 4;
              return this.req.get(endpoint);
            case 4:
              return _context4.abrupt("return", _context4.sent);
            case 5:
            case "end":
              return _context4.stop();
          }
        }, _callee4, this);
      }));
      function bandIBCPriceStates() {
        return _bandIBCPriceStates.apply(this, arguments);
      }
      return bandIBCPriceStates;
    }() /* Retrieves the state for all price feeds */
  }, {
    key: "priceFeedPriceStates",
    value: function () {
      var _priceFeedPriceStates = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
        var _params,
          endpoint,
          _args5 = arguments;
        return _regenerator["default"].wrap(function _callee5$(_context5) {
          while (1) switch (_context5.prev = _context5.next) {
            case 0:
              _params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
              endpoint = "injective/oracle/v1beta1/pricefeed_price_states";
              _context5.next = 4;
              return this.req.get(endpoint);
            case 4:
              return _context5.abrupt("return", _context5.sent);
            case 5:
            case "end":
              return _context5.stop();
          }
        }, _callee5, this);
      }));
      function priceFeedPriceStates() {
        return _priceFeedPriceStates.apply(this, arguments);
      }
      return priceFeedPriceStates;
    }() /* Retrieves the state for all coinbase price feeds */
  }, {
    key: "coinbasePriceStates",
    value: function () {
      var _coinbasePriceStates = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
        var _params,
          endpoint,
          _args6 = arguments;
        return _regenerator["default"].wrap(function _callee6$(_context6) {
          while (1) switch (_context6.prev = _context6.next) {
            case 0:
              _params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
              endpoint = "injective/oracle/v1beta1/coinbase_price_states";
              _context6.next = 4;
              return this.req.get(endpoint);
            case 4:
              return _context6.abrupt("return", _context6.sent);
            case 5:
            case "end":
              return _context6.stop();
          }
        }, _callee6, this);
      }));
      function coinbasePriceStates() {
        return _coinbasePriceStates.apply(this, arguments);
      }
      return coinbasePriceStates;
    }() /* Retrieves the state for all provider price feeds */
  }, {
    key: "providerPriceState",
    value: function () {
      var _providerPriceState = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(params) {
        var endpoint;
        return _regenerator["default"].wrap(function _callee7$(_context7) {
          while (1) switch (_context7.prev = _context7.next) {
            case 0:
              endpoint = "injective/oracle/v1beta1/provider_price_state/".concat(params.provider, "/").concat(params.symbol);
              _context7.next = 3;
              return this.req.get(endpoint);
            case 3:
              return _context7.abrupt("return", _context7.sent);
            case 4:
            case "end":
              return _context7.stop();
          }
        }, _callee7, this);
      }));
      function providerPriceState(_x) {
        return _providerPriceState.apply(this, arguments);
      }
      return providerPriceState;
    }() /* Retrieves the entire oracle module's state */
  }, {
    key: "oracleModuleState",
    value: function () {
      var _oracleModuleState = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
        var _params,
          endpoint,
          _args8 = arguments;
        return _regenerator["default"].wrap(function _callee8$(_context8) {
          while (1) switch (_context8.prev = _context8.next) {
            case 0:
              _params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
              endpoint = "injective/oracle/v1beta1/module_state";
              _context8.next = 4;
              return this.req.get(endpoint);
            case 4:
              return _context8.abrupt("return", _context8.sent);
            case 5:
            case "end":
              return _context8.stop();
          }
        }, _callee8, this);
      }));
      function oracleModuleState() {
        return _oracleModuleState.apply(this, arguments);
      }
      return oracleModuleState;
    }() /* Retrieves historical price records for a given OracleType and Symbol */
  }, {
    key: "historicalPriceRecords",
    value: function () {
      var _historicalPriceRecords = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(params) {
        var options, endpoint;
        return _regenerator["default"].wrap(function _callee9$(_context9) {
          while (1) switch (_context9.prev = _context9.next) {
            case 0:
              options = {
                params: {}
              };
              if (typeof (params === null || params === void 0 ? void 0 : params.oracle) !== "undefined") {
                options.params.oracle = params.oracle;
              }
              if (typeof (params === null || params === void 0 ? void 0 : params.symbolId) !== "undefined") {
                options.params.symbol_id = params.symbolId;
              }
              endpoint = "injective/oracle/v1beta1/historical_price_records";
              _context9.next = 6;
              return this.req.get(endpoint, options);
            case 6:
              return _context9.abrupt("return", _context9.sent);
            case 7:
            case "end":
              return _context9.stop();
          }
        }, _callee9, this);
      }));
      function historicalPriceRecords(_x2) {
        return _historicalPriceRecords.apply(this, arguments);
      }
      return historicalPriceRecords;
    }() /* Retrieves mixed volatility value for the specified pair of base/quote */
  }, {
    key: "oracleVolatility",
    value: function () {
      var _oracleVolatility = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(params) {
        var options, endpoint;
        return _regenerator["default"].wrap(function _callee10$(_context10) {
          while (1) switch (_context10.prev = _context10.next) {
            case 0:
              options = {
                params: {}
              };
              if (typeof (params === null || params === void 0 ? void 0 : params.baseInfo) !== "undefined") {
                options.params.base_info = params.baseInfo;
              }
              if (typeof (params === null || params === void 0 ? void 0 : params.quoteInfo) !== "undefined") {
                options.params.quote_info = params.quoteInfo;
              }
              if (typeof (params === null || params === void 0 ? void 0 : params.oracleHistoryOptions) !== "undefined") {
                options.params.oracle_history_options = params.oracleHistoryOptions;
              }
              endpoint = "injective/oracle/v1beta1/volatility";
              _context10.next = 7;
              return this.req.get(endpoint, options);
            case 7:
              return _context10.abrupt("return", _context10.sent);
            case 8:
            case "end":
              return _context10.stop();
          }
        }, _callee10, this);
      }));
      function oracleVolatility(_x3) {
        return _oracleVolatility.apply(this, arguments);
      }
      return oracleVolatility;
    }() /* OracleProvidersInfo */
  }, {
    key: "oracleProvidersInfo",
    value: function () {
      var _oracleProvidersInfo = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
        var _params,
          endpoint,
          _args11 = arguments;
        return _regenerator["default"].wrap(function _callee11$(_context11) {
          while (1) switch (_context11.prev = _context11.next) {
            case 0:
              _params = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
              endpoint = "injective/oracle/v1beta1/providers";
              _context11.next = 4;
              return this.req.get(endpoint);
            case 4:
              return _context11.abrupt("return", _context11.sent);
            case 5:
            case "end":
              return _context11.stop();
          }
        }, _callee11, this);
      }));
      function oracleProvidersInfo() {
        return _oracleProvidersInfo.apply(this, arguments);
      }
      return oracleProvidersInfo;
    }() /* OracleProviderPrices */
  }, {
    key: "oracleProviderPrices",
    value: function () {
      var _oracleProviderPrices = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(params) {
        var options, endpoint;
        return _regenerator["default"].wrap(function _callee12$(_context12) {
          while (1) switch (_context12.prev = _context12.next) {
            case 0:
              options = {
                params: {}
              };
              if (typeof (params === null || params === void 0 ? void 0 : params.provider) !== "undefined") {
                options.params.provider = params.provider;
              }
              endpoint = "injective/oracle/v1beta1/provider_prices";
              _context12.next = 5;
              return this.req.get(endpoint, options);
            case 5:
              return _context12.abrupt("return", _context12.sent);
            case 6:
            case "end":
              return _context12.stop();
          }
        }, _callee12, this);
      }));
      function oracleProviderPrices(_x4) {
        return _oracleProviderPrices.apply(this, arguments);
      }
      return oracleProviderPrices;
    }()
  }]);
  return LCDQueryClient;
}();
exports.LCDQueryClient = LCDQueryClient;