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