@story-protocol/core-sdk 1.3.0-rc.3 → 1.3.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/README.md +29 -101
- package/dist/declarations/src/client.d.ts +3 -27
- package/dist/declarations/src/client.d.ts.map +1 -1
- package/dist/declarations/src/constants/common.d.ts +1 -4
- package/dist/declarations/src/constants/common.d.ts.map +1 -1
- package/dist/declarations/src/index.d.ts +13 -13
- package/dist/declarations/src/index.d.ts.map +1 -1
- package/dist/declarations/src/resources/dispute.d.ts +13 -29
- package/dist/declarations/src/resources/dispute.d.ts.map +1 -1
- package/dist/declarations/src/resources/group.d.ts +10 -13
- package/dist/declarations/src/resources/group.d.ts.map +1 -1
- package/dist/declarations/src/resources/ipAccount.d.ts +6 -24
- package/dist/declarations/src/resources/ipAccount.d.ts.map +1 -1
- package/dist/declarations/src/resources/ipAsset.d.ts +36 -164
- package/dist/declarations/src/resources/ipAsset.d.ts.map +1 -1
- package/dist/declarations/src/resources/license.d.ts +18 -76
- package/dist/declarations/src/resources/license.d.ts.map +1 -1
- package/dist/declarations/src/resources/nftClient.d.ts +3 -15
- package/dist/declarations/src/resources/nftClient.d.ts.map +1 -1
- package/dist/declarations/src/resources/permission.d.ts +13 -56
- package/dist/declarations/src/resources/permission.d.ts.map +1 -1
- package/dist/declarations/src/resources/royalty.d.ts +12 -8
- package/dist/declarations/src/resources/royalty.d.ts.map +1 -1
- package/dist/declarations/src/types/common.d.ts +11 -3
- package/dist/declarations/src/types/common.d.ts.map +1 -1
- package/dist/declarations/src/types/config.d.ts +15 -0
- package/dist/declarations/src/types/config.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/dispute.d.ts +14 -3
- package/dist/declarations/src/types/resources/dispute.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/group.d.ts +14 -9
- package/dist/declarations/src/types/resources/group.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/ipAccount.d.ts +13 -2
- package/dist/declarations/src/types/resources/ipAccount.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/ipAsset.d.ts +54 -32
- package/dist/declarations/src/types/resources/ipAsset.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/license.d.ts +65 -6
- package/dist/declarations/src/types/resources/license.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/nftClient.d.ts +11 -3
- package/dist/declarations/src/types/resources/nftClient.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/permission.d.ts +34 -2
- package/dist/declarations/src/types/resources/permission.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/royalty.d.ts +4 -0
- package/dist/declarations/src/types/resources/royalty.d.ts.map +1 -1
- package/dist/declarations/src/utils/chain.d.ts +2 -0
- package/dist/declarations/src/utils/chain.d.ts.map +1 -1
- package/dist/declarations/src/utils/getIpMetadataForWorkflow.d.ts +1 -1
- package/dist/declarations/src/utils/getIpMetadataForWorkflow.d.ts.map +1 -1
- package/dist/declarations/src/utils/sign.d.ts +0 -17
- package/dist/declarations/src/utils/sign.d.ts.map +1 -1
- package/dist/story-protocol-core-sdk.cjs.dev.js +514 -709
- package/dist/story-protocol-core-sdk.cjs.prod.js +514 -709
- package/dist/story-protocol-core-sdk.esm.js +514 -709
- package/package.json +1 -1
@@ -588,16 +588,6 @@ function validateAddresses(addresses) {
|
|
588
588
|
return validateAddress(address);
|
589
589
|
});
|
590
590
|
}
|
591
|
-
|
592
|
-
/** @deprecated use {@link validateAddress} */
|
593
|
-
var getAddress$1 = function getAddress(address, name, chainId) {
|
594
|
-
if (!viem.isAddress(address, {
|
595
|
-
strict: false
|
596
|
-
})) {
|
597
|
-
throw Error("".concat(name, " address is invalid: ").concat(address, ", Address must be a hex value of 20 bytes (40 hex characters) and match its checksum counterpart."));
|
598
|
-
}
|
599
|
-
return viem.checksumAddress(address, chainId);
|
600
|
-
};
|
601
591
|
function getTokenAmountDisplay(amount) {
|
602
592
|
var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "IP";
|
603
593
|
return "".concat(viem.formatEther(amount)).concat(unit);
|
@@ -3570,8 +3560,8 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
|
|
3570
3560
|
*/)},{key:"withdrawEncode",value:function withdrawEncode(request){return {to:this.address,data:viem.encodeFunctionData({abi:wrappedIpAbi,functionName:"withdraw",args:[request.value]})};}}]);}(WrappedIpReadOnlyClient);
|
3571
3561
|
|
3572
3562
|
/**
|
3573
|
-
* This structure defines the terms for a Programmable IP License (PIL).
|
3574
|
-
*
|
3563
|
+
* This structure defines the terms for a Programmable IP License (PIL).
|
3564
|
+
* These terms can be attached to IP Assets.
|
3575
3565
|
**/
|
3576
3566
|
|
3577
3567
|
var PIL_TYPE = /*#__PURE__*/function (PIL_TYPE) {
|
@@ -3581,14 +3571,16 @@ var PIL_TYPE = /*#__PURE__*/function (PIL_TYPE) {
|
|
3581
3571
|
return PIL_TYPE;
|
3582
3572
|
}({});
|
3583
3573
|
|
3584
|
-
var AddressZero = "0x0000000000000000000000000000000000000000";
|
3585
|
-
var HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
3586
3574
|
var defaultFunctionSelector = "0x00000000";
|
3587
3575
|
var royaltySharesTotalSupply = 100000000;
|
3588
3576
|
var MAX_ROYALTY_TOKEN = 100000000;
|
3577
|
+
var WIP_TOKEN_ADDRESS = wrappedIpAddress[mainnet.id];
|
3589
3578
|
|
3590
|
-
/**
|
3591
|
-
|
3579
|
+
/**
|
3580
|
+
* This data used IP owners to define the configuration
|
3581
|
+
* when others are minting license tokens of their IP through the LicensingModule.
|
3582
|
+
* @see {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/lib/Licensing.sol#L27 | Licensing.sol}
|
3583
|
+
*/
|
3592
3584
|
|
3593
3585
|
/**
|
3594
3586
|
* Input for token amount, can be bigint or number.
|
@@ -3801,14 +3793,6 @@ var getRevenueShare = function getRevenueShare(revShare) {
|
|
3801
3793
|
|
3802
3794
|
/**
|
3803
3795
|
* Get the signature for setting permissions.
|
3804
|
-
* @param param - The parameter object containing necessary data to get the signature.
|
3805
|
-
* @param param.ipId - The IP ID.
|
3806
|
-
* @param param.deadline - The deadline.
|
3807
|
-
* @param param.nonce - The nonce.
|
3808
|
-
* @param param.wallet - The wallet client.
|
3809
|
-
* @param param.chainId - The chain ID.
|
3810
|
-
* @param param.permissionFunc - The permission function,default function is setPermission.
|
3811
|
-
* @returns A Promise that resolves to the signature.
|
3812
3796
|
*/
|
3813
3797
|
var getPermissionSignature = /*#__PURE__*/function () {
|
3814
3798
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(param) {
|
@@ -3822,15 +3806,15 @@ var getPermissionSignature = /*#__PURE__*/function () {
|
|
3822
3806
|
data = viem.encodeFunctionData({
|
3823
3807
|
abi: accessControllerAbi,
|
3824
3808
|
functionName: isBatchPermissionFunction ? "setBatchTransientPermissions" : "setTransientPermission",
|
3825
|
-
args: isBatchPermissionFunction ? [permissions.map(function (item
|
3809
|
+
args: isBatchPermissionFunction ? [permissions.map(function (item) {
|
3826
3810
|
return {
|
3827
|
-
ipAccount:
|
3828
|
-
signer:
|
3829
|
-
to:
|
3811
|
+
ipAccount: validateAddress(item.ipId),
|
3812
|
+
signer: validateAddress(item.signer),
|
3813
|
+
to: validateAddress(item.to),
|
3830
3814
|
func: item.func ? viem.toFunctionSelector(item.func) : defaultFunctionSelector,
|
3831
3815
|
permission: item.permission
|
3832
3816
|
};
|
3833
|
-
})] : [
|
3817
|
+
})] : [validateAddress(permissions[0].ipId), validateAddress(permissions[0].signer), validateAddress(permissions[0].to), permissions[0].func ? viem.toFunctionSelector(permissions[0].func) : defaultFunctionSelector, permissions[0].permission]
|
3834
3818
|
});
|
3835
3819
|
_context.next = 6;
|
3836
3820
|
return getSignature({
|
@@ -3863,15 +3847,6 @@ var getDeadline = function getDeadline(unixTimestamp, deadline) {
|
|
3863
3847
|
|
3864
3848
|
/**
|
3865
3849
|
* Get the signature.
|
3866
|
-
* @param param - The parameter object containing necessary data to get the signature.
|
3867
|
-
* @param param.state - The IP Account's state.
|
3868
|
-
* @param param.to - The recipient address.
|
3869
|
-
* @param param.encodeData - The encoded data.
|
3870
|
-
* @param param.wallet - The wallet client.
|
3871
|
-
* @param param.verifyingContract - The verifying contract.
|
3872
|
-
* @param param.deadline - The deadline.
|
3873
|
-
* @param param.chainId - The chain ID.
|
3874
|
-
* @returns A Promise that resolves to the signature.
|
3875
3850
|
*/
|
3876
3851
|
var getSignature = /*#__PURE__*/function () {
|
3877
3852
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
|
@@ -3958,14 +3933,16 @@ var getSignature = /*#__PURE__*/function () {
|
|
3958
3933
|
|
3959
3934
|
/**
|
3960
3935
|
* Permission level
|
3961
|
-
|
3962
|
-
**/
|
3936
|
+
*/
|
3963
3937
|
var AccessPermission = /*#__PURE__*/function (AccessPermission) {
|
3964
|
-
|
3938
|
+
/**
|
3939
|
+
* ABSTAIN means having not enough information to make decision at
|
3940
|
+
* current level, deferred decision to up.
|
3941
|
+
*/
|
3965
3942
|
AccessPermission[AccessPermission["ABSTAIN"] = 0] = "ABSTAIN";
|
3966
|
-
|
3943
|
+
/** ALLOW means the permission is granted to transaction signer to call the function. */
|
3967
3944
|
AccessPermission[AccessPermission["ALLOW"] = 1] = "ALLOW";
|
3968
|
-
|
3945
|
+
/** DENY means the permission is denied to transaction signer to call the function. */
|
3969
3946
|
AccessPermission[AccessPermission["DENY"] = 2] = "DENY";
|
3970
3947
|
return AccessPermission;
|
3971
3948
|
}({});
|
@@ -4011,7 +3988,7 @@ var validateLicenseConfig = function validateLicenseConfig(licensingConfig) {
|
|
4011
3988
|
isSet: false,
|
4012
3989
|
mintingFee: 0n,
|
4013
3990
|
licensingHook: viem.zeroAddress,
|
4014
|
-
hookData: viem.
|
3991
|
+
hookData: viem.zeroHash,
|
4015
3992
|
commercialRevShare: 0,
|
4016
3993
|
disabled: false,
|
4017
3994
|
expectMinimumGroupRewardShare: 0,
|
@@ -4040,12 +4017,12 @@ var validateLicenseConfig = function validateLicenseConfig(licensingConfig) {
|
|
4040
4017
|
return licenseConfig;
|
4041
4018
|
};
|
4042
4019
|
|
4043
|
-
var getIpMetadataForWorkflow = function getIpMetadataForWorkflow(
|
4020
|
+
var getIpMetadataForWorkflow = function getIpMetadataForWorkflow(ipMetadata) {
|
4044
4021
|
return {
|
4045
|
-
ipMetadataURI: (
|
4046
|
-
ipMetadataHash: (
|
4047
|
-
nftMetadataURI: (
|
4048
|
-
nftMetadataHash: (
|
4022
|
+
ipMetadataURI: (ipMetadata === null || ipMetadata === void 0 ? void 0 : ipMetadata.ipMetadataURI) || "",
|
4023
|
+
ipMetadataHash: (ipMetadata === null || ipMetadata === void 0 ? void 0 : ipMetadata.ipMetadataHash) || viem.zeroHash,
|
4024
|
+
nftMetadataURI: (ipMetadata === null || ipMetadata === void 0 ? void 0 : ipMetadata.nftMetadataURI) || "",
|
4025
|
+
nftMetadataHash: (ipMetadata === null || ipMetadata === void 0 ? void 0 : ipMetadata.nftMetadataHash) || viem.zeroHash
|
4049
4026
|
};
|
4050
4027
|
};
|
4051
4028
|
|
@@ -4355,6 +4332,45 @@ var WipTokenClient = /*#__PURE__*/function () {
|
|
4355
4332
|
}]);
|
4356
4333
|
}();
|
4357
4334
|
|
4335
|
+
/**
|
4336
|
+
* Predict the minting license fee.
|
4337
|
+
*
|
4338
|
+
* @remarks
|
4339
|
+
* The method passes `walletAddress` to the `readContract` function so the smart contract can verify
|
4340
|
+
* if the wallet is the owner of the IP ID. The wallet address is required when using the default license terms ID.
|
4341
|
+
*/
|
4342
|
+
var predictMintingLicenseFee = /*#__PURE__*/function () {
|
4343
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
4344
|
+
var predictMintingFeeRequest, rpcClient, chainId, walletAddress, result;
|
4345
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
4346
|
+
while (1) switch (_context.prev = _context.next) {
|
4347
|
+
case 0:
|
4348
|
+
predictMintingFeeRequest = _ref.predictMintingFeeRequest, rpcClient = _ref.rpcClient, chainId = _ref.chainId, walletAddress = _ref.walletAddress;
|
4349
|
+
_context.next = 3;
|
4350
|
+
return rpcClient.readContract({
|
4351
|
+
abi: licensingModuleAbi,
|
4352
|
+
address: licensingModuleAddress[chainId],
|
4353
|
+
functionName: "predictMintingLicenseFee",
|
4354
|
+
args: [predictMintingFeeRequest.licensorIpId, predictMintingFeeRequest.licenseTemplate, predictMintingFeeRequest.licenseTermsId, predictMintingFeeRequest.amount, predictMintingFeeRequest.receiver, predictMintingFeeRequest.royaltyContext],
|
4355
|
+
account: walletAddress
|
4356
|
+
});
|
4357
|
+
case 3:
|
4358
|
+
result = _context.sent;
|
4359
|
+
return _context.abrupt("return", {
|
4360
|
+
currencyToken: result[0],
|
4361
|
+
tokenAmount: result[1]
|
4362
|
+
});
|
4363
|
+
case 5:
|
4364
|
+
case "end":
|
4365
|
+
return _context.stop();
|
4366
|
+
}
|
4367
|
+
}, _callee);
|
4368
|
+
}));
|
4369
|
+
return function predictMintingLicenseFee(_x) {
|
4370
|
+
return _ref2.apply(this, arguments);
|
4371
|
+
};
|
4372
|
+
}();
|
4373
|
+
|
4358
4374
|
/**
|
4359
4375
|
* check the allowance of all spenders and call approval if any spender
|
4360
4376
|
* allowance is lower than the amount they are expected to spend.
|
@@ -4477,41 +4493,40 @@ var approvalAllSpenders = /*#__PURE__*/function () {
|
|
4477
4493
|
};
|
4478
4494
|
}();
|
4479
4495
|
var calculateLicenseWipMintFee = /*#__PURE__*/function () {
|
4480
|
-
var
|
4481
|
-
var fee;
|
4496
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
|
4497
|
+
var predictMintingFeeRequest, rpcClient, chainId, walletAddress, fee;
|
4482
4498
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
4483
4499
|
while (1) switch (_context3.prev = _context3.next) {
|
4484
4500
|
case 0:
|
4485
|
-
|
4486
|
-
|
4487
|
-
|
4488
|
-
|
4489
|
-
|
4490
|
-
|
4491
|
-
|
4492
|
-
royaltyContext: viem.zeroAddress
|
4501
|
+
predictMintingFeeRequest = _ref4.predictMintingFeeRequest, rpcClient = _ref4.rpcClient, chainId = _ref4.chainId, walletAddress = _ref4.walletAddress;
|
4502
|
+
_context3.next = 3;
|
4503
|
+
return predictMintingLicenseFee({
|
4504
|
+
predictMintingFeeRequest: predictMintingFeeRequest,
|
4505
|
+
rpcClient: rpcClient,
|
4506
|
+
chainId: chainId,
|
4507
|
+
walletAddress: walletAddress
|
4493
4508
|
});
|
4494
|
-
case
|
4509
|
+
case 3:
|
4495
4510
|
fee = _context3.sent;
|
4496
4511
|
if (!(fee.currencyToken !== WIP_TOKEN_ADDRESS)) {
|
4497
|
-
_context3.next =
|
4512
|
+
_context3.next = 6;
|
4498
4513
|
break;
|
4499
4514
|
}
|
4500
4515
|
return _context3.abrupt("return", 0n);
|
4501
|
-
case 5:
|
4502
|
-
return _context3.abrupt("return", fee.tokenAmount);
|
4503
4516
|
case 6:
|
4517
|
+
return _context3.abrupt("return", fee.tokenAmount);
|
4518
|
+
case 7:
|
4504
4519
|
case "end":
|
4505
4520
|
return _context3.stop();
|
4506
4521
|
}
|
4507
4522
|
}, _callee3);
|
4508
4523
|
}));
|
4509
4524
|
return function calculateLicenseWipMintFee(_x3) {
|
4510
|
-
return
|
4525
|
+
return _ref5.apply(this, arguments);
|
4511
4526
|
};
|
4512
4527
|
}();
|
4513
4528
|
var calculateSPGWipMintFee = /*#__PURE__*/function () {
|
4514
|
-
var
|
4529
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(spgNftClient) {
|
4515
4530
|
var token;
|
4516
4531
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
4517
4532
|
while (1) switch (_context4.prev = _context4.next) {
|
@@ -4537,16 +4552,16 @@ var calculateSPGWipMintFee = /*#__PURE__*/function () {
|
|
4537
4552
|
}, _callee4);
|
4538
4553
|
}));
|
4539
4554
|
return function calculateSPGWipMintFee(_x4) {
|
4540
|
-
return
|
4555
|
+
return _ref6.apply(this, arguments);
|
4541
4556
|
};
|
4542
4557
|
}();
|
4543
4558
|
var multiCallWrapIp = /*#__PURE__*/function () {
|
4544
|
-
var
|
4559
|
+
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref7) {
|
4545
4560
|
var ipAmountToWrap, wipClient, multicall3Address, wipSpenders, calls, rpcClient, wallet, contractCall, wipOptions, multiCalls, useMultiCall, deposit, autoApprove, approvalCalls, txHash;
|
4546
4561
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
4547
4562
|
while (1) switch (_context5.prev = _context5.next) {
|
4548
4563
|
case 0:
|
4549
|
-
ipAmountToWrap =
|
4564
|
+
ipAmountToWrap = _ref7.ipAmountToWrap, wipClient = _ref7.wipClient, multicall3Address = _ref7.multicall3Address, wipSpenders = _ref7.wipSpenders, calls = _ref7.calls, rpcClient = _ref7.rpcClient, wallet = _ref7.wallet, contractCall = _ref7.contractCall, wipOptions = _ref7.wipOptions;
|
4550
4565
|
if (!(ipAmountToWrap === 0n)) {
|
4551
4566
|
_context5.next = 3;
|
4552
4567
|
break;
|
@@ -4635,7 +4650,7 @@ var multiCallWrapIp = /*#__PURE__*/function () {
|
|
4635
4650
|
}, _callee5);
|
4636
4651
|
}));
|
4637
4652
|
return function multiCallWrapIp(_x5) {
|
4638
|
-
return
|
4653
|
+
return _ref8.apply(this, arguments);
|
4639
4654
|
};
|
4640
4655
|
}();
|
4641
4656
|
|
@@ -4653,13 +4668,13 @@ var multiCallWrapIp = /*#__PURE__*/function () {
|
|
4653
4668
|
* for each spender address and approve it, unless disabled via `disableAutoApprove`.
|
4654
4669
|
*/
|
4655
4670
|
var contractCallWithFees = /*#__PURE__*/function () {
|
4656
|
-
var
|
4671
|
+
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref9) {
|
4657
4672
|
var _options$wipOptions;
|
4658
4673
|
var totalFees, options, multicall3Address, wallet, tokenSpenders, contractCall, sender, txOptions, encodedTxs, rpcClient, token, wipTokenClient, isWip, selectedOptions, tokenClient, _txHash, balance, autoApprove, _txHash2, autoWrapIp, startingBalance, calls, _yield$multiCallWrapI, txHash;
|
4659
4674
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
4660
4675
|
while (1) switch (_context6.prev = _context6.next) {
|
4661
4676
|
case 0:
|
4662
|
-
totalFees =
|
4677
|
+
totalFees = _ref9.totalFees, options = _ref9.options, multicall3Address = _ref9.multicall3Address, wallet = _ref9.wallet, tokenSpenders = _ref9.tokenSpenders, contractCall = _ref9.contractCall, sender = _ref9.sender, txOptions = _ref9.txOptions, encodedTxs = _ref9.encodedTxs, rpcClient = _ref9.rpcClient, token = _ref9.token;
|
4663
4678
|
wipTokenClient = new WipTokenClient(rpcClient, wallet);
|
4664
4679
|
isWip = token === wipTokenClient.address || token === undefined;
|
4665
4680
|
selectedOptions = isWip ? options === null || options === void 0 ? void 0 : options.wipOptions : options.erc20Options;
|
@@ -4774,7 +4789,7 @@ var contractCallWithFees = /*#__PURE__*/function () {
|
|
4774
4789
|
}, _callee6);
|
4775
4790
|
}));
|
4776
4791
|
return function contractCallWithFees(_x6) {
|
4777
|
-
return
|
4792
|
+
return _ref10.apply(this, arguments);
|
4778
4793
|
};
|
4779
4794
|
}();
|
4780
4795
|
|
@@ -4814,18 +4829,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
4814
4829
|
|
4815
4830
|
/**
|
4816
4831
|
* Registers an NFT as IP, creating a corresponding IP record.
|
4817
|
-
*
|
4818
|
-
*
|
4819
|
-
* @param request.tokenId The token identifier of the NFT.
|
4820
|
-
* @param {Object} request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
|
4821
|
-
* @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
|
4822
|
-
* @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
|
4823
|
-
* @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
|
4824
|
-
* @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
|
4825
|
-
* @param request.deadline [Optional] The deadline for the signature in seconds, default is 1000s.
|
4826
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
4827
|
-
* @returns A Promise that resolves to a transaction hash, and if encodedTxDataOnly is true, includes encoded transaction data, and if waitForTransaction is true, includes IP ID, token ID.
|
4828
|
-
* @emits IPRegistered (ipId, chainId, tokenContract, tokenId, resolverAddr, metadataProviderAddress, metadata)
|
4832
|
+
*
|
4833
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
4829
4834
|
*/
|
4830
4835
|
}, {
|
4831
4836
|
key: "register",
|
@@ -4855,7 +4860,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
4855
4860
|
case 10:
|
4856
4861
|
object = {
|
4857
4862
|
tokenId: tokenId,
|
4858
|
-
nftContract:
|
4863
|
+
nftContract: validateAddress(request.nftContract),
|
4859
4864
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
4860
4865
|
sigMetadata: {
|
4861
4866
|
signer: viem.zeroAddress,
|
@@ -4882,8 +4887,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
4882
4887
|
chainId: chain[this.chainId],
|
4883
4888
|
permissions: [{
|
4884
4889
|
ipId: ipIdAddress,
|
4885
|
-
signer:
|
4886
|
-
to:
|
4890
|
+
signer: validateAddress(this.registrationWorkflowsClient.address),
|
4891
|
+
to: validateAddress(this.coreMetadataModuleClient.address),
|
4887
4892
|
permission: AccessPermission.ALLOW,
|
4888
4893
|
func: getFunctionSignature(coreMetadataModuleAbi, "setAll")
|
4889
4894
|
}]
|
@@ -4892,7 +4897,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
4892
4897
|
_yield$getPermissionS = _context.sent;
|
4893
4898
|
signature = _yield$getPermissionS.signature;
|
4894
4899
|
object.sigMetadata = {
|
4895
|
-
signer:
|
4900
|
+
signer: validateAddress(this.walletAddress),
|
4896
4901
|
deadline: calculatedDeadline,
|
4897
4902
|
signature: signature
|
4898
4903
|
};
|
@@ -4978,18 +4983,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
4978
4983
|
}()
|
4979
4984
|
/**
|
4980
4985
|
* Batch registers an NFT as IP, creating a corresponding IP record.
|
4981
|
-
*
|
4982
|
-
*
|
4983
|
-
* @param request.args.nftContract The address of the NFT.
|
4984
|
-
* @param request.args.tokenId The token identifier of the NFT.
|
4985
|
-
* @param {Object} request.args.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
|
4986
|
-
* @param request.args.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
|
4987
|
-
* @param request.args.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
|
4988
|
-
* @param request.args.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
|
4989
|
-
* @param request.args.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
|
4990
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property, without encodedTxDataOnly option.
|
4991
|
-
* @returns A Promise that resolves to a transaction hash, if waitForTransaction is true, return an array of containing IP ID, Token ID, NFT Contract.
|
4992
|
-
* @emits IPRegistered (ipId, chainId, tokenContract, tokenId, resolverAddr, metadataProviderAddress, metadata)
|
4986
|
+
*
|
4987
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
4993
4988
|
*/
|
4994
4989
|
)
|
4995
4990
|
}, {
|
@@ -5199,7 +5194,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5199
5194
|
contractCall: contractCall,
|
5200
5195
|
txOptions: request.txOptions,
|
5201
5196
|
encodedTxs: [encodedTxData],
|
5202
|
-
spgSpenderAddress: this.
|
5197
|
+
spgSpenderAddress: this.royaltyModuleEventClient.address,
|
5203
5198
|
wipOptions: _objectSpread2(_objectSpread2({}, request.wipOptions), {}, {
|
5204
5199
|
useMulticallWhenPossible: false
|
5205
5200
|
})
|
@@ -5224,17 +5219,6 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5224
5219
|
}()
|
5225
5220
|
/**
|
5226
5221
|
* Batch registers a derivative directly with parent IP's license terms.
|
5227
|
-
* @param request - The request object that contains all data needed to batch register derivative IP.
|
5228
|
-
* @param {Array} request.args The array of objects containing the data needed to register derivative IP.
|
5229
|
-
* @param request.args.childIpId The derivative IP ID.
|
5230
|
-
* @param {Array} request.args.parentIpIds The parent IP IDs.
|
5231
|
-
* @param {Array} request.args.licenseTermsIds The IDs of the license terms that the parent IP supports.
|
5232
|
-
* @param request.args.maxMintingFee The maximum minting fee that the caller is willing to pay. if set to 0 then no limit.
|
5233
|
-
* @param request.args.maxRts The maximum number of royalty tokens that can be distributed to the external royalty policies (max: 100,000,000).
|
5234
|
-
* @param request.args.maxRevenueShare The maximum revenue share percentage allowed for minting the License Tokens. Must be between 0 and 100,000,000 (where 100,000,000 represents 100%).
|
5235
|
-
* @param request.deadline [Optional] The deadline for the signature in seconds, default is 1000s.
|
5236
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property, without encodedTxDataOnly option.
|
5237
|
-
* @returns A Promise that resolves to a transaction hash.
|
5238
5222
|
*/
|
5239
5223
|
)
|
5240
5224
|
}, {
|
@@ -5247,7 +5231,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5247
5231
|
case 0:
|
5248
5232
|
_context5.prev = 0;
|
5249
5233
|
contracts = [];
|
5250
|
-
licenseModuleAddress =
|
5234
|
+
licenseModuleAddress = validateAddress(this.licensingModuleClient.address);
|
5251
5235
|
_iterator2 = _createForOfIteratorHelper(request.args);
|
5252
5236
|
_context5.prev = 4;
|
5253
5237
|
_iterator2.s();
|
@@ -5276,7 +5260,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5276
5260
|
return this.getCalculatedDeadline(request.deadline);
|
5277
5261
|
case 18:
|
5278
5262
|
calculatedDeadline = _context5.sent;
|
5279
|
-
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet,
|
5263
|
+
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(arg.childIpId));
|
5280
5264
|
data = viem.encodeFunctionData({
|
5281
5265
|
abi: licensingModuleAbi,
|
5282
5266
|
functionName: "registerDerivative",
|
@@ -5370,12 +5354,6 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5370
5354
|
* Registers a derivative with license tokens. The derivative IP is registered with license tokens minted from the parent IP's license terms.
|
5371
5355
|
* The license terms of the parent IPs issued with license tokens are attached to the derivative IP.
|
5372
5356
|
* The caller must be the derivative IP owner or an authorized operator.
|
5373
|
-
* @param request - The request object that contains all data needed to register derivative license tokens.
|
5374
|
-
* @param request.childIpId The derivative IP ID.
|
5375
|
-
* @param {Array} request.licenseTokenIds The IDs of the license tokens.
|
5376
|
-
* @param request.args.maxRts The maximum number of royalty tokens that can be distributed to the external royalty policies (max: 100,000,000).
|
5377
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
5378
|
-
* @returns A Promise that resolves to an object containing the transaction hash.
|
5379
5357
|
*/
|
5380
5358
|
)
|
5381
5359
|
}, {
|
@@ -5388,7 +5366,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5388
5366
|
case 0:
|
5389
5367
|
_context6.prev = 0;
|
5390
5368
|
req = {
|
5391
|
-
childIpId:
|
5369
|
+
childIpId: validateAddress(request.childIpId),
|
5392
5370
|
licenseTokenIds: request.licenseTokenIds.map(function (id) {
|
5393
5371
|
return BigInt(id);
|
5394
5372
|
}),
|
@@ -5464,10 +5442,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5464
5442
|
}()
|
5465
5443
|
/**
|
5466
5444
|
* Mint an NFT from a collection and register it as an IP.
|
5467
|
-
*
|
5468
|
-
*
|
5469
|
-
* @see {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicensingModule.sol#L19 | ILicensingModule}
|
5470
|
-
* for a list of on-chain events emitted when an IP is minted and registered, and license terms are attached to an IP.
|
5445
|
+
*
|
5446
|
+
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} and {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicensingModule.sol#L19 | `LicenseTermsAttached`} events.
|
5471
5447
|
*/
|
5472
5448
|
)
|
5473
5449
|
}, {
|
@@ -5487,8 +5463,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5487
5463
|
licenseTerms = _yield$this$validateL.licenseTerms;
|
5488
5464
|
licenseTermsData = _yield$this$validateL.licenseTermsData;
|
5489
5465
|
_object = {
|
5490
|
-
spgNftContract:
|
5491
|
-
recipient:
|
5466
|
+
spgNftContract: validateAddress(request.spgNftContract),
|
5467
|
+
recipient: validateAddress(request.recipient || this.walletAddress),
|
5492
5468
|
licenseTermsData: licenseTermsData,
|
5493
5469
|
allowDuplicates: request.allowDuplicates || true,
|
5494
5470
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata)
|
@@ -5550,49 +5526,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5550
5526
|
}()
|
5551
5527
|
/**
|
5552
5528
|
* Batch mint an NFT from a collection and register it as an IP.
|
5553
|
-
*
|
5554
|
-
*
|
5555
|
-
* @param request.args.spgNftContract The address of the NFT collection.
|
5556
|
-
* @param request.allowDuplicates Indicates whether the license terms can be attached to the same IP ID or not.
|
5557
|
-
* @param {Array} request.args.licenseTermsData The PIL terms and licensing configuration data to be attached to the IP.
|
5558
|
-
* @param {Object} request.args.licenseTermsData.terms The PIL terms to be used for the licensing.
|
5559
|
-
* @param request.args.licenseTermsData.terms.transferable Indicates whether the license is transferable or not.
|
5560
|
-
* @param request.args.licenseTermsData.terms.royaltyPolicy The address of the royalty policy contract which required to StoryProtocol in advance.
|
5561
|
-
* @param request.args.licenseTermsData.terms.mintingFee The fee to be paid when minting a license.
|
5562
|
-
* @param request.args.licenseTermsData.terms.expiration The expiration period of the license.
|
5563
|
-
* @param request.args.licenseTermsData.terms.commercialUse Indicates whether the work can be used commercially or not, Commercial use is required to deploy a royalty vault.
|
5564
|
-
* @param request.args.licenseTermsData.terms.commercialAttribution Whether attribution is required when reproducing the work commercially or not.
|
5565
|
-
* @param request.args.licenseTermsData.terms.commercializerChecker Commercializers that are allowed to commercially exploit the work. If zero address, then no restrictions is enforced.
|
5566
|
-
* @param request.args.licenseTermsData.terms.commercializerCheckerData The data to be passed to the commercializer checker contract.
|
5567
|
-
* @param request.args.licenseTermsData.terms.commercialRevShare Percentage of revenue that must be shared with the licensor.
|
5568
|
-
* @param request.args.licenseTermsData.terms.commercialRevCeiling The maximum revenue that can be generated from the commercial use of the work.
|
5569
|
-
* @param request.args.licenseTermsData.terms.derivativesAllowed Indicates whether the licensee can create derivatives of his work or not.
|
5570
|
-
* @param request.args.licenseTermsData.terms.derivativesAttribution Indicates whether attribution is required for derivatives of the work or not.
|
5571
|
-
* @param request.args.licenseTermsData.terms.derivativesApproval Indicates whether the licensor must approve derivatives of the work before they can be linked to the licensor IP ID or not.
|
5572
|
-
* @param request.args.licenseTermsData.terms.derivativesReciprocal Indicates whether the licensee must license derivatives of the work under the same terms or not.
|
5573
|
-
* @param request.args.licenseTermsData.terms.derivativeRevCeiling The maximum revenue that can be generated from the derivative use of the work.
|
5574
|
-
* @param request.args.licenseTermsData.terms.currency The ERC20 token to be used to pay the minting fee. the token must be registered in story protocol.
|
5575
|
-
* @param request.args.licenseTermsData.terms.uri The URI of the license terms, which can be used to fetch the offchain license terms.
|
5576
|
-
* @param {Object} request.args.licenseTermsData.licensingConfig The PIL terms and licensing configuration data to attach to the IP.
|
5577
|
-
* @param request.args.licenseTermsData.licensingConfig.isSet Whether the configuration is set or not.
|
5578
|
-
* @param request.args.licenseTermsData.licensingConfig.mintingFee The minting fee to be paid when minting license tokens.
|
5579
|
-
* @param request.args.licenseTermsData.licensingConfig.licensingHook The hook contract address for the licensing module, or zero address if none
|
5580
|
-
* @param request.args.licenseTermsData.licensingConfig.hookData The data to be used by the licensing hook.
|
5581
|
-
* @param request.args.licenseTermsData.licensingConfig.commercialRevShare The commercial revenue share percentage.
|
5582
|
-
* @param request.args.licenseTermsData.licensingConfig.disabled Whether the licensing is disabled or not.
|
5583
|
-
* @param request.args.licenseTermsData.licensingConfig.expectMinimumGroupRewardShare The minimum percentage of the group's reward share (from 0 to 100%, represented as 100 * 10 ** 6) that can be allocated to the IP when it is added to the group.
|
5584
|
-
* If the remaining reward share in the group is less than the minimumGroupRewardShare,the IP cannot be added to the group.
|
5585
|
-
* @param request.args.licenseTermsData.licensingConfig.expectGroupRewardPool The address of the expected group reward pool. The IP can only be added to a group with this specified reward pool address, or zero address if the IP does not want to be added to any group.
|
5586
|
-
* @param {Object} request.args.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
|
5587
|
-
* @param request.args.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
|
5588
|
-
* @param request.args.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
|
5589
|
-
* @param request.args.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
|
5590
|
-
* @param request.args.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
|
5591
|
-
* @param request.args.recipient [Optional] The address of the recipient of the minted NFT,default value is your wallet address.
|
5592
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property, without encodedTxData option.
|
5593
|
-
* @returns A Promise that resolves to a transaction hash, if waitForTransaction is true, return an array containing IP ID, Token ID, License Terms Ids, SPG NFT Contract.
|
5594
|
-
* @emits IPRegistered (ipId, chainId, tokenContract, tokenId, name, uri, registrationDate)
|
5595
|
-
* @emits LicenseTermsAttached (caller, ipId, licenseTemplate, licenseTermsId)
|
5529
|
+
*
|
5530
|
+
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} and {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicensingModule.sol#L19 | `LicenseTermsAttached`} events.
|
5596
5531
|
*/
|
5597
5532
|
)
|
5598
5533
|
}, {
|
@@ -5721,8 +5656,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5721
5656
|
}()
|
5722
5657
|
/**
|
5723
5658
|
* Register a given NFT as an IP and attach Programmable IP License Terms.
|
5724
|
-
*
|
5725
|
-
*
|
5659
|
+
*
|
5660
|
+
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} and {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicensingModule.sol#L19 | `LicenseTermsAttached`} events.
|
5726
5661
|
*/
|
5727
5662
|
)
|
5728
5663
|
}, {
|
@@ -5770,14 +5705,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5770
5705
|
chainId: chain[this.chainId],
|
5771
5706
|
permissions: [{
|
5772
5707
|
ipId: ipIdAddress,
|
5773
|
-
signer:
|
5774
|
-
to:
|
5708
|
+
signer: validateAddress(this.licenseAttachmentWorkflowsClient.address),
|
5709
|
+
to: validateAddress(this.coreMetadataModuleClient.address),
|
5775
5710
|
permission: AccessPermission.ALLOW,
|
5776
5711
|
func: getFunctionSignature(coreMetadataModuleAbi, "setAll")
|
5777
5712
|
}, {
|
5778
5713
|
ipId: ipIdAddress,
|
5779
|
-
signer:
|
5780
|
-
to:
|
5714
|
+
signer: this.licenseAttachmentWorkflowsClient.address,
|
5715
|
+
to: validateAddress(this.licensingModuleClient.address),
|
5781
5716
|
permission: AccessPermission.ALLOW,
|
5782
5717
|
func: getFunctionSignature(licensingModuleAbi, "attachLicenseTerms")
|
5783
5718
|
}, {
|
@@ -5792,12 +5727,12 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5792
5727
|
_yield$getPermissionS2 = _context9.sent;
|
5793
5728
|
signature = _yield$getPermissionS2.signature;
|
5794
5729
|
_object2 = {
|
5795
|
-
nftContract:
|
5730
|
+
nftContract: validateAddress(request.nftContract),
|
5796
5731
|
tokenId: request.tokenId,
|
5797
5732
|
licenseTermsData: licenseTermsData,
|
5798
5733
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
5799
5734
|
sigMetadataAndAttachAndConfig: {
|
5800
|
-
signer:
|
5735
|
+
signer: validateAddress(this.walletAddress),
|
5801
5736
|
deadline: calculatedDeadline,
|
5802
5737
|
signature: signature
|
5803
5738
|
}
|
@@ -5861,8 +5796,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5861
5796
|
}()
|
5862
5797
|
/**
|
5863
5798
|
* Register the given NFT as a derivative IP with metadata without using license tokens.
|
5864
|
-
*
|
5865
|
-
*
|
5799
|
+
*
|
5800
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
5866
5801
|
*/
|
5867
5802
|
)
|
5868
5803
|
}, {
|
@@ -5905,14 +5840,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5905
5840
|
chainId: chain[this.chainId],
|
5906
5841
|
permissions: [{
|
5907
5842
|
ipId: ipIdAddress,
|
5908
|
-
signer:
|
5909
|
-
to:
|
5843
|
+
signer: validateAddress(this.derivativeWorkflowsClient.address),
|
5844
|
+
to: validateAddress(this.coreMetadataModuleClient.address),
|
5910
5845
|
permission: AccessPermission.ALLOW,
|
5911
5846
|
func: getFunctionSignature(coreMetadataModuleAbi, "setAll")
|
5912
5847
|
}, {
|
5913
5848
|
ipId: ipIdAddress,
|
5914
5849
|
signer: this.derivativeWorkflowsClient.address,
|
5915
|
-
to:
|
5850
|
+
to: validateAddress(this.licensingModuleClient.address),
|
5916
5851
|
permission: AccessPermission.ALLOW,
|
5917
5852
|
func: getFunctionSignature(licensingModuleAbi, "registerDerivative")
|
5918
5853
|
}]
|
@@ -5925,7 +5860,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5925
5860
|
case 19:
|
5926
5861
|
derivData = _context10.sent;
|
5927
5862
|
_object3 = {
|
5928
|
-
nftContract:
|
5863
|
+
nftContract: validateAddress(request.nftContract),
|
5929
5864
|
tokenId: BigInt(request.tokenId),
|
5930
5865
|
derivData: derivData,
|
5931
5866
|
sigMetadataAndRegister: {
|
@@ -5975,8 +5910,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5975
5910
|
}()
|
5976
5911
|
/**
|
5977
5912
|
* Mint an NFT from a collection and register it as a derivative IP without license tokens.
|
5978
|
-
*
|
5979
|
-
*
|
5913
|
+
*
|
5914
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
5980
5915
|
*/
|
5981
5916
|
)
|
5982
5917
|
}, {
|
@@ -5993,8 +5928,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5993
5928
|
return this.validateDerivativeData(request.derivData);
|
5994
5929
|
case 3:
|
5995
5930
|
derivData = _context11.sent;
|
5996
|
-
recipient =
|
5997
|
-
spgNftContract =
|
5931
|
+
recipient = validateAddress(request.recipient || this.walletAddress);
|
5932
|
+
spgNftContract = validateAddress(request.spgNftContract);
|
5998
5933
|
_object4 = _objectSpread2(_objectSpread2({}, request), {}, {
|
5999
5934
|
derivData: derivData,
|
6000
5935
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
@@ -6041,22 +5976,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6041
5976
|
}()
|
6042
5977
|
/**
|
6043
5978
|
* Batch mint an NFT from a collection and register it as a derivative IP without license tokens.
|
6044
|
-
*
|
6045
|
-
*
|
6046
|
-
* @param request.args.spgNftContract The address of the NFT collection.
|
6047
|
-
* @param {Object} request.args.derivData The derivative data to be used for registerDerivative.
|
6048
|
-
* @param {Array} request.args.derivData.parentIpIds The IDs of the parent IPs to link the registered derivative IP.
|
6049
|
-
* @param {Array} request.args.derivData.licenseTermsIds The IDs of the license terms to be used for the linking.
|
6050
|
-
* @param request.args.derivData.licenseTemplate [Optional] The address of the license template to be used for the linking.
|
6051
|
-
* @param {Object} request.args.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
|
6052
|
-
* @param request.args.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
|
6053
|
-
* @param request.args.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
|
6054
|
-
* @param request.args.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
|
6055
|
-
* @param request.args.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
|
6056
|
-
* @param request.arg.recipient [Optional] The address of the recipient of the minted NFT,default value is your wallet address.
|
6057
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property, without encodedTxData option.
|
6058
|
-
* @returns A Promise that resolves to a transaction hash, if waitForTransaction is true, return an array of containing IP ID and token ID, SPG NFT Contract.
|
6059
|
-
* @emits IPRegistered (ipId, chainId, tokenContract, tokenId, name, uri, registrationDate)
|
5979
|
+
*
|
5980
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
6060
5981
|
*/
|
6061
5982
|
)
|
6062
5983
|
}, {
|
@@ -6150,18 +6071,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6150
6071
|
}()
|
6151
6072
|
/**
|
6152
6073
|
* Mint an NFT from a SPGNFT collection and register it with metadata as an IP.
|
6153
|
-
*
|
6154
|
-
*
|
6155
|
-
* @param request.recipient The address of the recipient of the minted NFT,default value is your wallet address.
|
6156
|
-
* @param request.allowDuplicates Set to true to allow minting an NFT with a duplicate metadata hash.
|
6157
|
-
* @param {Object} request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
|
6158
|
-
* @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
|
6159
|
-
* @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
|
6160
|
-
* @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
|
6161
|
-
* @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
|
6162
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
6163
|
-
* @returns A Promise that resolves to a transaction hash, and if encodedTxDataOnly is true, includes encoded transaction data, or if waitForTransaction is true, includes IP ID and Token ID.
|
6164
|
-
* @emits IPRegistered (ipId, chainId, tokenContract, tokenId, name, uri, registrationDate)
|
6074
|
+
*
|
6075
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
6165
6076
|
*/
|
6166
6077
|
)
|
6167
6078
|
}, {
|
@@ -6175,8 +6086,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6175
6086
|
case 0:
|
6176
6087
|
_context13.prev = 0;
|
6177
6088
|
_object5 = {
|
6178
|
-
spgNftContract:
|
6179
|
-
recipient:
|
6089
|
+
spgNftContract: validateAddress(request.spgNftContract),
|
6090
|
+
recipient: validateAddress(request.recipient || this.walletAddress),
|
6180
6091
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
6181
6092
|
allowDuplicates: request.allowDuplicates || true
|
6182
6093
|
};
|
@@ -6219,8 +6130,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6219
6130
|
}()
|
6220
6131
|
/**
|
6221
6132
|
* Register Programmable IP License Terms (if unregistered) and attach it to IP.
|
6222
|
-
*
|
6223
|
-
*
|
6133
|
+
*
|
6134
|
+
* 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.
|
6224
6135
|
*/
|
6225
6136
|
)
|
6226
6137
|
}, {
|
@@ -6268,14 +6179,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6268
6179
|
chainId: chain[this.chainId],
|
6269
6180
|
permissions: [{
|
6270
6181
|
ipId: ipId,
|
6271
|
-
signer:
|
6272
|
-
to:
|
6182
|
+
signer: validateAddress(this.licenseAttachmentWorkflowsClient.address),
|
6183
|
+
to: validateAddress(this.licensingModuleClient.address),
|
6273
6184
|
permission: AccessPermission.ALLOW,
|
6274
6185
|
func: getFunctionSignature(licensingModuleAbi, "attachLicenseTerms")
|
6275
6186
|
}, {
|
6276
6187
|
ipId: ipId,
|
6277
|
-
signer:
|
6278
|
-
to:
|
6188
|
+
signer: this.licenseAttachmentWorkflowsClient.address,
|
6189
|
+
to: this.licensingModuleClient.address,
|
6279
6190
|
permission: AccessPermission.ALLOW,
|
6280
6191
|
func: getFunctionSignature(licensingModuleAbi, "setLicensingConfig")
|
6281
6192
|
}]
|
@@ -6287,7 +6198,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6287
6198
|
ipId: ipId,
|
6288
6199
|
licenseTermsData: licenseTermsData,
|
6289
6200
|
sigAttachAndConfig: {
|
6290
|
-
signer:
|
6201
|
+
signer: validateAddress(this.walletAddress),
|
6291
6202
|
deadline: calculatedDeadline,
|
6292
6203
|
signature: signature
|
6293
6204
|
}
|
@@ -6344,22 +6255,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6344
6255
|
return registerPilTermsAndAttach;
|
6345
6256
|
}()
|
6346
6257
|
/**
|
6347
|
-
*
|
6258
|
+
* Mint an NFT from a collection and register it as a derivative IP using license tokens.
|
6348
6259
|
* 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.
|
6349
|
-
*
|
6350
|
-
*
|
6351
|
-
* @param {Array} request.licenseTokenIds The IDs of the license tokens to be burned for linking the IP to parent IPs.
|
6352
|
-
* @param request.allowDuplicates Set to true to allow minting an NFT with a duplicate metadata hash.
|
6353
|
-
* @param request.maxRts The maximum number of royalty tokens that can be distributed to the external royalty policies (max: 100,000,000).
|
6354
|
-
* @param {Object} request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
|
6355
|
-
* @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
|
6356
|
-
* @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
|
6357
|
-
* @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
|
6358
|
-
* @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
|
6359
|
-
* @param request.recipient - [Optional] The address to receive the minted NFT,default value is your wallet address.
|
6360
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
6361
|
-
* @returns A Promise that resolves to a transaction hash, and if encodedTxDataOnly is true, includes encoded transaction data, or if waitForTransaction is true, includes IP ID and Token ID.
|
6362
|
-
* @emits IPRegistered (ipId, chainId, tokenContract, tokenId, name, uri, registrationDate)
|
6260
|
+
*
|
6261
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
6363
6262
|
*/
|
6364
6263
|
)
|
6365
6264
|
}, {
|
@@ -6377,8 +6276,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6377
6276
|
case 3:
|
6378
6277
|
licenseTokenIds = _context16.sent;
|
6379
6278
|
_object7 = {
|
6380
|
-
spgNftContract:
|
6381
|
-
recipient:
|
6279
|
+
spgNftContract: validateAddress(request.spgNftContract),
|
6280
|
+
recipient: validateAddress(request.recipient || this.walletAddress),
|
6382
6281
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
6383
6282
|
licenseTokenIds: licenseTokenIds,
|
6384
6283
|
royaltyContext: viem.zeroAddress,
|
@@ -6441,18 +6340,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6441
6340
|
}()
|
6442
6341
|
/**
|
6443
6342
|
* Register the given NFT as a derivative IP using license tokens.
|
6444
|
-
*
|
6445
|
-
*
|
6446
|
-
* @param {Array} request.licenseTokenIds The IDs of the license tokens to be burned for linking the IP to parent IPs.
|
6447
|
-
* @param request.tokenId The ID of the NFT.
|
6448
|
-
* @param {Object} request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
|
6449
|
-
* @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
|
6450
|
-
* @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
|
6451
|
-
* @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
|
6452
|
-
* @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
|
6453
|
-
* @param request.deadline [Optional] The deadline for the signature in seconds, default is 1000s.
|
6454
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
6455
|
-
* @returns A Promise that resolves to a transaction hash, and if encodedTxDataOnly is true, includes encoded transaction data, or if waitForTransaction is true, includes IP ID, Token ID.
|
6343
|
+
*
|
6344
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
6456
6345
|
*/
|
6457
6346
|
)
|
6458
6347
|
}, {
|
@@ -6498,14 +6387,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6498
6387
|
chainId: chain[this.chainId],
|
6499
6388
|
permissions: [{
|
6500
6389
|
ipId: ipIdAddress,
|
6501
|
-
signer:
|
6502
|
-
to:
|
6390
|
+
signer: validateAddress(this.derivativeWorkflowsClient.address),
|
6391
|
+
to: validateAddress(this.coreMetadataModuleClient.address),
|
6503
6392
|
permission: AccessPermission.ALLOW,
|
6504
6393
|
func: getFunctionSignature(coreMetadataModuleAbi, "setAll")
|
6505
6394
|
}, {
|
6506
6395
|
ipId: ipIdAddress,
|
6507
6396
|
signer: this.derivativeWorkflowsClient.address,
|
6508
|
-
to:
|
6397
|
+
to: validateAddress(this.licensingModuleClient.address),
|
6509
6398
|
permission: AccessPermission.ALLOW,
|
6510
6399
|
func: getFunctionSignature(licensingModuleAbi, "registerDerivativeWithLicenseTokens")
|
6511
6400
|
}]
|
@@ -6519,7 +6408,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6519
6408
|
royaltyContext: viem.zeroAddress,
|
6520
6409
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
6521
6410
|
sigMetadataAndRegister: {
|
6522
|
-
signer:
|
6411
|
+
signer: validateAddress(this.walletAddress),
|
6523
6412
|
deadline: calculatedDeadline,
|
6524
6413
|
signature: signature
|
6525
6414
|
},
|
@@ -6575,11 +6464,11 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6575
6464
|
return registerIpAndMakeDerivativeWithLicenseTokens;
|
6576
6465
|
}()
|
6577
6466
|
/**
|
6578
|
-
* Register the given NFT and attach license terms and distribute royalty
|
6579
|
-
*
|
6580
|
-
*
|
6581
|
-
*
|
6582
|
-
*
|
6467
|
+
* Register the given NFT and attach license terms and distribute royalty
|
6468
|
+
* tokens. In order to successfully distribute royalty tokens, the first
|
6469
|
+
* license terms attached to the IP must be a commercial license.
|
6470
|
+
*
|
6471
|
+
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} and {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/royalty/IRoyaltyModule.sol#L88 | `IpRoyaltyVaultDeployed`} events.
|
6583
6472
|
*/
|
6584
6473
|
)
|
6585
6474
|
}, {
|
@@ -6603,7 +6492,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6603
6492
|
case 9:
|
6604
6493
|
calculatedDeadline = _context18.sent;
|
6605
6494
|
_context18.next = 12;
|
6606
|
-
return this.getIpIdAddress(
|
6495
|
+
return this.getIpIdAddress(validateAddress(request.nftContract), request.tokenId);
|
6607
6496
|
case 12:
|
6608
6497
|
ipIdAddress = _context18.sent;
|
6609
6498
|
_context18.next = 15;
|
@@ -6627,14 +6516,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6627
6516
|
chainId: chain[this.chainId],
|
6628
6517
|
permissions: [{
|
6629
6518
|
ipId: ipIdAddress,
|
6630
|
-
signer:
|
6631
|
-
to:
|
6519
|
+
signer: validateAddress(this.royaltyTokenDistributionWorkflowsClient.address),
|
6520
|
+
to: validateAddress(this.coreMetadataModuleClient.address),
|
6632
6521
|
permission: AccessPermission.ALLOW,
|
6633
6522
|
func: getFunctionSignature(coreMetadataModuleAbi, "setAll")
|
6634
6523
|
}, {
|
6635
6524
|
ipId: ipIdAddress,
|
6636
6525
|
signer: this.royaltyTokenDistributionWorkflowsClient.address,
|
6637
|
-
to:
|
6526
|
+
to: validateAddress(this.licensingModuleClient.address),
|
6638
6527
|
permission: AccessPermission.ALLOW,
|
6639
6528
|
func: getFunctionSignature(licensingModuleAbi, "attachLicenseTerms")
|
6640
6529
|
}, {
|
@@ -6655,7 +6544,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6655
6544
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
6656
6545
|
licenseTermsData: licenseTermsData,
|
6657
6546
|
sigMetadataAndAttachAndConfig: {
|
6658
|
-
signer:
|
6547
|
+
signer: validateAddress(this.walletAddress),
|
6659
6548
|
deadline: calculatedDeadline,
|
6660
6549
|
signature: signature
|
6661
6550
|
}
|
@@ -6719,9 +6608,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6719
6608
|
/**
|
6720
6609
|
* Register the given NFT as a derivative IP and attach license terms and distribute royalty tokens. In order to successfully distribute royalty tokens, the license terms attached to the IP must be
|
6721
6610
|
* a commercial license.
|
6722
|
-
*
|
6723
|
-
* @
|
6724
|
-
* for a list of on-chain events emitted when a derivative IP is registered, license terms are attached to an IP, and royalty tokens are distributed.
|
6611
|
+
*
|
6612
|
+
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} and {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/royalty/IRoyaltyModule.sol#L88| `IpRoyaltyVaultDeployed`} events.
|
6725
6613
|
*/
|
6726
6614
|
)
|
6727
6615
|
}, {
|
@@ -6753,14 +6641,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6753
6641
|
chainId: chain[this.chainId],
|
6754
6642
|
permissions: [{
|
6755
6643
|
ipId: ipIdAddress,
|
6756
|
-
signer:
|
6757
|
-
to:
|
6644
|
+
signer: validateAddress(this.royaltyTokenDistributionWorkflowsClient.address),
|
6645
|
+
to: validateAddress(this.coreMetadataModuleClient.address),
|
6758
6646
|
permission: AccessPermission.ALLOW,
|
6759
6647
|
func: getFunctionSignature(coreMetadataModuleAbi, "setAll")
|
6760
6648
|
}, {
|
6761
6649
|
ipId: ipIdAddress,
|
6762
6650
|
signer: this.royaltyTokenDistributionWorkflowsClient.address,
|
6763
|
-
to:
|
6651
|
+
to: validateAddress(this.licensingModuleClient.address),
|
6764
6652
|
permission: AccessPermission.ALLOW,
|
6765
6653
|
func: getFunctionSignature(licensingModuleAbi, "registerDerivative")
|
6766
6654
|
}]
|
@@ -6871,9 +6759,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6871
6759
|
}()
|
6872
6760
|
/**
|
6873
6761
|
* Mint an NFT and register the IP, attach PIL terms, and distribute royalty tokens.
|
6874
|
-
*
|
6875
|
-
* @
|
6876
|
-
* for a list of on-chain events emitted when an IP is minted and registered, PIL terms are attached to an IP, and royalty tokens are distributed.
|
6762
|
+
*
|
6763
|
+
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} and {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/royalty/IRoyaltyModule.sol#L88| `IpRoyaltyVaultDeployed`} events.
|
6877
6764
|
*/
|
6878
6765
|
)
|
6879
6766
|
}, {
|
@@ -6894,8 +6781,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6894
6781
|
licenseTermsData = _yield$this$validateL5.licenseTermsData;
|
6895
6782
|
_this$getRoyaltyShare3 = this.getRoyaltyShares(request.royaltyShares), royaltyShares = _this$getRoyaltyShare3.royaltyShares;
|
6896
6783
|
_object10 = {
|
6897
|
-
spgNftContract:
|
6898
|
-
recipient:
|
6784
|
+
spgNftContract: validateAddress(request.spgNftContract),
|
6785
|
+
recipient: validateAddress(request.recipient || this.walletAddress),
|
6899
6786
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
6900
6787
|
licenseTermsData: licenseTermsData,
|
6901
6788
|
royaltyShares: royaltyShares,
|
@@ -6958,8 +6845,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6958
6845
|
}()
|
6959
6846
|
/**
|
6960
6847
|
* Mint an NFT and register the IP, make a derivative, and distribute royalty tokens.
|
6961
|
-
*
|
6962
|
-
*
|
6848
|
+
*
|
6849
|
+
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
6963
6850
|
*/
|
6964
6851
|
)
|
6965
6852
|
}, {
|
@@ -6972,14 +6859,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6972
6859
|
while (1) switch (_context21.prev = _context21.next) {
|
6973
6860
|
case 0:
|
6974
6861
|
_context21.prev = 0;
|
6975
|
-
nftRecipient =
|
6862
|
+
nftRecipient = validateAddress(request.recipient || this.walletAddress);
|
6976
6863
|
_this$getRoyaltyShare4 = this.getRoyaltyShares(request.royaltyShares), royaltyShares = _this$getRoyaltyShare4.royaltyShares;
|
6977
6864
|
_context21.next = 5;
|
6978
6865
|
return this.validateDerivativeData(request.derivData);
|
6979
6866
|
case 5:
|
6980
6867
|
derivData = _context21.sent;
|
6981
6868
|
_object11 = {
|
6982
|
-
spgNftContract:
|
6869
|
+
spgNftContract: validateAddress(request.spgNftContract),
|
6983
6870
|
recipient: nftRecipient,
|
6984
6871
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
6985
6872
|
derivData: derivData,
|
@@ -7065,7 +6952,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
7065
6952
|
}
|
7066
6953
|
throw new Error("The balance of the IP account in the IP Royalty Vault is insufficient to distribute the royalty tokens.");
|
7067
6954
|
case 7:
|
7068
|
-
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet,
|
6955
|
+
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(ipId));
|
7069
6956
|
_context22.next = 10;
|
7070
6957
|
return ipAccount.state();
|
7071
6958
|
case 10:
|
@@ -7134,7 +7021,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
7134
7021
|
_context23.next = 2;
|
7135
7022
|
return this.ipAssetRegistryClient.ipId({
|
7136
7023
|
chainId: BigInt(chain[this.chainId]),
|
7137
|
-
tokenContract:
|
7024
|
+
tokenContract: validateAddress(nftContract),
|
7138
7025
|
tokenId: BigInt(tokenId)
|
7139
7026
|
});
|
7140
7027
|
case 2:
|
@@ -7160,7 +7047,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
7160
7047
|
case 0:
|
7161
7048
|
_context24.next = 2;
|
7162
7049
|
return this.ipAssetRegistryClient.isRegistered({
|
7163
|
-
id:
|
7050
|
+
id: validateAddress(ipId)
|
7164
7051
|
});
|
7165
7052
|
case 2:
|
7166
7053
|
return _context24.abrupt("return", _context24.sent);
|
@@ -7343,54 +7230,54 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
7343
7230
|
}, {
|
7344
7231
|
key: "validateDerivativeData",
|
7345
7232
|
value: function () {
|
7346
|
-
var _validateDerivativeData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(
|
7347
|
-
var
|
7233
|
+
var _validateDerivativeData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(derivativeDataInput) {
|
7234
|
+
var derivativeData, i, parentId, isParentIpRegistered, isAttachedLicenseTerms, _yield$this$licenseRe, royaltyPercent;
|
7348
7235
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
7349
7236
|
while (1) switch (_context28.prev = _context28.next) {
|
7350
7237
|
case 0:
|
7351
|
-
|
7352
|
-
parentIpIds:
|
7353
|
-
licenseTermsIds:
|
7238
|
+
derivativeData = {
|
7239
|
+
parentIpIds: derivativeDataInput.parentIpIds,
|
7240
|
+
licenseTermsIds: derivativeDataInput.licenseTermsIds.map(function (id) {
|
7354
7241
|
return BigInt(id);
|
7355
7242
|
}),
|
7356
|
-
licenseTemplate:
|
7243
|
+
licenseTemplate: validateAddress(derivativeDataInput.licenseTemplate || this.licenseTemplateClient.address),
|
7357
7244
|
royaltyContext: viem.zeroAddress,
|
7358
|
-
maxMintingFee: BigInt(
|
7359
|
-
maxRts: Number(
|
7360
|
-
maxRevenueShare: getRevenueShare(
|
7245
|
+
maxMintingFee: BigInt(derivativeDataInput.maxMintingFee || 0),
|
7246
|
+
maxRts: Number(derivativeDataInput.maxRts || MAX_ROYALTY_TOKEN),
|
7247
|
+
maxRevenueShare: getRevenueShare(derivativeDataInput.maxRevenueShare || 100, RevShareType.MAX_REVENUE_SHARE)
|
7361
7248
|
};
|
7362
|
-
if (!(
|
7249
|
+
if (!(derivativeData.parentIpIds.length === 0)) {
|
7363
7250
|
_context28.next = 3;
|
7364
7251
|
break;
|
7365
7252
|
}
|
7366
7253
|
throw new Error("The parent IP IDs must be provided.");
|
7367
7254
|
case 3:
|
7368
|
-
if (!(
|
7255
|
+
if (!(derivativeData.licenseTermsIds.length === 0)) {
|
7369
7256
|
_context28.next = 5;
|
7370
7257
|
break;
|
7371
7258
|
}
|
7372
7259
|
throw new Error("The license terms IDs must be provided.");
|
7373
7260
|
case 5:
|
7374
|
-
if (!(
|
7261
|
+
if (!(derivativeData.parentIpIds.length !== derivativeData.licenseTermsIds.length)) {
|
7375
7262
|
_context28.next = 7;
|
7376
7263
|
break;
|
7377
7264
|
}
|
7378
7265
|
throw new Error("The number of parent IP IDs must match the number of license terms IDs.");
|
7379
7266
|
case 7:
|
7380
|
-
if (!(
|
7267
|
+
if (!(derivativeData.maxMintingFee < 0)) {
|
7381
7268
|
_context28.next = 9;
|
7382
7269
|
break;
|
7383
7270
|
}
|
7384
7271
|
throw new Error("The maxMintingFee must be greater than 0.");
|
7385
7272
|
case 9:
|
7386
|
-
this.validateMaxRts(
|
7273
|
+
this.validateMaxRts(derivativeData.maxRts);
|
7387
7274
|
i = 0;
|
7388
7275
|
case 11:
|
7389
|
-
if (!(i <
|
7276
|
+
if (!(i < derivativeData.parentIpIds.length)) {
|
7390
7277
|
_context28.next = 32;
|
7391
7278
|
break;
|
7392
7279
|
}
|
7393
|
-
parentId =
|
7280
|
+
parentId = derivativeData.parentIpIds[i];
|
7394
7281
|
_context28.next = 15;
|
7395
7282
|
return this.isRegistered(parentId);
|
7396
7283
|
case 15:
|
@@ -7404,8 +7291,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
7404
7291
|
_context28.next = 20;
|
7405
7292
|
return this.licenseRegistryReadOnlyClient.hasIpAttachedLicenseTerms({
|
7406
7293
|
ipId: parentId,
|
7407
|
-
licenseTemplate:
|
7408
|
-
licenseTermsId:
|
7294
|
+
licenseTemplate: derivativeData.licenseTemplate,
|
7295
|
+
licenseTermsId: derivativeData.licenseTermsIds[i]
|
7409
7296
|
});
|
7410
7297
|
case 20:
|
7411
7298
|
isAttachedLicenseTerms = _context28.sent;
|
@@ -7413,28 +7300,28 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
7413
7300
|
_context28.next = 23;
|
7414
7301
|
break;
|
7415
7302
|
}
|
7416
|
-
throw new Error("License terms id ".concat(
|
7303
|
+
throw new Error("License terms id ".concat(derivativeData.licenseTermsIds[i], " must be attached to the parent ipId ").concat(derivativeData.parentIpIds[i], " before registering derivative."));
|
7417
7304
|
case 23:
|
7418
7305
|
_context28.next = 25;
|
7419
7306
|
return this.licenseRegistryReadOnlyClient.getRoyaltyPercent({
|
7420
7307
|
ipId: parentId,
|
7421
|
-
licenseTemplate:
|
7422
|
-
licenseTermsId:
|
7308
|
+
licenseTemplate: derivativeData.licenseTemplate,
|
7309
|
+
licenseTermsId: derivativeData.licenseTermsIds[i]
|
7423
7310
|
});
|
7424
7311
|
case 25:
|
7425
7312
|
_yield$this$licenseRe = _context28.sent;
|
7426
7313
|
royaltyPercent = _yield$this$licenseRe.royaltyPercent;
|
7427
|
-
if (!(
|
7314
|
+
if (!(derivativeData.maxRevenueShare !== 0 && royaltyPercent > derivativeData.maxRevenueShare)) {
|
7428
7315
|
_context28.next = 29;
|
7429
7316
|
break;
|
7430
7317
|
}
|
7431
|
-
throw new Error("The royalty percent for the parent IP with id ".concat(parentId, " is greater than the maximum revenue share ").concat(
|
7318
|
+
throw new Error("The royalty percent for the parent IP with id ".concat(parentId, " is greater than the maximum revenue share ").concat(derivativeData.maxRevenueShare, "."));
|
7432
7319
|
case 29:
|
7433
7320
|
i++;
|
7434
7321
|
_context28.next = 11;
|
7435
7322
|
break;
|
7436
7323
|
case 32:
|
7437
|
-
return _context28.abrupt("return",
|
7324
|
+
return _context28.abrupt("return", derivativeData);
|
7438
7325
|
case 33:
|
7439
7326
|
case "end":
|
7440
7327
|
return _context28.stop();
|
@@ -7536,13 +7423,17 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
7536
7423
|
}
|
7537
7424
|
_context30.next = 15;
|
7538
7425
|
return calculateLicenseWipMintFee({
|
7539
|
-
|
7540
|
-
|
7541
|
-
|
7542
|
-
|
7543
|
-
|
7544
|
-
|
7545
|
-
|
7426
|
+
predictMintingFeeRequest: {
|
7427
|
+
licensorIpId: derivData.parentIpIds[i],
|
7428
|
+
licenseTemplate: derivData.licenseTemplate,
|
7429
|
+
licenseTermsId: derivData.licenseTermsIds[i],
|
7430
|
+
receiver: sender,
|
7431
|
+
amount: 1n,
|
7432
|
+
royaltyContext: viem.zeroAddress
|
7433
|
+
},
|
7434
|
+
rpcClient: this.rpcClient,
|
7435
|
+
chainId: this.chainId,
|
7436
|
+
walletAddress: this.walletAddress
|
7546
7437
|
});
|
7547
7438
|
case 15:
|
7548
7439
|
derivativeMintingFee = _context30.sent;
|
@@ -7627,24 +7518,13 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
7627
7518
|
}
|
7628
7519
|
|
7629
7520
|
/**
|
7630
|
-
* Sets the permission for a specific function call
|
7521
|
+
* Sets the permission for a specific function call.
|
7631
7522
|
* Each policy is represented as a mapping from an IP account address to a signer address to a recipient
|
7632
|
-
* address to a function selector to a permission level. The permission level
|
7633
|
-
*
|
7634
|
-
* By default, all policies are set to 0 (ABSTAIN), which means that the permission is not set.
|
7523
|
+
* address to a function selector to a permission level. The permission level is an enum of `AccessPermission`.
|
7524
|
+
* By default, all policies are set to ABSTAIN, which means that the permission is not set.
|
7635
7525
|
* The owner of ipAccount by default has all permission.
|
7636
|
-
*
|
7637
|
-
*
|
7638
|
-
* Specific permission overrides wildcard permission.
|
7639
|
-
* @param request - The request object containing necessary data to set `permission`.
|
7640
|
-
* @param request.ipId The IP ID that grants the permission for `signer`.
|
7641
|
-
* @param request.signer The address that can call `to` on behalf of the `ipAccount`.
|
7642
|
-
* @param request.to The address that can be called by the `signer` (currently only modules can be `to`).
|
7643
|
-
* @param request.permission The new permission level.
|
7644
|
-
* @param request.func [Optional] The function selector string of `to` that can be called by the `signer` on behalf of the `ipAccount`. Be default, it allows all functions.
|
7645
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
7646
|
-
* @returns A Promise that resolves to an object containing the transaction hash.
|
7647
|
-
* @emits PermissionSet (ipAccountOwner, ipAccount, signer, to, func, permission)
|
7526
|
+
*
|
7527
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/access/IAccessController.sol#L13 | `PermissionSet`} event.
|
7648
7528
|
*/
|
7649
7529
|
return _createClass(PermissionClient, [{
|
7650
7530
|
key: "setPermission",
|
@@ -7714,16 +7594,8 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
7714
7594
|
}()
|
7715
7595
|
/**
|
7716
7596
|
* Specific permission overrides wildcard permission with signature.
|
7717
|
-
*
|
7718
|
-
*
|
7719
|
-
* @param request.signer The address that can call `to` on behalf of the `ipAccount`
|
7720
|
-
* @param request.to The address that can be called by the `signer` (currently only modules can be `to`)
|
7721
|
-
* @param request.permission The new permission level.
|
7722
|
-
* @param request.func [Optional] The function selector string of `to` that can be called by the `signer` on behalf of the `ipAccount`. Be default, it allows all functions.
|
7723
|
-
* @param request.deadline [Optional] The deadline for the signature in seconds, default is 1000s.
|
7724
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
7725
|
-
* @returns A Promise that resolves to an object containing the transaction hash.
|
7726
|
-
* @emits PermissionSet (ipAccountOwner, ipAccount, signer, to, func, permission)
|
7597
|
+
*
|
7598
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/access/IAccessController.sol#L13 | `PermissionSet`} event.
|
7727
7599
|
*/
|
7728
7600
|
)
|
7729
7601
|
}, {
|
@@ -7743,7 +7615,7 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
7743
7615
|
data = viem.encodeFunctionData({
|
7744
7616
|
abi: accessControllerAbi,
|
7745
7617
|
functionName: "setTransientPermission",
|
7746
|
-
args: [ipId,
|
7618
|
+
args: [ipId, validateAddress(signer), validateAddress(to), func ? viem.toFunctionSelector(func) : defaultFunctionSelector, permission]
|
7747
7619
|
});
|
7748
7620
|
_context2.next = 8;
|
7749
7621
|
return ipAccountClient.state();
|
@@ -7774,7 +7646,7 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
7774
7646
|
_yield$getPermissionS = _context2.sent;
|
7775
7647
|
signature = _yield$getPermissionS.signature;
|
7776
7648
|
req = {
|
7777
|
-
to:
|
7649
|
+
to: validateAddress(this.accessControllerClient.address),
|
7778
7650
|
value: BigInt(0),
|
7779
7651
|
data: data,
|
7780
7652
|
signer: signer,
|
@@ -7830,13 +7702,8 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
7830
7702
|
}()
|
7831
7703
|
/**
|
7832
7704
|
* Sets permission to a signer for all functions across all modules.
|
7833
|
-
*
|
7834
|
-
*
|
7835
|
-
* @param request.signer The address of the signer receiving the permissions.
|
7836
|
-
* @param request.permission The new permission.
|
7837
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
7838
|
-
* @returns A Promise that resolves to an object containing the transaction hash
|
7839
|
-
* @emits PermissionSet (ipAccountOwner, ipAccount, signer, to, func, permission)
|
7705
|
+
*
|
7706
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/access/IAccessController.sol#L13 | `PermissionSet`} event.
|
7840
7707
|
*/
|
7841
7708
|
)
|
7842
7709
|
}, {
|
@@ -7905,17 +7772,8 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
7905
7772
|
}()
|
7906
7773
|
/**
|
7907
7774
|
* Sets a batch of permissions in a single transaction.
|
7908
|
-
*
|
7909
|
-
*
|
7910
|
-
* @param request.permissions[].ipId The IP ID that grants the permission for `signer`.
|
7911
|
-
* @param request.permissions[].signer The address that can call `to` on behalf of the `ipAccount`.
|
7912
|
-
* @param request.permissions[].to The address that can be called by the `signer` (currently only modules can be `to`).
|
7913
|
-
* @param request.permissions[].permission The new permission level.
|
7914
|
-
* @param request.permissions[].func [Optional] The function selector string of `to` that can be called by the `signer` on behalf of the `ipAccount`. Be default, it allows all functions.
|
7915
|
-
* @param request.deadline [Optional] The deadline for the signature in milliseconds, default is 1000ms.
|
7916
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
7917
|
-
* @returns A Promise that resolves to an object containing the transaction hash
|
7918
|
-
* @emits PermissionSet (ipAccountOwner, ipAccount, signer, to, func, permission)
|
7775
|
+
*
|
7776
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/access/IAccessController.sol#L13 | `PermissionSet`} event.
|
7919
7777
|
*/
|
7920
7778
|
)
|
7921
7779
|
}, {
|
@@ -8014,18 +7872,8 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
8014
7872
|
}()
|
8015
7873
|
/**
|
8016
7874
|
* Sets a batch of permissions in a single transaction with signature.
|
8017
|
-
*
|
8018
|
-
*
|
8019
|
-
* @param {Array} request.permissions - An array of `Permission` structure, each representing the permission to be set.
|
8020
|
-
* @param request.permissions[].ipId The IP ID that grants the permission for `signer`.
|
8021
|
-
* @param request.permissions[].signer The address that can call `to` on behalf of the `ipAccount`.
|
8022
|
-
* @param request.permissions[].to The address that can be called by the `signer` (currently only modules can be `to`).
|
8023
|
-
* @param request.permissions[].permission The new permission level.
|
8024
|
-
* @param request.permissions[].func [Optional] The function selector string of `to` that can be called by the `signer` on behalf of the `ipAccount`. Be default, it allows all functions.
|
8025
|
-
* @param request.deadline [Optional] The deadline for the signature in seconds, default is 1000s.
|
8026
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
8027
|
-
* @returns A Promise that resolves to an object containing the transaction hash.
|
8028
|
-
* @emits PermissionSet (ipAccountOwner, ipAccount, signer, to, func, permission)
|
7875
|
+
*
|
7876
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/access/IAccessController.sol#L13 | `PermissionSet`} event.
|
8029
7877
|
*/
|
8030
7878
|
)
|
8031
7879
|
}, {
|
@@ -8101,10 +7949,10 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
8101
7949
|
_yield$getPermissionS2 = _context5.sent;
|
8102
7950
|
signature = _yield$getPermissionS2.signature;
|
8103
7951
|
req = {
|
8104
|
-
to:
|
7952
|
+
to: validateAddress(this.accessControllerClient.address),
|
8105
7953
|
value: BigInt(0),
|
8106
7954
|
data: data,
|
8107
|
-
signer:
|
7955
|
+
signer: validateAddress(this.wallet.account.address),
|
8108
7956
|
deadline: calculatedDeadline,
|
8109
7957
|
signature: signature
|
8110
7958
|
};
|
@@ -8165,7 +8013,7 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
8165
8013
|
case 0:
|
8166
8014
|
_context6.next = 2;
|
8167
8015
|
return this.ipAssetRegistryClient.isRegistered({
|
8168
|
-
id:
|
8016
|
+
id: validateAddress(ipId)
|
8169
8017
|
});
|
8170
8018
|
case 2:
|
8171
8019
|
isRegistered = _context6.sent;
|
@@ -8207,27 +8055,8 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8207
8055
|
}
|
8208
8056
|
/**
|
8209
8057
|
* Registers new license terms and return the ID of the newly registered license terms.
|
8210
|
-
*
|
8211
|
-
*
|
8212
|
-
* @param request.royaltyPolicy The address of the royalty policy contract which required to StoryProtocol in advance.
|
8213
|
-
* @param request.mintingFee The fee to be paid when minting a license.
|
8214
|
-
* @param request.expiration The expiration period of the license.
|
8215
|
-
* @param request.commercialUse Indicates whether the work can be used commercially or not.
|
8216
|
-
* @param request.commercialAttribution Whether attribution is required when reproducing the work commercially or not.
|
8217
|
-
* @param request.commercializerChecker Commercializers that are allowed to commercially exploit the work. If zero address, then no restrictions is enforced.
|
8218
|
-
* @param request.commercializerCheckerData The data to be passed to the commercializer checker contract.
|
8219
|
-
* @param request.commercialRevShare Percentage of revenue that must be shared with the licensor.
|
8220
|
-
* @param request.commercialRevCeiling The maximum revenue that can be generated from the commercial use of the work.
|
8221
|
-
* @param request.derivativesAllowed Indicates whether the licensee can create derivatives of his work or not.
|
8222
|
-
* @param request.derivativesAttribution Indicates whether attribution is required for derivatives of the work or not.
|
8223
|
-
* @param request.derivativesApproval Indicates whether the licensor must approve derivatives of the work before they can be linked to the licensor IP ID or not.
|
8224
|
-
* @param request.derivativesReciprocal Indicates whether the licensee must license derivatives of the work under the same terms or not.
|
8225
|
-
* @param request.derivativeRevCeiling The maximum revenue that can be generated from the derivative use of the work.
|
8226
|
-
* @param request.currency The ERC20 token to be used to pay the minting fee. the token must be registered in story protocol.
|
8227
|
-
* @param request.uri The URI of the license terms, which can be used to fetch the offchain license terms.
|
8228
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
8229
|
-
* @returns A Promise that resolves to a transaction hash, and if encodedTxDataOnly is true, includes encoded transaction data, and if waitForTransaction is true, includes license terms Id.
|
8230
|
-
* @emits LicenseTermsRegistered (licenseTermsId, licenseTemplate, licenseTerms);
|
8058
|
+
*
|
8059
|
+
* 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.
|
8231
8060
|
*/
|
8232
8061
|
return _createClass(LicenseClient, [{
|
8233
8062
|
key: "registerPILTerms",
|
@@ -8309,10 +8138,8 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8309
8138
|
}()
|
8310
8139
|
/**
|
8311
8140
|
* Convenient function to register a PIL non commercial social remix license to the registry
|
8312
|
-
*
|
8313
|
-
*
|
8314
|
-
* @returns A Promise that resolves to a transaction hash, and if encodedTxDataOnly is true, includes encoded transaction data, and if waitForTransaction is true, includes license terms Id.
|
8315
|
-
* @emits LicenseTermsRegistered (licenseTermsId, licenseTemplate, licenseTerms);
|
8141
|
+
*
|
8142
|
+
* 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.
|
8316
8143
|
*/
|
8317
8144
|
)
|
8318
8145
|
}, {
|
@@ -8392,13 +8219,8 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8392
8219
|
}()
|
8393
8220
|
/**
|
8394
8221
|
* Convenient function to register a PIL commercial use license to the registry.
|
8395
|
-
*
|
8396
|
-
*
|
8397
|
-
* @param request.currency The ERC20 token to be used to pay the minting fee and the token must be registered in story protocol.
|
8398
|
-
* @param request.royaltyPolicyAddress [Optional] The address of the royalty policy contract, default value is LAP.
|
8399
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
8400
|
-
* @returns A Promise that resolves to a transaction hash, and if encodedTxDataOnly is true, includes encoded transaction data, and if waitForTransaction is true, includes license terms Id.
|
8401
|
-
* @emits LicenseTermsRegistered (licenseTermsId, licenseTemplate, licenseTerms);
|
8222
|
+
*
|
8223
|
+
* 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.
|
8402
8224
|
*/
|
8403
8225
|
)
|
8404
8226
|
}, {
|
@@ -8413,7 +8235,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8413
8235
|
licenseTerms = getLicenseTermByType(PIL_TYPE.COMMERCIAL_USE, {
|
8414
8236
|
defaultMintingFee: request.defaultMintingFee,
|
8415
8237
|
currency: request.currency,
|
8416
|
-
royaltyPolicyAddress:
|
8238
|
+
royaltyPolicyAddress: validateAddress(request.royaltyPolicyAddress || royaltyPolicyLapAddress[chain[this.chainId]])
|
8417
8239
|
});
|
8418
8240
|
_context3.next = 4;
|
8419
8241
|
return this.getLicenseTermsId(licenseTerms);
|
@@ -8482,14 +8304,8 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8482
8304
|
}()
|
8483
8305
|
/**
|
8484
8306
|
* Convenient function to register a PIL commercial Remix license to the registry.
|
8485
|
-
*
|
8486
|
-
*
|
8487
|
-
* @param request.commercialRevShare Percentage of revenue that must be shared with the licensor.
|
8488
|
-
* @param request.currency The ERC20 token to be used to pay the minting fee. the token must be registered in story protocol.
|
8489
|
-
* @param request.royaltyPolicyAddress [Optional] The address of the royalty policy contract, default value is LAP.
|
8490
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
8491
|
-
* @returns A Promise that resolves to a transaction hash, and if encodedTxDataOnly is true, includes encoded transaction data, and if waitForTransaction is true, includes license terms Id.
|
8492
|
-
* @emits LicenseTermsRegistered (licenseTermsId, licenseTemplate, licenseTerms);
|
8307
|
+
*
|
8308
|
+
* 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.
|
8493
8309
|
*/
|
8494
8310
|
)
|
8495
8311
|
}, {
|
@@ -8504,7 +8320,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8504
8320
|
licenseTerms = getLicenseTermByType(PIL_TYPE.COMMERCIAL_REMIX, {
|
8505
8321
|
defaultMintingFee: request.defaultMintingFee,
|
8506
8322
|
currency: request.currency,
|
8507
|
-
royaltyPolicyAddress:
|
8323
|
+
royaltyPolicyAddress: validateAddress(request.royaltyPolicyAddress || royaltyPolicyLapAddress[chain[this.chainId]]),
|
8508
8324
|
commercialRevShare: request.commercialRevShare
|
8509
8325
|
});
|
8510
8326
|
_context4.next = 4;
|
@@ -8574,13 +8390,6 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8574
8390
|
}()
|
8575
8391
|
/**
|
8576
8392
|
* Attaches license terms to an IP.
|
8577
|
-
* @param request - The request object that contains all data needed to attach license terms.
|
8578
|
-
* @param request.ipId The address of the IP to which the license terms are attached.
|
8579
|
-
* @param request.licenseTemplate The address of the license template, default value is Programmable IP License.
|
8580
|
-
* @param request.licenseTermsId The ID of the license terms.
|
8581
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
8582
|
-
* @returns A Promise that resolves to a transaction hash, and if encodedTxDataOnly is true, includes encoded transaction data, and if waitForTransaction is true, includes success.
|
8583
|
-
* If Ip have attached license terms, success will return false and txhash is empty.
|
8584
8393
|
*/
|
8585
8394
|
)
|
8586
8395
|
}, {
|
@@ -8595,7 +8404,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8595
8404
|
request.licenseTermsId = BigInt(request.licenseTermsId);
|
8596
8405
|
_context5.next = 4;
|
8597
8406
|
return this.ipAssetRegistryClient.isRegistered({
|
8598
|
-
id:
|
8407
|
+
id: validateAddress(request.ipId)
|
8599
8408
|
});
|
8600
8409
|
case 4:
|
8601
8410
|
isRegistered = _context5.sent;
|
@@ -8620,7 +8429,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8620
8429
|
_context5.next = 14;
|
8621
8430
|
return this.licenseRegistryReadOnlyClient.hasIpAttachedLicenseTerms({
|
8622
8431
|
ipId: request.ipId,
|
8623
|
-
licenseTemplate:
|
8432
|
+
licenseTemplate: validateAddress(request.licenseTemplate || this.licenseTemplateClient.address),
|
8624
8433
|
licenseTermsId: request.licenseTermsId
|
8625
8434
|
});
|
8626
8435
|
case 14:
|
@@ -8688,27 +8497,18 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8688
8497
|
}()
|
8689
8498
|
/**
|
8690
8499
|
* Mints license tokens for the license terms attached to an IP.
|
8691
|
-
* The license tokens are minted to the receiver.
|
8692
|
-
* The license terms must be attached to the IP before calling this function.
|
8693
|
-
* But it can mint license token of default license terms without attaching the default license terms,
|
8694
|
-
* since it is attached to all IPs by default.
|
8695
|
-
* IP owners can mint license tokens for their IPs for arbitrary license terms
|
8696
|
-
* without attaching the license terms to IP.
|
8697
8500
|
* It might require the caller pay the minting fee, depending on the license terms or configured by the iP owner.
|
8698
8501
|
* The minting fee is paid in the minting fee token specified in the license terms or configured by the IP owner.
|
8699
|
-
* IP owners can configure the minting fee of their IPs or
|
8700
|
-
*
|
8701
|
-
* @
|
8702
|
-
*
|
8703
|
-
*
|
8704
|
-
*
|
8705
|
-
*
|
8706
|
-
*
|
8707
|
-
*
|
8708
|
-
*
|
8709
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
8710
|
-
* @returns A Promise that resolves to a transaction hash, and if encodedTxDataOnly is true, includes encoded transaction data, and if waitForTransaction is true, includes license token IDs.
|
8711
|
-
* @emits LicenseTokensMinted (msg.sender, licensorIpId, licenseTemplate, licenseTermsId, amount, receiver, startLicenseTokenId);
|
8502
|
+
* IP owners can configure the minting fee of their IPs or configure the minting fee module to determine the minting fee.
|
8503
|
+
*
|
8504
|
+
* @remarks
|
8505
|
+
* Before minting license tokens, the license terms must be attached to the IP, with two exceptions:
|
8506
|
+
* 1. Default license terms can be minted without explicit attachment since they are automatically
|
8507
|
+
* attached to all IPs by default
|
8508
|
+
* 2. IP owners have special privileges and can mint license tokens for their own IPs using any
|
8509
|
+
* license terms, even if those terms are not explicitly attached
|
8510
|
+
*
|
8511
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicensingModule.sol#L34 | `LicenseTokensMinted`} event.
|
8712
8512
|
*/
|
8713
8513
|
)
|
8714
8514
|
}, {
|
@@ -8716,15 +8516,15 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8716
8516
|
value: (function () {
|
8717
8517
|
var _mintLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(request) {
|
8718
8518
|
var _this = this;
|
8719
|
-
var _request$txOptions11, receiver, req, isLicenseIpIdRegistered, isExisted, isAttachedLicenseTerms, encodedTxData, licenseMintingFee, wipSpenders, _yield$contractCallWi, txHash, receipt, targetLogs, startLicenseTokenId, licenseTokenIds, i;
|
8519
|
+
var _request$txOptions11, receiver, req, isLicenseIpIdRegistered, isExisted, ipAccount, ipOwner, isAttachedLicenseTerms, encodedTxData, licenseMintingFee, wipSpenders, _yield$contractCallWi, txHash, receipt, targetLogs, startLicenseTokenId, licenseTokenIds, i;
|
8720
8520
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
8721
8521
|
while (1) switch (_context6.prev = _context6.next) {
|
8722
8522
|
case 0:
|
8723
8523
|
_context6.prev = 0;
|
8724
|
-
receiver =
|
8524
|
+
receiver = validateAddress(request.receiver || this.walletAddress);
|
8725
8525
|
req = {
|
8726
|
-
licensorIpId:
|
8727
|
-
licenseTemplate:
|
8526
|
+
licensorIpId: validateAddress(request.licensorIpId),
|
8527
|
+
licenseTemplate: validateAddress(request.licenseTemplate || this.licenseTemplateClient.address),
|
8728
8528
|
licenseTermsId: BigInt(request.licenseTermsId),
|
8729
8529
|
amount: BigInt(request.amount || 1),
|
8730
8530
|
receiver: receiver,
|
@@ -8740,7 +8540,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8740
8540
|
case 5:
|
8741
8541
|
_context6.next = 7;
|
8742
8542
|
return this.ipAssetRegistryClient.isRegistered({
|
8743
|
-
id:
|
8543
|
+
id: validateAddress(request.licensorIpId)
|
8744
8544
|
});
|
8745
8545
|
case 7:
|
8746
8546
|
isLicenseIpIdRegistered = _context6.sent;
|
@@ -8762,40 +8562,46 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8762
8562
|
}
|
8763
8563
|
throw new Error("License terms id ".concat(request.licenseTermsId, " do not exist."));
|
8764
8564
|
case 15:
|
8765
|
-
|
8565
|
+
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, req.licensorIpId);
|
8566
|
+
_context6.next = 18;
|
8567
|
+
return ipAccount.owner();
|
8568
|
+
case 18:
|
8569
|
+
ipOwner = _context6.sent;
|
8570
|
+
if (!(ipOwner !== this.walletAddress)) {
|
8571
|
+
_context6.next = 25;
|
8572
|
+
break;
|
8573
|
+
}
|
8574
|
+
_context6.next = 22;
|
8766
8575
|
return this.licenseRegistryReadOnlyClient.hasIpAttachedLicenseTerms({
|
8767
|
-
ipId:
|
8768
|
-
licenseTemplate:
|
8576
|
+
ipId: req.licensorIpId,
|
8577
|
+
licenseTemplate: validateAddress(req.licenseTemplate || this.licenseTemplateClient.address),
|
8769
8578
|
licenseTermsId: req.licenseTermsId
|
8770
8579
|
});
|
8771
|
-
case
|
8580
|
+
case 22:
|
8772
8581
|
isAttachedLicenseTerms = _context6.sent;
|
8773
8582
|
if (isAttachedLicenseTerms) {
|
8774
|
-
_context6.next =
|
8583
|
+
_context6.next = 25;
|
8775
8584
|
break;
|
8776
8585
|
}
|
8777
|
-
throw new Error("License terms id ".concat(
|
8778
|
-
case
|
8586
|
+
throw new Error("License terms id ".concat(req.licenseTermsId, " is not attached to the IP with id ").concat(req.licensorIpId, "."));
|
8587
|
+
case 25:
|
8779
8588
|
encodedTxData = this.licensingModuleClient.mintLicenseTokensEncode(req);
|
8780
8589
|
if (!((_request$txOptions11 = request.txOptions) !== null && _request$txOptions11 !== void 0 && _request$txOptions11.encodedTxDataOnly)) {
|
8781
|
-
_context6.next =
|
8590
|
+
_context6.next = 28;
|
8782
8591
|
break;
|
8783
8592
|
}
|
8784
8593
|
return _context6.abrupt("return", {
|
8785
8594
|
encodedTxData: encodedTxData
|
8786
8595
|
});
|
8787
|
-
case
|
8788
|
-
_context6.next =
|
8596
|
+
case 28:
|
8597
|
+
_context6.next = 30;
|
8789
8598
|
return calculateLicenseWipMintFee({
|
8790
|
-
|
8791
|
-
|
8792
|
-
|
8793
|
-
|
8794
|
-
licenseTermsId: req.licenseTermsId,
|
8795
|
-
receiver: receiver,
|
8796
|
-
amount: req.amount
|
8599
|
+
predictMintingFeeRequest: req,
|
8600
|
+
rpcClient: this.rpcClient,
|
8601
|
+
chainId: this.chainId,
|
8602
|
+
walletAddress: this.walletAddress
|
8797
8603
|
});
|
8798
|
-
case
|
8604
|
+
case 30:
|
8799
8605
|
licenseMintingFee = _context6.sent;
|
8800
8606
|
wipSpenders = [];
|
8801
8607
|
if (licenseMintingFee > 0n) {
|
@@ -8804,7 +8610,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8804
8610
|
amount: licenseMintingFee
|
8805
8611
|
});
|
8806
8612
|
}
|
8807
|
-
_context6.next =
|
8613
|
+
_context6.next = 35;
|
8808
8614
|
return contractCallWithFees({
|
8809
8615
|
totalFees: licenseMintingFee,
|
8810
8616
|
options: {
|
@@ -8821,18 +8627,18 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8821
8627
|
txOptions: request.txOptions,
|
8822
8628
|
encodedTxs: [encodedTxData]
|
8823
8629
|
});
|
8824
|
-
case
|
8630
|
+
case 35:
|
8825
8631
|
_yield$contractCallWi = _context6.sent;
|
8826
8632
|
txHash = _yield$contractCallWi.txHash;
|
8827
8633
|
receipt = _yield$contractCallWi.receipt;
|
8828
8634
|
if (receipt) {
|
8829
|
-
_context6.next =
|
8635
|
+
_context6.next = 40;
|
8830
8636
|
break;
|
8831
8637
|
}
|
8832
8638
|
return _context6.abrupt("return", {
|
8833
8639
|
txHash: txHash
|
8834
8640
|
});
|
8835
|
-
case
|
8641
|
+
case 40:
|
8836
8642
|
targetLogs = this.licensingModuleClient.parseTxLicenseTokensMintedEvent(receipt);
|
8837
8643
|
startLicenseTokenId = targetLogs[0].startLicenseTokenId;
|
8838
8644
|
licenseTokenIds = [];
|
@@ -8844,15 +8650,15 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8844
8650
|
licenseTokenIds: licenseTokenIds,
|
8845
8651
|
receipt: receipt
|
8846
8652
|
});
|
8847
|
-
case
|
8848
|
-
_context6.prev =
|
8653
|
+
case 47:
|
8654
|
+
_context6.prev = 47;
|
8849
8655
|
_context6.t0 = _context6["catch"](0);
|
8850
8656
|
handleError(_context6.t0, "Failed to mint license tokens");
|
8851
|
-
case
|
8657
|
+
case 50:
|
8852
8658
|
case "end":
|
8853
8659
|
return _context6.stop();
|
8854
8660
|
}
|
8855
|
-
}, _callee6, this, [[0,
|
8661
|
+
}, _callee6, this, [[0, 47]]);
|
8856
8662
|
}));
|
8857
8663
|
function mintLicenseTokens(_x6) {
|
8858
8664
|
return _mintLicenseTokens.apply(this, arguments);
|
@@ -8861,8 +8667,6 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8861
8667
|
}()
|
8862
8668
|
/**
|
8863
8669
|
* Gets license terms of the given ID.
|
8864
|
-
* @param selectedLicenseTermsId The ID of the license terms.
|
8865
|
-
* @returns A Promise that resolves to an object containing the PILTerms associate with the given ID.
|
8866
8670
|
*/
|
8867
8671
|
)
|
8868
8672
|
}, {
|
@@ -8896,20 +8700,12 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8896
8700
|
}()
|
8897
8701
|
/**
|
8898
8702
|
* Pre-compute the minting license fee for the given IP and license terms. The function can be used to calculate the minting license fee before minting license tokens.
|
8899
|
-
* @param request - The request object that contains all data needed to predict minting licenses fee.
|
8900
|
-
* @param request.licensorIpId The IP ID of the licensor.
|
8901
|
-
* @param request.licenseTermsId The ID of the license terms.
|
8902
|
-
* @param request.amount The amount of license tokens to mint.
|
8903
|
-
* @param request.licenseTemplate [Optional] The address of the license template, default value is Programmable IP License.
|
8904
|
-
* @param request.receiver [Optional] The address of the receiver,default value is your wallet address.
|
8905
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
8906
|
-
* @returns A Promise that resolves to an object containing the currency token and token amount.
|
8907
8703
|
*/
|
8908
8704
|
)
|
8909
8705
|
}, {
|
8910
8706
|
key: "predictMintingLicenseFee",
|
8911
8707
|
value: (function () {
|
8912
|
-
var
|
8708
|
+
var _predictMintingLicenseFee2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(request) {
|
8913
8709
|
var isLicenseIpIdRegistered, licenseTermsId, isExisted, object;
|
8914
8710
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
8915
8711
|
while (1) switch (_context8.prev = _context8.next) {
|
@@ -8917,7 +8713,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8917
8713
|
_context8.prev = 0;
|
8918
8714
|
_context8.next = 3;
|
8919
8715
|
return this.ipAssetRegistryClient.isRegistered({
|
8920
|
-
id:
|
8716
|
+
id: validateAddress(request.licensorIpId)
|
8921
8717
|
});
|
8922
8718
|
case 3:
|
8923
8719
|
isLicenseIpIdRegistered = _context8.sent;
|
@@ -8941,14 +8737,19 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8941
8737
|
throw new Error("License terms id ".concat(request.licenseTermsId, " do not exist."));
|
8942
8738
|
case 12:
|
8943
8739
|
object = _objectSpread2(_objectSpread2({}, request), {}, {
|
8944
|
-
receiver:
|
8740
|
+
receiver: validateAddress(request.receiver || this.walletAddress),
|
8945
8741
|
amount: BigInt(request.amount),
|
8946
8742
|
royaltyContext: viem.zeroAddress,
|
8947
|
-
licenseTemplate:
|
8743
|
+
licenseTemplate: validateAddress(request.licenseTemplate || this.licenseTemplateClient.address),
|
8948
8744
|
licenseTermsId: licenseTermsId
|
8949
8745
|
});
|
8950
8746
|
_context8.next = 15;
|
8951
|
-
return
|
8747
|
+
return predictMintingLicenseFee({
|
8748
|
+
predictMintingFeeRequest: object,
|
8749
|
+
rpcClient: this.rpcClient,
|
8750
|
+
chainId: this.chainId,
|
8751
|
+
walletAddress: this.walletAddress
|
8752
|
+
});
|
8952
8753
|
case 15:
|
8953
8754
|
return _context8.abrupt("return", _context8.sent);
|
8954
8755
|
case 18:
|
@@ -8961,10 +8762,10 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8961
8762
|
}
|
8962
8763
|
}, _callee8, this, [[0, 18]]);
|
8963
8764
|
}));
|
8964
|
-
function predictMintingLicenseFee(_x8) {
|
8965
|
-
return
|
8765
|
+
function predictMintingLicenseFee$1(_x8) {
|
8766
|
+
return _predictMintingLicenseFee2.apply(this, arguments);
|
8966
8767
|
}
|
8967
|
-
return predictMintingLicenseFee;
|
8768
|
+
return predictMintingLicenseFee$1;
|
8968
8769
|
}()
|
8969
8770
|
/**
|
8970
8771
|
* Sets the licensing configuration for a specific license terms of an IP. If both licenseTemplate and licenseTermsId are not specified then the licensing config apply to all licenses of given IP.
|
@@ -9178,6 +8979,10 @@ var convertHashIPFStoCID = function convertHashIPFStoCID(hash) {
|
|
9178
8979
|
}
|
9179
8980
|
};
|
9180
8981
|
|
8982
|
+
/**
|
8983
|
+
* The ABI for the OptimisticOracleV3 contract. Contract address may be changed.
|
8984
|
+
* @see https://aeneid.storyscan.io/address/0xABac6a158431edED06EE6cba37eDE8779F599eE4?tab=contract_abi
|
8985
|
+
*/
|
9181
8986
|
var ASSERTION_ABI = [{
|
9182
8987
|
inputs: [{
|
9183
8988
|
internalType: "bytes32",
|
@@ -9272,6 +9077,20 @@ var ASSERTION_ABI = [{
|
|
9272
9077
|
outputs: [],
|
9273
9078
|
stateMutability: "nonpayable",
|
9274
9079
|
type: "function"
|
9080
|
+
}, {
|
9081
|
+
inputs: [{
|
9082
|
+
internalType: "address",
|
9083
|
+
name: "currency",
|
9084
|
+
type: "address"
|
9085
|
+
}],
|
9086
|
+
name: "getMinimumBond",
|
9087
|
+
outputs: [{
|
9088
|
+
internalType: "uint256",
|
9089
|
+
name: "",
|
9090
|
+
type: "uint256"
|
9091
|
+
}],
|
9092
|
+
stateMutability: "view",
|
9093
|
+
type: "function"
|
9275
9094
|
}];
|
9276
9095
|
|
9277
9096
|
var getOov3Contract = /*#__PURE__*/function () {
|
@@ -9324,6 +9143,35 @@ var getAssertionDetails = /*#__PURE__*/function () {
|
|
9324
9143
|
return _ref2.apply(this, arguments);
|
9325
9144
|
};
|
9326
9145
|
}();
|
9146
|
+
var getMinimumBond = /*#__PURE__*/function () {
|
9147
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(rpcClient, arbitrationPolicyUmaClient, currency) {
|
9148
|
+
var oov3Contract;
|
9149
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
9150
|
+
while (1) switch (_context3.prev = _context3.next) {
|
9151
|
+
case 0:
|
9152
|
+
_context3.next = 2;
|
9153
|
+
return getOov3Contract(arbitrationPolicyUmaClient);
|
9154
|
+
case 2:
|
9155
|
+
oov3Contract = _context3.sent;
|
9156
|
+
_context3.next = 5;
|
9157
|
+
return rpcClient.readContract({
|
9158
|
+
address: oov3Contract,
|
9159
|
+
abi: ASSERTION_ABI,
|
9160
|
+
functionName: "getMinimumBond",
|
9161
|
+
args: [currency]
|
9162
|
+
});
|
9163
|
+
case 5:
|
9164
|
+
return _context3.abrupt("return", _context3.sent);
|
9165
|
+
case 6:
|
9166
|
+
case "end":
|
9167
|
+
return _context3.stop();
|
9168
|
+
}
|
9169
|
+
}, _callee3);
|
9170
|
+
}));
|
9171
|
+
return function getMinimumBond(_x5, _x6, _x7) {
|
9172
|
+
return _ref3.apply(this, arguments);
|
9173
|
+
};
|
9174
|
+
}();
|
9327
9175
|
|
9328
9176
|
var DisputeClient = /*#__PURE__*/function () {
|
9329
9177
|
function DisputeClient(rpcClient, wallet, chainId) {
|
@@ -9340,53 +9188,51 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9340
9188
|
/**
|
9341
9189
|
* Raises a dispute on a given ipId.
|
9342
9190
|
*
|
9343
|
-
*
|
9344
|
-
* @see {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/dispute/IDisputeModule.sol#L64 | IDisputeModule.sol}
|
9345
|
-
* for a list of on-chain events emitted when a dispute is raised.
|
9346
|
-
*
|
9347
|
-
* @remarks `WipOptions.useMulticallWhenPossible` is disabled for this function due to disputeInitiator issue. It will be executed sequentially with several transactions.
|
9191
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/dispute/IDisputeModule.sol#L64 | `DisputeRaised`} event.
|
9348
9192
|
*/
|
9349
9193
|
return _createClass(DisputeClient, [{
|
9350
9194
|
key: "raiseDispute",
|
9351
9195
|
value: (function () {
|
9352
9196
|
var _raiseDispute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
9353
9197
|
var _this = this;
|
9354
|
-
var _request$txOptions, liveness,
|
9198
|
+
var _request$txOptions, liveness, _yield$Promise$all, _yield$Promise$all2, minLiveness, maxLiveness, _yield$Promise$all3, _yield$Promise$all4, minimumBond, maximumBond, bonds, tag, data, _yield$this$disputeMo, isWhiteList, req, encodedTxData, contractCall, _yield$contractCallWi, txHash, receipt, targetLogs;
|
9355
9199
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
9356
9200
|
while (1) switch (_context.prev = _context.next) {
|
9357
9201
|
case 0:
|
9358
9202
|
_context.prev = 0;
|
9359
9203
|
liveness = BigInt(request.liveness);
|
9360
|
-
|
9361
|
-
tokenAddress = wrappedIpAddress[chain[this.chainId]];
|
9362
|
-
_context.next = 6;
|
9204
|
+
_context.next = 4;
|
9363
9205
|
return Promise.all([this.arbitrationPolicyUmaClient.minLiveness(), this.arbitrationPolicyUmaClient.maxLiveness()]);
|
9364
|
-
case
|
9206
|
+
case 4:
|
9365
9207
|
_yield$Promise$all = _context.sent;
|
9366
9208
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
9367
9209
|
minLiveness = _yield$Promise$all2[0];
|
9368
9210
|
maxLiveness = _yield$Promise$all2[1];
|
9369
|
-
tag = viem.stringToHex(request.targetTag, {
|
9370
|
-
size: 32
|
9371
|
-
});
|
9372
9211
|
if (!(liveness < minLiveness || liveness > maxLiveness)) {
|
9373
|
-
_context.next =
|
9212
|
+
_context.next = 10;
|
9374
9213
|
break;
|
9375
9214
|
}
|
9376
9215
|
throw new Error("Liveness must be between ".concat(minLiveness, " and ").concat(maxLiveness, "."));
|
9377
|
-
case
|
9378
|
-
_context.next =
|
9379
|
-
return this.arbitrationPolicyUmaClient.maxBonds({
|
9380
|
-
token:
|
9381
|
-
});
|
9382
|
-
case
|
9383
|
-
|
9384
|
-
|
9385
|
-
|
9216
|
+
case 10:
|
9217
|
+
_context.next = 12;
|
9218
|
+
return Promise.all([getMinimumBond(this.rpcClient, this.arbitrationPolicyUmaClient, WIP_TOKEN_ADDRESS), this.arbitrationPolicyUmaClient.maxBonds({
|
9219
|
+
token: WIP_TOKEN_ADDRESS
|
9220
|
+
})]);
|
9221
|
+
case 12:
|
9222
|
+
_yield$Promise$all3 = _context.sent;
|
9223
|
+
_yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 2);
|
9224
|
+
minimumBond = _yield$Promise$all4[0];
|
9225
|
+
maximumBond = _yield$Promise$all4[1];
|
9226
|
+
bonds = BigInt(request.bond || minimumBond);
|
9227
|
+
if (!(bonds > maximumBond || bonds < minimumBond)) {
|
9228
|
+
_context.next = 19;
|
9386
9229
|
break;
|
9387
9230
|
}
|
9388
|
-
throw new Error("Bonds must be
|
9389
|
-
case
|
9231
|
+
throw new Error("Bonds must be between ".concat(minimumBond, " and ").concat(maximumBond, "."));
|
9232
|
+
case 19:
|
9233
|
+
tag = viem.stringToHex(request.targetTag, {
|
9234
|
+
size: 32
|
9235
|
+
});
|
9390
9236
|
data = viem.encodeAbiParameters([{
|
9391
9237
|
name: "",
|
9392
9238
|
type: "uint64"
|
@@ -9396,20 +9242,20 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9396
9242
|
}, {
|
9397
9243
|
name: "",
|
9398
9244
|
type: "uint256"
|
9399
|
-
}], [liveness,
|
9400
|
-
_context.next =
|
9245
|
+
}], [liveness, WIP_TOKEN_ADDRESS, bonds]);
|
9246
|
+
_context.next = 23;
|
9401
9247
|
return this.disputeModuleClient.isWhitelistedDisputeTag({
|
9402
9248
|
tag: tag
|
9403
9249
|
});
|
9404
|
-
case
|
9250
|
+
case 23:
|
9405
9251
|
_yield$this$disputeMo = _context.sent;
|
9406
9252
|
isWhiteList = _yield$this$disputeMo.allowed;
|
9407
9253
|
if (isWhiteList) {
|
9408
|
-
_context.next =
|
9254
|
+
_context.next = 27;
|
9409
9255
|
break;
|
9410
9256
|
}
|
9411
9257
|
throw new Error("The target tag ".concat(request.targetTag, " is not whitelisted."));
|
9412
|
-
case
|
9258
|
+
case 27:
|
9413
9259
|
req = {
|
9414
9260
|
targetIpId: validateAddress(request.targetIpId),
|
9415
9261
|
targetTag: tag,
|
@@ -9418,17 +9264,17 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9418
9264
|
};
|
9419
9265
|
encodedTxData = this.disputeModuleClient.raiseDisputeEncode(req);
|
9420
9266
|
if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.encodedTxDataOnly)) {
|
9421
|
-
_context.next =
|
9267
|
+
_context.next = 33;
|
9422
9268
|
break;
|
9423
9269
|
}
|
9424
9270
|
return _context.abrupt("return", {
|
9425
9271
|
encodedTxData: encodedTxData
|
9426
9272
|
});
|
9427
|
-
case
|
9273
|
+
case 33:
|
9428
9274
|
contractCall = function contractCall() {
|
9429
9275
|
return _this.disputeModuleClient.raiseDispute(req);
|
9430
9276
|
};
|
9431
|
-
_context.next =
|
9277
|
+
_context.next = 36;
|
9432
9278
|
return contractCallWithFees({
|
9433
9279
|
totalFees: bonds,
|
9434
9280
|
options: {
|
@@ -9449,35 +9295,35 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9449
9295
|
txOptions: request.txOptions,
|
9450
9296
|
sender: this.wallet.account.address
|
9451
9297
|
});
|
9452
|
-
case
|
9298
|
+
case 36:
|
9453
9299
|
_yield$contractCallWi = _context.sent;
|
9454
9300
|
txHash = _yield$contractCallWi.txHash;
|
9455
9301
|
receipt = _yield$contractCallWi.receipt;
|
9456
9302
|
if (receipt) {
|
9457
|
-
_context.next =
|
9303
|
+
_context.next = 41;
|
9458
9304
|
break;
|
9459
9305
|
}
|
9460
9306
|
return _context.abrupt("return", {
|
9461
9307
|
txHash: txHash
|
9462
9308
|
});
|
9463
|
-
case
|
9309
|
+
case 41:
|
9464
9310
|
targetLogs = this.disputeModuleClient.parseTxDisputeRaisedEvent(receipt);
|
9465
9311
|
return _context.abrupt("return", {
|
9466
9312
|
txHash: txHash,
|
9467
9313
|
disputeId: targetLogs[0].disputeId
|
9468
9314
|
});
|
9469
|
-
case 41:
|
9470
|
-
_context.next = 46;
|
9471
|
-
break;
|
9472
9315
|
case 43:
|
9473
|
-
_context.
|
9316
|
+
_context.next = 48;
|
9317
|
+
break;
|
9318
|
+
case 45:
|
9319
|
+
_context.prev = 45;
|
9474
9320
|
_context.t0 = _context["catch"](0);
|
9475
9321
|
handleError(_context.t0, "Failed to raise dispute");
|
9476
|
-
case
|
9322
|
+
case 48:
|
9477
9323
|
case "end":
|
9478
9324
|
return _context.stop();
|
9479
9325
|
}
|
9480
|
-
}, _callee, this, [[0,
|
9326
|
+
}, _callee, this, [[0, 45]]);
|
9481
9327
|
}));
|
9482
9328
|
function raiseDispute(_x) {
|
9483
9329
|
return _raiseDispute.apply(this, arguments);
|
@@ -9486,16 +9332,8 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9486
9332
|
}()
|
9487
9333
|
/**
|
9488
9334
|
* Cancels an ongoing dispute
|
9489
|
-
*
|
9490
|
-
*
|
9491
|
-
* @param request.data [Optional] additional data used in the cancellation process.
|
9492
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
9493
|
-
* @returns A Promise that resolves to a CancelDisputeResponse containing the transaction hash.
|
9494
|
-
* @throws NotInDisputeState, if the currentTag of the Dispute is not being disputed
|
9495
|
-
* @throws NotDisputeInitiator, if the transaction executor is not the one that initiated the dispute
|
9496
|
-
* @throws error if the Dispute's ArbitrationPolicy contract is not valid
|
9497
|
-
* @calls cancelDispute(uint256 _disputeId, bytes calldata _data) external nonReentrant {
|
9498
|
-
* @emits DisputeCancelled (_disputeId, _data);
|
9335
|
+
*
|
9336
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/dispute/IDisputeModule.sol#L84 | `DisputeCancelled`} event.
|
9499
9337
|
*/
|
9500
9338
|
)
|
9501
9339
|
}, {
|
@@ -9554,29 +9392,23 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9554
9392
|
return cancelDispute;
|
9555
9393
|
}()
|
9556
9394
|
/**
|
9557
|
-
* Resolves a dispute after it has been judged
|
9558
|
-
*
|
9559
|
-
*
|
9560
|
-
* @param request.data The data to resolve the dispute.
|
9561
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
9562
|
-
* @returns A Promise that resolves to a ResolveDisputeResponse.
|
9563
|
-
* @throws NotAbleToResolve, if currentTag is still in dispute (i.e still needs a judgement to be set)
|
9564
|
-
* @throws NotDisputeInitiator, if the transaction executor is not the one that initiated the dispute
|
9565
|
-
* @emits DisputeResolved (_disputeId)
|
9395
|
+
* Resolves a dispute after it has been judged.
|
9396
|
+
*
|
9397
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/dispute/IDisputeModule.sol#L104 | `DisputeResolved`} event.
|
9566
9398
|
*/
|
9567
9399
|
)
|
9568
9400
|
}, {
|
9569
9401
|
key: "resolveDispute",
|
9570
9402
|
value: (function () {
|
9571
9403
|
var _resolveDispute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(request) {
|
9572
|
-
var _request$txOptions4, _req2, _request$txOptions5, txHash;
|
9404
|
+
var _request$data, _request$txOptions4, _req2, _request$txOptions5, txHash;
|
9573
9405
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
9574
9406
|
while (1) switch (_context3.prev = _context3.next) {
|
9575
9407
|
case 0:
|
9576
9408
|
_context3.prev = 0;
|
9577
9409
|
_req2 = {
|
9578
9410
|
disputeId: BigInt(request.disputeId),
|
9579
|
-
data: request.data
|
9411
|
+
data: (_request$data = request.data) !== null && _request$data !== void 0 ? _request$data : "0x"
|
9580
9412
|
};
|
9581
9413
|
if (!((_request$txOptions4 = request.txOptions) !== null && _request$txOptions4 !== void 0 && _request$txOptions4.encodedTxDataOnly)) {
|
9582
9414
|
_context3.next = 6;
|
@@ -9624,8 +9456,7 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9624
9456
|
* Tags a derivative if a parent has been tagged with an infringement tag
|
9625
9457
|
* or a group ip if a group member has been tagged with an infringement tag.
|
9626
9458
|
*
|
9627
|
-
*
|
9628
|
-
* for a list of on-chain events emitted when a derivative is tagged on an infringement.
|
9459
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/dispute/IDisputeModule.sol#L93 | `IpTaggedOnRelatedIpInfringement`} event.
|
9629
9460
|
*/
|
9630
9461
|
)
|
9631
9462
|
}, {
|
@@ -9633,7 +9464,7 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9633
9464
|
value: (function () {
|
9634
9465
|
var _tagIfRelatedIpInfringed = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(request) {
|
9635
9466
|
var _this2 = this;
|
9636
|
-
var _request$options, objects, txHashes, calls, txHash;
|
9467
|
+
var _request$options, objects, txHashes, calls, txHash, _iterator, _step, object, _txHash;
|
9637
9468
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
9638
9469
|
while (1) switch (_context4.prev = _context4.next) {
|
9639
9470
|
case 0:
|
@@ -9663,17 +9494,39 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9663
9494
|
case 7:
|
9664
9495
|
txHash = _context4.sent;
|
9665
9496
|
txHashes.push(txHash);
|
9666
|
-
_context4.next =
|
9497
|
+
_context4.next = 30;
|
9667
9498
|
break;
|
9668
9499
|
case 11:
|
9669
|
-
|
9670
|
-
|
9671
|
-
|
9672
|
-
}));
|
9673
|
-
case 13:
|
9674
|
-
txHashes = _context4.sent;
|
9500
|
+
_iterator = _createForOfIteratorHelper(objects);
|
9501
|
+
_context4.prev = 12;
|
9502
|
+
_iterator.s();
|
9675
9503
|
case 14:
|
9676
|
-
|
9504
|
+
if ((_step = _iterator.n()).done) {
|
9505
|
+
_context4.next = 22;
|
9506
|
+
break;
|
9507
|
+
}
|
9508
|
+
object = _step.value;
|
9509
|
+
_context4.next = 18;
|
9510
|
+
return this.disputeModuleClient.tagIfRelatedIpInfringed(object);
|
9511
|
+
case 18:
|
9512
|
+
_txHash = _context4.sent;
|
9513
|
+
txHashes.push(_txHash);
|
9514
|
+
case 20:
|
9515
|
+
_context4.next = 14;
|
9516
|
+
break;
|
9517
|
+
case 22:
|
9518
|
+
_context4.next = 27;
|
9519
|
+
break;
|
9520
|
+
case 24:
|
9521
|
+
_context4.prev = 24;
|
9522
|
+
_context4.t0 = _context4["catch"](12);
|
9523
|
+
_iterator.e(_context4.t0);
|
9524
|
+
case 27:
|
9525
|
+
_context4.prev = 27;
|
9526
|
+
_iterator.f();
|
9527
|
+
return _context4.finish(27);
|
9528
|
+
case 30:
|
9529
|
+
_context4.next = 32;
|
9677
9530
|
return Promise.all(txHashes.map(function (txHash) {
|
9678
9531
|
return handleTxOptions({
|
9679
9532
|
txHash: txHash,
|
@@ -9681,17 +9534,17 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9681
9534
|
rpcClient: _this2.rpcClient
|
9682
9535
|
});
|
9683
9536
|
}));
|
9684
|
-
case
|
9537
|
+
case 32:
|
9685
9538
|
return _context4.abrupt("return", _context4.sent);
|
9686
|
-
case
|
9687
|
-
_context4.prev =
|
9688
|
-
_context4.
|
9689
|
-
handleError(_context4.
|
9690
|
-
case
|
9539
|
+
case 35:
|
9540
|
+
_context4.prev = 35;
|
9541
|
+
_context4.t1 = _context4["catch"](0);
|
9542
|
+
handleError(_context4.t1, "Failed to tag related ip infringed");
|
9543
|
+
case 38:
|
9691
9544
|
case "end":
|
9692
9545
|
return _context4.stop();
|
9693
9546
|
}
|
9694
|
-
}, _callee4, this, [[0,
|
9547
|
+
}, _callee4, this, [[0, 35], [12, 24, 27, 30]]);
|
9695
9548
|
}));
|
9696
9549
|
function tagIfRelatedIpInfringed(_x4) {
|
9697
9550
|
return _tagIfRelatedIpInfringed.apply(this, arguments);
|
@@ -9700,10 +9553,13 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9700
9553
|
}()
|
9701
9554
|
/**
|
9702
9555
|
* Counters a dispute that was raised by another party on an IP using counter evidence.
|
9556
|
+
* The counter evidence (e.g., documents, images) should be uploaded to IPFS,
|
9557
|
+
* and its corresponding CID is converted to a hash for the request.
|
9703
9558
|
*
|
9704
|
-
*
|
9705
|
-
*
|
9706
|
-
*
|
9559
|
+
* @remarks
|
9560
|
+
* The liveness period is split in two parts:
|
9561
|
+
* - the first part of the liveness period in which only the IP's owner can be called the method.
|
9562
|
+
* - a second part in which any address can be called the method.
|
9707
9563
|
*
|
9708
9564
|
* If you only have a `disputeId`, call {@link disputeIdToAssertionId} to get the `assertionId` needed here.
|
9709
9565
|
*/
|
@@ -9713,7 +9569,7 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9713
9569
|
value: (function () {
|
9714
9570
|
var _disputeAssertion = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(request) {
|
9715
9571
|
var _this3 = this;
|
9716
|
-
var ipAccount, bond, counterEvidenceHash, encodedData, _yield$this$wrappedIp, allowance,
|
9572
|
+
var ipAccount, bond, counterEvidenceHash, encodedData, _yield$this$wrappedIp, allowance, _txHash2, contractCall, _yield$contractCallWi2, txHash, receipt;
|
9717
9573
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
9718
9574
|
while (1) switch (_context5.prev = _context5.next) {
|
9719
9575
|
case 0:
|
@@ -9746,10 +9602,10 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9746
9602
|
amount: viem.maxUint256
|
9747
9603
|
});
|
9748
9604
|
case 14:
|
9749
|
-
|
9605
|
+
_txHash2 = _context5.sent;
|
9750
9606
|
_context5.next = 17;
|
9751
9607
|
return this.rpcClient.waitForTransactionReceipt({
|
9752
|
-
hash:
|
9608
|
+
hash: _txHash2
|
9753
9609
|
});
|
9754
9610
|
case 17:
|
9755
9611
|
contractCall = function contractCall() {
|
@@ -9875,15 +9731,8 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
9875
9731
|
this.erc20Client = new Erc20Client(rpcClient, wallet);
|
9876
9732
|
}
|
9877
9733
|
|
9878
|
-
/**
|
9879
|
-
*
|
9880
|
-
* @param request.ipId The Ip Id to get ip account.
|
9881
|
-
* @param request.to The recipient of the transaction.
|
9882
|
-
* @param request.value The amount of Ether to send.
|
9883
|
-
* @param request.accountAddress The ipId to send.
|
9884
|
-
* @param request.data The data to send along with the transaction.
|
9885
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
9886
|
-
* @returns Tx hash for the transaction.
|
9734
|
+
/**
|
9735
|
+
* Executes a transaction from the IP Account.
|
9887
9736
|
*/
|
9888
9737
|
return _createClass(IPAccountClient, [{
|
9889
9738
|
key: "execute",
|
@@ -9894,7 +9743,7 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
9894
9743
|
while (1) switch (_context.prev = _context.next) {
|
9895
9744
|
case 0:
|
9896
9745
|
_context.prev = 0;
|
9897
|
-
ipAccountClient = new IpAccountImplClient(this.rpcClient, this.wallet,
|
9746
|
+
ipAccountClient = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(request.ipId));
|
9898
9747
|
req = {
|
9899
9748
|
to: request.to,
|
9900
9749
|
value: BigInt(0),
|
@@ -9946,17 +9795,8 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
9946
9795
|
}
|
9947
9796
|
return execute;
|
9948
9797
|
}()
|
9949
|
-
/**
|
9950
|
-
*
|
9951
|
-
* @param request.ipId The Ip Id to get ip account.
|
9952
|
-
* @param request.to The recipient of the transaction.
|
9953
|
-
* @param request.data The data to send along with the transaction.
|
9954
|
-
* @param request.signer The signer of the transaction.
|
9955
|
-
* @param request.deadline The deadline of the transaction signature.
|
9956
|
-
* @param request.signature The signature of the transaction, EIP-712 encoded.
|
9957
|
-
* @param request.value [Optional] The amount of Ether to send.
|
9958
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
9959
|
-
* @returns Tx hash for the transaction.
|
9798
|
+
/**
|
9799
|
+
* Executes a transaction from the IP Account with a signature.
|
9960
9800
|
*/
|
9961
9801
|
)
|
9962
9802
|
}, {
|
@@ -9968,12 +9808,12 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
9968
9808
|
while (1) switch (_context2.prev = _context2.next) {
|
9969
9809
|
case 0:
|
9970
9810
|
_context2.prev = 0;
|
9971
|
-
ipAccountClient = new IpAccountImplClient(this.rpcClient, this.wallet,
|
9811
|
+
ipAccountClient = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(request.ipId));
|
9972
9812
|
req = {
|
9973
|
-
to:
|
9813
|
+
to: validateAddress(request.to),
|
9974
9814
|
value: BigInt(request.value || 0),
|
9975
9815
|
data: request.data,
|
9976
|
-
signer:
|
9816
|
+
signer: validateAddress(request.signer),
|
9977
9817
|
deadline: BigInt(request.deadline),
|
9978
9818
|
signature: request.signature
|
9979
9819
|
};
|
@@ -10019,9 +9859,8 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
10019
9859
|
}
|
10020
9860
|
return executeWithSig;
|
10021
9861
|
}()
|
10022
|
-
/**
|
10023
|
-
*
|
10024
|
-
* @returns A Promise that resolves to the IP Account's nonce.
|
9862
|
+
/**
|
9863
|
+
* Returns the IPAccount's internal nonce for transaction ordering.
|
10025
9864
|
*/
|
10026
9865
|
)
|
10027
9866
|
}, {
|
@@ -10033,7 +9872,7 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
10033
9872
|
while (1) switch (_context3.prev = _context3.next) {
|
10034
9873
|
case 0:
|
10035
9874
|
_context3.prev = 0;
|
10036
|
-
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet,
|
9875
|
+
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(ipId));
|
10037
9876
|
_context3.next = 4;
|
10038
9877
|
return ipAccount.state();
|
10039
9878
|
case 4:
|
@@ -10057,7 +9896,6 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
10057
9896
|
}()
|
10058
9897
|
/**
|
10059
9898
|
* Returns the identifier of the non-fungible token which owns the account
|
10060
|
-
* @returns A Promise that resolves to an object containing the chain ID, token contract address, and token ID.
|
10061
9899
|
*/
|
10062
9900
|
)
|
10063
9901
|
}, {
|
@@ -10069,7 +9907,7 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
10069
9907
|
while (1) switch (_context4.prev = _context4.next) {
|
10070
9908
|
case 0:
|
10071
9909
|
_context4.prev = 0;
|
10072
|
-
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet,
|
9910
|
+
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(ipId));
|
10073
9911
|
_context4.next = 4;
|
10074
9912
|
return ipAccount.token();
|
10075
9913
|
case 4:
|
@@ -10214,6 +10052,8 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
10214
10052
|
}]);
|
10215
10053
|
}();
|
10216
10054
|
|
10055
|
+
/** The amount of revenue token claimable. */
|
10056
|
+
|
10217
10057
|
/**
|
10218
10058
|
* Native royalty policy created by the Story team
|
10219
10059
|
*/
|
@@ -10254,9 +10094,14 @@ var RoyaltyClient = /*#__PURE__*/function () {
|
|
10254
10094
|
this.walletAddress = wallet.account.address;
|
10255
10095
|
}
|
10256
10096
|
/**
|
10257
|
-
* Claims all revenue from the child IPs of an ancestor IP, then transfer
|
10097
|
+
* Claims all revenue from the child IPs of an ancestor IP, then transfer
|
10258
10098
|
* all claimed tokens to the wallet if the wallet owns the IP or is the claimer.
|
10259
10099
|
* If claimed token is WIP, it will also be converted back to IP.
|
10100
|
+
*
|
10101
|
+
* @remarks
|
10102
|
+
* Even if there are no child IPs, you must still populate {@link ClaimAllRevenueRequest.currencyTokens} with
|
10103
|
+
* the token addresses you wish to claim. This is required for the claim operation to know which
|
10104
|
+
* token balances to process.
|
10260
10105
|
*/
|
10261
10106
|
return _createClass(RoyaltyClient, [{
|
10262
10107
|
key: "claimAllRevenue",
|
@@ -10361,6 +10206,11 @@ var RoyaltyClient = /*#__PURE__*/function () {
|
|
10361
10206
|
* if multicall is disabled, it will call @link{claimAllRevenue} for each ancestor IP.
|
10362
10207
|
* Then transfer all claimed tokens to the wallet if the wallet owns the IP or is the claimer.
|
10363
10208
|
* If claimed token is WIP, it will also be converted back to IP.
|
10209
|
+
*
|
10210
|
+
* @remarks
|
10211
|
+
* Even if there are no child IPs, you must still populate `currencyTokens` in each ancestor IP
|
10212
|
+
* with the token addresses you wish to claim. This is required for the claim operation to know which
|
10213
|
+
* token balances to process.
|
10364
10214
|
*/
|
10365
10215
|
)
|
10366
10216
|
}, {
|
@@ -10693,11 +10543,7 @@ var RoyaltyClient = /*#__PURE__*/function () {
|
|
10693
10543
|
}()
|
10694
10544
|
/**
|
10695
10545
|
* Get total amount of revenue token claimable by a royalty token holder.
|
10696
|
-
*
|
10697
|
-
* @param request.royaltyVaultIpId The id of the royalty vault.
|
10698
|
-
* @param request.claimer The address of the royalty token holder
|
10699
|
-
* @param request.token The revenue token to claim.
|
10700
|
-
* @returns A Promise that contains the amount of revenue token claimable
|
10546
|
+
* Returns the amount of revenue token claimable by the claimer.
|
10701
10547
|
*/
|
10702
10548
|
)
|
10703
10549
|
}, {
|
@@ -10710,14 +10556,14 @@ var RoyaltyClient = /*#__PURE__*/function () {
|
|
10710
10556
|
case 0:
|
10711
10557
|
_context5.prev = 0;
|
10712
10558
|
_context5.next = 3;
|
10713
|
-
return this.getRoyaltyVaultAddress(
|
10559
|
+
return this.getRoyaltyVaultAddress(validateAddress(request.royaltyVaultIpId));
|
10714
10560
|
case 3:
|
10715
10561
|
proxyAddress = _context5.sent;
|
10716
10562
|
ipRoyaltyVault = new IpRoyaltyVaultImplReadOnlyClient(this.rpcClient, proxyAddress);
|
10717
10563
|
_context5.next = 7;
|
10718
10564
|
return ipRoyaltyVault.claimableRevenue({
|
10719
|
-
claimer:
|
10720
|
-
token:
|
10565
|
+
claimer: validateAddress(request.claimer),
|
10566
|
+
token: validateAddress(request.token)
|
10721
10567
|
});
|
10722
10568
|
case 7:
|
10723
10569
|
return _context5.abrupt("return", _context5.sent);
|
@@ -10738,8 +10584,6 @@ var RoyaltyClient = /*#__PURE__*/function () {
|
|
10738
10584
|
}()
|
10739
10585
|
/**
|
10740
10586
|
* Get the royalty vault proxy address of given royaltyVaultIpId.
|
10741
|
-
* @param royaltyVaultIpId the id of the royalty vault.
|
10742
|
-
* @returns A Promise that resolves to an object containing the royalty vault address.
|
10743
10587
|
*/
|
10744
10588
|
)
|
10745
10589
|
}, {
|
@@ -10752,7 +10596,7 @@ var RoyaltyClient = /*#__PURE__*/function () {
|
|
10752
10596
|
case 0:
|
10753
10597
|
_context6.next = 2;
|
10754
10598
|
return this.ipAssetRegistryClient.isRegistered({
|
10755
|
-
id:
|
10599
|
+
id: validateAddress(royaltyVaultIpId)
|
10756
10600
|
});
|
10757
10601
|
case 2:
|
10758
10602
|
isRoyaltyVaultIpIdRegistered = _context6.sent;
|
@@ -10987,21 +10831,9 @@ var NftClient = /*#__PURE__*/function () {
|
|
10987
10831
|
|
10988
10832
|
/**
|
10989
10833
|
* Creates a new SPG NFT Collection.
|
10990
|
-
*
|
10991
|
-
*
|
10992
|
-
*
|
10993
|
-
* @param request.isPublicMinting - If true, anyone can mint from the collection. If false, only the addresses with the minter role can mint.
|
10994
|
-
* @param request.mintOpen Whether the collection is open for minting on creation.
|
10995
|
-
* @param request.mintFeeRecipient - The address to receive mint fees.
|
10996
|
-
* @param request.contractURI - The contract URI for the collection. Follows ERC-7572 standard. See https://eips.ethereum.org/EIPS/eip-7572
|
10997
|
-
* @param request.baseURI - [Optional] The base URI for the collection. If baseURI is not empty, tokenURI will be either baseURI + token ID (if nftMetadataURI is empty) or baseURI + nftMetadataURI.
|
10998
|
-
* @param request.maxSupply - [Optional] The maximum supply of the collection.
|
10999
|
-
* @param request.mintFee - [Optional] The cost to mint a token.
|
11000
|
-
* @param request.mintFeeToken - [Optional] The token to mint.
|
11001
|
-
* @param request.owner - [Optional] The owner of the collection.
|
11002
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
11003
|
-
* @returns A Promise that resolves to a transaction hash, and if encodedTxDataOnly is true, includes encoded transaction data, and if waitForTransaction is true, includes spg nft contract address.
|
11004
|
-
* @emits CollectionCreated (spgNftContract);
|
10834
|
+
*
|
10835
|
+
* Emits an on-chain `CollectionCreated` event.
|
10836
|
+
* @see {@link https://github.com/storyprotocol/protocol-periphery-v1/blob/v1.3.1/contracts/interfaces/workflows/IRegistrationWorkflows.sol#L12 | IRegistrationWorkflows}
|
11005
10837
|
*/
|
11006
10838
|
return _createClass(NftClient, [{
|
11007
10839
|
key: "createNFTCollection",
|
@@ -11026,8 +10858,8 @@ var NftClient = /*#__PURE__*/function () {
|
|
11026
10858
|
maxSupply: (_request$maxSupply = request.maxSupply) !== null && _request$maxSupply !== void 0 ? _request$maxSupply : Number(viem.maxUint32),
|
11027
10859
|
mintFee: (_request$mintFee = request.mintFee) !== null && _request$mintFee !== void 0 ? _request$mintFee : 0n,
|
11028
10860
|
mintFeeToken: (_request$mintFeeToken = request.mintFeeToken) !== null && _request$mintFeeToken !== void 0 ? _request$mintFeeToken : viem.zeroAddress,
|
11029
|
-
owner:
|
11030
|
-
mintFeeRecipient:
|
10861
|
+
owner: validateAddress(request.owner || this.wallet.account.address),
|
10862
|
+
mintFeeRecipient: validateAddress(request.mintFeeRecipient),
|
11031
10863
|
mintOpen: request.mintOpen,
|
11032
10864
|
isPublicMinting: request.isPublicMinting,
|
11033
10865
|
contractURI: request.contractURI
|
@@ -11070,7 +10902,7 @@ var NftClient = /*#__PURE__*/function () {
|
|
11070
10902
|
case 20:
|
11071
10903
|
_context.prev = 20;
|
11072
10904
|
_context.t0 = _context["catch"](0);
|
11073
|
-
handleError(_context.t0, "Failed to create
|
10905
|
+
handleError(_context.t0, "Failed to create an SPG NFT collection");
|
11074
10906
|
case 23:
|
11075
10907
|
case "end":
|
11076
10908
|
return _context.stop();
|
@@ -11153,11 +10985,8 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11153
10985
|
this.royaltyModuleEventClient = new RoyaltyModuleEventClient(rpcClient);
|
11154
10986
|
}
|
11155
10987
|
/** Registers a Group IPA.
|
11156
|
-
*
|
11157
|
-
*
|
11158
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
11159
|
-
* @returns A Promise that resolves to a transaction hash, and if encodedTxDataOnly is true, includes encoded transaction data, and if waitForTransaction is true, includes group id.
|
11160
|
-
* @emits PGroupRegistered (groupId, groupPool);
|
10988
|
+
*
|
10989
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/grouping/IGroupingModule.sol#L14 | `IPGroupRegistered`} event.
|
11161
10990
|
*/
|
11162
10991
|
return _createClass(GroupClient, [{
|
11163
10992
|
key: "registerGroup",
|
@@ -11169,7 +10998,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11169
10998
|
case 0:
|
11170
10999
|
_context.prev = 0;
|
11171
11000
|
object = {
|
11172
|
-
groupPool:
|
11001
|
+
groupPool: validateAddress(request.groupPool)
|
11173
11002
|
};
|
11174
11003
|
if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.encodedTxDataOnly)) {
|
11175
11004
|
_context.next = 6;
|
@@ -11221,8 +11050,8 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11221
11050
|
return registerGroup;
|
11222
11051
|
}()
|
11223
11052
|
/** Mint an NFT from a SPGNFT collection, register it with metadata as an IP, attach license terms to the registered IP, and add it to a group IP.
|
11224
|
-
*
|
11225
|
-
*
|
11053
|
+
*
|
11054
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
11226
11055
|
*/
|
11227
11056
|
)
|
11228
11057
|
}, {
|
@@ -11237,7 +11066,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11237
11066
|
groupId = request.groupId, recipient = request.recipient, spgNftContract = request.spgNftContract, deadline = request.deadline;
|
11238
11067
|
_context2.next = 4;
|
11239
11068
|
return this.ipAssetRegistryClient.isRegistered({
|
11240
|
-
id:
|
11069
|
+
id: validateAddress(groupId)
|
11241
11070
|
});
|
11242
11071
|
case 4:
|
11243
11072
|
isRegistered = _context2.sent;
|
@@ -11267,8 +11096,8 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11267
11096
|
chainId: chain[this.chainId],
|
11268
11097
|
permissions: [{
|
11269
11098
|
ipId: groupId,
|
11270
|
-
signer:
|
11271
|
-
to:
|
11099
|
+
signer: validateAddress(this.groupingWorkflowsClient.address),
|
11100
|
+
to: validateAddress(this.groupingModuleClient.address),
|
11272
11101
|
permission: AccessPermission.ALLOW,
|
11273
11102
|
func: getFunctionSignature(groupingModuleAbi, "addIp")
|
11274
11103
|
}]
|
@@ -11278,13 +11107,13 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11278
11107
|
sigAddToGroupSignature = _yield$getPermissionS.signature;
|
11279
11108
|
object = _objectSpread2(_objectSpread2({}, request), {}, {
|
11280
11109
|
allowDuplicates: request.allowDuplicates || true,
|
11281
|
-
spgNftContract:
|
11282
|
-
recipient:
|
11110
|
+
spgNftContract: validateAddress(spgNftContract),
|
11111
|
+
recipient: validateAddress(recipient || this.wallet.account.address),
|
11283
11112
|
maxAllowedRewardShare: BigInt(getRevenueShare(request.maxAllowedRewardShare, RevShareType.MAX_ALLOWED_REWARD_SHARE)),
|
11284
11113
|
licensesData: this.getLicenseData(request.licenseData),
|
11285
11114
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
11286
11115
|
sigAddToGroup: {
|
11287
|
-
signer:
|
11116
|
+
signer: validateAddress(this.wallet.account.address),
|
11288
11117
|
deadline: calculatedDeadline,
|
11289
11118
|
signature: sigAddToGroupSignature
|
11290
11119
|
}
|
@@ -11340,8 +11169,8 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11340
11169
|
return mintAndRegisterIpAndAttachLicenseAndAddToGroup;
|
11341
11170
|
}()
|
11342
11171
|
/** Register an NFT as IP with metadata, attach license terms to the registered IP, and add it to a group IP.
|
11343
|
-
*
|
11344
|
-
*
|
11172
|
+
*
|
11173
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
11345
11174
|
*/
|
11346
11175
|
)
|
11347
11176
|
}, {
|
@@ -11356,14 +11185,14 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11356
11185
|
_context3.next = 3;
|
11357
11186
|
return this.ipAssetRegistryClient.ipId({
|
11358
11187
|
chainId: BigInt(chain[this.chainId]),
|
11359
|
-
tokenContract:
|
11188
|
+
tokenContract: validateAddress(request.nftContract),
|
11360
11189
|
tokenId: BigInt(request.tokenId)
|
11361
11190
|
});
|
11362
11191
|
case 3:
|
11363
11192
|
ipIdAddress = _context3.sent;
|
11364
11193
|
_context3.next = 6;
|
11365
11194
|
return this.ipAssetRegistryClient.isRegistered({
|
11366
|
-
id:
|
11195
|
+
id: validateAddress(request.groupId)
|
11367
11196
|
});
|
11368
11197
|
case 6:
|
11369
11198
|
isRegistered = _context3.sent;
|
@@ -11386,13 +11215,13 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11386
11215
|
calculatedDeadline = getDeadline(blockTimestamp, request.deadline);
|
11387
11216
|
_context3.next = 20;
|
11388
11217
|
return getPermissionSignature({
|
11389
|
-
ipId:
|
11218
|
+
ipId: request.groupId,
|
11390
11219
|
deadline: calculatedDeadline,
|
11391
11220
|
state: state,
|
11392
11221
|
wallet: this.wallet,
|
11393
11222
|
chainId: chain[this.chainId],
|
11394
11223
|
permissions: [{
|
11395
|
-
ipId:
|
11224
|
+
ipId: request.groupId,
|
11396
11225
|
signer: this.groupingWorkflowsClient.address,
|
11397
11226
|
to: this.groupingModuleClient.address,
|
11398
11227
|
permission: AccessPermission.ALLOW,
|
@@ -11414,19 +11243,19 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11414
11243
|
permissions: [{
|
11415
11244
|
ipId: ipIdAddress,
|
11416
11245
|
signer: this.groupingWorkflowsClient.address,
|
11417
|
-
to:
|
11246
|
+
to: validateAddress(this.coreMetadataModuleClient.address),
|
11418
11247
|
permission: AccessPermission.ALLOW,
|
11419
11248
|
func: getFunctionSignature(coreMetadataModuleAbi, "setAll")
|
11420
11249
|
}, {
|
11421
11250
|
ipId: ipIdAddress,
|
11422
11251
|
signer: this.groupingWorkflowsClient.address,
|
11423
|
-
to:
|
11252
|
+
to: validateAddress(this.licensingModuleClient.address),
|
11424
11253
|
permission: AccessPermission.ALLOW,
|
11425
11254
|
func: getFunctionSignature(licensingModuleAbi, "attachLicenseTerms")
|
11426
11255
|
}, {
|
11427
11256
|
ipId: ipIdAddress,
|
11428
11257
|
signer: this.groupingWorkflowsClient.address,
|
11429
|
-
to:
|
11258
|
+
to: this.licensingModuleClient.address,
|
11430
11259
|
permission: AccessPermission.ALLOW,
|
11431
11260
|
func: getFunctionSignature(licensingModuleAbi, "setLicensingConfig")
|
11432
11261
|
}]
|
@@ -11435,19 +11264,19 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11435
11264
|
_yield$getPermissionS3 = _context3.sent;
|
11436
11265
|
sigMetadataAndAttachSignature = _yield$getPermissionS3.signature;
|
11437
11266
|
object = {
|
11438
|
-
nftContract:
|
11267
|
+
nftContract: request.nftContract,
|
11439
11268
|
groupId: request.groupId,
|
11440
11269
|
licensesData: this.getLicenseData(request.licenseData),
|
11441
11270
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
11442
11271
|
tokenId: BigInt(request.tokenId),
|
11443
11272
|
maxAllowedRewardShare: BigInt(getRevenueShare(request.maxAllowedRewardShare, RevShareType.MAX_ALLOWED_REWARD_SHARE)),
|
11444
11273
|
sigAddToGroup: {
|
11445
|
-
signer:
|
11274
|
+
signer: validateAddress(this.wallet.account.address),
|
11446
11275
|
deadline: calculatedDeadline,
|
11447
11276
|
signature: sigAddToGroupSignature
|
11448
11277
|
},
|
11449
11278
|
sigMetadataAndAttachAndConfig: {
|
11450
|
-
signer:
|
11279
|
+
signer: this.wallet.account.address,
|
11451
11280
|
deadline: calculatedDeadline,
|
11452
11281
|
signature: sigMetadataAndAttachSignature
|
11453
11282
|
}
|
@@ -11500,8 +11329,8 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11500
11329
|
return registerIpAndAttachLicenseAndAddToGroup;
|
11501
11330
|
}()
|
11502
11331
|
/** Register a group IP with a group reward pool and attach license terms to the group IP.
|
11503
|
-
*
|
11504
|
-
*
|
11332
|
+
*
|
11333
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/grouping/IGroupingModule.sol#L14 | `IPGroupRegistered`} event.
|
11505
11334
|
*/
|
11506
11335
|
)
|
11507
11336
|
}, {
|
@@ -11514,7 +11343,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11514
11343
|
case 0:
|
11515
11344
|
_context4.prev = 0;
|
11516
11345
|
object = {
|
11517
|
-
groupPool:
|
11346
|
+
groupPool: validateAddress(request.groupPool),
|
11518
11347
|
licenseData: this.getLicenseData(request.licenseData)[0]
|
11519
11348
|
};
|
11520
11349
|
if (!((_request$txOptions7 = request.txOptions) !== null && _request$txOptions7 !== void 0 && _request$txOptions7.encodedTxDataOnly)) {
|
@@ -11564,8 +11393,8 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11564
11393
|
return registerGroupAndAttachLicense;
|
11565
11394
|
}()
|
11566
11395
|
/** Register a group IP with a group reward pool, attach license terms to the group IP, and add individual IPs to the group IP.
|
11567
|
-
*
|
11568
|
-
*
|
11396
|
+
*
|
11397
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/grouping/IGroupingModule.sol#L14 | `IPGroupRegistered`} event.
|
11569
11398
|
*/
|
11570
11399
|
)
|
11571
11400
|
}, {
|
@@ -11578,7 +11407,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11578
11407
|
case 0:
|
11579
11408
|
_context5.prev = 0;
|
11580
11409
|
object = {
|
11581
|
-
groupPool:
|
11410
|
+
groupPool: validateAddress(request.groupPool),
|
11582
11411
|
ipIds: request.ipIds,
|
11583
11412
|
licenseData: this.getLicenseData(request.licenseData)[0],
|
11584
11413
|
maxAllowedRewardShare: BigInt(getRevenueShare(request.maxAllowedRewardShare))
|
@@ -11591,7 +11420,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11591
11420
|
}
|
11592
11421
|
_context5.next = 6;
|
11593
11422
|
return this.ipAssetRegistryClient.isRegistered({
|
11594
|
-
id:
|
11423
|
+
id: validateAddress(request.ipIds[i])
|
11595
11424
|
});
|
11596
11425
|
case 6:
|
11597
11426
|
isRegistered = _context5.sent;
|
@@ -11830,9 +11659,9 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11830
11659
|
throw new Error("License data is required.");
|
11831
11660
|
}
|
11832
11661
|
var licenseDataArray = isArray ? licenseData : [licenseData];
|
11833
|
-
return licenseDataArray.map(function (item
|
11662
|
+
return licenseDataArray.map(function (item) {
|
11834
11663
|
return {
|
11835
|
-
licenseTemplate:
|
11664
|
+
licenseTemplate: validateAddress(item.licenseTemplate || _this2.licenseTemplateClient.address),
|
11836
11665
|
licenseTermsId: BigInt(item.licenseTermsId),
|
11837
11666
|
licensingConfig: validateLicenseConfig(item.licensingConfig)
|
11838
11667
|
};
|
@@ -12135,9 +11964,6 @@ if (typeof process !== "undefined") {
|
|
12135
11964
|
* The StoryClient is the main entry point for the SDK.
|
12136
11965
|
*/
|
12137
11966
|
var StoryClient = /*#__PURE__*/function () {
|
12138
|
-
/**
|
12139
|
-
* @param config - the configuration for the SDK client
|
12140
|
-
*/
|
12141
11967
|
function StoryClient(config) {
|
12142
11968
|
_classCallCheck(this, StoryClient);
|
12143
11969
|
_defineProperty(this, "_ipAsset", null);
|
@@ -12150,7 +11976,7 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12150
11976
|
_defineProperty(this, "_group", null);
|
12151
11977
|
_defineProperty(this, "_wip", null);
|
12152
11978
|
this.config = _objectSpread2(_objectSpread2({}, config), {}, {
|
12153
|
-
chainId: chain[config.chainId || "
|
11979
|
+
chainId: chain[config.chainId || "1315"]
|
12154
11980
|
});
|
12155
11981
|
if (!this.config.transport) {
|
12156
11982
|
throw new Error("transport is null, please pass in a valid RPC Provider URL as the transport.");
|
@@ -12177,9 +12003,8 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12177
12003
|
return this.config.chainId;
|
12178
12004
|
}
|
12179
12005
|
/**
|
12180
|
-
* Factory method for creating
|
12006
|
+
* Factory method for creating an SDK client with a signer.
|
12181
12007
|
*
|
12182
|
-
* @param config StoryClient - the configuration for a new SDK client
|
12183
12008
|
*/
|
12184
12009
|
}, {
|
12185
12010
|
key: "ipAsset",
|
@@ -12187,8 +12012,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12187
12012
|
/**
|
12188
12013
|
* Getter for the ip asset client. The client is lazily created when
|
12189
12014
|
* this method is called.
|
12190
|
-
*
|
12191
|
-
* @returns the IPAssetClient instance
|
12192
12015
|
*/
|
12193
12016
|
function get() {
|
12194
12017
|
if (this._ipAsset === null) {
|
@@ -12200,8 +12023,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12200
12023
|
/**
|
12201
12024
|
* Getter for the permission client. The client is lazily created when
|
12202
12025
|
* this method is called.
|
12203
|
-
*
|
12204
|
-
* @returns the PermissionClient instance
|
12205
12026
|
*/
|
12206
12027
|
}, {
|
12207
12028
|
key: "permission",
|
@@ -12215,8 +12036,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12215
12036
|
/**
|
12216
12037
|
* Getter for the license client. The client is lazily created when
|
12217
12038
|
* this method is called.
|
12218
|
-
*
|
12219
|
-
* @returns the LicenseClient instance
|
12220
12039
|
*/
|
12221
12040
|
}, {
|
12222
12041
|
key: "license",
|
@@ -12230,8 +12049,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12230
12049
|
/**
|
12231
12050
|
* Getter for the dispute client. The client is lazily created when
|
12232
12051
|
* this method is called.
|
12233
|
-
*
|
12234
|
-
* @returns the DisputeClient instance
|
12235
12052
|
*/
|
12236
12053
|
}, {
|
12237
12054
|
key: "dispute",
|
@@ -12245,8 +12062,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12245
12062
|
/**
|
12246
12063
|
* Getter for the ip account client. The client is lazily created when
|
12247
12064
|
* this method is called.
|
12248
|
-
*
|
12249
|
-
* @returns the IPAccountClient instance
|
12250
12065
|
*/
|
12251
12066
|
}, {
|
12252
12067
|
key: "ipAccount",
|
@@ -12260,8 +12075,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12260
12075
|
/**
|
12261
12076
|
* Getter for the royalty client. The client is lazily created when
|
12262
12077
|
* this method is called.
|
12263
|
-
*
|
12264
|
-
* @returns the RoyaltyClient instance
|
12265
12078
|
*/
|
12266
12079
|
}, {
|
12267
12080
|
key: "royalty",
|
@@ -12275,8 +12088,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12275
12088
|
/**
|
12276
12089
|
* Getter for the NFT client. The client is lazily created when
|
12277
12090
|
* this method is called.
|
12278
|
-
*
|
12279
|
-
* @returns the NftClient instance
|
12280
12091
|
*/
|
12281
12092
|
}, {
|
12282
12093
|
key: "nftClient",
|
@@ -12290,8 +12101,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12290
12101
|
/**
|
12291
12102
|
* Getter for the group client. The client is lazily created when
|
12292
12103
|
* this method is called.
|
12293
|
-
*
|
12294
|
-
* @returns the GroupClient instance
|
12295
12104
|
*/
|
12296
12105
|
}, {
|
12297
12106
|
key: "groupClient",
|
@@ -12370,9 +12179,7 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12370
12179
|
}
|
12371
12180
|
|
12372
12181
|
/**
|
12373
|
-
* Factory method for creating
|
12374
|
-
*
|
12375
|
-
* @param config WalletClientConfig - the configuration for a new SDK client
|
12182
|
+
* Factory method for creating an SDK client with a signer.
|
12376
12183
|
*/
|
12377
12184
|
}, {
|
12378
12185
|
key: "newClientUseWallet",
|
@@ -12385,9 +12192,7 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12385
12192
|
}
|
12386
12193
|
|
12387
12194
|
/**
|
12388
|
-
* Factory method for creating
|
12389
|
-
*
|
12390
|
-
* @param config UseAccountStoryConfig - the configuration for a new SDK client
|
12195
|
+
* Factory method for creating an SDK client with a signer.
|
12391
12196
|
*/
|
12392
12197
|
}, {
|
12393
12198
|
key: "newClientUseAccount",
|
@@ -12513,16 +12318,16 @@ var AIRelationship = /*#__PURE__*/function (AIRelationship) {
|
|
12513
12318
|
|
12514
12319
|
exports.AIRelationship = AIRelationship;
|
12515
12320
|
exports.AccessPermission = AccessPermission;
|
12516
|
-
exports.AddressZero = AddressZero;
|
12517
12321
|
exports.DisputeClient = DisputeClient;
|
12518
12322
|
exports.GroupClient = GroupClient;
|
12519
|
-
exports.HashZero = HashZero;
|
12520
12323
|
exports.IPAccountClient = IPAccountClient;
|
12521
12324
|
exports.IPAssetClient = IPAssetClient;
|
12522
12325
|
exports.LicenseClient = LicenseClient;
|
12326
|
+
exports.NativeRoyaltyPolicy = NativeRoyaltyPolicy;
|
12523
12327
|
exports.NftClient = NftClient;
|
12524
12328
|
exports.PIL_TYPE = PIL_TYPE;
|
12525
12329
|
exports.PermissionClient = PermissionClient;
|
12330
|
+
exports.RevShareType = RevShareType;
|
12526
12331
|
exports.RoyaltyClient = RoyaltyClient;
|
12527
12332
|
exports.StoryClient = StoryClient;
|
12528
12333
|
exports.StoryRelationship = StoryRelationship;
|