@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
@@ -1,4 +1,4 @@
|
|
1
|
-
import { isAddress,
|
1
|
+
import { isAddress, formatEther, encodeFunctionData, decodeEventLog, zeroAddress, toFunctionSelector, keccak256, encodeAbiParameters, zeroHash, maxUint256, toHex, stringToHex, erc20Abi as erc20Abi$1, maxUint32, createPublicClient, createWalletClient } from 'viem';
|
2
2
|
import * as dotenv from 'dotenv';
|
3
3
|
import { defineChain } from 'viem/utils';
|
4
4
|
import { CID } from 'multiformats/cid';
|
@@ -561,16 +561,6 @@ function validateAddresses(addresses) {
|
|
561
561
|
return validateAddress(address);
|
562
562
|
});
|
563
563
|
}
|
564
|
-
|
565
|
-
/** @deprecated use {@link validateAddress} */
|
566
|
-
var getAddress$1 = function getAddress(address, name, chainId) {
|
567
|
-
if (!isAddress(address, {
|
568
|
-
strict: false
|
569
|
-
})) {
|
570
|
-
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."));
|
571
|
-
}
|
572
|
-
return checksumAddress(address, chainId);
|
573
|
-
};
|
574
564
|
function getTokenAmountDisplay(amount) {
|
575
565
|
var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "IP";
|
576
566
|
return "".concat(formatEther(amount)).concat(unit);
|
@@ -3543,8 +3533,8 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
|
|
3543
3533
|
*/)},{key:"withdrawEncode",value:function withdrawEncode(request){return {to:this.address,data:encodeFunctionData({abi:wrappedIpAbi,functionName:"withdraw",args:[request.value]})};}}]);}(WrappedIpReadOnlyClient);
|
3544
3534
|
|
3545
3535
|
/**
|
3546
|
-
* This structure defines the terms for a Programmable IP License (PIL).
|
3547
|
-
*
|
3536
|
+
* This structure defines the terms for a Programmable IP License (PIL).
|
3537
|
+
* These terms can be attached to IP Assets.
|
3548
3538
|
**/
|
3549
3539
|
|
3550
3540
|
var PIL_TYPE = /*#__PURE__*/function (PIL_TYPE) {
|
@@ -3554,14 +3544,16 @@ var PIL_TYPE = /*#__PURE__*/function (PIL_TYPE) {
|
|
3554
3544
|
return PIL_TYPE;
|
3555
3545
|
}({});
|
3556
3546
|
|
3557
|
-
var AddressZero = "0x0000000000000000000000000000000000000000";
|
3558
|
-
var HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
3559
3547
|
var defaultFunctionSelector = "0x00000000";
|
3560
3548
|
var royaltySharesTotalSupply = 100000000;
|
3561
3549
|
var MAX_ROYALTY_TOKEN = 100000000;
|
3550
|
+
var WIP_TOKEN_ADDRESS = wrappedIpAddress[mainnet.id];
|
3562
3551
|
|
3563
|
-
/**
|
3564
|
-
|
3552
|
+
/**
|
3553
|
+
* This data used IP owners to define the configuration
|
3554
|
+
* when others are minting license tokens of their IP through the LicensingModule.
|
3555
|
+
* @see {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/lib/Licensing.sol#L27 | Licensing.sol}
|
3556
|
+
*/
|
3565
3557
|
|
3566
3558
|
/**
|
3567
3559
|
* Input for token amount, can be bigint or number.
|
@@ -3774,14 +3766,6 @@ var getRevenueShare = function getRevenueShare(revShare) {
|
|
3774
3766
|
|
3775
3767
|
/**
|
3776
3768
|
* Get the signature for setting permissions.
|
3777
|
-
* @param param - The parameter object containing necessary data to get the signature.
|
3778
|
-
* @param param.ipId - The IP ID.
|
3779
|
-
* @param param.deadline - The deadline.
|
3780
|
-
* @param param.nonce - The nonce.
|
3781
|
-
* @param param.wallet - The wallet client.
|
3782
|
-
* @param param.chainId - The chain ID.
|
3783
|
-
* @param param.permissionFunc - The permission function,default function is setPermission.
|
3784
|
-
* @returns A Promise that resolves to the signature.
|
3785
3769
|
*/
|
3786
3770
|
var getPermissionSignature = /*#__PURE__*/function () {
|
3787
3771
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(param) {
|
@@ -3795,15 +3779,15 @@ var getPermissionSignature = /*#__PURE__*/function () {
|
|
3795
3779
|
data = encodeFunctionData({
|
3796
3780
|
abi: accessControllerAbi,
|
3797
3781
|
functionName: isBatchPermissionFunction ? "setBatchTransientPermissions" : "setTransientPermission",
|
3798
|
-
args: isBatchPermissionFunction ? [permissions.map(function (item
|
3782
|
+
args: isBatchPermissionFunction ? [permissions.map(function (item) {
|
3799
3783
|
return {
|
3800
|
-
ipAccount:
|
3801
|
-
signer:
|
3802
|
-
to:
|
3784
|
+
ipAccount: validateAddress(item.ipId),
|
3785
|
+
signer: validateAddress(item.signer),
|
3786
|
+
to: validateAddress(item.to),
|
3803
3787
|
func: item.func ? toFunctionSelector(item.func) : defaultFunctionSelector,
|
3804
3788
|
permission: item.permission
|
3805
3789
|
};
|
3806
|
-
})] : [
|
3790
|
+
})] : [validateAddress(permissions[0].ipId), validateAddress(permissions[0].signer), validateAddress(permissions[0].to), permissions[0].func ? toFunctionSelector(permissions[0].func) : defaultFunctionSelector, permissions[0].permission]
|
3807
3791
|
});
|
3808
3792
|
_context.next = 6;
|
3809
3793
|
return getSignature({
|
@@ -3836,15 +3820,6 @@ var getDeadline = function getDeadline(unixTimestamp, deadline) {
|
|
3836
3820
|
|
3837
3821
|
/**
|
3838
3822
|
* Get the signature.
|
3839
|
-
* @param param - The parameter object containing necessary data to get the signature.
|
3840
|
-
* @param param.state - The IP Account's state.
|
3841
|
-
* @param param.to - The recipient address.
|
3842
|
-
* @param param.encodeData - The encoded data.
|
3843
|
-
* @param param.wallet - The wallet client.
|
3844
|
-
* @param param.verifyingContract - The verifying contract.
|
3845
|
-
* @param param.deadline - The deadline.
|
3846
|
-
* @param param.chainId - The chain ID.
|
3847
|
-
* @returns A Promise that resolves to the signature.
|
3848
3823
|
*/
|
3849
3824
|
var getSignature = /*#__PURE__*/function () {
|
3850
3825
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
|
@@ -3931,14 +3906,16 @@ var getSignature = /*#__PURE__*/function () {
|
|
3931
3906
|
|
3932
3907
|
/**
|
3933
3908
|
* Permission level
|
3934
|
-
|
3935
|
-
**/
|
3909
|
+
*/
|
3936
3910
|
var AccessPermission = /*#__PURE__*/function (AccessPermission) {
|
3937
|
-
|
3911
|
+
/**
|
3912
|
+
* ABSTAIN means having not enough information to make decision at
|
3913
|
+
* current level, deferred decision to up.
|
3914
|
+
*/
|
3938
3915
|
AccessPermission[AccessPermission["ABSTAIN"] = 0] = "ABSTAIN";
|
3939
|
-
|
3916
|
+
/** ALLOW means the permission is granted to transaction signer to call the function. */
|
3940
3917
|
AccessPermission[AccessPermission["ALLOW"] = 1] = "ALLOW";
|
3941
|
-
|
3918
|
+
/** DENY means the permission is denied to transaction signer to call the function. */
|
3942
3919
|
AccessPermission[AccessPermission["DENY"] = 2] = "DENY";
|
3943
3920
|
return AccessPermission;
|
3944
3921
|
}({});
|
@@ -3984,7 +3961,7 @@ var validateLicenseConfig = function validateLicenseConfig(licensingConfig) {
|
|
3984
3961
|
isSet: false,
|
3985
3962
|
mintingFee: 0n,
|
3986
3963
|
licensingHook: zeroAddress,
|
3987
|
-
hookData:
|
3964
|
+
hookData: zeroHash,
|
3988
3965
|
commercialRevShare: 0,
|
3989
3966
|
disabled: false,
|
3990
3967
|
expectMinimumGroupRewardShare: 0,
|
@@ -4013,12 +3990,12 @@ var validateLicenseConfig = function validateLicenseConfig(licensingConfig) {
|
|
4013
3990
|
return licenseConfig;
|
4014
3991
|
};
|
4015
3992
|
|
4016
|
-
var getIpMetadataForWorkflow = function getIpMetadataForWorkflow(
|
3993
|
+
var getIpMetadataForWorkflow = function getIpMetadataForWorkflow(ipMetadata) {
|
4017
3994
|
return {
|
4018
|
-
ipMetadataURI: (
|
4019
|
-
ipMetadataHash: (
|
4020
|
-
nftMetadataURI: (
|
4021
|
-
nftMetadataHash: (
|
3995
|
+
ipMetadataURI: (ipMetadata === null || ipMetadata === void 0 ? void 0 : ipMetadata.ipMetadataURI) || "",
|
3996
|
+
ipMetadataHash: (ipMetadata === null || ipMetadata === void 0 ? void 0 : ipMetadata.ipMetadataHash) || zeroHash,
|
3997
|
+
nftMetadataURI: (ipMetadata === null || ipMetadata === void 0 ? void 0 : ipMetadata.nftMetadataURI) || "",
|
3998
|
+
nftMetadataHash: (ipMetadata === null || ipMetadata === void 0 ? void 0 : ipMetadata.nftMetadataHash) || zeroHash
|
4022
3999
|
};
|
4023
4000
|
};
|
4024
4001
|
|
@@ -4328,6 +4305,45 @@ var WipTokenClient = /*#__PURE__*/function () {
|
|
4328
4305
|
}]);
|
4329
4306
|
}();
|
4330
4307
|
|
4308
|
+
/**
|
4309
|
+
* Predict the minting license fee.
|
4310
|
+
*
|
4311
|
+
* @remarks
|
4312
|
+
* The method passes `walletAddress` to the `readContract` function so the smart contract can verify
|
4313
|
+
* if the wallet is the owner of the IP ID. The wallet address is required when using the default license terms ID.
|
4314
|
+
*/
|
4315
|
+
var predictMintingLicenseFee = /*#__PURE__*/function () {
|
4316
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
4317
|
+
var predictMintingFeeRequest, rpcClient, chainId, walletAddress, result;
|
4318
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
4319
|
+
while (1) switch (_context.prev = _context.next) {
|
4320
|
+
case 0:
|
4321
|
+
predictMintingFeeRequest = _ref.predictMintingFeeRequest, rpcClient = _ref.rpcClient, chainId = _ref.chainId, walletAddress = _ref.walletAddress;
|
4322
|
+
_context.next = 3;
|
4323
|
+
return rpcClient.readContract({
|
4324
|
+
abi: licensingModuleAbi,
|
4325
|
+
address: licensingModuleAddress[chainId],
|
4326
|
+
functionName: "predictMintingLicenseFee",
|
4327
|
+
args: [predictMintingFeeRequest.licensorIpId, predictMintingFeeRequest.licenseTemplate, predictMintingFeeRequest.licenseTermsId, predictMintingFeeRequest.amount, predictMintingFeeRequest.receiver, predictMintingFeeRequest.royaltyContext],
|
4328
|
+
account: walletAddress
|
4329
|
+
});
|
4330
|
+
case 3:
|
4331
|
+
result = _context.sent;
|
4332
|
+
return _context.abrupt("return", {
|
4333
|
+
currencyToken: result[0],
|
4334
|
+
tokenAmount: result[1]
|
4335
|
+
});
|
4336
|
+
case 5:
|
4337
|
+
case "end":
|
4338
|
+
return _context.stop();
|
4339
|
+
}
|
4340
|
+
}, _callee);
|
4341
|
+
}));
|
4342
|
+
return function predictMintingLicenseFee(_x) {
|
4343
|
+
return _ref2.apply(this, arguments);
|
4344
|
+
};
|
4345
|
+
}();
|
4346
|
+
|
4331
4347
|
/**
|
4332
4348
|
* check the allowance of all spenders and call approval if any spender
|
4333
4349
|
* allowance is lower than the amount they are expected to spend.
|
@@ -4450,41 +4466,40 @@ var approvalAllSpenders = /*#__PURE__*/function () {
|
|
4450
4466
|
};
|
4451
4467
|
}();
|
4452
4468
|
var calculateLicenseWipMintFee = /*#__PURE__*/function () {
|
4453
|
-
var
|
4454
|
-
var fee;
|
4469
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
|
4470
|
+
var predictMintingFeeRequest, rpcClient, chainId, walletAddress, fee;
|
4455
4471
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
4456
4472
|
while (1) switch (_context3.prev = _context3.next) {
|
4457
4473
|
case 0:
|
4458
|
-
|
4459
|
-
|
4460
|
-
|
4461
|
-
|
4462
|
-
|
4463
|
-
|
4464
|
-
|
4465
|
-
royaltyContext: zeroAddress
|
4474
|
+
predictMintingFeeRequest = _ref4.predictMintingFeeRequest, rpcClient = _ref4.rpcClient, chainId = _ref4.chainId, walletAddress = _ref4.walletAddress;
|
4475
|
+
_context3.next = 3;
|
4476
|
+
return predictMintingLicenseFee({
|
4477
|
+
predictMintingFeeRequest: predictMintingFeeRequest,
|
4478
|
+
rpcClient: rpcClient,
|
4479
|
+
chainId: chainId,
|
4480
|
+
walletAddress: walletAddress
|
4466
4481
|
});
|
4467
|
-
case
|
4482
|
+
case 3:
|
4468
4483
|
fee = _context3.sent;
|
4469
4484
|
if (!(fee.currencyToken !== WIP_TOKEN_ADDRESS)) {
|
4470
|
-
_context3.next =
|
4485
|
+
_context3.next = 6;
|
4471
4486
|
break;
|
4472
4487
|
}
|
4473
4488
|
return _context3.abrupt("return", 0n);
|
4474
|
-
case 5:
|
4475
|
-
return _context3.abrupt("return", fee.tokenAmount);
|
4476
4489
|
case 6:
|
4490
|
+
return _context3.abrupt("return", fee.tokenAmount);
|
4491
|
+
case 7:
|
4477
4492
|
case "end":
|
4478
4493
|
return _context3.stop();
|
4479
4494
|
}
|
4480
4495
|
}, _callee3);
|
4481
4496
|
}));
|
4482
4497
|
return function calculateLicenseWipMintFee(_x3) {
|
4483
|
-
return
|
4498
|
+
return _ref5.apply(this, arguments);
|
4484
4499
|
};
|
4485
4500
|
}();
|
4486
4501
|
var calculateSPGWipMintFee = /*#__PURE__*/function () {
|
4487
|
-
var
|
4502
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(spgNftClient) {
|
4488
4503
|
var token;
|
4489
4504
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
4490
4505
|
while (1) switch (_context4.prev = _context4.next) {
|
@@ -4510,16 +4525,16 @@ var calculateSPGWipMintFee = /*#__PURE__*/function () {
|
|
4510
4525
|
}, _callee4);
|
4511
4526
|
}));
|
4512
4527
|
return function calculateSPGWipMintFee(_x4) {
|
4513
|
-
return
|
4528
|
+
return _ref6.apply(this, arguments);
|
4514
4529
|
};
|
4515
4530
|
}();
|
4516
4531
|
var multiCallWrapIp = /*#__PURE__*/function () {
|
4517
|
-
var
|
4532
|
+
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref7) {
|
4518
4533
|
var ipAmountToWrap, wipClient, multicall3Address, wipSpenders, calls, rpcClient, wallet, contractCall, wipOptions, multiCalls, useMultiCall, deposit, autoApprove, approvalCalls, txHash;
|
4519
4534
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
4520
4535
|
while (1) switch (_context5.prev = _context5.next) {
|
4521
4536
|
case 0:
|
4522
|
-
ipAmountToWrap =
|
4537
|
+
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;
|
4523
4538
|
if (!(ipAmountToWrap === 0n)) {
|
4524
4539
|
_context5.next = 3;
|
4525
4540
|
break;
|
@@ -4608,7 +4623,7 @@ var multiCallWrapIp = /*#__PURE__*/function () {
|
|
4608
4623
|
}, _callee5);
|
4609
4624
|
}));
|
4610
4625
|
return function multiCallWrapIp(_x5) {
|
4611
|
-
return
|
4626
|
+
return _ref8.apply(this, arguments);
|
4612
4627
|
};
|
4613
4628
|
}();
|
4614
4629
|
|
@@ -4626,13 +4641,13 @@ var multiCallWrapIp = /*#__PURE__*/function () {
|
|
4626
4641
|
* for each spender address and approve it, unless disabled via `disableAutoApprove`.
|
4627
4642
|
*/
|
4628
4643
|
var contractCallWithFees = /*#__PURE__*/function () {
|
4629
|
-
var
|
4644
|
+
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref9) {
|
4630
4645
|
var _options$wipOptions;
|
4631
4646
|
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;
|
4632
4647
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
4633
4648
|
while (1) switch (_context6.prev = _context6.next) {
|
4634
4649
|
case 0:
|
4635
|
-
totalFees =
|
4650
|
+
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;
|
4636
4651
|
wipTokenClient = new WipTokenClient(rpcClient, wallet);
|
4637
4652
|
isWip = token === wipTokenClient.address || token === undefined;
|
4638
4653
|
selectedOptions = isWip ? options === null || options === void 0 ? void 0 : options.wipOptions : options.erc20Options;
|
@@ -4747,7 +4762,7 @@ var contractCallWithFees = /*#__PURE__*/function () {
|
|
4747
4762
|
}, _callee6);
|
4748
4763
|
}));
|
4749
4764
|
return function contractCallWithFees(_x6) {
|
4750
|
-
return
|
4765
|
+
return _ref10.apply(this, arguments);
|
4751
4766
|
};
|
4752
4767
|
}();
|
4753
4768
|
|
@@ -4787,18 +4802,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
4787
4802
|
|
4788
4803
|
/**
|
4789
4804
|
* Registers an NFT as IP, creating a corresponding IP record.
|
4790
|
-
*
|
4791
|
-
*
|
4792
|
-
* @param request.tokenId The token identifier of the NFT.
|
4793
|
-
* @param {Object} request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
|
4794
|
-
* @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
|
4795
|
-
* @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
|
4796
|
-
* @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
|
4797
|
-
* @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
|
4798
|
-
* @param request.deadline [Optional] The deadline for the signature in seconds, default is 1000s.
|
4799
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
4800
|
-
* @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.
|
4801
|
-
* @emits IPRegistered (ipId, chainId, tokenContract, tokenId, resolverAddr, metadataProviderAddress, metadata)
|
4805
|
+
*
|
4806
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
4802
4807
|
*/
|
4803
4808
|
}, {
|
4804
4809
|
key: "register",
|
@@ -4828,7 +4833,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
4828
4833
|
case 10:
|
4829
4834
|
object = {
|
4830
4835
|
tokenId: tokenId,
|
4831
|
-
nftContract:
|
4836
|
+
nftContract: validateAddress(request.nftContract),
|
4832
4837
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
4833
4838
|
sigMetadata: {
|
4834
4839
|
signer: zeroAddress,
|
@@ -4855,8 +4860,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
4855
4860
|
chainId: chain[this.chainId],
|
4856
4861
|
permissions: [{
|
4857
4862
|
ipId: ipIdAddress,
|
4858
|
-
signer:
|
4859
|
-
to:
|
4863
|
+
signer: validateAddress(this.registrationWorkflowsClient.address),
|
4864
|
+
to: validateAddress(this.coreMetadataModuleClient.address),
|
4860
4865
|
permission: AccessPermission.ALLOW,
|
4861
4866
|
func: getFunctionSignature(coreMetadataModuleAbi, "setAll")
|
4862
4867
|
}]
|
@@ -4865,7 +4870,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
4865
4870
|
_yield$getPermissionS = _context.sent;
|
4866
4871
|
signature = _yield$getPermissionS.signature;
|
4867
4872
|
object.sigMetadata = {
|
4868
|
-
signer:
|
4873
|
+
signer: validateAddress(this.walletAddress),
|
4869
4874
|
deadline: calculatedDeadline,
|
4870
4875
|
signature: signature
|
4871
4876
|
};
|
@@ -4951,18 +4956,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
4951
4956
|
}()
|
4952
4957
|
/**
|
4953
4958
|
* Batch registers an NFT as IP, creating a corresponding IP record.
|
4954
|
-
*
|
4955
|
-
*
|
4956
|
-
* @param request.args.nftContract The address of the NFT.
|
4957
|
-
* @param request.args.tokenId The token identifier of the NFT.
|
4958
|
-
* @param {Object} request.args.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
|
4959
|
-
* @param request.args.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
|
4960
|
-
* @param request.args.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
|
4961
|
-
* @param request.args.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
|
4962
|
-
* @param request.args.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
|
4963
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property, without encodedTxDataOnly option.
|
4964
|
-
* @returns A Promise that resolves to a transaction hash, if waitForTransaction is true, return an array of containing IP ID, Token ID, NFT Contract.
|
4965
|
-
* @emits IPRegistered (ipId, chainId, tokenContract, tokenId, resolverAddr, metadataProviderAddress, metadata)
|
4959
|
+
*
|
4960
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
4966
4961
|
*/
|
4967
4962
|
)
|
4968
4963
|
}, {
|
@@ -5172,7 +5167,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5172
5167
|
contractCall: contractCall,
|
5173
5168
|
txOptions: request.txOptions,
|
5174
5169
|
encodedTxs: [encodedTxData],
|
5175
|
-
spgSpenderAddress: this.
|
5170
|
+
spgSpenderAddress: this.royaltyModuleEventClient.address,
|
5176
5171
|
wipOptions: _objectSpread2(_objectSpread2({}, request.wipOptions), {}, {
|
5177
5172
|
useMulticallWhenPossible: false
|
5178
5173
|
})
|
@@ -5197,17 +5192,6 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5197
5192
|
}()
|
5198
5193
|
/**
|
5199
5194
|
* Batch registers a derivative directly with parent IP's license terms.
|
5200
|
-
* @param request - The request object that contains all data needed to batch register derivative IP.
|
5201
|
-
* @param {Array} request.args The array of objects containing the data needed to register derivative IP.
|
5202
|
-
* @param request.args.childIpId The derivative IP ID.
|
5203
|
-
* @param {Array} request.args.parentIpIds The parent IP IDs.
|
5204
|
-
* @param {Array} request.args.licenseTermsIds The IDs of the license terms that the parent IP supports.
|
5205
|
-
* @param request.args.maxMintingFee The maximum minting fee that the caller is willing to pay. if set to 0 then no limit.
|
5206
|
-
* @param request.args.maxRts The maximum number of royalty tokens that can be distributed to the external royalty policies (max: 100,000,000).
|
5207
|
-
* @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%).
|
5208
|
-
* @param request.deadline [Optional] The deadline for the signature in seconds, default is 1000s.
|
5209
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property, without encodedTxDataOnly option.
|
5210
|
-
* @returns A Promise that resolves to a transaction hash.
|
5211
5195
|
*/
|
5212
5196
|
)
|
5213
5197
|
}, {
|
@@ -5220,7 +5204,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5220
5204
|
case 0:
|
5221
5205
|
_context5.prev = 0;
|
5222
5206
|
contracts = [];
|
5223
|
-
licenseModuleAddress =
|
5207
|
+
licenseModuleAddress = validateAddress(this.licensingModuleClient.address);
|
5224
5208
|
_iterator2 = _createForOfIteratorHelper(request.args);
|
5225
5209
|
_context5.prev = 4;
|
5226
5210
|
_iterator2.s();
|
@@ -5249,7 +5233,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5249
5233
|
return this.getCalculatedDeadline(request.deadline);
|
5250
5234
|
case 18:
|
5251
5235
|
calculatedDeadline = _context5.sent;
|
5252
|
-
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet,
|
5236
|
+
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(arg.childIpId));
|
5253
5237
|
data = encodeFunctionData({
|
5254
5238
|
abi: licensingModuleAbi,
|
5255
5239
|
functionName: "registerDerivative",
|
@@ -5343,12 +5327,6 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5343
5327
|
* Registers a derivative with license tokens. The derivative IP is registered with license tokens minted from the parent IP's license terms.
|
5344
5328
|
* The license terms of the parent IPs issued with license tokens are attached to the derivative IP.
|
5345
5329
|
* The caller must be the derivative IP owner or an authorized operator.
|
5346
|
-
* @param request - The request object that contains all data needed to register derivative license tokens.
|
5347
|
-
* @param request.childIpId The derivative IP ID.
|
5348
|
-
* @param {Array} request.licenseTokenIds The IDs of the license tokens.
|
5349
|
-
* @param request.args.maxRts The maximum number of royalty tokens that can be distributed to the external royalty policies (max: 100,000,000).
|
5350
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
5351
|
-
* @returns A Promise that resolves to an object containing the transaction hash.
|
5352
5330
|
*/
|
5353
5331
|
)
|
5354
5332
|
}, {
|
@@ -5361,7 +5339,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5361
5339
|
case 0:
|
5362
5340
|
_context6.prev = 0;
|
5363
5341
|
req = {
|
5364
|
-
childIpId:
|
5342
|
+
childIpId: validateAddress(request.childIpId),
|
5365
5343
|
licenseTokenIds: request.licenseTokenIds.map(function (id) {
|
5366
5344
|
return BigInt(id);
|
5367
5345
|
}),
|
@@ -5437,10 +5415,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5437
5415
|
}()
|
5438
5416
|
/**
|
5439
5417
|
* Mint an NFT from a collection and register it as an IP.
|
5440
|
-
*
|
5441
|
-
*
|
5442
|
-
* @see {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicensingModule.sol#L19 | ILicensingModule}
|
5443
|
-
* for a list of on-chain events emitted when an IP is minted and registered, and license terms are attached to an IP.
|
5418
|
+
*
|
5419
|
+
* 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.
|
5444
5420
|
*/
|
5445
5421
|
)
|
5446
5422
|
}, {
|
@@ -5460,8 +5436,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5460
5436
|
licenseTerms = _yield$this$validateL.licenseTerms;
|
5461
5437
|
licenseTermsData = _yield$this$validateL.licenseTermsData;
|
5462
5438
|
_object = {
|
5463
|
-
spgNftContract:
|
5464
|
-
recipient:
|
5439
|
+
spgNftContract: validateAddress(request.spgNftContract),
|
5440
|
+
recipient: validateAddress(request.recipient || this.walletAddress),
|
5465
5441
|
licenseTermsData: licenseTermsData,
|
5466
5442
|
allowDuplicates: request.allowDuplicates || true,
|
5467
5443
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata)
|
@@ -5523,49 +5499,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5523
5499
|
}()
|
5524
5500
|
/**
|
5525
5501
|
* Batch mint an NFT from a collection and register it as an IP.
|
5526
|
-
*
|
5527
|
-
*
|
5528
|
-
* @param request.args.spgNftContract The address of the NFT collection.
|
5529
|
-
* @param request.allowDuplicates Indicates whether the license terms can be attached to the same IP ID or not.
|
5530
|
-
* @param {Array} request.args.licenseTermsData The PIL terms and licensing configuration data to be attached to the IP.
|
5531
|
-
* @param {Object} request.args.licenseTermsData.terms The PIL terms to be used for the licensing.
|
5532
|
-
* @param request.args.licenseTermsData.terms.transferable Indicates whether the license is transferable or not.
|
5533
|
-
* @param request.args.licenseTermsData.terms.royaltyPolicy The address of the royalty policy contract which required to StoryProtocol in advance.
|
5534
|
-
* @param request.args.licenseTermsData.terms.mintingFee The fee to be paid when minting a license.
|
5535
|
-
* @param request.args.licenseTermsData.terms.expiration The expiration period of the license.
|
5536
|
-
* @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.
|
5537
|
-
* @param request.args.licenseTermsData.terms.commercialAttribution Whether attribution is required when reproducing the work commercially or not.
|
5538
|
-
* @param request.args.licenseTermsData.terms.commercializerChecker Commercializers that are allowed to commercially exploit the work. If zero address, then no restrictions is enforced.
|
5539
|
-
* @param request.args.licenseTermsData.terms.commercializerCheckerData The data to be passed to the commercializer checker contract.
|
5540
|
-
* @param request.args.licenseTermsData.terms.commercialRevShare Percentage of revenue that must be shared with the licensor.
|
5541
|
-
* @param request.args.licenseTermsData.terms.commercialRevCeiling The maximum revenue that can be generated from the commercial use of the work.
|
5542
|
-
* @param request.args.licenseTermsData.terms.derivativesAllowed Indicates whether the licensee can create derivatives of his work or not.
|
5543
|
-
* @param request.args.licenseTermsData.terms.derivativesAttribution Indicates whether attribution is required for derivatives of the work or not.
|
5544
|
-
* @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.
|
5545
|
-
* @param request.args.licenseTermsData.terms.derivativesReciprocal Indicates whether the licensee must license derivatives of the work under the same terms or not.
|
5546
|
-
* @param request.args.licenseTermsData.terms.derivativeRevCeiling The maximum revenue that can be generated from the derivative use of the work.
|
5547
|
-
* @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.
|
5548
|
-
* @param request.args.licenseTermsData.terms.uri The URI of the license terms, which can be used to fetch the offchain license terms.
|
5549
|
-
* @param {Object} request.args.licenseTermsData.licensingConfig The PIL terms and licensing configuration data to attach to the IP.
|
5550
|
-
* @param request.args.licenseTermsData.licensingConfig.isSet Whether the configuration is set or not.
|
5551
|
-
* @param request.args.licenseTermsData.licensingConfig.mintingFee The minting fee to be paid when minting license tokens.
|
5552
|
-
* @param request.args.licenseTermsData.licensingConfig.licensingHook The hook contract address for the licensing module, or zero address if none
|
5553
|
-
* @param request.args.licenseTermsData.licensingConfig.hookData The data to be used by the licensing hook.
|
5554
|
-
* @param request.args.licenseTermsData.licensingConfig.commercialRevShare The commercial revenue share percentage.
|
5555
|
-
* @param request.args.licenseTermsData.licensingConfig.disabled Whether the licensing is disabled or not.
|
5556
|
-
* @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.
|
5557
|
-
* If the remaining reward share in the group is less than the minimumGroupRewardShare,the IP cannot be added to the group.
|
5558
|
-
* @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.
|
5559
|
-
* @param {Object} request.args.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
|
5560
|
-
* @param request.args.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
|
5561
|
-
* @param request.args.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
|
5562
|
-
* @param request.args.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
|
5563
|
-
* @param request.args.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
|
5564
|
-
* @param request.args.recipient [Optional] The address of the recipient of the minted NFT,default value is your wallet address.
|
5565
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property, without encodedTxData option.
|
5566
|
-
* @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.
|
5567
|
-
* @emits IPRegistered (ipId, chainId, tokenContract, tokenId, name, uri, registrationDate)
|
5568
|
-
* @emits LicenseTermsAttached (caller, ipId, licenseTemplate, licenseTermsId)
|
5502
|
+
*
|
5503
|
+
* 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.
|
5569
5504
|
*/
|
5570
5505
|
)
|
5571
5506
|
}, {
|
@@ -5694,8 +5629,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5694
5629
|
}()
|
5695
5630
|
/**
|
5696
5631
|
* Register a given NFT as an IP and attach Programmable IP License Terms.
|
5697
|
-
*
|
5698
|
-
*
|
5632
|
+
*
|
5633
|
+
* 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.
|
5699
5634
|
*/
|
5700
5635
|
)
|
5701
5636
|
}, {
|
@@ -5743,14 +5678,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5743
5678
|
chainId: chain[this.chainId],
|
5744
5679
|
permissions: [{
|
5745
5680
|
ipId: ipIdAddress,
|
5746
|
-
signer:
|
5747
|
-
to:
|
5681
|
+
signer: validateAddress(this.licenseAttachmentWorkflowsClient.address),
|
5682
|
+
to: validateAddress(this.coreMetadataModuleClient.address),
|
5748
5683
|
permission: AccessPermission.ALLOW,
|
5749
5684
|
func: getFunctionSignature(coreMetadataModuleAbi, "setAll")
|
5750
5685
|
}, {
|
5751
5686
|
ipId: ipIdAddress,
|
5752
|
-
signer:
|
5753
|
-
to:
|
5687
|
+
signer: this.licenseAttachmentWorkflowsClient.address,
|
5688
|
+
to: validateAddress(this.licensingModuleClient.address),
|
5754
5689
|
permission: AccessPermission.ALLOW,
|
5755
5690
|
func: getFunctionSignature(licensingModuleAbi, "attachLicenseTerms")
|
5756
5691
|
}, {
|
@@ -5765,12 +5700,12 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5765
5700
|
_yield$getPermissionS2 = _context9.sent;
|
5766
5701
|
signature = _yield$getPermissionS2.signature;
|
5767
5702
|
_object2 = {
|
5768
|
-
nftContract:
|
5703
|
+
nftContract: validateAddress(request.nftContract),
|
5769
5704
|
tokenId: request.tokenId,
|
5770
5705
|
licenseTermsData: licenseTermsData,
|
5771
5706
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
5772
5707
|
sigMetadataAndAttachAndConfig: {
|
5773
|
-
signer:
|
5708
|
+
signer: validateAddress(this.walletAddress),
|
5774
5709
|
deadline: calculatedDeadline,
|
5775
5710
|
signature: signature
|
5776
5711
|
}
|
@@ -5834,8 +5769,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5834
5769
|
}()
|
5835
5770
|
/**
|
5836
5771
|
* Register the given NFT as a derivative IP with metadata without using license tokens.
|
5837
|
-
*
|
5838
|
-
*
|
5772
|
+
*
|
5773
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
5839
5774
|
*/
|
5840
5775
|
)
|
5841
5776
|
}, {
|
@@ -5878,14 +5813,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5878
5813
|
chainId: chain[this.chainId],
|
5879
5814
|
permissions: [{
|
5880
5815
|
ipId: ipIdAddress,
|
5881
|
-
signer:
|
5882
|
-
to:
|
5816
|
+
signer: validateAddress(this.derivativeWorkflowsClient.address),
|
5817
|
+
to: validateAddress(this.coreMetadataModuleClient.address),
|
5883
5818
|
permission: AccessPermission.ALLOW,
|
5884
5819
|
func: getFunctionSignature(coreMetadataModuleAbi, "setAll")
|
5885
5820
|
}, {
|
5886
5821
|
ipId: ipIdAddress,
|
5887
5822
|
signer: this.derivativeWorkflowsClient.address,
|
5888
|
-
to:
|
5823
|
+
to: validateAddress(this.licensingModuleClient.address),
|
5889
5824
|
permission: AccessPermission.ALLOW,
|
5890
5825
|
func: getFunctionSignature(licensingModuleAbi, "registerDerivative")
|
5891
5826
|
}]
|
@@ -5898,7 +5833,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5898
5833
|
case 19:
|
5899
5834
|
derivData = _context10.sent;
|
5900
5835
|
_object3 = {
|
5901
|
-
nftContract:
|
5836
|
+
nftContract: validateAddress(request.nftContract),
|
5902
5837
|
tokenId: BigInt(request.tokenId),
|
5903
5838
|
derivData: derivData,
|
5904
5839
|
sigMetadataAndRegister: {
|
@@ -5948,8 +5883,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5948
5883
|
}()
|
5949
5884
|
/**
|
5950
5885
|
* Mint an NFT from a collection and register it as a derivative IP without license tokens.
|
5951
|
-
*
|
5952
|
-
*
|
5886
|
+
*
|
5887
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
5953
5888
|
*/
|
5954
5889
|
)
|
5955
5890
|
}, {
|
@@ -5966,8 +5901,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
5966
5901
|
return this.validateDerivativeData(request.derivData);
|
5967
5902
|
case 3:
|
5968
5903
|
derivData = _context11.sent;
|
5969
|
-
recipient =
|
5970
|
-
spgNftContract =
|
5904
|
+
recipient = validateAddress(request.recipient || this.walletAddress);
|
5905
|
+
spgNftContract = validateAddress(request.spgNftContract);
|
5971
5906
|
_object4 = _objectSpread2(_objectSpread2({}, request), {}, {
|
5972
5907
|
derivData: derivData,
|
5973
5908
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
@@ -6014,22 +5949,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6014
5949
|
}()
|
6015
5950
|
/**
|
6016
5951
|
* Batch mint an NFT from a collection and register it as a derivative IP without license tokens.
|
6017
|
-
*
|
6018
|
-
*
|
6019
|
-
* @param request.args.spgNftContract The address of the NFT collection.
|
6020
|
-
* @param {Object} request.args.derivData The derivative data to be used for registerDerivative.
|
6021
|
-
* @param {Array} request.args.derivData.parentIpIds The IDs of the parent IPs to link the registered derivative IP.
|
6022
|
-
* @param {Array} request.args.derivData.licenseTermsIds The IDs of the license terms to be used for the linking.
|
6023
|
-
* @param request.args.derivData.licenseTemplate [Optional] The address of the license template to be used for the linking.
|
6024
|
-
* @param {Object} request.args.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
|
6025
|
-
* @param request.args.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
|
6026
|
-
* @param request.args.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
|
6027
|
-
* @param request.args.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
|
6028
|
-
* @param request.args.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
|
6029
|
-
* @param request.arg.recipient [Optional] The address of the recipient of the minted NFT,default value is your wallet address.
|
6030
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property, without encodedTxData option.
|
6031
|
-
* @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.
|
6032
|
-
* @emits IPRegistered (ipId, chainId, tokenContract, tokenId, name, uri, registrationDate)
|
5952
|
+
*
|
5953
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
6033
5954
|
*/
|
6034
5955
|
)
|
6035
5956
|
}, {
|
@@ -6123,18 +6044,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6123
6044
|
}()
|
6124
6045
|
/**
|
6125
6046
|
* Mint an NFT from a SPGNFT collection and register it with metadata as an IP.
|
6126
|
-
*
|
6127
|
-
*
|
6128
|
-
* @param request.recipient The address of the recipient of the minted NFT,default value is your wallet address.
|
6129
|
-
* @param request.allowDuplicates Set to true to allow minting an NFT with a duplicate metadata hash.
|
6130
|
-
* @param {Object} request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
|
6131
|
-
* @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
|
6132
|
-
* @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
|
6133
|
-
* @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
|
6134
|
-
* @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
|
6135
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
6136
|
-
* @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.
|
6137
|
-
* @emits IPRegistered (ipId, chainId, tokenContract, tokenId, name, uri, registrationDate)
|
6047
|
+
*
|
6048
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
6138
6049
|
*/
|
6139
6050
|
)
|
6140
6051
|
}, {
|
@@ -6148,8 +6059,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6148
6059
|
case 0:
|
6149
6060
|
_context13.prev = 0;
|
6150
6061
|
_object5 = {
|
6151
|
-
spgNftContract:
|
6152
|
-
recipient:
|
6062
|
+
spgNftContract: validateAddress(request.spgNftContract),
|
6063
|
+
recipient: validateAddress(request.recipient || this.walletAddress),
|
6153
6064
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
6154
6065
|
allowDuplicates: request.allowDuplicates || true
|
6155
6066
|
};
|
@@ -6192,8 +6103,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6192
6103
|
}()
|
6193
6104
|
/**
|
6194
6105
|
* Register Programmable IP License Terms (if unregistered) and attach it to IP.
|
6195
|
-
*
|
6196
|
-
*
|
6106
|
+
*
|
6107
|
+
* 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.
|
6197
6108
|
*/
|
6198
6109
|
)
|
6199
6110
|
}, {
|
@@ -6241,14 +6152,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6241
6152
|
chainId: chain[this.chainId],
|
6242
6153
|
permissions: [{
|
6243
6154
|
ipId: ipId,
|
6244
|
-
signer:
|
6245
|
-
to:
|
6155
|
+
signer: validateAddress(this.licenseAttachmentWorkflowsClient.address),
|
6156
|
+
to: validateAddress(this.licensingModuleClient.address),
|
6246
6157
|
permission: AccessPermission.ALLOW,
|
6247
6158
|
func: getFunctionSignature(licensingModuleAbi, "attachLicenseTerms")
|
6248
6159
|
}, {
|
6249
6160
|
ipId: ipId,
|
6250
|
-
signer:
|
6251
|
-
to:
|
6161
|
+
signer: this.licenseAttachmentWorkflowsClient.address,
|
6162
|
+
to: this.licensingModuleClient.address,
|
6252
6163
|
permission: AccessPermission.ALLOW,
|
6253
6164
|
func: getFunctionSignature(licensingModuleAbi, "setLicensingConfig")
|
6254
6165
|
}]
|
@@ -6260,7 +6171,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6260
6171
|
ipId: ipId,
|
6261
6172
|
licenseTermsData: licenseTermsData,
|
6262
6173
|
sigAttachAndConfig: {
|
6263
|
-
signer:
|
6174
|
+
signer: validateAddress(this.walletAddress),
|
6264
6175
|
deadline: calculatedDeadline,
|
6265
6176
|
signature: signature
|
6266
6177
|
}
|
@@ -6317,22 +6228,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6317
6228
|
return registerPilTermsAndAttach;
|
6318
6229
|
}()
|
6319
6230
|
/**
|
6320
|
-
*
|
6231
|
+
* Mint an NFT from a collection and register it as a derivative IP using license tokens.
|
6321
6232
|
* 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.
|
6322
|
-
*
|
6323
|
-
*
|
6324
|
-
* @param {Array} request.licenseTokenIds The IDs of the license tokens to be burned for linking the IP to parent IPs.
|
6325
|
-
* @param request.allowDuplicates Set to true to allow minting an NFT with a duplicate metadata hash.
|
6326
|
-
* @param request.maxRts The maximum number of royalty tokens that can be distributed to the external royalty policies (max: 100,000,000).
|
6327
|
-
* @param {Object} request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
|
6328
|
-
* @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
|
6329
|
-
* @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
|
6330
|
-
* @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
|
6331
|
-
* @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
|
6332
|
-
* @param request.recipient - [Optional] The address to receive the minted NFT,default value is your wallet address.
|
6333
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
6334
|
-
* @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.
|
6335
|
-
* @emits IPRegistered (ipId, chainId, tokenContract, tokenId, name, uri, registrationDate)
|
6233
|
+
*
|
6234
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
6336
6235
|
*/
|
6337
6236
|
)
|
6338
6237
|
}, {
|
@@ -6350,8 +6249,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6350
6249
|
case 3:
|
6351
6250
|
licenseTokenIds = _context16.sent;
|
6352
6251
|
_object7 = {
|
6353
|
-
spgNftContract:
|
6354
|
-
recipient:
|
6252
|
+
spgNftContract: validateAddress(request.spgNftContract),
|
6253
|
+
recipient: validateAddress(request.recipient || this.walletAddress),
|
6355
6254
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
6356
6255
|
licenseTokenIds: licenseTokenIds,
|
6357
6256
|
royaltyContext: zeroAddress,
|
@@ -6414,18 +6313,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6414
6313
|
}()
|
6415
6314
|
/**
|
6416
6315
|
* Register the given NFT as a derivative IP using license tokens.
|
6417
|
-
*
|
6418
|
-
*
|
6419
|
-
* @param {Array} request.licenseTokenIds The IDs of the license tokens to be burned for linking the IP to parent IPs.
|
6420
|
-
* @param request.tokenId The ID of the NFT.
|
6421
|
-
* @param {Object} request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
|
6422
|
-
* @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
|
6423
|
-
* @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
|
6424
|
-
* @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
|
6425
|
-
* @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
|
6426
|
-
* @param request.deadline [Optional] The deadline for the signature in seconds, default is 1000s.
|
6427
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
6428
|
-
* @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.
|
6316
|
+
*
|
6317
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
6429
6318
|
*/
|
6430
6319
|
)
|
6431
6320
|
}, {
|
@@ -6471,14 +6360,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6471
6360
|
chainId: chain[this.chainId],
|
6472
6361
|
permissions: [{
|
6473
6362
|
ipId: ipIdAddress,
|
6474
|
-
signer:
|
6475
|
-
to:
|
6363
|
+
signer: validateAddress(this.derivativeWorkflowsClient.address),
|
6364
|
+
to: validateAddress(this.coreMetadataModuleClient.address),
|
6476
6365
|
permission: AccessPermission.ALLOW,
|
6477
6366
|
func: getFunctionSignature(coreMetadataModuleAbi, "setAll")
|
6478
6367
|
}, {
|
6479
6368
|
ipId: ipIdAddress,
|
6480
6369
|
signer: this.derivativeWorkflowsClient.address,
|
6481
|
-
to:
|
6370
|
+
to: validateAddress(this.licensingModuleClient.address),
|
6482
6371
|
permission: AccessPermission.ALLOW,
|
6483
6372
|
func: getFunctionSignature(licensingModuleAbi, "registerDerivativeWithLicenseTokens")
|
6484
6373
|
}]
|
@@ -6492,7 +6381,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6492
6381
|
royaltyContext: zeroAddress,
|
6493
6382
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
6494
6383
|
sigMetadataAndRegister: {
|
6495
|
-
signer:
|
6384
|
+
signer: validateAddress(this.walletAddress),
|
6496
6385
|
deadline: calculatedDeadline,
|
6497
6386
|
signature: signature
|
6498
6387
|
},
|
@@ -6548,11 +6437,11 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6548
6437
|
return registerIpAndMakeDerivativeWithLicenseTokens;
|
6549
6438
|
}()
|
6550
6439
|
/**
|
6551
|
-
* Register the given NFT and attach license terms and distribute royalty
|
6552
|
-
*
|
6553
|
-
*
|
6554
|
-
*
|
6555
|
-
*
|
6440
|
+
* Register the given NFT and attach license terms and distribute royalty
|
6441
|
+
* tokens. In order to successfully distribute royalty tokens, the first
|
6442
|
+
* license terms attached to the IP must be a commercial license.
|
6443
|
+
*
|
6444
|
+
* 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.
|
6556
6445
|
*/
|
6557
6446
|
)
|
6558
6447
|
}, {
|
@@ -6576,7 +6465,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6576
6465
|
case 9:
|
6577
6466
|
calculatedDeadline = _context18.sent;
|
6578
6467
|
_context18.next = 12;
|
6579
|
-
return this.getIpIdAddress(
|
6468
|
+
return this.getIpIdAddress(validateAddress(request.nftContract), request.tokenId);
|
6580
6469
|
case 12:
|
6581
6470
|
ipIdAddress = _context18.sent;
|
6582
6471
|
_context18.next = 15;
|
@@ -6600,14 +6489,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6600
6489
|
chainId: chain[this.chainId],
|
6601
6490
|
permissions: [{
|
6602
6491
|
ipId: ipIdAddress,
|
6603
|
-
signer:
|
6604
|
-
to:
|
6492
|
+
signer: validateAddress(this.royaltyTokenDistributionWorkflowsClient.address),
|
6493
|
+
to: validateAddress(this.coreMetadataModuleClient.address),
|
6605
6494
|
permission: AccessPermission.ALLOW,
|
6606
6495
|
func: getFunctionSignature(coreMetadataModuleAbi, "setAll")
|
6607
6496
|
}, {
|
6608
6497
|
ipId: ipIdAddress,
|
6609
6498
|
signer: this.royaltyTokenDistributionWorkflowsClient.address,
|
6610
|
-
to:
|
6499
|
+
to: validateAddress(this.licensingModuleClient.address),
|
6611
6500
|
permission: AccessPermission.ALLOW,
|
6612
6501
|
func: getFunctionSignature(licensingModuleAbi, "attachLicenseTerms")
|
6613
6502
|
}, {
|
@@ -6628,7 +6517,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6628
6517
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
6629
6518
|
licenseTermsData: licenseTermsData,
|
6630
6519
|
sigMetadataAndAttachAndConfig: {
|
6631
|
-
signer:
|
6520
|
+
signer: validateAddress(this.walletAddress),
|
6632
6521
|
deadline: calculatedDeadline,
|
6633
6522
|
signature: signature
|
6634
6523
|
}
|
@@ -6692,9 +6581,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6692
6581
|
/**
|
6693
6582
|
* 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
|
6694
6583
|
* a commercial license.
|
6695
|
-
*
|
6696
|
-
* @
|
6697
|
-
* 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.
|
6584
|
+
*
|
6585
|
+
* 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.
|
6698
6586
|
*/
|
6699
6587
|
)
|
6700
6588
|
}, {
|
@@ -6726,14 +6614,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6726
6614
|
chainId: chain[this.chainId],
|
6727
6615
|
permissions: [{
|
6728
6616
|
ipId: ipIdAddress,
|
6729
|
-
signer:
|
6730
|
-
to:
|
6617
|
+
signer: validateAddress(this.royaltyTokenDistributionWorkflowsClient.address),
|
6618
|
+
to: validateAddress(this.coreMetadataModuleClient.address),
|
6731
6619
|
permission: AccessPermission.ALLOW,
|
6732
6620
|
func: getFunctionSignature(coreMetadataModuleAbi, "setAll")
|
6733
6621
|
}, {
|
6734
6622
|
ipId: ipIdAddress,
|
6735
6623
|
signer: this.royaltyTokenDistributionWorkflowsClient.address,
|
6736
|
-
to:
|
6624
|
+
to: validateAddress(this.licensingModuleClient.address),
|
6737
6625
|
permission: AccessPermission.ALLOW,
|
6738
6626
|
func: getFunctionSignature(licensingModuleAbi, "registerDerivative")
|
6739
6627
|
}]
|
@@ -6844,9 +6732,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6844
6732
|
}()
|
6845
6733
|
/**
|
6846
6734
|
* Mint an NFT and register the IP, attach PIL terms, and distribute royalty tokens.
|
6847
|
-
*
|
6848
|
-
* @
|
6849
|
-
* 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.
|
6735
|
+
*
|
6736
|
+
* 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.
|
6850
6737
|
*/
|
6851
6738
|
)
|
6852
6739
|
}, {
|
@@ -6867,8 +6754,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6867
6754
|
licenseTermsData = _yield$this$validateL5.licenseTermsData;
|
6868
6755
|
_this$getRoyaltyShare3 = this.getRoyaltyShares(request.royaltyShares), royaltyShares = _this$getRoyaltyShare3.royaltyShares;
|
6869
6756
|
_object10 = {
|
6870
|
-
spgNftContract:
|
6871
|
-
recipient:
|
6757
|
+
spgNftContract: validateAddress(request.spgNftContract),
|
6758
|
+
recipient: validateAddress(request.recipient || this.walletAddress),
|
6872
6759
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
6873
6760
|
licenseTermsData: licenseTermsData,
|
6874
6761
|
royaltyShares: royaltyShares,
|
@@ -6931,8 +6818,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6931
6818
|
}()
|
6932
6819
|
/**
|
6933
6820
|
* Mint an NFT and register the IP, make a derivative, and distribute royalty tokens.
|
6934
|
-
*
|
6935
|
-
*
|
6821
|
+
*
|
6822
|
+
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
6936
6823
|
*/
|
6937
6824
|
)
|
6938
6825
|
}, {
|
@@ -6945,14 +6832,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
6945
6832
|
while (1) switch (_context21.prev = _context21.next) {
|
6946
6833
|
case 0:
|
6947
6834
|
_context21.prev = 0;
|
6948
|
-
nftRecipient =
|
6835
|
+
nftRecipient = validateAddress(request.recipient || this.walletAddress);
|
6949
6836
|
_this$getRoyaltyShare4 = this.getRoyaltyShares(request.royaltyShares), royaltyShares = _this$getRoyaltyShare4.royaltyShares;
|
6950
6837
|
_context21.next = 5;
|
6951
6838
|
return this.validateDerivativeData(request.derivData);
|
6952
6839
|
case 5:
|
6953
6840
|
derivData = _context21.sent;
|
6954
6841
|
_object11 = {
|
6955
|
-
spgNftContract:
|
6842
|
+
spgNftContract: validateAddress(request.spgNftContract),
|
6956
6843
|
recipient: nftRecipient,
|
6957
6844
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
6958
6845
|
derivData: derivData,
|
@@ -7038,7 +6925,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
7038
6925
|
}
|
7039
6926
|
throw new Error("The balance of the IP account in the IP Royalty Vault is insufficient to distribute the royalty tokens.");
|
7040
6927
|
case 7:
|
7041
|
-
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet,
|
6928
|
+
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(ipId));
|
7042
6929
|
_context22.next = 10;
|
7043
6930
|
return ipAccount.state();
|
7044
6931
|
case 10:
|
@@ -7107,7 +6994,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
7107
6994
|
_context23.next = 2;
|
7108
6995
|
return this.ipAssetRegistryClient.ipId({
|
7109
6996
|
chainId: BigInt(chain[this.chainId]),
|
7110
|
-
tokenContract:
|
6997
|
+
tokenContract: validateAddress(nftContract),
|
7111
6998
|
tokenId: BigInt(tokenId)
|
7112
6999
|
});
|
7113
7000
|
case 2:
|
@@ -7133,7 +7020,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
7133
7020
|
case 0:
|
7134
7021
|
_context24.next = 2;
|
7135
7022
|
return this.ipAssetRegistryClient.isRegistered({
|
7136
|
-
id:
|
7023
|
+
id: validateAddress(ipId)
|
7137
7024
|
});
|
7138
7025
|
case 2:
|
7139
7026
|
return _context24.abrupt("return", _context24.sent);
|
@@ -7316,54 +7203,54 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
7316
7203
|
}, {
|
7317
7204
|
key: "validateDerivativeData",
|
7318
7205
|
value: function () {
|
7319
|
-
var _validateDerivativeData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(
|
7320
|
-
var
|
7206
|
+
var _validateDerivativeData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(derivativeDataInput) {
|
7207
|
+
var derivativeData, i, parentId, isParentIpRegistered, isAttachedLicenseTerms, _yield$this$licenseRe, royaltyPercent;
|
7321
7208
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
7322
7209
|
while (1) switch (_context28.prev = _context28.next) {
|
7323
7210
|
case 0:
|
7324
|
-
|
7325
|
-
parentIpIds:
|
7326
|
-
licenseTermsIds:
|
7211
|
+
derivativeData = {
|
7212
|
+
parentIpIds: derivativeDataInput.parentIpIds,
|
7213
|
+
licenseTermsIds: derivativeDataInput.licenseTermsIds.map(function (id) {
|
7327
7214
|
return BigInt(id);
|
7328
7215
|
}),
|
7329
|
-
licenseTemplate:
|
7216
|
+
licenseTemplate: validateAddress(derivativeDataInput.licenseTemplate || this.licenseTemplateClient.address),
|
7330
7217
|
royaltyContext: zeroAddress,
|
7331
|
-
maxMintingFee: BigInt(
|
7332
|
-
maxRts: Number(
|
7333
|
-
maxRevenueShare: getRevenueShare(
|
7218
|
+
maxMintingFee: BigInt(derivativeDataInput.maxMintingFee || 0),
|
7219
|
+
maxRts: Number(derivativeDataInput.maxRts || MAX_ROYALTY_TOKEN),
|
7220
|
+
maxRevenueShare: getRevenueShare(derivativeDataInput.maxRevenueShare || 100, RevShareType.MAX_REVENUE_SHARE)
|
7334
7221
|
};
|
7335
|
-
if (!(
|
7222
|
+
if (!(derivativeData.parentIpIds.length === 0)) {
|
7336
7223
|
_context28.next = 3;
|
7337
7224
|
break;
|
7338
7225
|
}
|
7339
7226
|
throw new Error("The parent IP IDs must be provided.");
|
7340
7227
|
case 3:
|
7341
|
-
if (!(
|
7228
|
+
if (!(derivativeData.licenseTermsIds.length === 0)) {
|
7342
7229
|
_context28.next = 5;
|
7343
7230
|
break;
|
7344
7231
|
}
|
7345
7232
|
throw new Error("The license terms IDs must be provided.");
|
7346
7233
|
case 5:
|
7347
|
-
if (!(
|
7234
|
+
if (!(derivativeData.parentIpIds.length !== derivativeData.licenseTermsIds.length)) {
|
7348
7235
|
_context28.next = 7;
|
7349
7236
|
break;
|
7350
7237
|
}
|
7351
7238
|
throw new Error("The number of parent IP IDs must match the number of license terms IDs.");
|
7352
7239
|
case 7:
|
7353
|
-
if (!(
|
7240
|
+
if (!(derivativeData.maxMintingFee < 0)) {
|
7354
7241
|
_context28.next = 9;
|
7355
7242
|
break;
|
7356
7243
|
}
|
7357
7244
|
throw new Error("The maxMintingFee must be greater than 0.");
|
7358
7245
|
case 9:
|
7359
|
-
this.validateMaxRts(
|
7246
|
+
this.validateMaxRts(derivativeData.maxRts);
|
7360
7247
|
i = 0;
|
7361
7248
|
case 11:
|
7362
|
-
if (!(i <
|
7249
|
+
if (!(i < derivativeData.parentIpIds.length)) {
|
7363
7250
|
_context28.next = 32;
|
7364
7251
|
break;
|
7365
7252
|
}
|
7366
|
-
parentId =
|
7253
|
+
parentId = derivativeData.parentIpIds[i];
|
7367
7254
|
_context28.next = 15;
|
7368
7255
|
return this.isRegistered(parentId);
|
7369
7256
|
case 15:
|
@@ -7377,8 +7264,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
7377
7264
|
_context28.next = 20;
|
7378
7265
|
return this.licenseRegistryReadOnlyClient.hasIpAttachedLicenseTerms({
|
7379
7266
|
ipId: parentId,
|
7380
|
-
licenseTemplate:
|
7381
|
-
licenseTermsId:
|
7267
|
+
licenseTemplate: derivativeData.licenseTemplate,
|
7268
|
+
licenseTermsId: derivativeData.licenseTermsIds[i]
|
7382
7269
|
});
|
7383
7270
|
case 20:
|
7384
7271
|
isAttachedLicenseTerms = _context28.sent;
|
@@ -7386,28 +7273,28 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
7386
7273
|
_context28.next = 23;
|
7387
7274
|
break;
|
7388
7275
|
}
|
7389
|
-
throw new Error("License terms id ".concat(
|
7276
|
+
throw new Error("License terms id ".concat(derivativeData.licenseTermsIds[i], " must be attached to the parent ipId ").concat(derivativeData.parentIpIds[i], " before registering derivative."));
|
7390
7277
|
case 23:
|
7391
7278
|
_context28.next = 25;
|
7392
7279
|
return this.licenseRegistryReadOnlyClient.getRoyaltyPercent({
|
7393
7280
|
ipId: parentId,
|
7394
|
-
licenseTemplate:
|
7395
|
-
licenseTermsId:
|
7281
|
+
licenseTemplate: derivativeData.licenseTemplate,
|
7282
|
+
licenseTermsId: derivativeData.licenseTermsIds[i]
|
7396
7283
|
});
|
7397
7284
|
case 25:
|
7398
7285
|
_yield$this$licenseRe = _context28.sent;
|
7399
7286
|
royaltyPercent = _yield$this$licenseRe.royaltyPercent;
|
7400
|
-
if (!(
|
7287
|
+
if (!(derivativeData.maxRevenueShare !== 0 && royaltyPercent > derivativeData.maxRevenueShare)) {
|
7401
7288
|
_context28.next = 29;
|
7402
7289
|
break;
|
7403
7290
|
}
|
7404
|
-
throw new Error("The royalty percent for the parent IP with id ".concat(parentId, " is greater than the maximum revenue share ").concat(
|
7291
|
+
throw new Error("The royalty percent for the parent IP with id ".concat(parentId, " is greater than the maximum revenue share ").concat(derivativeData.maxRevenueShare, "."));
|
7405
7292
|
case 29:
|
7406
7293
|
i++;
|
7407
7294
|
_context28.next = 11;
|
7408
7295
|
break;
|
7409
7296
|
case 32:
|
7410
|
-
return _context28.abrupt("return",
|
7297
|
+
return _context28.abrupt("return", derivativeData);
|
7411
7298
|
case 33:
|
7412
7299
|
case "end":
|
7413
7300
|
return _context28.stop();
|
@@ -7509,13 +7396,17 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
7509
7396
|
}
|
7510
7397
|
_context30.next = 15;
|
7511
7398
|
return calculateLicenseWipMintFee({
|
7512
|
-
|
7513
|
-
|
7514
|
-
|
7515
|
-
|
7516
|
-
|
7517
|
-
|
7518
|
-
|
7399
|
+
predictMintingFeeRequest: {
|
7400
|
+
licensorIpId: derivData.parentIpIds[i],
|
7401
|
+
licenseTemplate: derivData.licenseTemplate,
|
7402
|
+
licenseTermsId: derivData.licenseTermsIds[i],
|
7403
|
+
receiver: sender,
|
7404
|
+
amount: 1n,
|
7405
|
+
royaltyContext: zeroAddress
|
7406
|
+
},
|
7407
|
+
rpcClient: this.rpcClient,
|
7408
|
+
chainId: this.chainId,
|
7409
|
+
walletAddress: this.walletAddress
|
7519
7410
|
});
|
7520
7411
|
case 15:
|
7521
7412
|
derivativeMintingFee = _context30.sent;
|
@@ -7600,24 +7491,13 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
7600
7491
|
}
|
7601
7492
|
|
7602
7493
|
/**
|
7603
|
-
* Sets the permission for a specific function call
|
7494
|
+
* Sets the permission for a specific function call.
|
7604
7495
|
* Each policy is represented as a mapping from an IP account address to a signer address to a recipient
|
7605
|
-
* address to a function selector to a permission level. The permission level
|
7606
|
-
*
|
7607
|
-
* By default, all policies are set to 0 (ABSTAIN), which means that the permission is not set.
|
7496
|
+
* address to a function selector to a permission level. The permission level is an enum of `AccessPermission`.
|
7497
|
+
* By default, all policies are set to ABSTAIN, which means that the permission is not set.
|
7608
7498
|
* The owner of ipAccount by default has all permission.
|
7609
|
-
*
|
7610
|
-
*
|
7611
|
-
* Specific permission overrides wildcard permission.
|
7612
|
-
* @param request - The request object containing necessary data to set `permission`.
|
7613
|
-
* @param request.ipId The IP ID that grants the permission for `signer`.
|
7614
|
-
* @param request.signer The address that can call `to` on behalf of the `ipAccount`.
|
7615
|
-
* @param request.to The address that can be called by the `signer` (currently only modules can be `to`).
|
7616
|
-
* @param request.permission The new permission level.
|
7617
|
-
* @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.
|
7618
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
7619
|
-
* @returns A Promise that resolves to an object containing the transaction hash.
|
7620
|
-
* @emits PermissionSet (ipAccountOwner, ipAccount, signer, to, func, permission)
|
7499
|
+
*
|
7500
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/access/IAccessController.sol#L13 | `PermissionSet`} event.
|
7621
7501
|
*/
|
7622
7502
|
return _createClass(PermissionClient, [{
|
7623
7503
|
key: "setPermission",
|
@@ -7687,16 +7567,8 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
7687
7567
|
}()
|
7688
7568
|
/**
|
7689
7569
|
* Specific permission overrides wildcard permission with signature.
|
7690
|
-
*
|
7691
|
-
*
|
7692
|
-
* @param request.signer The address that can call `to` on behalf of the `ipAccount`
|
7693
|
-
* @param request.to The address that can be called by the `signer` (currently only modules can be `to`)
|
7694
|
-
* @param request.permission The new permission level.
|
7695
|
-
* @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.
|
7696
|
-
* @param request.deadline [Optional] The deadline for the signature in seconds, default is 1000s.
|
7697
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
7698
|
-
* @returns A Promise that resolves to an object containing the transaction hash.
|
7699
|
-
* @emits PermissionSet (ipAccountOwner, ipAccount, signer, to, func, permission)
|
7570
|
+
*
|
7571
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/access/IAccessController.sol#L13 | `PermissionSet`} event.
|
7700
7572
|
*/
|
7701
7573
|
)
|
7702
7574
|
}, {
|
@@ -7716,7 +7588,7 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
7716
7588
|
data = encodeFunctionData({
|
7717
7589
|
abi: accessControllerAbi,
|
7718
7590
|
functionName: "setTransientPermission",
|
7719
|
-
args: [ipId,
|
7591
|
+
args: [ipId, validateAddress(signer), validateAddress(to), func ? toFunctionSelector(func) : defaultFunctionSelector, permission]
|
7720
7592
|
});
|
7721
7593
|
_context2.next = 8;
|
7722
7594
|
return ipAccountClient.state();
|
@@ -7747,7 +7619,7 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
7747
7619
|
_yield$getPermissionS = _context2.sent;
|
7748
7620
|
signature = _yield$getPermissionS.signature;
|
7749
7621
|
req = {
|
7750
|
-
to:
|
7622
|
+
to: validateAddress(this.accessControllerClient.address),
|
7751
7623
|
value: BigInt(0),
|
7752
7624
|
data: data,
|
7753
7625
|
signer: signer,
|
@@ -7803,13 +7675,8 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
7803
7675
|
}()
|
7804
7676
|
/**
|
7805
7677
|
* Sets permission to a signer for all functions across all modules.
|
7806
|
-
*
|
7807
|
-
*
|
7808
|
-
* @param request.signer The address of the signer receiving the permissions.
|
7809
|
-
* @param request.permission The new permission.
|
7810
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
7811
|
-
* @returns A Promise that resolves to an object containing the transaction hash
|
7812
|
-
* @emits PermissionSet (ipAccountOwner, ipAccount, signer, to, func, permission)
|
7678
|
+
*
|
7679
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/access/IAccessController.sol#L13 | `PermissionSet`} event.
|
7813
7680
|
*/
|
7814
7681
|
)
|
7815
7682
|
}, {
|
@@ -7878,17 +7745,8 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
7878
7745
|
}()
|
7879
7746
|
/**
|
7880
7747
|
* Sets a batch of permissions in a single transaction.
|
7881
|
-
*
|
7882
|
-
*
|
7883
|
-
* @param request.permissions[].ipId The IP ID that grants the permission for `signer`.
|
7884
|
-
* @param request.permissions[].signer The address that can call `to` on behalf of the `ipAccount`.
|
7885
|
-
* @param request.permissions[].to The address that can be called by the `signer` (currently only modules can be `to`).
|
7886
|
-
* @param request.permissions[].permission The new permission level.
|
7887
|
-
* @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.
|
7888
|
-
* @param request.deadline [Optional] The deadline for the signature in milliseconds, default is 1000ms.
|
7889
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
7890
|
-
* @returns A Promise that resolves to an object containing the transaction hash
|
7891
|
-
* @emits PermissionSet (ipAccountOwner, ipAccount, signer, to, func, permission)
|
7748
|
+
*
|
7749
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/access/IAccessController.sol#L13 | `PermissionSet`} event.
|
7892
7750
|
*/
|
7893
7751
|
)
|
7894
7752
|
}, {
|
@@ -7987,18 +7845,8 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
7987
7845
|
}()
|
7988
7846
|
/**
|
7989
7847
|
* Sets a batch of permissions in a single transaction with signature.
|
7990
|
-
*
|
7991
|
-
*
|
7992
|
-
* @param {Array} request.permissions - An array of `Permission` structure, each representing the permission to be set.
|
7993
|
-
* @param request.permissions[].ipId The IP ID that grants the permission for `signer`.
|
7994
|
-
* @param request.permissions[].signer The address that can call `to` on behalf of the `ipAccount`.
|
7995
|
-
* @param request.permissions[].to The address that can be called by the `signer` (currently only modules can be `to`).
|
7996
|
-
* @param request.permissions[].permission The new permission level.
|
7997
|
-
* @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.
|
7998
|
-
* @param request.deadline [Optional] The deadline for the signature in seconds, default is 1000s.
|
7999
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
8000
|
-
* @returns A Promise that resolves to an object containing the transaction hash.
|
8001
|
-
* @emits PermissionSet (ipAccountOwner, ipAccount, signer, to, func, permission)
|
7848
|
+
*
|
7849
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/access/IAccessController.sol#L13 | `PermissionSet`} event.
|
8002
7850
|
*/
|
8003
7851
|
)
|
8004
7852
|
}, {
|
@@ -8074,10 +7922,10 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
8074
7922
|
_yield$getPermissionS2 = _context5.sent;
|
8075
7923
|
signature = _yield$getPermissionS2.signature;
|
8076
7924
|
req = {
|
8077
|
-
to:
|
7925
|
+
to: validateAddress(this.accessControllerClient.address),
|
8078
7926
|
value: BigInt(0),
|
8079
7927
|
data: data,
|
8080
|
-
signer:
|
7928
|
+
signer: validateAddress(this.wallet.account.address),
|
8081
7929
|
deadline: calculatedDeadline,
|
8082
7930
|
signature: signature
|
8083
7931
|
};
|
@@ -8138,7 +7986,7 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
8138
7986
|
case 0:
|
8139
7987
|
_context6.next = 2;
|
8140
7988
|
return this.ipAssetRegistryClient.isRegistered({
|
8141
|
-
id:
|
7989
|
+
id: validateAddress(ipId)
|
8142
7990
|
});
|
8143
7991
|
case 2:
|
8144
7992
|
isRegistered = _context6.sent;
|
@@ -8180,27 +8028,8 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8180
8028
|
}
|
8181
8029
|
/**
|
8182
8030
|
* Registers new license terms and return the ID of the newly registered license terms.
|
8183
|
-
*
|
8184
|
-
*
|
8185
|
-
* @param request.royaltyPolicy The address of the royalty policy contract which required to StoryProtocol in advance.
|
8186
|
-
* @param request.mintingFee The fee to be paid when minting a license.
|
8187
|
-
* @param request.expiration The expiration period of the license.
|
8188
|
-
* @param request.commercialUse Indicates whether the work can be used commercially or not.
|
8189
|
-
* @param request.commercialAttribution Whether attribution is required when reproducing the work commercially or not.
|
8190
|
-
* @param request.commercializerChecker Commercializers that are allowed to commercially exploit the work. If zero address, then no restrictions is enforced.
|
8191
|
-
* @param request.commercializerCheckerData The data to be passed to the commercializer checker contract.
|
8192
|
-
* @param request.commercialRevShare Percentage of revenue that must be shared with the licensor.
|
8193
|
-
* @param request.commercialRevCeiling The maximum revenue that can be generated from the commercial use of the work.
|
8194
|
-
* @param request.derivativesAllowed Indicates whether the licensee can create derivatives of his work or not.
|
8195
|
-
* @param request.derivativesAttribution Indicates whether attribution is required for derivatives of the work or not.
|
8196
|
-
* @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.
|
8197
|
-
* @param request.derivativesReciprocal Indicates whether the licensee must license derivatives of the work under the same terms or not.
|
8198
|
-
* @param request.derivativeRevCeiling The maximum revenue that can be generated from the derivative use of the work.
|
8199
|
-
* @param request.currency The ERC20 token to be used to pay the minting fee. the token must be registered in story protocol.
|
8200
|
-
* @param request.uri The URI of the license terms, which can be used to fetch the offchain license terms.
|
8201
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
8202
|
-
* @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.
|
8203
|
-
* @emits LicenseTermsRegistered (licenseTermsId, licenseTemplate, licenseTerms);
|
8031
|
+
*
|
8032
|
+
* 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.
|
8204
8033
|
*/
|
8205
8034
|
return _createClass(LicenseClient, [{
|
8206
8035
|
key: "registerPILTerms",
|
@@ -8282,10 +8111,8 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8282
8111
|
}()
|
8283
8112
|
/**
|
8284
8113
|
* Convenient function to register a PIL non commercial social remix license to the registry
|
8285
|
-
*
|
8286
|
-
*
|
8287
|
-
* @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.
|
8288
|
-
* @emits LicenseTermsRegistered (licenseTermsId, licenseTemplate, licenseTerms);
|
8114
|
+
*
|
8115
|
+
* 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.
|
8289
8116
|
*/
|
8290
8117
|
)
|
8291
8118
|
}, {
|
@@ -8365,13 +8192,8 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8365
8192
|
}()
|
8366
8193
|
/**
|
8367
8194
|
* Convenient function to register a PIL commercial use license to the registry.
|
8368
|
-
*
|
8369
|
-
*
|
8370
|
-
* @param request.currency The ERC20 token to be used to pay the minting fee and the token must be registered in story protocol.
|
8371
|
-
* @param request.royaltyPolicyAddress [Optional] The address of the royalty policy contract, default value is LAP.
|
8372
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
8373
|
-
* @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.
|
8374
|
-
* @emits LicenseTermsRegistered (licenseTermsId, licenseTemplate, licenseTerms);
|
8195
|
+
*
|
8196
|
+
* 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.
|
8375
8197
|
*/
|
8376
8198
|
)
|
8377
8199
|
}, {
|
@@ -8386,7 +8208,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8386
8208
|
licenseTerms = getLicenseTermByType(PIL_TYPE.COMMERCIAL_USE, {
|
8387
8209
|
defaultMintingFee: request.defaultMintingFee,
|
8388
8210
|
currency: request.currency,
|
8389
|
-
royaltyPolicyAddress:
|
8211
|
+
royaltyPolicyAddress: validateAddress(request.royaltyPolicyAddress || royaltyPolicyLapAddress[chain[this.chainId]])
|
8390
8212
|
});
|
8391
8213
|
_context3.next = 4;
|
8392
8214
|
return this.getLicenseTermsId(licenseTerms);
|
@@ -8455,14 +8277,8 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8455
8277
|
}()
|
8456
8278
|
/**
|
8457
8279
|
* Convenient function to register a PIL commercial Remix license to the registry.
|
8458
|
-
*
|
8459
|
-
*
|
8460
|
-
* @param request.commercialRevShare Percentage of revenue that must be shared with the licensor.
|
8461
|
-
* @param request.currency The ERC20 token to be used to pay the minting fee. the token must be registered in story protocol.
|
8462
|
-
* @param request.royaltyPolicyAddress [Optional] The address of the royalty policy contract, default value is LAP.
|
8463
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
8464
|
-
* @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.
|
8465
|
-
* @emits LicenseTermsRegistered (licenseTermsId, licenseTemplate, licenseTerms);
|
8280
|
+
*
|
8281
|
+
* 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.
|
8466
8282
|
*/
|
8467
8283
|
)
|
8468
8284
|
}, {
|
@@ -8477,7 +8293,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8477
8293
|
licenseTerms = getLicenseTermByType(PIL_TYPE.COMMERCIAL_REMIX, {
|
8478
8294
|
defaultMintingFee: request.defaultMintingFee,
|
8479
8295
|
currency: request.currency,
|
8480
|
-
royaltyPolicyAddress:
|
8296
|
+
royaltyPolicyAddress: validateAddress(request.royaltyPolicyAddress || royaltyPolicyLapAddress[chain[this.chainId]]),
|
8481
8297
|
commercialRevShare: request.commercialRevShare
|
8482
8298
|
});
|
8483
8299
|
_context4.next = 4;
|
@@ -8547,13 +8363,6 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8547
8363
|
}()
|
8548
8364
|
/**
|
8549
8365
|
* Attaches license terms to an IP.
|
8550
|
-
* @param request - The request object that contains all data needed to attach license terms.
|
8551
|
-
* @param request.ipId The address of the IP to which the license terms are attached.
|
8552
|
-
* @param request.licenseTemplate The address of the license template, default value is Programmable IP License.
|
8553
|
-
* @param request.licenseTermsId The ID of the license terms.
|
8554
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
8555
|
-
* @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.
|
8556
|
-
* If Ip have attached license terms, success will return false and txhash is empty.
|
8557
8366
|
*/
|
8558
8367
|
)
|
8559
8368
|
}, {
|
@@ -8568,7 +8377,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8568
8377
|
request.licenseTermsId = BigInt(request.licenseTermsId);
|
8569
8378
|
_context5.next = 4;
|
8570
8379
|
return this.ipAssetRegistryClient.isRegistered({
|
8571
|
-
id:
|
8380
|
+
id: validateAddress(request.ipId)
|
8572
8381
|
});
|
8573
8382
|
case 4:
|
8574
8383
|
isRegistered = _context5.sent;
|
@@ -8593,7 +8402,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8593
8402
|
_context5.next = 14;
|
8594
8403
|
return this.licenseRegistryReadOnlyClient.hasIpAttachedLicenseTerms({
|
8595
8404
|
ipId: request.ipId,
|
8596
|
-
licenseTemplate:
|
8405
|
+
licenseTemplate: validateAddress(request.licenseTemplate || this.licenseTemplateClient.address),
|
8597
8406
|
licenseTermsId: request.licenseTermsId
|
8598
8407
|
});
|
8599
8408
|
case 14:
|
@@ -8661,27 +8470,18 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8661
8470
|
}()
|
8662
8471
|
/**
|
8663
8472
|
* Mints license tokens for the license terms attached to an IP.
|
8664
|
-
* The license tokens are minted to the receiver.
|
8665
|
-
* The license terms must be attached to the IP before calling this function.
|
8666
|
-
* But it can mint license token of default license terms without attaching the default license terms,
|
8667
|
-
* since it is attached to all IPs by default.
|
8668
|
-
* IP owners can mint license tokens for their IPs for arbitrary license terms
|
8669
|
-
* without attaching the license terms to IP.
|
8670
8473
|
* It might require the caller pay the minting fee, depending on the license terms or configured by the iP owner.
|
8671
8474
|
* The minting fee is paid in the minting fee token specified in the license terms or configured by the IP owner.
|
8672
|
-
* IP owners can configure the minting fee of their IPs or
|
8673
|
-
*
|
8674
|
-
* @
|
8675
|
-
*
|
8676
|
-
*
|
8677
|
-
*
|
8678
|
-
*
|
8679
|
-
*
|
8680
|
-
*
|
8681
|
-
*
|
8682
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
8683
|
-
* @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.
|
8684
|
-
* @emits LicenseTokensMinted (msg.sender, licensorIpId, licenseTemplate, licenseTermsId, amount, receiver, startLicenseTokenId);
|
8475
|
+
* IP owners can configure the minting fee of their IPs or configure the minting fee module to determine the minting fee.
|
8476
|
+
*
|
8477
|
+
* @remarks
|
8478
|
+
* Before minting license tokens, the license terms must be attached to the IP, with two exceptions:
|
8479
|
+
* 1. Default license terms can be minted without explicit attachment since they are automatically
|
8480
|
+
* attached to all IPs by default
|
8481
|
+
* 2. IP owners have special privileges and can mint license tokens for their own IPs using any
|
8482
|
+
* license terms, even if those terms are not explicitly attached
|
8483
|
+
*
|
8484
|
+
* 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.
|
8685
8485
|
*/
|
8686
8486
|
)
|
8687
8487
|
}, {
|
@@ -8689,15 +8489,15 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8689
8489
|
value: (function () {
|
8690
8490
|
var _mintLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(request) {
|
8691
8491
|
var _this = this;
|
8692
|
-
var _request$txOptions11, receiver, req, isLicenseIpIdRegistered, isExisted, isAttachedLicenseTerms, encodedTxData, licenseMintingFee, wipSpenders, _yield$contractCallWi, txHash, receipt, targetLogs, startLicenseTokenId, licenseTokenIds, i;
|
8492
|
+
var _request$txOptions11, receiver, req, isLicenseIpIdRegistered, isExisted, ipAccount, ipOwner, isAttachedLicenseTerms, encodedTxData, licenseMintingFee, wipSpenders, _yield$contractCallWi, txHash, receipt, targetLogs, startLicenseTokenId, licenseTokenIds, i;
|
8693
8493
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
8694
8494
|
while (1) switch (_context6.prev = _context6.next) {
|
8695
8495
|
case 0:
|
8696
8496
|
_context6.prev = 0;
|
8697
|
-
receiver =
|
8497
|
+
receiver = validateAddress(request.receiver || this.walletAddress);
|
8698
8498
|
req = {
|
8699
|
-
licensorIpId:
|
8700
|
-
licenseTemplate:
|
8499
|
+
licensorIpId: validateAddress(request.licensorIpId),
|
8500
|
+
licenseTemplate: validateAddress(request.licenseTemplate || this.licenseTemplateClient.address),
|
8701
8501
|
licenseTermsId: BigInt(request.licenseTermsId),
|
8702
8502
|
amount: BigInt(request.amount || 1),
|
8703
8503
|
receiver: receiver,
|
@@ -8713,7 +8513,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8713
8513
|
case 5:
|
8714
8514
|
_context6.next = 7;
|
8715
8515
|
return this.ipAssetRegistryClient.isRegistered({
|
8716
|
-
id:
|
8516
|
+
id: validateAddress(request.licensorIpId)
|
8717
8517
|
});
|
8718
8518
|
case 7:
|
8719
8519
|
isLicenseIpIdRegistered = _context6.sent;
|
@@ -8735,40 +8535,46 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8735
8535
|
}
|
8736
8536
|
throw new Error("License terms id ".concat(request.licenseTermsId, " do not exist."));
|
8737
8537
|
case 15:
|
8738
|
-
|
8538
|
+
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, req.licensorIpId);
|
8539
|
+
_context6.next = 18;
|
8540
|
+
return ipAccount.owner();
|
8541
|
+
case 18:
|
8542
|
+
ipOwner = _context6.sent;
|
8543
|
+
if (!(ipOwner !== this.walletAddress)) {
|
8544
|
+
_context6.next = 25;
|
8545
|
+
break;
|
8546
|
+
}
|
8547
|
+
_context6.next = 22;
|
8739
8548
|
return this.licenseRegistryReadOnlyClient.hasIpAttachedLicenseTerms({
|
8740
|
-
ipId:
|
8741
|
-
licenseTemplate:
|
8549
|
+
ipId: req.licensorIpId,
|
8550
|
+
licenseTemplate: validateAddress(req.licenseTemplate || this.licenseTemplateClient.address),
|
8742
8551
|
licenseTermsId: req.licenseTermsId
|
8743
8552
|
});
|
8744
|
-
case
|
8553
|
+
case 22:
|
8745
8554
|
isAttachedLicenseTerms = _context6.sent;
|
8746
8555
|
if (isAttachedLicenseTerms) {
|
8747
|
-
_context6.next =
|
8556
|
+
_context6.next = 25;
|
8748
8557
|
break;
|
8749
8558
|
}
|
8750
|
-
throw new Error("License terms id ".concat(
|
8751
|
-
case
|
8559
|
+
throw new Error("License terms id ".concat(req.licenseTermsId, " is not attached to the IP with id ").concat(req.licensorIpId, "."));
|
8560
|
+
case 25:
|
8752
8561
|
encodedTxData = this.licensingModuleClient.mintLicenseTokensEncode(req);
|
8753
8562
|
if (!((_request$txOptions11 = request.txOptions) !== null && _request$txOptions11 !== void 0 && _request$txOptions11.encodedTxDataOnly)) {
|
8754
|
-
_context6.next =
|
8563
|
+
_context6.next = 28;
|
8755
8564
|
break;
|
8756
8565
|
}
|
8757
8566
|
return _context6.abrupt("return", {
|
8758
8567
|
encodedTxData: encodedTxData
|
8759
8568
|
});
|
8760
|
-
case
|
8761
|
-
_context6.next =
|
8569
|
+
case 28:
|
8570
|
+
_context6.next = 30;
|
8762
8571
|
return calculateLicenseWipMintFee({
|
8763
|
-
|
8764
|
-
|
8765
|
-
|
8766
|
-
|
8767
|
-
licenseTermsId: req.licenseTermsId,
|
8768
|
-
receiver: receiver,
|
8769
|
-
amount: req.amount
|
8572
|
+
predictMintingFeeRequest: req,
|
8573
|
+
rpcClient: this.rpcClient,
|
8574
|
+
chainId: this.chainId,
|
8575
|
+
walletAddress: this.walletAddress
|
8770
8576
|
});
|
8771
|
-
case
|
8577
|
+
case 30:
|
8772
8578
|
licenseMintingFee = _context6.sent;
|
8773
8579
|
wipSpenders = [];
|
8774
8580
|
if (licenseMintingFee > 0n) {
|
@@ -8777,7 +8583,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8777
8583
|
amount: licenseMintingFee
|
8778
8584
|
});
|
8779
8585
|
}
|
8780
|
-
_context6.next =
|
8586
|
+
_context6.next = 35;
|
8781
8587
|
return contractCallWithFees({
|
8782
8588
|
totalFees: licenseMintingFee,
|
8783
8589
|
options: {
|
@@ -8794,18 +8600,18 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8794
8600
|
txOptions: request.txOptions,
|
8795
8601
|
encodedTxs: [encodedTxData]
|
8796
8602
|
});
|
8797
|
-
case
|
8603
|
+
case 35:
|
8798
8604
|
_yield$contractCallWi = _context6.sent;
|
8799
8605
|
txHash = _yield$contractCallWi.txHash;
|
8800
8606
|
receipt = _yield$contractCallWi.receipt;
|
8801
8607
|
if (receipt) {
|
8802
|
-
_context6.next =
|
8608
|
+
_context6.next = 40;
|
8803
8609
|
break;
|
8804
8610
|
}
|
8805
8611
|
return _context6.abrupt("return", {
|
8806
8612
|
txHash: txHash
|
8807
8613
|
});
|
8808
|
-
case
|
8614
|
+
case 40:
|
8809
8615
|
targetLogs = this.licensingModuleClient.parseTxLicenseTokensMintedEvent(receipt);
|
8810
8616
|
startLicenseTokenId = targetLogs[0].startLicenseTokenId;
|
8811
8617
|
licenseTokenIds = [];
|
@@ -8817,15 +8623,15 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8817
8623
|
licenseTokenIds: licenseTokenIds,
|
8818
8624
|
receipt: receipt
|
8819
8625
|
});
|
8820
|
-
case
|
8821
|
-
_context6.prev =
|
8626
|
+
case 47:
|
8627
|
+
_context6.prev = 47;
|
8822
8628
|
_context6.t0 = _context6["catch"](0);
|
8823
8629
|
handleError(_context6.t0, "Failed to mint license tokens");
|
8824
|
-
case
|
8630
|
+
case 50:
|
8825
8631
|
case "end":
|
8826
8632
|
return _context6.stop();
|
8827
8633
|
}
|
8828
|
-
}, _callee6, this, [[0,
|
8634
|
+
}, _callee6, this, [[0, 47]]);
|
8829
8635
|
}));
|
8830
8636
|
function mintLicenseTokens(_x6) {
|
8831
8637
|
return _mintLicenseTokens.apply(this, arguments);
|
@@ -8834,8 +8640,6 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8834
8640
|
}()
|
8835
8641
|
/**
|
8836
8642
|
* Gets license terms of the given ID.
|
8837
|
-
* @param selectedLicenseTermsId The ID of the license terms.
|
8838
|
-
* @returns A Promise that resolves to an object containing the PILTerms associate with the given ID.
|
8839
8643
|
*/
|
8840
8644
|
)
|
8841
8645
|
}, {
|
@@ -8869,20 +8673,12 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8869
8673
|
}()
|
8870
8674
|
/**
|
8871
8675
|
* 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.
|
8872
|
-
* @param request - The request object that contains all data needed to predict minting licenses fee.
|
8873
|
-
* @param request.licensorIpId The IP ID of the licensor.
|
8874
|
-
* @param request.licenseTermsId The ID of the license terms.
|
8875
|
-
* @param request.amount The amount of license tokens to mint.
|
8876
|
-
* @param request.licenseTemplate [Optional] The address of the license template, default value is Programmable IP License.
|
8877
|
-
* @param request.receiver [Optional] The address of the receiver,default value is your wallet address.
|
8878
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
8879
|
-
* @returns A Promise that resolves to an object containing the currency token and token amount.
|
8880
8676
|
*/
|
8881
8677
|
)
|
8882
8678
|
}, {
|
8883
8679
|
key: "predictMintingLicenseFee",
|
8884
8680
|
value: (function () {
|
8885
|
-
var
|
8681
|
+
var _predictMintingLicenseFee2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(request) {
|
8886
8682
|
var isLicenseIpIdRegistered, licenseTermsId, isExisted, object;
|
8887
8683
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
8888
8684
|
while (1) switch (_context8.prev = _context8.next) {
|
@@ -8890,7 +8686,7 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8890
8686
|
_context8.prev = 0;
|
8891
8687
|
_context8.next = 3;
|
8892
8688
|
return this.ipAssetRegistryClient.isRegistered({
|
8893
|
-
id:
|
8689
|
+
id: validateAddress(request.licensorIpId)
|
8894
8690
|
});
|
8895
8691
|
case 3:
|
8896
8692
|
isLicenseIpIdRegistered = _context8.sent;
|
@@ -8914,14 +8710,19 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8914
8710
|
throw new Error("License terms id ".concat(request.licenseTermsId, " do not exist."));
|
8915
8711
|
case 12:
|
8916
8712
|
object = _objectSpread2(_objectSpread2({}, request), {}, {
|
8917
|
-
receiver:
|
8713
|
+
receiver: validateAddress(request.receiver || this.walletAddress),
|
8918
8714
|
amount: BigInt(request.amount),
|
8919
8715
|
royaltyContext: zeroAddress,
|
8920
|
-
licenseTemplate:
|
8716
|
+
licenseTemplate: validateAddress(request.licenseTemplate || this.licenseTemplateClient.address),
|
8921
8717
|
licenseTermsId: licenseTermsId
|
8922
8718
|
});
|
8923
8719
|
_context8.next = 15;
|
8924
|
-
return
|
8720
|
+
return predictMintingLicenseFee({
|
8721
|
+
predictMintingFeeRequest: object,
|
8722
|
+
rpcClient: this.rpcClient,
|
8723
|
+
chainId: this.chainId,
|
8724
|
+
walletAddress: this.walletAddress
|
8725
|
+
});
|
8925
8726
|
case 15:
|
8926
8727
|
return _context8.abrupt("return", _context8.sent);
|
8927
8728
|
case 18:
|
@@ -8934,10 +8735,10 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
8934
8735
|
}
|
8935
8736
|
}, _callee8, this, [[0, 18]]);
|
8936
8737
|
}));
|
8937
|
-
function predictMintingLicenseFee(_x8) {
|
8938
|
-
return
|
8738
|
+
function predictMintingLicenseFee$1(_x8) {
|
8739
|
+
return _predictMintingLicenseFee2.apply(this, arguments);
|
8939
8740
|
}
|
8940
|
-
return predictMintingLicenseFee;
|
8741
|
+
return predictMintingLicenseFee$1;
|
8941
8742
|
}()
|
8942
8743
|
/**
|
8943
8744
|
* 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.
|
@@ -9151,6 +8952,10 @@ var convertHashIPFStoCID = function convertHashIPFStoCID(hash) {
|
|
9151
8952
|
}
|
9152
8953
|
};
|
9153
8954
|
|
8955
|
+
/**
|
8956
|
+
* The ABI for the OptimisticOracleV3 contract. Contract address may be changed.
|
8957
|
+
* @see https://aeneid.storyscan.io/address/0xABac6a158431edED06EE6cba37eDE8779F599eE4?tab=contract_abi
|
8958
|
+
*/
|
9154
8959
|
var ASSERTION_ABI = [{
|
9155
8960
|
inputs: [{
|
9156
8961
|
internalType: "bytes32",
|
@@ -9245,6 +9050,20 @@ var ASSERTION_ABI = [{
|
|
9245
9050
|
outputs: [],
|
9246
9051
|
stateMutability: "nonpayable",
|
9247
9052
|
type: "function"
|
9053
|
+
}, {
|
9054
|
+
inputs: [{
|
9055
|
+
internalType: "address",
|
9056
|
+
name: "currency",
|
9057
|
+
type: "address"
|
9058
|
+
}],
|
9059
|
+
name: "getMinimumBond",
|
9060
|
+
outputs: [{
|
9061
|
+
internalType: "uint256",
|
9062
|
+
name: "",
|
9063
|
+
type: "uint256"
|
9064
|
+
}],
|
9065
|
+
stateMutability: "view",
|
9066
|
+
type: "function"
|
9248
9067
|
}];
|
9249
9068
|
|
9250
9069
|
var getOov3Contract = /*#__PURE__*/function () {
|
@@ -9297,6 +9116,35 @@ var getAssertionDetails = /*#__PURE__*/function () {
|
|
9297
9116
|
return _ref2.apply(this, arguments);
|
9298
9117
|
};
|
9299
9118
|
}();
|
9119
|
+
var getMinimumBond = /*#__PURE__*/function () {
|
9120
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(rpcClient, arbitrationPolicyUmaClient, currency) {
|
9121
|
+
var oov3Contract;
|
9122
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
9123
|
+
while (1) switch (_context3.prev = _context3.next) {
|
9124
|
+
case 0:
|
9125
|
+
_context3.next = 2;
|
9126
|
+
return getOov3Contract(arbitrationPolicyUmaClient);
|
9127
|
+
case 2:
|
9128
|
+
oov3Contract = _context3.sent;
|
9129
|
+
_context3.next = 5;
|
9130
|
+
return rpcClient.readContract({
|
9131
|
+
address: oov3Contract,
|
9132
|
+
abi: ASSERTION_ABI,
|
9133
|
+
functionName: "getMinimumBond",
|
9134
|
+
args: [currency]
|
9135
|
+
});
|
9136
|
+
case 5:
|
9137
|
+
return _context3.abrupt("return", _context3.sent);
|
9138
|
+
case 6:
|
9139
|
+
case "end":
|
9140
|
+
return _context3.stop();
|
9141
|
+
}
|
9142
|
+
}, _callee3);
|
9143
|
+
}));
|
9144
|
+
return function getMinimumBond(_x5, _x6, _x7) {
|
9145
|
+
return _ref3.apply(this, arguments);
|
9146
|
+
};
|
9147
|
+
}();
|
9300
9148
|
|
9301
9149
|
var DisputeClient = /*#__PURE__*/function () {
|
9302
9150
|
function DisputeClient(rpcClient, wallet, chainId) {
|
@@ -9313,53 +9161,51 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9313
9161
|
/**
|
9314
9162
|
* Raises a dispute on a given ipId.
|
9315
9163
|
*
|
9316
|
-
*
|
9317
|
-
* @see {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/dispute/IDisputeModule.sol#L64 | IDisputeModule.sol}
|
9318
|
-
* for a list of on-chain events emitted when a dispute is raised.
|
9319
|
-
*
|
9320
|
-
* @remarks `WipOptions.useMulticallWhenPossible` is disabled for this function due to disputeInitiator issue. It will be executed sequentially with several transactions.
|
9164
|
+
* 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.
|
9321
9165
|
*/
|
9322
9166
|
return _createClass(DisputeClient, [{
|
9323
9167
|
key: "raiseDispute",
|
9324
9168
|
value: (function () {
|
9325
9169
|
var _raiseDispute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
9326
9170
|
var _this = this;
|
9327
|
-
var _request$txOptions, liveness,
|
9171
|
+
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;
|
9328
9172
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
9329
9173
|
while (1) switch (_context.prev = _context.next) {
|
9330
9174
|
case 0:
|
9331
9175
|
_context.prev = 0;
|
9332
9176
|
liveness = BigInt(request.liveness);
|
9333
|
-
|
9334
|
-
tokenAddress = wrappedIpAddress[chain[this.chainId]];
|
9335
|
-
_context.next = 6;
|
9177
|
+
_context.next = 4;
|
9336
9178
|
return Promise.all([this.arbitrationPolicyUmaClient.minLiveness(), this.arbitrationPolicyUmaClient.maxLiveness()]);
|
9337
|
-
case
|
9179
|
+
case 4:
|
9338
9180
|
_yield$Promise$all = _context.sent;
|
9339
9181
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
9340
9182
|
minLiveness = _yield$Promise$all2[0];
|
9341
9183
|
maxLiveness = _yield$Promise$all2[1];
|
9342
|
-
tag = stringToHex(request.targetTag, {
|
9343
|
-
size: 32
|
9344
|
-
});
|
9345
9184
|
if (!(liveness < minLiveness || liveness > maxLiveness)) {
|
9346
|
-
_context.next =
|
9185
|
+
_context.next = 10;
|
9347
9186
|
break;
|
9348
9187
|
}
|
9349
9188
|
throw new Error("Liveness must be between ".concat(minLiveness, " and ").concat(maxLiveness, "."));
|
9350
|
-
case
|
9351
|
-
_context.next =
|
9352
|
-
return this.arbitrationPolicyUmaClient.maxBonds({
|
9353
|
-
token:
|
9354
|
-
});
|
9355
|
-
case
|
9356
|
-
|
9357
|
-
|
9358
|
-
|
9189
|
+
case 10:
|
9190
|
+
_context.next = 12;
|
9191
|
+
return Promise.all([getMinimumBond(this.rpcClient, this.arbitrationPolicyUmaClient, WIP_TOKEN_ADDRESS), this.arbitrationPolicyUmaClient.maxBonds({
|
9192
|
+
token: WIP_TOKEN_ADDRESS
|
9193
|
+
})]);
|
9194
|
+
case 12:
|
9195
|
+
_yield$Promise$all3 = _context.sent;
|
9196
|
+
_yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 2);
|
9197
|
+
minimumBond = _yield$Promise$all4[0];
|
9198
|
+
maximumBond = _yield$Promise$all4[1];
|
9199
|
+
bonds = BigInt(request.bond || minimumBond);
|
9200
|
+
if (!(bonds > maximumBond || bonds < minimumBond)) {
|
9201
|
+
_context.next = 19;
|
9359
9202
|
break;
|
9360
9203
|
}
|
9361
|
-
throw new Error("Bonds must be
|
9362
|
-
case
|
9204
|
+
throw new Error("Bonds must be between ".concat(minimumBond, " and ").concat(maximumBond, "."));
|
9205
|
+
case 19:
|
9206
|
+
tag = stringToHex(request.targetTag, {
|
9207
|
+
size: 32
|
9208
|
+
});
|
9363
9209
|
data = encodeAbiParameters([{
|
9364
9210
|
name: "",
|
9365
9211
|
type: "uint64"
|
@@ -9369,20 +9215,20 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9369
9215
|
}, {
|
9370
9216
|
name: "",
|
9371
9217
|
type: "uint256"
|
9372
|
-
}], [liveness,
|
9373
|
-
_context.next =
|
9218
|
+
}], [liveness, WIP_TOKEN_ADDRESS, bonds]);
|
9219
|
+
_context.next = 23;
|
9374
9220
|
return this.disputeModuleClient.isWhitelistedDisputeTag({
|
9375
9221
|
tag: tag
|
9376
9222
|
});
|
9377
|
-
case
|
9223
|
+
case 23:
|
9378
9224
|
_yield$this$disputeMo = _context.sent;
|
9379
9225
|
isWhiteList = _yield$this$disputeMo.allowed;
|
9380
9226
|
if (isWhiteList) {
|
9381
|
-
_context.next =
|
9227
|
+
_context.next = 27;
|
9382
9228
|
break;
|
9383
9229
|
}
|
9384
9230
|
throw new Error("The target tag ".concat(request.targetTag, " is not whitelisted."));
|
9385
|
-
case
|
9231
|
+
case 27:
|
9386
9232
|
req = {
|
9387
9233
|
targetIpId: validateAddress(request.targetIpId),
|
9388
9234
|
targetTag: tag,
|
@@ -9391,17 +9237,17 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9391
9237
|
};
|
9392
9238
|
encodedTxData = this.disputeModuleClient.raiseDisputeEncode(req);
|
9393
9239
|
if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.encodedTxDataOnly)) {
|
9394
|
-
_context.next =
|
9240
|
+
_context.next = 33;
|
9395
9241
|
break;
|
9396
9242
|
}
|
9397
9243
|
return _context.abrupt("return", {
|
9398
9244
|
encodedTxData: encodedTxData
|
9399
9245
|
});
|
9400
|
-
case
|
9246
|
+
case 33:
|
9401
9247
|
contractCall = function contractCall() {
|
9402
9248
|
return _this.disputeModuleClient.raiseDispute(req);
|
9403
9249
|
};
|
9404
|
-
_context.next =
|
9250
|
+
_context.next = 36;
|
9405
9251
|
return contractCallWithFees({
|
9406
9252
|
totalFees: bonds,
|
9407
9253
|
options: {
|
@@ -9422,35 +9268,35 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9422
9268
|
txOptions: request.txOptions,
|
9423
9269
|
sender: this.wallet.account.address
|
9424
9270
|
});
|
9425
|
-
case
|
9271
|
+
case 36:
|
9426
9272
|
_yield$contractCallWi = _context.sent;
|
9427
9273
|
txHash = _yield$contractCallWi.txHash;
|
9428
9274
|
receipt = _yield$contractCallWi.receipt;
|
9429
9275
|
if (receipt) {
|
9430
|
-
_context.next =
|
9276
|
+
_context.next = 41;
|
9431
9277
|
break;
|
9432
9278
|
}
|
9433
9279
|
return _context.abrupt("return", {
|
9434
9280
|
txHash: txHash
|
9435
9281
|
});
|
9436
|
-
case
|
9282
|
+
case 41:
|
9437
9283
|
targetLogs = this.disputeModuleClient.parseTxDisputeRaisedEvent(receipt);
|
9438
9284
|
return _context.abrupt("return", {
|
9439
9285
|
txHash: txHash,
|
9440
9286
|
disputeId: targetLogs[0].disputeId
|
9441
9287
|
});
|
9442
|
-
case 41:
|
9443
|
-
_context.next = 46;
|
9444
|
-
break;
|
9445
9288
|
case 43:
|
9446
|
-
_context.
|
9289
|
+
_context.next = 48;
|
9290
|
+
break;
|
9291
|
+
case 45:
|
9292
|
+
_context.prev = 45;
|
9447
9293
|
_context.t0 = _context["catch"](0);
|
9448
9294
|
handleError(_context.t0, "Failed to raise dispute");
|
9449
|
-
case
|
9295
|
+
case 48:
|
9450
9296
|
case "end":
|
9451
9297
|
return _context.stop();
|
9452
9298
|
}
|
9453
|
-
}, _callee, this, [[0,
|
9299
|
+
}, _callee, this, [[0, 45]]);
|
9454
9300
|
}));
|
9455
9301
|
function raiseDispute(_x) {
|
9456
9302
|
return _raiseDispute.apply(this, arguments);
|
@@ -9459,16 +9305,8 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9459
9305
|
}()
|
9460
9306
|
/**
|
9461
9307
|
* Cancels an ongoing dispute
|
9462
|
-
*
|
9463
|
-
*
|
9464
|
-
* @param request.data [Optional] additional data used in the cancellation process.
|
9465
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
9466
|
-
* @returns A Promise that resolves to a CancelDisputeResponse containing the transaction hash.
|
9467
|
-
* @throws NotInDisputeState, if the currentTag of the Dispute is not being disputed
|
9468
|
-
* @throws NotDisputeInitiator, if the transaction executor is not the one that initiated the dispute
|
9469
|
-
* @throws error if the Dispute's ArbitrationPolicy contract is not valid
|
9470
|
-
* @calls cancelDispute(uint256 _disputeId, bytes calldata _data) external nonReentrant {
|
9471
|
-
* @emits DisputeCancelled (_disputeId, _data);
|
9308
|
+
*
|
9309
|
+
* 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.
|
9472
9310
|
*/
|
9473
9311
|
)
|
9474
9312
|
}, {
|
@@ -9527,29 +9365,23 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9527
9365
|
return cancelDispute;
|
9528
9366
|
}()
|
9529
9367
|
/**
|
9530
|
-
* Resolves a dispute after it has been judged
|
9531
|
-
*
|
9532
|
-
*
|
9533
|
-
* @param request.data The data to resolve the dispute.
|
9534
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
9535
|
-
* @returns A Promise that resolves to a ResolveDisputeResponse.
|
9536
|
-
* @throws NotAbleToResolve, if currentTag is still in dispute (i.e still needs a judgement to be set)
|
9537
|
-
* @throws NotDisputeInitiator, if the transaction executor is not the one that initiated the dispute
|
9538
|
-
* @emits DisputeResolved (_disputeId)
|
9368
|
+
* Resolves a dispute after it has been judged.
|
9369
|
+
*
|
9370
|
+
* 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.
|
9539
9371
|
*/
|
9540
9372
|
)
|
9541
9373
|
}, {
|
9542
9374
|
key: "resolveDispute",
|
9543
9375
|
value: (function () {
|
9544
9376
|
var _resolveDispute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(request) {
|
9545
|
-
var _request$txOptions4, _req2, _request$txOptions5, txHash;
|
9377
|
+
var _request$data, _request$txOptions4, _req2, _request$txOptions5, txHash;
|
9546
9378
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
9547
9379
|
while (1) switch (_context3.prev = _context3.next) {
|
9548
9380
|
case 0:
|
9549
9381
|
_context3.prev = 0;
|
9550
9382
|
_req2 = {
|
9551
9383
|
disputeId: BigInt(request.disputeId),
|
9552
|
-
data: request.data
|
9384
|
+
data: (_request$data = request.data) !== null && _request$data !== void 0 ? _request$data : "0x"
|
9553
9385
|
};
|
9554
9386
|
if (!((_request$txOptions4 = request.txOptions) !== null && _request$txOptions4 !== void 0 && _request$txOptions4.encodedTxDataOnly)) {
|
9555
9387
|
_context3.next = 6;
|
@@ -9597,8 +9429,7 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9597
9429
|
* Tags a derivative if a parent has been tagged with an infringement tag
|
9598
9430
|
* or a group ip if a group member has been tagged with an infringement tag.
|
9599
9431
|
*
|
9600
|
-
*
|
9601
|
-
* for a list of on-chain events emitted when a derivative is tagged on an infringement.
|
9432
|
+
* 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.
|
9602
9433
|
*/
|
9603
9434
|
)
|
9604
9435
|
}, {
|
@@ -9606,7 +9437,7 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9606
9437
|
value: (function () {
|
9607
9438
|
var _tagIfRelatedIpInfringed = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(request) {
|
9608
9439
|
var _this2 = this;
|
9609
|
-
var _request$options, objects, txHashes, calls, txHash;
|
9440
|
+
var _request$options, objects, txHashes, calls, txHash, _iterator, _step, object, _txHash;
|
9610
9441
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
9611
9442
|
while (1) switch (_context4.prev = _context4.next) {
|
9612
9443
|
case 0:
|
@@ -9636,17 +9467,39 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9636
9467
|
case 7:
|
9637
9468
|
txHash = _context4.sent;
|
9638
9469
|
txHashes.push(txHash);
|
9639
|
-
_context4.next =
|
9470
|
+
_context4.next = 30;
|
9640
9471
|
break;
|
9641
9472
|
case 11:
|
9642
|
-
|
9643
|
-
|
9644
|
-
|
9645
|
-
}));
|
9646
|
-
case 13:
|
9647
|
-
txHashes = _context4.sent;
|
9473
|
+
_iterator = _createForOfIteratorHelper(objects);
|
9474
|
+
_context4.prev = 12;
|
9475
|
+
_iterator.s();
|
9648
9476
|
case 14:
|
9649
|
-
|
9477
|
+
if ((_step = _iterator.n()).done) {
|
9478
|
+
_context4.next = 22;
|
9479
|
+
break;
|
9480
|
+
}
|
9481
|
+
object = _step.value;
|
9482
|
+
_context4.next = 18;
|
9483
|
+
return this.disputeModuleClient.tagIfRelatedIpInfringed(object);
|
9484
|
+
case 18:
|
9485
|
+
_txHash = _context4.sent;
|
9486
|
+
txHashes.push(_txHash);
|
9487
|
+
case 20:
|
9488
|
+
_context4.next = 14;
|
9489
|
+
break;
|
9490
|
+
case 22:
|
9491
|
+
_context4.next = 27;
|
9492
|
+
break;
|
9493
|
+
case 24:
|
9494
|
+
_context4.prev = 24;
|
9495
|
+
_context4.t0 = _context4["catch"](12);
|
9496
|
+
_iterator.e(_context4.t0);
|
9497
|
+
case 27:
|
9498
|
+
_context4.prev = 27;
|
9499
|
+
_iterator.f();
|
9500
|
+
return _context4.finish(27);
|
9501
|
+
case 30:
|
9502
|
+
_context4.next = 32;
|
9650
9503
|
return Promise.all(txHashes.map(function (txHash) {
|
9651
9504
|
return handleTxOptions({
|
9652
9505
|
txHash: txHash,
|
@@ -9654,17 +9507,17 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9654
9507
|
rpcClient: _this2.rpcClient
|
9655
9508
|
});
|
9656
9509
|
}));
|
9657
|
-
case
|
9510
|
+
case 32:
|
9658
9511
|
return _context4.abrupt("return", _context4.sent);
|
9659
|
-
case
|
9660
|
-
_context4.prev =
|
9661
|
-
_context4.
|
9662
|
-
handleError(_context4.
|
9663
|
-
case
|
9512
|
+
case 35:
|
9513
|
+
_context4.prev = 35;
|
9514
|
+
_context4.t1 = _context4["catch"](0);
|
9515
|
+
handleError(_context4.t1, "Failed to tag related ip infringed");
|
9516
|
+
case 38:
|
9664
9517
|
case "end":
|
9665
9518
|
return _context4.stop();
|
9666
9519
|
}
|
9667
|
-
}, _callee4, this, [[0,
|
9520
|
+
}, _callee4, this, [[0, 35], [12, 24, 27, 30]]);
|
9668
9521
|
}));
|
9669
9522
|
function tagIfRelatedIpInfringed(_x4) {
|
9670
9523
|
return _tagIfRelatedIpInfringed.apply(this, arguments);
|
@@ -9673,10 +9526,13 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9673
9526
|
}()
|
9674
9527
|
/**
|
9675
9528
|
* Counters a dispute that was raised by another party on an IP using counter evidence.
|
9529
|
+
* The counter evidence (e.g., documents, images) should be uploaded to IPFS,
|
9530
|
+
* and its corresponding CID is converted to a hash for the request.
|
9676
9531
|
*
|
9677
|
-
*
|
9678
|
-
*
|
9679
|
-
*
|
9532
|
+
* @remarks
|
9533
|
+
* The liveness period is split in two parts:
|
9534
|
+
* - the first part of the liveness period in which only the IP's owner can be called the method.
|
9535
|
+
* - a second part in which any address can be called the method.
|
9680
9536
|
*
|
9681
9537
|
* If you only have a `disputeId`, call {@link disputeIdToAssertionId} to get the `assertionId` needed here.
|
9682
9538
|
*/
|
@@ -9686,7 +9542,7 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9686
9542
|
value: (function () {
|
9687
9543
|
var _disputeAssertion = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(request) {
|
9688
9544
|
var _this3 = this;
|
9689
|
-
var ipAccount, bond, counterEvidenceHash, encodedData, _yield$this$wrappedIp, allowance,
|
9545
|
+
var ipAccount, bond, counterEvidenceHash, encodedData, _yield$this$wrappedIp, allowance, _txHash2, contractCall, _yield$contractCallWi2, txHash, receipt;
|
9690
9546
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
9691
9547
|
while (1) switch (_context5.prev = _context5.next) {
|
9692
9548
|
case 0:
|
@@ -9719,10 +9575,10 @@ var DisputeClient = /*#__PURE__*/function () {
|
|
9719
9575
|
amount: maxUint256
|
9720
9576
|
});
|
9721
9577
|
case 14:
|
9722
|
-
|
9578
|
+
_txHash2 = _context5.sent;
|
9723
9579
|
_context5.next = 17;
|
9724
9580
|
return this.rpcClient.waitForTransactionReceipt({
|
9725
|
-
hash:
|
9581
|
+
hash: _txHash2
|
9726
9582
|
});
|
9727
9583
|
case 17:
|
9728
9584
|
contractCall = function contractCall() {
|
@@ -9848,15 +9704,8 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
9848
9704
|
this.erc20Client = new Erc20Client(rpcClient, wallet);
|
9849
9705
|
}
|
9850
9706
|
|
9851
|
-
/**
|
9852
|
-
*
|
9853
|
-
* @param request.ipId The Ip Id to get ip account.
|
9854
|
-
* @param request.to The recipient of the transaction.
|
9855
|
-
* @param request.value The amount of Ether to send.
|
9856
|
-
* @param request.accountAddress The ipId to send.
|
9857
|
-
* @param request.data The data to send along with the transaction.
|
9858
|
-
* @param request.txOptions - [Optional] transaction. This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
9859
|
-
* @returns Tx hash for the transaction.
|
9707
|
+
/**
|
9708
|
+
* Executes a transaction from the IP Account.
|
9860
9709
|
*/
|
9861
9710
|
return _createClass(IPAccountClient, [{
|
9862
9711
|
key: "execute",
|
@@ -9867,7 +9716,7 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
9867
9716
|
while (1) switch (_context.prev = _context.next) {
|
9868
9717
|
case 0:
|
9869
9718
|
_context.prev = 0;
|
9870
|
-
ipAccountClient = new IpAccountImplClient(this.rpcClient, this.wallet,
|
9719
|
+
ipAccountClient = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(request.ipId));
|
9871
9720
|
req = {
|
9872
9721
|
to: request.to,
|
9873
9722
|
value: BigInt(0),
|
@@ -9919,17 +9768,8 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
9919
9768
|
}
|
9920
9769
|
return execute;
|
9921
9770
|
}()
|
9922
|
-
/**
|
9923
|
-
*
|
9924
|
-
* @param request.ipId The Ip Id to get ip account.
|
9925
|
-
* @param request.to The recipient of the transaction.
|
9926
|
-
* @param request.data The data to send along with the transaction.
|
9927
|
-
* @param request.signer The signer of the transaction.
|
9928
|
-
* @param request.deadline The deadline of the transaction signature.
|
9929
|
-
* @param request.signature The signature of the transaction, EIP-712 encoded.
|
9930
|
-
* @param request.value [Optional] The amount of Ether to send.
|
9931
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
9932
|
-
* @returns Tx hash for the transaction.
|
9771
|
+
/**
|
9772
|
+
* Executes a transaction from the IP Account with a signature.
|
9933
9773
|
*/
|
9934
9774
|
)
|
9935
9775
|
}, {
|
@@ -9941,12 +9781,12 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
9941
9781
|
while (1) switch (_context2.prev = _context2.next) {
|
9942
9782
|
case 0:
|
9943
9783
|
_context2.prev = 0;
|
9944
|
-
ipAccountClient = new IpAccountImplClient(this.rpcClient, this.wallet,
|
9784
|
+
ipAccountClient = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(request.ipId));
|
9945
9785
|
req = {
|
9946
|
-
to:
|
9786
|
+
to: validateAddress(request.to),
|
9947
9787
|
value: BigInt(request.value || 0),
|
9948
9788
|
data: request.data,
|
9949
|
-
signer:
|
9789
|
+
signer: validateAddress(request.signer),
|
9950
9790
|
deadline: BigInt(request.deadline),
|
9951
9791
|
signature: request.signature
|
9952
9792
|
};
|
@@ -9992,9 +9832,8 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
9992
9832
|
}
|
9993
9833
|
return executeWithSig;
|
9994
9834
|
}()
|
9995
|
-
/**
|
9996
|
-
*
|
9997
|
-
* @returns A Promise that resolves to the IP Account's nonce.
|
9835
|
+
/**
|
9836
|
+
* Returns the IPAccount's internal nonce for transaction ordering.
|
9998
9837
|
*/
|
9999
9838
|
)
|
10000
9839
|
}, {
|
@@ -10006,7 +9845,7 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
10006
9845
|
while (1) switch (_context3.prev = _context3.next) {
|
10007
9846
|
case 0:
|
10008
9847
|
_context3.prev = 0;
|
10009
|
-
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet,
|
9848
|
+
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(ipId));
|
10010
9849
|
_context3.next = 4;
|
10011
9850
|
return ipAccount.state();
|
10012
9851
|
case 4:
|
@@ -10030,7 +9869,6 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
10030
9869
|
}()
|
10031
9870
|
/**
|
10032
9871
|
* Returns the identifier of the non-fungible token which owns the account
|
10033
|
-
* @returns A Promise that resolves to an object containing the chain ID, token contract address, and token ID.
|
10034
9872
|
*/
|
10035
9873
|
)
|
10036
9874
|
}, {
|
@@ -10042,7 +9880,7 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
10042
9880
|
while (1) switch (_context4.prev = _context4.next) {
|
10043
9881
|
case 0:
|
10044
9882
|
_context4.prev = 0;
|
10045
|
-
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet,
|
9883
|
+
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(ipId));
|
10046
9884
|
_context4.next = 4;
|
10047
9885
|
return ipAccount.token();
|
10048
9886
|
case 4:
|
@@ -10187,6 +10025,8 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
10187
10025
|
}]);
|
10188
10026
|
}();
|
10189
10027
|
|
10028
|
+
/** The amount of revenue token claimable. */
|
10029
|
+
|
10190
10030
|
/**
|
10191
10031
|
* Native royalty policy created by the Story team
|
10192
10032
|
*/
|
@@ -10227,9 +10067,14 @@ var RoyaltyClient = /*#__PURE__*/function () {
|
|
10227
10067
|
this.walletAddress = wallet.account.address;
|
10228
10068
|
}
|
10229
10069
|
/**
|
10230
|
-
* Claims all revenue from the child IPs of an ancestor IP, then transfer
|
10070
|
+
* Claims all revenue from the child IPs of an ancestor IP, then transfer
|
10231
10071
|
* all claimed tokens to the wallet if the wallet owns the IP or is the claimer.
|
10232
10072
|
* If claimed token is WIP, it will also be converted back to IP.
|
10073
|
+
*
|
10074
|
+
* @remarks
|
10075
|
+
* Even if there are no child IPs, you must still populate {@link ClaimAllRevenueRequest.currencyTokens} with
|
10076
|
+
* the token addresses you wish to claim. This is required for the claim operation to know which
|
10077
|
+
* token balances to process.
|
10233
10078
|
*/
|
10234
10079
|
return _createClass(RoyaltyClient, [{
|
10235
10080
|
key: "claimAllRevenue",
|
@@ -10334,6 +10179,11 @@ var RoyaltyClient = /*#__PURE__*/function () {
|
|
10334
10179
|
* if multicall is disabled, it will call @link{claimAllRevenue} for each ancestor IP.
|
10335
10180
|
* Then transfer all claimed tokens to the wallet if the wallet owns the IP or is the claimer.
|
10336
10181
|
* If claimed token is WIP, it will also be converted back to IP.
|
10182
|
+
*
|
10183
|
+
* @remarks
|
10184
|
+
* Even if there are no child IPs, you must still populate `currencyTokens` in each ancestor IP
|
10185
|
+
* with the token addresses you wish to claim. This is required for the claim operation to know which
|
10186
|
+
* token balances to process.
|
10337
10187
|
*/
|
10338
10188
|
)
|
10339
10189
|
}, {
|
@@ -10666,11 +10516,7 @@ var RoyaltyClient = /*#__PURE__*/function () {
|
|
10666
10516
|
}()
|
10667
10517
|
/**
|
10668
10518
|
* Get total amount of revenue token claimable by a royalty token holder.
|
10669
|
-
*
|
10670
|
-
* @param request.royaltyVaultIpId The id of the royalty vault.
|
10671
|
-
* @param request.claimer The address of the royalty token holder
|
10672
|
-
* @param request.token The revenue token to claim.
|
10673
|
-
* @returns A Promise that contains the amount of revenue token claimable
|
10519
|
+
* Returns the amount of revenue token claimable by the claimer.
|
10674
10520
|
*/
|
10675
10521
|
)
|
10676
10522
|
}, {
|
@@ -10683,14 +10529,14 @@ var RoyaltyClient = /*#__PURE__*/function () {
|
|
10683
10529
|
case 0:
|
10684
10530
|
_context5.prev = 0;
|
10685
10531
|
_context5.next = 3;
|
10686
|
-
return this.getRoyaltyVaultAddress(
|
10532
|
+
return this.getRoyaltyVaultAddress(validateAddress(request.royaltyVaultIpId));
|
10687
10533
|
case 3:
|
10688
10534
|
proxyAddress = _context5.sent;
|
10689
10535
|
ipRoyaltyVault = new IpRoyaltyVaultImplReadOnlyClient(this.rpcClient, proxyAddress);
|
10690
10536
|
_context5.next = 7;
|
10691
10537
|
return ipRoyaltyVault.claimableRevenue({
|
10692
|
-
claimer:
|
10693
|
-
token:
|
10538
|
+
claimer: validateAddress(request.claimer),
|
10539
|
+
token: validateAddress(request.token)
|
10694
10540
|
});
|
10695
10541
|
case 7:
|
10696
10542
|
return _context5.abrupt("return", _context5.sent);
|
@@ -10711,8 +10557,6 @@ var RoyaltyClient = /*#__PURE__*/function () {
|
|
10711
10557
|
}()
|
10712
10558
|
/**
|
10713
10559
|
* Get the royalty vault proxy address of given royaltyVaultIpId.
|
10714
|
-
* @param royaltyVaultIpId the id of the royalty vault.
|
10715
|
-
* @returns A Promise that resolves to an object containing the royalty vault address.
|
10716
10560
|
*/
|
10717
10561
|
)
|
10718
10562
|
}, {
|
@@ -10725,7 +10569,7 @@ var RoyaltyClient = /*#__PURE__*/function () {
|
|
10725
10569
|
case 0:
|
10726
10570
|
_context6.next = 2;
|
10727
10571
|
return this.ipAssetRegistryClient.isRegistered({
|
10728
|
-
id:
|
10572
|
+
id: validateAddress(royaltyVaultIpId)
|
10729
10573
|
});
|
10730
10574
|
case 2:
|
10731
10575
|
isRoyaltyVaultIpIdRegistered = _context6.sent;
|
@@ -10960,21 +10804,9 @@ var NftClient = /*#__PURE__*/function () {
|
|
10960
10804
|
|
10961
10805
|
/**
|
10962
10806
|
* Creates a new SPG NFT Collection.
|
10963
|
-
*
|
10964
|
-
*
|
10965
|
-
*
|
10966
|
-
* @param request.isPublicMinting - If true, anyone can mint from the collection. If false, only the addresses with the minter role can mint.
|
10967
|
-
* @param request.mintOpen Whether the collection is open for minting on creation.
|
10968
|
-
* @param request.mintFeeRecipient - The address to receive mint fees.
|
10969
|
-
* @param request.contractURI - The contract URI for the collection. Follows ERC-7572 standard. See https://eips.ethereum.org/EIPS/eip-7572
|
10970
|
-
* @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.
|
10971
|
-
* @param request.maxSupply - [Optional] The maximum supply of the collection.
|
10972
|
-
* @param request.mintFee - [Optional] The cost to mint a token.
|
10973
|
-
* @param request.mintFeeToken - [Optional] The token to mint.
|
10974
|
-
* @param request.owner - [Optional] The owner of the collection.
|
10975
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
10976
|
-
* @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.
|
10977
|
-
* @emits CollectionCreated (spgNftContract);
|
10807
|
+
*
|
10808
|
+
* Emits an on-chain `CollectionCreated` event.
|
10809
|
+
* @see {@link https://github.com/storyprotocol/protocol-periphery-v1/blob/v1.3.1/contracts/interfaces/workflows/IRegistrationWorkflows.sol#L12 | IRegistrationWorkflows}
|
10978
10810
|
*/
|
10979
10811
|
return _createClass(NftClient, [{
|
10980
10812
|
key: "createNFTCollection",
|
@@ -10999,8 +10831,8 @@ var NftClient = /*#__PURE__*/function () {
|
|
10999
10831
|
maxSupply: (_request$maxSupply = request.maxSupply) !== null && _request$maxSupply !== void 0 ? _request$maxSupply : Number(maxUint32),
|
11000
10832
|
mintFee: (_request$mintFee = request.mintFee) !== null && _request$mintFee !== void 0 ? _request$mintFee : 0n,
|
11001
10833
|
mintFeeToken: (_request$mintFeeToken = request.mintFeeToken) !== null && _request$mintFeeToken !== void 0 ? _request$mintFeeToken : zeroAddress,
|
11002
|
-
owner:
|
11003
|
-
mintFeeRecipient:
|
10834
|
+
owner: validateAddress(request.owner || this.wallet.account.address),
|
10835
|
+
mintFeeRecipient: validateAddress(request.mintFeeRecipient),
|
11004
10836
|
mintOpen: request.mintOpen,
|
11005
10837
|
isPublicMinting: request.isPublicMinting,
|
11006
10838
|
contractURI: request.contractURI
|
@@ -11043,7 +10875,7 @@ var NftClient = /*#__PURE__*/function () {
|
|
11043
10875
|
case 20:
|
11044
10876
|
_context.prev = 20;
|
11045
10877
|
_context.t0 = _context["catch"](0);
|
11046
|
-
handleError(_context.t0, "Failed to create
|
10878
|
+
handleError(_context.t0, "Failed to create an SPG NFT collection");
|
11047
10879
|
case 23:
|
11048
10880
|
case "end":
|
11049
10881
|
return _context.stop();
|
@@ -11126,11 +10958,8 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11126
10958
|
this.royaltyModuleEventClient = new RoyaltyModuleEventClient(rpcClient);
|
11127
10959
|
}
|
11128
10960
|
/** Registers a Group IPA.
|
11129
|
-
*
|
11130
|
-
*
|
11131
|
-
* @param request.txOptions [Optional] This extends `WaitForTransactionReceiptParameters` from the Viem library, excluding the `hash` property.
|
11132
|
-
* @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.
|
11133
|
-
* @emits PGroupRegistered (groupId, groupPool);
|
10961
|
+
*
|
10962
|
+
* 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.
|
11134
10963
|
*/
|
11135
10964
|
return _createClass(GroupClient, [{
|
11136
10965
|
key: "registerGroup",
|
@@ -11142,7 +10971,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11142
10971
|
case 0:
|
11143
10972
|
_context.prev = 0;
|
11144
10973
|
object = {
|
11145
|
-
groupPool:
|
10974
|
+
groupPool: validateAddress(request.groupPool)
|
11146
10975
|
};
|
11147
10976
|
if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.encodedTxDataOnly)) {
|
11148
10977
|
_context.next = 6;
|
@@ -11194,8 +11023,8 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11194
11023
|
return registerGroup;
|
11195
11024
|
}()
|
11196
11025
|
/** 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.
|
11197
|
-
*
|
11198
|
-
*
|
11026
|
+
*
|
11027
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
11199
11028
|
*/
|
11200
11029
|
)
|
11201
11030
|
}, {
|
@@ -11210,7 +11039,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11210
11039
|
groupId = request.groupId, recipient = request.recipient, spgNftContract = request.spgNftContract, deadline = request.deadline;
|
11211
11040
|
_context2.next = 4;
|
11212
11041
|
return this.ipAssetRegistryClient.isRegistered({
|
11213
|
-
id:
|
11042
|
+
id: validateAddress(groupId)
|
11214
11043
|
});
|
11215
11044
|
case 4:
|
11216
11045
|
isRegistered = _context2.sent;
|
@@ -11240,8 +11069,8 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11240
11069
|
chainId: chain[this.chainId],
|
11241
11070
|
permissions: [{
|
11242
11071
|
ipId: groupId,
|
11243
|
-
signer:
|
11244
|
-
to:
|
11072
|
+
signer: validateAddress(this.groupingWorkflowsClient.address),
|
11073
|
+
to: validateAddress(this.groupingModuleClient.address),
|
11245
11074
|
permission: AccessPermission.ALLOW,
|
11246
11075
|
func: getFunctionSignature(groupingModuleAbi, "addIp")
|
11247
11076
|
}]
|
@@ -11251,13 +11080,13 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11251
11080
|
sigAddToGroupSignature = _yield$getPermissionS.signature;
|
11252
11081
|
object = _objectSpread2(_objectSpread2({}, request), {}, {
|
11253
11082
|
allowDuplicates: request.allowDuplicates || true,
|
11254
|
-
spgNftContract:
|
11255
|
-
recipient:
|
11083
|
+
spgNftContract: validateAddress(spgNftContract),
|
11084
|
+
recipient: validateAddress(recipient || this.wallet.account.address),
|
11256
11085
|
maxAllowedRewardShare: BigInt(getRevenueShare(request.maxAllowedRewardShare, RevShareType.MAX_ALLOWED_REWARD_SHARE)),
|
11257
11086
|
licensesData: this.getLicenseData(request.licenseData),
|
11258
11087
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
11259
11088
|
sigAddToGroup: {
|
11260
|
-
signer:
|
11089
|
+
signer: validateAddress(this.wallet.account.address),
|
11261
11090
|
deadline: calculatedDeadline,
|
11262
11091
|
signature: sigAddToGroupSignature
|
11263
11092
|
}
|
@@ -11313,8 +11142,8 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11313
11142
|
return mintAndRegisterIpAndAttachLicenseAndAddToGroup;
|
11314
11143
|
}()
|
11315
11144
|
/** Register an NFT as IP with metadata, attach license terms to the registered IP, and add it to a group IP.
|
11316
|
-
*
|
11317
|
-
*
|
11145
|
+
*
|
11146
|
+
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
11318
11147
|
*/
|
11319
11148
|
)
|
11320
11149
|
}, {
|
@@ -11329,14 +11158,14 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11329
11158
|
_context3.next = 3;
|
11330
11159
|
return this.ipAssetRegistryClient.ipId({
|
11331
11160
|
chainId: BigInt(chain[this.chainId]),
|
11332
|
-
tokenContract:
|
11161
|
+
tokenContract: validateAddress(request.nftContract),
|
11333
11162
|
tokenId: BigInt(request.tokenId)
|
11334
11163
|
});
|
11335
11164
|
case 3:
|
11336
11165
|
ipIdAddress = _context3.sent;
|
11337
11166
|
_context3.next = 6;
|
11338
11167
|
return this.ipAssetRegistryClient.isRegistered({
|
11339
|
-
id:
|
11168
|
+
id: validateAddress(request.groupId)
|
11340
11169
|
});
|
11341
11170
|
case 6:
|
11342
11171
|
isRegistered = _context3.sent;
|
@@ -11359,13 +11188,13 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11359
11188
|
calculatedDeadline = getDeadline(blockTimestamp, request.deadline);
|
11360
11189
|
_context3.next = 20;
|
11361
11190
|
return getPermissionSignature({
|
11362
|
-
ipId:
|
11191
|
+
ipId: request.groupId,
|
11363
11192
|
deadline: calculatedDeadline,
|
11364
11193
|
state: state,
|
11365
11194
|
wallet: this.wallet,
|
11366
11195
|
chainId: chain[this.chainId],
|
11367
11196
|
permissions: [{
|
11368
|
-
ipId:
|
11197
|
+
ipId: request.groupId,
|
11369
11198
|
signer: this.groupingWorkflowsClient.address,
|
11370
11199
|
to: this.groupingModuleClient.address,
|
11371
11200
|
permission: AccessPermission.ALLOW,
|
@@ -11387,19 +11216,19 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11387
11216
|
permissions: [{
|
11388
11217
|
ipId: ipIdAddress,
|
11389
11218
|
signer: this.groupingWorkflowsClient.address,
|
11390
|
-
to:
|
11219
|
+
to: validateAddress(this.coreMetadataModuleClient.address),
|
11391
11220
|
permission: AccessPermission.ALLOW,
|
11392
11221
|
func: getFunctionSignature(coreMetadataModuleAbi, "setAll")
|
11393
11222
|
}, {
|
11394
11223
|
ipId: ipIdAddress,
|
11395
11224
|
signer: this.groupingWorkflowsClient.address,
|
11396
|
-
to:
|
11225
|
+
to: validateAddress(this.licensingModuleClient.address),
|
11397
11226
|
permission: AccessPermission.ALLOW,
|
11398
11227
|
func: getFunctionSignature(licensingModuleAbi, "attachLicenseTerms")
|
11399
11228
|
}, {
|
11400
11229
|
ipId: ipIdAddress,
|
11401
11230
|
signer: this.groupingWorkflowsClient.address,
|
11402
|
-
to:
|
11231
|
+
to: this.licensingModuleClient.address,
|
11403
11232
|
permission: AccessPermission.ALLOW,
|
11404
11233
|
func: getFunctionSignature(licensingModuleAbi, "setLicensingConfig")
|
11405
11234
|
}]
|
@@ -11408,19 +11237,19 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11408
11237
|
_yield$getPermissionS3 = _context3.sent;
|
11409
11238
|
sigMetadataAndAttachSignature = _yield$getPermissionS3.signature;
|
11410
11239
|
object = {
|
11411
|
-
nftContract:
|
11240
|
+
nftContract: request.nftContract,
|
11412
11241
|
groupId: request.groupId,
|
11413
11242
|
licensesData: this.getLicenseData(request.licenseData),
|
11414
11243
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
11415
11244
|
tokenId: BigInt(request.tokenId),
|
11416
11245
|
maxAllowedRewardShare: BigInt(getRevenueShare(request.maxAllowedRewardShare, RevShareType.MAX_ALLOWED_REWARD_SHARE)),
|
11417
11246
|
sigAddToGroup: {
|
11418
|
-
signer:
|
11247
|
+
signer: validateAddress(this.wallet.account.address),
|
11419
11248
|
deadline: calculatedDeadline,
|
11420
11249
|
signature: sigAddToGroupSignature
|
11421
11250
|
},
|
11422
11251
|
sigMetadataAndAttachAndConfig: {
|
11423
|
-
signer:
|
11252
|
+
signer: this.wallet.account.address,
|
11424
11253
|
deadline: calculatedDeadline,
|
11425
11254
|
signature: sigMetadataAndAttachSignature
|
11426
11255
|
}
|
@@ -11473,8 +11302,8 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11473
11302
|
return registerIpAndAttachLicenseAndAddToGroup;
|
11474
11303
|
}()
|
11475
11304
|
/** Register a group IP with a group reward pool and attach license terms to the group IP.
|
11476
|
-
*
|
11477
|
-
*
|
11305
|
+
*
|
11306
|
+
* 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.
|
11478
11307
|
*/
|
11479
11308
|
)
|
11480
11309
|
}, {
|
@@ -11487,7 +11316,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11487
11316
|
case 0:
|
11488
11317
|
_context4.prev = 0;
|
11489
11318
|
object = {
|
11490
|
-
groupPool:
|
11319
|
+
groupPool: validateAddress(request.groupPool),
|
11491
11320
|
licenseData: this.getLicenseData(request.licenseData)[0]
|
11492
11321
|
};
|
11493
11322
|
if (!((_request$txOptions7 = request.txOptions) !== null && _request$txOptions7 !== void 0 && _request$txOptions7.encodedTxDataOnly)) {
|
@@ -11537,8 +11366,8 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11537
11366
|
return registerGroupAndAttachLicense;
|
11538
11367
|
}()
|
11539
11368
|
/** Register a group IP with a group reward pool, attach license terms to the group IP, and add individual IPs to the group IP.
|
11540
|
-
*
|
11541
|
-
*
|
11369
|
+
*
|
11370
|
+
* 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.
|
11542
11371
|
*/
|
11543
11372
|
)
|
11544
11373
|
}, {
|
@@ -11551,7 +11380,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11551
11380
|
case 0:
|
11552
11381
|
_context5.prev = 0;
|
11553
11382
|
object = {
|
11554
|
-
groupPool:
|
11383
|
+
groupPool: validateAddress(request.groupPool),
|
11555
11384
|
ipIds: request.ipIds,
|
11556
11385
|
licenseData: this.getLicenseData(request.licenseData)[0],
|
11557
11386
|
maxAllowedRewardShare: BigInt(getRevenueShare(request.maxAllowedRewardShare))
|
@@ -11564,7 +11393,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11564
11393
|
}
|
11565
11394
|
_context5.next = 6;
|
11566
11395
|
return this.ipAssetRegistryClient.isRegistered({
|
11567
|
-
id:
|
11396
|
+
id: validateAddress(request.ipIds[i])
|
11568
11397
|
});
|
11569
11398
|
case 6:
|
11570
11399
|
isRegistered = _context5.sent;
|
@@ -11803,9 +11632,9 @@ var GroupClient = /*#__PURE__*/function () {
|
|
11803
11632
|
throw new Error("License data is required.");
|
11804
11633
|
}
|
11805
11634
|
var licenseDataArray = isArray ? licenseData : [licenseData];
|
11806
|
-
return licenseDataArray.map(function (item
|
11635
|
+
return licenseDataArray.map(function (item) {
|
11807
11636
|
return {
|
11808
|
-
licenseTemplate:
|
11637
|
+
licenseTemplate: validateAddress(item.licenseTemplate || _this2.licenseTemplateClient.address),
|
11809
11638
|
licenseTermsId: BigInt(item.licenseTermsId),
|
11810
11639
|
licensingConfig: validateLicenseConfig(item.licensingConfig)
|
11811
11640
|
};
|
@@ -12108,9 +11937,6 @@ if (typeof process !== "undefined") {
|
|
12108
11937
|
* The StoryClient is the main entry point for the SDK.
|
12109
11938
|
*/
|
12110
11939
|
var StoryClient = /*#__PURE__*/function () {
|
12111
|
-
/**
|
12112
|
-
* @param config - the configuration for the SDK client
|
12113
|
-
*/
|
12114
11940
|
function StoryClient(config) {
|
12115
11941
|
_classCallCheck(this, StoryClient);
|
12116
11942
|
_defineProperty(this, "_ipAsset", null);
|
@@ -12123,7 +11949,7 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12123
11949
|
_defineProperty(this, "_group", null);
|
12124
11950
|
_defineProperty(this, "_wip", null);
|
12125
11951
|
this.config = _objectSpread2(_objectSpread2({}, config), {}, {
|
12126
|
-
chainId: chain[config.chainId || "
|
11952
|
+
chainId: chain[config.chainId || "1315"]
|
12127
11953
|
});
|
12128
11954
|
if (!this.config.transport) {
|
12129
11955
|
throw new Error("transport is null, please pass in a valid RPC Provider URL as the transport.");
|
@@ -12150,9 +11976,8 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12150
11976
|
return this.config.chainId;
|
12151
11977
|
}
|
12152
11978
|
/**
|
12153
|
-
* Factory method for creating
|
11979
|
+
* Factory method for creating an SDK client with a signer.
|
12154
11980
|
*
|
12155
|
-
* @param config StoryClient - the configuration for a new SDK client
|
12156
11981
|
*/
|
12157
11982
|
}, {
|
12158
11983
|
key: "ipAsset",
|
@@ -12160,8 +11985,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12160
11985
|
/**
|
12161
11986
|
* Getter for the ip asset client. The client is lazily created when
|
12162
11987
|
* this method is called.
|
12163
|
-
*
|
12164
|
-
* @returns the IPAssetClient instance
|
12165
11988
|
*/
|
12166
11989
|
function get() {
|
12167
11990
|
if (this._ipAsset === null) {
|
@@ -12173,8 +11996,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12173
11996
|
/**
|
12174
11997
|
* Getter for the permission client. The client is lazily created when
|
12175
11998
|
* this method is called.
|
12176
|
-
*
|
12177
|
-
* @returns the PermissionClient instance
|
12178
11999
|
*/
|
12179
12000
|
}, {
|
12180
12001
|
key: "permission",
|
@@ -12188,8 +12009,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12188
12009
|
/**
|
12189
12010
|
* Getter for the license client. The client is lazily created when
|
12190
12011
|
* this method is called.
|
12191
|
-
*
|
12192
|
-
* @returns the LicenseClient instance
|
12193
12012
|
*/
|
12194
12013
|
}, {
|
12195
12014
|
key: "license",
|
@@ -12203,8 +12022,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12203
12022
|
/**
|
12204
12023
|
* Getter for the dispute client. The client is lazily created when
|
12205
12024
|
* this method is called.
|
12206
|
-
*
|
12207
|
-
* @returns the DisputeClient instance
|
12208
12025
|
*/
|
12209
12026
|
}, {
|
12210
12027
|
key: "dispute",
|
@@ -12218,8 +12035,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12218
12035
|
/**
|
12219
12036
|
* Getter for the ip account client. The client is lazily created when
|
12220
12037
|
* this method is called.
|
12221
|
-
*
|
12222
|
-
* @returns the IPAccountClient instance
|
12223
12038
|
*/
|
12224
12039
|
}, {
|
12225
12040
|
key: "ipAccount",
|
@@ -12233,8 +12048,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12233
12048
|
/**
|
12234
12049
|
* Getter for the royalty client. The client is lazily created when
|
12235
12050
|
* this method is called.
|
12236
|
-
*
|
12237
|
-
* @returns the RoyaltyClient instance
|
12238
12051
|
*/
|
12239
12052
|
}, {
|
12240
12053
|
key: "royalty",
|
@@ -12248,8 +12061,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12248
12061
|
/**
|
12249
12062
|
* Getter for the NFT client. The client is lazily created when
|
12250
12063
|
* this method is called.
|
12251
|
-
*
|
12252
|
-
* @returns the NftClient instance
|
12253
12064
|
*/
|
12254
12065
|
}, {
|
12255
12066
|
key: "nftClient",
|
@@ -12263,8 +12074,6 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12263
12074
|
/**
|
12264
12075
|
* Getter for the group client. The client is lazily created when
|
12265
12076
|
* this method is called.
|
12266
|
-
*
|
12267
|
-
* @returns the GroupClient instance
|
12268
12077
|
*/
|
12269
12078
|
}, {
|
12270
12079
|
key: "groupClient",
|
@@ -12343,9 +12152,7 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12343
12152
|
}
|
12344
12153
|
|
12345
12154
|
/**
|
12346
|
-
* Factory method for creating
|
12347
|
-
*
|
12348
|
-
* @param config WalletClientConfig - the configuration for a new SDK client
|
12155
|
+
* Factory method for creating an SDK client with a signer.
|
12349
12156
|
*/
|
12350
12157
|
}, {
|
12351
12158
|
key: "newClientUseWallet",
|
@@ -12358,9 +12165,7 @@ var StoryClient = /*#__PURE__*/function () {
|
|
12358
12165
|
}
|
12359
12166
|
|
12360
12167
|
/**
|
12361
|
-
* Factory method for creating
|
12362
|
-
*
|
12363
|
-
* @param config UseAccountStoryConfig - the configuration for a new SDK client
|
12168
|
+
* Factory method for creating an SDK client with a signer.
|
12364
12169
|
*/
|
12365
12170
|
}, {
|
12366
12171
|
key: "newClientUseAccount",
|
@@ -12484,4 +12289,4 @@ var AIRelationship = /*#__PURE__*/function (AIRelationship) {
|
|
12484
12289
|
return AIRelationship;
|
12485
12290
|
}({});
|
12486
12291
|
|
12487
|
-
export { AIRelationship, AccessPermission,
|
12292
|
+
export { AIRelationship, AccessPermission, DisputeClient, GroupClient, IPAccountClient, IPAssetClient, LicenseClient, NativeRoyaltyPolicy, NftClient, PIL_TYPE, PermissionClient, RevShareType, RoyaltyClient, StoryClient, StoryRelationship, WIP_TOKEN_ADDRESS, WipClient, aeneid, convertCIDtoHashIPFS, convertHashIPFStoCID, getPermissionSignature, getSignature, mainnet, royaltyPolicyLapAddress, royaltyPolicyLrpAddress };
|