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