"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 bonds 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.createBond = this.createBond.bind(this);
    this.editBond = this.editBond.bind(this);
    this.setNextAlpha = this.setNextAlpha.bind(this);
    this.updateBondState = this.updateBondState.bind(this);
    this.buy = this.buy.bind(this);
    this.sell = this.sell.bind(this);
    this.swap = this.swap.bind(this);
    this.makeOutcomePayment = this.makeOutcomePayment.bind(this);
    this.withdrawShare = this.withdrawShare.bind(this);
    this.withdrawReserve = this.withdrawReserve.bind(this);
  }
  return (0, _createClass2["default"])(MsgClientImpl, [{
    key: "createBond",
    value: function createBond(request) {
      var data = _tx.MsgCreateBond.encode(request).finish();
      var promise = this.rpc.request("ixo.bonds.v1beta1.Msg", "CreateBond", data);
      return promise.then(function (data) {
        return _tx.MsgCreateBondResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "editBond",
    value: function editBond(request) {
      var data = _tx.MsgEditBond.encode(request).finish();
      var promise = this.rpc.request("ixo.bonds.v1beta1.Msg", "EditBond", data);
      return promise.then(function (data) {
        return _tx.MsgEditBondResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "setNextAlpha",
    value: function setNextAlpha(request) {
      var data = _tx.MsgSetNextAlpha.encode(request).finish();
      var promise = this.rpc.request("ixo.bonds.v1beta1.Msg", "SetNextAlpha", data);
      return promise.then(function (data) {
        return _tx.MsgSetNextAlphaResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "updateBondState",
    value: function updateBondState(request) {
      var data = _tx.MsgUpdateBondState.encode(request).finish();
      var promise = this.rpc.request("ixo.bonds.v1beta1.Msg", "UpdateBondState", data);
      return promise.then(function (data) {
        return _tx.MsgUpdateBondStateResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "buy",
    value: function buy(request) {
      var data = _tx.MsgBuy.encode(request).finish();
      var promise = this.rpc.request("ixo.bonds.v1beta1.Msg", "Buy", data);
      return promise.then(function (data) {
        return _tx.MsgBuyResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "sell",
    value: function sell(request) {
      var data = _tx.MsgSell.encode(request).finish();
      var promise = this.rpc.request("ixo.bonds.v1beta1.Msg", "Sell", data);
      return promise.then(function (data) {
        return _tx.MsgSellResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "swap",
    value: function swap(request) {
      var data = _tx.MsgSwap.encode(request).finish();
      var promise = this.rpc.request("ixo.bonds.v1beta1.Msg", "Swap", data);
      return promise.then(function (data) {
        return _tx.MsgSwapResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "makeOutcomePayment",
    value: function makeOutcomePayment(request) {
      var data = _tx.MsgMakeOutcomePayment.encode(request).finish();
      var promise = this.rpc.request("ixo.bonds.v1beta1.Msg", "MakeOutcomePayment", data);
      return promise.then(function (data) {
        return _tx.MsgMakeOutcomePaymentResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "withdrawShare",
    value: function withdrawShare(request) {
      var data = _tx.MsgWithdrawShare.encode(request).finish();
      var promise = this.rpc.request("ixo.bonds.v1beta1.Msg", "WithdrawShare", data);
      return promise.then(function (data) {
        return _tx.MsgWithdrawShareResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "withdrawReserve",
    value: function withdrawReserve(request) {
      var data = _tx.MsgWithdrawReserve.encode(request).finish();
      var promise = this.rpc.request("ixo.bonds.v1beta1.Msg", "WithdrawReserve", data);
      return promise.then(function (data) {
        return _tx.MsgWithdrawReserveResponse.decode(new _m0.Reader(data));
      });
    }
  }]);
}();