"use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MsgWithdrawShareResponse = exports.MsgWithdrawShare = exports.MsgWithdrawReserveResponse = exports.MsgWithdrawReserve = exports.MsgUpdateBondStateResponse = exports.MsgUpdateBondState = exports.MsgSwapResponse = exports.MsgSwap = exports.MsgSetNextAlphaResponse = exports.MsgSetNextAlpha = exports.MsgSellResponse = exports.MsgSell = exports.MsgMakeOutcomePaymentResponse = exports.MsgMakeOutcomePayment = exports.MsgEditBondResponse = exports.MsgEditBond = exports.MsgCreateBondResponse = exports.MsgCreateBond = exports.MsgBuyResponse = exports.MsgBuy = void 0;
var _bonds = require("./bonds");
var _coin = require("../../../cosmos/base/v1beta1/coin");
var _m0 = _interopRequireWildcard(require("protobufjs/minimal"));
var _helpers = require("../../../helpers");
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); }
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } //@ts-nocheck
/** MsgCreateBond defines a message for creating a new bond. */

/** MsgCreateBond defines a message for creating a new bond. */

/** MsgCreateBondResponse defines the Msg/CreateBond response type. */

/** MsgCreateBondResponse defines the Msg/CreateBond response type. */

/** MsgEditBond defines a message for editing an existing bond. */

/** MsgEditBond defines a message for editing an existing bond. */

/** MsgEditBondResponse defines the Msg/EditBond response type. */

/** MsgEditBondResponse defines the Msg/EditBond response type. */

/** MsgSetNextAlpha defines a message for editing a bond's alpha parameter. */

/** MsgSetNextAlpha defines a message for editing a bond's alpha parameter. */

/** MsgUpdateBondState defines a message for updating a bond's current state. */

/** MsgUpdateBondState defines a message for updating a bond's current state. */

/** MsgUpdateBondStateResponse defines the Msg/UpdateBondState response type. */

/** MsgUpdateBondStateResponse defines the Msg/UpdateBondState response type. */

/** MsgBuy defines a message for buying from a bond. */

/** MsgBuy defines a message for buying from a bond. */

/** MsgBuyResponse defines the Msg/Buy response type. */

/** MsgBuyResponse defines the Msg/Buy response type. */

/** MsgSell defines a message for selling from a bond. */

/** MsgSell defines a message for selling from a bond. */

/** MsgSellResponse defines the Msg/Sell response type. */

/** MsgSellResponse defines the Msg/Sell response type. */

/**
 * MsgSwap defines a message for swapping from one reserve bond token to
 * another.
 */

/**
 * MsgSwap defines a message for swapping from one reserve bond token to
 * another.
 */

/** MsgSwapResponse defines the Msg/Swap response type. */

/** MsgSwapResponse defines the Msg/Swap response type. */

/**
 * MsgMakeOutcomePayment defines a message for making an outcome payment to a
 * bond.
 */

/**
 * MsgMakeOutcomePayment defines a message for making an outcome payment to a
 * bond.
 */

/**
 * MsgMakeOutcomePaymentResponse defines the Msg/MakeOutcomePayment response
 * type.
 */

/**
 * MsgMakeOutcomePaymentResponse defines the Msg/MakeOutcomePayment response
 * type.
 */

/**
 * MsgWithdrawShare defines a message for withdrawing a share from a bond that
 * is in the SETTLE stage.
 */

/**
 * MsgWithdrawShare defines a message for withdrawing a share from a bond that
 * is in the SETTLE stage.
 */

/** MsgWithdrawShareResponse defines the Msg/WithdrawShare response type. */

/** MsgWithdrawShareResponse defines the Msg/WithdrawShare response type. */

/** MsgWithdrawReserve defines a message for withdrawing reserve from a bond. */

/** MsgWithdrawReserve defines a message for withdrawing reserve from a bond. */

/** MsgWithdrawReserveResponse defines the Msg/WithdrawReserve response type. */

/** MsgWithdrawReserveResponse defines the Msg/WithdrawReserve response type. */

function createBaseMsgCreateBond() {
  return {
    bondDid: "",
    token: "",
    name: "",
    description: "",
    functionType: "",
    functionParameters: [],
    creatorDid: "",
    controllerDid: "",
    oracleDid: "",
    reserveTokens: [],
    txFeePercentage: "",
    exitFeePercentage: "",
    feeAddress: "",
    reserveWithdrawalAddress: "",
    maxSupply: undefined,
    orderQuantityLimits: [],
    sanityRate: "",
    sanityMarginPercentage: "",
    allowSells: false,
    allowReserveWithdrawals: false,
    alphaBond: false,
    batchBlocks: "",
    outcomePayment: "",
    creatorAddress: ""
  };
}
var MsgCreateBond = exports.MsgCreateBond = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.bondDid !== "") {
      writer.uint32(10).string(message.bondDid);
    }
    if (message.token !== "") {
      writer.uint32(18).string(message.token);
    }
    if (message.name !== "") {
      writer.uint32(26).string(message.name);
    }
    if (message.description !== "") {
      writer.uint32(34).string(message.description);
    }
    if (message.functionType !== "") {
      writer.uint32(42).string(message.functionType);
    }
    var _iterator = _createForOfIteratorHelper(message.functionParameters),
      _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var v = _step.value;
        _bonds.FunctionParam.encode(v, writer.uint32(50).fork()).ldelim();
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
    if (message.creatorDid !== "") {
      writer.uint32(58).string(message.creatorDid);
    }
    if (message.controllerDid !== "") {
      writer.uint32(66).string(message.controllerDid);
    }
    if (message.oracleDid !== "") {
      writer.uint32(74).string(message.oracleDid);
    }
    var _iterator2 = _createForOfIteratorHelper(message.reserveTokens),
      _step2;
    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var _v = _step2.value;
        writer.uint32(82).string(_v);
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }
    if (message.txFeePercentage !== "") {
      writer.uint32(90).string(message.txFeePercentage);
    }
    if (message.exitFeePercentage !== "") {
      writer.uint32(98).string(message.exitFeePercentage);
    }
    if (message.feeAddress !== "") {
      writer.uint32(106).string(message.feeAddress);
    }
    if (message.reserveWithdrawalAddress !== "") {
      writer.uint32(114).string(message.reserveWithdrawalAddress);
    }
    if (message.maxSupply !== undefined) {
      _coin.Coin.encode(message.maxSupply, writer.uint32(122).fork()).ldelim();
    }
    var _iterator3 = _createForOfIteratorHelper(message.orderQuantityLimits),
      _step3;
    try {
      for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
        var _v2 = _step3.value;
        _coin.Coin.encode(_v2, writer.uint32(130).fork()).ldelim();
      }
    } catch (err) {
      _iterator3.e(err);
    } finally {
      _iterator3.f();
    }
    if (message.sanityRate !== "") {
      writer.uint32(138).string(message.sanityRate);
    }
    if (message.sanityMarginPercentage !== "") {
      writer.uint32(146).string(message.sanityMarginPercentage);
    }
    if (message.allowSells === true) {
      writer.uint32(152).bool(message.allowSells);
    }
    if (message.allowReserveWithdrawals === true) {
      writer.uint32(160).bool(message.allowReserveWithdrawals);
    }
    if (message.alphaBond === true) {
      writer.uint32(168).bool(message.alphaBond);
    }
    if (message.batchBlocks !== "") {
      writer.uint32(178).string(message.batchBlocks);
    }
    if (message.outcomePayment !== "") {
      writer.uint32(186).string(message.outcomePayment);
    }
    if (message.creatorAddress !== "") {
      writer.uint32(194).string(message.creatorAddress);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgCreateBond();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = reader.string();
          break;
        case 2:
          message.token = reader.string();
          break;
        case 3:
          message.name = reader.string();
          break;
        case 4:
          message.description = reader.string();
          break;
        case 5:
          message.functionType = reader.string();
          break;
        case 6:
          message.functionParameters.push(_bonds.FunctionParam.decode(reader, reader.uint32()));
          break;
        case 7:
          message.creatorDid = reader.string();
          break;
        case 8:
          message.controllerDid = reader.string();
          break;
        case 9:
          message.oracleDid = reader.string();
          break;
        case 10:
          message.reserveTokens.push(reader.string());
          break;
        case 11:
          message.txFeePercentage = reader.string();
          break;
        case 12:
          message.exitFeePercentage = reader.string();
          break;
        case 13:
          message.feeAddress = reader.string();
          break;
        case 14:
          message.reserveWithdrawalAddress = reader.string();
          break;
        case 15:
          message.maxSupply = _coin.Coin.decode(reader, reader.uint32());
          break;
        case 16:
          message.orderQuantityLimits.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 17:
          message.sanityRate = reader.string();
          break;
        case 18:
          message.sanityMarginPercentage = reader.string();
          break;
        case 19:
          message.allowSells = reader.bool();
          break;
        case 20:
          message.allowReserveWithdrawals = reader.bool();
          break;
        case 21:
          message.alphaBond = reader.bool();
          break;
        case 22:
          message.batchBlocks = reader.string();
          break;
        case 23:
          message.outcomePayment = reader.string();
          break;
        case 24:
          message.creatorAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      bondDid: (0, _helpers.isSet)(object.bondDid) ? String(object.bondDid) : "",
      token: (0, _helpers.isSet)(object.token) ? String(object.token) : "",
      name: (0, _helpers.isSet)(object.name) ? String(object.name) : "",
      description: (0, _helpers.isSet)(object.description) ? String(object.description) : "",
      functionType: (0, _helpers.isSet)(object.functionType) ? String(object.functionType) : "",
      functionParameters: Array.isArray(object === null || object === void 0 ? void 0 : object.functionParameters) ? object.functionParameters.map(function (e) {
        return _bonds.FunctionParam.fromJSON(e);
      }) : [],
      creatorDid: (0, _helpers.isSet)(object.creatorDid) ? String(object.creatorDid) : "",
      controllerDid: (0, _helpers.isSet)(object.controllerDid) ? String(object.controllerDid) : "",
      oracleDid: (0, _helpers.isSet)(object.oracleDid) ? String(object.oracleDid) : "",
      reserveTokens: Array.isArray(object === null || object === void 0 ? void 0 : object.reserveTokens) ? object.reserveTokens.map(function (e) {
        return String(e);
      }) : [],
      txFeePercentage: (0, _helpers.isSet)(object.txFeePercentage) ? String(object.txFeePercentage) : "",
      exitFeePercentage: (0, _helpers.isSet)(object.exitFeePercentage) ? String(object.exitFeePercentage) : "",
      feeAddress: (0, _helpers.isSet)(object.feeAddress) ? String(object.feeAddress) : "",
      reserveWithdrawalAddress: (0, _helpers.isSet)(object.reserveWithdrawalAddress) ? String(object.reserveWithdrawalAddress) : "",
      maxSupply: (0, _helpers.isSet)(object.maxSupply) ? _coin.Coin.fromJSON(object.maxSupply) : undefined,
      orderQuantityLimits: Array.isArray(object === null || object === void 0 ? void 0 : object.orderQuantityLimits) ? object.orderQuantityLimits.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      sanityRate: (0, _helpers.isSet)(object.sanityRate) ? String(object.sanityRate) : "",
      sanityMarginPercentage: (0, _helpers.isSet)(object.sanityMarginPercentage) ? String(object.sanityMarginPercentage) : "",
      allowSells: (0, _helpers.isSet)(object.allowSells) ? Boolean(object.allowSells) : false,
      allowReserveWithdrawals: (0, _helpers.isSet)(object.allowReserveWithdrawals) ? Boolean(object.allowReserveWithdrawals) : false,
      alphaBond: (0, _helpers.isSet)(object.alphaBond) ? Boolean(object.alphaBond) : false,
      batchBlocks: (0, _helpers.isSet)(object.batchBlocks) ? String(object.batchBlocks) : "",
      outcomePayment: (0, _helpers.isSet)(object.outcomePayment) ? String(object.outcomePayment) : "",
      creatorAddress: (0, _helpers.isSet)(object.creatorAddress) ? String(object.creatorAddress) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.token !== undefined && (obj.token = message.token);
    message.name !== undefined && (obj.name = message.name);
    message.description !== undefined && (obj.description = message.description);
    message.functionType !== undefined && (obj.functionType = message.functionType);
    if (message.functionParameters) {
      obj.functionParameters = message.functionParameters.map(function (e) {
        return e ? _bonds.FunctionParam.toJSON(e) : undefined;
      });
    } else {
      obj.functionParameters = [];
    }
    message.creatorDid !== undefined && (obj.creatorDid = message.creatorDid);
    message.controllerDid !== undefined && (obj.controllerDid = message.controllerDid);
    message.oracleDid !== undefined && (obj.oracleDid = message.oracleDid);
    if (message.reserveTokens) {
      obj.reserveTokens = message.reserveTokens.map(function (e) {
        return e;
      });
    } else {
      obj.reserveTokens = [];
    }
    message.txFeePercentage !== undefined && (obj.txFeePercentage = message.txFeePercentage);
    message.exitFeePercentage !== undefined && (obj.exitFeePercentage = message.exitFeePercentage);
    message.feeAddress !== undefined && (obj.feeAddress = message.feeAddress);
    message.reserveWithdrawalAddress !== undefined && (obj.reserveWithdrawalAddress = message.reserveWithdrawalAddress);
    message.maxSupply !== undefined && (obj.maxSupply = message.maxSupply ? _coin.Coin.toJSON(message.maxSupply) : undefined);
    if (message.orderQuantityLimits) {
      obj.orderQuantityLimits = message.orderQuantityLimits.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.orderQuantityLimits = [];
    }
    message.sanityRate !== undefined && (obj.sanityRate = message.sanityRate);
    message.sanityMarginPercentage !== undefined && (obj.sanityMarginPercentage = message.sanityMarginPercentage);
    message.allowSells !== undefined && (obj.allowSells = message.allowSells);
    message.allowReserveWithdrawals !== undefined && (obj.allowReserveWithdrawals = message.allowReserveWithdrawals);
    message.alphaBond !== undefined && (obj.alphaBond = message.alphaBond);
    message.batchBlocks !== undefined && (obj.batchBlocks = message.batchBlocks);
    message.outcomePayment !== undefined && (obj.outcomePayment = message.outcomePayment);
    message.creatorAddress !== undefined && (obj.creatorAddress = message.creatorAddress);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid, _object$token, _object$name, _object$description, _object$functionType, _object$functionParam, _object$creatorDid, _object$controllerDid, _object$oracleDid, _object$reserveTokens, _object$txFeePercenta, _object$exitFeePercen, _object$feeAddress, _object$reserveWithdr, _object$orderQuantity, _object$sanityRate, _object$sanityMarginP, _object$allowSells, _object$allowReserveW, _object$alphaBond, _object$batchBlocks, _object$outcomePaymen, _object$creatorAddres;
    var message = createBaseMsgCreateBond();
    message.bondDid = (_object$bondDid = object.bondDid) !== null && _object$bondDid !== void 0 ? _object$bondDid : "";
    message.token = (_object$token = object.token) !== null && _object$token !== void 0 ? _object$token : "";
    message.name = (_object$name = object.name) !== null && _object$name !== void 0 ? _object$name : "";
    message.description = (_object$description = object.description) !== null && _object$description !== void 0 ? _object$description : "";
    message.functionType = (_object$functionType = object.functionType) !== null && _object$functionType !== void 0 ? _object$functionType : "";
    message.functionParameters = ((_object$functionParam = object.functionParameters) === null || _object$functionParam === void 0 ? void 0 : _object$functionParam.map(function (e) {
      return _bonds.FunctionParam.fromPartial(e);
    })) || [];
    message.creatorDid = (_object$creatorDid = object.creatorDid) !== null && _object$creatorDid !== void 0 ? _object$creatorDid : "";
    message.controllerDid = (_object$controllerDid = object.controllerDid) !== null && _object$controllerDid !== void 0 ? _object$controllerDid : "";
    message.oracleDid = (_object$oracleDid = object.oracleDid) !== null && _object$oracleDid !== void 0 ? _object$oracleDid : "";
    message.reserveTokens = ((_object$reserveTokens = object.reserveTokens) === null || _object$reserveTokens === void 0 ? void 0 : _object$reserveTokens.map(function (e) {
      return e;
    })) || [];
    message.txFeePercentage = (_object$txFeePercenta = object.txFeePercentage) !== null && _object$txFeePercenta !== void 0 ? _object$txFeePercenta : "";
    message.exitFeePercentage = (_object$exitFeePercen = object.exitFeePercentage) !== null && _object$exitFeePercen !== void 0 ? _object$exitFeePercen : "";
    message.feeAddress = (_object$feeAddress = object.feeAddress) !== null && _object$feeAddress !== void 0 ? _object$feeAddress : "";
    message.reserveWithdrawalAddress = (_object$reserveWithdr = object.reserveWithdrawalAddress) !== null && _object$reserveWithdr !== void 0 ? _object$reserveWithdr : "";
    message.maxSupply = object.maxSupply !== undefined && object.maxSupply !== null ? _coin.Coin.fromPartial(object.maxSupply) : undefined;
    message.orderQuantityLimits = ((_object$orderQuantity = object.orderQuantityLimits) === null || _object$orderQuantity === void 0 ? void 0 : _object$orderQuantity.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.sanityRate = (_object$sanityRate = object.sanityRate) !== null && _object$sanityRate !== void 0 ? _object$sanityRate : "";
    message.sanityMarginPercentage = (_object$sanityMarginP = object.sanityMarginPercentage) !== null && _object$sanityMarginP !== void 0 ? _object$sanityMarginP : "";
    message.allowSells = (_object$allowSells = object.allowSells) !== null && _object$allowSells !== void 0 ? _object$allowSells : false;
    message.allowReserveWithdrawals = (_object$allowReserveW = object.allowReserveWithdrawals) !== null && _object$allowReserveW !== void 0 ? _object$allowReserveW : false;
    message.alphaBond = (_object$alphaBond = object.alphaBond) !== null && _object$alphaBond !== void 0 ? _object$alphaBond : false;
    message.batchBlocks = (_object$batchBlocks = object.batchBlocks) !== null && _object$batchBlocks !== void 0 ? _object$batchBlocks : "";
    message.outcomePayment = (_object$outcomePaymen = object.outcomePayment) !== null && _object$outcomePaymen !== void 0 ? _object$outcomePaymen : "";
    message.creatorAddress = (_object$creatorAddres = object.creatorAddress) !== null && _object$creatorAddres !== void 0 ? _object$creatorAddres : "";
    return message;
  }
};
function createBaseMsgCreateBondResponse() {
  return {};
}
var MsgCreateBondResponse = exports.MsgCreateBondResponse = {
  encode: function encode(_) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgCreateBondResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(_) {
    return {};
  },
  toJSON: function toJSON(_) {
    var obj = {};
    return obj;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseMsgCreateBondResponse();
    return message;
  }
};
function createBaseMsgEditBond() {
  return {
    bondDid: "",
    name: "",
    description: "",
    orderQuantityLimits: "",
    sanityRate: "",
    sanityMarginPercentage: "",
    editorDid: "",
    editorAddress: ""
  };
}
var MsgEditBond = exports.MsgEditBond = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.bondDid !== "") {
      writer.uint32(10).string(message.bondDid);
    }
    if (message.name !== "") {
      writer.uint32(18).string(message.name);
    }
    if (message.description !== "") {
      writer.uint32(26).string(message.description);
    }
    if (message.orderQuantityLimits !== "") {
      writer.uint32(34).string(message.orderQuantityLimits);
    }
    if (message.sanityRate !== "") {
      writer.uint32(42).string(message.sanityRate);
    }
    if (message.sanityMarginPercentage !== "") {
      writer.uint32(50).string(message.sanityMarginPercentage);
    }
    if (message.editorDid !== "") {
      writer.uint32(58).string(message.editorDid);
    }
    if (message.editorAddress !== "") {
      writer.uint32(66).string(message.editorAddress);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgEditBond();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = reader.string();
          break;
        case 2:
          message.name = reader.string();
          break;
        case 3:
          message.description = reader.string();
          break;
        case 4:
          message.orderQuantityLimits = reader.string();
          break;
        case 5:
          message.sanityRate = reader.string();
          break;
        case 6:
          message.sanityMarginPercentage = reader.string();
          break;
        case 7:
          message.editorDid = reader.string();
          break;
        case 8:
          message.editorAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      bondDid: (0, _helpers.isSet)(object.bondDid) ? String(object.bondDid) : "",
      name: (0, _helpers.isSet)(object.name) ? String(object.name) : "",
      description: (0, _helpers.isSet)(object.description) ? String(object.description) : "",
      orderQuantityLimits: (0, _helpers.isSet)(object.orderQuantityLimits) ? String(object.orderQuantityLimits) : "",
      sanityRate: (0, _helpers.isSet)(object.sanityRate) ? String(object.sanityRate) : "",
      sanityMarginPercentage: (0, _helpers.isSet)(object.sanityMarginPercentage) ? String(object.sanityMarginPercentage) : "",
      editorDid: (0, _helpers.isSet)(object.editorDid) ? String(object.editorDid) : "",
      editorAddress: (0, _helpers.isSet)(object.editorAddress) ? String(object.editorAddress) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.name !== undefined && (obj.name = message.name);
    message.description !== undefined && (obj.description = message.description);
    message.orderQuantityLimits !== undefined && (obj.orderQuantityLimits = message.orderQuantityLimits);
    message.sanityRate !== undefined && (obj.sanityRate = message.sanityRate);
    message.sanityMarginPercentage !== undefined && (obj.sanityMarginPercentage = message.sanityMarginPercentage);
    message.editorDid !== undefined && (obj.editorDid = message.editorDid);
    message.editorAddress !== undefined && (obj.editorAddress = message.editorAddress);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid2, _object$name2, _object$description2, _object$orderQuantity2, _object$sanityRate2, _object$sanityMarginP2, _object$editorDid, _object$editorAddress;
    var message = createBaseMsgEditBond();
    message.bondDid = (_object$bondDid2 = object.bondDid) !== null && _object$bondDid2 !== void 0 ? _object$bondDid2 : "";
    message.name = (_object$name2 = object.name) !== null && _object$name2 !== void 0 ? _object$name2 : "";
    message.description = (_object$description2 = object.description) !== null && _object$description2 !== void 0 ? _object$description2 : "";
    message.orderQuantityLimits = (_object$orderQuantity2 = object.orderQuantityLimits) !== null && _object$orderQuantity2 !== void 0 ? _object$orderQuantity2 : "";
    message.sanityRate = (_object$sanityRate2 = object.sanityRate) !== null && _object$sanityRate2 !== void 0 ? _object$sanityRate2 : "";
    message.sanityMarginPercentage = (_object$sanityMarginP2 = object.sanityMarginPercentage) !== null && _object$sanityMarginP2 !== void 0 ? _object$sanityMarginP2 : "";
    message.editorDid = (_object$editorDid = object.editorDid) !== null && _object$editorDid !== void 0 ? _object$editorDid : "";
    message.editorAddress = (_object$editorAddress = object.editorAddress) !== null && _object$editorAddress !== void 0 ? _object$editorAddress : "";
    return message;
  }
};
function createBaseMsgEditBondResponse() {
  return {};
}
var MsgEditBondResponse = exports.MsgEditBondResponse = {
  encode: function encode(_) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgEditBondResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(_) {
    return {};
  },
  toJSON: function toJSON(_) {
    var obj = {};
    return obj;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseMsgEditBondResponse();
    return message;
  }
};
function createBaseMsgSetNextAlpha() {
  return {
    bondDid: "",
    alpha: "",
    delta: undefined,
    oracleDid: "",
    oracleAddress: ""
  };
}
var MsgSetNextAlpha = exports.MsgSetNextAlpha = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.bondDid !== "") {
      writer.uint32(10).string(message.bondDid);
    }
    if (message.alpha !== "") {
      writer.uint32(18).string(message.alpha);
    }
    if (message.delta !== undefined) {
      writer.uint32(26).string(message.delta);
    }
    if (message.oracleDid !== "") {
      writer.uint32(34).string(message.oracleDid);
    }
    if (message.oracleAddress !== "") {
      writer.uint32(42).string(message.oracleAddress);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgSetNextAlpha();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = reader.string();
          break;
        case 2:
          message.alpha = reader.string();
          break;
        case 3:
          message.delta = reader.string();
          break;
        case 4:
          message.oracleDid = reader.string();
          break;
        case 5:
          message.oracleAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      bondDid: (0, _helpers.isSet)(object.bondDid) ? String(object.bondDid) : "",
      alpha: (0, _helpers.isSet)(object.alpha) ? String(object.alpha) : "",
      delta: (0, _helpers.isSet)(object.delta) ? String(object.delta) : undefined,
      oracleDid: (0, _helpers.isSet)(object.oracleDid) ? String(object.oracleDid) : "",
      oracleAddress: (0, _helpers.isSet)(object.oracleAddress) ? String(object.oracleAddress) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.alpha !== undefined && (obj.alpha = message.alpha);
    message.delta !== undefined && (obj.delta = message.delta);
    message.oracleDid !== undefined && (obj.oracleDid = message.oracleDid);
    message.oracleAddress !== undefined && (obj.oracleAddress = message.oracleAddress);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid3, _object$alpha, _object$delta, _object$oracleDid2, _object$oracleAddress;
    var message = createBaseMsgSetNextAlpha();
    message.bondDid = (_object$bondDid3 = object.bondDid) !== null && _object$bondDid3 !== void 0 ? _object$bondDid3 : "";
    message.alpha = (_object$alpha = object.alpha) !== null && _object$alpha !== void 0 ? _object$alpha : "";
    message.delta = (_object$delta = object.delta) !== null && _object$delta !== void 0 ? _object$delta : undefined;
    message.oracleDid = (_object$oracleDid2 = object.oracleDid) !== null && _object$oracleDid2 !== void 0 ? _object$oracleDid2 : "";
    message.oracleAddress = (_object$oracleAddress = object.oracleAddress) !== null && _object$oracleAddress !== void 0 ? _object$oracleAddress : "";
    return message;
  }
};
function createBaseMsgSetNextAlphaResponse() {
  return {};
}
var MsgSetNextAlphaResponse = exports.MsgSetNextAlphaResponse = {
  encode: function encode(_) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgSetNextAlphaResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(_) {
    return {};
  },
  toJSON: function toJSON(_) {
    var obj = {};
    return obj;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseMsgSetNextAlphaResponse();
    return message;
  }
};
function createBaseMsgUpdateBondState() {
  return {
    bondDid: "",
    state: "",
    editorDid: "",
    editorAddress: ""
  };
}
var MsgUpdateBondState = exports.MsgUpdateBondState = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.bondDid !== "") {
      writer.uint32(10).string(message.bondDid);
    }
    if (message.state !== "") {
      writer.uint32(18).string(message.state);
    }
    if (message.editorDid !== "") {
      writer.uint32(26).string(message.editorDid);
    }
    if (message.editorAddress !== "") {
      writer.uint32(34).string(message.editorAddress);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgUpdateBondState();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = reader.string();
          break;
        case 2:
          message.state = reader.string();
          break;
        case 3:
          message.editorDid = reader.string();
          break;
        case 4:
          message.editorAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      bondDid: (0, _helpers.isSet)(object.bondDid) ? String(object.bondDid) : "",
      state: (0, _helpers.isSet)(object.state) ? String(object.state) : "",
      editorDid: (0, _helpers.isSet)(object.editorDid) ? String(object.editorDid) : "",
      editorAddress: (0, _helpers.isSet)(object.editorAddress) ? String(object.editorAddress) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.state !== undefined && (obj.state = message.state);
    message.editorDid !== undefined && (obj.editorDid = message.editorDid);
    message.editorAddress !== undefined && (obj.editorAddress = message.editorAddress);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid4, _object$state, _object$editorDid2, _object$editorAddress2;
    var message = createBaseMsgUpdateBondState();
    message.bondDid = (_object$bondDid4 = object.bondDid) !== null && _object$bondDid4 !== void 0 ? _object$bondDid4 : "";
    message.state = (_object$state = object.state) !== null && _object$state !== void 0 ? _object$state : "";
    message.editorDid = (_object$editorDid2 = object.editorDid) !== null && _object$editorDid2 !== void 0 ? _object$editorDid2 : "";
    message.editorAddress = (_object$editorAddress2 = object.editorAddress) !== null && _object$editorAddress2 !== void 0 ? _object$editorAddress2 : "";
    return message;
  }
};
function createBaseMsgUpdateBondStateResponse() {
  return {};
}
var MsgUpdateBondStateResponse = exports.MsgUpdateBondStateResponse = {
  encode: function encode(_) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgUpdateBondStateResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(_) {
    return {};
  },
  toJSON: function toJSON(_) {
    var obj = {};
    return obj;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseMsgUpdateBondStateResponse();
    return message;
  }
};
function createBaseMsgBuy() {
  return {
    buyerDid: "",
    amount: undefined,
    maxPrices: [],
    bondDid: "",
    buyerAddress: ""
  };
}
var MsgBuy = exports.MsgBuy = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.buyerDid !== "") {
      writer.uint32(10).string(message.buyerDid);
    }
    if (message.amount !== undefined) {
      _coin.Coin.encode(message.amount, writer.uint32(18).fork()).ldelim();
    }
    var _iterator4 = _createForOfIteratorHelper(message.maxPrices),
      _step4;
    try {
      for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
        var v = _step4.value;
        _coin.Coin.encode(v, writer.uint32(26).fork()).ldelim();
      }
    } catch (err) {
      _iterator4.e(err);
    } finally {
      _iterator4.f();
    }
    if (message.bondDid !== "") {
      writer.uint32(34).string(message.bondDid);
    }
    if (message.buyerAddress !== "") {
      writer.uint32(42).string(message.buyerAddress);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgBuy();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.buyerDid = reader.string();
          break;
        case 2:
          message.amount = _coin.Coin.decode(reader, reader.uint32());
          break;
        case 3:
          message.maxPrices.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 4:
          message.bondDid = reader.string();
          break;
        case 5:
          message.buyerAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      buyerDid: (0, _helpers.isSet)(object.buyerDid) ? String(object.buyerDid) : "",
      amount: (0, _helpers.isSet)(object.amount) ? _coin.Coin.fromJSON(object.amount) : undefined,
      maxPrices: Array.isArray(object === null || object === void 0 ? void 0 : object.maxPrices) ? object.maxPrices.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      bondDid: (0, _helpers.isSet)(object.bondDid) ? String(object.bondDid) : "",
      buyerAddress: (0, _helpers.isSet)(object.buyerAddress) ? String(object.buyerAddress) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.buyerDid !== undefined && (obj.buyerDid = message.buyerDid);
    message.amount !== undefined && (obj.amount = message.amount ? _coin.Coin.toJSON(message.amount) : undefined);
    if (message.maxPrices) {
      obj.maxPrices = message.maxPrices.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.maxPrices = [];
    }
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.buyerAddress !== undefined && (obj.buyerAddress = message.buyerAddress);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$buyerDid, _object$maxPrices, _object$bondDid5, _object$buyerAddress;
    var message = createBaseMsgBuy();
    message.buyerDid = (_object$buyerDid = object.buyerDid) !== null && _object$buyerDid !== void 0 ? _object$buyerDid : "";
    message.amount = object.amount !== undefined && object.amount !== null ? _coin.Coin.fromPartial(object.amount) : undefined;
    message.maxPrices = ((_object$maxPrices = object.maxPrices) === null || _object$maxPrices === void 0 ? void 0 : _object$maxPrices.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.bondDid = (_object$bondDid5 = object.bondDid) !== null && _object$bondDid5 !== void 0 ? _object$bondDid5 : "";
    message.buyerAddress = (_object$buyerAddress = object.buyerAddress) !== null && _object$buyerAddress !== void 0 ? _object$buyerAddress : "";
    return message;
  }
};
function createBaseMsgBuyResponse() {
  return {};
}
var MsgBuyResponse = exports.MsgBuyResponse = {
  encode: function encode(_) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgBuyResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(_) {
    return {};
  },
  toJSON: function toJSON(_) {
    var obj = {};
    return obj;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseMsgBuyResponse();
    return message;
  }
};
function createBaseMsgSell() {
  return {
    sellerDid: "",
    amount: undefined,
    bondDid: "",
    sellerAddress: ""
  };
}
var MsgSell = exports.MsgSell = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.sellerDid !== "") {
      writer.uint32(10).string(message.sellerDid);
    }
    if (message.amount !== undefined) {
      _coin.Coin.encode(message.amount, writer.uint32(18).fork()).ldelim();
    }
    if (message.bondDid !== "") {
      writer.uint32(26).string(message.bondDid);
    }
    if (message.sellerAddress !== "") {
      writer.uint32(34).string(message.sellerAddress);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgSell();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.sellerDid = reader.string();
          break;
        case 2:
          message.amount = _coin.Coin.decode(reader, reader.uint32());
          break;
        case 3:
          message.bondDid = reader.string();
          break;
        case 4:
          message.sellerAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      sellerDid: (0, _helpers.isSet)(object.sellerDid) ? String(object.sellerDid) : "",
      amount: (0, _helpers.isSet)(object.amount) ? _coin.Coin.fromJSON(object.amount) : undefined,
      bondDid: (0, _helpers.isSet)(object.bondDid) ? String(object.bondDid) : "",
      sellerAddress: (0, _helpers.isSet)(object.sellerAddress) ? String(object.sellerAddress) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.sellerDid !== undefined && (obj.sellerDid = message.sellerDid);
    message.amount !== undefined && (obj.amount = message.amount ? _coin.Coin.toJSON(message.amount) : undefined);
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.sellerAddress !== undefined && (obj.sellerAddress = message.sellerAddress);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$sellerDid, _object$bondDid6, _object$sellerAddress;
    var message = createBaseMsgSell();
    message.sellerDid = (_object$sellerDid = object.sellerDid) !== null && _object$sellerDid !== void 0 ? _object$sellerDid : "";
    message.amount = object.amount !== undefined && object.amount !== null ? _coin.Coin.fromPartial(object.amount) : undefined;
    message.bondDid = (_object$bondDid6 = object.bondDid) !== null && _object$bondDid6 !== void 0 ? _object$bondDid6 : "";
    message.sellerAddress = (_object$sellerAddress = object.sellerAddress) !== null && _object$sellerAddress !== void 0 ? _object$sellerAddress : "";
    return message;
  }
};
function createBaseMsgSellResponse() {
  return {};
}
var MsgSellResponse = exports.MsgSellResponse = {
  encode: function encode(_) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgSellResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(_) {
    return {};
  },
  toJSON: function toJSON(_) {
    var obj = {};
    return obj;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseMsgSellResponse();
    return message;
  }
};
function createBaseMsgSwap() {
  return {
    swapperDid: "",
    bondDid: "",
    from: undefined,
    toToken: "",
    swapperAddress: ""
  };
}
var MsgSwap = exports.MsgSwap = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.swapperDid !== "") {
      writer.uint32(10).string(message.swapperDid);
    }
    if (message.bondDid !== "") {
      writer.uint32(18).string(message.bondDid);
    }
    if (message.from !== undefined) {
      _coin.Coin.encode(message.from, writer.uint32(26).fork()).ldelim();
    }
    if (message.toToken !== "") {
      writer.uint32(34).string(message.toToken);
    }
    if (message.swapperAddress !== "") {
      writer.uint32(42).string(message.swapperAddress);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgSwap();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.swapperDid = reader.string();
          break;
        case 2:
          message.bondDid = reader.string();
          break;
        case 3:
          message.from = _coin.Coin.decode(reader, reader.uint32());
          break;
        case 4:
          message.toToken = reader.string();
          break;
        case 5:
          message.swapperAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      swapperDid: (0, _helpers.isSet)(object.swapperDid) ? String(object.swapperDid) : "",
      bondDid: (0, _helpers.isSet)(object.bondDid) ? String(object.bondDid) : "",
      from: (0, _helpers.isSet)(object.from) ? _coin.Coin.fromJSON(object.from) : undefined,
      toToken: (0, _helpers.isSet)(object.toToken) ? String(object.toToken) : "",
      swapperAddress: (0, _helpers.isSet)(object.swapperAddress) ? String(object.swapperAddress) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.swapperDid !== undefined && (obj.swapperDid = message.swapperDid);
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.from !== undefined && (obj.from = message.from ? _coin.Coin.toJSON(message.from) : undefined);
    message.toToken !== undefined && (obj.toToken = message.toToken);
    message.swapperAddress !== undefined && (obj.swapperAddress = message.swapperAddress);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$swapperDid, _object$bondDid7, _object$toToken, _object$swapperAddres;
    var message = createBaseMsgSwap();
    message.swapperDid = (_object$swapperDid = object.swapperDid) !== null && _object$swapperDid !== void 0 ? _object$swapperDid : "";
    message.bondDid = (_object$bondDid7 = object.bondDid) !== null && _object$bondDid7 !== void 0 ? _object$bondDid7 : "";
    message.from = object.from !== undefined && object.from !== null ? _coin.Coin.fromPartial(object.from) : undefined;
    message.toToken = (_object$toToken = object.toToken) !== null && _object$toToken !== void 0 ? _object$toToken : "";
    message.swapperAddress = (_object$swapperAddres = object.swapperAddress) !== null && _object$swapperAddres !== void 0 ? _object$swapperAddres : "";
    return message;
  }
};
function createBaseMsgSwapResponse() {
  return {};
}
var MsgSwapResponse = exports.MsgSwapResponse = {
  encode: function encode(_) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgSwapResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(_) {
    return {};
  },
  toJSON: function toJSON(_) {
    var obj = {};
    return obj;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseMsgSwapResponse();
    return message;
  }
};
function createBaseMsgMakeOutcomePayment() {
  return {
    senderDid: "",
    amount: "",
    bondDid: "",
    senderAddress: ""
  };
}
var MsgMakeOutcomePayment = exports.MsgMakeOutcomePayment = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.senderDid !== "") {
      writer.uint32(10).string(message.senderDid);
    }
    if (message.amount !== "") {
      writer.uint32(18).string(message.amount);
    }
    if (message.bondDid !== "") {
      writer.uint32(26).string(message.bondDid);
    }
    if (message.senderAddress !== "") {
      writer.uint32(34).string(message.senderAddress);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgMakeOutcomePayment();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.senderDid = reader.string();
          break;
        case 2:
          message.amount = reader.string();
          break;
        case 3:
          message.bondDid = reader.string();
          break;
        case 4:
          message.senderAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      senderDid: (0, _helpers.isSet)(object.senderDid) ? String(object.senderDid) : "",
      amount: (0, _helpers.isSet)(object.amount) ? String(object.amount) : "",
      bondDid: (0, _helpers.isSet)(object.bondDid) ? String(object.bondDid) : "",
      senderAddress: (0, _helpers.isSet)(object.senderAddress) ? String(object.senderAddress) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.senderDid !== undefined && (obj.senderDid = message.senderDid);
    message.amount !== undefined && (obj.amount = message.amount);
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.senderAddress !== undefined && (obj.senderAddress = message.senderAddress);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$senderDid, _object$amount, _object$bondDid8, _object$senderAddress;
    var message = createBaseMsgMakeOutcomePayment();
    message.senderDid = (_object$senderDid = object.senderDid) !== null && _object$senderDid !== void 0 ? _object$senderDid : "";
    message.amount = (_object$amount = object.amount) !== null && _object$amount !== void 0 ? _object$amount : "";
    message.bondDid = (_object$bondDid8 = object.bondDid) !== null && _object$bondDid8 !== void 0 ? _object$bondDid8 : "";
    message.senderAddress = (_object$senderAddress = object.senderAddress) !== null && _object$senderAddress !== void 0 ? _object$senderAddress : "";
    return message;
  }
};
function createBaseMsgMakeOutcomePaymentResponse() {
  return {};
}
var MsgMakeOutcomePaymentResponse = exports.MsgMakeOutcomePaymentResponse = {
  encode: function encode(_) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgMakeOutcomePaymentResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(_) {
    return {};
  },
  toJSON: function toJSON(_) {
    var obj = {};
    return obj;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseMsgMakeOutcomePaymentResponse();
    return message;
  }
};
function createBaseMsgWithdrawShare() {
  return {
    recipientDid: "",
    bondDid: "",
    recipientAddress: ""
  };
}
var MsgWithdrawShare = exports.MsgWithdrawShare = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.recipientDid !== "") {
      writer.uint32(10).string(message.recipientDid);
    }
    if (message.bondDid !== "") {
      writer.uint32(18).string(message.bondDid);
    }
    if (message.recipientAddress !== "") {
      writer.uint32(26).string(message.recipientAddress);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgWithdrawShare();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.recipientDid = reader.string();
          break;
        case 2:
          message.bondDid = reader.string();
          break;
        case 3:
          message.recipientAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      recipientDid: (0, _helpers.isSet)(object.recipientDid) ? String(object.recipientDid) : "",
      bondDid: (0, _helpers.isSet)(object.bondDid) ? String(object.bondDid) : "",
      recipientAddress: (0, _helpers.isSet)(object.recipientAddress) ? String(object.recipientAddress) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.recipientDid !== undefined && (obj.recipientDid = message.recipientDid);
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.recipientAddress !== undefined && (obj.recipientAddress = message.recipientAddress);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$recipientDid, _object$bondDid9, _object$recipientAddr;
    var message = createBaseMsgWithdrawShare();
    message.recipientDid = (_object$recipientDid = object.recipientDid) !== null && _object$recipientDid !== void 0 ? _object$recipientDid : "";
    message.bondDid = (_object$bondDid9 = object.bondDid) !== null && _object$bondDid9 !== void 0 ? _object$bondDid9 : "";
    message.recipientAddress = (_object$recipientAddr = object.recipientAddress) !== null && _object$recipientAddr !== void 0 ? _object$recipientAddr : "";
    return message;
  }
};
function createBaseMsgWithdrawShareResponse() {
  return {};
}
var MsgWithdrawShareResponse = exports.MsgWithdrawShareResponse = {
  encode: function encode(_) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgWithdrawShareResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(_) {
    return {};
  },
  toJSON: function toJSON(_) {
    var obj = {};
    return obj;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseMsgWithdrawShareResponse();
    return message;
  }
};
function createBaseMsgWithdrawReserve() {
  return {
    withdrawerDid: "",
    amount: [],
    bondDid: "",
    withdrawerAddress: ""
  };
}
var MsgWithdrawReserve = exports.MsgWithdrawReserve = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.withdrawerDid !== "") {
      writer.uint32(10).string(message.withdrawerDid);
    }
    var _iterator5 = _createForOfIteratorHelper(message.amount),
      _step5;
    try {
      for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
        var v = _step5.value;
        _coin.Coin.encode(v, writer.uint32(18).fork()).ldelim();
      }
    } catch (err) {
      _iterator5.e(err);
    } finally {
      _iterator5.f();
    }
    if (message.bondDid !== "") {
      writer.uint32(26).string(message.bondDid);
    }
    if (message.withdrawerAddress !== "") {
      writer.uint32(34).string(message.withdrawerAddress);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgWithdrawReserve();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.withdrawerDid = reader.string();
          break;
        case 2:
          message.amount.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 3:
          message.bondDid = reader.string();
          break;
        case 4:
          message.withdrawerAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      withdrawerDid: (0, _helpers.isSet)(object.withdrawerDid) ? String(object.withdrawerDid) : "",
      amount: Array.isArray(object === null || object === void 0 ? void 0 : object.amount) ? object.amount.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      bondDid: (0, _helpers.isSet)(object.bondDid) ? String(object.bondDid) : "",
      withdrawerAddress: (0, _helpers.isSet)(object.withdrawerAddress) ? String(object.withdrawerAddress) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.withdrawerDid !== undefined && (obj.withdrawerDid = message.withdrawerDid);
    if (message.amount) {
      obj.amount = message.amount.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.amount = [];
    }
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.withdrawerAddress !== undefined && (obj.withdrawerAddress = message.withdrawerAddress);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$withdrawerDid, _object$amount2, _object$bondDid0, _object$withdrawerAdd;
    var message = createBaseMsgWithdrawReserve();
    message.withdrawerDid = (_object$withdrawerDid = object.withdrawerDid) !== null && _object$withdrawerDid !== void 0 ? _object$withdrawerDid : "";
    message.amount = ((_object$amount2 = object.amount) === null || _object$amount2 === void 0 ? void 0 : _object$amount2.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.bondDid = (_object$bondDid0 = object.bondDid) !== null && _object$bondDid0 !== void 0 ? _object$bondDid0 : "";
    message.withdrawerAddress = (_object$withdrawerAdd = object.withdrawerAddress) !== null && _object$withdrawerAdd !== void 0 ? _object$withdrawerAdd : "";
    return message;
  }
};
function createBaseMsgWithdrawReserveResponse() {
  return {};
}
var MsgWithdrawReserveResponse = exports.MsgWithdrawReserveResponse = {
  encode: function encode(_) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseMsgWithdrawReserveResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(_) {
    return {};
  },
  toJSON: function toJSON(_) {
    var obj = {};
    return obj;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseMsgWithdrawReserveResponse();
    return message;
  }
};