"use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Payments = exports.PaymentTypeSDKType = exports.PaymentType = exports.PaymentStatusSDKType = exports.PaymentStatus = exports.Payment = exports.Params = exports.IntentStatusSDKType = exports.IntentStatus = exports.Intent = exports.EvaluationStatusSDKType = exports.EvaluationStatus = exports.Evaluation = exports.DisputeData = exports.Dispute = exports.Contract1155Payment = exports.CollectionStateSDKType = exports.CollectionState = exports.CollectionIntentOptionsSDKType = exports.CollectionIntentOptions = exports.Collection = exports.ClaimPayments = exports.Claim = exports.CW20Payment = exports.CW20Output = exports.CW1155Payment = exports.CW1155IntentPaymentToken = exports.CW1155IntentPayment = void 0;
exports.collectionIntentOptionsFromJSON = collectionIntentOptionsFromJSON;
exports.collectionIntentOptionsToJSON = collectionIntentOptionsToJSON;
exports.collectionStateFromJSON = collectionStateFromJSON;
exports.collectionStateToJSON = collectionStateToJSON;
exports.evaluationStatusFromJSON = evaluationStatusFromJSON;
exports.evaluationStatusToJSON = evaluationStatusToJSON;
exports.intentStatusFromJSON = intentStatusFromJSON;
exports.intentStatusToJSON = intentStatusToJSON;
exports.paymentStatusFromJSON = paymentStatusFromJSON;
exports.paymentStatusToJSON = paymentStatusToJSON;
exports.paymentTypeFromJSON = paymentTypeFromJSON;
exports.paymentTypeToJSON = paymentTypeToJSON;
var _timestamp = require("../../../google/protobuf/timestamp");
var _coin = require("../../../cosmos/base/v1beta1/coin");
var _duration = require("../../../google/protobuf/duration");
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
var CollectionState = exports.CollectionState = /*#__PURE__*/function (CollectionState) {
  CollectionState[CollectionState["OPEN"] = 0] = "OPEN";
  CollectionState[CollectionState["PAUSED"] = 1] = "PAUSED";
  CollectionState[CollectionState["CLOSED"] = 2] = "CLOSED";
  CollectionState[CollectionState["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return CollectionState;
}({});
var CollectionStateSDKType = exports.CollectionStateSDKType = CollectionState;
function collectionStateFromJSON(object) {
  switch (object) {
    case 0:
    case "OPEN":
      return CollectionState.OPEN;
    case 1:
    case "PAUSED":
      return CollectionState.PAUSED;
    case 2:
    case "CLOSED":
      return CollectionState.CLOSED;
    case -1:
    case "UNRECOGNIZED":
    default:
      return CollectionState.UNRECOGNIZED;
  }
}
function collectionStateToJSON(object) {
  switch (object) {
    case CollectionState.OPEN:
      return "OPEN";
    case CollectionState.PAUSED:
      return "PAUSED";
    case CollectionState.CLOSED:
      return "CLOSED";
    case CollectionState.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
var CollectionIntentOptions = exports.CollectionIntentOptions = /*#__PURE__*/function (CollectionIntentOptions) {
  /**
   * ALLOW - Allow: Intents can be made for claims, but claims can also be made without
   * intents.
   */
  CollectionIntentOptions[CollectionIntentOptions["ALLOW"] = 0] = "ALLOW";
  /** DENY - Deny: Intents cannot be made for claims for the collection. */
  CollectionIntentOptions[CollectionIntentOptions["DENY"] = 1] = "DENY";
  /**
   * REQUIRED - Required: Claims cannot be made without an associated intent. An intent is
   * mandatory before a claim can be submitted.
   */
  CollectionIntentOptions[CollectionIntentOptions["REQUIRED"] = 2] = "REQUIRED";
  CollectionIntentOptions[CollectionIntentOptions["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return CollectionIntentOptions;
}({});
var CollectionIntentOptionsSDKType = exports.CollectionIntentOptionsSDKType = CollectionIntentOptions;
function collectionIntentOptionsFromJSON(object) {
  switch (object) {
    case 0:
    case "ALLOW":
      return CollectionIntentOptions.ALLOW;
    case 1:
    case "DENY":
      return CollectionIntentOptions.DENY;
    case 2:
    case "REQUIRED":
      return CollectionIntentOptions.REQUIRED;
    case -1:
    case "UNRECOGNIZED":
    default:
      return CollectionIntentOptions.UNRECOGNIZED;
  }
}
function collectionIntentOptionsToJSON(object) {
  switch (object) {
    case CollectionIntentOptions.ALLOW:
      return "ALLOW";
    case CollectionIntentOptions.DENY:
      return "DENY";
    case CollectionIntentOptions.REQUIRED:
      return "REQUIRED";
    case CollectionIntentOptions.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
var EvaluationStatus = exports.EvaluationStatus = /*#__PURE__*/function (EvaluationStatus) {
  EvaluationStatus[EvaluationStatus["PENDING"] = 0] = "PENDING";
  EvaluationStatus[EvaluationStatus["APPROVED"] = 1] = "APPROVED";
  EvaluationStatus[EvaluationStatus["REJECTED"] = 2] = "REJECTED";
  EvaluationStatus[EvaluationStatus["DISPUTED"] = 3] = "DISPUTED";
  EvaluationStatus[EvaluationStatus["INVALIDATED"] = 4] = "INVALIDATED";
  EvaluationStatus[EvaluationStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return EvaluationStatus;
}({});
var EvaluationStatusSDKType = exports.EvaluationStatusSDKType = EvaluationStatus;
function evaluationStatusFromJSON(object) {
  switch (object) {
    case 0:
    case "PENDING":
      return EvaluationStatus.PENDING;
    case 1:
    case "APPROVED":
      return EvaluationStatus.APPROVED;
    case 2:
    case "REJECTED":
      return EvaluationStatus.REJECTED;
    case 3:
    case "DISPUTED":
      return EvaluationStatus.DISPUTED;
    case 4:
    case "INVALIDATED":
      return EvaluationStatus.INVALIDATED;
    case -1:
    case "UNRECOGNIZED":
    default:
      return EvaluationStatus.UNRECOGNIZED;
  }
}
function evaluationStatusToJSON(object) {
  switch (object) {
    case EvaluationStatus.PENDING:
      return "PENDING";
    case EvaluationStatus.APPROVED:
      return "APPROVED";
    case EvaluationStatus.REJECTED:
      return "REJECTED";
    case EvaluationStatus.DISPUTED:
      return "DISPUTED";
    case EvaluationStatus.INVALIDATED:
      return "INVALIDATED";
    case EvaluationStatus.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
var IntentStatus = exports.IntentStatus = /*#__PURE__*/function (IntentStatus) {
  /**
   * ACTIVE - Active: Intent is created and active, payments have been transferred to
   * escrow if there is any
   */
  IntentStatus[IntentStatus["ACTIVE"] = 0] = "ACTIVE";
  /**
   * FULFILLED - Fulfilled: Intent is fulfilled, was used to create a claim and funds will
   * be released on claim APPROVAL, or funds will be reverted on claim REJECTION
   * or DISPUTE
   */
  IntentStatus[IntentStatus["FULFILLED"] = 1] = "FULFILLED";
  /**
   * EXPIRED - Expired: Intent has expired, payments have been transferred back out of
   * escrow
   */
  IntentStatus[IntentStatus["EXPIRED"] = 2] = "EXPIRED";
  IntentStatus[IntentStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return IntentStatus;
}({});
var IntentStatusSDKType = exports.IntentStatusSDKType = IntentStatus;
function intentStatusFromJSON(object) {
  switch (object) {
    case 0:
    case "ACTIVE":
      return IntentStatus.ACTIVE;
    case 1:
    case "FULFILLED":
      return IntentStatus.FULFILLED;
    case 2:
    case "EXPIRED":
      return IntentStatus.EXPIRED;
    case -1:
    case "UNRECOGNIZED":
    default:
      return IntentStatus.UNRECOGNIZED;
  }
}
function intentStatusToJSON(object) {
  switch (object) {
    case IntentStatus.ACTIVE:
      return "ACTIVE";
    case IntentStatus.FULFILLED:
      return "FULFILLED";
    case IntentStatus.EXPIRED:
      return "EXPIRED";
    case IntentStatus.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
var PaymentType = exports.PaymentType = /*#__PURE__*/function (PaymentType) {
  PaymentType[PaymentType["SUBMISSION"] = 0] = "SUBMISSION";
  PaymentType[PaymentType["APPROVAL"] = 1] = "APPROVAL";
  PaymentType[PaymentType["EVALUATION"] = 2] = "EVALUATION";
  PaymentType[PaymentType["REJECTION"] = 3] = "REJECTION";
  PaymentType[PaymentType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return PaymentType;
}({});
var PaymentTypeSDKType = exports.PaymentTypeSDKType = PaymentType;
function paymentTypeFromJSON(object) {
  switch (object) {
    case 0:
    case "SUBMISSION":
      return PaymentType.SUBMISSION;
    case 1:
    case "APPROVAL":
      return PaymentType.APPROVAL;
    case 2:
    case "EVALUATION":
      return PaymentType.EVALUATION;
    case 3:
    case "REJECTION":
      return PaymentType.REJECTION;
    case -1:
    case "UNRECOGNIZED":
    default:
      return PaymentType.UNRECOGNIZED;
  }
}
function paymentTypeToJSON(object) {
  switch (object) {
    case PaymentType.SUBMISSION:
      return "SUBMISSION";
    case PaymentType.APPROVAL:
      return "APPROVAL";
    case PaymentType.EVALUATION:
      return "EVALUATION";
    case PaymentType.REJECTION:
      return "REJECTION";
    case PaymentType.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
var PaymentStatus = exports.PaymentStatus = /*#__PURE__*/function (PaymentStatus) {
  PaymentStatus[PaymentStatus["NO_PAYMENT"] = 0] = "NO_PAYMENT";
  /** PROMISED - Promised: Agent is contracted to receive payment */
  PaymentStatus[PaymentStatus["PROMISED"] = 1] = "PROMISED";
  /** AUTHORIZED - Authorized: Authz set up, no guarantee */
  PaymentStatus[PaymentStatus["AUTHORIZED"] = 2] = "AUTHORIZED";
  /** GUARANTEED - Guaranteed: Escrow set up with funds blocked */
  PaymentStatus[PaymentStatus["GUARANTEED"] = 3] = "GUARANTEED";
  /** PAID - Paid: Funds have been paid */
  PaymentStatus[PaymentStatus["PAID"] = 4] = "PAID";
  /** FAILED - Failed: Payment failed, most probably due to insufficient funds */
  PaymentStatus[PaymentStatus["FAILED"] = 5] = "FAILED";
  /** DISPUTED_PAYMENT - DisputedPayment: Payment disputed */
  PaymentStatus[PaymentStatus["DISPUTED_PAYMENT"] = 6] = "DISPUTED_PAYMENT";
  PaymentStatus[PaymentStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return PaymentStatus;
}({});
var PaymentStatusSDKType = exports.PaymentStatusSDKType = PaymentStatus;
function paymentStatusFromJSON(object) {
  switch (object) {
    case 0:
    case "NO_PAYMENT":
      return PaymentStatus.NO_PAYMENT;
    case 1:
    case "PROMISED":
      return PaymentStatus.PROMISED;
    case 2:
    case "AUTHORIZED":
      return PaymentStatus.AUTHORIZED;
    case 3:
    case "GUARANTEED":
      return PaymentStatus.GUARANTEED;
    case 4:
    case "PAID":
      return PaymentStatus.PAID;
    case 5:
    case "FAILED":
      return PaymentStatus.FAILED;
    case 6:
    case "DISPUTED_PAYMENT":
      return PaymentStatus.DISPUTED_PAYMENT;
    case -1:
    case "UNRECOGNIZED":
    default:
      return PaymentStatus.UNRECOGNIZED;
  }
}
function paymentStatusToJSON(object) {
  switch (object) {
    case PaymentStatus.NO_PAYMENT:
      return "NO_PAYMENT";
    case PaymentStatus.PROMISED:
      return "PROMISED";
    case PaymentStatus.AUTHORIZED:
      return "AUTHORIZED";
    case PaymentStatus.GUARANTEED:
      return "GUARANTEED";
    case PaymentStatus.PAID:
      return "PAID";
    case PaymentStatus.FAILED:
      return "FAILED";
    case PaymentStatus.DISPUTED_PAYMENT:
      return "DISPUTED_PAYMENT";
    case PaymentStatus.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}

/** CW20Output represents a CW20 token output for split payments */

/** CW20Output represents a CW20 token output for split payments */

/** Intent defines the structure for a service agent's claim intent. */

/** Intent defines the structure for a service agent's claim intent. */

function createBaseParams() {
  return {
    collectionSequence: _helpers.Long.UZERO,
    ixoAccount: "",
    networkFeePercentage: "",
    nodeFeePercentage: "",
    intentSequence: _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.collectionSequence.isZero()) {
      writer.uint32(8).uint64(message.collectionSequence);
    }
    if (message.ixoAccount !== "") {
      writer.uint32(18).string(message.ixoAccount);
    }
    if (message.networkFeePercentage !== "") {
      writer.uint32(26).string(message.networkFeePercentage);
    }
    if (message.nodeFeePercentage !== "") {
      writer.uint32(34).string(message.nodeFeePercentage);
    }
    if (!message.intentSequence.isZero()) {
      writer.uint32(40).uint64(message.intentSequence);
    }
    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.collectionSequence = reader.uint64();
          break;
        case 2:
          message.ixoAccount = reader.string();
          break;
        case 3:
          message.networkFeePercentage = reader.string();
          break;
        case 4:
          message.nodeFeePercentage = reader.string();
          break;
        case 5:
          message.intentSequence = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      collectionSequence: (0, _helpers.isSet)(object.collectionSequence) ? _helpers.Long.fromValue(object.collectionSequence) : _helpers.Long.UZERO,
      ixoAccount: (0, _helpers.isSet)(object.ixoAccount) ? String(object.ixoAccount) : "",
      networkFeePercentage: (0, _helpers.isSet)(object.networkFeePercentage) ? String(object.networkFeePercentage) : "",
      nodeFeePercentage: (0, _helpers.isSet)(object.nodeFeePercentage) ? String(object.nodeFeePercentage) : "",
      intentSequence: (0, _helpers.isSet)(object.intentSequence) ? _helpers.Long.fromValue(object.intentSequence) : _helpers.Long.UZERO
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.collectionSequence !== undefined && (obj.collectionSequence = (message.collectionSequence || _helpers.Long.UZERO).toString());
    message.ixoAccount !== undefined && (obj.ixoAccount = message.ixoAccount);
    message.networkFeePercentage !== undefined && (obj.networkFeePercentage = message.networkFeePercentage);
    message.nodeFeePercentage !== undefined && (obj.nodeFeePercentage = message.nodeFeePercentage);
    message.intentSequence !== undefined && (obj.intentSequence = (message.intentSequence || _helpers.Long.UZERO).toString());
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$ixoAccount, _object$networkFeePer, _object$nodeFeePercen;
    var message = createBaseParams();
    message.collectionSequence = object.collectionSequence !== undefined && object.collectionSequence !== null ? _helpers.Long.fromValue(object.collectionSequence) : _helpers.Long.UZERO;
    message.ixoAccount = (_object$ixoAccount = object.ixoAccount) !== null && _object$ixoAccount !== void 0 ? _object$ixoAccount : "";
    message.networkFeePercentage = (_object$networkFeePer = object.networkFeePercentage) !== null && _object$networkFeePer !== void 0 ? _object$networkFeePer : "";
    message.nodeFeePercentage = (_object$nodeFeePercen = object.nodeFeePercentage) !== null && _object$nodeFeePercen !== void 0 ? _object$nodeFeePercen : "";
    message.intentSequence = object.intentSequence !== undefined && object.intentSequence !== null ? _helpers.Long.fromValue(object.intentSequence) : _helpers.Long.UZERO;
    return message;
  }
};
function createBaseCollection() {
  return {
    id: "",
    entity: "",
    admin: "",
    protocol: "",
    startDate: undefined,
    endDate: undefined,
    quota: _helpers.Long.UZERO,
    count: _helpers.Long.UZERO,
    evaluated: _helpers.Long.UZERO,
    approved: _helpers.Long.UZERO,
    rejected: _helpers.Long.UZERO,
    disputed: _helpers.Long.UZERO,
    state: 0,
    payments: undefined,
    signer: "",
    invalidated: _helpers.Long.UZERO,
    escrowAccount: "",
    intents: 0
  };
}
var Collection = exports.Collection = {
  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.entity !== "") {
      writer.uint32(18).string(message.entity);
    }
    if (message.admin !== "") {
      writer.uint32(26).string(message.admin);
    }
    if (message.protocol !== "") {
      writer.uint32(34).string(message.protocol);
    }
    if (message.startDate !== undefined) {
      _timestamp.Timestamp.encode(message.startDate, writer.uint32(42).fork()).ldelim();
    }
    if (message.endDate !== undefined) {
      _timestamp.Timestamp.encode(message.endDate, writer.uint32(50).fork()).ldelim();
    }
    if (!message.quota.isZero()) {
      writer.uint32(56).uint64(message.quota);
    }
    if (!message.count.isZero()) {
      writer.uint32(64).uint64(message.count);
    }
    if (!message.evaluated.isZero()) {
      writer.uint32(72).uint64(message.evaluated);
    }
    if (!message.approved.isZero()) {
      writer.uint32(80).uint64(message.approved);
    }
    if (!message.rejected.isZero()) {
      writer.uint32(88).uint64(message.rejected);
    }
    if (!message.disputed.isZero()) {
      writer.uint32(96).uint64(message.disputed);
    }
    if (message.state !== 0) {
      writer.uint32(104).int32(message.state);
    }
    if (message.payments !== undefined) {
      Payments.encode(message.payments, writer.uint32(114).fork()).ldelim();
    }
    if (message.signer !== "") {
      writer.uint32(122).string(message.signer);
    }
    if (!message.invalidated.isZero()) {
      writer.uint32(128).uint64(message.invalidated);
    }
    if (message.escrowAccount !== "") {
      writer.uint32(138).string(message.escrowAccount);
    }
    if (message.intents !== 0) {
      writer.uint32(144).int32(message.intents);
    }
    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 = createBaseCollection();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.entity = reader.string();
          break;
        case 3:
          message.admin = reader.string();
          break;
        case 4:
          message.protocol = reader.string();
          break;
        case 5:
          message.startDate = _timestamp.Timestamp.decode(reader, reader.uint32());
          break;
        case 6:
          message.endDate = _timestamp.Timestamp.decode(reader, reader.uint32());
          break;
        case 7:
          message.quota = reader.uint64();
          break;
        case 8:
          message.count = reader.uint64();
          break;
        case 9:
          message.evaluated = reader.uint64();
          break;
        case 10:
          message.approved = reader.uint64();
          break;
        case 11:
          message.rejected = reader.uint64();
          break;
        case 12:
          message.disputed = reader.uint64();
          break;
        case 13:
          message.state = reader.int32();
          break;
        case 14:
          message.payments = Payments.decode(reader, reader.uint32());
          break;
        case 15:
          message.signer = reader.string();
          break;
        case 16:
          message.invalidated = reader.uint64();
          break;
        case 17:
          message.escrowAccount = reader.string();
          break;
        case 18:
          message.intents = reader.int32();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? String(object.id) : "",
      entity: (0, _helpers.isSet)(object.entity) ? String(object.entity) : "",
      admin: (0, _helpers.isSet)(object.admin) ? String(object.admin) : "",
      protocol: (0, _helpers.isSet)(object.protocol) ? String(object.protocol) : "",
      startDate: (0, _helpers.isSet)(object.startDate) ? (0, _helpers.fromJsonTimestamp)(object.startDate) : undefined,
      endDate: (0, _helpers.isSet)(object.endDate) ? (0, _helpers.fromJsonTimestamp)(object.endDate) : undefined,
      quota: (0, _helpers.isSet)(object.quota) ? _helpers.Long.fromValue(object.quota) : _helpers.Long.UZERO,
      count: (0, _helpers.isSet)(object.count) ? _helpers.Long.fromValue(object.count) : _helpers.Long.UZERO,
      evaluated: (0, _helpers.isSet)(object.evaluated) ? _helpers.Long.fromValue(object.evaluated) : _helpers.Long.UZERO,
      approved: (0, _helpers.isSet)(object.approved) ? _helpers.Long.fromValue(object.approved) : _helpers.Long.UZERO,
      rejected: (0, _helpers.isSet)(object.rejected) ? _helpers.Long.fromValue(object.rejected) : _helpers.Long.UZERO,
      disputed: (0, _helpers.isSet)(object.disputed) ? _helpers.Long.fromValue(object.disputed) : _helpers.Long.UZERO,
      state: (0, _helpers.isSet)(object.state) ? collectionStateFromJSON(object.state) : 0,
      payments: (0, _helpers.isSet)(object.payments) ? Payments.fromJSON(object.payments) : undefined,
      signer: (0, _helpers.isSet)(object.signer) ? String(object.signer) : "",
      invalidated: (0, _helpers.isSet)(object.invalidated) ? _helpers.Long.fromValue(object.invalidated) : _helpers.Long.UZERO,
      escrowAccount: (0, _helpers.isSet)(object.escrowAccount) ? String(object.escrowAccount) : "",
      intents: (0, _helpers.isSet)(object.intents) ? collectionIntentOptionsFromJSON(object.intents) : 0
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.entity !== undefined && (obj.entity = message.entity);
    message.admin !== undefined && (obj.admin = message.admin);
    message.protocol !== undefined && (obj.protocol = message.protocol);
    message.startDate !== undefined && (obj.startDate = (0, _helpers.fromTimestamp)(message.startDate).toISOString());
    message.endDate !== undefined && (obj.endDate = (0, _helpers.fromTimestamp)(message.endDate).toISOString());
    message.quota !== undefined && (obj.quota = (message.quota || _helpers.Long.UZERO).toString());
    message.count !== undefined && (obj.count = (message.count || _helpers.Long.UZERO).toString());
    message.evaluated !== undefined && (obj.evaluated = (message.evaluated || _helpers.Long.UZERO).toString());
    message.approved !== undefined && (obj.approved = (message.approved || _helpers.Long.UZERO).toString());
    message.rejected !== undefined && (obj.rejected = (message.rejected || _helpers.Long.UZERO).toString());
    message.disputed !== undefined && (obj.disputed = (message.disputed || _helpers.Long.UZERO).toString());
    message.state !== undefined && (obj.state = collectionStateToJSON(message.state));
    message.payments !== undefined && (obj.payments = message.payments ? Payments.toJSON(message.payments) : undefined);
    message.signer !== undefined && (obj.signer = message.signer);
    message.invalidated !== undefined && (obj.invalidated = (message.invalidated || _helpers.Long.UZERO).toString());
    message.escrowAccount !== undefined && (obj.escrowAccount = message.escrowAccount);
    message.intents !== undefined && (obj.intents = collectionIntentOptionsToJSON(message.intents));
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$id, _object$entity, _object$admin, _object$protocol, _object$state, _object$signer, _object$escrowAccount, _object$intents;
    var message = createBaseCollection();
    message.id = (_object$id = object.id) !== null && _object$id !== void 0 ? _object$id : "";
    message.entity = (_object$entity = object.entity) !== null && _object$entity !== void 0 ? _object$entity : "";
    message.admin = (_object$admin = object.admin) !== null && _object$admin !== void 0 ? _object$admin : "";
    message.protocol = (_object$protocol = object.protocol) !== null && _object$protocol !== void 0 ? _object$protocol : "";
    message.startDate = object.startDate !== undefined && object.startDate !== null ? _timestamp.Timestamp.fromPartial(object.startDate) : undefined;
    message.endDate = object.endDate !== undefined && object.endDate !== null ? _timestamp.Timestamp.fromPartial(object.endDate) : undefined;
    message.quota = object.quota !== undefined && object.quota !== null ? _helpers.Long.fromValue(object.quota) : _helpers.Long.UZERO;
    message.count = object.count !== undefined && object.count !== null ? _helpers.Long.fromValue(object.count) : _helpers.Long.UZERO;
    message.evaluated = object.evaluated !== undefined && object.evaluated !== null ? _helpers.Long.fromValue(object.evaluated) : _helpers.Long.UZERO;
    message.approved = object.approved !== undefined && object.approved !== null ? _helpers.Long.fromValue(object.approved) : _helpers.Long.UZERO;
    message.rejected = object.rejected !== undefined && object.rejected !== null ? _helpers.Long.fromValue(object.rejected) : _helpers.Long.UZERO;
    message.disputed = object.disputed !== undefined && object.disputed !== null ? _helpers.Long.fromValue(object.disputed) : _helpers.Long.UZERO;
    message.state = (_object$state = object.state) !== null && _object$state !== void 0 ? _object$state : 0;
    message.payments = object.payments !== undefined && object.payments !== null ? Payments.fromPartial(object.payments) : undefined;
    message.signer = (_object$signer = object.signer) !== null && _object$signer !== void 0 ? _object$signer : "";
    message.invalidated = object.invalidated !== undefined && object.invalidated !== null ? _helpers.Long.fromValue(object.invalidated) : _helpers.Long.UZERO;
    message.escrowAccount = (_object$escrowAccount = object.escrowAccount) !== null && _object$escrowAccount !== void 0 ? _object$escrowAccount : "";
    message.intents = (_object$intents = object.intents) !== null && _object$intents !== void 0 ? _object$intents : 0;
    return message;
  }
};
function createBasePayments() {
  return {
    submission: undefined,
    evaluation: undefined,
    approval: undefined,
    rejection: undefined
  };
}
var Payments = exports.Payments = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.submission !== undefined) {
      Payment.encode(message.submission, writer.uint32(10).fork()).ldelim();
    }
    if (message.evaluation !== undefined) {
      Payment.encode(message.evaluation, writer.uint32(18).fork()).ldelim();
    }
    if (message.approval !== undefined) {
      Payment.encode(message.approval, writer.uint32(26).fork()).ldelim();
    }
    if (message.rejection !== undefined) {
      Payment.encode(message.rejection, writer.uint32(34).fork()).ldelim();
    }
    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 = createBasePayments();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.submission = Payment.decode(reader, reader.uint32());
          break;
        case 2:
          message.evaluation = Payment.decode(reader, reader.uint32());
          break;
        case 3:
          message.approval = Payment.decode(reader, reader.uint32());
          break;
        case 4:
          message.rejection = Payment.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      submission: (0, _helpers.isSet)(object.submission) ? Payment.fromJSON(object.submission) : undefined,
      evaluation: (0, _helpers.isSet)(object.evaluation) ? Payment.fromJSON(object.evaluation) : undefined,
      approval: (0, _helpers.isSet)(object.approval) ? Payment.fromJSON(object.approval) : undefined,
      rejection: (0, _helpers.isSet)(object.rejection) ? Payment.fromJSON(object.rejection) : undefined
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.submission !== undefined && (obj.submission = message.submission ? Payment.toJSON(message.submission) : undefined);
    message.evaluation !== undefined && (obj.evaluation = message.evaluation ? Payment.toJSON(message.evaluation) : undefined);
    message.approval !== undefined && (obj.approval = message.approval ? Payment.toJSON(message.approval) : undefined);
    message.rejection !== undefined && (obj.rejection = message.rejection ? Payment.toJSON(message.rejection) : undefined);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var message = createBasePayments();
    message.submission = object.submission !== undefined && object.submission !== null ? Payment.fromPartial(object.submission) : undefined;
    message.evaluation = object.evaluation !== undefined && object.evaluation !== null ? Payment.fromPartial(object.evaluation) : undefined;
    message.approval = object.approval !== undefined && object.approval !== null ? Payment.fromPartial(object.approval) : undefined;
    message.rejection = object.rejection !== undefined && object.rejection !== null ? Payment.fromPartial(object.rejection) : undefined;
    return message;
  }
};
function createBasePayment() {
  return {
    account: "",
    amount: [],
    contract_1155Payment: undefined,
    timeoutNs: undefined,
    cw20Payment: [],
    isOraclePayment: false,
    cw1155Payment: []
  };
}
var Payment = exports.Payment = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.account !== "") {
      writer.uint32(10).string(message.account);
    }
    var _iterator = _createForOfIteratorHelper(message.amount),
      _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var v = _step.value;
        _coin.Coin.encode(v, writer.uint32(18).fork()).ldelim();
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
    if (message.contract_1155Payment !== undefined) {
      Contract1155Payment.encode(message.contract_1155Payment, writer.uint32(26).fork()).ldelim();
    }
    if (message.timeoutNs !== undefined) {
      _duration.Duration.encode(message.timeoutNs, writer.uint32(34).fork()).ldelim();
    }
    var _iterator2 = _createForOfIteratorHelper(message.cw20Payment),
      _step2;
    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var _v = _step2.value;
        CW20Payment.encode(_v, writer.uint32(42).fork()).ldelim();
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }
    if (message.isOraclePayment === true) {
      writer.uint32(48).bool(message.isOraclePayment);
    }
    var _iterator3 = _createForOfIteratorHelper(message.cw1155Payment),
      _step3;
    try {
      for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
        var _v2 = _step3.value;
        CW1155Payment.encode(_v2, writer.uint32(58).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 = createBasePayment();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.account = reader.string();
          break;
        case 2:
          message.amount.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 3:
          message.contract_1155Payment = Contract1155Payment.decode(reader, reader.uint32());
          break;
        case 4:
          message.timeoutNs = _duration.Duration.decode(reader, reader.uint32());
          break;
        case 5:
          message.cw20Payment.push(CW20Payment.decode(reader, reader.uint32()));
          break;
        case 6:
          message.isOraclePayment = reader.bool();
          break;
        case 7:
          message.cw1155Payment.push(CW1155Payment.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      account: (0, _helpers.isSet)(object.account) ? String(object.account) : "",
      amount: Array.isArray(object === null || object === void 0 ? void 0 : object.amount) ? object.amount.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      contract_1155Payment: (0, _helpers.isSet)(object.contract_1155Payment) ? Contract1155Payment.fromJSON(object.contract_1155Payment) : undefined,
      timeoutNs: (0, _helpers.isSet)(object.timeoutNs) ? _duration.Duration.fromJSON(object.timeoutNs) : undefined,
      cw20Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw20Payment) ? object.cw20Payment.map(function (e) {
        return CW20Payment.fromJSON(e);
      }) : [],
      isOraclePayment: (0, _helpers.isSet)(object.isOraclePayment) ? Boolean(object.isOraclePayment) : false,
      cw1155Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155Payment) ? object.cw1155Payment.map(function (e) {
        return CW1155Payment.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.account !== undefined && (obj.account = message.account);
    if (message.amount) {
      obj.amount = message.amount.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.amount = [];
    }
    message.contract_1155Payment !== undefined && (obj.contract_1155Payment = message.contract_1155Payment ? Contract1155Payment.toJSON(message.contract_1155Payment) : undefined);
    message.timeoutNs !== undefined && (obj.timeoutNs = message.timeoutNs ? _duration.Duration.toJSON(message.timeoutNs) : undefined);
    if (message.cw20Payment) {
      obj.cw20Payment = message.cw20Payment.map(function (e) {
        return e ? CW20Payment.toJSON(e) : undefined;
      });
    } else {
      obj.cw20Payment = [];
    }
    message.isOraclePayment !== undefined && (obj.isOraclePayment = message.isOraclePayment);
    if (message.cw1155Payment) {
      obj.cw1155Payment = message.cw1155Payment.map(function (e) {
        return e ? CW1155Payment.toJSON(e) : undefined;
      });
    } else {
      obj.cw1155Payment = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$account, _object$amount, _object$cw20Payment, _object$isOraclePayme, _object$cw1155Payment;
    var message = createBasePayment();
    message.account = (_object$account = object.account) !== null && _object$account !== void 0 ? _object$account : "";
    message.amount = ((_object$amount = object.amount) === null || _object$amount === void 0 ? void 0 : _object$amount.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.contract_1155Payment = object.contract_1155Payment !== undefined && object.contract_1155Payment !== null ? Contract1155Payment.fromPartial(object.contract_1155Payment) : undefined;
    message.timeoutNs = object.timeoutNs !== undefined && object.timeoutNs !== null ? _duration.Duration.fromPartial(object.timeoutNs) : undefined;
    message.cw20Payment = ((_object$cw20Payment = object.cw20Payment) === null || _object$cw20Payment === void 0 ? void 0 : _object$cw20Payment.map(function (e) {
      return CW20Payment.fromPartial(e);
    })) || [];
    message.isOraclePayment = (_object$isOraclePayme = object.isOraclePayment) !== null && _object$isOraclePayme !== void 0 ? _object$isOraclePayme : false;
    message.cw1155Payment = ((_object$cw1155Payment = object.cw1155Payment) === null || _object$cw1155Payment === void 0 ? void 0 : _object$cw1155Payment.map(function (e) {
      return CW1155Payment.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseContract1155Payment() {
  return {
    address: "",
    tokenId: "",
    amount: 0
  };
}
var Contract1155Payment = exports.Contract1155Payment = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.address !== "") {
      writer.uint32(10).string(message.address);
    }
    if (message.tokenId !== "") {
      writer.uint32(18).string(message.tokenId);
    }
    if (message.amount !== 0) {
      writer.uint32(24).uint32(message.amount);
    }
    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 = createBaseContract1155Payment();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.address = reader.string();
          break;
        case 2:
          message.tokenId = reader.string();
          break;
        case 3:
          message.amount = reader.uint32();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      address: (0, _helpers.isSet)(object.address) ? String(object.address) : "",
      tokenId: (0, _helpers.isSet)(object.tokenId) ? String(object.tokenId) : "",
      amount: (0, _helpers.isSet)(object.amount) ? Number(object.amount) : 0
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.address !== undefined && (obj.address = message.address);
    message.tokenId !== undefined && (obj.tokenId = message.tokenId);
    message.amount !== undefined && (obj.amount = Math.round(message.amount));
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$address, _object$tokenId, _object$amount2;
    var message = createBaseContract1155Payment();
    message.address = (_object$address = object.address) !== null && _object$address !== void 0 ? _object$address : "";
    message.tokenId = (_object$tokenId = object.tokenId) !== null && _object$tokenId !== void 0 ? _object$tokenId : "";
    message.amount = (_object$amount2 = object.amount) !== null && _object$amount2 !== void 0 ? _object$amount2 : 0;
    return message;
  }
};
function createBaseCW1155Payment() {
  return {
    address: "",
    tokenId: [],
    amount: _helpers.Long.UZERO
  };
}
var CW1155Payment = exports.CW1155Payment = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.address !== "") {
      writer.uint32(10).string(message.address);
    }
    var _iterator4 = _createForOfIteratorHelper(message.tokenId),
      _step4;
    try {
      for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
        var v = _step4.value;
        writer.uint32(18).string(v);
      }
    } catch (err) {
      _iterator4.e(err);
    } finally {
      _iterator4.f();
    }
    if (!message.amount.isZero()) {
      writer.uint32(24).uint64(message.amount);
    }
    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 = createBaseCW1155Payment();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.address = reader.string();
          break;
        case 2:
          message.tokenId.push(reader.string());
          break;
        case 3:
          message.amount = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      address: (0, _helpers.isSet)(object.address) ? String(object.address) : "",
      tokenId: Array.isArray(object === null || object === void 0 ? void 0 : object.tokenId) ? object.tokenId.map(function (e) {
        return String(e);
      }) : [],
      amount: (0, _helpers.isSet)(object.amount) ? _helpers.Long.fromValue(object.amount) : _helpers.Long.UZERO
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.address !== undefined && (obj.address = message.address);
    if (message.tokenId) {
      obj.tokenId = message.tokenId.map(function (e) {
        return e;
      });
    } else {
      obj.tokenId = [];
    }
    message.amount !== undefined && (obj.amount = (message.amount || _helpers.Long.UZERO).toString());
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$address2, _object$tokenId2;
    var message = createBaseCW1155Payment();
    message.address = (_object$address2 = object.address) !== null && _object$address2 !== void 0 ? _object$address2 : "";
    message.tokenId = ((_object$tokenId2 = object.tokenId) === null || _object$tokenId2 === void 0 ? void 0 : _object$tokenId2.map(function (e) {
      return e;
    })) || [];
    message.amount = object.amount !== undefined && object.amount !== null ? _helpers.Long.fromValue(object.amount) : _helpers.Long.UZERO;
    return message;
  }
};
function createBaseCW1155IntentPayment() {
  return {
    address: "",
    tokens: []
  };
}
var CW1155IntentPayment = exports.CW1155IntentPayment = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.address !== "") {
      writer.uint32(10).string(message.address);
    }
    var _iterator5 = _createForOfIteratorHelper(message.tokens),
      _step5;
    try {
      for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
        var v = _step5.value;
        CW1155IntentPaymentToken.encode(v, writer.uint32(18).fork()).ldelim();
      }
    } catch (err) {
      _iterator5.e(err);
    } finally {
      _iterator5.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 = createBaseCW1155IntentPayment();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.address = reader.string();
          break;
        case 2:
          message.tokens.push(CW1155IntentPaymentToken.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      address: (0, _helpers.isSet)(object.address) ? String(object.address) : "",
      tokens: Array.isArray(object === null || object === void 0 ? void 0 : object.tokens) ? object.tokens.map(function (e) {
        return CW1155IntentPaymentToken.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.address !== undefined && (obj.address = message.address);
    if (message.tokens) {
      obj.tokens = message.tokens.map(function (e) {
        return e ? CW1155IntentPaymentToken.toJSON(e) : undefined;
      });
    } else {
      obj.tokens = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$address3, _object$tokens;
    var message = createBaseCW1155IntentPayment();
    message.address = (_object$address3 = object.address) !== null && _object$address3 !== void 0 ? _object$address3 : "";
    message.tokens = ((_object$tokens = object.tokens) === null || _object$tokens === void 0 ? void 0 : _object$tokens.map(function (e) {
      return CW1155IntentPaymentToken.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseCW1155IntentPaymentToken() {
  return {
    tokenId: "",
    amount: _helpers.Long.UZERO
  };
}
var CW1155IntentPaymentToken = exports.CW1155IntentPaymentToken = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.tokenId !== "") {
      writer.uint32(10).string(message.tokenId);
    }
    if (!message.amount.isZero()) {
      writer.uint32(16).uint64(message.amount);
    }
    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 = createBaseCW1155IntentPaymentToken();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.tokenId = reader.string();
          break;
        case 2:
          message.amount = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      tokenId: (0, _helpers.isSet)(object.tokenId) ? String(object.tokenId) : "",
      amount: (0, _helpers.isSet)(object.amount) ? _helpers.Long.fromValue(object.amount) : _helpers.Long.UZERO
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.tokenId !== undefined && (obj.tokenId = message.tokenId);
    message.amount !== undefined && (obj.amount = (message.amount || _helpers.Long.UZERO).toString());
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$tokenId3;
    var message = createBaseCW1155IntentPaymentToken();
    message.tokenId = (_object$tokenId3 = object.tokenId) !== null && _object$tokenId3 !== void 0 ? _object$tokenId3 : "";
    message.amount = object.amount !== undefined && object.amount !== null ? _helpers.Long.fromValue(object.amount) : _helpers.Long.UZERO;
    return message;
  }
};
function createBaseCW20Payment() {
  return {
    address: "",
    amount: _helpers.Long.UZERO
  };
}
var CW20Payment = exports.CW20Payment = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.address !== "") {
      writer.uint32(10).string(message.address);
    }
    if (!message.amount.isZero()) {
      writer.uint32(24).uint64(message.amount);
    }
    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 = createBaseCW20Payment();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.address = reader.string();
          break;
        case 3:
          message.amount = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      address: (0, _helpers.isSet)(object.address) ? String(object.address) : "",
      amount: (0, _helpers.isSet)(object.amount) ? _helpers.Long.fromValue(object.amount) : _helpers.Long.UZERO
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.address !== undefined && (obj.address = message.address);
    message.amount !== undefined && (obj.amount = (message.amount || _helpers.Long.UZERO).toString());
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$address4;
    var message = createBaseCW20Payment();
    message.address = (_object$address4 = object.address) !== null && _object$address4 !== void 0 ? _object$address4 : "";
    message.amount = object.amount !== undefined && object.amount !== null ? _helpers.Long.fromValue(object.amount) : _helpers.Long.UZERO;
    return message;
  }
};
function createBaseCW20Output() {
  return {
    address: "",
    contractAddress: "",
    amount: _helpers.Long.UZERO
  };
}
var CW20Output = exports.CW20Output = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.address !== "") {
      writer.uint32(10).string(message.address);
    }
    if (message.contractAddress !== "") {
      writer.uint32(18).string(message.contractAddress);
    }
    if (!message.amount.isZero()) {
      writer.uint32(24).uint64(message.amount);
    }
    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 = createBaseCW20Output();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.address = reader.string();
          break;
        case 2:
          message.contractAddress = reader.string();
          break;
        case 3:
          message.amount = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      address: (0, _helpers.isSet)(object.address) ? String(object.address) : "",
      contractAddress: (0, _helpers.isSet)(object.contractAddress) ? String(object.contractAddress) : "",
      amount: (0, _helpers.isSet)(object.amount) ? _helpers.Long.fromValue(object.amount) : _helpers.Long.UZERO
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.address !== undefined && (obj.address = message.address);
    message.contractAddress !== undefined && (obj.contractAddress = message.contractAddress);
    message.amount !== undefined && (obj.amount = (message.amount || _helpers.Long.UZERO).toString());
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$address5, _object$contractAddre;
    var message = createBaseCW20Output();
    message.address = (_object$address5 = object.address) !== null && _object$address5 !== void 0 ? _object$address5 : "";
    message.contractAddress = (_object$contractAddre = object.contractAddress) !== null && _object$contractAddre !== void 0 ? _object$contractAddre : "";
    message.amount = object.amount !== undefined && object.amount !== null ? _helpers.Long.fromValue(object.amount) : _helpers.Long.UZERO;
    return message;
  }
};
function createBaseClaim() {
  return {
    collectionId: "",
    agentDid: "",
    agentAddress: "",
    submissionDate: undefined,
    claimId: "",
    evaluation: undefined,
    paymentsStatus: undefined,
    useIntent: false,
    amount: [],
    cw20Payment: [],
    cw1155Payment: [],
    cw1155IntentPayment: []
  };
}
var Claim = exports.Claim = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.collectionId !== "") {
      writer.uint32(10).string(message.collectionId);
    }
    if (message.agentDid !== "") {
      writer.uint32(18).string(message.agentDid);
    }
    if (message.agentAddress !== "") {
      writer.uint32(26).string(message.agentAddress);
    }
    if (message.submissionDate !== undefined) {
      _timestamp.Timestamp.encode(message.submissionDate, writer.uint32(34).fork()).ldelim();
    }
    if (message.claimId !== "") {
      writer.uint32(42).string(message.claimId);
    }
    if (message.evaluation !== undefined) {
      Evaluation.encode(message.evaluation, writer.uint32(50).fork()).ldelim();
    }
    if (message.paymentsStatus !== undefined) {
      ClaimPayments.encode(message.paymentsStatus, writer.uint32(58).fork()).ldelim();
    }
    if (message.useIntent === true) {
      writer.uint32(64).bool(message.useIntent);
    }
    var _iterator6 = _createForOfIteratorHelper(message.amount),
      _step6;
    try {
      for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
        var v = _step6.value;
        _coin.Coin.encode(v, writer.uint32(74).fork()).ldelim();
      }
    } catch (err) {
      _iterator6.e(err);
    } finally {
      _iterator6.f();
    }
    var _iterator7 = _createForOfIteratorHelper(message.cw20Payment),
      _step7;
    try {
      for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
        var _v3 = _step7.value;
        CW20Payment.encode(_v3, writer.uint32(82).fork()).ldelim();
      }
    } catch (err) {
      _iterator7.e(err);
    } finally {
      _iterator7.f();
    }
    var _iterator8 = _createForOfIteratorHelper(message.cw1155Payment),
      _step8;
    try {
      for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
        var _v4 = _step8.value;
        CW1155Payment.encode(_v4, writer.uint32(90).fork()).ldelim();
      }
    } catch (err) {
      _iterator8.e(err);
    } finally {
      _iterator8.f();
    }
    var _iterator9 = _createForOfIteratorHelper(message.cw1155IntentPayment),
      _step9;
    try {
      for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
        var _v5 = _step9.value;
        CW1155IntentPayment.encode(_v5, writer.uint32(98).fork()).ldelim();
      }
    } catch (err) {
      _iterator9.e(err);
    } finally {
      _iterator9.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 = createBaseClaim();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.collectionId = reader.string();
          break;
        case 2:
          message.agentDid = reader.string();
          break;
        case 3:
          message.agentAddress = reader.string();
          break;
        case 4:
          message.submissionDate = _timestamp.Timestamp.decode(reader, reader.uint32());
          break;
        case 5:
          message.claimId = reader.string();
          break;
        case 6:
          message.evaluation = Evaluation.decode(reader, reader.uint32());
          break;
        case 7:
          message.paymentsStatus = ClaimPayments.decode(reader, reader.uint32());
          break;
        case 8:
          message.useIntent = reader.bool();
          break;
        case 9:
          message.amount.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 10:
          message.cw20Payment.push(CW20Payment.decode(reader, reader.uint32()));
          break;
        case 11:
          message.cw1155Payment.push(CW1155Payment.decode(reader, reader.uint32()));
          break;
        case 12:
          message.cw1155IntentPayment.push(CW1155IntentPayment.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      collectionId: (0, _helpers.isSet)(object.collectionId) ? String(object.collectionId) : "",
      agentDid: (0, _helpers.isSet)(object.agentDid) ? String(object.agentDid) : "",
      agentAddress: (0, _helpers.isSet)(object.agentAddress) ? String(object.agentAddress) : "",
      submissionDate: (0, _helpers.isSet)(object.submissionDate) ? (0, _helpers.fromJsonTimestamp)(object.submissionDate) : undefined,
      claimId: (0, _helpers.isSet)(object.claimId) ? String(object.claimId) : "",
      evaluation: (0, _helpers.isSet)(object.evaluation) ? Evaluation.fromJSON(object.evaluation) : undefined,
      paymentsStatus: (0, _helpers.isSet)(object.paymentsStatus) ? ClaimPayments.fromJSON(object.paymentsStatus) : undefined,
      useIntent: (0, _helpers.isSet)(object.useIntent) ? Boolean(object.useIntent) : false,
      amount: Array.isArray(object === null || object === void 0 ? void 0 : object.amount) ? object.amount.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      cw20Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw20Payment) ? object.cw20Payment.map(function (e) {
        return CW20Payment.fromJSON(e);
      }) : [],
      cw1155Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155Payment) ? object.cw1155Payment.map(function (e) {
        return CW1155Payment.fromJSON(e);
      }) : [],
      cw1155IntentPayment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155IntentPayment) ? object.cw1155IntentPayment.map(function (e) {
        return CW1155IntentPayment.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.collectionId !== undefined && (obj.collectionId = message.collectionId);
    message.agentDid !== undefined && (obj.agentDid = message.agentDid);
    message.agentAddress !== undefined && (obj.agentAddress = message.agentAddress);
    message.submissionDate !== undefined && (obj.submissionDate = (0, _helpers.fromTimestamp)(message.submissionDate).toISOString());
    message.claimId !== undefined && (obj.claimId = message.claimId);
    message.evaluation !== undefined && (obj.evaluation = message.evaluation ? Evaluation.toJSON(message.evaluation) : undefined);
    message.paymentsStatus !== undefined && (obj.paymentsStatus = message.paymentsStatus ? ClaimPayments.toJSON(message.paymentsStatus) : undefined);
    message.useIntent !== undefined && (obj.useIntent = message.useIntent);
    if (message.amount) {
      obj.amount = message.amount.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.amount = [];
    }
    if (message.cw20Payment) {
      obj.cw20Payment = message.cw20Payment.map(function (e) {
        return e ? CW20Payment.toJSON(e) : undefined;
      });
    } else {
      obj.cw20Payment = [];
    }
    if (message.cw1155Payment) {
      obj.cw1155Payment = message.cw1155Payment.map(function (e) {
        return e ? CW1155Payment.toJSON(e) : undefined;
      });
    } else {
      obj.cw1155Payment = [];
    }
    if (message.cw1155IntentPayment) {
      obj.cw1155IntentPayment = message.cw1155IntentPayment.map(function (e) {
        return e ? CW1155IntentPayment.toJSON(e) : undefined;
      });
    } else {
      obj.cw1155IntentPayment = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$collectionId, _object$agentDid, _object$agentAddress, _object$claimId, _object$useIntent, _object$amount3, _object$cw20Payment2, _object$cw1155Payment2, _object$cw1155IntentP;
    var message = createBaseClaim();
    message.collectionId = (_object$collectionId = object.collectionId) !== null && _object$collectionId !== void 0 ? _object$collectionId : "";
    message.agentDid = (_object$agentDid = object.agentDid) !== null && _object$agentDid !== void 0 ? _object$agentDid : "";
    message.agentAddress = (_object$agentAddress = object.agentAddress) !== null && _object$agentAddress !== void 0 ? _object$agentAddress : "";
    message.submissionDate = object.submissionDate !== undefined && object.submissionDate !== null ? _timestamp.Timestamp.fromPartial(object.submissionDate) : undefined;
    message.claimId = (_object$claimId = object.claimId) !== null && _object$claimId !== void 0 ? _object$claimId : "";
    message.evaluation = object.evaluation !== undefined && object.evaluation !== null ? Evaluation.fromPartial(object.evaluation) : undefined;
    message.paymentsStatus = object.paymentsStatus !== undefined && object.paymentsStatus !== null ? ClaimPayments.fromPartial(object.paymentsStatus) : undefined;
    message.useIntent = (_object$useIntent = object.useIntent) !== null && _object$useIntent !== void 0 ? _object$useIntent : false;
    message.amount = ((_object$amount3 = object.amount) === null || _object$amount3 === void 0 ? void 0 : _object$amount3.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.cw20Payment = ((_object$cw20Payment2 = object.cw20Payment) === null || _object$cw20Payment2 === void 0 ? void 0 : _object$cw20Payment2.map(function (e) {
      return CW20Payment.fromPartial(e);
    })) || [];
    message.cw1155Payment = ((_object$cw1155Payment2 = object.cw1155Payment) === null || _object$cw1155Payment2 === void 0 ? void 0 : _object$cw1155Payment2.map(function (e) {
      return CW1155Payment.fromPartial(e);
    })) || [];
    message.cw1155IntentPayment = ((_object$cw1155IntentP = object.cw1155IntentPayment) === null || _object$cw1155IntentP === void 0 ? void 0 : _object$cw1155IntentP.map(function (e) {
      return CW1155IntentPayment.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseClaimPayments() {
  return {
    submission: 0,
    evaluation: 0,
    approval: 0,
    rejection: 0
  };
}
var ClaimPayments = exports.ClaimPayments = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.submission !== 0) {
      writer.uint32(8).int32(message.submission);
    }
    if (message.evaluation !== 0) {
      writer.uint32(16).int32(message.evaluation);
    }
    if (message.approval !== 0) {
      writer.uint32(24).int32(message.approval);
    }
    if (message.rejection !== 0) {
      writer.uint32(32).int32(message.rejection);
    }
    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 = createBaseClaimPayments();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.submission = reader.int32();
          break;
        case 2:
          message.evaluation = reader.int32();
          break;
        case 3:
          message.approval = reader.int32();
          break;
        case 4:
          message.rejection = reader.int32();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      submission: (0, _helpers.isSet)(object.submission) ? paymentStatusFromJSON(object.submission) : 0,
      evaluation: (0, _helpers.isSet)(object.evaluation) ? paymentStatusFromJSON(object.evaluation) : 0,
      approval: (0, _helpers.isSet)(object.approval) ? paymentStatusFromJSON(object.approval) : 0,
      rejection: (0, _helpers.isSet)(object.rejection) ? paymentStatusFromJSON(object.rejection) : 0
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.submission !== undefined && (obj.submission = paymentStatusToJSON(message.submission));
    message.evaluation !== undefined && (obj.evaluation = paymentStatusToJSON(message.evaluation));
    message.approval !== undefined && (obj.approval = paymentStatusToJSON(message.approval));
    message.rejection !== undefined && (obj.rejection = paymentStatusToJSON(message.rejection));
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$submission, _object$evaluation, _object$approval, _object$rejection;
    var message = createBaseClaimPayments();
    message.submission = (_object$submission = object.submission) !== null && _object$submission !== void 0 ? _object$submission : 0;
    message.evaluation = (_object$evaluation = object.evaluation) !== null && _object$evaluation !== void 0 ? _object$evaluation : 0;
    message.approval = (_object$approval = object.approval) !== null && _object$approval !== void 0 ? _object$approval : 0;
    message.rejection = (_object$rejection = object.rejection) !== null && _object$rejection !== void 0 ? _object$rejection : 0;
    return message;
  }
};
function createBaseEvaluation() {
  return {
    claimId: "",
    collectionId: "",
    oracle: "",
    agentDid: "",
    agentAddress: "",
    status: 0,
    reason: 0,
    verificationProof: "",
    evaluationDate: undefined,
    amount: [],
    cw20Payment: [],
    cw1155Payment: [],
    cw1155IntentPayment: []
  };
}
var Evaluation = exports.Evaluation = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.claimId !== "") {
      writer.uint32(10).string(message.claimId);
    }
    if (message.collectionId !== "") {
      writer.uint32(18).string(message.collectionId);
    }
    if (message.oracle !== "") {
      writer.uint32(26).string(message.oracle);
    }
    if (message.agentDid !== "") {
      writer.uint32(34).string(message.agentDid);
    }
    if (message.agentAddress !== "") {
      writer.uint32(42).string(message.agentAddress);
    }
    if (message.status !== 0) {
      writer.uint32(48).int32(message.status);
    }
    if (message.reason !== 0) {
      writer.uint32(56).uint32(message.reason);
    }
    if (message.verificationProof !== "") {
      writer.uint32(66).string(message.verificationProof);
    }
    if (message.evaluationDate !== undefined) {
      _timestamp.Timestamp.encode(message.evaluationDate, writer.uint32(74).fork()).ldelim();
    }
    var _iterator0 = _createForOfIteratorHelper(message.amount),
      _step0;
    try {
      for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
        var v = _step0.value;
        _coin.Coin.encode(v, writer.uint32(82).fork()).ldelim();
      }
    } catch (err) {
      _iterator0.e(err);
    } finally {
      _iterator0.f();
    }
    var _iterator1 = _createForOfIteratorHelper(message.cw20Payment),
      _step1;
    try {
      for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
        var _v6 = _step1.value;
        CW20Payment.encode(_v6, writer.uint32(90).fork()).ldelim();
      }
    } catch (err) {
      _iterator1.e(err);
    } finally {
      _iterator1.f();
    }
    var _iterator10 = _createForOfIteratorHelper(message.cw1155Payment),
      _step10;
    try {
      for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
        var _v7 = _step10.value;
        CW1155Payment.encode(_v7, writer.uint32(98).fork()).ldelim();
      }
    } catch (err) {
      _iterator10.e(err);
    } finally {
      _iterator10.f();
    }
    var _iterator11 = _createForOfIteratorHelper(message.cw1155IntentPayment),
      _step11;
    try {
      for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
        var _v8 = _step11.value;
        CW1155IntentPayment.encode(_v8, writer.uint32(106).fork()).ldelim();
      }
    } catch (err) {
      _iterator11.e(err);
    } finally {
      _iterator11.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 = createBaseEvaluation();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.claimId = reader.string();
          break;
        case 2:
          message.collectionId = reader.string();
          break;
        case 3:
          message.oracle = reader.string();
          break;
        case 4:
          message.agentDid = reader.string();
          break;
        case 5:
          message.agentAddress = reader.string();
          break;
        case 6:
          message.status = reader.int32();
          break;
        case 7:
          message.reason = reader.uint32();
          break;
        case 8:
          message.verificationProof = reader.string();
          break;
        case 9:
          message.evaluationDate = _timestamp.Timestamp.decode(reader, reader.uint32());
          break;
        case 10:
          message.amount.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 11:
          message.cw20Payment.push(CW20Payment.decode(reader, reader.uint32()));
          break;
        case 12:
          message.cw1155Payment.push(CW1155Payment.decode(reader, reader.uint32()));
          break;
        case 13:
          message.cw1155IntentPayment.push(CW1155IntentPayment.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      claimId: (0, _helpers.isSet)(object.claimId) ? String(object.claimId) : "",
      collectionId: (0, _helpers.isSet)(object.collectionId) ? String(object.collectionId) : "",
      oracle: (0, _helpers.isSet)(object.oracle) ? String(object.oracle) : "",
      agentDid: (0, _helpers.isSet)(object.agentDid) ? String(object.agentDid) : "",
      agentAddress: (0, _helpers.isSet)(object.agentAddress) ? String(object.agentAddress) : "",
      status: (0, _helpers.isSet)(object.status) ? evaluationStatusFromJSON(object.status) : 0,
      reason: (0, _helpers.isSet)(object.reason) ? Number(object.reason) : 0,
      verificationProof: (0, _helpers.isSet)(object.verificationProof) ? String(object.verificationProof) : "",
      evaluationDate: (0, _helpers.isSet)(object.evaluationDate) ? (0, _helpers.fromJsonTimestamp)(object.evaluationDate) : undefined,
      amount: Array.isArray(object === null || object === void 0 ? void 0 : object.amount) ? object.amount.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      cw20Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw20Payment) ? object.cw20Payment.map(function (e) {
        return CW20Payment.fromJSON(e);
      }) : [],
      cw1155Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155Payment) ? object.cw1155Payment.map(function (e) {
        return CW1155Payment.fromJSON(e);
      }) : [],
      cw1155IntentPayment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155IntentPayment) ? object.cw1155IntentPayment.map(function (e) {
        return CW1155IntentPayment.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.claimId !== undefined && (obj.claimId = message.claimId);
    message.collectionId !== undefined && (obj.collectionId = message.collectionId);
    message.oracle !== undefined && (obj.oracle = message.oracle);
    message.agentDid !== undefined && (obj.agentDid = message.agentDid);
    message.agentAddress !== undefined && (obj.agentAddress = message.agentAddress);
    message.status !== undefined && (obj.status = evaluationStatusToJSON(message.status));
    message.reason !== undefined && (obj.reason = Math.round(message.reason));
    message.verificationProof !== undefined && (obj.verificationProof = message.verificationProof);
    message.evaluationDate !== undefined && (obj.evaluationDate = (0, _helpers.fromTimestamp)(message.evaluationDate).toISOString());
    if (message.amount) {
      obj.amount = message.amount.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.amount = [];
    }
    if (message.cw20Payment) {
      obj.cw20Payment = message.cw20Payment.map(function (e) {
        return e ? CW20Payment.toJSON(e) : undefined;
      });
    } else {
      obj.cw20Payment = [];
    }
    if (message.cw1155Payment) {
      obj.cw1155Payment = message.cw1155Payment.map(function (e) {
        return e ? CW1155Payment.toJSON(e) : undefined;
      });
    } else {
      obj.cw1155Payment = [];
    }
    if (message.cw1155IntentPayment) {
      obj.cw1155IntentPayment = message.cw1155IntentPayment.map(function (e) {
        return e ? CW1155IntentPayment.toJSON(e) : undefined;
      });
    } else {
      obj.cw1155IntentPayment = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$claimId2, _object$collectionId2, _object$oracle, _object$agentDid2, _object$agentAddress2, _object$status, _object$reason, _object$verificationP, _object$amount4, _object$cw20Payment3, _object$cw1155Payment3, _object$cw1155IntentP2;
    var message = createBaseEvaluation();
    message.claimId = (_object$claimId2 = object.claimId) !== null && _object$claimId2 !== void 0 ? _object$claimId2 : "";
    message.collectionId = (_object$collectionId2 = object.collectionId) !== null && _object$collectionId2 !== void 0 ? _object$collectionId2 : "";
    message.oracle = (_object$oracle = object.oracle) !== null && _object$oracle !== void 0 ? _object$oracle : "";
    message.agentDid = (_object$agentDid2 = object.agentDid) !== null && _object$agentDid2 !== void 0 ? _object$agentDid2 : "";
    message.agentAddress = (_object$agentAddress2 = object.agentAddress) !== null && _object$agentAddress2 !== void 0 ? _object$agentAddress2 : "";
    message.status = (_object$status = object.status) !== null && _object$status !== void 0 ? _object$status : 0;
    message.reason = (_object$reason = object.reason) !== null && _object$reason !== void 0 ? _object$reason : 0;
    message.verificationProof = (_object$verificationP = object.verificationProof) !== null && _object$verificationP !== void 0 ? _object$verificationP : "";
    message.evaluationDate = object.evaluationDate !== undefined && object.evaluationDate !== null ? _timestamp.Timestamp.fromPartial(object.evaluationDate) : undefined;
    message.amount = ((_object$amount4 = object.amount) === null || _object$amount4 === void 0 ? void 0 : _object$amount4.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.cw20Payment = ((_object$cw20Payment3 = object.cw20Payment) === null || _object$cw20Payment3 === void 0 ? void 0 : _object$cw20Payment3.map(function (e) {
      return CW20Payment.fromPartial(e);
    })) || [];
    message.cw1155Payment = ((_object$cw1155Payment3 = object.cw1155Payment) === null || _object$cw1155Payment3 === void 0 ? void 0 : _object$cw1155Payment3.map(function (e) {
      return CW1155Payment.fromPartial(e);
    })) || [];
    message.cw1155IntentPayment = ((_object$cw1155IntentP2 = object.cw1155IntentPayment) === null || _object$cw1155IntentP2 === void 0 ? void 0 : _object$cw1155IntentP2.map(function (e) {
      return CW1155IntentPayment.fromPartial(e);
    })) || [];
    return message;
  }
};
function createBaseDispute() {
  return {
    subjectId: "",
    type: 0,
    data: undefined
  };
}
var Dispute = exports.Dispute = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.subjectId !== "") {
      writer.uint32(10).string(message.subjectId);
    }
    if (message.type !== 0) {
      writer.uint32(16).int32(message.type);
    }
    if (message.data !== undefined) {
      DisputeData.encode(message.data, writer.uint32(26).fork()).ldelim();
    }
    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 = createBaseDispute();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.subjectId = reader.string();
          break;
        case 2:
          message.type = reader.int32();
          break;
        case 3:
          message.data = DisputeData.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      subjectId: (0, _helpers.isSet)(object.subjectId) ? String(object.subjectId) : "",
      type: (0, _helpers.isSet)(object.type) ? Number(object.type) : 0,
      data: (0, _helpers.isSet)(object.data) ? DisputeData.fromJSON(object.data) : undefined
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.subjectId !== undefined && (obj.subjectId = message.subjectId);
    message.type !== undefined && (obj.type = Math.round(message.type));
    message.data !== undefined && (obj.data = message.data ? DisputeData.toJSON(message.data) : undefined);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$subjectId, _object$type;
    var message = createBaseDispute();
    message.subjectId = (_object$subjectId = object.subjectId) !== null && _object$subjectId !== void 0 ? _object$subjectId : "";
    message.type = (_object$type = object.type) !== null && _object$type !== void 0 ? _object$type : 0;
    message.data = object.data !== undefined && object.data !== null ? DisputeData.fromPartial(object.data) : undefined;
    return message;
  }
};
function createBaseDisputeData() {
  return {
    uri: "",
    type: "",
    proof: "",
    encrypted: false
  };
}
var DisputeData = exports.DisputeData = {
  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.type !== "") {
      writer.uint32(18).string(message.type);
    }
    if (message.proof !== "") {
      writer.uint32(26).string(message.proof);
    }
    if (message.encrypted === true) {
      writer.uint32(32).bool(message.encrypted);
    }
    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 = createBaseDisputeData();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.uri = reader.string();
          break;
        case 2:
          message.type = reader.string();
          break;
        case 3:
          message.proof = reader.string();
          break;
        case 4:
          message.encrypted = reader.bool();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      uri: (0, _helpers.isSet)(object.uri) ? String(object.uri) : "",
      type: (0, _helpers.isSet)(object.type) ? String(object.type) : "",
      proof: (0, _helpers.isSet)(object.proof) ? String(object.proof) : "",
      encrypted: (0, _helpers.isSet)(object.encrypted) ? Boolean(object.encrypted) : false
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.uri !== undefined && (obj.uri = message.uri);
    message.type !== undefined && (obj.type = message.type);
    message.proof !== undefined && (obj.proof = message.proof);
    message.encrypted !== undefined && (obj.encrypted = message.encrypted);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$uri, _object$type2, _object$proof, _object$encrypted;
    var message = createBaseDisputeData();
    message.uri = (_object$uri = object.uri) !== null && _object$uri !== void 0 ? _object$uri : "";
    message.type = (_object$type2 = object.type) !== null && _object$type2 !== void 0 ? _object$type2 : "";
    message.proof = (_object$proof = object.proof) !== null && _object$proof !== void 0 ? _object$proof : "";
    message.encrypted = (_object$encrypted = object.encrypted) !== null && _object$encrypted !== void 0 ? _object$encrypted : false;
    return message;
  }
};
function createBaseIntent() {
  return {
    id: "",
    agentDid: "",
    agentAddress: "",
    collectionId: "",
    claimId: "",
    createdAt: undefined,
    expireAt: undefined,
    status: 0,
    amount: [],
    cw20Payment: [],
    fromAddress: "",
    escrowAddress: "",
    cw1155Payment: [],
    cw1155IntentPayment: []
  };
}
var Intent = exports.Intent = {
  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.agentDid !== "") {
      writer.uint32(18).string(message.agentDid);
    }
    if (message.agentAddress !== "") {
      writer.uint32(26).string(message.agentAddress);
    }
    if (message.collectionId !== "") {
      writer.uint32(34).string(message.collectionId);
    }
    if (message.claimId !== "") {
      writer.uint32(42).string(message.claimId);
    }
    if (message.createdAt !== undefined) {
      _timestamp.Timestamp.encode(message.createdAt, writer.uint32(50).fork()).ldelim();
    }
    if (message.expireAt !== undefined) {
      _timestamp.Timestamp.encode(message.expireAt, writer.uint32(58).fork()).ldelim();
    }
    if (message.status !== 0) {
      writer.uint32(64).int32(message.status);
    }
    var _iterator12 = _createForOfIteratorHelper(message.amount),
      _step12;
    try {
      for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
        var v = _step12.value;
        _coin.Coin.encode(v, writer.uint32(74).fork()).ldelim();
      }
    } catch (err) {
      _iterator12.e(err);
    } finally {
      _iterator12.f();
    }
    var _iterator13 = _createForOfIteratorHelper(message.cw20Payment),
      _step13;
    try {
      for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
        var _v9 = _step13.value;
        CW20Payment.encode(_v9, writer.uint32(82).fork()).ldelim();
      }
    } catch (err) {
      _iterator13.e(err);
    } finally {
      _iterator13.f();
    }
    if (message.fromAddress !== "") {
      writer.uint32(90).string(message.fromAddress);
    }
    if (message.escrowAddress !== "") {
      writer.uint32(98).string(message.escrowAddress);
    }
    var _iterator14 = _createForOfIteratorHelper(message.cw1155Payment),
      _step14;
    try {
      for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
        var _v0 = _step14.value;
        CW1155Payment.encode(_v0, writer.uint32(106).fork()).ldelim();
      }
    } catch (err) {
      _iterator14.e(err);
    } finally {
      _iterator14.f();
    }
    var _iterator15 = _createForOfIteratorHelper(message.cw1155IntentPayment),
      _step15;
    try {
      for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
        var _v1 = _step15.value;
        CW1155IntentPayment.encode(_v1, writer.uint32(114).fork()).ldelim();
      }
    } catch (err) {
      _iterator15.e(err);
    } finally {
      _iterator15.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 = createBaseIntent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.agentDid = reader.string();
          break;
        case 3:
          message.agentAddress = reader.string();
          break;
        case 4:
          message.collectionId = reader.string();
          break;
        case 5:
          message.claimId = reader.string();
          break;
        case 6:
          message.createdAt = _timestamp.Timestamp.decode(reader, reader.uint32());
          break;
        case 7:
          message.expireAt = _timestamp.Timestamp.decode(reader, reader.uint32());
          break;
        case 8:
          message.status = reader.int32();
          break;
        case 9:
          message.amount.push(_coin.Coin.decode(reader, reader.uint32()));
          break;
        case 10:
          message.cw20Payment.push(CW20Payment.decode(reader, reader.uint32()));
          break;
        case 11:
          message.fromAddress = reader.string();
          break;
        case 12:
          message.escrowAddress = reader.string();
          break;
        case 13:
          message.cw1155Payment.push(CW1155Payment.decode(reader, reader.uint32()));
          break;
        case 14:
          message.cw1155IntentPayment.push(CW1155IntentPayment.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) : "",
      agentDid: (0, _helpers.isSet)(object.agentDid) ? String(object.agentDid) : "",
      agentAddress: (0, _helpers.isSet)(object.agentAddress) ? String(object.agentAddress) : "",
      collectionId: (0, _helpers.isSet)(object.collectionId) ? String(object.collectionId) : "",
      claimId: (0, _helpers.isSet)(object.claimId) ? String(object.claimId) : "",
      createdAt: (0, _helpers.isSet)(object.createdAt) ? (0, _helpers.fromJsonTimestamp)(object.createdAt) : undefined,
      expireAt: (0, _helpers.isSet)(object.expireAt) ? (0, _helpers.fromJsonTimestamp)(object.expireAt) : undefined,
      status: (0, _helpers.isSet)(object.status) ? intentStatusFromJSON(object.status) : 0,
      amount: Array.isArray(object === null || object === void 0 ? void 0 : object.amount) ? object.amount.map(function (e) {
        return _coin.Coin.fromJSON(e);
      }) : [],
      cw20Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw20Payment) ? object.cw20Payment.map(function (e) {
        return CW20Payment.fromJSON(e);
      }) : [],
      fromAddress: (0, _helpers.isSet)(object.fromAddress) ? String(object.fromAddress) : "",
      escrowAddress: (0, _helpers.isSet)(object.escrowAddress) ? String(object.escrowAddress) : "",
      cw1155Payment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155Payment) ? object.cw1155Payment.map(function (e) {
        return CW1155Payment.fromJSON(e);
      }) : [],
      cw1155IntentPayment: Array.isArray(object === null || object === void 0 ? void 0 : object.cw1155IntentPayment) ? object.cw1155IntentPayment.map(function (e) {
        return CW1155IntentPayment.fromJSON(e);
      }) : []
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.agentDid !== undefined && (obj.agentDid = message.agentDid);
    message.agentAddress !== undefined && (obj.agentAddress = message.agentAddress);
    message.collectionId !== undefined && (obj.collectionId = message.collectionId);
    message.claimId !== undefined && (obj.claimId = message.claimId);
    message.createdAt !== undefined && (obj.createdAt = (0, _helpers.fromTimestamp)(message.createdAt).toISOString());
    message.expireAt !== undefined && (obj.expireAt = (0, _helpers.fromTimestamp)(message.expireAt).toISOString());
    message.status !== undefined && (obj.status = intentStatusToJSON(message.status));
    if (message.amount) {
      obj.amount = message.amount.map(function (e) {
        return e ? _coin.Coin.toJSON(e) : undefined;
      });
    } else {
      obj.amount = [];
    }
    if (message.cw20Payment) {
      obj.cw20Payment = message.cw20Payment.map(function (e) {
        return e ? CW20Payment.toJSON(e) : undefined;
      });
    } else {
      obj.cw20Payment = [];
    }
    message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress);
    message.escrowAddress !== undefined && (obj.escrowAddress = message.escrowAddress);
    if (message.cw1155Payment) {
      obj.cw1155Payment = message.cw1155Payment.map(function (e) {
        return e ? CW1155Payment.toJSON(e) : undefined;
      });
    } else {
      obj.cw1155Payment = [];
    }
    if (message.cw1155IntentPayment) {
      obj.cw1155IntentPayment = message.cw1155IntentPayment.map(function (e) {
        return e ? CW1155IntentPayment.toJSON(e) : undefined;
      });
    } else {
      obj.cw1155IntentPayment = [];
    }
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$id2, _object$agentDid3, _object$agentAddress3, _object$collectionId3, _object$claimId3, _object$status2, _object$amount5, _object$cw20Payment4, _object$fromAddress, _object$escrowAddress, _object$cw1155Payment4, _object$cw1155IntentP3;
    var message = createBaseIntent();
    message.id = (_object$id2 = object.id) !== null && _object$id2 !== void 0 ? _object$id2 : "";
    message.agentDid = (_object$agentDid3 = object.agentDid) !== null && _object$agentDid3 !== void 0 ? _object$agentDid3 : "";
    message.agentAddress = (_object$agentAddress3 = object.agentAddress) !== null && _object$agentAddress3 !== void 0 ? _object$agentAddress3 : "";
    message.collectionId = (_object$collectionId3 = object.collectionId) !== null && _object$collectionId3 !== void 0 ? _object$collectionId3 : "";
    message.claimId = (_object$claimId3 = object.claimId) !== null && _object$claimId3 !== void 0 ? _object$claimId3 : "";
    message.createdAt = object.createdAt !== undefined && object.createdAt !== null ? _timestamp.Timestamp.fromPartial(object.createdAt) : undefined;
    message.expireAt = object.expireAt !== undefined && object.expireAt !== null ? _timestamp.Timestamp.fromPartial(object.expireAt) : undefined;
    message.status = (_object$status2 = object.status) !== null && _object$status2 !== void 0 ? _object$status2 : 0;
    message.amount = ((_object$amount5 = object.amount) === null || _object$amount5 === void 0 ? void 0 : _object$amount5.map(function (e) {
      return _coin.Coin.fromPartial(e);
    })) || [];
    message.cw20Payment = ((_object$cw20Payment4 = object.cw20Payment) === null || _object$cw20Payment4 === void 0 ? void 0 : _object$cw20Payment4.map(function (e) {
      return CW20Payment.fromPartial(e);
    })) || [];
    message.fromAddress = (_object$fromAddress = object.fromAddress) !== null && _object$fromAddress !== void 0 ? _object$fromAddress : "";
    message.escrowAddress = (_object$escrowAddress = object.escrowAddress) !== null && _object$escrowAddress !== void 0 ? _object$escrowAddress : "";
    message.cw1155Payment = ((_object$cw1155Payment4 = object.cw1155Payment) === null || _object$cw1155Payment4 === void 0 ? void 0 : _object$cw1155Payment4.map(function (e) {
      return CW1155Payment.fromPartial(e);
    })) || [];
    message.cw1155IntentPayment = ((_object$cw1155IntentP3 = object.cw1155IntentPayment) === null || _object$cw1155IntentP3 === void 0 ? void 0 : _object$cw1155IntentP3.map(function (e) {
      return CW1155IntentPayment.fromPartial(e);
    })) || [];
    return message;
  }
};