"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 _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
/** Msg defines the staking Msg service. */
var MsgClientImpl = exports.MsgClientImpl = /*#__PURE__*/function () {
  function MsgClientImpl(rpc) {
    (0, _classCallCheck2["default"])(this, MsgClientImpl);
    (0, _defineProperty2["default"])(this, "rpc", void 0);
    this.rpc = rpc;
    this.createValidator = this.createValidator.bind(this);
    this.editValidator = this.editValidator.bind(this);
    this.delegate = this.delegate.bind(this);
    this.beginRedelegate = this.beginRedelegate.bind(this);
    this.undelegate = this.undelegate.bind(this);
    this.cancelUnbondingDelegation = this.cancelUnbondingDelegation.bind(this);
    this.updateParams = this.updateParams.bind(this);
  }
  return (0, _createClass2["default"])(MsgClientImpl, [{
    key: "createValidator",
    value: function createValidator(request) {
      var data = _tx.MsgCreateValidator.encode(request).finish();
      var promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "CreateValidator", data);
      return promise.then(function (data) {
        return _tx.MsgCreateValidatorResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "editValidator",
    value: function editValidator(request) {
      var data = _tx.MsgEditValidator.encode(request).finish();
      var promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "EditValidator", data);
      return promise.then(function (data) {
        return _tx.MsgEditValidatorResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "delegate",
    value: function delegate(request) {
      var data = _tx.MsgDelegate.encode(request).finish();
      var promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "Delegate", data);
      return promise.then(function (data) {
        return _tx.MsgDelegateResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "beginRedelegate",
    value: function beginRedelegate(request) {
      var data = _tx.MsgBeginRedelegate.encode(request).finish();
      var promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "BeginRedelegate", data);
      return promise.then(function (data) {
        return _tx.MsgBeginRedelegateResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "undelegate",
    value: function undelegate(request) {
      var data = _tx.MsgUndelegate.encode(request).finish();
      var promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "Undelegate", data);
      return promise.then(function (data) {
        return _tx.MsgUndelegateResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "cancelUnbondingDelegation",
    value: function cancelUnbondingDelegation(request) {
      var data = _tx.MsgCancelUnbondingDelegation.encode(request).finish();
      var promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "CancelUnbondingDelegation", data);
      return promise.then(function (data) {
        return _tx.MsgCancelUnbondingDelegationResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "updateParams",
    value: function updateParams(request) {
      var data = _tx.MsgUpdateParams.encode(request).finish();
      var promise = this.rpc.request("cosmos.staking.v1beta1.Msg", "UpdateParams", data);
      return promise.then(function (data) {
        return _tx.MsgUpdateParamsResponse.decode(new _m0.Reader(data));
      });
    }
  }]);
}();