"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MsgClientImpl = 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 _tx = require("./tx");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var MsgClientImpl = /*#__PURE__*/function () {
  function MsgClientImpl(rpc) {
    (0, _classCallCheck2["default"])(this, MsgClientImpl);
    (0, _defineProperty2["default"])(this, "rpc", void 0);
    this.rpc = rpc;
    this.relayProviderPrices = this.relayProviderPrices.bind(this);
    this.relayPriceFeedPrice = this.relayPriceFeedPrice.bind(this);
    this.relayBandRates = this.relayBandRates.bind(this);
    this.requestBandIBCRates = this.requestBandIBCRates.bind(this);
    this.relayCoinbaseMessages = this.relayCoinbaseMessages.bind(this);
  }
  (0, _createClass2["default"])(MsgClientImpl, [{
    key: "relayProviderPrices",
    value: function relayProviderPrices(request) {
      var data = _tx.MsgRelayProviderPrices.encode(request).finish();
      var promise = this.rpc.request("injective.oracle.v1beta1.Msg", "RelayProviderPrices", data);
      return promise.then(function (data) {
        return _tx.MsgRelayProviderPricesResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "relayPriceFeedPrice",
    value: function relayPriceFeedPrice(request) {
      var data = _tx.MsgRelayPriceFeedPrice.encode(request).finish();
      var promise = this.rpc.request("injective.oracle.v1beta1.Msg", "RelayPriceFeedPrice", data);
      return promise.then(function (data) {
        return _tx.MsgRelayPriceFeedPriceResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "relayBandRates",
    value: function relayBandRates(request) {
      var data = _tx.MsgRelayBandRates.encode(request).finish();
      var promise = this.rpc.request("injective.oracle.v1beta1.Msg", "RelayBandRates", data);
      return promise.then(function (data) {
        return _tx.MsgRelayBandRatesResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "requestBandIBCRates",
    value: function requestBandIBCRates(request) {
      var data = _tx.MsgRequestBandIBCRates.encode(request).finish();
      var promise = this.rpc.request("injective.oracle.v1beta1.Msg", "RequestBandIBCRates", data);
      return promise.then(function (data) {
        return _tx.MsgRequestBandIBCRatesResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "relayCoinbaseMessages",
    value: function relayCoinbaseMessages(request) {
      var data = _tx.MsgRelayCoinbaseMessages.encode(request).finish();
      var promise = this.rpc.request("injective.oracle.v1beta1.Msg", "RelayCoinbaseMessages", data);
      return promise.then(function (data) {
        return _tx.MsgRelayCoinbaseMessagesResponse.decode(new _m0.Reader(data));
      });
    }
  }]);
  return MsgClientImpl;
}();
exports.MsgClientImpl = MsgClientImpl;