// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
//   protoc-gen-ts_proto  v2.11.4
//   protoc               unknown
// source: cheqd/oracle/v2/tx.proto

/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { CurrencyDeviationThreshold, CurrencyPairProviders, Denom, Params, ParamUpdatePlan } from "./oracle.js";

/**
 * MsgAggregateExchangeRatePrevote represents a message to submit an aggregate
 * exchange rate prevote.
 */
export interface MsgAggregateExchangeRatePrevote {
  hash: string;
  /** Feeder is the author and the signer of the message. */
  feeder: string;
  validator: string;
}

/**
 * MsgAggregateExchangeRatePrevoteResponse defines the
 * Msg/AggregateExchangeRatePrevote response type.
 */
export interface MsgAggregateExchangeRatePrevoteResponse {
}

/**
 * MsgAggregateExchangeRateVote represents a message to submit anaggregate
 * exchange rate vote.
 */
export interface MsgAggregateExchangeRateVote {
  salt: string;
  exchangeRates: string;
  /** Feeder is the author and the signer of the message. */
  feeder: string;
  validator: string;
}

/**
 * MsgAggregateExchangeRateVoteResponse defines the
 * Msg/AggregateExchangeRateVote response type.
 */
export interface MsgAggregateExchangeRateVoteResponse {
}

/**
 * MsgDelegateFeedConsent represents a message to delegate oracle voting rights
 * to another address.
 */
export interface MsgDelegateFeedConsent {
  /** Operator is the author and the signer of the message. */
  operator: string;
  delegate: string;
}

/**
 * MsgDelegateFeedConsentResponse defines the Msg/DelegateFeedConsent response
 * type.
 */
export interface MsgDelegateFeedConsentResponse {
}

/** MsgLegacyGovUpdateParams defines the Msg/MsgLegacyGovUpdateParams request type. */
export interface MsgLegacyGovUpdateParams {
  /** authority is the address of the governance account. */
  authority: string;
  title: string;
  description: string;
  keys: string[];
  changes: Params | undefined;
}

/** MsgLegacyGovUpdateParams defines the Msg/MsgLegacyGovUpdateParams response type. */
export interface MsgLegacyGovUpdateParamsResponse {
}

/** MsgGovUpdateParams defines the Msg/GovUpdateParams request type. */
export interface MsgGovUpdateParams {
  /** authority is the address of the governance account. */
  authority: string;
  /** title of the proposal */
  title: string;
  /** description of the proposal */
  description: string;
  /** plan is the param update plan */
  plan: ParamUpdatePlan | undefined;
}

/** MsgGovUpdateParamsResponse defines the Msg/GovUpdateParams response type. */
export interface MsgGovUpdateParamsResponse {
}

/** MsgGovAddDenoms defines the Msg/GovAddDenoms request type. */
export interface MsgGovAddDenoms {
  /** authority is the address of the governance account. */
  authority: string;
  /** title of the proposal */
  title: string;
  /** description of the proposal */
  description: string;
  /** height at which the param update must be performed */
  height: bigint;
  /** denom_list is the list of denoms to add to the oracle registry */
  denomList: Denom[];
  /** whether or not the assets should be mandatory */
  mandatory: boolean;
  /**
   * reward_band determines what the reward_band will be for every
   * asset in the proposal. If not provided, it will default.
   */
  rewardBand: string;
  /**
   * currency_pair_providers defines the currency provider pairs for
   * each denom being added.
   */
  currencyPairProviders: CurrencyPairProviders[];
  /**
   * currency_deviation_thresholds defines the deviation thresholds
   * for each denom being added.
   */
  currencyDeviationThresholds: CurrencyDeviationThreshold[];
}

/** MsgGovAddDenomResponse defines the Msg/GovAddDenomResponse response type. */
export interface MsgGovAddDenomsResponse {
}

/** MsgGovRemoveCurrencyPairProviders defines the Msg/GovRemoveCurrencyPairProviders request type. */
export interface MsgGovRemoveCurrencyPairProviders {
  /** authority is the address of the governance account. */
  authority: string;
  /** title of the proposal */
  title: string;
  /** description of the proposal */
  description: string;
  /** height at which the param update must be performed */
  height: bigint;
  /** currency_pair_providers to remove from the current CurrencyPairProvidersList */
  currencyPairProviders: CurrencyPairProviders[];
}

/** MsgGovRemoveCurrencyPairProvidersResponse defines the Msg/GovRemoveCurrencyPairProvidersResponse response type. */
export interface MsgGovRemoveCurrencyPairProvidersResponse {
}

/** MsgGovRemoveCurrencyDeviationThresholds defines the Msg/GovRemoveCurrencyDeviationThresholds request type. */
export interface MsgGovRemoveCurrencyDeviationThresholds {
  /** authority is the address of the governance account. */
  authority: string;
  /** title of the proposal */
  title: string;
  /** description of the proposal */
  description: string;
  /** height at which the param update must be performed */
  height: bigint;
  /** currencies to remove from the current CurrencyDeviationThresholdsList */
  currencies: string[];
}

/** MsgGovRemoveCurrencyDeviationThresholdsResponse defines the Msg/GovRemoveCurrencyDeviationThresholdsResponse response type. */
export interface MsgGovRemoveCurrencyDeviationThresholdsResponse {
}

/** MsgGovCancelUpdateParamPlan defines the Msg/GovCancelUpdateParamPlan request type. */
export interface MsgGovCancelUpdateParamPlan {
  /** authority is the address of the governance account. */
  authority: string;
  /** title of the proposal */
  title: string;
  /** description of the proposal */
  description: string;
  /** height of param update plan to cancel */
  height: bigint;
}

/** MsgGovCancelUpdateParamPlanResponse defines the Msg/GovCancelUpdateParamPlanResponse response type. */
export interface MsgGovCancelUpdateParamPlanResponse {
}

function createBaseMsgAggregateExchangeRatePrevote(): MsgAggregateExchangeRatePrevote {
  return { hash: "", feeder: "", validator: "" };
}

export const MsgAggregateExchangeRatePrevote: MessageFns<MsgAggregateExchangeRatePrevote> = {
  encode(message: MsgAggregateExchangeRatePrevote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.hash !== "") {
      writer.uint32(10).string(message.hash);
    }
    if (message.feeder !== "") {
      writer.uint32(18).string(message.feeder);
    }
    if (message.validator !== "") {
      writer.uint32(26).string(message.validator);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgAggregateExchangeRatePrevote {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgAggregateExchangeRatePrevote();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.hash = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.feeder = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.validator = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): MsgAggregateExchangeRatePrevote {
    return {
      hash: isSet(object.hash) ? globalThis.String(object.hash) : "",
      feeder: isSet(object.feeder) ? globalThis.String(object.feeder) : "",
      validator: isSet(object.validator) ? globalThis.String(object.validator) : "",
    };
  },

  toJSON(message: MsgAggregateExchangeRatePrevote): unknown {
    const obj: any = {};
    if (message.hash !== "") {
      obj.hash = message.hash;
    }
    if (message.feeder !== "") {
      obj.feeder = message.feeder;
    }
    if (message.validator !== "") {
      obj.validator = message.validator;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgAggregateExchangeRatePrevote>, I>>(base?: I): MsgAggregateExchangeRatePrevote {
    return MsgAggregateExchangeRatePrevote.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgAggregateExchangeRatePrevote>, I>>(
    object: I,
  ): MsgAggregateExchangeRatePrevote {
    const message = createBaseMsgAggregateExchangeRatePrevote();
    message.hash = object.hash ?? "";
    message.feeder = object.feeder ?? "";
    message.validator = object.validator ?? "";
    return message;
  },
};

function createBaseMsgAggregateExchangeRatePrevoteResponse(): MsgAggregateExchangeRatePrevoteResponse {
  return {};
}

export const MsgAggregateExchangeRatePrevoteResponse: MessageFns<MsgAggregateExchangeRatePrevoteResponse> = {
  encode(_: MsgAggregateExchangeRatePrevoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgAggregateExchangeRatePrevoteResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgAggregateExchangeRatePrevoteResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): MsgAggregateExchangeRatePrevoteResponse {
    return {};
  },

  toJSON(_: MsgAggregateExchangeRatePrevoteResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgAggregateExchangeRatePrevoteResponse>, I>>(
    base?: I,
  ): MsgAggregateExchangeRatePrevoteResponse {
    return MsgAggregateExchangeRatePrevoteResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgAggregateExchangeRatePrevoteResponse>, I>>(
    _: I,
  ): MsgAggregateExchangeRatePrevoteResponse {
    const message = createBaseMsgAggregateExchangeRatePrevoteResponse();
    return message;
  },
};

function createBaseMsgAggregateExchangeRateVote(): MsgAggregateExchangeRateVote {
  return { salt: "", exchangeRates: "", feeder: "", validator: "" };
}

export const MsgAggregateExchangeRateVote: MessageFns<MsgAggregateExchangeRateVote> = {
  encode(message: MsgAggregateExchangeRateVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.salt !== "") {
      writer.uint32(10).string(message.salt);
    }
    if (message.exchangeRates !== "") {
      writer.uint32(18).string(message.exchangeRates);
    }
    if (message.feeder !== "") {
      writer.uint32(26).string(message.feeder);
    }
    if (message.validator !== "") {
      writer.uint32(34).string(message.validator);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgAggregateExchangeRateVote {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgAggregateExchangeRateVote();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.salt = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.exchangeRates = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.feeder = reader.string();
          continue;
        }
        case 4: {
          if (tag !== 34) {
            break;
          }

          message.validator = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): MsgAggregateExchangeRateVote {
    return {
      salt: isSet(object.salt) ? globalThis.String(object.salt) : "",
      exchangeRates: isSet(object.exchangeRates)
        ? globalThis.String(object.exchangeRates)
        : isSet(object.exchange_rates)
        ? globalThis.String(object.exchange_rates)
        : "",
      feeder: isSet(object.feeder) ? globalThis.String(object.feeder) : "",
      validator: isSet(object.validator) ? globalThis.String(object.validator) : "",
    };
  },

  toJSON(message: MsgAggregateExchangeRateVote): unknown {
    const obj: any = {};
    if (message.salt !== "") {
      obj.salt = message.salt;
    }
    if (message.exchangeRates !== "") {
      obj.exchangeRates = message.exchangeRates;
    }
    if (message.feeder !== "") {
      obj.feeder = message.feeder;
    }
    if (message.validator !== "") {
      obj.validator = message.validator;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgAggregateExchangeRateVote>, I>>(base?: I): MsgAggregateExchangeRateVote {
    return MsgAggregateExchangeRateVote.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgAggregateExchangeRateVote>, I>>(object: I): MsgAggregateExchangeRateVote {
    const message = createBaseMsgAggregateExchangeRateVote();
    message.salt = object.salt ?? "";
    message.exchangeRates = object.exchangeRates ?? "";
    message.feeder = object.feeder ?? "";
    message.validator = object.validator ?? "";
    return message;
  },
};

function createBaseMsgAggregateExchangeRateVoteResponse(): MsgAggregateExchangeRateVoteResponse {
  return {};
}

export const MsgAggregateExchangeRateVoteResponse: MessageFns<MsgAggregateExchangeRateVoteResponse> = {
  encode(_: MsgAggregateExchangeRateVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgAggregateExchangeRateVoteResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgAggregateExchangeRateVoteResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): MsgAggregateExchangeRateVoteResponse {
    return {};
  },

  toJSON(_: MsgAggregateExchangeRateVoteResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgAggregateExchangeRateVoteResponse>, I>>(
    base?: I,
  ): MsgAggregateExchangeRateVoteResponse {
    return MsgAggregateExchangeRateVoteResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgAggregateExchangeRateVoteResponse>, I>>(
    _: I,
  ): MsgAggregateExchangeRateVoteResponse {
    const message = createBaseMsgAggregateExchangeRateVoteResponse();
    return message;
  },
};

function createBaseMsgDelegateFeedConsent(): MsgDelegateFeedConsent {
  return { operator: "", delegate: "" };
}

export const MsgDelegateFeedConsent: MessageFns<MsgDelegateFeedConsent> = {
  encode(message: MsgDelegateFeedConsent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.operator !== "") {
      writer.uint32(10).string(message.operator);
    }
    if (message.delegate !== "") {
      writer.uint32(18).string(message.delegate);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateFeedConsent {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgDelegateFeedConsent();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.operator = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.delegate = reader.string();
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): MsgDelegateFeedConsent {
    return {
      operator: isSet(object.operator) ? globalThis.String(object.operator) : "",
      delegate: isSet(object.delegate) ? globalThis.String(object.delegate) : "",
    };
  },

  toJSON(message: MsgDelegateFeedConsent): unknown {
    const obj: any = {};
    if (message.operator !== "") {
      obj.operator = message.operator;
    }
    if (message.delegate !== "") {
      obj.delegate = message.delegate;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgDelegateFeedConsent>, I>>(base?: I): MsgDelegateFeedConsent {
    return MsgDelegateFeedConsent.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgDelegateFeedConsent>, I>>(object: I): MsgDelegateFeedConsent {
    const message = createBaseMsgDelegateFeedConsent();
    message.operator = object.operator ?? "";
    message.delegate = object.delegate ?? "";
    return message;
  },
};

function createBaseMsgDelegateFeedConsentResponse(): MsgDelegateFeedConsentResponse {
  return {};
}

export const MsgDelegateFeedConsentResponse: MessageFns<MsgDelegateFeedConsentResponse> = {
  encode(_: MsgDelegateFeedConsentResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateFeedConsentResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgDelegateFeedConsentResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): MsgDelegateFeedConsentResponse {
    return {};
  },

  toJSON(_: MsgDelegateFeedConsentResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgDelegateFeedConsentResponse>, I>>(base?: I): MsgDelegateFeedConsentResponse {
    return MsgDelegateFeedConsentResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgDelegateFeedConsentResponse>, I>>(_: I): MsgDelegateFeedConsentResponse {
    const message = createBaseMsgDelegateFeedConsentResponse();
    return message;
  },
};

function createBaseMsgLegacyGovUpdateParams(): MsgLegacyGovUpdateParams {
  return { authority: "", title: "", description: "", keys: [], changes: undefined };
}

export const MsgLegacyGovUpdateParams: MessageFns<MsgLegacyGovUpdateParams> = {
  encode(message: MsgLegacyGovUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.authority !== "") {
      writer.uint32(10).string(message.authority);
    }
    if (message.title !== "") {
      writer.uint32(18).string(message.title);
    }
    if (message.description !== "") {
      writer.uint32(26).string(message.description);
    }
    for (const v of message.keys) {
      writer.uint32(34).string(v!);
    }
    if (message.changes !== undefined) {
      Params.encode(message.changes, writer.uint32(42).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgLegacyGovUpdateParams {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgLegacyGovUpdateParams();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.authority = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.title = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.description = reader.string();
          continue;
        }
        case 4: {
          if (tag !== 34) {
            break;
          }

          message.keys.push(reader.string());
          continue;
        }
        case 5: {
          if (tag !== 42) {
            break;
          }

          message.changes = Params.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): MsgLegacyGovUpdateParams {
    return {
      authority: isSet(object.authority) ? globalThis.String(object.authority) : "",
      title: isSet(object.title) ? globalThis.String(object.title) : "",
      description: isSet(object.description) ? globalThis.String(object.description) : "",
      keys: globalThis.Array.isArray(object?.keys) ? object.keys.map((e: any) => globalThis.String(e)) : [],
      changes: isSet(object.changes) ? Params.fromJSON(object.changes) : undefined,
    };
  },

  toJSON(message: MsgLegacyGovUpdateParams): unknown {
    const obj: any = {};
    if (message.authority !== "") {
      obj.authority = message.authority;
    }
    if (message.title !== "") {
      obj.title = message.title;
    }
    if (message.description !== "") {
      obj.description = message.description;
    }
    if (message.keys?.length) {
      obj.keys = message.keys;
    }
    if (message.changes !== undefined) {
      obj.changes = Params.toJSON(message.changes);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgLegacyGovUpdateParams>, I>>(base?: I): MsgLegacyGovUpdateParams {
    return MsgLegacyGovUpdateParams.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgLegacyGovUpdateParams>, I>>(object: I): MsgLegacyGovUpdateParams {
    const message = createBaseMsgLegacyGovUpdateParams();
    message.authority = object.authority ?? "";
    message.title = object.title ?? "";
    message.description = object.description ?? "";
    message.keys = object.keys?.map((e) => e) || [];
    message.changes = (object.changes !== undefined && object.changes !== null)
      ? Params.fromPartial(object.changes)
      : undefined;
    return message;
  },
};

function createBaseMsgLegacyGovUpdateParamsResponse(): MsgLegacyGovUpdateParamsResponse {
  return {};
}

export const MsgLegacyGovUpdateParamsResponse: MessageFns<MsgLegacyGovUpdateParamsResponse> = {
  encode(_: MsgLegacyGovUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgLegacyGovUpdateParamsResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgLegacyGovUpdateParamsResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): MsgLegacyGovUpdateParamsResponse {
    return {};
  },

  toJSON(_: MsgLegacyGovUpdateParamsResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgLegacyGovUpdateParamsResponse>, I>>(
    base?: I,
  ): MsgLegacyGovUpdateParamsResponse {
    return MsgLegacyGovUpdateParamsResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgLegacyGovUpdateParamsResponse>, I>>(
    _: I,
  ): MsgLegacyGovUpdateParamsResponse {
    const message = createBaseMsgLegacyGovUpdateParamsResponse();
    return message;
  },
};

function createBaseMsgGovUpdateParams(): MsgGovUpdateParams {
  return { authority: "", title: "", description: "", plan: undefined };
}

export const MsgGovUpdateParams: MessageFns<MsgGovUpdateParams> = {
  encode(message: MsgGovUpdateParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.authority !== "") {
      writer.uint32(10).string(message.authority);
    }
    if (message.title !== "") {
      writer.uint32(18).string(message.title);
    }
    if (message.description !== "") {
      writer.uint32(26).string(message.description);
    }
    if (message.plan !== undefined) {
      ParamUpdatePlan.encode(message.plan, writer.uint32(34).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgGovUpdateParams {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgGovUpdateParams();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.authority = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.title = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.description = reader.string();
          continue;
        }
        case 4: {
          if (tag !== 34) {
            break;
          }

          message.plan = ParamUpdatePlan.decode(reader, reader.uint32());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): MsgGovUpdateParams {
    return {
      authority: isSet(object.authority) ? globalThis.String(object.authority) : "",
      title: isSet(object.title) ? globalThis.String(object.title) : "",
      description: isSet(object.description) ? globalThis.String(object.description) : "",
      plan: isSet(object.plan) ? ParamUpdatePlan.fromJSON(object.plan) : undefined,
    };
  },

  toJSON(message: MsgGovUpdateParams): unknown {
    const obj: any = {};
    if (message.authority !== "") {
      obj.authority = message.authority;
    }
    if (message.title !== "") {
      obj.title = message.title;
    }
    if (message.description !== "") {
      obj.description = message.description;
    }
    if (message.plan !== undefined) {
      obj.plan = ParamUpdatePlan.toJSON(message.plan);
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgGovUpdateParams>, I>>(base?: I): MsgGovUpdateParams {
    return MsgGovUpdateParams.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgGovUpdateParams>, I>>(object: I): MsgGovUpdateParams {
    const message = createBaseMsgGovUpdateParams();
    message.authority = object.authority ?? "";
    message.title = object.title ?? "";
    message.description = object.description ?? "";
    message.plan = (object.plan !== undefined && object.plan !== null)
      ? ParamUpdatePlan.fromPartial(object.plan)
      : undefined;
    return message;
  },
};

function createBaseMsgGovUpdateParamsResponse(): MsgGovUpdateParamsResponse {
  return {};
}

export const MsgGovUpdateParamsResponse: MessageFns<MsgGovUpdateParamsResponse> = {
  encode(_: MsgGovUpdateParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgGovUpdateParamsResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgGovUpdateParamsResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): MsgGovUpdateParamsResponse {
    return {};
  },

  toJSON(_: MsgGovUpdateParamsResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgGovUpdateParamsResponse>, I>>(base?: I): MsgGovUpdateParamsResponse {
    return MsgGovUpdateParamsResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgGovUpdateParamsResponse>, I>>(_: I): MsgGovUpdateParamsResponse {
    const message = createBaseMsgGovUpdateParamsResponse();
    return message;
  },
};

function createBaseMsgGovAddDenoms(): MsgGovAddDenoms {
  return {
    authority: "",
    title: "",
    description: "",
    height: 0n,
    denomList: [],
    mandatory: false,
    rewardBand: "",
    currencyPairProviders: [],
    currencyDeviationThresholds: [],
  };
}

export const MsgGovAddDenoms: MessageFns<MsgGovAddDenoms> = {
  encode(message: MsgGovAddDenoms, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.authority !== "") {
      writer.uint32(10).string(message.authority);
    }
    if (message.title !== "") {
      writer.uint32(18).string(message.title);
    }
    if (message.description !== "") {
      writer.uint32(26).string(message.description);
    }
    if (message.height !== 0n) {
      if (BigInt.asIntN(64, message.height) !== message.height) {
        throw new globalThis.Error("value provided for field message.height of type int64 too large");
      }
      writer.uint32(32).int64(message.height);
    }
    for (const v of message.denomList) {
      Denom.encode(v!, writer.uint32(42).fork()).join();
    }
    if (message.mandatory !== false) {
      writer.uint32(48).bool(message.mandatory);
    }
    if (message.rewardBand !== "") {
      writer.uint32(58).string(message.rewardBand);
    }
    for (const v of message.currencyPairProviders) {
      CurrencyPairProviders.encode(v!, writer.uint32(66).fork()).join();
    }
    for (const v of message.currencyDeviationThresholds) {
      CurrencyDeviationThreshold.encode(v!, writer.uint32(74).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgGovAddDenoms {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgGovAddDenoms();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.authority = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.title = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.description = reader.string();
          continue;
        }
        case 4: {
          if (tag !== 32) {
            break;
          }

          message.height = reader.int64() as bigint;
          continue;
        }
        case 5: {
          if (tag !== 42) {
            break;
          }

          message.denomList.push(Denom.decode(reader, reader.uint32()));
          continue;
        }
        case 6: {
          if (tag !== 48) {
            break;
          }

          message.mandatory = reader.bool();
          continue;
        }
        case 7: {
          if (tag !== 58) {
            break;
          }

          message.rewardBand = reader.string();
          continue;
        }
        case 8: {
          if (tag !== 66) {
            break;
          }

          message.currencyPairProviders.push(CurrencyPairProviders.decode(reader, reader.uint32()));
          continue;
        }
        case 9: {
          if (tag !== 74) {
            break;
          }

          message.currencyDeviationThresholds.push(CurrencyDeviationThreshold.decode(reader, reader.uint32()));
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): MsgGovAddDenoms {
    return {
      authority: isSet(object.authority) ? globalThis.String(object.authority) : "",
      title: isSet(object.title) ? globalThis.String(object.title) : "",
      description: isSet(object.description) ? globalThis.String(object.description) : "",
      height: isSet(object.height) ? BigInt(object.height) : 0n,
      denomList: globalThis.Array.isArray(object?.denomList)
        ? object.denomList.map((e: any) => Denom.fromJSON(e))
        : globalThis.Array.isArray(object?.denom_list)
        ? object.denom_list.map((e: any) => Denom.fromJSON(e))
        : [],
      mandatory: isSet(object.mandatory) ? globalThis.Boolean(object.mandatory) : false,
      rewardBand: isSet(object.rewardBand)
        ? globalThis.String(object.rewardBand)
        : isSet(object.reward_band)
        ? globalThis.String(object.reward_band)
        : "",
      currencyPairProviders: globalThis.Array.isArray(object?.currencyPairProviders)
        ? object.currencyPairProviders.map((e: any) => CurrencyPairProviders.fromJSON(e))
        : globalThis.Array.isArray(object?.currency_pair_providers)
        ? object.currency_pair_providers.map((e: any) => CurrencyPairProviders.fromJSON(e))
        : [],
      currencyDeviationThresholds: globalThis.Array.isArray(object?.currencyDeviationThresholds)
        ? object.currencyDeviationThresholds.map((e: any) => CurrencyDeviationThreshold.fromJSON(e))
        : globalThis.Array.isArray(object?.currency_deviation_thresholds)
        ? object.currency_deviation_thresholds.map((e: any) => CurrencyDeviationThreshold.fromJSON(e))
        : [],
    };
  },

  toJSON(message: MsgGovAddDenoms): unknown {
    const obj: any = {};
    if (message.authority !== "") {
      obj.authority = message.authority;
    }
    if (message.title !== "") {
      obj.title = message.title;
    }
    if (message.description !== "") {
      obj.description = message.description;
    }
    if (message.height !== 0n) {
      obj.height = message.height.toString();
    }
    if (message.denomList?.length) {
      obj.denomList = message.denomList.map((e) => Denom.toJSON(e));
    }
    if (message.mandatory !== false) {
      obj.mandatory = message.mandatory;
    }
    if (message.rewardBand !== "") {
      obj.rewardBand = message.rewardBand;
    }
    if (message.currencyPairProviders?.length) {
      obj.currencyPairProviders = message.currencyPairProviders.map((e) => CurrencyPairProviders.toJSON(e));
    }
    if (message.currencyDeviationThresholds?.length) {
      obj.currencyDeviationThresholds = message.currencyDeviationThresholds.map((e) =>
        CurrencyDeviationThreshold.toJSON(e)
      );
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgGovAddDenoms>, I>>(base?: I): MsgGovAddDenoms {
    return MsgGovAddDenoms.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgGovAddDenoms>, I>>(object: I): MsgGovAddDenoms {
    const message = createBaseMsgGovAddDenoms();
    message.authority = object.authority ?? "";
    message.title = object.title ?? "";
    message.description = object.description ?? "";
    message.height = object.height ?? 0n;
    message.denomList = object.denomList?.map((e) => Denom.fromPartial(e)) || [];
    message.mandatory = object.mandatory ?? false;
    message.rewardBand = object.rewardBand ?? "";
    message.currencyPairProviders = object.currencyPairProviders?.map((e) => CurrencyPairProviders.fromPartial(e)) ||
      [];
    message.currencyDeviationThresholds =
      object.currencyDeviationThresholds?.map((e) => CurrencyDeviationThreshold.fromPartial(e)) || [];
    return message;
  },
};

function createBaseMsgGovAddDenomsResponse(): MsgGovAddDenomsResponse {
  return {};
}

export const MsgGovAddDenomsResponse: MessageFns<MsgGovAddDenomsResponse> = {
  encode(_: MsgGovAddDenomsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgGovAddDenomsResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgGovAddDenomsResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): MsgGovAddDenomsResponse {
    return {};
  },

  toJSON(_: MsgGovAddDenomsResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgGovAddDenomsResponse>, I>>(base?: I): MsgGovAddDenomsResponse {
    return MsgGovAddDenomsResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgGovAddDenomsResponse>, I>>(_: I): MsgGovAddDenomsResponse {
    const message = createBaseMsgGovAddDenomsResponse();
    return message;
  },
};

function createBaseMsgGovRemoveCurrencyPairProviders(): MsgGovRemoveCurrencyPairProviders {
  return { authority: "", title: "", description: "", height: 0n, currencyPairProviders: [] };
}

export const MsgGovRemoveCurrencyPairProviders: MessageFns<MsgGovRemoveCurrencyPairProviders> = {
  encode(message: MsgGovRemoveCurrencyPairProviders, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.authority !== "") {
      writer.uint32(10).string(message.authority);
    }
    if (message.title !== "") {
      writer.uint32(18).string(message.title);
    }
    if (message.description !== "") {
      writer.uint32(26).string(message.description);
    }
    if (message.height !== 0n) {
      if (BigInt.asIntN(64, message.height) !== message.height) {
        throw new globalThis.Error("value provided for field message.height of type int64 too large");
      }
      writer.uint32(32).int64(message.height);
    }
    for (const v of message.currencyPairProviders) {
      CurrencyPairProviders.encode(v!, writer.uint32(42).fork()).join();
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgGovRemoveCurrencyPairProviders {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgGovRemoveCurrencyPairProviders();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.authority = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.title = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.description = reader.string();
          continue;
        }
        case 4: {
          if (tag !== 32) {
            break;
          }

          message.height = reader.int64() as bigint;
          continue;
        }
        case 5: {
          if (tag !== 42) {
            break;
          }

          message.currencyPairProviders.push(CurrencyPairProviders.decode(reader, reader.uint32()));
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): MsgGovRemoveCurrencyPairProviders {
    return {
      authority: isSet(object.authority) ? globalThis.String(object.authority) : "",
      title: isSet(object.title) ? globalThis.String(object.title) : "",
      description: isSet(object.description) ? globalThis.String(object.description) : "",
      height: isSet(object.height) ? BigInt(object.height) : 0n,
      currencyPairProviders: globalThis.Array.isArray(object?.currencyPairProviders)
        ? object.currencyPairProviders.map((e: any) => CurrencyPairProviders.fromJSON(e))
        : globalThis.Array.isArray(object?.currency_pair_providers)
        ? object.currency_pair_providers.map((e: any) => CurrencyPairProviders.fromJSON(e))
        : [],
    };
  },

  toJSON(message: MsgGovRemoveCurrencyPairProviders): unknown {
    const obj: any = {};
    if (message.authority !== "") {
      obj.authority = message.authority;
    }
    if (message.title !== "") {
      obj.title = message.title;
    }
    if (message.description !== "") {
      obj.description = message.description;
    }
    if (message.height !== 0n) {
      obj.height = message.height.toString();
    }
    if (message.currencyPairProviders?.length) {
      obj.currencyPairProviders = message.currencyPairProviders.map((e) => CurrencyPairProviders.toJSON(e));
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgGovRemoveCurrencyPairProviders>, I>>(
    base?: I,
  ): MsgGovRemoveCurrencyPairProviders {
    return MsgGovRemoveCurrencyPairProviders.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgGovRemoveCurrencyPairProviders>, I>>(
    object: I,
  ): MsgGovRemoveCurrencyPairProviders {
    const message = createBaseMsgGovRemoveCurrencyPairProviders();
    message.authority = object.authority ?? "";
    message.title = object.title ?? "";
    message.description = object.description ?? "";
    message.height = object.height ?? 0n;
    message.currencyPairProviders = object.currencyPairProviders?.map((e) => CurrencyPairProviders.fromPartial(e)) ||
      [];
    return message;
  },
};

function createBaseMsgGovRemoveCurrencyPairProvidersResponse(): MsgGovRemoveCurrencyPairProvidersResponse {
  return {};
}

export const MsgGovRemoveCurrencyPairProvidersResponse: MessageFns<MsgGovRemoveCurrencyPairProvidersResponse> = {
  encode(_: MsgGovRemoveCurrencyPairProvidersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgGovRemoveCurrencyPairProvidersResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgGovRemoveCurrencyPairProvidersResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): MsgGovRemoveCurrencyPairProvidersResponse {
    return {};
  },

  toJSON(_: MsgGovRemoveCurrencyPairProvidersResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgGovRemoveCurrencyPairProvidersResponse>, I>>(
    base?: I,
  ): MsgGovRemoveCurrencyPairProvidersResponse {
    return MsgGovRemoveCurrencyPairProvidersResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgGovRemoveCurrencyPairProvidersResponse>, I>>(
    _: I,
  ): MsgGovRemoveCurrencyPairProvidersResponse {
    const message = createBaseMsgGovRemoveCurrencyPairProvidersResponse();
    return message;
  },
};

function createBaseMsgGovRemoveCurrencyDeviationThresholds(): MsgGovRemoveCurrencyDeviationThresholds {
  return { authority: "", title: "", description: "", height: 0n, currencies: [] };
}

export const MsgGovRemoveCurrencyDeviationThresholds: MessageFns<MsgGovRemoveCurrencyDeviationThresholds> = {
  encode(message: MsgGovRemoveCurrencyDeviationThresholds, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.authority !== "") {
      writer.uint32(10).string(message.authority);
    }
    if (message.title !== "") {
      writer.uint32(18).string(message.title);
    }
    if (message.description !== "") {
      writer.uint32(26).string(message.description);
    }
    if (message.height !== 0n) {
      if (BigInt.asIntN(64, message.height) !== message.height) {
        throw new globalThis.Error("value provided for field message.height of type int64 too large");
      }
      writer.uint32(32).int64(message.height);
    }
    for (const v of message.currencies) {
      writer.uint32(42).string(v!);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgGovRemoveCurrencyDeviationThresholds {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgGovRemoveCurrencyDeviationThresholds();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.authority = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.title = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.description = reader.string();
          continue;
        }
        case 4: {
          if (tag !== 32) {
            break;
          }

          message.height = reader.int64() as bigint;
          continue;
        }
        case 5: {
          if (tag !== 42) {
            break;
          }

          message.currencies.push(reader.string());
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): MsgGovRemoveCurrencyDeviationThresholds {
    return {
      authority: isSet(object.authority) ? globalThis.String(object.authority) : "",
      title: isSet(object.title) ? globalThis.String(object.title) : "",
      description: isSet(object.description) ? globalThis.String(object.description) : "",
      height: isSet(object.height) ? BigInt(object.height) : 0n,
      currencies: globalThis.Array.isArray(object?.currencies)
        ? object.currencies.map((e: any) => globalThis.String(e))
        : [],
    };
  },

  toJSON(message: MsgGovRemoveCurrencyDeviationThresholds): unknown {
    const obj: any = {};
    if (message.authority !== "") {
      obj.authority = message.authority;
    }
    if (message.title !== "") {
      obj.title = message.title;
    }
    if (message.description !== "") {
      obj.description = message.description;
    }
    if (message.height !== 0n) {
      obj.height = message.height.toString();
    }
    if (message.currencies?.length) {
      obj.currencies = message.currencies;
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgGovRemoveCurrencyDeviationThresholds>, I>>(
    base?: I,
  ): MsgGovRemoveCurrencyDeviationThresholds {
    return MsgGovRemoveCurrencyDeviationThresholds.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgGovRemoveCurrencyDeviationThresholds>, I>>(
    object: I,
  ): MsgGovRemoveCurrencyDeviationThresholds {
    const message = createBaseMsgGovRemoveCurrencyDeviationThresholds();
    message.authority = object.authority ?? "";
    message.title = object.title ?? "";
    message.description = object.description ?? "";
    message.height = object.height ?? 0n;
    message.currencies = object.currencies?.map((e) => e) || [];
    return message;
  },
};

function createBaseMsgGovRemoveCurrencyDeviationThresholdsResponse(): MsgGovRemoveCurrencyDeviationThresholdsResponse {
  return {};
}

export const MsgGovRemoveCurrencyDeviationThresholdsResponse: MessageFns<
  MsgGovRemoveCurrencyDeviationThresholdsResponse
> = {
  encode(_: MsgGovRemoveCurrencyDeviationThresholdsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgGovRemoveCurrencyDeviationThresholdsResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgGovRemoveCurrencyDeviationThresholdsResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): MsgGovRemoveCurrencyDeviationThresholdsResponse {
    return {};
  },

  toJSON(_: MsgGovRemoveCurrencyDeviationThresholdsResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgGovRemoveCurrencyDeviationThresholdsResponse>, I>>(
    base?: I,
  ): MsgGovRemoveCurrencyDeviationThresholdsResponse {
    return MsgGovRemoveCurrencyDeviationThresholdsResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgGovRemoveCurrencyDeviationThresholdsResponse>, I>>(
    _: I,
  ): MsgGovRemoveCurrencyDeviationThresholdsResponse {
    const message = createBaseMsgGovRemoveCurrencyDeviationThresholdsResponse();
    return message;
  },
};

function createBaseMsgGovCancelUpdateParamPlan(): MsgGovCancelUpdateParamPlan {
  return { authority: "", title: "", description: "", height: 0n };
}

export const MsgGovCancelUpdateParamPlan: MessageFns<MsgGovCancelUpdateParamPlan> = {
  encode(message: MsgGovCancelUpdateParamPlan, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    if (message.authority !== "") {
      writer.uint32(10).string(message.authority);
    }
    if (message.title !== "") {
      writer.uint32(18).string(message.title);
    }
    if (message.description !== "") {
      writer.uint32(26).string(message.description);
    }
    if (message.height !== 0n) {
      if (BigInt.asIntN(64, message.height) !== message.height) {
        throw new globalThis.Error("value provided for field message.height of type int64 too large");
      }
      writer.uint32(32).int64(message.height);
    }
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgGovCancelUpdateParamPlan {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgGovCancelUpdateParamPlan();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1: {
          if (tag !== 10) {
            break;
          }

          message.authority = reader.string();
          continue;
        }
        case 2: {
          if (tag !== 18) {
            break;
          }

          message.title = reader.string();
          continue;
        }
        case 3: {
          if (tag !== 26) {
            break;
          }

          message.description = reader.string();
          continue;
        }
        case 4: {
          if (tag !== 32) {
            break;
          }

          message.height = reader.int64() as bigint;
          continue;
        }
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(object: any): MsgGovCancelUpdateParamPlan {
    return {
      authority: isSet(object.authority) ? globalThis.String(object.authority) : "",
      title: isSet(object.title) ? globalThis.String(object.title) : "",
      description: isSet(object.description) ? globalThis.String(object.description) : "",
      height: isSet(object.height) ? BigInt(object.height) : 0n,
    };
  },

  toJSON(message: MsgGovCancelUpdateParamPlan): unknown {
    const obj: any = {};
    if (message.authority !== "") {
      obj.authority = message.authority;
    }
    if (message.title !== "") {
      obj.title = message.title;
    }
    if (message.description !== "") {
      obj.description = message.description;
    }
    if (message.height !== 0n) {
      obj.height = message.height.toString();
    }
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgGovCancelUpdateParamPlan>, I>>(base?: I): MsgGovCancelUpdateParamPlan {
    return MsgGovCancelUpdateParamPlan.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgGovCancelUpdateParamPlan>, I>>(object: I): MsgGovCancelUpdateParamPlan {
    const message = createBaseMsgGovCancelUpdateParamPlan();
    message.authority = object.authority ?? "";
    message.title = object.title ?? "";
    message.description = object.description ?? "";
    message.height = object.height ?? 0n;
    return message;
  },
};

function createBaseMsgGovCancelUpdateParamPlanResponse(): MsgGovCancelUpdateParamPlanResponse {
  return {};
}

export const MsgGovCancelUpdateParamPlanResponse: MessageFns<MsgGovCancelUpdateParamPlanResponse> = {
  encode(_: MsgGovCancelUpdateParamPlanResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
    return writer;
  },

  decode(input: BinaryReader | Uint8Array, length?: number): MsgGovCancelUpdateParamPlanResponse {
    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
    const end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgGovCancelUpdateParamPlanResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
      }
      if ((tag & 7) === 4 || tag === 0) {
        break;
      }
      reader.skip(tag & 7);
    }
    return message;
  },

  fromJSON(_: any): MsgGovCancelUpdateParamPlanResponse {
    return {};
  },

  toJSON(_: MsgGovCancelUpdateParamPlanResponse): unknown {
    const obj: any = {};
    return obj;
  },

  create<I extends Exact<DeepPartial<MsgGovCancelUpdateParamPlanResponse>, I>>(
    base?: I,
  ): MsgGovCancelUpdateParamPlanResponse {
    return MsgGovCancelUpdateParamPlanResponse.fromPartial(base ?? ({} as any));
  },
  fromPartial<I extends Exact<DeepPartial<MsgGovCancelUpdateParamPlanResponse>, I>>(
    _: I,
  ): MsgGovCancelUpdateParamPlanResponse {
    const message = createBaseMsgGovCancelUpdateParamPlanResponse();
    return message;
  },
};

/** Msg defines the oracle Msg service. */
export interface Msg {
  /**
   * AggregateExchangeRatePrevote defines a method for submitting an aggregate
   * exchange rate prevote.
   */
  AggregateExchangeRatePrevote(
    request: MsgAggregateExchangeRatePrevote,
  ): Promise<MsgAggregateExchangeRatePrevoteResponse>;
  /**
   * AggregateExchangeRateVote defines a method for submitting an aggregate
   * exchange rate vote.
   */
  AggregateExchangeRateVote(request: MsgAggregateExchangeRateVote): Promise<MsgAggregateExchangeRateVoteResponse>;
  /** DelegateFeedConsent defines a method for setting the feeder delegation. */
  DelegateFeedConsent(request: MsgDelegateFeedConsent): Promise<MsgDelegateFeedConsentResponse>;
  /** LegacyGovUpdateParams defines the legacy message that updates the oracle parameters. */
  LegacyGovUpdateParams(request: MsgLegacyGovUpdateParams): Promise<MsgLegacyGovUpdateParamsResponse>;
  /** GovUpdateParams updates the oracle parameters. */
  GovUpdateParams(request: MsgGovUpdateParams): Promise<MsgGovUpdateParamsResponse>;
  /** GovAddDenoms updates the oracle parameters to include a new tokens. */
  GovAddDenoms(request: MsgGovAddDenoms): Promise<MsgGovAddDenomsResponse>;
  /**
   * GovRemoveCurrencyPairProviders updates the oracle parameters to remove a list of
   * currency pair providers.
   */
  GovRemoveCurrencyPairProviders(
    request: MsgGovRemoveCurrencyPairProviders,
  ): Promise<MsgGovRemoveCurrencyPairProvidersResponse>;
  /**
   * GovRemoveCurrencyDeviationThresholds updates the oracle parameters to remove a list
   * of currency deviation thresholds.
   */
  GovRemoveCurrencyDeviationThresholds(
    request: MsgGovRemoveCurrencyDeviationThresholds,
  ): Promise<MsgGovRemoveCurrencyDeviationThresholdsResponse>;
  /** GovCancelUpdateParamPlan cancels a plan to update the oracle parameters. */
  GovCancelUpdateParamPlan(request: MsgGovCancelUpdateParamPlan): Promise<MsgGovCancelUpdateParamPlanResponse>;
}

export const MsgServiceName = "cheqd.oracle.v2.Msg";
export class MsgClientImpl implements Msg {
  private readonly rpc: Rpc;
  private readonly service: string;
  constructor(rpc: Rpc, opts?: { service?: string }) {
    this.service = opts?.service || MsgServiceName;
    this.rpc = rpc;
    this.AggregateExchangeRatePrevote = this.AggregateExchangeRatePrevote.bind(this);
    this.AggregateExchangeRateVote = this.AggregateExchangeRateVote.bind(this);
    this.DelegateFeedConsent = this.DelegateFeedConsent.bind(this);
    this.LegacyGovUpdateParams = this.LegacyGovUpdateParams.bind(this);
    this.GovUpdateParams = this.GovUpdateParams.bind(this);
    this.GovAddDenoms = this.GovAddDenoms.bind(this);
    this.GovRemoveCurrencyPairProviders = this.GovRemoveCurrencyPairProviders.bind(this);
    this.GovRemoveCurrencyDeviationThresholds = this.GovRemoveCurrencyDeviationThresholds.bind(this);
    this.GovCancelUpdateParamPlan = this.GovCancelUpdateParamPlan.bind(this);
  }
  AggregateExchangeRatePrevote(
    request: MsgAggregateExchangeRatePrevote,
  ): Promise<MsgAggregateExchangeRatePrevoteResponse> {
    const data = MsgAggregateExchangeRatePrevote.encode(request).finish();
    const promise = this.rpc.request(this.service, "AggregateExchangeRatePrevote", data);
    return promise.then((data) => MsgAggregateExchangeRatePrevoteResponse.decode(new BinaryReader(data)));
  }

  AggregateExchangeRateVote(request: MsgAggregateExchangeRateVote): Promise<MsgAggregateExchangeRateVoteResponse> {
    const data = MsgAggregateExchangeRateVote.encode(request).finish();
    const promise = this.rpc.request(this.service, "AggregateExchangeRateVote", data);
    return promise.then((data) => MsgAggregateExchangeRateVoteResponse.decode(new BinaryReader(data)));
  }

  DelegateFeedConsent(request: MsgDelegateFeedConsent): Promise<MsgDelegateFeedConsentResponse> {
    const data = MsgDelegateFeedConsent.encode(request).finish();
    const promise = this.rpc.request(this.service, "DelegateFeedConsent", data);
    return promise.then((data) => MsgDelegateFeedConsentResponse.decode(new BinaryReader(data)));
  }

  LegacyGovUpdateParams(request: MsgLegacyGovUpdateParams): Promise<MsgLegacyGovUpdateParamsResponse> {
    const data = MsgLegacyGovUpdateParams.encode(request).finish();
    const promise = this.rpc.request(this.service, "LegacyGovUpdateParams", data);
    return promise.then((data) => MsgLegacyGovUpdateParamsResponse.decode(new BinaryReader(data)));
  }

  GovUpdateParams(request: MsgGovUpdateParams): Promise<MsgGovUpdateParamsResponse> {
    const data = MsgGovUpdateParams.encode(request).finish();
    const promise = this.rpc.request(this.service, "GovUpdateParams", data);
    return promise.then((data) => MsgGovUpdateParamsResponse.decode(new BinaryReader(data)));
  }

  GovAddDenoms(request: MsgGovAddDenoms): Promise<MsgGovAddDenomsResponse> {
    const data = MsgGovAddDenoms.encode(request).finish();
    const promise = this.rpc.request(this.service, "GovAddDenoms", data);
    return promise.then((data) => MsgGovAddDenomsResponse.decode(new BinaryReader(data)));
  }

  GovRemoveCurrencyPairProviders(
    request: MsgGovRemoveCurrencyPairProviders,
  ): Promise<MsgGovRemoveCurrencyPairProvidersResponse> {
    const data = MsgGovRemoveCurrencyPairProviders.encode(request).finish();
    const promise = this.rpc.request(this.service, "GovRemoveCurrencyPairProviders", data);
    return promise.then((data) => MsgGovRemoveCurrencyPairProvidersResponse.decode(new BinaryReader(data)));
  }

  GovRemoveCurrencyDeviationThresholds(
    request: MsgGovRemoveCurrencyDeviationThresholds,
  ): Promise<MsgGovRemoveCurrencyDeviationThresholdsResponse> {
    const data = MsgGovRemoveCurrencyDeviationThresholds.encode(request).finish();
    const promise = this.rpc.request(this.service, "GovRemoveCurrencyDeviationThresholds", data);
    return promise.then((data) => MsgGovRemoveCurrencyDeviationThresholdsResponse.decode(new BinaryReader(data)));
  }

  GovCancelUpdateParamPlan(request: MsgGovCancelUpdateParamPlan): Promise<MsgGovCancelUpdateParamPlanResponse> {
    const data = MsgGovCancelUpdateParamPlan.encode(request).finish();
    const promise = this.rpc.request(this.service, "GovCancelUpdateParamPlan", data);
    return promise.then((data) => MsgGovCancelUpdateParamPlanResponse.decode(new BinaryReader(data)));
  }
}

interface Rpc {
  request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
}

type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;

type DeepPartial<T> = T extends Builtin ? T
  : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
  : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
  : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
  : Partial<T>;

type KeysOfUnion<T> = T extends T ? keyof T : never;
type Exact<P, I extends P> = P extends Builtin ? P
  : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };

function isSet(value: any): boolean {
  return value !== null && value !== undefined;
}

interface MessageFns<T> {
  encode(message: T, writer?: BinaryWriter): BinaryWriter;
  decode(input: BinaryReader | Uint8Array, length?: number): T;
  fromJSON(object: any): T;
  toJSON(message: T): unknown;
  create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
  fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
