import { BridgeValidator } from "./types";
import { Long } from "../../../helpers";
import * as _m0 from "protobufjs/minimal";
function createBaseEventAttestationObserved() {
  return {
    attestationType: 0,
    bridgeContract: "",
    bridgeChainId: Long.UZERO,
    attestationId: new Uint8Array(),
    nonce: Long.UZERO
  };
}
export const EventAttestationObserved = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.attestationType !== 0) {
      writer.uint32(8).int32(message.attestationType);
    }
    if (message.bridgeContract !== "") {
      writer.uint32(18).string(message.bridgeContract);
    }
    if (!message.bridgeChainId.isZero()) {
      writer.uint32(24).uint64(message.bridgeChainId);
    }
    if (message.attestationId.length !== 0) {
      writer.uint32(34).bytes(message.attestationId);
    }
    if (!message.nonce.isZero()) {
      writer.uint32(40).uint64(message.nonce);
    }
    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 = createBaseEventAttestationObserved();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.attestationType = reader.int32();
          break;
        case 2:
          message.bridgeContract = reader.string();
          break;
        case 3:
          message.bridgeChainId = reader.uint64();
          break;
        case 4:
          message.attestationId = reader.bytes();
          break;
        case 5:
          message.nonce = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$attestationTy, _object$bridgeContrac, _object$attestationId;
    const message = createBaseEventAttestationObserved();
    message.attestationType = (_object$attestationTy = object.attestationType) !== null && _object$attestationTy !== void 0 ? _object$attestationTy : 0;
    message.bridgeContract = (_object$bridgeContrac = object.bridgeContract) !== null && _object$bridgeContrac !== void 0 ? _object$bridgeContrac : "";
    message.bridgeChainId = object.bridgeChainId !== undefined && object.bridgeChainId !== null ? Long.fromValue(object.bridgeChainId) : Long.UZERO;
    message.attestationId = (_object$attestationId = object.attestationId) !== null && _object$attestationId !== void 0 ? _object$attestationId : new Uint8Array();
    message.nonce = object.nonce !== undefined && object.nonce !== null ? Long.fromValue(object.nonce) : Long.UZERO;
    return message;
  }
};
function createBaseEventBridgeWithdrawCanceled() {
  return {
    bridgeContract: "",
    bridgeChainId: Long.UZERO
  };
}
export const EventBridgeWithdrawCanceled = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.bridgeContract !== "") {
      writer.uint32(10).string(message.bridgeContract);
    }
    if (!message.bridgeChainId.isZero()) {
      writer.uint32(16).uint64(message.bridgeChainId);
    }
    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 = createBaseEventBridgeWithdrawCanceled();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bridgeContract = reader.string();
          break;
        case 2:
          message.bridgeChainId = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$bridgeContrac2;
    const message = createBaseEventBridgeWithdrawCanceled();
    message.bridgeContract = (_object$bridgeContrac2 = object.bridgeContract) !== null && _object$bridgeContrac2 !== void 0 ? _object$bridgeContrac2 : "";
    message.bridgeChainId = object.bridgeChainId !== undefined && object.bridgeChainId !== null ? Long.fromValue(object.bridgeChainId) : Long.UZERO;
    return message;
  }
};
function createBaseEventOutgoingBatch() {
  return {
    denom: "",
    orchestratorAddress: "",
    batchNonce: Long.UZERO,
    batchTimeout: Long.UZERO,
    batchTxIds: []
  };
}
export const EventOutgoingBatch = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.denom !== "") {
      writer.uint32(10).string(message.denom);
    }
    if (message.orchestratorAddress !== "") {
      writer.uint32(18).string(message.orchestratorAddress);
    }
    if (!message.batchNonce.isZero()) {
      writer.uint32(24).uint64(message.batchNonce);
    }
    if (!message.batchTimeout.isZero()) {
      writer.uint32(32).uint64(message.batchTimeout);
    }
    writer.uint32(42).fork();
    for (const v of message.batchTxIds) {
      writer.uint64(v);
    }
    writer.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 = createBaseEventOutgoingBatch();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.denom = reader.string();
          break;
        case 2:
          message.orchestratorAddress = reader.string();
          break;
        case 3:
          message.batchNonce = reader.uint64();
          break;
        case 4:
          message.batchTimeout = reader.uint64();
          break;
        case 5:
          if ((tag & 7) === 2) {
            const end2 = reader.uint32() + reader.pos;
            while (reader.pos < end2) {
              message.batchTxIds.push(reader.uint64());
            }
          } else {
            message.batchTxIds.push(reader.uint64());
          }
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$denom, _object$orchestratorA, _object$batchTxIds;
    const message = createBaseEventOutgoingBatch();
    message.denom = (_object$denom = object.denom) !== null && _object$denom !== void 0 ? _object$denom : "";
    message.orchestratorAddress = (_object$orchestratorA = object.orchestratorAddress) !== null && _object$orchestratorA !== void 0 ? _object$orchestratorA : "";
    message.batchNonce = object.batchNonce !== undefined && object.batchNonce !== null ? Long.fromValue(object.batchNonce) : Long.UZERO;
    message.batchTimeout = object.batchTimeout !== undefined && object.batchTimeout !== null ? Long.fromValue(object.batchTimeout) : Long.UZERO;
    message.batchTxIds = ((_object$batchTxIds = object.batchTxIds) === null || _object$batchTxIds === void 0 ? void 0 : _object$batchTxIds.map(e => Long.fromValue(e))) || [];
    return message;
  }
};
function createBaseEventOutgoingBatchCanceled() {
  return {
    bridgeContract: "",
    bridgeChainId: Long.UZERO,
    batchId: Long.UZERO,
    nonce: Long.UZERO
  };
}
export const EventOutgoingBatchCanceled = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.bridgeContract !== "") {
      writer.uint32(10).string(message.bridgeContract);
    }
    if (!message.bridgeChainId.isZero()) {
      writer.uint32(16).uint64(message.bridgeChainId);
    }
    if (!message.batchId.isZero()) {
      writer.uint32(24).uint64(message.batchId);
    }
    if (!message.nonce.isZero()) {
      writer.uint32(32).uint64(message.nonce);
    }
    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 = createBaseEventOutgoingBatchCanceled();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.bridgeContract = reader.string();
          break;
        case 2:
          message.bridgeChainId = reader.uint64();
          break;
        case 3:
          message.batchId = reader.uint64();
          break;
        case 4:
          message.nonce = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$bridgeContrac3;
    const message = createBaseEventOutgoingBatchCanceled();
    message.bridgeContract = (_object$bridgeContrac3 = object.bridgeContract) !== null && _object$bridgeContrac3 !== void 0 ? _object$bridgeContrac3 : "";
    message.bridgeChainId = object.bridgeChainId !== undefined && object.bridgeChainId !== null ? Long.fromValue(object.bridgeChainId) : Long.UZERO;
    message.batchId = object.batchId !== undefined && object.batchId !== null ? Long.fromValue(object.batchId) : Long.UZERO;
    message.nonce = object.nonce !== undefined && object.nonce !== null ? Long.fromValue(object.nonce) : Long.UZERO;
    return message;
  }
};
function createBaseEventValsetUpdateRequest() {
  return {
    valsetNonce: Long.UZERO,
    valsetHeight: Long.UZERO,
    valsetMembers: [],
    rewardAmount: "",
    rewardToken: ""
  };
}
export const EventValsetUpdateRequest = {
  encode(message, writer = _m0.Writer.create()) {
    if (!message.valsetNonce.isZero()) {
      writer.uint32(8).uint64(message.valsetNonce);
    }
    if (!message.valsetHeight.isZero()) {
      writer.uint32(16).uint64(message.valsetHeight);
    }
    for (const v of message.valsetMembers) {
      BridgeValidator.encode(v, writer.uint32(26).fork()).ldelim();
    }
    if (message.rewardAmount !== "") {
      writer.uint32(34).string(message.rewardAmount);
    }
    if (message.rewardToken !== "") {
      writer.uint32(42).string(message.rewardToken);
    }
    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 = createBaseEventValsetUpdateRequest();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.valsetNonce = reader.uint64();
          break;
        case 2:
          message.valsetHeight = reader.uint64();
          break;
        case 3:
          message.valsetMembers.push(BridgeValidator.decode(reader, reader.uint32()));
          break;
        case 4:
          message.rewardAmount = reader.string();
          break;
        case 5:
          message.rewardToken = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$valsetMembers, _object$rewardAmount, _object$rewardToken;
    const message = createBaseEventValsetUpdateRequest();
    message.valsetNonce = object.valsetNonce !== undefined && object.valsetNonce !== null ? Long.fromValue(object.valsetNonce) : Long.UZERO;
    message.valsetHeight = object.valsetHeight !== undefined && object.valsetHeight !== null ? Long.fromValue(object.valsetHeight) : Long.UZERO;
    message.valsetMembers = ((_object$valsetMembers = object.valsetMembers) === null || _object$valsetMembers === void 0 ? void 0 : _object$valsetMembers.map(e => BridgeValidator.fromPartial(e))) || [];
    message.rewardAmount = (_object$rewardAmount = object.rewardAmount) !== null && _object$rewardAmount !== void 0 ? _object$rewardAmount : "";
    message.rewardToken = (_object$rewardToken = object.rewardToken) !== null && _object$rewardToken !== void 0 ? _object$rewardToken : "";
    return message;
  }
};
function createBaseEventSetOrchestratorAddresses() {
  return {
    validatorAddress: "",
    orchestratorAddress: "",
    operatorEthAddress: ""
  };
}
export const EventSetOrchestratorAddresses = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.validatorAddress !== "") {
      writer.uint32(10).string(message.validatorAddress);
    }
    if (message.orchestratorAddress !== "") {
      writer.uint32(18).string(message.orchestratorAddress);
    }
    if (message.operatorEthAddress !== "") {
      writer.uint32(26).string(message.operatorEthAddress);
    }
    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 = createBaseEventSetOrchestratorAddresses();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.validatorAddress = reader.string();
          break;
        case 2:
          message.orchestratorAddress = reader.string();
          break;
        case 3:
          message.operatorEthAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$validatorAddr, _object$orchestratorA2, _object$operatorEthAd;
    const message = createBaseEventSetOrchestratorAddresses();
    message.validatorAddress = (_object$validatorAddr = object.validatorAddress) !== null && _object$validatorAddr !== void 0 ? _object$validatorAddr : "";
    message.orchestratorAddress = (_object$orchestratorA2 = object.orchestratorAddress) !== null && _object$orchestratorA2 !== void 0 ? _object$orchestratorA2 : "";
    message.operatorEthAddress = (_object$operatorEthAd = object.operatorEthAddress) !== null && _object$operatorEthAd !== void 0 ? _object$operatorEthAd : "";
    return message;
  }
};
function createBaseEventValsetConfirm() {
  return {
    valsetNonce: Long.UZERO,
    orchestratorAddress: ""
  };
}
export const EventValsetConfirm = {
  encode(message, writer = _m0.Writer.create()) {
    if (!message.valsetNonce.isZero()) {
      writer.uint32(8).uint64(message.valsetNonce);
    }
    if (message.orchestratorAddress !== "") {
      writer.uint32(18).string(message.orchestratorAddress);
    }
    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 = createBaseEventValsetConfirm();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.valsetNonce = reader.uint64();
          break;
        case 2:
          message.orchestratorAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$orchestratorA3;
    const message = createBaseEventValsetConfirm();
    message.valsetNonce = object.valsetNonce !== undefined && object.valsetNonce !== null ? Long.fromValue(object.valsetNonce) : Long.UZERO;
    message.orchestratorAddress = (_object$orchestratorA3 = object.orchestratorAddress) !== null && _object$orchestratorA3 !== void 0 ? _object$orchestratorA3 : "";
    return message;
  }
};
function createBaseEventSendToEth() {
  return {
    outgoingTxId: Long.UZERO,
    sender: "",
    receiver: "",
    amount: "",
    bridgeFee: ""
  };
}
export const EventSendToEth = {
  encode(message, writer = _m0.Writer.create()) {
    if (!message.outgoingTxId.isZero()) {
      writer.uint32(8).uint64(message.outgoingTxId);
    }
    if (message.sender !== "") {
      writer.uint32(18).string(message.sender);
    }
    if (message.receiver !== "") {
      writer.uint32(26).string(message.receiver);
    }
    if (message.amount !== "") {
      writer.uint32(34).string(message.amount);
    }
    if (message.bridgeFee !== "") {
      writer.uint32(42).string(message.bridgeFee);
    }
    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 = createBaseEventSendToEth();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.outgoingTxId = reader.uint64();
          break;
        case 2:
          message.sender = reader.string();
          break;
        case 3:
          message.receiver = reader.string();
          break;
        case 4:
          message.amount = reader.string();
          break;
        case 5:
          message.bridgeFee = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$sender, _object$receiver, _object$amount, _object$bridgeFee;
    const message = createBaseEventSendToEth();
    message.outgoingTxId = object.outgoingTxId !== undefined && object.outgoingTxId !== null ? Long.fromValue(object.outgoingTxId) : Long.UZERO;
    message.sender = (_object$sender = object.sender) !== null && _object$sender !== void 0 ? _object$sender : "";
    message.receiver = (_object$receiver = object.receiver) !== null && _object$receiver !== void 0 ? _object$receiver : "";
    message.amount = (_object$amount = object.amount) !== null && _object$amount !== void 0 ? _object$amount : "";
    message.bridgeFee = (_object$bridgeFee = object.bridgeFee) !== null && _object$bridgeFee !== void 0 ? _object$bridgeFee : "";
    return message;
  }
};
function createBaseEventConfirmBatch() {
  return {
    batchNonce: Long.UZERO,
    orchestratorAddress: ""
  };
}
export const EventConfirmBatch = {
  encode(message, writer = _m0.Writer.create()) {
    if (!message.batchNonce.isZero()) {
      writer.uint32(8).uint64(message.batchNonce);
    }
    if (message.orchestratorAddress !== "") {
      writer.uint32(18).string(message.orchestratorAddress);
    }
    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 = createBaseEventConfirmBatch();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.batchNonce = reader.uint64();
          break;
        case 2:
          message.orchestratorAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$orchestratorA4;
    const message = createBaseEventConfirmBatch();
    message.batchNonce = object.batchNonce !== undefined && object.batchNonce !== null ? Long.fromValue(object.batchNonce) : Long.UZERO;
    message.orchestratorAddress = (_object$orchestratorA4 = object.orchestratorAddress) !== null && _object$orchestratorA4 !== void 0 ? _object$orchestratorA4 : "";
    return message;
  }
};
function createBaseEventAttestationVote() {
  return {
    eventNonce: Long.UZERO,
    attestationId: new Uint8Array(),
    voter: ""
  };
}
export const EventAttestationVote = {
  encode(message, writer = _m0.Writer.create()) {
    if (!message.eventNonce.isZero()) {
      writer.uint32(8).uint64(message.eventNonce);
    }
    if (message.attestationId.length !== 0) {
      writer.uint32(18).bytes(message.attestationId);
    }
    if (message.voter !== "") {
      writer.uint32(26).string(message.voter);
    }
    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 = createBaseEventAttestationVote();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.eventNonce = reader.uint64();
          break;
        case 2:
          message.attestationId = reader.bytes();
          break;
        case 3:
          message.voter = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$attestationId2, _object$voter;
    const message = createBaseEventAttestationVote();
    message.eventNonce = object.eventNonce !== undefined && object.eventNonce !== null ? Long.fromValue(object.eventNonce) : Long.UZERO;
    message.attestationId = (_object$attestationId2 = object.attestationId) !== null && _object$attestationId2 !== void 0 ? _object$attestationId2 : new Uint8Array();
    message.voter = (_object$voter = object.voter) !== null && _object$voter !== void 0 ? _object$voter : "";
    return message;
  }
};
function createBaseEventDepositClaim() {
  return {
    eventNonce: Long.UZERO,
    eventHeight: Long.UZERO,
    attestationId: new Uint8Array(),
    ethereumSender: "",
    cosmosReceiver: "",
    tokenContract: "",
    amount: "",
    orchestratorAddress: "",
    data: ""
  };
}
export const EventDepositClaim = {
  encode(message, writer = _m0.Writer.create()) {
    if (!message.eventNonce.isZero()) {
      writer.uint32(8).uint64(message.eventNonce);
    }
    if (!message.eventHeight.isZero()) {
      writer.uint32(16).uint64(message.eventHeight);
    }
    if (message.attestationId.length !== 0) {
      writer.uint32(26).bytes(message.attestationId);
    }
    if (message.ethereumSender !== "") {
      writer.uint32(34).string(message.ethereumSender);
    }
    if (message.cosmosReceiver !== "") {
      writer.uint32(42).string(message.cosmosReceiver);
    }
    if (message.tokenContract !== "") {
      writer.uint32(50).string(message.tokenContract);
    }
    if (message.amount !== "") {
      writer.uint32(58).string(message.amount);
    }
    if (message.orchestratorAddress !== "") {
      writer.uint32(66).string(message.orchestratorAddress);
    }
    if (message.data !== "") {
      writer.uint32(74).string(message.data);
    }
    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 = createBaseEventDepositClaim();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.eventNonce = reader.uint64();
          break;
        case 2:
          message.eventHeight = reader.uint64();
          break;
        case 3:
          message.attestationId = reader.bytes();
          break;
        case 4:
          message.ethereumSender = reader.string();
          break;
        case 5:
          message.cosmosReceiver = reader.string();
          break;
        case 6:
          message.tokenContract = reader.string();
          break;
        case 7:
          message.amount = reader.string();
          break;
        case 8:
          message.orchestratorAddress = reader.string();
          break;
        case 9:
          message.data = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$attestationId3, _object$ethereumSende, _object$cosmosReceive, _object$tokenContract, _object$amount2, _object$orchestratorA5, _object$data;
    const message = createBaseEventDepositClaim();
    message.eventNonce = object.eventNonce !== undefined && object.eventNonce !== null ? Long.fromValue(object.eventNonce) : Long.UZERO;
    message.eventHeight = object.eventHeight !== undefined && object.eventHeight !== null ? Long.fromValue(object.eventHeight) : Long.UZERO;
    message.attestationId = (_object$attestationId3 = object.attestationId) !== null && _object$attestationId3 !== void 0 ? _object$attestationId3 : new Uint8Array();
    message.ethereumSender = (_object$ethereumSende = object.ethereumSender) !== null && _object$ethereumSende !== void 0 ? _object$ethereumSende : "";
    message.cosmosReceiver = (_object$cosmosReceive = object.cosmosReceiver) !== null && _object$cosmosReceive !== void 0 ? _object$cosmosReceive : "";
    message.tokenContract = (_object$tokenContract = object.tokenContract) !== null && _object$tokenContract !== void 0 ? _object$tokenContract : "";
    message.amount = (_object$amount2 = object.amount) !== null && _object$amount2 !== void 0 ? _object$amount2 : "";
    message.orchestratorAddress = (_object$orchestratorA5 = object.orchestratorAddress) !== null && _object$orchestratorA5 !== void 0 ? _object$orchestratorA5 : "";
    message.data = (_object$data = object.data) !== null && _object$data !== void 0 ? _object$data : "";
    return message;
  }
};
function createBaseEventWithdrawClaim() {
  return {
    eventNonce: Long.UZERO,
    eventHeight: Long.UZERO,
    attestationId: new Uint8Array(),
    batchNonce: Long.UZERO,
    tokenContract: "",
    orchestratorAddress: ""
  };
}
export const EventWithdrawClaim = {
  encode(message, writer = _m0.Writer.create()) {
    if (!message.eventNonce.isZero()) {
      writer.uint32(8).uint64(message.eventNonce);
    }
    if (!message.eventHeight.isZero()) {
      writer.uint32(16).uint64(message.eventHeight);
    }
    if (message.attestationId.length !== 0) {
      writer.uint32(26).bytes(message.attestationId);
    }
    if (!message.batchNonce.isZero()) {
      writer.uint32(32).uint64(message.batchNonce);
    }
    if (message.tokenContract !== "") {
      writer.uint32(42).string(message.tokenContract);
    }
    if (message.orchestratorAddress !== "") {
      writer.uint32(50).string(message.orchestratorAddress);
    }
    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 = createBaseEventWithdrawClaim();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.eventNonce = reader.uint64();
          break;
        case 2:
          message.eventHeight = reader.uint64();
          break;
        case 3:
          message.attestationId = reader.bytes();
          break;
        case 4:
          message.batchNonce = reader.uint64();
          break;
        case 5:
          message.tokenContract = reader.string();
          break;
        case 6:
          message.orchestratorAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$attestationId4, _object$tokenContract2, _object$orchestratorA6;
    const message = createBaseEventWithdrawClaim();
    message.eventNonce = object.eventNonce !== undefined && object.eventNonce !== null ? Long.fromValue(object.eventNonce) : Long.UZERO;
    message.eventHeight = object.eventHeight !== undefined && object.eventHeight !== null ? Long.fromValue(object.eventHeight) : Long.UZERO;
    message.attestationId = (_object$attestationId4 = object.attestationId) !== null && _object$attestationId4 !== void 0 ? _object$attestationId4 : new Uint8Array();
    message.batchNonce = object.batchNonce !== undefined && object.batchNonce !== null ? Long.fromValue(object.batchNonce) : Long.UZERO;
    message.tokenContract = (_object$tokenContract2 = object.tokenContract) !== null && _object$tokenContract2 !== void 0 ? _object$tokenContract2 : "";
    message.orchestratorAddress = (_object$orchestratorA6 = object.orchestratorAddress) !== null && _object$orchestratorA6 !== void 0 ? _object$orchestratorA6 : "";
    return message;
  }
};
function createBaseEventERC20DeployedClaim() {
  return {
    eventNonce: Long.UZERO,
    eventHeight: Long.UZERO,
    attestationId: new Uint8Array(),
    cosmosDenom: "",
    tokenContract: "",
    name: "",
    symbol: "",
    decimals: Long.UZERO,
    orchestratorAddress: ""
  };
}
export const EventERC20DeployedClaim = {
  encode(message, writer = _m0.Writer.create()) {
    if (!message.eventNonce.isZero()) {
      writer.uint32(8).uint64(message.eventNonce);
    }
    if (!message.eventHeight.isZero()) {
      writer.uint32(16).uint64(message.eventHeight);
    }
    if (message.attestationId.length !== 0) {
      writer.uint32(26).bytes(message.attestationId);
    }
    if (message.cosmosDenom !== "") {
      writer.uint32(34).string(message.cosmosDenom);
    }
    if (message.tokenContract !== "") {
      writer.uint32(42).string(message.tokenContract);
    }
    if (message.name !== "") {
      writer.uint32(50).string(message.name);
    }
    if (message.symbol !== "") {
      writer.uint32(58).string(message.symbol);
    }
    if (!message.decimals.isZero()) {
      writer.uint32(64).uint64(message.decimals);
    }
    if (message.orchestratorAddress !== "") {
      writer.uint32(74).string(message.orchestratorAddress);
    }
    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 = createBaseEventERC20DeployedClaim();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.eventNonce = reader.uint64();
          break;
        case 2:
          message.eventHeight = reader.uint64();
          break;
        case 3:
          message.attestationId = reader.bytes();
          break;
        case 4:
          message.cosmosDenom = reader.string();
          break;
        case 5:
          message.tokenContract = reader.string();
          break;
        case 6:
          message.name = reader.string();
          break;
        case 7:
          message.symbol = reader.string();
          break;
        case 8:
          message.decimals = reader.uint64();
          break;
        case 9:
          message.orchestratorAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$attestationId5, _object$cosmosDenom, _object$tokenContract3, _object$name, _object$symbol, _object$orchestratorA7;
    const message = createBaseEventERC20DeployedClaim();
    message.eventNonce = object.eventNonce !== undefined && object.eventNonce !== null ? Long.fromValue(object.eventNonce) : Long.UZERO;
    message.eventHeight = object.eventHeight !== undefined && object.eventHeight !== null ? Long.fromValue(object.eventHeight) : Long.UZERO;
    message.attestationId = (_object$attestationId5 = object.attestationId) !== null && _object$attestationId5 !== void 0 ? _object$attestationId5 : new Uint8Array();
    message.cosmosDenom = (_object$cosmosDenom = object.cosmosDenom) !== null && _object$cosmosDenom !== void 0 ? _object$cosmosDenom : "";
    message.tokenContract = (_object$tokenContract3 = object.tokenContract) !== null && _object$tokenContract3 !== void 0 ? _object$tokenContract3 : "";
    message.name = (_object$name = object.name) !== null && _object$name !== void 0 ? _object$name : "";
    message.symbol = (_object$symbol = object.symbol) !== null && _object$symbol !== void 0 ? _object$symbol : "";
    message.decimals = object.decimals !== undefined && object.decimals !== null ? Long.fromValue(object.decimals) : Long.UZERO;
    message.orchestratorAddress = (_object$orchestratorA7 = object.orchestratorAddress) !== null && _object$orchestratorA7 !== void 0 ? _object$orchestratorA7 : "";
    return message;
  }
};
function createBaseEventValsetUpdateClaim() {
  return {
    eventNonce: Long.UZERO,
    eventHeight: Long.UZERO,
    attestationId: new Uint8Array(),
    valsetNonce: Long.UZERO,
    valsetMembers: [],
    rewardAmount: "",
    rewardToken: "",
    orchestratorAddress: ""
  };
}
export const EventValsetUpdateClaim = {
  encode(message, writer = _m0.Writer.create()) {
    if (!message.eventNonce.isZero()) {
      writer.uint32(8).uint64(message.eventNonce);
    }
    if (!message.eventHeight.isZero()) {
      writer.uint32(16).uint64(message.eventHeight);
    }
    if (message.attestationId.length !== 0) {
      writer.uint32(26).bytes(message.attestationId);
    }
    if (!message.valsetNonce.isZero()) {
      writer.uint32(32).uint64(message.valsetNonce);
    }
    for (const v of message.valsetMembers) {
      BridgeValidator.encode(v, writer.uint32(42).fork()).ldelim();
    }
    if (message.rewardAmount !== "") {
      writer.uint32(50).string(message.rewardAmount);
    }
    if (message.rewardToken !== "") {
      writer.uint32(58).string(message.rewardToken);
    }
    if (message.orchestratorAddress !== "") {
      writer.uint32(66).string(message.orchestratorAddress);
    }
    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 = createBaseEventValsetUpdateClaim();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.eventNonce = reader.uint64();
          break;
        case 2:
          message.eventHeight = reader.uint64();
          break;
        case 3:
          message.attestationId = reader.bytes();
          break;
        case 4:
          message.valsetNonce = reader.uint64();
          break;
        case 5:
          message.valsetMembers.push(BridgeValidator.decode(reader, reader.uint32()));
          break;
        case 6:
          message.rewardAmount = reader.string();
          break;
        case 7:
          message.rewardToken = reader.string();
          break;
        case 8:
          message.orchestratorAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$attestationId6, _object$valsetMembers2, _object$rewardAmount2, _object$rewardToken2, _object$orchestratorA8;
    const message = createBaseEventValsetUpdateClaim();
    message.eventNonce = object.eventNonce !== undefined && object.eventNonce !== null ? Long.fromValue(object.eventNonce) : Long.UZERO;
    message.eventHeight = object.eventHeight !== undefined && object.eventHeight !== null ? Long.fromValue(object.eventHeight) : Long.UZERO;
    message.attestationId = (_object$attestationId6 = object.attestationId) !== null && _object$attestationId6 !== void 0 ? _object$attestationId6 : new Uint8Array();
    message.valsetNonce = object.valsetNonce !== undefined && object.valsetNonce !== null ? Long.fromValue(object.valsetNonce) : Long.UZERO;
    message.valsetMembers = ((_object$valsetMembers2 = object.valsetMembers) === null || _object$valsetMembers2 === void 0 ? void 0 : _object$valsetMembers2.map(e => BridgeValidator.fromPartial(e))) || [];
    message.rewardAmount = (_object$rewardAmount2 = object.rewardAmount) !== null && _object$rewardAmount2 !== void 0 ? _object$rewardAmount2 : "";
    message.rewardToken = (_object$rewardToken2 = object.rewardToken) !== null && _object$rewardToken2 !== void 0 ? _object$rewardToken2 : "";
    message.orchestratorAddress = (_object$orchestratorA8 = object.orchestratorAddress) !== null && _object$orchestratorA8 !== void 0 ? _object$orchestratorA8 : "";
    return message;
  }
};
function createBaseEventCancelSendToEth() {
  return {
    outgoingTxId: Long.UZERO
  };
}
export const EventCancelSendToEth = {
  encode(message, writer = _m0.Writer.create()) {
    if (!message.outgoingTxId.isZero()) {
      writer.uint32(8).uint64(message.outgoingTxId);
    }
    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 = createBaseEventCancelSendToEth();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.outgoingTxId = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    const message = createBaseEventCancelSendToEth();
    message.outgoingTxId = object.outgoingTxId !== undefined && object.outgoingTxId !== null ? Long.fromValue(object.outgoingTxId) : Long.UZERO;
    return message;
  }
};
function createBaseEventSubmitBadSignatureEvidence() {
  return {
    badEthSignature: "",
    badEthSignatureSubject: ""
  };
}
export const EventSubmitBadSignatureEvidence = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.badEthSignature !== "") {
      writer.uint32(10).string(message.badEthSignature);
    }
    if (message.badEthSignatureSubject !== "") {
      writer.uint32(18).string(message.badEthSignatureSubject);
    }
    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 = createBaseEventSubmitBadSignatureEvidence();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.badEthSignature = reader.string();
          break;
        case 2:
          message.badEthSignatureSubject = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$badEthSignatu, _object$badEthSignatu2;
    const message = createBaseEventSubmitBadSignatureEvidence();
    message.badEthSignature = (_object$badEthSignatu = object.badEthSignature) !== null && _object$badEthSignatu !== void 0 ? _object$badEthSignatu : "";
    message.badEthSignatureSubject = (_object$badEthSignatu2 = object.badEthSignatureSubject) !== null && _object$badEthSignatu2 !== void 0 ? _object$badEthSignatu2 : "";
    return message;
  }
};