@story-protocol/core-sdk 0.0.1-beta-rc.10 → 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.
Files changed (30) hide show
  1. package/dist/declarations/src/client.d.ts +9 -0
  2. package/dist/declarations/src/client.d.ts.map +1 -1
  3. package/dist/declarations/src/index.d.ts +2 -1
  4. package/dist/declarations/src/index.d.ts.map +1 -1
  5. package/dist/declarations/src/resources/dispute.d.ts +103 -78
  6. package/dist/declarations/src/resources/dispute.d.ts.map +1 -1
  7. package/dist/declarations/src/resources/ipAccount.d.ts +84 -76
  8. package/dist/declarations/src/resources/ipAccount.d.ts.map +1 -1
  9. package/dist/declarations/src/resources/ipAsset.d.ts +26 -756
  10. package/dist/declarations/src/resources/ipAsset.d.ts.map +1 -1
  11. package/dist/declarations/src/resources/license.d.ts +875 -858
  12. package/dist/declarations/src/resources/license.d.ts.map +1 -1
  13. package/dist/declarations/src/resources/permission.d.ts +271 -216
  14. package/dist/declarations/src/resources/permission.d.ts.map +1 -1
  15. package/dist/declarations/src/resources/policy.d.ts +1094 -277
  16. package/dist/declarations/src/resources/policy.d.ts.map +1 -1
  17. package/dist/declarations/src/resources/royalty.d.ts +2155 -0
  18. package/dist/declarations/src/resources/royalty.d.ts.map +1 -0
  19. package/dist/declarations/src/types/config.d.ts +6 -3
  20. package/dist/declarations/src/types/config.d.ts.map +1 -1
  21. package/dist/declarations/src/types/resources/ipAsset.d.ts +4 -20
  22. package/dist/declarations/src/types/resources/ipAsset.d.ts.map +1 -1
  23. package/dist/declarations/src/types/resources/royalty.d.ts +41 -0
  24. package/dist/declarations/src/types/resources/royalty.d.ts.map +1 -1
  25. package/dist/story-protocol-core-sdk.cjs.d.ts +1 -1
  26. package/dist/story-protocol-core-sdk.cjs.dev.js +910 -661
  27. package/dist/story-protocol-core-sdk.cjs.prod.js +910 -661
  28. package/dist/story-protocol-core-sdk.esm.js +912 -663
  29. package/package.json +2 -2
  30. package/dist/story-protocol-core-sdk.cjs.d.ts.map +0 -1
@@ -30,24 +30,24 @@ function _interopNamespace(e) {
30
30
  var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
31
31
  var axios__default = /*#__PURE__*/_interopDefault(axios);
32
32
 
33
- function _toPrimitive(input, hint) {
34
- if (typeof input !== "object" || input === null) return input;
35
- var prim = input[Symbol.toPrimitive];
36
- if (prim !== undefined) {
37
- var res = prim.call(input, hint || "default");
38
- if (typeof res !== "object") return res;
33
+ function toPrimitive(t, r) {
34
+ if ("object" != typeof t || !t) return t;
35
+ var e = t[Symbol.toPrimitive];
36
+ if (void 0 !== e) {
37
+ var i = e.call(t, r || "default");
38
+ if ("object" != typeof i) return i;
39
39
  throw new TypeError("@@toPrimitive must return a primitive value.");
40
40
  }
41
- return (hint === "string" ? String : Number)(input);
41
+ return ("string" === r ? String : Number)(t);
42
42
  }
43
43
 
44
- function _toPropertyKey(arg) {
45
- var key = _toPrimitive(arg, "string");
46
- return typeof key === "symbol" ? key : String(key);
44
+ function toPropertyKey(t) {
45
+ var i = toPrimitive(t, "string");
46
+ return "symbol" == typeof i ? i : i + "";
47
47
  }
48
48
 
49
49
  function _defineProperty(obj, key, value) {
50
- key = _toPropertyKey(key);
50
+ key = toPropertyKey(key);
51
51
  if (key in obj) {
52
52
  Object.defineProperty(obj, key, {
53
53
  value: value,
@@ -95,7 +95,7 @@ function _defineProperties(target, props) {
95
95
  descriptor.enumerable = descriptor.enumerable || false;
96
96
  descriptor.configurable = true;
97
97
  if ("value" in descriptor) descriptor.writable = true;
98
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
98
+ Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
99
99
  }
100
100
  }
101
101
  function _createClass(Constructor, protoProps, staticProps) {
@@ -215,7 +215,7 @@ function _regeneratorRuntime() {
215
215
  function makeInvokeMethod(e, r, n) {
216
216
  var o = h;
217
217
  return function (i, a) {
218
- if (o === f) throw new Error("Generator is already running");
218
+ if (o === f) throw Error("Generator is already running");
219
219
  if (o === s) {
220
220
  if ("throw" === i) throw a;
221
221
  return {
@@ -357,7 +357,7 @@ function _regeneratorRuntime() {
357
357
  } else if (c) {
358
358
  if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
359
359
  } else {
360
- if (!u) throw new Error("try statement without catch or finally");
360
+ if (!u) throw Error("try statement without catch or finally");
361
361
  if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
362
362
  }
363
363
  }
@@ -397,7 +397,7 @@ function _regeneratorRuntime() {
397
397
  return o;
398
398
  }
399
399
  }
400
- throw new Error("illegal catch attempt");
400
+ throw Error("illegal catch attempt");
401
401
  },
402
402
  delegateYield: function (e, r, n) {
403
403
  return this.delegate = {
@@ -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: "address",
810
- name: "resolver",
811
- type: "address"
1002
+ internalType: "string",
1003
+ name: "name",
1004
+ type: "string"
812
1005
  }, {
813
1006
  indexed: false,
814
- internalType: "address",
815
- name: "provider",
816
- type: "address"
1007
+ internalType: "string",
1008
+ name: "uri",
1009
+ type: "string"
817
1010
  }, {
818
1011
  indexed: false,
819
- internalType: "bytes",
820
- name: "metadata",
821
- type: "bytes"
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 RegistrationModuleABI = [{
1408
+ var IRoyaltyPolicyLAPABI = [{
1198
1409
  inputs: [{
1199
- internalType: "uint256[]",
1200
- name: "licenseIds",
1201
- type: "uint256[]"
1202
- }, {
1203
1410
  internalType: "address",
1204
- name: "tokenContract",
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: "uint256",
1208
- name: "tokenId",
1209
- type: "uint256"
1210
- }, {
1211
- internalType: "string",
1212
- name: "ipName",
1213
- type: "string"
1420
+ internalType: "address",
1421
+ name: "",
1422
+ type: "address"
1214
1423
  }, {
1215
- internalType: "bytes32",
1216
- name: "contentHash",
1217
- type: "bytes32"
1424
+ internalType: "uint32",
1425
+ name: "",
1426
+ type: "uint32"
1218
1427
  }, {
1219
- internalType: "string",
1220
- name: "externalURL",
1221
- type: "string"
1428
+ internalType: "address[]",
1429
+ name: "",
1430
+ type: "address[]"
1222
1431
  }, {
1223
- internalType: "bytes",
1224
- name: "royaltyContext",
1225
- type: "bytes"
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: "registerDerivativeIp",
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: "policyId",
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: "tokenContract",
1493
+ name: "account",
1239
1494
  type: "address"
1240
1495
  }, {
1241
1496
  internalType: "uint256",
1242
- name: "tokenId",
1497
+ name: "snapshotId",
1243
1498
  type: "uint256"
1244
1499
  }, {
1245
- internalType: "string",
1246
- name: "ipName",
1247
- type: "string"
1248
- }, {
1249
- internalType: "bytes32",
1250
- name: "contentHash",
1251
- type: "bytes32"
1252
- }, {
1253
- internalType: "string",
1254
- name: "externalURL",
1255
- type: "string"
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: "registerRootIp",
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: "AncestorsVaultLAP__AlreadyClaimed",
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: "AncestorsVaultLAP__ZeroRoyaltyPolicyLAP",
1640
+ name: "ArbitrationPolicySP__ZeroDisputeModule",
1370
1641
  type: "error"
1371
1642
  }, {
1372
1643
  inputs: [],
1373
- name: "ArbitrationPolicySP__NotDisputeModule",
1644
+ name: "ArbitrationPolicySP__ZeroPaymentToken",
1374
1645
  type: "error"
1375
1646
  }, {
1376
1647
  inputs: [],
1377
- name: "ArbitrationPolicySP__ZeroDisputeModule",
1648
+ name: "BasePolicyFrameworkManager__CallerNotLicensingModule",
1378
1649
  type: "error"
1379
1650
  }, {
1380
1651
  inputs: [],
1381
- name: "ArbitrationPolicySP__ZeroPaymentToken",
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: "RoyaltyPolicyLAP__TransferFailed",
2188
+ name: "RoyaltyPolicyLAP__UnlinkableToParents",
1890
2189
  type: "error"
1891
2190
  }, {
1892
2191
  inputs: [],
1893
- name: "RoyaltyPolicyLAP__UnlinkableToParents",
2192
+ name: "RoyaltyPolicyLAP__ZeroAncestorsVaultImpl",
1894
2193
  type: "error"
1895
2194
  }, {
1896
2195
  inputs: [],
1897
- name: "RoyaltyPolicyLAP__ZeroAncestorsVaultImpl",
2196
+ name: "RoyaltyPolicyLAP__ZeroIpRoyaltyVaultBeacon",
1898
2197
  type: "error"
1899
2198
  }, {
1900
2199
  inputs: [],
@@ -1938,537 +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 IPAssetRegistryConfig = {
1944
- abi: IPAssetRegistryABI,
1945
- address: viem.getAddress(sepolia.IPAssetRegistry)
2269
+ var getIPAssetRegistryConfig = function getIPAssetRegistryConfig(chain) {
2270
+ return {
2271
+ abi: IPAssetRegistryABI,
2272
+ address: viem.getAddress(contractAddress[chain].IPAssetRegistry)
2273
+ };
1946
2274
  };
1947
- var AccessControllerConfig = {
1948
- abi: [].concat(_toConsumableArray(AccessControllerABI), _toConsumableArray(ErrorsABI)),
1949
- address: viem.getAddress(sepolia.AccessController)
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 DisputeModuleConfig = {
1952
- abi: [].concat(_toConsumableArray(DisputeModuleABI), _toConsumableArray(ErrorsABI)),
1953
- address: viem.getAddress(sepolia.DisputeModule)
2287
+ var getLicenseRegistryConfig = function getLicenseRegistryConfig(chain) {
2288
+ return {
2289
+ abi: IERC1155ABI,
2290
+ address: viem.getAddress(contractAddress[chain].LicenseRegistry)
2291
+ };
1954
2292
  };
1955
- var LicenseRegistryConfig = {
1956
- abi: IERC1155ABI,
1957
- address: viem.getAddress(sepolia.LicenseRegistry)
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 LicensingModuleConfig = {
1960
- abi: [].concat(_toConsumableArray(LicensingModuleABI), _toConsumableArray(ErrorsABI)),
1961
- address: viem.getAddress(sepolia.LicensingModule)
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 RegistrationModuleConfig = {
1964
- abi: [].concat(_toConsumableArray(RegistrationModuleABI), _toConsumableArray(ErrorsABI)),
1965
- address: viem.getAddress(sepolia.RegistrationModule)
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 PILPolicyFrameworkManagerConfig = {
1968
- abi: [].concat(_toConsumableArray(PILPolicyFrameworkManagerABI), _toConsumableArray(ErrorsABI)),
1969
- address: viem.getAddress(sepolia.PILPolicyFrameworkManager)
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 RoyaltyPolicyLAPConfig = {
1972
- address: viem.getAddress(sepolia.RoyaltyPolicyLAP)
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 _createForOfIteratorHelper(o, allowArrayLike) {
1976
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
1977
- if (!it) {
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, storyClient) {
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.storyClient = storyClient;
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
- _createClass(IPAssetClient, [{
2255
- key: "registerRootIp",
2339
+ return _createClass(IPAssetClient, [{
2340
+ key: "isNFTRegistered",
2256
2341
  value: function () {
2257
- var _registerRootIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2258
- var _request$txOptions, ipId, _yield$this$rpcClient, call, txHash, targetLogs;
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.prev = 0;
2263
- _context.next = 3;
2264
- return this.isNFTRegistered(SepoliaChainId, request.tokenContractAddress, request.tokenId);
2265
- case 3:
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 8:
2284
- _yield$this$rpcClient = _context.sent;
2285
- call = _yield$this$rpcClient.request;
2286
- _context.next = 12;
2287
- return this.wallet.writeContract(call);
2288
- case 12:
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 16:
2299
- targetLogs = _context.sent;
2300
- return _context.abrupt("return", {
2301
- txHash: txHash,
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, [[0, 23]]);
2366
+ }, _callee, this);
2320
2367
  }));
2321
- function registerRootIp(_x) {
2322
- return _registerRootIp.apply(this, arguments);
2368
+ function isNFTRegistered(_x, _x2) {
2369
+ return _isNFTRegistered.apply(this, arguments);
2323
2370
  }
2324
- return registerRootIp;
2371
+ return isNFTRegistered;
2325
2372
  }()
2326
2373
  /**
2327
- * Registers derivative IPs into the protocol. Derivative IPs are IP assets that inherit policies from
2328
- * parent IPs by burning acquired license NFTs.
2329
- * @param request The request object that contains all data needed to register a root IP.
2330
- * @param request.licenseIds The policy that identifies the licensing terms of the IP.
2331
- * @param request.tokenContract The address of the NFT bound to the derivative IP.
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 RootIPRegistered (msg.sender, ipId, policyId)
2380
+ * @emits IPRegistered (ipId, chainId, tokenContract, tokenId, resolverAddr, metadataProviderAddress, metadata)
2339
2381
  */
2340
2382
  }, {
2341
- key: "registerDerivativeIp",
2342
- value: function () {
2343
- var _registerDerivativeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
2344
- var _request$txOptions2, ipId, licenseIds, royaltyContext, _yield$this$rpcClient2, call, txHash, targetLogs;
2383
+ key: "register",
2384
+ value: (function () {
2385
+ var _register = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
2386
+ var tokenId, _request$txOptions, ipId, _yield$this$rpcClient, call, txHash, targetLogs;
2345
2387
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2346
2388
  while (1) switch (_context2.prev = _context2.next) {
2347
2389
  case 0:
2348
- _context2.prev = 0;
2349
- _context2.next = 3;
2350
- return this.isNFTRegistered(SepoliaChainId, request.tokenContractAddress, request.tokenId);
2351
- case 3:
2390
+ tokenId = parseToBigInt(request.tokenId);
2391
+ _context2.prev = 1;
2392
+ _context2.next = 4;
2393
+ return this.isNFTRegistered(request.tokenContract, tokenId);
2394
+ case 4:
2352
2395
  ipId = _context2.sent;
2353
2396
  if (!(ipId !== "0x")) {
2354
- _context2.next = 6;
2397
+ _context2.next = 7;
2355
2398
  break;
2356
2399
  }
2357
2400
  return _context2.abrupt("return", {
2358
2401
  ipId: ipId
2359
2402
  });
2360
- case 6:
2361
- licenseIds = [];
2362
- request.licenseIds.forEach(function (licenseId) {
2363
- licenseIds.push(parseToBigInt(licenseId));
2364
- });
2365
- _context2.next = 10;
2366
- return computeRoyaltyContext(request.licenseIds, this.storyClient);
2367
- case 10:
2368
- royaltyContext = _context2.sent;
2369
- _context2.next = 13;
2370
- return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.registrationModuleConfig), {}, {
2371
- functionName: "registerDerivativeIp",
2372
- args: [licenseIds, viem.getAddress(request.tokenContractAddress),
2373
- // 0x Address
2374
- 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],
2375
2408
  account: this.wallet.account
2376
2409
  }));
2377
- case 13:
2378
- _yield$this$rpcClient2 = _context2.sent;
2379
- call = _yield$this$rpcClient2.request;
2380
- _context2.next = 17;
2410
+ case 9:
2411
+ _yield$this$rpcClient = _context2.sent;
2412
+ call = _yield$this$rpcClient.request;
2413
+ _context2.next = 13;
2381
2414
  return this.wallet.writeContract(call);
2382
- case 17:
2415
+ case 13:
2383
2416
  txHash = _context2.sent;
2384
- if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
2385
- _context2.next = 25;
2417
+ if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
2418
+ _context2.next = 21;
2386
2419
  break;
2387
2420
  }
2388
- _context2.next = 21;
2421
+ _context2.next = 17;
2389
2422
  return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
2390
2423
  eventName: "IPRegistered"
2391
2424
  }));
2392
- case 21:
2425
+ case 17:
2393
2426
  targetLogs = _context2.sent;
2394
2427
  return _context2.abrupt("return", {
2395
2428
  txHash: txHash,
2396
2429
  ipId: targetLogs[0].args.ipId
2397
2430
  });
2398
- case 25:
2431
+ case 21:
2399
2432
  return _context2.abrupt("return", {
2400
2433
  txHash: txHash
2401
2434
  });
2402
- case 26:
2403
- _context2.next = 31;
2435
+ case 22:
2436
+ _context2.next = 27;
2404
2437
  break;
2405
- case 28:
2406
- _context2.prev = 28;
2407
- _context2.t0 = _context2["catch"](0);
2408
- handleError(_context2.t0, "Failed to register derivative IP");
2409
- case 31:
2438
+ case 24:
2439
+ _context2.prev = 24;
2440
+ _context2.t0 = _context2["catch"](1);
2441
+ handleError(_context2.t0, "Failed to register IP");
2442
+ case 27:
2410
2443
  case "end":
2411
2444
  return _context2.stop();
2412
2445
  }
2413
- }, _callee2, this, [[0, 28]]);
2414
- }));
2415
- function registerDerivativeIp(_x2) {
2416
- return _registerDerivativeIp.apply(this, arguments);
2417
- }
2418
- return registerDerivativeIp;
2419
- }()
2420
- /**
2421
- * Checks if an NFT is already registered in the protocol.
2422
- * @param chainId The chain ID of the NFT.
2423
- * @param tokenAddress The address of the NFT.
2424
- * @param tokenId The token ID of the NFT.
2425
- * @returns A Promise that resolves to the IP ID if the NFT is already registered, otherwise it resolves to 0x.
2426
- */
2427
- }, {
2428
- key: "isNFTRegistered",
2429
- value: function () {
2430
- var _isNFTRegistered = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(chainId, tokenAddress, tokenId) {
2431
- var ipId, isRegistered;
2432
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2433
- while (1) switch (_context3.prev = _context3.next) {
2434
- case 0:
2435
- _context3.next = 2;
2436
- return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
2437
- functionName: "ipId",
2438
- args: [parseToBigInt(chainId), tokenAddress, parseToBigInt(tokenId)]
2439
- }));
2440
- case 2:
2441
- ipId = _context3.sent;
2442
- _context3.next = 5;
2443
- return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
2444
- functionName: "isRegistered",
2445
- args: [ipId]
2446
- }));
2447
- case 5:
2448
- isRegistered = _context3.sent;
2449
- return _context3.abrupt("return", isRegistered ? ipId : "0x");
2450
- case 7:
2451
- case "end":
2452
- return _context3.stop();
2453
- }
2454
- }, _callee3, this);
2446
+ }, _callee2, this, [[1, 24]]);
2455
2447
  }));
2456
- function isNFTRegistered(_x3, _x4, _x5) {
2457
- return _isNFTRegistered.apply(this, arguments);
2448
+ function register(_x3) {
2449
+ return _register.apply(this, arguments);
2458
2450
  }
2459
- return isNFTRegistered;
2460
- }()
2451
+ return register;
2452
+ }())
2461
2453
  }]);
2462
- return IPAssetClient;
2463
2454
  }();
2464
2455
 
2465
2456
  var PermissionClient = /*#__PURE__*/function () {
2466
- function PermissionClient(rpcClient, wallet) {
2457
+ function PermissionClient(rpcClient, wallet, chainId) {
2467
2458
  _classCallCheck(this, PermissionClient);
2468
2459
  _defineProperty(this, "ipAccountABI", IPAccountABI);
2469
- _defineProperty(this, "accessControllerConfig", AccessControllerConfig);
2470
2460
  this.rpcClient = rpcClient;
2471
2461
  this.wallet = wallet;
2462
+ this.accessControllerConfig = getAccessControllerConfig(chainId);
2472
2463
  }
2473
2464
 
2474
2465
  /**
@@ -2490,9 +2481,9 @@ var PermissionClient = /*#__PURE__*/function () {
2490
2481
  * @returns A Promise that resolves to an object containing the transaction hash
2491
2482
  * @emits PermissionSet (ipAccountOwner, ipAccount, signer, to, func, permission)
2492
2483
  */
2493
- _createClass(PermissionClient, [{
2484
+ return _createClass(PermissionClient, [{
2494
2485
  key: "setPermission",
2495
- value: function () {
2486
+ value: (function () {
2496
2487
  var _setPermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2497
2488
  var _request$txOptions, IPAccountConfig, _yield$this$rpcClient, call, txHash;
2498
2489
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -2520,7 +2511,6 @@ var PermissionClient = /*#__PURE__*/function () {
2520
2511
  request.permission // uint8
2521
2512
  ]
2522
2513
  })],
2523
-
2524
2514
  account: this.wallet.account
2525
2515
  }));
2526
2516
  case 4:
@@ -2564,20 +2554,100 @@ var PermissionClient = /*#__PURE__*/function () {
2564
2554
  return _setPermission.apply(this, arguments);
2565
2555
  }
2566
2556
  return setPermission;
2567
- }()
2557
+ }())
2568
2558
  }]);
2569
- return PermissionClient;
2570
2559
  }();
2571
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
+
2572
2642
  var LicenseClient = /*#__PURE__*/function () {
2573
- function LicenseClient(rpcClient, wallet, storyClient) {
2643
+ function LicenseClient(rpcClient, wallet, storyClient, chainId) {
2574
2644
  _classCallCheck(this, LicenseClient);
2575
2645
  _defineProperty(this, "ipAccountABI", IPAccountABI);
2576
- _defineProperty(this, "licenseRegistryConfig", LicenseRegistryConfig);
2577
- _defineProperty(this, "licensingModuleConfig", LicensingModuleConfig);
2578
2646
  this.wallet = wallet;
2579
2647
  this.rpcClient = rpcClient;
2580
2648
  this.storyClient = storyClient;
2649
+ this.licenseRegistryConfig = getLicenseRegistryConfig(chainId);
2650
+ this.licensingModuleConfig = getLicensingModuleConfig(chainId);
2581
2651
  }
2582
2652
 
2583
2653
  /**
@@ -2592,9 +2662,9 @@ var LicenseClient = /*#__PURE__*/function () {
2592
2662
  * @param request.receiver Receiver address of the minted license NFT(s).
2593
2663
  * @returns licenseId The ID of the minted license NFT(s).
2594
2664
  */
2595
- _createClass(LicenseClient, [{
2665
+ return _createClass(LicenseClient, [{
2596
2666
  key: "mintLicense",
2597
- value: function () {
2667
+ value: (function () {
2598
2668
  var _mintLicense = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2599
2669
  var _request$txOptions, royaltyContext, royaltyPolicy, _royaltyContext$targe, _royaltyContext$targe2, targetRoyaltyAmount, _yield$this$rpcClient, call, txHash, targetLogs;
2600
2670
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -2669,7 +2739,7 @@ var LicenseClient = /*#__PURE__*/function () {
2669
2739
  return _mintLicense.apply(this, arguments);
2670
2740
  }
2671
2741
  return mintLicense;
2672
- }()
2742
+ }())
2673
2743
  }, {
2674
2744
  key: "linkIpToParent",
2675
2745
  value: function () {
@@ -2713,7 +2783,7 @@ var LicenseClient = /*#__PURE__*/function () {
2713
2783
  break;
2714
2784
  }
2715
2785
  _context2.next = 17;
2716
- return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, LicenseRegistryConfig), {}, {
2786
+ return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licenseRegistryConfig), {}, {
2717
2787
  eventName: "TransferBatch"
2718
2788
  }));
2719
2789
  case 17:
@@ -2744,18 +2814,17 @@ var LicenseClient = /*#__PURE__*/function () {
2744
2814
  return linkIpToParent;
2745
2815
  }()
2746
2816
  }]);
2747
- return LicenseClient;
2748
2817
  }();
2749
2818
 
2750
2819
  var PolicyClient = /*#__PURE__*/function () {
2751
- function PolicyClient(rpcClient, wallet) {
2820
+ function PolicyClient(rpcClient, wallet, chainId) {
2752
2821
  _classCallCheck(this, PolicyClient);
2753
2822
  _defineProperty(this, "ipAccountABI", IPAccountABI);
2754
- _defineProperty(this, "licensingModuleConfig", LicensingModuleConfig);
2755
- _defineProperty(this, "pilPolicyFrameworkManagerConfig", PILPolicyFrameworkManagerConfig);
2756
- _defineProperty(this, "royaltyPolicyLAPConfig", RoyaltyPolicyLAPConfig);
2757
2823
  this.wallet = wallet;
2758
2824
  this.rpcClient = rpcClient;
2825
+ this.licensingModuleConfig = getLicensingModuleConfig(chainId);
2826
+ this.pilPolicyFrameworkManagerConfig = getPILPolicyFrameworkManagerConfig(chainId);
2827
+ this.royaltyPolicyLAPConfig = getRoyaltyPolicyLAPConfig(chainId);
2759
2828
  }
2760
2829
 
2761
2830
  /**
@@ -2777,9 +2846,9 @@ var PolicyClient = /*#__PURE__*/function () {
2777
2846
  * @param request.royaltyPolicy Address of a royalty policy contract (e.g. RoyaltyPolicyLS) that will handle royalty payments
2778
2847
  * @returns the transaction hash and the policy ID if the txOptions.waitForTransaction is set to true
2779
2848
  */
2780
- _createClass(PolicyClient, [{
2849
+ return _createClass(PolicyClient, [{
2781
2850
  key: "registerPILPolicy",
2782
- value: function () {
2851
+ value: (function () {
2783
2852
  var _registerPILPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2784
2853
  var _request$txOptions, frameworkData, policyId, _yield$this$rpcClient, call, txHash, targetLogs;
2785
2854
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -2895,9 +2964,10 @@ var PolicyClient = /*#__PURE__*/function () {
2895
2964
  * @param request.contentRestrictions List of content restrictions where the license is valid. Empty if no restrictions.
2896
2965
  * @returns the transaction hash and the policy ID if the txOptions.waitForTransaction is set to true
2897
2966
  */
2967
+ )
2898
2968
  }, {
2899
2969
  key: "registerPILSocialRemixPolicy",
2900
- value: function () {
2970
+ value: (function () {
2901
2971
  var _registerPILSocialRemixPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
2902
2972
  var _request$txOptions2, frameworkData, policyId, _yield$this$rpcClient2, call, txHash, targetLog;
2903
2973
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -3016,9 +3086,10 @@ var PolicyClient = /*#__PURE__*/function () {
3016
3086
  * @param request.contentRestrictions List of content restrictions where the license is valid. Empty if no restrictions.
3017
3087
  * @returns the transaction hash and the policy ID if the txOptions.waitForTransaction is set to true
3018
3088
  */
3089
+ )
3019
3090
  }, {
3020
3091
  key: "registerPILCommercialUsePolicy",
3021
- value: function () {
3092
+ value: (function () {
3022
3093
  var _registerPILCommercialUsePolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(request) {
3023
3094
  var _request$txOptions3, frameworkData, policyId, _yield$this$rpcClient3, call, txHash, targetLogs;
3024
3095
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
@@ -3124,7 +3195,7 @@ var PolicyClient = /*#__PURE__*/function () {
3124
3195
  return _registerPILCommercialUsePolicy.apply(this, arguments);
3125
3196
  }
3126
3197
  return registerPILCommercialUsePolicy;
3127
- }()
3198
+ }())
3128
3199
  }, {
3129
3200
  key: "getPolicyId",
3130
3201
  value: function () {
@@ -3178,7 +3249,7 @@ var PolicyClient = /*#__PURE__*/function () {
3178
3249
  */
3179
3250
  }, {
3180
3251
  key: "addPolicyToIp",
3181
- value: function () {
3252
+ value: (function () {
3182
3253
  var _addPolicyToIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(request) {
3183
3254
  var _request$txOptions4, IPAccountConfig, _yield$this$rpcClient4, call, txHash, targetLogs;
3184
3255
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
@@ -3241,17 +3312,16 @@ var PolicyClient = /*#__PURE__*/function () {
3241
3312
  return _addPolicyToIp.apply(this, arguments);
3242
3313
  }
3243
3314
  return addPolicyToIp;
3244
- }()
3315
+ }())
3245
3316
  }]);
3246
- return PolicyClient;
3247
3317
  }();
3248
3318
 
3249
3319
  var DisputeClient = /*#__PURE__*/function () {
3250
- function DisputeClient(rpcClient, wallet) {
3320
+ function DisputeClient(rpcClient, wallet, chainId) {
3251
3321
  _classCallCheck(this, DisputeClient);
3252
- _defineProperty(this, "disputeModuleConfig", DisputeModuleConfig);
3253
3322
  this.rpcClient = rpcClient;
3254
3323
  this.wallet = wallet;
3324
+ this.disputeModuleConfig = getDisputeModuleConfig(chainId);
3255
3325
  }
3256
3326
 
3257
3327
  /**
@@ -3270,9 +3340,9 @@ var DisputeClient = /*#__PURE__*/function () {
3270
3340
  * @calls raiseDispute(address _targetIpId, string memory _linkToDisputeEvidence, bytes32 _targetTag, bytes calldata _data) external nonReentrant returns (uint256) {
3271
3341
  * @emits DisputeRaised (disputeId_, targetIpId, msg.sender, arbitrationPolicy, linkToDisputeEvidence, targetTag, calldata);
3272
3342
  */
3273
- _createClass(DisputeClient, [{
3343
+ return _createClass(DisputeClient, [{
3274
3344
  key: "raiseDispute",
3275
- value: function () {
3345
+ value: (function () {
3276
3346
  var _raiseDispute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
3277
3347
  var _request$txOptions, _yield$this$rpcClient, call, txHash, targetLogs;
3278
3348
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -3339,9 +3409,10 @@ var DisputeClient = /*#__PURE__*/function () {
3339
3409
  * @calls cancelDispute(uint256 _disputeId, bytes calldata _data) external nonReentrant {
3340
3410
  * @emits DisputeCancelled (_disputeId, _data);
3341
3411
  */
3412
+ )
3342
3413
  }, {
3343
3414
  key: "cancelDispute",
3344
- value: function () {
3415
+ value: (function () {
3345
3416
  var _cancelDispute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
3346
3417
  var _request$txOptions2, _yield$this$rpcClient2, call, txHash;
3347
3418
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -3395,9 +3466,10 @@ var DisputeClient = /*#__PURE__*/function () {
3395
3466
  * @throws NotDisputeInitiator, if the transaction executor is not the one that initiated the dispute
3396
3467
  * @emits DisputeResolved (_disputeId)
3397
3468
  */
3469
+ )
3398
3470
  }, {
3399
3471
  key: "resolveDispute",
3400
- value: function () {
3472
+ value: (function () {
3401
3473
  var _resolveDispute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(request) {
3402
3474
  var _request$txOptions3, _yield$this$rpcClient3, call, txHash;
3403
3475
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
@@ -3441,9 +3513,8 @@ var DisputeClient = /*#__PURE__*/function () {
3441
3513
  return _resolveDispute.apply(this, arguments);
3442
3514
  }
3443
3515
  return resolveDispute;
3444
- }()
3516
+ }())
3445
3517
  }]);
3446
- return DisputeClient;
3447
3518
  }();
3448
3519
 
3449
3520
  var IPAccountClient = /*#__PURE__*/function () {
@@ -3461,9 +3532,9 @@ var IPAccountClient = /*#__PURE__*/function () {
3461
3532
  * @param request.data The data to send along with the transaction.
3462
3533
  * @returns Tx hash for the transaction.
3463
3534
  */
3464
- _createClass(IPAccountClient, [{
3535
+ return _createClass(IPAccountClient, [{
3465
3536
  key: "execute",
3466
- value: function () {
3537
+ value: (function () {
3467
3538
  var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
3468
3539
  var _request$txOptions, IPAccountConfig, _yield$this$rpcClient, call, txHash;
3469
3540
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -3522,9 +3593,10 @@ var IPAccountClient = /*#__PURE__*/function () {
3522
3593
  * @param request.signature The signature of the transaction, EIP-712 encoded.
3523
3594
  * @returns Tx hash for the transaction.
3524
3595
  */
3596
+ )
3525
3597
  }, {
3526
3598
  key: "executeWithSig",
3527
- value: function () {
3599
+ value: (function () {
3528
3600
  var _executeWithSig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
3529
3601
  var _request$txOptions2, IPAccountConfig, _yield$this$rpcClient2, call, txHash;
3530
3602
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -3572,9 +3644,8 @@ var IPAccountClient = /*#__PURE__*/function () {
3572
3644
  return _executeWithSig.apply(this, arguments);
3573
3645
  }
3574
3646
  return executeWithSig;
3575
- }()
3647
+ }())
3576
3648
  }]);
3577
- return IPAccountClient;
3578
3649
  }();
3579
3650
 
3580
3651
  var StoryAPIClient = /*#__PURE__*/function () {
@@ -3588,7 +3659,7 @@ var StoryAPIClient = /*#__PURE__*/function () {
3588
3659
  }
3589
3660
  });
3590
3661
  }
3591
- _createClass(StoryAPIClient, [{
3662
+ return _createClass(StoryAPIClient, [{
3592
3663
  key: "getRoyaltyPolicy",
3593
3664
  value: function () {
3594
3665
  var _getRoyaltyPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(ipId) {
@@ -3661,7 +3732,166 @@ var StoryAPIClient = /*#__PURE__*/function () {
3661
3732
  return getPolicy;
3662
3733
  }()
3663
3734
  }]);
3664
- return StoryAPIClient;
3735
+ }();
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
+ }]);
3665
3895
  }();
3666
3896
 
3667
3897
  if (typeof process !== "undefined") {
@@ -3682,12 +3912,15 @@ var StoryClient = /*#__PURE__*/function () {
3682
3912
  _defineProperty(this, "_policy", null);
3683
3913
  _defineProperty(this, "_dispute", null);
3684
3914
  _defineProperty(this, "_ipAccount", null);
3685
- this.config = config;
3915
+ _defineProperty(this, "_royalty", null);
3916
+ this.config = _objectSpread2(_objectSpread2({}, config), {}, {
3917
+ chainId: config.chainId || "sepolia"
3918
+ });
3686
3919
  if (!this.config.transport) {
3687
3920
  throw new Error("transport is null, please pass in a valid RPC Provider URL as the transport.");
3688
3921
  }
3689
3922
  var clientConfig = {
3690
- chain: chainStringToViemChain(this.config.chainId || "sepolia"),
3923
+ chain: chainStringToViemChain(this.config.chainId),
3691
3924
  transport: this.config.transport
3692
3925
  };
3693
3926
  this.rpcClient = viem.createPublicClient(clientConfig);
@@ -3706,7 +3939,7 @@ var StoryClient = /*#__PURE__*/function () {
3706
3939
  *
3707
3940
  * @param config - the configuration for a new SDK client
3708
3941
  */
3709
- _createClass(StoryClient, [{
3942
+ return _createClass(StoryClient, [{
3710
3943
  key: "ipAsset",
3711
3944
  get:
3712
3945
  /**
@@ -3717,7 +3950,7 @@ var StoryClient = /*#__PURE__*/function () {
3717
3950
  */
3718
3951
  function get() {
3719
3952
  if (this._ipAsset === null) {
3720
- this._ipAsset = new IPAssetClient(this.rpcClient, this.wallet, this.storyClient);
3953
+ this._ipAsset = new IPAssetClient(this.rpcClient, this.wallet, this.config.chainId);
3721
3954
  }
3722
3955
  return this._ipAsset;
3723
3956
  }
@@ -3732,7 +3965,7 @@ var StoryClient = /*#__PURE__*/function () {
3732
3965
  key: "permission",
3733
3966
  get: function get() {
3734
3967
  if (this._permission === null) {
3735
- this._permission = new PermissionClient(this.rpcClient, this.wallet);
3968
+ this._permission = new PermissionClient(this.rpcClient, this.wallet, this.config.chainId);
3736
3969
  }
3737
3970
  return this._permission;
3738
3971
  }
@@ -3747,7 +3980,7 @@ var StoryClient = /*#__PURE__*/function () {
3747
3980
  key: "license",
3748
3981
  get: function get() {
3749
3982
  if (this._license === null) {
3750
- this._license = new LicenseClient(this.rpcClient, this.wallet, this.storyClient);
3983
+ this._license = new LicenseClient(this.rpcClient, this.wallet, this.storyClient, this.config.chainId);
3751
3984
  }
3752
3985
  return this._license;
3753
3986
  }
@@ -3762,7 +3995,7 @@ var StoryClient = /*#__PURE__*/function () {
3762
3995
  key: "policy",
3763
3996
  get: function get() {
3764
3997
  if (this._policy === null) {
3765
- this._policy = new PolicyClient(this.rpcClient, this.wallet);
3998
+ this._policy = new PolicyClient(this.rpcClient, this.wallet, this.config.chainId);
3766
3999
  }
3767
4000
  return this._policy;
3768
4001
  }
@@ -3777,7 +4010,7 @@ var StoryClient = /*#__PURE__*/function () {
3777
4010
  key: "dispute",
3778
4011
  get: function get() {
3779
4012
  if (this._dispute === null) {
3780
- this._dispute = new DisputeClient(this.rpcClient, this.wallet);
4013
+ this._dispute = new DisputeClient(this.rpcClient, this.wallet, this.config.chainId);
3781
4014
  }
3782
4015
  return this._dispute;
3783
4016
  }
@@ -3796,15 +4029,31 @@ var StoryClient = /*#__PURE__*/function () {
3796
4029
  }
3797
4030
  return this._ipAccount;
3798
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
+ }
3799
4046
  }], [{
3800
4047
  key: "newClient",
3801
4048
  value: function newClient(config) {
3802
4049
  return new StoryClient(config);
3803
4050
  }
3804
4051
  }]);
3805
- return StoryClient;
3806
4052
  }();
3807
4053
 
4054
+ var AddressZero = "0x0000000000000000000000000000000000000000";
4055
+ var HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
4056
+
3808
4057
  exports.AddressZero = AddressZero;
3809
4058
  exports.DisputeClient = DisputeClient;
3810
4059
  exports.HashZero = HashZero;