//@ts-nocheck
import { FunctionParam } from "./bonds";
import { Coin } from "../../../cosmos/base/v1beta1/coin";
import * as _m0 from "protobufjs/minimal";
import { isSet } from "../../../helpers";
/** MsgCreateBond defines a message for creating a new bond. */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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