"use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.QuerySwapReturnResponse = exports.QuerySwapReturnRequest = exports.QuerySellReturnResponse = exports.QuerySellReturnRequest = exports.QueryParamsResponse = exports.QueryParamsRequest = exports.QueryLastBatchResponse = exports.QueryLastBatchRequest = exports.QueryCustomPriceResponse = exports.QueryCustomPriceRequest = exports.QueryCurrentReserveResponse = exports.QueryCurrentReserveRequest = exports.QueryCurrentPriceResponse = exports.QueryCurrentPriceRequest = exports.QueryBuyPriceResponse = exports.QueryBuyPriceRequest = exports.QueryBondsResponse = exports.QueryBondsRequest = exports.QueryBondsDetailedResponse = exports.QueryBondsDetailedRequest = exports.QueryBondResponse = exports.QueryBondRequest = exports.QueryBatchResponse = exports.QueryBatchRequest = exports.QueryAvailableReserveResponse = exports.QueryAvailableReserveRequest = exports.QueryAlphaMaximumsResponse = exports.QueryAlphaMaximumsRequest = 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
/** QueryBondsRequest is the request type for the Query/Bonds RPC method. */

/** QueryBondsRequest is the request type for the Query/Bonds RPC method. */

/** QueryBondsResponse is the response type for the Query/Bonds RPC method. */

/** QueryBondsResponse is the response type for the Query/Bonds RPC method. */

/**
 * QueryBondsDetailedRequest is the request type for the Query/BondsDetailed RPC
 * method.
 */

/**
 * QueryBondsDetailedRequest is the request type for the Query/BondsDetailed RPC
 * method.
 */

/**
 * QueryBondsDetailedResponse is the response type for the Query/BondsDetailed
 * RPC method.
 */

/**
 * QueryBondsDetailedResponse is the response type for the Query/BondsDetailed
 * RPC method.
 */

/** QueryBondRequest is the request type for the Query/Bond RPC method. */

/** QueryBondRequest is the request type for the Query/Bond RPC method. */

/** QueryBondResponse is the response type for the Query/Bond RPC method. */

/** QueryBondResponse is the response type for the Query/Bond RPC method. */

/** QueryBatchRequest is the request type for the Query/Batch RPC method. */

/** QueryBatchRequest is the request type for the Query/Batch RPC method. */

/** QueryBatchResponse is the response type for the Query/Batch RPC method. */

/** QueryBatchResponse is the response type for the Query/Batch RPC method. */

/** QueryLastBatchRequest is the request type for the Query/LastBatch RPC method. */

/** QueryLastBatchRequest is the request type for the Query/LastBatch RPC method. */

/**
 * QueryLastBatchResponse is the response type for the Query/LastBatch RPC
 * method.
 */

/**
 * QueryLastBatchResponse is the response type for the Query/LastBatch RPC
 * method.
 */

/**
 * QueryCurrentPriceRequest is the request type for the Query/CurrentPrice RPC
 * method.
 */

/**
 * QueryCurrentPriceRequest is the request type for the Query/CurrentPrice RPC
 * method.
 */

/**
 * QueryCurrentPriceResponse is the response type for the Query/CurrentPrice RPC
 * method.
 */

/**
 * QueryCurrentPriceResponse is the response type for the Query/CurrentPrice RPC
 * method.
 */

/**
 * QueryCurrentReserveRequest is the request type for the Query/CurrentReserve
 * RPC method.
 */

/**
 * QueryCurrentReserveRequest is the request type for the Query/CurrentReserve
 * RPC method.
 */

/**
 * QueryCurrentReserveResponse is the response type for the Query/CurrentReserve
 * RPC method.
 */

/**
 * QueryCurrentReserveResponse is the response type for the Query/CurrentReserve
 * RPC method.
 */

/**
 * QueryAvailableReserveRequest is the request type for the
 * Query/AvailableReserve RPC method.
 */

/**
 * QueryAvailableReserveRequest is the request type for the
 * Query/AvailableReserve RPC method.
 */

/**
 * QueryAvailableReserveResponse is the response type for the
 * Query/AvailableReserve RPC method.
 */

/**
 * QueryAvailableReserveResponse is the response type for the
 * Query/AvailableReserve RPC method.
 */

/**
 * QueryCustomPriceRequest is the request type for the Query/CustomPrice RPC
 * method.
 */

/**
 * QueryCustomPriceRequest is the request type for the Query/CustomPrice RPC
 * method.
 */

/**
 * QueryCustomPriceResponse is the response type for the Query/CustomPrice RPC
 * method.
 */

/**
 * QueryCustomPriceResponse is the response type for the Query/CustomPrice RPC
 * method.
 */

/**
 * QueryCustomPriceRequest is the request type for the Query/BuyPrice RPC
 * method.
 */

/**
 * QueryCustomPriceRequest is the request type for the Query/BuyPrice RPC
 * method.
 */

/**
 * QueryCustomPriceResponse is the response type for the Query/BuyPrice RPC
 * method.
 */

/**
 * QueryCustomPriceResponse is the response type for the Query/BuyPrice RPC
 * method.
 */

/**
 * QuerySellReturnRequest is the request type for the Query/SellReturn RPC
 * method.
 */

/**
 * QuerySellReturnRequest is the request type for the Query/SellReturn RPC
 * method.
 */

/**
 * QuerySellReturnResponse is the response type for the Query/SellReturn RPC
 * method.
 */

/**
 * QuerySellReturnResponse is the response type for the Query/SellReturn RPC
 * method.
 */

/**
 * QuerySwapReturnRequest is the request type for the Query/SwapReturn RPC
 * method.
 */

/**
 * QuerySwapReturnRequest is the request type for the Query/SwapReturn RPC
 * method.
 */

/**
 * QuerySwapReturnResponse is the response type for the Query/SwapReturn RPC
 * method.
 */

/**
 * QuerySwapReturnResponse is the response type for the Query/SwapReturn RPC
 * method.
 */

/**
 * QueryAlphaMaximumsRequest is the request type for the Query/AlphaMaximums RPC
 * method.
 */

/**
 * QueryAlphaMaximumsRequest is the request type for the Query/AlphaMaximums RPC
 * method.
 */

/**
 * QueryAlphaMaximumsResponse is the response type for the Query/AlphaMaximums
 * RPC method.
 */

/**
 * QueryAlphaMaximumsResponse is the response type for the Query/AlphaMaximums
 * RPC method.
 */

/** QueryParamsRequest is the request type for the Query/Params RPC method. */

/** QueryParamsRequest is the request type for the Query/Params RPC method. */

/** QueryParamsResponse is the response type for the Query/Params RPC method. */

/** QueryParamsResponse is the response type for the Query/Params RPC method. */

function createBaseQueryBondsRequest() {
  return {};
}
var QueryBondsRequest = exports.QueryBondsRequest = {
  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 = createBaseQueryBondsRequest();
    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 = createBaseQueryBondsRequest();
    return message;
  }
};
function createBaseQueryBondsResponse() {
  return {
    bonds: []
  };
}
var QueryBondsResponse = exports.QueryBondsResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    var _iterator = _createForOfIteratorHelper(message.bonds),
      _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var v = _step.value;
        writer.uint32(10).string(v);
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.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 = createBaseQueryBondsResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bonds.push(reader.string());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      bonds: Array.isArray(object === null || object === void 0 ? void 0 : object.bonds) ? object.bonds.map(function (e) {
        return String(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    if (message.bonds) {
      obj.bonds = message.bonds.map(function (e) {
        return e;
      });
    } else {
      obj.bonds = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bonds;
    var message = createBaseQueryBondsResponse();
    message.bonds = ((_object$bonds = object.bonds) === null || _object$bonds === void 0 ? void 0 : _object$bonds.map(function (e) {
      return e;
    })) || [];
    return message;
  }
};
function createBaseQueryBondsDetailedRequest() {
  return {};
}
var QueryBondsDetailedRequest = exports.QueryBondsDetailedRequest = {
  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 = createBaseQueryBondsDetailedRequest();
    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 = createBaseQueryBondsDetailedRequest();
    return message;
  }
};
function createBaseQueryBondsDetailedResponse() {
  return {
    bondsDetailed: []
  };
}
var QueryBondsDetailedResponse = exports.QueryBondsDetailedResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    var _iterator2 = _createForOfIteratorHelper(message.bondsDetailed),
      _step2;
    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var v = _step2.value;
        _bonds.BondDetails.encode(v, writer.uint32(10).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 = createBaseQueryBondsDetailedResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondsDetailed.push(_bonds.BondDetails.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      bondsDetailed: Array.isArray(object === null || object === void 0 ? void 0 : object.bondsDetailed) ? object.bondsDetailed.map(function (e) {
        return _bonds.BondDetails.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    if (message.bondsDetailed) {
      obj.bondsDetailed = message.bondsDetailed.map(function (e) {
        return e ? _bonds.BondDetails.toJSON(e) : undefined;
      });
    } else {
      obj.bondsDetailed = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondsDetailed;
    var message = createBaseQueryBondsDetailedResponse();
    message.bondsDetailed = ((_object$bondsDetailed = object.bondsDetailed) === null || _object$bondsDetailed === void 0 ? void 0 : _object$bondsDetailed.map(function (e) {
      return _bonds.BondDetails.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseQueryBondRequest() {
  return {
    bondDid: ""
  };
}
var QueryBondRequest = exports.QueryBondRequest = {
  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);
    }
    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 = createBaseQueryBondRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = 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) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid;
    var message = createBaseQueryBondRequest();
    message.bondDid = (_object$bondDid = object.bondDid) !== null && _object$bondDid !== void 0 ? _object$bondDid : "";
    return message;
  }
};
function createBaseQueryBondResponse() {
  return {
    bond: undefined
  };
}
var QueryBondResponse = exports.QueryBondResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.bond !== undefined) {
      _bonds.Bond.encode(message.bond, 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 = createBaseQueryBondResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bond = _bonds.Bond.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      bond: (0, _helpers.isSet)(object.bond) ? _bonds.Bond.fromJSON(object.bond) : undefined
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bond !== undefined && (obj.bond = message.bond ? _bonds.Bond.toJSON(message.bond) : undefined);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseQueryBondResponse();
    message.bond = object.bond !== undefined && object.bond !== null ? _bonds.Bond.fromPartial(object.bond) : undefined;
    return message;
  }
};
function createBaseQueryBatchRequest() {
  return {
    bondDid: ""
  };
}
var QueryBatchRequest = exports.QueryBatchRequest = {
  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);
    }
    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 = createBaseQueryBatchRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = 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) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid2;
    var message = createBaseQueryBatchRequest();
    message.bondDid = (_object$bondDid2 = object.bondDid) !== null && _object$bondDid2 !== void 0 ? _object$bondDid2 : "";
    return message;
  }
};
function createBaseQueryBatchResponse() {
  return {
    batch: undefined
  };
}
var QueryBatchResponse = exports.QueryBatchResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.batch !== undefined) {
      _bonds.Batch.encode(message.batch, 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 = createBaseQueryBatchResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.batch = _bonds.Batch.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      batch: (0, _helpers.isSet)(object.batch) ? _bonds.Batch.fromJSON(object.batch) : undefined
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.batch !== undefined && (obj.batch = message.batch ? _bonds.Batch.toJSON(message.batch) : undefined);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseQueryBatchResponse();
    message.batch = object.batch !== undefined && object.batch !== null ? _bonds.Batch.fromPartial(object.batch) : undefined;
    return message;
  }
};
function createBaseQueryLastBatchRequest() {
  return {
    bondDid: ""
  };
}
var QueryLastBatchRequest = exports.QueryLastBatchRequest = {
  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);
    }
    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 = createBaseQueryLastBatchRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = 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) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid3;
    var message = createBaseQueryLastBatchRequest();
    message.bondDid = (_object$bondDid3 = object.bondDid) !== null && _object$bondDid3 !== void 0 ? _object$bondDid3 : "";
    return message;
  }
};
function createBaseQueryLastBatchResponse() {
  return {
    lastBatch: undefined
  };
}
var QueryLastBatchResponse = exports.QueryLastBatchResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.lastBatch !== undefined) {
      _bonds.Batch.encode(message.lastBatch, 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 = createBaseQueryLastBatchResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.lastBatch = _bonds.Batch.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      lastBatch: (0, _helpers.isSet)(object.lastBatch) ? _bonds.Batch.fromJSON(object.lastBatch) : undefined
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.lastBatch !== undefined && (obj.lastBatch = message.lastBatch ? _bonds.Batch.toJSON(message.lastBatch) : undefined);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseQueryLastBatchResponse();
    message.lastBatch = object.lastBatch !== undefined && object.lastBatch !== null ? _bonds.Batch.fromPartial(object.lastBatch) : undefined;
    return message;
  }
};
function createBaseQueryCurrentPriceRequest() {
  return {
    bondDid: ""
  };
}
var QueryCurrentPriceRequest = exports.QueryCurrentPriceRequest = {
  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);
    }
    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 = createBaseQueryCurrentPriceRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = 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) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid4;
    var message = createBaseQueryCurrentPriceRequest();
    message.bondDid = (_object$bondDid4 = object.bondDid) !== null && _object$bondDid4 !== void 0 ? _object$bondDid4 : "";
    return message;
  }
};
function createBaseQueryCurrentPriceResponse() {
  return {
    currentPrice: []
  };
}
var QueryCurrentPriceResponse = exports.QueryCurrentPriceResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    var _iterator3 = _createForOfIteratorHelper(message.currentPrice),
      _step3;
    try {
      for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
        var v = _step3.value;
        _coin.DecCoin.encode(v, writer.uint32(10).fork()).ldelim();
      }
    } catch (err) {
      _iterator3.e(err);
    } finally {
      _iterator3.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 = createBaseQueryCurrentPriceResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.currentPrice.push(_coin.DecCoin.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      currentPrice: Array.isArray(object === null || object === void 0 ? void 0 : object.currentPrice) ? object.currentPrice.map(function (e) {
        return _coin.DecCoin.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    if (message.currentPrice) {
      obj.currentPrice = message.currentPrice.map(function (e) {
        return e ? _coin.DecCoin.toJSON(e) : undefined;
      });
    } else {
      obj.currentPrice = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$currentPrice;
    var message = createBaseQueryCurrentPriceResponse();
    message.currentPrice = ((_object$currentPrice = object.currentPrice) === null || _object$currentPrice === void 0 ? void 0 : _object$currentPrice.map(function (e) {
      return _coin.DecCoin.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseQueryCurrentReserveRequest() {
  return {
    bondDid: ""
  };
}
var QueryCurrentReserveRequest = exports.QueryCurrentReserveRequest = {
  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);
    }
    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 = createBaseQueryCurrentReserveRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = 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) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid5;
    var message = createBaseQueryCurrentReserveRequest();
    message.bondDid = (_object$bondDid5 = object.bondDid) !== null && _object$bondDid5 !== void 0 ? _object$bondDid5 : "";
    return message;
  }
};
function createBaseQueryCurrentReserveResponse() {
  return {
    currentReserve: []
  };
}
var QueryCurrentReserveResponse = exports.QueryCurrentReserveResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    var _iterator4 = _createForOfIteratorHelper(message.currentReserve),
      _step4;
    try {
      for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
        var v = _step4.value;
        _coin.Coin.encode(v, writer.uint32(10).fork()).ldelim();
      }
    } catch (err) {
      _iterator4.e(err);
    } finally {
      _iterator4.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 = createBaseQueryCurrentReserveResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.currentReserve.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      currentReserve: Array.isArray(object === null || object === void 0 ? void 0 : object.currentReserve) ? object.currentReserve.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    if (message.currentReserve) {
      obj.currentReserve = message.currentReserve.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.currentReserve = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$currentReserv;
    var message = createBaseQueryCurrentReserveResponse();
    message.currentReserve = ((_object$currentReserv = object.currentReserve) === null || _object$currentReserv === void 0 ? void 0 : _object$currentReserv.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseQueryAvailableReserveRequest() {
  return {
    bondDid: ""
  };
}
var QueryAvailableReserveRequest = exports.QueryAvailableReserveRequest = {
  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);
    }
    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 = createBaseQueryAvailableReserveRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = 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) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid6;
    var message = createBaseQueryAvailableReserveRequest();
    message.bondDid = (_object$bondDid6 = object.bondDid) !== null && _object$bondDid6 !== void 0 ? _object$bondDid6 : "";
    return message;
  }
};
function createBaseQueryAvailableReserveResponse() {
  return {
    availableReserve: []
  };
}
var QueryAvailableReserveResponse = exports.QueryAvailableReserveResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    var _iterator5 = _createForOfIteratorHelper(message.availableReserve),
      _step5;
    try {
      for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
        var v = _step5.value;
        _coin.Coin.encode(v, writer.uint32(10).fork()).ldelim();
      }
    } catch (err) {
      _iterator5.e(err);
    } finally {
      _iterator5.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 = createBaseQueryAvailableReserveResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.availableReserve.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      availableReserve: Array.isArray(object === null || object === void 0 ? void 0 : object.availableReserve) ? object.availableReserve.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    if (message.availableReserve) {
      obj.availableReserve = message.availableReserve.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.availableReserve = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$availableRese;
    var message = createBaseQueryAvailableReserveResponse();
    message.availableReserve = ((_object$availableRese = object.availableReserve) === null || _object$availableRese === void 0 ? void 0 : _object$availableRese.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseQueryCustomPriceRequest() {
  return {
    bondDid: "",
    bondAmount: ""
  };
}
var QueryCustomPriceRequest = exports.QueryCustomPriceRequest = {
  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.bondAmount !== "") {
      writer.uint32(18).string(message.bondAmount);
    }
    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 = createBaseQueryCustomPriceRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = reader.string();
          break;
        case 2:
          message.bondAmount = 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) : "",
      bondAmount: (0, _helpers.isSet)(object.bondAmount) ? String(object.bondAmount) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.bondAmount !== undefined && (obj.bondAmount = message.bondAmount);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid7, _object$bondAmount;
    var message = createBaseQueryCustomPriceRequest();
    message.bondDid = (_object$bondDid7 = object.bondDid) !== null && _object$bondDid7 !== void 0 ? _object$bondDid7 : "";
    message.bondAmount = (_object$bondAmount = object.bondAmount) !== null && _object$bondAmount !== void 0 ? _object$bondAmount : "";
    return message;
  }
};
function createBaseQueryCustomPriceResponse() {
  return {
    price: []
  };
}
var QueryCustomPriceResponse = exports.QueryCustomPriceResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    var _iterator6 = _createForOfIteratorHelper(message.price),
      _step6;
    try {
      for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
        var v = _step6.value;
        _coin.DecCoin.encode(v, writer.uint32(10).fork()).ldelim();
      }
    } catch (err) {
      _iterator6.e(err);
    } finally {
      _iterator6.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 = createBaseQueryCustomPriceResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.price.push(_coin.DecCoin.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      price: Array.isArray(object === null || object === void 0 ? void 0 : object.price) ? object.price.map(function (e) {
        return _coin.DecCoin.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    if (message.price) {
      obj.price = message.price.map(function (e) {
        return e ? _coin.DecCoin.toJSON(e) : undefined;
      });
    } else {
      obj.price = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$price;
    var message = createBaseQueryCustomPriceResponse();
    message.price = ((_object$price = object.price) === null || _object$price === void 0 ? void 0 : _object$price.map(function (e) {
      return _coin.DecCoin.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseQueryBuyPriceRequest() {
  return {
    bondDid: "",
    bondAmount: ""
  };
}
var QueryBuyPriceRequest = exports.QueryBuyPriceRequest = {
  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.bondAmount !== "") {
      writer.uint32(18).string(message.bondAmount);
    }
    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 = createBaseQueryBuyPriceRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = reader.string();
          break;
        case 2:
          message.bondAmount = 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) : "",
      bondAmount: (0, _helpers.isSet)(object.bondAmount) ? String(object.bondAmount) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.bondAmount !== undefined && (obj.bondAmount = message.bondAmount);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid8, _object$bondAmount2;
    var message = createBaseQueryBuyPriceRequest();
    message.bondDid = (_object$bondDid8 = object.bondDid) !== null && _object$bondDid8 !== void 0 ? _object$bondDid8 : "";
    message.bondAmount = (_object$bondAmount2 = object.bondAmount) !== null && _object$bondAmount2 !== void 0 ? _object$bondAmount2 : "";
    return message;
  }
};
function createBaseQueryBuyPriceResponse() {
  return {
    adjustedSupply: undefined,
    prices: [],
    txFees: [],
    totalPrices: [],
    totalFees: []
  };
}
var QueryBuyPriceResponse = exports.QueryBuyPriceResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.adjustedSupply !== undefined) {
      _coin.Coin.encode(message.adjustedSupply, writer.uint32(10).fork()).ldelim();
    }
    var _iterator7 = _createForOfIteratorHelper(message.prices),
      _step7;
    try {
      for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
        var v = _step7.value;
        _coin.Coin.encode(v, writer.uint32(18).fork()).ldelim();
      }
    } catch (err) {
      _iterator7.e(err);
    } finally {
      _iterator7.f();
    }
    var _iterator8 = _createForOfIteratorHelper(message.txFees),
      _step8;
    try {
      for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
        var _v = _step8.value;
        _coin.Coin.encode(_v, writer.uint32(26).fork()).ldelim();
      }
    } catch (err) {
      _iterator8.e(err);
    } finally {
      _iterator8.f();
    }
    var _iterator9 = _createForOfIteratorHelper(message.totalPrices),
      _step9;
    try {
      for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
        var _v2 = _step9.value;
        _coin.Coin.encode(_v2, writer.uint32(34).fork()).ldelim();
      }
    } catch (err) {
      _iterator9.e(err);
    } finally {
      _iterator9.f();
    }
    var _iterator0 = _createForOfIteratorHelper(message.totalFees),
      _step0;
    try {
      for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
        var _v3 = _step0.value;
        _coin.Coin.encode(_v3, writer.uint32(42).fork()).ldelim();
      }
    } catch (err) {
      _iterator0.e(err);
    } finally {
      _iterator0.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 = createBaseQueryBuyPriceResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.adjustedSupply = _coin.Coin.decode(reader, reader.uint32());
          break;
        case 2:
          message.prices.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 3:
          message.txFees.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 4:
          message.totalPrices.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 5:
          message.totalFees.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      adjustedSupply: (0, _helpers.isSet)(object.adjustedSupply) ? _coin.Coin.fromJSON(object.adjustedSupply) : undefined,
      prices: Array.isArray(object === null || object === void 0 ? void 0 : object.prices) ? object.prices.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      txFees: Array.isArray(object === null || object === void 0 ? void 0 : object.txFees) ? object.txFees.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      totalPrices: Array.isArray(object === null || object === void 0 ? void 0 : object.totalPrices) ? object.totalPrices.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      totalFees: Array.isArray(object === null || object === void 0 ? void 0 : object.totalFees) ? object.totalFees.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.adjustedSupply !== undefined && (obj.adjustedSupply = message.adjustedSupply ? _coin.Coin.toJSON(message.adjustedSupply) : undefined);
    if (message.prices) {
      obj.prices = message.prices.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.prices = [];
    }
    if (message.txFees) {
      obj.txFees = message.txFees.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.txFees = [];
    }
    if (message.totalPrices) {
      obj.totalPrices = message.totalPrices.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.totalPrices = [];
    }
    if (message.totalFees) {
      obj.totalFees = message.totalFees.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.totalFees = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$prices, _object$txFees, _object$totalPrices, _object$totalFees;
    var message = createBaseQueryBuyPriceResponse();
    message.adjustedSupply = object.adjustedSupply !== undefined && object.adjustedSupply !== null ? _coin.Coin.fromPartial(object.adjustedSupply) : undefined;
    message.prices = ((_object$prices = object.prices) === null || _object$prices === void 0 ? void 0 : _object$prices.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.txFees = ((_object$txFees = object.txFees) === null || _object$txFees === void 0 ? void 0 : _object$txFees.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.totalPrices = ((_object$totalPrices = object.totalPrices) === null || _object$totalPrices === void 0 ? void 0 : _object$totalPrices.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.totalFees = ((_object$totalFees = object.totalFees) === null || _object$totalFees === void 0 ? void 0 : _object$totalFees.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseQuerySellReturnRequest() {
  return {
    bondDid: "",
    bondAmount: ""
  };
}
var QuerySellReturnRequest = exports.QuerySellReturnRequest = {
  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.bondAmount !== "") {
      writer.uint32(18).string(message.bondAmount);
    }
    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 = createBaseQuerySellReturnRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = reader.string();
          break;
        case 2:
          message.bondAmount = 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) : "",
      bondAmount: (0, _helpers.isSet)(object.bondAmount) ? String(object.bondAmount) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.bondAmount !== undefined && (obj.bondAmount = message.bondAmount);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid9, _object$bondAmount3;
    var message = createBaseQuerySellReturnRequest();
    message.bondDid = (_object$bondDid9 = object.bondDid) !== null && _object$bondDid9 !== void 0 ? _object$bondDid9 : "";
    message.bondAmount = (_object$bondAmount3 = object.bondAmount) !== null && _object$bondAmount3 !== void 0 ? _object$bondAmount3 : "";
    return message;
  }
};
function createBaseQuerySellReturnResponse() {
  return {
    adjustedSupply: undefined,
    returns: [],
    txFees: [],
    exitFees: [],
    totalReturns: [],
    totalFees: []
  };
}
var QuerySellReturnResponse = exports.QuerySellReturnResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.adjustedSupply !== undefined) {
      _coin.Coin.encode(message.adjustedSupply, writer.uint32(10).fork()).ldelim();
    }
    var _iterator1 = _createForOfIteratorHelper(message.returns),
      _step1;
    try {
      for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
        var v = _step1.value;
        _coin.Coin.encode(v, writer.uint32(18).fork()).ldelim();
      }
    } catch (err) {
      _iterator1.e(err);
    } finally {
      _iterator1.f();
    }
    var _iterator10 = _createForOfIteratorHelper(message.txFees),
      _step10;
    try {
      for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
        var _v4 = _step10.value;
        _coin.Coin.encode(_v4, writer.uint32(26).fork()).ldelim();
      }
    } catch (err) {
      _iterator10.e(err);
    } finally {
      _iterator10.f();
    }
    var _iterator11 = _createForOfIteratorHelper(message.exitFees),
      _step11;
    try {
      for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
        var _v5 = _step11.value;
        _coin.Coin.encode(_v5, writer.uint32(34).fork()).ldelim();
      }
    } catch (err) {
      _iterator11.e(err);
    } finally {
      _iterator11.f();
    }
    var _iterator12 = _createForOfIteratorHelper(message.totalReturns),
      _step12;
    try {
      for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
        var _v6 = _step12.value;
        _coin.Coin.encode(_v6, writer.uint32(42).fork()).ldelim();
      }
    } catch (err) {
      _iterator12.e(err);
    } finally {
      _iterator12.f();
    }
    var _iterator13 = _createForOfIteratorHelper(message.totalFees),
      _step13;
    try {
      for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
        var _v7 = _step13.value;
        _coin.Coin.encode(_v7, writer.uint32(50).fork()).ldelim();
      }
    } 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 = createBaseQuerySellReturnResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.adjustedSupply = _coin.Coin.decode(reader, reader.uint32());
          break;
        case 2:
          message.returns.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 3:
          message.txFees.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 4:
          message.exitFees.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 5:
          message.totalReturns.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 6:
          message.totalFees.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      adjustedSupply: (0, _helpers.isSet)(object.adjustedSupply) ? _coin.Coin.fromJSON(object.adjustedSupply) : undefined,
      returns: Array.isArray(object === null || object === void 0 ? void 0 : object.returns) ? object.returns.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      txFees: Array.isArray(object === null || object === void 0 ? void 0 : object.txFees) ? object.txFees.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      exitFees: Array.isArray(object === null || object === void 0 ? void 0 : object.exitFees) ? object.exitFees.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      totalReturns: Array.isArray(object === null || object === void 0 ? void 0 : object.totalReturns) ? object.totalReturns.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      totalFees: Array.isArray(object === null || object === void 0 ? void 0 : object.totalFees) ? object.totalFees.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.adjustedSupply !== undefined && (obj.adjustedSupply = message.adjustedSupply ? _coin.Coin.toJSON(message.adjustedSupply) : undefined);
    if (message.returns) {
      obj.returns = message.returns.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.returns = [];
    }
    if (message.txFees) {
      obj.txFees = message.txFees.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.txFees = [];
    }
    if (message.exitFees) {
      obj.exitFees = message.exitFees.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.exitFees = [];
    }
    if (message.totalReturns) {
      obj.totalReturns = message.totalReturns.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.totalReturns = [];
    }
    if (message.totalFees) {
      obj.totalFees = message.totalFees.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.totalFees = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$returns, _object$txFees2, _object$exitFees, _object$totalReturns, _object$totalFees2;
    var message = createBaseQuerySellReturnResponse();
    message.adjustedSupply = object.adjustedSupply !== undefined && object.adjustedSupply !== null ? _coin.Coin.fromPartial(object.adjustedSupply) : undefined;
    message.returns = ((_object$returns = object.returns) === null || _object$returns === void 0 ? void 0 : _object$returns.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.txFees = ((_object$txFees2 = object.txFees) === null || _object$txFees2 === void 0 ? void 0 : _object$txFees2.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.exitFees = ((_object$exitFees = object.exitFees) === null || _object$exitFees === void 0 ? void 0 : _object$exitFees.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.totalReturns = ((_object$totalReturns = object.totalReturns) === null || _object$totalReturns === void 0 ? void 0 : _object$totalReturns.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.totalFees = ((_object$totalFees2 = object.totalFees) === null || _object$totalFees2 === void 0 ? void 0 : _object$totalFees2.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseQuerySwapReturnRequest() {
  return {
    bondDid: "",
    fromTokenWithAmount: "",
    toToken: ""
  };
}
var QuerySwapReturnRequest = exports.QuerySwapReturnRequest = {
  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.fromTokenWithAmount !== "") {
      writer.uint32(18).string(message.fromTokenWithAmount);
    }
    if (message.toToken !== "") {
      writer.uint32(26).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 = createBaseQuerySwapReturnRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = reader.string();
          break;
        case 2:
          message.fromTokenWithAmount = reader.string();
          break;
        case 3:
          message.toToken = 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) : "",
      fromTokenWithAmount: (0, _helpers.isSet)(object.fromTokenWithAmount) ? String(object.fromTokenWithAmount) : "",
      toToken: (0, _helpers.isSet)(object.toToken) ? String(object.toToken) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    message.fromTokenWithAmount !== undefined && (obj.fromTokenWithAmount = message.fromTokenWithAmount);
    message.toToken !== undefined && (obj.toToken = message.toToken);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid0, _object$fromTokenWith, _object$toToken;
    var message = createBaseQuerySwapReturnRequest();
    message.bondDid = (_object$bondDid0 = object.bondDid) !== null && _object$bondDid0 !== void 0 ? _object$bondDid0 : "";
    message.fromTokenWithAmount = (_object$fromTokenWith = object.fromTokenWithAmount) !== null && _object$fromTokenWith !== void 0 ? _object$fromTokenWith : "";
    message.toToken = (_object$toToken = object.toToken) !== null && _object$toToken !== void 0 ? _object$toToken : "";
    return message;
  }
};
function createBaseQuerySwapReturnResponse() {
  return {
    totalReturns: [],
    totalFees: []
  };
}
var QuerySwapReturnResponse = exports.QuerySwapReturnResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    var _iterator14 = _createForOfIteratorHelper(message.totalReturns),
      _step14;
    try {
      for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
        var v = _step14.value;
        _coin.Coin.encode(v, writer.uint32(10).fork()).ldelim();
      }
    } catch (err) {
      _iterator14.e(err);
    } finally {
      _iterator14.f();
    }
    var _iterator15 = _createForOfIteratorHelper(message.totalFees),
      _step15;
    try {
      for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
        var _v8 = _step15.value;
        _coin.Coin.encode(_v8, writer.uint32(18).fork()).ldelim();
      }
    } catch (err) {
      _iterator15.e(err);
    } finally {
      _iterator15.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 = createBaseQuerySwapReturnResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.totalReturns.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 2:
          message.totalFees.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      totalReturns: Array.isArray(object === null || object === void 0 ? void 0 : object.totalReturns) ? object.totalReturns.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      totalFees: Array.isArray(object === null || object === void 0 ? void 0 : object.totalFees) ? object.totalFees.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    if (message.totalReturns) {
      obj.totalReturns = message.totalReturns.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.totalReturns = [];
    }
    if (message.totalFees) {
      obj.totalFees = message.totalFees.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.totalFees = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$totalReturns2, _object$totalFees3;
    var message = createBaseQuerySwapReturnResponse();
    message.totalReturns = ((_object$totalReturns2 = object.totalReturns) === null || _object$totalReturns2 === void 0 ? void 0 : _object$totalReturns2.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.totalFees = ((_object$totalFees3 = object.totalFees) === null || _object$totalFees3 === void 0 ? void 0 : _object$totalFees3.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseQueryAlphaMaximumsRequest() {
  return {
    bondDid: ""
  };
}
var QueryAlphaMaximumsRequest = exports.QueryAlphaMaximumsRequest = {
  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);
    }
    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 = createBaseQueryAlphaMaximumsRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bondDid = 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) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.bondDid !== undefined && (obj.bondDid = message.bondDid);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$bondDid1;
    var message = createBaseQueryAlphaMaximumsRequest();
    message.bondDid = (_object$bondDid1 = object.bondDid) !== null && _object$bondDid1 !== void 0 ? _object$bondDid1 : "";
    return message;
  }
};
function createBaseQueryAlphaMaximumsResponse() {
  return {
    maxSystemAlphaIncrease: "",
    maxSystemAlpha: ""
  };
}
var QueryAlphaMaximumsResponse = exports.QueryAlphaMaximumsResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.maxSystemAlphaIncrease !== "") {
      writer.uint32(10).string(message.maxSystemAlphaIncrease);
    }
    if (message.maxSystemAlpha !== "") {
      writer.uint32(18).string(message.maxSystemAlpha);
    }
    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 = createBaseQueryAlphaMaximumsResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.maxSystemAlphaIncrease = reader.string();
          break;
        case 2:
          message.maxSystemAlpha = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      maxSystemAlphaIncrease: (0, _helpers.isSet)(object.maxSystemAlphaIncrease) ? String(object.maxSystemAlphaIncrease) : "",
      maxSystemAlpha: (0, _helpers.isSet)(object.maxSystemAlpha) ? String(object.maxSystemAlpha) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.maxSystemAlphaIncrease !== undefined && (obj.maxSystemAlphaIncrease = message.maxSystemAlphaIncrease);
    message.maxSystemAlpha !== undefined && (obj.maxSystemAlpha = message.maxSystemAlpha);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$maxSystemAlph, _object$maxSystemAlph2;
    var message = createBaseQueryAlphaMaximumsResponse();
    message.maxSystemAlphaIncrease = (_object$maxSystemAlph = object.maxSystemAlphaIncrease) !== null && _object$maxSystemAlph !== void 0 ? _object$maxSystemAlph : "";
    message.maxSystemAlpha = (_object$maxSystemAlph2 = object.maxSystemAlpha) !== null && _object$maxSystemAlph2 !== void 0 ? _object$maxSystemAlph2 : "";
    return message;
  }
};
function createBaseQueryParamsRequest() {
  return {};
}
var QueryParamsRequest = exports.QueryParamsRequest = {
  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 = createBaseQueryParamsRequest();
    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 = createBaseQueryParamsRequest();
    return message;
  }
};
function createBaseQueryParamsResponse() {
  return {
    params: undefined
  };
}
var QueryParamsResponse = exports.QueryParamsResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.params !== undefined) {
      _bonds.Params.encode(message.params, 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 = createBaseQueryParamsResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.params = _bonds.Params.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      params: (0, _helpers.isSet)(object.params) ? _bonds.Params.fromJSON(object.params) : undefined
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.params !== undefined && (obj.params = message.params ? _bonds.Params.toJSON(message.params) : undefined);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseQueryParamsResponse();
    message.params = object.params !== undefined && object.params !== null ? _bonds.Params.fromPartial(object.params) : undefined;
    return message;
  }
};