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