@story-protocol/core-sdk 1.3.3 → 1.4.0-rc.2

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.
Files changed (30) hide show
  1. package/dist/declarations/src/abi/generated.d.ts +21 -36
  2. package/dist/declarations/src/abi/generated.d.ts.map +1 -1
  3. package/dist/declarations/src/index.d.ts +2 -0
  4. package/dist/declarations/src/index.d.ts.map +1 -1
  5. package/dist/declarations/src/resources/ipAsset.d.ts +17 -1
  6. package/dist/declarations/src/resources/ipAsset.d.ts.map +1 -1
  7. package/dist/declarations/src/resources/license.d.ts +13 -1
  8. package/dist/declarations/src/resources/license.d.ts.map +1 -1
  9. package/dist/declarations/src/types/common.d.ts +13 -5
  10. package/dist/declarations/src/types/common.d.ts.map +1 -1
  11. package/dist/declarations/src/types/resources/group.d.ts +8 -2
  12. package/dist/declarations/src/types/resources/group.d.ts.map +1 -1
  13. package/dist/declarations/src/types/resources/ipAsset.d.ts +12 -0
  14. package/dist/declarations/src/types/resources/ipAsset.d.ts.map +1 -1
  15. package/dist/declarations/src/types/resources/license.d.ts +18 -2
  16. package/dist/declarations/src/types/resources/license.d.ts.map +1 -1
  17. package/dist/declarations/src/types/resources/permission.d.ts +8 -0
  18. package/dist/declarations/src/types/resources/permission.d.ts.map +1 -1
  19. package/dist/declarations/src/types/resources/royalty.d.ts +4 -1
  20. package/dist/declarations/src/types/resources/royalty.d.ts.map +1 -1
  21. package/dist/declarations/src/types/utils/pilFlavor.d.ts +75 -0
  22. package/dist/declarations/src/types/utils/pilFlavor.d.ts.map +1 -0
  23. package/dist/declarations/src/utils/chain.d.ts +2 -0
  24. package/dist/declarations/src/utils/chain.d.ts.map +1 -1
  25. package/dist/declarations/src/utils/pilFlavor.d.ts +54 -0
  26. package/dist/declarations/src/utils/pilFlavor.d.ts.map +1 -0
  27. package/dist/story-protocol-core-sdk.cjs.dev.js +1218 -842
  28. package/dist/story-protocol-core-sdk.cjs.prod.js +1218 -842
  29. package/dist/story-protocol-core-sdk.esm.js +1220 -845
  30. package/package.json +4 -3
@@ -1,5 +1,5 @@
1
1
  import * as dotenv from 'dotenv';
2
- import { encodeFunctionData, decodeEventLog, isAddress, formatEther, maxUint256, http, createPublicClient, createWalletClient, stringToHex, encodeAbiParameters, zeroHash, zeroAddress, keccak256, toFunctionSelector, toHex, maxUint32, erc20Abi as erc20Abi$1 } from 'viem';
2
+ import { encodeFunctionData, decodeEventLog, isAddress, formatEther, maxUint256, http, createPublicClient, createWalletClient, stringToHex, encodeAbiParameters, zeroHash, keccak256, toFunctionSelector, zeroAddress, toHex, maxUint32, erc20Abi as erc20Abi$1 } from 'viem';
3
3
  import { defineChain } from 'viem/utils';
4
4
  import bs58 from 'bs58';
5
5
  import { base58btc } from 'multiformats/bases/base58';
@@ -14,19 +14,17 @@ function _regeneratorDefine(e, r, n, t) {
14
14
  i = 0;
15
15
  }
16
16
  _regeneratorDefine = function (e, r, n, t) {
17
- if (r) i ? i(e, r, {
17
+ function o(r, n) {
18
+ _regeneratorDefine(e, r, function (e) {
19
+ return this._invoke(r, n, e);
20
+ });
21
+ }
22
+ r ? i ? i(e, r, {
18
23
  value: n,
19
24
  enumerable: !t,
20
25
  configurable: !t,
21
26
  writable: !t
22
- }) : e[r] = n;else {
23
- function o(r, n) {
24
- _regeneratorDefine(e, r, function (e) {
25
- return this._invoke(r, n, e);
26
- });
27
- }
28
- o("next", 0), o("throw", 1), o("return", 2);
29
- }
27
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
30
28
  }, _regeneratorDefine(e, r, n, t);
31
29
  }
32
30
 
@@ -2625,6 +2623,11 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2625
2623
  * @param to address
2626
2624
  * @param tokenId uint256
2627
2625
  *//**
2626
+ * SpgnftImplHasRoleRequest
2627
+ *
2628
+ * @param role bytes32
2629
+ * @param account address
2630
+ *//**
2628
2631
  * SpgnftImplTokenUriRequest
2629
2632
  *
2630
2633
  * @param tokenId uint256
@@ -2642,49 +2645,44 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2642
2645
  */},{key:"parseTxTransferEvent",value:function parseTxTransferEvent(txReceipt){var targetLogs=[];var _iterator38=_createForOfIteratorHelper(txReceipt.logs),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var log=_step38.value;try{var event=decodeEventLog({abi:spgnftImplAbi,eventName:"Transfer",data:log.data,topics:log.topics});if(event.eventName==="Transfer"){targetLogs.push(event.args);}}catch(e){/* empty */}}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}return targetLogs;}}]);}();/**
2643
2646
  * contract SPGNFTImpl readonly method
2644
2647
  */var SpgnftImplReadOnlyClient=/*#__PURE__*/function(_SpgnftImplEventClien){function SpgnftImplReadOnlyClient(rpcClient,address){_classCallCheck(this,SpgnftImplReadOnlyClient);return _callSuper(this,SpgnftImplReadOnlyClient,[rpcClient,address]);}/**
2648
+ * method hasRole for contract SPGNFTImpl
2649
+ *
2650
+ * @param request SpgnftImplHasRoleRequest
2651
+ * @return Promise<SpgnftImplHasRoleResponse>
2652
+ */_inherits(SpgnftImplReadOnlyClient,_SpgnftImplEventClien);return _createClass(SpgnftImplReadOnlyClient,[{key:"hasRole",value:(function(){var _hasRole=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee187(request){return _regenerator().w(function(_context187){while(1)switch(_context187.n){case 0:_context187.n=1;return this.rpcClient.readContract({abi:spgnftImplAbi,address:this.address,functionName:"hasRole",args:[request.role,request.account]});case 1:return _context187.a(2,_context187.v);}},_callee187,this);}));function hasRole(_x133){return _hasRole.apply(this,arguments);}return hasRole;}()/**
2645
2653
  * method mintFee for contract SPGNFTImpl
2646
2654
  *
2647
2655
  * @param request SpgnftImplMintFeeRequest
2648
2656
  * @return Promise<SpgnftImplMintFeeResponse>
2649
- */_inherits(SpgnftImplReadOnlyClient,_SpgnftImplEventClien);return _createClass(SpgnftImplReadOnlyClient,[{key:"mintFee",value:(function(){var _mintFee=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee187(){return _regenerator().w(function(_context187){while(1)switch(_context187.n){case 0:_context187.n=1;return this.rpcClient.readContract({abi:spgnftImplAbi,address:this.address,functionName:"mintFee"});case 1:return _context187.a(2,_context187.v);}},_callee187,this);}));function mintFee(){return _mintFee.apply(this,arguments);}return mintFee;}()/**
2657
+ */)},{key:"mintFee",value:(function(){var _mintFee=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee188(){return _regenerator().w(function(_context188){while(1)switch(_context188.n){case 0:_context188.n=1;return this.rpcClient.readContract({abi:spgnftImplAbi,address:this.address,functionName:"mintFee"});case 1:return _context188.a(2,_context188.v);}},_callee188,this);}));function mintFee(){return _mintFee.apply(this,arguments);}return mintFee;}()/**
2650
2658
  * method mintFeeToken for contract SPGNFTImpl
2651
2659
  *
2652
2660
  * @param request SpgnftImplMintFeeTokenRequest
2653
2661
  * @return Promise<SpgnftImplMintFeeTokenResponse>
2654
- */)},{key:"mintFeeToken",value:(function(){var _mintFeeToken=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee188(){return _regenerator().w(function(_context188){while(1)switch(_context188.n){case 0:_context188.n=1;return this.rpcClient.readContract({abi:spgnftImplAbi,address:this.address,functionName:"mintFeeToken"});case 1:return _context188.a(2,_context188.v);}},_callee188,this);}));function mintFeeToken(){return _mintFeeToken.apply(this,arguments);}return mintFeeToken;}()/**
2662
+ */)},{key:"mintFeeToken",value:(function(){var _mintFeeToken=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee189(){return _regenerator().w(function(_context189){while(1)switch(_context189.n){case 0:_context189.n=1;return this.rpcClient.readContract({abi:spgnftImplAbi,address:this.address,functionName:"mintFeeToken"});case 1:return _context189.a(2,_context189.v);}},_callee189,this);}));function mintFeeToken(){return _mintFeeToken.apply(this,arguments);}return mintFeeToken;}()/**
2655
2663
  * method publicMinting for contract SPGNFTImpl
2656
2664
  *
2657
2665
  * @param request SpgnftImplPublicMintingRequest
2658
2666
  * @return Promise<SpgnftImplPublicMintingResponse>
2659
- */)},{key:"publicMinting",value:(function(){var _publicMinting=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee189(){return _regenerator().w(function(_context189){while(1)switch(_context189.n){case 0:_context189.n=1;return this.rpcClient.readContract({abi:spgnftImplAbi,address:this.address,functionName:"publicMinting"});case 1:return _context189.a(2,_context189.v);}},_callee189,this);}));function publicMinting(){return _publicMinting.apply(this,arguments);}return publicMinting;}()/**
2667
+ */)},{key:"publicMinting",value:(function(){var _publicMinting=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee190(){return _regenerator().w(function(_context190){while(1)switch(_context190.n){case 0:_context190.n=1;return this.rpcClient.readContract({abi:spgnftImplAbi,address:this.address,functionName:"publicMinting"});case 1:return _context190.a(2,_context190.v);}},_callee190,this);}));function publicMinting(){return _publicMinting.apply(this,arguments);}return publicMinting;}()/**
2660
2668
  * method tokenURI for contract SPGNFTImpl
2661
2669
  *
2662
2670
  * @param request SpgnftImplTokenUriRequest
2663
2671
  * @return Promise<SpgnftImplTokenUriResponse>
2664
- */)},{key:"tokenUri",value:(function(){var _tokenUri=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee190(request){return _regenerator().w(function(_context190){while(1)switch(_context190.n){case 0:_context190.n=1;return this.rpcClient.readContract({abi:spgnftImplAbi,address:this.address,functionName:"tokenURI",args:[request.tokenId]});case 1:return _context190.a(2,_context190.v);}},_callee190,this);}));function tokenUri(_x133){return _tokenUri.apply(this,arguments);}return tokenUri;}())}]);}(SpgnftImplEventClient);/**
2672
+ */)},{key:"tokenUri",value:(function(){var _tokenUri=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee191(request){return _regenerator().w(function(_context191){while(1)switch(_context191.n){case 0:_context191.n=1;return this.rpcClient.readContract({abi:spgnftImplAbi,address:this.address,functionName:"tokenURI",args:[request.tokenId]});case 1:return _context191.a(2,_context191.v);}},_callee191,this);}));function tokenUri(_x134){return _tokenUri.apply(this,arguments);}return tokenUri;}())}]);}(SpgnftImplEventClient);/**
2665
2673
  * contract SPGNFTImpl write method
2666
2674
  */var SpgnftImplClient=/*#__PURE__*/function(_SpgnftImplReadOnlyCl){function SpgnftImplClient(rpcClient,wallet,address){var _this14;_classCallCheck(this,SpgnftImplClient);_this14=_callSuper(this,SpgnftImplClient,[rpcClient,address]);_this14.wallet=wallet;return _this14;}/**
2667
2675
  * method setTokenURI for contract SPGNFTImpl
2668
2676
  *
2669
2677
  * @param request SpgnftImplSetTokenUriRequest
2670
2678
  * @return Promise<WriteContractReturnType>
2671
- */_inherits(SpgnftImplClient,_SpgnftImplReadOnlyCl);return _createClass(SpgnftImplClient,[{key:"setTokenUri",value:(function(){var _setTokenUri=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee191(request){var _yield$this$rpcClient92,call;return _regenerator().w(function(_context191){while(1)switch(_context191.n){case 0:_context191.n=1;return this.rpcClient.simulateContract({abi:spgnftImplAbi,address:this.address,functionName:"setTokenURI",account:this.wallet.account,args:[request.tokenId,request.tokenUri]});case 1:_yield$this$rpcClient92=_context191.v;call=_yield$this$rpcClient92.request;_context191.n=2;return this.wallet.writeContract(call);case 2:return _context191.a(2,_context191.v);}},_callee191,this);}));function setTokenUri(_x134){return _setTokenUri.apply(this,arguments);}return setTokenUri;}()/**
2679
+ */_inherits(SpgnftImplClient,_SpgnftImplReadOnlyCl);return _createClass(SpgnftImplClient,[{key:"setTokenUri",value:(function(){var _setTokenUri=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee192(request){var _yield$this$rpcClient92,call;return _regenerator().w(function(_context192){while(1)switch(_context192.n){case 0:_context192.n=1;return this.rpcClient.simulateContract({abi:spgnftImplAbi,address:this.address,functionName:"setTokenURI",account:this.wallet.account,args:[request.tokenId,request.tokenUri]});case 1:_yield$this$rpcClient92=_context192.v;call=_yield$this$rpcClient92.request;_context192.n=2;return this.wallet.writeContract(call);case 2:return _context192.a(2,_context192.v);}},_callee192,this);}));function setTokenUri(_x135){return _setTokenUri.apply(this,arguments);}return setTokenUri;}()/**
2672
2680
  * method setTokenURI for contract SPGNFTImpl with only encode
2673
2681
  *
2674
2682
  * @param request SpgnftImplSetTokenUriRequest
2675
2683
  * @return EncodedTxData
2676
2684
  */)},{key:"setTokenUriEncode",value:function setTokenUriEncode(request){return {to:this.address,data:encodeFunctionData({abi:spgnftImplAbi,functionName:"setTokenURI",args:[request.tokenId,request.tokenUri]})};}}]);}(SpgnftImplReadOnlyClient);// Contract TotalLicenseTokenLimitHook =============================================================
2677
2685
  /**
2678
- * TotalLicenseTokenLimitHookGetTotalLicenseTokenLimitRequest
2679
- *
2680
- * @param licensorIpId address
2681
- * @param licenseTemplate address
2682
- * @param licenseTermsId uint256
2683
- *//**
2684
- * TotalLicenseTokenLimitHookGetTotalLicenseTokenLimitResponse
2685
- *
2686
- * @param limit uint256
2687
- *//**
2688
2686
  * TotalLicenseTokenLimitHookSetTotalLicenseTokenLimitRequest
2689
2687
  *
2690
2688
  * @param licensorIpId address
@@ -2692,25 +2690,18 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2692
2690
  * @param licenseTermsId uint256
2693
2691
  * @param limit uint256
2694
2692
  *//**
2695
- * contract TotalLicenseTokenLimitHook readonly method
2696
- */var TotalLicenseTokenLimitHookReadOnlyClient=/*#__PURE__*/function(){function TotalLicenseTokenLimitHookReadOnlyClient(rpcClient,address){var _rpcClient$chain25;_classCallCheck(this,TotalLicenseTokenLimitHookReadOnlyClient);this.address=address||getAddress(totalLicenseTokenLimitHookAddress,(_rpcClient$chain25=rpcClient.chain)===null||_rpcClient$chain25===void 0?void 0:_rpcClient$chain25.id);this.rpcClient=rpcClient;}/**
2697
- * method getTotalLicenseTokenLimit for contract TotalLicenseTokenLimitHook
2698
- *
2699
- * @param request TotalLicenseTokenLimitHookGetTotalLicenseTokenLimitRequest
2700
- * @return Promise<TotalLicenseTokenLimitHookGetTotalLicenseTokenLimitResponse>
2701
- */return _createClass(TotalLicenseTokenLimitHookReadOnlyClient,[{key:"getTotalLicenseTokenLimit",value:(function(){var _getTotalLicenseTokenLimit=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee192(request){var result;return _regenerator().w(function(_context192){while(1)switch(_context192.n){case 0:_context192.n=1;return this.rpcClient.readContract({abi:totalLicenseTokenLimitHookAbi,address:this.address,functionName:"getTotalLicenseTokenLimit",args:[request.licensorIpId,request.licenseTemplate,request.licenseTermsId]});case 1:result=_context192.v;return _context192.a(2,{limit:result});}},_callee192,this);}));function getTotalLicenseTokenLimit(_x135){return _getTotalLicenseTokenLimit.apply(this,arguments);}return getTotalLicenseTokenLimit;}())}]);}();/**
2702
2693
  * contract TotalLicenseTokenLimitHook write method
2703
- */var TotalLicenseTokenLimitHookClient=/*#__PURE__*/function(_TotalLicenseTokenLim){function TotalLicenseTokenLimitHookClient(rpcClient,wallet,address){var _this15;_classCallCheck(this,TotalLicenseTokenLimitHookClient);_this15=_callSuper(this,TotalLicenseTokenLimitHookClient,[rpcClient,address]);_this15.wallet=wallet;return _this15;}/**
2694
+ */var TotalLicenseTokenLimitHookClient=/*#__PURE__*/function(){function TotalLicenseTokenLimitHookClient(rpcClient,wallet,address){var _rpcClient$chain25;_classCallCheck(this,TotalLicenseTokenLimitHookClient);this.address=address||getAddress(totalLicenseTokenLimitHookAddress,(_rpcClient$chain25=rpcClient.chain)===null||_rpcClient$chain25===void 0?void 0:_rpcClient$chain25.id);this.rpcClient=rpcClient;this.wallet=wallet;}/**
2704
2695
  * method setTotalLicenseTokenLimit for contract TotalLicenseTokenLimitHook
2705
2696
  *
2706
2697
  * @param request TotalLicenseTokenLimitHookSetTotalLicenseTokenLimitRequest
2707
2698
  * @return Promise<WriteContractReturnType>
2708
- */_inherits(TotalLicenseTokenLimitHookClient,_TotalLicenseTokenLim);return _createClass(TotalLicenseTokenLimitHookClient,[{key:"setTotalLicenseTokenLimit",value:(function(){var _setTotalLicenseTokenLimit=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee193(request){var _yield$this$rpcClient93,call;return _regenerator().w(function(_context193){while(1)switch(_context193.n){case 0:_context193.n=1;return this.rpcClient.simulateContract({abi:totalLicenseTokenLimitHookAbi,address:this.address,functionName:"setTotalLicenseTokenLimit",account:this.wallet.account,args:[request.licensorIpId,request.licenseTemplate,request.licenseTermsId,request.limit]});case 1:_yield$this$rpcClient93=_context193.v;call=_yield$this$rpcClient93.request;_context193.n=2;return this.wallet.writeContract(call);case 2:return _context193.a(2,_context193.v);}},_callee193,this);}));function setTotalLicenseTokenLimit(_x136){return _setTotalLicenseTokenLimit.apply(this,arguments);}return setTotalLicenseTokenLimit;}()/**
2699
+ */return _createClass(TotalLicenseTokenLimitHookClient,[{key:"setTotalLicenseTokenLimit",value:(function(){var _setTotalLicenseTokenLimit=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee193(request){var _yield$this$rpcClient93,call;return _regenerator().w(function(_context193){while(1)switch(_context193.n){case 0:_context193.n=1;return this.rpcClient.simulateContract({abi:totalLicenseTokenLimitHookAbi,address:this.address,functionName:"setTotalLicenseTokenLimit",account:this.wallet.account,args:[request.licensorIpId,request.licenseTemplate,request.licenseTermsId,request.limit]});case 1:_yield$this$rpcClient93=_context193.v;call=_yield$this$rpcClient93.request;_context193.n=2;return this.wallet.writeContract(call);case 2:return _context193.a(2,_context193.v);}},_callee193,this);}));function setTotalLicenseTokenLimit(_x136){return _setTotalLicenseTokenLimit.apply(this,arguments);}return setTotalLicenseTokenLimit;}()/**
2709
2700
  * method setTotalLicenseTokenLimit for contract TotalLicenseTokenLimitHook with only encode
2710
2701
  *
2711
2702
  * @param request TotalLicenseTokenLimitHookSetTotalLicenseTokenLimitRequest
2712
2703
  * @return EncodedTxData
2713
- */)},{key:"setTotalLicenseTokenLimitEncode",value:function setTotalLicenseTokenLimitEncode(request){return {to:this.address,data:encodeFunctionData({abi:totalLicenseTokenLimitHookAbi,functionName:"setTotalLicenseTokenLimit",args:[request.licensorIpId,request.licenseTemplate,request.licenseTermsId,request.limit]})};}}]);}(TotalLicenseTokenLimitHookReadOnlyClient);// Contract WrappedIP =============================================================
2704
+ */)},{key:"setTotalLicenseTokenLimitEncode",value:function setTotalLicenseTokenLimitEncode(request){return {to:this.address,data:encodeFunctionData({abi:totalLicenseTokenLimitHookAbi,functionName:"setTotalLicenseTokenLimit",args:[request.licensorIpId,request.licenseTemplate,request.licenseTermsId,request.limit]})};}}]);}();// Contract WrappedIP =============================================================
2714
2705
  /**
2715
2706
  * WrappedIpAllowanceRequest
2716
2707
  *
@@ -2762,7 +2753,7 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2762
2753
  * @return Promise<WrappedIpBalanceOfResponse>
2763
2754
  */)},{key:"balanceOf",value:(function(){var _balanceOf3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee195(request){var result;return _regenerator().w(function(_context195){while(1)switch(_context195.n){case 0:_context195.n=1;return this.rpcClient.readContract({abi:wrappedIpAbi,address:this.address,functionName:"balanceOf",args:[request.owner]});case 1:result=_context195.v;return _context195.a(2,{result:result});}},_callee195,this);}));function balanceOf(_x138){return _balanceOf3.apply(this,arguments);}return balanceOf;}())}]);}();/**
2764
2755
  * contract WrappedIP write method
2765
- */var WrappedIpClient=/*#__PURE__*/function(_WrappedIpReadOnlyCli){function WrappedIpClient(rpcClient,wallet,address){var _this16;_classCallCheck(this,WrappedIpClient);_this16=_callSuper(this,WrappedIpClient,[rpcClient,address]);_this16.wallet=wallet;return _this16;}/**
2756
+ */var WrappedIpClient=/*#__PURE__*/function(_WrappedIpReadOnlyCli){function WrappedIpClient(rpcClient,wallet,address){var _this15;_classCallCheck(this,WrappedIpClient);_this15=_callSuper(this,WrappedIpClient,[rpcClient,address]);_this15.wallet=wallet;return _this15;}/**
2766
2757
  * method approve for contract WrappedIP
2767
2758
  *
2768
2759
  * @param request WrappedIpApproveRequest
@@ -2874,6 +2865,45 @@ var royaltySharesTotalSupply = 100000000;
2874
2865
  var MAX_ROYALTY_TOKEN = 100000000;
2875
2866
  var WIP_TOKEN_ADDRESS = wrappedIpAddress[mainnet.id];
2876
2867
 
2868
+ function _isNativeFunction(t) {
2869
+ try {
2870
+ return -1 !== Function.toString.call(t).indexOf("[native code]");
2871
+ } catch (n) {
2872
+ return "function" == typeof t;
2873
+ }
2874
+ }
2875
+
2876
+ function _construct(t, e, r) {
2877
+ if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
2878
+ var o = [null];
2879
+ o.push.apply(o, e);
2880
+ var p = new (t.bind.apply(t, o))();
2881
+ return r && _setPrototypeOf(p, r.prototype), p;
2882
+ }
2883
+
2884
+ function _wrapNativeSuper(t) {
2885
+ var r = "function" == typeof Map ? new Map() : void 0;
2886
+ return _wrapNativeSuper = function (t) {
2887
+ if (null === t || !_isNativeFunction(t)) return t;
2888
+ if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
2889
+ if (void 0 !== r) {
2890
+ if (r.has(t)) return r.get(t);
2891
+ r.set(t, Wrapper);
2892
+ }
2893
+ function Wrapper() {
2894
+ return _construct(t, arguments, _getPrototypeOf(this).constructor);
2895
+ }
2896
+ return Wrapper.prototype = Object.create(t.prototype, {
2897
+ constructor: {
2898
+ value: Wrapper,
2899
+ enumerable: false,
2900
+ writable: true,
2901
+ configurable: true
2902
+ }
2903
+ }), _setPrototypeOf(Wrapper, t);
2904
+ }, _wrapNativeSuper(t);
2905
+ }
2906
+
2877
2907
  var handleError = function handleError(error, msg) {
2878
2908
  if (error instanceof Error) {
2879
2909
  var newError = new Error("".concat(msg, ": ").concat(error.message));
@@ -2882,6 +2912,17 @@ var handleError = function handleError(error, msg) {
2882
2912
  }
2883
2913
  throw new Error("".concat(msg, ": Unknown error type"));
2884
2914
  };
2915
+ var PILFlavorError = /*#__PURE__*/function (_Error) {
2916
+ function PILFlavorError(message) {
2917
+ var _this;
2918
+ _classCallCheck(this, PILFlavorError);
2919
+ _this = _callSuper(this, PILFlavorError, [message]);
2920
+ _this.name = "PILFlavorError";
2921
+ return _this;
2922
+ }
2923
+ _inherits(PILFlavorError, _Error);
2924
+ return _createClass(PILFlavorError);
2925
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
2885
2926
 
2886
2927
  function _arrayWithoutHoles(r) {
2887
2928
  if (Array.isArray(r)) return _arrayLikeToArray(r);
@@ -3234,7 +3275,7 @@ var approvalAllSpenders = /*#__PURE__*/function () {
3234
3275
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
3235
3276
  var spenders, client, owner, useMultiCall, rpcClient, multicallAddress, approvals, allCalls, _iterator, _step, approval, hash, _t;
3236
3277
  return _regenerator().w(function (_context2) {
3237
- while (1) switch (_context2.n) {
3278
+ while (1) switch (_context2.p = _context2.n) {
3238
3279
  case 0:
3239
3280
  spenders = _ref.spenders, client = _ref.client, owner = _ref.owner, useMultiCall = _ref.useMultiCall, rpcClient = _ref.rpcClient, multicallAddress = _ref.multicallAddress;
3240
3281
  _context2.n = 1;
@@ -3820,7 +3861,7 @@ var settleAssertion = /*#__PURE__*/function () {
3820
3861
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(privateKey, disputeId, transport) {
3821
3862
  var baseConfig, rpcClient, walletClient, arbitrationPolicyUmaClient, oov3Contract, assertionId, txHash, _t;
3822
3863
  return _regenerator().w(function (_context4) {
3823
- while (1) switch (_context4.n) {
3864
+ while (1) switch (_context4.p = _context4.n) {
3824
3865
  case 0:
3825
3866
  _context4.p = 0;
3826
3867
  baseConfig = {
@@ -3893,7 +3934,7 @@ var DisputeClient = /*#__PURE__*/function () {
3893
3934
  var _this = this;
3894
3935
  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, _t;
3895
3936
  return _regenerator().w(function (_context) {
3896
- while (1) switch (_context.n) {
3937
+ while (1) switch (_context.p = _context.n) {
3897
3938
  case 0:
3898
3939
  _context.p = 0;
3899
3940
  liveness = BigInt(request.liveness);
@@ -3919,7 +3960,7 @@ var DisputeClient = /*#__PURE__*/function () {
3919
3960
  _yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 2);
3920
3961
  minimumBond = _yield$Promise$all4[0];
3921
3962
  maximumBond = _yield$Promise$all4[1];
3922
- bonds = BigInt(request.bond || minimumBond);
3963
+ bonds = BigInt(request.bond === undefined ? minimumBond : request.bond);
3923
3964
  if (!(bonds > maximumBond || bonds < minimumBond)) {
3924
3965
  _context.n = 4;
3925
3966
  break;
@@ -4037,7 +4078,7 @@ var DisputeClient = /*#__PURE__*/function () {
4037
4078
  var _cancelDispute = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(request) {
4038
4079
  var _request$txOptions2, _req, txHash, _t2;
4039
4080
  return _regenerator().w(function (_context2) {
4040
- while (1) switch (_context2.n) {
4081
+ while (1) switch (_context2.p = _context2.n) {
4041
4082
  case 0:
4042
4083
  _context2.p = 0;
4043
4084
  _req = {
@@ -4093,7 +4134,7 @@ var DisputeClient = /*#__PURE__*/function () {
4093
4134
  var _resolveDispute = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(request) {
4094
4135
  var _request$data, _request$txOptions3, _req2, txHash, _t3;
4095
4136
  return _regenerator().w(function (_context3) {
4096
- while (1) switch (_context3.n) {
4137
+ while (1) switch (_context3.p = _context3.n) {
4097
4138
  case 0:
4098
4139
  _context3.p = 0;
4099
4140
  _req2 = {
@@ -4151,7 +4192,7 @@ var DisputeClient = /*#__PURE__*/function () {
4151
4192
  var _this2 = this;
4152
4193
  var _request$options, objects, txHashes, calls, txHash, _iterator, _step, object, _txHash, _t4, _t5;
4153
4194
  return _regenerator().w(function (_context4) {
4154
- while (1) switch (_context4.n) {
4195
+ while (1) switch (_context4.p = _context4.n) {
4155
4196
  case 0:
4156
4197
  _context4.p = 0;
4157
4198
  objects = request.infringementTags.map(function (arg) {
@@ -4253,7 +4294,7 @@ var DisputeClient = /*#__PURE__*/function () {
4253
4294
  var _this3 = this;
4254
4295
  var ipAccount, bond, counterEvidenceHash, encodedData, _yield$this$wrappedIp, allowance, _txHash2, contractCall, _yield$contractCallWi2, txHash, receipt, _t6;
4255
4296
  return _regenerator().w(function (_context5) {
4256
- while (1) switch (_context5.n) {
4297
+ while (1) switch (_context5.p = _context5.n) {
4257
4298
  case 0:
4258
4299
  _context5.p = 0;
4259
4300
  ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(request.ipId));
@@ -4406,9 +4447,11 @@ var DisputeClient = /*#__PURE__*/function () {
4406
4447
  * It is used to determine the type of revenue share to be used in the revenue share calculation and throw error when the revenue share is not valid.
4407
4448
  */
4408
4449
  var RevShareType = /*#__PURE__*/function (RevShareType) {
4409
- RevShareType["COMMERCIAL_REVENUE_SHARE"] = "CommercialRevShare";
4410
- RevShareType["MAX_REVENUE_SHARE"] = "MaxRevenueShare";
4411
- RevShareType["MAX_ALLOWED_REWARD_SHARE"] = "MaxAllowedRewardShare";
4450
+ RevShareType["COMMERCIAL_REVENUE_SHARE"] = "commercialRevShare";
4451
+ RevShareType["MAX_REVENUE_SHARE"] = "maxRevenueShare";
4452
+ RevShareType["MAX_ALLOWED_REWARD_SHARE"] = "maxAllowedRewardShare";
4453
+ RevShareType["EXPECT_MINIMUM_GROUP_REWARD_SHARE"] = "expectMinimumGroupRewardShare";
4454
+ RevShareType["MAX_ALLOWED_REWARD_SHARE_PERCENTAGE"] = "maxAllowedRewardSharePercentage";
4412
4455
  return RevShareType;
4413
4456
  }({});
4414
4457
 
@@ -4472,207 +4515,39 @@ var getIpMetadataForWorkflow = function getIpMetadataForWorkflow(ipMetadata) {
4472
4515
  };
4473
4516
  };
4474
4517
 
4475
- /**
4476
- * This structure defines the terms for a Programmable IP License (PIL).
4477
- * These terms can be attached to IP Assets.
4478
- *
4479
- * For more information, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-terms | PIL}.
4480
- **/
4518
+ /** The amount of revenue token claimable. */
4481
4519
 
4482
- var PIL_TYPE = /*#__PURE__*/function (PIL_TYPE) {
4483
- PIL_TYPE[PIL_TYPE["NON_COMMERCIAL_REMIX"] = 0] = "NON_COMMERCIAL_REMIX";
4484
- PIL_TYPE[PIL_TYPE["COMMERCIAL_USE"] = 1] = "COMMERCIAL_USE";
4485
- PIL_TYPE[PIL_TYPE["COMMERCIAL_REMIX"] = 2] = "COMMERCIAL_REMIX";
4486
- PIL_TYPE[PIL_TYPE["CREATIVE_COMMONS_ATTRIBUTION"] = 3] = "CREATIVE_COMMONS_ATTRIBUTION";
4487
- return PIL_TYPE;
4520
+ /**
4521
+ * Native royalty policy created by the Story team
4522
+ * - LAP: {@link https://docs.story.foundation/concepts/royalty-module/liquid-absolute-percentage | Liquid Absolute Percentage}
4523
+ * - LRP: {@link https://docs.story.foundation/concepts/royalty-module/liquid-relative-percentage | Liquid Relative Percentage}
4524
+ */
4525
+ var NativeRoyaltyPolicy = /*#__PURE__*/function (NativeRoyaltyPolicy) {
4526
+ NativeRoyaltyPolicy[NativeRoyaltyPolicy["LAP"] = 0] = "LAP";
4527
+ NativeRoyaltyPolicy[NativeRoyaltyPolicy["LRP"] = 1] = "LRP";
4528
+ return NativeRoyaltyPolicy;
4488
4529
  }({});
4489
4530
 
4490
- var getLicenseTermByType = function getLicenseTermByType(type, term) {
4491
- var licenseTerms = {
4492
- transferable: true,
4493
- royaltyPolicy: zeroAddress,
4494
- defaultMintingFee: BigInt(0),
4495
- expiration: BigInt(0),
4496
- commercialUse: false,
4497
- commercialAttribution: false,
4498
- commercializerChecker: zeroAddress,
4499
- commercializerCheckerData: zeroAddress,
4500
- commercialRevShare: 0,
4501
- commercialRevCeiling: BigInt(0),
4502
- derivativesAllowed: true,
4503
- derivativesAttribution: true,
4504
- derivativesApproval: false,
4505
- derivativesReciprocal: true,
4506
- derivativeRevCeiling: BigInt(0),
4507
- currency: zeroAddress,
4508
- uri: ""
4509
- };
4510
- if (type === PIL_TYPE.NON_COMMERCIAL_REMIX) {
4511
- licenseTerms.commercializerCheckerData = "0x";
4512
- licenseTerms.uri = "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/NCSR.json";
4513
- return licenseTerms;
4514
- } else if (type === PIL_TYPE.COMMERCIAL_USE) {
4515
- if (!term || term.defaultMintingFee === undefined || term.currency === undefined) {
4516
- throw new Error("DefaultMintingFee, currency are required for commercial use PIL.");
4517
- }
4518
- licenseTerms.royaltyPolicy = validateAddress(term.royaltyPolicyAddress);
4519
- licenseTerms.defaultMintingFee = BigInt(term.defaultMintingFee);
4520
- licenseTerms.commercialUse = true;
4521
- licenseTerms.commercialAttribution = true;
4522
- licenseTerms.derivativesReciprocal = false;
4523
- licenseTerms.currency = validateAddress(term.currency);
4524
- licenseTerms.uri = "https://github.com/piplabs/pil-document/blob/9a1f803fcf8101a8a78f1dcc929e6014e144ab56/off-chain-terms/CommercialUse.json";
4525
- licenseTerms.derivativesAllowed = false;
4526
- licenseTerms.derivativesAttribution = false;
4527
- return licenseTerms;
4528
- } else if (type === PIL_TYPE.CREATIVE_COMMONS_ATTRIBUTION) {
4529
- if (!term || !term.royaltyPolicyAddress || !term.currency) {
4530
- throw new Error("royaltyPolicyAddress and currency are required for creative commons attribution PIL.");
4531
- }
4532
- licenseTerms.royaltyPolicy = validateAddress(term.royaltyPolicyAddress);
4533
- licenseTerms.currency = validateAddress(term.currency);
4534
- licenseTerms.commercialUse = true;
4535
- licenseTerms.commercialAttribution = true;
4536
- licenseTerms.uri = "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/CC-BY.json";
4537
- return licenseTerms;
4538
- } else {
4539
- if (!term || term.defaultMintingFee === undefined || term.currency === undefined || term.commercialRevShare === undefined) {
4540
- throw new Error("DefaultMintingFee, currency and commercialRevShare are required for commercial remix PIL.");
4541
- }
4542
- licenseTerms.royaltyPolicy = validateAddress(term.royaltyPolicyAddress);
4543
- licenseTerms.defaultMintingFee = BigInt(term.defaultMintingFee);
4544
- licenseTerms.commercialUse = true;
4545
- licenseTerms.commercialAttribution = true;
4546
- licenseTerms.uri = "https://github.com/piplabs/pil-document/blob/ad67bb632a310d2557f8abcccd428e4c9c798db1/off-chain-terms/CommercialRemix.json";
4547
- licenseTerms.commercialRevShare = getRevenueShare(term.commercialRevShare);
4548
- licenseTerms.derivativesReciprocal = true;
4549
- licenseTerms.currency = validateAddress(term.currency);
4550
- return licenseTerms;
4551
- }
4552
- };
4553
- var validateLicenseTerms = /*#__PURE__*/function () {
4554
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params, rpcClient) {
4555
- var royaltyPolicy, currency, royaltyModuleReadOnlyClient, isWhitelistedArbitrationPolicy, isWhitelistedRoyaltyToken, object;
4556
- return _regenerator().w(function (_context) {
4557
- while (1) switch (_context.n) {
4558
- case 0:
4559
- royaltyPolicy = params.royaltyPolicy, currency = params.currency;
4560
- royaltyModuleReadOnlyClient = new RoyaltyModuleReadOnlyClient(rpcClient);
4561
- if (!(validateAddress(royaltyPolicy) !== zeroAddress)) {
4562
- _context.n = 2;
4563
- break;
4564
- }
4565
- _context.n = 1;
4566
- return royaltyModuleReadOnlyClient.isWhitelistedRoyaltyPolicy({
4567
- royaltyPolicy: royaltyPolicy
4568
- });
4569
- case 1:
4570
- isWhitelistedArbitrationPolicy = _context.v;
4571
- if (isWhitelistedArbitrationPolicy) {
4572
- _context.n = 2;
4573
- break;
4574
- }
4575
- throw new Error("The royalty policy is not whitelisted.");
4576
- case 2:
4577
- if (!(validateAddress(currency) !== zeroAddress)) {
4578
- _context.n = 4;
4579
- break;
4580
- }
4581
- _context.n = 3;
4582
- return royaltyModuleReadOnlyClient.isWhitelistedRoyaltyToken({
4583
- token: currency
4584
- });
4585
- case 3:
4586
- isWhitelistedRoyaltyToken = _context.v;
4587
- if (isWhitelistedRoyaltyToken) {
4588
- _context.n = 4;
4589
- break;
4590
- }
4591
- throw new Error("The currency token is not whitelisted.");
4592
- case 4:
4593
- if (!(royaltyPolicy !== zeroAddress && currency === zeroAddress)) {
4594
- _context.n = 5;
4595
- break;
4596
- }
4597
- throw new Error("Royalty policy requires currency token.");
4598
- case 5:
4599
- object = _objectSpread2(_objectSpread2({}, params), {}, {
4600
- defaultMintingFee: BigInt(params.defaultMintingFee),
4601
- expiration: BigInt(params.expiration),
4602
- commercialRevCeiling: BigInt(params.commercialRevCeiling),
4603
- derivativeRevCeiling: BigInt(params.derivativeRevCeiling)
4604
- });
4605
- if (!(object.defaultMintingFee < 0)) {
4606
- _context.n = 6;
4607
- break;
4608
- }
4609
- throw new Error("DefaultMintingFee should be greater than or equal to 0.");
4610
- case 6:
4611
- if (!(object.defaultMintingFee > 0 && object.royaltyPolicy === zeroAddress)) {
4612
- _context.n = 7;
4613
- break;
4614
- }
4615
- throw new Error("Royalty policy is required when defaultMintingFee is greater than 0.");
4616
- case 7:
4617
- verifyCommercialUse(object);
4618
- verifyDerivatives(object);
4619
- if (!(object.commercialRevShare < 0 || object.commercialRevShare > 100)) {
4620
- _context.n = 8;
4621
- break;
4622
- }
4623
- throw new Error("CommercialRevShare should be between 0 and 100.");
4624
- case 8:
4625
- object.commercialRevShare = object.commercialRevShare / 100 * 100000000;
4626
- case 9:
4627
- return _context.a(2, object);
4628
- }
4629
- }, _callee);
4630
- }));
4631
- return function validateLicenseTerms(_x, _x2) {
4632
- return _ref.apply(this, arguments);
4633
- };
4634
- }();
4635
- var verifyCommercialUse = function verifyCommercialUse(terms) {
4636
- if (!terms.commercialUse) {
4637
- if (terms.commercialAttribution) {
4638
- throw new Error("Cannot add commercial attribution when commercial use is disabled.");
4639
- }
4640
- if (terms.commercializerChecker !== zeroAddress) {
4641
- throw new Error("Cannot add commercializerChecker when commercial use is disabled.");
4642
- }
4643
- if (terms.commercialRevShare > 0) {
4644
- throw new Error("Cannot add commercial revenue share when commercial use is disabled.");
4645
- }
4646
- if (terms.commercialRevCeiling > 0) {
4647
- throw new Error("Cannot add commercial revenue ceiling when commercial use is disabled.");
4648
- }
4649
- if (terms.derivativeRevCeiling > 0) {
4650
- throw new Error("Cannot add derivative revenue ceiling share when commercial use is disabled.");
4651
- }
4652
- if (terms.royaltyPolicy !== zeroAddress) {
4653
- throw new Error("Cannot add commercial royalty policy when commercial use is disabled.");
4654
- }
4655
- } else {
4656
- if (terms.royaltyPolicy === zeroAddress) {
4657
- throw new Error("Royalty policy is required when commercial use is enabled.");
4658
- }
4659
- }
4660
- };
4661
- var verifyDerivatives = function verifyDerivatives(terms) {
4662
- if (!terms.derivativesAllowed) {
4663
- if (terms.derivativesAttribution) {
4664
- throw new Error("Cannot add derivative attribution when derivative use is disabled.");
4665
- }
4666
- if (terms.derivativesApproval) {
4667
- throw new Error("Cannot add derivative approval when derivative use is disabled.");
4668
- }
4669
- if (terms.derivativesReciprocal) {
4670
- throw new Error("Cannot add derivative reciprocal when derivative use is disabled.");
4671
- }
4672
- if (terms.derivativeRevCeiling > 0) {
4673
- throw new Error("Cannot add derivative revenue ceiling when derivative use is disabled.");
4674
- }
4531
+ /**
4532
+ * Allow custom royalty policy address or use a native royalty policy enum.
4533
+ * For custom royalty policy, @see {@link https://docs.story.foundation/concepts/royalty-module/external-royalty-policies | External Royalty Policies}
4534
+ */
4535
+
4536
+ var royaltyPolicyInputToAddress = function royaltyPolicyInputToAddress(input, chainId) {
4537
+ var transferredChainId = chain[chainId || "aeneid"];
4538
+ var address;
4539
+ switch (input) {
4540
+ case undefined:
4541
+ case NativeRoyaltyPolicy.LAP:
4542
+ address = royaltyPolicyLapAddress[transferredChainId];
4543
+ break;
4544
+ case NativeRoyaltyPolicy.LRP:
4545
+ address = royaltyPolicyLrpAddress[transferredChainId];
4546
+ break;
4547
+ default:
4548
+ address = validateAddress(input);
4675
4549
  }
4550
+ return address;
4676
4551
  };
4677
4552
  var getRevenueShare = function getRevenueShare(revShare) {
4678
4553
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : RevShareType.COMMERCIAL_REVENUE_SHARE;
@@ -4683,7 +4558,7 @@ var getRevenueShare = function getRevenueShare(revShare) {
4683
4558
  if (revShareNumber < 0 || revShareNumber > 100) {
4684
4559
  throw new Error("".concat(type, " must be between 0 and 100."));
4685
4560
  }
4686
- return revShareNumber / 100 * MAX_ROYALTY_TOKEN;
4561
+ return revShareNumber * Math.pow(10, 6);
4687
4562
  };
4688
4563
 
4689
4564
  /**
@@ -4848,6 +4723,8 @@ var validateLicenseConfig = function validateLicenseConfig(licensingConfig) {
4848
4723
  }
4849
4724
  if (licenseConfig.expectMinimumGroupRewardShare < 0 || licenseConfig.expectMinimumGroupRewardShare > 100) {
4850
4725
  throw new Error("The expectMinimumGroupRewardShare must be greater than 0 and less than 100.");
4726
+ } else {
4727
+ licenseConfig.expectMinimumGroupRewardShare = getRevenueShare(licenseConfig.expectMinimumGroupRewardShare, RevShareType.EXPECT_MINIMUM_GROUP_REWARD_SHARE);
4851
4728
  }
4852
4729
  if (licenseConfig.mintingFee < 0) {
4853
4730
  throw new Error("The mintingFee must be greater than 0.");
@@ -4883,7 +4760,7 @@ var GroupClient = /*#__PURE__*/function () {
4883
4760
  var _registerGroup = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request) {
4884
4761
  var _request$txOptions, object, txHash, txReceipt, groupId, _t;
4885
4762
  return _regenerator().w(function (_context) {
4886
- while (1) switch (_context.n) {
4763
+ while (1) switch (_context.p = _context.n) {
4887
4764
  case 0:
4888
4765
  _context.p = 0;
4889
4766
  object = {
@@ -4940,7 +4817,7 @@ var GroupClient = /*#__PURE__*/function () {
4940
4817
  var _mintAndRegisterIpAndAttachLicenseAndAddToGroup = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(request) {
4941
4818
  var _request$txOptions2, groupId, recipient, spgNftContract, deadline, isRegistered, ipAccount, _yield$ipAccount$stat, state, blockTimestamp, calculatedDeadline, _yield$getPermissionS, sigAddToGroupSignature, object, txHash, receipt, log, _t2;
4942
4819
  return _regenerator().w(function (_context2) {
4943
- while (1) switch (_context2.n) {
4820
+ while (1) switch (_context2.p = _context2.n) {
4944
4821
  case 0:
4945
4822
  _context2.p = 0;
4946
4823
  groupId = request.groupId, recipient = request.recipient, spgNftContract = request.spgNftContract, deadline = request.deadline;
@@ -5050,7 +4927,7 @@ var GroupClient = /*#__PURE__*/function () {
5050
4927
  var _registerIpAndAttachLicenseAndAddToGroup = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(request) {
5051
4928
  var _request$txOptions3, ipIdAddress, isRegistered, ipAccount, _yield$ipAccount$stat2, state, blockTimestamp, calculatedDeadline, _yield$getPermissionS2, sigAddToGroupSignature, _yield$getPermissionS3, sigMetadataAndAttachSignature, object, txHash, receipt, log, _t3;
5052
4929
  return _regenerator().w(function (_context3) {
5053
- while (1) switch (_context3.n) {
4930
+ while (1) switch (_context3.p = _context3.n) {
5054
4931
  case 0:
5055
4932
  _context3.p = 0;
5056
4933
  _context3.n = 1;
@@ -5199,7 +5076,7 @@ var GroupClient = /*#__PURE__*/function () {
5199
5076
  var _registerGroupAndAttachLicense = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(request) {
5200
5077
  var _request$txOptions4, object, txHash, txReceipt, groupId, _t4;
5201
5078
  return _regenerator().w(function (_context4) {
5202
- while (1) switch (_context4.n) {
5079
+ while (1) switch (_context4.p = _context4.n) {
5203
5080
  case 0:
5204
5081
  _context4.p = 0;
5205
5082
  object = {
@@ -5252,7 +5129,7 @@ var GroupClient = /*#__PURE__*/function () {
5252
5129
  var _registerGroupAndAttachLicenseAndAddIps = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(request) {
5253
5130
  var _request$txOptions5, object, i, isRegistered, _i, isAttachedLicenseTerms, txHash, txReceipt, groupId, _t5;
5254
5131
  return _regenerator().w(function (_context5) {
5255
- while (1) switch (_context5.n) {
5132
+ while (1) switch (_context5.p = _context5.n) {
5256
5133
  case 0:
5257
5134
  _context5.p = 0;
5258
5135
  object = {
@@ -5355,7 +5232,7 @@ var GroupClient = /*#__PURE__*/function () {
5355
5232
  var _this = this;
5356
5233
  var groupIpId, currencyTokens, memberIpIds, txOptions, collectAndClaimParams, isGroupRegistered, txHash, _yield$waitForTxRecei, receipt, collectedRoyalties, royaltiesDistributed, _t6;
5357
5234
  return _regenerator().w(function (_context7) {
5358
- while (1) switch (_context7.n) {
5235
+ while (1) switch (_context7.p = _context7.n) {
5359
5236
  case 0:
5360
5237
  groupIpId = _ref.groupIpId, currencyTokens = _ref.currencyTokens, memberIpIds = _ref.memberIpIds, txOptions = _ref.txOptions;
5361
5238
  _context7.p = 1;
@@ -5495,14 +5372,14 @@ var GroupClient = /*#__PURE__*/function () {
5495
5372
  var _addIpsToGroup = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(_ref5) {
5496
5373
  var groupIpId, ipIds, maxAllowedRewardSharePercentage, txOptions, addIpParam, txHash, _t7;
5497
5374
  return _regenerator().w(function (_context8) {
5498
- while (1) switch (_context8.n) {
5375
+ while (1) switch (_context8.p = _context8.n) {
5499
5376
  case 0:
5500
5377
  groupIpId = _ref5.groupIpId, ipIds = _ref5.ipIds, maxAllowedRewardSharePercentage = _ref5.maxAllowedRewardSharePercentage, txOptions = _ref5.txOptions;
5501
5378
  _context8.p = 1;
5502
5379
  addIpParam = {
5503
5380
  groupIpId: validateAddress(groupIpId),
5504
5381
  ipIds: validateAddresses(ipIds),
5505
- maxAllowedRewardShare: BigInt(getRevenueShare(maxAllowedRewardSharePercentage || 100, RevShareType.MAX_ALLOWED_REWARD_SHARE))
5382
+ maxAllowedRewardShare: BigInt(getRevenueShare(maxAllowedRewardSharePercentage === undefined ? 100 : maxAllowedRewardSharePercentage, RevShareType.MAX_ALLOWED_REWARD_SHARE_PERCENTAGE))
5506
5383
  };
5507
5384
  _context8.n = 2;
5508
5385
  return this.groupingModuleClient.addIp(addIpParam);
@@ -5538,7 +5415,7 @@ var GroupClient = /*#__PURE__*/function () {
5538
5415
  var _getClaimableReward = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(_ref6) {
5539
5416
  var groupIpId, currencyToken, memberIpIds, claimableReward, _t8;
5540
5417
  return _regenerator().w(function (_context9) {
5541
- while (1) switch (_context9.n) {
5418
+ while (1) switch (_context9.p = _context9.n) {
5542
5419
  case 0:
5543
5420
  groupIpId = _ref6.groupIpId, currencyToken = _ref6.currencyToken, memberIpIds = _ref6.memberIpIds;
5544
5421
  _context9.p = 1;
@@ -5574,7 +5451,7 @@ var GroupClient = /*#__PURE__*/function () {
5574
5451
  var _removeIpsFromGroup = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(_ref7) {
5575
5452
  var groupIpId, ipIds, txOptions, removeIpParam, txHash, _t9;
5576
5453
  return _regenerator().w(function (_context0) {
5577
- while (1) switch (_context0.n) {
5454
+ while (1) switch (_context0.p = _context0.n) {
5578
5455
  case 0:
5579
5456
  groupIpId = _ref7.groupIpId, ipIds = _ref7.ipIds, txOptions = _ref7.txOptions;
5580
5457
  _context0.p = 1;
@@ -5618,7 +5495,7 @@ var GroupClient = /*#__PURE__*/function () {
5618
5495
  var _claimReward = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(_ref8) {
5619
5496
  var groupIpId, currencyToken, memberIpIds, txOptions, claimRewardParam, txHash, _yield$waitForTxRecei2, receipt, claimedReward, _t0;
5620
5497
  return _regenerator().w(function (_context1) {
5621
- while (1) switch (_context1.n) {
5498
+ while (1) switch (_context1.p = _context1.n) {
5622
5499
  case 0:
5623
5500
  groupIpId = _ref8.groupIpId, currencyToken = _ref8.currencyToken, memberIpIds = _ref8.memberIpIds, txOptions = _ref8.txOptions;
5624
5501
  _context1.p = 1;
@@ -5677,7 +5554,7 @@ var GroupClient = /*#__PURE__*/function () {
5677
5554
  var _collectRoyalties = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(_ref9) {
5678
5555
  var groupIpId, currencyToken, txOptions, collectRoyaltiesParam, txHash, _yield$waitForTxRecei3, receipt, collectedRoyalties, _t1;
5679
5556
  return _regenerator().w(function (_context10) {
5680
- while (1) switch (_context10.n) {
5557
+ while (1) switch (_context10.p = _context10.n) {
5681
5558
  case 0:
5682
5559
  groupIpId = _ref9.groupIpId, currencyToken = _ref9.currencyToken, txOptions = _ref9.txOptions;
5683
5560
  _context10.p = 1;
@@ -5762,7 +5639,7 @@ var IPAccountClient = /*#__PURE__*/function () {
5762
5639
  var _execute = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request) {
5763
5640
  var _request$txOptions, ipAccountClient, req, txHash, _t;
5764
5641
  return _regenerator().w(function (_context) {
5765
- while (1) switch (_context.n) {
5642
+ while (1) switch (_context.p = _context.n) {
5766
5643
  case 0:
5767
5644
  _context.p = 0;
5768
5645
  ipAccountClient = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(request.ipId));
@@ -5822,7 +5699,7 @@ var IPAccountClient = /*#__PURE__*/function () {
5822
5699
  var _executeWithSig = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(request) {
5823
5700
  var _request$txOptions2, ipAccountClient, req, txHash, _t2;
5824
5701
  return _regenerator().w(function (_context2) {
5825
- while (1) switch (_context2.n) {
5702
+ while (1) switch (_context2.p = _context2.n) {
5826
5703
  case 0:
5827
5704
  _context2.p = 0;
5828
5705
  ipAccountClient = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(request.ipId));
@@ -5881,7 +5758,7 @@ var IPAccountClient = /*#__PURE__*/function () {
5881
5758
  var _getIpAccountNonce = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(ipId) {
5882
5759
  var ipAccount, _yield$ipAccount$stat, state, _t3;
5883
5760
  return _regenerator().w(function (_context3) {
5884
- while (1) switch (_context3.n) {
5761
+ while (1) switch (_context3.p = _context3.n) {
5885
5762
  case 0:
5886
5763
  _context3.p = 0;
5887
5764
  ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(ipId));
@@ -5913,7 +5790,7 @@ var IPAccountClient = /*#__PURE__*/function () {
5913
5790
  var _getToken = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(ipId) {
5914
5791
  var ipAccount, _yield$ipAccount$toke, _yield$ipAccount$toke2, chainId, tokenContract, tokenId, _t4;
5915
5792
  return _regenerator().w(function (_context4) {
5916
- while (1) switch (_context4.n) {
5793
+ while (1) switch (_context4.p = _context4.n) {
5917
5794
  case 0:
5918
5795
  _context4.p = 0;
5919
5796
  ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(ipId));
@@ -5952,7 +5829,7 @@ var IPAccountClient = /*#__PURE__*/function () {
5952
5829
  var _setIpMetadata = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref) {
5953
5830
  var ipId, metadataURI, metadataHash, txOptions, data, _yield$this$execute, txHash, _t5;
5954
5831
  return _regenerator().w(function (_context5) {
5955
- while (1) switch (_context5.n) {
5832
+ while (1) switch (_context5.p = _context5.n) {
5956
5833
  case 0:
5957
5834
  ipId = _ref.ipId, metadataURI = _ref.metadataURI, metadataHash = _ref.metadataHash, txOptions = _ref.txOptions;
5958
5835
  _context5.p = 1;
@@ -5998,7 +5875,7 @@ var IPAccountClient = /*#__PURE__*/function () {
5998
5875
  var _this = this;
5999
5876
  var ipId, tokens, txOptions, ipAccount, calls, txHash, _t6;
6000
5877
  return _regenerator().w(function (_context6) {
6001
- while (1) switch (_context6.n) {
5878
+ while (1) switch (_context6.p = _context6.n) {
6002
5879
  case 0:
6003
5880
  ipId = _ref2.ipId, tokens = _ref2.tokens, txOptions = _ref2.txOptions;
6004
5881
  _context6.p = 1;
@@ -6389,6 +6266,235 @@ var generateOperationSignature = /*#__PURE__*/function () {
6389
6266
  };
6390
6267
  }();
6391
6268
 
6269
+ var _PILFlavor;
6270
+ var PIL_URIS = {
6271
+ NCSR: "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/NCSR.json",
6272
+ COMMERCIAL_USE: "https://github.com/piplabs/pil-document/blob/9a1f803fcf8101a8a78f1dcc929e6014e144ab56/off-chain-terms/CommercialUse.json",
6273
+ COMMERCIAL_REMIX: "https://github.com/piplabs/pil-document/blob/ad67bb632a310d2557f8abcccd428e4c9c798db1/off-chain-terms/CommercialRemix.json",
6274
+ CC_BY: "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/CC-BY.json"
6275
+ };
6276
+ var COMMON_DEFAULTS = {
6277
+ transferable: true,
6278
+ royaltyPolicy: zeroAddress,
6279
+ defaultMintingFee: 0n,
6280
+ expiration: 0n,
6281
+ commercializerChecker: zeroAddress,
6282
+ commercializerCheckerData: zeroAddress,
6283
+ commercialRevShare: 0,
6284
+ commercialRevCeiling: 0n,
6285
+ derivativeRevCeiling: 0n,
6286
+ currency: zeroAddress
6287
+ };
6288
+
6289
+ /**
6290
+ * Pre-configured Programmable IP License (PIL) flavors for ease of use.
6291
+ *
6292
+ * The PIL is highly configurable, but these pre-configured license terms (flavors)
6293
+ * are the most popular options that cover common use cases.
6294
+ *
6295
+ * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors | PIL Flavors Documentation}
6296
+ *
6297
+ * @example
6298
+ * ```typescript
6299
+ * // Create a commercial use license
6300
+ * const commercialLicense = PILFlavor.commercialUse({
6301
+ * defaultMintingFee: 1000000000000000000n, // 1 IP minting fee
6302
+ * currencyToken: "0x1234...", // currency token
6303
+ * royaltyPolicy: "LAP" // royalty policy
6304
+ * });
6305
+ *
6306
+ * // Create a non-commercial social remixing license
6307
+ * const remixLicense = PILFlavor.nonCommercialSocialRemixing();
6308
+ * ```
6309
+ */
6310
+ var PILFlavor = /*#__PURE__*/_createClass(function PILFlavor() {
6311
+ _classCallCheck(this, PILFlavor);
6312
+ });
6313
+ _PILFlavor = PILFlavor;
6314
+ _defineProperty(PILFlavor, "_nonComSocialRemixingPIL", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
6315
+ commercialUse: false,
6316
+ commercialAttribution: false,
6317
+ derivativesAllowed: true,
6318
+ derivativesAttribution: true,
6319
+ derivativesApproval: false,
6320
+ derivativesReciprocal: true,
6321
+ uri: PIL_URIS.NCSR
6322
+ }));
6323
+ _defineProperty(PILFlavor, "_commercialUse", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
6324
+ commercialUse: true,
6325
+ commercialAttribution: true,
6326
+ derivativesAllowed: false,
6327
+ derivativesAttribution: false,
6328
+ derivativesApproval: false,
6329
+ derivativesReciprocal: false,
6330
+ uri: PIL_URIS.COMMERCIAL_USE
6331
+ }));
6332
+ _defineProperty(PILFlavor, "_commercialRemix", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
6333
+ commercialUse: true,
6334
+ commercialAttribution: true,
6335
+ derivativesAllowed: true,
6336
+ derivativesAttribution: true,
6337
+ derivativesApproval: false,
6338
+ derivativesReciprocal: true,
6339
+ uri: PIL_URIS.COMMERCIAL_REMIX
6340
+ }));
6341
+ _defineProperty(PILFlavor, "_creativeCommonsAttribution", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
6342
+ commercialUse: true,
6343
+ commercialAttribution: true,
6344
+ derivativesAllowed: true,
6345
+ derivativesAttribution: true,
6346
+ derivativesApproval: false,
6347
+ derivativesReciprocal: true,
6348
+ uri: PIL_URIS.CC_BY
6349
+ }));
6350
+ /**
6351
+ * Gets the values to create a Non-Commercial Social Remixing license terms flavor.
6352
+ * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#non-commercial-social-remixing | Non Commercial Social Remixing}
6353
+ */
6354
+ _defineProperty(PILFlavor, "nonCommercialSocialRemixing", function (request) {
6355
+ return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._nonComSocialRemixingPIL), request === null || request === void 0 ? void 0 : request.override), request === null || request === void 0 ? void 0 : request.chainId);
6356
+ });
6357
+ /**
6358
+ * Gets the values to create a Commercial Use license terms flavor.
6359
+ * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#commercial-use | Commercial Use}
6360
+ */
6361
+ _defineProperty(PILFlavor, "commercialUse", function (_ref) {
6362
+ var defaultMintingFee = _ref.defaultMintingFee,
6363
+ currency = _ref.currency,
6364
+ royaltyPolicy = _ref.royaltyPolicy,
6365
+ chainId = _ref.chainId,
6366
+ override = _ref.override;
6367
+ return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._commercialUse), {}, {
6368
+ defaultMintingFee: defaultMintingFee,
6369
+ currency: currency,
6370
+ royaltyPolicy: royaltyPolicy
6371
+ }, override), chainId);
6372
+ });
6373
+ /**
6374
+ * Gets the values to create a Commercial Remixing license terms flavor.
6375
+ * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#commercial-remix | Commercial Remix}
6376
+ */
6377
+ _defineProperty(PILFlavor, "commercialRemix", function (_ref2) {
6378
+ var defaultMintingFee = _ref2.defaultMintingFee,
6379
+ royaltyPolicy = _ref2.royaltyPolicy,
6380
+ currency = _ref2.currency,
6381
+ commercialRevShare = _ref2.commercialRevShare,
6382
+ chainId = _ref2.chainId,
6383
+ override = _ref2.override;
6384
+ return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._commercialRemix), {}, {
6385
+ commercialRevShare: commercialRevShare,
6386
+ defaultMintingFee: defaultMintingFee,
6387
+ currency: currency,
6388
+ royaltyPolicy: royaltyPolicy
6389
+ }, override), chainId);
6390
+ });
6391
+ /**
6392
+ * Gets the values to create a Creative Commons Attribution (CC-BY) license terms flavor.
6393
+ * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#creative-commons-attribution | Creative Commons Attribution}
6394
+ */
6395
+ _defineProperty(PILFlavor, "creativeCommonsAttribution", function (_ref3) {
6396
+ var royaltyPolicy = _ref3.royaltyPolicy,
6397
+ currency = _ref3.currency,
6398
+ chainId = _ref3.chainId,
6399
+ override = _ref3.override;
6400
+ return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._creativeCommonsAttribution), {}, {
6401
+ currency: currency,
6402
+ royaltyPolicy: royaltyPolicy
6403
+ }, override), chainId);
6404
+ });
6405
+ _defineProperty(PILFlavor, "validateLicenseTerms", function (params, chainId) {
6406
+ var normalized = _objectSpread2(_objectSpread2({}, params), {}, {
6407
+ defaultMintingFee: BigInt(params.defaultMintingFee),
6408
+ expiration: BigInt(params.expiration),
6409
+ commercialRevCeiling: BigInt(params.commercialRevCeiling),
6410
+ derivativeRevCeiling: BigInt(params.derivativeRevCeiling),
6411
+ royaltyPolicy: royaltyPolicyInputToAddress(params.royaltyPolicy, chainId)
6412
+ });
6413
+ var royaltyPolicy = normalized.royaltyPolicy,
6414
+ currency = normalized.currency;
6415
+
6416
+ // Validate royalty policy and currency relationship
6417
+ if (royaltyPolicy !== zeroAddress && currency === zeroAddress) {
6418
+ throw new PILFlavorError("Royalty policy requires currency token.");
6419
+ }
6420
+
6421
+ // Validate defaultMintingFee
6422
+ if (normalized.defaultMintingFee < 0n) {
6423
+ throw new PILFlavorError("DefaultMintingFee should be greater than or equal to 0.");
6424
+ }
6425
+ if (normalized.defaultMintingFee > 0n && normalized.royaltyPolicy === zeroAddress) {
6426
+ throw new PILFlavorError("Royalty policy is required when defaultMintingFee is greater than 0.");
6427
+ }
6428
+
6429
+ // Validate commercial use and derivatives
6430
+ _PILFlavor.verifyCommercialUse(normalized);
6431
+ _PILFlavor.verifyDerivatives(normalized);
6432
+ if (normalized.commercialRevShare > 100 || normalized.commercialRevShare < 0) {
6433
+ throw new PILFlavorError("commercialRevShare must be between 0 and 100.");
6434
+ }
6435
+ return normalized;
6436
+ });
6437
+ _defineProperty(PILFlavor, "verifyCommercialUse", function (terms) {
6438
+ if (!terms.commercialUse) {
6439
+ var commercialFields = [{
6440
+ field: "commercialAttribution",
6441
+ value: terms.commercialAttribution
6442
+ }, {
6443
+ field: "commercializerChecker",
6444
+ value: terms.commercializerChecker !== zeroAddress
6445
+ }, {
6446
+ field: "commercialRevShare",
6447
+ value: terms.commercialRevShare > 0
6448
+ }, {
6449
+ field: "commercialRevCeiling",
6450
+ value: terms.commercialRevCeiling > 0n
6451
+ }, {
6452
+ field: "derivativeRevCeiling",
6453
+ value: terms.derivativeRevCeiling > 0n
6454
+ }, {
6455
+ field: "royaltyPolicy",
6456
+ value: terms.royaltyPolicy !== zeroAddress
6457
+ }];
6458
+ for (var _i = 0, _commercialFields = commercialFields; _i < _commercialFields.length; _i++) {
6459
+ var _commercialFields$_i = _commercialFields[_i],
6460
+ field = _commercialFields$_i.field,
6461
+ value = _commercialFields$_i.value;
6462
+ if (value) {
6463
+ throw new PILFlavorError("Cannot add ".concat(field, " when commercial use is disabled."));
6464
+ }
6465
+ }
6466
+ } else {
6467
+ if (terms.royaltyPolicy === zeroAddress) {
6468
+ throw new PILFlavorError("Royalty policy is required when commercial use is enabled.");
6469
+ }
6470
+ }
6471
+ });
6472
+ _defineProperty(PILFlavor, "verifyDerivatives", function (terms) {
6473
+ if (!terms.derivativesAllowed) {
6474
+ var derivativeFields = [{
6475
+ field: "derivativesAttribution",
6476
+ value: terms.derivativesAttribution
6477
+ }, {
6478
+ field: "derivativesApproval",
6479
+ value: terms.derivativesApproval
6480
+ }, {
6481
+ field: "derivativesReciprocal",
6482
+ value: terms.derivativesReciprocal
6483
+ }, {
6484
+ field: "derivativeRevCeiling",
6485
+ value: terms.derivativeRevCeiling > 0n
6486
+ }];
6487
+ for (var _i2 = 0, _derivativeFields = derivativeFields; _i2 < _derivativeFields.length; _i2++) {
6488
+ var _derivativeFields$_i = _derivativeFields[_i2],
6489
+ field = _derivativeFields$_i.field,
6490
+ value = _derivativeFields$_i.value;
6491
+ if (value) {
6492
+ throw new PILFlavorError("Cannot add ".concat(field, " when derivative use is disabled."));
6493
+ }
6494
+ }
6495
+ }
6496
+ });
6497
+
6392
6498
  function _regeneratorValues(e) {
6393
6499
  if (null != e) {
6394
6500
  var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
@@ -6437,7 +6543,7 @@ var getPublicMinting = /*#__PURE__*/function () {
6437
6543
  }();
6438
6544
  var validateLicenseTermsData = /*#__PURE__*/function () {
6439
6545
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(licenseTermsData, rpcClient, chainId) {
6440
- var licenseTerms, processedLicenseTermsData, maxLicenseTokens, i, licenseTerm, licensingConfig, maxLicenseTokensValue;
6546
+ var licenseTerms, processedLicenseTermsData, maxLicenseTokens, i, licenseTerm, royaltyModuleReadOnlyClient, isWhitelistedArbitrationPolicy, isWhitelistedRoyaltyToken, licensingConfig, maxLicenseTokensValue;
6441
6547
  return _regenerator().w(function (_context2) {
6442
6548
  while (1) switch (_context2.n) {
6443
6549
  case 0:
@@ -6447,44 +6553,75 @@ var validateLicenseTermsData = /*#__PURE__*/function () {
6447
6553
  i = 0;
6448
6554
  case 1:
6449
6555
  if (!(i < licenseTermsData.length)) {
6450
- _context2.n = 7;
6556
+ _context2.n = 10;
6557
+ break;
6558
+ }
6559
+ licenseTerm = PILFlavor.validateLicenseTerms(licenseTermsData[i].terms, chainId);
6560
+ licenseTerm.commercialRevShare = getRevenueShare(licenseTerm.commercialRevShare);
6561
+ royaltyModuleReadOnlyClient = new RoyaltyModuleReadOnlyClient(rpcClient);
6562
+ if (!(validateAddress(licenseTerm.royaltyPolicy) !== zeroAddress)) {
6563
+ _context2.n = 3;
6451
6564
  break;
6452
6565
  }
6453
6566
  _context2.n = 2;
6454
- return validateLicenseTerms(licenseTermsData[i].terms, rpcClient);
6567
+ return royaltyModuleReadOnlyClient.isWhitelistedRoyaltyPolicy({
6568
+ royaltyPolicy: licenseTerm.royaltyPolicy
6569
+ });
6455
6570
  case 2:
6456
- licenseTerm = _context2.v;
6571
+ isWhitelistedArbitrationPolicy = _context2.v;
6572
+ if (isWhitelistedArbitrationPolicy) {
6573
+ _context2.n = 3;
6574
+ break;
6575
+ }
6576
+ throw new Error("The royalty policy ".concat(licenseTerm.royaltyPolicy, " is not whitelisted."));
6577
+ case 3:
6578
+ if (!(validateAddress(licenseTerm.currency) !== zeroAddress)) {
6579
+ _context2.n = 5;
6580
+ break;
6581
+ }
6582
+ _context2.n = 4;
6583
+ return royaltyModuleReadOnlyClient.isWhitelistedRoyaltyToken({
6584
+ token: licenseTerm.currency
6585
+ });
6586
+ case 4:
6587
+ isWhitelistedRoyaltyToken = _context2.v;
6588
+ if (isWhitelistedRoyaltyToken) {
6589
+ _context2.n = 5;
6590
+ break;
6591
+ }
6592
+ throw new Error("The currency token ".concat(licenseTerm.currency, " is not whitelisted."));
6593
+ case 5:
6457
6594
  licensingConfig = validateLicenseConfig(licenseTermsData[i].licensingConfig);
6458
6595
  if (!(licensingConfig.mintingFee > 0 && licenseTerm.royaltyPolicy === zeroAddress)) {
6459
- _context2.n = 3;
6596
+ _context2.n = 6;
6460
6597
  break;
6461
6598
  }
6462
6599
  throw new Error("A royalty policy must be provided when the minting fee is greater than 0.");
6463
- case 3:
6600
+ case 6:
6464
6601
  maxLicenseTokensValue = licenseTermsData[i].maxLicenseTokens;
6465
6602
  if (!(maxLicenseTokensValue !== undefined)) {
6466
- _context2.n = 5;
6603
+ _context2.n = 8;
6467
6604
  break;
6468
6605
  }
6469
6606
  if (!(maxLicenseTokensValue < 0)) {
6470
- _context2.n = 4;
6607
+ _context2.n = 7;
6471
6608
  break;
6472
6609
  }
6473
6610
  throw new Error("The max license tokens must be greater than or equal to 0.");
6474
- case 4:
6611
+ case 7:
6475
6612
  licensingConfig.licensingHook = totalLicenseTokenLimitHookAddress[chainId];
6476
6613
  maxLicenseTokens[i] = BigInt(maxLicenseTokensValue);
6477
- case 5:
6614
+ case 8:
6478
6615
  licenseTerms.push(licenseTerm);
6479
6616
  processedLicenseTermsData.push({
6480
6617
  terms: licenseTerm,
6481
6618
  licensingConfig: licensingConfig
6482
6619
  });
6483
- case 6:
6620
+ case 9:
6484
6621
  i++;
6485
6622
  _context2.n = 1;
6486
6623
  break;
6487
- case 7:
6624
+ case 10:
6488
6625
  return _context2.a(2, {
6489
6626
  licenseTerms: licenseTerms,
6490
6627
  licenseTermsData: processedLicenseTermsData,
@@ -6540,8 +6677,8 @@ var validateDerivativeData = /*#__PURE__*/function () {
6540
6677
  licenseTemplate: validateAddress(derivativeDataInput.licenseTemplate || licenseTemplateAddress),
6541
6678
  royaltyContext: zeroAddress,
6542
6679
  maxMintingFee: BigInt(derivativeDataInput.maxMintingFee || 0),
6543
- maxRts: Number(derivativeDataInput.maxRts || MAX_ROYALTY_TOKEN),
6544
- maxRevenueShare: getRevenueShare(derivativeDataInput.maxRevenueShare || 100, RevShareType.MAX_REVENUE_SHARE)
6680
+ maxRts: Number(derivativeDataInput.maxRts === undefined ? MAX_ROYALTY_TOKEN : derivativeDataInput.maxRts),
6681
+ maxRevenueShare: getRevenueShare(derivativeDataInput.maxRevenueShare === undefined ? 100 : derivativeDataInput.maxRevenueShare, RevShareType.MAX_REVENUE_SHARE)
6545
6682
  };
6546
6683
  if (!(derivativeData.parentIpIds.length === 0)) {
6547
6684
  _context3.n = 1;
@@ -6699,18 +6836,42 @@ var mergeSpenders = function mergeSpenders(previousSpenders, newSpenders) {
6699
6836
  return acc;
6700
6837
  }, _toConsumableArray(previousSpenders));
6701
6838
  };
6702
-
6703
- /**
6704
- * Aggregates the registration requests for the given workflow responses.
6705
- *
6706
- * This function combines multiple workflow responses into a consolidated request structure,
6707
- * aggregating:
6708
- * - Token spenders and their allowances
6709
- * - Total fees required for all operations
6710
- * - Encoded transaction data
6711
- * - Contract calls to be executed
6712
- *
6713
- * @remarks
6839
+ var hasMinterRole = /*#__PURE__*/function () {
6840
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(spgNftContract, rpcClient, walletAddress) {
6841
+ var spgNftContractImpl, minterRole;
6842
+ return _regenerator().w(function (_context6) {
6843
+ while (1) switch (_context6.n) {
6844
+ case 0:
6845
+ spgNftContractImpl = new SpgnftImplReadOnlyClient(rpcClient, spgNftContract);
6846
+ minterRole = toHex(1, {
6847
+ size: 32
6848
+ });
6849
+ _context6.n = 1;
6850
+ return spgNftContractImpl.hasRole({
6851
+ role: minterRole,
6852
+ account: walletAddress
6853
+ });
6854
+ case 1:
6855
+ return _context6.a(2, _context6.v);
6856
+ }
6857
+ }, _callee6);
6858
+ }));
6859
+ return function hasMinterRole(_x0, _x1, _x10) {
6860
+ return _ref8.apply(this, arguments);
6861
+ };
6862
+ }();
6863
+
6864
+ /**
6865
+ * Aggregates the registration requests for the given workflow responses.
6866
+ *
6867
+ * This function combines multiple workflow responses into a consolidated request structure,
6868
+ * aggregating:
6869
+ * - Token spenders and their allowances
6870
+ * - Total fees required for all operations
6871
+ * - Encoded transaction data
6872
+ * - Contract calls to be executed
6873
+ *
6874
+ * @remarks
6714
6875
  * The function handles two execution modes:
6715
6876
  * 1. If `disableMulticallWhenPossible` is true or a workflow response supports multicall3
6716
6877
  * (indicated by `isUseMulticall3`), individual contract calls are added to the `contractCall` array.
@@ -6794,7 +6955,7 @@ var handleMulticall = /*#__PURE__*/function () {
6794
6955
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
6795
6956
  var txHashes, _iterator2, _step2, call, txHash, _t;
6796
6957
  return _regenerator().w(function (_context) {
6797
- while (1) switch (_context.n) {
6958
+ while (1) switch (_context.p = _context.n) {
6798
6959
  case 0:
6799
6960
  txHashes = [];
6800
6961
  _iterator2 = _createForOfIteratorHelper(contractCall);
@@ -7723,7 +7884,7 @@ var prepareRoyaltyTokensDistributionRequests = /*#__PURE__*/function () {
7723
7884
  var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(_ref19) {
7724
7885
  var royaltyDistributionRequests, ipRegisteredLog, ipRoyaltyVault, rpcClient, wallet, chainId, results, _iterator, _step, _loop, _t;
7725
7886
  return _regenerator().w(function (_context0) {
7726
- while (1) switch (_context0.n) {
7887
+ while (1) switch (_context0.p = _context0.n) {
7727
7888
  case 0:
7728
7889
  royaltyDistributionRequests = _ref19.royaltyDistributionRequests, ipRegisteredLog = _ref19.ipRegisteredLog, ipRoyaltyVault = _ref19.ipRoyaltyVault, rpcClient = _ref19.rpcClient, wallet = _ref19.wallet, chainId = _ref19.chainId;
7729
7890
  if (!(royaltyDistributionRequests.length === 0)) {
@@ -7855,7 +8016,7 @@ var IPAssetClient = /*#__PURE__*/function () {
7855
8016
  var _register = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request) {
7856
8017
  var _request$txOptions, tokenId, ipIdAddress, isRegistered, object, calculatedDeadline, signature, txHash, txReceipt, log, _t;
7857
8018
  return _regenerator().w(function (_context) {
7858
- while (1) switch (_context.n) {
8019
+ while (1) switch (_context.p = _context.n) {
7859
8020
  case 0:
7860
8021
  _context.p = 0;
7861
8022
  tokenId = BigInt(request.tokenId);
@@ -7998,7 +8159,7 @@ var IPAssetClient = /*#__PURE__*/function () {
7998
8159
  var _this = this;
7999
8160
  var contracts, spgContracts, encodedTxData, _iterator, _step, arg, result, spgTxHash, txHash, results, processTransaction, _t2, _t3, _t4;
8000
8161
  return _regenerator().w(function (_context3) {
8001
- while (1) switch (_context3.n) {
8162
+ while (1) switch (_context3.p = _context3.n) {
8002
8163
  case 0:
8003
8164
  _context3.p = 0;
8004
8165
  contracts = [];
@@ -8145,7 +8306,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8145
8306
  var _this2 = this;
8146
8307
  var _request$txOptions2, isChildIpIdRegistered, derivativeData, object, encodedTxData, _request$options, contractCall, _t5;
8147
8308
  return _regenerator().w(function (_context4) {
8148
- while (1) switch (_context4.n) {
8309
+ while (1) switch (_context4.p = _context4.n) {
8149
8310
  case 0:
8150
8311
  _context4.p = 0;
8151
8312
  _context4.n = 1;
@@ -8220,7 +8381,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8220
8381
  var _batchRegisterDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(request) {
8221
8382
  var contracts, licenseModuleAddress, _iterator2, _step2, arg, calculatedDeadline, ipAccount, data, _yield$ipAccount$stat, state, signature, txHash, _t6, _t7, _t8;
8222
8383
  return _regenerator().w(function (_context5) {
8223
- while (1) switch (_context5.n) {
8384
+ while (1) switch (_context5.p = _context5.n) {
8224
8385
  case 0:
8225
8386
  _context5.p = 0;
8226
8387
  contracts = [];
@@ -8259,7 +8420,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8259
8420
  functionName: "registerDerivative",
8260
8421
  args: [arg.childIpId, arg.parentIpIds, arg.licenseTermsIds.map(function (id) {
8261
8422
  return BigInt(id);
8262
- }), arg.licenseTemplate || this.licenseTemplateClient.address, zeroAddress, BigInt(arg.maxMintingFee || 0), Number(arg.maxRts || MAX_ROYALTY_TOKEN), getRevenueShare(arg.maxRevenueShare || 100, RevShareType.MAX_REVENUE_SHARE)]
8423
+ }), arg.licenseTemplate || this.licenseTemplateClient.address, zeroAddress, BigInt(arg.maxMintingFee || 0), Number(arg.maxRts === undefined ? MAX_ROYALTY_TOKEN : arg.maxRts), getRevenueShare(arg.maxRevenueShare === undefined ? 100 : arg.maxRevenueShare, RevShareType.MAX_REVENUE_SHARE)]
8263
8424
  });
8264
8425
  _context5.n = 8;
8265
8426
  return ipAccount.state();
@@ -8340,7 +8501,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8340
8501
  var _registerDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(request) {
8341
8502
  var _request$txOptions3, req, isChildIpIdRegistered, txHash, _t9;
8342
8503
  return _regenerator().w(function (_context6) {
8343
- while (1) switch (_context6.n) {
8504
+ while (1) switch (_context6.p = _context6.n) {
8344
8505
  case 0:
8345
8506
  _context6.p = 0;
8346
8507
  req = {
@@ -8420,39 +8581,34 @@ var IPAssetClient = /*#__PURE__*/function () {
8420
8581
  value: (function () {
8421
8582
  var _mintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(request) {
8422
8583
  var _this3 = this;
8423
- var _request$txOptions4, _request$options2, _yield$validateLicens, licenseTerms, _yield$transformRegis, transformRequest, encodedTxData, contractCall, rsp, computedLicenseTermsIds, maxLicenseTokensTxHashes, _t0;
8584
+ var _request$txOptions4, _request$options2, _yield$transformRegis, transformRequest, encodedTxData, contractCall, rsp, computedLicenseTermsIds, maxLicenseTokensTxHashes, _t0;
8424
8585
  return _regenerator().w(function (_context7) {
8425
- while (1) switch (_context7.n) {
8586
+ while (1) switch (_context7.p = _context7.n) {
8426
8587
  case 0:
8427
8588
  _context7.p = 0;
8428
8589
  _context7.n = 1;
8429
- return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
8430
- case 1:
8431
- _yield$validateLicens = _context7.v;
8432
- licenseTerms = _yield$validateLicens.licenseTerms;
8433
- _context7.n = 2;
8434
8590
  return transformRegistrationRequest({
8435
8591
  request: request,
8436
8592
  rpcClient: this.rpcClient,
8437
8593
  wallet: this.wallet,
8438
8594
  chainId: this.chainId
8439
8595
  });
8440
- case 2:
8596
+ case 1:
8441
8597
  _yield$transformRegis = _context7.v;
8442
8598
  transformRequest = _yield$transformRegis.transformRequest;
8443
8599
  encodedTxData = this.licenseAttachmentWorkflowsClient.mintAndRegisterIpAndAttachPilTermsEncode(transformRequest);
8444
8600
  if (!((_request$txOptions4 = request.txOptions) !== null && _request$txOptions4 !== void 0 && _request$txOptions4.encodedTxDataOnly)) {
8445
- _context7.n = 3;
8601
+ _context7.n = 2;
8446
8602
  break;
8447
8603
  }
8448
8604
  return _context7.a(2, {
8449
8605
  encodedTxData: encodedTxData
8450
8606
  });
8451
- case 3:
8607
+ case 2:
8452
8608
  contractCall = function contractCall() {
8453
8609
  return _this3.licenseAttachmentWorkflowsClient.mintAndRegisterIpAndAttachPilTerms(transformRequest);
8454
8610
  };
8455
- _context7.n = 4;
8611
+ _context7.n = 3;
8456
8612
  return this.handleRegistrationWithFees({
8457
8613
  wipOptions: (_request$options2 = request.options) === null || _request$options2 === void 0 ? void 0 : _request$options2.wipOptions,
8458
8614
  sender: this.walletAddress,
@@ -8462,31 +8618,33 @@ var IPAssetClient = /*#__PURE__*/function () {
8462
8618
  contractCall: contractCall,
8463
8619
  txOptions: request.txOptions
8464
8620
  });
8465
- case 4:
8621
+ case 3:
8466
8622
  rsp = _context7.v;
8467
- _context7.n = 5;
8468
- return this.getLicenseTermsId(licenseTerms);
8469
- case 5:
8623
+ _context7.n = 4;
8624
+ return this.getLicenseTermsId(transformRequest.licenseTermsData.map(function (data) {
8625
+ return data.terms;
8626
+ }));
8627
+ case 4:
8470
8628
  computedLicenseTermsIds = _context7.v;
8471
- _context7.n = 6;
8629
+ _context7.n = 5;
8472
8630
  return this.setMaxLicenseTokens({
8473
8631
  maxLicenseTokensData: request.licenseTermsData,
8474
8632
  licensorIpId: rsp.ipId,
8475
8633
  licenseTermsIds: computedLicenseTermsIds
8476
8634
  });
8477
- case 6:
8635
+ case 5:
8478
8636
  maxLicenseTokensTxHashes = _context7.v;
8479
8637
  return _context7.a(2, _objectSpread2(_objectSpread2({}, rsp), {}, {
8480
8638
  licenseTermsIds: computedLicenseTermsIds
8481
8639
  }, maxLicenseTokensTxHashes.length > 0 && {
8482
8640
  maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
8483
8641
  }));
8484
- case 7:
8485
- _context7.p = 7;
8642
+ case 6:
8643
+ _context7.p = 6;
8486
8644
  _t0 = _context7.v;
8487
8645
  return _context7.a(2, handleError(_t0, "Failed to mint and register IP and attach PIL terms"));
8488
8646
  }
8489
- }, _callee7, this, [[0, 7]]);
8647
+ }, _callee7, this, [[0, 6]]);
8490
8648
  }));
8491
8649
  function mintAndRegisterIpAssetWithPilTerms(_x8) {
8492
8650
  return _mintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
@@ -8505,7 +8663,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8505
8663
  var _batchMintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(request) {
8506
8664
  var calldata, _iterator3, _step3, arg, result, txHash, txReceipt, results, j, licenseTerms, licenseTermsData, i, licenseTerm, licenseTermsIds, maxLicenseTokensTxHashes, _t1, _t10;
8507
8665
  return _regenerator().w(function (_context8) {
8508
- while (1) switch (_context8.n) {
8666
+ while (1) switch (_context8.p = _context8.n) {
8509
8667
  case 0:
8510
8668
  _context8.p = 0;
8511
8669
  calldata = [];
@@ -8565,58 +8723,46 @@ var IPAssetClient = /*#__PURE__*/function () {
8565
8723
  j = 0;
8566
8724
  case 11:
8567
8725
  if (!(j < request.args.length)) {
8568
- _context8.n = 19;
8726
+ _context8.n = 15;
8569
8727
  break;
8570
8728
  }
8571
8729
  licenseTerms = [];
8572
8730
  licenseTermsData = request.args[j].licenseTermsData;
8573
- i = 0;
8574
- case 12:
8575
- if (!(i < licenseTermsData.length)) {
8576
- _context8.n = 15;
8577
- break;
8731
+ for (i = 0; i < licenseTermsData.length; i++) {
8732
+ licenseTerm = PILFlavor.validateLicenseTerms(licenseTermsData[i].terms, this.chainId);
8733
+ licenseTerms.push(licenseTerm);
8578
8734
  }
8579
- _context8.n = 13;
8580
- return validateLicenseTerms(licenseTermsData[i].terms, this.rpcClient);
8581
- case 13:
8582
- licenseTerm = _context8.v;
8583
- licenseTerms.push(licenseTerm);
8584
- case 14:
8585
- i++;
8586
8735
  _context8.n = 12;
8587
- break;
8588
- case 15:
8589
- _context8.n = 16;
8590
8736
  return this.getLicenseTermsId(licenseTerms);
8591
- case 16:
8737
+ case 12:
8592
8738
  licenseTermsIds = _context8.v;
8593
8739
  results[j].licenseTermsIds = licenseTermsIds;
8594
- _context8.n = 17;
8740
+ _context8.n = 13;
8595
8741
  return this.setMaxLicenseTokens({
8596
8742
  maxLicenseTokensData: licenseTermsData,
8597
8743
  licensorIpId: results[j].ipId,
8598
8744
  licenseTermsIds: licenseTermsIds
8599
8745
  });
8600
- case 17:
8746
+ case 13:
8601
8747
  maxLicenseTokensTxHashes = _context8.v;
8602
8748
  if (maxLicenseTokensTxHashes.length > 0) {
8603
8749
  results[j].maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
8604
8750
  }
8605
- case 18:
8751
+ case 14:
8606
8752
  j++;
8607
8753
  _context8.n = 11;
8608
8754
  break;
8609
- case 19:
8755
+ case 15:
8610
8756
  return _context8.a(2, {
8611
8757
  txHash: txHash,
8612
8758
  results: results
8613
8759
  });
8614
- case 20:
8615
- _context8.p = 20;
8760
+ case 16:
8761
+ _context8.p = 16;
8616
8762
  _t10 = _context8.v;
8617
8763
  return _context8.a(2, handleError(_t10, "Failed to batch mint and register IP and attach PIL terms"));
8618
8764
  }
8619
- }, _callee8, this, [[1, 6, 7, 8], [0, 20]]);
8765
+ }, _callee8, this, [[1, 6, 7, 8], [0, 16]]);
8620
8766
  }));
8621
8767
  function batchMintAndRegisterIpAssetWithPilTerms(_x9) {
8622
8768
  return _batchMintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
@@ -8633,9 +8779,9 @@ var IPAssetClient = /*#__PURE__*/function () {
8633
8779
  key: "registerIpAndAttachPilTerms",
8634
8780
  value: (function () {
8635
8781
  var _registerIpAndAttachPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(request) {
8636
- var _request$txOptions5, ipIdAddress, isRegistered, _yield$validateLicens2, licenseTerms, _yield$transformRegis2, _transformRequest, txHash, txReceipt, log, licenseTermsIds, maxLicenseTokensTxHashes, _t11;
8782
+ var _request$txOptions5, ipIdAddress, isRegistered, _yield$validateLicens, licenseTerms, _yield$transformRegis2, _transformRequest, txHash, txReceipt, log, licenseTermsIds, maxLicenseTokensTxHashes, _t11;
8637
8783
  return _regenerator().w(function (_context9) {
8638
- while (1) switch (_context9.n) {
8784
+ while (1) switch (_context9.p = _context9.n) {
8639
8785
  case 0:
8640
8786
  _context9.p = 0;
8641
8787
  request.tokenId = BigInt(request.tokenId);
@@ -8662,8 +8808,8 @@ var IPAssetClient = /*#__PURE__*/function () {
8662
8808
  _context9.n = 4;
8663
8809
  return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
8664
8810
  case 4:
8665
- _yield$validateLicens2 = _context9.v;
8666
- licenseTerms = _yield$validateLicens2.licenseTerms;
8811
+ _yield$validateLicens = _context9.v;
8812
+ licenseTerms = _yield$validateLicens.licenseTerms;
8667
8813
  _context9.n = 5;
8668
8814
  return transformRegistrationRequest({
8669
8815
  request: request,
@@ -8741,7 +8887,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8741
8887
  var _this4 = this;
8742
8888
  var _request$txOptions6, _request$options3, tokenId, ipIdAddress, isRegistered, _yield$transformRegis3, _transformRequest2, encodedTxData, contractCall, _t12;
8743
8889
  return _regenerator().w(function (_context0) {
8744
- while (1) switch (_context0.n) {
8890
+ while (1) switch (_context0.p = _context0.n) {
8745
8891
  case 0:
8746
8892
  _context0.p = 0;
8747
8893
  tokenId = BigInt(request.tokenId);
@@ -8823,7 +8969,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8823
8969
  var _this5 = this;
8824
8970
  var _request$txOptions7, _request$options4, spgNftContract, _yield$transformRegis4, _transformRequest3, encodedTxData, contractCall, _t13;
8825
8971
  return _regenerator().w(function (_context1) {
8826
- while (1) switch (_context1.n) {
8972
+ while (1) switch (_context1.p = _context1.n) {
8827
8973
  case 0:
8828
8974
  _context1.p = 0;
8829
8975
  spgNftContract = validateAddress(request.spgNftContract);
@@ -8883,7 +9029,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8883
9029
  var _batchMintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(request) {
8884
9030
  var calldata, _iterator4, _step4, arg, result, txHash, txReceipt, _t14, _t15, _t16;
8885
9031
  return _regenerator().w(function (_context10) {
8886
- while (1) switch (_context10.n) {
9032
+ while (1) switch (_context10.p = _context10.n) {
8887
9033
  case 0:
8888
9034
  _context10.p = 0;
8889
9035
  calldata = [];
@@ -8968,7 +9114,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8968
9114
  var _this6 = this;
8969
9115
  var _request$txOptions8, _request$options5, _object, encodedTxData, contractCall, _t17;
8970
9116
  return _regenerator().w(function (_context11) {
8971
- while (1) switch (_context11.n) {
9117
+ while (1) switch (_context11.p = _context11.n) {
8972
9118
  case 0:
8973
9119
  _context11.p = 0;
8974
9120
  _object = {
@@ -9012,6 +9158,241 @@ var IPAssetClient = /*#__PURE__*/function () {
9012
9158
  }
9013
9159
  return mintAndRegisterIp;
9014
9160
  }()
9161
+ /**
9162
+ * Batch mints NFTs from SPGNFT collections and registers them as IP assets.
9163
+ *
9164
+ * Optimizes transaction processing by grouping requests and automatically selecting the most efficient multicall strategy:
9165
+ * - Uses `multicall3` for public minting contracts.
9166
+ * - Uses `SPG's multicall` for private minting contracts.
9167
+ *
9168
+ * @remark
9169
+ * For private minting, verifies the `caller` has the `minter role` and avoids `multicall3` batching to ensure correct `msg.sender`.
9170
+ *
9171
+ * Automatically manages minting fees, including wrapping IP tokens into WIP tokens if balances are insufficient, and checks or sets allowances for all spenders as needed.
9172
+ * The `multicall` and token handling behavior can be configured via `wipOptions`.
9173
+ *
9174
+ * Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
9175
+ */
9176
+ )
9177
+ }, {
9178
+ key: "batchMintAndRegisterIp",
9179
+ value: (function () {
9180
+ var _batchMintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(request) {
9181
+ var _this7 = this;
9182
+ var publicMintEncodedTxs, publicMintSpenders, privateMintEncodedTxs, privateMintSpenders, publicMintFeesTotal, privateMintFeesTotal, _iterator5, _step5, req, registrationRequest, isPublicMinting, nftMintFee, encodeTx, isMinterRole, handlePublicMintTransactions, handlePrivateMintTransactions, transactionResponses, publicMintResponse, privateMintResponse, _t18, _t19, _t20, _t21;
9183
+ return _regenerator().w(function (_context14) {
9184
+ while (1) switch (_context14.p = _context14.n) {
9185
+ case 0:
9186
+ _context14.p = 0;
9187
+ publicMintEncodedTxs = [];
9188
+ publicMintSpenders = [];
9189
+ privateMintEncodedTxs = [];
9190
+ privateMintSpenders = [];
9191
+ publicMintFeesTotal = 0n;
9192
+ privateMintFeesTotal = 0n;
9193
+ _iterator5 = _createForOfIteratorHelper(request.requests);
9194
+ _context14.p = 1;
9195
+ _iterator5.s();
9196
+ case 2:
9197
+ if ((_step5 = _iterator5.n()).done) {
9198
+ _context14.n = 9;
9199
+ break;
9200
+ }
9201
+ req = _step5.value;
9202
+ registrationRequest = {
9203
+ spgNftContract: validateAddress(req.spgNftContract),
9204
+ recipient: validateAddress(req.recipient || this.walletAddress),
9205
+ ipMetadata: getIpMetadataForWorkflow(req.ipMetadata),
9206
+ allowDuplicates: req.allowDuplicates || true
9207
+ };
9208
+ _context14.n = 3;
9209
+ return getPublicMinting(req.spgNftContract, this.rpcClient);
9210
+ case 3:
9211
+ isPublicMinting = _context14.v;
9212
+ _context14.n = 4;
9213
+ return calculateSPGWipMintFee(new SpgnftImplReadOnlyClient(this.rpcClient, registrationRequest.spgNftContract));
9214
+ case 4:
9215
+ nftMintFee = _context14.v;
9216
+ encodeTx = {
9217
+ to: this.registrationWorkflowsClient.address,
9218
+ data: encodeFunctionData({
9219
+ abi: registrationWorkflowsAbi,
9220
+ functionName: "mintAndRegisterIp",
9221
+ args: [registrationRequest.spgNftContract, registrationRequest.recipient, registrationRequest.ipMetadata, registrationRequest.allowDuplicates]
9222
+ })
9223
+ };
9224
+ if (!isPublicMinting) {
9225
+ _context14.n = 5;
9226
+ break;
9227
+ }
9228
+ publicMintFeesTotal += nftMintFee;
9229
+ publicMintSpenders = mergeSpenders(publicMintSpenders, [{
9230
+ address: registrationRequest.spgNftContract,
9231
+ amount: nftMintFee
9232
+ }]);
9233
+ publicMintEncodedTxs.push(encodeTx);
9234
+ _context14.n = 8;
9235
+ break;
9236
+ case 5:
9237
+ _context14.n = 6;
9238
+ return hasMinterRole(registrationRequest.spgNftContract, this.rpcClient, this.walletAddress);
9239
+ case 6:
9240
+ isMinterRole = _context14.v;
9241
+ if (isMinterRole) {
9242
+ _context14.n = 7;
9243
+ break;
9244
+ }
9245
+ throw new Error("Caller ".concat(this.walletAddress, " does not have the minter role for ").concat(registrationRequest.spgNftContract));
9246
+ case 7:
9247
+ privateMintFeesTotal += nftMintFee;
9248
+ privateMintSpenders = mergeSpenders(privateMintSpenders, [{
9249
+ address: registrationRequest.spgNftContract,
9250
+ amount: nftMintFee
9251
+ }]);
9252
+ privateMintEncodedTxs.push(encodeTx);
9253
+ case 8:
9254
+ _context14.n = 2;
9255
+ break;
9256
+ case 9:
9257
+ _context14.n = 11;
9258
+ break;
9259
+ case 10:
9260
+ _context14.p = 10;
9261
+ _t18 = _context14.v;
9262
+ _iterator5.e(_t18);
9263
+ case 11:
9264
+ _context14.p = 11;
9265
+ _iterator5.f();
9266
+ return _context14.f(11);
9267
+ case 12:
9268
+ handlePublicMintTransactions = /*#__PURE__*/function () {
9269
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
9270
+ return _regenerator().w(function (_context12) {
9271
+ while (1) switch (_context12.n) {
9272
+ case 0:
9273
+ _context12.n = 1;
9274
+ return contractCallWithFees({
9275
+ totalFees: publicMintFeesTotal,
9276
+ options: {
9277
+ wipOptions: request.wipOptions
9278
+ },
9279
+ multicall3Address: _this7.multicall3Client.address,
9280
+ rpcClient: _this7.rpcClient,
9281
+ tokenSpenders: publicMintSpenders,
9282
+ contractCall: function contractCall() {
9283
+ return _this7.registrationWorkflowsClient.multicall({
9284
+ data: publicMintEncodedTxs.map(function (tx) {
9285
+ return tx.data;
9286
+ })
9287
+ });
9288
+ },
9289
+ sender: _this7.walletAddress,
9290
+ wallet: _this7.wallet,
9291
+ txOptions: request.txOptions,
9292
+ encodedTxs: publicMintEncodedTxs
9293
+ });
9294
+ case 1:
9295
+ return _context12.a(2, _context12.v);
9296
+ }
9297
+ }, _callee12);
9298
+ }));
9299
+ return function handlePublicMintTransactions() {
9300
+ return _ref2.apply(this, arguments);
9301
+ };
9302
+ }();
9303
+ handlePrivateMintTransactions = /*#__PURE__*/function () {
9304
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
9305
+ return _regenerator().w(function (_context13) {
9306
+ while (1) switch (_context13.n) {
9307
+ case 0:
9308
+ _context13.n = 1;
9309
+ return contractCallWithFees({
9310
+ totalFees: privateMintFeesTotal,
9311
+ options: {
9312
+ wipOptions: _objectSpread2(_objectSpread2({}, request.wipOptions), {}, {
9313
+ useMulticallWhenPossible: false
9314
+ })
9315
+ },
9316
+ multicall3Address: _this7.multicall3Client.address,
9317
+ rpcClient: _this7.rpcClient,
9318
+ tokenSpenders: privateMintSpenders,
9319
+ contractCall: function contractCall() {
9320
+ return _this7.registrationWorkflowsClient.multicall({
9321
+ data: privateMintEncodedTxs.map(function (tx) {
9322
+ return tx.data;
9323
+ })
9324
+ });
9325
+ },
9326
+ sender: _this7.walletAddress,
9327
+ wallet: _this7.wallet,
9328
+ txOptions: request.txOptions,
9329
+ encodedTxs: privateMintEncodedTxs
9330
+ });
9331
+ case 1:
9332
+ return _context13.a(2, _context13.v);
9333
+ }
9334
+ }, _callee13);
9335
+ }));
9336
+ return function handlePrivateMintTransactions() {
9337
+ return _ref3.apply(this, arguments);
9338
+ };
9339
+ }();
9340
+ transactionResponses = [];
9341
+ if (!(privateMintEncodedTxs.length === 0)) {
9342
+ _context14.n = 14;
9343
+ break;
9344
+ }
9345
+ _context14.n = 13;
9346
+ return handlePublicMintTransactions();
9347
+ case 13:
9348
+ _t19 = _context14.v;
9349
+ transactionResponses = [_t19];
9350
+ _context14.n = 19;
9351
+ break;
9352
+ case 14:
9353
+ if (!(publicMintEncodedTxs.length === 0)) {
9354
+ _context14.n = 16;
9355
+ break;
9356
+ }
9357
+ _context14.n = 15;
9358
+ return handlePrivateMintTransactions();
9359
+ case 15:
9360
+ _t20 = _context14.v;
9361
+ transactionResponses = [_t20];
9362
+ _context14.n = 19;
9363
+ break;
9364
+ case 16:
9365
+ _context14.n = 17;
9366
+ return handlePublicMintTransactions();
9367
+ case 17:
9368
+ publicMintResponse = _context14.v;
9369
+ _context14.n = 18;
9370
+ return handlePrivateMintTransactions();
9371
+ case 18:
9372
+ privateMintResponse = _context14.v;
9373
+ transactionResponses = [publicMintResponse, privateMintResponse];
9374
+ case 19:
9375
+ return _context14.a(2, {
9376
+ registrationResults: transactionResponses.map(function (r) {
9377
+ return {
9378
+ txHash: r.txHash,
9379
+ receipt: r.receipt,
9380
+ ipIdsAndTokenIds: _this7.getIpIdAndTokenIdsFromEvent(r.receipt, "spgNftContract")
9381
+ };
9382
+ })
9383
+ });
9384
+ case 20:
9385
+ _context14.p = 20;
9386
+ _t21 = _context14.v;
9387
+ return _context14.a(2, handleError(_t21, "Failed to batch mint and register IP"));
9388
+ }
9389
+ }, _callee14, this, [[1, 10, 11, 12], [0, 20]]);
9390
+ }));
9391
+ function batchMintAndRegisterIp(_x13) {
9392
+ return _batchMintAndRegisterIp.apply(this, arguments);
9393
+ }
9394
+ return batchMintAndRegisterIp;
9395
+ }()
9015
9396
  /**
9016
9397
  * Register Programmable IP License Terms (if unregistered) and attach it to IP.
9017
9398
  *
@@ -9021,40 +9402,40 @@ var IPAssetClient = /*#__PURE__*/function () {
9021
9402
  }, {
9022
9403
  key: "registerPilTermsAndAttach",
9023
9404
  value: (function () {
9024
- var _registerPilTermsAndAttach = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(request) {
9025
- var _request$txOptions9, ipId, isRegistered, _yield$validateLicens3, licenseTerms, licenseTermsData, calculatedDeadline, ipAccount, _yield$ipAccount$stat2, state, signature, _object2, txHash, licenseTermsIds, maxLicenseTokensTxHashes, _t18;
9026
- return _regenerator().w(function (_context12) {
9027
- while (1) switch (_context12.n) {
9405
+ var _registerPilTermsAndAttach = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(request) {
9406
+ var _request$txOptions9, ipId, isRegistered, _yield$validateLicens2, licenseTerms, licenseTermsData, calculatedDeadline, ipAccount, _yield$ipAccount$stat2, state, signature, _object2, txHash, licenseTermsIds, maxLicenseTokensTxHashes, _t22;
9407
+ return _regenerator().w(function (_context15) {
9408
+ while (1) switch (_context15.p = _context15.n) {
9028
9409
  case 0:
9029
- _context12.p = 0;
9410
+ _context15.p = 0;
9030
9411
  ipId = request.ipId;
9031
- _context12.n = 1;
9412
+ _context15.n = 1;
9032
9413
  return this.isRegistered(ipId);
9033
9414
  case 1:
9034
- isRegistered = _context12.v;
9415
+ isRegistered = _context15.v;
9035
9416
  if (isRegistered) {
9036
- _context12.n = 2;
9417
+ _context15.n = 2;
9037
9418
  break;
9038
9419
  }
9039
9420
  throw new Error("The IP with id ".concat(ipId, " is not registered."));
9040
9421
  case 2:
9041
- _context12.n = 3;
9422
+ _context15.n = 3;
9042
9423
  return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
9043
9424
  case 3:
9044
- _yield$validateLicens3 = _context12.v;
9045
- licenseTerms = _yield$validateLicens3.licenseTerms;
9046
- licenseTermsData = _yield$validateLicens3.licenseTermsData;
9047
- _context12.n = 4;
9425
+ _yield$validateLicens2 = _context15.v;
9426
+ licenseTerms = _yield$validateLicens2.licenseTerms;
9427
+ licenseTermsData = _yield$validateLicens2.licenseTermsData;
9428
+ _context15.n = 4;
9048
9429
  return getCalculatedDeadline(this.rpcClient, request.deadline);
9049
9430
  case 4:
9050
- calculatedDeadline = _context12.v;
9431
+ calculatedDeadline = _context15.v;
9051
9432
  ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, ipId);
9052
- _context12.n = 5;
9433
+ _context15.n = 5;
9053
9434
  return ipAccount.state();
9054
9435
  case 5:
9055
- _yield$ipAccount$stat2 = _context12.v;
9436
+ _yield$ipAccount$stat2 = _context15.v;
9056
9437
  state = _yield$ipAccount$stat2.result;
9057
- _context12.n = 6;
9438
+ _context15.n = 6;
9058
9439
  return generateOperationSignature({
9059
9440
  ipIdAddress: ipId,
9060
9441
  methodType: SignatureMethodType.REGISTER_PIL_TERMS_AND_ATTACH,
@@ -9064,7 +9445,7 @@ var IPAssetClient = /*#__PURE__*/function () {
9064
9445
  chainId: this.chainId
9065
9446
  });
9066
9447
  case 6:
9067
- signature = _context12.v;
9448
+ signature = _context15.v;
9068
9449
  _object2 = {
9069
9450
  ipId: ipId,
9070
9451
  licenseTermsData: licenseTermsData,
@@ -9075,53 +9456,53 @@ var IPAssetClient = /*#__PURE__*/function () {
9075
9456
  }
9076
9457
  };
9077
9458
  if (!((_request$txOptions9 = request.txOptions) !== null && _request$txOptions9 !== void 0 && _request$txOptions9.encodedTxDataOnly)) {
9078
- _context12.n = 7;
9459
+ _context15.n = 7;
9079
9460
  break;
9080
9461
  }
9081
- return _context12.a(2, {
9462
+ return _context15.a(2, {
9082
9463
  encodedTxData: this.licenseAttachmentWorkflowsClient.registerPilTermsAndAttachEncode(_object2)
9083
9464
  });
9084
9465
  case 7:
9085
- _context12.n = 8;
9466
+ _context15.n = 8;
9086
9467
  return this.licenseAttachmentWorkflowsClient.registerPilTermsAndAttach(_object2);
9087
9468
  case 8:
9088
- txHash = _context12.v;
9089
- _context12.n = 9;
9469
+ txHash = _context15.v;
9470
+ _context15.n = 9;
9090
9471
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
9091
9472
  hash: txHash
9092
9473
  }));
9093
9474
  case 9:
9094
- _context12.n = 10;
9475
+ _context15.n = 10;
9095
9476
  return this.getLicenseTermsId(licenseTerms);
9096
9477
  case 10:
9097
- licenseTermsIds = _context12.v;
9098
- _context12.n = 11;
9478
+ licenseTermsIds = _context15.v;
9479
+ _context15.n = 11;
9099
9480
  return this.setMaxLicenseTokens({
9100
9481
  maxLicenseTokensData: request.licenseTermsData,
9101
9482
  licensorIpId: ipId,
9102
9483
  licenseTermsIds: licenseTermsIds
9103
9484
  });
9104
9485
  case 11:
9105
- maxLicenseTokensTxHashes = _context12.v;
9106
- return _context12.a(2, _objectSpread2({
9486
+ maxLicenseTokensTxHashes = _context15.v;
9487
+ return _context15.a(2, _objectSpread2({
9107
9488
  txHash: txHash,
9108
9489
  licenseTermsIds: licenseTermsIds
9109
9490
  }, maxLicenseTokensTxHashes.length > 0 && {
9110
9491
  maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
9111
9492
  }));
9112
9493
  case 12:
9113
- _context12.n = 14;
9494
+ _context15.n = 14;
9114
9495
  break;
9115
9496
  case 13:
9116
- _context12.p = 13;
9117
- _t18 = _context12.v;
9118
- return _context12.a(2, handleError(_t18, "Failed to register PIL terms and attach"));
9497
+ _context15.p = 13;
9498
+ _t22 = _context15.v;
9499
+ return _context15.a(2, handleError(_t22, "Failed to register PIL terms and attach"));
9119
9500
  case 14:
9120
- return _context12.a(2);
9501
+ return _context15.a(2);
9121
9502
  }
9122
- }, _callee12, this, [[0, 13]]);
9503
+ }, _callee15, this, [[0, 13]]);
9123
9504
  }));
9124
- function registerPilTermsAndAttach(_x13) {
9505
+ function registerPilTermsAndAttach(_x14) {
9125
9506
  return _registerPilTermsAndAttach.apply(this, arguments);
9126
9507
  }
9127
9508
  return registerPilTermsAndAttach;
@@ -9136,17 +9517,17 @@ var IPAssetClient = /*#__PURE__*/function () {
9136
9517
  }, {
9137
9518
  key: "mintAndRegisterIpAndMakeDerivativeWithLicenseTokens",
9138
9519
  value: (function () {
9139
- var _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(request) {
9140
- var _this7 = this;
9141
- var _request$txOptions0, _request$options6, licenseTokenIds, _object3, encodedTxData, contractCall, _t19;
9142
- return _regenerator().w(function (_context14) {
9143
- while (1) switch (_context14.n) {
9520
+ var _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(request) {
9521
+ var _this8 = this;
9522
+ var _request$txOptions0, _request$options6, licenseTokenIds, _object3, encodedTxData, contractCall, _t23;
9523
+ return _regenerator().w(function (_context17) {
9524
+ while (1) switch (_context17.p = _context17.n) {
9144
9525
  case 0:
9145
- _context14.p = 0;
9146
- _context14.n = 1;
9526
+ _context17.p = 0;
9527
+ _context17.n = 1;
9147
9528
  return this.validateLicenseTokenIds(request.licenseTokenIds);
9148
9529
  case 1:
9149
- licenseTokenIds = _context14.v;
9530
+ licenseTokenIds = _context17.v;
9150
9531
  _object3 = {
9151
9532
  spgNftContract: validateAddress(request.spgNftContract),
9152
9533
  recipient: validateAddress(request.recipient || this.walletAddress),
@@ -9159,27 +9540,27 @@ var IPAssetClient = /*#__PURE__*/function () {
9159
9540
  validateMaxRts(_object3.maxRts);
9160
9541
  encodedTxData = this.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokensEncode(_object3);
9161
9542
  if (!((_request$txOptions0 = request.txOptions) !== null && _request$txOptions0 !== void 0 && _request$txOptions0.encodedTxDataOnly)) {
9162
- _context14.n = 2;
9543
+ _context17.n = 2;
9163
9544
  break;
9164
9545
  }
9165
- return _context14.a(2, {
9546
+ return _context17.a(2, {
9166
9547
  encodedTxData: encodedTxData
9167
9548
  });
9168
9549
  case 2:
9169
9550
  contractCall = /*#__PURE__*/function () {
9170
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
9171
- return _regenerator().w(function (_context13) {
9172
- while (1) switch (_context13.n) {
9551
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
9552
+ return _regenerator().w(function (_context16) {
9553
+ while (1) switch (_context16.n) {
9173
9554
  case 0:
9174
- return _context13.a(2, _this7.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_object3));
9555
+ return _context16.a(2, _this8.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_object3));
9175
9556
  }
9176
- }, _callee13);
9557
+ }, _callee16);
9177
9558
  }));
9178
9559
  return function contractCall() {
9179
- return _ref2.apply(this, arguments);
9560
+ return _ref4.apply(this, arguments);
9180
9561
  };
9181
9562
  }();
9182
- return _context14.a(2, this.handleRegistrationWithFees({
9563
+ return _context17.a(2, this.handleRegistrationWithFees({
9183
9564
  wipOptions: _objectSpread2(_objectSpread2({}, (_request$options6 = request.options) === null || _request$options6 === void 0 ? void 0 : _request$options6.wipOptions), {}, {
9184
9565
  // need to disable multicall to avoid needing to transfer the license
9185
9566
  // token to the multicall contract.
@@ -9193,13 +9574,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9193
9574
  txOptions: request.txOptions
9194
9575
  }));
9195
9576
  case 3:
9196
- _context14.p = 3;
9197
- _t19 = _context14.v;
9198
- return _context14.a(2, handleError(_t19, "Failed to mint and register IP and make derivative with license tokens"));
9577
+ _context17.p = 3;
9578
+ _t23 = _context17.v;
9579
+ return _context17.a(2, handleError(_t23, "Failed to mint and register IP and make derivative with license tokens"));
9199
9580
  }
9200
- }, _callee14, this, [[0, 3]]);
9581
+ }, _callee17, this, [[0, 3]]);
9201
9582
  }));
9202
- function mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_x14) {
9583
+ function mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_x15) {
9203
9584
  return _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens.apply(this, arguments);
9204
9585
  }
9205
9586
  return mintAndRegisterIpAndMakeDerivativeWithLicenseTokens;
@@ -9213,14 +9594,14 @@ var IPAssetClient = /*#__PURE__*/function () {
9213
9594
  }, {
9214
9595
  key: "registerIpAndMakeDerivativeWithLicenseTokens",
9215
9596
  value: (function () {
9216
- var _registerIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(request) {
9217
- var _request$txOptions1, tokenId, ipIdAddress, isRegistered, licenseTokenIds, calculatedDeadline, signature, _object4, txHash, receipt, log, _t20;
9218
- return _regenerator().w(function (_context15) {
9219
- while (1) switch (_context15.n) {
9597
+ var _registerIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(request) {
9598
+ var _request$txOptions1, tokenId, ipIdAddress, isRegistered, licenseTokenIds, calculatedDeadline, signature, _object4, txHash, receipt, log, _t24;
9599
+ return _regenerator().w(function (_context18) {
9600
+ while (1) switch (_context18.p = _context18.n) {
9220
9601
  case 0:
9221
- _context15.p = 0;
9602
+ _context18.p = 0;
9222
9603
  tokenId = BigInt(request.tokenId);
9223
- _context15.n = 1;
9604
+ _context18.n = 1;
9224
9605
  return getIpIdAddress({
9225
9606
  nftContract: request.nftContract,
9226
9607
  tokenId: tokenId,
@@ -9229,26 +9610,26 @@ var IPAssetClient = /*#__PURE__*/function () {
9229
9610
  chainId: this.chainId
9230
9611
  });
9231
9612
  case 1:
9232
- ipIdAddress = _context15.v;
9233
- _context15.n = 2;
9613
+ ipIdAddress = _context18.v;
9614
+ _context18.n = 2;
9234
9615
  return this.isRegistered(ipIdAddress);
9235
9616
  case 2:
9236
- isRegistered = _context15.v;
9617
+ isRegistered = _context18.v;
9237
9618
  if (!isRegistered) {
9238
- _context15.n = 3;
9619
+ _context18.n = 3;
9239
9620
  break;
9240
9621
  }
9241
9622
  throw new Error("The NFT with id ".concat(tokenId, " is already registered as IP."));
9242
9623
  case 3:
9243
- _context15.n = 4;
9624
+ _context18.n = 4;
9244
9625
  return this.validateLicenseTokenIds(request.licenseTokenIds);
9245
9626
  case 4:
9246
- licenseTokenIds = _context15.v;
9247
- _context15.n = 5;
9627
+ licenseTokenIds = _context18.v;
9628
+ _context18.n = 5;
9248
9629
  return getCalculatedDeadline(this.rpcClient, request.deadline);
9249
9630
  case 5:
9250
- calculatedDeadline = _context15.v;
9251
- _context15.n = 6;
9631
+ calculatedDeadline = _context18.v;
9632
+ _context18.n = 6;
9252
9633
  return generateOperationSignature({
9253
9634
  ipIdAddress: ipIdAddress,
9254
9635
  methodType: SignatureMethodType.REGISTER_IP_AND_MAKE_DERIVATIVE_WITH_LICENSE_TOKENS,
@@ -9257,7 +9638,7 @@ var IPAssetClient = /*#__PURE__*/function () {
9257
9638
  chainId: this.chainId
9258
9639
  });
9259
9640
  case 6:
9260
- signature = _context15.v;
9641
+ signature = _context18.v;
9261
9642
  _object4 = _objectSpread2(_objectSpread2({}, request), {}, {
9262
9643
  tokenId: tokenId,
9263
9644
  licenseTokenIds: licenseTokenIds,
@@ -9272,40 +9653,40 @@ var IPAssetClient = /*#__PURE__*/function () {
9272
9653
  });
9273
9654
  validateMaxRts(_object4.maxRts);
9274
9655
  if (!((_request$txOptions1 = request.txOptions) !== null && _request$txOptions1 !== void 0 && _request$txOptions1.encodedTxDataOnly)) {
9275
- _context15.n = 7;
9656
+ _context18.n = 7;
9276
9657
  break;
9277
9658
  }
9278
- return _context15.a(2, {
9659
+ return _context18.a(2, {
9279
9660
  encodedTxData: this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokensEncode(_object4)
9280
9661
  });
9281
9662
  case 7:
9282
- _context15.n = 8;
9663
+ _context18.n = 8;
9283
9664
  return this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokens(_object4);
9284
9665
  case 8:
9285
- txHash = _context15.v;
9286
- _context15.n = 9;
9666
+ txHash = _context18.v;
9667
+ _context18.n = 9;
9287
9668
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
9288
9669
  hash: txHash
9289
9670
  }));
9290
9671
  case 9:
9291
- receipt = _context15.v;
9672
+ receipt = _context18.v;
9292
9673
  log = this.getIpIdAndTokenIdsFromEvent(receipt)[0];
9293
- return _context15.a(2, _objectSpread2({
9674
+ return _context18.a(2, _objectSpread2({
9294
9675
  txHash: txHash
9295
9676
  }, log));
9296
9677
  case 10:
9297
- _context15.n = 12;
9678
+ _context18.n = 12;
9298
9679
  break;
9299
9680
  case 11:
9300
- _context15.p = 11;
9301
- _t20 = _context15.v;
9302
- return _context15.a(2, handleError(_t20, "Failed to register IP and make derivative with license tokens"));
9681
+ _context18.p = 11;
9682
+ _t24 = _context18.v;
9683
+ return _context18.a(2, handleError(_t24, "Failed to register IP and make derivative with license tokens"));
9303
9684
  case 12:
9304
- return _context15.a(2);
9685
+ return _context18.a(2);
9305
9686
  }
9306
- }, _callee15, this, [[0, 11]]);
9687
+ }, _callee18, this, [[0, 11]]);
9307
9688
  }));
9308
- function registerIpAndMakeDerivativeWithLicenseTokens(_x15) {
9689
+ function registerIpAndMakeDerivativeWithLicenseTokens(_x16) {
9309
9690
  return _registerIpAndMakeDerivativeWithLicenseTokens.apply(this, arguments);
9310
9691
  }
9311
9692
  return registerIpAndMakeDerivativeWithLicenseTokens;
@@ -9321,23 +9702,23 @@ var IPAssetClient = /*#__PURE__*/function () {
9321
9702
  }, {
9322
9703
  key: "registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens",
9323
9704
  value: (function () {
9324
- var _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(request) {
9325
- var _getRoyaltyShares, royaltyShares, totalAmount, _yield$validateLicens4, licenseTerms, calculatedDeadline, ipIdAddress, isRegistered, _yield$transformRegis5, _transformRequest4, registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash, txReceipt, ipId, licenseTermsIds, ipRoyaltyVault, distributeRoyaltyTokensTxHash, maxLicenseTokensTxHashes, _t21;
9326
- return _regenerator().w(function (_context16) {
9327
- while (1) switch (_context16.n) {
9705
+ var _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(request) {
9706
+ var _getRoyaltyShares, royaltyShares, totalAmount, _yield$validateLicens3, licenseTerms, calculatedDeadline, ipIdAddress, isRegistered, _yield$transformRegis5, _transformRequest4, registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash, txReceipt, ipId, licenseTermsIds, ipRoyaltyVault, distributeRoyaltyTokensTxHash, maxLicenseTokensTxHashes, _t25;
9707
+ return _regenerator().w(function (_context19) {
9708
+ while (1) switch (_context19.p = _context19.n) {
9328
9709
  case 0:
9329
- _context16.p = 0;
9710
+ _context19.p = 0;
9330
9711
  _getRoyaltyShares = getRoyaltyShares(request.royaltyShares), royaltyShares = _getRoyaltyShares.royaltyShares, totalAmount = _getRoyaltyShares.totalAmount;
9331
- _context16.n = 1;
9712
+ _context19.n = 1;
9332
9713
  return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
9333
9714
  case 1:
9334
- _yield$validateLicens4 = _context16.v;
9335
- licenseTerms = _yield$validateLicens4.licenseTerms;
9336
- _context16.n = 2;
9715
+ _yield$validateLicens3 = _context19.v;
9716
+ licenseTerms = _yield$validateLicens3.licenseTerms;
9717
+ _context19.n = 2;
9337
9718
  return getCalculatedDeadline(this.rpcClient, request.deadline);
9338
9719
  case 2:
9339
- calculatedDeadline = _context16.v;
9340
- _context16.n = 3;
9720
+ calculatedDeadline = _context19.v;
9721
+ _context19.n = 3;
9341
9722
  return getIpIdAddress({
9342
9723
  nftContract: validateAddress(request.nftContract),
9343
9724
  tokenId: BigInt(request.tokenId),
@@ -9346,18 +9727,18 @@ var IPAssetClient = /*#__PURE__*/function () {
9346
9727
  chainId: this.chainId
9347
9728
  });
9348
9729
  case 3:
9349
- ipIdAddress = _context16.v;
9350
- _context16.n = 4;
9730
+ ipIdAddress = _context19.v;
9731
+ _context19.n = 4;
9351
9732
  return this.isRegistered(ipIdAddress);
9352
9733
  case 4:
9353
- isRegistered = _context16.v;
9734
+ isRegistered = _context19.v;
9354
9735
  if (!isRegistered) {
9355
- _context16.n = 5;
9736
+ _context19.n = 5;
9356
9737
  break;
9357
9738
  }
9358
9739
  throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
9359
9740
  case 5:
9360
- _context16.n = 6;
9741
+ _context19.n = 6;
9361
9742
  return transformRegistrationRequest({
9362
9743
  request: request,
9363
9744
  rpcClient: this.rpcClient,
@@ -9365,25 +9746,25 @@ var IPAssetClient = /*#__PURE__*/function () {
9365
9746
  chainId: this.chainId
9366
9747
  });
9367
9748
  case 6:
9368
- _yield$transformRegis5 = _context16.v;
9749
+ _yield$transformRegis5 = _context19.v;
9369
9750
  _transformRequest4 = _yield$transformRegis5.transformRequest;
9370
- _context16.n = 7;
9751
+ _context19.n = 7;
9371
9752
  return this.royaltyTokenDistributionWorkflowsClient.registerIpAndAttachPilTermsAndDeployRoyaltyVault(_transformRequest4);
9372
9753
  case 7:
9373
- registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash = _context16.v;
9374
- _context16.n = 8;
9754
+ registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash = _context19.v;
9755
+ _context19.n = 8;
9375
9756
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
9376
9757
  hash: registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash
9377
9758
  }));
9378
9759
  case 8:
9379
- txReceipt = _context16.v;
9760
+ txReceipt = _context19.v;
9380
9761
  ipId = this.getIpIdAndTokenIdsFromEvent(txReceipt)[0].ipId;
9381
- _context16.n = 9;
9762
+ _context19.n = 9;
9382
9763
  return this.getLicenseTermsId(licenseTerms);
9383
9764
  case 9:
9384
- licenseTermsIds = _context16.v;
9765
+ licenseTermsIds = _context19.v;
9385
9766
  ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(txReceipt)[0].ipRoyaltyVault;
9386
- _context16.n = 10;
9767
+ _context19.n = 10;
9387
9768
  return this.distributeRoyaltyTokens({
9388
9769
  ipId: ipId,
9389
9770
  deadline: calculatedDeadline,
@@ -9393,21 +9774,21 @@ var IPAssetClient = /*#__PURE__*/function () {
9393
9774
  txOptions: request.txOptions
9394
9775
  });
9395
9776
  case 10:
9396
- distributeRoyaltyTokensTxHash = _context16.v;
9397
- _context16.n = 11;
9777
+ distributeRoyaltyTokensTxHash = _context19.v;
9778
+ _context19.n = 11;
9398
9779
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
9399
9780
  hash: distributeRoyaltyTokensTxHash
9400
9781
  }));
9401
9782
  case 11:
9402
- _context16.n = 12;
9783
+ _context19.n = 12;
9403
9784
  return this.setMaxLicenseTokens({
9404
9785
  maxLicenseTokensData: request.licenseTermsData,
9405
9786
  licensorIpId: ipId,
9406
9787
  licenseTermsIds: licenseTermsIds
9407
9788
  });
9408
9789
  case 12:
9409
- maxLicenseTokensTxHashes = _context16.v;
9410
- return _context16.a(2, _objectSpread2({
9790
+ maxLicenseTokensTxHashes = _context19.v;
9791
+ return _context19.a(2, _objectSpread2({
9411
9792
  registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash: registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash,
9412
9793
  distributeRoyaltyTokensTxHash: distributeRoyaltyTokensTxHash,
9413
9794
  ipId: ipId,
@@ -9417,13 +9798,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9417
9798
  maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
9418
9799
  }));
9419
9800
  case 13:
9420
- _context16.p = 13;
9421
- _t21 = _context16.v;
9422
- return _context16.a(2, handleError(_t21, "Failed to register IP and attach license terms and distribute royalty tokens"));
9801
+ _context19.p = 13;
9802
+ _t25 = _context19.v;
9803
+ return _context19.a(2, handleError(_t25, "Failed to register IP and attach license terms and distribute royalty tokens"));
9423
9804
  }
9424
- }, _callee16, this, [[0, 13]]);
9805
+ }, _callee19, this, [[0, 13]]);
9425
9806
  }));
9426
- function registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x16) {
9807
+ function registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x17) {
9427
9808
  return _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens.apply(this, arguments);
9428
9809
  }
9429
9810
  return registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens;
@@ -9438,14 +9819,14 @@ var IPAssetClient = /*#__PURE__*/function () {
9438
9819
  }, {
9439
9820
  key: "registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens",
9440
9821
  value: (function () {
9441
- var _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(request) {
9442
- var _this8 = this;
9443
- var _request$options7, ipIdAddress, _yield$transformRegis6, _transformRequest5, _getRoyaltyShares2, royaltyShares, totalAmount, isRegistered, encodedTxData, contractCall, _yield$this$handleReg, txHash, ipId, tokenId, receipt, ipRoyaltyVault, distributeRoyaltyTokensTxHash, _t22;
9444
- return _regenerator().w(function (_context17) {
9445
- while (1) switch (_context17.n) {
9822
+ var _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(request) {
9823
+ var _this9 = this;
9824
+ var _request$options7, ipIdAddress, _yield$transformRegis6, _transformRequest5, _getRoyaltyShares2, royaltyShares, totalAmount, isRegistered, encodedTxData, contractCall, _yield$this$handleReg, txHash, ipId, tokenId, receipt, ipRoyaltyVault, distributeRoyaltyTokensTxHash, _t26;
9825
+ return _regenerator().w(function (_context20) {
9826
+ while (1) switch (_context20.p = _context20.n) {
9446
9827
  case 0:
9447
- _context17.p = 0;
9448
- _context17.n = 1;
9828
+ _context20.p = 0;
9829
+ _context20.n = 1;
9449
9830
  return getIpIdAddress({
9450
9831
  nftContract: validateAddress(request.nftContract),
9451
9832
  tokenId: BigInt(request.tokenId),
@@ -9454,8 +9835,8 @@ var IPAssetClient = /*#__PURE__*/function () {
9454
9835
  chainId: this.chainId
9455
9836
  });
9456
9837
  case 1:
9457
- ipIdAddress = _context17.v;
9458
- _context17.n = 2;
9838
+ ipIdAddress = _context20.v;
9839
+ _context20.n = 2;
9459
9840
  return transformRegistrationRequest({
9460
9841
  request: request,
9461
9842
  rpcClient: this.rpcClient,
@@ -9463,24 +9844,24 @@ var IPAssetClient = /*#__PURE__*/function () {
9463
9844
  chainId: this.chainId
9464
9845
  });
9465
9846
  case 2:
9466
- _yield$transformRegis6 = _context17.v;
9847
+ _yield$transformRegis6 = _context20.v;
9467
9848
  _transformRequest5 = _yield$transformRegis6.transformRequest;
9468
9849
  _getRoyaltyShares2 = getRoyaltyShares(request.royaltyShares), royaltyShares = _getRoyaltyShares2.royaltyShares, totalAmount = _getRoyaltyShares2.totalAmount;
9469
- _context17.n = 3;
9850
+ _context20.n = 3;
9470
9851
  return this.isRegistered(ipIdAddress);
9471
9852
  case 3:
9472
- isRegistered = _context17.v;
9853
+ isRegistered = _context20.v;
9473
9854
  if (!isRegistered) {
9474
- _context17.n = 4;
9855
+ _context20.n = 4;
9475
9856
  break;
9476
9857
  }
9477
9858
  throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
9478
9859
  case 4:
9479
9860
  encodedTxData = this.royaltyTokenDistributionWorkflowsClient.registerIpAndMakeDerivativeAndDeployRoyaltyVaultEncode(_transformRequest5);
9480
9861
  contractCall = function contractCall() {
9481
- return _this8.royaltyTokenDistributionWorkflowsClient.registerIpAndMakeDerivativeAndDeployRoyaltyVault(_transformRequest5);
9862
+ return _this9.royaltyTokenDistributionWorkflowsClient.registerIpAndMakeDerivativeAndDeployRoyaltyVault(_transformRequest5);
9482
9863
  };
9483
- _context17.n = 5;
9864
+ _context20.n = 5;
9484
9865
  return this.handleRegistrationWithFees({
9485
9866
  wipOptions: _objectSpread2(_objectSpread2({}, (_request$options7 = request.options) === null || _request$options7 === void 0 ? void 0 : _request$options7.wipOptions), {}, {
9486
9867
  useMulticallWhenPossible: false
@@ -9493,13 +9874,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9493
9874
  txOptions: _objectSpread2({}, request.txOptions)
9494
9875
  });
9495
9876
  case 5:
9496
- _yield$this$handleReg = _context17.v;
9877
+ _yield$this$handleReg = _context20.v;
9497
9878
  txHash = _yield$this$handleReg.txHash;
9498
9879
  ipId = _yield$this$handleReg.ipId;
9499
9880
  tokenId = _yield$this$handleReg.tokenId;
9500
9881
  receipt = _yield$this$handleReg.receipt;
9501
9882
  if (!(tokenId === undefined || !ipId || !receipt)) {
9502
- _context17.n = 6;
9883
+ _context20.n = 6;
9503
9884
  break;
9504
9885
  }
9505
9886
  throw new Error("Failed to register derivative ip and deploy royalty vault.");
@@ -9507,7 +9888,7 @@ var IPAssetClient = /*#__PURE__*/function () {
9507
9888
  ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt).filter(function (item) {
9508
9889
  return item.ipId === ipId;
9509
9890
  })[0].ipRoyaltyVault;
9510
- _context17.n = 7;
9891
+ _context20.n = 7;
9511
9892
  return this.distributeRoyaltyTokens({
9512
9893
  ipId: ipId,
9513
9894
  deadline: request.deadline,
@@ -9517,13 +9898,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9517
9898
  txOptions: request.txOptions
9518
9899
  });
9519
9900
  case 7:
9520
- distributeRoyaltyTokensTxHash = _context17.v;
9521
- _context17.n = 8;
9901
+ distributeRoyaltyTokensTxHash = _context20.v;
9902
+ _context20.n = 8;
9522
9903
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
9523
9904
  hash: distributeRoyaltyTokensTxHash
9524
9905
  }));
9525
9906
  case 8:
9526
- return _context17.a(2, {
9907
+ return _context20.a(2, {
9527
9908
  registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokensTxHash: txHash,
9528
9909
  distributeRoyaltyTokensTxHash: distributeRoyaltyTokensTxHash,
9529
9910
  ipId: ipId,
@@ -9531,13 +9912,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9531
9912
  ipRoyaltyVault: ipRoyaltyVault
9532
9913
  });
9533
9914
  case 9:
9534
- _context17.p = 9;
9535
- _t22 = _context17.v;
9536
- return _context17.a(2, handleError(_t22, "Failed to register derivative IP and attach license terms and distribute royalty tokens"));
9915
+ _context20.p = 9;
9916
+ _t26 = _context20.v;
9917
+ return _context20.a(2, handleError(_t26, "Failed to register derivative IP and attach license terms and distribute royalty tokens"));
9537
9918
  }
9538
- }, _callee17, this, [[0, 9]]);
9919
+ }, _callee20, this, [[0, 9]]);
9539
9920
  }));
9540
- function registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x17) {
9921
+ function registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x18) {
9541
9922
  return _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens.apply(this, arguments);
9542
9923
  }
9543
9924
  return registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens;
@@ -9551,19 +9932,19 @@ var IPAssetClient = /*#__PURE__*/function () {
9551
9932
  }, {
9552
9933
  key: "mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens",
9553
9934
  value: (function () {
9554
- var _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(request) {
9555
- var _this9 = this;
9556
- var _request$options8, _yield$validateLicens5, licenseTerms, _yield$transformRegis7, _transformRequest6, encodedTxData, contractCall, _yield$this$handleReg2, txHash, ipId, tokenId, receipt, licenseTermsIds, ipRoyaltyVault, maxLicenseTokensTxHashes, _t23;
9557
- return _regenerator().w(function (_context18) {
9558
- while (1) switch (_context18.n) {
9935
+ var _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(request) {
9936
+ var _this0 = this;
9937
+ var _request$options8, _yield$validateLicens4, licenseTerms, _yield$transformRegis7, _transformRequest6, encodedTxData, contractCall, _yield$this$handleReg2, txHash, ipId, tokenId, receipt, licenseTermsIds, ipRoyaltyVault, maxLicenseTokensTxHashes, _t27;
9938
+ return _regenerator().w(function (_context21) {
9939
+ while (1) switch (_context21.p = _context21.n) {
9559
9940
  case 0:
9560
- _context18.p = 0;
9561
- _context18.n = 1;
9941
+ _context21.p = 0;
9942
+ _context21.n = 1;
9562
9943
  return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
9563
9944
  case 1:
9564
- _yield$validateLicens5 = _context18.v;
9565
- licenseTerms = _yield$validateLicens5.licenseTerms;
9566
- _context18.n = 2;
9945
+ _yield$validateLicens4 = _context21.v;
9946
+ licenseTerms = _yield$validateLicens4.licenseTerms;
9947
+ _context21.n = 2;
9567
9948
  return transformRegistrationRequest({
9568
9949
  request: request,
9569
9950
  rpcClient: this.rpcClient,
@@ -9571,13 +9952,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9571
9952
  chainId: this.chainId
9572
9953
  });
9573
9954
  case 2:
9574
- _yield$transformRegis7 = _context18.v;
9955
+ _yield$transformRegis7 = _context21.v;
9575
9956
  _transformRequest6 = _yield$transformRegis7.transformRequest;
9576
9957
  encodedTxData = this.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokensEncode(_transformRequest6);
9577
9958
  contractCall = function contractCall() {
9578
- return _this9.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_transformRequest6);
9959
+ return _this0.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_transformRequest6);
9579
9960
  };
9580
- _context18.n = 3;
9961
+ _context21.n = 3;
9581
9962
  return this.handleRegistrationWithFees({
9582
9963
  wipOptions: (_request$options8 = request.options) === null || _request$options8 === void 0 ? void 0 : _request$options8.wipOptions,
9583
9964
  sender: this.walletAddress,
@@ -9588,33 +9969,33 @@ var IPAssetClient = /*#__PURE__*/function () {
9588
9969
  txOptions: request.txOptions
9589
9970
  });
9590
9971
  case 3:
9591
- _yield$this$handleReg2 = _context18.v;
9972
+ _yield$this$handleReg2 = _context21.v;
9592
9973
  txHash = _yield$this$handleReg2.txHash;
9593
9974
  ipId = _yield$this$handleReg2.ipId;
9594
9975
  tokenId = _yield$this$handleReg2.tokenId;
9595
9976
  receipt = _yield$this$handleReg2.receipt;
9596
9977
  if (receipt) {
9597
- _context18.n = 4;
9978
+ _context21.n = 4;
9598
9979
  break;
9599
9980
  }
9600
- return _context18.a(2, {
9981
+ return _context21.a(2, {
9601
9982
  txHash: txHash
9602
9983
  });
9603
9984
  case 4:
9604
- _context18.n = 5;
9985
+ _context21.n = 5;
9605
9986
  return this.getLicenseTermsId(licenseTerms);
9606
9987
  case 5:
9607
- licenseTermsIds = _context18.v;
9988
+ licenseTermsIds = _context21.v;
9608
9989
  ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt)[0].ipRoyaltyVault;
9609
- _context18.n = 6;
9990
+ _context21.n = 6;
9610
9991
  return this.setMaxLicenseTokens({
9611
9992
  maxLicenseTokensData: request.licenseTermsData,
9612
9993
  licensorIpId: ipId,
9613
9994
  licenseTermsIds: licenseTermsIds
9614
9995
  });
9615
9996
  case 6:
9616
- maxLicenseTokensTxHashes = _context18.v;
9617
- return _context18.a(2, _objectSpread2({
9997
+ maxLicenseTokensTxHashes = _context21.v;
9998
+ return _context21.a(2, _objectSpread2({
9618
9999
  txHash: txHash,
9619
10000
  ipId: ipId,
9620
10001
  licenseTermsIds: licenseTermsIds,
@@ -9624,13 +10005,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9624
10005
  maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
9625
10006
  }));
9626
10007
  case 7:
9627
- _context18.p = 7;
9628
- _t23 = _context18.v;
9629
- return _context18.a(2, handleError(_t23, "Failed to mint and register IP and attach PIL terms and distribute royalty tokens"));
10008
+ _context21.p = 7;
10009
+ _t27 = _context21.v;
10010
+ return _context21.a(2, handleError(_t27, "Failed to mint and register IP and attach PIL terms and distribute royalty tokens"));
9630
10011
  }
9631
- }, _callee18, this, [[0, 7]]);
10012
+ }, _callee21, this, [[0, 7]]);
9632
10013
  }));
9633
- function mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_x18) {
10014
+ function mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_x19) {
9634
10015
  return _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens.apply(this, arguments);
9635
10016
  }
9636
10017
  return mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens;
@@ -9644,14 +10025,14 @@ var IPAssetClient = /*#__PURE__*/function () {
9644
10025
  }, {
9645
10026
  key: "mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens",
9646
10027
  value: (function () {
9647
- var _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(request) {
9648
- var _this0 = this;
9649
- var _request$options9, _yield$transformRegis8, _transformRequest7, encodedTxData, contractCall, _t24;
9650
- return _regenerator().w(function (_context19) {
9651
- while (1) switch (_context19.n) {
10028
+ var _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(request) {
10029
+ var _this1 = this;
10030
+ var _request$options9, _yield$transformRegis8, _transformRequest7, encodedTxData, contractCall, _t28;
10031
+ return _regenerator().w(function (_context22) {
10032
+ while (1) switch (_context22.p = _context22.n) {
9652
10033
  case 0:
9653
- _context19.p = 0;
9654
- _context19.n = 1;
10034
+ _context22.p = 0;
10035
+ _context22.n = 1;
9655
10036
  return transformRegistrationRequest({
9656
10037
  request: request,
9657
10038
  rpcClient: this.rpcClient,
@@ -9659,13 +10040,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9659
10040
  chainId: this.chainId
9660
10041
  });
9661
10042
  case 1:
9662
- _yield$transformRegis8 = _context19.v;
10043
+ _yield$transformRegis8 = _context22.v;
9663
10044
  _transformRequest7 = _yield$transformRegis8.transformRequest;
9664
10045
  encodedTxData = this.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokensEncode(_transformRequest7);
9665
10046
  contractCall = function contractCall() {
9666
- return _this0.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_transformRequest7);
10047
+ return _this1.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_transformRequest7);
9667
10048
  };
9668
- _context19.n = 2;
10049
+ _context22.n = 2;
9669
10050
  return this.handleRegistrationWithFees({
9670
10051
  spgNftContract: _transformRequest7.spgNftContract,
9671
10052
  wipOptions: (_request$options9 = request.options) === null || _request$options9 === void 0 ? void 0 : _request$options9.wipOptions,
@@ -9677,15 +10058,15 @@ var IPAssetClient = /*#__PURE__*/function () {
9677
10058
  txOptions: request.txOptions
9678
10059
  });
9679
10060
  case 2:
9680
- return _context19.a(2, _context19.v);
10061
+ return _context22.a(2, _context22.v);
9681
10062
  case 3:
9682
- _context19.p = 3;
9683
- _t24 = _context19.v;
9684
- return _context19.a(2, handleError(_t24, "Failed to mint and register IP and make derivative and distribute royalty tokens"));
10063
+ _context22.p = 3;
10064
+ _t28 = _context22.v;
10065
+ return _context22.a(2, handleError(_t28, "Failed to mint and register IP and make derivative and distribute royalty tokens"));
9685
10066
  }
9686
- }, _callee19, this, [[0, 3]]);
10067
+ }, _callee22, this, [[0, 3]]);
9687
10068
  }));
9688
- function mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_x19) {
10069
+ function mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_x20) {
9689
10070
  return _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens.apply(this, arguments);
9690
10071
  }
9691
10072
  return mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens;
@@ -9693,12 +10074,12 @@ var IPAssetClient = /*#__PURE__*/function () {
9693
10074
  }, {
9694
10075
  key: "distributeRoyaltyTokens",
9695
10076
  value: function () {
9696
- var _distributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(request) {
10077
+ var _distributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(request) {
9697
10078
  var _yield$transferDistri, transformRequest, txHash;
9698
- return _regenerator().w(function (_context20) {
9699
- while (1) switch (_context20.n) {
10079
+ return _regenerator().w(function (_context23) {
10080
+ while (1) switch (_context23.n) {
9700
10081
  case 0:
9701
- _context20.n = 1;
10082
+ _context23.n = 1;
9702
10083
  return transferDistributeRoyaltyTokensRequest({
9703
10084
  request: request,
9704
10085
  rpcClient: this.rpcClient,
@@ -9706,22 +10087,22 @@ var IPAssetClient = /*#__PURE__*/function () {
9706
10087
  chainId: this.chainId
9707
10088
  });
9708
10089
  case 1:
9709
- _yield$transferDistri = _context20.v;
10090
+ _yield$transferDistri = _context23.v;
9710
10091
  transformRequest = _yield$transferDistri.transformRequest;
9711
- _context20.n = 2;
10092
+ _context23.n = 2;
9712
10093
  return this.royaltyTokenDistributionWorkflowsClient.distributeRoyaltyTokens(transformRequest);
9713
10094
  case 2:
9714
- txHash = _context20.v;
9715
- _context20.n = 3;
10095
+ txHash = _context23.v;
10096
+ _context23.n = 3;
9716
10097
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
9717
10098
  hash: txHash
9718
10099
  }));
9719
10100
  case 3:
9720
- return _context20.a(2, txHash);
10101
+ return _context23.a(2, txHash);
9721
10102
  }
9722
- }, _callee20, this);
10103
+ }, _callee23, this);
9723
10104
  }));
9724
- function distributeRoyaltyTokens(_x20) {
10105
+ function distributeRoyaltyTokens(_x21) {
9725
10106
  return _distributeRoyaltyTokens.apply(this, arguments);
9726
10107
  }
9727
10108
  return distributeRoyaltyTokens;
@@ -9729,20 +10110,20 @@ var IPAssetClient = /*#__PURE__*/function () {
9729
10110
  }, {
9730
10111
  key: "isRegistered",
9731
10112
  value: function () {
9732
- var _isRegistered = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(ipId) {
9733
- return _regenerator().w(function (_context21) {
9734
- while (1) switch (_context21.n) {
10113
+ var _isRegistered = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(ipId) {
10114
+ return _regenerator().w(function (_context24) {
10115
+ while (1) switch (_context24.n) {
9735
10116
  case 0:
9736
- _context21.n = 1;
10117
+ _context24.n = 1;
9737
10118
  return this.ipAssetRegistryClient.isRegistered({
9738
10119
  id: validateAddress(ipId)
9739
10120
  });
9740
10121
  case 1:
9741
- return _context21.a(2, _context21.v);
10122
+ return _context24.a(2, _context24.v);
9742
10123
  }
9743
- }, _callee21, this);
10124
+ }, _callee24, this);
9744
10125
  }));
9745
- function isRegistered(_x21) {
10126
+ function isRegistered(_x22) {
9746
10127
  return _isRegistered.apply(this, arguments);
9747
10128
  }
9748
10129
  return isRegistered;
@@ -9786,24 +10167,24 @@ var IPAssetClient = /*#__PURE__*/function () {
9786
10167
  }, {
9787
10168
  key: "batchRegisterIpAssetsWithOptimizedWorkflows",
9788
10169
  value: (function () {
9789
- var _batchRegisterIpAssetsWithOptimizedWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(request) {
9790
- var _request$options0, _request$options10, transferWorkflowRequests, _iterator5, _step5, req, res, royaltyDistributionRequests, _yield$handleMultical, txResponses, aggregateRegistrationRequest, responses, royaltyTokensDistributionRequests, _iterator6, _step6, _step6$value, txHash, receipt, iPRegisteredLog, ipRoyaltyVaultEvent, response, distributeRoyaltyTokensTxHashes, _request$options1, _yield$handleMultical2, txResponse, registrationResults, _t25, _t26, _t27;
9791
- return _regenerator().w(function (_context22) {
9792
- while (1) switch (_context22.n) {
10170
+ var _batchRegisterIpAssetsWithOptimizedWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(request) {
10171
+ var _request$options0, _request$options10, transferWorkflowRequests, _iterator6, _step6, req, res, royaltyDistributionRequests, _yield$handleMultical, txResponses, aggregateRegistrationRequest, responses, royaltyTokensDistributionRequests, _iterator7, _step7, _step7$value, txHash, receipt, iPRegisteredLog, ipRoyaltyVaultEvent, response, distributeRoyaltyTokensTxHashes, _request$options1, _yield$handleMultical2, txResponse, registrationResults, _t29, _t30, _t31;
10172
+ return _regenerator().w(function (_context25) {
10173
+ while (1) switch (_context25.p = _context25.n) {
9793
10174
  case 0:
9794
- _context22.p = 0;
10175
+ _context25.p = 0;
9795
10176
  // Transform requests into workflow format
9796
10177
  transferWorkflowRequests = [];
9797
- _iterator5 = _createForOfIteratorHelper(request.requests);
9798
- _context22.p = 1;
9799
- _iterator5.s();
10178
+ _iterator6 = _createForOfIteratorHelper(request.requests);
10179
+ _context25.p = 1;
10180
+ _iterator6.s();
9800
10181
  case 2:
9801
- if ((_step5 = _iterator5.n()).done) {
9802
- _context22.n = 5;
10182
+ if ((_step6 = _iterator6.n()).done) {
10183
+ _context25.n = 5;
9803
10184
  break;
9804
10185
  }
9805
- req = _step5.value;
9806
- _context22.n = 3;
10186
+ req = _step6.value;
10187
+ _context25.n = 3;
9807
10188
  return transformRegistrationRequest({
9808
10189
  request: req,
9809
10190
  rpcClient: this.rpcClient,
@@ -9811,22 +10192,22 @@ var IPAssetClient = /*#__PURE__*/function () {
9811
10192
  chainId: this.chainId
9812
10193
  });
9813
10194
  case 3:
9814
- res = _context22.v;
10195
+ res = _context25.v;
9815
10196
  transferWorkflowRequests.push(res);
9816
10197
  case 4:
9817
- _context22.n = 2;
10198
+ _context25.n = 2;
9818
10199
  break;
9819
10200
  case 5:
9820
- _context22.n = 7;
10201
+ _context25.n = 7;
9821
10202
  break;
9822
10203
  case 6:
9823
- _context22.p = 6;
9824
- _t25 = _context22.v;
9825
- _iterator5.e(_t25);
10204
+ _context25.p = 6;
10205
+ _t29 = _context25.v;
10206
+ _iterator6.e(_t29);
9826
10207
  case 7:
9827
- _context22.p = 7;
9828
- _iterator5.f();
9829
- return _context22.f(7);
10208
+ _context25.p = 7;
10209
+ _iterator6.f();
10210
+ return _context25.f(7);
9830
10211
  case 8:
9831
10212
  /**
9832
10213
  * Extract royalty distribution requests from workflow responses that contain royalty shares
@@ -9844,7 +10225,7 @@ var IPAssetClient = /*#__PURE__*/function () {
9844
10225
  deadline: res.extraData.deadline
9845
10226
  };
9846
10227
  }); // Process initial registration transactions
9847
- _context22.n = 9;
10228
+ _context25.n = 9;
9848
10229
  return handleMulticall({
9849
10230
  transferWorkflowRequests: transferWorkflowRequests,
9850
10231
  multicall3Address: this.multicall3Client.address,
@@ -9855,23 +10236,23 @@ var IPAssetClient = /*#__PURE__*/function () {
9855
10236
  chainId: this.chainId
9856
10237
  });
9857
10238
  case 9:
9858
- _yield$handleMultical = _context22.v;
10239
+ _yield$handleMultical = _context25.v;
9859
10240
  txResponses = _yield$handleMultical.response;
9860
10241
  aggregateRegistrationRequest = _yield$handleMultical.aggregateRegistrationRequest;
9861
10242
  responses = [];
9862
10243
  royaltyTokensDistributionRequests = []; // Process each transaction response
9863
- _iterator6 = _createForOfIteratorHelper(txResponses);
9864
- _context22.p = 10;
9865
- _iterator6.s();
10244
+ _iterator7 = _createForOfIteratorHelper(txResponses);
10245
+ _context25.p = 10;
10246
+ _iterator7.s();
9866
10247
  case 11:
9867
- if ((_step6 = _iterator6.n()).done) {
9868
- _context22.n = 14;
10248
+ if ((_step7 = _iterator7.n()).done) {
10249
+ _context25.n = 14;
9869
10250
  break;
9870
10251
  }
9871
- _step6$value = _step6.value, txHash = _step6$value.txHash, receipt = _step6$value.receipt;
10252
+ _step7$value = _step7.value, txHash = _step7$value.txHash, receipt = _step7$value.receipt;
9872
10253
  iPRegisteredLog = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(receipt);
9873
10254
  ipRoyaltyVaultEvent = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt); // Prepare royalty distribution if needed
9874
- _context22.n = 12;
10255
+ _context25.n = 12;
9875
10256
  return prepareRoyaltyTokensDistributionRequests({
9876
10257
  royaltyDistributionRequests: royaltyDistributionRequests,
9877
10258
  ipRegisteredLog: iPRegisteredLog,
@@ -9881,7 +10262,7 @@ var IPAssetClient = /*#__PURE__*/function () {
9881
10262
  chainId: this.chainId
9882
10263
  });
9883
10264
  case 12:
9884
- response = _context22.v;
10265
+ response = _context25.v;
9885
10266
  royaltyTokensDistributionRequests.push.apply(royaltyTokensDistributionRequests, _toConsumableArray(response));
9886
10267
  responses.push({
9887
10268
  txHash: txHash,
@@ -9894,25 +10275,25 @@ var IPAssetClient = /*#__PURE__*/function () {
9894
10275
  })
9895
10276
  });
9896
10277
  case 13:
9897
- _context22.n = 11;
10278
+ _context25.n = 11;
9898
10279
  break;
9899
10280
  case 14:
9900
- _context22.n = 16;
10281
+ _context25.n = 16;
9901
10282
  break;
9902
10283
  case 15:
9903
- _context22.p = 15;
9904
- _t26 = _context22.v;
9905
- _iterator6.e(_t26);
10284
+ _context25.p = 15;
10285
+ _t30 = _context25.v;
10286
+ _iterator7.e(_t30);
9906
10287
  case 16:
9907
- _context22.p = 16;
9908
- _iterator6.f();
9909
- return _context22.f(16);
10288
+ _context25.p = 16;
10289
+ _iterator7.f();
10290
+ return _context25.f(16);
9910
10291
  case 17:
9911
10292
  if (!(royaltyTokensDistributionRequests.length > 0)) {
9912
- _context22.n = 19;
10293
+ _context25.n = 19;
9913
10294
  break;
9914
10295
  }
9915
- _context22.n = 18;
10296
+ _context25.n = 18;
9916
10297
  return handleMulticall({
9917
10298
  transferWorkflowRequests: royaltyTokensDistributionRequests,
9918
10299
  multicall3Address: this.multicall3Client.address,
@@ -9923,29 +10304,29 @@ var IPAssetClient = /*#__PURE__*/function () {
9923
10304
  chainId: this.chainId
9924
10305
  });
9925
10306
  case 18:
9926
- _yield$handleMultical2 = _context22.v;
10307
+ _yield$handleMultical2 = _context25.v;
9927
10308
  txResponse = _yield$handleMultical2.response;
9928
10309
  distributeRoyaltyTokensTxHashes = txResponse.map(function (tx) {
9929
10310
  return tx.txHash;
9930
10311
  });
9931
10312
  case 19:
9932
- _context22.n = 20;
10313
+ _context25.n = 20;
9933
10314
  return this.processResponses(responses, aggregateRegistrationRequest, ((_request$options10 = request.options) === null || _request$options10 === void 0 || (_request$options10 = _request$options10.wipOptions) === null || _request$options10 === void 0 ? void 0 : _request$options10.useMulticallWhenPossible) !== false);
9934
10315
  case 20:
9935
- registrationResults = _context22.v;
9936
- return _context22.a(2, _objectSpread2({
10316
+ registrationResults = _context25.v;
10317
+ return _context25.a(2, _objectSpread2({
9937
10318
  registrationResults: registrationResults
9938
10319
  }, distributeRoyaltyTokensTxHashes && {
9939
10320
  distributeRoyaltyTokensTxHashes: distributeRoyaltyTokensTxHashes
9940
10321
  }));
9941
10322
  case 21:
9942
- _context22.p = 21;
9943
- _t27 = _context22.v;
9944
- return _context22.a(2, handleError(_t27, "Failed to batch register IP assets with optimized workflows"));
10323
+ _context25.p = 21;
10324
+ _t31 = _context25.v;
10325
+ return _context25.a(2, handleError(_t31, "Failed to batch register IP assets with optimized workflows"));
9945
10326
  }
9946
- }, _callee22, this, [[10, 15, 16, 17], [1, 6, 7, 8], [0, 21]]);
10327
+ }, _callee25, this, [[10, 15, 16, 17], [1, 6, 7, 8], [0, 21]]);
9947
10328
  }));
9948
- function batchRegisterIpAssetsWithOptimizedWorkflows(_x22) {
10329
+ function batchRegisterIpAssetsWithOptimizedWorkflows(_x23) {
9949
10330
  return _batchRegisterIpAssetsWithOptimizedWorkflows.apply(this, arguments);
9950
10331
  }
9951
10332
  return batchRegisterIpAssetsWithOptimizedWorkflows;
@@ -9953,48 +10334,48 @@ var IPAssetClient = /*#__PURE__*/function () {
9953
10334
  }, {
9954
10335
  key: "getLicenseTermsId",
9955
10336
  value: function () {
9956
- var _getLicenseTermsId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(licenseTerms) {
9957
- var licenseTermsIds, _iterator7, _step7, licenseTerm, licenseRes, _t28;
9958
- return _regenerator().w(function (_context23) {
9959
- while (1) switch (_context23.n) {
10337
+ var _getLicenseTermsId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(licenseTerms) {
10338
+ var licenseTermsIds, _iterator8, _step8, licenseTerm, licenseRes, _t32;
10339
+ return _regenerator().w(function (_context26) {
10340
+ while (1) switch (_context26.p = _context26.n) {
9960
10341
  case 0:
9961
10342
  licenseTermsIds = [];
9962
- _iterator7 = _createForOfIteratorHelper(licenseTerms);
9963
- _context23.p = 1;
9964
- _iterator7.s();
10343
+ _iterator8 = _createForOfIteratorHelper(licenseTerms);
10344
+ _context26.p = 1;
10345
+ _iterator8.s();
9965
10346
  case 2:
9966
- if ((_step7 = _iterator7.n()).done) {
9967
- _context23.n = 5;
10347
+ if ((_step8 = _iterator8.n()).done) {
10348
+ _context26.n = 5;
9968
10349
  break;
9969
10350
  }
9970
- licenseTerm = _step7.value;
9971
- _context23.n = 3;
10351
+ licenseTerm = _step8.value;
10352
+ _context26.n = 3;
9972
10353
  return this.licenseTemplateClient.getLicenseTermsId({
9973
10354
  terms: licenseTerm
9974
10355
  });
9975
10356
  case 3:
9976
- licenseRes = _context23.v;
10357
+ licenseRes = _context26.v;
9977
10358
  licenseTermsIds.push(licenseRes.selectedLicenseTermsId);
9978
10359
  case 4:
9979
- _context23.n = 2;
10360
+ _context26.n = 2;
9980
10361
  break;
9981
10362
  case 5:
9982
- _context23.n = 7;
10363
+ _context26.n = 7;
9983
10364
  break;
9984
10365
  case 6:
9985
- _context23.p = 6;
9986
- _t28 = _context23.v;
9987
- _iterator7.e(_t28);
10366
+ _context26.p = 6;
10367
+ _t32 = _context26.v;
10368
+ _iterator8.e(_t32);
9988
10369
  case 7:
9989
- _context23.p = 7;
9990
- _iterator7.f();
9991
- return _context23.f(7);
10370
+ _context26.p = 7;
10371
+ _iterator8.f();
10372
+ return _context26.f(7);
9992
10373
  case 8:
9993
- return _context23.a(2, licenseTermsIds);
10374
+ return _context26.a(2, licenseTermsIds);
9994
10375
  }
9995
- }, _callee23, this, [[1, 6, 7, 8]]);
10376
+ }, _callee26, this, [[1, 6, 7, 8]]);
9996
10377
  }));
9997
- function getLicenseTermsId(_x23) {
10378
+ function getLicenseTermsId(_x24) {
9998
10379
  return _getLicenseTermsId.apply(this, arguments);
9999
10380
  }
10000
10381
  return getLicenseTermsId;
@@ -10002,13 +10383,13 @@ var IPAssetClient = /*#__PURE__*/function () {
10002
10383
  }, {
10003
10384
  key: "validateLicenseTokenIds",
10004
10385
  value: function () {
10005
- var _validateLicenseTokenIds = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(licenseTokenIds) {
10006
- var newLicenseTokenIds, _iterator8, _step8, licenseTokenId, tokenOwnerAddress, _t29;
10007
- return _regenerator().w(function (_context24) {
10008
- while (1) switch (_context24.n) {
10386
+ var _validateLicenseTokenIds = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(licenseTokenIds) {
10387
+ var newLicenseTokenIds, _iterator9, _step9, licenseTokenId, tokenOwnerAddress, _t33;
10388
+ return _regenerator().w(function (_context27) {
10389
+ while (1) switch (_context27.p = _context27.n) {
10009
10390
  case 0:
10010
10391
  if (!(licenseTokenIds.length === 0)) {
10011
- _context24.n = 1;
10392
+ _context27.n = 1;
10012
10393
  break;
10013
10394
  }
10014
10395
  throw new Error("License token IDs must be provided.");
@@ -10016,46 +10397,46 @@ var IPAssetClient = /*#__PURE__*/function () {
10016
10397
  newLicenseTokenIds = licenseTokenIds.map(function (id) {
10017
10398
  return BigInt(id);
10018
10399
  });
10019
- _iterator8 = _createForOfIteratorHelper(newLicenseTokenIds);
10020
- _context24.p = 2;
10021
- _iterator8.s();
10400
+ _iterator9 = _createForOfIteratorHelper(newLicenseTokenIds);
10401
+ _context27.p = 2;
10402
+ _iterator9.s();
10022
10403
  case 3:
10023
- if ((_step8 = _iterator8.n()).done) {
10024
- _context24.n = 6;
10404
+ if ((_step9 = _iterator9.n()).done) {
10405
+ _context27.n = 6;
10025
10406
  break;
10026
10407
  }
10027
- licenseTokenId = _step8.value;
10028
- _context24.n = 4;
10408
+ licenseTokenId = _step9.value;
10409
+ _context27.n = 4;
10029
10410
  return this.licenseTokenReadOnlyClient.ownerOf({
10030
10411
  tokenId: licenseTokenId
10031
10412
  });
10032
10413
  case 4:
10033
- tokenOwnerAddress = _context24.v;
10414
+ tokenOwnerAddress = _context27.v;
10034
10415
  if (tokenOwnerAddress) {
10035
- _context24.n = 5;
10416
+ _context27.n = 5;
10036
10417
  break;
10037
10418
  }
10038
10419
  throw new Error("License token id ".concat(licenseTokenId, " must be owned by the caller."));
10039
10420
  case 5:
10040
- _context24.n = 3;
10421
+ _context27.n = 3;
10041
10422
  break;
10042
10423
  case 6:
10043
- _context24.n = 8;
10424
+ _context27.n = 8;
10044
10425
  break;
10045
10426
  case 7:
10046
- _context24.p = 7;
10047
- _t29 = _context24.v;
10048
- _iterator8.e(_t29);
10427
+ _context27.p = 7;
10428
+ _t33 = _context27.v;
10429
+ _iterator9.e(_t33);
10049
10430
  case 8:
10050
- _context24.p = 8;
10051
- _iterator8.f();
10052
- return _context24.f(8);
10431
+ _context27.p = 8;
10432
+ _iterator9.f();
10433
+ return _context27.f(8);
10053
10434
  case 9:
10054
- return _context24.a(2, newLicenseTokenIds);
10435
+ return _context27.a(2, newLicenseTokenIds);
10055
10436
  }
10056
- }, _callee24, this, [[2, 7, 8, 9]]);
10437
+ }, _callee27, this, [[2, 7, 8, 9]]);
10057
10438
  }));
10058
- function validateLicenseTokenIds(_x24) {
10439
+ function validateLicenseTokenIds(_x25) {
10059
10440
  return _validateLicenseTokenIds.apply(this, arguments);
10060
10441
  }
10061
10442
  return validateLicenseTokenIds;
@@ -10078,28 +10459,28 @@ var IPAssetClient = /*#__PURE__*/function () {
10078
10459
  }, {
10079
10460
  key: "handleRegistrationWithFees",
10080
10461
  value: function () {
10081
- var _handleRegistrationWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(_ref3) {
10462
+ var _handleRegistrationWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(_ref5) {
10082
10463
  var _wipOptions$useMultic, _this$getIpIdAndToken, _event$ipId, _event$tokenId;
10083
10464
  var sender, derivData, spgNftContract, spgSpenderAddress, txOptions, wipOptions, encodedTxs, contractCall, totalFees, wipSpenders, useMulticallWhenPossible, nftMintFee, publicMinting, totalDerivativeMintingFee, _yield$contractCallWi, txHash, receipt, event;
10084
- return _regenerator().w(function (_context25) {
10085
- while (1) switch (_context25.n) {
10465
+ return _regenerator().w(function (_context28) {
10466
+ while (1) switch (_context28.n) {
10086
10467
  case 0:
10087
- sender = _ref3.sender, derivData = _ref3.derivData, spgNftContract = _ref3.spgNftContract, spgSpenderAddress = _ref3.spgSpenderAddress, txOptions = _ref3.txOptions, wipOptions = _ref3.wipOptions, encodedTxs = _ref3.encodedTxs, contractCall = _ref3.contractCall;
10468
+ sender = _ref5.sender, derivData = _ref5.derivData, spgNftContract = _ref5.spgNftContract, spgSpenderAddress = _ref5.spgSpenderAddress, txOptions = _ref5.txOptions, wipOptions = _ref5.wipOptions, encodedTxs = _ref5.encodedTxs, contractCall = _ref5.contractCall;
10088
10469
  totalFees = 0n;
10089
10470
  wipSpenders = [];
10090
10471
  useMulticallWhenPossible = (_wipOptions$useMultic = wipOptions === null || wipOptions === void 0 ? void 0 : wipOptions.useMulticallWhenPossible) !== null && _wipOptions$useMultic !== void 0 ? _wipOptions$useMultic : true; // get spg minting fee
10091
10472
  if (!spgNftContract) {
10092
- _context25.n = 3;
10473
+ _context28.n = 3;
10093
10474
  break;
10094
10475
  }
10095
- _context25.n = 1;
10476
+ _context28.n = 1;
10096
10477
  return calculateSPGWipMintFee(new SpgnftImplReadOnlyClient(this.rpcClient, spgNftContract));
10097
10478
  case 1:
10098
- nftMintFee = _context25.v;
10099
- _context25.n = 2;
10479
+ nftMintFee = _context28.v;
10480
+ _context28.n = 2;
10100
10481
  return getPublicMinting(spgNftContract, this.rpcClient);
10101
10482
  case 2:
10102
- publicMinting = _context25.v;
10483
+ publicMinting = _context28.v;
10103
10484
  /**
10104
10485
  * If the SPG NFT contract's public minting is disabled, we need to check if the caller has the `minter role`.
10105
10486
  * When public minting is disabled, we can't use multicall because we need to perform additional role checks
@@ -10118,10 +10499,10 @@ var IPAssetClient = /*#__PURE__*/function () {
10118
10499
  });
10119
10500
  case 3:
10120
10501
  if (!derivData) {
10121
- _context25.n = 5;
10502
+ _context28.n = 5;
10122
10503
  break;
10123
10504
  }
10124
- _context25.n = 4;
10505
+ _context28.n = 4;
10125
10506
  return calculateDerivativeMintingFee({
10126
10507
  derivData: derivData,
10127
10508
  rpcClient: this.rpcClient,
@@ -10130,7 +10511,7 @@ var IPAssetClient = /*#__PURE__*/function () {
10130
10511
  sender: sender
10131
10512
  });
10132
10513
  case 4:
10133
- totalDerivativeMintingFee = _context25.v;
10514
+ totalDerivativeMintingFee = _context28.v;
10134
10515
  totalFees += totalDerivativeMintingFee;
10135
10516
  if (totalDerivativeMintingFee > 0) {
10136
10517
  wipSpenders.push({
@@ -10140,12 +10521,12 @@ var IPAssetClient = /*#__PURE__*/function () {
10140
10521
  }
10141
10522
  case 5:
10142
10523
  if (!(totalFees < 0)) {
10143
- _context25.n = 6;
10524
+ _context28.n = 6;
10144
10525
  break;
10145
10526
  }
10146
10527
  throw new Error("Total fees for registering derivative should never be negative: ".concat(totalFees));
10147
10528
  case 6:
10148
- _context25.n = 7;
10529
+ _context28.n = 7;
10149
10530
  return contractCallWithFees({
10150
10531
  totalFees: totalFees,
10151
10532
  options: {
@@ -10163,11 +10544,11 @@ var IPAssetClient = /*#__PURE__*/function () {
10163
10544
  encodedTxs: encodedTxs
10164
10545
  });
10165
10546
  case 7:
10166
- _yield$contractCallWi = _context25.v;
10547
+ _yield$contractCallWi = _context28.v;
10167
10548
  txHash = _yield$contractCallWi.txHash;
10168
10549
  receipt = _yield$contractCallWi.receipt;
10169
10550
  event = (_this$getIpIdAndToken = this.getIpIdAndTokenIdsFromEvent(receipt)) === null || _this$getIpIdAndToken === void 0 ? void 0 : _this$getIpIdAndToken[0];
10170
- return _context25.a(2, _objectSpread2({
10551
+ return _context28.a(2, _objectSpread2({
10171
10552
  txHash: txHash,
10172
10553
  receipt: receipt
10173
10554
  }, event && {
@@ -10175,9 +10556,9 @@ var IPAssetClient = /*#__PURE__*/function () {
10175
10556
  tokenId: (_event$tokenId = event.tokenId) !== null && _event$tokenId !== void 0 ? _event$tokenId : undefined
10176
10557
  }));
10177
10558
  }
10178
- }, _callee25, this);
10559
+ }, _callee28, this);
10179
10560
  }));
10180
- function handleRegistrationWithFees(_x25) {
10561
+ function handleRegistrationWithFees(_x26) {
10181
10562
  return _handleRegistrationWithFees.apply(this, arguments);
10182
10563
  }
10183
10564
  return handleRegistrationWithFees;
@@ -10185,27 +10566,27 @@ var IPAssetClient = /*#__PURE__*/function () {
10185
10566
  }, {
10186
10567
  key: "setMaxLicenseTokens",
10187
10568
  value: function () {
10188
- var _setMaxLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(_ref4) {
10569
+ var _setMaxLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(_ref6) {
10189
10570
  var maxLicenseTokensData, licensorIpId, licenseTermsIds, licenseTermsMaxLimitTxHashes, i, maxLicenseTokens, txHash;
10190
- return _regenerator().w(function (_context26) {
10191
- while (1) switch (_context26.n) {
10571
+ return _regenerator().w(function (_context29) {
10572
+ while (1) switch (_context29.n) {
10192
10573
  case 0:
10193
- maxLicenseTokensData = _ref4.maxLicenseTokensData, licensorIpId = _ref4.licensorIpId, licenseTermsIds = _ref4.licenseTermsIds;
10574
+ maxLicenseTokensData = _ref6.maxLicenseTokensData, licensorIpId = _ref6.licensorIpId, licenseTermsIds = _ref6.licenseTermsIds;
10194
10575
  licenseTermsMaxLimitTxHashes = [];
10195
10576
  i = 0;
10196
10577
  case 1:
10197
10578
  if (!(i < maxLicenseTokensData.length)) {
10198
- _context26.n = 5;
10579
+ _context29.n = 5;
10199
10580
  break;
10200
10581
  }
10201
10582
  maxLicenseTokens = maxLicenseTokensData[i].maxLicenseTokens;
10202
10583
  if (!(maxLicenseTokens === undefined || maxLicenseTokens < 0n)) {
10203
- _context26.n = 2;
10584
+ _context29.n = 2;
10204
10585
  break;
10205
10586
  }
10206
- return _context26.a(3, 4);
10587
+ return _context29.a(3, 4);
10207
10588
  case 2:
10208
- _context26.n = 3;
10589
+ _context29.n = 3;
10209
10590
  return this.totalLicenseTokenLimitHookClient.setTotalLicenseTokenLimit({
10210
10591
  licensorIpId: licensorIpId,
10211
10592
  // The contract now directly writes the `licenseTemplate` address internally,
@@ -10215,20 +10596,20 @@ var IPAssetClient = /*#__PURE__*/function () {
10215
10596
  limit: BigInt(maxLicenseTokens)
10216
10597
  });
10217
10598
  case 3:
10218
- txHash = _context26.v;
10599
+ txHash = _context29.v;
10219
10600
  if (txHash) {
10220
10601
  licenseTermsMaxLimitTxHashes.push(txHash);
10221
10602
  }
10222
10603
  case 4:
10223
10604
  i++;
10224
- _context26.n = 1;
10605
+ _context29.n = 1;
10225
10606
  break;
10226
10607
  case 5:
10227
- return _context26.a(2, licenseTermsMaxLimitTxHashes);
10608
+ return _context29.a(2, licenseTermsMaxLimitTxHashes);
10228
10609
  }
10229
- }, _callee26, this);
10610
+ }, _callee29, this);
10230
10611
  }));
10231
- function setMaxLicenseTokens(_x26) {
10612
+ function setMaxLicenseTokens(_x27) {
10232
10613
  return _setMaxLicenseTokens.apply(this, arguments);
10233
10614
  }
10234
10615
  return setMaxLicenseTokens;
@@ -10239,69 +10620,69 @@ var IPAssetClient = /*#__PURE__*/function () {
10239
10620
  }, {
10240
10621
  key: "processResponses",
10241
10622
  value: (function () {
10242
- var _processResponses = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(responses, aggregateRegistrationRequest, useMulticall) {
10243
- var _iterator9, _step9, _step9$value, responseIndex, response, _iterator0, _step0, _Object$values$respon, _step0$value, assetIndex, ipAsset, extraData, result, _extraData, i, _response, extraDataItem, _ipAsset, _t30, _t31;
10244
- return _regenerator().w(function (_context27) {
10245
- while (1) switch (_context27.n) {
10623
+ var _processResponses = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30(responses, aggregateRegistrationRequest, useMulticall) {
10624
+ var _iterator0, _step0, _step0$value, responseIndex, response, _iterator1, _step1, _Object$values$respon, _step1$value, assetIndex, ipAsset, extraData, result, _extraData, i, _response, extraDataItem, _ipAsset, _t34, _t35;
10625
+ return _regenerator().w(function (_context30) {
10626
+ while (1) switch (_context30.p = _context30.n) {
10246
10627
  case 0:
10247
10628
  if (!useMulticall) {
10248
- _context27.n = 15;
10629
+ _context30.n = 15;
10249
10630
  break;
10250
10631
  }
10251
- _iterator9 = _createForOfIteratorHelper(responses.entries());
10252
- _context27.p = 1;
10253
- _iterator9.s();
10632
+ _iterator0 = _createForOfIteratorHelper(responses.entries());
10633
+ _context30.p = 1;
10634
+ _iterator0.s();
10254
10635
  case 2:
10255
- if ((_step9 = _iterator9.n()).done) {
10256
- _context27.n = 11;
10636
+ if ((_step0 = _iterator0.n()).done) {
10637
+ _context30.n = 11;
10257
10638
  break;
10258
10639
  }
10259
- _step9$value = _slicedToArray(_step9.value, 2), responseIndex = _step9$value[0], response = _step9$value[1];
10260
- _iterator0 = _createForOfIteratorHelper(response.ipAssetsWithLicenseTerms.entries());
10261
- _context27.p = 3;
10262
- _iterator0.s();
10640
+ _step0$value = _slicedToArray(_step0.value, 2), responseIndex = _step0$value[0], response = _step0$value[1];
10641
+ _iterator1 = _createForOfIteratorHelper(response.ipAssetsWithLicenseTerms.entries());
10642
+ _context30.p = 3;
10643
+ _iterator1.s();
10263
10644
  case 4:
10264
- if ((_step0 = _iterator0.n()).done) {
10265
- _context27.n = 7;
10645
+ if ((_step1 = _iterator1.n()).done) {
10646
+ _context30.n = 7;
10266
10647
  break;
10267
10648
  }
10268
- _step0$value = _slicedToArray(_step0.value, 2), assetIndex = _step0$value[0], ipAsset = _step0$value[1];
10649
+ _step1$value = _slicedToArray(_step1.value, 2), assetIndex = _step1$value[0], ipAsset = _step1$value[1];
10269
10650
  extraData = (_Object$values$respon = Object.values(aggregateRegistrationRequest)[responseIndex]) === null || _Object$values$respon === void 0 || (_Object$values$respon = _Object$values$respon.extraData) === null || _Object$values$respon === void 0 ? void 0 : _Object$values$respon[assetIndex];
10270
- _context27.n = 5;
10651
+ _context30.n = 5;
10271
10652
  return this.processIpAssetLicenseTerms(ipAsset, extraData);
10272
10653
  case 5:
10273
- result = _context27.v;
10654
+ result = _context30.v;
10274
10655
  responses[responseIndex].ipAssetsWithLicenseTerms[assetIndex] = result;
10275
10656
  case 6:
10276
- _context27.n = 4;
10657
+ _context30.n = 4;
10277
10658
  break;
10278
10659
  case 7:
10279
- _context27.n = 9;
10660
+ _context30.n = 9;
10280
10661
  break;
10281
10662
  case 8:
10282
- _context27.p = 8;
10283
- _t30 = _context27.v;
10284
- _iterator0.e(_t30);
10663
+ _context30.p = 8;
10664
+ _t34 = _context30.v;
10665
+ _iterator1.e(_t34);
10285
10666
  case 9:
10286
- _context27.p = 9;
10287
- _iterator0.f();
10288
- return _context27.f(9);
10667
+ _context30.p = 9;
10668
+ _iterator1.f();
10669
+ return _context30.f(9);
10289
10670
  case 10:
10290
- _context27.n = 2;
10671
+ _context30.n = 2;
10291
10672
  break;
10292
10673
  case 11:
10293
- _context27.n = 13;
10674
+ _context30.n = 13;
10294
10675
  break;
10295
10676
  case 12:
10296
- _context27.p = 12;
10297
- _t31 = _context27.v;
10298
- _iterator9.e(_t31);
10677
+ _context30.p = 12;
10678
+ _t35 = _context30.v;
10679
+ _iterator0.e(_t35);
10299
10680
  case 13:
10300
- _context27.p = 13;
10301
- _iterator9.f();
10302
- return _context27.f(13);
10681
+ _context30.p = 13;
10682
+ _iterator0.f();
10683
+ return _context30.f(13);
10303
10684
  case 14:
10304
- _context27.n = 19;
10685
+ _context30.n = 19;
10305
10686
  break;
10306
10687
  case 15:
10307
10688
  _extraData = [];
@@ -10312,26 +10693,26 @@ var IPAssetClient = /*#__PURE__*/function () {
10312
10693
  i = 0;
10313
10694
  case 16:
10314
10695
  if (!(i < responses.length)) {
10315
- _context27.n = 19;
10696
+ _context30.n = 19;
10316
10697
  break;
10317
10698
  }
10318
10699
  _response = responses[i];
10319
10700
  extraDataItem = _extraData[i];
10320
- _context27.n = 17;
10701
+ _context30.n = 17;
10321
10702
  return this.processIpAssetLicenseTerms(_response.ipAssetsWithLicenseTerms[0], extraDataItem);
10322
10703
  case 17:
10323
- _ipAsset = _context27.v;
10704
+ _ipAsset = _context30.v;
10324
10705
  responses[i].ipAssetsWithLicenseTerms[0] = _ipAsset;
10325
10706
  case 18:
10326
10707
  i++;
10327
- _context27.n = 16;
10708
+ _context30.n = 16;
10328
10709
  break;
10329
10710
  case 19:
10330
- return _context27.a(2, responses);
10711
+ return _context30.a(2, responses);
10331
10712
  }
10332
- }, _callee27, this, [[3, 8, 9, 10], [1, 12, 13, 14]]);
10713
+ }, _callee30, this, [[3, 8, 9, 10], [1, 12, 13, 14]]);
10333
10714
  }));
10334
- function processResponses(_x27, _x28, _x29) {
10715
+ function processResponses(_x28, _x29, _x30) {
10335
10716
  return _processResponses.apply(this, arguments);
10336
10717
  }
10337
10718
  return processResponses;
@@ -10339,31 +10720,31 @@ var IPAssetClient = /*#__PURE__*/function () {
10339
10720
  }, {
10340
10721
  key: "processIpAssetLicenseTerms",
10341
10722
  value: function () {
10342
- var _processIpAssetLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(ipAsset, extraData) {
10723
+ var _processIpAssetLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(ipAsset, extraData) {
10343
10724
  var _extraData$licenseTer;
10344
10725
  var licenseTermsIds, maxLicenseTokens, maxLicenseTokensData, maxLicenseTokensTxHashes;
10345
- return _regenerator().w(function (_context28) {
10346
- while (1) switch (_context28.n) {
10726
+ return _regenerator().w(function (_context31) {
10727
+ while (1) switch (_context31.n) {
10347
10728
  case 0:
10348
10729
  if (extraData !== null && extraData !== void 0 && (_extraData$licenseTer = extraData.licenseTermsData) !== null && _extraData$licenseTer !== void 0 && _extraData$licenseTer.length) {
10349
- _context28.n = 1;
10730
+ _context31.n = 1;
10350
10731
  break;
10351
10732
  }
10352
- return _context28.a(2, ipAsset);
10733
+ return _context31.a(2, ipAsset);
10353
10734
  case 1:
10354
- _context28.n = 2;
10735
+ _context31.n = 2;
10355
10736
  return this.getLicenseTermsId(extraData.licenseTermsData.map(function (item) {
10356
10737
  return item.terms;
10357
10738
  }));
10358
10739
  case 2:
10359
- licenseTermsIds = _context28.v;
10740
+ licenseTermsIds = _context31.v;
10360
10741
  ipAsset.licenseTermsIds = licenseTermsIds;
10361
10742
  maxLicenseTokens = extraData.maxLicenseTokens;
10362
10743
  if (maxLicenseTokens !== null && maxLicenseTokens !== void 0 && maxLicenseTokens.length) {
10363
- _context28.n = 3;
10744
+ _context31.n = 3;
10364
10745
  break;
10365
10746
  }
10366
- return _context28.a(2, ipAsset);
10747
+ return _context31.a(2, ipAsset);
10367
10748
  case 3:
10368
10749
  maxLicenseTokensData = maxLicenseTokens.filter(function (maxLicenseToken) {
10369
10750
  return maxLicenseToken !== undefined;
@@ -10372,22 +10753,22 @@ var IPAssetClient = /*#__PURE__*/function () {
10372
10753
  maxLicenseTokens: maxLicenseToken
10373
10754
  };
10374
10755
  });
10375
- _context28.n = 4;
10756
+ _context31.n = 4;
10376
10757
  return this.setMaxLicenseTokens({
10377
10758
  maxLicenseTokensData: maxLicenseTokensData,
10378
10759
  licensorIpId: ipAsset.ipId,
10379
10760
  licenseTermsIds: licenseTermsIds
10380
10761
  });
10381
10762
  case 4:
10382
- maxLicenseTokensTxHashes = _context28.v;
10763
+ maxLicenseTokensTxHashes = _context31.v;
10383
10764
  if (maxLicenseTokensTxHashes !== null && maxLicenseTokensTxHashes !== void 0 && maxLicenseTokensTxHashes.length) {
10384
10765
  ipAsset.maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
10385
10766
  }
10386
- return _context28.a(2, ipAsset);
10767
+ return _context31.a(2, ipAsset);
10387
10768
  }
10388
- }, _callee28, this);
10769
+ }, _callee31, this);
10389
10770
  }));
10390
- function processIpAssetLicenseTerms(_x30, _x31) {
10771
+ function processIpAssetLicenseTerms(_x31, _x32) {
10391
10772
  return _processIpAssetLicenseTerms.apply(this, arguments);
10392
10773
  }
10393
10774
  return processIpAssetLicenseTerms;
@@ -10422,37 +10803,22 @@ var LicenseClient = /*#__PURE__*/function () {
10422
10803
  key: "registerPILTerms",
10423
10804
  value: (function () {
10424
10805
  var _registerPILTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request) {
10425
- var object, licenseTermsId, _t;
10806
+ var object, _t;
10426
10807
  return _regenerator().w(function (_context) {
10427
- while (1) switch (_context.n) {
10808
+ while (1) switch (_context.p = _context.n) {
10428
10809
  case 0:
10429
10810
  _context.p = 0;
10811
+ object = PILFlavor.validateLicenseTerms(request, this.chainId);
10430
10812
  _context.n = 1;
10431
- return validateLicenseTerms(request, this.rpcClient);
10432
- case 1:
10433
- object = _context.v;
10434
- _context.n = 2;
10435
- return this.getLicenseTermsId(object);
10436
- case 2:
10437
- licenseTermsId = _context.v;
10438
- if (!(licenseTermsId !== 0n)) {
10439
- _context.n = 3;
10440
- break;
10441
- }
10442
- return _context.a(2, {
10443
- licenseTermsId: licenseTermsId
10444
- });
10445
- case 3:
10446
- _context.n = 4;
10447
10813
  return this.registerPILTermsHelper(object, request.txOptions);
10448
- case 4:
10814
+ case 1:
10449
10815
  return _context.a(2, _context.v);
10450
- case 5:
10451
- _context.p = 5;
10816
+ case 2:
10817
+ _context.p = 2;
10452
10818
  _t = _context.v;
10453
10819
  return _context.a(2, handleError(_t, "Failed to register license terms"));
10454
10820
  }
10455
- }, _callee, this, [[0, 5]]);
10821
+ }, _callee, this, [[0, 2]]);
10456
10822
  }));
10457
10823
  function registerPILTerms(_x) {
10458
10824
  return _registerPILTerms.apply(this, arguments);
@@ -10460,6 +10826,9 @@ var LicenseClient = /*#__PURE__*/function () {
10460
10826
  return registerPILTerms;
10461
10827
  }()
10462
10828
  /**
10829
+ * @deprecated Use {@link PILFlavor.nonCommercialSocialRemixing} with {@link LicenseClient.registerPILTerms} instead.
10830
+ * The method will be removed in the `v1.4.0`.
10831
+ *
10463
10832
  * Convenient function to register a PIL non commercial social remix license to the registry
10464
10833
  *
10465
10834
  * For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%231%3A-non-commercial-social-remixing | Non Commercial Social Remixing}.
@@ -10473,10 +10842,10 @@ var LicenseClient = /*#__PURE__*/function () {
10473
10842
  var _registerNonComSocialRemixingPIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(request) {
10474
10843
  var licenseTerms, _t2;
10475
10844
  return _regenerator().w(function (_context2) {
10476
- while (1) switch (_context2.n) {
10845
+ while (1) switch (_context2.p = _context2.n) {
10477
10846
  case 0:
10478
10847
  _context2.p = 0;
10479
- licenseTerms = getLicenseTermByType(PIL_TYPE.NON_COMMERCIAL_REMIX);
10848
+ licenseTerms = PILFlavor.nonCommercialSocialRemixing();
10480
10849
  _context2.n = 1;
10481
10850
  return this.registerPILTermsHelper(licenseTerms, request === null || request === void 0 ? void 0 : request.txOptions);
10482
10851
  case 1:
@@ -10494,6 +10863,9 @@ var LicenseClient = /*#__PURE__*/function () {
10494
10863
  return registerNonComSocialRemixingPIL;
10495
10864
  }()
10496
10865
  /**
10866
+ * @deprecated Use {@link PILFlavor.commercialUse} with {@link LicenseClient.registerPILTerms} instead.
10867
+ * The method will be removed in the `v1.4.0`.
10868
+ *
10497
10869
  * Convenient function to register a PIL commercial use license to the registry.
10498
10870
  *
10499
10871
  * For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%232%3A-commercial-use | Commercial Use}.
@@ -10507,13 +10879,13 @@ var LicenseClient = /*#__PURE__*/function () {
10507
10879
  var _registerCommercialUsePIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(request) {
10508
10880
  var licenseTerms, _t3;
10509
10881
  return _regenerator().w(function (_context3) {
10510
- while (1) switch (_context3.n) {
10882
+ while (1) switch (_context3.p = _context3.n) {
10511
10883
  case 0:
10512
10884
  _context3.p = 0;
10513
- licenseTerms = getLicenseTermByType(PIL_TYPE.COMMERCIAL_USE, {
10514
- defaultMintingFee: request.defaultMintingFee,
10885
+ licenseTerms = PILFlavor.commercialUse({
10886
+ defaultMintingFee: Number(request.defaultMintingFee),
10515
10887
  currency: request.currency,
10516
- royaltyPolicyAddress: validateAddress(request.royaltyPolicyAddress || royaltyPolicyLapAddress[this.chainId])
10888
+ royaltyPolicy: request.royaltyPolicyAddress
10517
10889
  });
10518
10890
  _context3.n = 1;
10519
10891
  return this.registerPILTermsHelper(licenseTerms, request.txOptions);
@@ -10532,6 +10904,9 @@ var LicenseClient = /*#__PURE__*/function () {
10532
10904
  return registerCommercialUsePIL;
10533
10905
  }()
10534
10906
  /**
10907
+ * @deprecated Use {@link PILFlavor.commercialRemix} with {@link LicenseClient.registerPILTerms} instead.
10908
+ * The method will be removed in the v1.4.0.
10909
+ *
10535
10910
  * Convenient function to register a PIL commercial Remix license to the registry.
10536
10911
  *
10537
10912
  * For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%233%3A-commercial-remix | Commercial Remix }.
@@ -10542,28 +10917,29 @@ var LicenseClient = /*#__PURE__*/function () {
10542
10917
  }, {
10543
10918
  key: "registerCommercialRemixPIL",
10544
10919
  value: (function () {
10545
- var _registerCommercialRemixPIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(request) {
10546
- var licenseTerms, _t4;
10920
+ var _registerCommercialRemixPIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(_ref) {
10921
+ var defaultMintingFee, currency, royaltyPolicyAddress, commercialRevShare, txOptions, licenseTerms, _t4;
10547
10922
  return _regenerator().w(function (_context4) {
10548
- while (1) switch (_context4.n) {
10923
+ while (1) switch (_context4.p = _context4.n) {
10549
10924
  case 0:
10550
- _context4.p = 0;
10551
- licenseTerms = getLicenseTermByType(PIL_TYPE.COMMERCIAL_REMIX, {
10552
- defaultMintingFee: request.defaultMintingFee,
10553
- currency: request.currency,
10554
- royaltyPolicyAddress: validateAddress(request.royaltyPolicyAddress || royaltyPolicyLapAddress[this.chainId]),
10555
- commercialRevShare: request.commercialRevShare
10925
+ defaultMintingFee = _ref.defaultMintingFee, currency = _ref.currency, royaltyPolicyAddress = _ref.royaltyPolicyAddress, commercialRevShare = _ref.commercialRevShare, txOptions = _ref.txOptions;
10926
+ _context4.p = 1;
10927
+ licenseTerms = PILFlavor.commercialRemix({
10928
+ defaultMintingFee: Number(defaultMintingFee),
10929
+ currency: currency,
10930
+ royaltyPolicy: royaltyPolicyAddress,
10931
+ commercialRevShare: commercialRevShare
10556
10932
  });
10557
- _context4.n = 1;
10558
- return this.registerPILTermsHelper(licenseTerms, request.txOptions);
10559
- case 1:
10560
- return _context4.a(2, _context4.v);
10933
+ _context4.n = 2;
10934
+ return this.registerPILTermsHelper(licenseTerms, txOptions);
10561
10935
  case 2:
10562
- _context4.p = 2;
10936
+ return _context4.a(2, _context4.v);
10937
+ case 3:
10938
+ _context4.p = 3;
10563
10939
  _t4 = _context4.v;
10564
10940
  return _context4.a(2, handleError(_t4, "Failed to register commercial remix PIL"));
10565
10941
  }
10566
- }, _callee4, this, [[0, 2]]);
10942
+ }, _callee4, this, [[1, 3]]);
10567
10943
  }));
10568
10944
  function registerCommercialRemixPIL(_x4) {
10569
10945
  return _registerCommercialRemixPIL.apply(this, arguments);
@@ -10571,6 +10947,9 @@ var LicenseClient = /*#__PURE__*/function () {
10571
10947
  return registerCommercialRemixPIL;
10572
10948
  }()
10573
10949
  /**
10950
+ * @deprecated Use {@link PILFlavor.creativeCommonsAttribution} with {@link LicenseClient.registerPILTerms} instead.
10951
+ * The method will be removed in the `v1.4.0`.
10952
+ *
10574
10953
  * Convenient function to register a PIL creative commons attribution license to the registry.
10575
10954
  * Creates a Creative Commons Attribution (CC-BY) license terms flavor.
10576
10955
  *
@@ -10582,17 +10961,17 @@ var LicenseClient = /*#__PURE__*/function () {
10582
10961
  }, {
10583
10962
  key: "registerCreativeCommonsAttributionPIL",
10584
10963
  value: (function () {
10585
- var _registerCreativeCommonsAttributionPIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref) {
10964
+ var _registerCreativeCommonsAttributionPIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref2) {
10586
10965
  var currency, royaltyPolicyAddress, txOptions, _t5;
10587
10966
  return _regenerator().w(function (_context5) {
10588
- while (1) switch (_context5.n) {
10967
+ while (1) switch (_context5.p = _context5.n) {
10589
10968
  case 0:
10590
- currency = _ref.currency, royaltyPolicyAddress = _ref.royaltyPolicyAddress, txOptions = _ref.txOptions;
10969
+ currency = _ref2.currency, royaltyPolicyAddress = _ref2.royaltyPolicyAddress, txOptions = _ref2.txOptions;
10591
10970
  _context5.p = 1;
10592
10971
  _context5.n = 2;
10593
- return this.registerPILTermsHelper(getLicenseTermByType(PIL_TYPE.CREATIVE_COMMONS_ATTRIBUTION, {
10972
+ return this.registerPILTermsHelper(PILFlavor.creativeCommonsAttribution({
10594
10973
  currency: currency,
10595
- royaltyPolicyAddress: royaltyPolicyAddress || royaltyPolicyLapAddress[this.chainId]
10974
+ royaltyPolicy: royaltyPolicyAddress
10596
10975
  }), txOptions);
10597
10976
  case 2:
10598
10977
  return _context5.a(2, _context5.v);
@@ -10618,7 +10997,7 @@ var LicenseClient = /*#__PURE__*/function () {
10618
10997
  var _attachLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(request) {
10619
10998
  var _request$txOptions, isRegistered, isExisted, isAttachedLicenseTerms, req, txHash, _t6;
10620
10999
  return _regenerator().w(function (_context6) {
10621
- while (1) switch (_context6.n) {
11000
+ while (1) switch (_context6.p = _context6.n) {
10622
11001
  case 0:
10623
11002
  _context6.p = 0;
10624
11003
  request.licenseTermsId = BigInt(request.licenseTermsId);
@@ -10728,7 +11107,7 @@ var LicenseClient = /*#__PURE__*/function () {
10728
11107
  var _this = this;
10729
11108
  var _request$txOptions2, _request$options, receiver, req, isLicenseIpIdRegistered, isExisted, ipAccount, ipOwner, isAttachedLicenseTerms, encodedTxData, licenseMintingFee, wipSpenders, _yield$contractCallWi, txHash, receipt, targetLogs, startLicenseTokenId, licenseTokenIds, i, _t7;
10730
11109
  return _regenerator().w(function (_context7) {
10731
- while (1) switch (_context7.n) {
11110
+ while (1) switch (_context7.p = _context7.n) {
10732
11111
  case 0:
10733
11112
  _context7.p = 0;
10734
11113
  receiver = validateAddress(request.receiver || this.walletAddress);
@@ -10736,7 +11115,7 @@ var LicenseClient = /*#__PURE__*/function () {
10736
11115
  licensorIpId: validateAddress(request.licensorIpId),
10737
11116
  licenseTemplate: validateAddress(request.licenseTemplate || this.licenseTemplateClient.address),
10738
11117
  licenseTermsId: BigInt(request.licenseTermsId),
10739
- amount: BigInt(request.amount || 1),
11118
+ amount: BigInt(request.amount === undefined ? 1 : request.amount),
10740
11119
  receiver: receiver,
10741
11120
  royaltyContext: zeroAddress,
10742
11121
  maxMintingFee: BigInt(request.maxMintingFee),
@@ -10874,7 +11253,7 @@ var LicenseClient = /*#__PURE__*/function () {
10874
11253
  var _getLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(selectedLicenseTermsId) {
10875
11254
  var _t8;
10876
11255
  return _regenerator().w(function (_context8) {
10877
- while (1) switch (_context8.n) {
11256
+ while (1) switch (_context8.p = _context8.n) {
10878
11257
  case 0:
10879
11258
  _context8.p = 0;
10880
11259
  _context8.n = 1;
@@ -10905,7 +11284,7 @@ var LicenseClient = /*#__PURE__*/function () {
10905
11284
  var _predictMintingLicenseFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(request) {
10906
11285
  var isLicenseIpIdRegistered, licenseTermsId, isExisted, object, _t9;
10907
11286
  return _regenerator().w(function (_context9) {
10908
- while (1) switch (_context9.n) {
11287
+ while (1) switch (_context9.p = _context9.n) {
10909
11288
  case 0:
10910
11289
  _context9.p = 0;
10911
11290
  _context9.n = 1;
@@ -10971,7 +11350,7 @@ var LicenseClient = /*#__PURE__*/function () {
10971
11350
  var _setLicensingConfig = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(request) {
10972
11351
  var _request$txOptions3, req, isLicenseIpIdRegistered, isExisted, isRegistered, txHash, _t0;
10973
11352
  return _regenerator().w(function (_context0) {
10974
- while (1) switch (_context0.n) {
11353
+ while (1) switch (_context0.p = _context0.n) {
10975
11354
  case 0:
10976
11355
  _context0.p = 0;
10977
11356
  req = {
@@ -11083,12 +11462,12 @@ var LicenseClient = /*#__PURE__*/function () {
11083
11462
  }, {
11084
11463
  key: "setMaxLicenseTokens",
11085
11464
  value: (function () {
11086
- var _setMaxLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(_ref2) {
11465
+ var _setMaxLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(_ref3) {
11087
11466
  var ipId, licenseTermsId, maxLicenseTokens, licenseTemplate, txOptions, newLicenseTermsId, newLicenseTemplate, licensingConfig, txHash, _t1;
11088
11467
  return _regenerator().w(function (_context1) {
11089
- while (1) switch (_context1.n) {
11468
+ while (1) switch (_context1.p = _context1.n) {
11090
11469
  case 0:
11091
- ipId = _ref2.ipId, licenseTermsId = _ref2.licenseTermsId, maxLicenseTokens = _ref2.maxLicenseTokens, licenseTemplate = _ref2.licenseTemplate, txOptions = _ref2.txOptions;
11470
+ ipId = _ref3.ipId, licenseTermsId = _ref3.licenseTermsId, maxLicenseTokens = _ref3.maxLicenseTokens, licenseTemplate = _ref3.licenseTemplate, txOptions = _ref3.txOptions;
11092
11471
  _context1.p = 1;
11093
11472
  if (!(maxLicenseTokens < 0)) {
11094
11473
  _context1.n = 2;
@@ -11116,7 +11495,8 @@ var LicenseClient = /*#__PURE__*/function () {
11116
11495
  licenseTermsId: newLicenseTermsId,
11117
11496
  licenseTemplate: newLicenseTemplate,
11118
11497
  licensingConfig: _objectSpread2(_objectSpread2({}, licensingConfig), {}, {
11119
- licensingHook: this.totalLicenseTokenLimitHookClient.address
11498
+ licensingHook: this.totalLicenseTokenLimitHookClient.address,
11499
+ expectMinimumGroupRewardShare: licensingConfig.expectMinimumGroupRewardShare / 1000000
11120
11500
  })
11121
11501
  });
11122
11502
  case 4:
@@ -11152,7 +11532,7 @@ var LicenseClient = /*#__PURE__*/function () {
11152
11532
  var _getLicensingConfig = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(request) {
11153
11533
  var licensingConfigParam, _t10;
11154
11534
  return _regenerator().w(function (_context10) {
11155
- while (1) switch (_context10.n) {
11535
+ while (1) switch (_context10.p = _context10.n) {
11156
11536
  case 0:
11157
11537
  _context10.p = 0;
11158
11538
  licensingConfigParam = {
@@ -11207,6 +11587,7 @@ var LicenseClient = /*#__PURE__*/function () {
11207
11587
  return _regenerator().w(function (_context12) {
11208
11588
  while (1) switch (_context12.n) {
11209
11589
  case 0:
11590
+ licenseTerms.commercialRevShare = getRevenueShare(licenseTerms.commercialRevShare);
11210
11591
  if (!(txOptions !== null && txOptions !== void 0 && txOptions.encodedTxDataOnly)) {
11211
11592
  _context12.n = 1;
11212
11593
  break;
@@ -11282,7 +11663,7 @@ var NftClient = /*#__PURE__*/function () {
11282
11663
  var _createNFTCollection = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request) {
11283
11664
  var _request$baseURI, _request$maxSupply, _request$mintFee, _request$mintFeeToken, _request$txOptions, object, txHash, txReceipt, targetLogs, _t;
11284
11665
  return _regenerator().w(function (_context) {
11285
- while (1) switch (_context.n) {
11666
+ while (1) switch (_context.p = _context.n) {
11286
11667
  case 0:
11287
11668
  _context.p = 0;
11288
11669
  if (!(request.mintFee !== undefined && (request.mintFee < 0n || request.mintFeeToken === zeroAddress || !isAddress(request.mintFeeToken || "")))) {
@@ -11403,7 +11784,7 @@ var NftClient = /*#__PURE__*/function () {
11403
11784
  var _setTokenURI = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(_ref) {
11404
11785
  var tokenId, tokenURI, spgNftContract, txOptions, spgNftClient, txHash, _t2;
11405
11786
  return _regenerator().w(function (_context4) {
11406
- while (1) switch (_context4.n) {
11787
+ while (1) switch (_context4.p = _context4.n) {
11407
11788
  case 0:
11408
11789
  tokenId = _ref.tokenId, tokenURI = _ref.tokenURI, spgNftContract = _ref.spgNftContract, txOptions = _ref.txOptions;
11409
11790
  _context4.p = 1;
@@ -11489,7 +11870,7 @@ var PermissionClient = /*#__PURE__*/function () {
11489
11870
  var _setPermission = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request) {
11490
11871
  var _request$txOptions, req, txHash, _t;
11491
11872
  return _regenerator().w(function (_context) {
11492
- while (1) switch (_context.n) {
11873
+ while (1) switch (_context.p = _context.n) {
11493
11874
  case 0:
11494
11875
  _context.p = 0;
11495
11876
  _context.n = 1;
@@ -11552,7 +11933,7 @@ var PermissionClient = /*#__PURE__*/function () {
11552
11933
  var _createSetPermissionSignature = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(request) {
11553
11934
  var _request$txOptions2, ipId, signer, to, txOptions, func, permission, deadline, ipAccountClient, data, _yield$ipAccountClien, state, blockTimestamp, calculatedDeadline, _yield$getPermissionS, signature, req, txHash, _t2;
11554
11935
  return _regenerator().w(function (_context2) {
11555
- while (1) switch (_context2.n) {
11936
+ while (1) switch (_context2.p = _context2.n) {
11556
11937
  case 0:
11557
11938
  _context2.p = 0;
11558
11939
  ipId = request.ipId, signer = request.signer, to = request.to, txOptions = request.txOptions, func = request.func, permission = request.permission, deadline = request.deadline;
@@ -11651,7 +12032,7 @@ var PermissionClient = /*#__PURE__*/function () {
11651
12032
  var _setAllPermissions = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(request) {
11652
12033
  var _request$txOptions3, req, txHash, _t3;
11653
12034
  return _regenerator().w(function (_context3) {
11654
- while (1) switch (_context3.n) {
12035
+ while (1) switch (_context3.p = _context3.n) {
11655
12036
  case 0:
11656
12037
  _context3.p = 0;
11657
12038
  _context3.n = 1;
@@ -11712,7 +12093,7 @@ var PermissionClient = /*#__PURE__*/function () {
11712
12093
  var _setBatchPermissions = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(request) {
11713
12094
  var _request$txOptions4, permissions, txOptions, _iterator, _step, permission, req, txHash, _t4, _t5;
11714
12095
  return _regenerator().w(function (_context4) {
11715
- while (1) switch (_context4.n) {
12096
+ while (1) switch (_context4.p = _context4.n) {
11716
12097
  case 0:
11717
12098
  _context4.p = 0;
11718
12099
  permissions = request.permissions, txOptions = request.txOptions;
@@ -11803,7 +12184,7 @@ var PermissionClient = /*#__PURE__*/function () {
11803
12184
  var _createBatchPermissionSignature = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(request) {
11804
12185
  var _request$txOptions5, permissions, deadline, ipId, txOptions, _iterator2, _step2, permission, ipAccountClient, data, _yield$ipAccountClien2, state, blockTimestamp, calculatedDeadline, _yield$getPermissionS2, signature, req, txHash, _t6, _t7;
11805
12186
  return _regenerator().w(function (_context5) {
11806
- while (1) switch (_context5.n) {
12187
+ while (1) switch (_context5.p = _context5.n) {
11807
12188
  case 0:
11808
12189
  _context5.p = 0;
11809
12190
  permissions = request.permissions, deadline = request.deadline, ipId = request.ipId, txOptions = request.txOptions;
@@ -11947,32 +12328,6 @@ var PermissionClient = /*#__PURE__*/function () {
11947
12328
  }]);
11948
12329
  }();
11949
12330
 
11950
- /** The amount of revenue token claimable. */
11951
-
11952
- /**
11953
- * Native royalty policy created by the Story team
11954
- */
11955
- var NativeRoyaltyPolicy = /*#__PURE__*/function (NativeRoyaltyPolicy) {
11956
- NativeRoyaltyPolicy[NativeRoyaltyPolicy["LAP"] = 0] = "LAP";
11957
- NativeRoyaltyPolicy[NativeRoyaltyPolicy["LRP"] = 1] = "LRP";
11958
- return NativeRoyaltyPolicy;
11959
- }({});
11960
-
11961
- /**
11962
- * Allow custom royalty policy address or use a native royalty policy enum
11963
- */
11964
-
11965
- var royaltyPolicyInputToAddress = function royaltyPolicyInputToAddress(input, chainId) {
11966
- switch (input) {
11967
- case NativeRoyaltyPolicy.LAP:
11968
- return royaltyPolicyLapAddress[chain[chainId]];
11969
- case NativeRoyaltyPolicy.LRP:
11970
- return royaltyPolicyLrpAddress[chain[chainId]];
11971
- default:
11972
- return validateAddress(input);
11973
- }
11974
- };
11975
-
11976
12331
  var RoyaltyClient = /*#__PURE__*/function () {
11977
12332
  function RoyaltyClient(rpcClient, wallet, chainId) {
11978
12333
  _classCallCheck(this, RoyaltyClient);
@@ -12005,7 +12360,7 @@ var RoyaltyClient = /*#__PURE__*/function () {
12005
12360
  var _claimAllRevenue = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(req) {
12006
12361
  var _req$claimOptions, _req$claimOptions2, ancestorIpId, claimer, childIpIds, royaltyPolicies, currencyTokens, txHashes, txHash, receipt, _yield$this$getClaime, ownsClaimer, isClaimerIp, ipAccount, claimedTokens, autoTransfer, autoUnwrapIp, hashes, _hashes, _t;
12007
12362
  return _regenerator().w(function (_context) {
12008
- while (1) switch (_context.n) {
12363
+ while (1) switch (_context.p = _context.n) {
12009
12364
  case 0:
12010
12365
  _context.p = 0;
12011
12366
  ancestorIpId = validateAddress(req.ancestorIpId);
@@ -12104,7 +12459,7 @@ var RoyaltyClient = /*#__PURE__*/function () {
12104
12459
  var _this = this;
12105
12460
  var _request$options, _request$claimOptions, _request$claimOptions2, txHashes, receipts, claimedTokens, useMulticallWhenPossible, _iterator, _step, ancestorIp, result, encodedTxs, txHash, receipt, claimedTokenLogs, aggregatedClaimedTokens, claimers, autoTransfer, autoUnwrapIp, wipClaimableAmounts, _iterator2, _step2, _loop, hash, _t2, _t3, _t4;
12106
12461
  return _regenerator().w(function (_context3) {
12107
- while (1) switch (_context3.n) {
12462
+ while (1) switch (_context3.p = _context3.n) {
12108
12463
  case 0:
12109
12464
  _context3.p = 0;
12110
12465
  txHashes = [];
@@ -12328,7 +12683,7 @@ var RoyaltyClient = /*#__PURE__*/function () {
12328
12683
  var _this2 = this;
12329
12684
  var _request$txOptions, receiverIpId, payerIpId, token, amount, _request$options2, _request$options3, erc20Options, wipOptions, txOptions, sender, payAmount, isReceiverRegistered, isPayerRegistered, req, encodedTxData, contractCall, tokenSpenders, _t5;
12330
12685
  return _regenerator().w(function (_context4) {
12331
- while (1) switch (_context4.n) {
12686
+ while (1) switch (_context4.p = _context4.n) {
12332
12687
  case 0:
12333
12688
  _context4.p = 0;
12334
12689
  receiverIpId = request.receiverIpId, payerIpId = request.payerIpId, token = request.token, amount = request.amount, _request$options2 = request.options, _request$options3 = _request$options2 === void 0 ? {} : _request$options2, erc20Options = _request$options3.erc20Options, wipOptions = _request$options3.wipOptions, txOptions = request.txOptions;
@@ -12432,7 +12787,7 @@ var RoyaltyClient = /*#__PURE__*/function () {
12432
12787
  var _claimableRevenue = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(request) {
12433
12788
  var proxyAddress, ipRoyaltyVault, _t6;
12434
12789
  return _regenerator().w(function (_context5) {
12435
- while (1) switch (_context5.n) {
12790
+ while (1) switch (_context5.p = _context5.n) {
12436
12791
  case 0:
12437
12792
  _context5.p = 0;
12438
12793
  _context5.n = 1;
@@ -12701,7 +13056,7 @@ var WipClient = /*#__PURE__*/function () {
12701
13056
  var _deposit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
12702
13057
  var amount, txOptions, _yield$this$rpcClient, call, txHash, _t;
12703
13058
  return _regenerator().w(function (_context) {
12704
- while (1) switch (_context.n) {
13059
+ while (1) switch (_context.p = _context.n) {
12705
13060
  case 0:
12706
13061
  amount = _ref.amount, txOptions = _ref.txOptions;
12707
13062
  _context.p = 1;
@@ -12753,7 +13108,7 @@ var WipClient = /*#__PURE__*/function () {
12753
13108
  var _withdraw = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref2) {
12754
13109
  var amount, txOptions, targetAmt, txHash, _t2;
12755
13110
  return _regenerator().w(function (_context2) {
12756
- while (1) switch (_context2.n) {
13111
+ while (1) switch (_context2.p = _context2.n) {
12757
13112
  case 0:
12758
13113
  amount = _ref2.amount, txOptions = _ref2.txOptions;
12759
13114
  _context2.p = 1;
@@ -12797,7 +13152,7 @@ var WipClient = /*#__PURE__*/function () {
12797
13152
  var _approve = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(req) {
12798
13153
  var amount, spender, txHash, _t3;
12799
13154
  return _regenerator().w(function (_context3) {
12800
- while (1) switch (_context3.n) {
13155
+ while (1) switch (_context3.p = _context3.n) {
12801
13156
  case 0:
12802
13157
  _context3.p = 0;
12803
13158
  amount = BigInt(req.amount);
@@ -12870,7 +13225,7 @@ var WipClient = /*#__PURE__*/function () {
12870
13225
  var _transfer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(request) {
12871
13226
  var amount, txHash, _t4;
12872
13227
  return _regenerator().w(function (_context5) {
12873
- while (1) switch (_context5.n) {
13228
+ while (1) switch (_context5.p = _context5.n) {
12874
13229
  case 0:
12875
13230
  _context5.p = 0;
12876
13231
  amount = BigInt(request.amount);
@@ -12914,7 +13269,7 @@ var WipClient = /*#__PURE__*/function () {
12914
13269
  var _transferFrom = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(request) {
12915
13270
  var amount, txHash, _t5;
12916
13271
  return _regenerator().w(function (_context6) {
12917
- while (1) switch (_context6.n) {
13272
+ while (1) switch (_context6.p = _context6.n) {
12918
13273
  case 0:
12919
13274
  _context6.p = 0;
12920
13275
  amount = BigInt(request.amount);
@@ -13306,6 +13661,26 @@ var AIRelationship = /*#__PURE__*/function (AIRelationship) {
13306
13661
  return AIRelationship;
13307
13662
  }({});
13308
13663
 
13664
+ /**
13665
+ * This structure defines the terms for a Programmable IP License (PIL).
13666
+ * These terms can be attached to IP Assets.
13667
+ *
13668
+ * For more information, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-terms | PIL}.
13669
+ **/
13670
+
13671
+ /**
13672
+ * @deprecated Use `PILFlavor.nonCommercialSocialRemixing`, `PILFlavor.commercialUse`, `PILFlavor.commercialRemix`, or `PILFlavor.creativeCommonsAttribution` instead.
13673
+ *
13674
+ * The type of PIL.
13675
+ */
13676
+ var PIL_TYPE = /*#__PURE__*/function (PIL_TYPE) {
13677
+ PIL_TYPE[PIL_TYPE["NON_COMMERCIAL_REMIX"] = 0] = "NON_COMMERCIAL_REMIX";
13678
+ PIL_TYPE[PIL_TYPE["COMMERCIAL_USE"] = 1] = "COMMERCIAL_USE";
13679
+ PIL_TYPE[PIL_TYPE["COMMERCIAL_REMIX"] = 2] = "COMMERCIAL_REMIX";
13680
+ PIL_TYPE[PIL_TYPE["CREATIVE_COMMONS_ATTRIBUTION"] = 3] = "CREATIVE_COMMONS_ATTRIBUTION";
13681
+ return PIL_TYPE;
13682
+ }({});
13683
+
13309
13684
  /**
13310
13685
  * Tags refer to the “labels” that can be applied to IP Assets in the protocol when raising a dispute.
13311
13686
  * Tags must be whitelisted by protocol governance to be used in a dispute.
@@ -13334,4 +13709,4 @@ var DisputeTargetTag = /*#__PURE__*/function (DisputeTargetTag) {
13334
13709
  return DisputeTargetTag;
13335
13710
  }({});
13336
13711
 
13337
- export { AIRelationship, AccessPermission, DisputeClient, DisputeTargetTag, 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, settleAssertion };
13712
+ export { AIRelationship, AccessPermission, DisputeClient, DisputeTargetTag, GroupClient, IPAccountClient, IPAssetClient, LicenseClient, NativeRoyaltyPolicy, NftClient, PILFlavor, PIL_TYPE, PermissionClient, RevShareType, RoyaltyClient, StoryClient, StoryRelationship, WIP_TOKEN_ADDRESS, WipClient, aeneid, convertCIDtoHashIPFS, convertHashIPFStoCID, getPermissionSignature, getSignature, mainnet, royaltyPolicyLapAddress, royaltyPolicyLrpAddress, settleAssertion };