"use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SetProviderPriceEvent = exports.SetPriceFeedPriceEvent = exports.SetCoinbasePriceEvent = exports.SetChainlinkPriceEvent = exports.SetBandPriceEvent = exports.SetBandIBCPriceEvent = exports.EventBandIBCResponseTimeout = exports.EventBandIBCAckSuccess = exports.EventBandIBCAckError = void 0;
var _helpers = require("../../../helpers");
var _m0 = _interopRequireWildcard(require("protobufjs/minimal"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function createBaseSetChainlinkPriceEvent() {
  return {
    feedId: "",
    answer: "",
    timestamp: _helpers.Long.UZERO
  };
}
var SetChainlinkPriceEvent = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.feedId !== "") {
      writer.uint32(10).string(message.feedId);
    }
    if (message.answer !== "") {
      writer.uint32(18).string(message.answer);
    }
    if (!message.timestamp.isZero()) {
      writer.uint32(24).uint64(message.timestamp);
    }
    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 = createBaseSetChainlinkPriceEvent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.feedId = reader.string();
          break;
        case 2:
          message.answer = reader.string();
          break;
        case 3:
          message.timestamp = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial: function fromPartial(object) {
    var _object$feedId, _object$answer;
    var message = createBaseSetChainlinkPriceEvent();
    message.feedId = (_object$feedId = object.feedId) !== null && _object$feedId !== void 0 ? _object$feedId : "";
    message.answer = (_object$answer = object.answer) !== null && _object$answer !== void 0 ? _object$answer : "";
    message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? _helpers.Long.fromValue(object.timestamp) : _helpers.Long.UZERO;
    return message;
  }
};
exports.SetChainlinkPriceEvent = SetChainlinkPriceEvent;
function createBaseSetBandPriceEvent() {
  return {
    relayer: "",
    symbol: "",
    price: "",
    resolveTime: _helpers.Long.UZERO,
    requestId: _helpers.Long.UZERO
  };
}
var SetBandPriceEvent = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.relayer !== "") {
      writer.uint32(10).string(message.relayer);
    }
    if (message.symbol !== "") {
      writer.uint32(18).string(message.symbol);
    }
    if (message.price !== "") {
      writer.uint32(26).string(message.price);
    }
    if (!message.resolveTime.isZero()) {
      writer.uint32(32).uint64(message.resolveTime);
    }
    if (!message.requestId.isZero()) {
      writer.uint32(40).uint64(message.requestId);
    }
    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 = createBaseSetBandPriceEvent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.relayer = reader.string();
          break;
        case 2:
          message.symbol = reader.string();
          break;
        case 3:
          message.price = reader.string();
          break;
        case 4:
          message.resolveTime = reader.uint64();
          break;
        case 5:
          message.requestId = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial: function fromPartial(object) {
    var _object$relayer, _object$symbol, _object$price;
    var message = createBaseSetBandPriceEvent();
    message.relayer = (_object$relayer = object.relayer) !== null && _object$relayer !== void 0 ? _object$relayer : "";
    message.symbol = (_object$symbol = object.symbol) !== null && _object$symbol !== void 0 ? _object$symbol : "";
    message.price = (_object$price = object.price) !== null && _object$price !== void 0 ? _object$price : "";
    message.resolveTime = object.resolveTime !== undefined && object.resolveTime !== null ? _helpers.Long.fromValue(object.resolveTime) : _helpers.Long.UZERO;
    message.requestId = object.requestId !== undefined && object.requestId !== null ? _helpers.Long.fromValue(object.requestId) : _helpers.Long.UZERO;
    return message;
  }
};
exports.SetBandPriceEvent = SetBandPriceEvent;
function createBaseSetBandIBCPriceEvent() {
  return {
    relayer: "",
    symbols: [],
    prices: [],
    resolveTime: _helpers.Long.UZERO,
    requestId: _helpers.Long.UZERO,
    clientId: _helpers.Long.ZERO
  };
}
var SetBandIBCPriceEvent = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.relayer !== "") {
      writer.uint32(10).string(message.relayer);
    }
    var _iterator = _createForOfIteratorHelper(message.symbols),
      _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var v = _step.value;
        writer.uint32(18).string(v);
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
    var _iterator2 = _createForOfIteratorHelper(message.prices),
      _step2;
    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var _v = _step2.value;
        writer.uint32(26).string(_v);
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }
    if (!message.resolveTime.isZero()) {
      writer.uint32(32).uint64(message.resolveTime);
    }
    if (!message.requestId.isZero()) {
      writer.uint32(40).uint64(message.requestId);
    }
    if (!message.clientId.isZero()) {
      writer.uint32(48).int64(message.clientId);
    }
    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 = createBaseSetBandIBCPriceEvent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.relayer = reader.string();
          break;
        case 2:
          message.symbols.push(reader.string());
          break;
        case 3:
          message.prices.push(reader.string());
          break;
        case 4:
          message.resolveTime = reader.uint64();
          break;
        case 5:
          message.requestId = reader.uint64();
          break;
        case 6:
          message.clientId = reader.int64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial: function fromPartial(object) {
    var _object$relayer2, _object$symbols, _object$prices;
    var message = createBaseSetBandIBCPriceEvent();
    message.relayer = (_object$relayer2 = object.relayer) !== null && _object$relayer2 !== void 0 ? _object$relayer2 : "";
    message.symbols = ((_object$symbols = object.symbols) === null || _object$symbols === void 0 ? void 0 : _object$symbols.map(function (e) {
      return e;
    })) || [];
    message.prices = ((_object$prices = object.prices) === null || _object$prices === void 0 ? void 0 : _object$prices.map(function (e) {
      return e;
    })) || [];
    message.resolveTime = object.resolveTime !== undefined && object.resolveTime !== null ? _helpers.Long.fromValue(object.resolveTime) : _helpers.Long.UZERO;
    message.requestId = object.requestId !== undefined && object.requestId !== null ? _helpers.Long.fromValue(object.requestId) : _helpers.Long.UZERO;
    message.clientId = object.clientId !== undefined && object.clientId !== null ? _helpers.Long.fromValue(object.clientId) : _helpers.Long.ZERO;
    return message;
  }
};
exports.SetBandIBCPriceEvent = SetBandIBCPriceEvent;
function createBaseEventBandIBCAckSuccess() {
  return {
    ackResult: "",
    clientId: _helpers.Long.ZERO
  };
}
var EventBandIBCAckSuccess = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.ackResult !== "") {
      writer.uint32(10).string(message.ackResult);
    }
    if (!message.clientId.isZero()) {
      writer.uint32(16).int64(message.clientId);
    }
    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 = createBaseEventBandIBCAckSuccess();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.ackResult = reader.string();
          break;
        case 2:
          message.clientId = reader.int64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial: function fromPartial(object) {
    var _object$ackResult;
    var message = createBaseEventBandIBCAckSuccess();
    message.ackResult = (_object$ackResult = object.ackResult) !== null && _object$ackResult !== void 0 ? _object$ackResult : "";
    message.clientId = object.clientId !== undefined && object.clientId !== null ? _helpers.Long.fromValue(object.clientId) : _helpers.Long.ZERO;
    return message;
  }
};
exports.EventBandIBCAckSuccess = EventBandIBCAckSuccess;
function createBaseEventBandIBCAckError() {
  return {
    ackError: "",
    clientId: _helpers.Long.ZERO
  };
}
var EventBandIBCAckError = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.ackError !== "") {
      writer.uint32(10).string(message.ackError);
    }
    if (!message.clientId.isZero()) {
      writer.uint32(16).int64(message.clientId);
    }
    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 = createBaseEventBandIBCAckError();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.ackError = reader.string();
          break;
        case 2:
          message.clientId = reader.int64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial: function fromPartial(object) {
    var _object$ackError;
    var message = createBaseEventBandIBCAckError();
    message.ackError = (_object$ackError = object.ackError) !== null && _object$ackError !== void 0 ? _object$ackError : "";
    message.clientId = object.clientId !== undefined && object.clientId !== null ? _helpers.Long.fromValue(object.clientId) : _helpers.Long.ZERO;
    return message;
  }
};
exports.EventBandIBCAckError = EventBandIBCAckError;
function createBaseEventBandIBCResponseTimeout() {
  return {
    clientId: _helpers.Long.ZERO
  };
}
var EventBandIBCResponseTimeout = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (!message.clientId.isZero()) {
      writer.uint32(8).int64(message.clientId);
    }
    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 = createBaseEventBandIBCResponseTimeout();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.clientId = reader.int64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseEventBandIBCResponseTimeout();
    message.clientId = object.clientId !== undefined && object.clientId !== null ? _helpers.Long.fromValue(object.clientId) : _helpers.Long.ZERO;
    return message;
  }
};
exports.EventBandIBCResponseTimeout = EventBandIBCResponseTimeout;
function createBaseSetPriceFeedPriceEvent() {
  return {
    relayer: "",
    base: "",
    quote: "",
    price: ""
  };
}
var SetPriceFeedPriceEvent = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.relayer !== "") {
      writer.uint32(10).string(message.relayer);
    }
    if (message.base !== "") {
      writer.uint32(18).string(message.base);
    }
    if (message.quote !== "") {
      writer.uint32(26).string(message.quote);
    }
    if (message.price !== "") {
      writer.uint32(34).string(message.price);
    }
    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 = createBaseSetPriceFeedPriceEvent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.relayer = reader.string();
          break;
        case 2:
          message.base = reader.string();
          break;
        case 3:
          message.quote = reader.string();
          break;
        case 4:
          message.price = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial: function fromPartial(object) {
    var _object$relayer3, _object$base, _object$quote, _object$price2;
    var message = createBaseSetPriceFeedPriceEvent();
    message.relayer = (_object$relayer3 = object.relayer) !== null && _object$relayer3 !== void 0 ? _object$relayer3 : "";
    message.base = (_object$base = object.base) !== null && _object$base !== void 0 ? _object$base : "";
    message.quote = (_object$quote = object.quote) !== null && _object$quote !== void 0 ? _object$quote : "";
    message.price = (_object$price2 = object.price) !== null && _object$price2 !== void 0 ? _object$price2 : "";
    return message;
  }
};
exports.SetPriceFeedPriceEvent = SetPriceFeedPriceEvent;
function createBaseSetProviderPriceEvent() {
  return {
    provider: "",
    relayer: "",
    symbol: "",
    price: ""
  };
}
var SetProviderPriceEvent = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.provider !== "") {
      writer.uint32(10).string(message.provider);
    }
    if (message.relayer !== "") {
      writer.uint32(18).string(message.relayer);
    }
    if (message.symbol !== "") {
      writer.uint32(26).string(message.symbol);
    }
    if (message.price !== "") {
      writer.uint32(34).string(message.price);
    }
    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 = createBaseSetProviderPriceEvent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.provider = reader.string();
          break;
        case 2:
          message.relayer = reader.string();
          break;
        case 3:
          message.symbol = reader.string();
          break;
        case 4:
          message.price = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial: function fromPartial(object) {
    var _object$provider, _object$relayer4, _object$symbol2, _object$price3;
    var message = createBaseSetProviderPriceEvent();
    message.provider = (_object$provider = object.provider) !== null && _object$provider !== void 0 ? _object$provider : "";
    message.relayer = (_object$relayer4 = object.relayer) !== null && _object$relayer4 !== void 0 ? _object$relayer4 : "";
    message.symbol = (_object$symbol2 = object.symbol) !== null && _object$symbol2 !== void 0 ? _object$symbol2 : "";
    message.price = (_object$price3 = object.price) !== null && _object$price3 !== void 0 ? _object$price3 : "";
    return message;
  }
};
exports.SetProviderPriceEvent = SetProviderPriceEvent;
function createBaseSetCoinbasePriceEvent() {
  return {
    symbol: "",
    price: "",
    timestamp: _helpers.Long.UZERO
  };
}
var SetCoinbasePriceEvent = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.symbol !== "") {
      writer.uint32(10).string(message.symbol);
    }
    if (message.price !== "") {
      writer.uint32(18).string(message.price);
    }
    if (!message.timestamp.isZero()) {
      writer.uint32(24).uint64(message.timestamp);
    }
    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 = createBaseSetCoinbasePriceEvent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.symbol = reader.string();
          break;
        case 2:
          message.price = reader.string();
          break;
        case 3:
          message.timestamp = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial: function fromPartial(object) {
    var _object$symbol3, _object$price4;
    var message = createBaseSetCoinbasePriceEvent();
    message.symbol = (_object$symbol3 = object.symbol) !== null && _object$symbol3 !== void 0 ? _object$symbol3 : "";
    message.price = (_object$price4 = object.price) !== null && _object$price4 !== void 0 ? _object$price4 : "";
    message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? _helpers.Long.fromValue(object.timestamp) : _helpers.Long.UZERO;
    return message;
  }
};
exports.SetCoinbasePriceEvent = SetCoinbasePriceEvent;