@story-protocol/core-sdk 1.0.0-rc.19 → 1.0.0-rc.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,7 +25,7 @@ function _interopNamespace(e) {
25
25
 
26
26
  var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
27
27
 
28
- function toPrimitive(t, r) {
28
+ function _toPrimitive(t, r) {
29
29
  if ("object" != typeof t || !t) return t;
30
30
  var e = t[Symbol.toPrimitive];
31
31
  if (void 0 !== e) {
@@ -36,24 +36,18 @@ function toPrimitive(t, r) {
36
36
  return ("string" === r ? String : Number)(t);
37
37
  }
38
38
 
39
- function toPropertyKey(t) {
40
- var i = toPrimitive(t, "string");
39
+ function _toPropertyKey(t) {
40
+ var i = _toPrimitive(t, "string");
41
41
  return "symbol" == typeof i ? i : i + "";
42
42
  }
43
43
 
44
- function _defineProperty(obj, key, value) {
45
- key = toPropertyKey(key);
46
- if (key in obj) {
47
- Object.defineProperty(obj, key, {
48
- value: value,
49
- enumerable: true,
50
- configurable: true,
51
- writable: true
52
- });
53
- } else {
54
- obj[key] = value;
55
- }
56
- return obj;
44
+ function _defineProperty(e, r, t) {
45
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
46
+ value: t,
47
+ enumerable: !0,
48
+ configurable: !0,
49
+ writable: !0
50
+ }) : e[r] = t, e;
57
51
  }
58
52
 
59
53
  function ownKeys(e, r) {
@@ -78,92 +72,80 @@ function _objectSpread2(e) {
78
72
  return e;
79
73
  }
80
74
 
81
- function _classCallCheck(instance, Constructor) {
82
- if (!(instance instanceof Constructor)) {
83
- throw new TypeError("Cannot call a class as a function");
84
- }
75
+ function _classCallCheck(a, n) {
76
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
85
77
  }
86
78
 
87
- function _defineProperties(target, props) {
88
- for (var i = 0; i < props.length; i++) {
89
- var descriptor = props[i];
90
- descriptor.enumerable = descriptor.enumerable || false;
91
- descriptor.configurable = true;
92
- if ("value" in descriptor) descriptor.writable = true;
93
- Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
79
+ function _defineProperties(e, r) {
80
+ for (var t = 0; t < r.length; t++) {
81
+ var o = r[t];
82
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
94
83
  }
95
84
  }
96
- function _createClass(Constructor, protoProps, staticProps) {
97
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
98
- if (staticProps) _defineProperties(Constructor, staticProps);
99
- Object.defineProperty(Constructor, "prototype", {
100
- writable: false
101
- });
102
- return Constructor;
85
+ function _createClass(e, r, t) {
86
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
87
+ writable: !1
88
+ }), e;
103
89
  }
104
90
 
105
- function _arrayLikeToArray(arr, len) {
106
- if (len == null || len > arr.length) len = arr.length;
107
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
108
- return arr2;
91
+ function _arrayLikeToArray(r, a) {
92
+ (null == a || a > r.length) && (a = r.length);
93
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
94
+ return n;
109
95
  }
110
96
 
111
- function _unsupportedIterableToArray(o, minLen) {
112
- if (!o) return;
113
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
114
- var n = Object.prototype.toString.call(o).slice(8, -1);
115
- if (n === "Object" && o.constructor) n = o.constructor.name;
116
- if (n === "Map" || n === "Set") return Array.from(o);
117
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
97
+ function _unsupportedIterableToArray(r, a) {
98
+ if (r) {
99
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
100
+ var t = {}.toString.call(r).slice(8, -1);
101
+ 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;
102
+ }
118
103
  }
119
104
 
120
- function _createForOfIteratorHelper(o, allowArrayLike) {
121
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
122
- if (!it) {
123
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
124
- if (it) o = it;
125
- var i = 0;
126
- var F = function () {};
105
+ function _createForOfIteratorHelper(r, e) {
106
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
107
+ if (!t) {
108
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
109
+ t && (r = t);
110
+ var n = 0,
111
+ F = function () {};
127
112
  return {
128
113
  s: F,
129
114
  n: function () {
130
- if (i >= o.length) return {
131
- done: true
132
- };
133
- return {
134
- done: false,
135
- value: o[i++]
115
+ return n >= r.length ? {
116
+ done: !0
117
+ } : {
118
+ done: !1,
119
+ value: r[n++]
136
120
  };
137
121
  },
138
- e: function (e) {
139
- throw e;
122
+ e: function (r) {
123
+ throw r;
140
124
  },
141
125
  f: F
142
126
  };
143
127
  }
144
128
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
145
129
  }
146
- var normalCompletion = true,
147
- didErr = false,
148
- err;
130
+ var o,
131
+ a = !0,
132
+ u = !1;
149
133
  return {
150
134
  s: function () {
151
- it = it.call(o);
135
+ t = t.call(r);
152
136
  },
153
137
  n: function () {
154
- var step = it.next();
155
- normalCompletion = step.done;
156
- return step;
138
+ var r = t.next();
139
+ return a = r.done, r;
157
140
  },
158
- e: function (e) {
159
- didErr = true;
160
- err = e;
141
+ e: function (r) {
142
+ u = !0, o = r;
161
143
  },
162
144
  f: function () {
163
145
  try {
164
- if (!normalCompletion && it.return != null) it.return();
146
+ a || null == t.return || t.return();
165
147
  } finally {
166
- if (didErr) throw err;
148
+ if (u) throw o;
167
149
  }
168
150
  }
169
151
  };
@@ -471,37 +453,54 @@ function _regeneratorRuntime() {
471
453
  }, e;
472
454
  }
473
455
 
474
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
456
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
475
457
  try {
476
- var info = gen[key](arg);
477
- var value = info.value;
478
- } catch (error) {
479
- reject(error);
480
- return;
481
- }
482
- if (info.done) {
483
- resolve(value);
484
- } else {
485
- Promise.resolve(value).then(_next, _throw);
458
+ var i = n[a](c),
459
+ u = i.value;
460
+ } catch (n) {
461
+ return void e(n);
486
462
  }
463
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
487
464
  }
488
- function _asyncToGenerator(fn) {
465
+ function _asyncToGenerator(n) {
489
466
  return function () {
490
- var self = this,
491
- args = arguments;
492
- return new Promise(function (resolve, reject) {
493
- var gen = fn.apply(self, args);
494
- function _next(value) {
495
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
467
+ var t = this,
468
+ e = arguments;
469
+ return new Promise(function (r, o) {
470
+ var a = n.apply(t, e);
471
+ function _next(n) {
472
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
496
473
  }
497
- function _throw(err) {
498
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
474
+ function _throw(n) {
475
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
499
476
  }
500
- _next(undefined);
477
+ _next(void 0);
501
478
  });
502
479
  };
503
480
  }
504
481
 
482
+ function _objectWithoutPropertiesLoose(r, e) {
483
+ if (null == r) return {};
484
+ var t = {};
485
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
486
+ if (e.includes(n)) continue;
487
+ t[n] = r[n];
488
+ }
489
+ return t;
490
+ }
491
+
492
+ function _objectWithoutProperties(e, t) {
493
+ if (null == e) return {};
494
+ var o,
495
+ r,
496
+ i = _objectWithoutPropertiesLoose(e, t);
497
+ if (Object.getOwnPropertySymbols) {
498
+ var s = Object.getOwnPropertySymbols(e);
499
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
500
+ }
501
+ return i;
502
+ }
503
+
505
504
  var iliad = viem.defineChain({
506
505
  id: 1513,
507
506
  name: "iliad",
@@ -559,11 +558,10 @@ function handleError(error, msg) {
559
558
  throw new Error("".concat(msg, ": Unknown error type"));
560
559
  }
561
560
 
562
- function _getPrototypeOf(o) {
563
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
564
- return o.__proto__ || Object.getPrototypeOf(o);
565
- };
566
- return _getPrototypeOf(o);
561
+ function _getPrototypeOf(t) {
562
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
563
+ return t.__proto__ || Object.getPrototypeOf(t);
564
+ }, _getPrototypeOf(t);
567
565
  }
568
566
 
569
567
  function _isNativeReflectConstruct() {
@@ -575,49 +573,38 @@ function _isNativeReflectConstruct() {
575
573
  })();
576
574
  }
577
575
 
578
- function _assertThisInitialized(self) {
579
- if (self === void 0) {
580
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
581
- }
582
- return self;
576
+ function _assertThisInitialized(e) {
577
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
578
+ return e;
583
579
  }
584
580
 
585
- function _possibleConstructorReturn(self, call) {
586
- if (call && (typeof call === "object" || typeof call === "function")) {
587
- return call;
588
- } else if (call !== void 0) {
589
- throw new TypeError("Derived constructors may only return object or undefined");
590
- }
591
- return _assertThisInitialized(self);
581
+ function _possibleConstructorReturn(t, e) {
582
+ if (e && ("object" == typeof e || "function" == typeof e)) return e;
583
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
584
+ return _assertThisInitialized(t);
592
585
  }
593
586
 
594
587
  function _callSuper(t, o, e) {
595
588
  return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
596
589
  }
597
590
 
598
- function _setPrototypeOf(o, p) {
599
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
600
- o.__proto__ = p;
601
- return o;
602
- };
603
- return _setPrototypeOf(o, p);
591
+ function _setPrototypeOf(t, e) {
592
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
593
+ return t.__proto__ = e, t;
594
+ }, _setPrototypeOf(t, e);
604
595
  }
605
596
 
606
- function _inherits(subClass, superClass) {
607
- if (typeof superClass !== "function" && superClass !== null) {
608
- throw new TypeError("Super expression must either be null or a function");
609
- }
610
- subClass.prototype = Object.create(superClass && superClass.prototype, {
597
+ function _inherits(t, e) {
598
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
599
+ t.prototype = Object.create(e && e.prototype, {
611
600
  constructor: {
612
- value: subClass,
613
- writable: true,
614
- configurable: true
601
+ value: t,
602
+ writable: !0,
603
+ configurable: !0
615
604
  }
616
- });
617
- Object.defineProperty(subClass, "prototype", {
618
- writable: false
619
- });
620
- if (superClass) _setPrototypeOf(subClass, superClass);
605
+ }), Object.defineProperty(t, "prototype", {
606
+ writable: !1
607
+ }), e && _setPrototypeOf(t, e);
621
608
  }
622
609
 
623
610
  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -18490,6 +18477,7 @@ var AccessPermission = /*#__PURE__*/function (AccessPermission) {
18490
18477
  return AccessPermission;
18491
18478
  }({});
18492
18479
 
18480
+ var _excluded = ["title", "description", "ipType", "relationships", "createdAt", "watermarkImg", "creators", "media", "attributes", "app", "tags", "robotTerms"];
18493
18481
  var IPAssetClient = /*#__PURE__*/function () {
18494
18482
  function IPAssetClient(rpcClient, wallet, chainId) {
18495
18483
  _classCallCheck(this, IPAssetClient);
@@ -18508,21 +18496,141 @@ var IPAssetClient = /*#__PURE__*/function () {
18508
18496
  }
18509
18497
 
18510
18498
  /**
18511
- * Registers an NFT as IP, creating a corresponding IP record.
18512
- * @param request - The request object that contains all data needed to register IP.
18513
- * @param request.nftContract The address of the NFT.
18514
- * @param request.tokenId The token identifier of the NFT.
18515
- * @param request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
18516
- * @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
18517
- * @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
18518
- * @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
18519
- * @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
18520
- * @param request.deadline [Optional] The deadline for the signature in milliseconds, default is 1000ms.
18521
- * @param request.txOptions [Optional] The transaction options.
18522
- * @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true.
18523
- * @emits IPRegistered (ipId, chainId, tokenContract, tokenId, resolverAddr, metadataProviderAddress, metadata)
18499
+ * Create a new `IpCreator` object with the specified details.
18500
+ * @param params - The parameters required to create the `IpCreator` object.
18501
+ * @param params.name The name of the creator.
18502
+ * @param params.address The wallet address of the creator.
18503
+ * @param params.description [Optional] A description of the creator.
18504
+ * @param params.image [Optional] The URL or path to an image representing the creator.
18505
+ * @param params.socialMedia [Optional] An array of social media profiles associated with the creator.
18506
+ * @param params.socialMedia[].platform The name of the social media platform.
18507
+ * @param params.socialMedia[].url The URL to the creator's profile on the platform.
18508
+ * @param params.contributionPercent The percentage of contribution by the creator, must add up to 100.
18509
+ * @param params.role [Optional] The role of the creator in relation to the IP.
18510
+ * @returns An `IpCreator` object containing the provided details.
18524
18511
  */
18525
18512
  return _createClass(IPAssetClient, [{
18513
+ key: "generateCreatorMetadata",
18514
+ value: function generateCreatorMetadata(_ref) {
18515
+ var name = _ref.name,
18516
+ address = _ref.address,
18517
+ _ref$description = _ref.description,
18518
+ description = _ref$description === void 0 ? "" : _ref$description,
18519
+ _ref$image = _ref.image,
18520
+ image = _ref$image === void 0 ? "" : _ref$image,
18521
+ _ref$socialMedia = _ref.socialMedia,
18522
+ socialMedia = _ref$socialMedia === void 0 ? [] : _ref$socialMedia,
18523
+ contributionPercent = _ref.contributionPercent,
18524
+ _ref$role = _ref.role,
18525
+ role = _ref$role === void 0 ? "" : _ref$role;
18526
+ return {
18527
+ name: name,
18528
+ address: address,
18529
+ description: description,
18530
+ image: image,
18531
+ socialMedia: socialMedia,
18532
+ contributionPercent: contributionPercent,
18533
+ role: role
18534
+ };
18535
+ }
18536
+
18537
+ /**
18538
+ * Create a new `IpMetadata` object with the specified details.
18539
+ * @param params - The parameters required to create the `IpMetadata` object.
18540
+ * @param params.title [Optional] The title of the IP.
18541
+ * @param params.description [Optional] A description of the IP.
18542
+ * @param params.ipType [Optional] The type of the IP asset (e.g., "character", "chapter").
18543
+ * @param params.relationships [Optional] An array of relationships between this IP and its parent IPs.
18544
+ * @param params.relationships[].ipId The ID of the parent IP.
18545
+ * @param params.relationships[].type The type of relationship (e.g., "APPEARS_IN").
18546
+ * @param params.createdAt [Optional] The creation date and time of the IP in ISO 8601 format.
18547
+ * @param params.watermarkImg [Optional] The URL or path to an image used as a watermark for the IP.
18548
+ * @param params.creators [Optional] An array of creators associated with the IP.
18549
+ * @param params.creators[].name The name of the creator.
18550
+ * @param params.creators[].address The address of the creator.
18551
+ * @param params.creators[].description [Optional] A description of the creator.
18552
+ * @param params.creators[].image [Optional] The URL or path to an image representing the creator.
18553
+ * @param params.creators[].socialMedia [Optional] An array of social media profiles for the creator.
18554
+ * @param params.creators[].socialMedia[].platform The social media platform name.
18555
+ * @param params.creators[].socialMedia[].url The URL to the creator's profile.
18556
+ * @param params.creators[].role [Optional] The role of the creator in relation to the IP.
18557
+ * @param params.creators[].contributionPercent The percentage of contribution by the creator.
18558
+ * @param params.media [Optional] An array of media related to the IP.
18559
+ * @param params.media[].name The name of the media.
18560
+ * @param params.media[].url The URL to the media.
18561
+ * @param params.media[].mimeType The MIME type of the media.
18562
+ * @param params.attributes [Optional] An array of key-value pairs providing additional metadata.
18563
+ * @param params.attributes[].key The key for the attribute.
18564
+ * @param params.attributes[].value The value for the attribute, can be a string or number.
18565
+ * @param params.app [Optional] Information about the application associated with the IP.
18566
+ * @param params.app.id The ID of the application.
18567
+ * @param params.app.name The name of the application.
18568
+ * @param params.app.website The website URL of the application.
18569
+ * @param params.tags [Optional] An array of tags associated with the IP.
18570
+ * @param params.robotTerms [Optional] Robot terms for the IP, specifying access rules.
18571
+ * @param params.robotTerms.userAgent The user agent for which the rules apply.
18572
+ * @param params.robotTerms.allow The rules allowing access.
18573
+ * @param params.additionalProperties [Optional] Any additional key-value pairs to include in the metadata.
18574
+ * @returns An `IpMetadata` object containing the provided details and any additional properties.
18575
+ */
18576
+ }, {
18577
+ key: "generateIpMetadata",
18578
+ value: function generateIpMetadata(_ref2) {
18579
+ var _ref2$title = _ref2.title,
18580
+ title = _ref2$title === void 0 ? "" : _ref2$title,
18581
+ _ref2$description = _ref2.description,
18582
+ description = _ref2$description === void 0 ? "" : _ref2$description,
18583
+ _ref2$ipType = _ref2.ipType,
18584
+ ipType = _ref2$ipType === void 0 ? "" : _ref2$ipType,
18585
+ _ref2$relationships = _ref2.relationships,
18586
+ relationships = _ref2$relationships === void 0 ? [] : _ref2$relationships,
18587
+ _ref2$createdAt = _ref2.createdAt,
18588
+ createdAt = _ref2$createdAt === void 0 ? "" : _ref2$createdAt,
18589
+ _ref2$watermarkImg = _ref2.watermarkImg,
18590
+ watermarkImg = _ref2$watermarkImg === void 0 ? "" : _ref2$watermarkImg,
18591
+ _ref2$creators = _ref2.creators,
18592
+ creators = _ref2$creators === void 0 ? [] : _ref2$creators,
18593
+ _ref2$media = _ref2.media,
18594
+ media = _ref2$media === void 0 ? [] : _ref2$media,
18595
+ _ref2$attributes = _ref2.attributes,
18596
+ attributes = _ref2$attributes === void 0 ? [] : _ref2$attributes,
18597
+ app = _ref2.app,
18598
+ _ref2$tags = _ref2.tags,
18599
+ tags = _ref2$tags === void 0 ? [] : _ref2$tags,
18600
+ robotTerms = _ref2.robotTerms,
18601
+ additionalProperties = _objectWithoutProperties(_ref2, _excluded);
18602
+ return _objectSpread2({
18603
+ title: title,
18604
+ description: description,
18605
+ ipType: ipType,
18606
+ relationships: relationships,
18607
+ createdAt: createdAt,
18608
+ watermarkImg: watermarkImg,
18609
+ creators: creators,
18610
+ media: media,
18611
+ attributes: attributes,
18612
+ app: app,
18613
+ tags: tags,
18614
+ robotTerms: robotTerms
18615
+ }, additionalProperties);
18616
+ }
18617
+
18618
+ /**
18619
+ * Registers an NFT as IP, creating a corresponding IP record.
18620
+ * @param request - The request object that contains all data needed to register IP.
18621
+ * @param request.nftContract The address of the NFT.
18622
+ * @param request.tokenId The token identifier of the NFT.
18623
+ * @param request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
18624
+ * @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
18625
+ * @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
18626
+ * @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
18627
+ * @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
18628
+ * @param request.deadline [Optional] The deadline for the signature in milliseconds, default is 1000ms.
18629
+ * @param request.txOptions [Optional] The transaction options.
18630
+ * @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true.
18631
+ * @emits IPRegistered (ipId, chainId, tokenContract, tokenId, resolverAddr, metadataProviderAddress, metadata)
18632
+ */
18633
+ }, {
18526
18634
  key: "register",
18527
18635
  value: (function () {
18528
18636
  var _register = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
@@ -19004,7 +19112,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19004
19112
  case 11:
19005
19113
  txHash = _context4.sent;
19006
19114
  if (!((_request$txOptions8 = request.txOptions) !== null && _request$txOptions8 !== void 0 && _request$txOptions8.waitForTransaction)) {
19007
- _context4.next = 19;
19115
+ _context4.next = 21;
19008
19116
  break;
19009
19117
  }
19010
19118
  _context4.next = 15;
@@ -19014,29 +19122,32 @@ var IPAssetClient = /*#__PURE__*/function () {
19014
19122
  case 15:
19015
19123
  txReceipt = _context4.sent;
19016
19124
  iPRegisteredLog = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt)[0];
19017
- licenseTermsId = this.licensingModuleClient.parseTxLicenseTermsAttachedEvent(txReceipt)[0].licenseTermsId;
19125
+ _context4.next = 19;
19126
+ return this.getLicenseTermsId(txReceipt);
19127
+ case 19:
19128
+ licenseTermsId = _context4.sent;
19018
19129
  return _context4.abrupt("return", {
19019
19130
  txHash: txHash,
19020
19131
  ipId: iPRegisteredLog.ipId,
19021
19132
  licenseTermsId: licenseTermsId,
19022
19133
  tokenId: iPRegisteredLog.tokenId
19023
19134
  });
19024
- case 19:
19135
+ case 21:
19025
19136
  return _context4.abrupt("return", {
19026
19137
  txHash: txHash
19027
19138
  });
19028
- case 20:
19029
- _context4.next = 25;
19030
- break;
19031
19139
  case 22:
19032
- _context4.prev = 22;
19140
+ _context4.next = 27;
19141
+ break;
19142
+ case 24:
19143
+ _context4.prev = 24;
19033
19144
  _context4.t0 = _context4["catch"](0);
19034
19145
  handleError(_context4.t0, "Failed to mint and register IP and attach PIL terms");
19035
- case 25:
19146
+ case 27:
19036
19147
  case "end":
19037
19148
  return _context4.stop();
19038
19149
  }
19039
- }, _callee4, this, [[0, 22]]);
19150
+ }, _callee4, this, [[0, 24]]);
19040
19151
  }));
19041
19152
  function mintAndRegisterIpAssetWithPilTerms(_x4) {
19042
19153
  return _mintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
@@ -19067,7 +19178,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19067
19178
  key: "registerIpAndAttachPilTerms",
19068
19179
  value: (function () {
19069
19180
  var _registerIpAndAttachPilTerms = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(request) {
19070
- var _request$ipMetadata9, _request$ipMetadata10, _request$ipMetadata11, _request$ipMetadata12, _request$txOptions9, ipIdAddress, isRegistered, licenseTerm, calculatedDeadline, sigAttachSignature, object, sigMetadataSignature, _request$txOptions10, txHash, txReceipt, log;
19181
+ var _request$ipMetadata9, _request$ipMetadata10, _request$ipMetadata11, _request$ipMetadata12, _request$txOptions9, ipIdAddress, isRegistered, licenseTerm, calculatedDeadline, sigAttachSignature, object, sigMetadataSignature, _request$txOptions10, txHash, txReceipt, ipRegisterEvent, licenseTermsId;
19071
19182
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
19072
19183
  while (1) switch (_context5.prev = _context5.next) {
19073
19184
  case 0:
@@ -19181,7 +19292,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19181
19292
  case 28:
19182
19293
  txHash = _context5.sent;
19183
19294
  if (!((_request$txOptions10 = request.txOptions) !== null && _request$txOptions10 !== void 0 && _request$txOptions10.waitForTransaction)) {
19184
- _context5.next = 35;
19295
+ _context5.next = 38;
19185
19296
  break;
19186
19297
  }
19187
19298
  _context5.next = 32;
@@ -19190,28 +19301,32 @@ var IPAssetClient = /*#__PURE__*/function () {
19190
19301
  });
19191
19302
  case 32:
19192
19303
  txReceipt = _context5.sent;
19193
- log = this.licensingModuleClient.parseTxLicenseTermsAttachedEvent(txReceipt)[0];
19304
+ ipRegisterEvent = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt);
19305
+ _context5.next = 36;
19306
+ return this.getLicenseTermsId(txReceipt);
19307
+ case 36:
19308
+ licenseTermsId = _context5.sent;
19194
19309
  return _context5.abrupt("return", {
19195
19310
  txHash: txHash,
19196
- licenseTermsId: log.licenseTermsId,
19197
- ipId: log.ipId
19311
+ licenseTermsId: licenseTermsId,
19312
+ ipId: ipRegisterEvent[0].ipId
19198
19313
  });
19199
- case 35:
19314
+ case 38:
19200
19315
  return _context5.abrupt("return", {
19201
19316
  txHash: txHash
19202
19317
  });
19203
- case 36:
19204
- _context5.next = 41;
19318
+ case 39:
19319
+ _context5.next = 44;
19205
19320
  break;
19206
- case 38:
19207
- _context5.prev = 38;
19321
+ case 41:
19322
+ _context5.prev = 41;
19208
19323
  _context5.t0 = _context5["catch"](0);
19209
19324
  handleError(_context5.t0, "Failed to register IP and attach PIL terms");
19210
- case 41:
19325
+ case 44:
19211
19326
  case "end":
19212
19327
  return _context5.stop();
19213
19328
  }
19214
- }, _callee5, this, [[0, 38]]);
19329
+ }, _callee5, this, [[0, 41]]);
19215
19330
  }));
19216
19331
  function registerIpAndAttachPilTerms(_x5) {
19217
19332
  return _registerIpAndAttachPilTerms.apply(this, arguments);
@@ -19616,6 +19731,38 @@ var IPAssetClient = /*#__PURE__*/function () {
19616
19731
  })]));
19617
19732
  return sigAttachState;
19618
19733
  }
19734
+ }, {
19735
+ key: "getLicenseTermsId",
19736
+ value: function () {
19737
+ var _getLicenseTermsId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(txReceipt) {
19738
+ var licensingModuleLicenseTermsAttachedEvent, licenseTermsId, defaultLicenseTerms;
19739
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
19740
+ while (1) switch (_context10.prev = _context10.next) {
19741
+ case 0:
19742
+ licensingModuleLicenseTermsAttachedEvent = this.licensingModuleClient.parseTxLicenseTermsAttachedEvent(txReceipt);
19743
+ licenseTermsId = licensingModuleLicenseTermsAttachedEvent.length >= 1 && licensingModuleLicenseTermsAttachedEvent[0].licenseTermsId;
19744
+ if (!(licenseTermsId === false)) {
19745
+ _context10.next = 7;
19746
+ break;
19747
+ }
19748
+ _context10.next = 5;
19749
+ return this.licenseRegistryReadOnlyClient.getDefaultLicenseTerms();
19750
+ case 5:
19751
+ defaultLicenseTerms = _context10.sent;
19752
+ licenseTermsId = defaultLicenseTerms.licenseTermsId;
19753
+ case 7:
19754
+ return _context10.abrupt("return", licenseTermsId);
19755
+ case 8:
19756
+ case "end":
19757
+ return _context10.stop();
19758
+ }
19759
+ }, _callee10, this);
19760
+ }));
19761
+ function getLicenseTermsId(_x11) {
19762
+ return _getLicenseTermsId.apply(this, arguments);
19763
+ }
19764
+ return getLicenseTermsId;
19765
+ }()
19619
19766
  }]);
19620
19767
  }();
19621
19768