"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.deposit = this.deposit.bind(this);
    this.withdraw = this.withdraw.bind(this);
    this.instantSpotMarketLaunch = this.instantSpotMarketLaunch.bind(this);
    this.instantPerpetualMarketLaunch = this.instantPerpetualMarketLaunch.bind(this);
    this.instantExpiryFuturesMarketLaunch = this.instantExpiryFuturesMarketLaunch.bind(this);
    this.createSpotLimitOrder = this.createSpotLimitOrder.bind(this);
    this.batchCreateSpotLimitOrders = this.batchCreateSpotLimitOrders.bind(this);
    this.createSpotMarketOrder = this.createSpotMarketOrder.bind(this);
    this.cancelSpotOrder = this.cancelSpotOrder.bind(this);
    this.batchCancelSpotOrders = this.batchCancelSpotOrders.bind(this);
    this.batchUpdateOrders = this.batchUpdateOrders.bind(this);
    this.exec = this.exec.bind(this);
    this.createDerivativeLimitOrder = this.createDerivativeLimitOrder.bind(this);
    this.batchCreateDerivativeLimitOrders = this.batchCreateDerivativeLimitOrders.bind(this);
    this.createDerivativeMarketOrder = this.createDerivativeMarketOrder.bind(this);
    this.cancelDerivativeOrder = this.cancelDerivativeOrder.bind(this);
    this.batchCancelDerivativeOrders = this.batchCancelDerivativeOrders.bind(this);
    this.instantBinaryOptionsMarketLaunch = this.instantBinaryOptionsMarketLaunch.bind(this);
    this.createBinaryOptionsLimitOrder = this.createBinaryOptionsLimitOrder.bind(this);
    this.createBinaryOptionsMarketOrder = this.createBinaryOptionsMarketOrder.bind(this);
    this.cancelBinaryOptionsOrder = this.cancelBinaryOptionsOrder.bind(this);
    this.batchCancelBinaryOptionsOrders = this.batchCancelBinaryOptionsOrders.bind(this);
    this.subaccountTransfer = this.subaccountTransfer.bind(this);
    this.externalTransfer = this.externalTransfer.bind(this);
    this.liquidatePosition = this.liquidatePosition.bind(this);
    this.increasePositionMargin = this.increasePositionMargin.bind(this);
    this.rewardsOptOut = this.rewardsOptOut.bind(this);
    this.adminUpdateBinaryOptionsMarket = this.adminUpdateBinaryOptionsMarket.bind(this);
  }
  (0, _createClass2["default"])(MsgClientImpl, [{
    key: "deposit",
    value: function deposit(request) {
      var data = _tx.MsgDeposit.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "Deposit", data);
      return promise.then(function (data) {
        return _tx.MsgDepositResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "withdraw",
    value: function withdraw(request) {
      var data = _tx.MsgWithdraw.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "Withdraw", data);
      return promise.then(function (data) {
        return _tx.MsgWithdrawResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "instantSpotMarketLaunch",
    value: function instantSpotMarketLaunch(request) {
      var data = _tx.MsgInstantSpotMarketLaunch.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "InstantSpotMarketLaunch", data);
      return promise.then(function (data) {
        return _tx.MsgInstantSpotMarketLaunchResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "instantPerpetualMarketLaunch",
    value: function instantPerpetualMarketLaunch(request) {
      var data = _tx.MsgInstantPerpetualMarketLaunch.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "InstantPerpetualMarketLaunch", data);
      return promise.then(function (data) {
        return _tx.MsgInstantPerpetualMarketLaunchResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "instantExpiryFuturesMarketLaunch",
    value: function instantExpiryFuturesMarketLaunch(request) {
      var data = _tx.MsgInstantExpiryFuturesMarketLaunch.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "InstantExpiryFuturesMarketLaunch", data);
      return promise.then(function (data) {
        return _tx.MsgInstantExpiryFuturesMarketLaunchResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "createSpotLimitOrder",
    value: function createSpotLimitOrder(request) {
      var data = _tx.MsgCreateSpotLimitOrder.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "CreateSpotLimitOrder", data);
      return promise.then(function (data) {
        return _tx.MsgCreateSpotLimitOrderResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "batchCreateSpotLimitOrders",
    value: function batchCreateSpotLimitOrders(request) {
      var data = _tx.MsgBatchCreateSpotLimitOrders.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "BatchCreateSpotLimitOrders", data);
      return promise.then(function (data) {
        return _tx.MsgBatchCreateSpotLimitOrdersResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "createSpotMarketOrder",
    value: function createSpotMarketOrder(request) {
      var data = _tx.MsgCreateSpotMarketOrder.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "CreateSpotMarketOrder", data);
      return promise.then(function (data) {
        return _tx.MsgCreateSpotMarketOrderResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "cancelSpotOrder",
    value: function cancelSpotOrder(request) {
      var data = _tx.MsgCancelSpotOrder.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "CancelSpotOrder", data);
      return promise.then(function (data) {
        return _tx.MsgCancelSpotOrderResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "batchCancelSpotOrders",
    value: function batchCancelSpotOrders(request) {
      var data = _tx.MsgBatchCancelSpotOrders.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "BatchCancelSpotOrders", data);
      return promise.then(function (data) {
        return _tx.MsgBatchCancelSpotOrdersResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "batchUpdateOrders",
    value: function batchUpdateOrders(request) {
      var data = _tx.MsgBatchUpdateOrders.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "BatchUpdateOrders", data);
      return promise.then(function (data) {
        return _tx.MsgBatchUpdateOrdersResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "exec",
    value: function exec(request) {
      var data = _tx.MsgExec.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "Exec", data);
      return promise.then(function (data) {
        return _tx.MsgExecResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "createDerivativeLimitOrder",
    value: function createDerivativeLimitOrder(request) {
      var data = _tx.MsgCreateDerivativeLimitOrder.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "CreateDerivativeLimitOrder", data);
      return promise.then(function (data) {
        return _tx.MsgCreateDerivativeLimitOrderResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "batchCreateDerivativeLimitOrders",
    value: function batchCreateDerivativeLimitOrders(request) {
      var data = _tx.MsgBatchCreateDerivativeLimitOrders.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "BatchCreateDerivativeLimitOrders", data);
      return promise.then(function (data) {
        return _tx.MsgBatchCreateDerivativeLimitOrdersResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "createDerivativeMarketOrder",
    value: function createDerivativeMarketOrder(request) {
      var data = _tx.MsgCreateDerivativeMarketOrder.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "CreateDerivativeMarketOrder", data);
      return promise.then(function (data) {
        return _tx.MsgCreateDerivativeMarketOrderResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "cancelDerivativeOrder",
    value: function cancelDerivativeOrder(request) {
      var data = _tx.MsgCancelDerivativeOrder.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "CancelDerivativeOrder", data);
      return promise.then(function (data) {
        return _tx.MsgCancelDerivativeOrderResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "batchCancelDerivativeOrders",
    value: function batchCancelDerivativeOrders(request) {
      var data = _tx.MsgBatchCancelDerivativeOrders.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "BatchCancelDerivativeOrders", data);
      return promise.then(function (data) {
        return _tx.MsgBatchCancelDerivativeOrdersResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "instantBinaryOptionsMarketLaunch",
    value: function instantBinaryOptionsMarketLaunch(request) {
      var data = _tx.MsgInstantBinaryOptionsMarketLaunch.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "InstantBinaryOptionsMarketLaunch", data);
      return promise.then(function (data) {
        return _tx.MsgInstantBinaryOptionsMarketLaunchResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "createBinaryOptionsLimitOrder",
    value: function createBinaryOptionsLimitOrder(request) {
      var data = _tx.MsgCreateBinaryOptionsLimitOrder.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "CreateBinaryOptionsLimitOrder", data);
      return promise.then(function (data) {
        return _tx.MsgCreateBinaryOptionsLimitOrderResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "createBinaryOptionsMarketOrder",
    value: function createBinaryOptionsMarketOrder(request) {
      var data = _tx.MsgCreateBinaryOptionsMarketOrder.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "CreateBinaryOptionsMarketOrder", data);
      return promise.then(function (data) {
        return _tx.MsgCreateBinaryOptionsMarketOrderResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "cancelBinaryOptionsOrder",
    value: function cancelBinaryOptionsOrder(request) {
      var data = _tx.MsgCancelBinaryOptionsOrder.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "CancelBinaryOptionsOrder", data);
      return promise.then(function (data) {
        return _tx.MsgCancelBinaryOptionsOrderResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "batchCancelBinaryOptionsOrders",
    value: function batchCancelBinaryOptionsOrders(request) {
      var data = _tx.MsgBatchCancelBinaryOptionsOrders.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "BatchCancelBinaryOptionsOrders", data);
      return promise.then(function (data) {
        return _tx.MsgBatchCancelBinaryOptionsOrdersResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "subaccountTransfer",
    value: function subaccountTransfer(request) {
      var data = _tx.MsgSubaccountTransfer.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "SubaccountTransfer", data);
      return promise.then(function (data) {
        return _tx.MsgSubaccountTransferResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "externalTransfer",
    value: function externalTransfer(request) {
      var data = _tx.MsgExternalTransfer.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "ExternalTransfer", data);
      return promise.then(function (data) {
        return _tx.MsgExternalTransferResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "liquidatePosition",
    value: function liquidatePosition(request) {
      var data = _tx.MsgLiquidatePosition.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "LiquidatePosition", data);
      return promise.then(function (data) {
        return _tx.MsgLiquidatePositionResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "increasePositionMargin",
    value: function increasePositionMargin(request) {
      var data = _tx.MsgIncreasePositionMargin.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "IncreasePositionMargin", data);
      return promise.then(function (data) {
        return _tx.MsgIncreasePositionMarginResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "rewardsOptOut",
    value: function rewardsOptOut(request) {
      var data = _tx.MsgRewardsOptOut.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "RewardsOptOut", data);
      return promise.then(function (data) {
        return _tx.MsgRewardsOptOutResponse.decode(new _m0.Reader(data));
      });
    }
  }, {
    key: "adminUpdateBinaryOptionsMarket",
    value: function adminUpdateBinaryOptionsMarket(request) {
      var data = _tx.MsgAdminUpdateBinaryOptionsMarket.encode(request).finish();
      var promise = this.rpc.request("injective.exchange.v1beta1.Msg", "AdminUpdateBinaryOptionsMarket", data);
      return promise.then(function (data) {
        return _tx.MsgAdminUpdateBinaryOptionsMarketResponse.decode(new _m0.Reader(data));
      });
    }
  }]);
  return MsgClientImpl;
}();
exports.MsgClientImpl = MsgClientImpl;