"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 ibc/connection 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.connectionOpenInit = this.connectionOpenInit.bind(this);
    this.connectionOpenTry = this.connectionOpenTry.bind(this);
    this.connectionOpenAck = this.connectionOpenAck.bind(this);
    this.connectionOpenConfirm = this.connectionOpenConfirm.bind(this);
    this.updateConnectionParams = this.updateConnectionParams.bind(this);
  }
  return (0, _createClass2["default"])(MsgClientImpl, [{
    key: "connectionOpenInit",
    value: function connectionOpenInit(request) {
      var data = _tx.MsgConnectionOpenInit.encode(request).finish();
      var promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenInit", data);
      return promise.then(function (data) {
        return _tx.MsgConnectionOpenInitResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "connectionOpenTry",
    value: function connectionOpenTry(request) {
      var data = _tx.MsgConnectionOpenTry.encode(request).finish();
      var promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenTry", data);
      return promise.then(function (data) {
        return _tx.MsgConnectionOpenTryResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "connectionOpenAck",
    value: function connectionOpenAck(request) {
      var data = _tx.MsgConnectionOpenAck.encode(request).finish();
      var promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenAck", data);
      return promise.then(function (data) {
        return _tx.MsgConnectionOpenAckResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "connectionOpenConfirm",
    value: function connectionOpenConfirm(request) {
      var data = _tx.MsgConnectionOpenConfirm.encode(request).finish();
      var promise = this.rpc.request("ibc.core.connection.v1.Msg", "ConnectionOpenConfirm", data);
      return promise.then(function (data) {
        return _tx.MsgConnectionOpenConfirmResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "updateConnectionParams",
    value: function updateConnectionParams(request) {
      var data = _tx.MsgUpdateParams.encode(request).finish();
      var promise = this.rpc.request("ibc.core.connection.v1.Msg", "UpdateConnectionParams", data);
      return promise.then(function (data) {
        return _tx.MsgUpdateParamsResponse.decode(new _m0.Reader(data));
      });
    }
  }]);
}();