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