"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.createFeed = this.createFeed.bind(this);
    this.updateFeed = this.updateFeed.bind(this);
    this.transmit = this.transmit.bind(this);
    this.fundFeedRewardPool = this.fundFeedRewardPool.bind(this);
    this.withdrawFeedRewardPool = this.withdrawFeedRewardPool.bind(this);
    this.setPayees = this.setPayees.bind(this);
    this.transferPayeeship = this.transferPayeeship.bind(this);
    this.acceptPayeeship = this.acceptPayeeship.bind(this);
  }
  (0, _createClass2["default"])(MsgClientImpl, [{
    key: "createFeed",
    value: function createFeed(request) {
      var data = _tx.MsgCreateFeed.encode(request).finish();
      var promise = this.rpc.request("injective.ocr.v1beta1.Msg", "CreateFeed", data);
      return promise.then(function (data) {
        return _tx.MsgCreateFeedResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "updateFeed",
    value: function updateFeed(request) {
      var data = _tx.MsgUpdateFeed.encode(request).finish();
      var promise = this.rpc.request("injective.ocr.v1beta1.Msg", "UpdateFeed", data);
      return promise.then(function (data) {
        return _tx.MsgUpdateFeedResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "transmit",
    value: function transmit(request) {
      var data = _tx.MsgTransmit.encode(request).finish();
      var promise = this.rpc.request("injective.ocr.v1beta1.Msg", "Transmit", data);
      return promise.then(function (data) {
        return _tx.MsgTransmitResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "fundFeedRewardPool",
    value: function fundFeedRewardPool(request) {
      var data = _tx.MsgFundFeedRewardPool.encode(request).finish();
      var promise = this.rpc.request("injective.ocr.v1beta1.Msg", "FundFeedRewardPool", data);
      return promise.then(function (data) {
        return _tx.MsgFundFeedRewardPoolResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "withdrawFeedRewardPool",
    value: function withdrawFeedRewardPool(request) {
      var data = _tx.MsgWithdrawFeedRewardPool.encode(request).finish();
      var promise = this.rpc.request("injective.ocr.v1beta1.Msg", "WithdrawFeedRewardPool", data);
      return promise.then(function (data) {
        return _tx.MsgWithdrawFeedRewardPoolResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "setPayees",
    value: function setPayees(request) {
      var data = _tx.MsgSetPayees.encode(request).finish();
      var promise = this.rpc.request("injective.ocr.v1beta1.Msg", "SetPayees", data);
      return promise.then(function (data) {
        return _tx.MsgSetPayeesResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "transferPayeeship",
    value: function transferPayeeship(request) {
      var data = _tx.MsgTransferPayeeship.encode(request).finish();
      var promise = this.rpc.request("injective.ocr.v1beta1.Msg", "TransferPayeeship", data);
      return promise.then(function (data) {
        return _tx.MsgTransferPayeeshipResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "acceptPayeeship",
    value: function acceptPayeeship(request) {
      var data = _tx.MsgAcceptPayeeship.encode(request).finish();
      var promise = this.rpc.request("injective.ocr.v1beta1.Msg", "AcceptPayeeship", data);
      return promise.then(function (data) {
        return _tx.MsgAcceptPayeeshipResponse.decode(new _m0.Reader(data));
      });
    }
  }]);
  return MsgClientImpl;
}();
exports.MsgClientImpl = MsgClientImpl;