@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.
@@ -1,7 +1,7 @@
1
1
  import { defineChain, isAddress, checksumAddress, encodeFunctionData, decodeEventLog, zeroAddress, getAddress as getAddress$2, toFunctionSelector, keccak256, encodeAbiParameters, toHex, zeroHash, stringToHex, maxUint32, createPublicClient, createWalletClient } from 'viem';
2
2
  import * as dotenv from 'dotenv';
3
3
 
4
- function toPrimitive(t, r) {
4
+ function _toPrimitive(t, r) {
5
5
  if ("object" != typeof t || !t) return t;
6
6
  var e = t[Symbol.toPrimitive];
7
7
  if (void 0 !== e) {
@@ -12,24 +12,18 @@ function toPrimitive(t, r) {
12
12
  return ("string" === r ? String : Number)(t);
13
13
  }
14
14
 
15
- function toPropertyKey(t) {
16
- var i = toPrimitive(t, "string");
15
+ function _toPropertyKey(t) {
16
+ var i = _toPrimitive(t, "string");
17
17
  return "symbol" == typeof i ? i : i + "";
18
18
  }
19
19
 
20
- function _defineProperty(obj, key, value) {
21
- key = toPropertyKey(key);
22
- if (key in obj) {
23
- Object.defineProperty(obj, key, {
24
- value: value,
25
- enumerable: true,
26
- configurable: true,
27
- writable: true
28
- });
29
- } else {
30
- obj[key] = value;
31
- }
32
- return obj;
20
+ function _defineProperty(e, r, t) {
21
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
22
+ value: t,
23
+ enumerable: !0,
24
+ configurable: !0,
25
+ writable: !0
26
+ }) : e[r] = t, e;
33
27
  }
34
28
 
35
29
  function ownKeys(e, r) {
@@ -54,92 +48,80 @@ function _objectSpread2(e) {
54
48
  return e;
55
49
  }
56
50
 
57
- function _classCallCheck(instance, Constructor) {
58
- if (!(instance instanceof Constructor)) {
59
- throw new TypeError("Cannot call a class as a function");
60
- }
51
+ function _classCallCheck(a, n) {
52
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
61
53
  }
62
54
 
63
- function _defineProperties(target, props) {
64
- for (var i = 0; i < props.length; i++) {
65
- var descriptor = props[i];
66
- descriptor.enumerable = descriptor.enumerable || false;
67
- descriptor.configurable = true;
68
- if ("value" in descriptor) descriptor.writable = true;
69
- Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
55
+ function _defineProperties(e, r) {
56
+ for (var t = 0; t < r.length; t++) {
57
+ var o = r[t];
58
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
70
59
  }
71
60
  }
72
- function _createClass(Constructor, protoProps, staticProps) {
73
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
74
- if (staticProps) _defineProperties(Constructor, staticProps);
75
- Object.defineProperty(Constructor, "prototype", {
76
- writable: false
77
- });
78
- return Constructor;
61
+ function _createClass(e, r, t) {
62
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
63
+ writable: !1
64
+ }), e;
79
65
  }
80
66
 
81
- function _arrayLikeToArray(arr, len) {
82
- if (len == null || len > arr.length) len = arr.length;
83
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
84
- return arr2;
67
+ function _arrayLikeToArray(r, a) {
68
+ (null == a || a > r.length) && (a = r.length);
69
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
70
+ return n;
85
71
  }
86
72
 
87
- function _unsupportedIterableToArray(o, minLen) {
88
- if (!o) return;
89
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
90
- var n = Object.prototype.toString.call(o).slice(8, -1);
91
- if (n === "Object" && o.constructor) n = o.constructor.name;
92
- if (n === "Map" || n === "Set") return Array.from(o);
93
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
73
+ function _unsupportedIterableToArray(r, a) {
74
+ if (r) {
75
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
76
+ var t = {}.toString.call(r).slice(8, -1);
77
+ 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;
78
+ }
94
79
  }
95
80
 
96
- function _createForOfIteratorHelper(o, allowArrayLike) {
97
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
98
- if (!it) {
99
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
100
- if (it) o = it;
101
- var i = 0;
102
- var F = function () {};
81
+ function _createForOfIteratorHelper(r, e) {
82
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
83
+ if (!t) {
84
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
85
+ t && (r = t);
86
+ var n = 0,
87
+ F = function () {};
103
88
  return {
104
89
  s: F,
105
90
  n: function () {
106
- if (i >= o.length) return {
107
- done: true
108
- };
109
- return {
110
- done: false,
111
- value: o[i++]
91
+ return n >= r.length ? {
92
+ done: !0
93
+ } : {
94
+ done: !1,
95
+ value: r[n++]
112
96
  };
113
97
  },
114
- e: function (e) {
115
- throw e;
98
+ e: function (r) {
99
+ throw r;
116
100
  },
117
101
  f: F
118
102
  };
119
103
  }
120
104
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
121
105
  }
122
- var normalCompletion = true,
123
- didErr = false,
124
- err;
106
+ var o,
107
+ a = !0,
108
+ u = !1;
125
109
  return {
126
110
  s: function () {
127
- it = it.call(o);
111
+ t = t.call(r);
128
112
  },
129
113
  n: function () {
130
- var step = it.next();
131
- normalCompletion = step.done;
132
- return step;
114
+ var r = t.next();
115
+ return a = r.done, r;
133
116
  },
134
- e: function (e) {
135
- didErr = true;
136
- err = e;
117
+ e: function (r) {
118
+ u = !0, o = r;
137
119
  },
138
120
  f: function () {
139
121
  try {
140
- if (!normalCompletion && it.return != null) it.return();
122
+ a || null == t.return || t.return();
141
123
  } finally {
142
- if (didErr) throw err;
124
+ if (u) throw o;
143
125
  }
144
126
  }
145
127
  };
@@ -447,37 +429,54 @@ function _regeneratorRuntime() {
447
429
  }, e;
448
430
  }
449
431
 
450
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
432
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
451
433
  try {
452
- var info = gen[key](arg);
453
- var value = info.value;
454
- } catch (error) {
455
- reject(error);
456
- return;
457
- }
458
- if (info.done) {
459
- resolve(value);
460
- } else {
461
- Promise.resolve(value).then(_next, _throw);
434
+ var i = n[a](c),
435
+ u = i.value;
436
+ } catch (n) {
437
+ return void e(n);
462
438
  }
439
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
463
440
  }
464
- function _asyncToGenerator(fn) {
441
+ function _asyncToGenerator(n) {
465
442
  return function () {
466
- var self = this,
467
- args = arguments;
468
- return new Promise(function (resolve, reject) {
469
- var gen = fn.apply(self, args);
470
- function _next(value) {
471
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
443
+ var t = this,
444
+ e = arguments;
445
+ return new Promise(function (r, o) {
446
+ var a = n.apply(t, e);
447
+ function _next(n) {
448
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
472
449
  }
473
- function _throw(err) {
474
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
450
+ function _throw(n) {
451
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
475
452
  }
476
- _next(undefined);
453
+ _next(void 0);
477
454
  });
478
455
  };
479
456
  }
480
457
 
458
+ function _objectWithoutPropertiesLoose(r, e) {
459
+ if (null == r) return {};
460
+ var t = {};
461
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
462
+ if (e.includes(n)) continue;
463
+ t[n] = r[n];
464
+ }
465
+ return t;
466
+ }
467
+
468
+ function _objectWithoutProperties(e, t) {
469
+ if (null == e) return {};
470
+ var o,
471
+ r,
472
+ i = _objectWithoutPropertiesLoose(e, t);
473
+ if (Object.getOwnPropertySymbols) {
474
+ var s = Object.getOwnPropertySymbols(e);
475
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
476
+ }
477
+ return i;
478
+ }
479
+
481
480
  var iliad = defineChain({
482
481
  id: 1513,
483
482
  name: "iliad",
@@ -535,11 +534,10 @@ function handleError(error, msg) {
535
534
  throw new Error("".concat(msg, ": Unknown error type"));
536
535
  }
537
536
 
538
- function _getPrototypeOf(o) {
539
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
540
- return o.__proto__ || Object.getPrototypeOf(o);
541
- };
542
- return _getPrototypeOf(o);
537
+ function _getPrototypeOf(t) {
538
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
539
+ return t.__proto__ || Object.getPrototypeOf(t);
540
+ }, _getPrototypeOf(t);
543
541
  }
544
542
 
545
543
  function _isNativeReflectConstruct() {
@@ -551,49 +549,38 @@ function _isNativeReflectConstruct() {
551
549
  })();
552
550
  }
553
551
 
554
- function _assertThisInitialized(self) {
555
- if (self === void 0) {
556
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
557
- }
558
- return self;
552
+ function _assertThisInitialized(e) {
553
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
554
+ return e;
559
555
  }
560
556
 
561
- function _possibleConstructorReturn(self, call) {
562
- if (call && (typeof call === "object" || typeof call === "function")) {
563
- return call;
564
- } else if (call !== void 0) {
565
- throw new TypeError("Derived constructors may only return object or undefined");
566
- }
567
- return _assertThisInitialized(self);
557
+ function _possibleConstructorReturn(t, e) {
558
+ if (e && ("object" == typeof e || "function" == typeof e)) return e;
559
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
560
+ return _assertThisInitialized(t);
568
561
  }
569
562
 
570
563
  function _callSuper(t, o, e) {
571
564
  return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
572
565
  }
573
566
 
574
- function _setPrototypeOf(o, p) {
575
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
576
- o.__proto__ = p;
577
- return o;
578
- };
579
- return _setPrototypeOf(o, p);
567
+ function _setPrototypeOf(t, e) {
568
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
569
+ return t.__proto__ = e, t;
570
+ }, _setPrototypeOf(t, e);
580
571
  }
581
572
 
582
- function _inherits(subClass, superClass) {
583
- if (typeof superClass !== "function" && superClass !== null) {
584
- throw new TypeError("Super expression must either be null or a function");
585
- }
586
- subClass.prototype = Object.create(superClass && superClass.prototype, {
573
+ function _inherits(t, e) {
574
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
575
+ t.prototype = Object.create(e && e.prototype, {
587
576
  constructor: {
588
- value: subClass,
589
- writable: true,
590
- configurable: true
577
+ value: t,
578
+ writable: !0,
579
+ configurable: !0
591
580
  }
592
- });
593
- Object.defineProperty(subClass, "prototype", {
594
- writable: false
595
- });
596
- if (superClass) _setPrototypeOf(subClass, superClass);
581
+ }), Object.defineProperty(t, "prototype", {
582
+ writable: !1
583
+ }), e && _setPrototypeOf(t, e);
597
584
  }
598
585
 
599
586
  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -18466,6 +18453,7 @@ var AccessPermission = /*#__PURE__*/function (AccessPermission) {
18466
18453
  return AccessPermission;
18467
18454
  }({});
18468
18455
 
18456
+ var _excluded = ["title", "description", "ipType", "relationships", "createdAt", "watermarkImg", "creators", "media", "attributes", "app", "tags", "robotTerms"];
18469
18457
  var IPAssetClient = /*#__PURE__*/function () {
18470
18458
  function IPAssetClient(rpcClient, wallet, chainId) {
18471
18459
  _classCallCheck(this, IPAssetClient);
@@ -18484,21 +18472,141 @@ var IPAssetClient = /*#__PURE__*/function () {
18484
18472
  }
18485
18473
 
18486
18474
  /**
18487
- * Registers an NFT as IP, creating a corresponding IP record.
18488
- * @param request - The request object that contains all data needed to register IP.
18489
- * @param request.nftContract The address of the NFT.
18490
- * @param request.tokenId The token identifier of the NFT.
18491
- * @param request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
18492
- * @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
18493
- * @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
18494
- * @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
18495
- * @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
18496
- * @param request.deadline [Optional] The deadline for the signature in milliseconds, default is 1000ms.
18497
- * @param request.txOptions [Optional] The transaction options.
18498
- * @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true.
18499
- * @emits IPRegistered (ipId, chainId, tokenContract, tokenId, resolverAddr, metadataProviderAddress, metadata)
18475
+ * Create a new `IpCreator` object with the specified details.
18476
+ * @param params - The parameters required to create the `IpCreator` object.
18477
+ * @param params.name The name of the creator.
18478
+ * @param params.address The wallet address of the creator.
18479
+ * @param params.description [Optional] A description of the creator.
18480
+ * @param params.image [Optional] The URL or path to an image representing the creator.
18481
+ * @param params.socialMedia [Optional] An array of social media profiles associated with the creator.
18482
+ * @param params.socialMedia[].platform The name of the social media platform.
18483
+ * @param params.socialMedia[].url The URL to the creator's profile on the platform.
18484
+ * @param params.contributionPercent The percentage of contribution by the creator, must add up to 100.
18485
+ * @param params.role [Optional] The role of the creator in relation to the IP.
18486
+ * @returns An `IpCreator` object containing the provided details.
18500
18487
  */
18501
18488
  return _createClass(IPAssetClient, [{
18489
+ key: "generateCreatorMetadata",
18490
+ value: function generateCreatorMetadata(_ref) {
18491
+ var name = _ref.name,
18492
+ address = _ref.address,
18493
+ _ref$description = _ref.description,
18494
+ description = _ref$description === void 0 ? "" : _ref$description,
18495
+ _ref$image = _ref.image,
18496
+ image = _ref$image === void 0 ? "" : _ref$image,
18497
+ _ref$socialMedia = _ref.socialMedia,
18498
+ socialMedia = _ref$socialMedia === void 0 ? [] : _ref$socialMedia,
18499
+ contributionPercent = _ref.contributionPercent,
18500
+ _ref$role = _ref.role,
18501
+ role = _ref$role === void 0 ? "" : _ref$role;
18502
+ return {
18503
+ name: name,
18504
+ address: address,
18505
+ description: description,
18506
+ image: image,
18507
+ socialMedia: socialMedia,
18508
+ contributionPercent: contributionPercent,
18509
+ role: role
18510
+ };
18511
+ }
18512
+
18513
+ /**
18514
+ * Create a new `IpMetadata` object with the specified details.
18515
+ * @param params - The parameters required to create the `IpMetadata` object.
18516
+ * @param params.title [Optional] The title of the IP.
18517
+ * @param params.description [Optional] A description of the IP.
18518
+ * @param params.ipType [Optional] The type of the IP asset (e.g., "character", "chapter").
18519
+ * @param params.relationships [Optional] An array of relationships between this IP and its parent IPs.
18520
+ * @param params.relationships[].ipId The ID of the parent IP.
18521
+ * @param params.relationships[].type The type of relationship (e.g., "APPEARS_IN").
18522
+ * @param params.createdAt [Optional] The creation date and time of the IP in ISO 8601 format.
18523
+ * @param params.watermarkImg [Optional] The URL or path to an image used as a watermark for the IP.
18524
+ * @param params.creators [Optional] An array of creators associated with the IP.
18525
+ * @param params.creators[].name The name of the creator.
18526
+ * @param params.creators[].address The address of the creator.
18527
+ * @param params.creators[].description [Optional] A description of the creator.
18528
+ * @param params.creators[].image [Optional] The URL or path to an image representing the creator.
18529
+ * @param params.creators[].socialMedia [Optional] An array of social media profiles for the creator.
18530
+ * @param params.creators[].socialMedia[].platform The social media platform name.
18531
+ * @param params.creators[].socialMedia[].url The URL to the creator's profile.
18532
+ * @param params.creators[].role [Optional] The role of the creator in relation to the IP.
18533
+ * @param params.creators[].contributionPercent The percentage of contribution by the creator.
18534
+ * @param params.media [Optional] An array of media related to the IP.
18535
+ * @param params.media[].name The name of the media.
18536
+ * @param params.media[].url The URL to the media.
18537
+ * @param params.media[].mimeType The MIME type of the media.
18538
+ * @param params.attributes [Optional] An array of key-value pairs providing additional metadata.
18539
+ * @param params.attributes[].key The key for the attribute.
18540
+ * @param params.attributes[].value The value for the attribute, can be a string or number.
18541
+ * @param params.app [Optional] Information about the application associated with the IP.
18542
+ * @param params.app.id The ID of the application.
18543
+ * @param params.app.name The name of the application.
18544
+ * @param params.app.website The website URL of the application.
18545
+ * @param params.tags [Optional] An array of tags associated with the IP.
18546
+ * @param params.robotTerms [Optional] Robot terms for the IP, specifying access rules.
18547
+ * @param params.robotTerms.userAgent The user agent for which the rules apply.
18548
+ * @param params.robotTerms.allow The rules allowing access.
18549
+ * @param params.additionalProperties [Optional] Any additional key-value pairs to include in the metadata.
18550
+ * @returns An `IpMetadata` object containing the provided details and any additional properties.
18551
+ */
18552
+ }, {
18553
+ key: "generateIpMetadata",
18554
+ value: function generateIpMetadata(_ref2) {
18555
+ var _ref2$title = _ref2.title,
18556
+ title = _ref2$title === void 0 ? "" : _ref2$title,
18557
+ _ref2$description = _ref2.description,
18558
+ description = _ref2$description === void 0 ? "" : _ref2$description,
18559
+ _ref2$ipType = _ref2.ipType,
18560
+ ipType = _ref2$ipType === void 0 ? "" : _ref2$ipType,
18561
+ _ref2$relationships = _ref2.relationships,
18562
+ relationships = _ref2$relationships === void 0 ? [] : _ref2$relationships,
18563
+ _ref2$createdAt = _ref2.createdAt,
18564
+ createdAt = _ref2$createdAt === void 0 ? "" : _ref2$createdAt,
18565
+ _ref2$watermarkImg = _ref2.watermarkImg,
18566
+ watermarkImg = _ref2$watermarkImg === void 0 ? "" : _ref2$watermarkImg,
18567
+ _ref2$creators = _ref2.creators,
18568
+ creators = _ref2$creators === void 0 ? [] : _ref2$creators,
18569
+ _ref2$media = _ref2.media,
18570
+ media = _ref2$media === void 0 ? [] : _ref2$media,
18571
+ _ref2$attributes = _ref2.attributes,
18572
+ attributes = _ref2$attributes === void 0 ? [] : _ref2$attributes,
18573
+ app = _ref2.app,
18574
+ _ref2$tags = _ref2.tags,
18575
+ tags = _ref2$tags === void 0 ? [] : _ref2$tags,
18576
+ robotTerms = _ref2.robotTerms,
18577
+ additionalProperties = _objectWithoutProperties(_ref2, _excluded);
18578
+ return _objectSpread2({
18579
+ title: title,
18580
+ description: description,
18581
+ ipType: ipType,
18582
+ relationships: relationships,
18583
+ createdAt: createdAt,
18584
+ watermarkImg: watermarkImg,
18585
+ creators: creators,
18586
+ media: media,
18587
+ attributes: attributes,
18588
+ app: app,
18589
+ tags: tags,
18590
+ robotTerms: robotTerms
18591
+ }, additionalProperties);
18592
+ }
18593
+
18594
+ /**
18595
+ * Registers an NFT as IP, creating a corresponding IP record.
18596
+ * @param request - The request object that contains all data needed to register IP.
18597
+ * @param request.nftContract The address of the NFT.
18598
+ * @param request.tokenId The token identifier of the NFT.
18599
+ * @param request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
18600
+ * @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
18601
+ * @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
18602
+ * @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
18603
+ * @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
18604
+ * @param request.deadline [Optional] The deadline for the signature in milliseconds, default is 1000ms.
18605
+ * @param request.txOptions [Optional] The transaction options.
18606
+ * @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true.
18607
+ * @emits IPRegistered (ipId, chainId, tokenContract, tokenId, resolverAddr, metadataProviderAddress, metadata)
18608
+ */
18609
+ }, {
18502
18610
  key: "register",
18503
18611
  value: (function () {
18504
18612
  var _register = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
@@ -18980,7 +19088,7 @@ var IPAssetClient = /*#__PURE__*/function () {
18980
19088
  case 11:
18981
19089
  txHash = _context4.sent;
18982
19090
  if (!((_request$txOptions8 = request.txOptions) !== null && _request$txOptions8 !== void 0 && _request$txOptions8.waitForTransaction)) {
18983
- _context4.next = 19;
19091
+ _context4.next = 21;
18984
19092
  break;
18985
19093
  }
18986
19094
  _context4.next = 15;
@@ -18990,29 +19098,32 @@ var IPAssetClient = /*#__PURE__*/function () {
18990
19098
  case 15:
18991
19099
  txReceipt = _context4.sent;
18992
19100
  iPRegisteredLog = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt)[0];
18993
- licenseTermsId = this.licensingModuleClient.parseTxLicenseTermsAttachedEvent(txReceipt)[0].licenseTermsId;
19101
+ _context4.next = 19;
19102
+ return this.getLicenseTermsId(txReceipt);
19103
+ case 19:
19104
+ licenseTermsId = _context4.sent;
18994
19105
  return _context4.abrupt("return", {
18995
19106
  txHash: txHash,
18996
19107
  ipId: iPRegisteredLog.ipId,
18997
19108
  licenseTermsId: licenseTermsId,
18998
19109
  tokenId: iPRegisteredLog.tokenId
18999
19110
  });
19000
- case 19:
19111
+ case 21:
19001
19112
  return _context4.abrupt("return", {
19002
19113
  txHash: txHash
19003
19114
  });
19004
- case 20:
19005
- _context4.next = 25;
19006
- break;
19007
19115
  case 22:
19008
- _context4.prev = 22;
19116
+ _context4.next = 27;
19117
+ break;
19118
+ case 24:
19119
+ _context4.prev = 24;
19009
19120
  _context4.t0 = _context4["catch"](0);
19010
19121
  handleError(_context4.t0, "Failed to mint and register IP and attach PIL terms");
19011
- case 25:
19122
+ case 27:
19012
19123
  case "end":
19013
19124
  return _context4.stop();
19014
19125
  }
19015
- }, _callee4, this, [[0, 22]]);
19126
+ }, _callee4, this, [[0, 24]]);
19016
19127
  }));
19017
19128
  function mintAndRegisterIpAssetWithPilTerms(_x4) {
19018
19129
  return _mintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
@@ -19043,7 +19154,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19043
19154
  key: "registerIpAndAttachPilTerms",
19044
19155
  value: (function () {
19045
19156
  var _registerIpAndAttachPilTerms = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(request) {
19046
- var _request$ipMetadata9, _request$ipMetadata10, _request$ipMetadata11, _request$ipMetadata12, _request$txOptions9, ipIdAddress, isRegistered, licenseTerm, calculatedDeadline, sigAttachSignature, object, sigMetadataSignature, _request$txOptions10, txHash, txReceipt, log;
19157
+ var _request$ipMetadata9, _request$ipMetadata10, _request$ipMetadata11, _request$ipMetadata12, _request$txOptions9, ipIdAddress, isRegistered, licenseTerm, calculatedDeadline, sigAttachSignature, object, sigMetadataSignature, _request$txOptions10, txHash, txReceipt, ipRegisterEvent, licenseTermsId;
19047
19158
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
19048
19159
  while (1) switch (_context5.prev = _context5.next) {
19049
19160
  case 0:
@@ -19157,7 +19268,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19157
19268
  case 28:
19158
19269
  txHash = _context5.sent;
19159
19270
  if (!((_request$txOptions10 = request.txOptions) !== null && _request$txOptions10 !== void 0 && _request$txOptions10.waitForTransaction)) {
19160
- _context5.next = 35;
19271
+ _context5.next = 38;
19161
19272
  break;
19162
19273
  }
19163
19274
  _context5.next = 32;
@@ -19166,28 +19277,32 @@ var IPAssetClient = /*#__PURE__*/function () {
19166
19277
  });
19167
19278
  case 32:
19168
19279
  txReceipt = _context5.sent;
19169
- log = this.licensingModuleClient.parseTxLicenseTermsAttachedEvent(txReceipt)[0];
19280
+ ipRegisterEvent = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt);
19281
+ _context5.next = 36;
19282
+ return this.getLicenseTermsId(txReceipt);
19283
+ case 36:
19284
+ licenseTermsId = _context5.sent;
19170
19285
  return _context5.abrupt("return", {
19171
19286
  txHash: txHash,
19172
- licenseTermsId: log.licenseTermsId,
19173
- ipId: log.ipId
19287
+ licenseTermsId: licenseTermsId,
19288
+ ipId: ipRegisterEvent[0].ipId
19174
19289
  });
19175
- case 35:
19290
+ case 38:
19176
19291
  return _context5.abrupt("return", {
19177
19292
  txHash: txHash
19178
19293
  });
19179
- case 36:
19180
- _context5.next = 41;
19294
+ case 39:
19295
+ _context5.next = 44;
19181
19296
  break;
19182
- case 38:
19183
- _context5.prev = 38;
19297
+ case 41:
19298
+ _context5.prev = 41;
19184
19299
  _context5.t0 = _context5["catch"](0);
19185
19300
  handleError(_context5.t0, "Failed to register IP and attach PIL terms");
19186
- case 41:
19301
+ case 44:
19187
19302
  case "end":
19188
19303
  return _context5.stop();
19189
19304
  }
19190
- }, _callee5, this, [[0, 38]]);
19305
+ }, _callee5, this, [[0, 41]]);
19191
19306
  }));
19192
19307
  function registerIpAndAttachPilTerms(_x5) {
19193
19308
  return _registerIpAndAttachPilTerms.apply(this, arguments);
@@ -19592,6 +19707,38 @@ var IPAssetClient = /*#__PURE__*/function () {
19592
19707
  })]));
19593
19708
  return sigAttachState;
19594
19709
  }
19710
+ }, {
19711
+ key: "getLicenseTermsId",
19712
+ value: function () {
19713
+ var _getLicenseTermsId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(txReceipt) {
19714
+ var licensingModuleLicenseTermsAttachedEvent, licenseTermsId, defaultLicenseTerms;
19715
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
19716
+ while (1) switch (_context10.prev = _context10.next) {
19717
+ case 0:
19718
+ licensingModuleLicenseTermsAttachedEvent = this.licensingModuleClient.parseTxLicenseTermsAttachedEvent(txReceipt);
19719
+ licenseTermsId = licensingModuleLicenseTermsAttachedEvent.length >= 1 && licensingModuleLicenseTermsAttachedEvent[0].licenseTermsId;
19720
+ if (!(licenseTermsId === false)) {
19721
+ _context10.next = 7;
19722
+ break;
19723
+ }
19724
+ _context10.next = 5;
19725
+ return this.licenseRegistryReadOnlyClient.getDefaultLicenseTerms();
19726
+ case 5:
19727
+ defaultLicenseTerms = _context10.sent;
19728
+ licenseTermsId = defaultLicenseTerms.licenseTermsId;
19729
+ case 7:
19730
+ return _context10.abrupt("return", licenseTermsId);
19731
+ case 8:
19732
+ case "end":
19733
+ return _context10.stop();
19734
+ }
19735
+ }, _callee10, this);
19736
+ }));
19737
+ function getLicenseTermsId(_x11) {
19738
+ return _getLicenseTermsId.apply(this, arguments);
19739
+ }
19740
+ return getLicenseTermsId;
19741
+ }()
19595
19742
  }]);
19596
19743
  }();
19597
19744
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@story-protocol/core-sdk",
3
- "version": "1.0.0-rc.19",
3
+ "version": "1.0.0-rc.20",
4
4
  "description": "Story Protocol Core SDK",
5
5
  "main": "dist/story-protocol-core-sdk.cjs.js",
6
6
  "module": "dist/story-protocol-core-sdk.esm.js",