@story-protocol/core-sdk 0.0.1-beta-rc.11 → 0.0.1-beta-rc.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/declarations/src/client.d.ts +9 -0
- package/dist/declarations/src/client.d.ts.map +1 -1
- package/dist/declarations/src/index.d.ts +2 -1
- package/dist/declarations/src/index.d.ts.map +1 -1
- package/dist/declarations/src/resources/dispute.d.ts +103 -78
- package/dist/declarations/src/resources/dispute.d.ts.map +1 -1
- package/dist/declarations/src/resources/ipAccount.d.ts +84 -76
- package/dist/declarations/src/resources/ipAccount.d.ts.map +1 -1
- package/dist/declarations/src/resources/ipAsset.d.ts +26 -756
- package/dist/declarations/src/resources/ipAsset.d.ts.map +1 -1
- package/dist/declarations/src/resources/license.d.ts +875 -858
- package/dist/declarations/src/resources/license.d.ts.map +1 -1
- package/dist/declarations/src/resources/permission.d.ts +271 -216
- package/dist/declarations/src/resources/permission.d.ts.map +1 -1
- package/dist/declarations/src/resources/policy.d.ts +1094 -277
- package/dist/declarations/src/resources/policy.d.ts.map +1 -1
- package/dist/declarations/src/resources/royalty.d.ts +2155 -0
- package/dist/declarations/src/resources/royalty.d.ts.map +1 -0
- package/dist/declarations/src/types/config.d.ts +4 -1
- package/dist/declarations/src/types/config.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/ipAsset.d.ts +4 -20
- package/dist/declarations/src/types/resources/ipAsset.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/royalty.d.ts +41 -0
- package/dist/declarations/src/types/resources/royalty.d.ts.map +1 -1
- package/dist/story-protocol-core-sdk.cjs.dev.js +864 -613
- package/dist/story-protocol-core-sdk.cjs.prod.js +864 -613
- package/dist/story-protocol-core-sdk.esm.js +866 -615
- package/package.json +1 -1
| @@ -440,31 +440,12 @@ function _asyncToGenerator(fn) { | |
| 440 440 | 
             
              };
         | 
| 441 441 | 
             
            }
         | 
| 442 442 |  | 
| 443 | 
            -
            function handleError(error, msg) {
         | 
| 444 | 
            -
              if (error instanceof Error) {
         | 
| 445 | 
            -
                throw new Error("".concat(msg, ": ").concat(error.message));
         | 
| 446 | 
            -
              }
         | 
| 447 | 
            -
              throw new Error("".concat(msg, ": Unknown error type"));
         | 
| 448 | 
            -
            }
         | 
| 449 | 
            -
             | 
| 450 | 
            -
            var AddressZero = "0x0000000000000000000000000000000000000000";
         | 
| 451 | 
            -
            var HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
         | 
| 452 | 
            -
            var SepoliaChainId = "11155111";
         | 
| 453 | 
            -
             | 
| 454 443 | 
             
            function _arrayLikeToArray(arr, len) {
         | 
| 455 444 | 
             
              if (len == null || len > arr.length) len = arr.length;
         | 
| 456 445 | 
             
              for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
         | 
| 457 446 | 
             
              return arr2;
         | 
| 458 447 | 
             
            }
         | 
| 459 448 |  | 
| 460 | 
            -
            function _arrayWithoutHoles(arr) {
         | 
| 461 | 
            -
              if (Array.isArray(arr)) return _arrayLikeToArray(arr);
         | 
| 462 | 
            -
            }
         | 
| 463 | 
            -
             | 
| 464 | 
            -
            function _iterableToArray(iter) {
         | 
| 465 | 
            -
              if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
         | 
| 466 | 
            -
            }
         | 
| 467 | 
            -
             | 
| 468 449 | 
             
            function _unsupportedIterableToArray(o, minLen) {
         | 
| 469 450 | 
             
              if (!o) return;
         | 
| 470 451 | 
             
              if (typeof o === "string") return _arrayLikeToArray(o, minLen);
         | 
| @@ -474,6 +455,218 @@ function _unsupportedIterableToArray(o, minLen) { | |
| 474 455 | 
             
              if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
         | 
| 475 456 | 
             
            }
         | 
| 476 457 |  | 
| 458 | 
            +
            function _createForOfIteratorHelper(o, allowArrayLike) {
         | 
| 459 | 
            +
              var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
         | 
| 460 | 
            +
              if (!it) {
         | 
| 461 | 
            +
                if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
         | 
| 462 | 
            +
                  if (it) o = it;
         | 
| 463 | 
            +
                  var i = 0;
         | 
| 464 | 
            +
                  var F = function () {};
         | 
| 465 | 
            +
                  return {
         | 
| 466 | 
            +
                    s: F,
         | 
| 467 | 
            +
                    n: function () {
         | 
| 468 | 
            +
                      if (i >= o.length) return {
         | 
| 469 | 
            +
                        done: true
         | 
| 470 | 
            +
                      };
         | 
| 471 | 
            +
                      return {
         | 
| 472 | 
            +
                        done: false,
         | 
| 473 | 
            +
                        value: o[i++]
         | 
| 474 | 
            +
                      };
         | 
| 475 | 
            +
                    },
         | 
| 476 | 
            +
                    e: function (e) {
         | 
| 477 | 
            +
                      throw e;
         | 
| 478 | 
            +
                    },
         | 
| 479 | 
            +
                    f: F
         | 
| 480 | 
            +
                  };
         | 
| 481 | 
            +
                }
         | 
| 482 | 
            +
                throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
         | 
| 483 | 
            +
              }
         | 
| 484 | 
            +
              var normalCompletion = true,
         | 
| 485 | 
            +
                didErr = false,
         | 
| 486 | 
            +
                err;
         | 
| 487 | 
            +
              return {
         | 
| 488 | 
            +
                s: function () {
         | 
| 489 | 
            +
                  it = it.call(o);
         | 
| 490 | 
            +
                },
         | 
| 491 | 
            +
                n: function () {
         | 
| 492 | 
            +
                  var step = it.next();
         | 
| 493 | 
            +
                  normalCompletion = step.done;
         | 
| 494 | 
            +
                  return step;
         | 
| 495 | 
            +
                },
         | 
| 496 | 
            +
                e: function (e) {
         | 
| 497 | 
            +
                  didErr = true;
         | 
| 498 | 
            +
                  err = e;
         | 
| 499 | 
            +
                },
         | 
| 500 | 
            +
                f: function () {
         | 
| 501 | 
            +
                  try {
         | 
| 502 | 
            +
                    if (!normalCompletion && it.return != null) it.return();
         | 
| 503 | 
            +
                  } finally {
         | 
| 504 | 
            +
                    if (didErr) throw err;
         | 
| 505 | 
            +
                  }
         | 
| 506 | 
            +
                }
         | 
| 507 | 
            +
              };
         | 
| 508 | 
            +
            }
         | 
| 509 | 
            +
             | 
| 510 | 
            +
            function parseToBigInt(num) {
         | 
| 511 | 
            +
              return BigInt(num);
         | 
| 512 | 
            +
            }
         | 
| 513 | 
            +
            function waitTxAndFilterLog(_x, _x2, _x3) {
         | 
| 514 | 
            +
              return _waitTxAndFilterLog.apply(this, arguments);
         | 
| 515 | 
            +
            }
         | 
| 516 | 
            +
            function _waitTxAndFilterLog() {
         | 
| 517 | 
            +
              _waitTxAndFilterLog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(client, txHash, params) {
         | 
| 518 | 
            +
                var txReceipt, targetLogs, _iterator, _step, log, currentLog;
         | 
| 519 | 
            +
                return _regeneratorRuntime().wrap(function _callee$(_context) {
         | 
| 520 | 
            +
                  while (1) switch (_context.prev = _context.next) {
         | 
| 521 | 
            +
                    case 0:
         | 
| 522 | 
            +
                      _context.next = 2;
         | 
| 523 | 
            +
                      return client.waitForTransactionReceipt({
         | 
| 524 | 
            +
                        hash: txHash,
         | 
| 525 | 
            +
                        confirmations: params.confirmations,
         | 
| 526 | 
            +
                        pollingInterval: params.pollingInterval,
         | 
| 527 | 
            +
                        timeout: params.timeout
         | 
| 528 | 
            +
                      });
         | 
| 529 | 
            +
                    case 2:
         | 
| 530 | 
            +
                      txReceipt = _context.sent;
         | 
| 531 | 
            +
                      targetLogs = [];
         | 
| 532 | 
            +
                      _iterator = _createForOfIteratorHelper(txReceipt.logs);
         | 
| 533 | 
            +
                      _context.prev = 5;
         | 
| 534 | 
            +
                      _iterator.s();
         | 
| 535 | 
            +
                    case 7:
         | 
| 536 | 
            +
                      if ((_step = _iterator.n()).done) {
         | 
| 537 | 
            +
                        _context.next = 21;
         | 
| 538 | 
            +
                        break;
         | 
| 539 | 
            +
                      }
         | 
| 540 | 
            +
                      log = _step.value;
         | 
| 541 | 
            +
                      _context.prev = 9;
         | 
| 542 | 
            +
                      if (!(params.from && log.address !== params.from.toLowerCase())) {
         | 
| 543 | 
            +
                        _context.next = 12;
         | 
| 544 | 
            +
                        break;
         | 
| 545 | 
            +
                      }
         | 
| 546 | 
            +
                      return _context.abrupt("continue", 19);
         | 
| 547 | 
            +
                    case 12:
         | 
| 548 | 
            +
                      currentLog = viem.decodeEventLog({
         | 
| 549 | 
            +
                        abi: params.abi,
         | 
| 550 | 
            +
                        eventName: params.eventName,
         | 
| 551 | 
            +
                        data: log.data,
         | 
| 552 | 
            +
                        topics: log.topics
         | 
| 553 | 
            +
                      });
         | 
| 554 | 
            +
                      targetLogs.push(currentLog);
         | 
| 555 | 
            +
                      _context.next = 19;
         | 
| 556 | 
            +
                      break;
         | 
| 557 | 
            +
                    case 16:
         | 
| 558 | 
            +
                      _context.prev = 16;
         | 
| 559 | 
            +
                      _context.t0 = _context["catch"](9);
         | 
| 560 | 
            +
                      return _context.abrupt("continue", 19);
         | 
| 561 | 
            +
                    case 19:
         | 
| 562 | 
            +
                      _context.next = 7;
         | 
| 563 | 
            +
                      break;
         | 
| 564 | 
            +
                    case 21:
         | 
| 565 | 
            +
                      _context.next = 26;
         | 
| 566 | 
            +
                      break;
         | 
| 567 | 
            +
                    case 23:
         | 
| 568 | 
            +
                      _context.prev = 23;
         | 
| 569 | 
            +
                      _context.t1 = _context["catch"](5);
         | 
| 570 | 
            +
                      _iterator.e(_context.t1);
         | 
| 571 | 
            +
                    case 26:
         | 
| 572 | 
            +
                      _context.prev = 26;
         | 
| 573 | 
            +
                      _iterator.f();
         | 
| 574 | 
            +
                      return _context.finish(26);
         | 
| 575 | 
            +
                    case 29:
         | 
| 576 | 
            +
                      if (!(targetLogs.length === 0)) {
         | 
| 577 | 
            +
                        _context.next = 31;
         | 
| 578 | 
            +
                        break;
         | 
| 579 | 
            +
                      }
         | 
| 580 | 
            +
                      throw new Error("not found event ".concat(params.eventName, " in target transaction"));
         | 
| 581 | 
            +
                    case 31:
         | 
| 582 | 
            +
                      return _context.abrupt("return", targetLogs);
         | 
| 583 | 
            +
                    case 32:
         | 
| 584 | 
            +
                    case "end":
         | 
| 585 | 
            +
                      return _context.stop();
         | 
| 586 | 
            +
                  }
         | 
| 587 | 
            +
                }, _callee, null, [[5, 23, 26, 29], [9, 16]]);
         | 
| 588 | 
            +
              }));
         | 
| 589 | 
            +
              return _waitTxAndFilterLog.apply(this, arguments);
         | 
| 590 | 
            +
            }
         | 
| 591 | 
            +
            function waitTx(_x4, _x5, _x6) {
         | 
| 592 | 
            +
              return _waitTx.apply(this, arguments);
         | 
| 593 | 
            +
            }
         | 
| 594 | 
            +
            function _waitTx() {
         | 
| 595 | 
            +
              _waitTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(client, txHash, params) {
         | 
| 596 | 
            +
                return _regeneratorRuntime().wrap(function _callee2$(_context2) {
         | 
| 597 | 
            +
                  while (1) switch (_context2.prev = _context2.next) {
         | 
| 598 | 
            +
                    case 0:
         | 
| 599 | 
            +
                      _context2.next = 2;
         | 
| 600 | 
            +
                      return client.waitForTransactionReceipt(_objectSpread2({
         | 
| 601 | 
            +
                        hash: txHash
         | 
| 602 | 
            +
                      }, params));
         | 
| 603 | 
            +
                    case 2:
         | 
| 604 | 
            +
                    case "end":
         | 
| 605 | 
            +
                      return _context2.stop();
         | 
| 606 | 
            +
                  }
         | 
| 607 | 
            +
                }, _callee2);
         | 
| 608 | 
            +
              }));
         | 
| 609 | 
            +
              return _waitTx.apply(this, arguments);
         | 
| 610 | 
            +
            }
         | 
| 611 | 
            +
            function typedDataToBytes(typedData) {
         | 
| 612 | 
            +
              return viem.encodeAbiParameters(viem.parseAbiParameters(typedData["interface"]), typedData.data);
         | 
| 613 | 
            +
            }
         | 
| 614 | 
            +
            function chainStringToViemChain(chainId) {
         | 
| 615 | 
            +
              switch (chainId) {
         | 
| 616 | 
            +
                case "11155111":
         | 
| 617 | 
            +
                case "sepolia":
         | 
| 618 | 
            +
                  return chains.sepolia;
         | 
| 619 | 
            +
                case "1513":
         | 
| 620 | 
            +
                case "storyTestnet":
         | 
| 621 | 
            +
                  return storyTestnet$1;
         | 
| 622 | 
            +
                default:
         | 
| 623 | 
            +
                  throw new Error("chainId ".concat(chainId, " not supported"));
         | 
| 624 | 
            +
              }
         | 
| 625 | 
            +
            }
         | 
| 626 | 
            +
            var storyTestnet$1 = viem.defineChain({
         | 
| 627 | 
            +
              id: 1513,
         | 
| 628 | 
            +
              name: "story-network",
         | 
| 629 | 
            +
              nativeCurrency: {
         | 
| 630 | 
            +
                name: "Ether",
         | 
| 631 | 
            +
                symbol: "SEP",
         | 
| 632 | 
            +
                decimals: 18
         | 
| 633 | 
            +
              },
         | 
| 634 | 
            +
              rpcUrls: {
         | 
| 635 | 
            +
                "default": {
         | 
| 636 | 
            +
                  http: ["https://story-network.rpc.caldera.xyz/http"],
         | 
| 637 | 
            +
                  webSocket: ["wss://story-network.rpc.caldera.xyz/ws"]
         | 
| 638 | 
            +
                }
         | 
| 639 | 
            +
              },
         | 
| 640 | 
            +
              blockExplorers: {
         | 
| 641 | 
            +
                "default": {
         | 
| 642 | 
            +
                  name: "Explorer",
         | 
| 643 | 
            +
                  url: "https://story-network.explorer.caldera.xyz"
         | 
| 644 | 
            +
                }
         | 
| 645 | 
            +
              },
         | 
| 646 | 
            +
              //TODO: wait for Ze confirm with config information
         | 
| 647 | 
            +
              contracts: {
         | 
| 648 | 
            +
                multicall3: {
         | 
| 649 | 
            +
                  address: "0xcA11bde05977b3631167028862bE2a173976CA11",
         | 
| 650 | 
            +
                  blockCreated: 5882
         | 
| 651 | 
            +
                }
         | 
| 652 | 
            +
              },
         | 
| 653 | 
            +
              testnet: true
         | 
| 654 | 
            +
            });
         | 
| 655 | 
            +
            var chain = {
         | 
| 656 | 
            +
              sepolia: "11155111",
         | 
| 657 | 
            +
              storyTestnet: "1513",
         | 
| 658 | 
            +
              11155111: "11155111",
         | 
| 659 | 
            +
              1513: "1513"
         | 
| 660 | 
            +
            };
         | 
| 661 | 
            +
             | 
| 662 | 
            +
            function _arrayWithoutHoles(arr) {
         | 
| 663 | 
            +
              if (Array.isArray(arr)) return _arrayLikeToArray(arr);
         | 
| 664 | 
            +
            }
         | 
| 665 | 
            +
             | 
| 666 | 
            +
            function _iterableToArray(iter) {
         | 
| 667 | 
            +
              if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
         | 
| 668 | 
            +
            }
         | 
| 669 | 
            +
             | 
| 477 670 | 
             
            function _nonIterableSpread() {
         | 
| 478 671 | 
             
              throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
         | 
| 479 672 | 
             
            }
         | 
| @@ -806,19 +999,19 @@ var IPAssetRegistryABI = [{ | |
| 806 999 | 
             
                type: "uint256"
         | 
| 807 1000 | 
             
              }, {
         | 
| 808 1001 | 
             
                indexed: false,
         | 
| 809 | 
            -
                internalType: " | 
| 810 | 
            -
                name: " | 
| 811 | 
            -
                type: " | 
| 1002 | 
            +
                internalType: "string",
         | 
| 1003 | 
            +
                name: "name",
         | 
| 1004 | 
            +
                type: "string"
         | 
| 812 1005 | 
             
              }, {
         | 
| 813 1006 | 
             
                indexed: false,
         | 
| 814 | 
            -
                internalType: " | 
| 815 | 
            -
                name: " | 
| 816 | 
            -
                type: " | 
| 1007 | 
            +
                internalType: "string",
         | 
| 1008 | 
            +
                name: "uri",
         | 
| 1009 | 
            +
                type: "string"
         | 
| 817 1010 | 
             
              }, {
         | 
| 818 1011 | 
             
                indexed: false,
         | 
| 819 | 
            -
                internalType: " | 
| 820 | 
            -
                name: " | 
| 821 | 
            -
                type: " | 
| 1012 | 
            +
                internalType: "uint256",
         | 
| 1013 | 
            +
                name: "registrationDate",
         | 
| 1014 | 
            +
                type: "uint256"
         | 
| 822 1015 | 
             
              }],
         | 
| 823 1016 | 
             
              name: "IPRegistered",
         | 
| 824 1017 | 
             
              type: "event"
         | 
| @@ -858,6 +1051,24 @@ var IPAssetRegistryABI = [{ | |
| 858 1051 | 
             
              }],
         | 
| 859 1052 | 
             
              stateMutability: "view",
         | 
| 860 1053 | 
             
              type: "function"
         | 
| 1054 | 
            +
            }, {
         | 
| 1055 | 
            +
              inputs: [{
         | 
| 1056 | 
            +
                internalType: "address",
         | 
| 1057 | 
            +
                name: "tokenContract",
         | 
| 1058 | 
            +
                type: "address"
         | 
| 1059 | 
            +
              }, {
         | 
| 1060 | 
            +
                internalType: "uint256",
         | 
| 1061 | 
            +
                name: "tokenId",
         | 
| 1062 | 
            +
                type: "uint256"
         | 
| 1063 | 
            +
              }],
         | 
| 1064 | 
            +
              name: "register",
         | 
| 1065 | 
            +
              outputs: [{
         | 
| 1066 | 
            +
                internalType: "address",
         | 
| 1067 | 
            +
                name: "id",
         | 
| 1068 | 
            +
                type: "address"
         | 
| 1069 | 
            +
              }],
         | 
| 1070 | 
            +
              stateMutability: "nonpayable",
         | 
| 1071 | 
            +
              type: "function"
         | 
| 861 1072 | 
             
            }];
         | 
| 862 1073 |  | 
| 863 1074 | 
             
            var LicensingModuleABI = [{
         | 
| @@ -1194,72 +1405,152 @@ var PILPolicyFrameworkManagerABI = [{ | |
| 1194 1405 | 
             
              type: "function"
         | 
| 1195 1406 | 
             
            }];
         | 
| 1196 1407 |  | 
| 1197 | 
            -
            var  | 
| 1408 | 
            +
            var IRoyaltyPolicyLAPABI = [{
         | 
| 1198 1409 | 
             
              inputs: [{
         | 
| 1199 | 
            -
                internalType: "uint256[]",
         | 
| 1200 | 
            -
                name: "licenseIds",
         | 
| 1201 | 
            -
                type: "uint256[]"
         | 
| 1202 | 
            -
              }, {
         | 
| 1203 1410 | 
             
                internalType: "address",
         | 
| 1204 | 
            -
                name: " | 
| 1411 | 
            +
                name: "ipId",
         | 
| 1205 1412 | 
             
                type: "address"
         | 
| 1413 | 
            +
              }],
         | 
| 1414 | 
            +
              name: "getRoyaltyData",
         | 
| 1415 | 
            +
              outputs: [{
         | 
| 1416 | 
            +
                internalType: "bool",
         | 
| 1417 | 
            +
                name: "",
         | 
| 1418 | 
            +
                type: "bool"
         | 
| 1206 1419 | 
             
              }, {
         | 
| 1207 | 
            -
                internalType: " | 
| 1208 | 
            -
                name: " | 
| 1209 | 
            -
                type: " | 
| 1210 | 
            -
              }, {
         | 
| 1211 | 
            -
                internalType: "string",
         | 
| 1212 | 
            -
                name: "ipName",
         | 
| 1213 | 
            -
                type: "string"
         | 
| 1420 | 
            +
                internalType: "address",
         | 
| 1421 | 
            +
                name: "",
         | 
| 1422 | 
            +
                type: "address"
         | 
| 1214 1423 | 
             
              }, {
         | 
| 1215 | 
            -
                internalType: " | 
| 1216 | 
            -
                name: " | 
| 1217 | 
            -
                type: " | 
| 1424 | 
            +
                internalType: "uint32",
         | 
| 1425 | 
            +
                name: "",
         | 
| 1426 | 
            +
                type: "uint32"
         | 
| 1218 1427 | 
             
              }, {
         | 
| 1219 | 
            -
                internalType: " | 
| 1220 | 
            -
                name: " | 
| 1221 | 
            -
                type: " | 
| 1428 | 
            +
                internalType: "address[]",
         | 
| 1429 | 
            +
                name: "",
         | 
| 1430 | 
            +
                type: "address[]"
         | 
| 1222 1431 | 
             
              }, {
         | 
| 1223 | 
            -
                internalType: " | 
| 1224 | 
            -
                name: " | 
| 1225 | 
            -
                type: " | 
| 1432 | 
            +
                internalType: "uint32[]",
         | 
| 1433 | 
            +
                name: "",
         | 
| 1434 | 
            +
                type: "uint32[]"
         | 
| 1435 | 
            +
              }],
         | 
| 1436 | 
            +
              stateMutability: "view",
         | 
| 1437 | 
            +
              type: "function"
         | 
| 1438 | 
            +
            }, {
         | 
| 1439 | 
            +
              inputs: [{
         | 
| 1440 | 
            +
                internalType: "address",
         | 
| 1441 | 
            +
                name: "caller",
         | 
| 1442 | 
            +
                type: "address"
         | 
| 1443 | 
            +
              }, {
         | 
| 1444 | 
            +
                internalType: "address",
         | 
| 1445 | 
            +
                name: "ipId",
         | 
| 1446 | 
            +
                type: "address"
         | 
| 1447 | 
            +
              }, {
         | 
| 1448 | 
            +
                internalType: "address",
         | 
| 1449 | 
            +
                name: "token",
         | 
| 1450 | 
            +
                type: "address"
         | 
| 1451 | 
            +
              }, {
         | 
| 1452 | 
            +
                internalType: "uint256",
         | 
| 1453 | 
            +
                name: "amount",
         | 
| 1454 | 
            +
                type: "uint256"
         | 
| 1455 | 
            +
              }],
         | 
| 1456 | 
            +
              name: "onRoyaltyPayment",
         | 
| 1457 | 
            +
              outputs: [],
         | 
| 1458 | 
            +
              stateMutability: "nonpayable",
         | 
| 1459 | 
            +
              type: "function"
         | 
| 1460 | 
            +
            }];
         | 
| 1461 | 
            +
             | 
| 1462 | 
            +
            var IpRoyaltyVaultABI = [{
         | 
| 1463 | 
            +
              inputs: [{
         | 
| 1464 | 
            +
                internalType: "uint256[]",
         | 
| 1465 | 
            +
                name: "snapshotIds",
         | 
| 1466 | 
            +
                type: "uint256[]"
         | 
| 1467 | 
            +
              }, {
         | 
| 1468 | 
            +
                internalType: "address",
         | 
| 1469 | 
            +
                name: "token",
         | 
| 1470 | 
            +
                type: "address"
         | 
| 1226 1471 | 
             
              }],
         | 
| 1227 | 
            -
              name: " | 
| 1472 | 
            +
              name: "claimRevenueBySnapshotBatch",
         | 
| 1228 1473 | 
             
              outputs: [],
         | 
| 1229 1474 | 
             
              stateMutability: "nonpayable",
         | 
| 1230 1475 | 
             
              type: "function"
         | 
| 1231 1476 | 
             
            }, {
         | 
| 1232 1477 | 
             
              inputs: [{
         | 
| 1233 1478 | 
             
                internalType: "uint256",
         | 
| 1234 | 
            -
                name: " | 
| 1479 | 
            +
                name: "snapshotId",
         | 
| 1235 1480 | 
             
                type: "uint256"
         | 
| 1236 1481 | 
             
              }, {
         | 
| 1482 | 
            +
                internalType: "address[]",
         | 
| 1483 | 
            +
                name: "tokens",
         | 
| 1484 | 
            +
                type: "address[]"
         | 
| 1485 | 
            +
              }],
         | 
| 1486 | 
            +
              name: "claimRevenueByTokenBatch",
         | 
| 1487 | 
            +
              outputs: [],
         | 
| 1488 | 
            +
              stateMutability: "nonpayable",
         | 
| 1489 | 
            +
              type: "function"
         | 
| 1490 | 
            +
            }, {
         | 
| 1491 | 
            +
              inputs: [{
         | 
| 1237 1492 | 
             
                internalType: "address",
         | 
| 1238 | 
            -
                name: " | 
| 1493 | 
            +
                name: "account",
         | 
| 1239 1494 | 
             
                type: "address"
         | 
| 1240 1495 | 
             
              }, {
         | 
| 1241 1496 | 
             
                internalType: "uint256",
         | 
| 1242 | 
            -
                name: " | 
| 1497 | 
            +
                name: "snapshotId",
         | 
| 1243 1498 | 
             
                type: "uint256"
         | 
| 1244 1499 | 
             
              }, {
         | 
| 1245 | 
            -
                internalType: " | 
| 1246 | 
            -
                name: " | 
| 1247 | 
            -
                type: " | 
| 1248 | 
            -
              }, | 
| 1249 | 
            -
             | 
| 1250 | 
            -
             | 
| 1251 | 
            -
                 | 
| 1252 | 
            -
             | 
| 1253 | 
            -
                 | 
| 1254 | 
            -
             | 
| 1255 | 
            -
             | 
| 1500 | 
            +
                internalType: "address",
         | 
| 1501 | 
            +
                name: "token",
         | 
| 1502 | 
            +
                type: "address"
         | 
| 1503 | 
            +
              }],
         | 
| 1504 | 
            +
              name: "claimableRevenue",
         | 
| 1505 | 
            +
              outputs: [{
         | 
| 1506 | 
            +
                internalType: "uint256",
         | 
| 1507 | 
            +
                name: "",
         | 
| 1508 | 
            +
                type: "uint256"
         | 
| 1509 | 
            +
              }],
         | 
| 1510 | 
            +
              stateMutability: "view",
         | 
| 1511 | 
            +
              type: "function"
         | 
| 1512 | 
            +
            }, {
         | 
| 1513 | 
            +
              inputs: [{
         | 
| 1514 | 
            +
                internalType: "address",
         | 
| 1515 | 
            +
                name: "ancestorIpId",
         | 
| 1516 | 
            +
                type: "address"
         | 
| 1256 1517 | 
             
              }],
         | 
| 1257 | 
            -
              name: " | 
| 1518 | 
            +
              name: "collectRoyaltyTokens",
         | 
| 1519 | 
            +
              outputs: [],
         | 
| 1520 | 
            +
              stateMutability: "nonpayable",
         | 
| 1521 | 
            +
              type: "function"
         | 
| 1522 | 
            +
            }, {
         | 
| 1523 | 
            +
              inputs: [],
         | 
| 1524 | 
            +
              name: "ipId",
         | 
| 1258 1525 | 
             
              outputs: [{
         | 
| 1259 1526 | 
             
                internalType: "address",
         | 
| 1260 1527 | 
             
                name: "",
         | 
| 1261 1528 | 
             
                type: "address"
         | 
| 1262 1529 | 
             
              }],
         | 
| 1530 | 
            +
              stateMutability: "view",
         | 
| 1531 | 
            +
              type: "function"
         | 
| 1532 | 
            +
            }];
         | 
| 1533 | 
            +
             | 
| 1534 | 
            +
            var IRoyaltyModuleABI = [{
         | 
| 1535 | 
            +
              inputs: [{
         | 
| 1536 | 
            +
                internalType: "address",
         | 
| 1537 | 
            +
                name: "receiverIpId",
         | 
| 1538 | 
            +
                type: "address"
         | 
| 1539 | 
            +
              }, {
         | 
| 1540 | 
            +
                internalType: "address",
         | 
| 1541 | 
            +
                name: "payerIpId",
         | 
| 1542 | 
            +
                type: "address"
         | 
| 1543 | 
            +
              }, {
         | 
| 1544 | 
            +
                internalType: "address",
         | 
| 1545 | 
            +
                name: "token",
         | 
| 1546 | 
            +
                type: "address"
         | 
| 1547 | 
            +
              }, {
         | 
| 1548 | 
            +
                internalType: "uint256",
         | 
| 1549 | 
            +
                name: "amount",
         | 
| 1550 | 
            +
                type: "uint256"
         | 
| 1551 | 
            +
              }],
         | 
| 1552 | 
            +
              name: "payRoyaltyOnBehalf",
         | 
| 1553 | 
            +
              outputs: [],
         | 
| 1263 1554 | 
             
              stateMutability: "nonpayable",
         | 
| 1264 1555 | 
             
              type: "function"
         | 
| 1265 1556 | 
             
            }];
         | 
| @@ -1284,6 +1575,18 @@ var ErrorsABI = [{ | |
| 1284 1575 | 
             
              inputs: [],
         | 
| 1285 1576 | 
             
              name: "AccessControlled__ZeroAddress",
         | 
| 1286 1577 | 
             
              type: "error"
         | 
| 1578 | 
            +
            }, {
         | 
| 1579 | 
            +
              inputs: [{
         | 
| 1580 | 
            +
                internalType: "address",
         | 
| 1581 | 
            +
                name: "signer",
         | 
| 1582 | 
            +
                type: "address"
         | 
| 1583 | 
            +
              }, {
         | 
| 1584 | 
            +
                internalType: "address",
         | 
| 1585 | 
            +
                name: "to",
         | 
| 1586 | 
            +
                type: "address"
         | 
| 1587 | 
            +
              }],
         | 
| 1588 | 
            +
              name: "AccessController__BothCallerAndRecipientAreNotRegisteredModule",
         | 
| 1589 | 
            +
              type: "error"
         | 
| 1287 1590 | 
             
            }, {
         | 
| 1288 1591 | 
             
              inputs: [],
         | 
| 1289 1592 | 
             
              name: "AccessController__CallerIsNotIPAccount",
         | 
| @@ -1324,61 +1627,29 @@ var ErrorsABI = [{ | |
| 1324 1627 | 
             
              inputs: [],
         | 
| 1325 1628 | 
             
              name: "AccessController__PermissionIsNotValid",
         | 
| 1326 1629 | 
             
              type: "error"
         | 
| 1327 | 
            -
            }, {
         | 
| 1328 | 
            -
              inputs: [{
         | 
| 1329 | 
            -
                internalType: "address",
         | 
| 1330 | 
            -
                name: "to",
         | 
| 1331 | 
            -
                type: "address"
         | 
| 1332 | 
            -
              }],
         | 
| 1333 | 
            -
              name: "AccessController__RecipientIsNotRegisteredModule",
         | 
| 1334 | 
            -
              type: "error"
         | 
| 1335 1630 | 
             
            }, {
         | 
| 1336 1631 | 
             
              inputs: [],
         | 
| 1337 1632 | 
             
              name: "AccessController__SignerIsZeroAddress",
         | 
| 1338 1633 | 
             
              type: "error"
         | 
| 1339 1634 | 
             
            }, {
         | 
| 1340 1635 | 
             
              inputs: [],
         | 
| 1341 | 
            -
              name: " | 
| 1342 | 
            -
              type: "error"
         | 
| 1343 | 
            -
            }, {
         | 
| 1344 | 
            -
              inputs: [],
         | 
| 1345 | 
            -
              name: "AncestorsVaultLAP__ClaimerNotAnAncestor",
         | 
| 1346 | 
            -
              type: "error"
         | 
| 1347 | 
            -
            }, {
         | 
| 1348 | 
            -
              inputs: [],
         | 
| 1349 | 
            -
              name: "AncestorsVaultLAP__ERC20BalanceNotZero",
         | 
| 1350 | 
            -
              type: "error"
         | 
| 1351 | 
            -
            }, {
         | 
| 1352 | 
            -
              inputs: [],
         | 
| 1353 | 
            -
              name: "AncestorsVaultLAP__ETHBalanceNotZero",
         | 
| 1354 | 
            -
              type: "error"
         | 
| 1355 | 
            -
            }, {
         | 
| 1356 | 
            -
              inputs: [],
         | 
| 1357 | 
            -
              name: "AncestorsVaultLAP__InvalidAncestorsHash",
         | 
| 1358 | 
            -
              type: "error"
         | 
| 1359 | 
            -
            }, {
         | 
| 1360 | 
            -
              inputs: [],
         | 
| 1361 | 
            -
              name: "AncestorsVaultLAP__InvalidClaimer",
         | 
| 1362 | 
            -
              type: "error"
         | 
| 1363 | 
            -
            }, {
         | 
| 1364 | 
            -
              inputs: [],
         | 
| 1365 | 
            -
              name: "AncestorsVaultLAP__TransferFailed",
         | 
| 1636 | 
            +
              name: "ArbitrationPolicySP__NotDisputeModule",
         | 
| 1366 1637 | 
             
              type: "error"
         | 
| 1367 1638 | 
             
            }, {
         | 
| 1368 1639 | 
             
              inputs: [],
         | 
| 1369 | 
            -
              name: " | 
| 1640 | 
            +
              name: "ArbitrationPolicySP__ZeroDisputeModule",
         | 
| 1370 1641 | 
             
              type: "error"
         | 
| 1371 1642 | 
             
            }, {
         | 
| 1372 1643 | 
             
              inputs: [],
         | 
| 1373 | 
            -
              name: " | 
| 1644 | 
            +
              name: "ArbitrationPolicySP__ZeroPaymentToken",
         | 
| 1374 1645 | 
             
              type: "error"
         | 
| 1375 1646 | 
             
            }, {
         | 
| 1376 1647 | 
             
              inputs: [],
         | 
| 1377 | 
            -
              name: " | 
| 1648 | 
            +
              name: "BasePolicyFrameworkManager__CallerNotLicensingModule",
         | 
| 1378 1649 | 
             
              type: "error"
         | 
| 1379 1650 | 
             
            }, {
         | 
| 1380 1651 | 
             
              inputs: [],
         | 
| 1381 | 
            -
              name: " | 
| 1652 | 
            +
              name: "CoreMetadataModule__MetadataAlreadyFrozen",
         | 
| 1382 1653 | 
             
              type: "error"
         | 
| 1383 1654 | 
             
            }, {
         | 
| 1384 1655 | 
             
              inputs: [],
         | 
| @@ -1408,10 +1679,6 @@ var ErrorsABI = [{ | |
| 1408 1679 | 
             
              inputs: [],
         | 
| 1409 1680 | 
             
              name: "DisputeModule__NotWhitelistedDisputeTag",
         | 
| 1410 1681 | 
             
              type: "error"
         | 
| 1411 | 
            -
            }, {
         | 
| 1412 | 
            -
              inputs: [],
         | 
| 1413 | 
            -
              name: "DisputeModule__UnauthorizedAccess",
         | 
| 1414 | 
            -
              type: "error"
         | 
| 1415 1682 | 
             
            }, {
         | 
| 1416 1683 | 
             
              inputs: [],
         | 
| 1417 1684 | 
             
              name: "DisputeModule__ZeroArbitrationPolicy",
         | 
| @@ -1496,6 +1763,18 @@ var ErrorsABI = [{ | |
| 1496 1763 | 
             
              inputs: [],
         | 
| 1497 1764 | 
             
              name: "IPAssetRegistry__InvalidMetadataProvider",
         | 
| 1498 1765 | 
             
              type: "error"
         | 
| 1766 | 
            +
            }, {
         | 
| 1767 | 
            +
              inputs: [{
         | 
| 1768 | 
            +
                internalType: "address",
         | 
| 1769 | 
            +
                name: "contractAddress",
         | 
| 1770 | 
            +
                type: "address"
         | 
| 1771 | 
            +
              }, {
         | 
| 1772 | 
            +
                internalType: "uint256",
         | 
| 1773 | 
            +
                name: "tokenId",
         | 
| 1774 | 
            +
                type: "uint256"
         | 
| 1775 | 
            +
              }],
         | 
| 1776 | 
            +
              name: "IPAssetRegistry__InvalidToken",
         | 
| 1777 | 
            +
              type: "error"
         | 
| 1499 1778 | 
             
            }, {
         | 
| 1500 1779 | 
             
              inputs: [],
         | 
| 1501 1780 | 
             
              name: "IPAssetRegistry__NotYetRegistered",
         | 
| @@ -1512,6 +1791,22 @@ var ErrorsABI = [{ | |
| 1512 1791 | 
             
              inputs: [],
         | 
| 1513 1792 | 
             
              name: "IPAssetRegistry__Unauthorized",
         | 
| 1514 1793 | 
             
              type: "error"
         | 
| 1794 | 
            +
            }, {
         | 
| 1795 | 
            +
              inputs: [{
         | 
| 1796 | 
            +
                internalType: "address",
         | 
| 1797 | 
            +
                name: "contractAddress",
         | 
| 1798 | 
            +
                type: "address"
         | 
| 1799 | 
            +
              }],
         | 
| 1800 | 
            +
              name: "IPAssetRegistry__UnsupportedIERC721",
         | 
| 1801 | 
            +
              type: "error"
         | 
| 1802 | 
            +
            }, {
         | 
| 1803 | 
            +
              inputs: [{
         | 
| 1804 | 
            +
                internalType: "address",
         | 
| 1805 | 
            +
                name: "contractAddress",
         | 
| 1806 | 
            +
                type: "address"
         | 
| 1807 | 
            +
              }],
         | 
| 1808 | 
            +
              name: "IPAssetRegistry__UnsupportedIERC721Metadata",
         | 
| 1809 | 
            +
              type: "error"
         | 
| 1515 1810 | 
             
            }, {
         | 
| 1516 1811 | 
             
              inputs: [],
         | 
| 1517 1812 | 
             
              name: "IPResolver_InvalidIP",
         | 
| @@ -1520,6 +1815,30 @@ var ErrorsABI = [{ | |
| 1520 1815 | 
             
              inputs: [],
         | 
| 1521 1816 | 
             
              name: "IPResolver_Unauthorized",
         | 
| 1522 1817 | 
             
              type: "error"
         | 
| 1818 | 
            +
            }, {
         | 
| 1819 | 
            +
              inputs: [],
         | 
| 1820 | 
            +
              name: "IpRoyaltyVault__AlreadyClaimed",
         | 
| 1821 | 
            +
              type: "error"
         | 
| 1822 | 
            +
            }, {
         | 
| 1823 | 
            +
              inputs: [],
         | 
| 1824 | 
            +
              name: "IpRoyaltyVault__ClaimerNotAnAncestor",
         | 
| 1825 | 
            +
              type: "error"
         | 
| 1826 | 
            +
            }, {
         | 
| 1827 | 
            +
              inputs: [],
         | 
| 1828 | 
            +
              name: "IpRoyaltyVault__NotRoyaltyPolicyLAP",
         | 
| 1829 | 
            +
              type: "error"
         | 
| 1830 | 
            +
            }, {
         | 
| 1831 | 
            +
              inputs: [],
         | 
| 1832 | 
            +
              name: "IpRoyaltyVault__SnapshotIntervalTooShort",
         | 
| 1833 | 
            +
              type: "error"
         | 
| 1834 | 
            +
            }, {
         | 
| 1835 | 
            +
              inputs: [],
         | 
| 1836 | 
            +
              name: "IpRoyaltyVault__ZeroIpId",
         | 
| 1837 | 
            +
              type: "error"
         | 
| 1838 | 
            +
            }, {
         | 
| 1839 | 
            +
              inputs: [],
         | 
| 1840 | 
            +
              name: "IpRoyaltyVault__ZeroRoyaltyPolicyLAP",
         | 
| 1841 | 
            +
              type: "error"
         | 
| 1523 1842 | 
             
            }, {
         | 
| 1524 1843 | 
             
              inputs: [],
         | 
| 1525 1844 | 
             
              name: "LicenseRegistry__CallerNotLicensingModule",
         | 
| @@ -1540,10 +1859,6 @@ var ErrorsABI = [{ | |
| 1540 1859 | 
             
              inputs: [],
         | 
| 1541 1860 | 
             
              name: "LicenseRegistry__ZeroLicensingModule",
         | 
| 1542 1861 | 
             
              type: "error"
         | 
| 1543 | 
            -
            }, {
         | 
| 1544 | 
            -
              inputs: [],
         | 
| 1545 | 
            -
              name: "LicensingModuleAware__CallerNotLicensingModule",
         | 
| 1546 | 
            -
              type: "error"
         | 
| 1547 1862 | 
             
            }, {
         | 
| 1548 1863 | 
             
              inputs: [],
         | 
| 1549 1864 | 
             
              name: "LicensingModule__CallerNotLicenseRegistry",
         | 
| @@ -1604,6 +1919,10 @@ var ErrorsABI = [{ | |
| 1604 1919 | 
             
              inputs: [],
         | 
| 1605 1920 | 
             
              name: "LicensingModule__InvalidPolicyFramework",
         | 
| 1606 1921 | 
             
              type: "error"
         | 
| 1922 | 
            +
            }, {
         | 
| 1923 | 
            +
              inputs: [],
         | 
| 1924 | 
            +
              name: "LicensingModule__IpAlreadyLinked",
         | 
| 1925 | 
            +
              type: "error"
         | 
| 1607 1926 | 
             
            }, {
         | 
| 1608 1927 | 
             
              inputs: [],
         | 
| 1609 1928 | 
             
              name: "LicensingModule__LicensorDoesntHaveThisPolicy",
         | 
| @@ -1620,6 +1939,10 @@ var ErrorsABI = [{ | |
| 1620 1939 | 
             
              inputs: [],
         | 
| 1621 1940 | 
             
              name: "LicensingModule__LinkingRevokedLicense",
         | 
| 1622 1941 | 
             
              type: "error"
         | 
| 1942 | 
            +
            }, {
         | 
| 1943 | 
            +
              inputs: [],
         | 
| 1944 | 
            +
              name: "LicensingModule__MintAmountZero",
         | 
| 1945 | 
            +
              type: "error"
         | 
| 1623 1946 | 
             
            }, {
         | 
| 1624 1947 | 
             
              inputs: [],
         | 
| 1625 1948 | 
             
              name: "LicensingModule__MintLicenseParamFailed",
         | 
| @@ -1656,6 +1979,10 @@ var ErrorsABI = [{ | |
| 1656 1979 | 
             
              inputs: [],
         | 
| 1657 1980 | 
             
              name: "LicensingModule__PolicyNotFound",
         | 
| 1658 1981 | 
             
              type: "error"
         | 
| 1982 | 
            +
            }, {
         | 
| 1983 | 
            +
              inputs: [],
         | 
| 1984 | 
            +
              name: "LicensingModule__ReceiverZeroAddress",
         | 
| 1985 | 
            +
              type: "error"
         | 
| 1659 1986 | 
             
            }, {
         | 
| 1660 1987 | 
             
              inputs: [],
         | 
| 1661 1988 | 
             
              name: "LicensingModule__RegisterPolicyFrameworkMismatch",
         | 
| @@ -1784,10 +2111,6 @@ var ErrorsABI = [{ | |
| 1784 2111 | 
             
              inputs: [],
         | 
| 1785 2112 | 
             
              name: "PolicyFrameworkManager__GettingPolicyWrongFramework",
         | 
| 1786 2113 | 
             
              type: "error"
         | 
| 1787 | 
            -
            }, {
         | 
| 1788 | 
            -
              inputs: [],
         | 
| 1789 | 
            -
              name: "RegistrationModule__InvalidOwner",
         | 
| 1790 | 
            -
              type: "error"
         | 
| 1791 2114 | 
             
            }, {
         | 
| 1792 2115 | 
             
              inputs: [],
         | 
| 1793 2116 | 
             
              name: "RoyaltyModule__CanOnlyMintSelectedPolicy",
         | 
| @@ -1808,10 +2131,6 @@ var ErrorsABI = [{ | |
| 1808 2131 | 
             
              inputs: [],
         | 
| 1809 2132 | 
             
              name: "RoyaltyModule__NotAllowedCaller",
         | 
| 1810 2133 | 
             
              type: "error"
         | 
| 1811 | 
            -
            }, {
         | 
| 1812 | 
            -
              inputs: [],
         | 
| 1813 | 
            -
              name: "RoyaltyModule__NotRegisteredIpId",
         | 
| 1814 | 
            -
              type: "error"
         | 
| 1815 2134 | 
             
            }, {
         | 
| 1816 2135 | 
             
              inputs: [],
         | 
| 1817 2136 | 
             
              name: "RoyaltyModule__NotWhitelistedRoyaltyPolicy",
         | 
| @@ -1848,30 +2167,10 @@ var ErrorsABI = [{ | |
| 1848 2167 | 
             
              inputs: [],
         | 
| 1849 2168 | 
             
              name: "RoyaltyPolicyLAP__ImplementationAlreadySet",
         | 
| 1850 2169 | 
             
              type: "error"
         | 
| 1851 | 
            -
            }, {
         | 
| 1852 | 
            -
              inputs: [],
         | 
| 1853 | 
            -
              name: "RoyaltyPolicyLAP__InvalidAncestors",
         | 
| 1854 | 
            -
              type: "error"
         | 
| 1855 | 
            -
            }, {
         | 
| 1856 | 
            -
              inputs: [],
         | 
| 1857 | 
            -
              name: "RoyaltyPolicyLAP__InvalidAncestorsHash",
         | 
| 1858 | 
            -
              type: "error"
         | 
| 1859 | 
            -
            }, {
         | 
| 1860 | 
            -
              inputs: [],
         | 
| 1861 | 
            -
              name: "RoyaltyPolicyLAP__InvalidAncestorsLength",
         | 
| 1862 | 
            -
              type: "error"
         | 
| 1863 | 
            -
            }, {
         | 
| 1864 | 
            -
              inputs: [],
         | 
| 1865 | 
            -
              name: "RoyaltyPolicyLAP__InvalidAncestorsRoyalty",
         | 
| 1866 | 
            -
              type: "error"
         | 
| 1867 2170 | 
             
            }, {
         | 
| 1868 2171 | 
             
              inputs: [],
         | 
| 1869 2172 | 
             
              name: "RoyaltyPolicyLAP__InvalidParentRoyaltiesLength",
         | 
| 1870 2173 | 
             
              type: "error"
         | 
| 1871 | 
            -
            }, {
         | 
| 1872 | 
            -
              inputs: [],
         | 
| 1873 | 
            -
              name: "RoyaltyPolicyLAP__InvalidRoyaltyAmountLength",
         | 
| 1874 | 
            -
              type: "error"
         | 
| 1875 2174 | 
             
            }, {
         | 
| 1876 2175 | 
             
              inputs: [],
         | 
| 1877 2176 | 
             
              name: "RoyaltyPolicyLAP__LastPositionNotAbleToMintLicense",
         | 
| @@ -1886,15 +2185,15 @@ var ErrorsABI = [{ | |
| 1886 2185 | 
             
              type: "error"
         | 
| 1887 2186 | 
             
            }, {
         | 
| 1888 2187 | 
             
              inputs: [],
         | 
| 1889 | 
            -
              name: " | 
| 2188 | 
            +
              name: "RoyaltyPolicyLAP__UnlinkableToParents",
         | 
| 1890 2189 | 
             
              type: "error"
         | 
| 1891 2190 | 
             
            }, {
         | 
| 1892 2191 | 
             
              inputs: [],
         | 
| 1893 | 
            -
              name: " | 
| 2192 | 
            +
              name: "RoyaltyPolicyLAP__ZeroAncestorsVaultImpl",
         | 
| 1894 2193 | 
             
              type: "error"
         | 
| 1895 2194 | 
             
            }, {
         | 
| 1896 2195 | 
             
              inputs: [],
         | 
| 1897 | 
            -
              name: " | 
| 2196 | 
            +
              name: "RoyaltyPolicyLAP__ZeroIpRoyaltyVaultBeacon",
         | 
| 1898 2197 | 
             
              type: "error"
         | 
| 1899 2198 | 
             
            }, {
         | 
| 1900 2199 | 
             
              inputs: [],
         | 
| @@ -1938,538 +2237,229 @@ var sepolia = { | |
| 1938 2237 | 
             
              RoyaltyPolicyLAP: "0x16eF58e959522727588921A92e9084d36E5d3855",
         | 
| 1939 2238 | 
             
              TokenWithdrawalModule: "0x66738a5722e9Cd91B694bA39146CFEcE95457F04"
         | 
| 1940 2239 | 
             
            };
         | 
| 2240 | 
            +
            var storyTestnet = {
         | 
| 2241 | 
            +
              AccessController: "0x6fB5BA9A8747E897109044a1cd1192898AA384a9",
         | 
| 2242 | 
            +
              ArbitrationPolicySP: "0x114aE96d362b802Ed92758A21992e429e9E83565",
         | 
| 2243 | 
            +
              DisputeModule: "0x837d095F9A11178545DF4114C44fb526dcf74168",
         | 
| 2244 | 
            +
              Governance: "0x0Fee5B61cF0976f3F59138146a9180a107738db9",
         | 
| 2245 | 
            +
              IPAccountImpl: "0x6d1398e1ceE174a3e41d6eB50F00Fe43132f9C8A",
         | 
| 2246 | 
            +
              IPAccountRegistry: "0x0CCc0CD388477ED0D7531d2aD6e68c9E24B8392d",
         | 
| 2247 | 
            +
              IPAssetRegistry: "0x30C89bCB41277f09b18DF0375b9438909e193bf0",
         | 
| 2248 | 
            +
              IpRoyaltyVaultBeacon: "0x8C7664Befc382A282F8aA821A2d337960e410E77",
         | 
| 2249 | 
            +
              IpRoyaltyVaultImpl: "0x0dB6AAb7525F03Bf94A1fC08A9aACCc2Ad25eD12",
         | 
| 2250 | 
            +
              LicenseRegistry: "0x790717fBa06Aa219Fc3A502ce360d8dEAF273Eb5",
         | 
| 2251 | 
            +
              LicensingModule: "0xB7a83a5f3C8b512A6DfE294ad4811F1b4AA10E96",
         | 
| 2252 | 
            +
              MockERC20: "0xCc97e835157daf88820cbDE105ADFF5d7981A382",
         | 
| 2253 | 
            +
              MockERC721: "0x7c0004C6D352bC0a0531AaD46d33A03D9d51ab1D",
         | 
| 2254 | 
            +
              MockTokenGatedHook: "0xD3Aa4F5B77509907FF3d7a90cEadE19bab2b6Fdb",
         | 
| 2255 | 
            +
              ModuleRegistry: "0xab0bf9846eCE1299AaA1cB3FF5EfbBA328968771",
         | 
| 2256 | 
            +
              PILPolicyFrameworkManager: "0x251bce81DF5957123869E43269C4E29308A062c4",
         | 
| 2257 | 
            +
              RoyaltyModule: "0xF77b0933F6aaC2dCE2eAa0d79f6Bfd6b9347a5E7",
         | 
| 2258 | 
            +
              RoyaltyPolicyLAP: "0x31f263D48df5FA5956E2Ba614b150e2A0fE1aDd3",
         | 
| 2259 | 
            +
              TokenWithdrawalModule: "0x446B734C3Fc13c53b4E32FEFCaaED97e0100552D"
         | 
| 2260 | 
            +
            };
         | 
| 2261 | 
            +
            var contractAddress = {
         | 
| 2262 | 
            +
              sepolia: sepolia,
         | 
| 2263 | 
            +
              11155111: sepolia,
         | 
| 2264 | 
            +
              storyTestnet: storyTestnet,
         | 
| 2265 | 
            +
              1513: storyTestnet
         | 
| 2266 | 
            +
            };
         | 
| 1941 2267 |  | 
| 1942 2268 | 
             
            var IPAccountABI = [].concat(_toConsumableArray(IPAccountImplABI), _toConsumableArray(ErrorsABI));
         | 
| 1943 | 
            -
            var  | 
| 1944 | 
            -
               | 
| 1945 | 
            -
             | 
| 2269 | 
            +
            var getIPAssetRegistryConfig = function getIPAssetRegistryConfig(chain) {
         | 
| 2270 | 
            +
              return {
         | 
| 2271 | 
            +
                abi: IPAssetRegistryABI,
         | 
| 2272 | 
            +
                address: viem.getAddress(contractAddress[chain].IPAssetRegistry)
         | 
| 2273 | 
            +
              };
         | 
| 1946 2274 | 
             
            };
         | 
| 1947 | 
            -
            var  | 
| 1948 | 
            -
               | 
| 1949 | 
            -
             | 
| 2275 | 
            +
            var getAccessControllerConfig = function getAccessControllerConfig(chain) {
         | 
| 2276 | 
            +
              return {
         | 
| 2277 | 
            +
                abi: [].concat(_toConsumableArray(AccessControllerABI), _toConsumableArray(ErrorsABI)),
         | 
| 2278 | 
            +
                address: viem.getAddress(contractAddress[chain].AccessController)
         | 
| 2279 | 
            +
              };
         | 
| 2280 | 
            +
            };
         | 
| 2281 | 
            +
            var getDisputeModuleConfig = function getDisputeModuleConfig(chain) {
         | 
| 2282 | 
            +
              return {
         | 
| 2283 | 
            +
                abi: [].concat(_toConsumableArray(DisputeModuleABI), _toConsumableArray(ErrorsABI)),
         | 
| 2284 | 
            +
                address: viem.getAddress(contractAddress[chain].DisputeModule)
         | 
| 2285 | 
            +
              };
         | 
| 1950 2286 | 
             
            };
         | 
| 1951 | 
            -
            var  | 
| 1952 | 
            -
               | 
| 1953 | 
            -
             | 
| 2287 | 
            +
            var getLicenseRegistryConfig = function getLicenseRegistryConfig(chain) {
         | 
| 2288 | 
            +
              return {
         | 
| 2289 | 
            +
                abi: IERC1155ABI,
         | 
| 2290 | 
            +
                address: viem.getAddress(contractAddress[chain].LicenseRegistry)
         | 
| 2291 | 
            +
              };
         | 
| 1954 2292 | 
             
            };
         | 
| 1955 | 
            -
            var  | 
| 1956 | 
            -
               | 
| 1957 | 
            -
             | 
| 2293 | 
            +
            var getLicensingModuleConfig = function getLicensingModuleConfig(chain) {
         | 
| 2294 | 
            +
              return {
         | 
| 2295 | 
            +
                abi: [].concat(_toConsumableArray(LicensingModuleABI), _toConsumableArray(ErrorsABI)),
         | 
| 2296 | 
            +
                address: viem.getAddress(contractAddress[chain].LicensingModule)
         | 
| 2297 | 
            +
              };
         | 
| 1958 2298 | 
             
            };
         | 
| 1959 | 
            -
            var  | 
| 1960 | 
            -
               | 
| 1961 | 
            -
             | 
| 2299 | 
            +
            var getPILPolicyFrameworkManagerConfig = function getPILPolicyFrameworkManagerConfig(chain) {
         | 
| 2300 | 
            +
              return {
         | 
| 2301 | 
            +
                abi: [].concat(_toConsumableArray(PILPolicyFrameworkManagerABI), _toConsumableArray(ErrorsABI)),
         | 
| 2302 | 
            +
                address: viem.getAddress(contractAddress[chain].PILPolicyFrameworkManager)
         | 
| 2303 | 
            +
              };
         | 
| 1962 2304 | 
             
            };
         | 
| 1963 | 
            -
            var  | 
| 1964 | 
            -
               | 
| 1965 | 
            -
             | 
| 2305 | 
            +
            var getRoyaltyPolicyLAPConfig = function getRoyaltyPolicyLAPConfig(chain) {
         | 
| 2306 | 
            +
              return {
         | 
| 2307 | 
            +
                abi: [].concat(_toConsumableArray(IRoyaltyPolicyLAPABI), _toConsumableArray(ErrorsABI)),
         | 
| 2308 | 
            +
                address: viem.getAddress(contractAddress[chain].RoyaltyPolicyLAP)
         | 
| 2309 | 
            +
              };
         | 
| 1966 2310 | 
             
            };
         | 
| 1967 | 
            -
            var  | 
| 1968 | 
            -
               | 
| 1969 | 
            -
             | 
| 2311 | 
            +
            var getRoyaltyVaultImplConfig = function getRoyaltyVaultImplConfig(chain) {
         | 
| 2312 | 
            +
              return {
         | 
| 2313 | 
            +
                abi: [].concat(_toConsumableArray(IpRoyaltyVaultABI), _toConsumableArray(ErrorsABI)),
         | 
| 2314 | 
            +
                address: viem.getAddress(contractAddress[chain].IpRoyaltyVaultImpl)
         | 
| 2315 | 
            +
              };
         | 
| 1970 2316 | 
             
            };
         | 
| 1971 | 
            -
            var  | 
| 1972 | 
            -
               | 
| 2317 | 
            +
            var getRoyaltyModuleConfig = function getRoyaltyModuleConfig(chain) {
         | 
| 2318 | 
            +
              return {
         | 
| 2319 | 
            +
                abi: [].concat(_toConsumableArray(IRoyaltyModuleABI), _toConsumableArray(ErrorsABI)),
         | 
| 2320 | 
            +
                address: viem.getAddress(contractAddress[chain].RoyaltyModule)
         | 
| 2321 | 
            +
              };
         | 
| 1973 2322 | 
             
            };
         | 
| 1974 2323 |  | 
| 1975 | 
            -
            function  | 
| 1976 | 
            -
               | 
| 1977 | 
            -
             | 
| 1978 | 
            -
                if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
         | 
| 1979 | 
            -
                  if (it) o = it;
         | 
| 1980 | 
            -
                  var i = 0;
         | 
| 1981 | 
            -
                  var F = function () {};
         | 
| 1982 | 
            -
                  return {
         | 
| 1983 | 
            -
                    s: F,
         | 
| 1984 | 
            -
                    n: function () {
         | 
| 1985 | 
            -
                      if (i >= o.length) return {
         | 
| 1986 | 
            -
                        done: true
         | 
| 1987 | 
            -
                      };
         | 
| 1988 | 
            -
                      return {
         | 
| 1989 | 
            -
                        done: false,
         | 
| 1990 | 
            -
                        value: o[i++]
         | 
| 1991 | 
            -
                      };
         | 
| 1992 | 
            -
                    },
         | 
| 1993 | 
            -
                    e: function (e) {
         | 
| 1994 | 
            -
                      throw e;
         | 
| 1995 | 
            -
                    },
         | 
| 1996 | 
            -
                    f: F
         | 
| 1997 | 
            -
                  };
         | 
| 1998 | 
            -
                }
         | 
| 1999 | 
            -
                throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
         | 
| 2000 | 
            -
              }
         | 
| 2001 | 
            -
              var normalCompletion = true,
         | 
| 2002 | 
            -
                didErr = false,
         | 
| 2003 | 
            -
                err;
         | 
| 2004 | 
            -
              return {
         | 
| 2005 | 
            -
                s: function () {
         | 
| 2006 | 
            -
                  it = it.call(o);
         | 
| 2007 | 
            -
                },
         | 
| 2008 | 
            -
                n: function () {
         | 
| 2009 | 
            -
                  var step = it.next();
         | 
| 2010 | 
            -
                  normalCompletion = step.done;
         | 
| 2011 | 
            -
                  return step;
         | 
| 2012 | 
            -
                },
         | 
| 2013 | 
            -
                e: function (e) {
         | 
| 2014 | 
            -
                  didErr = true;
         | 
| 2015 | 
            -
                  err = e;
         | 
| 2016 | 
            -
                },
         | 
| 2017 | 
            -
                f: function () {
         | 
| 2018 | 
            -
                  try {
         | 
| 2019 | 
            -
                    if (!normalCompletion && it.return != null) it.return();
         | 
| 2020 | 
            -
                  } finally {
         | 
| 2021 | 
            -
                    if (didErr) throw err;
         | 
| 2022 | 
            -
                  }
         | 
| 2023 | 
            -
                }
         | 
| 2024 | 
            -
              };
         | 
| 2025 | 
            -
            }
         | 
| 2026 | 
            -
             | 
| 2027 | 
            -
            function parseToBigInt(num) {
         | 
| 2028 | 
            -
              return BigInt(num);
         | 
| 2029 | 
            -
            }
         | 
| 2030 | 
            -
            function waitTxAndFilterLog(_x, _x2, _x3) {
         | 
| 2031 | 
            -
              return _waitTxAndFilterLog.apply(this, arguments);
         | 
| 2032 | 
            -
            }
         | 
| 2033 | 
            -
            function _waitTxAndFilterLog() {
         | 
| 2034 | 
            -
              _waitTxAndFilterLog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(client, txHash, params) {
         | 
| 2035 | 
            -
                var txReceipt, targetLogs, _iterator, _step, log, currentLog;
         | 
| 2036 | 
            -
                return _regeneratorRuntime().wrap(function _callee$(_context) {
         | 
| 2037 | 
            -
                  while (1) switch (_context.prev = _context.next) {
         | 
| 2038 | 
            -
                    case 0:
         | 
| 2039 | 
            -
                      _context.next = 2;
         | 
| 2040 | 
            -
                      return client.waitForTransactionReceipt({
         | 
| 2041 | 
            -
                        hash: txHash,
         | 
| 2042 | 
            -
                        confirmations: params.confirmations,
         | 
| 2043 | 
            -
                        pollingInterval: params.pollingInterval,
         | 
| 2044 | 
            -
                        timeout: params.timeout
         | 
| 2045 | 
            -
                      });
         | 
| 2046 | 
            -
                    case 2:
         | 
| 2047 | 
            -
                      txReceipt = _context.sent;
         | 
| 2048 | 
            -
                      targetLogs = [];
         | 
| 2049 | 
            -
                      _iterator = _createForOfIteratorHelper(txReceipt.logs);
         | 
| 2050 | 
            -
                      _context.prev = 5;
         | 
| 2051 | 
            -
                      _iterator.s();
         | 
| 2052 | 
            -
                    case 7:
         | 
| 2053 | 
            -
                      if ((_step = _iterator.n()).done) {
         | 
| 2054 | 
            -
                        _context.next = 21;
         | 
| 2055 | 
            -
                        break;
         | 
| 2056 | 
            -
                      }
         | 
| 2057 | 
            -
                      log = _step.value;
         | 
| 2058 | 
            -
                      _context.prev = 9;
         | 
| 2059 | 
            -
                      if (!(params.from && log.address !== params.from.toLowerCase())) {
         | 
| 2060 | 
            -
                        _context.next = 12;
         | 
| 2061 | 
            -
                        break;
         | 
| 2062 | 
            -
                      }
         | 
| 2063 | 
            -
                      return _context.abrupt("continue", 19);
         | 
| 2064 | 
            -
                    case 12:
         | 
| 2065 | 
            -
                      currentLog = viem.decodeEventLog({
         | 
| 2066 | 
            -
                        abi: params.abi,
         | 
| 2067 | 
            -
                        eventName: params.eventName,
         | 
| 2068 | 
            -
                        data: log.data,
         | 
| 2069 | 
            -
                        topics: log.topics
         | 
| 2070 | 
            -
                      });
         | 
| 2071 | 
            -
                      targetLogs.push(currentLog);
         | 
| 2072 | 
            -
                      _context.next = 19;
         | 
| 2073 | 
            -
                      break;
         | 
| 2074 | 
            -
                    case 16:
         | 
| 2075 | 
            -
                      _context.prev = 16;
         | 
| 2076 | 
            -
                      _context.t0 = _context["catch"](9);
         | 
| 2077 | 
            -
                      return _context.abrupt("continue", 19);
         | 
| 2078 | 
            -
                    case 19:
         | 
| 2079 | 
            -
                      _context.next = 7;
         | 
| 2080 | 
            -
                      break;
         | 
| 2081 | 
            -
                    case 21:
         | 
| 2082 | 
            -
                      _context.next = 26;
         | 
| 2083 | 
            -
                      break;
         | 
| 2084 | 
            -
                    case 23:
         | 
| 2085 | 
            -
                      _context.prev = 23;
         | 
| 2086 | 
            -
                      _context.t1 = _context["catch"](5);
         | 
| 2087 | 
            -
                      _iterator.e(_context.t1);
         | 
| 2088 | 
            -
                    case 26:
         | 
| 2089 | 
            -
                      _context.prev = 26;
         | 
| 2090 | 
            -
                      _iterator.f();
         | 
| 2091 | 
            -
                      return _context.finish(26);
         | 
| 2092 | 
            -
                    case 29:
         | 
| 2093 | 
            -
                      if (!(targetLogs.length === 0)) {
         | 
| 2094 | 
            -
                        _context.next = 31;
         | 
| 2095 | 
            -
                        break;
         | 
| 2096 | 
            -
                      }
         | 
| 2097 | 
            -
                      throw new Error("not found event ".concat(params.eventName, " in target transaction"));
         | 
| 2098 | 
            -
                    case 31:
         | 
| 2099 | 
            -
                      return _context.abrupt("return", targetLogs);
         | 
| 2100 | 
            -
                    case 32:
         | 
| 2101 | 
            -
                    case "end":
         | 
| 2102 | 
            -
                      return _context.stop();
         | 
| 2103 | 
            -
                  }
         | 
| 2104 | 
            -
                }, _callee, null, [[5, 23, 26, 29], [9, 16]]);
         | 
| 2105 | 
            -
              }));
         | 
| 2106 | 
            -
              return _waitTxAndFilterLog.apply(this, arguments);
         | 
| 2107 | 
            -
            }
         | 
| 2108 | 
            -
            function waitTx(_x4, _x5, _x6) {
         | 
| 2109 | 
            -
              return _waitTx.apply(this, arguments);
         | 
| 2110 | 
            -
            }
         | 
| 2111 | 
            -
            function _waitTx() {
         | 
| 2112 | 
            -
              _waitTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(client, txHash, params) {
         | 
| 2113 | 
            -
                return _regeneratorRuntime().wrap(function _callee2$(_context2) {
         | 
| 2114 | 
            -
                  while (1) switch (_context2.prev = _context2.next) {
         | 
| 2115 | 
            -
                    case 0:
         | 
| 2116 | 
            -
                      _context2.next = 2;
         | 
| 2117 | 
            -
                      return client.waitForTransactionReceipt(_objectSpread2({
         | 
| 2118 | 
            -
                        hash: txHash
         | 
| 2119 | 
            -
                      }, params));
         | 
| 2120 | 
            -
                    case 2:
         | 
| 2121 | 
            -
                    case "end":
         | 
| 2122 | 
            -
                      return _context2.stop();
         | 
| 2123 | 
            -
                  }
         | 
| 2124 | 
            -
                }, _callee2);
         | 
| 2125 | 
            -
              }));
         | 
| 2126 | 
            -
              return _waitTx.apply(this, arguments);
         | 
| 2127 | 
            -
            }
         | 
| 2128 | 
            -
            function typedDataToBytes(typedData) {
         | 
| 2129 | 
            -
              return viem.encodeAbiParameters(viem.parseAbiParameters(typedData["interface"]), typedData.data);
         | 
| 2130 | 
            -
            }
         | 
| 2131 | 
            -
            function chainStringToViemChain(chainId) {
         | 
| 2132 | 
            -
              switch (chainId) {
         | 
| 2133 | 
            -
                case "1":
         | 
| 2134 | 
            -
                case "mainnet":
         | 
| 2135 | 
            -
                  return chains.mainnet;
         | 
| 2136 | 
            -
                case "11155111":
         | 
| 2137 | 
            -
                case "sepolia":
         | 
| 2138 | 
            -
                  return chains.sepolia;
         | 
| 2139 | 
            -
                case "80001":
         | 
| 2140 | 
            -
                case "mumbai":
         | 
| 2141 | 
            -
                case "polygonMumbai":
         | 
| 2142 | 
            -
                  return chains.polygonMumbai;
         | 
| 2143 | 
            -
                default:
         | 
| 2144 | 
            -
                  throw new Error("chainId ".concat(chainId, " not supported"));
         | 
| 2145 | 
            -
              }
         | 
| 2146 | 
            -
            }
         | 
| 2147 | 
            -
             | 
| 2148 | 
            -
            function computeRoyaltyContext(_x, _x2) {
         | 
| 2149 | 
            -
              return _computeRoyaltyContext.apply(this, arguments);
         | 
| 2150 | 
            -
            }
         | 
| 2151 | 
            -
            function _computeRoyaltyContext() {
         | 
| 2152 | 
            -
              _computeRoyaltyContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(licenseIds, storyClient) {
         | 
| 2153 | 
            -
                var royaltyContext, i, licenseData, royaltyPolicy, policy, targetRoyaltyAmount;
         | 
| 2154 | 
            -
                return _regeneratorRuntime().wrap(function _callee$(_context) {
         | 
| 2155 | 
            -
                  while (1) switch (_context.prev = _context.next) {
         | 
| 2156 | 
            -
                    case 0:
         | 
| 2157 | 
            -
                      royaltyContext = {
         | 
| 2158 | 
            -
                        targetAncestors: [],
         | 
| 2159 | 
            -
                        targetRoyaltyAmount: [],
         | 
| 2160 | 
            -
                        parentAncestors1: [],
         | 
| 2161 | 
            -
                        parentAncestors2: [],
         | 
| 2162 | 
            -
                        parentAncestorsRoyalties1: [],
         | 
| 2163 | 
            -
                        parentAncestorsRoyalties2: []
         | 
| 2164 | 
            -
                      };
         | 
| 2165 | 
            -
                      i = 0;
         | 
| 2166 | 
            -
                    case 2:
         | 
| 2167 | 
            -
                      if (!(i < licenseIds.length)) {
         | 
| 2168 | 
            -
                        _context.next = 16;
         | 
| 2169 | 
            -
                        break;
         | 
| 2170 | 
            -
                      }
         | 
| 2171 | 
            -
                      _context.next = 5;
         | 
| 2172 | 
            -
                      return storyClient.getLicense(licenseIds[i]);
         | 
| 2173 | 
            -
                    case 5:
         | 
| 2174 | 
            -
                      licenseData = _context.sent;
         | 
| 2175 | 
            -
                      _context.next = 8;
         | 
| 2176 | 
            -
                      return storyClient.getRoyaltyPolicy(licenseData.licensorIpId);
         | 
| 2177 | 
            -
                    case 8:
         | 
| 2178 | 
            -
                      royaltyPolicy = _context.sent;
         | 
| 2179 | 
            -
                      _context.next = 11;
         | 
| 2180 | 
            -
                      return storyClient.getPolicy(licenseData.policyId);
         | 
| 2181 | 
            -
                    case 11:
         | 
| 2182 | 
            -
                      policy = _context.sent;
         | 
| 2183 | 
            -
                      if (royaltyPolicy) {
         | 
| 2184 | 
            -
                        targetRoyaltyAmount = royaltyPolicy.targetRoyaltyAmount.map(function (e) {
         | 
| 2185 | 
            -
                          return parseInt(e);
         | 
| 2186 | 
            -
                        });
         | 
| 2187 | 
            -
                        if (i === 0) {
         | 
| 2188 | 
            -
                          royaltyContext.parentAncestors1 = royaltyPolicy.targetAncestors;
         | 
| 2189 | 
            -
                          royaltyContext.parentAncestorsRoyalties1 = targetRoyaltyAmount;
         | 
| 2190 | 
            -
                        } else {
         | 
| 2191 | 
            -
                          royaltyContext.parentAncestors2 = royaltyPolicy.targetAncestors;
         | 
| 2192 | 
            -
                          royaltyContext.parentAncestorsRoyalties2 = targetRoyaltyAmount;
         | 
| 2193 | 
            -
                        }
         | 
| 2194 | 
            -
                        updateRoyaltyContext(royaltyContext, [licenseData.licensorIpId], [parseInt(policy.pil.commercialRevShare)]);
         | 
| 2195 | 
            -
                        updateRoyaltyContext(royaltyContext, royaltyPolicy.targetAncestors, targetRoyaltyAmount);
         | 
| 2196 | 
            -
                      }
         | 
| 2197 | 
            -
                    case 13:
         | 
| 2198 | 
            -
                      i++;
         | 
| 2199 | 
            -
                      _context.next = 2;
         | 
| 2200 | 
            -
                      break;
         | 
| 2201 | 
            -
                    case 16:
         | 
| 2202 | 
            -
                      return _context.abrupt("return", royaltyContext);
         | 
| 2203 | 
            -
                    case 17:
         | 
| 2204 | 
            -
                    case "end":
         | 
| 2205 | 
            -
                      return _context.stop();
         | 
| 2206 | 
            -
                  }
         | 
| 2207 | 
            -
                }, _callee);
         | 
| 2208 | 
            -
              }));
         | 
| 2209 | 
            -
              return _computeRoyaltyContext.apply(this, arguments);
         | 
| 2210 | 
            -
            }
         | 
| 2211 | 
            -
            function encodeRoyaltyContext(royaltyContext) {
         | 
| 2212 | 
            -
              return typedDataToBytes({
         | 
| 2213 | 
            -
                "interface": "(address[], uint32[], address[], address[], uint32[], uint32[])",
         | 
| 2214 | 
            -
                data: [[royaltyContext.targetAncestors, royaltyContext.targetRoyaltyAmount, royaltyContext.parentAncestors1, royaltyContext.parentAncestors2, royaltyContext.parentAncestorsRoyalties1, royaltyContext.parentAncestorsRoyalties2]]
         | 
| 2215 | 
            -
              });
         | 
| 2216 | 
            -
            }
         | 
| 2217 | 
            -
            function updateRoyaltyContext(royaltyContext, targetAncestors, targetRoyaltyAccounts) {
         | 
| 2218 | 
            -
              for (var i = 0; i < targetAncestors.length; i++) {
         | 
| 2219 | 
            -
                var index = royaltyContext.targetAncestors.indexOf(targetAncestors[i]);
         | 
| 2220 | 
            -
                if (index === -1) {
         | 
| 2221 | 
            -
                  royaltyContext.targetAncestors.push(targetAncestors[i]);
         | 
| 2222 | 
            -
                  royaltyContext.targetRoyaltyAmount.push(targetRoyaltyAccounts[i]);
         | 
| 2223 | 
            -
                } else {
         | 
| 2224 | 
            -
                  royaltyContext.targetRoyaltyAmount[index] += targetRoyaltyAccounts[i];
         | 
| 2225 | 
            -
                }
         | 
| 2324 | 
            +
            function handleError(error, msg) {
         | 
| 2325 | 
            +
              if (error instanceof Error) {
         | 
| 2326 | 
            +
                throw new Error("".concat(msg, ": ").concat(error.message));
         | 
| 2226 2327 | 
             
              }
         | 
| 2328 | 
            +
              throw new Error("".concat(msg, ": Unknown error type"));
         | 
| 2227 2329 | 
             
            }
         | 
| 2228 2330 |  | 
| 2229 2331 | 
             
            var IPAssetClient = /*#__PURE__*/function () {
         | 
| 2230 | 
            -
              function IPAssetClient(rpcClient, wallet,  | 
| 2332 | 
            +
              function IPAssetClient(rpcClient, wallet, chainId) {
         | 
| 2231 2333 | 
             
                _classCallCheck(this, IPAssetClient);
         | 
| 2232 | 
            -
                _defineProperty(this, "ipAssetRegistryConfig", IPAssetRegistryConfig);
         | 
| 2233 | 
            -
                _defineProperty(this, "registrationModuleConfig", RegistrationModuleConfig);
         | 
| 2234 2334 | 
             
                this.wallet = wallet;
         | 
| 2235 2335 | 
             
                this.rpcClient = rpcClient;
         | 
| 2236 | 
            -
                this. | 
| 2336 | 
            +
                this.chainId = chainId;
         | 
| 2337 | 
            +
                this.ipAssetRegistryConfig = getIPAssetRegistryConfig(chainId);
         | 
| 2237 2338 | 
             
              }
         | 
| 2238 | 
            -
             | 
| 2239 | 
            -
              /**
         | 
| 2240 | 
            -
               *  Registers a root-level IP into the protocol. Root-level IPs can be thought of as organizational hubs
         | 
| 2241 | 
            -
               *  for encapsulating policies that actual IPs can use to register through. As such, a root-level IP is not an
         | 
| 2242 | 
            -
               *  actual IP, but a container for IP policy management for their child IP assets.
         | 
| 2243 | 
            -
               * @param request The request object that contains all data needed to register a root IP.
         | 
| 2244 | 
            -
               *   @param request.policyId The policy that identifies the licensing terms of the IP.
         | 
| 2245 | 
            -
               *   @param request.tokenContract The address of the NFT bound to the root-level IP.
         | 
| 2246 | 
            -
               *   @param request.tokenId The token id of the NFT bound to the root-level IP.
         | 
| 2247 | 
            -
               *   @param request.ipName [Optional] The name assigned to the new IP.
         | 
| 2248 | 
            -
               *   @param request.contentHash [Optional] The content hash of the IP being registered.
         | 
| 2249 | 
            -
               *   @param request.uri [Optional] An external URI to link to the IP.
         | 
| 2250 | 
            -
               *   @param request.txOptions [Optional] The transaction options.
         | 
| 2251 | 
            -
               * @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true.
         | 
| 2252 | 
            -
               * @emits RootIPRegistered (msg.sender, ipId, policyId)
         | 
| 2253 | 
            -
               */
         | 
| 2254 2339 | 
             
              return _createClass(IPAssetClient, [{
         | 
| 2255 | 
            -
                key: " | 
| 2256 | 
            -
                value:  | 
| 2257 | 
            -
                  var  | 
| 2258 | 
            -
                    var  | 
| 2340 | 
            +
                key: "isNFTRegistered",
         | 
| 2341 | 
            +
                value: function () {
         | 
| 2342 | 
            +
                  var _isNFTRegistered = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(tokenAddress, tokenId) {
         | 
| 2343 | 
            +
                    var ipId, isRegistered;
         | 
| 2259 2344 | 
             
                    return _regeneratorRuntime().wrap(function _callee$(_context) {
         | 
| 2260 2345 | 
             
                      while (1) switch (_context.prev = _context.next) {
         | 
| 2261 2346 | 
             
                        case 0:
         | 
| 2262 | 
            -
                          _context. | 
| 2263 | 
            -
                           | 
| 2264 | 
            -
             | 
| 2265 | 
            -
             | 
| 2266 | 
            -
                          ipId = _context.sent;
         | 
| 2267 | 
            -
                          if (!(ipId !== "0x")) {
         | 
| 2268 | 
            -
                            _context.next = 6;
         | 
| 2269 | 
            -
                            break;
         | 
| 2270 | 
            -
                          }
         | 
| 2271 | 
            -
                          return _context.abrupt("return", {
         | 
| 2272 | 
            -
                            ipId: ipId
         | 
| 2273 | 
            -
                          });
         | 
| 2274 | 
            -
                        case 6:
         | 
| 2275 | 
            -
                          _context.next = 8;
         | 
| 2276 | 
            -
                          return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.registrationModuleConfig), {}, {
         | 
| 2277 | 
            -
                            functionName: "registerRootIp",
         | 
| 2278 | 
            -
                            args: [parseToBigInt(request.policyId || "0"), viem.getAddress(request.tokenContractAddress),
         | 
| 2279 | 
            -
                            // 0x Address
         | 
| 2280 | 
            -
                            parseToBigInt(request.tokenId), request.ipName || "", request.contentHash || HashZero, request.uri || ""],
         | 
| 2281 | 
            -
                            account: this.wallet.account
         | 
| 2347 | 
            +
                          _context.next = 2;
         | 
| 2348 | 
            +
                          return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
         | 
| 2349 | 
            +
                            functionName: "ipId",
         | 
| 2350 | 
            +
                            args: [parseToBigInt(chain[this.chainId]), tokenAddress, tokenId]
         | 
| 2282 2351 | 
             
                          }));
         | 
| 2283 | 
            -
                        case  | 
| 2284 | 
            -
                           | 
| 2285 | 
            -
                           | 
| 2286 | 
            -
                           | 
| 2287 | 
            -
             | 
| 2288 | 
            -
             | 
| 2289 | 
            -
                          txHash = _context.sent;
         | 
| 2290 | 
            -
                          if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
         | 
| 2291 | 
            -
                            _context.next = 20;
         | 
| 2292 | 
            -
                            break;
         | 
| 2293 | 
            -
                          }
         | 
| 2294 | 
            -
                          _context.next = 16;
         | 
| 2295 | 
            -
                          return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
         | 
| 2296 | 
            -
                            eventName: "IPRegistered"
         | 
| 2352 | 
            +
                        case 2:
         | 
| 2353 | 
            +
                          ipId = _context.sent;
         | 
| 2354 | 
            +
                          _context.next = 5;
         | 
| 2355 | 
            +
                          return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
         | 
| 2356 | 
            +
                            functionName: "isRegistered",
         | 
| 2357 | 
            +
                            args: [ipId]
         | 
| 2297 2358 | 
             
                          }));
         | 
| 2298 | 
            -
                        case  | 
| 2299 | 
            -
                           | 
| 2300 | 
            -
                          return _context.abrupt("return",  | 
| 2301 | 
            -
             | 
| 2302 | 
            -
                            ipId: targetLogs[0].args.ipId
         | 
| 2303 | 
            -
                          });
         | 
| 2304 | 
            -
                        case 20:
         | 
| 2305 | 
            -
                          return _context.abrupt("return", {
         | 
| 2306 | 
            -
                            txHash: txHash
         | 
| 2307 | 
            -
                          });
         | 
| 2308 | 
            -
                        case 21:
         | 
| 2309 | 
            -
                          _context.next = 26;
         | 
| 2310 | 
            -
                          break;
         | 
| 2311 | 
            -
                        case 23:
         | 
| 2312 | 
            -
                          _context.prev = 23;
         | 
| 2313 | 
            -
                          _context.t0 = _context["catch"](0);
         | 
| 2314 | 
            -
                          handleError(_context.t0, "Failed to register root IP");
         | 
| 2315 | 
            -
                        case 26:
         | 
| 2359 | 
            +
                        case 5:
         | 
| 2360 | 
            +
                          isRegistered = _context.sent;
         | 
| 2361 | 
            +
                          return _context.abrupt("return", isRegistered ? ipId : "0x");
         | 
| 2362 | 
            +
                        case 7:
         | 
| 2316 2363 | 
             
                        case "end":
         | 
| 2317 2364 | 
             
                          return _context.stop();
         | 
| 2318 2365 | 
             
                      }
         | 
| 2319 | 
            -
                    }, _callee, this | 
| 2366 | 
            +
                    }, _callee, this);
         | 
| 2320 2367 | 
             
                  }));
         | 
| 2321 | 
            -
                  function  | 
| 2322 | 
            -
                    return  | 
| 2368 | 
            +
                  function isNFTRegistered(_x, _x2) {
         | 
| 2369 | 
            +
                    return _isNFTRegistered.apply(this, arguments);
         | 
| 2323 2370 | 
             
                  }
         | 
| 2324 | 
            -
                  return  | 
| 2371 | 
            +
                  return isNFTRegistered;
         | 
| 2325 2372 | 
             
                }()
         | 
| 2326 2373 | 
             
                /**
         | 
| 2327 | 
            -
                 * | 
| 2328 | 
            -
                 * | 
| 2329 | 
            -
                 * | 
| 2330 | 
            -
                 * | 
| 2331 | 
            -
                 * | 
| 2332 | 
            -
                 *   @param request.tokenId The token id of the NFT bound to the derivative IP.
         | 
| 2333 | 
            -
                 *   @param request.ipName [Optional] The name assigned to the new IP.
         | 
| 2334 | 
            -
                 *   @param request.contentHash [Optional] The content hash of the IP being registered.
         | 
| 2335 | 
            -
                 *   @param request.uri [Optional] An external URI to link to the IP.
         | 
| 2336 | 
            -
                 *   @param request.txOptions [Optional] The transaction options.
         | 
| 2374 | 
            +
                 * Registers an NFT as IP, creating a corresponding IP record.
         | 
| 2375 | 
            +
                 * @param request The request object that contains all data needed to register IP.
         | 
| 2376 | 
            +
                 *  @param request.tokenContract The address of the NFT.
         | 
| 2377 | 
            +
                 *  @param request.tokenId The token identifier of the NFT.
         | 
| 2378 | 
            +
                 *  @param request.txOptions [Optional] The transaction options.
         | 
| 2337 2379 | 
             
                 * @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true.
         | 
| 2338 | 
            -
                 * @emits  | 
| 2380 | 
            +
                 * @emits IPRegistered (ipId, chainId, tokenContract, tokenId, resolverAddr, metadataProviderAddress, metadata)
         | 
| 2339 2381 | 
             
                 */
         | 
| 2340 | 
            -
                )
         | 
| 2341 2382 | 
             
              }, {
         | 
| 2342 | 
            -
                key: " | 
| 2383 | 
            +
                key: "register",
         | 
| 2343 2384 | 
             
                value: (function () {
         | 
| 2344 | 
            -
                  var  | 
| 2345 | 
            -
                    var _request$ | 
| 2385 | 
            +
                  var _register = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
         | 
| 2386 | 
            +
                    var tokenId, _request$txOptions, ipId, _yield$this$rpcClient, call, txHash, targetLogs;
         | 
| 2346 2387 | 
             
                    return _regeneratorRuntime().wrap(function _callee2$(_context2) {
         | 
| 2347 2388 | 
             
                      while (1) switch (_context2.prev = _context2.next) {
         | 
| 2348 2389 | 
             
                        case 0:
         | 
| 2349 | 
            -
                           | 
| 2350 | 
            -
                          _context2. | 
| 2351 | 
            -
                           | 
| 2352 | 
            -
             | 
| 2390 | 
            +
                          tokenId = parseToBigInt(request.tokenId);
         | 
| 2391 | 
            +
                          _context2.prev = 1;
         | 
| 2392 | 
            +
                          _context2.next = 4;
         | 
| 2393 | 
            +
                          return this.isNFTRegistered(request.tokenContract, tokenId);
         | 
| 2394 | 
            +
                        case 4:
         | 
| 2353 2395 | 
             
                          ipId = _context2.sent;
         | 
| 2354 2396 | 
             
                          if (!(ipId !== "0x")) {
         | 
| 2355 | 
            -
                            _context2.next =  | 
| 2397 | 
            +
                            _context2.next = 7;
         | 
| 2356 2398 | 
             
                            break;
         | 
| 2357 2399 | 
             
                          }
         | 
| 2358 2400 | 
             
                          return _context2.abrupt("return", {
         | 
| 2359 2401 | 
             
                            ipId: ipId
         | 
| 2360 2402 | 
             
                          });
         | 
| 2361 | 
            -
                        case  | 
| 2362 | 
            -
                           | 
| 2363 | 
            -
                           | 
| 2364 | 
            -
                             | 
| 2365 | 
            -
             | 
| 2366 | 
            -
                          _context2.next = 10;
         | 
| 2367 | 
            -
                          return computeRoyaltyContext(request.licenseIds, this.storyClient);
         | 
| 2368 | 
            -
                        case 10:
         | 
| 2369 | 
            -
                          royaltyContext = _context2.sent;
         | 
| 2370 | 
            -
                          _context2.next = 13;
         | 
| 2371 | 
            -
                          return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.registrationModuleConfig), {}, {
         | 
| 2372 | 
            -
                            functionName: "registerDerivativeIp",
         | 
| 2373 | 
            -
                            args: [licenseIds, viem.getAddress(request.tokenContractAddress),
         | 
| 2374 | 
            -
                            // 0x Address
         | 
| 2375 | 
            -
                            parseToBigInt(request.tokenId), request.ipName || "", request.contentHash || HashZero, request.uri || "", encodeRoyaltyContext(royaltyContext)],
         | 
| 2403 | 
            +
                        case 7:
         | 
| 2404 | 
            +
                          _context2.next = 9;
         | 
| 2405 | 
            +
                          return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
         | 
| 2406 | 
            +
                            functionName: "register",
         | 
| 2407 | 
            +
                            args: [viem.getAddress(request.tokenContract), tokenId],
         | 
| 2376 2408 | 
             
                            account: this.wallet.account
         | 
| 2377 2409 | 
             
                          }));
         | 
| 2378 | 
            -
                        case  | 
| 2379 | 
            -
                          _yield$this$ | 
| 2380 | 
            -
                          call = _yield$this$ | 
| 2381 | 
            -
                          _context2.next =  | 
| 2410 | 
            +
                        case 9:
         | 
| 2411 | 
            +
                          _yield$this$rpcClient = _context2.sent;
         | 
| 2412 | 
            +
                          call = _yield$this$rpcClient.request;
         | 
| 2413 | 
            +
                          _context2.next = 13;
         | 
| 2382 2414 | 
             
                          return this.wallet.writeContract(call);
         | 
| 2383 | 
            -
                        case  | 
| 2415 | 
            +
                        case 13:
         | 
| 2384 2416 | 
             
                          txHash = _context2.sent;
         | 
| 2385 | 
            -
                          if (!((_request$ | 
| 2386 | 
            -
                            _context2.next =  | 
| 2417 | 
            +
                          if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
         | 
| 2418 | 
            +
                            _context2.next = 21;
         | 
| 2387 2419 | 
             
                            break;
         | 
| 2388 2420 | 
             
                          }
         | 
| 2389 | 
            -
                          _context2.next =  | 
| 2421 | 
            +
                          _context2.next = 17;
         | 
| 2390 2422 | 
             
                          return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
         | 
| 2391 2423 | 
             
                            eventName: "IPRegistered"
         | 
| 2392 2424 | 
             
                          }));
         | 
| 2393 | 
            -
                        case  | 
| 2425 | 
            +
                        case 17:
         | 
| 2394 2426 | 
             
                          targetLogs = _context2.sent;
         | 
| 2395 2427 | 
             
                          return _context2.abrupt("return", {
         | 
| 2396 2428 | 
             
                            txHash: txHash,
         | 
| 2397 2429 | 
             
                            ipId: targetLogs[0].args.ipId
         | 
| 2398 2430 | 
             
                          });
         | 
| 2399 | 
            -
                        case  | 
| 2431 | 
            +
                        case 21:
         | 
| 2400 2432 | 
             
                          return _context2.abrupt("return", {
         | 
| 2401 2433 | 
             
                            txHash: txHash
         | 
| 2402 2434 | 
             
                          });
         | 
| 2403 | 
            -
                        case  | 
| 2404 | 
            -
                          _context2.next =  | 
| 2435 | 
            +
                        case 22:
         | 
| 2436 | 
            +
                          _context2.next = 27;
         | 
| 2405 2437 | 
             
                          break;
         | 
| 2406 | 
            -
                        case  | 
| 2407 | 
            -
                          _context2.prev =  | 
| 2408 | 
            -
                          _context2.t0 = _context2["catch"]( | 
| 2409 | 
            -
                          handleError(_context2.t0, "Failed to register  | 
| 2410 | 
            -
                        case  | 
| 2438 | 
            +
                        case 24:
         | 
| 2439 | 
            +
                          _context2.prev = 24;
         | 
| 2440 | 
            +
                          _context2.t0 = _context2["catch"](1);
         | 
| 2441 | 
            +
                          handleError(_context2.t0, "Failed to register IP");
         | 
| 2442 | 
            +
                        case 27:
         | 
| 2411 2443 | 
             
                        case "end":
         | 
| 2412 2444 | 
             
                          return _context2.stop();
         | 
| 2413 2445 | 
             
                      }
         | 
| 2414 | 
            -
                    }, _callee2, this, [[ | 
| 2415 | 
            -
                  }));
         | 
| 2416 | 
            -
                  function registerDerivativeIp(_x2) {
         | 
| 2417 | 
            -
                    return _registerDerivativeIp.apply(this, arguments);
         | 
| 2418 | 
            -
                  }
         | 
| 2419 | 
            -
                  return registerDerivativeIp;
         | 
| 2420 | 
            -
                }()
         | 
| 2421 | 
            -
                /**
         | 
| 2422 | 
            -
                 *  Checks if an NFT is already registered in the protocol.
         | 
| 2423 | 
            -
                 * @param chainId The chain ID of the NFT.
         | 
| 2424 | 
            -
                 * @param tokenAddress The address of the NFT.
         | 
| 2425 | 
            -
                 * @param tokenId The token ID of the NFT.
         | 
| 2426 | 
            -
                 * @returns A Promise that resolves to the IP ID if the NFT is already registered, otherwise it resolves to 0x.
         | 
| 2427 | 
            -
                 */
         | 
| 2428 | 
            -
                )
         | 
| 2429 | 
            -
              }, {
         | 
| 2430 | 
            -
                key: "isNFTRegistered",
         | 
| 2431 | 
            -
                value: (function () {
         | 
| 2432 | 
            -
                  var _isNFTRegistered = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(chainId, tokenAddress, tokenId) {
         | 
| 2433 | 
            -
                    var ipId, isRegistered;
         | 
| 2434 | 
            -
                    return _regeneratorRuntime().wrap(function _callee3$(_context3) {
         | 
| 2435 | 
            -
                      while (1) switch (_context3.prev = _context3.next) {
         | 
| 2436 | 
            -
                        case 0:
         | 
| 2437 | 
            -
                          _context3.next = 2;
         | 
| 2438 | 
            -
                          return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
         | 
| 2439 | 
            -
                            functionName: "ipId",
         | 
| 2440 | 
            -
                            args: [parseToBigInt(chainId), tokenAddress, parseToBigInt(tokenId)]
         | 
| 2441 | 
            -
                          }));
         | 
| 2442 | 
            -
                        case 2:
         | 
| 2443 | 
            -
                          ipId = _context3.sent;
         | 
| 2444 | 
            -
                          _context3.next = 5;
         | 
| 2445 | 
            -
                          return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
         | 
| 2446 | 
            -
                            functionName: "isRegistered",
         | 
| 2447 | 
            -
                            args: [ipId]
         | 
| 2448 | 
            -
                          }));
         | 
| 2449 | 
            -
                        case 5:
         | 
| 2450 | 
            -
                          isRegistered = _context3.sent;
         | 
| 2451 | 
            -
                          return _context3.abrupt("return", isRegistered ? ipId : "0x");
         | 
| 2452 | 
            -
                        case 7:
         | 
| 2453 | 
            -
                        case "end":
         | 
| 2454 | 
            -
                          return _context3.stop();
         | 
| 2455 | 
            -
                      }
         | 
| 2456 | 
            -
                    }, _callee3, this);
         | 
| 2446 | 
            +
                    }, _callee2, this, [[1, 24]]);
         | 
| 2457 2447 | 
             
                  }));
         | 
| 2458 | 
            -
                  function  | 
| 2459 | 
            -
                    return  | 
| 2448 | 
            +
                  function register(_x3) {
         | 
| 2449 | 
            +
                    return _register.apply(this, arguments);
         | 
| 2460 2450 | 
             
                  }
         | 
| 2461 | 
            -
                  return  | 
| 2451 | 
            +
                  return register;
         | 
| 2462 2452 | 
             
                }())
         | 
| 2463 2453 | 
             
              }]);
         | 
| 2464 2454 | 
             
            }();
         | 
| 2465 2455 |  | 
| 2466 2456 | 
             
            var PermissionClient = /*#__PURE__*/function () {
         | 
| 2467 | 
            -
              function PermissionClient(rpcClient, wallet) {
         | 
| 2457 | 
            +
              function PermissionClient(rpcClient, wallet, chainId) {
         | 
| 2468 2458 | 
             
                _classCallCheck(this, PermissionClient);
         | 
| 2469 2459 | 
             
                _defineProperty(this, "ipAccountABI", IPAccountABI);
         | 
| 2470 | 
            -
                _defineProperty(this, "accessControllerConfig", AccessControllerConfig);
         | 
| 2471 2460 | 
             
                this.rpcClient = rpcClient;
         | 
| 2472 2461 | 
             
                this.wallet = wallet;
         | 
| 2462 | 
            +
                this.accessControllerConfig = getAccessControllerConfig(chainId);
         | 
| 2473 2463 | 
             
              }
         | 
| 2474 2464 |  | 
| 2475 2465 | 
             
              /**
         | 
| @@ -2568,15 +2558,96 @@ var PermissionClient = /*#__PURE__*/function () { | |
| 2568 2558 | 
             
              }]);
         | 
| 2569 2559 | 
             
            }();
         | 
| 2570 2560 |  | 
| 2561 | 
            +
            function computeRoyaltyContext(_x, _x2) {
         | 
| 2562 | 
            +
              return _computeRoyaltyContext.apply(this, arguments);
         | 
| 2563 | 
            +
            }
         | 
| 2564 | 
            +
            function _computeRoyaltyContext() {
         | 
| 2565 | 
            +
              _computeRoyaltyContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(licenseIds, storyClient) {
         | 
| 2566 | 
            +
                var royaltyContext, i, licenseData, royaltyPolicy, policy, targetRoyaltyAmount;
         | 
| 2567 | 
            +
                return _regeneratorRuntime().wrap(function _callee$(_context) {
         | 
| 2568 | 
            +
                  while (1) switch (_context.prev = _context.next) {
         | 
| 2569 | 
            +
                    case 0:
         | 
| 2570 | 
            +
                      royaltyContext = {
         | 
| 2571 | 
            +
                        targetAncestors: [],
         | 
| 2572 | 
            +
                        targetRoyaltyAmount: [],
         | 
| 2573 | 
            +
                        parentAncestors1: [],
         | 
| 2574 | 
            +
                        parentAncestors2: [],
         | 
| 2575 | 
            +
                        parentAncestorsRoyalties1: [],
         | 
| 2576 | 
            +
                        parentAncestorsRoyalties2: []
         | 
| 2577 | 
            +
                      };
         | 
| 2578 | 
            +
                      i = 0;
         | 
| 2579 | 
            +
                    case 2:
         | 
| 2580 | 
            +
                      if (!(i < licenseIds.length)) {
         | 
| 2581 | 
            +
                        _context.next = 16;
         | 
| 2582 | 
            +
                        break;
         | 
| 2583 | 
            +
                      }
         | 
| 2584 | 
            +
                      _context.next = 5;
         | 
| 2585 | 
            +
                      return storyClient.getLicense(licenseIds[i]);
         | 
| 2586 | 
            +
                    case 5:
         | 
| 2587 | 
            +
                      licenseData = _context.sent;
         | 
| 2588 | 
            +
                      _context.next = 8;
         | 
| 2589 | 
            +
                      return storyClient.getRoyaltyPolicy(licenseData.licensorIpId);
         | 
| 2590 | 
            +
                    case 8:
         | 
| 2591 | 
            +
                      royaltyPolicy = _context.sent;
         | 
| 2592 | 
            +
                      _context.next = 11;
         | 
| 2593 | 
            +
                      return storyClient.getPolicy(licenseData.policyId);
         | 
| 2594 | 
            +
                    case 11:
         | 
| 2595 | 
            +
                      policy = _context.sent;
         | 
| 2596 | 
            +
                      if (royaltyPolicy) {
         | 
| 2597 | 
            +
                        targetRoyaltyAmount = royaltyPolicy.targetRoyaltyAmount.map(function (e) {
         | 
| 2598 | 
            +
                          return parseInt(e);
         | 
| 2599 | 
            +
                        });
         | 
| 2600 | 
            +
                        if (i === 0) {
         | 
| 2601 | 
            +
                          royaltyContext.parentAncestors1 = royaltyPolicy.targetAncestors;
         | 
| 2602 | 
            +
                          royaltyContext.parentAncestorsRoyalties1 = targetRoyaltyAmount;
         | 
| 2603 | 
            +
                        } else {
         | 
| 2604 | 
            +
                          royaltyContext.parentAncestors2 = royaltyPolicy.targetAncestors;
         | 
| 2605 | 
            +
                          royaltyContext.parentAncestorsRoyalties2 = targetRoyaltyAmount;
         | 
| 2606 | 
            +
                        }
         | 
| 2607 | 
            +
                        updateRoyaltyContext(royaltyContext, [licenseData.licensorIpId], [parseInt(policy.pil.commercialRevShare)]);
         | 
| 2608 | 
            +
                        updateRoyaltyContext(royaltyContext, royaltyPolicy.targetAncestors, targetRoyaltyAmount);
         | 
| 2609 | 
            +
                      }
         | 
| 2610 | 
            +
                    case 13:
         | 
| 2611 | 
            +
                      i++;
         | 
| 2612 | 
            +
                      _context.next = 2;
         | 
| 2613 | 
            +
                      break;
         | 
| 2614 | 
            +
                    case 16:
         | 
| 2615 | 
            +
                      return _context.abrupt("return", royaltyContext);
         | 
| 2616 | 
            +
                    case 17:
         | 
| 2617 | 
            +
                    case "end":
         | 
| 2618 | 
            +
                      return _context.stop();
         | 
| 2619 | 
            +
                  }
         | 
| 2620 | 
            +
                }, _callee);
         | 
| 2621 | 
            +
              }));
         | 
| 2622 | 
            +
              return _computeRoyaltyContext.apply(this, arguments);
         | 
| 2623 | 
            +
            }
         | 
| 2624 | 
            +
            function encodeRoyaltyContext(royaltyContext) {
         | 
| 2625 | 
            +
              return typedDataToBytes({
         | 
| 2626 | 
            +
                "interface": "(address[], uint32[], address[], address[], uint32[], uint32[])",
         | 
| 2627 | 
            +
                data: [[royaltyContext.targetAncestors, royaltyContext.targetRoyaltyAmount, royaltyContext.parentAncestors1, royaltyContext.parentAncestors2, royaltyContext.parentAncestorsRoyalties1, royaltyContext.parentAncestorsRoyalties2]]
         | 
| 2628 | 
            +
              });
         | 
| 2629 | 
            +
            }
         | 
| 2630 | 
            +
            function updateRoyaltyContext(royaltyContext, targetAncestors, targetRoyaltyAccounts) {
         | 
| 2631 | 
            +
              for (var i = 0; i < targetAncestors.length; i++) {
         | 
| 2632 | 
            +
                var index = royaltyContext.targetAncestors.indexOf(targetAncestors[i]);
         | 
| 2633 | 
            +
                if (index === -1) {
         | 
| 2634 | 
            +
                  royaltyContext.targetAncestors.push(targetAncestors[i]);
         | 
| 2635 | 
            +
                  royaltyContext.targetRoyaltyAmount.push(targetRoyaltyAccounts[i]);
         | 
| 2636 | 
            +
                } else {
         | 
| 2637 | 
            +
                  royaltyContext.targetRoyaltyAmount[index] += targetRoyaltyAccounts[i];
         | 
| 2638 | 
            +
                }
         | 
| 2639 | 
            +
              }
         | 
| 2640 | 
            +
            }
         | 
| 2641 | 
            +
             | 
| 2571 2642 | 
             
            var LicenseClient = /*#__PURE__*/function () {
         | 
| 2572 | 
            -
              function LicenseClient(rpcClient, wallet, storyClient) {
         | 
| 2643 | 
            +
              function LicenseClient(rpcClient, wallet, storyClient, chainId) {
         | 
| 2573 2644 | 
             
                _classCallCheck(this, LicenseClient);
         | 
| 2574 2645 | 
             
                _defineProperty(this, "ipAccountABI", IPAccountABI);
         | 
| 2575 | 
            -
                _defineProperty(this, "licenseRegistryConfig", LicenseRegistryConfig);
         | 
| 2576 | 
            -
                _defineProperty(this, "licensingModuleConfig", LicensingModuleConfig);
         | 
| 2577 2646 | 
             
                this.wallet = wallet;
         | 
| 2578 2647 | 
             
                this.rpcClient = rpcClient;
         | 
| 2579 2648 | 
             
                this.storyClient = storyClient;
         | 
| 2649 | 
            +
                this.licenseRegistryConfig = getLicenseRegistryConfig(chainId);
         | 
| 2650 | 
            +
                this.licensingModuleConfig = getLicensingModuleConfig(chainId);
         | 
| 2580 2651 | 
             
              }
         | 
| 2581 2652 |  | 
| 2582 2653 | 
             
              /**
         | 
| @@ -2712,7 +2783,7 @@ var LicenseClient = /*#__PURE__*/function () { | |
| 2712 2783 | 
             
                            break;
         | 
| 2713 2784 | 
             
                          }
         | 
| 2714 2785 | 
             
                          _context2.next = 17;
         | 
| 2715 | 
            -
                          return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({},  | 
| 2786 | 
            +
                          return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licenseRegistryConfig), {}, {
         | 
| 2716 2787 | 
             
                            eventName: "TransferBatch"
         | 
| 2717 2788 | 
             
                          }));
         | 
| 2718 2789 | 
             
                        case 17:
         | 
| @@ -2746,14 +2817,14 @@ var LicenseClient = /*#__PURE__*/function () { | |
| 2746 2817 | 
             
            }();
         | 
| 2747 2818 |  | 
| 2748 2819 | 
             
            var PolicyClient = /*#__PURE__*/function () {
         | 
| 2749 | 
            -
              function PolicyClient(rpcClient, wallet) {
         | 
| 2820 | 
            +
              function PolicyClient(rpcClient, wallet, chainId) {
         | 
| 2750 2821 | 
             
                _classCallCheck(this, PolicyClient);
         | 
| 2751 2822 | 
             
                _defineProperty(this, "ipAccountABI", IPAccountABI);
         | 
| 2752 | 
            -
                _defineProperty(this, "licensingModuleConfig", LicensingModuleConfig);
         | 
| 2753 | 
            -
                _defineProperty(this, "pilPolicyFrameworkManagerConfig", PILPolicyFrameworkManagerConfig);
         | 
| 2754 | 
            -
                _defineProperty(this, "royaltyPolicyLAPConfig", RoyaltyPolicyLAPConfig);
         | 
| 2755 2823 | 
             
                this.wallet = wallet;
         | 
| 2756 2824 | 
             
                this.rpcClient = rpcClient;
         | 
| 2825 | 
            +
                this.licensingModuleConfig = getLicensingModuleConfig(chainId);
         | 
| 2826 | 
            +
                this.pilPolicyFrameworkManagerConfig = getPILPolicyFrameworkManagerConfig(chainId);
         | 
| 2827 | 
            +
                this.royaltyPolicyLAPConfig = getRoyaltyPolicyLAPConfig(chainId);
         | 
| 2757 2828 | 
             
              }
         | 
| 2758 2829 |  | 
| 2759 2830 | 
             
              /**
         | 
| @@ -3246,11 +3317,11 @@ var PolicyClient = /*#__PURE__*/function () { | |
| 3246 3317 | 
             
            }();
         | 
| 3247 3318 |  | 
| 3248 3319 | 
             
            var DisputeClient = /*#__PURE__*/function () {
         | 
| 3249 | 
            -
              function DisputeClient(rpcClient, wallet) {
         | 
| 3320 | 
            +
              function DisputeClient(rpcClient, wallet, chainId) {
         | 
| 3250 3321 | 
             
                _classCallCheck(this, DisputeClient);
         | 
| 3251 | 
            -
                _defineProperty(this, "disputeModuleConfig", DisputeModuleConfig);
         | 
| 3252 3322 | 
             
                this.rpcClient = rpcClient;
         | 
| 3253 3323 | 
             
                this.wallet = wallet;
         | 
| 3324 | 
            +
                this.disputeModuleConfig = getDisputeModuleConfig(chainId);
         | 
| 3254 3325 | 
             
              }
         | 
| 3255 3326 |  | 
| 3256 3327 | 
             
              /**
         | 
| @@ -3663,6 +3734,166 @@ var StoryAPIClient = /*#__PURE__*/function () { | |
| 3663 3734 | 
             
              }]);
         | 
| 3664 3735 | 
             
            }();
         | 
| 3665 3736 |  | 
| 3737 | 
            +
            var RoyaltyClient = /*#__PURE__*/function () {
         | 
| 3738 | 
            +
              function RoyaltyClient(rpcClient, wallet, chainId) {
         | 
| 3739 | 
            +
                _classCallCheck(this, RoyaltyClient);
         | 
| 3740 | 
            +
                this.rpcClient = rpcClient;
         | 
| 3741 | 
            +
                this.wallet = wallet;
         | 
| 3742 | 
            +
                this.royaltyVaultImplConfig = getRoyaltyVaultImplConfig(chainId);
         | 
| 3743 | 
            +
                this.royaltyPolicyLAPConfig = getRoyaltyPolicyLAPConfig(chainId);
         | 
| 3744 | 
            +
                this.royaltyModuleConfig = getRoyaltyModuleConfig(chainId);
         | 
| 3745 | 
            +
              }
         | 
| 3746 | 
            +
              /**
         | 
| 3747 | 
            +
               * Allows ancestors to claim the royalty tokens and any accrued revenue tokens
         | 
| 3748 | 
            +
               * @param request - the licensing parameters for the Programmable IP License v1 (PIL) standard.
         | 
| 3749 | 
            +
               *   @param request.ancestorIpId The ip id of the ancestor to whom the royalty tokens belong to.
         | 
| 3750 | 
            +
               *   @param request.txOptions [Optional] The transaction options.
         | 
| 3751 | 
            +
               * @returns Tx hash for the transaction.
         | 
| 3752 | 
            +
               * @emits RoyaltyTokensCollected (ancestorIpId, ancestorsRoyalty)
         | 
| 3753 | 
            +
               */
         | 
| 3754 | 
            +
              return _createClass(RoyaltyClient, [{
         | 
| 3755 | 
            +
                key: "collectRoyaltyTokens",
         | 
| 3756 | 
            +
                value: (function () {
         | 
| 3757 | 
            +
                  var _collectRoyaltyTokens = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
         | 
| 3758 | 
            +
                    var proxyAddress, _yield$this$rpcClient, call, txHash;
         | 
| 3759 | 
            +
                    return _regeneratorRuntime().wrap(function _callee$(_context) {
         | 
| 3760 | 
            +
                      while (1) switch (_context.prev = _context.next) {
         | 
| 3761 | 
            +
                        case 0:
         | 
| 3762 | 
            +
                          _context.prev = 0;
         | 
| 3763 | 
            +
                          _context.next = 3;
         | 
| 3764 | 
            +
                          return this.getProxyAddress(request.derivativeId);
         | 
| 3765 | 
            +
                        case 3:
         | 
| 3766 | 
            +
                          proxyAddress = _context.sent;
         | 
| 3767 | 
            +
                          if (proxyAddress) {
         | 
| 3768 | 
            +
                            _context.next = 6;
         | 
| 3769 | 
            +
                            break;
         | 
| 3770 | 
            +
                          }
         | 
| 3771 | 
            +
                          throw new Error("Proxy address not found");
         | 
| 3772 | 
            +
                        case 6:
         | 
| 3773 | 
            +
                          _context.next = 8;
         | 
| 3774 | 
            +
                          return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.royaltyVaultImplConfig), {}, {
         | 
| 3775 | 
            +
                            address: proxyAddress,
         | 
| 3776 | 
            +
                            functionName: "collectRoyaltyTokens",
         | 
| 3777 | 
            +
                            args: [request.ancestorIpId],
         | 
| 3778 | 
            +
                            account: this.wallet.account
         | 
| 3779 | 
            +
                          }));
         | 
| 3780 | 
            +
                        case 8:
         | 
| 3781 | 
            +
                          _yield$this$rpcClient = _context.sent;
         | 
| 3782 | 
            +
                          call = _yield$this$rpcClient.request;
         | 
| 3783 | 
            +
                          _context.next = 12;
         | 
| 3784 | 
            +
                          return this.wallet.writeContract(call);
         | 
| 3785 | 
            +
                        case 12:
         | 
| 3786 | 
            +
                          txHash = _context.sent;
         | 
| 3787 | 
            +
                          return _context.abrupt("return", {
         | 
| 3788 | 
            +
                            txHash: txHash
         | 
| 3789 | 
            +
                          });
         | 
| 3790 | 
            +
                        case 16:
         | 
| 3791 | 
            +
                          _context.prev = 16;
         | 
| 3792 | 
            +
                          _context.t0 = _context["catch"](0);
         | 
| 3793 | 
            +
                          handleError(_context.t0, "Failed to collect royalty tokens");
         | 
| 3794 | 
            +
                        case 19:
         | 
| 3795 | 
            +
                        case "end":
         | 
| 3796 | 
            +
                          return _context.stop();
         | 
| 3797 | 
            +
                      }
         | 
| 3798 | 
            +
                    }, _callee, this, [[0, 16]]);
         | 
| 3799 | 
            +
                  }));
         | 
| 3800 | 
            +
                  function collectRoyaltyTokens(_x) {
         | 
| 3801 | 
            +
                    return _collectRoyaltyTokens.apply(this, arguments);
         | 
| 3802 | 
            +
                  }
         | 
| 3803 | 
            +
                  return collectRoyaltyTokens;
         | 
| 3804 | 
            +
                }())
         | 
| 3805 | 
            +
              }, {
         | 
| 3806 | 
            +
                key: "getProxyAddress",
         | 
| 3807 | 
            +
                value: function () {
         | 
| 3808 | 
            +
                  var _getProxyAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(derivativeID) {
         | 
| 3809 | 
            +
                    var data;
         | 
| 3810 | 
            +
                    return _regeneratorRuntime().wrap(function _callee2$(_context2) {
         | 
| 3811 | 
            +
                      while (1) switch (_context2.prev = _context2.next) {
         | 
| 3812 | 
            +
                        case 0:
         | 
| 3813 | 
            +
                          _context2.next = 2;
         | 
| 3814 | 
            +
                          return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.royaltyPolicyLAPConfig), {}, {
         | 
| 3815 | 
            +
                            functionName: "getRoyaltyData",
         | 
| 3816 | 
            +
                            args: [derivativeID]
         | 
| 3817 | 
            +
                          }));
         | 
| 3818 | 
            +
                        case 2:
         | 
| 3819 | 
            +
                          data = _context2.sent;
         | 
| 3820 | 
            +
                          if (!(Array.isArray(data) && data[1])) {
         | 
| 3821 | 
            +
                            _context2.next = 5;
         | 
| 3822 | 
            +
                            break;
         | 
| 3823 | 
            +
                          }
         | 
| 3824 | 
            +
                          return _context2.abrupt("return", data[1]);
         | 
| 3825 | 
            +
                        case 5:
         | 
| 3826 | 
            +
                        case "end":
         | 
| 3827 | 
            +
                          return _context2.stop();
         | 
| 3828 | 
            +
                      }
         | 
| 3829 | 
            +
                    }, _callee2, this);
         | 
| 3830 | 
            +
                  }));
         | 
| 3831 | 
            +
                  function getProxyAddress(_x2) {
         | 
| 3832 | 
            +
                    return _getProxyAddress.apply(this, arguments);
         | 
| 3833 | 
            +
                  }
         | 
| 3834 | 
            +
                  return getProxyAddress;
         | 
| 3835 | 
            +
                }()
         | 
| 3836 | 
            +
                /**
         | 
| 3837 | 
            +
                 * Allows the function caller to pay royalties to the receiver IP asset on behalf of the payer IP asset.
         | 
| 3838 | 
            +
                 * @param request - The request object that contains all data needed to pay royalty on behalf.
         | 
| 3839 | 
            +
                 *   @param request.receiverIpId The ipId that receives the royalties.
         | 
| 3840 | 
            +
                 *   @param request.payerIpId The ID of the IP asset that pays the royalties.
         | 
| 3841 | 
            +
                 *   @param request.token The token to use to pay the royalties.
         | 
| 3842 | 
            +
                 *   @param request.amount The amount to pay.
         | 
| 3843 | 
            +
                 *   @param request.txOptions [Optional] The transaction options.
         | 
| 3844 | 
            +
                 * @returns A Promise that resolves to an object containing the transaction hash.
         | 
| 3845 | 
            +
                 * @emits RoyaltyPaid (receiverIpId, payerIpId, msg.sender, token, amount)
         | 
| 3846 | 
            +
                 */
         | 
| 3847 | 
            +
              }, {
         | 
| 3848 | 
            +
                key: "payRoyaltyOnBehalf",
         | 
| 3849 | 
            +
                value: (function () {
         | 
| 3850 | 
            +
                  var _payRoyaltyOnBehalf = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(request) {
         | 
| 3851 | 
            +
                    var _request$txOptions, _yield$this$rpcClient2, call, txHash;
         | 
| 3852 | 
            +
                    return _regeneratorRuntime().wrap(function _callee3$(_context3) {
         | 
| 3853 | 
            +
                      while (1) switch (_context3.prev = _context3.next) {
         | 
| 3854 | 
            +
                        case 0:
         | 
| 3855 | 
            +
                          _context3.prev = 0;
         | 
| 3856 | 
            +
                          _context3.next = 3;
         | 
| 3857 | 
            +
                          return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.royaltyModuleConfig), {}, {
         | 
| 3858 | 
            +
                            functionName: "payRoyaltyOnBehalf",
         | 
| 3859 | 
            +
                            args: [request.receiverIpId, request.payerIpId, request.token, request.amount],
         | 
| 3860 | 
            +
                            account: this.wallet.account
         | 
| 3861 | 
            +
                          }));
         | 
| 3862 | 
            +
                        case 3:
         | 
| 3863 | 
            +
                          _yield$this$rpcClient2 = _context3.sent;
         | 
| 3864 | 
            +
                          call = _yield$this$rpcClient2.request;
         | 
| 3865 | 
            +
                          _context3.next = 7;
         | 
| 3866 | 
            +
                          return this.wallet.writeContract(call);
         | 
| 3867 | 
            +
                        case 7:
         | 
| 3868 | 
            +
                          txHash = _context3.sent;
         | 
| 3869 | 
            +
                          if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
         | 
| 3870 | 
            +
                            _context3.next = 11;
         | 
| 3871 | 
            +
                            break;
         | 
| 3872 | 
            +
                          }
         | 
| 3873 | 
            +
                          _context3.next = 11;
         | 
| 3874 | 
            +
                          return waitTx(this.rpcClient, txHash);
         | 
| 3875 | 
            +
                        case 11:
         | 
| 3876 | 
            +
                          return _context3.abrupt("return", {
         | 
| 3877 | 
            +
                            txHash: txHash
         | 
| 3878 | 
            +
                          });
         | 
| 3879 | 
            +
                        case 14:
         | 
| 3880 | 
            +
                          _context3.prev = 14;
         | 
| 3881 | 
            +
                          _context3.t0 = _context3["catch"](0);
         | 
| 3882 | 
            +
                          handleError(_context3.t0, "Failed to pay royalty on behalf");
         | 
| 3883 | 
            +
                        case 17:
         | 
| 3884 | 
            +
                        case "end":
         | 
| 3885 | 
            +
                          return _context3.stop();
         | 
| 3886 | 
            +
                      }
         | 
| 3887 | 
            +
                    }, _callee3, this, [[0, 14]]);
         | 
| 3888 | 
            +
                  }));
         | 
| 3889 | 
            +
                  function payRoyaltyOnBehalf(_x3) {
         | 
| 3890 | 
            +
                    return _payRoyaltyOnBehalf.apply(this, arguments);
         | 
| 3891 | 
            +
                  }
         | 
| 3892 | 
            +
                  return payRoyaltyOnBehalf;
         | 
| 3893 | 
            +
                }())
         | 
| 3894 | 
            +
              }]);
         | 
| 3895 | 
            +
            }();
         | 
| 3896 | 
            +
             | 
| 3666 3897 | 
             
            if (typeof process !== "undefined") {
         | 
| 3667 3898 | 
             
              dotenv__namespace.config();
         | 
| 3668 3899 | 
             
            }
         | 
| @@ -3681,12 +3912,15 @@ var StoryClient = /*#__PURE__*/function () { | |
| 3681 3912 | 
             
                _defineProperty(this, "_policy", null);
         | 
| 3682 3913 | 
             
                _defineProperty(this, "_dispute", null);
         | 
| 3683 3914 | 
             
                _defineProperty(this, "_ipAccount", null);
         | 
| 3684 | 
            -
                this | 
| 3915 | 
            +
                _defineProperty(this, "_royalty", null);
         | 
| 3916 | 
            +
                this.config = _objectSpread2(_objectSpread2({}, config), {}, {
         | 
| 3917 | 
            +
                  chainId: config.chainId || "sepolia"
         | 
| 3918 | 
            +
                });
         | 
| 3685 3919 | 
             
                if (!this.config.transport) {
         | 
| 3686 3920 | 
             
                  throw new Error("transport is null, please pass in a valid RPC Provider URL as the transport.");
         | 
| 3687 3921 | 
             
                }
         | 
| 3688 3922 | 
             
                var clientConfig = {
         | 
| 3689 | 
            -
                  chain: chainStringToViemChain(this.config.chainId | 
| 3923 | 
            +
                  chain: chainStringToViemChain(this.config.chainId),
         | 
| 3690 3924 | 
             
                  transport: this.config.transport
         | 
| 3691 3925 | 
             
                };
         | 
| 3692 3926 | 
             
                this.rpcClient = viem.createPublicClient(clientConfig);
         | 
| @@ -3716,7 +3950,7 @@ var StoryClient = /*#__PURE__*/function () { | |
| 3716 3950 | 
             
                 */
         | 
| 3717 3951 | 
             
                function get() {
         | 
| 3718 3952 | 
             
                  if (this._ipAsset === null) {
         | 
| 3719 | 
            -
                    this._ipAsset = new IPAssetClient(this.rpcClient, this.wallet, this. | 
| 3953 | 
            +
                    this._ipAsset = new IPAssetClient(this.rpcClient, this.wallet, this.config.chainId);
         | 
| 3720 3954 | 
             
                  }
         | 
| 3721 3955 | 
             
                  return this._ipAsset;
         | 
| 3722 3956 | 
             
                }
         | 
| @@ -3731,7 +3965,7 @@ var StoryClient = /*#__PURE__*/function () { | |
| 3731 3965 | 
             
                key: "permission",
         | 
| 3732 3966 | 
             
                get: function get() {
         | 
| 3733 3967 | 
             
                  if (this._permission === null) {
         | 
| 3734 | 
            -
                    this._permission = new PermissionClient(this.rpcClient, this.wallet);
         | 
| 3968 | 
            +
                    this._permission = new PermissionClient(this.rpcClient, this.wallet, this.config.chainId);
         | 
| 3735 3969 | 
             
                  }
         | 
| 3736 3970 | 
             
                  return this._permission;
         | 
| 3737 3971 | 
             
                }
         | 
| @@ -3746,7 +3980,7 @@ var StoryClient = /*#__PURE__*/function () { | |
| 3746 3980 | 
             
                key: "license",
         | 
| 3747 3981 | 
             
                get: function get() {
         | 
| 3748 3982 | 
             
                  if (this._license === null) {
         | 
| 3749 | 
            -
                    this._license = new LicenseClient(this.rpcClient, this.wallet, this.storyClient);
         | 
| 3983 | 
            +
                    this._license = new LicenseClient(this.rpcClient, this.wallet, this.storyClient, this.config.chainId);
         | 
| 3750 3984 | 
             
                  }
         | 
| 3751 3985 | 
             
                  return this._license;
         | 
| 3752 3986 | 
             
                }
         | 
| @@ -3761,7 +3995,7 @@ var StoryClient = /*#__PURE__*/function () { | |
| 3761 3995 | 
             
                key: "policy",
         | 
| 3762 3996 | 
             
                get: function get() {
         | 
| 3763 3997 | 
             
                  if (this._policy === null) {
         | 
| 3764 | 
            -
                    this._policy = new PolicyClient(this.rpcClient, this.wallet);
         | 
| 3998 | 
            +
                    this._policy = new PolicyClient(this.rpcClient, this.wallet, this.config.chainId);
         | 
| 3765 3999 | 
             
                  }
         | 
| 3766 4000 | 
             
                  return this._policy;
         | 
| 3767 4001 | 
             
                }
         | 
| @@ -3776,7 +4010,7 @@ var StoryClient = /*#__PURE__*/function () { | |
| 3776 4010 | 
             
                key: "dispute",
         | 
| 3777 4011 | 
             
                get: function get() {
         | 
| 3778 4012 | 
             
                  if (this._dispute === null) {
         | 
| 3779 | 
            -
                    this._dispute = new DisputeClient(this.rpcClient, this.wallet);
         | 
| 4013 | 
            +
                    this._dispute = new DisputeClient(this.rpcClient, this.wallet, this.config.chainId);
         | 
| 3780 4014 | 
             
                  }
         | 
| 3781 4015 | 
             
                  return this._dispute;
         | 
| 3782 4016 | 
             
                }
         | 
| @@ -3795,6 +4029,20 @@ var StoryClient = /*#__PURE__*/function () { | |
| 3795 4029 | 
             
                  }
         | 
| 3796 4030 | 
             
                  return this._ipAccount;
         | 
| 3797 4031 | 
             
                }
         | 
| 4032 | 
            +
                /**
         | 
| 4033 | 
            +
                 * Getter for the royalty client. The client is lazily created when
         | 
| 4034 | 
            +
                 * this method is called.
         | 
| 4035 | 
            +
                 *
         | 
| 4036 | 
            +
                 * @returns the RoyaltyClient instance
         | 
| 4037 | 
            +
                 */
         | 
| 4038 | 
            +
              }, {
         | 
| 4039 | 
            +
                key: "royalty",
         | 
| 4040 | 
            +
                get: function get() {
         | 
| 4041 | 
            +
                  if (this._royalty === null) {
         | 
| 4042 | 
            +
                    this._royalty = new RoyaltyClient(this.rpcClient, this.wallet, this.config.chainId);
         | 
| 4043 | 
            +
                  }
         | 
| 4044 | 
            +
                  return this._royalty;
         | 
| 4045 | 
            +
                }
         | 
| 3798 4046 | 
             
              }], [{
         | 
| 3799 4047 | 
             
                key: "newClient",
         | 
| 3800 4048 | 
             
                value: function newClient(config) {
         | 
| @@ -3803,6 +4051,9 @@ var StoryClient = /*#__PURE__*/function () { | |
| 3803 4051 | 
             
              }]);
         | 
| 3804 4052 | 
             
            }();
         | 
| 3805 4053 |  | 
| 4054 | 
            +
            var AddressZero = "0x0000000000000000000000000000000000000000";
         | 
| 4055 | 
            +
            var HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
         | 
| 4056 | 
            +
             | 
| 3806 4057 | 
             
            exports.AddressZero = AddressZero;
         | 
| 3807 4058 | 
             
            exports.DisputeClient = DisputeClient;
         | 
| 3808 4059 | 
             
            exports.HashZero = HashZero;
         |