"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
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 _binary = require("../binary");
var _tx = require("./tx");
/** Msg defines the 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.claim = this.claim.bind(this);
    this.createReward = this.createReward.bind(this);
    this.updateParams = this.updateParams.bind(this);
  }
  return (0, _createClass2["default"])(MsgClientImpl, [{
    key: "claim",
    value: function claim(request) {
      var data = _tx.MsgClaim.encode(request).finish();
      var promise = this.rpc.request("gitopia.gitopia.rewards.Msg", "Claim", data);
      return promise.then(function (data) {
        return _tx.MsgClaimResponse.decode(new _binary.BinaryReader(data));
      });
    }
  }, {
    key: "createReward",
    value: function createReward(request) {
      var data = _tx.MsgCreateReward.encode(request).finish();
      var promise = this.rpc.request("gitopia.gitopia.rewards.Msg", "CreateReward", data);
      return promise.then(function (data) {
        return _tx.MsgCreateRewardResponse.decode(new _binary.BinaryReader(data));
      });
    }
  }, {
    key: "updateParams",
    value: function updateParams(request) {
      var data = _tx.MsgUpdateParams.encode(request).finish();
      var promise = this.rpc.request("gitopia.gitopia.rewards.Msg", "UpdateParams", data);
      return promise.then(function (data) {
        return _tx.MsgUpdateParamsResponse.decode(new _binary.BinaryReader(data));
      });
    }
  }]);
}();