@story-protocol/core-sdk 1.4.0-rc.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/declarations/src/resources/group.d.ts.map +1 -1
- package/dist/declarations/src/resources/ipAsset.d.ts +193 -10
- package/dist/declarations/src/resources/ipAsset.d.ts.map +1 -1
- package/dist/declarations/src/resources/license.d.ts +56 -49
- package/dist/declarations/src/resources/license.d.ts.map +1 -1
- package/dist/declarations/src/types/common.d.ts +28 -4
- package/dist/declarations/src/types/common.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/dispute.d.ts +6 -5
- package/dist/declarations/src/types/resources/dispute.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/group.d.ts +19 -10
- package/dist/declarations/src/types/resources/group.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/ipAccount.d.ts +3 -3
- package/dist/declarations/src/types/resources/ipAccount.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/ipAsset.d.ts +328 -75
- package/dist/declarations/src/types/resources/ipAsset.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/license.d.ts +113 -78
- package/dist/declarations/src/types/resources/license.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/nftClient.d.ts +4 -3
- package/dist/declarations/src/types/resources/nftClient.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/permission.d.ts +13 -4
- package/dist/declarations/src/types/resources/permission.d.ts.map +1 -1
- package/dist/declarations/src/types/utils/pilFlavor.d.ts +4 -3
- package/dist/declarations/src/types/utils/pilFlavor.d.ts.map +1 -1
- package/dist/declarations/src/utils/oov3.d.ts +2 -1
- package/dist/declarations/src/utils/oov3.d.ts.map +1 -1
- package/dist/declarations/src/utils/sign.d.ts +2 -1
- package/dist/declarations/src/utils/sign.d.ts.map +1 -1
- package/dist/story-protocol-core-sdk.cjs.dev.js +1633 -1086
- package/dist/story-protocol-core-sdk.cjs.prod.js +1633 -1086
- package/dist/story-protocol-core-sdk.esm.js +1633 -1086
- package/package.json +1 -1
@@ -4467,6 +4467,11 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
4467
4467
|
* Will be converted to bigint for contract calls.
|
4468
4468
|
*/
|
4469
4469
|
|
4470
|
+
/**
|
4471
|
+
* Input for token id, can be bigint or number.
|
4472
|
+
* Will be converted to bigint for contract calls.
|
4473
|
+
*/
|
4474
|
+
|
4470
4475
|
/**
|
4471
4476
|
* The type of revenue share.
|
4472
4477
|
* It is used to determine the type of revenue share to be used in the revenue share calculation and throw error when the revenue share is not valid.
|
@@ -4480,6 +4485,25 @@ var RevShareType = /*#__PURE__*/function (RevShareType) {
|
|
4480
4485
|
return RevShareType;
|
4481
4486
|
}({});
|
4482
4487
|
|
4488
|
+
/**
|
4489
|
+
* Input for license terms id, can be bigint or number.
|
4490
|
+
* Will be converted to bigint for contract calls.
|
4491
|
+
*/
|
4492
|
+
|
4493
|
+
/**
|
4494
|
+
* Input for deadline, can be bigint or number.
|
4495
|
+
* Will be converted to bigint for contract calls.
|
4496
|
+
*/
|
4497
|
+
|
4498
|
+
/**
|
4499
|
+
* Input for revenue share, can be number.
|
4500
|
+
*/
|
4501
|
+
|
4502
|
+
/**
|
4503
|
+
* Input for fee, can be bigint or number.
|
4504
|
+
* Will be converted to bigint for contract calls.
|
4505
|
+
*/
|
4506
|
+
|
4483
4507
|
/**
|
4484
4508
|
* Permission level
|
4485
4509
|
*/
|
@@ -4577,9 +4601,6 @@ var royaltyPolicyInputToAddress = function royaltyPolicyInputToAddress(input, ch
|
|
4577
4601
|
var getRevenueShare = function getRevenueShare(revShare) {
|
4578
4602
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : RevShareType.COMMERCIAL_REVENUE_SHARE;
|
4579
4603
|
var revShareNumber = Number(revShare);
|
4580
|
-
if (isNaN(revShareNumber)) {
|
4581
|
-
throw new Error("".concat(type, " must be a valid number."));
|
4582
|
-
}
|
4583
4604
|
if (revShareNumber < 0 || revShareNumber > 100) {
|
4584
4605
|
throw new Error("".concat(type, " must be between 0 and 100."));
|
4585
4606
|
}
|
@@ -4631,7 +4652,7 @@ var getPermissionSignature = /*#__PURE__*/function () {
|
|
4631
4652
|
};
|
4632
4653
|
}();
|
4633
4654
|
var getDeadline = function getDeadline(unixTimestamp, deadline) {
|
4634
|
-
if (deadline &&
|
4655
|
+
if (deadline && BigInt(deadline) < 0n) {
|
4635
4656
|
throw new Error("Invalid deadline value.");
|
4636
4657
|
}
|
4637
4658
|
return deadline ? unixTimestamp + BigInt(deadline) : unixTimestamp + 1000n;
|
@@ -4734,7 +4755,7 @@ var validateLicenseConfig = function validateLicenseConfig(licensingConfig) {
|
|
4734
4755
|
};
|
4735
4756
|
}
|
4736
4757
|
var licenseConfig = {
|
4737
|
-
expectMinimumGroupRewardShare:
|
4758
|
+
expectMinimumGroupRewardShare: getRevenueShare(licensingConfig.expectMinimumGroupRewardShare, RevShareType.EXPECT_MINIMUM_GROUP_REWARD_SHARE),
|
4738
4759
|
commercialRevShare: getRevenueShare(licensingConfig.commercialRevShare),
|
4739
4760
|
mintingFee: BigInt(licensingConfig.mintingFee),
|
4740
4761
|
expectGroupRewardPool: validateAddress(licensingConfig.expectGroupRewardPool),
|
@@ -4743,14 +4764,6 @@ var validateLicenseConfig = function validateLicenseConfig(licensingConfig) {
|
|
4743
4764
|
isSet: licensingConfig.isSet,
|
4744
4765
|
disabled: licensingConfig.disabled
|
4745
4766
|
};
|
4746
|
-
if (isNaN(licenseConfig.expectMinimumGroupRewardShare)) {
|
4747
|
-
throw new Error("The expectMinimumGroupRewardShare must be a valid number.");
|
4748
|
-
}
|
4749
|
-
if (licenseConfig.expectMinimumGroupRewardShare < 0 || licenseConfig.expectMinimumGroupRewardShare > 100) {
|
4750
|
-
throw new Error("The expectMinimumGroupRewardShare must be greater than 0 and less than 100.");
|
4751
|
-
} else {
|
4752
|
-
licenseConfig.expectMinimumGroupRewardShare = getRevenueShare(licenseConfig.expectMinimumGroupRewardShare, RevShareType.EXPECT_MINIMUM_GROUP_REWARD_SHARE);
|
4753
|
-
}
|
4754
4767
|
if (licenseConfig.mintingFee < 0) {
|
4755
4768
|
throw new Error("The mintingFee must be greater than 0.");
|
4756
4769
|
}
|
@@ -4840,7 +4853,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
4840
4853
|
key: "mintAndRegisterIpAndAttachLicenseAndAddToGroup",
|
4841
4854
|
value: (function () {
|
4842
4855
|
var _mintAndRegisterIpAndAttachLicenseAndAddToGroup = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(request) {
|
4843
|
-
var _request$txOptions2, groupId, recipient, spgNftContract, deadline, isRegistered, ipAccount, _yield$ipAccount$stat, state, blockTimestamp, calculatedDeadline, _yield$getPermissionS, sigAddToGroupSignature, object, txHash, receipt, log, _t2;
|
4856
|
+
var _request$maxAllowedRe, _request$txOptions2, groupId, recipient, spgNftContract, deadline, isRegistered, ipAccount, _yield$ipAccount$stat, state, blockTimestamp, calculatedDeadline, _yield$getPermissionS, sigAddToGroupSignature, object, txHash, receipt, log, _t2;
|
4844
4857
|
return _regenerator().w(function (_context2) {
|
4845
4858
|
while (1) switch (_context2.p = _context2.n) {
|
4846
4859
|
case 0:
|
@@ -4891,7 +4904,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
4891
4904
|
allowDuplicates: request.allowDuplicates || true,
|
4892
4905
|
spgNftContract: validateAddress(spgNftContract),
|
4893
4906
|
recipient: validateAddress(recipient || this.wallet.account.address),
|
4894
|
-
maxAllowedRewardShare: BigInt(getRevenueShare(request.maxAllowedRewardShare, RevShareType.MAX_ALLOWED_REWARD_SHARE)),
|
4907
|
+
maxAllowedRewardShare: BigInt(getRevenueShare((_request$maxAllowedRe = request.maxAllowedRewardShare) !== null && _request$maxAllowedRe !== void 0 ? _request$maxAllowedRe : 100, RevShareType.MAX_ALLOWED_REWARD_SHARE)),
|
4895
4908
|
licensesData: this.getLicenseData(request.licenseData),
|
4896
4909
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
4897
4910
|
sigAddToGroup: {
|
@@ -4950,7 +4963,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
4950
4963
|
key: "registerIpAndAttachLicenseAndAddToGroup",
|
4951
4964
|
value: (function () {
|
4952
4965
|
var _registerIpAndAttachLicenseAndAddToGroup = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(request) {
|
4953
|
-
var _request$txOptions3, ipIdAddress, isRegistered, ipAccount, _yield$ipAccount$stat2, state, blockTimestamp, calculatedDeadline, _yield$getPermissionS2, sigAddToGroupSignature, _yield$getPermissionS3, sigMetadataAndAttachSignature, object, txHash, receipt, log, _t3;
|
4966
|
+
var _request$maxAllowedRe2, _request$txOptions3, ipIdAddress, isRegistered, ipAccount, _yield$ipAccount$stat2, state, blockTimestamp, calculatedDeadline, _yield$getPermissionS2, sigAddToGroupSignature, _yield$getPermissionS3, sigMetadataAndAttachSignature, object, txHash, receipt, log, _t3;
|
4954
4967
|
return _regenerator().w(function (_context3) {
|
4955
4968
|
while (1) switch (_context3.p = _context3.n) {
|
4956
4969
|
case 0:
|
@@ -5042,7 +5055,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
5042
5055
|
licensesData: this.getLicenseData(request.licenseData),
|
5043
5056
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
5044
5057
|
tokenId: BigInt(request.tokenId),
|
5045
|
-
maxAllowedRewardShare: BigInt(getRevenueShare(request.maxAllowedRewardShare, RevShareType.MAX_ALLOWED_REWARD_SHARE)),
|
5058
|
+
maxAllowedRewardShare: BigInt(getRevenueShare((_request$maxAllowedRe2 = request.maxAllowedRewardShare) !== null && _request$maxAllowedRe2 !== void 0 ? _request$maxAllowedRe2 : 100, RevShareType.MAX_ALLOWED_REWARD_SHARE)),
|
5046
5059
|
sigAddToGroup: {
|
5047
5060
|
signer: validateAddress(this.wallet.account.address),
|
5048
5061
|
deadline: calculatedDeadline,
|
@@ -5152,7 +5165,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
5152
5165
|
key: "registerGroupAndAttachLicenseAndAddIps",
|
5153
5166
|
value: (function () {
|
5154
5167
|
var _registerGroupAndAttachLicenseAndAddIps = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(request) {
|
5155
|
-
var _request$txOptions5, object, i, isRegistered, _i, isAttachedLicenseTerms, txHash, txReceipt, groupId, _t5;
|
5168
|
+
var _request$maxAllowedRe3, _request$txOptions5, object, i, isRegistered, _i, isAttachedLicenseTerms, txHash, txReceipt, groupId, _t5;
|
5156
5169
|
return _regenerator().w(function (_context5) {
|
5157
5170
|
while (1) switch (_context5.p = _context5.n) {
|
5158
5171
|
case 0:
|
@@ -5161,7 +5174,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
5161
5174
|
groupPool: validateAddress(request.groupPool),
|
5162
5175
|
ipIds: request.ipIds,
|
5163
5176
|
licenseData: this.getLicenseData(request.licenseData)[0],
|
5164
|
-
maxAllowedRewardShare: BigInt(getRevenueShare(request.maxAllowedRewardShare))
|
5177
|
+
maxAllowedRewardShare: BigInt(getRevenueShare((_request$maxAllowedRe3 = request.maxAllowedRewardShare) !== null && _request$maxAllowedRe3 !== void 0 ? _request$maxAllowedRe3 : 100, RevShareType.MAX_ALLOWED_REWARD_SHARE))
|
5165
5178
|
};
|
5166
5179
|
i = 0;
|
5167
5180
|
case 1:
|
@@ -5404,7 +5417,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
5404
5417
|
addIpParam = {
|
5405
5418
|
groupIpId: validateAddress(groupIpId),
|
5406
5419
|
ipIds: validateAddresses(ipIds),
|
5407
|
-
maxAllowedRewardShare: BigInt(getRevenueShare(maxAllowedRewardSharePercentage
|
5420
|
+
maxAllowedRewardShare: BigInt(getRevenueShare(maxAllowedRewardSharePercentage !== null && maxAllowedRewardSharePercentage !== void 0 ? maxAllowedRewardSharePercentage : 100, RevShareType.MAX_ALLOWED_REWARD_SHARE_PERCENTAGE))
|
5408
5421
|
};
|
5409
5422
|
_context8.n = 2;
|
5410
5423
|
return this.groupingModuleClient.addIp(addIpParam);
|
@@ -6454,9 +6467,9 @@ _defineProperty(PILFlavor, "validateLicenseTerms", function (params, chainId) {
|
|
6454
6467
|
// Validate commercial use and derivatives
|
6455
6468
|
_PILFlavor.verifyCommercialUse(normalized);
|
6456
6469
|
_PILFlavor.verifyDerivatives(normalized);
|
6457
|
-
|
6458
|
-
|
6459
|
-
|
6470
|
+
if (normalized.commercialRevShare > 100 || normalized.commercialRevShare < 0) {
|
6471
|
+
throw new PILFlavorError("commercialRevShare must be between 0 and 100.");
|
6472
|
+
}
|
6460
6473
|
return normalized;
|
6461
6474
|
});
|
6462
6475
|
_defineProperty(PILFlavor, "verifyCommercialUse", function (terms) {
|
@@ -6582,6 +6595,7 @@ var validateLicenseTermsData = /*#__PURE__*/function () {
|
|
6582
6595
|
break;
|
6583
6596
|
}
|
6584
6597
|
licenseTerm = PILFlavor.validateLicenseTerms(licenseTermsData[i].terms, chainId);
|
6598
|
+
licenseTerm.commercialRevShare = getRevenueShare(licenseTerm.commercialRevShare);
|
6585
6599
|
royaltyModuleReadOnlyClient = new RoyaltyModuleReadOnlyClient(rpcClient);
|
6586
6600
|
if (!(validateAddress(licenseTerm.royaltyPolicy) !== viem.zeroAddress)) {
|
6587
6601
|
_context2.n = 3;
|
@@ -6685,6 +6699,7 @@ var getRoyaltyShares = function getRoyaltyShares(royaltyShares) {
|
|
6685
6699
|
};
|
6686
6700
|
var validateDerivativeData = /*#__PURE__*/function () {
|
6687
6701
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(_ref3) {
|
6702
|
+
var _derivativeDataInput$, _derivativeDataInput$2;
|
6688
6703
|
var derivativeDataInput, rpcClient, wallet, chainId, licenseTemplateAddress, ipAssetRegistryClient, licenseRegistryReadOnlyClient, derivativeData, i, parentId, isParentIpRegistered, isAttachedLicenseTerms, _yield$licenseRegistr, royaltyPercent;
|
6689
6704
|
return _regenerator().w(function (_context3) {
|
6690
6705
|
while (1) switch (_context3.n) {
|
@@ -6700,9 +6715,9 @@ var validateDerivativeData = /*#__PURE__*/function () {
|
|
6700
6715
|
}),
|
6701
6716
|
licenseTemplate: validateAddress(derivativeDataInput.licenseTemplate || licenseTemplateAddress),
|
6702
6717
|
royaltyContext: viem.zeroAddress,
|
6703
|
-
maxMintingFee: BigInt(derivativeDataInput.maxMintingFee
|
6704
|
-
maxRts:
|
6705
|
-
maxRevenueShare: getRevenueShare(derivativeDataInput.maxRevenueShare
|
6718
|
+
maxMintingFee: BigInt((_derivativeDataInput$ = derivativeDataInput.maxMintingFee) !== null && _derivativeDataInput$ !== void 0 ? _derivativeDataInput$ : 0),
|
6719
|
+
maxRts: validateMaxRts(derivativeDataInput.maxRts),
|
6720
|
+
maxRevenueShare: getRevenueShare((_derivativeDataInput$2 = derivativeDataInput.maxRevenueShare) !== null && _derivativeDataInput$2 !== void 0 ? _derivativeDataInput$2 : 100, RevShareType.MAX_REVENUE_SHARE)
|
6706
6721
|
};
|
6707
6722
|
if (!(derivativeData.parentIpIds.length === 0)) {
|
6708
6723
|
_context3.n = 1;
|
@@ -6728,7 +6743,6 @@ var validateDerivativeData = /*#__PURE__*/function () {
|
|
6728
6743
|
}
|
6729
6744
|
throw new Error("The maxMintingFee must be greater than 0.");
|
6730
6745
|
case 4:
|
6731
|
-
validateMaxRts(derivativeData.maxRts);
|
6732
6746
|
i = 0;
|
6733
6747
|
case 5:
|
6734
6748
|
if (!(i < derivativeData.parentIpIds.length)) {
|
@@ -6790,12 +6804,12 @@ var validateDerivativeData = /*#__PURE__*/function () {
|
|
6790
6804
|
};
|
6791
6805
|
}();
|
6792
6806
|
var validateMaxRts = function validateMaxRts(maxRts) {
|
6793
|
-
if (
|
6794
|
-
|
6795
|
-
}
|
6796
|
-
if (maxRts < 0 || maxRts > MAX_ROYALTY_TOKEN) {
|
6807
|
+
if (maxRts === undefined) {
|
6808
|
+
return MAX_ROYALTY_TOKEN;
|
6809
|
+
} else if (maxRts < 0 || maxRts > MAX_ROYALTY_TOKEN) {
|
6797
6810
|
throw new Error("The maxRts must be greater than 0 and less than ".concat(MAX_ROYALTY_TOKEN, "."));
|
6798
6811
|
}
|
6812
|
+
return maxRts;
|
6799
6813
|
};
|
6800
6814
|
var getIpIdAddress = /*#__PURE__*/function () {
|
6801
6815
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(_ref5) {
|
@@ -7994,6 +8008,53 @@ var prepareRoyaltyTokensDistributionRequests = /*#__PURE__*/function () {
|
|
7994
8008
|
};
|
7995
8009
|
}();
|
7996
8010
|
|
8011
|
+
var setMaxLicenseTokens = /*#__PURE__*/function () {
|
8012
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
8013
|
+
var maxLicenseTokensData, licensorIpId, licenseTermsIds, totalLicenseTokenLimitHookClient, templateAddress, licenseTermsMaxLimitTxHashes, i, maxLicenseTokens, txHash;
|
8014
|
+
return _regenerator().w(function (_context) {
|
8015
|
+
while (1) switch (_context.n) {
|
8016
|
+
case 0:
|
8017
|
+
maxLicenseTokensData = _ref.maxLicenseTokensData, licensorIpId = _ref.licensorIpId, licenseTermsIds = _ref.licenseTermsIds, totalLicenseTokenLimitHookClient = _ref.totalLicenseTokenLimitHookClient, templateAddress = _ref.templateAddress;
|
8018
|
+
licenseTermsMaxLimitTxHashes = [];
|
8019
|
+
i = 0;
|
8020
|
+
case 1:
|
8021
|
+
if (!(i < maxLicenseTokensData.length)) {
|
8022
|
+
_context.n = 5;
|
8023
|
+
break;
|
8024
|
+
}
|
8025
|
+
maxLicenseTokens = maxLicenseTokensData[i].maxLicenseTokens;
|
8026
|
+
if (!(maxLicenseTokens === undefined || maxLicenseTokens < 0n)) {
|
8027
|
+
_context.n = 2;
|
8028
|
+
break;
|
8029
|
+
}
|
8030
|
+
return _context.a(3, 4);
|
8031
|
+
case 2:
|
8032
|
+
_context.n = 3;
|
8033
|
+
return totalLicenseTokenLimitHookClient.setTotalLicenseTokenLimit({
|
8034
|
+
licensorIpId: licensorIpId,
|
8035
|
+
licenseTemplate: templateAddress,
|
8036
|
+
licenseTermsId: licenseTermsIds[i],
|
8037
|
+
limit: BigInt(maxLicenseTokens)
|
8038
|
+
});
|
8039
|
+
case 3:
|
8040
|
+
txHash = _context.v;
|
8041
|
+
if (txHash) {
|
8042
|
+
licenseTermsMaxLimitTxHashes.push(txHash);
|
8043
|
+
}
|
8044
|
+
case 4:
|
8045
|
+
i++;
|
8046
|
+
_context.n = 1;
|
8047
|
+
break;
|
8048
|
+
case 5:
|
8049
|
+
return _context.a(2, licenseTermsMaxLimitTxHashes);
|
8050
|
+
}
|
8051
|
+
}, _callee);
|
8052
|
+
}));
|
8053
|
+
return function setMaxLicenseTokens(_x) {
|
8054
|
+
return _ref2.apply(this, arguments);
|
8055
|
+
};
|
8056
|
+
}();
|
8057
|
+
|
7997
8058
|
var IPAssetClient = /*#__PURE__*/function () {
|
7998
8059
|
function IPAssetClient(rpcClient, wallet, chainId) {
|
7999
8060
|
_classCallCheck(this, IPAssetClient);
|
@@ -8017,6 +8078,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
8017
8078
|
this.wallet = wallet;
|
8018
8079
|
this.chainId = chainId;
|
8019
8080
|
this.walletAddress = this.wallet.account.address;
|
8081
|
+
this.licenseTemplateAddress = this.licenseTemplateClient.address;
|
8020
8082
|
}
|
8021
8083
|
return _createClass(IPAssetClient, [{
|
8022
8084
|
key: "generateCreatorMetadata",
|
@@ -8403,7 +8465,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
8403
8465
|
key: "batchRegisterDerivative",
|
8404
8466
|
value: (function () {
|
8405
8467
|
var _batchRegisterDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(request) {
|
8406
|
-
var contracts, licenseModuleAddress, _iterator2, _step2, arg, calculatedDeadline, ipAccount, data, _yield$ipAccount$stat, state, signature, txHash, _t6, _t7, _t8;
|
8468
|
+
var contracts, licenseModuleAddress, _iterator2, _step2, _arg$maxMintingFee, _arg$maxRevenueShare, arg, calculatedDeadline, ipAccount, data, _yield$ipAccount$stat, state, signature, txHash, _t6, _t7, _t8;
|
8407
8469
|
return _regenerator().w(function (_context5) {
|
8408
8470
|
while (1) switch (_context5.p = _context5.n) {
|
8409
8471
|
case 0:
|
@@ -8444,7 +8506,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
8444
8506
|
functionName: "registerDerivative",
|
8445
8507
|
args: [arg.childIpId, arg.parentIpIds, arg.licenseTermsIds.map(function (id) {
|
8446
8508
|
return BigInt(id);
|
8447
|
-
}), arg.licenseTemplate || this.
|
8509
|
+
}), arg.licenseTemplate || this.licenseTemplateAddress, viem.zeroAddress, BigInt((_arg$maxMintingFee = arg.maxMintingFee) !== null && _arg$maxMintingFee !== void 0 ? _arg$maxMintingFee : 0), validateMaxRts(arg.maxRts), getRevenueShare((_arg$maxRevenueShare = arg.maxRevenueShare) !== null && _arg$maxRevenueShare !== void 0 ? _arg$maxRevenueShare : 100, RevShareType.MAX_REVENUE_SHARE)]
|
8448
8510
|
});
|
8449
8511
|
_context5.n = 8;
|
8450
8512
|
return ipAccount.state();
|
@@ -8534,9 +8596,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
8534
8596
|
return BigInt(id);
|
8535
8597
|
}),
|
8536
8598
|
royaltyContext: viem.zeroAddress,
|
8537
|
-
maxRts:
|
8599
|
+
maxRts: validateMaxRts(request.maxRts)
|
8538
8600
|
};
|
8539
|
-
validateMaxRts(req.maxRts);
|
8540
8601
|
_context6.n = 1;
|
8541
8602
|
return this.isRegistered(request.childIpId);
|
8542
8603
|
case 1:
|
@@ -8605,39 +8666,34 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
8605
8666
|
value: (function () {
|
8606
8667
|
var _mintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(request) {
|
8607
8668
|
var _this3 = this;
|
8608
|
-
var _request$txOptions4, _request$options2, _yield$
|
8669
|
+
var _request$txOptions4, _request$options2, _yield$transformRegis, transformRequest, encodedTxData, contractCall, rsp, computedLicenseTermsIds, maxLicenseTokensTxHashes, _t0;
|
8609
8670
|
return _regenerator().w(function (_context7) {
|
8610
8671
|
while (1) switch (_context7.p = _context7.n) {
|
8611
8672
|
case 0:
|
8612
8673
|
_context7.p = 0;
|
8613
8674
|
_context7.n = 1;
|
8614
|
-
return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
|
8615
|
-
case 1:
|
8616
|
-
_yield$validateLicens = _context7.v;
|
8617
|
-
licenseTerms = _yield$validateLicens.licenseTerms;
|
8618
|
-
_context7.n = 2;
|
8619
8675
|
return transformRegistrationRequest({
|
8620
8676
|
request: request,
|
8621
8677
|
rpcClient: this.rpcClient,
|
8622
8678
|
wallet: this.wallet,
|
8623
8679
|
chainId: this.chainId
|
8624
8680
|
});
|
8625
|
-
case
|
8681
|
+
case 1:
|
8626
8682
|
_yield$transformRegis = _context7.v;
|
8627
8683
|
transformRequest = _yield$transformRegis.transformRequest;
|
8628
8684
|
encodedTxData = this.licenseAttachmentWorkflowsClient.mintAndRegisterIpAndAttachPilTermsEncode(transformRequest);
|
8629
8685
|
if (!((_request$txOptions4 = request.txOptions) !== null && _request$txOptions4 !== void 0 && _request$txOptions4.encodedTxDataOnly)) {
|
8630
|
-
_context7.n =
|
8686
|
+
_context7.n = 2;
|
8631
8687
|
break;
|
8632
8688
|
}
|
8633
8689
|
return _context7.a(2, {
|
8634
8690
|
encodedTxData: encodedTxData
|
8635
8691
|
});
|
8636
|
-
case
|
8692
|
+
case 2:
|
8637
8693
|
contractCall = function contractCall() {
|
8638
8694
|
return _this3.licenseAttachmentWorkflowsClient.mintAndRegisterIpAndAttachPilTerms(transformRequest);
|
8639
8695
|
};
|
8640
|
-
_context7.n =
|
8696
|
+
_context7.n = 3;
|
8641
8697
|
return this.handleRegistrationWithFees({
|
8642
8698
|
wipOptions: (_request$options2 = request.options) === null || _request$options2 === void 0 ? void 0 : _request$options2.wipOptions,
|
8643
8699
|
sender: this.walletAddress,
|
@@ -8647,31 +8703,35 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
8647
8703
|
contractCall: contractCall,
|
8648
8704
|
txOptions: request.txOptions
|
8649
8705
|
});
|
8650
|
-
case
|
8706
|
+
case 3:
|
8651
8707
|
rsp = _context7.v;
|
8652
|
-
_context7.n =
|
8653
|
-
return this.getLicenseTermsId(
|
8654
|
-
|
8708
|
+
_context7.n = 4;
|
8709
|
+
return this.getLicenseTermsId(transformRequest.licenseTermsData.map(function (data) {
|
8710
|
+
return data.terms;
|
8711
|
+
}));
|
8712
|
+
case 4:
|
8655
8713
|
computedLicenseTermsIds = _context7.v;
|
8656
|
-
_context7.n =
|
8657
|
-
return
|
8714
|
+
_context7.n = 5;
|
8715
|
+
return setMaxLicenseTokens({
|
8658
8716
|
maxLicenseTokensData: request.licenseTermsData,
|
8659
8717
|
licensorIpId: rsp.ipId,
|
8660
|
-
licenseTermsIds: computedLicenseTermsIds
|
8718
|
+
licenseTermsIds: computedLicenseTermsIds,
|
8719
|
+
totalLicenseTokenLimitHookClient: this.totalLicenseTokenLimitHookClient,
|
8720
|
+
templateAddress: this.licenseTemplateAddress
|
8661
8721
|
});
|
8662
|
-
case
|
8722
|
+
case 5:
|
8663
8723
|
maxLicenseTokensTxHashes = _context7.v;
|
8664
8724
|
return _context7.a(2, _objectSpread2(_objectSpread2({}, rsp), {}, {
|
8665
8725
|
licenseTermsIds: computedLicenseTermsIds
|
8666
8726
|
}, maxLicenseTokensTxHashes.length > 0 && {
|
8667
8727
|
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
8668
8728
|
}));
|
8669
|
-
case
|
8670
|
-
_context7.p =
|
8729
|
+
case 6:
|
8730
|
+
_context7.p = 6;
|
8671
8731
|
_t0 = _context7.v;
|
8672
8732
|
return _context7.a(2, handleError(_t0, "Failed to mint and register IP and attach PIL terms"));
|
8673
8733
|
}
|
8674
|
-
}, _callee7, this, [[0,
|
8734
|
+
}, _callee7, this, [[0, 6]]);
|
8675
8735
|
}));
|
8676
8736
|
function mintAndRegisterIpAssetWithPilTerms(_x8) {
|
8677
8737
|
return _mintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
|
@@ -8765,10 +8825,12 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
8765
8825
|
licenseTermsIds = _context8.v;
|
8766
8826
|
results[j].licenseTermsIds = licenseTermsIds;
|
8767
8827
|
_context8.n = 13;
|
8768
|
-
return
|
8828
|
+
return setMaxLicenseTokens({
|
8769
8829
|
maxLicenseTokensData: licenseTermsData,
|
8770
8830
|
licensorIpId: results[j].ipId,
|
8771
|
-
licenseTermsIds: licenseTermsIds
|
8831
|
+
licenseTermsIds: licenseTermsIds,
|
8832
|
+
totalLicenseTokenLimitHookClient: this.totalLicenseTokenLimitHookClient,
|
8833
|
+
templateAddress: this.licenseTemplateAddress
|
8772
8834
|
});
|
8773
8835
|
case 13:
|
8774
8836
|
maxLicenseTokensTxHashes = _context8.v;
|
@@ -8806,7 +8868,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
8806
8868
|
key: "registerIpAndAttachPilTerms",
|
8807
8869
|
value: (function () {
|
8808
8870
|
var _registerIpAndAttachPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(request) {
|
8809
|
-
var _request$txOptions5, ipIdAddress, isRegistered, _yield$
|
8871
|
+
var _request$txOptions5, ipIdAddress, isRegistered, _yield$validateLicens, licenseTerms, _yield$transformRegis2, _transformRequest, txHash, txReceipt, log, licenseTermsIds, maxLicenseTokensTxHashes, _t11;
|
8810
8872
|
return _regenerator().w(function (_context9) {
|
8811
8873
|
while (1) switch (_context9.p = _context9.n) {
|
8812
8874
|
case 0:
|
@@ -8835,8 +8897,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
8835
8897
|
_context9.n = 4;
|
8836
8898
|
return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
|
8837
8899
|
case 4:
|
8838
|
-
_yield$
|
8839
|
-
licenseTerms = _yield$
|
8900
|
+
_yield$validateLicens = _context9.v;
|
8901
|
+
licenseTerms = _yield$validateLicens.licenseTerms;
|
8840
8902
|
_context9.n = 5;
|
8841
8903
|
return transformRegistrationRequest({
|
8842
8904
|
request: request,
|
@@ -8871,10 +8933,12 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
8871
8933
|
case 9:
|
8872
8934
|
licenseTermsIds = _context9.v;
|
8873
8935
|
_context9.n = 10;
|
8874
|
-
return
|
8936
|
+
return setMaxLicenseTokens({
|
8875
8937
|
maxLicenseTokensData: request.licenseTermsData,
|
8876
8938
|
licensorIpId: log.ipId,
|
8877
|
-
licenseTermsIds: licenseTermsIds
|
8939
|
+
licenseTermsIds: licenseTermsIds,
|
8940
|
+
totalLicenseTokenLimitHookClient: this.totalLicenseTokenLimitHookClient,
|
8941
|
+
templateAddress: this.licenseTemplateAddress
|
8878
8942
|
});
|
8879
8943
|
case 10:
|
8880
8944
|
maxLicenseTokensTxHashes = _context9.v;
|
@@ -9420,120 +9484,6 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9420
9484
|
}
|
9421
9485
|
return batchMintAndRegisterIp;
|
9422
9486
|
}()
|
9423
|
-
/**
|
9424
|
-
* Register Programmable IP License Terms (if unregistered) and attach it to IP.
|
9425
|
-
*
|
9426
|
-
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicensingModule.sol#L19 | `LicenseTermsAttached`} event.
|
9427
|
-
*/
|
9428
|
-
)
|
9429
|
-
}, {
|
9430
|
-
key: "registerPilTermsAndAttach",
|
9431
|
-
value: (function () {
|
9432
|
-
var _registerPilTermsAndAttach = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(request) {
|
9433
|
-
var _request$txOptions9, ipId, isRegistered, _yield$validateLicens3, licenseTerms, licenseTermsData, calculatedDeadline, ipAccount, _yield$ipAccount$stat2, state, signature, _object2, txHash, licenseTermsIds, maxLicenseTokensTxHashes, _t22;
|
9434
|
-
return _regenerator().w(function (_context15) {
|
9435
|
-
while (1) switch (_context15.p = _context15.n) {
|
9436
|
-
case 0:
|
9437
|
-
_context15.p = 0;
|
9438
|
-
ipId = request.ipId;
|
9439
|
-
_context15.n = 1;
|
9440
|
-
return this.isRegistered(ipId);
|
9441
|
-
case 1:
|
9442
|
-
isRegistered = _context15.v;
|
9443
|
-
if (isRegistered) {
|
9444
|
-
_context15.n = 2;
|
9445
|
-
break;
|
9446
|
-
}
|
9447
|
-
throw new Error("The IP with id ".concat(ipId, " is not registered."));
|
9448
|
-
case 2:
|
9449
|
-
_context15.n = 3;
|
9450
|
-
return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
|
9451
|
-
case 3:
|
9452
|
-
_yield$validateLicens3 = _context15.v;
|
9453
|
-
licenseTerms = _yield$validateLicens3.licenseTerms;
|
9454
|
-
licenseTermsData = _yield$validateLicens3.licenseTermsData;
|
9455
|
-
_context15.n = 4;
|
9456
|
-
return getCalculatedDeadline(this.rpcClient, request.deadline);
|
9457
|
-
case 4:
|
9458
|
-
calculatedDeadline = _context15.v;
|
9459
|
-
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, ipId);
|
9460
|
-
_context15.n = 5;
|
9461
|
-
return ipAccount.state();
|
9462
|
-
case 5:
|
9463
|
-
_yield$ipAccount$stat2 = _context15.v;
|
9464
|
-
state = _yield$ipAccount$stat2.result;
|
9465
|
-
_context15.n = 6;
|
9466
|
-
return generateOperationSignature({
|
9467
|
-
ipIdAddress: ipId,
|
9468
|
-
methodType: SignatureMethodType.REGISTER_PIL_TERMS_AND_ATTACH,
|
9469
|
-
deadline: calculatedDeadline,
|
9470
|
-
state: state,
|
9471
|
-
wallet: this.wallet,
|
9472
|
-
chainId: this.chainId
|
9473
|
-
});
|
9474
|
-
case 6:
|
9475
|
-
signature = _context15.v;
|
9476
|
-
_object2 = {
|
9477
|
-
ipId: ipId,
|
9478
|
-
licenseTermsData: licenseTermsData,
|
9479
|
-
sigAttachAndConfig: {
|
9480
|
-
signer: validateAddress(this.walletAddress),
|
9481
|
-
deadline: calculatedDeadline,
|
9482
|
-
signature: signature
|
9483
|
-
}
|
9484
|
-
};
|
9485
|
-
if (!((_request$txOptions9 = request.txOptions) !== null && _request$txOptions9 !== void 0 && _request$txOptions9.encodedTxDataOnly)) {
|
9486
|
-
_context15.n = 7;
|
9487
|
-
break;
|
9488
|
-
}
|
9489
|
-
return _context15.a(2, {
|
9490
|
-
encodedTxData: this.licenseAttachmentWorkflowsClient.registerPilTermsAndAttachEncode(_object2)
|
9491
|
-
});
|
9492
|
-
case 7:
|
9493
|
-
_context15.n = 8;
|
9494
|
-
return this.licenseAttachmentWorkflowsClient.registerPilTermsAndAttach(_object2);
|
9495
|
-
case 8:
|
9496
|
-
txHash = _context15.v;
|
9497
|
-
_context15.n = 9;
|
9498
|
-
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
9499
|
-
hash: txHash
|
9500
|
-
}));
|
9501
|
-
case 9:
|
9502
|
-
_context15.n = 10;
|
9503
|
-
return this.getLicenseTermsId(licenseTerms);
|
9504
|
-
case 10:
|
9505
|
-
licenseTermsIds = _context15.v;
|
9506
|
-
_context15.n = 11;
|
9507
|
-
return this.setMaxLicenseTokens({
|
9508
|
-
maxLicenseTokensData: request.licenseTermsData,
|
9509
|
-
licensorIpId: ipId,
|
9510
|
-
licenseTermsIds: licenseTermsIds
|
9511
|
-
});
|
9512
|
-
case 11:
|
9513
|
-
maxLicenseTokensTxHashes = _context15.v;
|
9514
|
-
return _context15.a(2, _objectSpread2({
|
9515
|
-
txHash: txHash,
|
9516
|
-
licenseTermsIds: licenseTermsIds
|
9517
|
-
}, maxLicenseTokensTxHashes.length > 0 && {
|
9518
|
-
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
9519
|
-
}));
|
9520
|
-
case 12:
|
9521
|
-
_context15.n = 14;
|
9522
|
-
break;
|
9523
|
-
case 13:
|
9524
|
-
_context15.p = 13;
|
9525
|
-
_t22 = _context15.v;
|
9526
|
-
return _context15.a(2, handleError(_t22, "Failed to register PIL terms and attach"));
|
9527
|
-
case 14:
|
9528
|
-
return _context15.a(2);
|
9529
|
-
}
|
9530
|
-
}, _callee15, this, [[0, 13]]);
|
9531
|
-
}));
|
9532
|
-
function registerPilTermsAndAttach(_x14) {
|
9533
|
-
return _registerPilTermsAndAttach.apply(this, arguments);
|
9534
|
-
}
|
9535
|
-
return registerPilTermsAndAttach;
|
9536
|
-
}()
|
9537
9487
|
/**
|
9538
9488
|
* Mint an NFT from a collection and register it as a derivative IP using license tokens.
|
9539
9489
|
* Requires caller to have the minter role or the SPG NFT to allow public minting. Caller must own the license tokens and have approved DerivativeWorkflows to transfer them.
|
@@ -9544,70 +9494,69 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9544
9494
|
}, {
|
9545
9495
|
key: "mintAndRegisterIpAndMakeDerivativeWithLicenseTokens",
|
9546
9496
|
value: (function () {
|
9547
|
-
var _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
9497
|
+
var _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(request) {
|
9548
9498
|
var _this8 = this;
|
9549
|
-
var _request$
|
9550
|
-
return _regenerator().w(function (
|
9551
|
-
while (1) switch (
|
9499
|
+
var _request$txOptions9, _request$options6, licenseTokenIds, _object2, encodedTxData, contractCall, _t22;
|
9500
|
+
return _regenerator().w(function (_context16) {
|
9501
|
+
while (1) switch (_context16.p = _context16.n) {
|
9552
9502
|
case 0:
|
9553
|
-
|
9554
|
-
|
9503
|
+
_context16.p = 0;
|
9504
|
+
_context16.n = 1;
|
9555
9505
|
return this.validateLicenseTokenIds(request.licenseTokenIds);
|
9556
9506
|
case 1:
|
9557
|
-
licenseTokenIds =
|
9558
|
-
|
9507
|
+
licenseTokenIds = _context16.v;
|
9508
|
+
_object2 = {
|
9559
9509
|
spgNftContract: validateAddress(request.spgNftContract),
|
9560
9510
|
recipient: validateAddress(request.recipient || this.walletAddress),
|
9561
9511
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
9562
9512
|
licenseTokenIds: licenseTokenIds,
|
9563
9513
|
royaltyContext: viem.zeroAddress,
|
9564
|
-
maxRts:
|
9514
|
+
maxRts: validateMaxRts(request.maxRts),
|
9565
9515
|
allowDuplicates: request.allowDuplicates || true
|
9566
9516
|
};
|
9567
|
-
|
9568
|
-
|
9569
|
-
|
9570
|
-
_context17.n = 2;
|
9517
|
+
encodedTxData = this.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokensEncode(_object2);
|
9518
|
+
if (!((_request$txOptions9 = request.txOptions) !== null && _request$txOptions9 !== void 0 && _request$txOptions9.encodedTxDataOnly)) {
|
9519
|
+
_context16.n = 2;
|
9571
9520
|
break;
|
9572
9521
|
}
|
9573
|
-
return
|
9522
|
+
return _context16.a(2, {
|
9574
9523
|
encodedTxData: encodedTxData
|
9575
9524
|
});
|
9576
9525
|
case 2:
|
9577
9526
|
contractCall = /*#__PURE__*/function () {
|
9578
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
9579
|
-
return _regenerator().w(function (
|
9580
|
-
while (1) switch (
|
9527
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
|
9528
|
+
return _regenerator().w(function (_context15) {
|
9529
|
+
while (1) switch (_context15.n) {
|
9581
9530
|
case 0:
|
9582
|
-
return
|
9531
|
+
return _context15.a(2, _this8.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_object2));
|
9583
9532
|
}
|
9584
|
-
},
|
9533
|
+
}, _callee15);
|
9585
9534
|
}));
|
9586
9535
|
return function contractCall() {
|
9587
9536
|
return _ref4.apply(this, arguments);
|
9588
9537
|
};
|
9589
9538
|
}();
|
9590
|
-
return
|
9539
|
+
return _context16.a(2, this.handleRegistrationWithFees({
|
9591
9540
|
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options6 = request.options) === null || _request$options6 === void 0 ? void 0 : _request$options6.wipOptions), {}, {
|
9592
9541
|
// need to disable multicall to avoid needing to transfer the license
|
9593
9542
|
// token to the multicall contract.
|
9594
9543
|
useMulticallWhenPossible: false
|
9595
9544
|
}),
|
9596
9545
|
sender: this.walletAddress,
|
9597
|
-
spgNftContract:
|
9546
|
+
spgNftContract: _object2.spgNftContract,
|
9598
9547
|
spgSpenderAddress: this.derivativeWorkflowsClient.address,
|
9599
9548
|
encodedTxs: [encodedTxData],
|
9600
9549
|
contractCall: contractCall,
|
9601
9550
|
txOptions: request.txOptions
|
9602
9551
|
}));
|
9603
9552
|
case 3:
|
9604
|
-
|
9605
|
-
|
9606
|
-
return
|
9553
|
+
_context16.p = 3;
|
9554
|
+
_t22 = _context16.v;
|
9555
|
+
return _context16.a(2, handleError(_t22, "Failed to mint and register IP and make derivative with license tokens"));
|
9607
9556
|
}
|
9608
|
-
},
|
9557
|
+
}, _callee16, this, [[0, 3]]);
|
9609
9558
|
}));
|
9610
|
-
function mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(
|
9559
|
+
function mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_x14) {
|
9611
9560
|
return _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens.apply(this, arguments);
|
9612
9561
|
}
|
9613
9562
|
return mintAndRegisterIpAndMakeDerivativeWithLicenseTokens;
|
@@ -9621,14 +9570,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9621
9570
|
}, {
|
9622
9571
|
key: "registerIpAndMakeDerivativeWithLicenseTokens",
|
9623
9572
|
value: (function () {
|
9624
|
-
var _registerIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
9625
|
-
var _request$
|
9626
|
-
return _regenerator().w(function (
|
9627
|
-
while (1) switch (
|
9573
|
+
var _registerIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(request) {
|
9574
|
+
var _request$txOptions0, tokenId, ipIdAddress, isRegistered, licenseTokenIds, calculatedDeadline, signature, _object3, txHash, receipt, log, _t23;
|
9575
|
+
return _regenerator().w(function (_context17) {
|
9576
|
+
while (1) switch (_context17.p = _context17.n) {
|
9628
9577
|
case 0:
|
9629
|
-
|
9578
|
+
_context17.p = 0;
|
9630
9579
|
tokenId = BigInt(request.tokenId);
|
9631
|
-
|
9580
|
+
_context17.n = 1;
|
9632
9581
|
return getIpIdAddress({
|
9633
9582
|
nftContract: request.nftContract,
|
9634
9583
|
tokenId: tokenId,
|
@@ -9637,26 +9586,26 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9637
9586
|
chainId: this.chainId
|
9638
9587
|
});
|
9639
9588
|
case 1:
|
9640
|
-
ipIdAddress =
|
9641
|
-
|
9589
|
+
ipIdAddress = _context17.v;
|
9590
|
+
_context17.n = 2;
|
9642
9591
|
return this.isRegistered(ipIdAddress);
|
9643
9592
|
case 2:
|
9644
|
-
isRegistered =
|
9593
|
+
isRegistered = _context17.v;
|
9645
9594
|
if (!isRegistered) {
|
9646
|
-
|
9595
|
+
_context17.n = 3;
|
9647
9596
|
break;
|
9648
9597
|
}
|
9649
9598
|
throw new Error("The NFT with id ".concat(tokenId, " is already registered as IP."));
|
9650
9599
|
case 3:
|
9651
|
-
|
9600
|
+
_context17.n = 4;
|
9652
9601
|
return this.validateLicenseTokenIds(request.licenseTokenIds);
|
9653
9602
|
case 4:
|
9654
|
-
licenseTokenIds =
|
9655
|
-
|
9603
|
+
licenseTokenIds = _context17.v;
|
9604
|
+
_context17.n = 5;
|
9656
9605
|
return getCalculatedDeadline(this.rpcClient, request.deadline);
|
9657
9606
|
case 5:
|
9658
|
-
calculatedDeadline =
|
9659
|
-
|
9607
|
+
calculatedDeadline = _context17.v;
|
9608
|
+
_context17.n = 6;
|
9660
9609
|
return generateOperationSignature({
|
9661
9610
|
ipIdAddress: ipIdAddress,
|
9662
9611
|
methodType: SignatureMethodType.REGISTER_IP_AND_MAKE_DERIVATIVE_WITH_LICENSE_TOKENS,
|
@@ -9665,8 +9614,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9665
9614
|
chainId: this.chainId
|
9666
9615
|
});
|
9667
9616
|
case 6:
|
9668
|
-
signature =
|
9669
|
-
|
9617
|
+
signature = _context17.v;
|
9618
|
+
_object3 = _objectSpread2(_objectSpread2({}, request), {}, {
|
9670
9619
|
tokenId: tokenId,
|
9671
9620
|
licenseTokenIds: licenseTokenIds,
|
9672
9621
|
royaltyContext: viem.zeroAddress,
|
@@ -9676,44 +9625,43 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9676
9625
|
deadline: calculatedDeadline,
|
9677
9626
|
signature: signature
|
9678
9627
|
},
|
9679
|
-
maxRts:
|
9628
|
+
maxRts: validateMaxRts(request.maxRts)
|
9680
9629
|
});
|
9681
|
-
|
9682
|
-
|
9683
|
-
_context18.n = 7;
|
9630
|
+
if (!((_request$txOptions0 = request.txOptions) !== null && _request$txOptions0 !== void 0 && _request$txOptions0.encodedTxDataOnly)) {
|
9631
|
+
_context17.n = 7;
|
9684
9632
|
break;
|
9685
9633
|
}
|
9686
|
-
return
|
9687
|
-
encodedTxData: this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokensEncode(
|
9634
|
+
return _context17.a(2, {
|
9635
|
+
encodedTxData: this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokensEncode(_object3)
|
9688
9636
|
});
|
9689
9637
|
case 7:
|
9690
|
-
|
9691
|
-
return this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokens(
|
9638
|
+
_context17.n = 8;
|
9639
|
+
return this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokens(_object3);
|
9692
9640
|
case 8:
|
9693
|
-
txHash =
|
9694
|
-
|
9641
|
+
txHash = _context17.v;
|
9642
|
+
_context17.n = 9;
|
9695
9643
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
9696
9644
|
hash: txHash
|
9697
9645
|
}));
|
9698
9646
|
case 9:
|
9699
|
-
receipt =
|
9647
|
+
receipt = _context17.v;
|
9700
9648
|
log = this.getIpIdAndTokenIdsFromEvent(receipt)[0];
|
9701
|
-
return
|
9649
|
+
return _context17.a(2, _objectSpread2({
|
9702
9650
|
txHash: txHash
|
9703
9651
|
}, log));
|
9704
9652
|
case 10:
|
9705
|
-
|
9653
|
+
_context17.n = 12;
|
9706
9654
|
break;
|
9707
9655
|
case 11:
|
9708
|
-
|
9709
|
-
|
9710
|
-
return
|
9656
|
+
_context17.p = 11;
|
9657
|
+
_t23 = _context17.v;
|
9658
|
+
return _context17.a(2, handleError(_t23, "Failed to register IP and make derivative with license tokens"));
|
9711
9659
|
case 12:
|
9712
|
-
return
|
9660
|
+
return _context17.a(2);
|
9713
9661
|
}
|
9714
|
-
},
|
9662
|
+
}, _callee17, this, [[0, 11]]);
|
9715
9663
|
}));
|
9716
|
-
function registerIpAndMakeDerivativeWithLicenseTokens(
|
9664
|
+
function registerIpAndMakeDerivativeWithLicenseTokens(_x15) {
|
9717
9665
|
return _registerIpAndMakeDerivativeWithLicenseTokens.apply(this, arguments);
|
9718
9666
|
}
|
9719
9667
|
return registerIpAndMakeDerivativeWithLicenseTokens;
|
@@ -9729,23 +9677,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9729
9677
|
}, {
|
9730
9678
|
key: "registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens",
|
9731
9679
|
value: (function () {
|
9732
|
-
var _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
9733
|
-
var _getRoyaltyShares, royaltyShares, totalAmount, _yield$
|
9734
|
-
return _regenerator().w(function (
|
9735
|
-
while (1) switch (
|
9680
|
+
var _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(request) {
|
9681
|
+
var _getRoyaltyShares, royaltyShares, totalAmount, _yield$validateLicens2, licenseTerms, calculatedDeadline, ipIdAddress, isRegistered, _yield$transformRegis5, _transformRequest4, registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash, txReceipt, ipId, licenseTermsIds, ipRoyaltyVault, distributeRoyaltyTokensTxHash, maxLicenseTokensTxHashes, _t24;
|
9682
|
+
return _regenerator().w(function (_context18) {
|
9683
|
+
while (1) switch (_context18.p = _context18.n) {
|
9736
9684
|
case 0:
|
9737
|
-
|
9685
|
+
_context18.p = 0;
|
9738
9686
|
_getRoyaltyShares = getRoyaltyShares(request.royaltyShares), royaltyShares = _getRoyaltyShares.royaltyShares, totalAmount = _getRoyaltyShares.totalAmount;
|
9739
|
-
|
9687
|
+
_context18.n = 1;
|
9740
9688
|
return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
|
9741
9689
|
case 1:
|
9742
|
-
_yield$
|
9743
|
-
licenseTerms = _yield$
|
9744
|
-
|
9690
|
+
_yield$validateLicens2 = _context18.v;
|
9691
|
+
licenseTerms = _yield$validateLicens2.licenseTerms;
|
9692
|
+
_context18.n = 2;
|
9745
9693
|
return getCalculatedDeadline(this.rpcClient, request.deadline);
|
9746
9694
|
case 2:
|
9747
|
-
calculatedDeadline =
|
9748
|
-
|
9695
|
+
calculatedDeadline = _context18.v;
|
9696
|
+
_context18.n = 3;
|
9749
9697
|
return getIpIdAddress({
|
9750
9698
|
nftContract: validateAddress(request.nftContract),
|
9751
9699
|
tokenId: BigInt(request.tokenId),
|
@@ -9754,18 +9702,18 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9754
9702
|
chainId: this.chainId
|
9755
9703
|
});
|
9756
9704
|
case 3:
|
9757
|
-
ipIdAddress =
|
9758
|
-
|
9705
|
+
ipIdAddress = _context18.v;
|
9706
|
+
_context18.n = 4;
|
9759
9707
|
return this.isRegistered(ipIdAddress);
|
9760
9708
|
case 4:
|
9761
|
-
isRegistered =
|
9709
|
+
isRegistered = _context18.v;
|
9762
9710
|
if (!isRegistered) {
|
9763
|
-
|
9711
|
+
_context18.n = 5;
|
9764
9712
|
break;
|
9765
9713
|
}
|
9766
9714
|
throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
|
9767
9715
|
case 5:
|
9768
|
-
|
9716
|
+
_context18.n = 6;
|
9769
9717
|
return transformRegistrationRequest({
|
9770
9718
|
request: request,
|
9771
9719
|
rpcClient: this.rpcClient,
|
@@ -9773,25 +9721,25 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9773
9721
|
chainId: this.chainId
|
9774
9722
|
});
|
9775
9723
|
case 6:
|
9776
|
-
_yield$transformRegis5 =
|
9724
|
+
_yield$transformRegis5 = _context18.v;
|
9777
9725
|
_transformRequest4 = _yield$transformRegis5.transformRequest;
|
9778
|
-
|
9726
|
+
_context18.n = 7;
|
9779
9727
|
return this.royaltyTokenDistributionWorkflowsClient.registerIpAndAttachPilTermsAndDeployRoyaltyVault(_transformRequest4);
|
9780
9728
|
case 7:
|
9781
|
-
registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash =
|
9782
|
-
|
9729
|
+
registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash = _context18.v;
|
9730
|
+
_context18.n = 8;
|
9783
9731
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
9784
9732
|
hash: registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash
|
9785
9733
|
}));
|
9786
9734
|
case 8:
|
9787
|
-
txReceipt =
|
9735
|
+
txReceipt = _context18.v;
|
9788
9736
|
ipId = this.getIpIdAndTokenIdsFromEvent(txReceipt)[0].ipId;
|
9789
|
-
|
9737
|
+
_context18.n = 9;
|
9790
9738
|
return this.getLicenseTermsId(licenseTerms);
|
9791
9739
|
case 9:
|
9792
|
-
licenseTermsIds =
|
9740
|
+
licenseTermsIds = _context18.v;
|
9793
9741
|
ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(txReceipt)[0].ipRoyaltyVault;
|
9794
|
-
|
9742
|
+
_context18.n = 10;
|
9795
9743
|
return this.distributeRoyaltyTokens({
|
9796
9744
|
ipId: ipId,
|
9797
9745
|
deadline: calculatedDeadline,
|
@@ -9801,21 +9749,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9801
9749
|
txOptions: request.txOptions
|
9802
9750
|
});
|
9803
9751
|
case 10:
|
9804
|
-
distributeRoyaltyTokensTxHash =
|
9805
|
-
|
9752
|
+
distributeRoyaltyTokensTxHash = _context18.v;
|
9753
|
+
_context18.n = 11;
|
9806
9754
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
9807
9755
|
hash: distributeRoyaltyTokensTxHash
|
9808
9756
|
}));
|
9809
9757
|
case 11:
|
9810
|
-
|
9811
|
-
return
|
9758
|
+
_context18.n = 12;
|
9759
|
+
return setMaxLicenseTokens({
|
9812
9760
|
maxLicenseTokensData: request.licenseTermsData,
|
9813
9761
|
licensorIpId: ipId,
|
9814
|
-
licenseTermsIds: licenseTermsIds
|
9762
|
+
licenseTermsIds: licenseTermsIds,
|
9763
|
+
totalLicenseTokenLimitHookClient: this.totalLicenseTokenLimitHookClient,
|
9764
|
+
templateAddress: this.licenseTemplateAddress
|
9815
9765
|
});
|
9816
9766
|
case 12:
|
9817
|
-
maxLicenseTokensTxHashes =
|
9818
|
-
return
|
9767
|
+
maxLicenseTokensTxHashes = _context18.v;
|
9768
|
+
return _context18.a(2, _objectSpread2({
|
9819
9769
|
registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash: registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash,
|
9820
9770
|
distributeRoyaltyTokensTxHash: distributeRoyaltyTokensTxHash,
|
9821
9771
|
ipId: ipId,
|
@@ -9825,13 +9775,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9825
9775
|
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
9826
9776
|
}));
|
9827
9777
|
case 13:
|
9828
|
-
|
9829
|
-
|
9830
|
-
return
|
9778
|
+
_context18.p = 13;
|
9779
|
+
_t24 = _context18.v;
|
9780
|
+
return _context18.a(2, handleError(_t24, "Failed to register IP and attach license terms and distribute royalty tokens"));
|
9831
9781
|
}
|
9832
|
-
},
|
9782
|
+
}, _callee18, this, [[0, 13]]);
|
9833
9783
|
}));
|
9834
|
-
function registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(
|
9784
|
+
function registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x16) {
|
9835
9785
|
return _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens.apply(this, arguments);
|
9836
9786
|
}
|
9837
9787
|
return registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens;
|
@@ -9846,14 +9796,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9846
9796
|
}, {
|
9847
9797
|
key: "registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens",
|
9848
9798
|
value: (function () {
|
9849
|
-
var _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
9799
|
+
var _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(request) {
|
9850
9800
|
var _this9 = this;
|
9851
|
-
var _request$options7, ipIdAddress, _yield$transformRegis6, _transformRequest5, _getRoyaltyShares2, royaltyShares, totalAmount, isRegistered, encodedTxData, contractCall, _yield$this$handleReg, txHash, ipId, tokenId, receipt, ipRoyaltyVault, distributeRoyaltyTokensTxHash,
|
9852
|
-
return _regenerator().w(function (
|
9853
|
-
while (1) switch (
|
9801
|
+
var _request$options7, ipIdAddress, _yield$transformRegis6, _transformRequest5, _getRoyaltyShares2, royaltyShares, totalAmount, isRegistered, encodedTxData, contractCall, _yield$this$handleReg, txHash, ipId, tokenId, receipt, ipRoyaltyVault, distributeRoyaltyTokensTxHash, _t25;
|
9802
|
+
return _regenerator().w(function (_context19) {
|
9803
|
+
while (1) switch (_context19.p = _context19.n) {
|
9854
9804
|
case 0:
|
9855
|
-
|
9856
|
-
|
9805
|
+
_context19.p = 0;
|
9806
|
+
_context19.n = 1;
|
9857
9807
|
return getIpIdAddress({
|
9858
9808
|
nftContract: validateAddress(request.nftContract),
|
9859
9809
|
tokenId: BigInt(request.tokenId),
|
@@ -9862,8 +9812,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9862
9812
|
chainId: this.chainId
|
9863
9813
|
});
|
9864
9814
|
case 1:
|
9865
|
-
ipIdAddress =
|
9866
|
-
|
9815
|
+
ipIdAddress = _context19.v;
|
9816
|
+
_context19.n = 2;
|
9867
9817
|
return transformRegistrationRequest({
|
9868
9818
|
request: request,
|
9869
9819
|
rpcClient: this.rpcClient,
|
@@ -9871,15 +9821,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9871
9821
|
chainId: this.chainId
|
9872
9822
|
});
|
9873
9823
|
case 2:
|
9874
|
-
_yield$transformRegis6 =
|
9824
|
+
_yield$transformRegis6 = _context19.v;
|
9875
9825
|
_transformRequest5 = _yield$transformRegis6.transformRequest;
|
9876
9826
|
_getRoyaltyShares2 = getRoyaltyShares(request.royaltyShares), royaltyShares = _getRoyaltyShares2.royaltyShares, totalAmount = _getRoyaltyShares2.totalAmount;
|
9877
|
-
|
9827
|
+
_context19.n = 3;
|
9878
9828
|
return this.isRegistered(ipIdAddress);
|
9879
9829
|
case 3:
|
9880
|
-
isRegistered =
|
9830
|
+
isRegistered = _context19.v;
|
9881
9831
|
if (!isRegistered) {
|
9882
|
-
|
9832
|
+
_context19.n = 4;
|
9883
9833
|
break;
|
9884
9834
|
}
|
9885
9835
|
throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
|
@@ -9888,7 +9838,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9888
9838
|
contractCall = function contractCall() {
|
9889
9839
|
return _this9.royaltyTokenDistributionWorkflowsClient.registerIpAndMakeDerivativeAndDeployRoyaltyVault(_transformRequest5);
|
9890
9840
|
};
|
9891
|
-
|
9841
|
+
_context19.n = 5;
|
9892
9842
|
return this.handleRegistrationWithFees({
|
9893
9843
|
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options7 = request.options) === null || _request$options7 === void 0 ? void 0 : _request$options7.wipOptions), {}, {
|
9894
9844
|
useMulticallWhenPossible: false
|
@@ -9901,13 +9851,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9901
9851
|
txOptions: _objectSpread2({}, request.txOptions)
|
9902
9852
|
});
|
9903
9853
|
case 5:
|
9904
|
-
_yield$this$handleReg =
|
9854
|
+
_yield$this$handleReg = _context19.v;
|
9905
9855
|
txHash = _yield$this$handleReg.txHash;
|
9906
9856
|
ipId = _yield$this$handleReg.ipId;
|
9907
9857
|
tokenId = _yield$this$handleReg.tokenId;
|
9908
9858
|
receipt = _yield$this$handleReg.receipt;
|
9909
9859
|
if (!(tokenId === undefined || !ipId || !receipt)) {
|
9910
|
-
|
9860
|
+
_context19.n = 6;
|
9911
9861
|
break;
|
9912
9862
|
}
|
9913
9863
|
throw new Error("Failed to register derivative ip and deploy royalty vault.");
|
@@ -9915,7 +9865,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9915
9865
|
ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt).filter(function (item) {
|
9916
9866
|
return item.ipId === ipId;
|
9917
9867
|
})[0].ipRoyaltyVault;
|
9918
|
-
|
9868
|
+
_context19.n = 7;
|
9919
9869
|
return this.distributeRoyaltyTokens({
|
9920
9870
|
ipId: ipId,
|
9921
9871
|
deadline: request.deadline,
|
@@ -9925,13 +9875,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9925
9875
|
txOptions: request.txOptions
|
9926
9876
|
});
|
9927
9877
|
case 7:
|
9928
|
-
distributeRoyaltyTokensTxHash =
|
9929
|
-
|
9878
|
+
distributeRoyaltyTokensTxHash = _context19.v;
|
9879
|
+
_context19.n = 8;
|
9930
9880
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
9931
9881
|
hash: distributeRoyaltyTokensTxHash
|
9932
9882
|
}));
|
9933
9883
|
case 8:
|
9934
|
-
return
|
9884
|
+
return _context19.a(2, {
|
9935
9885
|
registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokensTxHash: txHash,
|
9936
9886
|
distributeRoyaltyTokensTxHash: distributeRoyaltyTokensTxHash,
|
9937
9887
|
ipId: ipId,
|
@@ -9939,13 +9889,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9939
9889
|
ipRoyaltyVault: ipRoyaltyVault
|
9940
9890
|
});
|
9941
9891
|
case 9:
|
9942
|
-
|
9943
|
-
|
9944
|
-
return
|
9892
|
+
_context19.p = 9;
|
9893
|
+
_t25 = _context19.v;
|
9894
|
+
return _context19.a(2, handleError(_t25, "Failed to register derivative IP and attach license terms and distribute royalty tokens"));
|
9945
9895
|
}
|
9946
|
-
},
|
9896
|
+
}, _callee19, this, [[0, 9]]);
|
9947
9897
|
}));
|
9948
|
-
function registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(
|
9898
|
+
function registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x17) {
|
9949
9899
|
return _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens.apply(this, arguments);
|
9950
9900
|
}
|
9951
9901
|
return registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens;
|
@@ -9959,19 +9909,19 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9959
9909
|
}, {
|
9960
9910
|
key: "mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens",
|
9961
9911
|
value: (function () {
|
9962
|
-
var _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
9912
|
+
var _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(request) {
|
9963
9913
|
var _this0 = this;
|
9964
|
-
var _request$options8, _yield$
|
9965
|
-
return _regenerator().w(function (
|
9966
|
-
while (1) switch (
|
9914
|
+
var _request$options8, _yield$validateLicens3, licenseTerms, _yield$transformRegis7, _transformRequest6, encodedTxData, contractCall, _yield$this$handleReg2, txHash, ipId, tokenId, receipt, licenseTermsIds, ipRoyaltyVault, maxLicenseTokensTxHashes, _t26;
|
9915
|
+
return _regenerator().w(function (_context20) {
|
9916
|
+
while (1) switch (_context20.p = _context20.n) {
|
9967
9917
|
case 0:
|
9968
|
-
|
9969
|
-
|
9918
|
+
_context20.p = 0;
|
9919
|
+
_context20.n = 1;
|
9970
9920
|
return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
|
9971
9921
|
case 1:
|
9972
|
-
_yield$
|
9973
|
-
licenseTerms = _yield$
|
9974
|
-
|
9922
|
+
_yield$validateLicens3 = _context20.v;
|
9923
|
+
licenseTerms = _yield$validateLicens3.licenseTerms;
|
9924
|
+
_context20.n = 2;
|
9975
9925
|
return transformRegistrationRequest({
|
9976
9926
|
request: request,
|
9977
9927
|
rpcClient: this.rpcClient,
|
@@ -9979,13 +9929,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9979
9929
|
chainId: this.chainId
|
9980
9930
|
});
|
9981
9931
|
case 2:
|
9982
|
-
_yield$transformRegis7 =
|
9932
|
+
_yield$transformRegis7 = _context20.v;
|
9983
9933
|
_transformRequest6 = _yield$transformRegis7.transformRequest;
|
9984
9934
|
encodedTxData = this.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokensEncode(_transformRequest6);
|
9985
9935
|
contractCall = function contractCall() {
|
9986
9936
|
return _this0.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_transformRequest6);
|
9987
9937
|
};
|
9988
|
-
|
9938
|
+
_context20.n = 3;
|
9989
9939
|
return this.handleRegistrationWithFees({
|
9990
9940
|
wipOptions: (_request$options8 = request.options) === null || _request$options8 === void 0 ? void 0 : _request$options8.wipOptions,
|
9991
9941
|
sender: this.walletAddress,
|
@@ -9996,33 +9946,35 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
9996
9946
|
txOptions: request.txOptions
|
9997
9947
|
});
|
9998
9948
|
case 3:
|
9999
|
-
_yield$this$handleReg2 =
|
9949
|
+
_yield$this$handleReg2 = _context20.v;
|
10000
9950
|
txHash = _yield$this$handleReg2.txHash;
|
10001
9951
|
ipId = _yield$this$handleReg2.ipId;
|
10002
9952
|
tokenId = _yield$this$handleReg2.tokenId;
|
10003
9953
|
receipt = _yield$this$handleReg2.receipt;
|
10004
9954
|
if (receipt) {
|
10005
|
-
|
9955
|
+
_context20.n = 4;
|
10006
9956
|
break;
|
10007
9957
|
}
|
10008
|
-
return
|
9958
|
+
return _context20.a(2, {
|
10009
9959
|
txHash: txHash
|
10010
9960
|
});
|
10011
9961
|
case 4:
|
10012
|
-
|
9962
|
+
_context20.n = 5;
|
10013
9963
|
return this.getLicenseTermsId(licenseTerms);
|
10014
9964
|
case 5:
|
10015
|
-
licenseTermsIds =
|
9965
|
+
licenseTermsIds = _context20.v;
|
10016
9966
|
ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt)[0].ipRoyaltyVault;
|
10017
|
-
|
10018
|
-
return
|
9967
|
+
_context20.n = 6;
|
9968
|
+
return setMaxLicenseTokens({
|
10019
9969
|
maxLicenseTokensData: request.licenseTermsData,
|
10020
9970
|
licensorIpId: ipId,
|
10021
|
-
licenseTermsIds: licenseTermsIds
|
9971
|
+
licenseTermsIds: licenseTermsIds,
|
9972
|
+
totalLicenseTokenLimitHookClient: this.totalLicenseTokenLimitHookClient,
|
9973
|
+
templateAddress: this.licenseTemplateAddress
|
10022
9974
|
});
|
10023
9975
|
case 6:
|
10024
|
-
maxLicenseTokensTxHashes =
|
10025
|
-
return
|
9976
|
+
maxLicenseTokensTxHashes = _context20.v;
|
9977
|
+
return _context20.a(2, _objectSpread2({
|
10026
9978
|
txHash: txHash,
|
10027
9979
|
ipId: ipId,
|
10028
9980
|
licenseTermsIds: licenseTermsIds,
|
@@ -10032,13 +9984,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10032
9984
|
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
10033
9985
|
}));
|
10034
9986
|
case 7:
|
10035
|
-
|
10036
|
-
|
10037
|
-
return
|
9987
|
+
_context20.p = 7;
|
9988
|
+
_t26 = _context20.v;
|
9989
|
+
return _context20.a(2, handleError(_t26, "Failed to mint and register IP and attach PIL terms and distribute royalty tokens"));
|
10038
9990
|
}
|
10039
|
-
},
|
9991
|
+
}, _callee20, this, [[0, 7]]);
|
10040
9992
|
}));
|
10041
|
-
function mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(
|
9993
|
+
function mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_x18) {
|
10042
9994
|
return _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens.apply(this, arguments);
|
10043
9995
|
}
|
10044
9996
|
return mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens;
|
@@ -10052,14 +10004,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10052
10004
|
}, {
|
10053
10005
|
key: "mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens",
|
10054
10006
|
value: (function () {
|
10055
|
-
var _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
10007
|
+
var _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(request) {
|
10056
10008
|
var _this1 = this;
|
10057
|
-
var _request$options9, _yield$transformRegis8, _transformRequest7, encodedTxData, contractCall,
|
10058
|
-
return _regenerator().w(function (
|
10059
|
-
while (1) switch (
|
10009
|
+
var _request$options9, _yield$transformRegis8, _transformRequest7, encodedTxData, contractCall, _t27;
|
10010
|
+
return _regenerator().w(function (_context21) {
|
10011
|
+
while (1) switch (_context21.p = _context21.n) {
|
10060
10012
|
case 0:
|
10061
|
-
|
10062
|
-
|
10013
|
+
_context21.p = 0;
|
10014
|
+
_context21.n = 1;
|
10063
10015
|
return transformRegistrationRequest({
|
10064
10016
|
request: request,
|
10065
10017
|
rpcClient: this.rpcClient,
|
@@ -10067,13 +10019,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10067
10019
|
chainId: this.chainId
|
10068
10020
|
});
|
10069
10021
|
case 1:
|
10070
|
-
_yield$transformRegis8 =
|
10022
|
+
_yield$transformRegis8 = _context21.v;
|
10071
10023
|
_transformRequest7 = _yield$transformRegis8.transformRequest;
|
10072
10024
|
encodedTxData = this.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokensEncode(_transformRequest7);
|
10073
10025
|
contractCall = function contractCall() {
|
10074
10026
|
return _this1.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_transformRequest7);
|
10075
10027
|
};
|
10076
|
-
|
10028
|
+
_context21.n = 2;
|
10077
10029
|
return this.handleRegistrationWithFees({
|
10078
10030
|
spgNftContract: _transformRequest7.spgNftContract,
|
10079
10031
|
wipOptions: (_request$options9 = request.options) === null || _request$options9 === void 0 ? void 0 : _request$options9.wipOptions,
|
@@ -10085,15 +10037,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10085
10037
|
txOptions: request.txOptions
|
10086
10038
|
});
|
10087
10039
|
case 2:
|
10088
|
-
return
|
10040
|
+
return _context21.a(2, _context21.v);
|
10089
10041
|
case 3:
|
10090
|
-
|
10091
|
-
|
10092
|
-
return
|
10042
|
+
_context21.p = 3;
|
10043
|
+
_t27 = _context21.v;
|
10044
|
+
return _context21.a(2, handleError(_t27, "Failed to mint and register IP and make derivative and distribute royalty tokens"));
|
10093
10045
|
}
|
10094
|
-
},
|
10046
|
+
}, _callee21, this, [[0, 3]]);
|
10095
10047
|
}));
|
10096
|
-
function mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(
|
10048
|
+
function mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_x19) {
|
10097
10049
|
return _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens.apply(this, arguments);
|
10098
10050
|
}
|
10099
10051
|
return mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens;
|
@@ -10101,12 +10053,12 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10101
10053
|
}, {
|
10102
10054
|
key: "distributeRoyaltyTokens",
|
10103
10055
|
value: function () {
|
10104
|
-
var _distributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
10056
|
+
var _distributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(request) {
|
10105
10057
|
var _yield$transferDistri, transformRequest, txHash;
|
10106
|
-
return _regenerator().w(function (
|
10107
|
-
while (1) switch (
|
10058
|
+
return _regenerator().w(function (_context22) {
|
10059
|
+
while (1) switch (_context22.n) {
|
10108
10060
|
case 0:
|
10109
|
-
|
10061
|
+
_context22.n = 1;
|
10110
10062
|
return transferDistributeRoyaltyTokensRequest({
|
10111
10063
|
request: request,
|
10112
10064
|
rpcClient: this.rpcClient,
|
@@ -10114,22 +10066,22 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10114
10066
|
chainId: this.chainId
|
10115
10067
|
});
|
10116
10068
|
case 1:
|
10117
|
-
_yield$transferDistri =
|
10069
|
+
_yield$transferDistri = _context22.v;
|
10118
10070
|
transformRequest = _yield$transferDistri.transformRequest;
|
10119
|
-
|
10071
|
+
_context22.n = 2;
|
10120
10072
|
return this.royaltyTokenDistributionWorkflowsClient.distributeRoyaltyTokens(transformRequest);
|
10121
10073
|
case 2:
|
10122
|
-
txHash =
|
10123
|
-
|
10074
|
+
txHash = _context22.v;
|
10075
|
+
_context22.n = 3;
|
10124
10076
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
10125
10077
|
hash: txHash
|
10126
10078
|
}));
|
10127
10079
|
case 3:
|
10128
|
-
return
|
10080
|
+
return _context22.a(2, txHash);
|
10129
10081
|
}
|
10130
|
-
},
|
10082
|
+
}, _callee22, this);
|
10131
10083
|
}));
|
10132
|
-
function distributeRoyaltyTokens(
|
10084
|
+
function distributeRoyaltyTokens(_x20) {
|
10133
10085
|
return _distributeRoyaltyTokens.apply(this, arguments);
|
10134
10086
|
}
|
10135
10087
|
return distributeRoyaltyTokens;
|
@@ -10137,20 +10089,20 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10137
10089
|
}, {
|
10138
10090
|
key: "isRegistered",
|
10139
10091
|
value: function () {
|
10140
|
-
var _isRegistered = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
10141
|
-
return _regenerator().w(function (
|
10142
|
-
while (1) switch (
|
10092
|
+
var _isRegistered = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(ipId) {
|
10093
|
+
return _regenerator().w(function (_context23) {
|
10094
|
+
while (1) switch (_context23.n) {
|
10143
10095
|
case 0:
|
10144
|
-
|
10096
|
+
_context23.n = 1;
|
10145
10097
|
return this.ipAssetRegistryClient.isRegistered({
|
10146
10098
|
id: validateAddress(ipId)
|
10147
10099
|
});
|
10148
10100
|
case 1:
|
10149
|
-
return
|
10101
|
+
return _context23.a(2, _context23.v);
|
10150
10102
|
}
|
10151
|
-
},
|
10103
|
+
}, _callee23, this);
|
10152
10104
|
}));
|
10153
|
-
function isRegistered(
|
10105
|
+
function isRegistered(_x21) {
|
10154
10106
|
return _isRegistered.apply(this, arguments);
|
10155
10107
|
}
|
10156
10108
|
return isRegistered;
|
@@ -10194,24 +10146,24 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10194
10146
|
}, {
|
10195
10147
|
key: "batchRegisterIpAssetsWithOptimizedWorkflows",
|
10196
10148
|
value: (function () {
|
10197
|
-
var _batchRegisterIpAssetsWithOptimizedWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
10198
|
-
var _request$options0, _request$options10, transferWorkflowRequests, _iterator6, _step6, req, res, royaltyDistributionRequests, _yield$handleMultical, txResponses, aggregateRegistrationRequest, responses, royaltyTokensDistributionRequests, _iterator7, _step7, _step7$value, txHash, receipt, iPRegisteredLog, ipRoyaltyVaultEvent, response, distributeRoyaltyTokensTxHashes, _request$options1, _yield$handleMultical2, txResponse, registrationResults, _t29, _t30
|
10199
|
-
return _regenerator().w(function (
|
10200
|
-
while (1) switch (
|
10149
|
+
var _batchRegisterIpAssetsWithOptimizedWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(request) {
|
10150
|
+
var _request$options0, _request$options10, transferWorkflowRequests, _iterator6, _step6, req, res, royaltyDistributionRequests, _yield$handleMultical, txResponses, aggregateRegistrationRequest, responses, royaltyTokensDistributionRequests, _iterator7, _step7, _step7$value, txHash, receipt, iPRegisteredLog, ipRoyaltyVaultEvent, response, distributeRoyaltyTokensTxHashes, _request$options1, _yield$handleMultical2, txResponse, registrationResults, _t28, _t29, _t30;
|
10151
|
+
return _regenerator().w(function (_context24) {
|
10152
|
+
while (1) switch (_context24.p = _context24.n) {
|
10201
10153
|
case 0:
|
10202
|
-
|
10154
|
+
_context24.p = 0;
|
10203
10155
|
// Transform requests into workflow format
|
10204
10156
|
transferWorkflowRequests = [];
|
10205
10157
|
_iterator6 = _createForOfIteratorHelper(request.requests);
|
10206
|
-
|
10158
|
+
_context24.p = 1;
|
10207
10159
|
_iterator6.s();
|
10208
10160
|
case 2:
|
10209
10161
|
if ((_step6 = _iterator6.n()).done) {
|
10210
|
-
|
10162
|
+
_context24.n = 5;
|
10211
10163
|
break;
|
10212
10164
|
}
|
10213
10165
|
req = _step6.value;
|
10214
|
-
|
10166
|
+
_context24.n = 3;
|
10215
10167
|
return transformRegistrationRequest({
|
10216
10168
|
request: req,
|
10217
10169
|
rpcClient: this.rpcClient,
|
@@ -10219,22 +10171,22 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10219
10171
|
chainId: this.chainId
|
10220
10172
|
});
|
10221
10173
|
case 3:
|
10222
|
-
res =
|
10174
|
+
res = _context24.v;
|
10223
10175
|
transferWorkflowRequests.push(res);
|
10224
10176
|
case 4:
|
10225
|
-
|
10177
|
+
_context24.n = 2;
|
10226
10178
|
break;
|
10227
10179
|
case 5:
|
10228
|
-
|
10180
|
+
_context24.n = 7;
|
10229
10181
|
break;
|
10230
10182
|
case 6:
|
10231
|
-
|
10232
|
-
|
10233
|
-
_iterator6.e(
|
10183
|
+
_context24.p = 6;
|
10184
|
+
_t28 = _context24.v;
|
10185
|
+
_iterator6.e(_t28);
|
10234
10186
|
case 7:
|
10235
|
-
|
10187
|
+
_context24.p = 7;
|
10236
10188
|
_iterator6.f();
|
10237
|
-
return
|
10189
|
+
return _context24.f(7);
|
10238
10190
|
case 8:
|
10239
10191
|
/**
|
10240
10192
|
* Extract royalty distribution requests from workflow responses that contain royalty shares
|
@@ -10252,7 +10204,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10252
10204
|
deadline: res.extraData.deadline
|
10253
10205
|
};
|
10254
10206
|
}); // Process initial registration transactions
|
10255
|
-
|
10207
|
+
_context24.n = 9;
|
10256
10208
|
return handleMulticall({
|
10257
10209
|
transferWorkflowRequests: transferWorkflowRequests,
|
10258
10210
|
multicall3Address: this.multicall3Client.address,
|
@@ -10263,23 +10215,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10263
10215
|
chainId: this.chainId
|
10264
10216
|
});
|
10265
10217
|
case 9:
|
10266
|
-
_yield$handleMultical =
|
10218
|
+
_yield$handleMultical = _context24.v;
|
10267
10219
|
txResponses = _yield$handleMultical.response;
|
10268
10220
|
aggregateRegistrationRequest = _yield$handleMultical.aggregateRegistrationRequest;
|
10269
10221
|
responses = [];
|
10270
10222
|
royaltyTokensDistributionRequests = []; // Process each transaction response
|
10271
10223
|
_iterator7 = _createForOfIteratorHelper(txResponses);
|
10272
|
-
|
10224
|
+
_context24.p = 10;
|
10273
10225
|
_iterator7.s();
|
10274
10226
|
case 11:
|
10275
10227
|
if ((_step7 = _iterator7.n()).done) {
|
10276
|
-
|
10228
|
+
_context24.n = 14;
|
10277
10229
|
break;
|
10278
10230
|
}
|
10279
10231
|
_step7$value = _step7.value, txHash = _step7$value.txHash, receipt = _step7$value.receipt;
|
10280
10232
|
iPRegisteredLog = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(receipt);
|
10281
10233
|
ipRoyaltyVaultEvent = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt); // Prepare royalty distribution if needed
|
10282
|
-
|
10234
|
+
_context24.n = 12;
|
10283
10235
|
return prepareRoyaltyTokensDistributionRequests({
|
10284
10236
|
royaltyDistributionRequests: royaltyDistributionRequests,
|
10285
10237
|
ipRegisteredLog: iPRegisteredLog,
|
@@ -10289,7 +10241,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10289
10241
|
chainId: this.chainId
|
10290
10242
|
});
|
10291
10243
|
case 12:
|
10292
|
-
response =
|
10244
|
+
response = _context24.v;
|
10293
10245
|
royaltyTokensDistributionRequests.push.apply(royaltyTokensDistributionRequests, _toConsumableArray(response));
|
10294
10246
|
responses.push({
|
10295
10247
|
txHash: txHash,
|
@@ -10302,25 +10254,25 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10302
10254
|
})
|
10303
10255
|
});
|
10304
10256
|
case 13:
|
10305
|
-
|
10257
|
+
_context24.n = 11;
|
10306
10258
|
break;
|
10307
10259
|
case 14:
|
10308
|
-
|
10260
|
+
_context24.n = 16;
|
10309
10261
|
break;
|
10310
10262
|
case 15:
|
10311
|
-
|
10312
|
-
|
10313
|
-
_iterator7.e(
|
10263
|
+
_context24.p = 15;
|
10264
|
+
_t29 = _context24.v;
|
10265
|
+
_iterator7.e(_t29);
|
10314
10266
|
case 16:
|
10315
|
-
|
10267
|
+
_context24.p = 16;
|
10316
10268
|
_iterator7.f();
|
10317
|
-
return
|
10269
|
+
return _context24.f(16);
|
10318
10270
|
case 17:
|
10319
10271
|
if (!(royaltyTokensDistributionRequests.length > 0)) {
|
10320
|
-
|
10272
|
+
_context24.n = 19;
|
10321
10273
|
break;
|
10322
10274
|
}
|
10323
|
-
|
10275
|
+
_context24.n = 18;
|
10324
10276
|
return handleMulticall({
|
10325
10277
|
transferWorkflowRequests: royaltyTokensDistributionRequests,
|
10326
10278
|
multicall3Address: this.multicall3Client.address,
|
@@ -10331,315 +10283,776 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10331
10283
|
chainId: this.chainId
|
10332
10284
|
});
|
10333
10285
|
case 18:
|
10334
|
-
_yield$handleMultical2 =
|
10286
|
+
_yield$handleMultical2 = _context24.v;
|
10335
10287
|
txResponse = _yield$handleMultical2.response;
|
10336
10288
|
distributeRoyaltyTokensTxHashes = txResponse.map(function (tx) {
|
10337
10289
|
return tx.txHash;
|
10338
10290
|
});
|
10339
10291
|
case 19:
|
10340
|
-
|
10292
|
+
_context24.n = 20;
|
10341
10293
|
return this.processResponses(responses, aggregateRegistrationRequest, ((_request$options10 = request.options) === null || _request$options10 === void 0 || (_request$options10 = _request$options10.wipOptions) === null || _request$options10 === void 0 ? void 0 : _request$options10.useMulticallWhenPossible) !== false);
|
10342
10294
|
case 20:
|
10343
|
-
registrationResults =
|
10344
|
-
return
|
10295
|
+
registrationResults = _context24.v;
|
10296
|
+
return _context24.a(2, _objectSpread2({
|
10345
10297
|
registrationResults: registrationResults
|
10346
10298
|
}, distributeRoyaltyTokensTxHashes && {
|
10347
10299
|
distributeRoyaltyTokensTxHashes: distributeRoyaltyTokensTxHashes
|
10348
10300
|
}));
|
10349
10301
|
case 21:
|
10350
|
-
|
10351
|
-
|
10352
|
-
return
|
10302
|
+
_context24.p = 21;
|
10303
|
+
_t30 = _context24.v;
|
10304
|
+
return _context24.a(2, handleError(_t30, "Failed to batch register IP assets with optimized workflows"));
|
10353
10305
|
}
|
10354
|
-
},
|
10306
|
+
}, _callee24, this, [[10, 15, 16, 17], [1, 6, 7, 8], [0, 21]]);
|
10355
10307
|
}));
|
10356
|
-
function batchRegisterIpAssetsWithOptimizedWorkflows(
|
10308
|
+
function batchRegisterIpAssetsWithOptimizedWorkflows(_x22) {
|
10357
10309
|
return _batchRegisterIpAssetsWithOptimizedWorkflows.apply(this, arguments);
|
10358
10310
|
}
|
10359
10311
|
return batchRegisterIpAssetsWithOptimizedWorkflows;
|
10360
|
-
}()
|
10312
|
+
}()
|
10313
|
+
/**
|
10314
|
+
* Register an IP asset, supporting both minted and mint-on-demand NFTs, with optional `licenseTermsData` and `royaltyShares`.
|
10315
|
+
*
|
10316
|
+
* This method automatically selects and calls the appropriate workflow from 6 available methods based on your input parameters.
|
10317
|
+
* Here are three common usage patterns:
|
10318
|
+
*
|
10319
|
+
* **1. Minted NFT with License Terms and Royalty Distribution:**
|
10320
|
+
* ```typescript
|
10321
|
+
* const result = await client.ipAsset.registerIpAsset({
|
10322
|
+
* nft: { type: "minted", nftContract: "0x...", tokenId: 1n },
|
10323
|
+
* licenseTermsData: [
|
10324
|
+
* {
|
10325
|
+
* terms: PILFlavor.commercialRemix({
|
10326
|
+
* defaultMintingFee: 10000n,
|
10327
|
+
* commercialRevShare: 100,
|
10328
|
+
* currency: "0x..."
|
10329
|
+
* })
|
10330
|
+
* }
|
10331
|
+
* ],
|
10332
|
+
* royaltyShares: [
|
10333
|
+
* { recipient: "0x...", percentage: 100 }
|
10334
|
+
* ]
|
10335
|
+
* });
|
10336
|
+
* ```
|
10337
|
+
*
|
10338
|
+
* **2. Minted NFT with Basic License Terms:**
|
10339
|
+
* ```typescript
|
10340
|
+
* const result = await client.ipAsset.registerIpAsset({
|
10341
|
+
* nft: { type: "minted", nftContract: "0x...", tokenId: 1n },
|
10342
|
+
* licenseTermsData: [
|
10343
|
+
* {
|
10344
|
+
* terms: PILFlavor.nonCommercialSocialRemixing()
|
10345
|
+
* }
|
10346
|
+
* ]
|
10347
|
+
* });
|
10348
|
+
* ```
|
10349
|
+
*
|
10350
|
+
* **3. Mint NFT with IP Asset:**
|
10351
|
+
* ```typescript
|
10352
|
+
* const result = await client.ipAsset.registerIpAsset({
|
10353
|
+
* nft: { type: "mint", spgNftContract: "0x...", recipient: "0x...", allowDuplicates: false },
|
10354
|
+
* });
|
10355
|
+
* ```
|
10356
|
+
*
|
10357
|
+
* **Supported Workflows (6 methods automatically selected based on parameters):**
|
10358
|
+
* - {@link registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens} - Register IP with license terms and royalty distribution
|
10359
|
+
* - {@link registerIpAndAttachPilTerms} - Register IP with license terms
|
10360
|
+
* - {@link register} - Register basic IP asset
|
10361
|
+
* - {@link mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens} - Mint NFT and register IP with license terms and royalty distribution
|
10362
|
+
* - {@link mintAndRegisterIpAssetWithPilTerms} - Mint NFT and register IP with license terms
|
10363
|
+
* - {@link mintAndRegisterIp} - Mint NFT and register basic IP asset
|
10364
|
+
*
|
10365
|
+
* **Automatic Token Handling:**
|
10366
|
+
* - If the wallet's IP token balance is insufficient to cover minting fees, it automatically wraps native IP tokens into WIP tokens.
|
10367
|
+
* - It checks allowances for all required spenders and automatically approves them if their current allowance is lower than needed.
|
10368
|
+
* - These automatic processes can be configured through the `wipOptions` parameter to control behavior like multicall usage and approval settings.
|
10369
|
+
*
|
10370
|
+
* @throws {Error} If the NFT type is invalid.
|
10371
|
+
* @throws {Error} If `licenseTermsData` is not provided when `royaltyShares` are specified.
|
10372
|
+
*
|
10373
|
+
*/
|
10374
|
+
)
|
10361
10375
|
}, {
|
10362
|
-
key: "
|
10363
|
-
value: function () {
|
10364
|
-
var
|
10365
|
-
var
|
10366
|
-
return _regenerator().w(function (
|
10367
|
-
while (1) switch (
|
10376
|
+
key: "registerIpAsset",
|
10377
|
+
value: (function () {
|
10378
|
+
var _registerIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(request) {
|
10379
|
+
var nft, licenseTermsData, royaltyShares, _t31;
|
10380
|
+
return _regenerator().w(function (_context25) {
|
10381
|
+
while (1) switch (_context25.p = _context25.n) {
|
10368
10382
|
case 0:
|
10369
|
-
|
10370
|
-
|
10371
|
-
|
10372
|
-
|
10373
|
-
case 2:
|
10374
|
-
if ((_step8 = _iterator8.n()).done) {
|
10375
|
-
_context26.n = 5;
|
10383
|
+
_context25.p = 0;
|
10384
|
+
nft = request.nft, licenseTermsData = request.licenseTermsData, royaltyShares = request.royaltyShares; // Validate royalty shares without license terms
|
10385
|
+
if (!(royaltyShares && !licenseTermsData)) {
|
10386
|
+
_context25.n = 1;
|
10376
10387
|
break;
|
10377
10388
|
}
|
10378
|
-
|
10379
|
-
|
10380
|
-
|
10381
|
-
|
10382
|
-
|
10389
|
+
throw new Error("License terms data must be provided when royalty shares are specified.");
|
10390
|
+
case 1:
|
10391
|
+
if (!(nft.type === "minted")) {
|
10392
|
+
_context25.n = 3;
|
10393
|
+
break;
|
10394
|
+
}
|
10395
|
+
_context25.n = 2;
|
10396
|
+
return this.handleMintedNftRegistration(request);
|
10397
|
+
case 2:
|
10398
|
+
return _context25.a(2, _context25.v);
|
10383
10399
|
case 3:
|
10384
|
-
|
10385
|
-
|
10400
|
+
if (!(nft.type === "mint")) {
|
10401
|
+
_context25.n = 5;
|
10402
|
+
break;
|
10403
|
+
}
|
10404
|
+
_context25.n = 4;
|
10405
|
+
return this.handleMintNftRegistration(request);
|
10386
10406
|
case 4:
|
10387
|
-
|
10388
|
-
break;
|
10407
|
+
return _context25.a(2, _context25.v);
|
10389
10408
|
case 5:
|
10390
|
-
|
10391
|
-
break;
|
10409
|
+
throw new Error("Invalid NFT type");
|
10392
10410
|
case 6:
|
10393
|
-
|
10394
|
-
|
10395
|
-
_iterator8.e(_t32);
|
10411
|
+
_context25.n = 8;
|
10412
|
+
break;
|
10396
10413
|
case 7:
|
10397
|
-
|
10398
|
-
|
10399
|
-
return
|
10414
|
+
_context25.p = 7;
|
10415
|
+
_t31 = _context25.v;
|
10416
|
+
return _context25.a(2, handleError(_t31, "Failed to register IP Asset"));
|
10400
10417
|
case 8:
|
10401
|
-
return
|
10418
|
+
return _context25.a(2);
|
10402
10419
|
}
|
10403
|
-
},
|
10420
|
+
}, _callee25, this, [[0, 7]]);
|
10404
10421
|
}));
|
10405
|
-
function
|
10406
|
-
return
|
10422
|
+
function registerIpAsset(_x23) {
|
10423
|
+
return _registerIpAsset.apply(this, arguments);
|
10407
10424
|
}
|
10408
|
-
return
|
10425
|
+
return registerIpAsset;
|
10409
10426
|
}()
|
10427
|
+
/**
|
10428
|
+
* Register a derivative IP asset, supporting both minted and mint-on-demand NFTs, with optional `derivData`, `royaltyShares` and `licenseTokenIds`.
|
10429
|
+
*
|
10430
|
+
* This method automatically selects and calls the appropriate workflow from 6 available methods based on your input parameters.
|
10431
|
+
* Here are three common usage patterns:
|
10432
|
+
*
|
10433
|
+
* **1. Minted NFT with License Terms and Royalty Distribution:**
|
10434
|
+
* ```typescript
|
10435
|
+
* const result = await client.ipAsset.registerDerivativeIpAsset({
|
10436
|
+
* nft: { type: "minted", nftContract: "0x...", tokenId: 1n },
|
10437
|
+
* derivData: {
|
10438
|
+
* parentIpIds: ["0x..."],
|
10439
|
+
* licenseTermsIds: [1n],
|
10440
|
+
* maxMintingFee: 10000n,
|
10441
|
+
* maxRevenueShare: 100
|
10442
|
+
* },
|
10443
|
+
* royaltyShares: [
|
10444
|
+
* { recipient: "0x...", percentage: 100 }
|
10445
|
+
* ]
|
10446
|
+
* });
|
10447
|
+
* ```
|
10448
|
+
*
|
10449
|
+
* **2. Minted NFT with Basic Derivative Registration:**
|
10450
|
+
* ```typescript
|
10451
|
+
* const result = await client.ipAsset.registerDerivativeIpAsset({
|
10452
|
+
* nft: { type: "minted", nftContract: "0x...", tokenId: 1n },
|
10453
|
+
* derivData: {
|
10454
|
+
* parentIpIds: ["0x..."],
|
10455
|
+
* licenseTermsIds: [1n],
|
10456
|
+
* maxMintingFee: 10000n,
|
10457
|
+
* maxRevenueShare: 100
|
10458
|
+
* }
|
10459
|
+
* });
|
10460
|
+
* ```
|
10461
|
+
*
|
10462
|
+
* **3. Mint NFT with License Token IDs:**
|
10463
|
+
* ```typescript
|
10464
|
+
* const result = await client.ipAsset.registerDerivativeIpAsset({
|
10465
|
+
* nft: { type: "mint", spgNftContract: "0x...", recipient: "0x...", allowDuplicates: false },
|
10466
|
+
* licenseTokenIds: [1, 2, 3],
|
10467
|
+
* });
|
10468
|
+
* ```
|
10469
|
+
*
|
10470
|
+
* **Supported Workflows (6 methods automatically selected based on parameters):**
|
10471
|
+
* - {@link registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens} - Register derivative with license terms and royalty distribution
|
10472
|
+
* - {@link registerDerivativeIp} - Register derivative with basic derivative data
|
10473
|
+
* - {@link registerIpAndMakeDerivativeWithLicenseTokens} - Register derivative using existing license tokens
|
10474
|
+
* - {@link mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens} - Mint NFT and register as derivative with royalty distribution
|
10475
|
+
* - {@link mintAndRegisterIpAndMakeDerivative} - Mint NFT and register as derivative
|
10476
|
+
* - {@link mintAndRegisterIpAndMakeDerivativeWithLicenseTokens} - Mint NFT and register as derivative using license tokens
|
10477
|
+
*
|
10478
|
+
* **Automatic Token Handling:**
|
10479
|
+
* - If the wallet's IP token balance is insufficient to cover minting fees, it automatically wraps native IP tokens into WIP tokens.
|
10480
|
+
* - It checks allowances for all required spenders and automatically approves them if their current allowance is lower than needed.
|
10481
|
+
* - These automatic processes can be configured through the `wipOptions` parameter to control behavior like multicall usage and approval settings.
|
10482
|
+
*
|
10483
|
+
* @throws {Error} If `derivData` is not provided when `royaltyShares` are provided.
|
10484
|
+
* @throws {Error} If neither `derivData` nor `licenseTokenIds` are provided.
|
10485
|
+
* @throws {Error} If the NFT type is invalid.
|
10486
|
+
*/
|
10487
|
+
)
|
10410
10488
|
}, {
|
10411
|
-
key: "
|
10412
|
-
value: function () {
|
10413
|
-
var
|
10414
|
-
var
|
10415
|
-
return _regenerator().w(function (
|
10416
|
-
while (1) switch (
|
10489
|
+
key: "registerDerivativeIpAsset",
|
10490
|
+
value: (function () {
|
10491
|
+
var _registerDerivativeIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(request) {
|
10492
|
+
var nft, licenseTokenIds, royaltyShares, derivData, hasDerivData, hasLicenseTokens, _t32;
|
10493
|
+
return _regenerator().w(function (_context26) {
|
10494
|
+
while (1) switch (_context26.p = _context26.n) {
|
10417
10495
|
case 0:
|
10418
|
-
|
10419
|
-
|
10496
|
+
_context26.p = 0;
|
10497
|
+
nft = request.nft, licenseTokenIds = request.licenseTokenIds, royaltyShares = request.royaltyShares, derivData = request.derivData;
|
10498
|
+
if (!(royaltyShares && !derivData)) {
|
10499
|
+
_context26.n = 1;
|
10420
10500
|
break;
|
10421
10501
|
}
|
10422
|
-
throw new Error("
|
10502
|
+
throw new Error("derivData must be provided when royaltyShares are provided.");
|
10423
10503
|
case 1:
|
10424
|
-
|
10425
|
-
|
10426
|
-
|
10427
|
-
|
10428
|
-
|
10429
|
-
_iterator9.s();
|
10430
|
-
case 3:
|
10431
|
-
if ((_step9 = _iterator9.n()).done) {
|
10432
|
-
_context27.n = 6;
|
10504
|
+
// Validate that at least one valid combination is provided
|
10505
|
+
hasDerivData = !!derivData;
|
10506
|
+
hasLicenseTokens = !!(licenseTokenIds && licenseTokenIds.length > 0);
|
10507
|
+
if (!(!hasDerivData && !hasLicenseTokens)) {
|
10508
|
+
_context26.n = 2;
|
10433
10509
|
break;
|
10434
10510
|
}
|
10435
|
-
|
10436
|
-
|
10437
|
-
|
10438
|
-
|
10439
|
-
|
10511
|
+
throw new Error("Either derivData or licenseTokenIds must be provided.");
|
10512
|
+
case 2:
|
10513
|
+
if (!(nft.type === "minted")) {
|
10514
|
+
_context26.n = 4;
|
10515
|
+
break;
|
10516
|
+
}
|
10517
|
+
_context26.n = 3;
|
10518
|
+
return this.handleMintedNftDerivativeRegistration(request);
|
10519
|
+
case 3:
|
10520
|
+
return _context26.a(2, _context26.v);
|
10440
10521
|
case 4:
|
10441
|
-
|
10442
|
-
|
10443
|
-
_context27.n = 5;
|
10522
|
+
if (!(nft.type === "mint")) {
|
10523
|
+
_context26.n = 6;
|
10444
10524
|
break;
|
10445
10525
|
}
|
10446
|
-
|
10526
|
+
_context26.n = 5;
|
10527
|
+
return this.handleMintNftDerivativeRegistration(request);
|
10447
10528
|
case 5:
|
10448
|
-
|
10449
|
-
break;
|
10529
|
+
return _context26.a(2, _context26.v);
|
10450
10530
|
case 6:
|
10451
|
-
|
10452
|
-
break;
|
10531
|
+
throw new Error("Invalid NFT type.");
|
10453
10532
|
case 7:
|
10454
|
-
|
10455
|
-
|
10456
|
-
_iterator9.e(_t33);
|
10533
|
+
_context26.n = 9;
|
10534
|
+
break;
|
10457
10535
|
case 8:
|
10458
|
-
|
10459
|
-
|
10460
|
-
return
|
10536
|
+
_context26.p = 8;
|
10537
|
+
_t32 = _context26.v;
|
10538
|
+
return _context26.a(2, handleError(_t32, "Failed to register derivative IP Asset"));
|
10461
10539
|
case 9:
|
10462
|
-
return
|
10540
|
+
return _context26.a(2);
|
10463
10541
|
}
|
10464
|
-
},
|
10542
|
+
}, _callee26, this, [[0, 8]]);
|
10465
10543
|
}));
|
10466
|
-
function
|
10467
|
-
return
|
10544
|
+
function registerDerivativeIpAsset(_x24) {
|
10545
|
+
return _registerDerivativeIpAsset.apply(this, arguments);
|
10468
10546
|
}
|
10469
|
-
return
|
10547
|
+
return registerDerivativeIpAsset;
|
10470
10548
|
}()
|
10549
|
+
/**
|
10550
|
+
* Handles derivative registration for already minted NFTs with optional `derivData`, `royaltyShares` and `licenseTokenIds`.
|
10551
|
+
*
|
10552
|
+
* Supports the following workflows:
|
10553
|
+
* - {@link registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens}
|
10554
|
+
* - {@link registerDerivativeIp}
|
10555
|
+
* - {@link registerIpAndMakeDerivativeWithLicenseTokens}
|
10556
|
+
*/
|
10557
|
+
)
|
10471
10558
|
}, {
|
10472
|
-
key: "
|
10473
|
-
value: function
|
10474
|
-
var
|
10475
|
-
|
10476
|
-
|
10477
|
-
|
10478
|
-
tokenId: log.tokenId
|
10479
|
-
};
|
10480
|
-
if (key) {
|
10481
|
-
return _objectSpread2(_objectSpread2({}, baseResult), {}, _defineProperty({}, key, log.tokenContract));
|
10482
|
-
}
|
10483
|
-
return baseResult;
|
10484
|
-
});
|
10485
|
-
}
|
10486
|
-
}, {
|
10487
|
-
key: "handleRegistrationWithFees",
|
10488
|
-
value: function () {
|
10489
|
-
var _handleRegistrationWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(_ref5) {
|
10490
|
-
var _wipOptions$useMultic, _this$getIpIdAndToken, _event$ipId, _event$tokenId;
|
10491
|
-
var sender, derivData, spgNftContract, spgSpenderAddress, txOptions, wipOptions, encodedTxs, contractCall, totalFees, wipSpenders, useMulticallWhenPossible, nftMintFee, publicMinting, totalDerivativeMintingFee, _yield$contractCallWi, txHash, receipt, event;
|
10492
|
-
return _regenerator().w(function (_context28) {
|
10493
|
-
while (1) switch (_context28.n) {
|
10559
|
+
key: "handleMintedNftDerivativeRegistration",
|
10560
|
+
value: (function () {
|
10561
|
+
var _handleMintedNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(request) {
|
10562
|
+
var nft, royaltyShares, derivData, maxRts, licenseTokenIds, deadline, txOptions, options, ipMetadata, baseParams;
|
10563
|
+
return _regenerator().w(function (_context27) {
|
10564
|
+
while (1) switch (_context27.n) {
|
10494
10565
|
case 0:
|
10495
|
-
|
10496
|
-
|
10497
|
-
|
10498
|
-
|
10499
|
-
|
10500
|
-
|
10566
|
+
nft = request.nft, royaltyShares = request.royaltyShares, derivData = request.derivData, maxRts = request.maxRts, licenseTokenIds = request.licenseTokenIds, deadline = request.deadline, txOptions = request.txOptions, options = request.options, ipMetadata = request.ipMetadata;
|
10567
|
+
baseParams = {
|
10568
|
+
nftContract: nft.nftContract,
|
10569
|
+
tokenId: nft.tokenId,
|
10570
|
+
ipMetadata: ipMetadata,
|
10571
|
+
deadline: deadline,
|
10572
|
+
txOptions: txOptions,
|
10573
|
+
options: options
|
10574
|
+
};
|
10575
|
+
if (!(royaltyShares && derivData)) {
|
10576
|
+
_context27.n = 1;
|
10501
10577
|
break;
|
10502
10578
|
}
|
10503
|
-
|
10504
|
-
|
10579
|
+
return _context27.a(2, this.registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
10580
|
+
royaltyShares: royaltyShares,
|
10581
|
+
derivData: derivData
|
10582
|
+
})));
|
10505
10583
|
case 1:
|
10506
|
-
nftMintFee = _context28.v;
|
10507
|
-
_context28.n = 2;
|
10508
|
-
return getPublicMinting(spgNftContract, this.rpcClient);
|
10509
|
-
case 2:
|
10510
|
-
publicMinting = _context28.v;
|
10511
|
-
/**
|
10512
|
-
* If the SPG NFT contract's public minting is disabled, we need to check if the caller has the `minter role`.
|
10513
|
-
* When public minting is disabled, we can't use multicall because we need to perform additional role checks
|
10514
|
-
* that aren't compatible with batched transactions.
|
10515
|
-
*
|
10516
|
-
* This is because role-based access control requires the transaction's msg.sender to be verified directly,
|
10517
|
-
* which is not preserved when using multicall (where the multicall contract becomes the sender).
|
10518
|
-
*/
|
10519
|
-
if (!publicMinting) {
|
10520
|
-
useMulticallWhenPossible = false;
|
10521
|
-
}
|
10522
|
-
totalFees += nftMintFee;
|
10523
|
-
wipSpenders.push({
|
10524
|
-
address: spgNftContract,
|
10525
|
-
amount: nftMintFee
|
10526
|
-
});
|
10527
|
-
case 3:
|
10528
10584
|
if (!derivData) {
|
10529
|
-
|
10530
|
-
break;
|
10531
|
-
}
|
10532
|
-
_context28.n = 4;
|
10533
|
-
return calculateDerivativeMintingFee({
|
10534
|
-
derivData: derivData,
|
10535
|
-
rpcClient: this.rpcClient,
|
10536
|
-
wallet: this.wallet,
|
10537
|
-
chainId: this.chainId,
|
10538
|
-
sender: sender
|
10539
|
-
});
|
10540
|
-
case 4:
|
10541
|
-
totalDerivativeMintingFee = _context28.v;
|
10542
|
-
totalFees += totalDerivativeMintingFee;
|
10543
|
-
if (totalDerivativeMintingFee > 0) {
|
10544
|
-
wipSpenders.push({
|
10545
|
-
address: spgSpenderAddress,
|
10546
|
-
amount: totalDerivativeMintingFee
|
10547
|
-
});
|
10548
|
-
}
|
10549
|
-
case 5:
|
10550
|
-
if (!(totalFees < 0)) {
|
10551
|
-
_context28.n = 6;
|
10585
|
+
_context27.n = 2;
|
10552
10586
|
break;
|
10553
10587
|
}
|
10554
|
-
|
10555
|
-
|
10556
|
-
|
10557
|
-
|
10558
|
-
|
10559
|
-
|
10560
|
-
|
10561
|
-
|
10562
|
-
})
|
10563
|
-
},
|
10564
|
-
multicall3Address: this.multicall3Client.address,
|
10565
|
-
rpcClient: this.rpcClient,
|
10566
|
-
tokenSpenders: wipSpenders,
|
10567
|
-
contractCall: contractCall,
|
10568
|
-
sender: sender,
|
10569
|
-
wallet: this.wallet,
|
10570
|
-
txOptions: txOptions,
|
10571
|
-
encodedTxs: encodedTxs
|
10572
|
-
});
|
10573
|
-
case 7:
|
10574
|
-
_yield$contractCallWi = _context28.v;
|
10575
|
-
txHash = _yield$contractCallWi.txHash;
|
10576
|
-
receipt = _yield$contractCallWi.receipt;
|
10577
|
-
event = (_this$getIpIdAndToken = this.getIpIdAndTokenIdsFromEvent(receipt)) === null || _this$getIpIdAndToken === void 0 ? void 0 : _this$getIpIdAndToken[0];
|
10578
|
-
return _context28.a(2, _objectSpread2({
|
10579
|
-
txHash: txHash,
|
10580
|
-
receipt: receipt
|
10581
|
-
}, event && {
|
10582
|
-
ipId: (_event$ipId = event.ipId) !== null && _event$ipId !== void 0 ? _event$ipId : undefined,
|
10583
|
-
tokenId: (_event$tokenId = event.tokenId) !== null && _event$tokenId !== void 0 ? _event$tokenId : undefined
|
10584
|
-
}));
|
10588
|
+
return _context27.a(2, this.registerDerivativeIp(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
10589
|
+
derivData: derivData
|
10590
|
+
})));
|
10591
|
+
case 2:
|
10592
|
+
return _context27.a(2, this.registerIpAndMakeDerivativeWithLicenseTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
10593
|
+
licenseTokenIds: licenseTokenIds,
|
10594
|
+
maxRts: maxRts
|
10595
|
+
})));
|
10585
10596
|
}
|
10586
|
-
},
|
10597
|
+
}, _callee27, this);
|
10587
10598
|
}));
|
10588
|
-
function
|
10589
|
-
return
|
10599
|
+
function handleMintedNftDerivativeRegistration(_x25) {
|
10600
|
+
return _handleMintedNftDerivativeRegistration.apply(this, arguments);
|
10590
10601
|
}
|
10591
|
-
return
|
10602
|
+
return handleMintedNftDerivativeRegistration;
|
10592
10603
|
}()
|
10593
|
-
|
10594
|
-
|
10595
|
-
|
10596
|
-
|
10597
|
-
|
10598
|
-
|
10599
|
-
|
10604
|
+
/**
|
10605
|
+
* Handles derivative registration for minted NFTs with optional `derivData`, `royaltyShares` and `licenseTokenIds`.
|
10606
|
+
*
|
10607
|
+
* Supports the following workflows:
|
10608
|
+
* - {@link mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens}
|
10609
|
+
* - {@link mintAndRegisterIpAndMakeDerivative}
|
10610
|
+
* - {@link mintAndRegisterIpAndMakeDerivativeWithLicenseTokens}
|
10611
|
+
*/
|
10612
|
+
)
|
10613
|
+
}, {
|
10614
|
+
key: "handleMintNftDerivativeRegistration",
|
10615
|
+
value: (function () {
|
10616
|
+
var _handleMintNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(request) {
|
10617
|
+
var nft, royaltyShares, derivData, maxRts, licenseTokenIds, txOptions, options, ipMetadata, baseParams;
|
10618
|
+
return _regenerator().w(function (_context28) {
|
10619
|
+
while (1) switch (_context28.n) {
|
10600
10620
|
case 0:
|
10601
|
-
|
10602
|
-
|
10603
|
-
|
10621
|
+
nft = request.nft, royaltyShares = request.royaltyShares, derivData = request.derivData, maxRts = request.maxRts, licenseTokenIds = request.licenseTokenIds, txOptions = request.txOptions, options = request.options, ipMetadata = request.ipMetadata;
|
10622
|
+
baseParams = {
|
10623
|
+
spgNftContract: nft.spgNftContract,
|
10624
|
+
recipient: nft.recipient,
|
10625
|
+
allowDuplicates: nft.allowDuplicates,
|
10626
|
+
ipMetadata: ipMetadata,
|
10627
|
+
txOptions: txOptions,
|
10628
|
+
options: options
|
10629
|
+
};
|
10630
|
+
if (!(royaltyShares && derivData)) {
|
10631
|
+
_context28.n = 1;
|
10632
|
+
break;
|
10633
|
+
}
|
10634
|
+
return _context28.a(2, this.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
10635
|
+
royaltyShares: royaltyShares,
|
10636
|
+
derivData: derivData
|
10637
|
+
})));
|
10604
10638
|
case 1:
|
10605
|
-
if (!
|
10606
|
-
|
10639
|
+
if (!derivData) {
|
10640
|
+
_context28.n = 2;
|
10607
10641
|
break;
|
10608
10642
|
}
|
10609
|
-
|
10610
|
-
|
10611
|
-
|
10643
|
+
return _context28.a(2, this.mintAndRegisterIpAndMakeDerivative(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
10644
|
+
derivData: derivData
|
10645
|
+
})));
|
10646
|
+
case 2:
|
10647
|
+
return _context28.a(2, this.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
10648
|
+
licenseTokenIds: licenseTokenIds,
|
10649
|
+
maxRts: maxRts
|
10650
|
+
})));
|
10651
|
+
}
|
10652
|
+
}, _callee28, this);
|
10653
|
+
}));
|
10654
|
+
function handleMintNftDerivativeRegistration(_x26) {
|
10655
|
+
return _handleMintNftDerivativeRegistration.apply(this, arguments);
|
10656
|
+
}
|
10657
|
+
return handleMintNftDerivativeRegistration;
|
10658
|
+
}()
|
10659
|
+
/**
|
10660
|
+
* Link a derivative IP asset using parent IP's license terms or license tokens.
|
10661
|
+
*
|
10662
|
+
* Supports the following workflows:
|
10663
|
+
* - {@link registerDerivative}
|
10664
|
+
* - {@link registerDerivativeWithLicenseTokens}
|
10665
|
+
*
|
10666
|
+
* @example
|
10667
|
+
* ```typescript
|
10668
|
+
* const result = await client.ipAsset.linkDerivative({
|
10669
|
+
* licenseTokenIds: [1, 2, 3],
|
10670
|
+
* childIpId: "0x...",
|
10671
|
+
* });
|
10672
|
+
* ```
|
10673
|
+
*
|
10674
|
+
* @example
|
10675
|
+
* ```typescript
|
10676
|
+
* const result = await client.ipAsset.linkDerivative({
|
10677
|
+
* parentIpIds: ["0x..."],
|
10678
|
+
* licenseTermsIds: [1],
|
10679
|
+
* childIpId: "0x...",
|
10680
|
+
* });
|
10681
|
+
* ```
|
10682
|
+
*
|
10683
|
+
* **Automatic Token Handling:**
|
10684
|
+
* - If the wallet's IP token balance is insufficient to cover minting fees, it automatically wraps native IP tokens into WIP tokens.
|
10685
|
+
* - It checks allowances for all required spenders and automatically approves them if their current allowance is lower than needed.
|
10686
|
+
* - These automatic processes can be configured through the `wipOptions` parameter to control behavior like multicall usage and approval settings.
|
10687
|
+
*/
|
10688
|
+
)
|
10689
|
+
}, {
|
10690
|
+
key: "linkDerivative",
|
10691
|
+
value: (function () {
|
10692
|
+
var _linkDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(request) {
|
10693
|
+
var _t33;
|
10694
|
+
return _regenerator().w(function (_context29) {
|
10695
|
+
while (1) switch (_context29.p = _context29.n) {
|
10696
|
+
case 0:
|
10697
|
+
_context29.p = 0;
|
10698
|
+
if (!("parentIpIds" in request)) {
|
10699
|
+
_context29.n = 1;
|
10612
10700
|
break;
|
10613
10701
|
}
|
10614
|
-
return _context29.a(
|
10702
|
+
return _context29.a(2, this.registerDerivative(request));
|
10703
|
+
case 1:
|
10704
|
+
return _context29.a(2, this.registerDerivativeWithLicenseTokens(request));
|
10615
10705
|
case 2:
|
10616
|
-
_context29.n =
|
10617
|
-
|
10618
|
-
|
10619
|
-
|
10620
|
-
|
10621
|
-
|
10622
|
-
|
10623
|
-
|
10706
|
+
_context29.n = 4;
|
10707
|
+
break;
|
10708
|
+
case 3:
|
10709
|
+
_context29.p = 3;
|
10710
|
+
_t33 = _context29.v;
|
10711
|
+
return _context29.a(2, handleError(_t33, "Failed to link derivative"));
|
10712
|
+
case 4:
|
10713
|
+
return _context29.a(2);
|
10714
|
+
}
|
10715
|
+
}, _callee29, this, [[0, 3]]);
|
10716
|
+
}));
|
10717
|
+
function linkDerivative(_x27) {
|
10718
|
+
return _linkDerivative.apply(this, arguments);
|
10719
|
+
}
|
10720
|
+
return linkDerivative;
|
10721
|
+
}()
|
10722
|
+
/**
|
10723
|
+
* Handles registration for already minted NFTs with optional license terms and royalty shares.
|
10724
|
+
*
|
10725
|
+
* Supports the following workflows:
|
10726
|
+
* - {@link registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens}
|
10727
|
+
* - {@link registerIpAndAttachPilTerms}
|
10728
|
+
* - {@link register}
|
10729
|
+
*/
|
10730
|
+
)
|
10731
|
+
}, {
|
10732
|
+
key: "handleMintedNftRegistration",
|
10733
|
+
value: (function () {
|
10734
|
+
var _handleMintedNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30(request) {
|
10735
|
+
var nft, ipMetadata, txOptions, licenseTermsData, royaltyShares, deadline, baseParams;
|
10736
|
+
return _regenerator().w(function (_context30) {
|
10737
|
+
while (1) switch (_context30.n) {
|
10738
|
+
case 0:
|
10739
|
+
nft = request.nft, ipMetadata = request.ipMetadata, txOptions = request.txOptions, licenseTermsData = request.licenseTermsData, royaltyShares = request.royaltyShares, deadline = request.deadline;
|
10740
|
+
baseParams = {
|
10741
|
+
nftContract: nft.nftContract,
|
10742
|
+
tokenId: nft.tokenId,
|
10743
|
+
ipMetadata: ipMetadata,
|
10744
|
+
deadline: deadline,
|
10745
|
+
txOptions: txOptions
|
10746
|
+
};
|
10747
|
+
if (!(licenseTermsData && royaltyShares)) {
|
10748
|
+
_context30.n = 1;
|
10749
|
+
break;
|
10750
|
+
}
|
10751
|
+
return _context30.a(2, this.registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
10752
|
+
licenseTermsData: licenseTermsData,
|
10753
|
+
royaltyShares: royaltyShares
|
10754
|
+
})));
|
10755
|
+
case 1:
|
10756
|
+
if (!licenseTermsData) {
|
10757
|
+
_context30.n = 2;
|
10758
|
+
break;
|
10759
|
+
}
|
10760
|
+
return _context30.a(2, this.registerIpAndAttachPilTerms(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
10761
|
+
licenseTermsData: licenseTermsData
|
10762
|
+
})));
|
10763
|
+
case 2:
|
10764
|
+
return _context30.a(2, this.register(_objectSpread2({}, baseParams)));
|
10765
|
+
}
|
10766
|
+
}, _callee30, this);
|
10767
|
+
}));
|
10768
|
+
function handleMintedNftRegistration(_x28) {
|
10769
|
+
return _handleMintedNftRegistration.apply(this, arguments);
|
10770
|
+
}
|
10771
|
+
return handleMintedNftRegistration;
|
10772
|
+
}()
|
10773
|
+
/**
|
10774
|
+
* Handles minting and registration of new NFTs with optional license terms and royalty shares.
|
10775
|
+
*
|
10776
|
+
* Supports the following workflows:
|
10777
|
+
* - {@link mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens}
|
10778
|
+
* - {@link mintAndRegisterIpAssetWithPilTerms}
|
10779
|
+
* - {@link mintAndRegisterIp}
|
10780
|
+
*/
|
10781
|
+
)
|
10782
|
+
}, {
|
10783
|
+
key: "handleMintNftRegistration",
|
10784
|
+
value: (function () {
|
10785
|
+
var _handleMintNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(request) {
|
10786
|
+
var nft, ipMetadata, txOptions, options, licenseTermsData, royaltyShares, baseParams;
|
10787
|
+
return _regenerator().w(function (_context31) {
|
10788
|
+
while (1) switch (_context31.n) {
|
10789
|
+
case 0:
|
10790
|
+
nft = request.nft, ipMetadata = request.ipMetadata, txOptions = request.txOptions, options = request.options, licenseTermsData = request.licenseTermsData, royaltyShares = request.royaltyShares;
|
10791
|
+
baseParams = {
|
10792
|
+
spgNftContract: nft.spgNftContract,
|
10793
|
+
recipient: nft.recipient,
|
10794
|
+
allowDuplicates: nft.allowDuplicates,
|
10795
|
+
ipMetadata: ipMetadata,
|
10796
|
+
txOptions: txOptions,
|
10797
|
+
options: options
|
10798
|
+
};
|
10799
|
+
if (!(licenseTermsData && royaltyShares)) {
|
10800
|
+
_context31.n = 1;
|
10801
|
+
break;
|
10802
|
+
}
|
10803
|
+
return _context31.a(2, this.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
10804
|
+
licenseTermsData: licenseTermsData,
|
10805
|
+
royaltyShares: royaltyShares
|
10806
|
+
})));
|
10807
|
+
case 1:
|
10808
|
+
if (!licenseTermsData) {
|
10809
|
+
_context31.n = 2;
|
10810
|
+
break;
|
10811
|
+
}
|
10812
|
+
return _context31.a(2, this.mintAndRegisterIpAssetWithPilTerms(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
10813
|
+
licenseTermsData: licenseTermsData
|
10814
|
+
})));
|
10815
|
+
case 2:
|
10816
|
+
return _context31.a(2, this.mintAndRegisterIp(_objectSpread2({}, baseParams)));
|
10817
|
+
}
|
10818
|
+
}, _callee31, this);
|
10819
|
+
}));
|
10820
|
+
function handleMintNftRegistration(_x29) {
|
10821
|
+
return _handleMintNftRegistration.apply(this, arguments);
|
10822
|
+
}
|
10823
|
+
return handleMintNftRegistration;
|
10824
|
+
}())
|
10825
|
+
}, {
|
10826
|
+
key: "getLicenseTermsId",
|
10827
|
+
value: function () {
|
10828
|
+
var _getLicenseTermsId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32(licenseTerms) {
|
10829
|
+
var licenseTermsIds, _iterator8, _step8, licenseTerm, licenseRes, _t34;
|
10830
|
+
return _regenerator().w(function (_context32) {
|
10831
|
+
while (1) switch (_context32.p = _context32.n) {
|
10832
|
+
case 0:
|
10833
|
+
licenseTermsIds = [];
|
10834
|
+
_iterator8 = _createForOfIteratorHelper(licenseTerms);
|
10835
|
+
_context32.p = 1;
|
10836
|
+
_iterator8.s();
|
10837
|
+
case 2:
|
10838
|
+
if ((_step8 = _iterator8.n()).done) {
|
10839
|
+
_context32.n = 5;
|
10840
|
+
break;
|
10841
|
+
}
|
10842
|
+
licenseTerm = _step8.value;
|
10843
|
+
_context32.n = 3;
|
10844
|
+
return this.licenseTemplateClient.getLicenseTermsId({
|
10845
|
+
terms: licenseTerm
|
10624
10846
|
});
|
10625
10847
|
case 3:
|
10626
|
-
|
10627
|
-
|
10628
|
-
|
10848
|
+
licenseRes = _context32.v;
|
10849
|
+
licenseTermsIds.push(licenseRes.selectedLicenseTermsId);
|
10850
|
+
case 4:
|
10851
|
+
_context32.n = 2;
|
10852
|
+
break;
|
10853
|
+
case 5:
|
10854
|
+
_context32.n = 7;
|
10855
|
+
break;
|
10856
|
+
case 6:
|
10857
|
+
_context32.p = 6;
|
10858
|
+
_t34 = _context32.v;
|
10859
|
+
_iterator8.e(_t34);
|
10860
|
+
case 7:
|
10861
|
+
_context32.p = 7;
|
10862
|
+
_iterator8.f();
|
10863
|
+
return _context32.f(7);
|
10864
|
+
case 8:
|
10865
|
+
return _context32.a(2, licenseTermsIds);
|
10866
|
+
}
|
10867
|
+
}, _callee32, this, [[1, 6, 7, 8]]);
|
10868
|
+
}));
|
10869
|
+
function getLicenseTermsId(_x30) {
|
10870
|
+
return _getLicenseTermsId.apply(this, arguments);
|
10871
|
+
}
|
10872
|
+
return getLicenseTermsId;
|
10873
|
+
}()
|
10874
|
+
}, {
|
10875
|
+
key: "validateLicenseTokenIds",
|
10876
|
+
value: function () {
|
10877
|
+
var _validateLicenseTokenIds = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33(licenseTokenIds) {
|
10878
|
+
var newLicenseTokenIds, _iterator9, _step9, licenseTokenId, tokenOwnerAddress, _t35;
|
10879
|
+
return _regenerator().w(function (_context33) {
|
10880
|
+
while (1) switch (_context33.p = _context33.n) {
|
10881
|
+
case 0:
|
10882
|
+
if (!(licenseTokenIds.length === 0)) {
|
10883
|
+
_context33.n = 1;
|
10884
|
+
break;
|
10629
10885
|
}
|
10886
|
+
throw new Error("License token IDs must be provided.");
|
10887
|
+
case 1:
|
10888
|
+
newLicenseTokenIds = licenseTokenIds.map(function (id) {
|
10889
|
+
return BigInt(id);
|
10890
|
+
});
|
10891
|
+
_iterator9 = _createForOfIteratorHelper(newLicenseTokenIds);
|
10892
|
+
_context33.p = 2;
|
10893
|
+
_iterator9.s();
|
10894
|
+
case 3:
|
10895
|
+
if ((_step9 = _iterator9.n()).done) {
|
10896
|
+
_context33.n = 6;
|
10897
|
+
break;
|
10898
|
+
}
|
10899
|
+
licenseTokenId = _step9.value;
|
10900
|
+
_context33.n = 4;
|
10901
|
+
return this.licenseTokenReadOnlyClient.ownerOf({
|
10902
|
+
tokenId: licenseTokenId
|
10903
|
+
});
|
10630
10904
|
case 4:
|
10631
|
-
|
10632
|
-
|
10905
|
+
tokenOwnerAddress = _context33.v;
|
10906
|
+
if (tokenOwnerAddress) {
|
10907
|
+
_context33.n = 5;
|
10908
|
+
break;
|
10909
|
+
}
|
10910
|
+
throw new Error("License token id ".concat(licenseTokenId, " must be owned by the caller."));
|
10911
|
+
case 5:
|
10912
|
+
_context33.n = 3;
|
10633
10913
|
break;
|
10914
|
+
case 6:
|
10915
|
+
_context33.n = 8;
|
10916
|
+
break;
|
10917
|
+
case 7:
|
10918
|
+
_context33.p = 7;
|
10919
|
+
_t35 = _context33.v;
|
10920
|
+
_iterator9.e(_t35);
|
10921
|
+
case 8:
|
10922
|
+
_context33.p = 8;
|
10923
|
+
_iterator9.f();
|
10924
|
+
return _context33.f(8);
|
10925
|
+
case 9:
|
10926
|
+
return _context33.a(2, newLicenseTokenIds);
|
10927
|
+
}
|
10928
|
+
}, _callee33, this, [[2, 7, 8, 9]]);
|
10929
|
+
}));
|
10930
|
+
function validateLicenseTokenIds(_x31) {
|
10931
|
+
return _validateLicenseTokenIds.apply(this, arguments);
|
10932
|
+
}
|
10933
|
+
return validateLicenseTokenIds;
|
10934
|
+
}()
|
10935
|
+
}, {
|
10936
|
+
key: "getIpIdAndTokenIdsFromEvent",
|
10937
|
+
value: function getIpIdAndTokenIdsFromEvent(txReceipt, key) {
|
10938
|
+
var ipRegisteredLog = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt);
|
10939
|
+
return ipRegisteredLog.map(function (log) {
|
10940
|
+
var baseResult = {
|
10941
|
+
ipId: log.ipId,
|
10942
|
+
tokenId: log.tokenId
|
10943
|
+
};
|
10944
|
+
if (key) {
|
10945
|
+
return _objectSpread2(_objectSpread2({}, baseResult), {}, _defineProperty({}, key, log.tokenContract));
|
10946
|
+
}
|
10947
|
+
return baseResult;
|
10948
|
+
});
|
10949
|
+
}
|
10950
|
+
}, {
|
10951
|
+
key: "handleRegistrationWithFees",
|
10952
|
+
value: function () {
|
10953
|
+
var _handleRegistrationWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(_ref5) {
|
10954
|
+
var _wipOptions$useMultic, _this$getIpIdAndToken, _event$ipId, _event$tokenId;
|
10955
|
+
var sender, derivData, spgNftContract, spgSpenderAddress, txOptions, wipOptions, encodedTxs, contractCall, totalFees, wipSpenders, useMulticallWhenPossible, nftMintFee, publicMinting, totalDerivativeMintingFee, _yield$contractCallWi, txHash, receipt, event;
|
10956
|
+
return _regenerator().w(function (_context34) {
|
10957
|
+
while (1) switch (_context34.n) {
|
10958
|
+
case 0:
|
10959
|
+
sender = _ref5.sender, derivData = _ref5.derivData, spgNftContract = _ref5.spgNftContract, spgSpenderAddress = _ref5.spgSpenderAddress, txOptions = _ref5.txOptions, wipOptions = _ref5.wipOptions, encodedTxs = _ref5.encodedTxs, contractCall = _ref5.contractCall;
|
10960
|
+
totalFees = 0n;
|
10961
|
+
wipSpenders = [];
|
10962
|
+
useMulticallWhenPossible = (_wipOptions$useMultic = wipOptions === null || wipOptions === void 0 ? void 0 : wipOptions.useMulticallWhenPossible) !== null && _wipOptions$useMultic !== void 0 ? _wipOptions$useMultic : true; // get spg minting fee
|
10963
|
+
if (!spgNftContract) {
|
10964
|
+
_context34.n = 3;
|
10965
|
+
break;
|
10966
|
+
}
|
10967
|
+
_context34.n = 1;
|
10968
|
+
return calculateSPGWipMintFee(new SpgnftImplReadOnlyClient(this.rpcClient, spgNftContract));
|
10969
|
+
case 1:
|
10970
|
+
nftMintFee = _context34.v;
|
10971
|
+
_context34.n = 2;
|
10972
|
+
return getPublicMinting(spgNftContract, this.rpcClient);
|
10973
|
+
case 2:
|
10974
|
+
publicMinting = _context34.v;
|
10975
|
+
/**
|
10976
|
+
* If the SPG NFT contract's public minting is disabled, we need to check if the caller has the `minter role`.
|
10977
|
+
* When public minting is disabled, we can't use multicall because we need to perform additional role checks
|
10978
|
+
* that aren't compatible with batched transactions.
|
10979
|
+
*
|
10980
|
+
* This is because role-based access control requires the transaction's msg.sender to be verified directly,
|
10981
|
+
* which is not preserved when using multicall (where the multicall contract becomes the sender).
|
10982
|
+
*/
|
10983
|
+
if (!publicMinting) {
|
10984
|
+
useMulticallWhenPossible = false;
|
10985
|
+
}
|
10986
|
+
totalFees += nftMintFee;
|
10987
|
+
wipSpenders.push({
|
10988
|
+
address: spgNftContract,
|
10989
|
+
amount: nftMintFee
|
10990
|
+
});
|
10991
|
+
case 3:
|
10992
|
+
if (!derivData) {
|
10993
|
+
_context34.n = 5;
|
10994
|
+
break;
|
10995
|
+
}
|
10996
|
+
_context34.n = 4;
|
10997
|
+
return calculateDerivativeMintingFee({
|
10998
|
+
derivData: derivData,
|
10999
|
+
rpcClient: this.rpcClient,
|
11000
|
+
wallet: this.wallet,
|
11001
|
+
chainId: this.chainId,
|
11002
|
+
sender: sender
|
11003
|
+
});
|
11004
|
+
case 4:
|
11005
|
+
totalDerivativeMintingFee = _context34.v;
|
11006
|
+
totalFees += totalDerivativeMintingFee;
|
11007
|
+
if (totalDerivativeMintingFee > 0) {
|
11008
|
+
wipSpenders.push({
|
11009
|
+
address: spgSpenderAddress,
|
11010
|
+
amount: totalDerivativeMintingFee
|
11011
|
+
});
|
11012
|
+
}
|
10634
11013
|
case 5:
|
10635
|
-
|
11014
|
+
if (!(totalFees < 0)) {
|
11015
|
+
_context34.n = 6;
|
11016
|
+
break;
|
11017
|
+
}
|
11018
|
+
throw new Error("Total fees for registering derivative should never be negative: ".concat(totalFees));
|
11019
|
+
case 6:
|
11020
|
+
_context34.n = 7;
|
11021
|
+
return contractCallWithFees({
|
11022
|
+
totalFees: totalFees,
|
11023
|
+
options: {
|
11024
|
+
wipOptions: _objectSpread2(_objectSpread2({}, wipOptions), {}, {
|
11025
|
+
useMulticallWhenPossible: useMulticallWhenPossible
|
11026
|
+
})
|
11027
|
+
},
|
11028
|
+
multicall3Address: this.multicall3Client.address,
|
11029
|
+
rpcClient: this.rpcClient,
|
11030
|
+
tokenSpenders: wipSpenders,
|
11031
|
+
contractCall: contractCall,
|
11032
|
+
sender: sender,
|
11033
|
+
wallet: this.wallet,
|
11034
|
+
txOptions: txOptions,
|
11035
|
+
encodedTxs: encodedTxs
|
11036
|
+
});
|
11037
|
+
case 7:
|
11038
|
+
_yield$contractCallWi = _context34.v;
|
11039
|
+
txHash = _yield$contractCallWi.txHash;
|
11040
|
+
receipt = _yield$contractCallWi.receipt;
|
11041
|
+
event = (_this$getIpIdAndToken = this.getIpIdAndTokenIdsFromEvent(receipt)) === null || _this$getIpIdAndToken === void 0 ? void 0 : _this$getIpIdAndToken[0];
|
11042
|
+
return _context34.a(2, _objectSpread2({
|
11043
|
+
txHash: txHash,
|
11044
|
+
receipt: receipt
|
11045
|
+
}, event && {
|
11046
|
+
ipId: (_event$ipId = event.ipId) !== null && _event$ipId !== void 0 ? _event$ipId : undefined,
|
11047
|
+
tokenId: (_event$tokenId = event.tokenId) !== null && _event$tokenId !== void 0 ? _event$tokenId : undefined
|
11048
|
+
}));
|
10636
11049
|
}
|
10637
|
-
},
|
11050
|
+
}, _callee34, this);
|
10638
11051
|
}));
|
10639
|
-
function
|
10640
|
-
return
|
11052
|
+
function handleRegistrationWithFees(_x32) {
|
11053
|
+
return _handleRegistrationWithFees.apply(this, arguments);
|
10641
11054
|
}
|
10642
|
-
return
|
11055
|
+
return handleRegistrationWithFees;
|
10643
11056
|
}()
|
10644
11057
|
/**
|
10645
11058
|
* Process the `LicenseTermsIds` and `maxLicenseTokensTxHashes` for each IP asset.
|
@@ -10647,69 +11060,69 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10647
11060
|
}, {
|
10648
11061
|
key: "processResponses",
|
10649
11062
|
value: (function () {
|
10650
|
-
var _processResponses = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
10651
|
-
var _iterator0, _step0, _step0$value, responseIndex, response, _iterator1, _step1, _Object$values$respon, _step1$value, assetIndex, ipAsset, extraData, result, _extraData, i, _response, extraDataItem, _ipAsset,
|
10652
|
-
return _regenerator().w(function (
|
10653
|
-
while (1) switch (
|
11063
|
+
var _processResponses = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35(responses, aggregateRegistrationRequest, useMulticall) {
|
11064
|
+
var _iterator0, _step0, _step0$value, responseIndex, response, _iterator1, _step1, _Object$values$respon, _step1$value, assetIndex, ipAsset, extraData, result, _extraData, i, _response, extraDataItem, _ipAsset, _t36, _t37;
|
11065
|
+
return _regenerator().w(function (_context35) {
|
11066
|
+
while (1) switch (_context35.p = _context35.n) {
|
10654
11067
|
case 0:
|
10655
11068
|
if (!useMulticall) {
|
10656
|
-
|
11069
|
+
_context35.n = 15;
|
10657
11070
|
break;
|
10658
11071
|
}
|
10659
11072
|
_iterator0 = _createForOfIteratorHelper(responses.entries());
|
10660
|
-
|
11073
|
+
_context35.p = 1;
|
10661
11074
|
_iterator0.s();
|
10662
11075
|
case 2:
|
10663
11076
|
if ((_step0 = _iterator0.n()).done) {
|
10664
|
-
|
11077
|
+
_context35.n = 11;
|
10665
11078
|
break;
|
10666
11079
|
}
|
10667
11080
|
_step0$value = _slicedToArray(_step0.value, 2), responseIndex = _step0$value[0], response = _step0$value[1];
|
10668
11081
|
_iterator1 = _createForOfIteratorHelper(response.ipAssetsWithLicenseTerms.entries());
|
10669
|
-
|
11082
|
+
_context35.p = 3;
|
10670
11083
|
_iterator1.s();
|
10671
11084
|
case 4:
|
10672
11085
|
if ((_step1 = _iterator1.n()).done) {
|
10673
|
-
|
11086
|
+
_context35.n = 7;
|
10674
11087
|
break;
|
10675
11088
|
}
|
10676
11089
|
_step1$value = _slicedToArray(_step1.value, 2), assetIndex = _step1$value[0], ipAsset = _step1$value[1];
|
10677
11090
|
extraData = (_Object$values$respon = Object.values(aggregateRegistrationRequest)[responseIndex]) === null || _Object$values$respon === void 0 || (_Object$values$respon = _Object$values$respon.extraData) === null || _Object$values$respon === void 0 ? void 0 : _Object$values$respon[assetIndex];
|
10678
|
-
|
11091
|
+
_context35.n = 5;
|
10679
11092
|
return this.processIpAssetLicenseTerms(ipAsset, extraData);
|
10680
11093
|
case 5:
|
10681
|
-
result =
|
11094
|
+
result = _context35.v;
|
10682
11095
|
responses[responseIndex].ipAssetsWithLicenseTerms[assetIndex] = result;
|
10683
11096
|
case 6:
|
10684
|
-
|
11097
|
+
_context35.n = 4;
|
10685
11098
|
break;
|
10686
11099
|
case 7:
|
10687
|
-
|
11100
|
+
_context35.n = 9;
|
10688
11101
|
break;
|
10689
11102
|
case 8:
|
10690
|
-
|
10691
|
-
|
10692
|
-
_iterator1.e(
|
11103
|
+
_context35.p = 8;
|
11104
|
+
_t36 = _context35.v;
|
11105
|
+
_iterator1.e(_t36);
|
10693
11106
|
case 9:
|
10694
|
-
|
11107
|
+
_context35.p = 9;
|
10695
11108
|
_iterator1.f();
|
10696
|
-
return
|
11109
|
+
return _context35.f(9);
|
10697
11110
|
case 10:
|
10698
|
-
|
11111
|
+
_context35.n = 2;
|
10699
11112
|
break;
|
10700
11113
|
case 11:
|
10701
|
-
|
11114
|
+
_context35.n = 13;
|
10702
11115
|
break;
|
10703
11116
|
case 12:
|
10704
|
-
|
10705
|
-
|
10706
|
-
_iterator0.e(
|
11117
|
+
_context35.p = 12;
|
11118
|
+
_t37 = _context35.v;
|
11119
|
+
_iterator0.e(_t37);
|
10707
11120
|
case 13:
|
10708
|
-
|
11121
|
+
_context35.p = 13;
|
10709
11122
|
_iterator0.f();
|
10710
|
-
return
|
11123
|
+
return _context35.f(13);
|
10711
11124
|
case 14:
|
10712
|
-
|
11125
|
+
_context35.n = 19;
|
10713
11126
|
break;
|
10714
11127
|
case 15:
|
10715
11128
|
_extraData = [];
|
@@ -10720,299 +11133,140 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
10720
11133
|
i = 0;
|
10721
11134
|
case 16:
|
10722
11135
|
if (!(i < responses.length)) {
|
10723
|
-
|
11136
|
+
_context35.n = 19;
|
10724
11137
|
break;
|
10725
11138
|
}
|
10726
11139
|
_response = responses[i];
|
10727
11140
|
extraDataItem = _extraData[i];
|
10728
|
-
|
11141
|
+
_context35.n = 17;
|
10729
11142
|
return this.processIpAssetLicenseTerms(_response.ipAssetsWithLicenseTerms[0], extraDataItem);
|
10730
11143
|
case 17:
|
10731
|
-
_ipAsset =
|
11144
|
+
_ipAsset = _context35.v;
|
10732
11145
|
responses[i].ipAssetsWithLicenseTerms[0] = _ipAsset;
|
10733
11146
|
case 18:
|
10734
11147
|
i++;
|
10735
|
-
|
11148
|
+
_context35.n = 16;
|
10736
11149
|
break;
|
10737
11150
|
case 19:
|
10738
|
-
return
|
11151
|
+
return _context35.a(2, responses);
|
10739
11152
|
}
|
10740
|
-
},
|
11153
|
+
}, _callee35, this, [[3, 8, 9, 10], [1, 12, 13, 14]]);
|
10741
11154
|
}));
|
10742
|
-
function processResponses(
|
11155
|
+
function processResponses(_x33, _x34, _x35) {
|
10743
11156
|
return _processResponses.apply(this, arguments);
|
10744
11157
|
}
|
10745
11158
|
return processResponses;
|
10746
11159
|
}())
|
10747
|
-
}, {
|
10748
|
-
key: "processIpAssetLicenseTerms",
|
10749
|
-
value: function () {
|
10750
|
-
var _processIpAssetLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
10751
|
-
var _extraData$licenseTer;
|
10752
|
-
var licenseTermsIds, maxLicenseTokens, maxLicenseTokensData, maxLicenseTokensTxHashes;
|
10753
|
-
return _regenerator().w(function (
|
10754
|
-
while (1) switch (
|
10755
|
-
case 0:
|
10756
|
-
if (extraData !== null && extraData !== void 0 && (_extraData$licenseTer = extraData.licenseTermsData) !== null && _extraData$licenseTer !== void 0 && _extraData$licenseTer.length) {
|
10757
|
-
_context31.n = 1;
|
10758
|
-
break;
|
10759
|
-
}
|
10760
|
-
return _context31.a(2, ipAsset);
|
10761
|
-
case 1:
|
10762
|
-
_context31.n = 2;
|
10763
|
-
return this.getLicenseTermsId(extraData.licenseTermsData.map(function (item) {
|
10764
|
-
return item.terms;
|
10765
|
-
}));
|
10766
|
-
case 2:
|
10767
|
-
licenseTermsIds = _context31.v;
|
10768
|
-
ipAsset.licenseTermsIds = licenseTermsIds;
|
10769
|
-
maxLicenseTokens = extraData.maxLicenseTokens;
|
10770
|
-
if (maxLicenseTokens !== null && maxLicenseTokens !== void 0 && maxLicenseTokens.length) {
|
10771
|
-
_context31.n = 3;
|
10772
|
-
break;
|
10773
|
-
}
|
10774
|
-
return _context31.a(2, ipAsset);
|
10775
|
-
case 3:
|
10776
|
-
maxLicenseTokensData = maxLicenseTokens.filter(function (maxLicenseToken) {
|
10777
|
-
return maxLicenseToken !== undefined;
|
10778
|
-
}).map(function (maxLicenseToken) {
|
10779
|
-
return {
|
10780
|
-
maxLicenseTokens: maxLicenseToken
|
10781
|
-
};
|
10782
|
-
});
|
10783
|
-
_context31.n = 4;
|
10784
|
-
return this.setMaxLicenseTokens({
|
10785
|
-
maxLicenseTokensData: maxLicenseTokensData,
|
10786
|
-
licensorIpId: ipAsset.ipId,
|
10787
|
-
licenseTermsIds: licenseTermsIds
|
10788
|
-
});
|
10789
|
-
case 4:
|
10790
|
-
maxLicenseTokensTxHashes = _context31.v;
|
10791
|
-
if (maxLicenseTokensTxHashes !== null && maxLicenseTokensTxHashes !== void 0 && maxLicenseTokensTxHashes.length) {
|
10792
|
-
ipAsset.maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
|
10793
|
-
}
|
10794
|
-
return _context31.a(2, ipAsset);
|
10795
|
-
}
|
10796
|
-
}, _callee31, this);
|
10797
|
-
}));
|
10798
|
-
function processIpAssetLicenseTerms(_x31, _x32) {
|
10799
|
-
return _processIpAssetLicenseTerms.apply(this, arguments);
|
10800
|
-
}
|
10801
|
-
return processIpAssetLicenseTerms;
|
10802
|
-
}()
|
10803
|
-
}]);
|
10804
|
-
}();
|
10805
|
-
|
10806
|
-
var LicenseClient = /*#__PURE__*/function () {
|
10807
|
-
function LicenseClient(rpcClient, wallet, chainId) {
|
10808
|
-
_classCallCheck(this, LicenseClient);
|
10809
|
-
this.licensingModuleClient = new LicensingModuleClient(rpcClient, wallet);
|
10810
|
-
this.piLicenseTemplateReadOnlyClient = new PiLicenseTemplateReadOnlyClient(rpcClient);
|
10811
|
-
this.licenseTemplateClient = new PiLicenseTemplateClient(rpcClient, wallet);
|
10812
|
-
this.licenseRegistryReadOnlyClient = new LicenseRegistryReadOnlyClient(rpcClient);
|
10813
|
-
this.ipAssetRegistryClient = new IpAssetRegistryClient(rpcClient, wallet);
|
10814
|
-
this.moduleRegistryReadOnlyClient = new ModuleRegistryReadOnlyClient(rpcClient);
|
10815
|
-
this.multicall3Client = new Multicall3Client(rpcClient, wallet);
|
10816
|
-
this.wipClient = new WrappedIpClient(rpcClient, wallet);
|
10817
|
-
this.totalLicenseTokenLimitHookClient = new TotalLicenseTokenLimitHookClient(rpcClient, wallet);
|
10818
|
-
this.rpcClient = rpcClient;
|
10819
|
-
this.wallet = wallet;
|
10820
|
-
this.chainId = chainId;
|
10821
|
-
this.walletAddress = wallet.account.address;
|
10822
|
-
}
|
10823
|
-
|
10824
|
-
/**
|
10825
|
-
* Registers new license terms and return the ID of the newly registered license terms.
|
10826
|
-
*
|
10827
|
-
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicenseTemplate.sol#L19 | `LicenseTermsRegistered`} event.
|
10828
|
-
*/
|
10829
|
-
return _createClass(LicenseClient, [{
|
10830
|
-
key: "registerPILTerms",
|
10831
|
-
value: (function () {
|
10832
|
-
var _registerPILTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request) {
|
10833
|
-
var object, _t;
|
10834
|
-
return _regenerator().w(function (_context) {
|
10835
|
-
while (1) switch (_context.p = _context.n) {
|
10836
|
-
case 0:
|
10837
|
-
_context.p = 0;
|
10838
|
-
object = PILFlavor.validateLicenseTerms(request, this.chainId);
|
10839
|
-
_context.n = 1;
|
10840
|
-
return this.registerPILTermsHelper(object, request.txOptions);
|
10841
|
-
case 1:
|
10842
|
-
return _context.a(2, _context.v);
|
10843
|
-
case 2:
|
10844
|
-
_context.p = 2;
|
10845
|
-
_t = _context.v;
|
10846
|
-
return _context.a(2, handleError(_t, "Failed to register license terms"));
|
10847
|
-
}
|
10848
|
-
}, _callee, this, [[0, 2]]);
|
10849
|
-
}));
|
10850
|
-
function registerPILTerms(_x) {
|
10851
|
-
return _registerPILTerms.apply(this, arguments);
|
10852
|
-
}
|
10853
|
-
return registerPILTerms;
|
10854
|
-
}()
|
10855
|
-
/**
|
10856
|
-
* @deprecated Use {@link PILFlavor.nonCommercialSocialRemixing} with {@link LicenseClient.registerPILTerms} instead.
|
10857
|
-
* The method will be removed in the `v1.4.0`.
|
10858
|
-
*
|
10859
|
-
* Convenient function to register a PIL non commercial social remix license to the registry
|
10860
|
-
*
|
10861
|
-
* For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%231%3A-non-commercial-social-remixing | Non Commercial Social Remixing}.
|
10862
|
-
*
|
10863
|
-
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicenseTemplate.sol#L19 | `LicenseTermsRegistered`} event.
|
10864
|
-
*/
|
10865
|
-
)
|
10866
|
-
}, {
|
10867
|
-
key: "registerNonComSocialRemixingPIL",
|
10868
|
-
value: (function () {
|
10869
|
-
var _registerNonComSocialRemixingPIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(request) {
|
10870
|
-
var licenseTerms, _t2;
|
10871
|
-
return _regenerator().w(function (_context2) {
|
10872
|
-
while (1) switch (_context2.p = _context2.n) {
|
10873
|
-
case 0:
|
10874
|
-
_context2.p = 0;
|
10875
|
-
licenseTerms = PILFlavor.nonCommercialSocialRemixing();
|
10876
|
-
_context2.n = 1;
|
10877
|
-
return this.registerPILTermsHelper(licenseTerms, request === null || request === void 0 ? void 0 : request.txOptions);
|
10878
|
-
case 1:
|
10879
|
-
return _context2.a(2, _context2.v);
|
10880
|
-
case 2:
|
10881
|
-
_context2.p = 2;
|
10882
|
-
_t2 = _context2.v;
|
10883
|
-
return _context2.a(2, handleError(_t2, "Failed to register non commercial social remixing PIL"));
|
10884
|
-
}
|
10885
|
-
}, _callee2, this, [[0, 2]]);
|
10886
|
-
}));
|
10887
|
-
function registerNonComSocialRemixingPIL(_x2) {
|
10888
|
-
return _registerNonComSocialRemixingPIL.apply(this, arguments);
|
10889
|
-
}
|
10890
|
-
return registerNonComSocialRemixingPIL;
|
10891
|
-
}()
|
10892
|
-
/**
|
10893
|
-
* @deprecated Use {@link PILFlavor.commercialUse} with {@link LicenseClient.registerPILTerms} instead.
|
10894
|
-
* The method will be removed in the `v1.4.0`.
|
10895
|
-
*
|
10896
|
-
* Convenient function to register a PIL commercial use license to the registry.
|
10897
|
-
*
|
10898
|
-
* For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%232%3A-commercial-use | Commercial Use}.
|
10899
|
-
*
|
10900
|
-
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicenseTemplate.sol#L19 | `LicenseTermsRegistered`} event.
|
10901
|
-
*/
|
10902
|
-
)
|
10903
|
-
}, {
|
10904
|
-
key: "registerCommercialUsePIL",
|
10905
|
-
value: (function () {
|
10906
|
-
var _registerCommercialUsePIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(request) {
|
10907
|
-
var licenseTerms, _t3;
|
10908
|
-
return _regenerator().w(function (_context3) {
|
10909
|
-
while (1) switch (_context3.p = _context3.n) {
|
10910
|
-
case 0:
|
10911
|
-
_context3.p = 0;
|
10912
|
-
licenseTerms = PILFlavor.commercialUse({
|
10913
|
-
defaultMintingFee: Number(request.defaultMintingFee),
|
10914
|
-
currency: request.currency,
|
10915
|
-
royaltyPolicy: request.royaltyPolicyAddress
|
10916
|
-
});
|
10917
|
-
_context3.n = 1;
|
10918
|
-
return this.registerPILTermsHelper(licenseTerms, request.txOptions);
|
10919
|
-
case 1:
|
10920
|
-
return _context3.a(2, _context3.v);
|
10921
|
-
case 2:
|
10922
|
-
_context3.p = 2;
|
10923
|
-
_t3 = _context3.v;
|
10924
|
-
return _context3.a(2, handleError(_t3, "Failed to register commercial use PIL"));
|
10925
|
-
}
|
10926
|
-
}, _callee3, this, [[0, 2]]);
|
10927
|
-
}));
|
10928
|
-
function registerCommercialUsePIL(_x3) {
|
10929
|
-
return _registerCommercialUsePIL.apply(this, arguments);
|
10930
|
-
}
|
10931
|
-
return registerCommercialUsePIL;
|
10932
|
-
}()
|
10933
|
-
/**
|
10934
|
-
* @deprecated Use {@link PILFlavor.commercialRemix} with {@link LicenseClient.registerPILTerms} instead.
|
10935
|
-
* The method will be removed in the v1.4.0.
|
10936
|
-
*
|
10937
|
-
* Convenient function to register a PIL commercial Remix license to the registry.
|
10938
|
-
*
|
10939
|
-
* For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%233%3A-commercial-remix | Commercial Remix }.
|
10940
|
-
*
|
10941
|
-
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicenseTemplate.sol#L19 | `LicenseTermsRegistered`} event.
|
10942
|
-
*/
|
10943
|
-
)
|
10944
|
-
}, {
|
10945
|
-
key: "registerCommercialRemixPIL",
|
10946
|
-
value: (function () {
|
10947
|
-
var _registerCommercialRemixPIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(_ref) {
|
10948
|
-
var defaultMintingFee, currency, royaltyPolicyAddress, commercialRevShare, txOptions, licenseTerms, _t4;
|
10949
|
-
return _regenerator().w(function (_context4) {
|
10950
|
-
while (1) switch (_context4.p = _context4.n) {
|
11160
|
+
}, {
|
11161
|
+
key: "processIpAssetLicenseTerms",
|
11162
|
+
value: function () {
|
11163
|
+
var _processIpAssetLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36(ipAsset, extraData) {
|
11164
|
+
var _extraData$licenseTer;
|
11165
|
+
var licenseTermsIds, maxLicenseTokens, maxLicenseTokensData, maxLicenseTokensTxHashes;
|
11166
|
+
return _regenerator().w(function (_context36) {
|
11167
|
+
while (1) switch (_context36.n) {
|
10951
11168
|
case 0:
|
10952
|
-
|
10953
|
-
|
10954
|
-
|
10955
|
-
|
10956
|
-
|
10957
|
-
|
10958
|
-
|
10959
|
-
|
10960
|
-
|
10961
|
-
|
11169
|
+
if (extraData !== null && extraData !== void 0 && (_extraData$licenseTer = extraData.licenseTermsData) !== null && _extraData$licenseTer !== void 0 && _extraData$licenseTer.length) {
|
11170
|
+
_context36.n = 1;
|
11171
|
+
break;
|
11172
|
+
}
|
11173
|
+
return _context36.a(2, ipAsset);
|
11174
|
+
case 1:
|
11175
|
+
_context36.n = 2;
|
11176
|
+
return this.getLicenseTermsId(extraData.licenseTermsData.map(function (item) {
|
11177
|
+
return item.terms;
|
11178
|
+
}));
|
10962
11179
|
case 2:
|
10963
|
-
|
11180
|
+
licenseTermsIds = _context36.v;
|
11181
|
+
ipAsset.licenseTermsIds = licenseTermsIds;
|
11182
|
+
maxLicenseTokens = extraData.maxLicenseTokens;
|
11183
|
+
if (maxLicenseTokens !== null && maxLicenseTokens !== void 0 && maxLicenseTokens.length) {
|
11184
|
+
_context36.n = 3;
|
11185
|
+
break;
|
11186
|
+
}
|
11187
|
+
return _context36.a(2, ipAsset);
|
10964
11188
|
case 3:
|
10965
|
-
|
10966
|
-
|
10967
|
-
|
11189
|
+
maxLicenseTokensData = maxLicenseTokens.filter(function (maxLicenseToken) {
|
11190
|
+
return maxLicenseToken !== undefined;
|
11191
|
+
}).map(function (maxLicenseToken) {
|
11192
|
+
return {
|
11193
|
+
maxLicenseTokens: maxLicenseToken
|
11194
|
+
};
|
11195
|
+
});
|
11196
|
+
_context36.n = 4;
|
11197
|
+
return setMaxLicenseTokens({
|
11198
|
+
maxLicenseTokensData: maxLicenseTokensData,
|
11199
|
+
licensorIpId: ipAsset.ipId,
|
11200
|
+
licenseTermsIds: licenseTermsIds,
|
11201
|
+
totalLicenseTokenLimitHookClient: this.totalLicenseTokenLimitHookClient,
|
11202
|
+
templateAddress: this.licenseTemplateAddress
|
11203
|
+
});
|
11204
|
+
case 4:
|
11205
|
+
maxLicenseTokensTxHashes = _context36.v;
|
11206
|
+
if (maxLicenseTokensTxHashes !== null && maxLicenseTokensTxHashes !== void 0 && maxLicenseTokensTxHashes.length) {
|
11207
|
+
ipAsset.maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
|
11208
|
+
}
|
11209
|
+
return _context36.a(2, ipAsset);
|
10968
11210
|
}
|
10969
|
-
},
|
11211
|
+
}, _callee36, this);
|
10970
11212
|
}));
|
10971
|
-
function
|
10972
|
-
return
|
11213
|
+
function processIpAssetLicenseTerms(_x36, _x37) {
|
11214
|
+
return _processIpAssetLicenseTerms.apply(this, arguments);
|
10973
11215
|
}
|
10974
|
-
return
|
11216
|
+
return processIpAssetLicenseTerms;
|
10975
11217
|
}()
|
10976
|
-
|
10977
|
-
|
10978
|
-
|
10979
|
-
|
10980
|
-
|
10981
|
-
|
10982
|
-
|
10983
|
-
|
10984
|
-
|
10985
|
-
|
10986
|
-
|
10987
|
-
)
|
10988
|
-
|
10989
|
-
|
11218
|
+
}]);
|
11219
|
+
}();
|
11220
|
+
|
11221
|
+
var LicenseClient = /*#__PURE__*/function () {
|
11222
|
+
function LicenseClient(rpcClient, wallet, chainId) {
|
11223
|
+
_classCallCheck(this, LicenseClient);
|
11224
|
+
this.licensingModuleClient = new LicensingModuleClient(rpcClient, wallet);
|
11225
|
+
this.piLicenseTemplateReadOnlyClient = new PiLicenseTemplateReadOnlyClient(rpcClient);
|
11226
|
+
this.licenseTemplateClient = new PiLicenseTemplateClient(rpcClient, wallet);
|
11227
|
+
this.licenseRegistryReadOnlyClient = new LicenseRegistryReadOnlyClient(rpcClient);
|
11228
|
+
this.ipAssetRegistryClient = new IpAssetRegistryClient(rpcClient, wallet);
|
11229
|
+
this.moduleRegistryReadOnlyClient = new ModuleRegistryReadOnlyClient(rpcClient);
|
11230
|
+
this.multicall3Client = new Multicall3Client(rpcClient, wallet);
|
11231
|
+
this.wipClient = new WrappedIpClient(rpcClient, wallet);
|
11232
|
+
this.totalLicenseTokenLimitHookClient = new TotalLicenseTokenLimitHookClient(rpcClient, wallet);
|
11233
|
+
this.licenseAttachmentWorkflowsClient = new LicenseAttachmentWorkflowsClient(rpcClient, wallet);
|
11234
|
+
this.rpcClient = rpcClient;
|
11235
|
+
this.wallet = wallet;
|
11236
|
+
this.chainId = chainId;
|
11237
|
+
this.walletAddress = wallet.account.address;
|
11238
|
+
}
|
11239
|
+
|
11240
|
+
/**
|
11241
|
+
* Registers new license terms and return the ID of the newly registered license terms.
|
11242
|
+
*
|
11243
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicenseTemplate.sol#L19 | `LicenseTermsRegistered`} event.
|
11244
|
+
*/
|
11245
|
+
return _createClass(LicenseClient, [{
|
11246
|
+
key: "registerPILTerms",
|
10990
11247
|
value: (function () {
|
10991
|
-
var
|
10992
|
-
var
|
10993
|
-
return _regenerator().w(function (
|
10994
|
-
while (1) switch (
|
11248
|
+
var _registerPILTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request) {
|
11249
|
+
var object, _t;
|
11250
|
+
return _regenerator().w(function (_context) {
|
11251
|
+
while (1) switch (_context.p = _context.n) {
|
10995
11252
|
case 0:
|
10996
|
-
|
10997
|
-
|
10998
|
-
|
10999
|
-
return this.registerPILTermsHelper(
|
11000
|
-
|
11001
|
-
|
11002
|
-
}), txOptions);
|
11253
|
+
_context.p = 0;
|
11254
|
+
object = PILFlavor.validateLicenseTerms(request, this.chainId);
|
11255
|
+
_context.n = 1;
|
11256
|
+
return this.registerPILTermsHelper(object, request.txOptions);
|
11257
|
+
case 1:
|
11258
|
+
return _context.a(2, _context.v);
|
11003
11259
|
case 2:
|
11004
|
-
|
11005
|
-
|
11006
|
-
|
11007
|
-
_t5 = _context5.v;
|
11008
|
-
return _context5.a(2, handleError(_t5, "Failed to register creative commons attribution PIL"));
|
11260
|
+
_context.p = 2;
|
11261
|
+
_t = _context.v;
|
11262
|
+
return _context.a(2, handleError(_t, "Failed to register license terms"));
|
11009
11263
|
}
|
11010
|
-
},
|
11264
|
+
}, _callee, this, [[0, 2]]);
|
11011
11265
|
}));
|
11012
|
-
function
|
11013
|
-
return
|
11266
|
+
function registerPILTerms(_x) {
|
11267
|
+
return _registerPILTerms.apply(this, arguments);
|
11014
11268
|
}
|
11015
|
-
return
|
11269
|
+
return registerPILTerms;
|
11016
11270
|
}()
|
11017
11271
|
/**
|
11018
11272
|
* Attaches license terms to an IP.
|
@@ -11021,50 +11275,50 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11021
11275
|
}, {
|
11022
11276
|
key: "attachLicenseTerms",
|
11023
11277
|
value: (function () {
|
11024
|
-
var _attachLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
11025
|
-
var _request$txOptions, isRegistered, isExisted, isAttachedLicenseTerms, req, txHash,
|
11026
|
-
return _regenerator().w(function (
|
11027
|
-
while (1) switch (
|
11278
|
+
var _attachLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(request) {
|
11279
|
+
var _request$txOptions, isRegistered, isExisted, isAttachedLicenseTerms, req, txHash, _t2;
|
11280
|
+
return _regenerator().w(function (_context2) {
|
11281
|
+
while (1) switch (_context2.p = _context2.n) {
|
11028
11282
|
case 0:
|
11029
|
-
|
11283
|
+
_context2.p = 0;
|
11030
11284
|
request.licenseTermsId = BigInt(request.licenseTermsId);
|
11031
|
-
|
11285
|
+
_context2.n = 1;
|
11032
11286
|
return this.ipAssetRegistryClient.isRegistered({
|
11033
11287
|
id: validateAddress(request.ipId)
|
11034
11288
|
});
|
11035
11289
|
case 1:
|
11036
|
-
isRegistered =
|
11290
|
+
isRegistered = _context2.v;
|
11037
11291
|
if (isRegistered) {
|
11038
|
-
|
11292
|
+
_context2.n = 2;
|
11039
11293
|
break;
|
11040
11294
|
}
|
11041
11295
|
throw new Error("The IP with id ".concat(request.ipId, " is not registered."));
|
11042
11296
|
case 2:
|
11043
|
-
|
11297
|
+
_context2.n = 3;
|
11044
11298
|
return this.piLicenseTemplateReadOnlyClient.exists({
|
11045
11299
|
licenseTermsId: request.licenseTermsId
|
11046
11300
|
});
|
11047
11301
|
case 3:
|
11048
|
-
isExisted =
|
11302
|
+
isExisted = _context2.v;
|
11049
11303
|
if (isExisted) {
|
11050
|
-
|
11304
|
+
_context2.n = 4;
|
11051
11305
|
break;
|
11052
11306
|
}
|
11053
11307
|
throw new Error("License terms id ".concat(request.licenseTermsId, " do not exist."));
|
11054
11308
|
case 4:
|
11055
|
-
|
11309
|
+
_context2.n = 5;
|
11056
11310
|
return this.licenseRegistryReadOnlyClient.hasIpAttachedLicenseTerms({
|
11057
11311
|
ipId: request.ipId,
|
11058
11312
|
licenseTemplate: validateAddress(request.licenseTemplate || this.licenseTemplateClient.address),
|
11059
11313
|
licenseTermsId: request.licenseTermsId
|
11060
11314
|
});
|
11061
11315
|
case 5:
|
11062
|
-
isAttachedLicenseTerms =
|
11316
|
+
isAttachedLicenseTerms = _context2.v;
|
11063
11317
|
if (!isAttachedLicenseTerms) {
|
11064
|
-
|
11318
|
+
_context2.n = 6;
|
11065
11319
|
break;
|
11066
11320
|
}
|
11067
|
-
return
|
11321
|
+
return _context2.a(2, {
|
11068
11322
|
success: false
|
11069
11323
|
});
|
11070
11324
|
case 6:
|
@@ -11074,39 +11328,39 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11074
11328
|
licenseTermsId: request.licenseTermsId
|
11075
11329
|
};
|
11076
11330
|
if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.encodedTxDataOnly)) {
|
11077
|
-
|
11331
|
+
_context2.n = 7;
|
11078
11332
|
break;
|
11079
11333
|
}
|
11080
|
-
return
|
11334
|
+
return _context2.a(2, {
|
11081
11335
|
encodedTxData: this.licensingModuleClient.attachLicenseTermsEncode(req)
|
11082
11336
|
});
|
11083
11337
|
case 7:
|
11084
|
-
|
11338
|
+
_context2.n = 8;
|
11085
11339
|
return this.licensingModuleClient.attachLicenseTerms(req);
|
11086
11340
|
case 8:
|
11087
|
-
txHash =
|
11088
|
-
|
11341
|
+
txHash = _context2.v;
|
11342
|
+
_context2.n = 9;
|
11089
11343
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
11090
11344
|
hash: txHash
|
11091
11345
|
}));
|
11092
11346
|
case 9:
|
11093
|
-
return
|
11347
|
+
return _context2.a(2, {
|
11094
11348
|
txHash: txHash,
|
11095
11349
|
success: true
|
11096
11350
|
});
|
11097
11351
|
case 10:
|
11098
|
-
|
11352
|
+
_context2.n = 12;
|
11099
11353
|
break;
|
11100
11354
|
case 11:
|
11101
|
-
|
11102
|
-
|
11103
|
-
return
|
11355
|
+
_context2.p = 11;
|
11356
|
+
_t2 = _context2.v;
|
11357
|
+
return _context2.a(2, handleError(_t2, "Failed to attach license terms"));
|
11104
11358
|
case 12:
|
11105
|
-
return
|
11359
|
+
return _context2.a(2);
|
11106
11360
|
}
|
11107
|
-
},
|
11361
|
+
}, _callee2, this, [[0, 11]]);
|
11108
11362
|
}));
|
11109
|
-
function attachLicenseTerms(
|
11363
|
+
function attachLicenseTerms(_x2) {
|
11110
11364
|
return _attachLicenseTerms.apply(this, arguments);
|
11111
11365
|
}
|
11112
11366
|
return attachLicenseTerms;
|
@@ -11130,13 +11384,13 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11130
11384
|
}, {
|
11131
11385
|
key: "mintLicenseTokens",
|
11132
11386
|
value: (function () {
|
11133
|
-
var _mintLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
11387
|
+
var _mintLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(request) {
|
11134
11388
|
var _this = this;
|
11135
|
-
var _request$txOptions2, _request$options, receiver, req, isLicenseIpIdRegistered, isExisted, ipAccount, ipOwner, isAttachedLicenseTerms, encodedTxData, licenseMintingFee, wipSpenders, _yield$contractCallWi, txHash, receipt, targetLogs, startLicenseTokenId, licenseTokenIds, i,
|
11136
|
-
return _regenerator().w(function (
|
11137
|
-
while (1) switch (
|
11389
|
+
var _request$maxMintingFe, _request$maxRevenueSh, _request$txOptions2, _request$options, receiver, req, isLicenseIpIdRegistered, isExisted, ipAccount, ipOwner, isAttachedLicenseTerms, encodedTxData, licenseMintingFee, wipSpenders, _yield$contractCallWi, txHash, receipt, targetLogs, startLicenseTokenId, licenseTokenIds, i, _t3;
|
11390
|
+
return _regenerator().w(function (_context3) {
|
11391
|
+
while (1) switch (_context3.p = _context3.n) {
|
11138
11392
|
case 0:
|
11139
|
-
|
11393
|
+
_context3.p = 0;
|
11140
11394
|
receiver = validateAddress(request.receiver || this.walletAddress);
|
11141
11395
|
req = {
|
11142
11396
|
licensorIpId: validateAddress(request.licensorIpId),
|
@@ -11145,72 +11399,72 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11145
11399
|
amount: BigInt(request.amount === undefined ? 1 : request.amount),
|
11146
11400
|
receiver: receiver,
|
11147
11401
|
royaltyContext: viem.zeroAddress,
|
11148
|
-
maxMintingFee: BigInt(request.maxMintingFee),
|
11149
|
-
maxRevenueShare: getRevenueShare(request.maxRevenueShare, RevShareType.MAX_REVENUE_SHARE)
|
11402
|
+
maxMintingFee: BigInt((_request$maxMintingFe = request.maxMintingFee) !== null && _request$maxMintingFe !== void 0 ? _request$maxMintingFe : 0),
|
11403
|
+
maxRevenueShare: getRevenueShare((_request$maxRevenueSh = request.maxRevenueShare) !== null && _request$maxRevenueSh !== void 0 ? _request$maxRevenueSh : 100, RevShareType.MAX_REVENUE_SHARE)
|
11150
11404
|
};
|
11151
11405
|
if (!(req.maxMintingFee < 0)) {
|
11152
|
-
|
11406
|
+
_context3.n = 1;
|
11153
11407
|
break;
|
11154
11408
|
}
|
11155
11409
|
throw new Error("The maxMintingFee must be greater than 0.");
|
11156
11410
|
case 1:
|
11157
|
-
|
11411
|
+
_context3.n = 2;
|
11158
11412
|
return this.ipAssetRegistryClient.isRegistered({
|
11159
11413
|
id: validateAddress(request.licensorIpId)
|
11160
11414
|
});
|
11161
11415
|
case 2:
|
11162
|
-
isLicenseIpIdRegistered =
|
11416
|
+
isLicenseIpIdRegistered = _context3.v;
|
11163
11417
|
if (isLicenseIpIdRegistered) {
|
11164
|
-
|
11418
|
+
_context3.n = 3;
|
11165
11419
|
break;
|
11166
11420
|
}
|
11167
11421
|
throw new Error("The licensor IP with id ".concat(request.licensorIpId, " is not registered."));
|
11168
11422
|
case 3:
|
11169
|
-
|
11423
|
+
_context3.n = 4;
|
11170
11424
|
return this.piLicenseTemplateReadOnlyClient.exists({
|
11171
11425
|
licenseTermsId: req.licenseTermsId
|
11172
11426
|
});
|
11173
11427
|
case 4:
|
11174
|
-
isExisted =
|
11428
|
+
isExisted = _context3.v;
|
11175
11429
|
if (isExisted) {
|
11176
|
-
|
11430
|
+
_context3.n = 5;
|
11177
11431
|
break;
|
11178
11432
|
}
|
11179
11433
|
throw new Error("License terms id ".concat(request.licenseTermsId, " do not exist."));
|
11180
11434
|
case 5:
|
11181
11435
|
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, req.licensorIpId);
|
11182
|
-
|
11436
|
+
_context3.n = 6;
|
11183
11437
|
return ipAccount.owner();
|
11184
11438
|
case 6:
|
11185
|
-
ipOwner =
|
11439
|
+
ipOwner = _context3.v;
|
11186
11440
|
if (!(ipOwner !== this.walletAddress)) {
|
11187
|
-
|
11441
|
+
_context3.n = 8;
|
11188
11442
|
break;
|
11189
11443
|
}
|
11190
|
-
|
11444
|
+
_context3.n = 7;
|
11191
11445
|
return this.licenseRegistryReadOnlyClient.hasIpAttachedLicenseTerms({
|
11192
11446
|
ipId: req.licensorIpId,
|
11193
11447
|
licenseTemplate: req.licenseTemplate,
|
11194
11448
|
licenseTermsId: req.licenseTermsId
|
11195
11449
|
});
|
11196
11450
|
case 7:
|
11197
|
-
isAttachedLicenseTerms =
|
11451
|
+
isAttachedLicenseTerms = _context3.v;
|
11198
11452
|
if (isAttachedLicenseTerms) {
|
11199
|
-
|
11453
|
+
_context3.n = 8;
|
11200
11454
|
break;
|
11201
11455
|
}
|
11202
11456
|
throw new Error("License terms id ".concat(req.licenseTermsId, " is not attached to the IP with id ").concat(req.licensorIpId, "."));
|
11203
11457
|
case 8:
|
11204
11458
|
encodedTxData = this.licensingModuleClient.mintLicenseTokensEncode(req);
|
11205
11459
|
if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.encodedTxDataOnly)) {
|
11206
|
-
|
11460
|
+
_context3.n = 9;
|
11207
11461
|
break;
|
11208
11462
|
}
|
11209
|
-
return
|
11463
|
+
return _context3.a(2, {
|
11210
11464
|
encodedTxData: encodedTxData
|
11211
11465
|
});
|
11212
11466
|
case 9:
|
11213
|
-
|
11467
|
+
_context3.n = 10;
|
11214
11468
|
return calculateLicenseWipMintFee({
|
11215
11469
|
predictMintingFeeRequest: req,
|
11216
11470
|
rpcClient: this.rpcClient,
|
@@ -11218,7 +11472,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11218
11472
|
walletAddress: this.walletAddress
|
11219
11473
|
});
|
11220
11474
|
case 10:
|
11221
|
-
licenseMintingFee =
|
11475
|
+
licenseMintingFee = _context3.v;
|
11222
11476
|
wipSpenders = [];
|
11223
11477
|
if (licenseMintingFee > 0n) {
|
11224
11478
|
wipSpenders.push({
|
@@ -11226,7 +11480,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11226
11480
|
amount: licenseMintingFee
|
11227
11481
|
});
|
11228
11482
|
}
|
11229
|
-
|
11483
|
+
_context3.n = 11;
|
11230
11484
|
return contractCallWithFees({
|
11231
11485
|
totalFees: licenseMintingFee,
|
11232
11486
|
options: {
|
@@ -11244,7 +11498,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11244
11498
|
encodedTxs: [encodedTxData]
|
11245
11499
|
});
|
11246
11500
|
case 11:
|
11247
|
-
_yield$contractCallWi =
|
11501
|
+
_yield$contractCallWi = _context3.v;
|
11248
11502
|
txHash = _yield$contractCallWi.txHash;
|
11249
11503
|
receipt = _yield$contractCallWi.receipt;
|
11250
11504
|
targetLogs = this.licensingModuleClient.parseTxLicenseTokensMintedEvent(receipt);
|
@@ -11253,19 +11507,19 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11253
11507
|
for (i = 0; i < req.amount; i++) {
|
11254
11508
|
licenseTokenIds.push(startLicenseTokenId + BigInt(i));
|
11255
11509
|
}
|
11256
|
-
return
|
11510
|
+
return _context3.a(2, {
|
11257
11511
|
txHash: txHash,
|
11258
11512
|
licenseTokenIds: licenseTokenIds,
|
11259
11513
|
receipt: receipt
|
11260
11514
|
});
|
11261
11515
|
case 12:
|
11262
|
-
|
11263
|
-
|
11264
|
-
return
|
11516
|
+
_context3.p = 12;
|
11517
|
+
_t3 = _context3.v;
|
11518
|
+
return _context3.a(2, handleError(_t3, "Failed to mint license tokens"));
|
11265
11519
|
}
|
11266
|
-
},
|
11520
|
+
}, _callee3, this, [[0, 12]]);
|
11267
11521
|
}));
|
11268
|
-
function mintLicenseTokens(
|
11522
|
+
function mintLicenseTokens(_x3) {
|
11269
11523
|
return _mintLicenseTokens.apply(this, arguments);
|
11270
11524
|
}
|
11271
11525
|
return mintLicenseTokens;
|
@@ -11277,26 +11531,26 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11277
11531
|
}, {
|
11278
11532
|
key: "getLicenseTerms",
|
11279
11533
|
value: (function () {
|
11280
|
-
var _getLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
11281
|
-
var
|
11282
|
-
return _regenerator().w(function (
|
11283
|
-
while (1) switch (
|
11534
|
+
var _getLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(selectedLicenseTermsId) {
|
11535
|
+
var _t4;
|
11536
|
+
return _regenerator().w(function (_context4) {
|
11537
|
+
while (1) switch (_context4.p = _context4.n) {
|
11284
11538
|
case 0:
|
11285
|
-
|
11286
|
-
|
11539
|
+
_context4.p = 0;
|
11540
|
+
_context4.n = 1;
|
11287
11541
|
return this.piLicenseTemplateReadOnlyClient.getLicenseTerms({
|
11288
11542
|
selectedLicenseTermsId: BigInt(selectedLicenseTermsId)
|
11289
11543
|
});
|
11290
11544
|
case 1:
|
11291
|
-
return
|
11545
|
+
return _context4.a(2, _context4.v);
|
11292
11546
|
case 2:
|
11293
|
-
|
11294
|
-
|
11295
|
-
return
|
11547
|
+
_context4.p = 2;
|
11548
|
+
_t4 = _context4.v;
|
11549
|
+
return _context4.a(2, handleError(_t4, "Failed to get license terms"));
|
11296
11550
|
}
|
11297
|
-
},
|
11551
|
+
}, _callee4, this, [[0, 2]]);
|
11298
11552
|
}));
|
11299
|
-
function getLicenseTerms(
|
11553
|
+
function getLicenseTerms(_x4) {
|
11300
11554
|
return _getLicenseTerms.apply(this, arguments);
|
11301
11555
|
}
|
11302
11556
|
return getLicenseTerms;
|
@@ -11308,33 +11562,33 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11308
11562
|
}, {
|
11309
11563
|
key: "predictMintingLicenseFee",
|
11310
11564
|
value: (function () {
|
11311
|
-
var _predictMintingLicenseFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
11312
|
-
var isLicenseIpIdRegistered, licenseTermsId, isExisted, object,
|
11313
|
-
return _regenerator().w(function (
|
11314
|
-
while (1) switch (
|
11565
|
+
var _predictMintingLicenseFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(request) {
|
11566
|
+
var isLicenseIpIdRegistered, licenseTermsId, isExisted, object, _t5;
|
11567
|
+
return _regenerator().w(function (_context5) {
|
11568
|
+
while (1) switch (_context5.p = _context5.n) {
|
11315
11569
|
case 0:
|
11316
|
-
|
11317
|
-
|
11570
|
+
_context5.p = 0;
|
11571
|
+
_context5.n = 1;
|
11318
11572
|
return this.ipAssetRegistryClient.isRegistered({
|
11319
11573
|
id: validateAddress(request.licensorIpId)
|
11320
11574
|
});
|
11321
11575
|
case 1:
|
11322
|
-
isLicenseIpIdRegistered =
|
11576
|
+
isLicenseIpIdRegistered = _context5.v;
|
11323
11577
|
if (isLicenseIpIdRegistered) {
|
11324
|
-
|
11578
|
+
_context5.n = 2;
|
11325
11579
|
break;
|
11326
11580
|
}
|
11327
11581
|
throw new Error("The licensor IP with id ".concat(request.licensorIpId, " is not registered."));
|
11328
11582
|
case 2:
|
11329
11583
|
licenseTermsId = BigInt(request.licenseTermsId);
|
11330
|
-
|
11584
|
+
_context5.n = 3;
|
11331
11585
|
return this.piLicenseTemplateReadOnlyClient.exists({
|
11332
11586
|
licenseTermsId: licenseTermsId
|
11333
11587
|
});
|
11334
11588
|
case 3:
|
11335
|
-
isExisted =
|
11589
|
+
isExisted = _context5.v;
|
11336
11590
|
if (isExisted) {
|
11337
|
-
|
11591
|
+
_context5.n = 4;
|
11338
11592
|
break;
|
11339
11593
|
}
|
11340
11594
|
throw new Error("License terms id ".concat(request.licenseTermsId, " do not exist."));
|
@@ -11346,7 +11600,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11346
11600
|
licenseTemplate: validateAddress(request.licenseTemplate || this.licenseTemplateClient.address),
|
11347
11601
|
licenseTermsId: licenseTermsId
|
11348
11602
|
});
|
11349
|
-
|
11603
|
+
_context5.n = 5;
|
11350
11604
|
return predictMintingLicenseFee({
|
11351
11605
|
predictMintingFeeRequest: object,
|
11352
11606
|
rpcClient: this.rpcClient,
|
@@ -11354,15 +11608,15 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11354
11608
|
walletAddress: this.walletAddress
|
11355
11609
|
});
|
11356
11610
|
case 5:
|
11357
|
-
return
|
11611
|
+
return _context5.a(2, _context5.v);
|
11358
11612
|
case 6:
|
11359
|
-
|
11360
|
-
|
11361
|
-
return
|
11613
|
+
_context5.p = 6;
|
11614
|
+
_t5 = _context5.v;
|
11615
|
+
return _context5.a(2, handleError(_t5, "Failed to predict minting license fee"));
|
11362
11616
|
}
|
11363
|
-
},
|
11617
|
+
}, _callee5, this, [[0, 6]]);
|
11364
11618
|
}));
|
11365
|
-
function predictMintingLicenseFee$1(
|
11619
|
+
function predictMintingLicenseFee$1(_x5) {
|
11366
11620
|
return _predictMintingLicenseFee2.apply(this, arguments);
|
11367
11621
|
}
|
11368
11622
|
return predictMintingLicenseFee$1;
|
@@ -11374,12 +11628,12 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11374
11628
|
}, {
|
11375
11629
|
key: "setLicensingConfig",
|
11376
11630
|
value: (function () {
|
11377
|
-
var _setLicensingConfig = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
11378
|
-
var _request$txOptions3, req, isLicenseIpIdRegistered, isExisted, isRegistered, txHash,
|
11379
|
-
return _regenerator().w(function (
|
11380
|
-
while (1) switch (
|
11631
|
+
var _setLicensingConfig = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(request) {
|
11632
|
+
var _request$txOptions3, req, isLicenseIpIdRegistered, isExisted, isRegistered, txHash, _t6;
|
11633
|
+
return _regenerator().w(function (_context6) {
|
11634
|
+
while (1) switch (_context6.p = _context6.n) {
|
11381
11635
|
case 0:
|
11382
|
-
|
11636
|
+
_context6.p = 0;
|
11383
11637
|
req = {
|
11384
11638
|
ipId: request.ipId,
|
11385
11639
|
licenseTemplate: validateAddress(request.licenseTemplate || this.licenseTemplateClient.address),
|
@@ -11387,91 +11641,91 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11387
11641
|
licensingConfig: validateLicenseConfig(request.licensingConfig)
|
11388
11642
|
};
|
11389
11643
|
if (!(req.licenseTemplate === viem.zeroAddress && req.licensingConfig.commercialRevShare !== 0)) {
|
11390
|
-
|
11644
|
+
_context6.n = 1;
|
11391
11645
|
break;
|
11392
11646
|
}
|
11393
11647
|
throw new Error("The license template cannot be zero address if commercial revenue share is not zero.");
|
11394
11648
|
case 1:
|
11395
|
-
|
11649
|
+
_context6.n = 2;
|
11396
11650
|
return this.ipAssetRegistryClient.isRegistered({
|
11397
11651
|
id: validateAddress(req.ipId)
|
11398
11652
|
});
|
11399
11653
|
case 2:
|
11400
|
-
isLicenseIpIdRegistered =
|
11654
|
+
isLicenseIpIdRegistered = _context6.v;
|
11401
11655
|
if (isLicenseIpIdRegistered) {
|
11402
|
-
|
11656
|
+
_context6.n = 3;
|
11403
11657
|
break;
|
11404
11658
|
}
|
11405
11659
|
throw new Error("The licensor IP with id ".concat(req.ipId, " is not registered."));
|
11406
11660
|
case 3:
|
11407
|
-
|
11661
|
+
_context6.n = 4;
|
11408
11662
|
return this.piLicenseTemplateReadOnlyClient.exists({
|
11409
11663
|
licenseTermsId: req.licenseTermsId
|
11410
11664
|
});
|
11411
11665
|
case 4:
|
11412
|
-
isExisted =
|
11666
|
+
isExisted = _context6.v;
|
11413
11667
|
if (isExisted) {
|
11414
|
-
|
11668
|
+
_context6.n = 5;
|
11415
11669
|
break;
|
11416
11670
|
}
|
11417
11671
|
throw new Error("License terms id ".concat(req.licenseTermsId, " do not exist."));
|
11418
11672
|
case 5:
|
11419
11673
|
if (!(req.licensingConfig.licensingHook !== viem.zeroAddress)) {
|
11420
|
-
|
11674
|
+
_context6.n = 7;
|
11421
11675
|
break;
|
11422
11676
|
}
|
11423
|
-
|
11677
|
+
_context6.n = 6;
|
11424
11678
|
return this.moduleRegistryReadOnlyClient.isRegistered({
|
11425
11679
|
moduleAddress: req.licensingConfig.licensingHook
|
11426
11680
|
});
|
11427
11681
|
case 6:
|
11428
|
-
isRegistered =
|
11682
|
+
isRegistered = _context6.v;
|
11429
11683
|
if (isRegistered) {
|
11430
|
-
|
11684
|
+
_context6.n = 7;
|
11431
11685
|
break;
|
11432
11686
|
}
|
11433
11687
|
throw new Error("The licensing hook is not registered.");
|
11434
11688
|
case 7:
|
11435
11689
|
if (!(req.licenseTemplate === viem.zeroAddress && req.licenseTermsId !== 0n)) {
|
11436
|
-
|
11690
|
+
_context6.n = 8;
|
11437
11691
|
break;
|
11438
11692
|
}
|
11439
11693
|
throw new Error("The license template is zero address but license terms id is not zero.");
|
11440
11694
|
case 8:
|
11441
11695
|
if (!((_request$txOptions3 = request.txOptions) !== null && _request$txOptions3 !== void 0 && _request$txOptions3.encodedTxDataOnly)) {
|
11442
|
-
|
11696
|
+
_context6.n = 9;
|
11443
11697
|
break;
|
11444
11698
|
}
|
11445
|
-
return
|
11699
|
+
return _context6.a(2, {
|
11446
11700
|
encodedTxData: this.licensingModuleClient.setLicensingConfigEncode(req)
|
11447
11701
|
});
|
11448
11702
|
case 9:
|
11449
|
-
|
11703
|
+
_context6.n = 10;
|
11450
11704
|
return this.licensingModuleClient.setLicensingConfig(req);
|
11451
11705
|
case 10:
|
11452
|
-
txHash =
|
11453
|
-
|
11706
|
+
txHash = _context6.v;
|
11707
|
+
_context6.n = 11;
|
11454
11708
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
11455
11709
|
hash: txHash
|
11456
11710
|
}));
|
11457
11711
|
case 11:
|
11458
|
-
return
|
11712
|
+
return _context6.a(2, {
|
11459
11713
|
txHash: txHash,
|
11460
11714
|
success: true
|
11461
11715
|
});
|
11462
11716
|
case 12:
|
11463
|
-
|
11717
|
+
_context6.n = 14;
|
11464
11718
|
break;
|
11465
11719
|
case 13:
|
11466
|
-
|
11467
|
-
|
11468
|
-
return
|
11720
|
+
_context6.p = 13;
|
11721
|
+
_t6 = _context6.v;
|
11722
|
+
return _context6.a(2, handleError(_t6, "Failed to set licensing config"));
|
11469
11723
|
case 14:
|
11470
|
-
return
|
11724
|
+
return _context6.a(2);
|
11471
11725
|
}
|
11472
|
-
},
|
11726
|
+
}, _callee6, this, [[0, 13]]);
|
11473
11727
|
}));
|
11474
|
-
function setLicensingConfig(
|
11728
|
+
function setLicensingConfig(_x6) {
|
11475
11729
|
return _setLicensingConfig.apply(this, arguments);
|
11476
11730
|
}
|
11477
11731
|
return setLicensingConfig;
|
@@ -11489,34 +11743,34 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11489
11743
|
}, {
|
11490
11744
|
key: "setMaxLicenseTokens",
|
11491
11745
|
value: (function () {
|
11492
|
-
var _setMaxLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
11493
|
-
var ipId, licenseTermsId, maxLicenseTokens, licenseTemplate, txOptions, newLicenseTermsId, newLicenseTemplate, licensingConfig, txHash,
|
11494
|
-
return _regenerator().w(function (
|
11495
|
-
while (1) switch (
|
11746
|
+
var _setMaxLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(_ref) {
|
11747
|
+
var ipId, licenseTermsId, maxLicenseTokens, licenseTemplate, txOptions, newLicenseTermsId, newLicenseTemplate, licensingConfig, txHash, _t7;
|
11748
|
+
return _regenerator().w(function (_context7) {
|
11749
|
+
while (1) switch (_context7.p = _context7.n) {
|
11496
11750
|
case 0:
|
11497
|
-
ipId =
|
11498
|
-
|
11751
|
+
ipId = _ref.ipId, licenseTermsId = _ref.licenseTermsId, maxLicenseTokens = _ref.maxLicenseTokens, licenseTemplate = _ref.licenseTemplate, txOptions = _ref.txOptions;
|
11752
|
+
_context7.p = 1;
|
11499
11753
|
if (!(maxLicenseTokens < 0)) {
|
11500
|
-
|
11754
|
+
_context7.n = 2;
|
11501
11755
|
break;
|
11502
11756
|
}
|
11503
11757
|
throw new Error("The max license tokens must be greater than 0.");
|
11504
11758
|
case 2:
|
11505
11759
|
newLicenseTermsId = BigInt(licenseTermsId);
|
11506
11760
|
newLicenseTemplate = validateAddress(licenseTemplate || this.licenseTemplateClient.address);
|
11507
|
-
|
11761
|
+
_context7.n = 3;
|
11508
11762
|
return this.getLicensingConfig({
|
11509
11763
|
ipId: ipId,
|
11510
11764
|
licenseTermsId: newLicenseTermsId,
|
11511
11765
|
licenseTemplate: newLicenseTemplate
|
11512
11766
|
});
|
11513
11767
|
case 3:
|
11514
|
-
licensingConfig =
|
11768
|
+
licensingConfig = _context7.v;
|
11515
11769
|
if (!(licensingConfig.licensingHook !== this.totalLicenseTokenLimitHookClient.address)) {
|
11516
|
-
|
11770
|
+
_context7.n = 4;
|
11517
11771
|
break;
|
11518
11772
|
}
|
11519
|
-
|
11773
|
+
_context7.n = 4;
|
11520
11774
|
return this.setLicensingConfig({
|
11521
11775
|
ipId: ipId,
|
11522
11776
|
licenseTermsId: newLicenseTermsId,
|
@@ -11527,7 +11781,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11527
11781
|
})
|
11528
11782
|
});
|
11529
11783
|
case 4:
|
11530
|
-
|
11784
|
+
_context7.n = 5;
|
11531
11785
|
return this.totalLicenseTokenLimitHookClient.setTotalLicenseTokenLimit({
|
11532
11786
|
licensorIpId: ipId,
|
11533
11787
|
licenseTemplate: newLicenseTemplate,
|
@@ -11535,20 +11789,20 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11535
11789
|
limit: BigInt(maxLicenseTokens)
|
11536
11790
|
});
|
11537
11791
|
case 5:
|
11538
|
-
txHash =
|
11539
|
-
return
|
11792
|
+
txHash = _context7.v;
|
11793
|
+
return _context7.a(2, waitForTxReceipt({
|
11540
11794
|
txHash: txHash,
|
11541
11795
|
txOptions: txOptions,
|
11542
11796
|
rpcClient: this.rpcClient
|
11543
11797
|
}));
|
11544
11798
|
case 6:
|
11545
|
-
|
11546
|
-
|
11547
|
-
return
|
11799
|
+
_context7.p = 6;
|
11800
|
+
_t7 = _context7.v;
|
11801
|
+
return _context7.a(2, handleError(_t7, "Failed to set max license tokens"));
|
11548
11802
|
}
|
11549
|
-
},
|
11803
|
+
}, _callee7, this, [[1, 6]]);
|
11550
11804
|
}));
|
11551
|
-
function setMaxLicenseTokens(
|
11805
|
+
function setMaxLicenseTokens(_x7) {
|
11552
11806
|
return _setMaxLicenseTokens.apply(this, arguments);
|
11553
11807
|
}
|
11554
11808
|
return setMaxLicenseTokens;
|
@@ -11556,52 +11810,344 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11556
11810
|
}, {
|
11557
11811
|
key: "getLicensingConfig",
|
11558
11812
|
value: function () {
|
11559
|
-
var _getLicensingConfig = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
11560
|
-
var licensingConfigParam,
|
11561
|
-
return _regenerator().w(function (
|
11562
|
-
while (1) switch (
|
11813
|
+
var _getLicensingConfig = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(request) {
|
11814
|
+
var licensingConfigParam, _t8;
|
11815
|
+
return _regenerator().w(function (_context8) {
|
11816
|
+
while (1) switch (_context8.p = _context8.n) {
|
11563
11817
|
case 0:
|
11564
|
-
|
11818
|
+
_context8.p = 0;
|
11565
11819
|
licensingConfigParam = {
|
11566
11820
|
ipId: validateAddress(request.ipId),
|
11567
11821
|
licenseTemplate: validateAddress(request.licenseTemplate || this.licenseTemplateClient.address),
|
11568
11822
|
licenseTermsId: BigInt(request.licenseTermsId)
|
11569
11823
|
};
|
11570
|
-
|
11824
|
+
_context8.n = 1;
|
11571
11825
|
return this.licenseRegistryReadOnlyClient.getLicensingConfig(licensingConfigParam);
|
11572
11826
|
case 1:
|
11573
|
-
return
|
11827
|
+
return _context8.a(2, _context8.v);
|
11574
11828
|
case 2:
|
11575
|
-
|
11576
|
-
|
11577
|
-
return
|
11829
|
+
_context8.p = 2;
|
11830
|
+
_t8 = _context8.v;
|
11831
|
+
return _context8.a(2, handleError(_t8, "Failed to get licensing config"));
|
11578
11832
|
}
|
11579
|
-
},
|
11833
|
+
}, _callee8, this, [[0, 2]]);
|
11580
11834
|
}));
|
11581
|
-
function getLicensingConfig(
|
11835
|
+
function getLicensingConfig(_x8) {
|
11582
11836
|
return _getLicensingConfig.apply(this, arguments);
|
11583
11837
|
}
|
11584
11838
|
return getLicensingConfig;
|
11585
11839
|
}()
|
11840
|
+
/**
|
11841
|
+
* Register Programmable IP License Terms (if unregistered) and attach it to IP.
|
11842
|
+
*
|
11843
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicensingModule.sol#L19 | `LicenseTermsAttached`} event.
|
11844
|
+
*/
|
11845
|
+
}, {
|
11846
|
+
key: "registerPilTermsAndAttach",
|
11847
|
+
value: (function () {
|
11848
|
+
var _registerPilTermsAndAttach = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(request) {
|
11849
|
+
var _request$txOptions4, ipId, isRegistered, _yield$validateLicens, licenseTerms, licenseTermsData, calculatedDeadline, ipAccount, _yield$ipAccount$stat, state, signature, object, txHash, licenseTermsIds, i, maxLicenseTokensTxHashes, _t9, _t0;
|
11850
|
+
return _regenerator().w(function (_context9) {
|
11851
|
+
while (1) switch (_context9.p = _context9.n) {
|
11852
|
+
case 0:
|
11853
|
+
_context9.p = 0;
|
11854
|
+
ipId = request.ipId;
|
11855
|
+
_context9.n = 1;
|
11856
|
+
return this.ipAssetRegistryClient.isRegistered({
|
11857
|
+
id: validateAddress(ipId)
|
11858
|
+
});
|
11859
|
+
case 1:
|
11860
|
+
isRegistered = _context9.v;
|
11861
|
+
if (isRegistered) {
|
11862
|
+
_context9.n = 2;
|
11863
|
+
break;
|
11864
|
+
}
|
11865
|
+
throw new Error("The IP with id ".concat(ipId, " is not registered."));
|
11866
|
+
case 2:
|
11867
|
+
_context9.n = 3;
|
11868
|
+
return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
|
11869
|
+
case 3:
|
11870
|
+
_yield$validateLicens = _context9.v;
|
11871
|
+
licenseTerms = _yield$validateLicens.licenseTerms;
|
11872
|
+
licenseTermsData = _yield$validateLicens.licenseTermsData;
|
11873
|
+
_context9.n = 4;
|
11874
|
+
return getCalculatedDeadline(this.rpcClient, request.deadline);
|
11875
|
+
case 4:
|
11876
|
+
calculatedDeadline = _context9.v;
|
11877
|
+
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, ipId);
|
11878
|
+
_context9.n = 5;
|
11879
|
+
return ipAccount.state();
|
11880
|
+
case 5:
|
11881
|
+
_yield$ipAccount$stat = _context9.v;
|
11882
|
+
state = _yield$ipAccount$stat.result;
|
11883
|
+
_context9.n = 6;
|
11884
|
+
return generateOperationSignature({
|
11885
|
+
ipIdAddress: ipId,
|
11886
|
+
methodType: SignatureMethodType.REGISTER_PIL_TERMS_AND_ATTACH,
|
11887
|
+
deadline: calculatedDeadline,
|
11888
|
+
state: state,
|
11889
|
+
wallet: this.wallet,
|
11890
|
+
chainId: this.chainId
|
11891
|
+
});
|
11892
|
+
case 6:
|
11893
|
+
signature = _context9.v;
|
11894
|
+
object = {
|
11895
|
+
ipId: ipId,
|
11896
|
+
licenseTermsData: licenseTermsData,
|
11897
|
+
sigAttachAndConfig: {
|
11898
|
+
signer: validateAddress(this.walletAddress),
|
11899
|
+
deadline: calculatedDeadline,
|
11900
|
+
signature: signature
|
11901
|
+
}
|
11902
|
+
};
|
11903
|
+
if (!((_request$txOptions4 = request.txOptions) !== null && _request$txOptions4 !== void 0 && _request$txOptions4.encodedTxDataOnly)) {
|
11904
|
+
_context9.n = 7;
|
11905
|
+
break;
|
11906
|
+
}
|
11907
|
+
return _context9.a(2, {
|
11908
|
+
encodedTxData: this.licenseAttachmentWorkflowsClient.registerPilTermsAndAttachEncode(object)
|
11909
|
+
});
|
11910
|
+
case 7:
|
11911
|
+
_context9.n = 8;
|
11912
|
+
return this.licenseAttachmentWorkflowsClient.registerPilTermsAndAttach(object);
|
11913
|
+
case 8:
|
11914
|
+
txHash = _context9.v;
|
11915
|
+
_context9.n = 9;
|
11916
|
+
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
11917
|
+
hash: txHash
|
11918
|
+
}));
|
11919
|
+
case 9:
|
11920
|
+
licenseTermsIds = [];
|
11921
|
+
i = 0;
|
11922
|
+
case 10:
|
11923
|
+
if (!(i < licenseTerms.length)) {
|
11924
|
+
_context9.n = 13;
|
11925
|
+
break;
|
11926
|
+
}
|
11927
|
+
_t9 = licenseTermsIds;
|
11928
|
+
_context9.n = 11;
|
11929
|
+
return this.getLicenseTermsId(licenseTerms[i]);
|
11930
|
+
case 11:
|
11931
|
+
_t9.push.call(_t9, _context9.v);
|
11932
|
+
case 12:
|
11933
|
+
i++;
|
11934
|
+
_context9.n = 10;
|
11935
|
+
break;
|
11936
|
+
case 13:
|
11937
|
+
_context9.n = 14;
|
11938
|
+
return setMaxLicenseTokens({
|
11939
|
+
maxLicenseTokensData: request.licenseTermsData,
|
11940
|
+
licensorIpId: ipId,
|
11941
|
+
licenseTermsIds: licenseTermsIds,
|
11942
|
+
totalLicenseTokenLimitHookClient: this.totalLicenseTokenLimitHookClient,
|
11943
|
+
templateAddress: this.licenseTemplateClient.address
|
11944
|
+
});
|
11945
|
+
case 14:
|
11946
|
+
maxLicenseTokensTxHashes = _context9.v;
|
11947
|
+
return _context9.a(2, _objectSpread2({
|
11948
|
+
txHash: txHash,
|
11949
|
+
licenseTermsIds: licenseTermsIds
|
11950
|
+
}, maxLicenseTokensTxHashes.length > 0 && {
|
11951
|
+
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
11952
|
+
}));
|
11953
|
+
case 15:
|
11954
|
+
_context9.n = 17;
|
11955
|
+
break;
|
11956
|
+
case 16:
|
11957
|
+
_context9.p = 16;
|
11958
|
+
_t0 = _context9.v;
|
11959
|
+
return _context9.a(2, handleError(_t0, "Failed to register PIL terms and attach"));
|
11960
|
+
case 17:
|
11961
|
+
return _context9.a(2);
|
11962
|
+
}
|
11963
|
+
}, _callee9, this, [[0, 16]]);
|
11964
|
+
}));
|
11965
|
+
function registerPilTermsAndAttach(_x9) {
|
11966
|
+
return _registerPilTermsAndAttach.apply(this, arguments);
|
11967
|
+
}
|
11968
|
+
return registerPilTermsAndAttach;
|
11969
|
+
}()
|
11970
|
+
/**
|
11971
|
+
* @deprecated Use {@link PILFlavor.nonCommercialSocialRemixing} with {@link LicenseClient.registerPILTerms} instead.
|
11972
|
+
* This method will be removed soon.
|
11973
|
+
*
|
11974
|
+
* Convenient function to register a PIL non commercial social remix license to the registry
|
11975
|
+
*
|
11976
|
+
* For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%231%3A-non-commercial-social-remixing | Non Commercial Social Remixing}.
|
11977
|
+
*
|
11978
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicenseTemplate.sol#L19 | `LicenseTermsRegistered`} event.
|
11979
|
+
*/
|
11980
|
+
)
|
11981
|
+
}, {
|
11982
|
+
key: "registerNonComSocialRemixingPIL",
|
11983
|
+
value: (function () {
|
11984
|
+
var _registerNonComSocialRemixingPIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(request) {
|
11985
|
+
var licenseTerms, _t1;
|
11986
|
+
return _regenerator().w(function (_context0) {
|
11987
|
+
while (1) switch (_context0.p = _context0.n) {
|
11988
|
+
case 0:
|
11989
|
+
_context0.p = 0;
|
11990
|
+
licenseTerms = PILFlavor.nonCommercialSocialRemixing();
|
11991
|
+
_context0.n = 1;
|
11992
|
+
return this.registerPILTermsHelper(licenseTerms, request === null || request === void 0 ? void 0 : request.txOptions);
|
11993
|
+
case 1:
|
11994
|
+
return _context0.a(2, _context0.v);
|
11995
|
+
case 2:
|
11996
|
+
_context0.p = 2;
|
11997
|
+
_t1 = _context0.v;
|
11998
|
+
return _context0.a(2, handleError(_t1, "Failed to register non commercial social remixing PIL"));
|
11999
|
+
}
|
12000
|
+
}, _callee0, this, [[0, 2]]);
|
12001
|
+
}));
|
12002
|
+
function registerNonComSocialRemixingPIL(_x0) {
|
12003
|
+
return _registerNonComSocialRemixingPIL.apply(this, arguments);
|
12004
|
+
}
|
12005
|
+
return registerNonComSocialRemixingPIL;
|
12006
|
+
}()
|
12007
|
+
/**
|
12008
|
+
* @deprecated Use {@link PILFlavor.commercialUse} with {@link LicenseClient.registerPILTerms} instead.
|
12009
|
+
* This method will be removed soon.
|
12010
|
+
*
|
12011
|
+
* Convenient function to register a PIL commercial use license to the registry.
|
12012
|
+
*
|
12013
|
+
* For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%232%3A-commercial-use | Commercial Use}.
|
12014
|
+
*
|
12015
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicenseTemplate.sol#L19 | `LicenseTermsRegistered`} event.
|
12016
|
+
*/
|
12017
|
+
)
|
12018
|
+
}, {
|
12019
|
+
key: "registerCommercialUsePIL",
|
12020
|
+
value: (function () {
|
12021
|
+
var _registerCommercialUsePIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(request) {
|
12022
|
+
var licenseTerms, _t10;
|
12023
|
+
return _regenerator().w(function (_context1) {
|
12024
|
+
while (1) switch (_context1.p = _context1.n) {
|
12025
|
+
case 0:
|
12026
|
+
_context1.p = 0;
|
12027
|
+
licenseTerms = PILFlavor.commercialUse({
|
12028
|
+
defaultMintingFee: Number(request.defaultMintingFee),
|
12029
|
+
currency: request.currency,
|
12030
|
+
royaltyPolicy: request.royaltyPolicyAddress
|
12031
|
+
});
|
12032
|
+
_context1.n = 1;
|
12033
|
+
return this.registerPILTermsHelper(licenseTerms, request.txOptions);
|
12034
|
+
case 1:
|
12035
|
+
return _context1.a(2, _context1.v);
|
12036
|
+
case 2:
|
12037
|
+
_context1.p = 2;
|
12038
|
+
_t10 = _context1.v;
|
12039
|
+
return _context1.a(2, handleError(_t10, "Failed to register commercial use PIL"));
|
12040
|
+
}
|
12041
|
+
}, _callee1, this, [[0, 2]]);
|
12042
|
+
}));
|
12043
|
+
function registerCommercialUsePIL(_x1) {
|
12044
|
+
return _registerCommercialUsePIL.apply(this, arguments);
|
12045
|
+
}
|
12046
|
+
return registerCommercialUsePIL;
|
12047
|
+
}()
|
12048
|
+
/**
|
12049
|
+
* @deprecated Use {@link PILFlavor.commercialRemix} with {@link LicenseClient.registerPILTerms} instead.
|
12050
|
+
* This method will be removed soon.
|
12051
|
+
*
|
12052
|
+
* Convenient function to register a PIL commercial Remix license to the registry.
|
12053
|
+
*
|
12054
|
+
* For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%233%3A-commercial-remix | Commercial Remix }.
|
12055
|
+
*
|
12056
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicenseTemplate.sol#L19 | `LicenseTermsRegistered`} event.
|
12057
|
+
*/
|
12058
|
+
)
|
12059
|
+
}, {
|
12060
|
+
key: "registerCommercialRemixPIL",
|
12061
|
+
value: (function () {
|
12062
|
+
var _registerCommercialRemixPIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(_ref2) {
|
12063
|
+
var defaultMintingFee, currency, royaltyPolicyAddress, commercialRevShare, txOptions, licenseTerms, _t11;
|
12064
|
+
return _regenerator().w(function (_context10) {
|
12065
|
+
while (1) switch (_context10.p = _context10.n) {
|
12066
|
+
case 0:
|
12067
|
+
defaultMintingFee = _ref2.defaultMintingFee, currency = _ref2.currency, royaltyPolicyAddress = _ref2.royaltyPolicyAddress, commercialRevShare = _ref2.commercialRevShare, txOptions = _ref2.txOptions;
|
12068
|
+
_context10.p = 1;
|
12069
|
+
licenseTerms = PILFlavor.commercialRemix({
|
12070
|
+
defaultMintingFee: Number(defaultMintingFee),
|
12071
|
+
currency: currency,
|
12072
|
+
royaltyPolicy: royaltyPolicyAddress,
|
12073
|
+
commercialRevShare: commercialRevShare
|
12074
|
+
});
|
12075
|
+
_context10.n = 2;
|
12076
|
+
return this.registerPILTermsHelper(licenseTerms, txOptions);
|
12077
|
+
case 2:
|
12078
|
+
return _context10.a(2, _context10.v);
|
12079
|
+
case 3:
|
12080
|
+
_context10.p = 3;
|
12081
|
+
_t11 = _context10.v;
|
12082
|
+
return _context10.a(2, handleError(_t11, "Failed to register commercial remix PIL"));
|
12083
|
+
}
|
12084
|
+
}, _callee10, this, [[1, 3]]);
|
12085
|
+
}));
|
12086
|
+
function registerCommercialRemixPIL(_x10) {
|
12087
|
+
return _registerCommercialRemixPIL.apply(this, arguments);
|
12088
|
+
}
|
12089
|
+
return registerCommercialRemixPIL;
|
12090
|
+
}()
|
12091
|
+
/**
|
12092
|
+
* @deprecated Use {@link PILFlavor.creativeCommonsAttribution} with {@link LicenseClient.registerPILTerms} instead.
|
12093
|
+
* This method will be removed soon.
|
12094
|
+
*
|
12095
|
+
* Convenient function to register a PIL creative commons attribution license to the registry.
|
12096
|
+
* Creates a Creative Commons Attribution (CC-BY) license terms flavor.
|
12097
|
+
*
|
12098
|
+
* For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%234%3A-creative-commons-attribution | Creative Commons Attribution}.
|
12099
|
+
*
|
12100
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicenseTemplate.sol#L19 | `LicenseTermsRegistered`} event.
|
12101
|
+
*/
|
12102
|
+
)
|
12103
|
+
}, {
|
12104
|
+
key: "registerCreativeCommonsAttributionPIL",
|
12105
|
+
value: (function () {
|
12106
|
+
var _registerCreativeCommonsAttributionPIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(_ref3) {
|
12107
|
+
var currency, royaltyPolicyAddress, txOptions, _t12;
|
12108
|
+
return _regenerator().w(function (_context11) {
|
12109
|
+
while (1) switch (_context11.p = _context11.n) {
|
12110
|
+
case 0:
|
12111
|
+
currency = _ref3.currency, royaltyPolicyAddress = _ref3.royaltyPolicyAddress, txOptions = _ref3.txOptions;
|
12112
|
+
_context11.p = 1;
|
12113
|
+
_context11.n = 2;
|
12114
|
+
return this.registerPILTermsHelper(PILFlavor.creativeCommonsAttribution({
|
12115
|
+
currency: currency,
|
12116
|
+
royaltyPolicy: royaltyPolicyAddress
|
12117
|
+
}), txOptions);
|
12118
|
+
case 2:
|
12119
|
+
return _context11.a(2, _context11.v);
|
12120
|
+
case 3:
|
12121
|
+
_context11.p = 3;
|
12122
|
+
_t12 = _context11.v;
|
12123
|
+
return _context11.a(2, handleError(_t12, "Failed to register creative commons attribution PIL"));
|
12124
|
+
}
|
12125
|
+
}, _callee11, this, [[1, 3]]);
|
12126
|
+
}));
|
12127
|
+
function registerCreativeCommonsAttributionPIL(_x11) {
|
12128
|
+
return _registerCreativeCommonsAttributionPIL.apply(this, arguments);
|
12129
|
+
}
|
12130
|
+
return registerCreativeCommonsAttributionPIL;
|
12131
|
+
}())
|
11586
12132
|
}, {
|
11587
12133
|
key: "getLicenseTermsId",
|
11588
12134
|
value: function () {
|
11589
|
-
var _getLicenseTermsId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
12135
|
+
var _getLicenseTermsId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(licenseTerms) {
|
11590
12136
|
var licenseRes;
|
11591
|
-
return _regenerator().w(function (
|
11592
|
-
while (1) switch (
|
12137
|
+
return _regenerator().w(function (_context12) {
|
12138
|
+
while (1) switch (_context12.n) {
|
11593
12139
|
case 0:
|
11594
|
-
|
12140
|
+
_context12.n = 1;
|
11595
12141
|
return this.licenseTemplateClient.getLicenseTermsId({
|
11596
|
-
terms:
|
12142
|
+
terms: licenseTerms
|
11597
12143
|
});
|
11598
12144
|
case 1:
|
11599
|
-
licenseRes =
|
11600
|
-
return
|
12145
|
+
licenseRes = _context12.v;
|
12146
|
+
return _context12.a(2, licenseRes.selectedLicenseTermsId);
|
11601
12147
|
}
|
11602
|
-
},
|
12148
|
+
}, _callee12, this);
|
11603
12149
|
}));
|
11604
|
-
function getLicenseTermsId(
|
12150
|
+
function getLicenseTermsId(_x12) {
|
11605
12151
|
return _getLicenseTermsId.apply(this, arguments);
|
11606
12152
|
}
|
11607
12153
|
return getLicenseTermsId;
|
@@ -11609,59 +12155,60 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
11609
12155
|
}, {
|
11610
12156
|
key: "registerPILTermsHelper",
|
11611
12157
|
value: function () {
|
11612
|
-
var _registerPILTermsHelper = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
12158
|
+
var _registerPILTermsHelper = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(licenseTerms, txOptions) {
|
11613
12159
|
var licenseTermsId, txHash, _yield$waitForTxRecei, receipt, targetLogs;
|
11614
|
-
return _regenerator().w(function (
|
11615
|
-
while (1) switch (
|
12160
|
+
return _regenerator().w(function (_context13) {
|
12161
|
+
while (1) switch (_context13.n) {
|
11616
12162
|
case 0:
|
12163
|
+
licenseTerms.commercialRevShare = getRevenueShare(licenseTerms.commercialRevShare);
|
11617
12164
|
if (!(txOptions !== null && txOptions !== void 0 && txOptions.encodedTxDataOnly)) {
|
11618
|
-
|
12165
|
+
_context13.n = 1;
|
11619
12166
|
break;
|
11620
12167
|
}
|
11621
|
-
return
|
12168
|
+
return _context13.a(2, {
|
11622
12169
|
encodedTxData: this.licenseTemplateClient.registerLicenseTermsEncode({
|
11623
12170
|
terms: licenseTerms
|
11624
12171
|
})
|
11625
12172
|
});
|
11626
12173
|
case 1:
|
11627
|
-
|
12174
|
+
_context13.n = 2;
|
11628
12175
|
return this.getLicenseTermsId(licenseTerms);
|
11629
12176
|
case 2:
|
11630
|
-
licenseTermsId =
|
12177
|
+
licenseTermsId = _context13.v;
|
11631
12178
|
if (!(licenseTermsId !== 0n)) {
|
11632
|
-
|
12179
|
+
_context13.n = 3;
|
11633
12180
|
break;
|
11634
12181
|
}
|
11635
|
-
return
|
12182
|
+
return _context13.a(2, {
|
11636
12183
|
licenseTermsId: licenseTermsId
|
11637
12184
|
});
|
11638
12185
|
case 3:
|
11639
|
-
|
12186
|
+
_context13.n = 4;
|
11640
12187
|
return this.licenseTemplateClient.registerLicenseTerms({
|
11641
12188
|
terms: licenseTerms
|
11642
12189
|
});
|
11643
12190
|
case 4:
|
11644
|
-
txHash =
|
11645
|
-
|
12191
|
+
txHash = _context13.v;
|
12192
|
+
_context13.n = 5;
|
11646
12193
|
return waitForTxReceipt({
|
11647
12194
|
txOptions: txOptions,
|
11648
12195
|
rpcClient: this.rpcClient,
|
11649
12196
|
txHash: txHash
|
11650
12197
|
});
|
11651
12198
|
case 5:
|
11652
|
-
_yield$waitForTxRecei =
|
12199
|
+
_yield$waitForTxRecei = _context13.v;
|
11653
12200
|
receipt = _yield$waitForTxRecei.receipt;
|
11654
12201
|
targetLogs = this.licenseTemplateClient.parseTxLicenseTermsRegisteredEvent(receipt);
|
11655
|
-
return
|
12202
|
+
return _context13.a(2, {
|
11656
12203
|
txHash: txHash,
|
11657
12204
|
licenseTermsId: targetLogs[0].licenseTermsId
|
11658
12205
|
});
|
11659
12206
|
case 6:
|
11660
|
-
return
|
12207
|
+
return _context13.a(2);
|
11661
12208
|
}
|
11662
|
-
},
|
12209
|
+
}, _callee13, this);
|
11663
12210
|
}));
|
11664
|
-
function registerPILTermsHelper(
|
12211
|
+
function registerPILTermsHelper(_x13, _x14) {
|
11665
12212
|
return _registerPILTermsHelper.apply(this, arguments);
|
11666
12213
|
}
|
11667
12214
|
return registerPILTermsHelper;
|
@@ -11704,7 +12251,7 @@ var NftClient = /*#__PURE__*/function () {
|
|
11704
12251
|
symbol: request.symbol,
|
11705
12252
|
baseURI: (_request$baseURI = request.baseURI) !== null && _request$baseURI !== void 0 ? _request$baseURI : "",
|
11706
12253
|
maxSupply: (_request$maxSupply = request.maxSupply) !== null && _request$maxSupply !== void 0 ? _request$maxSupply : Number(viem.maxUint32),
|
11707
|
-
mintFee: (_request$mintFee = request.mintFee) !== null && _request$mintFee !== void 0 ? _request$mintFee :
|
12254
|
+
mintFee: BigInt((_request$mintFee = request.mintFee) !== null && _request$mintFee !== void 0 ? _request$mintFee : 0),
|
11708
12255
|
mintFeeToken: (_request$mintFeeToken = request.mintFeeToken) !== null && _request$mintFeeToken !== void 0 ? _request$mintFeeToken : viem.zeroAddress,
|
11709
12256
|
owner: validateAddress(request.owner || this.wallet.account.address),
|
11710
12257
|
mintFeeRecipient: validateAddress(request.mintFeeRecipient),
|