import { Long } from "../../../helpers";
import * as _m0 from "protobufjs/minimal";
function createBaseExtensionOptionsWeb3Tx() {
  return {
    typedDataChainID: Long.UZERO,
    feePayer: "",
    feePayerSig: new Uint8Array()
  };
}
export const ExtensionOptionsWeb3Tx = {
  encode(message, writer = _m0.Writer.create()) {
    if (!message.typedDataChainID.isZero()) {
      writer.uint32(8).uint64(message.typedDataChainID);
    }
    if (message.feePayer !== "") {
      writer.uint32(18).string(message.feePayer);
    }
    if (message.feePayerSig.length !== 0) {
      writer.uint32(26).bytes(message.feePayerSig);
    }
    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 = createBaseExtensionOptionsWeb3Tx();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.typedDataChainID = reader.uint64();
          break;
        case 2:
          message.feePayer = reader.string();
          break;
        case 3:
          message.feePayerSig = reader.bytes();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$feePayer, _object$feePayerSig;
    const message = createBaseExtensionOptionsWeb3Tx();
    message.typedDataChainID = object.typedDataChainID !== undefined && object.typedDataChainID !== null ? Long.fromValue(object.typedDataChainID) : Long.UZERO;
    message.feePayer = (_object$feePayer = object.feePayer) !== null && _object$feePayer !== void 0 ? _object$feePayer : "";
    message.feePayerSig = (_object$feePayerSig = object.feePayerSig) !== null && _object$feePayerSig !== void 0 ? _object$feePayerSig : new Uint8Array();
    return message;
  }
};