@story-protocol/core-sdk 0.0.1-beta-rc.10 → 0.0.1-beta-rc.12
Sign up to get free protection for your applications and to get access to all the features.
- 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 +6 -3
- 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.d.ts +1 -1
- package/dist/story-protocol-core-sdk.cjs.dev.js +910 -661
- package/dist/story-protocol-core-sdk.cjs.prod.js +910 -661
- package/dist/story-protocol-core-sdk.esm.js +912 -663
- package/package.json +2 -2
- package/dist/story-protocol-core-sdk.cjs.d.ts.map +0 -1
@@ -1,26 +1,26 @@
|
|
1
|
-
import {
|
1
|
+
import { encodeAbiParameters, parseAbiParameters, defineChain, decodeEventLog, getAddress, encodeFunctionData, zeroAddress, stringToHex, createPublicClient, createWalletClient } from 'viem';
|
2
2
|
import * as dotenv from 'dotenv';
|
3
|
-
import {
|
3
|
+
import { sepolia as sepolia$1 } from 'viem/chains';
|
4
4
|
import axios from 'axios';
|
5
5
|
|
6
|
-
function
|
7
|
-
if (
|
8
|
-
var
|
9
|
-
if (
|
10
|
-
var
|
11
|
-
if (
|
6
|
+
function toPrimitive(t, r) {
|
7
|
+
if ("object" != typeof t || !t) return t;
|
8
|
+
var e = t[Symbol.toPrimitive];
|
9
|
+
if (void 0 !== e) {
|
10
|
+
var i = e.call(t, r || "default");
|
11
|
+
if ("object" != typeof i) return i;
|
12
12
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
13
13
|
}
|
14
|
-
return (
|
14
|
+
return ("string" === r ? String : Number)(t);
|
15
15
|
}
|
16
16
|
|
17
|
-
function
|
18
|
-
var
|
19
|
-
return
|
17
|
+
function toPropertyKey(t) {
|
18
|
+
var i = toPrimitive(t, "string");
|
19
|
+
return "symbol" == typeof i ? i : i + "";
|
20
20
|
}
|
21
21
|
|
22
22
|
function _defineProperty(obj, key, value) {
|
23
|
-
key =
|
23
|
+
key = toPropertyKey(key);
|
24
24
|
if (key in obj) {
|
25
25
|
Object.defineProperty(obj, key, {
|
26
26
|
value: value,
|
@@ -68,7 +68,7 @@ function _defineProperties(target, props) {
|
|
68
68
|
descriptor.enumerable = descriptor.enumerable || false;
|
69
69
|
descriptor.configurable = true;
|
70
70
|
if ("value" in descriptor) descriptor.writable = true;
|
71
|
-
Object.defineProperty(target,
|
71
|
+
Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
|
72
72
|
}
|
73
73
|
}
|
74
74
|
function _createClass(Constructor, protoProps, staticProps) {
|
@@ -188,7 +188,7 @@ function _regeneratorRuntime() {
|
|
188
188
|
function makeInvokeMethod(e, r, n) {
|
189
189
|
var o = h;
|
190
190
|
return function (i, a) {
|
191
|
-
if (o === f) throw
|
191
|
+
if (o === f) throw Error("Generator is already running");
|
192
192
|
if (o === s) {
|
193
193
|
if ("throw" === i) throw a;
|
194
194
|
return {
|
@@ -330,7 +330,7 @@ function _regeneratorRuntime() {
|
|
330
330
|
} else if (c) {
|
331
331
|
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
332
332
|
} else {
|
333
|
-
if (!u) throw
|
333
|
+
if (!u) throw Error("try statement without catch or finally");
|
334
334
|
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
335
335
|
}
|
336
336
|
}
|
@@ -370,7 +370,7 @@ function _regeneratorRuntime() {
|
|
370
370
|
return o;
|
371
371
|
}
|
372
372
|
}
|
373
|
-
throw
|
373
|
+
throw Error("illegal catch attempt");
|
374
374
|
},
|
375
375
|
delegateYield: function (e, r, n) {
|
376
376
|
return this.delegate = {
|
@@ -413,31 +413,12 @@ function _asyncToGenerator(fn) {
|
|
413
413
|
};
|
414
414
|
}
|
415
415
|
|
416
|
-
function handleError(error, msg) {
|
417
|
-
if (error instanceof Error) {
|
418
|
-
throw new Error("".concat(msg, ": ").concat(error.message));
|
419
|
-
}
|
420
|
-
throw new Error("".concat(msg, ": Unknown error type"));
|
421
|
-
}
|
422
|
-
|
423
|
-
var AddressZero = "0x0000000000000000000000000000000000000000";
|
424
|
-
var HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
425
|
-
var SepoliaChainId = "11155111";
|
426
|
-
|
427
416
|
function _arrayLikeToArray(arr, len) {
|
428
417
|
if (len == null || len > arr.length) len = arr.length;
|
429
418
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
430
419
|
return arr2;
|
431
420
|
}
|
432
421
|
|
433
|
-
function _arrayWithoutHoles(arr) {
|
434
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
435
|
-
}
|
436
|
-
|
437
|
-
function _iterableToArray(iter) {
|
438
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
439
|
-
}
|
440
|
-
|
441
422
|
function _unsupportedIterableToArray(o, minLen) {
|
442
423
|
if (!o) return;
|
443
424
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
@@ -447,6 +428,218 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
447
428
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
448
429
|
}
|
449
430
|
|
431
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
432
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
433
|
+
if (!it) {
|
434
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
435
|
+
if (it) o = it;
|
436
|
+
var i = 0;
|
437
|
+
var F = function () {};
|
438
|
+
return {
|
439
|
+
s: F,
|
440
|
+
n: function () {
|
441
|
+
if (i >= o.length) return {
|
442
|
+
done: true
|
443
|
+
};
|
444
|
+
return {
|
445
|
+
done: false,
|
446
|
+
value: o[i++]
|
447
|
+
};
|
448
|
+
},
|
449
|
+
e: function (e) {
|
450
|
+
throw e;
|
451
|
+
},
|
452
|
+
f: F
|
453
|
+
};
|
454
|
+
}
|
455
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
456
|
+
}
|
457
|
+
var normalCompletion = true,
|
458
|
+
didErr = false,
|
459
|
+
err;
|
460
|
+
return {
|
461
|
+
s: function () {
|
462
|
+
it = it.call(o);
|
463
|
+
},
|
464
|
+
n: function () {
|
465
|
+
var step = it.next();
|
466
|
+
normalCompletion = step.done;
|
467
|
+
return step;
|
468
|
+
},
|
469
|
+
e: function (e) {
|
470
|
+
didErr = true;
|
471
|
+
err = e;
|
472
|
+
},
|
473
|
+
f: function () {
|
474
|
+
try {
|
475
|
+
if (!normalCompletion && it.return != null) it.return();
|
476
|
+
} finally {
|
477
|
+
if (didErr) throw err;
|
478
|
+
}
|
479
|
+
}
|
480
|
+
};
|
481
|
+
}
|
482
|
+
|
483
|
+
function parseToBigInt(num) {
|
484
|
+
return BigInt(num);
|
485
|
+
}
|
486
|
+
function waitTxAndFilterLog(_x, _x2, _x3) {
|
487
|
+
return _waitTxAndFilterLog.apply(this, arguments);
|
488
|
+
}
|
489
|
+
function _waitTxAndFilterLog() {
|
490
|
+
_waitTxAndFilterLog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(client, txHash, params) {
|
491
|
+
var txReceipt, targetLogs, _iterator, _step, log, currentLog;
|
492
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
493
|
+
while (1) switch (_context.prev = _context.next) {
|
494
|
+
case 0:
|
495
|
+
_context.next = 2;
|
496
|
+
return client.waitForTransactionReceipt({
|
497
|
+
hash: txHash,
|
498
|
+
confirmations: params.confirmations,
|
499
|
+
pollingInterval: params.pollingInterval,
|
500
|
+
timeout: params.timeout
|
501
|
+
});
|
502
|
+
case 2:
|
503
|
+
txReceipt = _context.sent;
|
504
|
+
targetLogs = [];
|
505
|
+
_iterator = _createForOfIteratorHelper(txReceipt.logs);
|
506
|
+
_context.prev = 5;
|
507
|
+
_iterator.s();
|
508
|
+
case 7:
|
509
|
+
if ((_step = _iterator.n()).done) {
|
510
|
+
_context.next = 21;
|
511
|
+
break;
|
512
|
+
}
|
513
|
+
log = _step.value;
|
514
|
+
_context.prev = 9;
|
515
|
+
if (!(params.from && log.address !== params.from.toLowerCase())) {
|
516
|
+
_context.next = 12;
|
517
|
+
break;
|
518
|
+
}
|
519
|
+
return _context.abrupt("continue", 19);
|
520
|
+
case 12:
|
521
|
+
currentLog = decodeEventLog({
|
522
|
+
abi: params.abi,
|
523
|
+
eventName: params.eventName,
|
524
|
+
data: log.data,
|
525
|
+
topics: log.topics
|
526
|
+
});
|
527
|
+
targetLogs.push(currentLog);
|
528
|
+
_context.next = 19;
|
529
|
+
break;
|
530
|
+
case 16:
|
531
|
+
_context.prev = 16;
|
532
|
+
_context.t0 = _context["catch"](9);
|
533
|
+
return _context.abrupt("continue", 19);
|
534
|
+
case 19:
|
535
|
+
_context.next = 7;
|
536
|
+
break;
|
537
|
+
case 21:
|
538
|
+
_context.next = 26;
|
539
|
+
break;
|
540
|
+
case 23:
|
541
|
+
_context.prev = 23;
|
542
|
+
_context.t1 = _context["catch"](5);
|
543
|
+
_iterator.e(_context.t1);
|
544
|
+
case 26:
|
545
|
+
_context.prev = 26;
|
546
|
+
_iterator.f();
|
547
|
+
return _context.finish(26);
|
548
|
+
case 29:
|
549
|
+
if (!(targetLogs.length === 0)) {
|
550
|
+
_context.next = 31;
|
551
|
+
break;
|
552
|
+
}
|
553
|
+
throw new Error("not found event ".concat(params.eventName, " in target transaction"));
|
554
|
+
case 31:
|
555
|
+
return _context.abrupt("return", targetLogs);
|
556
|
+
case 32:
|
557
|
+
case "end":
|
558
|
+
return _context.stop();
|
559
|
+
}
|
560
|
+
}, _callee, null, [[5, 23, 26, 29], [9, 16]]);
|
561
|
+
}));
|
562
|
+
return _waitTxAndFilterLog.apply(this, arguments);
|
563
|
+
}
|
564
|
+
function waitTx(_x4, _x5, _x6) {
|
565
|
+
return _waitTx.apply(this, arguments);
|
566
|
+
}
|
567
|
+
function _waitTx() {
|
568
|
+
_waitTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(client, txHash, params) {
|
569
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
570
|
+
while (1) switch (_context2.prev = _context2.next) {
|
571
|
+
case 0:
|
572
|
+
_context2.next = 2;
|
573
|
+
return client.waitForTransactionReceipt(_objectSpread2({
|
574
|
+
hash: txHash
|
575
|
+
}, params));
|
576
|
+
case 2:
|
577
|
+
case "end":
|
578
|
+
return _context2.stop();
|
579
|
+
}
|
580
|
+
}, _callee2);
|
581
|
+
}));
|
582
|
+
return _waitTx.apply(this, arguments);
|
583
|
+
}
|
584
|
+
function typedDataToBytes(typedData) {
|
585
|
+
return encodeAbiParameters(parseAbiParameters(typedData["interface"]), typedData.data);
|
586
|
+
}
|
587
|
+
function chainStringToViemChain(chainId) {
|
588
|
+
switch (chainId) {
|
589
|
+
case "11155111":
|
590
|
+
case "sepolia":
|
591
|
+
return sepolia$1;
|
592
|
+
case "1513":
|
593
|
+
case "storyTestnet":
|
594
|
+
return storyTestnet$1;
|
595
|
+
default:
|
596
|
+
throw new Error("chainId ".concat(chainId, " not supported"));
|
597
|
+
}
|
598
|
+
}
|
599
|
+
var storyTestnet$1 = defineChain({
|
600
|
+
id: 1513,
|
601
|
+
name: "story-network",
|
602
|
+
nativeCurrency: {
|
603
|
+
name: "Ether",
|
604
|
+
symbol: "SEP",
|
605
|
+
decimals: 18
|
606
|
+
},
|
607
|
+
rpcUrls: {
|
608
|
+
"default": {
|
609
|
+
http: ["https://story-network.rpc.caldera.xyz/http"],
|
610
|
+
webSocket: ["wss://story-network.rpc.caldera.xyz/ws"]
|
611
|
+
}
|
612
|
+
},
|
613
|
+
blockExplorers: {
|
614
|
+
"default": {
|
615
|
+
name: "Explorer",
|
616
|
+
url: "https://story-network.explorer.caldera.xyz"
|
617
|
+
}
|
618
|
+
},
|
619
|
+
//TODO: wait for Ze confirm with config information
|
620
|
+
contracts: {
|
621
|
+
multicall3: {
|
622
|
+
address: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
623
|
+
blockCreated: 5882
|
624
|
+
}
|
625
|
+
},
|
626
|
+
testnet: true
|
627
|
+
});
|
628
|
+
var chain = {
|
629
|
+
sepolia: "11155111",
|
630
|
+
storyTestnet: "1513",
|
631
|
+
11155111: "11155111",
|
632
|
+
1513: "1513"
|
633
|
+
};
|
634
|
+
|
635
|
+
function _arrayWithoutHoles(arr) {
|
636
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
637
|
+
}
|
638
|
+
|
639
|
+
function _iterableToArray(iter) {
|
640
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
641
|
+
}
|
642
|
+
|
450
643
|
function _nonIterableSpread() {
|
451
644
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
452
645
|
}
|
@@ -779,19 +972,19 @@ var IPAssetRegistryABI = [{
|
|
779
972
|
type: "uint256"
|
780
973
|
}, {
|
781
974
|
indexed: false,
|
782
|
-
internalType: "
|
783
|
-
name: "
|
784
|
-
type: "
|
975
|
+
internalType: "string",
|
976
|
+
name: "name",
|
977
|
+
type: "string"
|
785
978
|
}, {
|
786
979
|
indexed: false,
|
787
|
-
internalType: "
|
788
|
-
name: "
|
789
|
-
type: "
|
980
|
+
internalType: "string",
|
981
|
+
name: "uri",
|
982
|
+
type: "string"
|
790
983
|
}, {
|
791
984
|
indexed: false,
|
792
|
-
internalType: "
|
793
|
-
name: "
|
794
|
-
type: "
|
985
|
+
internalType: "uint256",
|
986
|
+
name: "registrationDate",
|
987
|
+
type: "uint256"
|
795
988
|
}],
|
796
989
|
name: "IPRegistered",
|
797
990
|
type: "event"
|
@@ -831,6 +1024,24 @@ var IPAssetRegistryABI = [{
|
|
831
1024
|
}],
|
832
1025
|
stateMutability: "view",
|
833
1026
|
type: "function"
|
1027
|
+
}, {
|
1028
|
+
inputs: [{
|
1029
|
+
internalType: "address",
|
1030
|
+
name: "tokenContract",
|
1031
|
+
type: "address"
|
1032
|
+
}, {
|
1033
|
+
internalType: "uint256",
|
1034
|
+
name: "tokenId",
|
1035
|
+
type: "uint256"
|
1036
|
+
}],
|
1037
|
+
name: "register",
|
1038
|
+
outputs: [{
|
1039
|
+
internalType: "address",
|
1040
|
+
name: "id",
|
1041
|
+
type: "address"
|
1042
|
+
}],
|
1043
|
+
stateMutability: "nonpayable",
|
1044
|
+
type: "function"
|
834
1045
|
}];
|
835
1046
|
|
836
1047
|
var LicensingModuleABI = [{
|
@@ -1167,72 +1378,152 @@ var PILPolicyFrameworkManagerABI = [{
|
|
1167
1378
|
type: "function"
|
1168
1379
|
}];
|
1169
1380
|
|
1170
|
-
var
|
1381
|
+
var IRoyaltyPolicyLAPABI = [{
|
1171
1382
|
inputs: [{
|
1172
|
-
internalType: "uint256[]",
|
1173
|
-
name: "licenseIds",
|
1174
|
-
type: "uint256[]"
|
1175
|
-
}, {
|
1176
1383
|
internalType: "address",
|
1177
|
-
name: "
|
1384
|
+
name: "ipId",
|
1178
1385
|
type: "address"
|
1386
|
+
}],
|
1387
|
+
name: "getRoyaltyData",
|
1388
|
+
outputs: [{
|
1389
|
+
internalType: "bool",
|
1390
|
+
name: "",
|
1391
|
+
type: "bool"
|
1179
1392
|
}, {
|
1180
|
-
internalType: "
|
1181
|
-
name: "
|
1182
|
-
type: "
|
1183
|
-
}, {
|
1184
|
-
internalType: "string",
|
1185
|
-
name: "ipName",
|
1186
|
-
type: "string"
|
1393
|
+
internalType: "address",
|
1394
|
+
name: "",
|
1395
|
+
type: "address"
|
1187
1396
|
}, {
|
1188
|
-
internalType: "
|
1189
|
-
name: "
|
1190
|
-
type: "
|
1397
|
+
internalType: "uint32",
|
1398
|
+
name: "",
|
1399
|
+
type: "uint32"
|
1191
1400
|
}, {
|
1192
|
-
internalType: "
|
1193
|
-
name: "
|
1194
|
-
type: "
|
1401
|
+
internalType: "address[]",
|
1402
|
+
name: "",
|
1403
|
+
type: "address[]"
|
1195
1404
|
}, {
|
1196
|
-
internalType: "
|
1197
|
-
name: "
|
1198
|
-
type: "
|
1405
|
+
internalType: "uint32[]",
|
1406
|
+
name: "",
|
1407
|
+
type: "uint32[]"
|
1408
|
+
}],
|
1409
|
+
stateMutability: "view",
|
1410
|
+
type: "function"
|
1411
|
+
}, {
|
1412
|
+
inputs: [{
|
1413
|
+
internalType: "address",
|
1414
|
+
name: "caller",
|
1415
|
+
type: "address"
|
1416
|
+
}, {
|
1417
|
+
internalType: "address",
|
1418
|
+
name: "ipId",
|
1419
|
+
type: "address"
|
1420
|
+
}, {
|
1421
|
+
internalType: "address",
|
1422
|
+
name: "token",
|
1423
|
+
type: "address"
|
1424
|
+
}, {
|
1425
|
+
internalType: "uint256",
|
1426
|
+
name: "amount",
|
1427
|
+
type: "uint256"
|
1428
|
+
}],
|
1429
|
+
name: "onRoyaltyPayment",
|
1430
|
+
outputs: [],
|
1431
|
+
stateMutability: "nonpayable",
|
1432
|
+
type: "function"
|
1433
|
+
}];
|
1434
|
+
|
1435
|
+
var IpRoyaltyVaultABI = [{
|
1436
|
+
inputs: [{
|
1437
|
+
internalType: "uint256[]",
|
1438
|
+
name: "snapshotIds",
|
1439
|
+
type: "uint256[]"
|
1440
|
+
}, {
|
1441
|
+
internalType: "address",
|
1442
|
+
name: "token",
|
1443
|
+
type: "address"
|
1199
1444
|
}],
|
1200
|
-
name: "
|
1445
|
+
name: "claimRevenueBySnapshotBatch",
|
1201
1446
|
outputs: [],
|
1202
1447
|
stateMutability: "nonpayable",
|
1203
1448
|
type: "function"
|
1204
1449
|
}, {
|
1205
1450
|
inputs: [{
|
1206
1451
|
internalType: "uint256",
|
1207
|
-
name: "
|
1452
|
+
name: "snapshotId",
|
1208
1453
|
type: "uint256"
|
1209
1454
|
}, {
|
1455
|
+
internalType: "address[]",
|
1456
|
+
name: "tokens",
|
1457
|
+
type: "address[]"
|
1458
|
+
}],
|
1459
|
+
name: "claimRevenueByTokenBatch",
|
1460
|
+
outputs: [],
|
1461
|
+
stateMutability: "nonpayable",
|
1462
|
+
type: "function"
|
1463
|
+
}, {
|
1464
|
+
inputs: [{
|
1210
1465
|
internalType: "address",
|
1211
|
-
name: "
|
1466
|
+
name: "account",
|
1212
1467
|
type: "address"
|
1213
1468
|
}, {
|
1214
1469
|
internalType: "uint256",
|
1215
|
-
name: "
|
1470
|
+
name: "snapshotId",
|
1216
1471
|
type: "uint256"
|
1217
1472
|
}, {
|
1218
|
-
internalType: "
|
1219
|
-
name: "
|
1220
|
-
type: "
|
1221
|
-
},
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1473
|
+
internalType: "address",
|
1474
|
+
name: "token",
|
1475
|
+
type: "address"
|
1476
|
+
}],
|
1477
|
+
name: "claimableRevenue",
|
1478
|
+
outputs: [{
|
1479
|
+
internalType: "uint256",
|
1480
|
+
name: "",
|
1481
|
+
type: "uint256"
|
1482
|
+
}],
|
1483
|
+
stateMutability: "view",
|
1484
|
+
type: "function"
|
1485
|
+
}, {
|
1486
|
+
inputs: [{
|
1487
|
+
internalType: "address",
|
1488
|
+
name: "ancestorIpId",
|
1489
|
+
type: "address"
|
1229
1490
|
}],
|
1230
|
-
name: "
|
1491
|
+
name: "collectRoyaltyTokens",
|
1492
|
+
outputs: [],
|
1493
|
+
stateMutability: "nonpayable",
|
1494
|
+
type: "function"
|
1495
|
+
}, {
|
1496
|
+
inputs: [],
|
1497
|
+
name: "ipId",
|
1231
1498
|
outputs: [{
|
1232
1499
|
internalType: "address",
|
1233
1500
|
name: "",
|
1234
1501
|
type: "address"
|
1235
1502
|
}],
|
1503
|
+
stateMutability: "view",
|
1504
|
+
type: "function"
|
1505
|
+
}];
|
1506
|
+
|
1507
|
+
var IRoyaltyModuleABI = [{
|
1508
|
+
inputs: [{
|
1509
|
+
internalType: "address",
|
1510
|
+
name: "receiverIpId",
|
1511
|
+
type: "address"
|
1512
|
+
}, {
|
1513
|
+
internalType: "address",
|
1514
|
+
name: "payerIpId",
|
1515
|
+
type: "address"
|
1516
|
+
}, {
|
1517
|
+
internalType: "address",
|
1518
|
+
name: "token",
|
1519
|
+
type: "address"
|
1520
|
+
}, {
|
1521
|
+
internalType: "uint256",
|
1522
|
+
name: "amount",
|
1523
|
+
type: "uint256"
|
1524
|
+
}],
|
1525
|
+
name: "payRoyaltyOnBehalf",
|
1526
|
+
outputs: [],
|
1236
1527
|
stateMutability: "nonpayable",
|
1237
1528
|
type: "function"
|
1238
1529
|
}];
|
@@ -1257,6 +1548,18 @@ var ErrorsABI = [{
|
|
1257
1548
|
inputs: [],
|
1258
1549
|
name: "AccessControlled__ZeroAddress",
|
1259
1550
|
type: "error"
|
1551
|
+
}, {
|
1552
|
+
inputs: [{
|
1553
|
+
internalType: "address",
|
1554
|
+
name: "signer",
|
1555
|
+
type: "address"
|
1556
|
+
}, {
|
1557
|
+
internalType: "address",
|
1558
|
+
name: "to",
|
1559
|
+
type: "address"
|
1560
|
+
}],
|
1561
|
+
name: "AccessController__BothCallerAndRecipientAreNotRegisteredModule",
|
1562
|
+
type: "error"
|
1260
1563
|
}, {
|
1261
1564
|
inputs: [],
|
1262
1565
|
name: "AccessController__CallerIsNotIPAccount",
|
@@ -1297,61 +1600,29 @@ var ErrorsABI = [{
|
|
1297
1600
|
inputs: [],
|
1298
1601
|
name: "AccessController__PermissionIsNotValid",
|
1299
1602
|
type: "error"
|
1300
|
-
}, {
|
1301
|
-
inputs: [{
|
1302
|
-
internalType: "address",
|
1303
|
-
name: "to",
|
1304
|
-
type: "address"
|
1305
|
-
}],
|
1306
|
-
name: "AccessController__RecipientIsNotRegisteredModule",
|
1307
|
-
type: "error"
|
1308
1603
|
}, {
|
1309
1604
|
inputs: [],
|
1310
1605
|
name: "AccessController__SignerIsZeroAddress",
|
1311
1606
|
type: "error"
|
1312
1607
|
}, {
|
1313
1608
|
inputs: [],
|
1314
|
-
name: "
|
1315
|
-
type: "error"
|
1316
|
-
}, {
|
1317
|
-
inputs: [],
|
1318
|
-
name: "AncestorsVaultLAP__ClaimerNotAnAncestor",
|
1319
|
-
type: "error"
|
1320
|
-
}, {
|
1321
|
-
inputs: [],
|
1322
|
-
name: "AncestorsVaultLAP__ERC20BalanceNotZero",
|
1323
|
-
type: "error"
|
1324
|
-
}, {
|
1325
|
-
inputs: [],
|
1326
|
-
name: "AncestorsVaultLAP__ETHBalanceNotZero",
|
1327
|
-
type: "error"
|
1328
|
-
}, {
|
1329
|
-
inputs: [],
|
1330
|
-
name: "AncestorsVaultLAP__InvalidAncestorsHash",
|
1331
|
-
type: "error"
|
1332
|
-
}, {
|
1333
|
-
inputs: [],
|
1334
|
-
name: "AncestorsVaultLAP__InvalidClaimer",
|
1335
|
-
type: "error"
|
1336
|
-
}, {
|
1337
|
-
inputs: [],
|
1338
|
-
name: "AncestorsVaultLAP__TransferFailed",
|
1609
|
+
name: "ArbitrationPolicySP__NotDisputeModule",
|
1339
1610
|
type: "error"
|
1340
1611
|
}, {
|
1341
1612
|
inputs: [],
|
1342
|
-
name: "
|
1613
|
+
name: "ArbitrationPolicySP__ZeroDisputeModule",
|
1343
1614
|
type: "error"
|
1344
1615
|
}, {
|
1345
1616
|
inputs: [],
|
1346
|
-
name: "
|
1617
|
+
name: "ArbitrationPolicySP__ZeroPaymentToken",
|
1347
1618
|
type: "error"
|
1348
1619
|
}, {
|
1349
1620
|
inputs: [],
|
1350
|
-
name: "
|
1621
|
+
name: "BasePolicyFrameworkManager__CallerNotLicensingModule",
|
1351
1622
|
type: "error"
|
1352
1623
|
}, {
|
1353
1624
|
inputs: [],
|
1354
|
-
name: "
|
1625
|
+
name: "CoreMetadataModule__MetadataAlreadyFrozen",
|
1355
1626
|
type: "error"
|
1356
1627
|
}, {
|
1357
1628
|
inputs: [],
|
@@ -1381,10 +1652,6 @@ var ErrorsABI = [{
|
|
1381
1652
|
inputs: [],
|
1382
1653
|
name: "DisputeModule__NotWhitelistedDisputeTag",
|
1383
1654
|
type: "error"
|
1384
|
-
}, {
|
1385
|
-
inputs: [],
|
1386
|
-
name: "DisputeModule__UnauthorizedAccess",
|
1387
|
-
type: "error"
|
1388
1655
|
}, {
|
1389
1656
|
inputs: [],
|
1390
1657
|
name: "DisputeModule__ZeroArbitrationPolicy",
|
@@ -1469,6 +1736,18 @@ var ErrorsABI = [{
|
|
1469
1736
|
inputs: [],
|
1470
1737
|
name: "IPAssetRegistry__InvalidMetadataProvider",
|
1471
1738
|
type: "error"
|
1739
|
+
}, {
|
1740
|
+
inputs: [{
|
1741
|
+
internalType: "address",
|
1742
|
+
name: "contractAddress",
|
1743
|
+
type: "address"
|
1744
|
+
}, {
|
1745
|
+
internalType: "uint256",
|
1746
|
+
name: "tokenId",
|
1747
|
+
type: "uint256"
|
1748
|
+
}],
|
1749
|
+
name: "IPAssetRegistry__InvalidToken",
|
1750
|
+
type: "error"
|
1472
1751
|
}, {
|
1473
1752
|
inputs: [],
|
1474
1753
|
name: "IPAssetRegistry__NotYetRegistered",
|
@@ -1485,6 +1764,22 @@ var ErrorsABI = [{
|
|
1485
1764
|
inputs: [],
|
1486
1765
|
name: "IPAssetRegistry__Unauthorized",
|
1487
1766
|
type: "error"
|
1767
|
+
}, {
|
1768
|
+
inputs: [{
|
1769
|
+
internalType: "address",
|
1770
|
+
name: "contractAddress",
|
1771
|
+
type: "address"
|
1772
|
+
}],
|
1773
|
+
name: "IPAssetRegistry__UnsupportedIERC721",
|
1774
|
+
type: "error"
|
1775
|
+
}, {
|
1776
|
+
inputs: [{
|
1777
|
+
internalType: "address",
|
1778
|
+
name: "contractAddress",
|
1779
|
+
type: "address"
|
1780
|
+
}],
|
1781
|
+
name: "IPAssetRegistry__UnsupportedIERC721Metadata",
|
1782
|
+
type: "error"
|
1488
1783
|
}, {
|
1489
1784
|
inputs: [],
|
1490
1785
|
name: "IPResolver_InvalidIP",
|
@@ -1493,6 +1788,30 @@ var ErrorsABI = [{
|
|
1493
1788
|
inputs: [],
|
1494
1789
|
name: "IPResolver_Unauthorized",
|
1495
1790
|
type: "error"
|
1791
|
+
}, {
|
1792
|
+
inputs: [],
|
1793
|
+
name: "IpRoyaltyVault__AlreadyClaimed",
|
1794
|
+
type: "error"
|
1795
|
+
}, {
|
1796
|
+
inputs: [],
|
1797
|
+
name: "IpRoyaltyVault__ClaimerNotAnAncestor",
|
1798
|
+
type: "error"
|
1799
|
+
}, {
|
1800
|
+
inputs: [],
|
1801
|
+
name: "IpRoyaltyVault__NotRoyaltyPolicyLAP",
|
1802
|
+
type: "error"
|
1803
|
+
}, {
|
1804
|
+
inputs: [],
|
1805
|
+
name: "IpRoyaltyVault__SnapshotIntervalTooShort",
|
1806
|
+
type: "error"
|
1807
|
+
}, {
|
1808
|
+
inputs: [],
|
1809
|
+
name: "IpRoyaltyVault__ZeroIpId",
|
1810
|
+
type: "error"
|
1811
|
+
}, {
|
1812
|
+
inputs: [],
|
1813
|
+
name: "IpRoyaltyVault__ZeroRoyaltyPolicyLAP",
|
1814
|
+
type: "error"
|
1496
1815
|
}, {
|
1497
1816
|
inputs: [],
|
1498
1817
|
name: "LicenseRegistry__CallerNotLicensingModule",
|
@@ -1513,10 +1832,6 @@ var ErrorsABI = [{
|
|
1513
1832
|
inputs: [],
|
1514
1833
|
name: "LicenseRegistry__ZeroLicensingModule",
|
1515
1834
|
type: "error"
|
1516
|
-
}, {
|
1517
|
-
inputs: [],
|
1518
|
-
name: "LicensingModuleAware__CallerNotLicensingModule",
|
1519
|
-
type: "error"
|
1520
1835
|
}, {
|
1521
1836
|
inputs: [],
|
1522
1837
|
name: "LicensingModule__CallerNotLicenseRegistry",
|
@@ -1577,6 +1892,10 @@ var ErrorsABI = [{
|
|
1577
1892
|
inputs: [],
|
1578
1893
|
name: "LicensingModule__InvalidPolicyFramework",
|
1579
1894
|
type: "error"
|
1895
|
+
}, {
|
1896
|
+
inputs: [],
|
1897
|
+
name: "LicensingModule__IpAlreadyLinked",
|
1898
|
+
type: "error"
|
1580
1899
|
}, {
|
1581
1900
|
inputs: [],
|
1582
1901
|
name: "LicensingModule__LicensorDoesntHaveThisPolicy",
|
@@ -1593,6 +1912,10 @@ var ErrorsABI = [{
|
|
1593
1912
|
inputs: [],
|
1594
1913
|
name: "LicensingModule__LinkingRevokedLicense",
|
1595
1914
|
type: "error"
|
1915
|
+
}, {
|
1916
|
+
inputs: [],
|
1917
|
+
name: "LicensingModule__MintAmountZero",
|
1918
|
+
type: "error"
|
1596
1919
|
}, {
|
1597
1920
|
inputs: [],
|
1598
1921
|
name: "LicensingModule__MintLicenseParamFailed",
|
@@ -1629,6 +1952,10 @@ var ErrorsABI = [{
|
|
1629
1952
|
inputs: [],
|
1630
1953
|
name: "LicensingModule__PolicyNotFound",
|
1631
1954
|
type: "error"
|
1955
|
+
}, {
|
1956
|
+
inputs: [],
|
1957
|
+
name: "LicensingModule__ReceiverZeroAddress",
|
1958
|
+
type: "error"
|
1632
1959
|
}, {
|
1633
1960
|
inputs: [],
|
1634
1961
|
name: "LicensingModule__RegisterPolicyFrameworkMismatch",
|
@@ -1757,10 +2084,6 @@ var ErrorsABI = [{
|
|
1757
2084
|
inputs: [],
|
1758
2085
|
name: "PolicyFrameworkManager__GettingPolicyWrongFramework",
|
1759
2086
|
type: "error"
|
1760
|
-
}, {
|
1761
|
-
inputs: [],
|
1762
|
-
name: "RegistrationModule__InvalidOwner",
|
1763
|
-
type: "error"
|
1764
2087
|
}, {
|
1765
2088
|
inputs: [],
|
1766
2089
|
name: "RoyaltyModule__CanOnlyMintSelectedPolicy",
|
@@ -1781,10 +2104,6 @@ var ErrorsABI = [{
|
|
1781
2104
|
inputs: [],
|
1782
2105
|
name: "RoyaltyModule__NotAllowedCaller",
|
1783
2106
|
type: "error"
|
1784
|
-
}, {
|
1785
|
-
inputs: [],
|
1786
|
-
name: "RoyaltyModule__NotRegisteredIpId",
|
1787
|
-
type: "error"
|
1788
2107
|
}, {
|
1789
2108
|
inputs: [],
|
1790
2109
|
name: "RoyaltyModule__NotWhitelistedRoyaltyPolicy",
|
@@ -1821,30 +2140,10 @@ var ErrorsABI = [{
|
|
1821
2140
|
inputs: [],
|
1822
2141
|
name: "RoyaltyPolicyLAP__ImplementationAlreadySet",
|
1823
2142
|
type: "error"
|
1824
|
-
}, {
|
1825
|
-
inputs: [],
|
1826
|
-
name: "RoyaltyPolicyLAP__InvalidAncestors",
|
1827
|
-
type: "error"
|
1828
|
-
}, {
|
1829
|
-
inputs: [],
|
1830
|
-
name: "RoyaltyPolicyLAP__InvalidAncestorsHash",
|
1831
|
-
type: "error"
|
1832
|
-
}, {
|
1833
|
-
inputs: [],
|
1834
|
-
name: "RoyaltyPolicyLAP__InvalidAncestorsLength",
|
1835
|
-
type: "error"
|
1836
|
-
}, {
|
1837
|
-
inputs: [],
|
1838
|
-
name: "RoyaltyPolicyLAP__InvalidAncestorsRoyalty",
|
1839
|
-
type: "error"
|
1840
2143
|
}, {
|
1841
2144
|
inputs: [],
|
1842
2145
|
name: "RoyaltyPolicyLAP__InvalidParentRoyaltiesLength",
|
1843
2146
|
type: "error"
|
1844
|
-
}, {
|
1845
|
-
inputs: [],
|
1846
|
-
name: "RoyaltyPolicyLAP__InvalidRoyaltyAmountLength",
|
1847
|
-
type: "error"
|
1848
2147
|
}, {
|
1849
2148
|
inputs: [],
|
1850
2149
|
name: "RoyaltyPolicyLAP__LastPositionNotAbleToMintLicense",
|
@@ -1859,15 +2158,15 @@ var ErrorsABI = [{
|
|
1859
2158
|
type: "error"
|
1860
2159
|
}, {
|
1861
2160
|
inputs: [],
|
1862
|
-
name: "
|
2161
|
+
name: "RoyaltyPolicyLAP__UnlinkableToParents",
|
1863
2162
|
type: "error"
|
1864
2163
|
}, {
|
1865
2164
|
inputs: [],
|
1866
|
-
name: "
|
2165
|
+
name: "RoyaltyPolicyLAP__ZeroAncestorsVaultImpl",
|
1867
2166
|
type: "error"
|
1868
2167
|
}, {
|
1869
2168
|
inputs: [],
|
1870
|
-
name: "
|
2169
|
+
name: "RoyaltyPolicyLAP__ZeroIpRoyaltyVaultBeacon",
|
1871
2170
|
type: "error"
|
1872
2171
|
}, {
|
1873
2172
|
inputs: [],
|
@@ -1911,537 +2210,229 @@ var sepolia = {
|
|
1911
2210
|
RoyaltyPolicyLAP: "0x16eF58e959522727588921A92e9084d36E5d3855",
|
1912
2211
|
TokenWithdrawalModule: "0x66738a5722e9Cd91B694bA39146CFEcE95457F04"
|
1913
2212
|
};
|
2213
|
+
var storyTestnet = {
|
2214
|
+
AccessController: "0x6fB5BA9A8747E897109044a1cd1192898AA384a9",
|
2215
|
+
ArbitrationPolicySP: "0x114aE96d362b802Ed92758A21992e429e9E83565",
|
2216
|
+
DisputeModule: "0x837d095F9A11178545DF4114C44fb526dcf74168",
|
2217
|
+
Governance: "0x0Fee5B61cF0976f3F59138146a9180a107738db9",
|
2218
|
+
IPAccountImpl: "0x6d1398e1ceE174a3e41d6eB50F00Fe43132f9C8A",
|
2219
|
+
IPAccountRegistry: "0x0CCc0CD388477ED0D7531d2aD6e68c9E24B8392d",
|
2220
|
+
IPAssetRegistry: "0x30C89bCB41277f09b18DF0375b9438909e193bf0",
|
2221
|
+
IpRoyaltyVaultBeacon: "0x8C7664Befc382A282F8aA821A2d337960e410E77",
|
2222
|
+
IpRoyaltyVaultImpl: "0x0dB6AAb7525F03Bf94A1fC08A9aACCc2Ad25eD12",
|
2223
|
+
LicenseRegistry: "0x790717fBa06Aa219Fc3A502ce360d8dEAF273Eb5",
|
2224
|
+
LicensingModule: "0xB7a83a5f3C8b512A6DfE294ad4811F1b4AA10E96",
|
2225
|
+
MockERC20: "0xCc97e835157daf88820cbDE105ADFF5d7981A382",
|
2226
|
+
MockERC721: "0x7c0004C6D352bC0a0531AaD46d33A03D9d51ab1D",
|
2227
|
+
MockTokenGatedHook: "0xD3Aa4F5B77509907FF3d7a90cEadE19bab2b6Fdb",
|
2228
|
+
ModuleRegistry: "0xab0bf9846eCE1299AaA1cB3FF5EfbBA328968771",
|
2229
|
+
PILPolicyFrameworkManager: "0x251bce81DF5957123869E43269C4E29308A062c4",
|
2230
|
+
RoyaltyModule: "0xF77b0933F6aaC2dCE2eAa0d79f6Bfd6b9347a5E7",
|
2231
|
+
RoyaltyPolicyLAP: "0x31f263D48df5FA5956E2Ba614b150e2A0fE1aDd3",
|
2232
|
+
TokenWithdrawalModule: "0x446B734C3Fc13c53b4E32FEFCaaED97e0100552D"
|
2233
|
+
};
|
2234
|
+
var contractAddress = {
|
2235
|
+
sepolia: sepolia,
|
2236
|
+
11155111: sepolia,
|
2237
|
+
storyTestnet: storyTestnet,
|
2238
|
+
1513: storyTestnet
|
2239
|
+
};
|
1914
2240
|
|
1915
2241
|
var IPAccountABI = [].concat(_toConsumableArray(IPAccountImplABI), _toConsumableArray(ErrorsABI));
|
1916
|
-
var
|
1917
|
-
|
1918
|
-
|
2242
|
+
var getIPAssetRegistryConfig = function getIPAssetRegistryConfig(chain) {
|
2243
|
+
return {
|
2244
|
+
abi: IPAssetRegistryABI,
|
2245
|
+
address: getAddress(contractAddress[chain].IPAssetRegistry)
|
2246
|
+
};
|
1919
2247
|
};
|
1920
|
-
var
|
1921
|
-
|
1922
|
-
|
2248
|
+
var getAccessControllerConfig = function getAccessControllerConfig(chain) {
|
2249
|
+
return {
|
2250
|
+
abi: [].concat(_toConsumableArray(AccessControllerABI), _toConsumableArray(ErrorsABI)),
|
2251
|
+
address: getAddress(contractAddress[chain].AccessController)
|
2252
|
+
};
|
2253
|
+
};
|
2254
|
+
var getDisputeModuleConfig = function getDisputeModuleConfig(chain) {
|
2255
|
+
return {
|
2256
|
+
abi: [].concat(_toConsumableArray(DisputeModuleABI), _toConsumableArray(ErrorsABI)),
|
2257
|
+
address: getAddress(contractAddress[chain].DisputeModule)
|
2258
|
+
};
|
1923
2259
|
};
|
1924
|
-
var
|
1925
|
-
|
1926
|
-
|
2260
|
+
var getLicenseRegistryConfig = function getLicenseRegistryConfig(chain) {
|
2261
|
+
return {
|
2262
|
+
abi: IERC1155ABI,
|
2263
|
+
address: getAddress(contractAddress[chain].LicenseRegistry)
|
2264
|
+
};
|
1927
2265
|
};
|
1928
|
-
var
|
1929
|
-
|
1930
|
-
|
2266
|
+
var getLicensingModuleConfig = function getLicensingModuleConfig(chain) {
|
2267
|
+
return {
|
2268
|
+
abi: [].concat(_toConsumableArray(LicensingModuleABI), _toConsumableArray(ErrorsABI)),
|
2269
|
+
address: getAddress(contractAddress[chain].LicensingModule)
|
2270
|
+
};
|
1931
2271
|
};
|
1932
|
-
var
|
1933
|
-
|
1934
|
-
|
2272
|
+
var getPILPolicyFrameworkManagerConfig = function getPILPolicyFrameworkManagerConfig(chain) {
|
2273
|
+
return {
|
2274
|
+
abi: [].concat(_toConsumableArray(PILPolicyFrameworkManagerABI), _toConsumableArray(ErrorsABI)),
|
2275
|
+
address: getAddress(contractAddress[chain].PILPolicyFrameworkManager)
|
2276
|
+
};
|
1935
2277
|
};
|
1936
|
-
var
|
1937
|
-
|
1938
|
-
|
2278
|
+
var getRoyaltyPolicyLAPConfig = function getRoyaltyPolicyLAPConfig(chain) {
|
2279
|
+
return {
|
2280
|
+
abi: [].concat(_toConsumableArray(IRoyaltyPolicyLAPABI), _toConsumableArray(ErrorsABI)),
|
2281
|
+
address: getAddress(contractAddress[chain].RoyaltyPolicyLAP)
|
2282
|
+
};
|
1939
2283
|
};
|
1940
|
-
var
|
1941
|
-
|
1942
|
-
|
2284
|
+
var getRoyaltyVaultImplConfig = function getRoyaltyVaultImplConfig(chain) {
|
2285
|
+
return {
|
2286
|
+
abi: [].concat(_toConsumableArray(IpRoyaltyVaultABI), _toConsumableArray(ErrorsABI)),
|
2287
|
+
address: getAddress(contractAddress[chain].IpRoyaltyVaultImpl)
|
2288
|
+
};
|
1943
2289
|
};
|
1944
|
-
var
|
1945
|
-
|
2290
|
+
var getRoyaltyModuleConfig = function getRoyaltyModuleConfig(chain) {
|
2291
|
+
return {
|
2292
|
+
abi: [].concat(_toConsumableArray(IRoyaltyModuleABI), _toConsumableArray(ErrorsABI)),
|
2293
|
+
address: getAddress(contractAddress[chain].RoyaltyModule)
|
2294
|
+
};
|
1946
2295
|
};
|
1947
2296
|
|
1948
|
-
function
|
1949
|
-
|
1950
|
-
|
1951
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
1952
|
-
if (it) o = it;
|
1953
|
-
var i = 0;
|
1954
|
-
var F = function () {};
|
1955
|
-
return {
|
1956
|
-
s: F,
|
1957
|
-
n: function () {
|
1958
|
-
if (i >= o.length) return {
|
1959
|
-
done: true
|
1960
|
-
};
|
1961
|
-
return {
|
1962
|
-
done: false,
|
1963
|
-
value: o[i++]
|
1964
|
-
};
|
1965
|
-
},
|
1966
|
-
e: function (e) {
|
1967
|
-
throw e;
|
1968
|
-
},
|
1969
|
-
f: F
|
1970
|
-
};
|
1971
|
-
}
|
1972
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
1973
|
-
}
|
1974
|
-
var normalCompletion = true,
|
1975
|
-
didErr = false,
|
1976
|
-
err;
|
1977
|
-
return {
|
1978
|
-
s: function () {
|
1979
|
-
it = it.call(o);
|
1980
|
-
},
|
1981
|
-
n: function () {
|
1982
|
-
var step = it.next();
|
1983
|
-
normalCompletion = step.done;
|
1984
|
-
return step;
|
1985
|
-
},
|
1986
|
-
e: function (e) {
|
1987
|
-
didErr = true;
|
1988
|
-
err = e;
|
1989
|
-
},
|
1990
|
-
f: function () {
|
1991
|
-
try {
|
1992
|
-
if (!normalCompletion && it.return != null) it.return();
|
1993
|
-
} finally {
|
1994
|
-
if (didErr) throw err;
|
1995
|
-
}
|
1996
|
-
}
|
1997
|
-
};
|
1998
|
-
}
|
1999
|
-
|
2000
|
-
function parseToBigInt(num) {
|
2001
|
-
return BigInt(num);
|
2002
|
-
}
|
2003
|
-
function waitTxAndFilterLog(_x, _x2, _x3) {
|
2004
|
-
return _waitTxAndFilterLog.apply(this, arguments);
|
2005
|
-
}
|
2006
|
-
function _waitTxAndFilterLog() {
|
2007
|
-
_waitTxAndFilterLog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(client, txHash, params) {
|
2008
|
-
var txReceipt, targetLogs, _iterator, _step, log, currentLog;
|
2009
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
2010
|
-
while (1) switch (_context.prev = _context.next) {
|
2011
|
-
case 0:
|
2012
|
-
_context.next = 2;
|
2013
|
-
return client.waitForTransactionReceipt({
|
2014
|
-
hash: txHash,
|
2015
|
-
confirmations: params.confirmations,
|
2016
|
-
pollingInterval: params.pollingInterval,
|
2017
|
-
timeout: params.timeout
|
2018
|
-
});
|
2019
|
-
case 2:
|
2020
|
-
txReceipt = _context.sent;
|
2021
|
-
targetLogs = [];
|
2022
|
-
_iterator = _createForOfIteratorHelper(txReceipt.logs);
|
2023
|
-
_context.prev = 5;
|
2024
|
-
_iterator.s();
|
2025
|
-
case 7:
|
2026
|
-
if ((_step = _iterator.n()).done) {
|
2027
|
-
_context.next = 21;
|
2028
|
-
break;
|
2029
|
-
}
|
2030
|
-
log = _step.value;
|
2031
|
-
_context.prev = 9;
|
2032
|
-
if (!(params.from && log.address !== params.from.toLowerCase())) {
|
2033
|
-
_context.next = 12;
|
2034
|
-
break;
|
2035
|
-
}
|
2036
|
-
return _context.abrupt("continue", 19);
|
2037
|
-
case 12:
|
2038
|
-
currentLog = decodeEventLog({
|
2039
|
-
abi: params.abi,
|
2040
|
-
eventName: params.eventName,
|
2041
|
-
data: log.data,
|
2042
|
-
topics: log.topics
|
2043
|
-
});
|
2044
|
-
targetLogs.push(currentLog);
|
2045
|
-
_context.next = 19;
|
2046
|
-
break;
|
2047
|
-
case 16:
|
2048
|
-
_context.prev = 16;
|
2049
|
-
_context.t0 = _context["catch"](9);
|
2050
|
-
return _context.abrupt("continue", 19);
|
2051
|
-
case 19:
|
2052
|
-
_context.next = 7;
|
2053
|
-
break;
|
2054
|
-
case 21:
|
2055
|
-
_context.next = 26;
|
2056
|
-
break;
|
2057
|
-
case 23:
|
2058
|
-
_context.prev = 23;
|
2059
|
-
_context.t1 = _context["catch"](5);
|
2060
|
-
_iterator.e(_context.t1);
|
2061
|
-
case 26:
|
2062
|
-
_context.prev = 26;
|
2063
|
-
_iterator.f();
|
2064
|
-
return _context.finish(26);
|
2065
|
-
case 29:
|
2066
|
-
if (!(targetLogs.length === 0)) {
|
2067
|
-
_context.next = 31;
|
2068
|
-
break;
|
2069
|
-
}
|
2070
|
-
throw new Error("not found event ".concat(params.eventName, " in target transaction"));
|
2071
|
-
case 31:
|
2072
|
-
return _context.abrupt("return", targetLogs);
|
2073
|
-
case 32:
|
2074
|
-
case "end":
|
2075
|
-
return _context.stop();
|
2076
|
-
}
|
2077
|
-
}, _callee, null, [[5, 23, 26, 29], [9, 16]]);
|
2078
|
-
}));
|
2079
|
-
return _waitTxAndFilterLog.apply(this, arguments);
|
2080
|
-
}
|
2081
|
-
function waitTx(_x4, _x5, _x6) {
|
2082
|
-
return _waitTx.apply(this, arguments);
|
2083
|
-
}
|
2084
|
-
function _waitTx() {
|
2085
|
-
_waitTx = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(client, txHash, params) {
|
2086
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
2087
|
-
while (1) switch (_context2.prev = _context2.next) {
|
2088
|
-
case 0:
|
2089
|
-
_context2.next = 2;
|
2090
|
-
return client.waitForTransactionReceipt(_objectSpread2({
|
2091
|
-
hash: txHash
|
2092
|
-
}, params));
|
2093
|
-
case 2:
|
2094
|
-
case "end":
|
2095
|
-
return _context2.stop();
|
2096
|
-
}
|
2097
|
-
}, _callee2);
|
2098
|
-
}));
|
2099
|
-
return _waitTx.apply(this, arguments);
|
2100
|
-
}
|
2101
|
-
function typedDataToBytes(typedData) {
|
2102
|
-
return encodeAbiParameters(parseAbiParameters(typedData["interface"]), typedData.data);
|
2103
|
-
}
|
2104
|
-
function chainStringToViemChain(chainId) {
|
2105
|
-
switch (chainId) {
|
2106
|
-
case "1":
|
2107
|
-
case "mainnet":
|
2108
|
-
return mainnet;
|
2109
|
-
case "11155111":
|
2110
|
-
case "sepolia":
|
2111
|
-
return sepolia$1;
|
2112
|
-
case "80001":
|
2113
|
-
case "mumbai":
|
2114
|
-
case "polygonMumbai":
|
2115
|
-
return polygonMumbai;
|
2116
|
-
default:
|
2117
|
-
throw new Error("chainId ".concat(chainId, " not supported"));
|
2118
|
-
}
|
2119
|
-
}
|
2120
|
-
|
2121
|
-
function computeRoyaltyContext(_x, _x2) {
|
2122
|
-
return _computeRoyaltyContext.apply(this, arguments);
|
2123
|
-
}
|
2124
|
-
function _computeRoyaltyContext() {
|
2125
|
-
_computeRoyaltyContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(licenseIds, storyClient) {
|
2126
|
-
var royaltyContext, i, licenseData, royaltyPolicy, policy, targetRoyaltyAmount;
|
2127
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
2128
|
-
while (1) switch (_context.prev = _context.next) {
|
2129
|
-
case 0:
|
2130
|
-
royaltyContext = {
|
2131
|
-
targetAncestors: [],
|
2132
|
-
targetRoyaltyAmount: [],
|
2133
|
-
parentAncestors1: [],
|
2134
|
-
parentAncestors2: [],
|
2135
|
-
parentAncestorsRoyalties1: [],
|
2136
|
-
parentAncestorsRoyalties2: []
|
2137
|
-
};
|
2138
|
-
i = 0;
|
2139
|
-
case 2:
|
2140
|
-
if (!(i < licenseIds.length)) {
|
2141
|
-
_context.next = 16;
|
2142
|
-
break;
|
2143
|
-
}
|
2144
|
-
_context.next = 5;
|
2145
|
-
return storyClient.getLicense(licenseIds[i]);
|
2146
|
-
case 5:
|
2147
|
-
licenseData = _context.sent;
|
2148
|
-
_context.next = 8;
|
2149
|
-
return storyClient.getRoyaltyPolicy(licenseData.licensorIpId);
|
2150
|
-
case 8:
|
2151
|
-
royaltyPolicy = _context.sent;
|
2152
|
-
_context.next = 11;
|
2153
|
-
return storyClient.getPolicy(licenseData.policyId);
|
2154
|
-
case 11:
|
2155
|
-
policy = _context.sent;
|
2156
|
-
if (royaltyPolicy) {
|
2157
|
-
targetRoyaltyAmount = royaltyPolicy.targetRoyaltyAmount.map(function (e) {
|
2158
|
-
return parseInt(e);
|
2159
|
-
});
|
2160
|
-
if (i === 0) {
|
2161
|
-
royaltyContext.parentAncestors1 = royaltyPolicy.targetAncestors;
|
2162
|
-
royaltyContext.parentAncestorsRoyalties1 = targetRoyaltyAmount;
|
2163
|
-
} else {
|
2164
|
-
royaltyContext.parentAncestors2 = royaltyPolicy.targetAncestors;
|
2165
|
-
royaltyContext.parentAncestorsRoyalties2 = targetRoyaltyAmount;
|
2166
|
-
}
|
2167
|
-
updateRoyaltyContext(royaltyContext, [licenseData.licensorIpId], [parseInt(policy.pil.commercialRevShare)]);
|
2168
|
-
updateRoyaltyContext(royaltyContext, royaltyPolicy.targetAncestors, targetRoyaltyAmount);
|
2169
|
-
}
|
2170
|
-
case 13:
|
2171
|
-
i++;
|
2172
|
-
_context.next = 2;
|
2173
|
-
break;
|
2174
|
-
case 16:
|
2175
|
-
return _context.abrupt("return", royaltyContext);
|
2176
|
-
case 17:
|
2177
|
-
case "end":
|
2178
|
-
return _context.stop();
|
2179
|
-
}
|
2180
|
-
}, _callee);
|
2181
|
-
}));
|
2182
|
-
return _computeRoyaltyContext.apply(this, arguments);
|
2183
|
-
}
|
2184
|
-
function encodeRoyaltyContext(royaltyContext) {
|
2185
|
-
return typedDataToBytes({
|
2186
|
-
"interface": "(address[], uint32[], address[], address[], uint32[], uint32[])",
|
2187
|
-
data: [[royaltyContext.targetAncestors, royaltyContext.targetRoyaltyAmount, royaltyContext.parentAncestors1, royaltyContext.parentAncestors2, royaltyContext.parentAncestorsRoyalties1, royaltyContext.parentAncestorsRoyalties2]]
|
2188
|
-
});
|
2189
|
-
}
|
2190
|
-
function updateRoyaltyContext(royaltyContext, targetAncestors, targetRoyaltyAccounts) {
|
2191
|
-
for (var i = 0; i < targetAncestors.length; i++) {
|
2192
|
-
var index = royaltyContext.targetAncestors.indexOf(targetAncestors[i]);
|
2193
|
-
if (index === -1) {
|
2194
|
-
royaltyContext.targetAncestors.push(targetAncestors[i]);
|
2195
|
-
royaltyContext.targetRoyaltyAmount.push(targetRoyaltyAccounts[i]);
|
2196
|
-
} else {
|
2197
|
-
royaltyContext.targetRoyaltyAmount[index] += targetRoyaltyAccounts[i];
|
2198
|
-
}
|
2297
|
+
function handleError(error, msg) {
|
2298
|
+
if (error instanceof Error) {
|
2299
|
+
throw new Error("".concat(msg, ": ").concat(error.message));
|
2199
2300
|
}
|
2301
|
+
throw new Error("".concat(msg, ": Unknown error type"));
|
2200
2302
|
}
|
2201
2303
|
|
2202
2304
|
var IPAssetClient = /*#__PURE__*/function () {
|
2203
|
-
function IPAssetClient(rpcClient, wallet,
|
2305
|
+
function IPAssetClient(rpcClient, wallet, chainId) {
|
2204
2306
|
_classCallCheck(this, IPAssetClient);
|
2205
|
-
_defineProperty(this, "ipAssetRegistryConfig", IPAssetRegistryConfig);
|
2206
|
-
_defineProperty(this, "registrationModuleConfig", RegistrationModuleConfig);
|
2207
2307
|
this.wallet = wallet;
|
2208
2308
|
this.rpcClient = rpcClient;
|
2209
|
-
this.
|
2309
|
+
this.chainId = chainId;
|
2310
|
+
this.ipAssetRegistryConfig = getIPAssetRegistryConfig(chainId);
|
2210
2311
|
}
|
2211
|
-
|
2212
|
-
|
2213
|
-
* Registers a root-level IP into the protocol. Root-level IPs can be thought of as organizational hubs
|
2214
|
-
* for encapsulating policies that actual IPs can use to register through. As such, a root-level IP is not an
|
2215
|
-
* actual IP, but a container for IP policy management for their child IP assets.
|
2216
|
-
* @param request The request object that contains all data needed to register a root IP.
|
2217
|
-
* @param request.policyId The policy that identifies the licensing terms of the IP.
|
2218
|
-
* @param request.tokenContract The address of the NFT bound to the root-level IP.
|
2219
|
-
* @param request.tokenId The token id of the NFT bound to the root-level IP.
|
2220
|
-
* @param request.ipName [Optional] The name assigned to the new IP.
|
2221
|
-
* @param request.contentHash [Optional] The content hash of the IP being registered.
|
2222
|
-
* @param request.uri [Optional] An external URI to link to the IP.
|
2223
|
-
* @param request.txOptions [Optional] The transaction options.
|
2224
|
-
* @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true.
|
2225
|
-
* @emits RootIPRegistered (msg.sender, ipId, policyId)
|
2226
|
-
*/
|
2227
|
-
_createClass(IPAssetClient, [{
|
2228
|
-
key: "registerRootIp",
|
2312
|
+
return _createClass(IPAssetClient, [{
|
2313
|
+
key: "isNFTRegistered",
|
2229
2314
|
value: function () {
|
2230
|
-
var
|
2231
|
-
var
|
2315
|
+
var _isNFTRegistered = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(tokenAddress, tokenId) {
|
2316
|
+
var ipId, isRegistered;
|
2232
2317
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
2233
2318
|
while (1) switch (_context.prev = _context.next) {
|
2234
2319
|
case 0:
|
2235
|
-
_context.
|
2236
|
-
|
2237
|
-
|
2238
|
-
|
2239
|
-
ipId = _context.sent;
|
2240
|
-
if (!(ipId !== "0x")) {
|
2241
|
-
_context.next = 6;
|
2242
|
-
break;
|
2243
|
-
}
|
2244
|
-
return _context.abrupt("return", {
|
2245
|
-
ipId: ipId
|
2246
|
-
});
|
2247
|
-
case 6:
|
2248
|
-
_context.next = 8;
|
2249
|
-
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.registrationModuleConfig), {}, {
|
2250
|
-
functionName: "registerRootIp",
|
2251
|
-
args: [parseToBigInt(request.policyId || "0"), getAddress(request.tokenContractAddress),
|
2252
|
-
// 0x Address
|
2253
|
-
parseToBigInt(request.tokenId), request.ipName || "", request.contentHash || HashZero, request.uri || ""],
|
2254
|
-
account: this.wallet.account
|
2320
|
+
_context.next = 2;
|
2321
|
+
return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
|
2322
|
+
functionName: "ipId",
|
2323
|
+
args: [parseToBigInt(chain[this.chainId]), tokenAddress, tokenId]
|
2255
2324
|
}));
|
2256
|
-
case
|
2257
|
-
|
2258
|
-
|
2259
|
-
|
2260
|
-
|
2261
|
-
|
2262
|
-
txHash = _context.sent;
|
2263
|
-
if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
|
2264
|
-
_context.next = 20;
|
2265
|
-
break;
|
2266
|
-
}
|
2267
|
-
_context.next = 16;
|
2268
|
-
return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
|
2269
|
-
eventName: "IPRegistered"
|
2325
|
+
case 2:
|
2326
|
+
ipId = _context.sent;
|
2327
|
+
_context.next = 5;
|
2328
|
+
return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
|
2329
|
+
functionName: "isRegistered",
|
2330
|
+
args: [ipId]
|
2270
2331
|
}));
|
2271
|
-
case
|
2272
|
-
|
2273
|
-
return _context.abrupt("return",
|
2274
|
-
|
2275
|
-
ipId: targetLogs[0].args.ipId
|
2276
|
-
});
|
2277
|
-
case 20:
|
2278
|
-
return _context.abrupt("return", {
|
2279
|
-
txHash: txHash
|
2280
|
-
});
|
2281
|
-
case 21:
|
2282
|
-
_context.next = 26;
|
2283
|
-
break;
|
2284
|
-
case 23:
|
2285
|
-
_context.prev = 23;
|
2286
|
-
_context.t0 = _context["catch"](0);
|
2287
|
-
handleError(_context.t0, "Failed to register root IP");
|
2288
|
-
case 26:
|
2332
|
+
case 5:
|
2333
|
+
isRegistered = _context.sent;
|
2334
|
+
return _context.abrupt("return", isRegistered ? ipId : "0x");
|
2335
|
+
case 7:
|
2289
2336
|
case "end":
|
2290
2337
|
return _context.stop();
|
2291
2338
|
}
|
2292
|
-
}, _callee, this
|
2339
|
+
}, _callee, this);
|
2293
2340
|
}));
|
2294
|
-
function
|
2295
|
-
return
|
2341
|
+
function isNFTRegistered(_x, _x2) {
|
2342
|
+
return _isNFTRegistered.apply(this, arguments);
|
2296
2343
|
}
|
2297
|
-
return
|
2344
|
+
return isNFTRegistered;
|
2298
2345
|
}()
|
2299
2346
|
/**
|
2300
|
-
*
|
2301
|
-
*
|
2302
|
-
*
|
2303
|
-
*
|
2304
|
-
*
|
2305
|
-
* @param request.tokenId The token id of the NFT bound to the derivative IP.
|
2306
|
-
* @param request.ipName [Optional] The name assigned to the new IP.
|
2307
|
-
* @param request.contentHash [Optional] The content hash of the IP being registered.
|
2308
|
-
* @param request.uri [Optional] An external URI to link to the IP.
|
2309
|
-
* @param request.txOptions [Optional] The transaction options.
|
2347
|
+
* Registers an NFT as IP, creating a corresponding IP record.
|
2348
|
+
* @param request The request object that contains all data needed to register IP.
|
2349
|
+
* @param request.tokenContract The address of the NFT.
|
2350
|
+
* @param request.tokenId The token identifier of the NFT.
|
2351
|
+
* @param request.txOptions [Optional] The transaction options.
|
2310
2352
|
* @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true.
|
2311
|
-
* @emits
|
2353
|
+
* @emits IPRegistered (ipId, chainId, tokenContract, tokenId, resolverAddr, metadataProviderAddress, metadata)
|
2312
2354
|
*/
|
2313
2355
|
}, {
|
2314
|
-
key: "
|
2315
|
-
value: function () {
|
2316
|
-
var
|
2317
|
-
var _request$
|
2356
|
+
key: "register",
|
2357
|
+
value: (function () {
|
2358
|
+
var _register = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
|
2359
|
+
var tokenId, _request$txOptions, ipId, _yield$this$rpcClient, call, txHash, targetLogs;
|
2318
2360
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
2319
2361
|
while (1) switch (_context2.prev = _context2.next) {
|
2320
2362
|
case 0:
|
2321
|
-
|
2322
|
-
_context2.
|
2323
|
-
|
2324
|
-
|
2363
|
+
tokenId = parseToBigInt(request.tokenId);
|
2364
|
+
_context2.prev = 1;
|
2365
|
+
_context2.next = 4;
|
2366
|
+
return this.isNFTRegistered(request.tokenContract, tokenId);
|
2367
|
+
case 4:
|
2325
2368
|
ipId = _context2.sent;
|
2326
2369
|
if (!(ipId !== "0x")) {
|
2327
|
-
_context2.next =
|
2370
|
+
_context2.next = 7;
|
2328
2371
|
break;
|
2329
2372
|
}
|
2330
2373
|
return _context2.abrupt("return", {
|
2331
2374
|
ipId: ipId
|
2332
2375
|
});
|
2333
|
-
case
|
2334
|
-
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2338
|
-
_context2.next = 10;
|
2339
|
-
return computeRoyaltyContext(request.licenseIds, this.storyClient);
|
2340
|
-
case 10:
|
2341
|
-
royaltyContext = _context2.sent;
|
2342
|
-
_context2.next = 13;
|
2343
|
-
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.registrationModuleConfig), {}, {
|
2344
|
-
functionName: "registerDerivativeIp",
|
2345
|
-
args: [licenseIds, getAddress(request.tokenContractAddress),
|
2346
|
-
// 0x Address
|
2347
|
-
parseToBigInt(request.tokenId), request.ipName || "", request.contentHash || HashZero, request.uri || "", encodeRoyaltyContext(royaltyContext)],
|
2376
|
+
case 7:
|
2377
|
+
_context2.next = 9;
|
2378
|
+
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
|
2379
|
+
functionName: "register",
|
2380
|
+
args: [getAddress(request.tokenContract), tokenId],
|
2348
2381
|
account: this.wallet.account
|
2349
2382
|
}));
|
2350
|
-
case
|
2351
|
-
_yield$this$
|
2352
|
-
call = _yield$this$
|
2353
|
-
_context2.next =
|
2383
|
+
case 9:
|
2384
|
+
_yield$this$rpcClient = _context2.sent;
|
2385
|
+
call = _yield$this$rpcClient.request;
|
2386
|
+
_context2.next = 13;
|
2354
2387
|
return this.wallet.writeContract(call);
|
2355
|
-
case
|
2388
|
+
case 13:
|
2356
2389
|
txHash = _context2.sent;
|
2357
|
-
if (!((_request$
|
2358
|
-
_context2.next =
|
2390
|
+
if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
|
2391
|
+
_context2.next = 21;
|
2359
2392
|
break;
|
2360
2393
|
}
|
2361
|
-
_context2.next =
|
2394
|
+
_context2.next = 17;
|
2362
2395
|
return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
|
2363
2396
|
eventName: "IPRegistered"
|
2364
2397
|
}));
|
2365
|
-
case
|
2398
|
+
case 17:
|
2366
2399
|
targetLogs = _context2.sent;
|
2367
2400
|
return _context2.abrupt("return", {
|
2368
2401
|
txHash: txHash,
|
2369
2402
|
ipId: targetLogs[0].args.ipId
|
2370
2403
|
});
|
2371
|
-
case
|
2404
|
+
case 21:
|
2372
2405
|
return _context2.abrupt("return", {
|
2373
2406
|
txHash: txHash
|
2374
2407
|
});
|
2375
|
-
case
|
2376
|
-
_context2.next =
|
2408
|
+
case 22:
|
2409
|
+
_context2.next = 27;
|
2377
2410
|
break;
|
2378
|
-
case
|
2379
|
-
_context2.prev =
|
2380
|
-
_context2.t0 = _context2["catch"](
|
2381
|
-
handleError(_context2.t0, "Failed to register
|
2382
|
-
case
|
2411
|
+
case 24:
|
2412
|
+
_context2.prev = 24;
|
2413
|
+
_context2.t0 = _context2["catch"](1);
|
2414
|
+
handleError(_context2.t0, "Failed to register IP");
|
2415
|
+
case 27:
|
2383
2416
|
case "end":
|
2384
2417
|
return _context2.stop();
|
2385
2418
|
}
|
2386
|
-
}, _callee2, this, [[
|
2387
|
-
}));
|
2388
|
-
function registerDerivativeIp(_x2) {
|
2389
|
-
return _registerDerivativeIp.apply(this, arguments);
|
2390
|
-
}
|
2391
|
-
return registerDerivativeIp;
|
2392
|
-
}()
|
2393
|
-
/**
|
2394
|
-
* Checks if an NFT is already registered in the protocol.
|
2395
|
-
* @param chainId The chain ID of the NFT.
|
2396
|
-
* @param tokenAddress The address of the NFT.
|
2397
|
-
* @param tokenId The token ID of the NFT.
|
2398
|
-
* @returns A Promise that resolves to the IP ID if the NFT is already registered, otherwise it resolves to 0x.
|
2399
|
-
*/
|
2400
|
-
}, {
|
2401
|
-
key: "isNFTRegistered",
|
2402
|
-
value: function () {
|
2403
|
-
var _isNFTRegistered = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(chainId, tokenAddress, tokenId) {
|
2404
|
-
var ipId, isRegistered;
|
2405
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
2406
|
-
while (1) switch (_context3.prev = _context3.next) {
|
2407
|
-
case 0:
|
2408
|
-
_context3.next = 2;
|
2409
|
-
return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
|
2410
|
-
functionName: "ipId",
|
2411
|
-
args: [parseToBigInt(chainId), tokenAddress, parseToBigInt(tokenId)]
|
2412
|
-
}));
|
2413
|
-
case 2:
|
2414
|
-
ipId = _context3.sent;
|
2415
|
-
_context3.next = 5;
|
2416
|
-
return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
|
2417
|
-
functionName: "isRegistered",
|
2418
|
-
args: [ipId]
|
2419
|
-
}));
|
2420
|
-
case 5:
|
2421
|
-
isRegistered = _context3.sent;
|
2422
|
-
return _context3.abrupt("return", isRegistered ? ipId : "0x");
|
2423
|
-
case 7:
|
2424
|
-
case "end":
|
2425
|
-
return _context3.stop();
|
2426
|
-
}
|
2427
|
-
}, _callee3, this);
|
2419
|
+
}, _callee2, this, [[1, 24]]);
|
2428
2420
|
}));
|
2429
|
-
function
|
2430
|
-
return
|
2421
|
+
function register(_x3) {
|
2422
|
+
return _register.apply(this, arguments);
|
2431
2423
|
}
|
2432
|
-
return
|
2433
|
-
}()
|
2424
|
+
return register;
|
2425
|
+
}())
|
2434
2426
|
}]);
|
2435
|
-
return IPAssetClient;
|
2436
2427
|
}();
|
2437
2428
|
|
2438
2429
|
var PermissionClient = /*#__PURE__*/function () {
|
2439
|
-
function PermissionClient(rpcClient, wallet) {
|
2430
|
+
function PermissionClient(rpcClient, wallet, chainId) {
|
2440
2431
|
_classCallCheck(this, PermissionClient);
|
2441
2432
|
_defineProperty(this, "ipAccountABI", IPAccountABI);
|
2442
|
-
_defineProperty(this, "accessControllerConfig", AccessControllerConfig);
|
2443
2433
|
this.rpcClient = rpcClient;
|
2444
2434
|
this.wallet = wallet;
|
2435
|
+
this.accessControllerConfig = getAccessControllerConfig(chainId);
|
2445
2436
|
}
|
2446
2437
|
|
2447
2438
|
/**
|
@@ -2463,9 +2454,9 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
2463
2454
|
* @returns A Promise that resolves to an object containing the transaction hash
|
2464
2455
|
* @emits PermissionSet (ipAccountOwner, ipAccount, signer, to, func, permission)
|
2465
2456
|
*/
|
2466
|
-
_createClass(PermissionClient, [{
|
2457
|
+
return _createClass(PermissionClient, [{
|
2467
2458
|
key: "setPermission",
|
2468
|
-
value: function () {
|
2459
|
+
value: (function () {
|
2469
2460
|
var _setPermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
2470
2461
|
var _request$txOptions, IPAccountConfig, _yield$this$rpcClient, call, txHash;
|
2471
2462
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
@@ -2493,7 +2484,6 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
2493
2484
|
request.permission // uint8
|
2494
2485
|
]
|
2495
2486
|
})],
|
2496
|
-
|
2497
2487
|
account: this.wallet.account
|
2498
2488
|
}));
|
2499
2489
|
case 4:
|
@@ -2537,20 +2527,100 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
2537
2527
|
return _setPermission.apply(this, arguments);
|
2538
2528
|
}
|
2539
2529
|
return setPermission;
|
2540
|
-
}()
|
2530
|
+
}())
|
2541
2531
|
}]);
|
2542
|
-
return PermissionClient;
|
2543
2532
|
}();
|
2544
2533
|
|
2534
|
+
function computeRoyaltyContext(_x, _x2) {
|
2535
|
+
return _computeRoyaltyContext.apply(this, arguments);
|
2536
|
+
}
|
2537
|
+
function _computeRoyaltyContext() {
|
2538
|
+
_computeRoyaltyContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(licenseIds, storyClient) {
|
2539
|
+
var royaltyContext, i, licenseData, royaltyPolicy, policy, targetRoyaltyAmount;
|
2540
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
2541
|
+
while (1) switch (_context.prev = _context.next) {
|
2542
|
+
case 0:
|
2543
|
+
royaltyContext = {
|
2544
|
+
targetAncestors: [],
|
2545
|
+
targetRoyaltyAmount: [],
|
2546
|
+
parentAncestors1: [],
|
2547
|
+
parentAncestors2: [],
|
2548
|
+
parentAncestorsRoyalties1: [],
|
2549
|
+
parentAncestorsRoyalties2: []
|
2550
|
+
};
|
2551
|
+
i = 0;
|
2552
|
+
case 2:
|
2553
|
+
if (!(i < licenseIds.length)) {
|
2554
|
+
_context.next = 16;
|
2555
|
+
break;
|
2556
|
+
}
|
2557
|
+
_context.next = 5;
|
2558
|
+
return storyClient.getLicense(licenseIds[i]);
|
2559
|
+
case 5:
|
2560
|
+
licenseData = _context.sent;
|
2561
|
+
_context.next = 8;
|
2562
|
+
return storyClient.getRoyaltyPolicy(licenseData.licensorIpId);
|
2563
|
+
case 8:
|
2564
|
+
royaltyPolicy = _context.sent;
|
2565
|
+
_context.next = 11;
|
2566
|
+
return storyClient.getPolicy(licenseData.policyId);
|
2567
|
+
case 11:
|
2568
|
+
policy = _context.sent;
|
2569
|
+
if (royaltyPolicy) {
|
2570
|
+
targetRoyaltyAmount = royaltyPolicy.targetRoyaltyAmount.map(function (e) {
|
2571
|
+
return parseInt(e);
|
2572
|
+
});
|
2573
|
+
if (i === 0) {
|
2574
|
+
royaltyContext.parentAncestors1 = royaltyPolicy.targetAncestors;
|
2575
|
+
royaltyContext.parentAncestorsRoyalties1 = targetRoyaltyAmount;
|
2576
|
+
} else {
|
2577
|
+
royaltyContext.parentAncestors2 = royaltyPolicy.targetAncestors;
|
2578
|
+
royaltyContext.parentAncestorsRoyalties2 = targetRoyaltyAmount;
|
2579
|
+
}
|
2580
|
+
updateRoyaltyContext(royaltyContext, [licenseData.licensorIpId], [parseInt(policy.pil.commercialRevShare)]);
|
2581
|
+
updateRoyaltyContext(royaltyContext, royaltyPolicy.targetAncestors, targetRoyaltyAmount);
|
2582
|
+
}
|
2583
|
+
case 13:
|
2584
|
+
i++;
|
2585
|
+
_context.next = 2;
|
2586
|
+
break;
|
2587
|
+
case 16:
|
2588
|
+
return _context.abrupt("return", royaltyContext);
|
2589
|
+
case 17:
|
2590
|
+
case "end":
|
2591
|
+
return _context.stop();
|
2592
|
+
}
|
2593
|
+
}, _callee);
|
2594
|
+
}));
|
2595
|
+
return _computeRoyaltyContext.apply(this, arguments);
|
2596
|
+
}
|
2597
|
+
function encodeRoyaltyContext(royaltyContext) {
|
2598
|
+
return typedDataToBytes({
|
2599
|
+
"interface": "(address[], uint32[], address[], address[], uint32[], uint32[])",
|
2600
|
+
data: [[royaltyContext.targetAncestors, royaltyContext.targetRoyaltyAmount, royaltyContext.parentAncestors1, royaltyContext.parentAncestors2, royaltyContext.parentAncestorsRoyalties1, royaltyContext.parentAncestorsRoyalties2]]
|
2601
|
+
});
|
2602
|
+
}
|
2603
|
+
function updateRoyaltyContext(royaltyContext, targetAncestors, targetRoyaltyAccounts) {
|
2604
|
+
for (var i = 0; i < targetAncestors.length; i++) {
|
2605
|
+
var index = royaltyContext.targetAncestors.indexOf(targetAncestors[i]);
|
2606
|
+
if (index === -1) {
|
2607
|
+
royaltyContext.targetAncestors.push(targetAncestors[i]);
|
2608
|
+
royaltyContext.targetRoyaltyAmount.push(targetRoyaltyAccounts[i]);
|
2609
|
+
} else {
|
2610
|
+
royaltyContext.targetRoyaltyAmount[index] += targetRoyaltyAccounts[i];
|
2611
|
+
}
|
2612
|
+
}
|
2613
|
+
}
|
2614
|
+
|
2545
2615
|
var LicenseClient = /*#__PURE__*/function () {
|
2546
|
-
function LicenseClient(rpcClient, wallet, storyClient) {
|
2616
|
+
function LicenseClient(rpcClient, wallet, storyClient, chainId) {
|
2547
2617
|
_classCallCheck(this, LicenseClient);
|
2548
2618
|
_defineProperty(this, "ipAccountABI", IPAccountABI);
|
2549
|
-
_defineProperty(this, "licenseRegistryConfig", LicenseRegistryConfig);
|
2550
|
-
_defineProperty(this, "licensingModuleConfig", LicensingModuleConfig);
|
2551
2619
|
this.wallet = wallet;
|
2552
2620
|
this.rpcClient = rpcClient;
|
2553
2621
|
this.storyClient = storyClient;
|
2622
|
+
this.licenseRegistryConfig = getLicenseRegistryConfig(chainId);
|
2623
|
+
this.licensingModuleConfig = getLicensingModuleConfig(chainId);
|
2554
2624
|
}
|
2555
2625
|
|
2556
2626
|
/**
|
@@ -2565,9 +2635,9 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
2565
2635
|
* @param request.receiver Receiver address of the minted license NFT(s).
|
2566
2636
|
* @returns licenseId The ID of the minted license NFT(s).
|
2567
2637
|
*/
|
2568
|
-
_createClass(LicenseClient, [{
|
2638
|
+
return _createClass(LicenseClient, [{
|
2569
2639
|
key: "mintLicense",
|
2570
|
-
value: function () {
|
2640
|
+
value: (function () {
|
2571
2641
|
var _mintLicense = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
2572
2642
|
var _request$txOptions, royaltyContext, royaltyPolicy, _royaltyContext$targe, _royaltyContext$targe2, targetRoyaltyAmount, _yield$this$rpcClient, call, txHash, targetLogs;
|
2573
2643
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
@@ -2642,7 +2712,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
2642
2712
|
return _mintLicense.apply(this, arguments);
|
2643
2713
|
}
|
2644
2714
|
return mintLicense;
|
2645
|
-
}()
|
2715
|
+
}())
|
2646
2716
|
}, {
|
2647
2717
|
key: "linkIpToParent",
|
2648
2718
|
value: function () {
|
@@ -2686,7 +2756,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
2686
2756
|
break;
|
2687
2757
|
}
|
2688
2758
|
_context2.next = 17;
|
2689
|
-
return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({},
|
2759
|
+
return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licenseRegistryConfig), {}, {
|
2690
2760
|
eventName: "TransferBatch"
|
2691
2761
|
}));
|
2692
2762
|
case 17:
|
@@ -2717,18 +2787,17 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
2717
2787
|
return linkIpToParent;
|
2718
2788
|
}()
|
2719
2789
|
}]);
|
2720
|
-
return LicenseClient;
|
2721
2790
|
}();
|
2722
2791
|
|
2723
2792
|
var PolicyClient = /*#__PURE__*/function () {
|
2724
|
-
function PolicyClient(rpcClient, wallet) {
|
2793
|
+
function PolicyClient(rpcClient, wallet, chainId) {
|
2725
2794
|
_classCallCheck(this, PolicyClient);
|
2726
2795
|
_defineProperty(this, "ipAccountABI", IPAccountABI);
|
2727
|
-
_defineProperty(this, "licensingModuleConfig", LicensingModuleConfig);
|
2728
|
-
_defineProperty(this, "pilPolicyFrameworkManagerConfig", PILPolicyFrameworkManagerConfig);
|
2729
|
-
_defineProperty(this, "royaltyPolicyLAPConfig", RoyaltyPolicyLAPConfig);
|
2730
2796
|
this.wallet = wallet;
|
2731
2797
|
this.rpcClient = rpcClient;
|
2798
|
+
this.licensingModuleConfig = getLicensingModuleConfig(chainId);
|
2799
|
+
this.pilPolicyFrameworkManagerConfig = getPILPolicyFrameworkManagerConfig(chainId);
|
2800
|
+
this.royaltyPolicyLAPConfig = getRoyaltyPolicyLAPConfig(chainId);
|
2732
2801
|
}
|
2733
2802
|
|
2734
2803
|
/**
|
@@ -2750,9 +2819,9 @@ var PolicyClient = /*#__PURE__*/function () {
|
|
2750
2819
|
* @param request.royaltyPolicy Address of a royalty policy contract (e.g. RoyaltyPolicyLS) that will handle royalty payments
|
2751
2820
|
* @returns the transaction hash and the policy ID if the txOptions.waitForTransaction is set to true
|
2752
2821
|
*/
|
2753
|
-
_createClass(PolicyClient, [{
|
2822
|
+
return _createClass(PolicyClient, [{
|
2754
2823
|
key: "registerPILPolicy",
|
2755
|
-
value: function () {
|
2824
|
+
value: (function () {
|
2756
2825
|
var _registerPILPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
2757
2826
|
var _request$txOptions, frameworkData, policyId, _yield$this$rpcClient, call, txHash, targetLogs;
|
2758
2827
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
@@ -2868,9 +2937,10 @@ var PolicyClient = /*#__PURE__*/function () {
|
|
2868
2937
|
* @param request.contentRestrictions List of content restrictions where the license is valid. Empty if no restrictions.
|
2869
2938
|
* @returns the transaction hash and the policy ID if the txOptions.waitForTransaction is set to true
|
2870
2939
|
*/
|
2940
|
+
)
|
2871
2941
|
}, {
|
2872
2942
|
key: "registerPILSocialRemixPolicy",
|
2873
|
-
value: function () {
|
2943
|
+
value: (function () {
|
2874
2944
|
var _registerPILSocialRemixPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
|
2875
2945
|
var _request$txOptions2, frameworkData, policyId, _yield$this$rpcClient2, call, txHash, targetLog;
|
2876
2946
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
@@ -2989,9 +3059,10 @@ var PolicyClient = /*#__PURE__*/function () {
|
|
2989
3059
|
* @param request.contentRestrictions List of content restrictions where the license is valid. Empty if no restrictions.
|
2990
3060
|
* @returns the transaction hash and the policy ID if the txOptions.waitForTransaction is set to true
|
2991
3061
|
*/
|
3062
|
+
)
|
2992
3063
|
}, {
|
2993
3064
|
key: "registerPILCommercialUsePolicy",
|
2994
|
-
value: function () {
|
3065
|
+
value: (function () {
|
2995
3066
|
var _registerPILCommercialUsePolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(request) {
|
2996
3067
|
var _request$txOptions3, frameworkData, policyId, _yield$this$rpcClient3, call, txHash, targetLogs;
|
2997
3068
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
@@ -3097,7 +3168,7 @@ var PolicyClient = /*#__PURE__*/function () {
|
|
3097
3168
|
return _registerPILCommercialUsePolicy.apply(this, arguments);
|
3098
3169
|
}
|
3099
3170
|
return registerPILCommercialUsePolicy;
|
3100
|
-
}()
|
3171
|
+
}())
|
3101
3172
|
}, {
|
3102
3173
|
key: "getPolicyId",
|
3103
3174
|
value: function () {
|
@@ -3151,7 +3222,7 @@ var PolicyClient = /*#__PURE__*/function () {
|
|
3151
3222
|
*/
|
3152
3223
|
}, {
|
3153
3224
|
key: "addPolicyToIp",
|
3154
|
-
value: function () {
|
3225
|
+
value: (function () {
|
3155
3226
|
var _addPolicyToIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(request) {
|
3156
3227
|
var _request$txOptions4, IPAccountConfig, _yield$this$rpcClient4, call, txHash, targetLogs;
|
3157
3228
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
@@ -3214,17 +3285,16 @@ var PolicyClient = /*#__PURE__*/function () {
|
|
3214
3285
|
return _addPolicyToIp.apply(this, arguments);
|
3215
3286
|
}
|
3216
3287
|
return addPolicyToIp;
|
3217
|
-
}()
|
3288
|
+
}())
|
3218
3289
|
}]);
|
3219
|
-
return PolicyClient;
|
3220
3290
|
}();
|
3221
3291
|
|
3222
3292
|
var DisputeClient = /*#__PURE__*/function () {
|
3223
|
-
function DisputeClient(rpcClient, wallet) {
|
3293
|
+
function DisputeClient(rpcClient, wallet, chainId) {
|
3224
3294
|
_classCallCheck(this, DisputeClient);
|
3225
|
-
_defineProperty(this, "disputeModuleConfig", DisputeModuleConfig);
|
3226
3295
|
this.rpcClient = rpcClient;
|
3227
3296
|
this.wallet = wallet;
|
3297
|
+
this.disputeModuleConfig = getDisputeModuleConfig(chainId);
|
3228
3298
|
}
|
3229
3299
|
|
3230
3300
|
/**
|
@@ -3243,9 +3313,9 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
3243
3313
|
* @calls raiseDispute(address _targetIpId, string memory _linkToDisputeEvidence, bytes32 _targetTag, bytes calldata _data) external nonReentrant returns (uint256) {
|
3244
3314
|
* @emits DisputeRaised (disputeId_, targetIpId, msg.sender, arbitrationPolicy, linkToDisputeEvidence, targetTag, calldata);
|
3245
3315
|
*/
|
3246
|
-
_createClass(DisputeClient, [{
|
3316
|
+
return _createClass(DisputeClient, [{
|
3247
3317
|
key: "raiseDispute",
|
3248
|
-
value: function () {
|
3318
|
+
value: (function () {
|
3249
3319
|
var _raiseDispute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
3250
3320
|
var _request$txOptions, _yield$this$rpcClient, call, txHash, targetLogs;
|
3251
3321
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
@@ -3312,9 +3382,10 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
3312
3382
|
* @calls cancelDispute(uint256 _disputeId, bytes calldata _data) external nonReentrant {
|
3313
3383
|
* @emits DisputeCancelled (_disputeId, _data);
|
3314
3384
|
*/
|
3385
|
+
)
|
3315
3386
|
}, {
|
3316
3387
|
key: "cancelDispute",
|
3317
|
-
value: function () {
|
3388
|
+
value: (function () {
|
3318
3389
|
var _cancelDispute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
|
3319
3390
|
var _request$txOptions2, _yield$this$rpcClient2, call, txHash;
|
3320
3391
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
@@ -3368,9 +3439,10 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
3368
3439
|
* @throws NotDisputeInitiator, if the transaction executor is not the one that initiated the dispute
|
3369
3440
|
* @emits DisputeResolved (_disputeId)
|
3370
3441
|
*/
|
3442
|
+
)
|
3371
3443
|
}, {
|
3372
3444
|
key: "resolveDispute",
|
3373
|
-
value: function () {
|
3445
|
+
value: (function () {
|
3374
3446
|
var _resolveDispute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(request) {
|
3375
3447
|
var _request$txOptions3, _yield$this$rpcClient3, call, txHash;
|
3376
3448
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
@@ -3414,9 +3486,8 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
3414
3486
|
return _resolveDispute.apply(this, arguments);
|
3415
3487
|
}
|
3416
3488
|
return resolveDispute;
|
3417
|
-
}()
|
3489
|
+
}())
|
3418
3490
|
}]);
|
3419
|
-
return DisputeClient;
|
3420
3491
|
}();
|
3421
3492
|
|
3422
3493
|
var IPAccountClient = /*#__PURE__*/function () {
|
@@ -3434,9 +3505,9 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
3434
3505
|
* @param request.data The data to send along with the transaction.
|
3435
3506
|
* @returns Tx hash for the transaction.
|
3436
3507
|
*/
|
3437
|
-
_createClass(IPAccountClient, [{
|
3508
|
+
return _createClass(IPAccountClient, [{
|
3438
3509
|
key: "execute",
|
3439
|
-
value: function () {
|
3510
|
+
value: (function () {
|
3440
3511
|
var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
3441
3512
|
var _request$txOptions, IPAccountConfig, _yield$this$rpcClient, call, txHash;
|
3442
3513
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
@@ -3495,9 +3566,10 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
3495
3566
|
* @param request.signature The signature of the transaction, EIP-712 encoded.
|
3496
3567
|
* @returns Tx hash for the transaction.
|
3497
3568
|
*/
|
3569
|
+
)
|
3498
3570
|
}, {
|
3499
3571
|
key: "executeWithSig",
|
3500
|
-
value: function () {
|
3572
|
+
value: (function () {
|
3501
3573
|
var _executeWithSig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
|
3502
3574
|
var _request$txOptions2, IPAccountConfig, _yield$this$rpcClient2, call, txHash;
|
3503
3575
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
@@ -3545,9 +3617,8 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
3545
3617
|
return _executeWithSig.apply(this, arguments);
|
3546
3618
|
}
|
3547
3619
|
return executeWithSig;
|
3548
|
-
}()
|
3620
|
+
}())
|
3549
3621
|
}]);
|
3550
|
-
return IPAccountClient;
|
3551
3622
|
}();
|
3552
3623
|
|
3553
3624
|
var StoryAPIClient = /*#__PURE__*/function () {
|
@@ -3561,7 +3632,7 @@ var StoryAPIClient = /*#__PURE__*/function () {
|
|
3561
3632
|
}
|
3562
3633
|
});
|
3563
3634
|
}
|
3564
|
-
_createClass(StoryAPIClient, [{
|
3635
|
+
return _createClass(StoryAPIClient, [{
|
3565
3636
|
key: "getRoyaltyPolicy",
|
3566
3637
|
value: function () {
|
3567
3638
|
var _getRoyaltyPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(ipId) {
|
@@ -3634,7 +3705,166 @@ var StoryAPIClient = /*#__PURE__*/function () {
|
|
3634
3705
|
return getPolicy;
|
3635
3706
|
}()
|
3636
3707
|
}]);
|
3637
|
-
|
3708
|
+
}();
|
3709
|
+
|
3710
|
+
var RoyaltyClient = /*#__PURE__*/function () {
|
3711
|
+
function RoyaltyClient(rpcClient, wallet, chainId) {
|
3712
|
+
_classCallCheck(this, RoyaltyClient);
|
3713
|
+
this.rpcClient = rpcClient;
|
3714
|
+
this.wallet = wallet;
|
3715
|
+
this.royaltyVaultImplConfig = getRoyaltyVaultImplConfig(chainId);
|
3716
|
+
this.royaltyPolicyLAPConfig = getRoyaltyPolicyLAPConfig(chainId);
|
3717
|
+
this.royaltyModuleConfig = getRoyaltyModuleConfig(chainId);
|
3718
|
+
}
|
3719
|
+
/**
|
3720
|
+
* Allows ancestors to claim the royalty tokens and any accrued revenue tokens
|
3721
|
+
* @param request - the licensing parameters for the Programmable IP License v1 (PIL) standard.
|
3722
|
+
* @param request.ancestorIpId The ip id of the ancestor to whom the royalty tokens belong to.
|
3723
|
+
* @param request.txOptions [Optional] The transaction options.
|
3724
|
+
* @returns Tx hash for the transaction.
|
3725
|
+
* @emits RoyaltyTokensCollected (ancestorIpId, ancestorsRoyalty)
|
3726
|
+
*/
|
3727
|
+
return _createClass(RoyaltyClient, [{
|
3728
|
+
key: "collectRoyaltyTokens",
|
3729
|
+
value: (function () {
|
3730
|
+
var _collectRoyaltyTokens = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
3731
|
+
var proxyAddress, _yield$this$rpcClient, call, txHash;
|
3732
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
3733
|
+
while (1) switch (_context.prev = _context.next) {
|
3734
|
+
case 0:
|
3735
|
+
_context.prev = 0;
|
3736
|
+
_context.next = 3;
|
3737
|
+
return this.getProxyAddress(request.derivativeId);
|
3738
|
+
case 3:
|
3739
|
+
proxyAddress = _context.sent;
|
3740
|
+
if (proxyAddress) {
|
3741
|
+
_context.next = 6;
|
3742
|
+
break;
|
3743
|
+
}
|
3744
|
+
throw new Error("Proxy address not found");
|
3745
|
+
case 6:
|
3746
|
+
_context.next = 8;
|
3747
|
+
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.royaltyVaultImplConfig), {}, {
|
3748
|
+
address: proxyAddress,
|
3749
|
+
functionName: "collectRoyaltyTokens",
|
3750
|
+
args: [request.ancestorIpId],
|
3751
|
+
account: this.wallet.account
|
3752
|
+
}));
|
3753
|
+
case 8:
|
3754
|
+
_yield$this$rpcClient = _context.sent;
|
3755
|
+
call = _yield$this$rpcClient.request;
|
3756
|
+
_context.next = 12;
|
3757
|
+
return this.wallet.writeContract(call);
|
3758
|
+
case 12:
|
3759
|
+
txHash = _context.sent;
|
3760
|
+
return _context.abrupt("return", {
|
3761
|
+
txHash: txHash
|
3762
|
+
});
|
3763
|
+
case 16:
|
3764
|
+
_context.prev = 16;
|
3765
|
+
_context.t0 = _context["catch"](0);
|
3766
|
+
handleError(_context.t0, "Failed to collect royalty tokens");
|
3767
|
+
case 19:
|
3768
|
+
case "end":
|
3769
|
+
return _context.stop();
|
3770
|
+
}
|
3771
|
+
}, _callee, this, [[0, 16]]);
|
3772
|
+
}));
|
3773
|
+
function collectRoyaltyTokens(_x) {
|
3774
|
+
return _collectRoyaltyTokens.apply(this, arguments);
|
3775
|
+
}
|
3776
|
+
return collectRoyaltyTokens;
|
3777
|
+
}())
|
3778
|
+
}, {
|
3779
|
+
key: "getProxyAddress",
|
3780
|
+
value: function () {
|
3781
|
+
var _getProxyAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(derivativeID) {
|
3782
|
+
var data;
|
3783
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
3784
|
+
while (1) switch (_context2.prev = _context2.next) {
|
3785
|
+
case 0:
|
3786
|
+
_context2.next = 2;
|
3787
|
+
return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.royaltyPolicyLAPConfig), {}, {
|
3788
|
+
functionName: "getRoyaltyData",
|
3789
|
+
args: [derivativeID]
|
3790
|
+
}));
|
3791
|
+
case 2:
|
3792
|
+
data = _context2.sent;
|
3793
|
+
if (!(Array.isArray(data) && data[1])) {
|
3794
|
+
_context2.next = 5;
|
3795
|
+
break;
|
3796
|
+
}
|
3797
|
+
return _context2.abrupt("return", data[1]);
|
3798
|
+
case 5:
|
3799
|
+
case "end":
|
3800
|
+
return _context2.stop();
|
3801
|
+
}
|
3802
|
+
}, _callee2, this);
|
3803
|
+
}));
|
3804
|
+
function getProxyAddress(_x2) {
|
3805
|
+
return _getProxyAddress.apply(this, arguments);
|
3806
|
+
}
|
3807
|
+
return getProxyAddress;
|
3808
|
+
}()
|
3809
|
+
/**
|
3810
|
+
* Allows the function caller to pay royalties to the receiver IP asset on behalf of the payer IP asset.
|
3811
|
+
* @param request - The request object that contains all data needed to pay royalty on behalf.
|
3812
|
+
* @param request.receiverIpId The ipId that receives the royalties.
|
3813
|
+
* @param request.payerIpId The ID of the IP asset that pays the royalties.
|
3814
|
+
* @param request.token The token to use to pay the royalties.
|
3815
|
+
* @param request.amount The amount to pay.
|
3816
|
+
* @param request.txOptions [Optional] The transaction options.
|
3817
|
+
* @returns A Promise that resolves to an object containing the transaction hash.
|
3818
|
+
* @emits RoyaltyPaid (receiverIpId, payerIpId, msg.sender, token, amount)
|
3819
|
+
*/
|
3820
|
+
}, {
|
3821
|
+
key: "payRoyaltyOnBehalf",
|
3822
|
+
value: (function () {
|
3823
|
+
var _payRoyaltyOnBehalf = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(request) {
|
3824
|
+
var _request$txOptions, _yield$this$rpcClient2, call, txHash;
|
3825
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
3826
|
+
while (1) switch (_context3.prev = _context3.next) {
|
3827
|
+
case 0:
|
3828
|
+
_context3.prev = 0;
|
3829
|
+
_context3.next = 3;
|
3830
|
+
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.royaltyModuleConfig), {}, {
|
3831
|
+
functionName: "payRoyaltyOnBehalf",
|
3832
|
+
args: [request.receiverIpId, request.payerIpId, request.token, request.amount],
|
3833
|
+
account: this.wallet.account
|
3834
|
+
}));
|
3835
|
+
case 3:
|
3836
|
+
_yield$this$rpcClient2 = _context3.sent;
|
3837
|
+
call = _yield$this$rpcClient2.request;
|
3838
|
+
_context3.next = 7;
|
3839
|
+
return this.wallet.writeContract(call);
|
3840
|
+
case 7:
|
3841
|
+
txHash = _context3.sent;
|
3842
|
+
if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
|
3843
|
+
_context3.next = 11;
|
3844
|
+
break;
|
3845
|
+
}
|
3846
|
+
_context3.next = 11;
|
3847
|
+
return waitTx(this.rpcClient, txHash);
|
3848
|
+
case 11:
|
3849
|
+
return _context3.abrupt("return", {
|
3850
|
+
txHash: txHash
|
3851
|
+
});
|
3852
|
+
case 14:
|
3853
|
+
_context3.prev = 14;
|
3854
|
+
_context3.t0 = _context3["catch"](0);
|
3855
|
+
handleError(_context3.t0, "Failed to pay royalty on behalf");
|
3856
|
+
case 17:
|
3857
|
+
case "end":
|
3858
|
+
return _context3.stop();
|
3859
|
+
}
|
3860
|
+
}, _callee3, this, [[0, 14]]);
|
3861
|
+
}));
|
3862
|
+
function payRoyaltyOnBehalf(_x3) {
|
3863
|
+
return _payRoyaltyOnBehalf.apply(this, arguments);
|
3864
|
+
}
|
3865
|
+
return payRoyaltyOnBehalf;
|
3866
|
+
}())
|
3867
|
+
}]);
|
3638
3868
|
}();
|
3639
3869
|
|
3640
3870
|
if (typeof process !== "undefined") {
|
@@ -3655,12 +3885,15 @@ var StoryClient = /*#__PURE__*/function () {
|
|
3655
3885
|
_defineProperty(this, "_policy", null);
|
3656
3886
|
_defineProperty(this, "_dispute", null);
|
3657
3887
|
_defineProperty(this, "_ipAccount", null);
|
3658
|
-
this
|
3888
|
+
_defineProperty(this, "_royalty", null);
|
3889
|
+
this.config = _objectSpread2(_objectSpread2({}, config), {}, {
|
3890
|
+
chainId: config.chainId || "sepolia"
|
3891
|
+
});
|
3659
3892
|
if (!this.config.transport) {
|
3660
3893
|
throw new Error("transport is null, please pass in a valid RPC Provider URL as the transport.");
|
3661
3894
|
}
|
3662
3895
|
var clientConfig = {
|
3663
|
-
chain: chainStringToViemChain(this.config.chainId
|
3896
|
+
chain: chainStringToViemChain(this.config.chainId),
|
3664
3897
|
transport: this.config.transport
|
3665
3898
|
};
|
3666
3899
|
this.rpcClient = createPublicClient(clientConfig);
|
@@ -3679,7 +3912,7 @@ var StoryClient = /*#__PURE__*/function () {
|
|
3679
3912
|
*
|
3680
3913
|
* @param config - the configuration for a new SDK client
|
3681
3914
|
*/
|
3682
|
-
_createClass(StoryClient, [{
|
3915
|
+
return _createClass(StoryClient, [{
|
3683
3916
|
key: "ipAsset",
|
3684
3917
|
get:
|
3685
3918
|
/**
|
@@ -3690,7 +3923,7 @@ var StoryClient = /*#__PURE__*/function () {
|
|
3690
3923
|
*/
|
3691
3924
|
function get() {
|
3692
3925
|
if (this._ipAsset === null) {
|
3693
|
-
this._ipAsset = new IPAssetClient(this.rpcClient, this.wallet, this.
|
3926
|
+
this._ipAsset = new IPAssetClient(this.rpcClient, this.wallet, this.config.chainId);
|
3694
3927
|
}
|
3695
3928
|
return this._ipAsset;
|
3696
3929
|
}
|
@@ -3705,7 +3938,7 @@ var StoryClient = /*#__PURE__*/function () {
|
|
3705
3938
|
key: "permission",
|
3706
3939
|
get: function get() {
|
3707
3940
|
if (this._permission === null) {
|
3708
|
-
this._permission = new PermissionClient(this.rpcClient, this.wallet);
|
3941
|
+
this._permission = new PermissionClient(this.rpcClient, this.wallet, this.config.chainId);
|
3709
3942
|
}
|
3710
3943
|
return this._permission;
|
3711
3944
|
}
|
@@ -3720,7 +3953,7 @@ var StoryClient = /*#__PURE__*/function () {
|
|
3720
3953
|
key: "license",
|
3721
3954
|
get: function get() {
|
3722
3955
|
if (this._license === null) {
|
3723
|
-
this._license = new LicenseClient(this.rpcClient, this.wallet, this.storyClient);
|
3956
|
+
this._license = new LicenseClient(this.rpcClient, this.wallet, this.storyClient, this.config.chainId);
|
3724
3957
|
}
|
3725
3958
|
return this._license;
|
3726
3959
|
}
|
@@ -3735,7 +3968,7 @@ var StoryClient = /*#__PURE__*/function () {
|
|
3735
3968
|
key: "policy",
|
3736
3969
|
get: function get() {
|
3737
3970
|
if (this._policy === null) {
|
3738
|
-
this._policy = new PolicyClient(this.rpcClient, this.wallet);
|
3971
|
+
this._policy = new PolicyClient(this.rpcClient, this.wallet, this.config.chainId);
|
3739
3972
|
}
|
3740
3973
|
return this._policy;
|
3741
3974
|
}
|
@@ -3750,7 +3983,7 @@ var StoryClient = /*#__PURE__*/function () {
|
|
3750
3983
|
key: "dispute",
|
3751
3984
|
get: function get() {
|
3752
3985
|
if (this._dispute === null) {
|
3753
|
-
this._dispute = new DisputeClient(this.rpcClient, this.wallet);
|
3986
|
+
this._dispute = new DisputeClient(this.rpcClient, this.wallet, this.config.chainId);
|
3754
3987
|
}
|
3755
3988
|
return this._dispute;
|
3756
3989
|
}
|
@@ -3769,13 +4002,29 @@ var StoryClient = /*#__PURE__*/function () {
|
|
3769
4002
|
}
|
3770
4003
|
return this._ipAccount;
|
3771
4004
|
}
|
4005
|
+
/**
|
4006
|
+
* Getter for the royalty client. The client is lazily created when
|
4007
|
+
* this method is called.
|
4008
|
+
*
|
4009
|
+
* @returns the RoyaltyClient instance
|
4010
|
+
*/
|
4011
|
+
}, {
|
4012
|
+
key: "royalty",
|
4013
|
+
get: function get() {
|
4014
|
+
if (this._royalty === null) {
|
4015
|
+
this._royalty = new RoyaltyClient(this.rpcClient, this.wallet, this.config.chainId);
|
4016
|
+
}
|
4017
|
+
return this._royalty;
|
4018
|
+
}
|
3772
4019
|
}], [{
|
3773
4020
|
key: "newClient",
|
3774
4021
|
value: function newClient(config) {
|
3775
4022
|
return new StoryClient(config);
|
3776
4023
|
}
|
3777
4024
|
}]);
|
3778
|
-
return StoryClient;
|
3779
4025
|
}();
|
3780
4026
|
|
4027
|
+
var AddressZero = "0x0000000000000000000000000000000000000000";
|
4028
|
+
var HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
4029
|
+
|
3781
4030
|
export { AddressZero, DisputeClient, HashZero, IPAssetClient, LicenseClient, PermissionClient, PolicyClient, StoryClient };
|