@story-protocol/core-sdk 0.0.1-beta-rc.1 → 0.0.1-beta-rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/README.md +0 -15
  2. package/dist/declarations/src/client.d.ts +22 -38
  3. package/dist/declarations/src/client.d.ts.map +1 -1
  4. package/dist/declarations/src/index.d.ts +11 -12
  5. package/dist/declarations/src/index.d.ts.map +1 -1
  6. package/dist/declarations/src/resources/dispute.d.ts +63 -0
  7. package/dist/declarations/src/resources/dispute.d.ts.map +1 -0
  8. package/dist/declarations/src/resources/ipAsset.d.ts +3 -4
  9. package/dist/declarations/src/resources/ipAsset.d.ts.map +1 -1
  10. package/dist/declarations/src/resources/license.d.ts +10 -0
  11. package/dist/declarations/src/resources/license.d.ts.map +1 -0
  12. package/dist/declarations/src/resources/permission.d.ts +3 -4
  13. package/dist/declarations/src/resources/permission.d.ts.map +1 -1
  14. package/dist/declarations/src/resources/policy.d.ts +16 -0
  15. package/dist/declarations/src/resources/policy.d.ts.map +1 -0
  16. package/dist/declarations/src/resources/tagging.d.ts +3 -4
  17. package/dist/declarations/src/resources/tagging.d.ts.map +1 -1
  18. package/dist/declarations/src/types/config.d.ts +8 -9
  19. package/dist/declarations/src/types/config.d.ts.map +1 -1
  20. package/dist/declarations/src/types/options.d.ts +0 -6
  21. package/dist/declarations/src/types/options.d.ts.map +1 -1
  22. package/dist/declarations/src/types/resources/dispute.d.ts +50 -0
  23. package/dist/declarations/src/types/resources/dispute.d.ts.map +1 -0
  24. package/dist/declarations/src/types/resources/ipAsset.d.ts +11 -126
  25. package/dist/declarations/src/types/resources/ipAsset.d.ts.map +1 -1
  26. package/dist/declarations/src/types/resources/license.d.ts +23 -0
  27. package/dist/declarations/src/types/resources/license.d.ts.map +1 -0
  28. package/dist/declarations/src/types/resources/permission.d.ts +2 -23
  29. package/dist/declarations/src/types/resources/permission.d.ts.map +1 -1
  30. package/dist/declarations/src/types/resources/policy.d.ts +33 -0
  31. package/dist/declarations/src/types/resources/policy.d.ts.map +1 -0
  32. package/dist/declarations/src/types/resources/tagging.d.ts +1 -13
  33. package/dist/declarations/src/types/resources/tagging.d.ts.map +1 -1
  34. package/dist/story-protocol-core-sdk.cjs.dev.js +2458 -1645
  35. package/dist/story-protocol-core-sdk.cjs.prod.js +2458 -1645
  36. package/dist/story-protocol-core-sdk.esm.js +2455 -1639
  37. package/package.json +5 -5
  38. package/dist/declarations/src/enums/ActionType.d.ts +0 -11
  39. package/dist/declarations/src/enums/ActionType.d.ts.map +0 -1
  40. package/dist/declarations/src/enums/ResourceType.d.ts +0 -15
  41. package/dist/declarations/src/enums/ResourceType.d.ts.map +0 -1
  42. package/dist/declarations/src/resources/ipAssetReadOnly.d.ts +0 -26
  43. package/dist/declarations/src/resources/ipAssetReadOnly.d.ts.map +0 -1
  44. package/dist/declarations/src/resources/moduleReadOnly.d.ts +0 -25
  45. package/dist/declarations/src/resources/moduleReadOnly.d.ts.map +0 -1
  46. package/dist/declarations/src/resources/permissionReadOnly.d.ts +0 -25
  47. package/dist/declarations/src/resources/permissionReadOnly.d.ts.map +0 -1
  48. package/dist/declarations/src/resources/taggingReadOnly.d.ts +0 -24
  49. package/dist/declarations/src/resources/taggingReadOnly.d.ts.map +0 -1
  50. package/dist/declarations/src/resources/transaction.d.ts +0 -11
  51. package/dist/declarations/src/resources/transaction.d.ts.map +0 -1
  52. package/dist/declarations/src/resources/transactionReadOnly.d.ts +0 -25
  53. package/dist/declarations/src/resources/transactionReadOnly.d.ts.map +0 -1
  54. package/dist/declarations/src/types/client.d.ts +0 -23
  55. package/dist/declarations/src/types/client.d.ts.map +0 -1
  56. package/dist/declarations/src/types/resources/module.d.ts +0 -43
  57. package/dist/declarations/src/types/resources/module.d.ts.map +0 -1
  58. package/dist/declarations/src/types/resources/transaction.d.ts +0 -52
  59. package/dist/declarations/src/types/resources/transaction.d.ts.map +0 -1
@@ -1,8 +1,7 @@
1
+ import { getAddress, decodeEventLog, encodeFunctionData, zeroAddress, stringToHex, createPublicClient, createWalletClient } from 'viem';
1
2
  import axios from 'axios';
2
- import { getAddress, isAddress, decodeEventLog, encodeFunctionData, http, createPublicClient, createWalletClient } from 'viem';
3
- import { sepolia } from 'viem/chains';
4
3
  import * as dotenv from 'dotenv';
5
- import { formatAbi } from 'abitype';
4
+ import { polygonMumbai, sepolia, mainnet } from 'viem/chains';
6
5
 
7
6
  function _toPrimitive(input, hint) {
8
7
  if (typeof input !== "object" || input === null) return input;
@@ -81,81 +80,6 @@ function _createClass(Constructor, protoProps, staticProps) {
81
80
  return Constructor;
82
81
  }
83
82
 
84
- function _setPrototypeOf(o, p) {
85
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
86
- o.__proto__ = p;
87
- return o;
88
- };
89
- return _setPrototypeOf(o, p);
90
- }
91
-
92
- function _inherits(subClass, superClass) {
93
- if (typeof superClass !== "function" && superClass !== null) {
94
- throw new TypeError("Super expression must either be null or a function");
95
- }
96
- subClass.prototype = Object.create(superClass && superClass.prototype, {
97
- constructor: {
98
- value: subClass,
99
- writable: true,
100
- configurable: true
101
- }
102
- });
103
- Object.defineProperty(subClass, "prototype", {
104
- writable: false
105
- });
106
- if (superClass) _setPrototypeOf(subClass, superClass);
107
- }
108
-
109
- function _getPrototypeOf(o) {
110
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
111
- return o.__proto__ || Object.getPrototypeOf(o);
112
- };
113
- return _getPrototypeOf(o);
114
- }
115
-
116
- function _isNativeReflectConstruct() {
117
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
118
- if (Reflect.construct.sham) return false;
119
- if (typeof Proxy === "function") return true;
120
- try {
121
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
122
- return true;
123
- } catch (e) {
124
- return false;
125
- }
126
- }
127
-
128
- function _assertThisInitialized(self) {
129
- if (self === void 0) {
130
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
131
- }
132
- return self;
133
- }
134
-
135
- function _possibleConstructorReturn(self, call) {
136
- if (call && (typeof call === "object" || typeof call === "function")) {
137
- return call;
138
- } else if (call !== void 0) {
139
- throw new TypeError("Derived constructors may only return object or undefined");
140
- }
141
- return _assertThisInitialized(self);
142
- }
143
-
144
- function _createSuper(Derived) {
145
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
146
- return function _createSuperInternal() {
147
- var Super = _getPrototypeOf(Derived),
148
- result;
149
- if (hasNativeReflectConstruct) {
150
- var NewTarget = _getPrototypeOf(this).constructor;
151
- result = Reflect.construct(Super, arguments, NewTarget);
152
- } else {
153
- result = Super.apply(this, arguments);
154
- }
155
- return _possibleConstructorReturn(this, result);
156
- };
157
- }
158
-
159
83
  function _regeneratorRuntime() {
160
84
  _regeneratorRuntime = function () {
161
85
  return e;
@@ -496,1231 +420,2153 @@ function handleError(error, msg) {
496
420
  throw new Error("".concat(msg, ": Unknown error type"));
497
421
  }
498
422
 
499
- /**
500
- * TransactionClient allows you to view and monitor transactions on Story Protocol.
501
- */
502
- var TransactionReadOnlyClient = /*#__PURE__*/function () {
503
- function TransactionReadOnlyClient(httpClient, rpcClient) {
504
- _classCallCheck(this, TransactionReadOnlyClient);
505
- this.httpClient = httpClient;
506
- this.rpcClient = rpcClient;
507
- }
508
-
509
- /**
510
- * Get transaction data based on the specified transaction id.
511
- *
512
- * @param request - the request object for getting the transaction
513
- * @returns the response object that contains the fetched transaction object
514
- */
515
- _createClass(TransactionReadOnlyClient, [{
516
- key: "get",
517
- value: function () {
518
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
519
- var response;
520
- return _regeneratorRuntime().wrap(function _callee$(_context) {
521
- while (1) switch (_context.prev = _context.next) {
522
- case 0:
523
- _context.prev = 0;
524
- _context.next = 3;
525
- return this.httpClient.get("/protocol/transaction/".concat(request.transactionId));
526
- case 3:
527
- response = _context.sent;
528
- return _context.abrupt("return", response.data);
529
- case 7:
530
- _context.prev = 7;
531
- _context.t0 = _context["catch"](0);
532
- handleError(_context.t0, "Failed to get transaction");
533
- case 10:
534
- case "end":
535
- return _context.stop();
536
- }
537
- }, _callee, this, [[0, 7]]);
538
- }));
539
- function get(_x) {
540
- return _get.apply(this, arguments);
541
- }
542
- return get;
543
- }()
544
- /**
545
- * List Transactions.
546
- *
547
- * @returns the response object that contains a list of transactions
548
- */
549
- }, {
550
- key: "list",
551
- value: function () {
552
- var _list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
553
- var response;
554
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
555
- while (1) switch (_context2.prev = _context2.next) {
556
- case 0:
557
- _context2.prev = 0;
558
- _context2.next = 3;
559
- return this.httpClient.post("/protocol/transaction", request || {});
560
- case 3:
561
- response = _context2.sent;
562
- return _context2.abrupt("return", response.data);
563
- case 7:
564
- _context2.prev = 7;
565
- _context2.t0 = _context2["catch"](0);
566
- handleError(_context2.t0, "Failed to list transactions");
567
- case 10:
568
- case "end":
569
- return _context2.stop();
570
- }
571
- }, _callee2, this, [[0, 7]]);
572
- }));
573
- function list(_x2) {
574
- return _list.apply(this, arguments);
575
- }
576
- return list;
577
- }()
578
- }]);
579
- return TransactionReadOnlyClient;
580
- }();
581
-
582
- /**
583
- * TransactionClient allows you to view and monitor transactions on Story Protocol.
584
- */
585
- var TransactionClient = /*#__PURE__*/function (_TransactionReadOnlyC) {
586
- _inherits(TransactionClient, _TransactionReadOnlyC);
587
- var _super = _createSuper(TransactionClient);
588
- function TransactionClient(httpClient, rpcClient, wallet) {
589
- var _this;
590
- _classCallCheck(this, TransactionClient);
591
- _this = _super.call(this, httpClient, rpcClient);
592
- _this.wallet = wallet;
593
- return _this;
594
- }
595
- return _createClass(TransactionClient);
596
- }(TransactionReadOnlyClient);
423
+ function _arrayLikeToArray(arr, len) {
424
+ if (len == null || len > arr.length) len = arr.length;
425
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
426
+ return arr2;
427
+ }
597
428
 
598
- /**
599
- * Default timeout value for http clients.
600
- */
601
- var HTTP_TIMEOUT = 5000;
429
+ function _arrayWithoutHoles(arr) {
430
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
431
+ }
602
432
 
603
- var PlatformClient = /*#__PURE__*/function () {
604
- function PlatformClient(httpClient) {
605
- _classCallCheck(this, PlatformClient);
606
- this.httpClient = httpClient;
607
- }
433
+ function _iterableToArray(iter) {
434
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
435
+ }
608
436
 
609
- /**
610
- * Upload a file to Arweave.
611
- *
612
- * @param file - the file binary data to upload
613
- * @param mimeType - the mime type of the file
614
- * @returns the response object that contains the uri of the uploaded file
615
- */
616
- _createClass(PlatformClient, [{
617
- key: "uploadFile",
618
- value: function () {
619
- var _uploadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file, mimeType) {
620
- var preSignUrlResp, data, uploadResp, confirmResp;
621
- return _regeneratorRuntime().wrap(function _callee$(_context) {
622
- while (1) switch (_context.prev = _context.next) {
623
- case 0:
624
- _context.prev = 0;
625
- _context.next = 3;
626
- return this.httpClient.post("/platform/file-upload/request");
627
- case 3:
628
- preSignUrlResp = _context.sent;
629
- data = preSignUrlResp.data; // upload the file to s3
630
- _context.next = 7;
631
- return this.httpClient.put(data.url, file, {
632
- timeout: 0,
633
- headers: {
634
- "Content-Type": mimeType
635
- }
636
- });
637
- case 7:
638
- uploadResp = _context.sent;
639
- if (!(uploadResp.status !== 200)) {
640
- _context.next = 10;
641
- break;
642
- }
643
- throw new Error("Failed to upload file to s3. Status: ".concat(uploadResp.status));
644
- case 10:
645
- _context.next = 12;
646
- return this.httpClient.post("/platform/file-upload/confirm", {
647
- key: data.key
648
- });
649
- case 12:
650
- confirmResp = _context.sent;
651
- return _context.abrupt("return", confirmResp.data);
652
- case 16:
653
- _context.prev = 16;
654
- _context.t0 = _context["catch"](0);
655
- return _context.abrupt("return", handleError(_context.t0, "Failed to upload file"));
656
- case 19:
657
- case "end":
658
- return _context.stop();
659
- }
660
- }, _callee, this, [[0, 16]]);
661
- }));
662
- function uploadFile(_x, _x2) {
663
- return _uploadFile.apply(this, arguments);
664
- }
665
- return uploadFile;
666
- }()
667
- }]);
668
- return PlatformClient;
669
- }();
437
+ function _unsupportedIterableToArray(o, minLen) {
438
+ if (!o) return;
439
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
440
+ var n = Object.prototype.toString.call(o).slice(8, -1);
441
+ if (n === "Object" && o.constructor) n = o.constructor.name;
442
+ if (n === "Map" || n === "Set") return Array.from(o);
443
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
444
+ }
670
445
 
671
- /**
672
- * ModuleReadOnlyClient allows you to view and search modules on Story Protocol.
673
- */
674
- var ModuleReadOnlyClient = /*#__PURE__*/function () {
675
- function ModuleReadOnlyClient(httpClient, rpcClient) {
676
- _classCallCheck(this, ModuleReadOnlyClient);
677
- this.httpClient = httpClient;
678
- this.rpcClient = rpcClient;
679
- }
446
+ function _nonIterableSpread() {
447
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
448
+ }
680
449
 
681
- /**
682
- * Get an module based on the module name.
683
- *
684
- * @param request - the request object for getting a module.
685
- * @returns the response object the contains the fetched module.
686
- */
687
- _createClass(ModuleReadOnlyClient, [{
688
- key: "get",
689
- value: function () {
690
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
691
- var response;
692
- return _regeneratorRuntime().wrap(function _callee$(_context) {
693
- while (1) switch (_context.prev = _context.next) {
694
- case 0:
695
- _context.prev = 0;
696
- _context.next = 3;
697
- return this.httpClient.get("/modules/".concat(request.name));
698
- case 3:
699
- response = _context.sent;
700
- return _context.abrupt("return", response.data);
701
- case 7:
702
- _context.prev = 7;
703
- _context.t0 = _context["catch"](0);
704
- handleError(_context.t0, "Failed to get module");
705
- case 10:
706
- case "end":
707
- return _context.stop();
708
- }
709
- }, _callee, this, [[0, 7]]);
710
- }));
711
- function get(_x) {
712
- return _get.apply(this, arguments);
713
- }
714
- return get;
715
- }()
716
- /**
717
- * List modules.
718
- *
719
- * @returns the response object that contains results from listing query.
720
- */
721
- }, {
722
- key: "list",
723
- value: function () {
724
- var _list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
725
- var response;
726
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
727
- while (1) switch (_context2.prev = _context2.next) {
728
- case 0:
729
- _context2.prev = 0;
730
- _context2.next = 3;
731
- return this.httpClient.post("/modules", request || {});
732
- case 3:
733
- response = _context2.sent;
734
- return _context2.abrupt("return", response.data);
735
- case 7:
736
- _context2.prev = 7;
737
- _context2.t0 = _context2["catch"](0);
738
- handleError(_context2.t0, "Failed to list modules.");
739
- case 10:
740
- case "end":
741
- return _context2.stop();
742
- }
743
- }, _callee2, this, [[0, 7]]);
744
- }));
745
- function list(_x2) {
746
- return _list.apply(this, arguments);
747
- }
748
- return list;
749
- }()
750
- }]);
751
- return ModuleReadOnlyClient;
752
- }();
450
+ function _toConsumableArray(arr) {
451
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
452
+ }
753
453
 
754
- var TaggingModuleABI = [{
454
+ var IERC1155ABI = [{
455
+ anonymous: false,
755
456
  inputs: [{
756
- internalType: "string",
757
- name: "tag",
758
- type: "string"
457
+ indexed: true,
458
+ internalType: "address",
459
+ name: "operator",
460
+ type: "address"
759
461
  }, {
462
+ indexed: true,
760
463
  internalType: "address",
761
- name: "ipId",
464
+ name: "from",
762
465
  type: "address"
466
+ }, {
467
+ indexed: true,
468
+ internalType: "address",
469
+ name: "to",
470
+ type: "address"
471
+ }, {
472
+ indexed: false,
473
+ internalType: "uint256[]",
474
+ name: "ids",
475
+ type: "uint256[]"
476
+ }, {
477
+ indexed: false,
478
+ internalType: "uint256[]",
479
+ name: "values",
480
+ type: "uint256[]"
763
481
  }],
764
- name: "removeTag",
765
- outputs: [{
766
- internalType: "bool",
767
- name: "removed",
768
- type: "bool"
769
- }],
770
- stateMutability: "nonpayable",
771
- type: "function"
482
+ name: "TransferBatch",
483
+ type: "event"
772
484
  }, {
485
+ anonymous: false,
773
486
  inputs: [{
774
- internalType: "string",
775
- name: "tag",
776
- type: "string"
487
+ indexed: true,
488
+ internalType: "address",
489
+ name: "operator",
490
+ type: "address"
777
491
  }, {
492
+ indexed: true,
778
493
  internalType: "address",
779
- name: "ipId",
494
+ name: "from",
780
495
  type: "address"
781
- }],
782
- name: "setTag",
783
- outputs: [{
784
- internalType: "bool",
785
- name: "added",
786
- type: "bool"
787
- }],
788
- stateMutability: "nonpayable",
789
- type: "function"
790
- }];
791
-
792
- var TaggingModuleRaw = TaggingModuleABI;
793
- formatAbi(TaggingModuleRaw);
794
- var TaggingModuleConfig = {
795
- abi: TaggingModuleRaw,
796
- address: getAddress(process.env.TAGGING_MODULE || process.env.NEXT_PUBLIC_TAGGING_MODULE || "")
797
- };
798
-
799
- /**
800
- * TaggingReadOnlyClient allows you to view and search IP Assets on Story Protocol.
801
- */
802
- var TaggingReadOnlyClient = /*#__PURE__*/function () {
803
- function TaggingReadOnlyClient(httpClient, rpcClient) {
804
- _classCallCheck(this, TaggingReadOnlyClient);
805
- this.httpClient = httpClient;
806
- this.rpcClient = rpcClient;
807
- }
808
-
809
- /**
810
- * Get tags.
811
- *
812
- * @returns the response object that contains results from get tag query.
813
- */
814
- _createClass(TaggingReadOnlyClient, [{
815
- key: "get",
816
- value: function () {
817
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
818
- var response;
819
- return _regeneratorRuntime().wrap(function _callee$(_context) {
820
- while (1) switch (_context.prev = _context.next) {
821
- case 0:
822
- _context.prev = 0;
823
- _context.next = 3;
824
- return this.httpClient.get("/tags/".concat(request.id));
825
- case 3:
826
- response = _context.sent;
827
- return _context.abrupt("return", response.data);
828
- case 7:
829
- _context.prev = 7;
830
- _context.t0 = _context["catch"](0);
831
- handleError(_context.t0, "Failed to get tags.");
832
- case 10:
833
- case "end":
834
- return _context.stop();
835
- }
836
- }, _callee, this, [[0, 7]]);
837
- }));
838
- function get(_x) {
839
- return _get.apply(this, arguments);
840
- }
841
- return get;
842
- }()
843
- /**
844
- * List tags.
845
- *
846
- * @returns the response object that contains results from list tags query.
847
- */
848
- }, {
849
- key: "list",
850
- value: function () {
851
- var _list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
852
- var response;
853
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
854
- while (1) switch (_context2.prev = _context2.next) {
855
- case 0:
856
- _context2.prev = 0;
857
- _context2.next = 3;
858
- return this.httpClient.post("/tags", request || {});
859
- case 3:
860
- response = _context2.sent;
861
- return _context2.abrupt("return", response.data);
862
- case 7:
863
- _context2.prev = 7;
864
- _context2.t0 = _context2["catch"](0);
865
- handleError(_context2.t0, "Failed to list tags.");
866
- case 10:
867
- case "end":
868
- return _context2.stop();
869
- }
870
- }, _callee2, this, [[0, 7]]);
871
- }));
872
- function list(_x2) {
873
- return _list.apply(this, arguments);
874
- }
875
- return list;
876
- }()
877
- }]);
878
- return TaggingReadOnlyClient;
879
- }();
880
-
881
- var TaggingClient = /*#__PURE__*/function (_TaggingReadOnlyClien) {
882
- _inherits(TaggingClient, _TaggingReadOnlyClien);
883
- var _super = _createSuper(TaggingClient);
884
- function TaggingClient(httpClient, rpcClient, wallet) {
885
- var _this;
886
- _classCallCheck(this, TaggingClient);
887
- _this = _super.call(this, httpClient, rpcClient);
888
- _this.wallet = wallet;
889
- return _this;
890
- }
891
- _createClass(TaggingClient, [{
892
- key: "setTag",
893
- value: function () {
894
- var _setTag = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
895
- var _yield$this$rpcClient, call, txHash;
896
- return _regeneratorRuntime().wrap(function _callee$(_context) {
897
- while (1) switch (_context.prev = _context.next) {
898
- case 0:
899
- _context.prev = 0;
900
- _context.next = 3;
901
- return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, TaggingModuleConfig), {}, {
902
- functionName: "setTag",
903
- args: [request.tag, request.ipId]
904
- }));
905
- case 3:
906
- _yield$this$rpcClient = _context.sent;
907
- call = _yield$this$rpcClient.request;
908
- _context.next = 7;
909
- return this.wallet.writeContract(call);
910
- case 7:
911
- txHash = _context.sent;
912
- return _context.abrupt("return", {
913
- txHash: txHash
914
- });
915
- case 11:
916
- _context.prev = 11;
917
- _context.t0 = _context["catch"](0);
918
- handleError(_context.t0, "Failed to set tag");
919
- case 14:
920
- case "end":
921
- return _context.stop();
922
- }
923
- }, _callee, this, [[0, 11]]);
924
- }));
925
- function setTag(_x) {
926
- return _setTag.apply(this, arguments);
927
- }
928
- return setTag;
929
- }()
930
- }, {
931
- key: "removeTag",
932
- value: function () {
933
- var _removeTag = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
934
- var _yield$this$rpcClient2, call, txHash;
935
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
936
- while (1) switch (_context2.prev = _context2.next) {
937
- case 0:
938
- _context2.prev = 0;
939
- _context2.next = 3;
940
- return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, TaggingModuleConfig), {}, {
941
- functionName: "removeTag",
942
- args: [request.tag, request.ipId]
943
- }));
944
- case 3:
945
- _yield$this$rpcClient2 = _context2.sent;
946
- call = _yield$this$rpcClient2.request;
947
- _context2.next = 7;
948
- return this.wallet.writeContract(call);
949
- case 7:
950
- txHash = _context2.sent;
951
- return _context2.abrupt("return", {
952
- txHash: txHash
953
- });
954
- case 11:
955
- _context2.prev = 11;
956
- _context2.t0 = _context2["catch"](0);
957
- handleError(_context2.t0, "Failed to remove tag");
958
- case 14:
959
- case "end":
960
- return _context2.stop();
961
- }
962
- }, _callee2, this, [[0, 11]]);
963
- }));
964
- function removeTag(_x2) {
965
- return _removeTag.apply(this, arguments);
966
- }
967
- return removeTag;
968
- }()
969
- }]);
970
- return TaggingClient;
971
- }(TaggingReadOnlyClient);
972
-
973
- /**
974
- * IPAssetReadOnlyClient allows you to view and search IP Assets on Story Protocol.
975
- */
976
- var IPAssetReadOnlyClient = /*#__PURE__*/function () {
977
- function IPAssetReadOnlyClient(httpClient, rpcClient) {
978
- _classCallCheck(this, IPAssetReadOnlyClient);
979
- this.httpClient = httpClient;
980
- this.rpcClient = rpcClient;
981
- }
982
-
983
- /**
984
- * Get an IP Asset based on the specified IP asset ID.
985
- *
986
- * @param request - the request object for getting an IP Asset.
987
- * @returns the response object the contains the fetched IP Asset.
988
- */
989
- _createClass(IPAssetReadOnlyClient, [{
990
- key: "get",
991
- value: function () {
992
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
993
- var response;
994
- return _regeneratorRuntime().wrap(function _callee$(_context) {
995
- while (1) switch (_context.prev = _context.next) {
996
- case 0:
997
- _context.prev = 0;
998
- if (isAddress(request.ipId)) {
999
- _context.next = 3;
1000
- break;
1001
- }
1002
- throw new Error("Invalid ip id. Must be an address. But get: ".concat(request.ipId));
1003
- case 3:
1004
- _context.next = 5;
1005
- return this.httpClient.get("/accounts/".concat(request.ipId));
1006
- case 5:
1007
- response = _context.sent;
1008
- return _context.abrupt("return", response.data);
1009
- case 9:
1010
- _context.prev = 9;
1011
- _context.t0 = _context["catch"](0);
1012
- handleError(_context.t0, "Failed to get IP account");
1013
- case 12:
1014
- case "end":
1015
- return _context.stop();
1016
- }
1017
- }, _callee, this, [[0, 9]]);
1018
- }));
1019
- function get(_x) {
1020
- return _get.apply(this, arguments);
1021
- }
1022
- return get;
1023
- }()
1024
- /**
1025
- * List IP accounts.
1026
- *
1027
- * @returns the response object that contains results from listing query.
1028
- */
1029
496
  }, {
1030
- key: "list",
1031
- value: function () {
1032
- var _list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
1033
- var response;
1034
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1035
- while (1) switch (_context2.prev = _context2.next) {
1036
- case 0:
1037
- _context2.prev = 0;
1038
- _context2.next = 3;
1039
- return this.httpClient.post("/accounts", request || {});
1040
- case 3:
1041
- response = _context2.sent;
1042
- return _context2.abrupt("return", response.data);
1043
- case 7:
1044
- _context2.prev = 7;
1045
- _context2.t0 = _context2["catch"](0);
1046
- handleError(_context2.t0, "Failed to list IP Asset.");
1047
- case 10:
1048
- case "end":
1049
- return _context2.stop();
1050
- }
1051
- }, _callee2, this, [[0, 7]]);
1052
- }));
1053
- function list(_x2) {
1054
- return _list.apply(this, arguments);
1055
- }
1056
- return list;
1057
- }()
497
+ indexed: true,
498
+ internalType: "address",
499
+ name: "to",
500
+ type: "address"
1058
501
  }, {
1059
- key: "getIpId",
1060
- value: function () {
1061
- var _getIpId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
1062
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1063
- while (1) switch (_context3.prev = _context3.next) {
1064
- case 0:
1065
- case "end":
1066
- return _context3.stop();
1067
- }
1068
- }, _callee3);
1069
- }));
1070
- function getIpId() {
1071
- return _getIpId.apply(this, arguments);
1072
- }
1073
- return getIpId;
1074
- }()
1075
- }]);
1076
- return IPAssetReadOnlyClient;
1077
- }();
1078
-
1079
- var IPAccountRegistryABI = [{
1080
- inputs: [{
502
+ indexed: false,
1081
503
  internalType: "uint256",
1082
- name: "chainId_",
504
+ name: "id",
1083
505
  type: "uint256"
1084
506
  }, {
1085
- internalType: "address",
1086
- name: "tokenContract_",
1087
- type: "address"
1088
- }, {
507
+ indexed: false,
1089
508
  internalType: "uint256",
1090
- name: "tokenId_",
509
+ name: "value",
1091
510
  type: "uint256"
1092
511
  }],
1093
- name: "ipAsset",
1094
- outputs: [{
1095
- internalType: "address",
1096
- name: "",
1097
- type: "address"
1098
- }],
1099
- stateMutability: "view",
1100
- type: "function"
1101
- }, {
512
+ name: "TransferSingle",
513
+ type: "event"
514
+ }];
515
+
516
+ var AccessControllerABI = [{
1102
517
  anonymous: false,
1103
518
  inputs: [{
1104
519
  indexed: true,
1105
520
  internalType: "address",
1106
- name: "account",
521
+ name: "ipAccount",
1107
522
  type: "address"
1108
523
  }, {
1109
524
  indexed: true,
1110
525
  internalType: "address",
1111
- name: "implementation",
526
+ name: "signer",
1112
527
  type: "address"
1113
528
  }, {
1114
529
  indexed: true,
1115
- internalType: "uint256",
1116
- name: "chainId",
1117
- type: "uint256"
1118
- }, {
1119
- indexed: false,
1120
530
  internalType: "address",
1121
- name: "tokenContract",
531
+ name: "to",
1122
532
  type: "address"
1123
533
  }, {
1124
534
  indexed: false,
1125
- internalType: "uint256",
1126
- name: "tokenId",
1127
- type: "uint256"
535
+ internalType: "bytes4",
536
+ name: "func",
537
+ type: "bytes4"
538
+ }, {
539
+ indexed: false,
540
+ internalType: "uint8",
541
+ name: "permission",
542
+ type: "uint8"
1128
543
  }],
1129
- name: "IPAccountRegistered",
544
+ name: "PermissionSet",
1130
545
  type: "event"
1131
- }];
1132
-
1133
- if (typeof process !== "undefined") {
1134
- dotenv.config();
1135
- }
1136
- var IPAccountRegistryRaw = IPAccountRegistryABI;
1137
- formatAbi(IPAccountRegistryRaw);
1138
- var IPAccountRegistryConfig = {
1139
- abi: IPAccountRegistryRaw,
1140
- address: getAddress(process.env.IP_ACCOUNT_REGISTRY || process.env.NEXT_PUBLIC_IP_ACCOUNT_REGISTRY || "")
1141
- };
1142
-
1143
- function _arrayLikeToArray(arr, len) {
1144
- if (len == null || len > arr.length) len = arr.length;
1145
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
1146
- return arr2;
1147
- }
1148
-
1149
- function _unsupportedIterableToArray(o, minLen) {
1150
- if (!o) return;
1151
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
1152
- var n = Object.prototype.toString.call(o).slice(8, -1);
1153
- if (n === "Object" && o.constructor) n = o.constructor.name;
1154
- if (n === "Map" || n === "Set") return Array.from(o);
1155
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
546
+ }, {
547
+ inputs: [{
548
+ internalType: "address",
549
+ name: "ipAccount_",
550
+ type: "address"
551
+ }, {
552
+ internalType: "address",
553
+ name: "signer_",
554
+ type: "address"
555
+ }, {
556
+ internalType: "address",
557
+ name: "to_",
558
+ type: "address"
559
+ }, {
560
+ internalType: "bytes4",
561
+ name: "func_",
562
+ type: "bytes4"
563
+ }, {
564
+ internalType: "uint8",
565
+ name: "permission_",
566
+ type: "uint8"
567
+ }],
568
+ name: "setPermission",
569
+ outputs: [],
570
+ stateMutability: "nonpayable",
571
+ type: "function"
572
+ }];
573
+
574
+ var DisputeModuleABI = [{
575
+ anonymous: false,
576
+ inputs: [{
577
+ indexed: false,
578
+ internalType: "uint256",
579
+ name: "disputeId",
580
+ type: "uint256"
581
+ }, {
582
+ indexed: false,
583
+ internalType: "bytes",
584
+ name: "data",
585
+ type: "bytes"
586
+ }],
587
+ name: "DisputeCancelled",
588
+ type: "event"
589
+ }, {
590
+ anonymous: false,
591
+ inputs: [{
592
+ indexed: false,
593
+ internalType: "uint256",
594
+ name: "disputeId",
595
+ type: "uint256"
596
+ }, {
597
+ indexed: false,
598
+ internalType: "bool",
599
+ name: "decision",
600
+ type: "bool"
601
+ }, {
602
+ indexed: false,
603
+ internalType: "bytes",
604
+ name: "data",
605
+ type: "bytes"
606
+ }],
607
+ name: "DisputeJudgementSet",
608
+ type: "event"
609
+ }, {
610
+ anonymous: false,
611
+ inputs: [{
612
+ indexed: false,
613
+ internalType: "uint256",
614
+ name: "disputeId",
615
+ type: "uint256"
616
+ }, {
617
+ indexed: false,
618
+ internalType: "address",
619
+ name: "targetIpId",
620
+ type: "address"
621
+ }, {
622
+ indexed: false,
623
+ internalType: "address",
624
+ name: "disputeInitiator",
625
+ type: "address"
626
+ }, {
627
+ indexed: false,
628
+ internalType: "address",
629
+ name: "arbitrationPolicy",
630
+ type: "address"
631
+ }, {
632
+ indexed: false,
633
+ internalType: "bytes32",
634
+ name: "linkToDisputeEvidence",
635
+ type: "bytes32"
636
+ }, {
637
+ indexed: false,
638
+ internalType: "bytes32",
639
+ name: "targetTag",
640
+ type: "bytes32"
641
+ }, {
642
+ indexed: false,
643
+ internalType: "bytes",
644
+ name: "data",
645
+ type: "bytes"
646
+ }],
647
+ name: "DisputeRaised",
648
+ type: "event"
649
+ }, {
650
+ anonymous: false,
651
+ inputs: [{
652
+ indexed: false,
653
+ internalType: "uint256",
654
+ name: "disputeId",
655
+ type: "uint256"
656
+ }],
657
+ name: "DisputeResolved",
658
+ type: "event"
659
+ }, {
660
+ inputs: [{
661
+ internalType: "uint256",
662
+ name: "_disputeId",
663
+ type: "uint256"
664
+ }, {
665
+ internalType: "bytes",
666
+ name: "_data",
667
+ type: "bytes"
668
+ }],
669
+ name: "cancelDispute",
670
+ outputs: [],
671
+ stateMutability: "nonpayable",
672
+ type: "function"
673
+ }, {
674
+ inputs: [],
675
+ name: "name",
676
+ outputs: [{
677
+ internalType: "string",
678
+ name: "",
679
+ type: "string"
680
+ }],
681
+ stateMutability: "pure",
682
+ type: "function"
683
+ }, {
684
+ inputs: [{
685
+ internalType: "address",
686
+ name: "_targetIpId",
687
+ type: "address"
688
+ }, {
689
+ internalType: "string",
690
+ name: "_linkToDisputeEvidence",
691
+ type: "string"
692
+ }, {
693
+ internalType: "bytes32",
694
+ name: "_targetTag",
695
+ type: "bytes32"
696
+ }, {
697
+ internalType: "bytes",
698
+ name: "_data",
699
+ type: "bytes"
700
+ }],
701
+ name: "raiseDispute",
702
+ outputs: [{
703
+ internalType: "uint256",
704
+ name: "",
705
+ type: "uint256"
706
+ }],
707
+ stateMutability: "nonpayable",
708
+ type: "function"
709
+ }, {
710
+ inputs: [{
711
+ internalType: "uint256",
712
+ name: "_disputeId",
713
+ type: "uint256"
714
+ }],
715
+ name: "resolveDispute",
716
+ outputs: [],
717
+ stateMutability: "nonpayable",
718
+ type: "function"
719
+ }, {
720
+ inputs: [{
721
+ internalType: "uint256",
722
+ name: "_disputeId",
723
+ type: "uint256"
724
+ }, {
725
+ internalType: "bool",
726
+ name: "_decision",
727
+ type: "bool"
728
+ }, {
729
+ internalType: "bytes",
730
+ name: "_data",
731
+ type: "bytes"
732
+ }],
733
+ name: "setDisputeJudgement",
734
+ outputs: [],
735
+ stateMutability: "nonpayable",
736
+ type: "function"
737
+ }, {
738
+ inputs: [{
739
+ internalType: "address",
740
+ name: "_arbitrationPolicy",
741
+ type: "address"
742
+ }, {
743
+ internalType: "bool",
744
+ name: "_allowed",
745
+ type: "bool"
746
+ }],
747
+ name: "whitelistArbitrationPolicy",
748
+ outputs: [],
749
+ stateMutability: "nonpayable",
750
+ type: "function"
751
+ }, {
752
+ inputs: [{
753
+ internalType: "address",
754
+ name: "_arbitrationPolicy",
755
+ type: "address"
756
+ }, {
757
+ internalType: "address",
758
+ name: "_arbPolicyRelayer",
759
+ type: "address"
760
+ }, {
761
+ internalType: "bool",
762
+ name: "_allowed",
763
+ type: "bool"
764
+ }],
765
+ name: "whitelistArbitrationRelayer",
766
+ outputs: [],
767
+ stateMutability: "nonpayable",
768
+ type: "function"
769
+ }];
770
+
771
+ var IPAccountImplABI = [{
772
+ inputs: [{
773
+ internalType: "address",
774
+ name: "to",
775
+ type: "address"
776
+ }, {
777
+ internalType: "uint256",
778
+ name: "value",
779
+ type: "uint256"
780
+ }, {
781
+ internalType: "bytes",
782
+ name: "data",
783
+ type: "bytes"
784
+ }],
785
+ name: "execute",
786
+ outputs: [{
787
+ internalType: "bytes",
788
+ name: "result",
789
+ type: "bytes"
790
+ }],
791
+ stateMutability: "payable",
792
+ type: "function"
793
+ }];
794
+
795
+ var IPAssetRegistryABI = [{
796
+ anonymous: false,
797
+ inputs: [{
798
+ indexed: false,
799
+ internalType: "address",
800
+ name: "ipId",
801
+ type: "address"
802
+ }, {
803
+ indexed: true,
804
+ internalType: "uint256",
805
+ name: "chainId",
806
+ type: "uint256"
807
+ }, {
808
+ indexed: true,
809
+ internalType: "address",
810
+ name: "tokenContract",
811
+ type: "address"
812
+ }, {
813
+ indexed: true,
814
+ internalType: "uint256",
815
+ name: "tokenId",
816
+ type: "uint256"
817
+ }, {
818
+ indexed: false,
819
+ internalType: "address",
820
+ name: "resolver",
821
+ type: "address"
822
+ }, {
823
+ indexed: false,
824
+ internalType: "address",
825
+ name: "provider",
826
+ type: "address"
827
+ }, {
828
+ indexed: false,
829
+ internalType: "bytes",
830
+ name: "metadata",
831
+ type: "bytes"
832
+ }],
833
+ name: "IPRegistered",
834
+ type: "event"
835
+ }];
836
+
837
+ var LicensingModuleABI = [{
838
+ anonymous: false,
839
+ inputs: [{
840
+ indexed: true,
841
+ internalType: "address",
842
+ name: "caller",
843
+ type: "address"
844
+ }, {
845
+ indexed: true,
846
+ internalType: "address",
847
+ name: "ipId",
848
+ type: "address"
849
+ }, {
850
+ indexed: false,
851
+ internalType: "address[]",
852
+ name: "parentIpIds",
853
+ type: "address[]"
854
+ }],
855
+ name: "IpIdLinkedToParents",
856
+ type: "event"
857
+ }, {
858
+ anonymous: false,
859
+ inputs: [{
860
+ indexed: true,
861
+ internalType: "address",
862
+ name: "caller",
863
+ type: "address"
864
+ }, {
865
+ indexed: true,
866
+ internalType: "address",
867
+ name: "ipId",
868
+ type: "address"
869
+ }, {
870
+ indexed: true,
871
+ internalType: "uint256",
872
+ name: "policyId",
873
+ type: "uint256"
874
+ }, {
875
+ indexed: false,
876
+ internalType: "uint256",
877
+ name: "index",
878
+ type: "uint256"
879
+ }, {
880
+ indexed: false,
881
+ internalType: "bool",
882
+ name: "isInherited",
883
+ type: "bool"
884
+ }],
885
+ name: "PolicyAddedToIpId",
886
+ type: "event"
887
+ }, {
888
+ anonymous: false,
889
+ inputs: [{
890
+ indexed: true,
891
+ internalType: "address",
892
+ name: "policyFrameworkManager",
893
+ type: "address"
894
+ }, {
895
+ indexed: true,
896
+ internalType: "uint256",
897
+ name: "policyId",
898
+ type: "uint256"
899
+ }, {
900
+ indexed: false,
901
+ internalType: "bytes",
902
+ name: "policy",
903
+ type: "bytes"
904
+ }],
905
+ name: "PolicyRegistered",
906
+ type: "event"
907
+ }, {
908
+ inputs: [{
909
+ internalType: "address",
910
+ name: "ipId",
911
+ type: "address"
912
+ }, {
913
+ internalType: "uint256",
914
+ name: "polId",
915
+ type: "uint256"
916
+ }],
917
+ name: "addPolicyToIp",
918
+ outputs: [{
919
+ internalType: "uint256",
920
+ name: "indexOnIpId",
921
+ type: "uint256"
922
+ }],
923
+ stateMutability: "nonpayable",
924
+ type: "function"
925
+ }, {
926
+ inputs: [{
927
+ internalType: "uint256[]",
928
+ name: "licenseIds",
929
+ type: "uint256[]"
930
+ }, {
931
+ internalType: "address",
932
+ name: "childIpId",
933
+ type: "address"
934
+ }, {
935
+ internalType: "uint32",
936
+ name: "minRoyalty",
937
+ type: "uint32"
938
+ }],
939
+ name: "linkIpToParents",
940
+ outputs: [],
941
+ stateMutability: "nonpayable",
942
+ type: "function"
943
+ }, {
944
+ inputs: [{
945
+ internalType: "uint256",
946
+ name: "policyId",
947
+ type: "uint256"
948
+ }, {
949
+ internalType: "address",
950
+ name: "licensorIp",
951
+ type: "address"
952
+ }, {
953
+ internalType: "uint256",
954
+ name: "amount",
955
+ type: "uint256"
956
+ }, {
957
+ internalType: "address",
958
+ name: "receiver",
959
+ type: "address"
960
+ }],
961
+ name: "mintLicense",
962
+ outputs: [{
963
+ internalType: "uint256",
964
+ name: "licenseId",
965
+ type: "uint256"
966
+ }],
967
+ stateMutability: "nonpayable",
968
+ type: "function"
969
+ }, {
970
+ inputs: [],
971
+ name: "name",
972
+ outputs: [{
973
+ internalType: "string",
974
+ name: "",
975
+ type: "string"
976
+ }],
977
+ stateMutability: "view",
978
+ type: "function"
979
+ }, {
980
+ inputs: [{
981
+ internalType: "bool",
982
+ name: "isLicenseTransferable",
983
+ type: "bool"
984
+ }, {
985
+ internalType: "bytes",
986
+ name: "data",
987
+ type: "bytes"
988
+ }],
989
+ name: "registerPolicy",
990
+ outputs: [{
991
+ internalType: "uint256",
992
+ name: "policyId",
993
+ type: "uint256"
994
+ }],
995
+ stateMutability: "nonpayable",
996
+ type: "function"
997
+ }];
998
+
999
+ var UMLPolicyFrameworkManagerABI = [{
1000
+ inputs: [{
1001
+ components: [{
1002
+ internalType: "bool",
1003
+ name: "transferable",
1004
+ type: "bool"
1005
+ }, {
1006
+ internalType: "bool",
1007
+ name: "attribution",
1008
+ type: "bool"
1009
+ }, {
1010
+ internalType: "bool",
1011
+ name: "commercialUse",
1012
+ type: "bool"
1013
+ }, {
1014
+ internalType: "bool",
1015
+ name: "commercialAttribution",
1016
+ type: "bool"
1017
+ }, {
1018
+ internalType: "string[]",
1019
+ name: "commercializers",
1020
+ type: "string[]"
1021
+ }, {
1022
+ internalType: "uint32",
1023
+ name: "commercialRevShare",
1024
+ type: "uint32"
1025
+ }, {
1026
+ internalType: "bool",
1027
+ name: "derivativesAllowed",
1028
+ type: "bool"
1029
+ }, {
1030
+ internalType: "bool",
1031
+ name: "derivativesAttribution",
1032
+ type: "bool"
1033
+ }, {
1034
+ internalType: "bool",
1035
+ name: "derivativesApproval",
1036
+ type: "bool"
1037
+ }, {
1038
+ internalType: "bool",
1039
+ name: "derivativesReciprocal",
1040
+ type: "bool"
1041
+ }, {
1042
+ internalType: "uint32",
1043
+ name: "derivativesRevShare",
1044
+ type: "uint32"
1045
+ }, {
1046
+ internalType: "string[]",
1047
+ name: "territories",
1048
+ type: "string[]"
1049
+ }, {
1050
+ internalType: "string[]",
1051
+ name: "distributionChannels",
1052
+ type: "string[]"
1053
+ }, {
1054
+ internalType: "string[]",
1055
+ name: "contentRestrictions",
1056
+ type: "string[]"
1057
+ }, {
1058
+ internalType: "address",
1059
+ name: "royaltyPolicy",
1060
+ type: "address"
1061
+ }],
1062
+ internalType: "struct UMLPolicy",
1063
+ name: "umlPolicy",
1064
+ type: "tuple"
1065
+ }],
1066
+ name: "registerPolicy",
1067
+ outputs: [{
1068
+ internalType: "uint256",
1069
+ name: "policyId",
1070
+ type: "uint256"
1071
+ }],
1072
+ stateMutability: "nonpayable",
1073
+ type: "function"
1074
+ }];
1075
+
1076
+ var RegistrationModuleABI = [{
1077
+ inputs: [],
1078
+ name: "name",
1079
+ outputs: [{
1080
+ internalType: "string",
1081
+ name: "",
1082
+ type: "string"
1083
+ }],
1084
+ stateMutability: "pure",
1085
+ type: "function"
1086
+ }, {
1087
+ inputs: [{
1088
+ internalType: "uint256[]",
1089
+ name: "licenseIds",
1090
+ type: "uint256[]"
1091
+ }, {
1092
+ internalType: "address",
1093
+ name: "tokenContract",
1094
+ type: "address"
1095
+ }, {
1096
+ internalType: "uint256",
1097
+ name: "tokenId",
1098
+ type: "uint256"
1099
+ }, {
1100
+ internalType: "string",
1101
+ name: "ipName",
1102
+ type: "string"
1103
+ }, {
1104
+ internalType: "bytes32",
1105
+ name: "contentHash",
1106
+ type: "bytes32"
1107
+ }, {
1108
+ internalType: "string",
1109
+ name: "externalURL",
1110
+ type: "string"
1111
+ }, {
1112
+ internalType: "uint32",
1113
+ name: "minRoyalty",
1114
+ type: "uint32"
1115
+ }],
1116
+ name: "registerDerivativeIp",
1117
+ outputs: [],
1118
+ stateMutability: "nonpayable",
1119
+ type: "function"
1120
+ }, {
1121
+ inputs: [{
1122
+ internalType: "uint256",
1123
+ name: "policyId",
1124
+ type: "uint256"
1125
+ }, {
1126
+ internalType: "address",
1127
+ name: "tokenContract",
1128
+ type: "address"
1129
+ }, {
1130
+ internalType: "uint256",
1131
+ name: "tokenId",
1132
+ type: "uint256"
1133
+ }, {
1134
+ internalType: "string",
1135
+ name: "ipName",
1136
+ type: "string"
1137
+ }, {
1138
+ internalType: "bytes32",
1139
+ name: "contentHash",
1140
+ type: "bytes32"
1141
+ }, {
1142
+ internalType: "string",
1143
+ name: "externalURL",
1144
+ type: "string"
1145
+ }],
1146
+ name: "registerRootIp",
1147
+ outputs: [{
1148
+ internalType: "address",
1149
+ name: "",
1150
+ type: "address"
1151
+ }],
1152
+ stateMutability: "nonpayable",
1153
+ type: "function"
1154
+ }];
1155
+
1156
+ var TaggingModuleABI = [{
1157
+ inputs: [],
1158
+ name: "MAX_TAG_PERMISSIONS_AT_ONCE",
1159
+ outputs: [{
1160
+ internalType: "uint256",
1161
+ name: "",
1162
+ type: "uint256"
1163
+ }],
1164
+ stateMutability: "view",
1165
+ type: "function"
1166
+ }, {
1167
+ inputs: [{
1168
+ internalType: "string",
1169
+ name: "tag",
1170
+ type: "string"
1171
+ }, {
1172
+ internalType: "address",
1173
+ name: "ipId",
1174
+ type: "address"
1175
+ }],
1176
+ name: "isTagged",
1177
+ outputs: [{
1178
+ internalType: "bool",
1179
+ name: "",
1180
+ type: "bool"
1181
+ }],
1182
+ stateMutability: "view",
1183
+ type: "function"
1184
+ }, {
1185
+ inputs: [],
1186
+ name: "name",
1187
+ outputs: [{
1188
+ internalType: "string",
1189
+ name: "",
1190
+ type: "string"
1191
+ }],
1192
+ stateMutability: "view",
1193
+ type: "function"
1194
+ }, {
1195
+ inputs: [{
1196
+ internalType: "string",
1197
+ name: "tag",
1198
+ type: "string"
1199
+ }, {
1200
+ internalType: "address",
1201
+ name: "ipId",
1202
+ type: "address"
1203
+ }],
1204
+ name: "removeTag",
1205
+ outputs: [{
1206
+ internalType: "bool",
1207
+ name: "removed",
1208
+ type: "bool"
1209
+ }],
1210
+ stateMutability: "nonpayable",
1211
+ type: "function"
1212
+ }, {
1213
+ inputs: [{
1214
+ internalType: "string",
1215
+ name: "tag",
1216
+ type: "string"
1217
+ }, {
1218
+ internalType: "address",
1219
+ name: "ipId",
1220
+ type: "address"
1221
+ }],
1222
+ name: "setTag",
1223
+ outputs: [{
1224
+ internalType: "bool",
1225
+ name: "added",
1226
+ type: "bool"
1227
+ }],
1228
+ stateMutability: "nonpayable",
1229
+ type: "function"
1230
+ }, {
1231
+ inputs: [{
1232
+ internalType: "address",
1233
+ name: "ipId",
1234
+ type: "address"
1235
+ }, {
1236
+ internalType: "uint256",
1237
+ name: "index",
1238
+ type: "uint256"
1239
+ }],
1240
+ name: "tagAtIndexForIp",
1241
+ outputs: [{
1242
+ internalType: "bytes32",
1243
+ name: "",
1244
+ type: "bytes32"
1245
+ }],
1246
+ stateMutability: "view",
1247
+ type: "function"
1248
+ }, {
1249
+ inputs: [{
1250
+ internalType: "address",
1251
+ name: "ipId",
1252
+ type: "address"
1253
+ }, {
1254
+ internalType: "uint256",
1255
+ name: "index",
1256
+ type: "uint256"
1257
+ }],
1258
+ name: "tagStringAtIndexForIp",
1259
+ outputs: [{
1260
+ internalType: "string",
1261
+ name: "",
1262
+ type: "string"
1263
+ }],
1264
+ stateMutability: "view",
1265
+ type: "function"
1266
+ }, {
1267
+ inputs: [{
1268
+ internalType: "address",
1269
+ name: "ipId",
1270
+ type: "address"
1271
+ }],
1272
+ name: "totalTagsForIp",
1273
+ outputs: [{
1274
+ internalType: "uint256",
1275
+ name: "",
1276
+ type: "uint256"
1277
+ }],
1278
+ stateMutability: "view",
1279
+ type: "function"
1280
+ }];
1281
+
1282
+ var ErrorsABI = [{
1283
+ inputs: [{
1284
+ internalType: "address",
1285
+ name: "caller",
1286
+ type: "address"
1287
+ }],
1288
+ name: "AccessControlled__CallerIsNotIpAccount",
1289
+ type: "error"
1290
+ }, {
1291
+ inputs: [{
1292
+ internalType: "address",
1293
+ name: "ipAccount",
1294
+ type: "address"
1295
+ }],
1296
+ name: "AccessControlled__NotIpAccount",
1297
+ type: "error"
1298
+ }, {
1299
+ inputs: [],
1300
+ name: "AccessControlled__ZeroAddress",
1301
+ type: "error"
1302
+ }, {
1303
+ inputs: [],
1304
+ name: "AccessController__CallerIsNotIPAccount",
1305
+ type: "error"
1306
+ }, {
1307
+ inputs: [{
1308
+ internalType: "address",
1309
+ name: "ipAccount",
1310
+ type: "address"
1311
+ }],
1312
+ name: "AccessController__IPAccountIsNotValid",
1313
+ type: "error"
1314
+ }, {
1315
+ inputs: [],
1316
+ name: "AccessController__IPAccountIsZeroAddress",
1317
+ type: "error"
1318
+ }, {
1319
+ inputs: [{
1320
+ internalType: "address",
1321
+ name: "ipAccount",
1322
+ type: "address"
1323
+ }, {
1324
+ internalType: "address",
1325
+ name: "signer",
1326
+ type: "address"
1327
+ }, {
1328
+ internalType: "address",
1329
+ name: "to",
1330
+ type: "address"
1331
+ }, {
1332
+ internalType: "bytes4",
1333
+ name: "func",
1334
+ type: "bytes4"
1335
+ }],
1336
+ name: "AccessController__PermissionDenied",
1337
+ type: "error"
1338
+ }, {
1339
+ inputs: [],
1340
+ name: "AccessController__PermissionIsNotValid",
1341
+ type: "error"
1342
+ }, {
1343
+ inputs: [{
1344
+ internalType: "address",
1345
+ name: "to",
1346
+ type: "address"
1347
+ }],
1348
+ name: "AccessController__RecipientIsNotRegisteredModule",
1349
+ type: "error"
1350
+ }, {
1351
+ inputs: [],
1352
+ name: "AccessController__SignerIsZeroAddress",
1353
+ type: "error"
1354
+ }, {
1355
+ inputs: [],
1356
+ name: "ArbitrationPolicySP__NotDisputeModule",
1357
+ type: "error"
1358
+ }, {
1359
+ inputs: [],
1360
+ name: "ArbitrationPolicySP__ZeroDisputeModule",
1361
+ type: "error"
1362
+ }, {
1363
+ inputs: [],
1364
+ name: "ArbitrationPolicySP__ZeroPaymentToken",
1365
+ type: "error"
1366
+ }, {
1367
+ inputs: [],
1368
+ name: "DisputeModule__NotAbleToResolve",
1369
+ type: "error"
1370
+ }, {
1371
+ inputs: [],
1372
+ name: "DisputeModule__NotDisputeInitiator",
1373
+ type: "error"
1374
+ }, {
1375
+ inputs: [],
1376
+ name: "DisputeModule__NotInDisputeState",
1377
+ type: "error"
1378
+ }, {
1379
+ inputs: [],
1380
+ name: "DisputeModule__NotRegisteredIpId",
1381
+ type: "error"
1382
+ }, {
1383
+ inputs: [],
1384
+ name: "DisputeModule__NotWhitelistedArbitrationPolicy",
1385
+ type: "error"
1386
+ }, {
1387
+ inputs: [],
1388
+ name: "DisputeModule__NotWhitelistedArbitrationRelayer",
1389
+ type: "error"
1390
+ }, {
1391
+ inputs: [],
1392
+ name: "DisputeModule__NotWhitelistedDisputeTag",
1393
+ type: "error"
1394
+ }, {
1395
+ inputs: [],
1396
+ name: "DisputeModule__UnauthorizedAccess",
1397
+ type: "error"
1398
+ }, {
1399
+ inputs: [],
1400
+ name: "DisputeModule__ZeroArbitrationPolicy",
1401
+ type: "error"
1402
+ }, {
1403
+ inputs: [],
1404
+ name: "DisputeModule__ZeroArbitrationRelayer",
1405
+ type: "error"
1406
+ }, {
1407
+ inputs: [],
1408
+ name: "DisputeModule__ZeroDisputeTag",
1409
+ type: "error"
1410
+ }, {
1411
+ inputs: [],
1412
+ name: "DisputeModule__ZeroLinkToDisputeEvidence",
1413
+ type: "error"
1414
+ }, {
1415
+ inputs: [],
1416
+ name: "Governance__InconsistentState",
1417
+ type: "error"
1418
+ }, {
1419
+ inputs: [],
1420
+ name: "Governance__NewStateIsTheSameWithOldState",
1421
+ type: "error"
1422
+ }, {
1423
+ inputs: [],
1424
+ name: "Governance__OnlyProtocolAdmin",
1425
+ type: "error"
1426
+ }, {
1427
+ inputs: [],
1428
+ name: "Governance__ProtocolPaused",
1429
+ type: "error"
1430
+ }, {
1431
+ inputs: [{
1432
+ internalType: "string",
1433
+ name: "interfaceName",
1434
+ type: "string"
1435
+ }],
1436
+ name: "Governance__UnsupportedInterface",
1437
+ type: "error"
1438
+ }, {
1439
+ inputs: [],
1440
+ name: "Governance__ZeroAddress",
1441
+ type: "error"
1442
+ }, {
1443
+ inputs: [],
1444
+ name: "IPAccountRegistry_InvalidIpAccountImpl",
1445
+ type: "error"
1446
+ }, {
1447
+ inputs: [],
1448
+ name: "IPAccount__ExpiredSignature",
1449
+ type: "error"
1450
+ }, {
1451
+ inputs: [],
1452
+ name: "IPAccount__InvalidCalldata",
1453
+ type: "error"
1454
+ }, {
1455
+ inputs: [],
1456
+ name: "IPAccount__InvalidSignature",
1457
+ type: "error"
1458
+ }, {
1459
+ inputs: [],
1460
+ name: "IPAccount__InvalidSigner",
1461
+ type: "error"
1462
+ }, {
1463
+ inputs: [],
1464
+ name: "IPAssetRegistry__AlreadyRegistered",
1465
+ type: "error"
1466
+ }, {
1467
+ inputs: [],
1468
+ name: "IPAssetRegistry__IPAccountAlreadyCreated",
1469
+ type: "error"
1470
+ }, {
1471
+ inputs: [],
1472
+ name: "IPAssetRegistry__InvalidAccount",
1473
+ type: "error"
1474
+ }, {
1475
+ inputs: [],
1476
+ name: "IPAssetRegistry__InvalidMetadataProvider",
1477
+ type: "error"
1478
+ }, {
1479
+ inputs: [],
1480
+ name: "IPAssetRegistry__NotYetRegistered",
1481
+ type: "error"
1482
+ }, {
1483
+ inputs: [],
1484
+ name: "IPAssetRegistry__RegistrantUnauthorized",
1485
+ type: "error"
1486
+ }, {
1487
+ inputs: [],
1488
+ name: "IPAssetRegistry__ResolverInvalid",
1489
+ type: "error"
1490
+ }, {
1491
+ inputs: [],
1492
+ name: "IPAssetRegistry__Unauthorized",
1493
+ type: "error"
1494
+ }, {
1495
+ inputs: [],
1496
+ name: "IPResolver_InvalidIP",
1497
+ type: "error"
1498
+ }, {
1499
+ inputs: [],
1500
+ name: "IPResolver_Unauthorized",
1501
+ type: "error"
1502
+ }, {
1503
+ inputs: [],
1504
+ name: "LSClaimer__AlreadyClaimed",
1505
+ type: "error"
1506
+ }, {
1507
+ inputs: [],
1508
+ name: "LSClaimer__ERC20BalanceNotZero",
1509
+ type: "error"
1510
+ }, {
1511
+ inputs: [],
1512
+ name: "LSClaimer__ETHBalanceNotZero",
1513
+ type: "error"
1514
+ }, {
1515
+ inputs: [],
1516
+ name: "LSClaimer__InvalidPath",
1517
+ type: "error"
1518
+ }, {
1519
+ inputs: [],
1520
+ name: "LSClaimer__InvalidPathFirstPosition",
1521
+ type: "error"
1522
+ }, {
1523
+ inputs: [],
1524
+ name: "LSClaimer__InvalidPathLastPosition",
1525
+ type: "error"
1526
+ }, {
1527
+ inputs: [],
1528
+ name: "LSClaimer__ZeroIpId",
1529
+ type: "error"
1530
+ }, {
1531
+ inputs: [],
1532
+ name: "LSClaimer__ZeroLicensingModule",
1533
+ type: "error"
1534
+ }, {
1535
+ inputs: [],
1536
+ name: "LSClaimer__ZeroRoyaltyPolicyLS",
1537
+ type: "error"
1538
+ }, {
1539
+ inputs: [],
1540
+ name: "LicenseRegistry__CallerNotLicensingModule",
1541
+ type: "error"
1542
+ }, {
1543
+ inputs: [],
1544
+ name: "LicenseRegistry__NotTransferable",
1545
+ type: "error"
1546
+ }, {
1547
+ inputs: [],
1548
+ name: "LicenseRegistry__ZeroLicensingModule",
1549
+ type: "error"
1550
+ }, {
1551
+ inputs: [],
1552
+ name: "LicensingModuleAware__CallerNotLicensingModule",
1553
+ type: "error"
1554
+ }, {
1555
+ inputs: [],
1556
+ name: "LicensingModule__CallerNotLicenseRegistry",
1557
+ type: "error"
1558
+ }, {
1559
+ inputs: [],
1560
+ name: "LicensingModule__CallerNotLicensorAndPolicyNotSet",
1561
+ type: "error"
1562
+ }, {
1563
+ inputs: [],
1564
+ name: "LicensingModule__CommercialTermInNonCommercialPolicy",
1565
+ type: "error"
1566
+ }, {
1567
+ inputs: [],
1568
+ name: "LicensingModule__DerivativeRevShareSumExceedsMaxRNFTSupply",
1569
+ type: "error"
1570
+ }, {
1571
+ inputs: [],
1572
+ name: "LicensingModule__DerivativesCannotAddPolicy",
1573
+ type: "error"
1574
+ }, {
1575
+ inputs: [],
1576
+ name: "LicensingModule__EmptyLicenseUrl",
1577
+ type: "error"
1578
+ }, {
1579
+ inputs: [],
1580
+ name: "LicensingModule__EmptyParamName",
1581
+ type: "error"
1582
+ }, {
1583
+ inputs: [],
1584
+ name: "LicensingModule__FrameworkNotFound",
1585
+ type: "error"
1586
+ }, {
1587
+ inputs: [],
1588
+ name: "LicensingModule__IncompatibleLicensorCommercialPolicy",
1589
+ type: "error"
1590
+ }, {
1591
+ inputs: [],
1592
+ name: "LicensingModule__IncompatibleLicensorRoyaltyDerivativeRevShare",
1593
+ type: "error"
1594
+ }, {
1595
+ inputs: [],
1596
+ name: "LicensingModule__IncompatibleRoyaltyPolicyAddress",
1597
+ type: "error"
1598
+ }, {
1599
+ inputs: [],
1600
+ name: "LicensingModule__IncompatibleRoyaltyPolicyDerivativeRevShare",
1601
+ type: "error"
1602
+ }, {
1603
+ inputs: [],
1604
+ name: "LicensingModule__InvalidLicensor",
1605
+ type: "error"
1606
+ }, {
1607
+ inputs: [],
1608
+ name: "LicensingModule__InvalidPolicyFramework",
1609
+ type: "error"
1610
+ }, {
1611
+ inputs: [],
1612
+ name: "LicensingModule__LicensorDoesntHaveThisPolicy",
1613
+ type: "error"
1614
+ }, {
1615
+ inputs: [],
1616
+ name: "LicensingModule__LicensorNotRegistered",
1617
+ type: "error"
1618
+ }, {
1619
+ inputs: [],
1620
+ name: "LicensingModule__LinkParentParamFailed",
1621
+ type: "error"
1622
+ }, {
1623
+ inputs: [],
1624
+ name: "LicensingModule__MintLicenseParamFailed",
1625
+ type: "error"
1626
+ }, {
1627
+ inputs: [],
1628
+ name: "LicensingModule__MismatchBetweenCommercialRevenueShareAndMinRoyalty",
1629
+ type: "error"
1630
+ }, {
1631
+ inputs: [],
1632
+ name: "LicensingModule__MismatchBetweenRoyaltyPolicy",
1633
+ type: "error"
1634
+ }, {
1635
+ inputs: [],
1636
+ name: "LicensingModule__NotLicensee",
1637
+ type: "error"
1638
+ }, {
1639
+ inputs: [],
1640
+ name: "LicensingModule__ParamVerifierAlreadySet",
1641
+ type: "error"
1642
+ }, {
1643
+ inputs: [],
1644
+ name: "LicensingModule__ParamVerifierLengthMismatch",
1645
+ type: "error"
1646
+ }, {
1647
+ inputs: [],
1648
+ name: "LicensingModule__ParentIdEqualThanChild",
1649
+ type: "error"
1650
+ }, {
1651
+ inputs: [],
1652
+ name: "LicensingModule__PolicyAlreadySetForIpId",
1653
+ type: "error"
1654
+ }, {
1655
+ inputs: [],
1656
+ name: "LicensingModule__PolicyNotFound",
1657
+ type: "error"
1658
+ }, {
1659
+ inputs: [],
1660
+ name: "LicensingModule__TransferParamFailed",
1661
+ type: "error"
1662
+ }, {
1663
+ inputs: [],
1664
+ name: "LicensingModule__UnauthorizedAccess",
1665
+ type: "error"
1666
+ }, {
1667
+ inputs: [],
1668
+ name: "LicensingModule__UnregisteredFrameworkAddingPolicy",
1669
+ type: "error"
1670
+ }, {
1671
+ inputs: [],
1672
+ name: "LicensorApprovalChecker__Unauthorized",
1673
+ type: "error"
1674
+ }, {
1675
+ inputs: [],
1676
+ name: "MetadataProvider__HashInvalid",
1677
+ type: "error"
1678
+ }, {
1679
+ inputs: [],
1680
+ name: "MetadataProvider__IPAssetOwnerInvalid",
1681
+ type: "error"
1682
+ }, {
1683
+ inputs: [],
1684
+ name: "MetadataProvider__MetadataNotCompatible",
1685
+ type: "error"
1686
+ }, {
1687
+ inputs: [],
1688
+ name: "MetadataProvider__NameInvalid",
1689
+ type: "error"
1690
+ }, {
1691
+ inputs: [],
1692
+ name: "MetadataProvider__RegistrantInvalid",
1693
+ type: "error"
1694
+ }, {
1695
+ inputs: [],
1696
+ name: "MetadataProvider__RegistrationDateInvalid",
1697
+ type: "error"
1698
+ }, {
1699
+ inputs: [],
1700
+ name: "MetadataProvider__URIInvalid",
1701
+ type: "error"
1702
+ }, {
1703
+ inputs: [],
1704
+ name: "MetadataProvider__Unauthorized",
1705
+ type: "error"
1706
+ }, {
1707
+ inputs: [],
1708
+ name: "MetadataProvider__UpgradeProviderInvalid",
1709
+ type: "error"
1710
+ }, {
1711
+ inputs: [],
1712
+ name: "MetadataProvider__UpgradeUnavailable",
1713
+ type: "error"
1714
+ }, {
1715
+ inputs: [],
1716
+ name: "ModuleRegistry__ModuleAddressNotContract",
1717
+ type: "error"
1718
+ }, {
1719
+ inputs: [],
1720
+ name: "ModuleRegistry__ModuleAddressZeroAddress",
1721
+ type: "error"
1722
+ }, {
1723
+ inputs: [],
1724
+ name: "ModuleRegistry__ModuleAlreadyRegistered",
1725
+ type: "error"
1726
+ }, {
1727
+ inputs: [],
1728
+ name: "ModuleRegistry__ModuleNotRegistered",
1729
+ type: "error"
1730
+ }, {
1731
+ inputs: [],
1732
+ name: "ModuleRegistry__NameAlreadyRegistered",
1733
+ type: "error"
1734
+ }, {
1735
+ inputs: [],
1736
+ name: "ModuleRegistry__NameDoesNotMatch",
1737
+ type: "error"
1738
+ }, {
1739
+ inputs: [],
1740
+ name: "ModuleRegistry__NameEmptyString",
1741
+ type: "error"
1742
+ }, {
1743
+ inputs: [],
1744
+ name: "Module_Unauthorized",
1745
+ type: "error"
1746
+ }, {
1747
+ inputs: [],
1748
+ name: "PolicyFrameworkManager__GettingPolicyWrongFramework",
1749
+ type: "error"
1750
+ }, {
1751
+ inputs: [],
1752
+ name: "RegistrationModule__InvalidOwner",
1753
+ type: "error"
1754
+ }, {
1755
+ inputs: [],
1756
+ name: "RoyaltyModule__AlreadySetRoyaltyPolicy",
1757
+ type: "error"
1758
+ }, {
1759
+ inputs: [],
1760
+ name: "RoyaltyModule__IncompatibleRoyaltyPolicy",
1761
+ type: "error"
1762
+ }, {
1763
+ inputs: [],
1764
+ name: "RoyaltyModule__NoRoyaltyPolicySet",
1765
+ type: "error"
1766
+ }, {
1767
+ inputs: [],
1768
+ name: "RoyaltyModule__NotAllowedCaller",
1769
+ type: "error"
1770
+ }, {
1771
+ inputs: [],
1772
+ name: "RoyaltyModule__NotWhitelistedRoyaltyPolicy",
1773
+ type: "error"
1774
+ }, {
1775
+ inputs: [],
1776
+ name: "RoyaltyModule__NotWhitelistedRoyaltyToken",
1777
+ type: "error"
1778
+ }, {
1779
+ inputs: [],
1780
+ name: "RoyaltyModule__ZeroLicensingModule",
1781
+ type: "error"
1782
+ }, {
1783
+ inputs: [],
1784
+ name: "RoyaltyModule__ZeroRoyaltyPolicy",
1785
+ type: "error"
1786
+ }, {
1787
+ inputs: [],
1788
+ name: "RoyaltyModule__ZeroRoyaltyToken",
1789
+ type: "error"
1790
+ }, {
1791
+ inputs: [],
1792
+ name: "RoyaltyPolicyLS__InvalidMinRoyalty",
1793
+ type: "error"
1794
+ }, {
1795
+ inputs: [],
1796
+ name: "RoyaltyPolicyLS__InvalidRoyaltyStack",
1797
+ type: "error"
1798
+ }, {
1799
+ inputs: [],
1800
+ name: "RoyaltyPolicyLS__NotRoyaltyModule",
1801
+ type: "error"
1802
+ }, {
1803
+ inputs: [],
1804
+ name: "RoyaltyPolicyLS__TransferFailed",
1805
+ type: "error"
1806
+ }, {
1807
+ inputs: [],
1808
+ name: "RoyaltyPolicyLS__ZeroLicensingModule",
1809
+ type: "error"
1810
+ }, {
1811
+ inputs: [],
1812
+ name: "RoyaltyPolicyLS__ZeroLiquidSplitFactory",
1813
+ type: "error"
1814
+ }, {
1815
+ inputs: [],
1816
+ name: "RoyaltyPolicyLS__ZeroLiquidSplitMain",
1817
+ type: "error"
1818
+ }, {
1819
+ inputs: [],
1820
+ name: "RoyaltyPolicyLS__ZeroMinRoyalty",
1821
+ type: "error"
1822
+ }, {
1823
+ inputs: [],
1824
+ name: "RoyaltyPolicyLS__ZeroRoyaltyModule",
1825
+ type: "error"
1826
+ }, {
1827
+ inputs: [],
1828
+ name: "TaggingModule__DstIpIdDoesNotHaveDstTag",
1829
+ type: "error"
1830
+ }, {
1831
+ inputs: [],
1832
+ name: "TaggingModule__InvalidRelationTypeName",
1833
+ type: "error"
1834
+ }, {
1835
+ inputs: [],
1836
+ name: "TaggingModule__RelationTypeAlreadyExists",
1837
+ type: "error"
1838
+ }, {
1839
+ inputs: [],
1840
+ name: "TaggingModule__RelationTypeDoesNotExist",
1841
+ type: "error"
1842
+ }, {
1843
+ inputs: [],
1844
+ name: "TaggingModule__SrcIpIdDoesNotHaveSrcTag",
1845
+ type: "error"
1846
+ }];
1847
+
1848
+ if (typeof process !== "undefined") {
1849
+ dotenv.config();
1850
+ }
1851
+ var IPAccountABI = [].concat(_toConsumableArray(IPAccountImplABI), _toConsumableArray(ErrorsABI));
1852
+ var IPAssetRegistryConfig = {
1853
+ abi: IPAssetRegistryABI,
1854
+ address: getAddress("0xF2c66aAd2287F3fa00C3461862612Eaf1FAAEcDb")
1855
+ };
1856
+ var AccessControllerConfig = {
1857
+ abi: [].concat(_toConsumableArray(AccessControllerABI), _toConsumableArray(ErrorsABI)),
1858
+ address: getAddress("0x069AD174fb6285086b692AC9a6f328DCBcB94FC3")
1859
+ };
1860
+ var DisputeModuleConfig = {
1861
+ abi: [].concat(_toConsumableArray(DisputeModuleABI), _toConsumableArray(ErrorsABI)),
1862
+ address: getAddress("0x0B935d36516267fc2B4c902449b7D5Cfc2d5102A")
1863
+ };
1864
+ var LicenseRegistryConfig = {
1865
+ abi: IERC1155ABI,
1866
+ address: getAddress("0x051A0441918d7c393ba796dc6754c476324dAdEC")
1867
+ };
1868
+ var LicensingModuleConfig = {
1869
+ abi: [].concat(_toConsumableArray(LicensingModuleABI), _toConsumableArray(ErrorsABI)),
1870
+ address: getAddress("0x911415eb87b732443e8FbAd8aC8890Bf73BAa8Ec")
1871
+ };
1872
+ var RegistrationModuleConfig = {
1873
+ abi: [].concat(_toConsumableArray(RegistrationModuleABI), _toConsumableArray(ErrorsABI)),
1874
+ address: getAddress("0x1Ad58168Ae7914C3e8aA8c6F5068CFb23490F27F")
1875
+ };
1876
+ var TaggingModuleConfig = {
1877
+ abi: [].concat(_toConsumableArray(TaggingModuleABI), _toConsumableArray(ErrorsABI)),
1878
+ address: getAddress("0x333BECf0FF68C02E4387005A89c30De885b8a38F")
1879
+ };
1880
+ var UMLPolicyFrameworkManagerConfig = {
1881
+ abi: [].concat(_toConsumableArray(UMLPolicyFrameworkManagerABI), _toConsumableArray(ErrorsABI)),
1882
+ address: getAddress("0xae4De58808EB503E9C460C7A852c67C3152D5385")
1883
+ };
1884
+
1885
+ function _createForOfIteratorHelper(o, allowArrayLike) {
1886
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
1887
+ if (!it) {
1888
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
1889
+ if (it) o = it;
1890
+ var i = 0;
1891
+ var F = function () {};
1892
+ return {
1893
+ s: F,
1894
+ n: function () {
1895
+ if (i >= o.length) return {
1896
+ done: true
1897
+ };
1898
+ return {
1899
+ done: false,
1900
+ value: o[i++]
1901
+ };
1902
+ },
1903
+ e: function (e) {
1904
+ throw e;
1905
+ },
1906
+ f: F
1907
+ };
1908
+ }
1909
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1910
+ }
1911
+ var normalCompletion = true,
1912
+ didErr = false,
1913
+ err;
1914
+ return {
1915
+ s: function () {
1916
+ it = it.call(o);
1917
+ },
1918
+ n: function () {
1919
+ var step = it.next();
1920
+ normalCompletion = step.done;
1921
+ return step;
1922
+ },
1923
+ e: function (e) {
1924
+ didErr = true;
1925
+ err = e;
1926
+ },
1927
+ f: function () {
1928
+ try {
1929
+ if (!normalCompletion && it.return != null) it.return();
1930
+ } finally {
1931
+ if (didErr) throw err;
1932
+ }
1933
+ }
1934
+ };
1935
+ }
1936
+
1937
+ function parseToBigInt(num) {
1938
+ return BigInt(num);
1939
+ }
1940
+ function waitTxAndFilterLog(_x, _x2, _x3) {
1941
+ return _waitTxAndFilterLog.apply(this, arguments);
1942
+ }
1943
+ function _waitTxAndFilterLog() {
1944
+ _waitTxAndFilterLog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(client, txHash, params) {
1945
+ var txReceipt, _iterator, _step, log;
1946
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1947
+ while (1) switch (_context.prev = _context.next) {
1948
+ case 0:
1949
+ _context.next = 2;
1950
+ return client.waitForTransactionReceipt({
1951
+ hash: txHash,
1952
+ confirmations: params.confirmations,
1953
+ pollingInterval: params.pollingInterval,
1954
+ timeout: params.timeout
1955
+ });
1956
+ case 2:
1957
+ txReceipt = _context.sent;
1958
+ _iterator = _createForOfIteratorHelper(txReceipt.logs);
1959
+ _context.prev = 4;
1960
+ _iterator.s();
1961
+ case 6:
1962
+ if ((_step = _iterator.n()).done) {
1963
+ _context.next = 17;
1964
+ break;
1965
+ }
1966
+ log = _step.value;
1967
+ _context.prev = 8;
1968
+ return _context.abrupt("return", decodeEventLog({
1969
+ abi: params.abi,
1970
+ eventName: params.eventName,
1971
+ data: log.data,
1972
+ topics: log.topics
1973
+ }));
1974
+ case 12:
1975
+ _context.prev = 12;
1976
+ _context.t0 = _context["catch"](8);
1977
+ return _context.abrupt("continue", 15);
1978
+ case 15:
1979
+ _context.next = 6;
1980
+ break;
1981
+ case 17:
1982
+ _context.next = 22;
1983
+ break;
1984
+ case 19:
1985
+ _context.prev = 19;
1986
+ _context.t1 = _context["catch"](4);
1987
+ _iterator.e(_context.t1);
1988
+ case 22:
1989
+ _context.prev = 22;
1990
+ _iterator.f();
1991
+ return _context.finish(22);
1992
+ case 25:
1993
+ throw new Error("not found event ".concat(params.eventName, " in target transaction"));
1994
+ case 26:
1995
+ case "end":
1996
+ return _context.stop();
1997
+ }
1998
+ }, _callee, null, [[4, 19, 22, 25], [8, 12]]);
1999
+ }));
2000
+ return _waitTxAndFilterLog.apply(this, arguments);
2001
+ }
2002
+ function waitTx(_x4, _x5, _x6) {
2003
+ return _waitTx.apply(this, arguments);
2004
+ }
2005
+ function _waitTx() {
2006
+ _waitTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(client, txHash, params) {
2007
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2008
+ while (1) switch (_context2.prev = _context2.next) {
2009
+ case 0:
2010
+ _context2.next = 2;
2011
+ return client.waitForTransactionReceipt(_objectSpread2({
2012
+ hash: txHash
2013
+ }, params));
2014
+ case 2:
2015
+ case "end":
2016
+ return _context2.stop();
2017
+ }
2018
+ }, _callee2);
2019
+ }));
2020
+ return _waitTx.apply(this, arguments);
2021
+ }
2022
+ function chainStringToViemChain(chainId) {
2023
+ switch (chainId) {
2024
+ case "1":
2025
+ case "mainnet":
2026
+ return mainnet;
2027
+ case "11155111":
2028
+ case "sepolia":
2029
+ return sepolia;
2030
+ case "80001":
2031
+ case "mumbai":
2032
+ case "polygonMumbai":
2033
+ return polygonMumbai;
2034
+ default:
2035
+ throw new Error("chainId ".concat(chainId, " not supported"));
2036
+ }
1156
2037
  }
1157
2038
 
1158
- function _createForOfIteratorHelper(o, allowArrayLike) {
1159
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
1160
- if (!it) {
1161
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
1162
- if (it) o = it;
1163
- var i = 0;
1164
- var F = function () {};
1165
- return {
1166
- s: F,
1167
- n: function () {
1168
- if (i >= o.length) return {
1169
- done: true
1170
- };
1171
- return {
1172
- done: false,
1173
- value: o[i++]
1174
- };
1175
- },
1176
- e: function (e) {
1177
- throw e;
1178
- },
1179
- f: F
1180
- };
1181
- }
1182
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2039
+ var TaggingClient = /*#__PURE__*/function () {
2040
+ function TaggingClient(rpcClient, wallet) {
2041
+ _classCallCheck(this, TaggingClient);
2042
+ this.rpcClient = rpcClient;
2043
+ this.wallet = wallet;
2044
+ }
2045
+ _createClass(TaggingClient, [{
2046
+ key: "setTag",
2047
+ value: function () {
2048
+ var _setTag = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2049
+ var _request$txOptions, _yield$this$rpcClient, call, txHash;
2050
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2051
+ while (1) switch (_context.prev = _context.next) {
2052
+ case 0:
2053
+ _context.prev = 0;
2054
+ _context.next = 3;
2055
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, TaggingModuleConfig), {}, {
2056
+ functionName: "setTag",
2057
+ args: [request.tag, request.ipId]
2058
+ }));
2059
+ case 3:
2060
+ _yield$this$rpcClient = _context.sent;
2061
+ call = _yield$this$rpcClient.request;
2062
+ _context.next = 7;
2063
+ return this.wallet.writeContract(call);
2064
+ case 7:
2065
+ txHash = _context.sent;
2066
+ if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
2067
+ _context.next = 11;
2068
+ break;
2069
+ }
2070
+ _context.next = 11;
2071
+ return waitTx(this.rpcClient, txHash);
2072
+ case 11:
2073
+ return _context.abrupt("return", {
2074
+ txHash: txHash
2075
+ });
2076
+ case 14:
2077
+ _context.prev = 14;
2078
+ _context.t0 = _context["catch"](0);
2079
+ handleError(_context.t0, "Failed to set tag");
2080
+ case 17:
2081
+ case "end":
2082
+ return _context.stop();
2083
+ }
2084
+ }, _callee, this, [[0, 14]]);
2085
+ }));
2086
+ function setTag(_x) {
2087
+ return _setTag.apply(this, arguments);
2088
+ }
2089
+ return setTag;
2090
+ }()
2091
+ }, {
2092
+ key: "removeTag",
2093
+ value: function () {
2094
+ var _removeTag = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
2095
+ var _request$txOptions2, _yield$this$rpcClient2, call, txHash;
2096
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2097
+ while (1) switch (_context2.prev = _context2.next) {
2098
+ case 0:
2099
+ _context2.prev = 0;
2100
+ _context2.next = 3;
2101
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, TaggingModuleConfig), {}, {
2102
+ functionName: "removeTag",
2103
+ args: [request.tag, request.ipId]
2104
+ }));
2105
+ case 3:
2106
+ _yield$this$rpcClient2 = _context2.sent;
2107
+ call = _yield$this$rpcClient2.request;
2108
+ _context2.next = 7;
2109
+ return this.wallet.writeContract(call);
2110
+ case 7:
2111
+ txHash = _context2.sent;
2112
+ if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
2113
+ _context2.next = 11;
2114
+ break;
2115
+ }
2116
+ _context2.next = 11;
2117
+ return waitTx(this.rpcClient, txHash);
2118
+ case 11:
2119
+ return _context2.abrupt("return", {
2120
+ txHash: txHash
2121
+ });
2122
+ case 14:
2123
+ _context2.prev = 14;
2124
+ _context2.t0 = _context2["catch"](0);
2125
+ handleError(_context2.t0, "Failed to remove tag");
2126
+ case 17:
2127
+ case "end":
2128
+ return _context2.stop();
2129
+ }
2130
+ }, _callee2, this, [[0, 14]]);
2131
+ }));
2132
+ function removeTag(_x2) {
2133
+ return _removeTag.apply(this, arguments);
2134
+ }
2135
+ return removeTag;
2136
+ }()
2137
+ }]);
2138
+ return TaggingClient;
2139
+ }();
2140
+
2141
+ var AddressZero = "0x0000000000000000000000000000000000000000";
2142
+ var HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
2143
+
2144
+ var IPAssetClient = /*#__PURE__*/function () {
2145
+ function IPAssetClient(rpcClient, wallet) {
2146
+ _classCallCheck(this, IPAssetClient);
2147
+ this.wallet = wallet;
2148
+ this.rpcClient = rpcClient;
2149
+ }
2150
+
2151
+ /**
2152
+ * Register a root IP on Story Protocol based on the specified input asset data.
2153
+ *
2154
+ * @param request - the request object that contains all data needed to register a root IP.
2155
+ * @returns the response object that contains results from the IP creation.
2156
+ */
2157
+ _createClass(IPAssetClient, [{
2158
+ key: "registerRootIp",
2159
+ value: function () {
2160
+ var _registerRootIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2161
+ var _request$txOptions, _yield$this$rpcClient, call, txHash, targetLog;
2162
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2163
+ while (1) switch (_context.prev = _context.next) {
2164
+ case 0:
2165
+ _context.prev = 0;
2166
+ _context.next = 3;
2167
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, RegistrationModuleConfig), {}, {
2168
+ functionName: "registerRootIp",
2169
+ args: [parseToBigInt(request.policyId), getAddress(request.tokenContractAddress),
2170
+ // 0x Address
2171
+ parseToBigInt(request.tokenId), request.ipName || "", request.contentHash || HashZero, request.uri || ""],
2172
+ account: this.wallet.account
2173
+ }));
2174
+ case 3:
2175
+ _yield$this$rpcClient = _context.sent;
2176
+ call = _yield$this$rpcClient.request;
2177
+ _context.next = 7;
2178
+ return this.wallet.writeContract(call);
2179
+ case 7:
2180
+ txHash = _context.sent;
2181
+ if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
2182
+ _context.next = 15;
2183
+ break;
2184
+ }
2185
+ _context.next = 11;
2186
+ return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, IPAssetRegistryConfig), {}, {
2187
+ eventName: "IPRegistered"
2188
+ }));
2189
+ case 11:
2190
+ targetLog = _context.sent;
2191
+ return _context.abrupt("return", {
2192
+ txHash: txHash,
2193
+ ipId: targetLog.args.ipId
2194
+ });
2195
+ case 15:
2196
+ return _context.abrupt("return", {
2197
+ txHash: txHash
2198
+ });
2199
+ case 16:
2200
+ _context.next = 21;
2201
+ break;
2202
+ case 18:
2203
+ _context.prev = 18;
2204
+ _context.t0 = _context["catch"](0);
2205
+ handleError(_context.t0, "Failed to register root IP");
2206
+ case 21:
2207
+ case "end":
2208
+ return _context.stop();
2209
+ }
2210
+ }, _callee, this, [[0, 18]]);
2211
+ }));
2212
+ function registerRootIp(_x) {
2213
+ return _registerRootIp.apply(this, arguments);
2214
+ }
2215
+ return registerRootIp;
2216
+ }()
2217
+ /**
2218
+ * Register a derivative IP on Story Protocol based on the specified input asset data.
2219
+ *
2220
+ * @param request - the request object that contains all data needed to register a derivative IP.
2221
+ * @returns the response object that contains results from the IP creation.
2222
+ */
2223
+ }, {
2224
+ key: "registerDerivativeIp",
2225
+ value: function () {
2226
+ var _registerDerivativeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
2227
+ var _request$txOptions2, licenseIds, _yield$this$rpcClient2, call, txHash, targetLog;
2228
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2229
+ while (1) switch (_context2.prev = _context2.next) {
2230
+ case 0:
2231
+ _context2.prev = 0;
2232
+ licenseIds = [];
2233
+ request.licenseIds.forEach(function (licenseId) {
2234
+ licenseIds.push(parseToBigInt(licenseId));
2235
+ });
2236
+ _context2.next = 5;
2237
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, RegistrationModuleConfig), {}, {
2238
+ functionName: "registerDerivativeIp",
2239
+ args: [licenseIds, getAddress(request.tokenContractAddress),
2240
+ // 0x Address
2241
+ parseToBigInt(request.tokenId), request.ipName || "", request.contentHash || HashZero, request.uri || "", request.minRoyalty || 0],
2242
+ account: this.wallet.account
2243
+ }));
2244
+ case 5:
2245
+ _yield$this$rpcClient2 = _context2.sent;
2246
+ call = _yield$this$rpcClient2.request;
2247
+ _context2.next = 9;
2248
+ return this.wallet.writeContract(call);
2249
+ case 9:
2250
+ txHash = _context2.sent;
2251
+ if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
2252
+ _context2.next = 17;
2253
+ break;
2254
+ }
2255
+ _context2.next = 13;
2256
+ return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, IPAssetRegistryConfig), {}, {
2257
+ eventName: "IPRegistered"
2258
+ }));
2259
+ case 13:
2260
+ targetLog = _context2.sent;
2261
+ return _context2.abrupt("return", {
2262
+ txHash: txHash,
2263
+ ipId: targetLog.args.ipId
2264
+ });
2265
+ case 17:
2266
+ return _context2.abrupt("return", {
2267
+ txHash: txHash
2268
+ });
2269
+ case 18:
2270
+ _context2.next = 23;
2271
+ break;
2272
+ case 20:
2273
+ _context2.prev = 20;
2274
+ _context2.t0 = _context2["catch"](0);
2275
+ handleError(_context2.t0, "Failed to register derivative IP");
2276
+ case 23:
2277
+ case "end":
2278
+ return _context2.stop();
2279
+ }
2280
+ }, _callee2, this, [[0, 20]]);
2281
+ }));
2282
+ function registerDerivativeIp(_x2) {
2283
+ return _registerDerivativeIp.apply(this, arguments);
2284
+ }
2285
+ return registerDerivativeIp;
2286
+ }()
2287
+ }]);
2288
+ return IPAssetClient;
2289
+ }();
2290
+
2291
+ var PermissionClient = /*#__PURE__*/function () {
2292
+ function PermissionClient(rpcClient, wallet) {
2293
+ _classCallCheck(this, PermissionClient);
2294
+ this.rpcClient = rpcClient;
2295
+ this.wallet = wallet;
1183
2296
  }
1184
- var normalCompletion = true,
1185
- didErr = false,
1186
- err;
1187
- return {
1188
- s: function () {
1189
- it = it.call(o);
1190
- },
1191
- n: function () {
1192
- var step = it.next();
1193
- normalCompletion = step.done;
1194
- return step;
1195
- },
1196
- e: function (e) {
1197
- didErr = true;
1198
- err = e;
1199
- },
1200
- f: function () {
1201
- try {
1202
- if (!normalCompletion && it.return != null) it.return();
1203
- } finally {
1204
- if (didErr) throw err;
1205
- }
1206
- }
1207
- };
1208
- }
1209
2297
 
1210
- function parseToBigInt(num) {
1211
- return BigInt(num);
1212
- }
1213
- function waitTxAndFilterLog(_x, _x2, _x3) {
1214
- return _waitTxAndFilterLog.apply(this, arguments);
1215
- }
1216
- function _waitTxAndFilterLog() {
1217
- _waitTxAndFilterLog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(client, txHash, params) {
1218
- var txReceipt, _iterator, _step, log;
1219
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1220
- while (1) switch (_context.prev = _context.next) {
1221
- case 0:
1222
- _context.next = 2;
1223
- return client.waitForTransactionReceipt({
1224
- hash: txHash,
1225
- confirmations: params.confirmations,
1226
- pollingInterval: params.pollingInterval,
1227
- timeout: params.timeout
1228
- });
1229
- case 2:
1230
- txReceipt = _context.sent;
1231
- _iterator = _createForOfIteratorHelper(txReceipt.logs);
1232
- _context.prev = 4;
1233
- _iterator.s();
1234
- case 6:
1235
- if ((_step = _iterator.n()).done) {
1236
- _context.next = 17;
1237
- break;
2298
+ /**
2299
+ * Set Permission based on the specified input
2300
+ *
2301
+ * @param request - the request object that contains all data needed to set permission.
2302
+ * @returns the response object that contains results from the set permission.
2303
+ */
2304
+ _createClass(PermissionClient, [{
2305
+ key: "setPermission",
2306
+ value: function () {
2307
+ var _setPermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2308
+ var _request$txOptions, IPAccountConfig, _yield$this$rpcClient, call, txHash;
2309
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2310
+ while (1) switch (_context.prev = _context.next) {
2311
+ case 0:
2312
+ _context.prev = 0;
2313
+ IPAccountConfig = {
2314
+ abi: IPAccountABI,
2315
+ address: getAddress(request.ipAsset)
2316
+ };
2317
+ _context.next = 4;
2318
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, IPAccountConfig), {}, {
2319
+ functionName: "execute",
2320
+ args: [AccessControllerConfig.address, parseToBigInt(0), encodeFunctionData({
2321
+ abi: AccessControllerConfig.abi,
2322
+ functionName: "setPermission",
2323
+ args: [getAddress(request.ipAsset),
2324
+ // 0x Address
2325
+ getAddress(request.signer),
2326
+ // 0x Address
2327
+ getAddress(request.to),
2328
+ // 0x Address
2329
+ request.func,
2330
+ // bytes4
2331
+ request.permission // uint8
2332
+ ]
2333
+ })],
2334
+
2335
+ account: this.wallet.account
2336
+ }));
2337
+ case 4:
2338
+ _yield$this$rpcClient = _context.sent;
2339
+ call = _yield$this$rpcClient.request;
2340
+ _context.next = 8;
2341
+ return this.wallet.writeContract(call);
2342
+ case 8:
2343
+ txHash = _context.sent;
2344
+ if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
2345
+ _context.next = 15;
2346
+ break;
2347
+ }
2348
+ _context.next = 12;
2349
+ return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, AccessControllerConfig), {}, {
2350
+ eventName: "PermissionSet"
2351
+ }));
2352
+ case 12:
2353
+ return _context.abrupt("return", {
2354
+ txHash: txHash,
2355
+ success: true
2356
+ });
2357
+ case 15:
2358
+ return _context.abrupt("return", {
2359
+ txHash: txHash
2360
+ });
2361
+ case 16:
2362
+ _context.next = 21;
2363
+ break;
2364
+ case 18:
2365
+ _context.prev = 18;
2366
+ _context.t0 = _context["catch"](0);
2367
+ handleError(_context.t0, "Failed to set permissions");
2368
+ case 21:
2369
+ case "end":
2370
+ return _context.stop();
1238
2371
  }
1239
- log = _step.value;
1240
- _context.prev = 8;
1241
- return _context.abrupt("return", decodeEventLog({
1242
- abi: params.abi,
1243
- eventName: params.eventName,
1244
- data: log.data,
1245
- topics: log.topics
1246
- }));
1247
- case 12:
1248
- _context.prev = 12;
1249
- _context.t0 = _context["catch"](8);
1250
- return _context.abrupt("continue", 15);
1251
- case 15:
1252
- _context.next = 6;
1253
- break;
1254
- case 17:
1255
- _context.next = 22;
1256
- break;
1257
- case 19:
1258
- _context.prev = 19;
1259
- _context.t1 = _context["catch"](4);
1260
- _iterator.e(_context.t1);
1261
- case 22:
1262
- _context.prev = 22;
1263
- _iterator.f();
1264
- return _context.finish(22);
1265
- case 25:
1266
- throw new Error("not found event ".concat(params.eventName, " in target transaction"));
1267
- case 26:
1268
- case "end":
1269
- return _context.stop();
2372
+ }, _callee, this, [[0, 18]]);
2373
+ }));
2374
+ function setPermission(_x) {
2375
+ return _setPermission.apply(this, arguments);
2376
+ }
2377
+ return setPermission;
2378
+ }()
2379
+ }]);
2380
+ return PermissionClient;
2381
+ }();
2382
+
2383
+ var LicenseClient = /*#__PURE__*/function () {
2384
+ function LicenseClient(rpcClient, wallet) {
2385
+ _classCallCheck(this, LicenseClient);
2386
+ this.wallet = wallet;
2387
+ this.rpcClient = rpcClient;
2388
+ }
2389
+ _createClass(LicenseClient, [{
2390
+ key: "mintLicense",
2391
+ value: function () {
2392
+ var _mintLicense = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2393
+ var _request$txOptions, IPAccountConfig, _yield$this$rpcClient, call, txHash, targetLog;
2394
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2395
+ while (1) switch (_context.prev = _context.next) {
2396
+ case 0:
2397
+ _context.prev = 0;
2398
+ IPAccountConfig = {
2399
+ abi: IPAccountABI,
2400
+ address: getAddress(request.licensorIpId)
2401
+ };
2402
+ _context.next = 4;
2403
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, IPAccountConfig), {}, {
2404
+ functionName: "execute",
2405
+ args: [LicensingModuleConfig.address, parseToBigInt(0), encodeFunctionData({
2406
+ abi: LicensingModuleConfig.abi,
2407
+ functionName: "mintLicense",
2408
+ args: [parseToBigInt(request.policyId), request.licensorIpId, parseToBigInt(request.mintAmount), getAddress(request.receiverAddress)]
2409
+ })],
2410
+ account: this.wallet.account
2411
+ }));
2412
+ case 4:
2413
+ _yield$this$rpcClient = _context.sent;
2414
+ call = _yield$this$rpcClient.request;
2415
+ _context.next = 8;
2416
+ return this.wallet.writeContract(call);
2417
+ case 8:
2418
+ txHash = _context.sent;
2419
+ if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
2420
+ _context.next = 16;
2421
+ break;
2422
+ }
2423
+ _context.next = 12;
2424
+ return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, LicenseRegistryConfig), {}, {
2425
+ eventName: "TransferSingle"
2426
+ }));
2427
+ case 12:
2428
+ targetLog = _context.sent;
2429
+ return _context.abrupt("return", {
2430
+ txHash: txHash,
2431
+ licenseId: targetLog.args.id.toString()
2432
+ });
2433
+ case 16:
2434
+ return _context.abrupt("return", {
2435
+ txHash: txHash
2436
+ });
2437
+ case 17:
2438
+ _context.next = 22;
2439
+ break;
2440
+ case 19:
2441
+ _context.prev = 19;
2442
+ _context.t0 = _context["catch"](0);
2443
+ handleError(_context.t0, "Failed to mint license");
2444
+ case 22:
2445
+ case "end":
2446
+ return _context.stop();
2447
+ }
2448
+ }, _callee, this, [[0, 19]]);
2449
+ }));
2450
+ function mintLicense(_x) {
2451
+ return _mintLicense.apply(this, arguments);
1270
2452
  }
1271
- }, _callee, null, [[4, 19, 22, 25], [8, 12]]);
1272
- }));
1273
- return _waitTxAndFilterLog.apply(this, arguments);
1274
- }
1275
-
1276
- function _arrayWithoutHoles(arr) {
1277
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
1278
- }
1279
-
1280
- function _iterableToArray(iter) {
1281
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1282
- }
1283
-
1284
- function _nonIterableSpread() {
1285
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1286
- }
1287
-
1288
- function _toConsumableArray(arr) {
1289
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
1290
- }
1291
-
1292
- var RegistrationModuleABI = [{
1293
- inputs: [{
1294
- internalType: "uint256",
1295
- name: "licenseId",
1296
- type: "uint256"
1297
- }, {
1298
- internalType: "address",
1299
- name: "tokenContract",
1300
- type: "address"
1301
- }, {
1302
- internalType: "uint256",
1303
- name: "tokenId",
1304
- type: "uint256"
1305
- }, {
1306
- internalType: "string",
1307
- name: "ipName",
1308
- type: "string"
1309
- }, {
1310
- internalType: "string",
1311
- name: "ipDescription",
1312
- type: "string"
1313
- }, {
1314
- internalType: "bytes32",
1315
- name: "contentHash",
1316
- type: "bytes32"
1317
- }],
1318
- name: "registerDerivativeIp",
1319
- outputs: [],
1320
- stateMutability: "nonpayable",
1321
- type: "function"
1322
- }, {
1323
- inputs: [{
1324
- internalType: "uint256",
1325
- name: "policyId",
1326
- type: "uint256"
1327
- }, {
1328
- internalType: "address",
1329
- name: "tokenContract",
1330
- type: "address"
2453
+ return mintLicense;
2454
+ }()
1331
2455
  }, {
1332
- internalType: "uint256",
1333
- name: "tokenId",
1334
- type: "uint256"
1335
- }],
1336
- name: "registerRootIp",
1337
- outputs: [{
1338
- internalType: "address",
1339
- name: "",
1340
- type: "address"
1341
- }],
1342
- stateMutability: "nonpayable",
1343
- type: "function"
1344
- }];
1345
-
1346
- var errorsJson = [
1347
- {
1348
- inputs: [
1349
- ],
1350
- name: "AccessController__CallerIsNotIPAccount",
1351
- type: "error"
1352
- },
1353
- {
1354
- inputs: [
1355
- ],
1356
- name: "AccessController__IPAccountIsNotValid",
1357
- type: "error"
1358
- },
1359
- {
1360
- inputs: [
1361
- ],
1362
- name: "AccessController__IPAccountIsZeroAddress",
1363
- type: "error"
1364
- },
1365
- {
1366
- inputs: [
1367
- ],
1368
- name: "AccessController__PermissionIsNotValid",
1369
- type: "error"
1370
- },
1371
- {
1372
- inputs: [
1373
- ],
1374
- name: "AccessController__SignerIsZeroAddress",
1375
- type: "error"
1376
- },
1377
- {
1378
- inputs: [
1379
- ],
1380
- name: "ArbitrationPolicySP__NotDisputeModule",
1381
- type: "error"
1382
- },
1383
- {
1384
- inputs: [
1385
- ],
1386
- name: "ArbitrationPolicySP__ZeroDisputeModule",
1387
- type: "error"
1388
- },
1389
- {
1390
- inputs: [
1391
- ],
1392
- name: "ArbitrationPolicySP__ZeroPaymentToken",
1393
- type: "error"
1394
- },
1395
- {
1396
- inputs: [
1397
- ],
1398
- name: "DisputeModule__NotDisputeInitiator",
1399
- type: "error"
1400
- },
1401
- {
1402
- inputs: [
1403
- ],
1404
- name: "DisputeModule__NotWhitelistedArbitrationPolicy",
1405
- type: "error"
1406
- },
1407
- {
1408
- inputs: [
1409
- ],
1410
- name: "DisputeModule__NotWhitelistedArbitrationRelayer",
1411
- type: "error"
1412
- },
1413
- {
1414
- inputs: [
1415
- ],
1416
- name: "DisputeModule__NotWhitelistedDisputeTag",
1417
- type: "error"
1418
- },
1419
- {
1420
- inputs: [
1421
- ],
1422
- name: "DisputeModule__ZeroArbitrationPolicy",
1423
- type: "error"
1424
- },
1425
- {
1426
- inputs: [
1427
- ],
1428
- name: "DisputeModule__ZeroArbitrationRelayer",
1429
- type: "error"
1430
- },
1431
- {
1432
- inputs: [
1433
- ],
1434
- name: "DisputeModule__ZeroDisputeTag",
1435
- type: "error"
1436
- },
1437
- {
1438
- inputs: [
1439
- ],
1440
- name: "DisputeModule__ZeroLinkToDisputeSummary",
1441
- type: "error"
1442
- },
1443
- {
1444
- inputs: [
1445
- ],
1446
- name: "IPRecordRegistry_AlreadyRegistered",
1447
- type: "error"
1448
- },
1449
- {
1450
- inputs: [
1451
- ],
1452
- name: "IPRecordRegistry_IPAccountAlreadyCreated",
1453
- type: "error"
1454
- },
1455
- {
1456
- inputs: [
1457
- ],
1458
- name: "IPRecordRegistry_NotYetRegistered",
1459
- type: "error"
1460
- },
1461
- {
1462
- inputs: [
1463
- ],
1464
- name: "IPRecordRegistry_ResolverInvalid",
1465
- type: "error"
1466
- },
1467
- {
1468
- inputs: [
1469
- ],
1470
- name: "IPRecordRegistry_Unauthorized",
1471
- type: "error"
1472
- },
1473
- {
1474
- inputs: [
1475
- ],
1476
- name: "IPResolver_InvalidIP",
1477
- type: "error"
1478
- },
1479
- {
1480
- inputs: [
1481
- ],
1482
- name: "IPResolver_Unauthorized",
1483
- type: "error"
1484
- },
1485
- {
1486
- inputs: [
1487
- ],
1488
- name: "LicenseRegistry__EmptyLicenseUrl",
1489
- type: "error"
1490
- },
1491
- {
1492
- inputs: [
1493
- ],
1494
- name: "LicenseRegistry__FrameworkNotFound",
1495
- type: "error"
1496
- },
1497
- {
1498
- inputs: [
1499
- ],
1500
- name: "LicenseRegistry__InvalidParamVerifierType",
1501
- type: "error"
1502
- },
1503
- {
1504
- inputs: [
1505
- ],
1506
- name: "LicenseRegistry__LicensorDoesntHaveThisPolicy",
1507
- type: "error"
1508
- },
1509
- {
1510
- inputs: [
1511
- ],
1512
- name: "LicenseRegistry__LinkParentParamFailed",
1513
- type: "error"
1514
- },
1515
- {
1516
- inputs: [
1517
- ],
1518
- name: "LicenseRegistry__MintParamFailed",
1519
- type: "error"
1520
- },
1521
- {
1522
- inputs: [
1523
- ],
1524
- name: "LicenseRegistry__NotLicensee",
1525
- type: "error"
1526
- },
1527
- {
1528
- inputs: [
1529
- ],
1530
- name: "LicenseRegistry__ParamVerifierLengthMismatch",
1531
- type: "error"
1532
- },
1533
- {
1534
- inputs: [
1535
- ],
1536
- name: "LicenseRegistry__ParentIdEqualThanChild",
1537
- type: "error"
1538
- },
1539
- {
1540
- inputs: [
1541
- ],
1542
- name: "LicenseRegistry__PolicyAlreadySetForIpId",
1543
- type: "error"
1544
- },
1545
- {
1546
- inputs: [
1547
- ],
1548
- name: "LicenseRegistry__PolicyNotFound",
1549
- type: "error"
1550
- },
1551
- {
1552
- inputs: [
1553
- ],
1554
- name: "ModuleRegistry__ModuleAddressNotContract",
1555
- type: "error"
1556
- },
1557
- {
1558
- inputs: [
1559
- ],
1560
- name: "ModuleRegistry__ModuleAddressZeroAddress",
1561
- type: "error"
1562
- },
1563
- {
1564
- inputs: [
1565
- ],
1566
- name: "ModuleRegistry__ModuleAlreadyRegistered",
1567
- type: "error"
1568
- },
1569
- {
1570
- inputs: [
1571
- ],
1572
- name: "ModuleRegistry__ModuleNotRegistered",
1573
- type: "error"
1574
- },
1575
- {
1576
- inputs: [
1577
- ],
1578
- name: "ModuleRegistry__NameAlreadyRegistered",
1579
- type: "error"
1580
- },
1581
- {
1582
- inputs: [
1583
- ],
1584
- name: "ModuleRegistry__NameDoesNotMatch",
1585
- type: "error"
1586
- },
1587
- {
1588
- inputs: [
1589
- ],
1590
- name: "ModuleRegistry__NameEmptyString",
1591
- type: "error"
1592
- },
1593
- {
1594
- inputs: [
1595
- ],
1596
- name: "Module_Unauthorized",
1597
- type: "error"
1598
- },
1599
- {
1600
- inputs: [
1601
- ],
1602
- name: "RegistrationModule__InvalidOwner",
1603
- type: "error"
1604
- },
1605
- {
1606
- inputs: [
1607
- ],
1608
- name: "RoyaltyModule__AlreadySetRoyaltyPolicy",
1609
- type: "error"
1610
- },
1611
- {
1612
- inputs: [
1613
- ],
1614
- name: "RoyaltyModule__NotWhitelistedRoyaltyPolicy",
1615
- type: "error"
1616
- },
1617
- {
1618
- inputs: [
1619
- ],
1620
- name: "RoyaltyModule__ZeroRoyaltyPolicy",
1621
- type: "error"
1622
- },
1623
- {
1624
- inputs: [
1625
- ],
1626
- name: "RoyaltyPolicyLS__NotRoyaltyModule",
1627
- type: "error"
1628
- },
1629
- {
1630
- inputs: [
1631
- ],
1632
- name: "RoyaltyPolicyLS__TransferFailed",
1633
- type: "error"
1634
- },
1635
- {
1636
- inputs: [
1637
- ],
1638
- name: "RoyaltyPolicyLS__ZeroLiquidSplitFactory",
1639
- type: "error"
1640
- },
1641
- {
1642
- inputs: [
1643
- ],
1644
- name: "RoyaltyPolicyLS__ZeroLiquidSplitMain",
1645
- type: "error"
1646
- },
1647
- {
1648
- inputs: [
1649
- ],
1650
- name: "RoyaltyPolicyLS__ZeroRoyaltyModule",
1651
- type: "error"
1652
- },
1653
- {
1654
- inputs: [
1655
- ],
1656
- name: "TaggingModule__DstIpIdDoesNotHaveDstTag",
1657
- type: "error"
1658
- },
1659
- {
1660
- inputs: [
1661
- ],
1662
- name: "TaggingModule__InvalidRelationTypeName",
1663
- type: "error"
1664
- },
1665
- {
1666
- inputs: [
1667
- ],
1668
- name: "TaggingModule__RelationTypeAlreadyExists",
1669
- type: "error"
1670
- },
1671
- {
1672
- inputs: [
1673
- ],
1674
- name: "TaggingModule__RelationTypeDoesNotExist",
1675
- type: "error"
1676
- },
1677
- {
1678
- inputs: [
1679
- ],
1680
- name: "TaggingModule__SrcIpIdDoesNotHaveSrcTag",
1681
- type: "error"
1682
- }
1683
- ];
1684
-
1685
- var ErrorsAbi$2 = errorsJson;
1686
- var storyProtocolMerged = [].concat(_toConsumableArray(RegistrationModuleABI), _toConsumableArray(ErrorsAbi$2));
1687
- var RegistrationModuleConfig = {
1688
- abi: storyProtocolMerged,
1689
- address: getAddress(process.env.REGISTRATION_MODULE || process.env.NEXT_PUBLIC_REGISTRATION_MODULE || "")
1690
- };
2456
+ key: "linkIpToParent",
2457
+ value: function () {
2458
+ var _linkIpToParent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
2459
+ var _request$txOptions2, IPAccountConfig, licenseIds, _yield$this$rpcClient2, call, txHash;
2460
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2461
+ while (1) switch (_context2.prev = _context2.next) {
2462
+ case 0:
2463
+ _context2.prev = 0;
2464
+ IPAccountConfig = {
2465
+ abi: IPAccountABI,
2466
+ address: getAddress(request.childIpId)
2467
+ };
2468
+ licenseIds = [];
2469
+ request.licenseIds.forEach(function (licenseId) {
2470
+ licenseIds.push(parseToBigInt(licenseId));
2471
+ });
2472
+ _context2.next = 6;
2473
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, IPAccountConfig), {}, {
2474
+ functionName: "execute",
2475
+ args: [LicensingModuleConfig.address, parseToBigInt(0), encodeFunctionData({
2476
+ abi: LicensingModuleConfig.abi,
2477
+ functionName: "linkIpToParents",
2478
+ args: [licenseIds, getAddress(request.childIpId), request.minRoyalty]
2479
+ })],
2480
+ account: this.wallet.account
2481
+ }));
2482
+ case 6:
2483
+ _yield$this$rpcClient2 = _context2.sent;
2484
+ call = _yield$this$rpcClient2.request;
2485
+ _context2.next = 10;
2486
+ return this.wallet.writeContract(call);
2487
+ case 10:
2488
+ txHash = _context2.sent;
2489
+ if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
2490
+ _context2.next = 17;
2491
+ break;
2492
+ }
2493
+ _context2.next = 14;
2494
+ return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, LicenseRegistryConfig), {}, {
2495
+ eventName: "TransferBatch"
2496
+ }));
2497
+ case 14:
2498
+ return _context2.abrupt("return", {
2499
+ txHash: txHash,
2500
+ success: true
2501
+ });
2502
+ case 17:
2503
+ return _context2.abrupt("return", {
2504
+ txHash: txHash
2505
+ });
2506
+ case 18:
2507
+ _context2.next = 23;
2508
+ break;
2509
+ case 20:
2510
+ _context2.prev = 20;
2511
+ _context2.t0 = _context2["catch"](0);
2512
+ handleError(_context2.t0, "Failed to mint license");
2513
+ case 23:
2514
+ case "end":
2515
+ return _context2.stop();
2516
+ }
2517
+ }, _callee2, this, [[0, 20]]);
2518
+ }));
2519
+ function linkIpToParent(_x2) {
2520
+ return _linkIpToParent.apply(this, arguments);
2521
+ }
2522
+ return linkIpToParent;
2523
+ }()
2524
+ }]);
2525
+ return LicenseClient;
2526
+ }();
1691
2527
 
1692
- var IPAssetClient = /*#__PURE__*/function (_IPAssetReadOnlyClien) {
1693
- _inherits(IPAssetClient, _IPAssetReadOnlyClien);
1694
- var _super = _createSuper(IPAssetClient);
1695
- function IPAssetClient(httpClient, rpcClient, wallet) {
1696
- var _this;
1697
- _classCallCheck(this, IPAssetClient);
1698
- _this = _super.call(this, httpClient, rpcClient);
1699
- _this.wallet = wallet;
1700
- return _this;
2528
+ var PolicyClient = /*#__PURE__*/function () {
2529
+ function PolicyClient(rpcClient, wallet) {
2530
+ _classCallCheck(this, PolicyClient);
2531
+ this.wallet = wallet;
2532
+ this.rpcClient = rpcClient;
1701
2533
  }
1702
2534
 
1703
2535
  /**
1704
- * Register a root IP on Story Protocol based on the specified input asset data.
2536
+ * Create a policy on Story Protocol based on the specified params.
1705
2537
  *
1706
- * @param request - the request object that contains all data needed to register a root IP.
1707
- * @returns the response object that contains results from the IP creation.
2538
+ * @param request - the request object that contains all data needed to register a policy.
2539
+ * @returns the response object that contains results from the policy creation.
1708
2540
  */
1709
- _createClass(IPAssetClient, [{
1710
- key: "registerRootIp",
2541
+ _createClass(PolicyClient, [{
2542
+ key: "registerUMLPolicy",
1711
2543
  value: function () {
1712
- var _registerRootIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2544
+ var _registerUMLPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
1713
2545
  var _request$txOptions, _yield$this$rpcClient, call, txHash, targetLog;
1714
2546
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1715
2547
  while (1) switch (_context.prev = _context.next) {
1716
2548
  case 0:
1717
2549
  _context.prev = 0;
1718
2550
  _context.next = 3;
1719
- return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, RegistrationModuleConfig), {}, {
1720
- functionName: "registerRootIp",
1721
- args: [parseToBigInt(request.policyId), getAddress(request.tokenContractAddress),
1722
- // 0x Address
1723
- parseToBigInt(request.tokenId)],
2551
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, UMLPolicyFrameworkManagerConfig), {}, {
2552
+ functionName: "registerPolicy",
2553
+ args: [{
2554
+ transferable: request.transferable,
2555
+ attribution: request.attribution || false,
2556
+ commercialUse: request.commercialUse || false,
2557
+ commercialAttribution: request.commercialAttribution || false,
2558
+ commercializers: request.commercializers || [],
2559
+ commercialRevShare: request.commercialRevShare || 0,
2560
+ derivativesAllowed: request.derivativesAllowed || false,
2561
+ derivativesAttribution: request.commercialAttribution || false,
2562
+ derivativesApproval: request.derivativesApproval || false,
2563
+ derivativesReciprocal: request.derivativesReciprocal || false,
2564
+ derivativesRevShare: request.derivativesRevShare || 0,
2565
+ territories: request.territories || [],
2566
+ distributionChannels: request.distributionChannels || [],
2567
+ contentRestrictions: request.contentRestrictions || [],
2568
+ royaltyPolicy: request.royaltyPolicy || zeroAddress
2569
+ }],
1724
2570
  account: this.wallet.account
1725
2571
  }));
1726
2572
  case 3:
@@ -1735,14 +2581,14 @@ var IPAssetClient = /*#__PURE__*/function (_IPAssetReadOnlyClien) {
1735
2581
  break;
1736
2582
  }
1737
2583
  _context.next = 11;
1738
- return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, IPAccountRegistryConfig), {}, {
1739
- eventName: "IPAccountRegistered"
2584
+ return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, LicensingModuleConfig), {}, {
2585
+ eventName: "PolicyRegistered"
1740
2586
  }));
1741
2587
  case 11:
1742
2588
  targetLog = _context.sent;
1743
2589
  return _context.abrupt("return", {
1744
2590
  txHash: txHash,
1745
- ipAccountId: targetLog === null || targetLog === void 0 ? void 0 : targetLog.args.account.toString()
2591
+ policyId: targetLog === null || targetLog === void 0 ? void 0 : targetLog.args.policyId.toString()
1746
2592
  });
1747
2593
  case 15:
1748
2594
  return _context.abrupt("return", {
@@ -1754,398 +2600,411 @@ var IPAssetClient = /*#__PURE__*/function (_IPAssetReadOnlyClien) {
1754
2600
  case 18:
1755
2601
  _context.prev = 18;
1756
2602
  _context.t0 = _context["catch"](0);
1757
- handleError(_context.t0, "Failed to register root IP");
2603
+ handleError(_context.t0, "Failed to register policy");
1758
2604
  case 21:
1759
2605
  case "end":
1760
2606
  return _context.stop();
1761
2607
  }
1762
2608
  }, _callee, this, [[0, 18]]);
1763
2609
  }));
1764
- function registerRootIp(_x) {
1765
- return _registerRootIp.apply(this, arguments);
2610
+ function registerUMLPolicy(_x) {
2611
+ return _registerUMLPolicy.apply(this, arguments);
1766
2612
  }
1767
- return registerRootIp;
2613
+ return registerUMLPolicy;
1768
2614
  }()
1769
- /**
1770
- * Register a derivative IP on Story Protocol based on the specified input asset data.
1771
- *
1772
- * @param request - the request object that contains all data needed to register a derivative IP.
1773
- * @returns the response object that contains results from the IP creation.
1774
- */
1775
2615
  }, {
1776
- key: "registerDerivativeIp",
2616
+ key: "addPolicyToIp",
1777
2617
  value: function () {
1778
- var _registerDerivativeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
1779
- var _request$txOptions2, _yield$this$rpcClient2, call, txHash, targetLog;
2618
+ var _addPolicyToIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
2619
+ var _request$txOptions2, IPAccountConfig, _yield$this$rpcClient2, call, txHash, targetLog;
1780
2620
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1781
2621
  while (1) switch (_context2.prev = _context2.next) {
1782
2622
  case 0:
1783
2623
  _context2.prev = 0;
1784
- _context2.next = 3;
1785
- return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, RegistrationModuleConfig), {}, {
1786
- functionName: "registerDerivativeIp",
1787
- args: [parseToBigInt(request.licenseId), getAddress(request.tokenContractAddress),
1788
- // 0x Address
1789
- parseToBigInt(request.tokenId), request.ipName, request.ipDescription, getAddress(request.hash) // Byte32
1790
- ]
2624
+ IPAccountConfig = {
2625
+ abi: IPAccountABI,
2626
+ address: getAddress(request.ipId)
2627
+ };
2628
+ _context2.next = 4;
2629
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, IPAccountConfig), {}, {
2630
+ functionName: "execute",
2631
+ args: [LicensingModuleConfig.address, parseToBigInt(0), encodeFunctionData({
2632
+ abi: LicensingModuleConfig.abi,
2633
+ functionName: "addPolicyToIp",
2634
+ args: [getAddress(request.ipId), parseToBigInt(request.policyId)]
2635
+ })],
2636
+ account: this.wallet.account
1791
2637
  }));
1792
- case 3:
2638
+ case 4:
1793
2639
  _yield$this$rpcClient2 = _context2.sent;
1794
2640
  call = _yield$this$rpcClient2.request;
1795
- _context2.next = 7;
2641
+ _context2.next = 8;
1796
2642
  return this.wallet.writeContract(call);
1797
- case 7:
2643
+ case 8:
1798
2644
  txHash = _context2.sent;
1799
2645
  if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
1800
- _context2.next = 15;
2646
+ _context2.next = 16;
1801
2647
  break;
1802
2648
  }
1803
- _context2.next = 11;
1804
- return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, IPAccountRegistryConfig), {}, {
1805
- eventName: "IPAccountRegistered"
2649
+ _context2.next = 12;
2650
+ return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, LicensingModuleConfig), {}, {
2651
+ eventName: "PolicyAddedToIpId"
1806
2652
  }));
1807
- case 11:
2653
+ case 12:
1808
2654
  targetLog = _context2.sent;
1809
2655
  return _context2.abrupt("return", {
1810
2656
  txHash: txHash,
1811
- ipAccountId: targetLog === null || targetLog === void 0 ? void 0 : targetLog.args.account.toString()
2657
+ index: targetLog.args.index.toString()
1812
2658
  });
1813
- case 15:
2659
+ case 16:
1814
2660
  return _context2.abrupt("return", {
1815
2661
  txHash: txHash
1816
2662
  });
1817
- case 16:
1818
- _context2.next = 21;
2663
+ case 17:
2664
+ _context2.next = 22;
1819
2665
  break;
1820
- case 18:
1821
- _context2.prev = 18;
2666
+ case 19:
2667
+ _context2.prev = 19;
1822
2668
  _context2.t0 = _context2["catch"](0);
1823
- handleError(_context2.t0, "Failed to register derivative IP");
1824
- case 21:
2669
+ handleError(_context2.t0, "Failed to add policy to IP");
2670
+ case 22:
1825
2671
  case "end":
1826
2672
  return _context2.stop();
1827
2673
  }
1828
- }, _callee2, this, [[0, 18]]);
2674
+ }, _callee2, this, [[0, 19]]);
1829
2675
  }));
1830
- function registerDerivativeIp(_x2) {
1831
- return _registerDerivativeIp.apply(this, arguments);
2676
+ function addPolicyToIp(_x2) {
2677
+ return _addPolicyToIp.apply(this, arguments);
1832
2678
  }
1833
- return registerDerivativeIp;
1834
- }() // TODO: move to License resource
1835
- // public async createPolicy(request: addPolicyRequest): Promise<addPolicyResponse> {
1836
- // try {
1837
- // const { request: call } = await this.rpcClient.simulateContract({
1838
- // ...LicenseRegistryConfig,
1839
- // functionName: "addPolicy",
1840
- // args: [
1841
- // {
1842
- // frameworkId: parseToBigInt(request.frameworkId),
1843
- // mintingParamValues: request.mintingParamValues.map((add) => getAddress(add)),
1844
- // activationParamValues: request.activationParamValues.map((add) => getAddress(add)),
1845
- // needsActivation: request.needsActivation,
1846
- // linkParentParamValues: request.linkParentParamValues.map((add) => getAddress(add)),
1847
- // },
1848
- // ], // TODO: add args
1849
- // });
1850
- // const txHash = await this.wallet.writeContract(call);
1851
- // // TODO: need an emitted event
1852
- // // if (request.txOptions?.waitForTransaction) {
1853
- // // const targetLog = await waitTxAndFilterLog(this.rpcClient, txHash, {
1854
- // // ...IPAccountRegistryConfig,
1855
- // // eventName: "IPAccountRegistered",
1856
- // // });
1857
- // // return { txHash: txHash, policyId: targetLog?.args.account.toString() };
1858
- // // } else {
1859
- // return { txHash: txHash };
1860
- // // }
1861
- // } catch (error) {
1862
- // handleError(error, "Failed to register derivative IP");
1863
- // }
1864
- // }
1865
- // TODO: move to License resource
1866
- // public async addPolicyToIp(request: addPolicyToIpRequest): Promise<addPolicyToIpResponse> {
1867
- // TODO: use getIpAccount to get the ipId
1868
- // }
2679
+ return addPolicyToIp;
2680
+ }()
1869
2681
  }]);
1870
- return IPAssetClient;
1871
- }(IPAssetReadOnlyClient);
1872
-
1873
- // import { isIntegerString } from "../utils/utils";
2682
+ return PolicyClient;
2683
+ }();
1874
2684
 
1875
- /**
1876
- * IPAssetReadOnlyClient allows you to view and search IP Assets on Story Protocol.
1877
- */
1878
- var PermissionReadOnlyClient = /*#__PURE__*/function () {
1879
- function PermissionReadOnlyClient(httpClient, rpcClient) {
1880
- _classCallCheck(this, PermissionReadOnlyClient);
1881
- this.httpClient = httpClient;
2685
+ var DisputeClient = /*#__PURE__*/function () {
2686
+ function DisputeClient(rpcClient, wallet) {
2687
+ _classCallCheck(this, DisputeClient);
1882
2688
  this.rpcClient = rpcClient;
2689
+ this.wallet = wallet;
1883
2690
  }
1884
2691
 
1885
2692
  /**
1886
- * Get permission based on based on the specified IP id.
1887
- *
1888
- * @param request - the request object for getting an IP Asset.
1889
- * @returns the response object the contains the fetched IP Asset.
2693
+ * Initiates a dispute on an IP.
2694
+ * @param request - The request object containing necessary data to raise a dispute.
2695
+ * @param request.targetIpId - The IP ID that is the target of the dispute.
2696
+ * @param request.arbitrationPolicy - The address of the arbitration policy.
2697
+ * @param request.linkToDisputeEvidence - The link to the dispute evidence.
2698
+ * @param request.targetTag - The target tag of the dispute.
2699
+ * @param request.calldata - Optional calldata to initialize the policy.
2700
+ * @param request.txOptions - Optional transaction options.
2701
+ * @returns A Promise that resolves to a RaiseDisputeResponse containing the transaction hash.
2702
+ * @throws `NotRegisteredIpId` if targetIpId is not registered in the IPA Registry.
2703
+ * @throws `NotWhitelistedDisputeTag` if targetTag is not whitelisted.
2704
+ * @throws `ZeroLinkToDisputeEvidence` if linkToDisputeEvidence is empty
2705
+ * @calls raiseDispute(address _targetIpId, string memory _linkToDisputeEvidence, bytes32 _targetTag, bytes calldata _data) external nonReentrant returns (uint256) {
2706
+ * @emits DisputeRaised (disputeId_, targetIpId, msg.sender, arbitrationPolicy, linkToDisputeEvidence, targetTag, calldata);
1890
2707
  */
1891
- _createClass(PermissionReadOnlyClient, [{
1892
- key: "get",
2708
+ _createClass(DisputeClient, [{
2709
+ key: "raiseDispute",
1893
2710
  value: function () {
1894
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
1895
- var response;
2711
+ var _raiseDispute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2712
+ var _request$txOptions, _yield$this$rpcClient, call, txHash, logs;
1896
2713
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1897
2714
  while (1) switch (_context.prev = _context.next) {
1898
2715
  case 0:
1899
2716
  _context.prev = 0;
1900
2717
  _context.next = 3;
1901
- return this.httpClient.get("/permissions/".concat(request.permissionId));
2718
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, DisputeModuleConfig), {}, {
2719
+ functionName: "raiseDispute",
2720
+ args: [request.targetIpId, request.linkToDisputeEvidence, stringToHex(request.targetTag, {
2721
+ size: 32
2722
+ }), request.calldata || "0x"]
2723
+ }));
1902
2724
  case 3:
1903
- response = _context.sent;
1904
- return _context.abrupt("return", response.data);
2725
+ _yield$this$rpcClient = _context.sent;
2726
+ call = _yield$this$rpcClient.request;
2727
+ _context.next = 7;
2728
+ return this.wallet.writeContract(call);
1905
2729
  case 7:
1906
- _context.prev = 7;
2730
+ txHash = _context.sent;
2731
+ if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
2732
+ _context.next = 13;
2733
+ break;
2734
+ }
2735
+ _context.next = 11;
2736
+ return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, DisputeModuleConfig), {}, {
2737
+ eventName: "DisputeRaised"
2738
+ }));
2739
+ case 11:
2740
+ logs = _context.sent;
2741
+ return _context.abrupt("return", {
2742
+ txHash: txHash,
2743
+ disputeId: BigInt(logs.args.disputeId).toString()
2744
+ });
2745
+ case 13:
2746
+ return _context.abrupt("return", {
2747
+ txHash: txHash
2748
+ });
2749
+ case 16:
2750
+ _context.prev = 16;
1907
2751
  _context.t0 = _context["catch"](0);
1908
- handleError(_context.t0, "Failed to get IP account");
1909
- case 10:
2752
+ handleError(_context.t0, "Failed to raise dispute");
2753
+ case 19:
2754
+ case "end":
2755
+ return _context.stop();
2756
+ }
2757
+ }, _callee, this, [[0, 16]]);
2758
+ }));
2759
+ function raiseDispute(_x) {
2760
+ return _raiseDispute.apply(this, arguments);
2761
+ }
2762
+ return raiseDispute;
2763
+ }()
2764
+ /**
2765
+ * Sets the judgement for an existing dispute.
2766
+ * @param request The request object containing details for setting the dispute judgement.
2767
+ * @param request.disputeId The ID of the dispute to be judged.
2768
+ * @param request.decision The decision of the dispute.
2769
+ * @param request.calldata Optional additional data for the dispute judgement.
2770
+ * @returns A Promise that resolves to a SetDisputeJudgementResponse containing the transaction hash.
2771
+ * @throws An error if the process of setting the judgement fails.
2772
+ * @throws `NotInDisputeState` if the currentTag of the Dispute is not being disputed.
2773
+ * @throws `NotWhitelistedArbitrationRelayer` if the transaction executor is not a whitelisted arbitration relayer contract.
2774
+ * @throws error if the Dispute's ArbitrationPolicy contract is not valid.
2775
+ * @calls setDisputeJudgement(uint256 _disputeId, bool _decision, bytes calldata _data) external nonReentrant {
2776
+ * @emits DisputeJudgementSet (_disputeId, _decision, _data);
2777
+ */
2778
+ }, {
2779
+ key: "setDisputeJudgement",
2780
+ value: function () {
2781
+ var _setDisputeJudgement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
2782
+ var _request$txOptions2, _yield$this$rpcClient2, call, txHash;
2783
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2784
+ while (1) switch (_context2.prev = _context2.next) {
2785
+ case 0:
2786
+ _context2.prev = 0;
2787
+ _context2.next = 3;
2788
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, DisputeModuleConfig), {}, {
2789
+ functionName: "setDisputeJudgement",
2790
+ args: [BigInt(request.disputeId), request.decision, request.calldata ? request.calldata : "0x"]
2791
+ }));
2792
+ case 3:
2793
+ _yield$this$rpcClient2 = _context2.sent;
2794
+ call = _yield$this$rpcClient2.request;
2795
+ _context2.next = 7;
2796
+ return this.wallet.writeContract(call);
2797
+ case 7:
2798
+ txHash = _context2.sent;
2799
+ if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
2800
+ _context2.next = 11;
2801
+ break;
2802
+ }
2803
+ _context2.next = 11;
2804
+ return waitTx(this.rpcClient, txHash);
2805
+ case 11:
2806
+ return _context2.abrupt("return", {
2807
+ txHash: txHash
2808
+ });
2809
+ case 14:
2810
+ _context2.prev = 14;
2811
+ _context2.t0 = _context2["catch"](0);
2812
+ handleError(_context2.t0, "Failed to raise dispute");
2813
+ case 17:
2814
+ case "end":
2815
+ return _context2.stop();
2816
+ }
2817
+ }, _callee2, this, [[0, 14]]);
2818
+ }));
2819
+ function setDisputeJudgement(_x2) {
2820
+ return _setDisputeJudgement.apply(this, arguments);
2821
+ }
2822
+ return setDisputeJudgement;
2823
+ }()
2824
+ /**
2825
+ * Cancels an existing dispute.
2826
+ * @param request The request object containing details to cancel the dispute.
2827
+ * @param request.disputeId The ID of the dispute to be cancelled.
2828
+ * @param request.calldata Optional additional data used in the cancellation process.
2829
+ * @returns A Promise that resolves to a CancelDisputeResponse containing the transaction hash.
2830
+ * @throws NotInDisputeState, if the currentTag of the Dispute is not being disputed
2831
+ * @throws NotDisputeInitiator, if the transaction executor is not the one that initiated the dispute
2832
+ * @throws error if the Dispute's ArbitrationPolicy contract is not valid
2833
+ * @calls cancelDispute(uint256 _disputeId, bytes calldata _data) external nonReentrant {
2834
+ * @emits DisputeCancelled (_disputeId, _data);
2835
+ */
2836
+ }, {
2837
+ key: "cancelDispute",
2838
+ value: function () {
2839
+ var _cancelDispute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(request) {
2840
+ var _request$txOptions3, _yield$this$rpcClient3, call, txHash;
2841
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2842
+ while (1) switch (_context3.prev = _context3.next) {
2843
+ case 0:
2844
+ _context3.prev = 0;
2845
+ _context3.next = 3;
2846
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, DisputeModuleConfig), {}, {
2847
+ functionName: "cancelDispute",
2848
+ args: [BigInt(request.disputeId), request.calldata ? request.calldata : "0x"]
2849
+ }));
2850
+ case 3:
2851
+ _yield$this$rpcClient3 = _context3.sent;
2852
+ call = _yield$this$rpcClient3.request;
2853
+ _context3.next = 7;
2854
+ return this.wallet.writeContract(call);
2855
+ case 7:
2856
+ txHash = _context3.sent;
2857
+ if (!((_request$txOptions3 = request.txOptions) !== null && _request$txOptions3 !== void 0 && _request$txOptions3.waitForTransaction)) {
2858
+ _context3.next = 11;
2859
+ break;
2860
+ }
2861
+ _context3.next = 11;
2862
+ return waitTx(this.rpcClient, txHash);
2863
+ case 11:
2864
+ return _context3.abrupt("return", {
2865
+ txHash: txHash
2866
+ });
2867
+ case 14:
2868
+ _context3.prev = 14;
2869
+ _context3.t0 = _context3["catch"](0);
2870
+ handleError(_context3.t0, "Failed to cancel dispute");
2871
+ case 17:
1910
2872
  case "end":
1911
- return _context.stop();
2873
+ return _context3.stop();
1912
2874
  }
1913
- }, _callee, this, [[0, 7]]);
2875
+ }, _callee3, this, [[0, 14]]);
1914
2876
  }));
1915
- function get(_x) {
1916
- return _get.apply(this, arguments);
2877
+ function cancelDispute(_x3) {
2878
+ return _cancelDispute.apply(this, arguments);
1917
2879
  }
1918
- return get;
2880
+ return cancelDispute;
1919
2881
  }()
1920
2882
  /**
1921
- * List IP accounts.
1922
- *
1923
- * @returns the response object that contains results from listing query.
2883
+ * Resolves an existing dispute after a judgement has been set.
2884
+ * @param request The request object containing details to resolve the dispute.
2885
+ * @param request.disputeId The ID of the dispute to be resolved.
2886
+ * @returns A Promise that resolves to a ResolveDisputeResponse.
2887
+ * @throws NotAbleToResolve, if currentTag is still in dispute (i.e still needs a judgement to be set)
2888
+ * @throws NotDisputeInitiator, if the transaction executor is not the one that initiated the dispute
2889
+ * @emits DisputeResolved (_disputeId)
1924
2890
  */
1925
2891
  }, {
1926
- key: "list",
2892
+ key: "resolveDispute",
1927
2893
  value: function () {
1928
- var _list = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
1929
- var response;
1930
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1931
- while (1) switch (_context2.prev = _context2.next) {
2894
+ var _resolveDispute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(request) {
2895
+ var _request$txOptions4, _yield$this$rpcClient4, call, txHash;
2896
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
2897
+ while (1) switch (_context4.prev = _context4.next) {
1932
2898
  case 0:
1933
- _context2.prev = 0;
1934
- _context2.next = 3;
1935
- return this.httpClient.post("/permissions", request || {});
2899
+ _context4.prev = 0;
2900
+ _context4.next = 3;
2901
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, DisputeModuleConfig), {}, {
2902
+ functionName: "resolveDispute",
2903
+ args: [BigInt(request.disputeId)]
2904
+ }));
1936
2905
  case 3:
1937
- response = _context2.sent;
1938
- return _context2.abrupt("return", response.data);
2906
+ _yield$this$rpcClient4 = _context4.sent;
2907
+ call = _yield$this$rpcClient4.request;
2908
+ _context4.next = 7;
2909
+ return this.wallet.writeContract(call);
1939
2910
  case 7:
1940
- _context2.prev = 7;
1941
- _context2.t0 = _context2["catch"](0);
1942
- handleError(_context2.t0, "Failed to list IP Asset.");
1943
- case 10:
2911
+ txHash = _context4.sent;
2912
+ if (!((_request$txOptions4 = request.txOptions) !== null && _request$txOptions4 !== void 0 && _request$txOptions4.waitForTransaction)) {
2913
+ _context4.next = 11;
2914
+ break;
2915
+ }
2916
+ _context4.next = 11;
2917
+ return waitTx(this.rpcClient, txHash);
2918
+ case 11:
2919
+ return _context4.abrupt("return", {
2920
+ txHash: txHash
2921
+ });
2922
+ case 14:
2923
+ _context4.prev = 14;
2924
+ _context4.t0 = _context4["catch"](0);
2925
+ handleError(_context4.t0, "Failed to cancel dispute");
2926
+ case 17:
1944
2927
  case "end":
1945
- return _context2.stop();
2928
+ return _context4.stop();
1946
2929
  }
1947
- }, _callee2, this, [[0, 7]]);
2930
+ }, _callee4, this, [[0, 14]]);
1948
2931
  }));
1949
- function list(_x2) {
1950
- return _list.apply(this, arguments);
2932
+ function resolveDispute(_x4) {
2933
+ return _resolveDispute.apply(this, arguments);
1951
2934
  }
1952
- return list;
2935
+ return resolveDispute;
1953
2936
  }()
1954
2937
  }]);
1955
- return PermissionReadOnlyClient;
2938
+ return DisputeClient;
1956
2939
  }();
1957
2940
 
1958
- var IPAccountImplABI = [{
1959
- inputs: [{
1960
- internalType: "address",
1961
- name: "to_",
1962
- type: "address"
1963
- }, {
1964
- internalType: "uint256",
1965
- name: "value_",
1966
- type: "uint256"
1967
- }, {
1968
- internalType: "bytes",
1969
- name: "data_",
1970
- type: "bytes"
1971
- }],
1972
- name: "execute",
1973
- outputs: [{
1974
- internalType: "bytes",
1975
- name: "result",
1976
- type: "bytes"
1977
- }],
1978
- stateMutability: "payable",
1979
- type: "function"
1980
- }, {
1981
- inputs: [{
1982
- internalType: "address",
1983
- name: "signer_",
1984
- type: "address"
1985
- }, {
1986
- internalType: "bytes",
1987
- name: "data_",
1988
- type: "bytes"
1989
- }],
1990
- name: "isValidSigner",
1991
- outputs: [{
1992
- internalType: "bytes4",
1993
- name: "",
1994
- type: "bytes4"
1995
- }],
1996
- stateMutability: "view",
1997
- type: "function"
1998
- }];
1999
-
2000
- var ErrorsAbi$1 = errorsJson;
2001
- var IPAccountImplMerged = [].concat(_toConsumableArray(IPAccountImplABI), _toConsumableArray(ErrorsAbi$1));
2002
-
2003
- var AccessControllerABI = [{
2004
- inputs: [{
2005
- internalType: "address",
2006
- name: "ipAccount_",
2007
- type: "address"
2008
- }, {
2009
- internalType: "address",
2010
- name: "signer_",
2011
- type: "address"
2012
- }, {
2013
- internalType: "address",
2014
- name: "to_",
2015
- type: "address"
2016
- }, {
2017
- internalType: "bytes4",
2018
- name: "func_",
2019
- type: "bytes4"
2020
- }, {
2021
- internalType: "uint8",
2022
- name: "permission_",
2023
- type: "uint8"
2024
- }],
2025
- name: "setPermission",
2026
- outputs: [],
2027
- stateMutability: "nonpayable",
2028
- type: "function"
2029
- }, {
2030
- anonymous: false,
2031
- inputs: [{
2032
- indexed: true,
2033
- internalType: "address",
2034
- name: "ipAccount",
2035
- type: "address"
2036
- }, {
2037
- indexed: true,
2038
- internalType: "address",
2039
- name: "signer",
2040
- type: "address"
2041
- }, {
2042
- indexed: true,
2043
- internalType: "address",
2044
- name: "to",
2045
- type: "address"
2046
- }, {
2047
- indexed: false,
2048
- internalType: "bytes4",
2049
- name: "func",
2050
- type: "bytes4"
2051
- }, {
2052
- indexed: false,
2053
- internalType: "uint8",
2054
- name: "permission",
2055
- type: "uint8"
2056
- }],
2057
- name: "PermissionSet",
2058
- type: "event"
2059
- }];
2060
-
2061
- var ErrorsAbi = errorsJson;
2062
- var AccessControllerABImerged = [].concat(_toConsumableArray(AccessControllerABI), _toConsumableArray(ErrorsAbi));
2063
- ({
2064
- abi: AccessControllerABImerged,
2065
- address: getAddress(process.env.ACCESS_CONTROLLER || process.env.NEXT_PUBLIC_ACCESS_CONTROLLER || "")
2066
- });
2067
-
2068
- // import { HashZero } from "../constants/common";
2069
-
2070
- var PermissionClient = /*#__PURE__*/function (_PermissionReadOnlyCl) {
2071
- _inherits(PermissionClient, _PermissionReadOnlyCl);
2072
- var _super = _createSuper(PermissionClient);
2073
- function PermissionClient(httpClient, rpcClient, wallet) {
2074
- var _this;
2075
- _classCallCheck(this, PermissionClient);
2076
- _this = _super.call(this, httpClient, rpcClient);
2077
- _this.wallet = wallet;
2078
- return _this;
2941
+ var PlatformClient = /*#__PURE__*/function () {
2942
+ function PlatformClient(httpClient) {
2943
+ _classCallCheck(this, PlatformClient);
2944
+ this.httpClient = httpClient;
2079
2945
  }
2080
2946
 
2081
2947
  /**
2082
- * Set Permission based on the specified input
2948
+ * Upload a file to Arweave.
2083
2949
  *
2084
- * @param request - the request object that contains all data needed to set permission.
2085
- * @returns the response object that contains results from the set permission.
2950
+ * @param file - the file binary data to upload
2951
+ * @param mimeType - the mime type of the file
2952
+ * @returns the response object that contains the uri of the uploaded file
2086
2953
  */
2087
- _createClass(PermissionClient, [{
2088
- key: "setPermission",
2954
+ _createClass(PlatformClient, [{
2955
+ key: "uploadFile",
2089
2956
  value: function () {
2090
- var _setPermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2091
- var IPAccountConfig, accessController, _yield$this$rpcClient, call, txHash;
2957
+ var _uploadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file, mimeType) {
2958
+ var preSignUrlResp, data, uploadResp, confirmResp;
2092
2959
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2093
2960
  while (1) switch (_context.prev = _context.next) {
2094
2961
  case 0:
2095
2962
  _context.prev = 0;
2096
- IPAccountConfig = {
2097
- abi: IPAccountImplMerged,
2098
- address: getAddress(request.ipAsset)
2099
- };
2100
- accessController = getAddress(process.env.ACCESS_CONTROLLER || process.env.NEXT_PUBLIC_ACCESS_CONTROLLER || ""); //to
2101
- _context.next = 5;
2102
- return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, IPAccountConfig), {}, {
2103
- functionName: "execute",
2104
- args: [accessController, 0, encodeFunctionData({
2105
- abi: AccessControllerABImerged,
2106
- functionName: "setPermission",
2107
- args: [getAddress(request.ipAsset),
2108
- // 0x Address
2109
- getAddress(request.signer),
2110
- // 0x Address
2111
- getAddress(request.to),
2112
- // 0x Address
2113
- request.func,
2114
- // bytes4
2115
- request.permission // uint8
2116
- ]
2117
- })],
2118
-
2119
- account: this.wallet.account
2120
- }));
2121
- case 5:
2122
- _yield$this$rpcClient = _context.sent;
2123
- call = _yield$this$rpcClient.request;
2124
- _context.next = 9;
2125
- return this.wallet.writeContract(call);
2126
- case 9:
2127
- txHash = _context.sent;
2128
- return _context.abrupt("return", {
2129
- txHash: txHash
2963
+ _context.next = 3;
2964
+ return this.httpClient.post("/platform/file-upload/request");
2965
+ case 3:
2966
+ preSignUrlResp = _context.sent;
2967
+ data = preSignUrlResp.data; // upload the file to s3
2968
+ _context.next = 7;
2969
+ return this.httpClient.put(data.url, file, {
2970
+ timeout: 0,
2971
+ headers: {
2972
+ "Content-Type": mimeType
2973
+ }
2130
2974
  });
2131
- case 13:
2132
- _context.prev = 13;
2133
- _context.t0 = _context["catch"](0);
2134
- handleError(_context.t0, "Failed to set permissions");
2975
+ case 7:
2976
+ uploadResp = _context.sent;
2977
+ if (!(uploadResp.status !== 200)) {
2978
+ _context.next = 10;
2979
+ break;
2980
+ }
2981
+ throw new Error("Failed to upload file to s3. Status: ".concat(uploadResp.status));
2982
+ case 10:
2983
+ _context.next = 12;
2984
+ return this.httpClient.post("/platform/file-upload/confirm", {
2985
+ key: data.key
2986
+ });
2987
+ case 12:
2988
+ confirmResp = _context.sent;
2989
+ return _context.abrupt("return", confirmResp.data);
2135
2990
  case 16:
2991
+ _context.prev = 16;
2992
+ _context.t0 = _context["catch"](0);
2993
+ return _context.abrupt("return", handleError(_context.t0, "Failed to upload file"));
2994
+ case 19:
2136
2995
  case "end":
2137
2996
  return _context.stop();
2138
2997
  }
2139
- }, _callee, this, [[0, 13]]);
2998
+ }, _callee, this, [[0, 16]]);
2140
2999
  }));
2141
- function setPermission(_x) {
2142
- return _setPermission.apply(this, arguments);
3000
+ function uploadFile(_x, _x2) {
3001
+ return _uploadFile.apply(this, arguments);
2143
3002
  }
2144
- return setPermission;
3003
+ return uploadFile;
2145
3004
  }()
2146
3005
  }]);
2147
- return PermissionClient;
2148
- }(PermissionReadOnlyClient);
3006
+ return PlatformClient;
3007
+ }();
2149
3008
 
2150
3009
  if (typeof process !== "undefined") {
2151
3010
  dotenv.config();
@@ -2156,53 +3015,51 @@ if (typeof process !== "undefined") {
2156
3015
  var StoryClient = /*#__PURE__*/function () {
2157
3016
  /**
2158
3017
  * @param config - the configuration for the SDK client
2159
- * @param isReadOnly
2160
3018
  */
2161
3019
  function StoryClient(config) {
2162
- var isReadOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2163
3020
  _classCallCheck(this, StoryClient);
2164
- _defineProperty(this, "isReadOnly", false);
2165
3021
  _defineProperty(this, "_ipAccount", null);
2166
3022
  _defineProperty(this, "_permission", null);
2167
- _defineProperty(this, "_transaction", null);
3023
+ _defineProperty(this, "_license", null);
3024
+ _defineProperty(this, "_policy", null);
2168
3025
  _defineProperty(this, "_platform", null);
2169
- _defineProperty(this, "_module", null);
2170
3026
  _defineProperty(this, "_tagging", null);
3027
+ _defineProperty(this, "_dispute", null);
2171
3028
  this.config = config;
2172
- this.isReadOnly = isReadOnly;
2173
- var clientConfig = {
2174
- chain: this.config.chain || sepolia,
2175
- transport: this.config.transport || http(process.env.RPC_PROVIDER_URL)
2176
- };
2177
- this.rpcClient = createPublicClient(clientConfig);
2178
- if (!isReadOnly) {
2179
- var account = this.config.account;
2180
- if (!account) {
2181
- throw new Error("account is null");
2182
- }
2183
- this.wallet = createWalletClient(_objectSpread2(_objectSpread2({}, clientConfig), {}, {
2184
- account: account
2185
- }));
3029
+ if (!this.config.transport) {
3030
+ throw new Error("transport is null, please pass in a valid RPC Provider URL as the transport.");
2186
3031
  }
2187
3032
  this.httpClient = axios.create({
2188
- baseURL: process.env.API_BASE_URL || process.env.NEXT_PUBLIC_API_BASE_URL,
2189
- timeout: HTTP_TIMEOUT,
3033
+ baseURL: "https://stag.api.storyprotocol.net",
3034
+ timeout: 5000,
2190
3035
  headers: {
2191
3036
  version: "v0-alpha"
2192
3037
  }
2193
3038
  });
3039
+ var clientConfig = {
3040
+ chain: chainStringToViemChain(this.config.chainId || "sepolia"),
3041
+ transport: this.config.transport
3042
+ };
3043
+ this.rpcClient = createPublicClient(clientConfig);
3044
+ var account = this.config.account;
3045
+ if (!account) {
3046
+ throw new Error("account is null");
3047
+ }
3048
+ this.wallet = createWalletClient(_objectSpread2(_objectSpread2({}, clientConfig), {}, {
3049
+ account: account
3050
+ }));
2194
3051
  }
2195
3052
 
2196
3053
  /**
2197
- * Factory method for creating a read only SDK client.
3054
+ * Factory method for creating a SDK client with a signer.
2198
3055
  *
2199
- * @param config - the configuration for a read only SDK client
3056
+ * @param config - the configuration for a new SDK client
2200
3057
  */
2201
3058
  _createClass(StoryClient, [{
2202
3059
  key: "ipAsset",
2203
3060
  get: function get() {
2204
3061
  if (this._ipAccount === null) {
2205
- this._ipAccount = this.isReadOnly ? new IPAssetReadOnlyClient(this.httpClient, this.rpcClient) : new IPAssetClient(this.httpClient, this.rpcClient, this.wallet);
3062
+ this._ipAccount = new IPAssetClient(this.rpcClient, this.wallet);
2206
3063
  }
2207
3064
  return this._ipAccount;
2208
3065
  }
@@ -2210,119 +3067,78 @@ var StoryClient = /*#__PURE__*/function () {
2210
3067
  key: "permission",
2211
3068
  get: function get() {
2212
3069
  if (this._permission === null) {
2213
- this._permission = this.isReadOnly ? new PermissionReadOnlyClient(this.httpClient, this.rpcClient) : new PermissionClient(this.httpClient, this.rpcClient, this.wallet);
3070
+ this._permission = new PermissionClient(this.rpcClient, this.wallet);
2214
3071
  }
2215
3072
  return this._permission;
2216
3073
  }
2217
-
2218
- /**
2219
- * Getter for the transaction client. The client is lazily created when
2220
- * this method is called.
2221
- *
2222
- * @returns the TransactionReadOnlyClient or TransactionClient instance
2223
- */
2224
3074
  }, {
2225
- key: "transaction",
3075
+ key: "license",
3076
+ get: function get() {
3077
+ if (this._license === null) {
3078
+ this._license = new LicenseClient(this.rpcClient, this.wallet);
3079
+ }
3080
+ return this._license;
3081
+ }
3082
+ }, {
3083
+ key: "policy",
2226
3084
  get: function get() {
2227
- if (this._transaction === null) {
2228
- this._transaction = this.isReadOnly ? new TransactionReadOnlyClient(this.httpClient, this.rpcClient) : new TransactionClient(this.httpClient, this.rpcClient, this.wallet);
3085
+ if (this._policy === null) {
3086
+ this._policy = new PolicyClient(this.rpcClient, this.wallet);
2229
3087
  }
2230
- return this._transaction;
3088
+ return this._policy;
2231
3089
  }
2232
3090
 
2233
3091
  /**
2234
3092
  * Getter for the tagging client. The client is lazily created when
2235
3093
  * this method is called.
2236
3094
  *
2237
- * @returns the TaggingReadOnlyClient or TaggingClient instance
3095
+ * @returns the TaggingClient instance
2238
3096
  */
2239
3097
  }, {
2240
3098
  key: "tagging",
2241
3099
  get: function get() {
2242
3100
  if (this._tagging === null) {
2243
- this._tagging = this.isReadOnly ? new TaggingReadOnlyClient(this.httpClient, this.rpcClient) : new TaggingClient(this.httpClient, this.rpcClient, this.wallet);
3101
+ this._tagging = new TaggingClient(this.rpcClient, this.wallet);
2244
3102
  }
2245
3103
  return this._tagging;
2246
3104
  }
2247
3105
 
2248
3106
  /**
2249
- * Getter for the platform client. The client is lazily created when
3107
+ * Getter for the dispute client. The client is lazily created when
2250
3108
  * this method is called.
2251
3109
  *
2252
- * @returns the PlatformClient instance
3110
+ * @returns the DisputeClient instance
2253
3111
  */
2254
3112
  }, {
2255
- key: "platform",
3113
+ key: "dispute",
2256
3114
  get: function get() {
2257
- if (this._platform === null) {
2258
- this._platform = new PlatformClient(this.httpClient);
3115
+ if (this._dispute === null) {
3116
+ this._dispute = new DisputeClient(this.rpcClient, this.wallet);
2259
3117
  }
2260
- return this._platform;
3118
+ return this._dispute;
2261
3119
  }
2262
3120
 
2263
3121
  /**
2264
- * Getter for the module client. The client is lazily created when
3122
+ * Getter for the platform client. The client is lazily created when
2265
3123
  * this method is called.
2266
3124
  *
2267
- * @returns the Module instance
3125
+ * @returns the PlatformClient instance
2268
3126
  */
2269
3127
  }, {
2270
- key: "module",
3128
+ key: "platform",
2271
3129
  get: function get() {
2272
- if (this._module === null) {
2273
- this._module = new ModuleReadOnlyClient(this.httpClient, this.rpcClient);
3130
+ if (this._platform === null) {
3131
+ this._platform = new PlatformClient(this.httpClient);
2274
3132
  }
2275
- return this._module;
3133
+ return this._platform;
2276
3134
  }
2277
3135
  }], [{
2278
- key: "newReadOnlyClient",
2279
- value: function newReadOnlyClient(config) {
2280
- return new StoryClient(config, true);
2281
- }
2282
-
2283
- /**
2284
- * Factory method for creating a SDK client with a signer.
2285
- *
2286
- * @param config - the configuration for a new read/write SDK client
2287
- */
2288
- }, {
2289
3136
  key: "newClient",
2290
3137
  value: function newClient(config) {
2291
- return new StoryClient(config, false);
3138
+ return new StoryClient(config);
2292
3139
  }
2293
3140
  }]);
2294
3141
  return StoryClient;
2295
3142
  }();
2296
3143
 
2297
- /**
2298
- * @public
2299
- */
2300
- var ResourceType = /*#__PURE__*/function (ResourceType) {
2301
- ResourceType["Unspecified"] = "Unspecified";
2302
- ResourceType["IPOrg"] = "IPOrg";
2303
- ResourceType["IPAsset"] = "IPAsset";
2304
- ResourceType["License"] = "License";
2305
- ResourceType["Relationship"] = "Relationship";
2306
- ResourceType["RelationshipType"] = "RelationshipType";
2307
- ResourceType["Module"] = "Module";
2308
- ResourceType["Hook"] = "Hook";
2309
- ResourceType["Dispute"] = "Dispute";
2310
- return ResourceType;
2311
- }({});
2312
-
2313
- /**
2314
- * @public
2315
- */
2316
- var ActionType = /*#__PURE__*/function (ActionType) {
2317
- ActionType["Unspecified"] = "Unspecified";
2318
- ActionType["Register"] = "Register";
2319
- ActionType["Unregister"] = "Unregister";
2320
- ActionType["Configure"] = "Configure";
2321
- ActionType["Create"] = "Create";
2322
- return ActionType;
2323
- }({});
2324
-
2325
- var AddressZero = "0x0000000000000000000000000000000000000000";
2326
- var HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
2327
-
2328
- export { ActionType, AddressZero, HashZero, IPAssetClient, IPAssetReadOnlyClient, ModuleReadOnlyClient, PermissionClient, PermissionReadOnlyClient, PlatformClient, ResourceType, StoryClient, TaggingReadOnlyClient, TransactionClient };
3144
+ export { AddressZero, DisputeClient, HashZero, IPAssetClient, LicenseClient, PermissionClient, PlatformClient, PolicyClient, StoryClient, TaggingClient };