"use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.StatusResponse = exports.StatusRequest = exports.ConfigResponse = exports.ConfigRequest = void 0;
var _timestamp = require("../../../../google/protobuf/timestamp");
var _helpers = require("../../../../helpers");
var _m0 = _interopRequireWildcard(require("protobufjs/minimal"));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
//@ts-nocheck

/** ConfigRequest defines the request structure for the Config gRPC query. */

/** ConfigRequest defines the request structure for the Config gRPC query. */

/** ConfigResponse defines the response structure for the Config gRPC query. */

/** ConfigResponse defines the response structure for the Config gRPC query. */

/** StateRequest defines the request structure for the status of a node. */

/** StateRequest defines the request structure for the status of a node. */

/** StateResponse defines the response structure for the status of a node. */

/** StateResponse defines the response structure for the status of a node. */

function createBaseConfigRequest() {
  return {};
}
var ConfigRequest = exports.ConfigRequest = {
  encode: function encode(_) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseConfigRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(_) {
    return {};
  },
  toJSON: function toJSON(_) {
    var obj = {};
    return obj;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseConfigRequest();
    return message;
  }
};
function createBaseConfigResponse() {
  return {
    minimumGasPrice: "",
    pruningKeepRecent: "",
    pruningInterval: "",
    haltHeight: _helpers.Long.UZERO
  };
}
var ConfigResponse = exports.ConfigResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.minimumGasPrice !== "") {
      writer.uint32(10).string(message.minimumGasPrice);
    }
    if (message.pruningKeepRecent !== "") {
      writer.uint32(18).string(message.pruningKeepRecent);
    }
    if (message.pruningInterval !== "") {
      writer.uint32(26).string(message.pruningInterval);
    }
    if (!message.haltHeight.isZero()) {
      writer.uint32(32).uint64(message.haltHeight);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseConfigResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.minimumGasPrice = reader.string();
          break;
        case 2:
          message.pruningKeepRecent = reader.string();
          break;
        case 3:
          message.pruningInterval = reader.string();
          break;
        case 4:
          message.haltHeight = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      minimumGasPrice: (0, _helpers.isSet)(object.minimumGasPrice) ? String(object.minimumGasPrice) : "",
      pruningKeepRecent: (0, _helpers.isSet)(object.pruningKeepRecent) ? String(object.pruningKeepRecent) : "",
      pruningInterval: (0, _helpers.isSet)(object.pruningInterval) ? String(object.pruningInterval) : "",
      haltHeight: (0, _helpers.isSet)(object.haltHeight) ? _helpers.Long.fromValue(object.haltHeight) : _helpers.Long.UZERO
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.minimumGasPrice !== undefined && (obj.minimumGasPrice = message.minimumGasPrice);
    message.pruningKeepRecent !== undefined && (obj.pruningKeepRecent = message.pruningKeepRecent);
    message.pruningInterval !== undefined && (obj.pruningInterval = message.pruningInterval);
    message.haltHeight !== undefined && (obj.haltHeight = (message.haltHeight || _helpers.Long.UZERO).toString());
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$minimumGasPri, _object$pruningKeepRe, _object$pruningInterv;
    var message = createBaseConfigResponse();
    message.minimumGasPrice = (_object$minimumGasPri = object.minimumGasPrice) !== null && _object$minimumGasPri !== void 0 ? _object$minimumGasPri : "";
    message.pruningKeepRecent = (_object$pruningKeepRe = object.pruningKeepRecent) !== null && _object$pruningKeepRe !== void 0 ? _object$pruningKeepRe : "";
    message.pruningInterval = (_object$pruningInterv = object.pruningInterval) !== null && _object$pruningInterv !== void 0 ? _object$pruningInterv : "";
    message.haltHeight = object.haltHeight !== undefined && object.haltHeight !== null ? _helpers.Long.fromValue(object.haltHeight) : _helpers.Long.UZERO;
    return message;
  }
};
function createBaseStatusRequest() {
  return {};
}
var StatusRequest = exports.StatusRequest = {
  encode: function encode(_) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseStatusRequest();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(_) {
    return {};
  },
  toJSON: function toJSON(_) {
    var obj = {};
    return obj;
  },
  fromPartial: function fromPartial(_) {
    var message = createBaseStatusRequest();
    return message;
  }
};
function createBaseStatusResponse() {
  return {
    earliestStoreHeight: _helpers.Long.UZERO,
    height: _helpers.Long.UZERO,
    timestamp: undefined,
    appHash: new Uint8Array(),
    validatorHash: new Uint8Array()
  };
}
var StatusResponse = exports.StatusResponse = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (!message.earliestStoreHeight.isZero()) {
      writer.uint32(8).uint64(message.earliestStoreHeight);
    }
    if (!message.height.isZero()) {
      writer.uint32(16).uint64(message.height);
    }
    if (message.timestamp !== undefined) {
      _timestamp.Timestamp.encode(message.timestamp, writer.uint32(26).fork()).ldelim();
    }
    if (message.appHash.length !== 0) {
      writer.uint32(34).bytes(message.appHash);
    }
    if (message.validatorHash.length !== 0) {
      writer.uint32(42).bytes(message.validatorHash);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseStatusResponse();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.earliestStoreHeight = reader.uint64();
          break;
        case 2:
          message.height = reader.uint64();
          break;
        case 3:
          message.timestamp = _timestamp.Timestamp.decode(reader, reader.uint32());
          break;
        case 4:
          message.appHash = reader.bytes();
          break;
        case 5:
          message.validatorHash = reader.bytes();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      earliestStoreHeight: (0, _helpers.isSet)(object.earliestStoreHeight) ? _helpers.Long.fromValue(object.earliestStoreHeight) : _helpers.Long.UZERO,
      height: (0, _helpers.isSet)(object.height) ? _helpers.Long.fromValue(object.height) : _helpers.Long.UZERO,
      timestamp: (0, _helpers.isSet)(object.timestamp) ? (0, _helpers.fromJsonTimestamp)(object.timestamp) : undefined,
      appHash: (0, _helpers.isSet)(object.appHash) ? (0, _helpers.bytesFromBase64)(object.appHash) : new Uint8Array(),
      validatorHash: (0, _helpers.isSet)(object.validatorHash) ? (0, _helpers.bytesFromBase64)(object.validatorHash) : new Uint8Array()
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.earliestStoreHeight !== undefined && (obj.earliestStoreHeight = (message.earliestStoreHeight || _helpers.Long.UZERO).toString());
    message.height !== undefined && (obj.height = (message.height || _helpers.Long.UZERO).toString());
    message.timestamp !== undefined && (obj.timestamp = (0, _helpers.fromTimestamp)(message.timestamp).toISOString());
    message.appHash !== undefined && (obj.appHash = (0, _helpers.base64FromBytes)(message.appHash !== undefined ? message.appHash : new Uint8Array()));
    message.validatorHash !== undefined && (obj.validatorHash = (0, _helpers.base64FromBytes)(message.validatorHash !== undefined ? message.validatorHash : new Uint8Array()));
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$appHash, _object$validatorHash;
    var message = createBaseStatusResponse();
    message.earliestStoreHeight = object.earliestStoreHeight !== undefined && object.earliestStoreHeight !== null ? _helpers.Long.fromValue(object.earliestStoreHeight) : _helpers.Long.UZERO;
    message.height = object.height !== undefined && object.height !== null ? _helpers.Long.fromValue(object.height) : _helpers.Long.UZERO;
    message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? _timestamp.Timestamp.fromPartial(object.timestamp) : undefined;
    message.appHash = (_object$appHash = object.appHash) !== null && _object$appHash !== void 0 ? _object$appHash : new Uint8Array();
    message.validatorHash = (_object$validatorHash = object.validatorHash) !== null && _object$validatorHash !== void 0 ? _object$validatorHash : new Uint8Array();
    return message;
  }
};