"use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TokensRetired = exports.TokensCancelled = exports.TokenProperties = exports.TokenData = exports.Token = exports.Params = exports.CreditsTransferred = void 0;
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); }
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } //@ts-nocheck
function createBaseParams() {
  return {
    ixo1155ContractCode: _helpers.Long.UZERO
  };
}
var Params = exports.Params = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (!message.ixo1155ContractCode.isZero()) {
      writer.uint32(8).uint64(message.ixo1155ContractCode);
    }
    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 = createBaseParams();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.ixo1155ContractCode = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      ixo1155ContractCode: (0, _helpers.isSet)(object.ixo1155ContractCode) ? _helpers.Long.fromValue(object.ixo1155ContractCode) : _helpers.Long.UZERO
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.ixo1155ContractCode !== undefined && (obj.ixo1155ContractCode = (message.ixo1155ContractCode || _helpers.Long.UZERO).toString());
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseParams();
    message.ixo1155ContractCode = object.ixo1155ContractCode !== undefined && object.ixo1155ContractCode !== null ? _helpers.Long.fromValue(object.ixo1155ContractCode) : _helpers.Long.UZERO;
    return message;
  }
};
function createBaseToken() {
  return {
    minter: "",
    contractAddress: "",
    "class": "",
    name: "",
    description: "",
    image: "",
    type: "",
    cap: "",
    supply: "",
    paused: false,
    stopped: false,
    retired: [],
    cancelled: [],
    transferred: []
  };
}
var Token = exports.Token = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.minter !== "") {
      writer.uint32(10).string(message.minter);
    }
    if (message.contractAddress !== "") {
      writer.uint32(18).string(message.contractAddress);
    }
    if (message["class"] !== "") {
      writer.uint32(26).string(message["class"]);
    }
    if (message.name !== "") {
      writer.uint32(34).string(message.name);
    }
    if (message.description !== "") {
      writer.uint32(42).string(message.description);
    }
    if (message.image !== "") {
      writer.uint32(50).string(message.image);
    }
    if (message.type !== "") {
      writer.uint32(58).string(message.type);
    }
    if (message.cap !== "") {
      writer.uint32(66).string(message.cap);
    }
    if (message.supply !== "") {
      writer.uint32(74).string(message.supply);
    }
    if (message.paused === true) {
      writer.uint32(80).bool(message.paused);
    }
    if (message.stopped === true) {
      writer.uint32(88).bool(message.stopped);
    }
    var _iterator = _createForOfIteratorHelper(message.retired),
      _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var v = _step.value;
        TokensRetired.encode(v, writer.uint32(98).fork()).ldelim();
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
    var _iterator2 = _createForOfIteratorHelper(message.cancelled),
      _step2;
    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var _v = _step2.value;
        TokensCancelled.encode(_v, writer.uint32(106).fork()).ldelim();
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }
    var _iterator3 = _createForOfIteratorHelper(message.transferred),
      _step3;
    try {
      for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
        var _v2 = _step3.value;
        CreditsTransferred.encode(_v2, writer.uint32(114).fork()).ldelim();
      }
    } catch (err) {
      _iterator3.e(err);
    } finally {
      _iterator3.f();
    }
    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 = createBaseToken();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.minter = reader.string();
          break;
        case 2:
          message.contractAddress = reader.string();
          break;
        case 3:
          message["class"] = reader.string();
          break;
        case 4:
          message.name = reader.string();
          break;
        case 5:
          message.description = reader.string();
          break;
        case 6:
          message.image = reader.string();
          break;
        case 7:
          message.type = reader.string();
          break;
        case 8:
          message.cap = reader.string();
          break;
        case 9:
          message.supply = reader.string();
          break;
        case 10:
          message.paused = reader.bool();
          break;
        case 11:
          message.stopped = reader.bool();
          break;
        case 12:
          message.retired.push(TokensRetired.decode(reader, reader.uint32()));
          break;
        case 13:
          message.cancelled.push(TokensCancelled.decode(reader, reader.uint32()));
          break;
        case 14:
          message.transferred.push(CreditsTransferred.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      minter: (0, _helpers.isSet)(object.minter) ? String(object.minter) : "",
      contractAddress: (0, _helpers.isSet)(object.contractAddress) ? String(object.contractAddress) : "",
      "class": (0, _helpers.isSet)(object["class"]) ? String(object["class"]) : "",
      name: (0, _helpers.isSet)(object.name) ? String(object.name) : "",
      description: (0, _helpers.isSet)(object.description) ? String(object.description) : "",
      image: (0, _helpers.isSet)(object.image) ? String(object.image) : "",
      type: (0, _helpers.isSet)(object.type) ? String(object.type) : "",
      cap: (0, _helpers.isSet)(object.cap) ? String(object.cap) : "",
      supply: (0, _helpers.isSet)(object.supply) ? String(object.supply) : "",
      paused: (0, _helpers.isSet)(object.paused) ? Boolean(object.paused) : false,
      stopped: (0, _helpers.isSet)(object.stopped) ? Boolean(object.stopped) : false,
      retired: Array.isArray(object === null || object === void 0 ? void 0 : object.retired) ? object.retired.map(function (e) {
        return TokensRetired.fromJSON(e);
      }) : [],
      cancelled: Array.isArray(object === null || object === void 0 ? void 0 : object.cancelled) ? object.cancelled.map(function (e) {
        return TokensCancelled.fromJSON(e);
      }) : [],
      transferred: Array.isArray(object === null || object === void 0 ? void 0 : object.transferred) ? object.transferred.map(function (e) {
        return CreditsTransferred.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.minter !== undefined && (obj.minter = message.minter);
    message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress);
    message["class"] !== undefined && (obj["class"] = message["class"]);
    message.name !== undefined && (obj.name = message.name);
    message.description !== undefined && (obj.description = message.description);
    message.image !== undefined && (obj.image = message.image);
    message.type !== undefined && (obj.type = message.type);
    message.cap !== undefined && (obj.cap = message.cap);
    message.supply !== undefined && (obj.supply = message.supply);
    message.paused !== undefined && (obj.paused = message.paused);
    message.stopped !== undefined && (obj.stopped = message.stopped);
    if (message.retired) {
      obj.retired = message.retired.map(function (e) {
        return e ? TokensRetired.toJSON(e) : undefined;
      });
    } else {
      obj.retired = [];
    }
    if (message.cancelled) {
      obj.cancelled = message.cancelled.map(function (e) {
        return e ? TokensCancelled.toJSON(e) : undefined;
      });
    } else {
      obj.cancelled = [];
    }
    if (message.transferred) {
      obj.transferred = message.transferred.map(function (e) {
        return e ? CreditsTransferred.toJSON(e) : undefined;
      });
    } else {
      obj.transferred = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$minter, _object$contractAddre, _object$class, _object$name, _object$description, _object$image, _object$type, _object$cap, _object$supply, _object$paused, _object$stopped, _object$retired, _object$cancelled, _object$transferred;
    var message = createBaseToken();
    message.minter = (_object$minter = object.minter) !== null && _object$minter !== void 0 ? _object$minter : "";
    message.contractAddress = (_object$contractAddre = object.contractAddress) !== null && _object$contractAddre !== void 0 ? _object$contractAddre : "";
    message["class"] = (_object$class = object["class"]) !== null && _object$class !== void 0 ? _object$class : "";
    message.name = (_object$name = object.name) !== null && _object$name !== void 0 ? _object$name : "";
    message.description = (_object$description = object.description) !== null && _object$description !== void 0 ? _object$description : "";
    message.image = (_object$image = object.image) !== null && _object$image !== void 0 ? _object$image : "";
    message.type = (_object$type = object.type) !== null && _object$type !== void 0 ? _object$type : "";
    message.cap = (_object$cap = object.cap) !== null && _object$cap !== void 0 ? _object$cap : "";
    message.supply = (_object$supply = object.supply) !== null && _object$supply !== void 0 ? _object$supply : "";
    message.paused = (_object$paused = object.paused) !== null && _object$paused !== void 0 ? _object$paused : false;
    message.stopped = (_object$stopped = object.stopped) !== null && _object$stopped !== void 0 ? _object$stopped : false;
    message.retired = ((_object$retired = object.retired) === null || _object$retired === void 0 ? void 0 : _object$retired.map(function (e) {
      return TokensRetired.fromPartial(e);
    })) || [];
    message.cancelled = ((_object$cancelled = object.cancelled) === null || _object$cancelled === void 0 ? void 0 : _object$cancelled.map(function (e) {
      return TokensCancelled.fromPartial(e);
    })) || [];
    message.transferred = ((_object$transferred = object.transferred) === null || _object$transferred === void 0 ? void 0 : _object$transferred.map(function (e) {
      return CreditsTransferred.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseTokensRetired() {
  return {
    id: "",
    reason: "",
    jurisdiction: "",
    amount: "",
    owner: ""
  };
}
var TokensRetired = exports.TokensRetired = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.reason !== "") {
      writer.uint32(18).string(message.reason);
    }
    if (message.jurisdiction !== "") {
      writer.uint32(26).string(message.jurisdiction);
    }
    if (message.amount !== "") {
      writer.uint32(34).string(message.amount);
    }
    if (message.owner !== "") {
      writer.uint32(42).string(message.owner);
    }
    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 = createBaseTokensRetired();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.reason = reader.string();
          break;
        case 3:
          message.jurisdiction = reader.string();
          break;
        case 4:
          message.amount = reader.string();
          break;
        case 5:
          message.owner = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? String(object.id) : "",
      reason: (0, _helpers.isSet)(object.reason) ? String(object.reason) : "",
      jurisdiction: (0, _helpers.isSet)(object.jurisdiction) ? String(object.jurisdiction) : "",
      amount: (0, _helpers.isSet)(object.amount) ? String(object.amount) : "",
      owner: (0, _helpers.isSet)(object.owner) ? String(object.owner) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.reason !== undefined && (obj.reason = message.reason);
    message.jurisdiction !== undefined && (obj.jurisdiction = message.jurisdiction);
    message.amount !== undefined && (obj.amount = message.amount);
    message.owner !== undefined && (obj.owner = message.owner);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$id, _object$reason, _object$jurisdiction, _object$amount, _object$owner;
    var message = createBaseTokensRetired();
    message.id = (_object$id = object.id) !== null && _object$id !== void 0 ? _object$id : "";
    message.reason = (_object$reason = object.reason) !== null && _object$reason !== void 0 ? _object$reason : "";
    message.jurisdiction = (_object$jurisdiction = object.jurisdiction) !== null && _object$jurisdiction !== void 0 ? _object$jurisdiction : "";
    message.amount = (_object$amount = object.amount) !== null && _object$amount !== void 0 ? _object$amount : "";
    message.owner = (_object$owner = object.owner) !== null && _object$owner !== void 0 ? _object$owner : "";
    return message;
  }
};
function createBaseCreditsTransferred() {
  return {
    id: "",
    reason: "",
    jurisdiction: "",
    amount: "",
    owner: "",
    authorizationId: ""
  };
}
var CreditsTransferred = exports.CreditsTransferred = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.reason !== "") {
      writer.uint32(18).string(message.reason);
    }
    if (message.jurisdiction !== "") {
      writer.uint32(26).string(message.jurisdiction);
    }
    if (message.amount !== "") {
      writer.uint32(34).string(message.amount);
    }
    if (message.owner !== "") {
      writer.uint32(42).string(message.owner);
    }
    if (message.authorizationId !== "") {
      writer.uint32(50).string(message.authorizationId);
    }
    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 = createBaseCreditsTransferred();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.reason = reader.string();
          break;
        case 3:
          message.jurisdiction = reader.string();
          break;
        case 4:
          message.amount = reader.string();
          break;
        case 5:
          message.owner = reader.string();
          break;
        case 6:
          message.authorizationId = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? String(object.id) : "",
      reason: (0, _helpers.isSet)(object.reason) ? String(object.reason) : "",
      jurisdiction: (0, _helpers.isSet)(object.jurisdiction) ? String(object.jurisdiction) : "",
      amount: (0, _helpers.isSet)(object.amount) ? String(object.amount) : "",
      owner: (0, _helpers.isSet)(object.owner) ? String(object.owner) : "",
      authorizationId: (0, _helpers.isSet)(object.authorizationId) ? String(object.authorizationId) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.reason !== undefined && (obj.reason = message.reason);
    message.jurisdiction !== undefined && (obj.jurisdiction = message.jurisdiction);
    message.amount !== undefined && (obj.amount = message.amount);
    message.owner !== undefined && (obj.owner = message.owner);
    message.authorizationId !== undefined && (obj.authorizationId = message.authorizationId);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$id2, _object$reason2, _object$jurisdiction2, _object$amount2, _object$owner2, _object$authorization;
    var message = createBaseCreditsTransferred();
    message.id = (_object$id2 = object.id) !== null && _object$id2 !== void 0 ? _object$id2 : "";
    message.reason = (_object$reason2 = object.reason) !== null && _object$reason2 !== void 0 ? _object$reason2 : "";
    message.jurisdiction = (_object$jurisdiction2 = object.jurisdiction) !== null && _object$jurisdiction2 !== void 0 ? _object$jurisdiction2 : "";
    message.amount = (_object$amount2 = object.amount) !== null && _object$amount2 !== void 0 ? _object$amount2 : "";
    message.owner = (_object$owner2 = object.owner) !== null && _object$owner2 !== void 0 ? _object$owner2 : "";
    message.authorizationId = (_object$authorization = object.authorizationId) !== null && _object$authorization !== void 0 ? _object$authorization : "";
    return message;
  }
};
function createBaseTokensCancelled() {
  return {
    id: "",
    reason: "",
    amount: "",
    owner: ""
  };
}
var TokensCancelled = exports.TokensCancelled = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.reason !== "") {
      writer.uint32(18).string(message.reason);
    }
    if (message.amount !== "") {
      writer.uint32(26).string(message.amount);
    }
    if (message.owner !== "") {
      writer.uint32(34).string(message.owner);
    }
    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 = createBaseTokensCancelled();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.reason = reader.string();
          break;
        case 3:
          message.amount = reader.string();
          break;
        case 4:
          message.owner = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? String(object.id) : "",
      reason: (0, _helpers.isSet)(object.reason) ? String(object.reason) : "",
      amount: (0, _helpers.isSet)(object.amount) ? String(object.amount) : "",
      owner: (0, _helpers.isSet)(object.owner) ? String(object.owner) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.reason !== undefined && (obj.reason = message.reason);
    message.amount !== undefined && (obj.amount = message.amount);
    message.owner !== undefined && (obj.owner = message.owner);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$id3, _object$reason3, _object$amount3, _object$owner3;
    var message = createBaseTokensCancelled();
    message.id = (_object$id3 = object.id) !== null && _object$id3 !== void 0 ? _object$id3 : "";
    message.reason = (_object$reason3 = object.reason) !== null && _object$reason3 !== void 0 ? _object$reason3 : "";
    message.amount = (_object$amount3 = object.amount) !== null && _object$amount3 !== void 0 ? _object$amount3 : "";
    message.owner = (_object$owner3 = object.owner) !== null && _object$owner3 !== void 0 ? _object$owner3 : "";
    return message;
  }
};
function createBaseTokenProperties() {
  return {
    id: "",
    index: "",
    name: "",
    collection: "",
    tokenData: []
  };
}
var TokenProperties = exports.TokenProperties = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.index !== "") {
      writer.uint32(18).string(message.index);
    }
    if (message.name !== "") {
      writer.uint32(26).string(message.name);
    }
    if (message.collection !== "") {
      writer.uint32(34).string(message.collection);
    }
    var _iterator4 = _createForOfIteratorHelper(message.tokenData),
      _step4;
    try {
      for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
        var v = _step4.value;
        TokenData.encode(v, writer.uint32(42).fork()).ldelim();
      }
    } catch (err) {
      _iterator4.e(err);
    } finally {
      _iterator4.f();
    }
    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 = createBaseTokenProperties();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.index = reader.string();
          break;
        case 3:
          message.name = reader.string();
          break;
        case 4:
          message.collection = reader.string();
          break;
        case 5:
          message.tokenData.push(TokenData.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? String(object.id) : "",
      index: (0, _helpers.isSet)(object.index) ? String(object.index) : "",
      name: (0, _helpers.isSet)(object.name) ? String(object.name) : "",
      collection: (0, _helpers.isSet)(object.collection) ? String(object.collection) : "",
      tokenData: Array.isArray(object === null || object === void 0 ? void 0 : object.tokenData) ? object.tokenData.map(function (e) {
        return TokenData.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.index !== undefined && (obj.index = message.index);
    message.name !== undefined && (obj.name = message.name);
    message.collection !== undefined && (obj.collection = message.collection);
    if (message.tokenData) {
      obj.tokenData = message.tokenData.map(function (e) {
        return e ? TokenData.toJSON(e) : undefined;
      });
    } else {
      obj.tokenData = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$id4, _object$index, _object$name2, _object$collection, _object$tokenData;
    var message = createBaseTokenProperties();
    message.id = (_object$id4 = object.id) !== null && _object$id4 !== void 0 ? _object$id4 : "";
    message.index = (_object$index = object.index) !== null && _object$index !== void 0 ? _object$index : "";
    message.name = (_object$name2 = object.name) !== null && _object$name2 !== void 0 ? _object$name2 : "";
    message.collection = (_object$collection = object.collection) !== null && _object$collection !== void 0 ? _object$collection : "";
    message.tokenData = ((_object$tokenData = object.tokenData) === null || _object$tokenData === void 0 ? void 0 : _object$tokenData.map(function (e) {
      return TokenData.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseTokenData() {
  return {
    uri: "",
    encrypted: false,
    proof: "",
    type: "",
    id: ""
  };
}
var TokenData = exports.TokenData = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.uri !== "") {
      writer.uint32(10).string(message.uri);
    }
    if (message.encrypted === true) {
      writer.uint32(16).bool(message.encrypted);
    }
    if (message.proof !== "") {
      writer.uint32(26).string(message.proof);
    }
    if (message.type !== "") {
      writer.uint32(34).string(message.type);
    }
    if (message.id !== "") {
      writer.uint32(42).string(message.id);
    }
    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 = createBaseTokenData();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.uri = reader.string();
          break;
        case 2:
          message.encrypted = reader.bool();
          break;
        case 3:
          message.proof = reader.string();
          break;
        case 4:
          message.type = reader.string();
          break;
        case 5:
          message.id = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      uri: (0, _helpers.isSet)(object.uri) ? String(object.uri) : "",
      encrypted: (0, _helpers.isSet)(object.encrypted) ? Boolean(object.encrypted) : false,
      proof: (0, _helpers.isSet)(object.proof) ? String(object.proof) : "",
      type: (0, _helpers.isSet)(object.type) ? String(object.type) : "",
      id: (0, _helpers.isSet)(object.id) ? String(object.id) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.uri !== undefined && (obj.uri = message.uri);
    message.encrypted !== undefined && (obj.encrypted = message.encrypted);
    message.proof !== undefined && (obj.proof = message.proof);
    message.type !== undefined && (obj.type = message.type);
    message.id !== undefined && (obj.id = message.id);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$uri, _object$encrypted, _object$proof, _object$type2, _object$id5;
    var message = createBaseTokenData();
    message.uri = (_object$uri = object.uri) !== null && _object$uri !== void 0 ? _object$uri : "";
    message.encrypted = (_object$encrypted = object.encrypted) !== null && _object$encrypted !== void 0 ? _object$encrypted : false;
    message.proof = (_object$proof = object.proof) !== null && _object$proof !== void 0 ? _object$proof : "";
    message.type = (_object$type2 = object.type) !== null && _object$type2 !== void 0 ? _object$type2 : "";
    message.id = (_object$id5 = object.id) !== null && _object$id5 !== void 0 ? _object$id5 : "";
    return message;
  }
};