//@ts-nocheck
import { PageRequest, PageResponse } from "../../../../cosmos/base/query/v1beta1/pagination";
import { PacketId } from "../../../core/channel/v1/channel";
import { IdentifiedPacketFees } from "./fee";
import { Coin } from "../../../../cosmos/base/v1beta1/coin";
import { FeeEnabledChannel } from "./genesis";
import { Long, isSet } from "../../../../helpers";
import * as _m0 from "protobufjs/minimal";
/** QueryIncentivizedPacketsRequest defines the request type for the IncentivizedPackets rpc */

/** QueryIncentivizedPacketsRequest defines the request type for the IncentivizedPackets rpc */

/** QueryIncentivizedPacketsResponse defines the response type for the IncentivizedPackets rpc */

/** QueryIncentivizedPacketsResponse defines the response type for the IncentivizedPackets rpc */

/** QueryIncentivizedPacketRequest defines the request type for the IncentivizedPacket rpc */

/** QueryIncentivizedPacketRequest defines the request type for the IncentivizedPacket rpc */

/** QueryIncentivizedPacketsResponse defines the response type for the IncentivizedPacket rpc */

/** QueryIncentivizedPacketsResponse defines the response type for the IncentivizedPacket rpc */

/**
 * QueryIncentivizedPacketsForChannelRequest defines the request type for querying for all incentivized packets
 * for a specific channel
 */

/**
 * QueryIncentivizedPacketsForChannelRequest defines the request type for querying for all incentivized packets
 * for a specific channel
 */

/** QueryIncentivizedPacketsResponse defines the response type for the incentivized packets RPC */

/** QueryIncentivizedPacketsResponse defines the response type for the incentivized packets RPC */

/** QueryTotalRecvFeesRequest defines the request type for the TotalRecvFees rpc */

/** QueryTotalRecvFeesRequest defines the request type for the TotalRecvFees rpc */

/** QueryTotalRecvFeesResponse defines the response type for the TotalRecvFees rpc */

/** QueryTotalRecvFeesResponse defines the response type for the TotalRecvFees rpc */

/** QueryTotalAckFeesRequest defines the request type for the TotalAckFees rpc */

/** QueryTotalAckFeesRequest defines the request type for the TotalAckFees rpc */

/** QueryTotalAckFeesResponse defines the response type for the TotalAckFees rpc */

/** QueryTotalAckFeesResponse defines the response type for the TotalAckFees rpc */

/** QueryTotalTimeoutFeesRequest defines the request type for the TotalTimeoutFees rpc */

/** QueryTotalTimeoutFeesRequest defines the request type for the TotalTimeoutFees rpc */

/** QueryTotalTimeoutFeesResponse defines the response type for the TotalTimeoutFees rpc */

/** QueryTotalTimeoutFeesResponse defines the response type for the TotalTimeoutFees rpc */

/** QueryPayeeRequest defines the request type for the Payee rpc */

/** QueryPayeeRequest defines the request type for the Payee rpc */

/** QueryPayeeResponse defines the response type for the Payee rpc */

/** QueryPayeeResponse defines the response type for the Payee rpc */

/** QueryCounterpartyPayeeRequest defines the request type for the CounterpartyPayee rpc */

/** QueryCounterpartyPayeeRequest defines the request type for the CounterpartyPayee rpc */

/** QueryCounterpartyPayeeResponse defines the response type for the CounterpartyPayee rpc */

/** QueryCounterpartyPayeeResponse defines the response type for the CounterpartyPayee rpc */

/** QueryFeeEnabledChannelsRequest defines the request type for the FeeEnabledChannels rpc */

/** QueryFeeEnabledChannelsRequest defines the request type for the FeeEnabledChannels rpc */

/** QueryFeeEnabledChannelsResponse defines the response type for the FeeEnabledChannels rpc */

/** QueryFeeEnabledChannelsResponse defines the response type for the FeeEnabledChannels rpc */

/** QueryFeeEnabledChannelRequest defines the request type for the FeeEnabledChannel rpc */

/** QueryFeeEnabledChannelRequest defines the request type for the FeeEnabledChannel rpc */

/** QueryFeeEnabledChannelResponse defines the response type for the FeeEnabledChannel rpc */

/** QueryFeeEnabledChannelResponse defines the response type for the FeeEnabledChannel rpc */

function createBaseQueryIncentivizedPacketsRequest() {
  return {
    pagination: undefined,
    queryHeight: Long.UZERO
  };
}
export const QueryIncentivizedPacketsRequest = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.pagination !== undefined) {
      PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
    }
    if (!message.queryHeight.isZero()) {
      writer.uint32(16).uint64(message.queryHeight);
    }
    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 = createBaseQueryIncentivizedPacketsRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.pagination = PageRequest.decode(reader, reader.uint32());
          break;
        case 2:
          message.queryHeight = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined,
      queryHeight: isSet(object.queryHeight) ? Long.fromValue(object.queryHeight) : Long.UZERO
    };
  },
  toJSON(message) {
    const obj = {};
    message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined);
    message.queryHeight !== undefined && (obj.queryHeight = (message.queryHeight || Long.UZERO).toString());
    return obj;
  },
  fromPartial(object) {
    const message = createBaseQueryIncentivizedPacketsRequest();
    message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
    message.queryHeight = object.queryHeight !== undefined && object.queryHeight !== null ? Long.fromValue(object.queryHeight) : Long.UZERO;
    return message;
  }
};
function createBaseQueryIncentivizedPacketsResponse() {
  return {
    incentivizedPackets: [],
    pagination: undefined
  };
}
export const QueryIncentivizedPacketsResponse = {
  encode(message, writer = _m0.Writer.create()) {
    for (const v of message.incentivizedPackets) {
      IdentifiedPacketFees.encode(v, writer.uint32(10).fork()).ldelim();
    }
    if (message.pagination !== undefined) {
      PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
    }
    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 = createBaseQueryIncentivizedPacketsResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.incentivizedPackets.push(IdentifiedPacketFees.decode(reader, reader.uint32()));
          break;
        case 2:
          message.pagination = PageResponse.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      incentivizedPackets: Array.isArray(object === null || object === void 0 ? void 0 : object.incentivizedPackets) ? object.incentivizedPackets.map(e => IdentifiedPacketFees.fromJSON(e)) : [],
      pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    if (message.incentivizedPackets) {
      obj.incentivizedPackets = message.incentivizedPackets.map(e => e ? IdentifiedPacketFees.toJSON(e) : undefined);
    } else {
      obj.incentivizedPackets = [];
    }
    message.pagination !== undefined && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined);
    return obj;
  },
  fromPartial(object) {
    var _object$incentivizedP;
    const message = createBaseQueryIncentivizedPacketsResponse();
    message.incentivizedPackets = ((_object$incentivizedP = object.incentivizedPackets) === null || _object$incentivizedP === void 0 ? void 0 : _object$incentivizedP.map(e => IdentifiedPacketFees.fromPartial(e))) || [];
    message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined;
    return message;
  }
};
function createBaseQueryIncentivizedPacketRequest() {
  return {
    packetId: undefined,
    queryHeight: Long.UZERO
  };
}
export const QueryIncentivizedPacketRequest = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.packetId !== undefined) {
      PacketId.encode(message.packetId, writer.uint32(10).fork()).ldelim();
    }
    if (!message.queryHeight.isZero()) {
      writer.uint32(16).uint64(message.queryHeight);
    }
    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 = createBaseQueryIncentivizedPacketRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.packetId = PacketId.decode(reader, reader.uint32());
          break;
        case 2:
          message.queryHeight = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      packetId: isSet(object.packetId) ? PacketId.fromJSON(object.packetId) : undefined,
      queryHeight: isSet(object.queryHeight) ? Long.fromValue(object.queryHeight) : Long.UZERO
    };
  },
  toJSON(message) {
    const obj = {};
    message.packetId !== undefined && (obj.packetId = message.packetId ? PacketId.toJSON(message.packetId) : undefined);
    message.queryHeight !== undefined && (obj.queryHeight = (message.queryHeight || Long.UZERO).toString());
    return obj;
  },
  fromPartial(object) {
    const message = createBaseQueryIncentivizedPacketRequest();
    message.packetId = object.packetId !== undefined && object.packetId !== null ? PacketId.fromPartial(object.packetId) : undefined;
    message.queryHeight = object.queryHeight !== undefined && object.queryHeight !== null ? Long.fromValue(object.queryHeight) : Long.UZERO;
    return message;
  }
};
function createBaseQueryIncentivizedPacketResponse() {
  return {
    incentivizedPacket: undefined
  };
}
export const QueryIncentivizedPacketResponse = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.incentivizedPacket !== undefined) {
      IdentifiedPacketFees.encode(message.incentivizedPacket, writer.uint32(10).fork()).ldelim();
    }
    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 = createBaseQueryIncentivizedPacketResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.incentivizedPacket = IdentifiedPacketFees.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      incentivizedPacket: isSet(object.incentivizedPacket) ? IdentifiedPacketFees.fromJSON(object.incentivizedPacket) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    message.incentivizedPacket !== undefined && (obj.incentivizedPacket = message.incentivizedPacket ? IdentifiedPacketFees.toJSON(message.incentivizedPacket) : undefined);
    return obj;
  },
  fromPartial(object) {
    const message = createBaseQueryIncentivizedPacketResponse();
    message.incentivizedPacket = object.incentivizedPacket !== undefined && object.incentivizedPacket !== null ? IdentifiedPacketFees.fromPartial(object.incentivizedPacket) : undefined;
    return message;
  }
};
function createBaseQueryIncentivizedPacketsForChannelRequest() {
  return {
    pagination: undefined,
    portId: "",
    channelId: "",
    queryHeight: Long.UZERO
  };
}
export const QueryIncentivizedPacketsForChannelRequest = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.pagination !== undefined) {
      PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
    }
    if (message.portId !== "") {
      writer.uint32(18).string(message.portId);
    }
    if (message.channelId !== "") {
      writer.uint32(26).string(message.channelId);
    }
    if (!message.queryHeight.isZero()) {
      writer.uint32(32).uint64(message.queryHeight);
    }
    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 = createBaseQueryIncentivizedPacketsForChannelRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.pagination = PageRequest.decode(reader, reader.uint32());
          break;
        case 2:
          message.portId = reader.string();
          break;
        case 3:
          message.channelId = reader.string();
          break;
        case 4:
          message.queryHeight = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined,
      portId: isSet(object.portId) ? String(object.portId) : "",
      channelId: isSet(object.channelId) ? String(object.channelId) : "",
      queryHeight: isSet(object.queryHeight) ? Long.fromValue(object.queryHeight) : Long.UZERO
    };
  },
  toJSON(message) {
    const obj = {};
    message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined);
    message.portId !== undefined && (obj.portId = message.portId);
    message.channelId !== undefined && (obj.channelId = message.channelId);
    message.queryHeight !== undefined && (obj.queryHeight = (message.queryHeight || Long.UZERO).toString());
    return obj;
  },
  fromPartial(object) {
    var _object$portId, _object$channelId;
    const message = createBaseQueryIncentivizedPacketsForChannelRequest();
    message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
    message.portId = (_object$portId = object.portId) !== null && _object$portId !== void 0 ? _object$portId : "";
    message.channelId = (_object$channelId = object.channelId) !== null && _object$channelId !== void 0 ? _object$channelId : "";
    message.queryHeight = object.queryHeight !== undefined && object.queryHeight !== null ? Long.fromValue(object.queryHeight) : Long.UZERO;
    return message;
  }
};
function createBaseQueryIncentivizedPacketsForChannelResponse() {
  return {
    incentivizedPackets: [],
    pagination: undefined
  };
}
export const QueryIncentivizedPacketsForChannelResponse = {
  encode(message, writer = _m0.Writer.create()) {
    for (const v of message.incentivizedPackets) {
      IdentifiedPacketFees.encode(v, writer.uint32(10).fork()).ldelim();
    }
    if (message.pagination !== undefined) {
      PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
    }
    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 = createBaseQueryIncentivizedPacketsForChannelResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.incentivizedPackets.push(IdentifiedPacketFees.decode(reader, reader.uint32()));
          break;
        case 2:
          message.pagination = PageResponse.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      incentivizedPackets: Array.isArray(object === null || object === void 0 ? void 0 : object.incentivizedPackets) ? object.incentivizedPackets.map(e => IdentifiedPacketFees.fromJSON(e)) : [],
      pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    if (message.incentivizedPackets) {
      obj.incentivizedPackets = message.incentivizedPackets.map(e => e ? IdentifiedPacketFees.toJSON(e) : undefined);
    } else {
      obj.incentivizedPackets = [];
    }
    message.pagination !== undefined && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined);
    return obj;
  },
  fromPartial(object) {
    var _object$incentivizedP2;
    const message = createBaseQueryIncentivizedPacketsForChannelResponse();
    message.incentivizedPackets = ((_object$incentivizedP2 = object.incentivizedPackets) === null || _object$incentivizedP2 === void 0 ? void 0 : _object$incentivizedP2.map(e => IdentifiedPacketFees.fromPartial(e))) || [];
    message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined;
    return message;
  }
};
function createBaseQueryTotalRecvFeesRequest() {
  return {
    packetId: undefined
  };
}
export const QueryTotalRecvFeesRequest = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.packetId !== undefined) {
      PacketId.encode(message.packetId, writer.uint32(10).fork()).ldelim();
    }
    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 = createBaseQueryTotalRecvFeesRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.packetId = PacketId.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      packetId: isSet(object.packetId) ? PacketId.fromJSON(object.packetId) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    message.packetId !== undefined && (obj.packetId = message.packetId ? PacketId.toJSON(message.packetId) : undefined);
    return obj;
  },
  fromPartial(object) {
    const message = createBaseQueryTotalRecvFeesRequest();
    message.packetId = object.packetId !== undefined && object.packetId !== null ? PacketId.fromPartial(object.packetId) : undefined;
    return message;
  }
};
function createBaseQueryTotalRecvFeesResponse() {
  return {
    recvFees: []
  };
}
export const QueryTotalRecvFeesResponse = {
  encode(message, writer = _m0.Writer.create()) {
    for (const v of message.recvFees) {
      Coin.encode(v, writer.uint32(10).fork()).ldelim();
    }
    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 = createBaseQueryTotalRecvFeesResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.recvFees.push(Coin.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      recvFees: Array.isArray(object === null || object === void 0 ? void 0 : object.recvFees) ? object.recvFees.map(e => Coin.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    if (message.recvFees) {
      obj.recvFees = message.recvFees.map(e => e ? Coin.toJSON(e) : undefined);
    } else {
      obj.recvFees = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$recvFees;
    const message = createBaseQueryTotalRecvFeesResponse();
    message.recvFees = ((_object$recvFees = object.recvFees) === null || _object$recvFees === void 0 ? void 0 : _object$recvFees.map(e => Coin.fromPartial(e))) || [];
    return message;
  }
};
function createBaseQueryTotalAckFeesRequest() {
  return {
    packetId: undefined
  };
}
export const QueryTotalAckFeesRequest = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.packetId !== undefined) {
      PacketId.encode(message.packetId, writer.uint32(10).fork()).ldelim();
    }
    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 = createBaseQueryTotalAckFeesRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.packetId = PacketId.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      packetId: isSet(object.packetId) ? PacketId.fromJSON(object.packetId) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    message.packetId !== undefined && (obj.packetId = message.packetId ? PacketId.toJSON(message.packetId) : undefined);
    return obj;
  },
  fromPartial(object) {
    const message = createBaseQueryTotalAckFeesRequest();
    message.packetId = object.packetId !== undefined && object.packetId !== null ? PacketId.fromPartial(object.packetId) : undefined;
    return message;
  }
};
function createBaseQueryTotalAckFeesResponse() {
  return {
    ackFees: []
  };
}
export const QueryTotalAckFeesResponse = {
  encode(message, writer = _m0.Writer.create()) {
    for (const v of message.ackFees) {
      Coin.encode(v, writer.uint32(10).fork()).ldelim();
    }
    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 = createBaseQueryTotalAckFeesResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.ackFees.push(Coin.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      ackFees: Array.isArray(object === null || object === void 0 ? void 0 : object.ackFees) ? object.ackFees.map(e => Coin.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    if (message.ackFees) {
      obj.ackFees = message.ackFees.map(e => e ? Coin.toJSON(e) : undefined);
    } else {
      obj.ackFees = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$ackFees;
    const message = createBaseQueryTotalAckFeesResponse();
    message.ackFees = ((_object$ackFees = object.ackFees) === null || _object$ackFees === void 0 ? void 0 : _object$ackFees.map(e => Coin.fromPartial(e))) || [];
    return message;
  }
};
function createBaseQueryTotalTimeoutFeesRequest() {
  return {
    packetId: undefined
  };
}
export const QueryTotalTimeoutFeesRequest = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.packetId !== undefined) {
      PacketId.encode(message.packetId, writer.uint32(10).fork()).ldelim();
    }
    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 = createBaseQueryTotalTimeoutFeesRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.packetId = PacketId.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      packetId: isSet(object.packetId) ? PacketId.fromJSON(object.packetId) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    message.packetId !== undefined && (obj.packetId = message.packetId ? PacketId.toJSON(message.packetId) : undefined);
    return obj;
  },
  fromPartial(object) {
    const message = createBaseQueryTotalTimeoutFeesRequest();
    message.packetId = object.packetId !== undefined && object.packetId !== null ? PacketId.fromPartial(object.packetId) : undefined;
    return message;
  }
};
function createBaseQueryTotalTimeoutFeesResponse() {
  return {
    timeoutFees: []
  };
}
export const QueryTotalTimeoutFeesResponse = {
  encode(message, writer = _m0.Writer.create()) {
    for (const v of message.timeoutFees) {
      Coin.encode(v, writer.uint32(10).fork()).ldelim();
    }
    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 = createBaseQueryTotalTimeoutFeesResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.timeoutFees.push(Coin.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      timeoutFees: Array.isArray(object === null || object === void 0 ? void 0 : object.timeoutFees) ? object.timeoutFees.map(e => Coin.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    if (message.timeoutFees) {
      obj.timeoutFees = message.timeoutFees.map(e => e ? Coin.toJSON(e) : undefined);
    } else {
      obj.timeoutFees = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$timeoutFees;
    const message = createBaseQueryTotalTimeoutFeesResponse();
    message.timeoutFees = ((_object$timeoutFees = object.timeoutFees) === null || _object$timeoutFees === void 0 ? void 0 : _object$timeoutFees.map(e => Coin.fromPartial(e))) || [];
    return message;
  }
};
function createBaseQueryPayeeRequest() {
  return {
    channelId: "",
    relayer: ""
  };
}
export const QueryPayeeRequest = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.channelId !== "") {
      writer.uint32(10).string(message.channelId);
    }
    if (message.relayer !== "") {
      writer.uint32(18).string(message.relayer);
    }
    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 = createBaseQueryPayeeRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.channelId = reader.string();
          break;
        case 2:
          message.relayer = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      channelId: isSet(object.channelId) ? String(object.channelId) : "",
      relayer: isSet(object.relayer) ? String(object.relayer) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.channelId !== undefined && (obj.channelId = message.channelId);
    message.relayer !== undefined && (obj.relayer = message.relayer);
    return obj;
  },
  fromPartial(object) {
    var _object$channelId2, _object$relayer;
    const message = createBaseQueryPayeeRequest();
    message.channelId = (_object$channelId2 = object.channelId) !== null && _object$channelId2 !== void 0 ? _object$channelId2 : "";
    message.relayer = (_object$relayer = object.relayer) !== null && _object$relayer !== void 0 ? _object$relayer : "";
    return message;
  }
};
function createBaseQueryPayeeResponse() {
  return {
    payeeAddress: ""
  };
}
export const QueryPayeeResponse = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.payeeAddress !== "") {
      writer.uint32(10).string(message.payeeAddress);
    }
    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 = createBaseQueryPayeeResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.payeeAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      payeeAddress: isSet(object.payeeAddress) ? String(object.payeeAddress) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.payeeAddress !== undefined && (obj.payeeAddress = message.payeeAddress);
    return obj;
  },
  fromPartial(object) {
    var _object$payeeAddress;
    const message = createBaseQueryPayeeResponse();
    message.payeeAddress = (_object$payeeAddress = object.payeeAddress) !== null && _object$payeeAddress !== void 0 ? _object$payeeAddress : "";
    return message;
  }
};
function createBaseQueryCounterpartyPayeeRequest() {
  return {
    channelId: "",
    relayer: ""
  };
}
export const QueryCounterpartyPayeeRequest = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.channelId !== "") {
      writer.uint32(10).string(message.channelId);
    }
    if (message.relayer !== "") {
      writer.uint32(18).string(message.relayer);
    }
    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 = createBaseQueryCounterpartyPayeeRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.channelId = reader.string();
          break;
        case 2:
          message.relayer = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      channelId: isSet(object.channelId) ? String(object.channelId) : "",
      relayer: isSet(object.relayer) ? String(object.relayer) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.channelId !== undefined && (obj.channelId = message.channelId);
    message.relayer !== undefined && (obj.relayer = message.relayer);
    return obj;
  },
  fromPartial(object) {
    var _object$channelId3, _object$relayer2;
    const message = createBaseQueryCounterpartyPayeeRequest();
    message.channelId = (_object$channelId3 = object.channelId) !== null && _object$channelId3 !== void 0 ? _object$channelId3 : "";
    message.relayer = (_object$relayer2 = object.relayer) !== null && _object$relayer2 !== void 0 ? _object$relayer2 : "";
    return message;
  }
};
function createBaseQueryCounterpartyPayeeResponse() {
  return {
    counterpartyPayee: ""
  };
}
export const QueryCounterpartyPayeeResponse = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.counterpartyPayee !== "") {
      writer.uint32(10).string(message.counterpartyPayee);
    }
    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 = createBaseQueryCounterpartyPayeeResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.counterpartyPayee = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      counterpartyPayee: isSet(object.counterpartyPayee) ? String(object.counterpartyPayee) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.counterpartyPayee !== undefined && (obj.counterpartyPayee = message.counterpartyPayee);
    return obj;
  },
  fromPartial(object) {
    var _object$counterpartyP;
    const message = createBaseQueryCounterpartyPayeeResponse();
    message.counterpartyPayee = (_object$counterpartyP = object.counterpartyPayee) !== null && _object$counterpartyP !== void 0 ? _object$counterpartyP : "";
    return message;
  }
};
function createBaseQueryFeeEnabledChannelsRequest() {
  return {
    pagination: undefined,
    queryHeight: Long.UZERO
  };
}
export const QueryFeeEnabledChannelsRequest = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.pagination !== undefined) {
      PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
    }
    if (!message.queryHeight.isZero()) {
      writer.uint32(16).uint64(message.queryHeight);
    }
    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 = createBaseQueryFeeEnabledChannelsRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.pagination = PageRequest.decode(reader, reader.uint32());
          break;
        case 2:
          message.queryHeight = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined,
      queryHeight: isSet(object.queryHeight) ? Long.fromValue(object.queryHeight) : Long.UZERO
    };
  },
  toJSON(message) {
    const obj = {};
    message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined);
    message.queryHeight !== undefined && (obj.queryHeight = (message.queryHeight || Long.UZERO).toString());
    return obj;
  },
  fromPartial(object) {
    const message = createBaseQueryFeeEnabledChannelsRequest();
    message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
    message.queryHeight = object.queryHeight !== undefined && object.queryHeight !== null ? Long.fromValue(object.queryHeight) : Long.UZERO;
    return message;
  }
};
function createBaseQueryFeeEnabledChannelsResponse() {
  return {
    feeEnabledChannels: [],
    pagination: undefined
  };
}
export const QueryFeeEnabledChannelsResponse = {
  encode(message, writer = _m0.Writer.create()) {
    for (const v of message.feeEnabledChannels) {
      FeeEnabledChannel.encode(v, writer.uint32(10).fork()).ldelim();
    }
    if (message.pagination !== undefined) {
      PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
    }
    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 = createBaseQueryFeeEnabledChannelsResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.feeEnabledChannels.push(FeeEnabledChannel.decode(reader, reader.uint32()));
          break;
        case 2:
          message.pagination = PageResponse.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      feeEnabledChannels: Array.isArray(object === null || object === void 0 ? void 0 : object.feeEnabledChannels) ? object.feeEnabledChannels.map(e => FeeEnabledChannel.fromJSON(e)) : [],
      pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    if (message.feeEnabledChannels) {
      obj.feeEnabledChannels = message.feeEnabledChannels.map(e => e ? FeeEnabledChannel.toJSON(e) : undefined);
    } else {
      obj.feeEnabledChannels = [];
    }
    message.pagination !== undefined && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined);
    return obj;
  },
  fromPartial(object) {
    var _object$feeEnabledCha;
    const message = createBaseQueryFeeEnabledChannelsResponse();
    message.feeEnabledChannels = ((_object$feeEnabledCha = object.feeEnabledChannels) === null || _object$feeEnabledCha === void 0 ? void 0 : _object$feeEnabledCha.map(e => FeeEnabledChannel.fromPartial(e))) || [];
    message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined;
    return message;
  }
};
function createBaseQueryFeeEnabledChannelRequest() {
  return {
    portId: "",
    channelId: ""
  };
}
export const QueryFeeEnabledChannelRequest = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.portId !== "") {
      writer.uint32(10).string(message.portId);
    }
    if (message.channelId !== "") {
      writer.uint32(18).string(message.channelId);
    }
    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 = createBaseQueryFeeEnabledChannelRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.portId = reader.string();
          break;
        case 2:
          message.channelId = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      portId: isSet(object.portId) ? String(object.portId) : "",
      channelId: isSet(object.channelId) ? String(object.channelId) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.portId !== undefined && (obj.portId = message.portId);
    message.channelId !== undefined && (obj.channelId = message.channelId);
    return obj;
  },
  fromPartial(object) {
    var _object$portId2, _object$channelId4;
    const message = createBaseQueryFeeEnabledChannelRequest();
    message.portId = (_object$portId2 = object.portId) !== null && _object$portId2 !== void 0 ? _object$portId2 : "";
    message.channelId = (_object$channelId4 = object.channelId) !== null && _object$channelId4 !== void 0 ? _object$channelId4 : "";
    return message;
  }
};
function createBaseQueryFeeEnabledChannelResponse() {
  return {
    feeEnabled: false
  };
}
export const QueryFeeEnabledChannelResponse = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.feeEnabled === true) {
      writer.uint32(8).bool(message.feeEnabled);
    }
    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 = createBaseQueryFeeEnabledChannelResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.feeEnabled = reader.bool();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      feeEnabled: isSet(object.feeEnabled) ? Boolean(object.feeEnabled) : false
    };
  },
  toJSON(message) {
    const obj = {};
    message.feeEnabled !== undefined && (obj.feeEnabled = message.feeEnabled);
    return obj;
  },
  fromPartial(object) {
    var _object$feeEnabled;
    const message = createBaseQueryFeeEnabledChannelResponse();
    message.feeEnabled = (_object$feeEnabled = object.feeEnabled) !== null && _object$feeEnabled !== void 0 ? _object$feeEnabled : false;
    return message;
  }
};