"use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SwapOrder = exports.SellOrder = exports.Params = exports.FunctionParam = exports.BuyOrder = exports.BondDetails = exports.Bond = exports.Batch = exports.BaseOrder = void 0;
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
/**
 * FunctionParam is a key-value pair used for specifying a specific bond
 * parameter.
 */

/**
 * FunctionParam is a key-value pair used for specifying a specific bond
 * parameter.
 */

/** BondDetails contains details about the current state of a given bond. */

/** BondDetails contains details about the current state of a given bond. */

/** Bond defines a token bonding curve type with all of its parameters. */

/** Bond defines a token bonding curve type with all of its parameters. */

/**
 * BaseOrder defines a base order type. It contains all the necessary fields for
 * specifying the general details about a buy, sell, or swap order.
 */

/**
 * BaseOrder defines a base order type. It contains all the necessary fields for
 * specifying the general details about a buy, sell, or swap order.
 */

/**
 * BuyOrder defines a type for submitting a buy order on a bond, together with
 * the maximum amount of reserve tokens the buyer is willing to pay.
 */

/**
 * BuyOrder defines a type for submitting a buy order on a bond, together with
 * the maximum amount of reserve tokens the buyer is willing to pay.
 */

/** SellOrder defines a type for submitting a sell order on a bond. */

/** SellOrder defines a type for submitting a sell order on a bond. */

/**
 * SwapOrder defines a type for submitting a swap order between two tokens on a
 * bond.
 */

/**
 * SwapOrder defines a type for submitting a swap order between two tokens on a
 * bond.
 */

/**
 * Batch holds a collection of outstanding buy, sell, and swap orders on a
 * particular bond.
 */

/**
 * Batch holds a collection of outstanding buy, sell, and swap orders on a
 * particular bond.
 */

/** Params defines the parameters for the bonds module. */

/** Params defines the parameters for the bonds module. */

function createBaseFunctionParam() {
  return {
    param: "",
    value: ""
  };
}
var FunctionParam = exports.FunctionParam = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.param !== "") {
      writer.uint32(10).string(message.param);
    }
    if (message.value !== "") {
      writer.uint32(18).string(message.value);
    }
    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 = createBaseFunctionParam();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.param = reader.string();
          break;
        case 2:
          message.value = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      param: (0, _helpers.isSet)(object.param) ? String(object.param) : "",
      value: (0, _helpers.isSet)(object.value) ? String(object.value) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.param !== undefined && (obj.param = message.param);
    message.value !== undefined && (obj.value = message.value);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$param, _object$value;
    var message = createBaseFunctionParam();
    message.param = (_object$param = object.param) !== null && _object$param !== void 0 ? _object$param : "";
    message.value = (_object$value = object.value) !== null && _object$value !== void 0 ? _object$value : "";
    return message;
  }
};
function createBaseBondDetails() {
  return {
    bondDid: "",
    spotPrice: [],
    supply: undefined,
    reserve: []
  };
}
var BondDetails = exports.BondDetails = {
  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);
    }
    var _iterator = _createForOfIteratorHelper(message.spotPrice),
      _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var v = _step.value;
        _coin.DecCoin.encode(v, writer.uint32(18).fork()).ldelim();
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
    if (message.supply !== undefined) {
      _coin.Coin.encode(message.supply, writer.uint32(26).fork()).ldelim();
    }
    var _iterator2 = _createForOfIteratorHelper(message.reserve),
      _step2;
    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var _v = _step2.value;
        _coin.Coin.encode(_v, writer.uint32(34).fork()).ldelim();
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }
    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 = createBaseBondDetails();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = reader.string();
          break;
        case 2:
          message.spotPrice.push(_coin.DecCoin.decode(reader, reader.uint32()));
          break;
        case 3:
          message.supply = _coin.Coin.decode(reader, reader.uint32());
          break;
        case 4:
          message.reserve.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      bondDid: (0, _helpers.isSet)(object.bondDid) ? String(object.bondDid) : "",
      spotPrice: Array.isArray(object === null || object === void 0 ? void 0 : object.spotPrice) ? object.spotPrice.map(function (e) {
        return _coin.DecCoin.fromJSON(e);
      }) : [],
      supply: (0, _helpers.isSet)(object.supply) ? _coin.Coin.fromJSON(object.supply) : undefined,
      reserve: Array.isArray(object === null || object === void 0 ? void 0 : object.reserve) ? object.reserve.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    if (message.spotPrice) {
      obj.spotPrice = message.spotPrice.map(function (e) {
        return e ? _coin.DecCoin.toJSON(e) : undefined;
      });
    } else {
      obj.spotPrice = [];
    }
    message.supply !== undefined && (obj.supply = message.supply ? _coin.Coin.toJSON(message.supply) : undefined);
    if (message.reserve) {
      obj.reserve = message.reserve.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.reserve = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid, _object$spotPrice, _object$reserve;
    var message = createBaseBondDetails();
    message.bondDid = (_object$bondDid = object.bondDid) !== null && _object$bondDid !== void 0 ? _object$bondDid : "";
    message.spotPrice = ((_object$spotPrice = object.spotPrice) === null || _object$spotPrice === void 0 ? void 0 : _object$spotPrice.map(function (e) {
      return _coin.DecCoin.fromPartial(e);
    })) || [];
    message.supply = object.supply !== undefined && object.supply !== null ? _coin.Coin.fromPartial(object.supply) : undefined;
    message.reserve = ((_object$reserve = object.reserve) === null || _object$reserve === void 0 ? void 0 : _object$reserve.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseBond() {
  return {
    token: "",
    name: "",
    description: "",
    creatorDid: "",
    controllerDid: "",
    functionType: "",
    functionParameters: [],
    reserveTokens: [],
    txFeePercentage: "",
    exitFeePercentage: "",
    feeAddress: "",
    reserveWithdrawalAddress: "",
    maxSupply: undefined,
    orderQuantityLimits: [],
    sanityRate: "",
    sanityMarginPercentage: "",
    currentSupply: undefined,
    currentReserve: [],
    availableReserve: [],
    currentOutcomePaymentReserve: [],
    allowSells: false,
    allowReserveWithdrawals: false,
    alphaBond: false,
    batchBlocks: "",
    outcomePayment: "",
    state: "",
    bondDid: "",
    oracleDid: ""
  };
}
var Bond = exports.Bond = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.token !== "") {
      writer.uint32(10).string(message.token);
    }
    if (message.name !== "") {
      writer.uint32(18).string(message.name);
    }
    if (message.description !== "") {
      writer.uint32(26).string(message.description);
    }
    if (message.creatorDid !== "") {
      writer.uint32(34).string(message.creatorDid);
    }
    if (message.controllerDid !== "") {
      writer.uint32(42).string(message.controllerDid);
    }
    if (message.functionType !== "") {
      writer.uint32(50).string(message.functionType);
    }
    var _iterator3 = _createForOfIteratorHelper(message.functionParameters),
      _step3;
    try {
      for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
        var v = _step3.value;
        FunctionParam.encode(v, writer.uint32(58).fork()).ldelim();
      }
    } catch (err) {
      _iterator3.e(err);
    } finally {
      _iterator3.f();
    }
    var _iterator4 = _createForOfIteratorHelper(message.reserveTokens),
      _step4;
    try {
      for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
        var _v2 = _step4.value;
        writer.uint32(66).string(_v2);
      }
    } catch (err) {
      _iterator4.e(err);
    } finally {
      _iterator4.f();
    }
    if (message.txFeePercentage !== "") {
      writer.uint32(74).string(message.txFeePercentage);
    }
    if (message.exitFeePercentage !== "") {
      writer.uint32(82).string(message.exitFeePercentage);
    }
    if (message.feeAddress !== "") {
      writer.uint32(90).string(message.feeAddress);
    }
    if (message.reserveWithdrawalAddress !== "") {
      writer.uint32(98).string(message.reserveWithdrawalAddress);
    }
    if (message.maxSupply !== undefined) {
      _coin.Coin.encode(message.maxSupply, writer.uint32(106).fork()).ldelim();
    }
    var _iterator5 = _createForOfIteratorHelper(message.orderQuantityLimits),
      _step5;
    try {
      for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
        var _v3 = _step5.value;
        _coin.Coin.encode(_v3, writer.uint32(114).fork()).ldelim();
      }
    } catch (err) {
      _iterator5.e(err);
    } finally {
      _iterator5.f();
    }
    if (message.sanityRate !== "") {
      writer.uint32(122).string(message.sanityRate);
    }
    if (message.sanityMarginPercentage !== "") {
      writer.uint32(130).string(message.sanityMarginPercentage);
    }
    if (message.currentSupply !== undefined) {
      _coin.Coin.encode(message.currentSupply, writer.uint32(138).fork()).ldelim();
    }
    var _iterator6 = _createForOfIteratorHelper(message.currentReserve),
      _step6;
    try {
      for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
        var _v4 = _step6.value;
        _coin.Coin.encode(_v4, writer.uint32(146).fork()).ldelim();
      }
    } catch (err) {
      _iterator6.e(err);
    } finally {
      _iterator6.f();
    }
    var _iterator7 = _createForOfIteratorHelper(message.availableReserve),
      _step7;
    try {
      for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
        var _v5 = _step7.value;
        _coin.Coin.encode(_v5, writer.uint32(154).fork()).ldelim();
      }
    } catch (err) {
      _iterator7.e(err);
    } finally {
      _iterator7.f();
    }
    var _iterator8 = _createForOfIteratorHelper(message.currentOutcomePaymentReserve),
      _step8;
    try {
      for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
        var _v6 = _step8.value;
        _coin.Coin.encode(_v6, writer.uint32(162).fork()).ldelim();
      }
    } catch (err) {
      _iterator8.e(err);
    } finally {
      _iterator8.f();
    }
    if (message.allowSells === true) {
      writer.uint32(168).bool(message.allowSells);
    }
    if (message.allowReserveWithdrawals === true) {
      writer.uint32(176).bool(message.allowReserveWithdrawals);
    }
    if (message.alphaBond === true) {
      writer.uint32(184).bool(message.alphaBond);
    }
    if (message.batchBlocks !== "") {
      writer.uint32(194).string(message.batchBlocks);
    }
    if (message.outcomePayment !== "") {
      writer.uint32(202).string(message.outcomePayment);
    }
    if (message.state !== "") {
      writer.uint32(210).string(message.state);
    }
    if (message.bondDid !== "") {
      writer.uint32(218).string(message.bondDid);
    }
    if (message.oracleDid !== "") {
      writer.uint32(226).string(message.oracleDid);
    }
    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 = createBaseBond();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.token = reader.string();
          break;
        case 2:
          message.name = reader.string();
          break;
        case 3:
          message.description = reader.string();
          break;
        case 4:
          message.creatorDid = reader.string();
          break;
        case 5:
          message.controllerDid = reader.string();
          break;
        case 6:
          message.functionType = reader.string();
          break;
        case 7:
          message.functionParameters.push(FunctionParam.decode(reader, reader.uint32()));
          break;
        case 8:
          message.reserveTokens.push(reader.string());
          break;
        case 9:
          message.txFeePercentage = reader.string();
          break;
        case 10:
          message.exitFeePercentage = reader.string();
          break;
        case 11:
          message.feeAddress = reader.string();
          break;
        case 12:
          message.reserveWithdrawalAddress = reader.string();
          break;
        case 13:
          message.maxSupply = _coin.Coin.decode(reader, reader.uint32());
          break;
        case 14:
          message.orderQuantityLimits.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 15:
          message.sanityRate = reader.string();
          break;
        case 16:
          message.sanityMarginPercentage = reader.string();
          break;
        case 17:
          message.currentSupply = _coin.Coin.decode(reader, reader.uint32());
          break;
        case 18:
          message.currentReserve.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 19:
          message.availableReserve.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 20:
          message.currentOutcomePaymentReserve.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 21:
          message.allowSells = reader.bool();
          break;
        case 22:
          message.allowReserveWithdrawals = reader.bool();
          break;
        case 23:
          message.alphaBond = reader.bool();
          break;
        case 24:
          message.batchBlocks = reader.string();
          break;
        case 25:
          message.outcomePayment = reader.string();
          break;
        case 26:
          message.state = reader.string();
          break;
        case 27:
          message.bondDid = reader.string();
          break;
        case 28:
          message.oracleDid = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      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) : "",
      creatorDid: (0, _helpers.isSet)(object.creatorDid) ? String(object.creatorDid) : "",
      controllerDid: (0, _helpers.isSet)(object.controllerDid) ? String(object.controllerDid) : "",
      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 FunctionParam.fromJSON(e);
      }) : [],
      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) : "",
      currentSupply: (0, _helpers.isSet)(object.currentSupply) ? _coin.Coin.fromJSON(object.currentSupply) : undefined,
      currentReserve: Array.isArray(object === null || object === void 0 ? void 0 : object.currentReserve) ? object.currentReserve.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      availableReserve: Array.isArray(object === null || object === void 0 ? void 0 : object.availableReserve) ? object.availableReserve.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      currentOutcomePaymentReserve: Array.isArray(object === null || object === void 0 ? void 0 : object.currentOutcomePaymentReserve) ? object.currentOutcomePaymentReserve.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      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) : "",
      state: (0, _helpers.isSet)(object.state) ? String(object.state) : "",
      bondDid: (0, _helpers.isSet)(object.bondDid) ? String(object.bondDid) : "",
      oracleDid: (0, _helpers.isSet)(object.oracleDid) ? String(object.oracleDid) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.token !== undefined && (obj.token = message.token);
    message.name !== undefined && (obj.name = message.name);
    message.description !== undefined && (obj.description = message.description);
    message.creatorDid !== undefined && (obj.creatorDid = message.creatorDid);
    message.controllerDid !== undefined && (obj.controllerDid = message.controllerDid);
    message.functionType !== undefined && (obj.functionType = message.functionType);
    if (message.functionParameters) {
      obj.functionParameters = message.functionParameters.map(function (e) {
        return e ? FunctionParam.toJSON(e) : undefined;
      });
    } else {
      obj.functionParameters = [];
    }
    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.currentSupply !== undefined && (obj.currentSupply = message.currentSupply ? _coin.Coin.toJSON(message.currentSupply) : undefined);
    if (message.currentReserve) {
      obj.currentReserve = message.currentReserve.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.currentReserve = [];
    }
    if (message.availableReserve) {
      obj.availableReserve = message.availableReserve.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.availableReserve = [];
    }
    if (message.currentOutcomePaymentReserve) {
      obj.currentOutcomePaymentReserve = message.currentOutcomePaymentReserve.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.currentOutcomePaymentReserve = [];
    }
    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.state !== undefined && (obj.state = message.state);
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.oracleDid !== undefined && (obj.oracleDid = message.oracleDid);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$token, _object$name, _object$description, _object$creatorDid, _object$controllerDid, _object$functionType, _object$functionParam, _object$reserveTokens, _object$txFeePercenta, _object$exitFeePercen, _object$feeAddress, _object$reserveWithdr, _object$orderQuantity, _object$sanityRate, _object$sanityMarginP, _object$currentReserv, _object$availableRese, _object$currentOutcom, _object$allowSells, _object$allowReserveW, _object$alphaBond, _object$batchBlocks, _object$outcomePaymen, _object$state, _object$bondDid2, _object$oracleDid;
    var message = createBaseBond();
    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.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.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 FunctionParam.fromPartial(e);
    })) || [];
    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.currentSupply = object.currentSupply !== undefined && object.currentSupply !== null ? _coin.Coin.fromPartial(object.currentSupply) : undefined;
    message.currentReserve = ((_object$currentReserv = object.currentReserve) === null || _object$currentReserv === void 0 ? void 0 : _object$currentReserv.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.availableReserve = ((_object$availableRese = object.availableReserve) === null || _object$availableRese === void 0 ? void 0 : _object$availableRese.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.currentOutcomePaymentReserve = ((_object$currentOutcom = object.currentOutcomePaymentReserve) === null || _object$currentOutcom === void 0 ? void 0 : _object$currentOutcom.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    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.state = (_object$state = object.state) !== null && _object$state !== void 0 ? _object$state : "";
    message.bondDid = (_object$bondDid2 = object.bondDid) !== null && _object$bondDid2 !== void 0 ? _object$bondDid2 : "";
    message.oracleDid = (_object$oracleDid = object.oracleDid) !== null && _object$oracleDid !== void 0 ? _object$oracleDid : "";
    return message;
  }
};
function createBaseBaseOrder() {
  return {
    accountDid: "",
    amount: undefined,
    cancelled: false,
    cancelReason: ""
  };
}
var BaseOrder = exports.BaseOrder = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.accountDid !== "") {
      writer.uint32(10).string(message.accountDid);
    }
    if (message.amount !== undefined) {
      _coin.Coin.encode(message.amount, writer.uint32(18).fork()).ldelim();
    }
    if (message.cancelled === true) {
      writer.uint32(24).bool(message.cancelled);
    }
    if (message.cancelReason !== "") {
      writer.uint32(34).string(message.cancelReason);
    }
    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 = createBaseBaseOrder();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.accountDid = reader.string();
          break;
        case 2:
          message.amount = _coin.Coin.decode(reader, reader.uint32());
          break;
        case 3:
          message.cancelled = reader.bool();
          break;
        case 4:
          message.cancelReason = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      accountDid: (0, _helpers.isSet)(object.accountDid) ? String(object.accountDid) : "",
      amount: (0, _helpers.isSet)(object.amount) ? _coin.Coin.fromJSON(object.amount) : undefined,
      cancelled: (0, _helpers.isSet)(object.cancelled) ? Boolean(object.cancelled) : false,
      cancelReason: (0, _helpers.isSet)(object.cancelReason) ? String(object.cancelReason) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.accountDid !== undefined && (obj.accountDid = message.accountDid);
    message.amount !== undefined && (obj.amount = message.amount ? _coin.Coin.toJSON(message.amount) : undefined);
    message.cancelled !== undefined && (obj.cancelled = message.cancelled);
    message.cancelReason !== undefined && (obj.cancelReason = message.cancelReason);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$accountDid, _object$cancelled, _object$cancelReason;
    var message = createBaseBaseOrder();
    message.accountDid = (_object$accountDid = object.accountDid) !== null && _object$accountDid !== void 0 ? _object$accountDid : "";
    message.amount = object.amount !== undefined && object.amount !== null ? _coin.Coin.fromPartial(object.amount) : undefined;
    message.cancelled = (_object$cancelled = object.cancelled) !== null && _object$cancelled !== void 0 ? _object$cancelled : false;
    message.cancelReason = (_object$cancelReason = object.cancelReason) !== null && _object$cancelReason !== void 0 ? _object$cancelReason : "";
    return message;
  }
};
function createBaseBuyOrder() {
  return {
    baseOrder: undefined,
    maxPrices: []
  };
}
var BuyOrder = exports.BuyOrder = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.baseOrder !== undefined) {
      BaseOrder.encode(message.baseOrder, writer.uint32(10).fork()).ldelim();
    }
    var _iterator9 = _createForOfIteratorHelper(message.maxPrices),
      _step9;
    try {
      for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
        var v = _step9.value;
        _coin.Coin.encode(v, writer.uint32(18).fork()).ldelim();
      }
    } catch (err) {
      _iterator9.e(err);
    } finally {
      _iterator9.f();
    }
    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 = createBaseBuyOrder();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.baseOrder = BaseOrder.decode(reader, reader.uint32());
          break;
        case 2:
          message.maxPrices.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      baseOrder: (0, _helpers.isSet)(object.baseOrder) ? BaseOrder.fromJSON(object.baseOrder) : undefined,
      maxPrices: Array.isArray(object === null || object === void 0 ? void 0 : object.maxPrices) ? object.maxPrices.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.baseOrder !== undefined && (obj.baseOrder = message.baseOrder ? BaseOrder.toJSON(message.baseOrder) : undefined);
    if (message.maxPrices) {
      obj.maxPrices = message.maxPrices.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.maxPrices = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$maxPrices;
    var message = createBaseBuyOrder();
    message.baseOrder = object.baseOrder !== undefined && object.baseOrder !== null ? BaseOrder.fromPartial(object.baseOrder) : undefined;
    message.maxPrices = ((_object$maxPrices = object.maxPrices) === null || _object$maxPrices === void 0 ? void 0 : _object$maxPrices.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseSellOrder() {
  return {
    baseOrder: undefined
  };
}
var SellOrder = exports.SellOrder = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.baseOrder !== undefined) {
      BaseOrder.encode(message.baseOrder, writer.uint32(10).fork()).ldelim();
    }
    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 = createBaseSellOrder();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.baseOrder = BaseOrder.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      baseOrder: (0, _helpers.isSet)(object.baseOrder) ? BaseOrder.fromJSON(object.baseOrder) : undefined
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.baseOrder !== undefined && (obj.baseOrder = message.baseOrder ? BaseOrder.toJSON(message.baseOrder) : undefined);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseSellOrder();
    message.baseOrder = object.baseOrder !== undefined && object.baseOrder !== null ? BaseOrder.fromPartial(object.baseOrder) : undefined;
    return message;
  }
};
function createBaseSwapOrder() {
  return {
    baseOrder: undefined,
    toToken: ""
  };
}
var SwapOrder = exports.SwapOrder = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.baseOrder !== undefined) {
      BaseOrder.encode(message.baseOrder, writer.uint32(10).fork()).ldelim();
    }
    if (message.toToken !== "") {
      writer.uint32(18).string(message.toToken);
    }
    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 = createBaseSwapOrder();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.baseOrder = BaseOrder.decode(reader, reader.uint32());
          break;
        case 2:
          message.toToken = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      baseOrder: (0, _helpers.isSet)(object.baseOrder) ? BaseOrder.fromJSON(object.baseOrder) : undefined,
      toToken: (0, _helpers.isSet)(object.toToken) ? String(object.toToken) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.baseOrder !== undefined && (obj.baseOrder = message.baseOrder ? BaseOrder.toJSON(message.baseOrder) : undefined);
    message.toToken !== undefined && (obj.toToken = message.toToken);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$toToken;
    var message = createBaseSwapOrder();
    message.baseOrder = object.baseOrder !== undefined && object.baseOrder !== null ? BaseOrder.fromPartial(object.baseOrder) : undefined;
    message.toToken = (_object$toToken = object.toToken) !== null && _object$toToken !== void 0 ? _object$toToken : "";
    return message;
  }
};
function createBaseBatch() {
  return {
    bondDid: "",
    blocksRemaining: "",
    nextPublicAlpha: "",
    totalBuyAmount: undefined,
    totalSellAmount: undefined,
    buyPrices: [],
    sellPrices: [],
    buys: [],
    sells: [],
    swaps: []
  };
}
var Batch = exports.Batch = {
  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.blocksRemaining !== "") {
      writer.uint32(18).string(message.blocksRemaining);
    }
    if (message.nextPublicAlpha !== "") {
      writer.uint32(26).string(message.nextPublicAlpha);
    }
    if (message.totalBuyAmount !== undefined) {
      _coin.Coin.encode(message.totalBuyAmount, writer.uint32(34).fork()).ldelim();
    }
    if (message.totalSellAmount !== undefined) {
      _coin.Coin.encode(message.totalSellAmount, writer.uint32(42).fork()).ldelim();
    }
    var _iterator0 = _createForOfIteratorHelper(message.buyPrices),
      _step0;
    try {
      for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
        var v = _step0.value;
        _coin.DecCoin.encode(v, writer.uint32(50).fork()).ldelim();
      }
    } catch (err) {
      _iterator0.e(err);
    } finally {
      _iterator0.f();
    }
    var _iterator1 = _createForOfIteratorHelper(message.sellPrices),
      _step1;
    try {
      for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
        var _v7 = _step1.value;
        _coin.DecCoin.encode(_v7, writer.uint32(58).fork()).ldelim();
      }
    } catch (err) {
      _iterator1.e(err);
    } finally {
      _iterator1.f();
    }
    var _iterator10 = _createForOfIteratorHelper(message.buys),
      _step10;
    try {
      for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
        var _v8 = _step10.value;
        BuyOrder.encode(_v8, writer.uint32(66).fork()).ldelim();
      }
    } catch (err) {
      _iterator10.e(err);
    } finally {
      _iterator10.f();
    }
    var _iterator11 = _createForOfIteratorHelper(message.sells),
      _step11;
    try {
      for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
        var _v9 = _step11.value;
        SellOrder.encode(_v9, writer.uint32(74).fork()).ldelim();
      }
    } catch (err) {
      _iterator11.e(err);
    } finally {
      _iterator11.f();
    }
    var _iterator12 = _createForOfIteratorHelper(message.swaps),
      _step12;
    try {
      for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
        var _v0 = _step12.value;
        SwapOrder.encode(_v0, writer.uint32(82).fork()).ldelim();
      }
    } catch (err) {
      _iterator12.e(err);
    } finally {
      _iterator12.f();
    }
    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 = createBaseBatch();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = reader.string();
          break;
        case 2:
          message.blocksRemaining = reader.string();
          break;
        case 3:
          message.nextPublicAlpha = reader.string();
          break;
        case 4:
          message.totalBuyAmount = _coin.Coin.decode(reader, reader.uint32());
          break;
        case 5:
          message.totalSellAmount = _coin.Coin.decode(reader, reader.uint32());
          break;
        case 6:
          message.buyPrices.push(_coin.DecCoin.decode(reader, reader.uint32()));
          break;
        case 7:
          message.sellPrices.push(_coin.DecCoin.decode(reader, reader.uint32()));
          break;
        case 8:
          message.buys.push(BuyOrder.decode(reader, reader.uint32()));
          break;
        case 9:
          message.sells.push(SellOrder.decode(reader, reader.uint32()));
          break;
        case 10:
          message.swaps.push(SwapOrder.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      bondDid: (0, _helpers.isSet)(object.bondDid) ? String(object.bondDid) : "",
      blocksRemaining: (0, _helpers.isSet)(object.blocksRemaining) ? String(object.blocksRemaining) : "",
      nextPublicAlpha: (0, _helpers.isSet)(object.nextPublicAlpha) ? String(object.nextPublicAlpha) : "",
      totalBuyAmount: (0, _helpers.isSet)(object.totalBuyAmount) ? _coin.Coin.fromJSON(object.totalBuyAmount) : undefined,
      totalSellAmount: (0, _helpers.isSet)(object.totalSellAmount) ? _coin.Coin.fromJSON(object.totalSellAmount) : undefined,
      buyPrices: Array.isArray(object === null || object === void 0 ? void 0 : object.buyPrices) ? object.buyPrices.map(function (e) {
        return _coin.DecCoin.fromJSON(e);
      }) : [],
      sellPrices: Array.isArray(object === null || object === void 0 ? void 0 : object.sellPrices) ? object.sellPrices.map(function (e) {
        return _coin.DecCoin.fromJSON(e);
      }) : [],
      buys: Array.isArray(object === null || object === void 0 ? void 0 : object.buys) ? object.buys.map(function (e) {
        return BuyOrder.fromJSON(e);
      }) : [],
      sells: Array.isArray(object === null || object === void 0 ? void 0 : object.sells) ? object.sells.map(function (e) {
        return SellOrder.fromJSON(e);
      }) : [],
      swaps: Array.isArray(object === null || object === void 0 ? void 0 : object.swaps) ? object.swaps.map(function (e) {
        return SwapOrder.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.blocksRemaining !== undefined && (obj.blocksRemaining = message.blocksRemaining);
    message.nextPublicAlpha !== undefined && (obj.nextPublicAlpha = message.nextPublicAlpha);
    message.totalBuyAmount !== undefined && (obj.totalBuyAmount = message.totalBuyAmount ? _coin.Coin.toJSON(message.totalBuyAmount) : undefined);
    message.totalSellAmount !== undefined && (obj.totalSellAmount = message.totalSellAmount ? _coin.Coin.toJSON(message.totalSellAmount) : undefined);
    if (message.buyPrices) {
      obj.buyPrices = message.buyPrices.map(function (e) {
        return e ? _coin.DecCoin.toJSON(e) : undefined;
      });
    } else {
      obj.buyPrices = [];
    }
    if (message.sellPrices) {
      obj.sellPrices = message.sellPrices.map(function (e) {
        return e ? _coin.DecCoin.toJSON(e) : undefined;
      });
    } else {
      obj.sellPrices = [];
    }
    if (message.buys) {
      obj.buys = message.buys.map(function (e) {
        return e ? BuyOrder.toJSON(e) : undefined;
      });
    } else {
      obj.buys = [];
    }
    if (message.sells) {
      obj.sells = message.sells.map(function (e) {
        return e ? SellOrder.toJSON(e) : undefined;
      });
    } else {
      obj.sells = [];
    }
    if (message.swaps) {
      obj.swaps = message.swaps.map(function (e) {
        return e ? SwapOrder.toJSON(e) : undefined;
      });
    } else {
      obj.swaps = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid3, _object$blocksRemaini, _object$nextPublicAlp, _object$buyPrices, _object$sellPrices, _object$buys, _object$sells, _object$swaps;
    var message = createBaseBatch();
    message.bondDid = (_object$bondDid3 = object.bondDid) !== null && _object$bondDid3 !== void 0 ? _object$bondDid3 : "";
    message.blocksRemaining = (_object$blocksRemaini = object.blocksRemaining) !== null && _object$blocksRemaini !== void 0 ? _object$blocksRemaini : "";
    message.nextPublicAlpha = (_object$nextPublicAlp = object.nextPublicAlpha) !== null && _object$nextPublicAlp !== void 0 ? _object$nextPublicAlp : "";
    message.totalBuyAmount = object.totalBuyAmount !== undefined && object.totalBuyAmount !== null ? _coin.Coin.fromPartial(object.totalBuyAmount) : undefined;
    message.totalSellAmount = object.totalSellAmount !== undefined && object.totalSellAmount !== null ? _coin.Coin.fromPartial(object.totalSellAmount) : undefined;
    message.buyPrices = ((_object$buyPrices = object.buyPrices) === null || _object$buyPrices === void 0 ? void 0 : _object$buyPrices.map(function (e) {
      return _coin.DecCoin.fromPartial(e);
    })) || [];
    message.sellPrices = ((_object$sellPrices = object.sellPrices) === null || _object$sellPrices === void 0 ? void 0 : _object$sellPrices.map(function (e) {
      return _coin.DecCoin.fromPartial(e);
    })) || [];
    message.buys = ((_object$buys = object.buys) === null || _object$buys === void 0 ? void 0 : _object$buys.map(function (e) {
      return BuyOrder.fromPartial(e);
    })) || [];
    message.sells = ((_object$sells = object.sells) === null || _object$sells === void 0 ? void 0 : _object$sells.map(function (e) {
      return SellOrder.fromPartial(e);
    })) || [];
    message.swaps = ((_object$swaps = object.swaps) === null || _object$swaps === void 0 ? void 0 : _object$swaps.map(function (e) {
      return SwapOrder.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseParams() {
  return {
    reservedBondTokens: []
  };
}
var Params = exports.Params = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    var _iterator13 = _createForOfIteratorHelper(message.reservedBondTokens),
      _step13;
    try {
      for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
        var v = _step13.value;
        writer.uint32(10).string(v);
      }
    } catch (err) {
      _iterator13.e(err);
    } finally {
      _iterator13.f();
    }
    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 = createBaseParams();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.reservedBondTokens.push(reader.string());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      reservedBondTokens: Array.isArray(object === null || object === void 0 ? void 0 : object.reservedBondTokens) ? object.reservedBondTokens.map(function (e) {
        return String(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    if (message.reservedBondTokens) {
      obj.reservedBondTokens = message.reservedBondTokens.map(function (e) {
        return e;
      });
    } else {
      obj.reservedBondTokens = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$reservedBondT;
    var message = createBaseParams();
    message.reservedBondTokens = ((_object$reservedBondT = object.reservedBondTokens) === null || _object$reservedBondT === void 0 ? void 0 : _object$reservedBondT.map(function (e) {
      return e;
    })) || [];
    return message;
  }
};