@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
@@ -39,19 +39,17 @@ function _regeneratorDefine(e, r, n, t) {
39
39
  i = 0;
40
40
  }
41
41
  _regeneratorDefine = function (e, r, n, t) {
42
- if (r) i ? i(e, r, {
42
+ function o(r, n) {
43
+ _regeneratorDefine(e, r, function (e) {
44
+ return this._invoke(r, n, e);
45
+ });
46
+ }
47
+ r ? i ? i(e, r, {
43
48
  value: n,
44
49
  enumerable: !t,
45
50
  configurable: !t,
46
51
  writable: !t
47
- }) : e[r] = n;else {
48
- function o(r, n) {
49
- _regeneratorDefine(e, r, function (e) {
50
- return this._invoke(r, n, e);
51
- });
52
- }
53
- o("next", 0), o("throw", 1), o("return", 2);
54
- }
52
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
55
53
  }, _regeneratorDefine(e, r, n, t);
56
54
  }
57
55
 
@@ -2650,6 +2648,11 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2650
2648
  * @param to address
2651
2649
  * @param tokenId uint256
2652
2650
  *//**
2651
+ * SpgnftImplHasRoleRequest
2652
+ *
2653
+ * @param role bytes32
2654
+ * @param account address
2655
+ *//**
2653
2656
  * SpgnftImplTokenUriRequest
2654
2657
  *
2655
2658
  * @param tokenId uint256
@@ -2667,49 +2670,44 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2667
2670
  */},{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=viem.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;}}]);}();/**
2668
2671
  * contract SPGNFTImpl readonly method
2669
2672
  */var SpgnftImplReadOnlyClient=/*#__PURE__*/function(_SpgnftImplEventClien){function SpgnftImplReadOnlyClient(rpcClient,address){_classCallCheck(this,SpgnftImplReadOnlyClient);return _callSuper(this,SpgnftImplReadOnlyClient,[rpcClient,address]);}/**
2673
+ * method hasRole for contract SPGNFTImpl
2674
+ *
2675
+ * @param request SpgnftImplHasRoleRequest
2676
+ * @return Promise<SpgnftImplHasRoleResponse>
2677
+ */_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;}()/**
2670
2678
  * method mintFee for contract SPGNFTImpl
2671
2679
  *
2672
2680
  * @param request SpgnftImplMintFeeRequest
2673
2681
  * @return Promise<SpgnftImplMintFeeResponse>
2674
- */_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;}()/**
2682
+ */)},{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;}()/**
2675
2683
  * method mintFeeToken for contract SPGNFTImpl
2676
2684
  *
2677
2685
  * @param request SpgnftImplMintFeeTokenRequest
2678
2686
  * @return Promise<SpgnftImplMintFeeTokenResponse>
2679
- */)},{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;}()/**
2687
+ */)},{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;}()/**
2680
2688
  * method publicMinting for contract SPGNFTImpl
2681
2689
  *
2682
2690
  * @param request SpgnftImplPublicMintingRequest
2683
2691
  * @return Promise<SpgnftImplPublicMintingResponse>
2684
- */)},{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;}()/**
2692
+ */)},{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;}()/**
2685
2693
  * method tokenURI for contract SPGNFTImpl
2686
2694
  *
2687
2695
  * @param request SpgnftImplTokenUriRequest
2688
2696
  * @return Promise<SpgnftImplTokenUriResponse>
2689
- */)},{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);/**
2697
+ */)},{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);/**
2690
2698
  * contract SPGNFTImpl write method
2691
2699
  */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;}/**
2692
2700
  * method setTokenURI for contract SPGNFTImpl
2693
2701
  *
2694
2702
  * @param request SpgnftImplSetTokenUriRequest
2695
2703
  * @return Promise<WriteContractReturnType>
2696
- */_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;}()/**
2704
+ */_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;}()/**
2697
2705
  * method setTokenURI for contract SPGNFTImpl with only encode
2698
2706
  *
2699
2707
  * @param request SpgnftImplSetTokenUriRequest
2700
2708
  * @return EncodedTxData
2701
2709
  */)},{key:"setTokenUriEncode",value:function setTokenUriEncode(request){return {to:this.address,data:viem.encodeFunctionData({abi:spgnftImplAbi,functionName:"setTokenURI",args:[request.tokenId,request.tokenUri]})};}}]);}(SpgnftImplReadOnlyClient);// Contract TotalLicenseTokenLimitHook =============================================================
2702
2710
  /**
2703
- * TotalLicenseTokenLimitHookGetTotalLicenseTokenLimitRequest
2704
- *
2705
- * @param licensorIpId address
2706
- * @param licenseTemplate address
2707
- * @param licenseTermsId uint256
2708
- *//**
2709
- * TotalLicenseTokenLimitHookGetTotalLicenseTokenLimitResponse
2710
- *
2711
- * @param limit uint256
2712
- *//**
2713
2711
  * TotalLicenseTokenLimitHookSetTotalLicenseTokenLimitRequest
2714
2712
  *
2715
2713
  * @param licensorIpId address
@@ -2717,25 +2715,18 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2717
2715
  * @param licenseTermsId uint256
2718
2716
  * @param limit uint256
2719
2717
  *//**
2720
- * contract TotalLicenseTokenLimitHook readonly method
2721
- */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;}/**
2722
- * method getTotalLicenseTokenLimit for contract TotalLicenseTokenLimitHook
2723
- *
2724
- * @param request TotalLicenseTokenLimitHookGetTotalLicenseTokenLimitRequest
2725
- * @return Promise<TotalLicenseTokenLimitHookGetTotalLicenseTokenLimitResponse>
2726
- */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;}())}]);}();/**
2727
2718
  * contract TotalLicenseTokenLimitHook write method
2728
- */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;}/**
2719
+ */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;}/**
2729
2720
  * method setTotalLicenseTokenLimit for contract TotalLicenseTokenLimitHook
2730
2721
  *
2731
2722
  * @param request TotalLicenseTokenLimitHookSetTotalLicenseTokenLimitRequest
2732
2723
  * @return Promise<WriteContractReturnType>
2733
- */_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;}()/**
2724
+ */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;}()/**
2734
2725
  * method setTotalLicenseTokenLimit for contract TotalLicenseTokenLimitHook with only encode
2735
2726
  *
2736
2727
  * @param request TotalLicenseTokenLimitHookSetTotalLicenseTokenLimitRequest
2737
2728
  * @return EncodedTxData
2738
- */)},{key:"setTotalLicenseTokenLimitEncode",value:function setTotalLicenseTokenLimitEncode(request){return {to:this.address,data:viem.encodeFunctionData({abi:totalLicenseTokenLimitHookAbi,functionName:"setTotalLicenseTokenLimit",args:[request.licensorIpId,request.licenseTemplate,request.licenseTermsId,request.limit]})};}}]);}(TotalLicenseTokenLimitHookReadOnlyClient);// Contract WrappedIP =============================================================
2729
+ */)},{key:"setTotalLicenseTokenLimitEncode",value:function setTotalLicenseTokenLimitEncode(request){return {to:this.address,data:viem.encodeFunctionData({abi:totalLicenseTokenLimitHookAbi,functionName:"setTotalLicenseTokenLimit",args:[request.licensorIpId,request.licenseTemplate,request.licenseTermsId,request.limit]})};}}]);}();// Contract WrappedIP =============================================================
2739
2730
  /**
2740
2731
  * WrappedIpAllowanceRequest
2741
2732
  *
@@ -2787,7 +2778,7 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2787
2778
  * @return Promise<WrappedIpBalanceOfResponse>
2788
2779
  */)},{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;}())}]);}();/**
2789
2780
  * contract WrappedIP write method
2790
- */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;}/**
2781
+ */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;}/**
2791
2782
  * method approve for contract WrappedIP
2792
2783
  *
2793
2784
  * @param request WrappedIpApproveRequest
@@ -2899,6 +2890,45 @@ var royaltySharesTotalSupply = 100000000;
2899
2890
  var MAX_ROYALTY_TOKEN = 100000000;
2900
2891
  var WIP_TOKEN_ADDRESS = wrappedIpAddress[mainnet.id];
2901
2892
 
2893
+ function _isNativeFunction(t) {
2894
+ try {
2895
+ return -1 !== Function.toString.call(t).indexOf("[native code]");
2896
+ } catch (n) {
2897
+ return "function" == typeof t;
2898
+ }
2899
+ }
2900
+
2901
+ function _construct(t, e, r) {
2902
+ if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
2903
+ var o = [null];
2904
+ o.push.apply(o, e);
2905
+ var p = new (t.bind.apply(t, o))();
2906
+ return r && _setPrototypeOf(p, r.prototype), p;
2907
+ }
2908
+
2909
+ function _wrapNativeSuper(t) {
2910
+ var r = "function" == typeof Map ? new Map() : void 0;
2911
+ return _wrapNativeSuper = function (t) {
2912
+ if (null === t || !_isNativeFunction(t)) return t;
2913
+ if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
2914
+ if (void 0 !== r) {
2915
+ if (r.has(t)) return r.get(t);
2916
+ r.set(t, Wrapper);
2917
+ }
2918
+ function Wrapper() {
2919
+ return _construct(t, arguments, _getPrototypeOf(this).constructor);
2920
+ }
2921
+ return Wrapper.prototype = Object.create(t.prototype, {
2922
+ constructor: {
2923
+ value: Wrapper,
2924
+ enumerable: false,
2925
+ writable: true,
2926
+ configurable: true
2927
+ }
2928
+ }), _setPrototypeOf(Wrapper, t);
2929
+ }, _wrapNativeSuper(t);
2930
+ }
2931
+
2902
2932
  var handleError = function handleError(error, msg) {
2903
2933
  if (error instanceof Error) {
2904
2934
  var newError = new Error("".concat(msg, ": ").concat(error.message));
@@ -2907,6 +2937,17 @@ var handleError = function handleError(error, msg) {
2907
2937
  }
2908
2938
  throw new Error("".concat(msg, ": Unknown error type"));
2909
2939
  };
2940
+ var PILFlavorError = /*#__PURE__*/function (_Error) {
2941
+ function PILFlavorError(message) {
2942
+ var _this;
2943
+ _classCallCheck(this, PILFlavorError);
2944
+ _this = _callSuper(this, PILFlavorError, [message]);
2945
+ _this.name = "PILFlavorError";
2946
+ return _this;
2947
+ }
2948
+ _inherits(PILFlavorError, _Error);
2949
+ return _createClass(PILFlavorError);
2950
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
2910
2951
 
2911
2952
  function _arrayWithoutHoles(r) {
2912
2953
  if (Array.isArray(r)) return _arrayLikeToArray(r);
@@ -3259,7 +3300,7 @@ var approvalAllSpenders = /*#__PURE__*/function () {
3259
3300
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
3260
3301
  var spenders, client, owner, useMultiCall, rpcClient, multicallAddress, approvals, allCalls, _iterator, _step, approval, hash, _t;
3261
3302
  return _regenerator().w(function (_context2) {
3262
- while (1) switch (_context2.n) {
3303
+ while (1) switch (_context2.p = _context2.n) {
3263
3304
  case 0:
3264
3305
  spenders = _ref.spenders, client = _ref.client, owner = _ref.owner, useMultiCall = _ref.useMultiCall, rpcClient = _ref.rpcClient, multicallAddress = _ref.multicallAddress;
3265
3306
  _context2.n = 1;
@@ -3845,7 +3886,7 @@ var settleAssertion = /*#__PURE__*/function () {
3845
3886
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(privateKey, disputeId, transport) {
3846
3887
  var baseConfig, rpcClient, walletClient, arbitrationPolicyUmaClient, oov3Contract, assertionId, txHash, _t;
3847
3888
  return _regenerator().w(function (_context4) {
3848
- while (1) switch (_context4.n) {
3889
+ while (1) switch (_context4.p = _context4.n) {
3849
3890
  case 0:
3850
3891
  _context4.p = 0;
3851
3892
  baseConfig = {
@@ -3918,7 +3959,7 @@ var DisputeClient = /*#__PURE__*/function () {
3918
3959
  var _this = this;
3919
3960
  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;
3920
3961
  return _regenerator().w(function (_context) {
3921
- while (1) switch (_context.n) {
3962
+ while (1) switch (_context.p = _context.n) {
3922
3963
  case 0:
3923
3964
  _context.p = 0;
3924
3965
  liveness = BigInt(request.liveness);
@@ -3944,7 +3985,7 @@ var DisputeClient = /*#__PURE__*/function () {
3944
3985
  _yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 2);
3945
3986
  minimumBond = _yield$Promise$all4[0];
3946
3987
  maximumBond = _yield$Promise$all4[1];
3947
- bonds = BigInt(request.bond || minimumBond);
3988
+ bonds = BigInt(request.bond === undefined ? minimumBond : request.bond);
3948
3989
  if (!(bonds > maximumBond || bonds < minimumBond)) {
3949
3990
  _context.n = 4;
3950
3991
  break;
@@ -4062,7 +4103,7 @@ var DisputeClient = /*#__PURE__*/function () {
4062
4103
  var _cancelDispute = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(request) {
4063
4104
  var _request$txOptions2, _req, txHash, _t2;
4064
4105
  return _regenerator().w(function (_context2) {
4065
- while (1) switch (_context2.n) {
4106
+ while (1) switch (_context2.p = _context2.n) {
4066
4107
  case 0:
4067
4108
  _context2.p = 0;
4068
4109
  _req = {
@@ -4118,7 +4159,7 @@ var DisputeClient = /*#__PURE__*/function () {
4118
4159
  var _resolveDispute = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(request) {
4119
4160
  var _request$data, _request$txOptions3, _req2, txHash, _t3;
4120
4161
  return _regenerator().w(function (_context3) {
4121
- while (1) switch (_context3.n) {
4162
+ while (1) switch (_context3.p = _context3.n) {
4122
4163
  case 0:
4123
4164
  _context3.p = 0;
4124
4165
  _req2 = {
@@ -4176,7 +4217,7 @@ var DisputeClient = /*#__PURE__*/function () {
4176
4217
  var _this2 = this;
4177
4218
  var _request$options, objects, txHashes, calls, txHash, _iterator, _step, object, _txHash, _t4, _t5;
4178
4219
  return _regenerator().w(function (_context4) {
4179
- while (1) switch (_context4.n) {
4220
+ while (1) switch (_context4.p = _context4.n) {
4180
4221
  case 0:
4181
4222
  _context4.p = 0;
4182
4223
  objects = request.infringementTags.map(function (arg) {
@@ -4278,7 +4319,7 @@ var DisputeClient = /*#__PURE__*/function () {
4278
4319
  var _this3 = this;
4279
4320
  var ipAccount, bond, counterEvidenceHash, encodedData, _yield$this$wrappedIp, allowance, _txHash2, contractCall, _yield$contractCallWi2, txHash, receipt, _t6;
4280
4321
  return _regenerator().w(function (_context5) {
4281
- while (1) switch (_context5.n) {
4322
+ while (1) switch (_context5.p = _context5.n) {
4282
4323
  case 0:
4283
4324
  _context5.p = 0;
4284
4325
  ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(request.ipId));
@@ -4431,9 +4472,11 @@ var DisputeClient = /*#__PURE__*/function () {
4431
4472
  * 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.
4432
4473
  */
4433
4474
  var RevShareType = /*#__PURE__*/function (RevShareType) {
4434
- RevShareType["COMMERCIAL_REVENUE_SHARE"] = "CommercialRevShare";
4435
- RevShareType["MAX_REVENUE_SHARE"] = "MaxRevenueShare";
4436
- RevShareType["MAX_ALLOWED_REWARD_SHARE"] = "MaxAllowedRewardShare";
4475
+ RevShareType["COMMERCIAL_REVENUE_SHARE"] = "commercialRevShare";
4476
+ RevShareType["MAX_REVENUE_SHARE"] = "maxRevenueShare";
4477
+ RevShareType["MAX_ALLOWED_REWARD_SHARE"] = "maxAllowedRewardShare";
4478
+ RevShareType["EXPECT_MINIMUM_GROUP_REWARD_SHARE"] = "expectMinimumGroupRewardShare";
4479
+ RevShareType["MAX_ALLOWED_REWARD_SHARE_PERCENTAGE"] = "maxAllowedRewardSharePercentage";
4437
4480
  return RevShareType;
4438
4481
  }({});
4439
4482
 
@@ -4497,207 +4540,39 @@ var getIpMetadataForWorkflow = function getIpMetadataForWorkflow(ipMetadata) {
4497
4540
  };
4498
4541
  };
4499
4542
 
4500
- /**
4501
- * This structure defines the terms for a Programmable IP License (PIL).
4502
- * These terms can be attached to IP Assets.
4503
- *
4504
- * For more information, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-terms | PIL}.
4505
- **/
4543
+ /** The amount of revenue token claimable. */
4506
4544
 
4507
- var PIL_TYPE = /*#__PURE__*/function (PIL_TYPE) {
4508
- PIL_TYPE[PIL_TYPE["NON_COMMERCIAL_REMIX"] = 0] = "NON_COMMERCIAL_REMIX";
4509
- PIL_TYPE[PIL_TYPE["COMMERCIAL_USE"] = 1] = "COMMERCIAL_USE";
4510
- PIL_TYPE[PIL_TYPE["COMMERCIAL_REMIX"] = 2] = "COMMERCIAL_REMIX";
4511
- PIL_TYPE[PIL_TYPE["CREATIVE_COMMONS_ATTRIBUTION"] = 3] = "CREATIVE_COMMONS_ATTRIBUTION";
4512
- return PIL_TYPE;
4545
+ /**
4546
+ * Native royalty policy created by the Story team
4547
+ * - LAP: {@link https://docs.story.foundation/concepts/royalty-module/liquid-absolute-percentage | Liquid Absolute Percentage}
4548
+ * - LRP: {@link https://docs.story.foundation/concepts/royalty-module/liquid-relative-percentage | Liquid Relative Percentage}
4549
+ */
4550
+ var NativeRoyaltyPolicy = /*#__PURE__*/function (NativeRoyaltyPolicy) {
4551
+ NativeRoyaltyPolicy[NativeRoyaltyPolicy["LAP"] = 0] = "LAP";
4552
+ NativeRoyaltyPolicy[NativeRoyaltyPolicy["LRP"] = 1] = "LRP";
4553
+ return NativeRoyaltyPolicy;
4513
4554
  }({});
4514
4555
 
4515
- var getLicenseTermByType = function getLicenseTermByType(type, term) {
4516
- var licenseTerms = {
4517
- transferable: true,
4518
- royaltyPolicy: viem.zeroAddress,
4519
- defaultMintingFee: BigInt(0),
4520
- expiration: BigInt(0),
4521
- commercialUse: false,
4522
- commercialAttribution: false,
4523
- commercializerChecker: viem.zeroAddress,
4524
- commercializerCheckerData: viem.zeroAddress,
4525
- commercialRevShare: 0,
4526
- commercialRevCeiling: BigInt(0),
4527
- derivativesAllowed: true,
4528
- derivativesAttribution: true,
4529
- derivativesApproval: false,
4530
- derivativesReciprocal: true,
4531
- derivativeRevCeiling: BigInt(0),
4532
- currency: viem.zeroAddress,
4533
- uri: ""
4534
- };
4535
- if (type === PIL_TYPE.NON_COMMERCIAL_REMIX) {
4536
- licenseTerms.commercializerCheckerData = "0x";
4537
- licenseTerms.uri = "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/NCSR.json";
4538
- return licenseTerms;
4539
- } else if (type === PIL_TYPE.COMMERCIAL_USE) {
4540
- if (!term || term.defaultMintingFee === undefined || term.currency === undefined) {
4541
- throw new Error("DefaultMintingFee, currency are required for commercial use PIL.");
4542
- }
4543
- licenseTerms.royaltyPolicy = validateAddress(term.royaltyPolicyAddress);
4544
- licenseTerms.defaultMintingFee = BigInt(term.defaultMintingFee);
4545
- licenseTerms.commercialUse = true;
4546
- licenseTerms.commercialAttribution = true;
4547
- licenseTerms.derivativesReciprocal = false;
4548
- licenseTerms.currency = validateAddress(term.currency);
4549
- licenseTerms.uri = "https://github.com/piplabs/pil-document/blob/9a1f803fcf8101a8a78f1dcc929e6014e144ab56/off-chain-terms/CommercialUse.json";
4550
- licenseTerms.derivativesAllowed = false;
4551
- licenseTerms.derivativesAttribution = false;
4552
- return licenseTerms;
4553
- } else if (type === PIL_TYPE.CREATIVE_COMMONS_ATTRIBUTION) {
4554
- if (!term || !term.royaltyPolicyAddress || !term.currency) {
4555
- throw new Error("royaltyPolicyAddress and currency are required for creative commons attribution PIL.");
4556
- }
4557
- licenseTerms.royaltyPolicy = validateAddress(term.royaltyPolicyAddress);
4558
- licenseTerms.currency = validateAddress(term.currency);
4559
- licenseTerms.commercialUse = true;
4560
- licenseTerms.commercialAttribution = true;
4561
- licenseTerms.uri = "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/CC-BY.json";
4562
- return licenseTerms;
4563
- } else {
4564
- if (!term || term.defaultMintingFee === undefined || term.currency === undefined || term.commercialRevShare === undefined) {
4565
- throw new Error("DefaultMintingFee, currency and commercialRevShare are required for commercial remix PIL.");
4566
- }
4567
- licenseTerms.royaltyPolicy = validateAddress(term.royaltyPolicyAddress);
4568
- licenseTerms.defaultMintingFee = BigInt(term.defaultMintingFee);
4569
- licenseTerms.commercialUse = true;
4570
- licenseTerms.commercialAttribution = true;
4571
- licenseTerms.uri = "https://github.com/piplabs/pil-document/blob/ad67bb632a310d2557f8abcccd428e4c9c798db1/off-chain-terms/CommercialRemix.json";
4572
- licenseTerms.commercialRevShare = getRevenueShare(term.commercialRevShare);
4573
- licenseTerms.derivativesReciprocal = true;
4574
- licenseTerms.currency = validateAddress(term.currency);
4575
- return licenseTerms;
4576
- }
4577
- };
4578
- var validateLicenseTerms = /*#__PURE__*/function () {
4579
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params, rpcClient) {
4580
- var royaltyPolicy, currency, royaltyModuleReadOnlyClient, isWhitelistedArbitrationPolicy, isWhitelistedRoyaltyToken, object;
4581
- return _regenerator().w(function (_context) {
4582
- while (1) switch (_context.n) {
4583
- case 0:
4584
- royaltyPolicy = params.royaltyPolicy, currency = params.currency;
4585
- royaltyModuleReadOnlyClient = new RoyaltyModuleReadOnlyClient(rpcClient);
4586
- if (!(validateAddress(royaltyPolicy) !== viem.zeroAddress)) {
4587
- _context.n = 2;
4588
- break;
4589
- }
4590
- _context.n = 1;
4591
- return royaltyModuleReadOnlyClient.isWhitelistedRoyaltyPolicy({
4592
- royaltyPolicy: royaltyPolicy
4593
- });
4594
- case 1:
4595
- isWhitelistedArbitrationPolicy = _context.v;
4596
- if (isWhitelistedArbitrationPolicy) {
4597
- _context.n = 2;
4598
- break;
4599
- }
4600
- throw new Error("The royalty policy is not whitelisted.");
4601
- case 2:
4602
- if (!(validateAddress(currency) !== viem.zeroAddress)) {
4603
- _context.n = 4;
4604
- break;
4605
- }
4606
- _context.n = 3;
4607
- return royaltyModuleReadOnlyClient.isWhitelistedRoyaltyToken({
4608
- token: currency
4609
- });
4610
- case 3:
4611
- isWhitelistedRoyaltyToken = _context.v;
4612
- if (isWhitelistedRoyaltyToken) {
4613
- _context.n = 4;
4614
- break;
4615
- }
4616
- throw new Error("The currency token is not whitelisted.");
4617
- case 4:
4618
- if (!(royaltyPolicy !== viem.zeroAddress && currency === viem.zeroAddress)) {
4619
- _context.n = 5;
4620
- break;
4621
- }
4622
- throw new Error("Royalty policy requires currency token.");
4623
- case 5:
4624
- object = _objectSpread2(_objectSpread2({}, params), {}, {
4625
- defaultMintingFee: BigInt(params.defaultMintingFee),
4626
- expiration: BigInt(params.expiration),
4627
- commercialRevCeiling: BigInt(params.commercialRevCeiling),
4628
- derivativeRevCeiling: BigInt(params.derivativeRevCeiling)
4629
- });
4630
- if (!(object.defaultMintingFee < 0)) {
4631
- _context.n = 6;
4632
- break;
4633
- }
4634
- throw new Error("DefaultMintingFee should be greater than or equal to 0.");
4635
- case 6:
4636
- if (!(object.defaultMintingFee > 0 && object.royaltyPolicy === viem.zeroAddress)) {
4637
- _context.n = 7;
4638
- break;
4639
- }
4640
- throw new Error("Royalty policy is required when defaultMintingFee is greater than 0.");
4641
- case 7:
4642
- verifyCommercialUse(object);
4643
- verifyDerivatives(object);
4644
- if (!(object.commercialRevShare < 0 || object.commercialRevShare > 100)) {
4645
- _context.n = 8;
4646
- break;
4647
- }
4648
- throw new Error("CommercialRevShare should be between 0 and 100.");
4649
- case 8:
4650
- object.commercialRevShare = object.commercialRevShare / 100 * 100000000;
4651
- case 9:
4652
- return _context.a(2, object);
4653
- }
4654
- }, _callee);
4655
- }));
4656
- return function validateLicenseTerms(_x, _x2) {
4657
- return _ref.apply(this, arguments);
4658
- };
4659
- }();
4660
- var verifyCommercialUse = function verifyCommercialUse(terms) {
4661
- if (!terms.commercialUse) {
4662
- if (terms.commercialAttribution) {
4663
- throw new Error("Cannot add commercial attribution when commercial use is disabled.");
4664
- }
4665
- if (terms.commercializerChecker !== viem.zeroAddress) {
4666
- throw new Error("Cannot add commercializerChecker when commercial use is disabled.");
4667
- }
4668
- if (terms.commercialRevShare > 0) {
4669
- throw new Error("Cannot add commercial revenue share when commercial use is disabled.");
4670
- }
4671
- if (terms.commercialRevCeiling > 0) {
4672
- throw new Error("Cannot add commercial revenue ceiling when commercial use is disabled.");
4673
- }
4674
- if (terms.derivativeRevCeiling > 0) {
4675
- throw new Error("Cannot add derivative revenue ceiling share when commercial use is disabled.");
4676
- }
4677
- if (terms.royaltyPolicy !== viem.zeroAddress) {
4678
- throw new Error("Cannot add commercial royalty policy when commercial use is disabled.");
4679
- }
4680
- } else {
4681
- if (terms.royaltyPolicy === viem.zeroAddress) {
4682
- throw new Error("Royalty policy is required when commercial use is enabled.");
4683
- }
4684
- }
4685
- };
4686
- var verifyDerivatives = function verifyDerivatives(terms) {
4687
- if (!terms.derivativesAllowed) {
4688
- if (terms.derivativesAttribution) {
4689
- throw new Error("Cannot add derivative attribution when derivative use is disabled.");
4690
- }
4691
- if (terms.derivativesApproval) {
4692
- throw new Error("Cannot add derivative approval when derivative use is disabled.");
4693
- }
4694
- if (terms.derivativesReciprocal) {
4695
- throw new Error("Cannot add derivative reciprocal when derivative use is disabled.");
4696
- }
4697
- if (terms.derivativeRevCeiling > 0) {
4698
- throw new Error("Cannot add derivative revenue ceiling when derivative use is disabled.");
4699
- }
4556
+ /**
4557
+ * Allow custom royalty policy address or use a native royalty policy enum.
4558
+ * For custom royalty policy, @see {@link https://docs.story.foundation/concepts/royalty-module/external-royalty-policies | External Royalty Policies}
4559
+ */
4560
+
4561
+ var royaltyPolicyInputToAddress = function royaltyPolicyInputToAddress(input, chainId) {
4562
+ var transferredChainId = chain[chainId || "aeneid"];
4563
+ var address;
4564
+ switch (input) {
4565
+ case undefined:
4566
+ case NativeRoyaltyPolicy.LAP:
4567
+ address = royaltyPolicyLapAddress[transferredChainId];
4568
+ break;
4569
+ case NativeRoyaltyPolicy.LRP:
4570
+ address = royaltyPolicyLrpAddress[transferredChainId];
4571
+ break;
4572
+ default:
4573
+ address = validateAddress(input);
4700
4574
  }
4575
+ return address;
4701
4576
  };
4702
4577
  var getRevenueShare = function getRevenueShare(revShare) {
4703
4578
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : RevShareType.COMMERCIAL_REVENUE_SHARE;
@@ -4708,7 +4583,7 @@ var getRevenueShare = function getRevenueShare(revShare) {
4708
4583
  if (revShareNumber < 0 || revShareNumber > 100) {
4709
4584
  throw new Error("".concat(type, " must be between 0 and 100."));
4710
4585
  }
4711
- return revShareNumber / 100 * MAX_ROYALTY_TOKEN;
4586
+ return revShareNumber * Math.pow(10, 6);
4712
4587
  };
4713
4588
 
4714
4589
  /**
@@ -4873,6 +4748,8 @@ var validateLicenseConfig = function validateLicenseConfig(licensingConfig) {
4873
4748
  }
4874
4749
  if (licenseConfig.expectMinimumGroupRewardShare < 0 || licenseConfig.expectMinimumGroupRewardShare > 100) {
4875
4750
  throw new Error("The expectMinimumGroupRewardShare must be greater than 0 and less than 100.");
4751
+ } else {
4752
+ licenseConfig.expectMinimumGroupRewardShare = getRevenueShare(licenseConfig.expectMinimumGroupRewardShare, RevShareType.EXPECT_MINIMUM_GROUP_REWARD_SHARE);
4876
4753
  }
4877
4754
  if (licenseConfig.mintingFee < 0) {
4878
4755
  throw new Error("The mintingFee must be greater than 0.");
@@ -4908,7 +4785,7 @@ var GroupClient = /*#__PURE__*/function () {
4908
4785
  var _registerGroup = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request) {
4909
4786
  var _request$txOptions, object, txHash, txReceipt, groupId, _t;
4910
4787
  return _regenerator().w(function (_context) {
4911
- while (1) switch (_context.n) {
4788
+ while (1) switch (_context.p = _context.n) {
4912
4789
  case 0:
4913
4790
  _context.p = 0;
4914
4791
  object = {
@@ -4965,7 +4842,7 @@ var GroupClient = /*#__PURE__*/function () {
4965
4842
  var _mintAndRegisterIpAndAttachLicenseAndAddToGroup = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(request) {
4966
4843
  var _request$txOptions2, groupId, recipient, spgNftContract, deadline, isRegistered, ipAccount, _yield$ipAccount$stat, state, blockTimestamp, calculatedDeadline, _yield$getPermissionS, sigAddToGroupSignature, object, txHash, receipt, log, _t2;
4967
4844
  return _regenerator().w(function (_context2) {
4968
- while (1) switch (_context2.n) {
4845
+ while (1) switch (_context2.p = _context2.n) {
4969
4846
  case 0:
4970
4847
  _context2.p = 0;
4971
4848
  groupId = request.groupId, recipient = request.recipient, spgNftContract = request.spgNftContract, deadline = request.deadline;
@@ -5075,7 +4952,7 @@ var GroupClient = /*#__PURE__*/function () {
5075
4952
  var _registerIpAndAttachLicenseAndAddToGroup = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(request) {
5076
4953
  var _request$txOptions3, ipIdAddress, isRegistered, ipAccount, _yield$ipAccount$stat2, state, blockTimestamp, calculatedDeadline, _yield$getPermissionS2, sigAddToGroupSignature, _yield$getPermissionS3, sigMetadataAndAttachSignature, object, txHash, receipt, log, _t3;
5077
4954
  return _regenerator().w(function (_context3) {
5078
- while (1) switch (_context3.n) {
4955
+ while (1) switch (_context3.p = _context3.n) {
5079
4956
  case 0:
5080
4957
  _context3.p = 0;
5081
4958
  _context3.n = 1;
@@ -5224,7 +5101,7 @@ var GroupClient = /*#__PURE__*/function () {
5224
5101
  var _registerGroupAndAttachLicense = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(request) {
5225
5102
  var _request$txOptions4, object, txHash, txReceipt, groupId, _t4;
5226
5103
  return _regenerator().w(function (_context4) {
5227
- while (1) switch (_context4.n) {
5104
+ while (1) switch (_context4.p = _context4.n) {
5228
5105
  case 0:
5229
5106
  _context4.p = 0;
5230
5107
  object = {
@@ -5277,7 +5154,7 @@ var GroupClient = /*#__PURE__*/function () {
5277
5154
  var _registerGroupAndAttachLicenseAndAddIps = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(request) {
5278
5155
  var _request$txOptions5, object, i, isRegistered, _i, isAttachedLicenseTerms, txHash, txReceipt, groupId, _t5;
5279
5156
  return _regenerator().w(function (_context5) {
5280
- while (1) switch (_context5.n) {
5157
+ while (1) switch (_context5.p = _context5.n) {
5281
5158
  case 0:
5282
5159
  _context5.p = 0;
5283
5160
  object = {
@@ -5380,7 +5257,7 @@ var GroupClient = /*#__PURE__*/function () {
5380
5257
  var _this = this;
5381
5258
  var groupIpId, currencyTokens, memberIpIds, txOptions, collectAndClaimParams, isGroupRegistered, txHash, _yield$waitForTxRecei, receipt, collectedRoyalties, royaltiesDistributed, _t6;
5382
5259
  return _regenerator().w(function (_context7) {
5383
- while (1) switch (_context7.n) {
5260
+ while (1) switch (_context7.p = _context7.n) {
5384
5261
  case 0:
5385
5262
  groupIpId = _ref.groupIpId, currencyTokens = _ref.currencyTokens, memberIpIds = _ref.memberIpIds, txOptions = _ref.txOptions;
5386
5263
  _context7.p = 1;
@@ -5520,14 +5397,14 @@ var GroupClient = /*#__PURE__*/function () {
5520
5397
  var _addIpsToGroup = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(_ref5) {
5521
5398
  var groupIpId, ipIds, maxAllowedRewardSharePercentage, txOptions, addIpParam, txHash, _t7;
5522
5399
  return _regenerator().w(function (_context8) {
5523
- while (1) switch (_context8.n) {
5400
+ while (1) switch (_context8.p = _context8.n) {
5524
5401
  case 0:
5525
5402
  groupIpId = _ref5.groupIpId, ipIds = _ref5.ipIds, maxAllowedRewardSharePercentage = _ref5.maxAllowedRewardSharePercentage, txOptions = _ref5.txOptions;
5526
5403
  _context8.p = 1;
5527
5404
  addIpParam = {
5528
5405
  groupIpId: validateAddress(groupIpId),
5529
5406
  ipIds: validateAddresses(ipIds),
5530
- maxAllowedRewardShare: BigInt(getRevenueShare(maxAllowedRewardSharePercentage || 100, RevShareType.MAX_ALLOWED_REWARD_SHARE))
5407
+ maxAllowedRewardShare: BigInt(getRevenueShare(maxAllowedRewardSharePercentage === undefined ? 100 : maxAllowedRewardSharePercentage, RevShareType.MAX_ALLOWED_REWARD_SHARE_PERCENTAGE))
5531
5408
  };
5532
5409
  _context8.n = 2;
5533
5410
  return this.groupingModuleClient.addIp(addIpParam);
@@ -5563,7 +5440,7 @@ var GroupClient = /*#__PURE__*/function () {
5563
5440
  var _getClaimableReward = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(_ref6) {
5564
5441
  var groupIpId, currencyToken, memberIpIds, claimableReward, _t8;
5565
5442
  return _regenerator().w(function (_context9) {
5566
- while (1) switch (_context9.n) {
5443
+ while (1) switch (_context9.p = _context9.n) {
5567
5444
  case 0:
5568
5445
  groupIpId = _ref6.groupIpId, currencyToken = _ref6.currencyToken, memberIpIds = _ref6.memberIpIds;
5569
5446
  _context9.p = 1;
@@ -5599,7 +5476,7 @@ var GroupClient = /*#__PURE__*/function () {
5599
5476
  var _removeIpsFromGroup = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(_ref7) {
5600
5477
  var groupIpId, ipIds, txOptions, removeIpParam, txHash, _t9;
5601
5478
  return _regenerator().w(function (_context0) {
5602
- while (1) switch (_context0.n) {
5479
+ while (1) switch (_context0.p = _context0.n) {
5603
5480
  case 0:
5604
5481
  groupIpId = _ref7.groupIpId, ipIds = _ref7.ipIds, txOptions = _ref7.txOptions;
5605
5482
  _context0.p = 1;
@@ -5643,7 +5520,7 @@ var GroupClient = /*#__PURE__*/function () {
5643
5520
  var _claimReward = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(_ref8) {
5644
5521
  var groupIpId, currencyToken, memberIpIds, txOptions, claimRewardParam, txHash, _yield$waitForTxRecei2, receipt, claimedReward, _t0;
5645
5522
  return _regenerator().w(function (_context1) {
5646
- while (1) switch (_context1.n) {
5523
+ while (1) switch (_context1.p = _context1.n) {
5647
5524
  case 0:
5648
5525
  groupIpId = _ref8.groupIpId, currencyToken = _ref8.currencyToken, memberIpIds = _ref8.memberIpIds, txOptions = _ref8.txOptions;
5649
5526
  _context1.p = 1;
@@ -5702,7 +5579,7 @@ var GroupClient = /*#__PURE__*/function () {
5702
5579
  var _collectRoyalties = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(_ref9) {
5703
5580
  var groupIpId, currencyToken, txOptions, collectRoyaltiesParam, txHash, _yield$waitForTxRecei3, receipt, collectedRoyalties, _t1;
5704
5581
  return _regenerator().w(function (_context10) {
5705
- while (1) switch (_context10.n) {
5582
+ while (1) switch (_context10.p = _context10.n) {
5706
5583
  case 0:
5707
5584
  groupIpId = _ref9.groupIpId, currencyToken = _ref9.currencyToken, txOptions = _ref9.txOptions;
5708
5585
  _context10.p = 1;
@@ -5787,7 +5664,7 @@ var IPAccountClient = /*#__PURE__*/function () {
5787
5664
  var _execute = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request) {
5788
5665
  var _request$txOptions, ipAccountClient, req, txHash, _t;
5789
5666
  return _regenerator().w(function (_context) {
5790
- while (1) switch (_context.n) {
5667
+ while (1) switch (_context.p = _context.n) {
5791
5668
  case 0:
5792
5669
  _context.p = 0;
5793
5670
  ipAccountClient = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(request.ipId));
@@ -5847,7 +5724,7 @@ var IPAccountClient = /*#__PURE__*/function () {
5847
5724
  var _executeWithSig = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(request) {
5848
5725
  var _request$txOptions2, ipAccountClient, req, txHash, _t2;
5849
5726
  return _regenerator().w(function (_context2) {
5850
- while (1) switch (_context2.n) {
5727
+ while (1) switch (_context2.p = _context2.n) {
5851
5728
  case 0:
5852
5729
  _context2.p = 0;
5853
5730
  ipAccountClient = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(request.ipId));
@@ -5906,7 +5783,7 @@ var IPAccountClient = /*#__PURE__*/function () {
5906
5783
  var _getIpAccountNonce = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(ipId) {
5907
5784
  var ipAccount, _yield$ipAccount$stat, state, _t3;
5908
5785
  return _regenerator().w(function (_context3) {
5909
- while (1) switch (_context3.n) {
5786
+ while (1) switch (_context3.p = _context3.n) {
5910
5787
  case 0:
5911
5788
  _context3.p = 0;
5912
5789
  ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(ipId));
@@ -5938,7 +5815,7 @@ var IPAccountClient = /*#__PURE__*/function () {
5938
5815
  var _getToken = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(ipId) {
5939
5816
  var ipAccount, _yield$ipAccount$toke, _yield$ipAccount$toke2, chainId, tokenContract, tokenId, _t4;
5940
5817
  return _regenerator().w(function (_context4) {
5941
- while (1) switch (_context4.n) {
5818
+ while (1) switch (_context4.p = _context4.n) {
5942
5819
  case 0:
5943
5820
  _context4.p = 0;
5944
5821
  ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(ipId));
@@ -5977,7 +5854,7 @@ var IPAccountClient = /*#__PURE__*/function () {
5977
5854
  var _setIpMetadata = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref) {
5978
5855
  var ipId, metadataURI, metadataHash, txOptions, data, _yield$this$execute, txHash, _t5;
5979
5856
  return _regenerator().w(function (_context5) {
5980
- while (1) switch (_context5.n) {
5857
+ while (1) switch (_context5.p = _context5.n) {
5981
5858
  case 0:
5982
5859
  ipId = _ref.ipId, metadataURI = _ref.metadataURI, metadataHash = _ref.metadataHash, txOptions = _ref.txOptions;
5983
5860
  _context5.p = 1;
@@ -6023,7 +5900,7 @@ var IPAccountClient = /*#__PURE__*/function () {
6023
5900
  var _this = this;
6024
5901
  var ipId, tokens, txOptions, ipAccount, calls, txHash, _t6;
6025
5902
  return _regenerator().w(function (_context6) {
6026
- while (1) switch (_context6.n) {
5903
+ while (1) switch (_context6.p = _context6.n) {
6027
5904
  case 0:
6028
5905
  ipId = _ref2.ipId, tokens = _ref2.tokens, txOptions = _ref2.txOptions;
6029
5906
  _context6.p = 1;
@@ -6414,6 +6291,235 @@ var generateOperationSignature = /*#__PURE__*/function () {
6414
6291
  };
6415
6292
  }();
6416
6293
 
6294
+ var _PILFlavor;
6295
+ var PIL_URIS = {
6296
+ NCSR: "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/NCSR.json",
6297
+ COMMERCIAL_USE: "https://github.com/piplabs/pil-document/blob/9a1f803fcf8101a8a78f1dcc929e6014e144ab56/off-chain-terms/CommercialUse.json",
6298
+ COMMERCIAL_REMIX: "https://github.com/piplabs/pil-document/blob/ad67bb632a310d2557f8abcccd428e4c9c798db1/off-chain-terms/CommercialRemix.json",
6299
+ CC_BY: "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/CC-BY.json"
6300
+ };
6301
+ var COMMON_DEFAULTS = {
6302
+ transferable: true,
6303
+ royaltyPolicy: viem.zeroAddress,
6304
+ defaultMintingFee: 0n,
6305
+ expiration: 0n,
6306
+ commercializerChecker: viem.zeroAddress,
6307
+ commercializerCheckerData: viem.zeroAddress,
6308
+ commercialRevShare: 0,
6309
+ commercialRevCeiling: 0n,
6310
+ derivativeRevCeiling: 0n,
6311
+ currency: viem.zeroAddress
6312
+ };
6313
+
6314
+ /**
6315
+ * Pre-configured Programmable IP License (PIL) flavors for ease of use.
6316
+ *
6317
+ * The PIL is highly configurable, but these pre-configured license terms (flavors)
6318
+ * are the most popular options that cover common use cases.
6319
+ *
6320
+ * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors | PIL Flavors Documentation}
6321
+ *
6322
+ * @example
6323
+ * ```typescript
6324
+ * // Create a commercial use license
6325
+ * const commercialLicense = PILFlavor.commercialUse({
6326
+ * defaultMintingFee: 1000000000000000000n, // 1 IP minting fee
6327
+ * currencyToken: "0x1234...", // currency token
6328
+ * royaltyPolicy: "LAP" // royalty policy
6329
+ * });
6330
+ *
6331
+ * // Create a non-commercial social remixing license
6332
+ * const remixLicense = PILFlavor.nonCommercialSocialRemixing();
6333
+ * ```
6334
+ */
6335
+ var PILFlavor = /*#__PURE__*/_createClass(function PILFlavor() {
6336
+ _classCallCheck(this, PILFlavor);
6337
+ });
6338
+ _PILFlavor = PILFlavor;
6339
+ _defineProperty(PILFlavor, "_nonComSocialRemixingPIL", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
6340
+ commercialUse: false,
6341
+ commercialAttribution: false,
6342
+ derivativesAllowed: true,
6343
+ derivativesAttribution: true,
6344
+ derivativesApproval: false,
6345
+ derivativesReciprocal: true,
6346
+ uri: PIL_URIS.NCSR
6347
+ }));
6348
+ _defineProperty(PILFlavor, "_commercialUse", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
6349
+ commercialUse: true,
6350
+ commercialAttribution: true,
6351
+ derivativesAllowed: false,
6352
+ derivativesAttribution: false,
6353
+ derivativesApproval: false,
6354
+ derivativesReciprocal: false,
6355
+ uri: PIL_URIS.COMMERCIAL_USE
6356
+ }));
6357
+ _defineProperty(PILFlavor, "_commercialRemix", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
6358
+ commercialUse: true,
6359
+ commercialAttribution: true,
6360
+ derivativesAllowed: true,
6361
+ derivativesAttribution: true,
6362
+ derivativesApproval: false,
6363
+ derivativesReciprocal: true,
6364
+ uri: PIL_URIS.COMMERCIAL_REMIX
6365
+ }));
6366
+ _defineProperty(PILFlavor, "_creativeCommonsAttribution", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
6367
+ commercialUse: true,
6368
+ commercialAttribution: true,
6369
+ derivativesAllowed: true,
6370
+ derivativesAttribution: true,
6371
+ derivativesApproval: false,
6372
+ derivativesReciprocal: true,
6373
+ uri: PIL_URIS.CC_BY
6374
+ }));
6375
+ /**
6376
+ * Gets the values to create a Non-Commercial Social Remixing license terms flavor.
6377
+ * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#non-commercial-social-remixing | Non Commercial Social Remixing}
6378
+ */
6379
+ _defineProperty(PILFlavor, "nonCommercialSocialRemixing", function (request) {
6380
+ 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);
6381
+ });
6382
+ /**
6383
+ * Gets the values to create a Commercial Use license terms flavor.
6384
+ * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#commercial-use | Commercial Use}
6385
+ */
6386
+ _defineProperty(PILFlavor, "commercialUse", function (_ref) {
6387
+ var defaultMintingFee = _ref.defaultMintingFee,
6388
+ currency = _ref.currency,
6389
+ royaltyPolicy = _ref.royaltyPolicy,
6390
+ chainId = _ref.chainId,
6391
+ override = _ref.override;
6392
+ return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._commercialUse), {}, {
6393
+ defaultMintingFee: defaultMintingFee,
6394
+ currency: currency,
6395
+ royaltyPolicy: royaltyPolicy
6396
+ }, override), chainId);
6397
+ });
6398
+ /**
6399
+ * Gets the values to create a Commercial Remixing license terms flavor.
6400
+ * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#commercial-remix | Commercial Remix}
6401
+ */
6402
+ _defineProperty(PILFlavor, "commercialRemix", function (_ref2) {
6403
+ var defaultMintingFee = _ref2.defaultMintingFee,
6404
+ royaltyPolicy = _ref2.royaltyPolicy,
6405
+ currency = _ref2.currency,
6406
+ commercialRevShare = _ref2.commercialRevShare,
6407
+ chainId = _ref2.chainId,
6408
+ override = _ref2.override;
6409
+ return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._commercialRemix), {}, {
6410
+ commercialRevShare: commercialRevShare,
6411
+ defaultMintingFee: defaultMintingFee,
6412
+ currency: currency,
6413
+ royaltyPolicy: royaltyPolicy
6414
+ }, override), chainId);
6415
+ });
6416
+ /**
6417
+ * Gets the values to create a Creative Commons Attribution (CC-BY) license terms flavor.
6418
+ * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#creative-commons-attribution | Creative Commons Attribution}
6419
+ */
6420
+ _defineProperty(PILFlavor, "creativeCommonsAttribution", function (_ref3) {
6421
+ var royaltyPolicy = _ref3.royaltyPolicy,
6422
+ currency = _ref3.currency,
6423
+ chainId = _ref3.chainId,
6424
+ override = _ref3.override;
6425
+ return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._creativeCommonsAttribution), {}, {
6426
+ currency: currency,
6427
+ royaltyPolicy: royaltyPolicy
6428
+ }, override), chainId);
6429
+ });
6430
+ _defineProperty(PILFlavor, "validateLicenseTerms", function (params, chainId) {
6431
+ var normalized = _objectSpread2(_objectSpread2({}, params), {}, {
6432
+ defaultMintingFee: BigInt(params.defaultMintingFee),
6433
+ expiration: BigInt(params.expiration),
6434
+ commercialRevCeiling: BigInt(params.commercialRevCeiling),
6435
+ derivativeRevCeiling: BigInt(params.derivativeRevCeiling),
6436
+ royaltyPolicy: royaltyPolicyInputToAddress(params.royaltyPolicy, chainId)
6437
+ });
6438
+ var royaltyPolicy = normalized.royaltyPolicy,
6439
+ currency = normalized.currency;
6440
+
6441
+ // Validate royalty policy and currency relationship
6442
+ if (royaltyPolicy !== viem.zeroAddress && currency === viem.zeroAddress) {
6443
+ throw new PILFlavorError("Royalty policy requires currency token.");
6444
+ }
6445
+
6446
+ // Validate defaultMintingFee
6447
+ if (normalized.defaultMintingFee < 0n) {
6448
+ throw new PILFlavorError("DefaultMintingFee should be greater than or equal to 0.");
6449
+ }
6450
+ if (normalized.defaultMintingFee > 0n && normalized.royaltyPolicy === viem.zeroAddress) {
6451
+ throw new PILFlavorError("Royalty policy is required when defaultMintingFee is greater than 0.");
6452
+ }
6453
+
6454
+ // Validate commercial use and derivatives
6455
+ _PILFlavor.verifyCommercialUse(normalized);
6456
+ _PILFlavor.verifyDerivatives(normalized);
6457
+ if (normalized.commercialRevShare > 100 || normalized.commercialRevShare < 0) {
6458
+ throw new PILFlavorError("commercialRevShare must be between 0 and 100.");
6459
+ }
6460
+ return normalized;
6461
+ });
6462
+ _defineProperty(PILFlavor, "verifyCommercialUse", function (terms) {
6463
+ if (!terms.commercialUse) {
6464
+ var commercialFields = [{
6465
+ field: "commercialAttribution",
6466
+ value: terms.commercialAttribution
6467
+ }, {
6468
+ field: "commercializerChecker",
6469
+ value: terms.commercializerChecker !== viem.zeroAddress
6470
+ }, {
6471
+ field: "commercialRevShare",
6472
+ value: terms.commercialRevShare > 0
6473
+ }, {
6474
+ field: "commercialRevCeiling",
6475
+ value: terms.commercialRevCeiling > 0n
6476
+ }, {
6477
+ field: "derivativeRevCeiling",
6478
+ value: terms.derivativeRevCeiling > 0n
6479
+ }, {
6480
+ field: "royaltyPolicy",
6481
+ value: terms.royaltyPolicy !== viem.zeroAddress
6482
+ }];
6483
+ for (var _i = 0, _commercialFields = commercialFields; _i < _commercialFields.length; _i++) {
6484
+ var _commercialFields$_i = _commercialFields[_i],
6485
+ field = _commercialFields$_i.field,
6486
+ value = _commercialFields$_i.value;
6487
+ if (value) {
6488
+ throw new PILFlavorError("Cannot add ".concat(field, " when commercial use is disabled."));
6489
+ }
6490
+ }
6491
+ } else {
6492
+ if (terms.royaltyPolicy === viem.zeroAddress) {
6493
+ throw new PILFlavorError("Royalty policy is required when commercial use is enabled.");
6494
+ }
6495
+ }
6496
+ });
6497
+ _defineProperty(PILFlavor, "verifyDerivatives", function (terms) {
6498
+ if (!terms.derivativesAllowed) {
6499
+ var derivativeFields = [{
6500
+ field: "derivativesAttribution",
6501
+ value: terms.derivativesAttribution
6502
+ }, {
6503
+ field: "derivativesApproval",
6504
+ value: terms.derivativesApproval
6505
+ }, {
6506
+ field: "derivativesReciprocal",
6507
+ value: terms.derivativesReciprocal
6508
+ }, {
6509
+ field: "derivativeRevCeiling",
6510
+ value: terms.derivativeRevCeiling > 0n
6511
+ }];
6512
+ for (var _i2 = 0, _derivativeFields = derivativeFields; _i2 < _derivativeFields.length; _i2++) {
6513
+ var _derivativeFields$_i = _derivativeFields[_i2],
6514
+ field = _derivativeFields$_i.field,
6515
+ value = _derivativeFields$_i.value;
6516
+ if (value) {
6517
+ throw new PILFlavorError("Cannot add ".concat(field, " when derivative use is disabled."));
6518
+ }
6519
+ }
6520
+ }
6521
+ });
6522
+
6417
6523
  function _regeneratorValues(e) {
6418
6524
  if (null != e) {
6419
6525
  var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
@@ -6462,7 +6568,7 @@ var getPublicMinting = /*#__PURE__*/function () {
6462
6568
  }();
6463
6569
  var validateLicenseTermsData = /*#__PURE__*/function () {
6464
6570
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(licenseTermsData, rpcClient, chainId) {
6465
- var licenseTerms, processedLicenseTermsData, maxLicenseTokens, i, licenseTerm, licensingConfig, maxLicenseTokensValue;
6571
+ var licenseTerms, processedLicenseTermsData, maxLicenseTokens, i, licenseTerm, royaltyModuleReadOnlyClient, isWhitelistedArbitrationPolicy, isWhitelistedRoyaltyToken, licensingConfig, maxLicenseTokensValue;
6466
6572
  return _regenerator().w(function (_context2) {
6467
6573
  while (1) switch (_context2.n) {
6468
6574
  case 0:
@@ -6472,44 +6578,75 @@ var validateLicenseTermsData = /*#__PURE__*/function () {
6472
6578
  i = 0;
6473
6579
  case 1:
6474
6580
  if (!(i < licenseTermsData.length)) {
6475
- _context2.n = 7;
6581
+ _context2.n = 10;
6582
+ break;
6583
+ }
6584
+ licenseTerm = PILFlavor.validateLicenseTerms(licenseTermsData[i].terms, chainId);
6585
+ licenseTerm.commercialRevShare = getRevenueShare(licenseTerm.commercialRevShare);
6586
+ royaltyModuleReadOnlyClient = new RoyaltyModuleReadOnlyClient(rpcClient);
6587
+ if (!(validateAddress(licenseTerm.royaltyPolicy) !== viem.zeroAddress)) {
6588
+ _context2.n = 3;
6476
6589
  break;
6477
6590
  }
6478
6591
  _context2.n = 2;
6479
- return validateLicenseTerms(licenseTermsData[i].terms, rpcClient);
6592
+ return royaltyModuleReadOnlyClient.isWhitelistedRoyaltyPolicy({
6593
+ royaltyPolicy: licenseTerm.royaltyPolicy
6594
+ });
6480
6595
  case 2:
6481
- licenseTerm = _context2.v;
6596
+ isWhitelistedArbitrationPolicy = _context2.v;
6597
+ if (isWhitelistedArbitrationPolicy) {
6598
+ _context2.n = 3;
6599
+ break;
6600
+ }
6601
+ throw new Error("The royalty policy ".concat(licenseTerm.royaltyPolicy, " is not whitelisted."));
6602
+ case 3:
6603
+ if (!(validateAddress(licenseTerm.currency) !== viem.zeroAddress)) {
6604
+ _context2.n = 5;
6605
+ break;
6606
+ }
6607
+ _context2.n = 4;
6608
+ return royaltyModuleReadOnlyClient.isWhitelistedRoyaltyToken({
6609
+ token: licenseTerm.currency
6610
+ });
6611
+ case 4:
6612
+ isWhitelistedRoyaltyToken = _context2.v;
6613
+ if (isWhitelistedRoyaltyToken) {
6614
+ _context2.n = 5;
6615
+ break;
6616
+ }
6617
+ throw new Error("The currency token ".concat(licenseTerm.currency, " is not whitelisted."));
6618
+ case 5:
6482
6619
  licensingConfig = validateLicenseConfig(licenseTermsData[i].licensingConfig);
6483
6620
  if (!(licensingConfig.mintingFee > 0 && licenseTerm.royaltyPolicy === viem.zeroAddress)) {
6484
- _context2.n = 3;
6621
+ _context2.n = 6;
6485
6622
  break;
6486
6623
  }
6487
6624
  throw new Error("A royalty policy must be provided when the minting fee is greater than 0.");
6488
- case 3:
6625
+ case 6:
6489
6626
  maxLicenseTokensValue = licenseTermsData[i].maxLicenseTokens;
6490
6627
  if (!(maxLicenseTokensValue !== undefined)) {
6491
- _context2.n = 5;
6628
+ _context2.n = 8;
6492
6629
  break;
6493
6630
  }
6494
6631
  if (!(maxLicenseTokensValue < 0)) {
6495
- _context2.n = 4;
6632
+ _context2.n = 7;
6496
6633
  break;
6497
6634
  }
6498
6635
  throw new Error("The max license tokens must be greater than or equal to 0.");
6499
- case 4:
6636
+ case 7:
6500
6637
  licensingConfig.licensingHook = totalLicenseTokenLimitHookAddress[chainId];
6501
6638
  maxLicenseTokens[i] = BigInt(maxLicenseTokensValue);
6502
- case 5:
6639
+ case 8:
6503
6640
  licenseTerms.push(licenseTerm);
6504
6641
  processedLicenseTermsData.push({
6505
6642
  terms: licenseTerm,
6506
6643
  licensingConfig: licensingConfig
6507
6644
  });
6508
- case 6:
6645
+ case 9:
6509
6646
  i++;
6510
6647
  _context2.n = 1;
6511
6648
  break;
6512
- case 7:
6649
+ case 10:
6513
6650
  return _context2.a(2, {
6514
6651
  licenseTerms: licenseTerms,
6515
6652
  licenseTermsData: processedLicenseTermsData,
@@ -6565,8 +6702,8 @@ var validateDerivativeData = /*#__PURE__*/function () {
6565
6702
  licenseTemplate: validateAddress(derivativeDataInput.licenseTemplate || licenseTemplateAddress),
6566
6703
  royaltyContext: viem.zeroAddress,
6567
6704
  maxMintingFee: BigInt(derivativeDataInput.maxMintingFee || 0),
6568
- maxRts: Number(derivativeDataInput.maxRts || MAX_ROYALTY_TOKEN),
6569
- maxRevenueShare: getRevenueShare(derivativeDataInput.maxRevenueShare || 100, RevShareType.MAX_REVENUE_SHARE)
6705
+ maxRts: Number(derivativeDataInput.maxRts === undefined ? MAX_ROYALTY_TOKEN : derivativeDataInput.maxRts),
6706
+ maxRevenueShare: getRevenueShare(derivativeDataInput.maxRevenueShare === undefined ? 100 : derivativeDataInput.maxRevenueShare, RevShareType.MAX_REVENUE_SHARE)
6570
6707
  };
6571
6708
  if (!(derivativeData.parentIpIds.length === 0)) {
6572
6709
  _context3.n = 1;
@@ -6724,17 +6861,41 @@ var mergeSpenders = function mergeSpenders(previousSpenders, newSpenders) {
6724
6861
  return acc;
6725
6862
  }, _toConsumableArray(previousSpenders));
6726
6863
  };
6727
-
6728
- /**
6729
- * Aggregates the registration requests for the given workflow responses.
6730
- *
6731
- * This function combines multiple workflow responses into a consolidated request structure,
6732
- * aggregating:
6733
- * - Token spenders and their allowances
6734
- * - Total fees required for all operations
6735
- * - Encoded transaction data
6736
- * - Contract calls to be executed
6737
- *
6864
+ var hasMinterRole = /*#__PURE__*/function () {
6865
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(spgNftContract, rpcClient, walletAddress) {
6866
+ var spgNftContractImpl, minterRole;
6867
+ return _regenerator().w(function (_context6) {
6868
+ while (1) switch (_context6.n) {
6869
+ case 0:
6870
+ spgNftContractImpl = new SpgnftImplReadOnlyClient(rpcClient, spgNftContract);
6871
+ minterRole = viem.toHex(1, {
6872
+ size: 32
6873
+ });
6874
+ _context6.n = 1;
6875
+ return spgNftContractImpl.hasRole({
6876
+ role: minterRole,
6877
+ account: walletAddress
6878
+ });
6879
+ case 1:
6880
+ return _context6.a(2, _context6.v);
6881
+ }
6882
+ }, _callee6);
6883
+ }));
6884
+ return function hasMinterRole(_x0, _x1, _x10) {
6885
+ return _ref8.apply(this, arguments);
6886
+ };
6887
+ }();
6888
+
6889
+ /**
6890
+ * Aggregates the registration requests for the given workflow responses.
6891
+ *
6892
+ * This function combines multiple workflow responses into a consolidated request structure,
6893
+ * aggregating:
6894
+ * - Token spenders and their allowances
6895
+ * - Total fees required for all operations
6896
+ * - Encoded transaction data
6897
+ * - Contract calls to be executed
6898
+ *
6738
6899
  * @remarks
6739
6900
  * The function handles two execution modes:
6740
6901
  * 1. If `disableMulticallWhenPossible` is true or a workflow response supports multicall3
@@ -6819,7 +6980,7 @@ var handleMulticall = /*#__PURE__*/function () {
6819
6980
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
6820
6981
  var txHashes, _iterator2, _step2, call, txHash, _t;
6821
6982
  return _regenerator().w(function (_context) {
6822
- while (1) switch (_context.n) {
6983
+ while (1) switch (_context.p = _context.n) {
6823
6984
  case 0:
6824
6985
  txHashes = [];
6825
6986
  _iterator2 = _createForOfIteratorHelper(contractCall);
@@ -7748,7 +7909,7 @@ var prepareRoyaltyTokensDistributionRequests = /*#__PURE__*/function () {
7748
7909
  var _ref20 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(_ref19) {
7749
7910
  var royaltyDistributionRequests, ipRegisteredLog, ipRoyaltyVault, rpcClient, wallet, chainId, results, _iterator, _step, _loop, _t;
7750
7911
  return _regenerator().w(function (_context0) {
7751
- while (1) switch (_context0.n) {
7912
+ while (1) switch (_context0.p = _context0.n) {
7752
7913
  case 0:
7753
7914
  royaltyDistributionRequests = _ref19.royaltyDistributionRequests, ipRegisteredLog = _ref19.ipRegisteredLog, ipRoyaltyVault = _ref19.ipRoyaltyVault, rpcClient = _ref19.rpcClient, wallet = _ref19.wallet, chainId = _ref19.chainId;
7754
7915
  if (!(royaltyDistributionRequests.length === 0)) {
@@ -7880,7 +8041,7 @@ var IPAssetClient = /*#__PURE__*/function () {
7880
8041
  var _register = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request) {
7881
8042
  var _request$txOptions, tokenId, ipIdAddress, isRegistered, object, calculatedDeadline, signature, txHash, txReceipt, log, _t;
7882
8043
  return _regenerator().w(function (_context) {
7883
- while (1) switch (_context.n) {
8044
+ while (1) switch (_context.p = _context.n) {
7884
8045
  case 0:
7885
8046
  _context.p = 0;
7886
8047
  tokenId = BigInt(request.tokenId);
@@ -8023,7 +8184,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8023
8184
  var _this = this;
8024
8185
  var contracts, spgContracts, encodedTxData, _iterator, _step, arg, result, spgTxHash, txHash, results, processTransaction, _t2, _t3, _t4;
8025
8186
  return _regenerator().w(function (_context3) {
8026
- while (1) switch (_context3.n) {
8187
+ while (1) switch (_context3.p = _context3.n) {
8027
8188
  case 0:
8028
8189
  _context3.p = 0;
8029
8190
  contracts = [];
@@ -8170,7 +8331,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8170
8331
  var _this2 = this;
8171
8332
  var _request$txOptions2, isChildIpIdRegistered, derivativeData, object, encodedTxData, _request$options, contractCall, _t5;
8172
8333
  return _regenerator().w(function (_context4) {
8173
- while (1) switch (_context4.n) {
8334
+ while (1) switch (_context4.p = _context4.n) {
8174
8335
  case 0:
8175
8336
  _context4.p = 0;
8176
8337
  _context4.n = 1;
@@ -8245,7 +8406,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8245
8406
  var _batchRegisterDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(request) {
8246
8407
  var contracts, licenseModuleAddress, _iterator2, _step2, arg, calculatedDeadline, ipAccount, data, _yield$ipAccount$stat, state, signature, txHash, _t6, _t7, _t8;
8247
8408
  return _regenerator().w(function (_context5) {
8248
- while (1) switch (_context5.n) {
8409
+ while (1) switch (_context5.p = _context5.n) {
8249
8410
  case 0:
8250
8411
  _context5.p = 0;
8251
8412
  contracts = [];
@@ -8284,7 +8445,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8284
8445
  functionName: "registerDerivative",
8285
8446
  args: [arg.childIpId, arg.parentIpIds, arg.licenseTermsIds.map(function (id) {
8286
8447
  return BigInt(id);
8287
- }), arg.licenseTemplate || this.licenseTemplateClient.address, viem.zeroAddress, BigInt(arg.maxMintingFee || 0), Number(arg.maxRts || MAX_ROYALTY_TOKEN), getRevenueShare(arg.maxRevenueShare || 100, RevShareType.MAX_REVENUE_SHARE)]
8448
+ }), arg.licenseTemplate || this.licenseTemplateClient.address, viem.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)]
8288
8449
  });
8289
8450
  _context5.n = 8;
8290
8451
  return ipAccount.state();
@@ -8365,7 +8526,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8365
8526
  var _registerDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(request) {
8366
8527
  var _request$txOptions3, req, isChildIpIdRegistered, txHash, _t9;
8367
8528
  return _regenerator().w(function (_context6) {
8368
- while (1) switch (_context6.n) {
8529
+ while (1) switch (_context6.p = _context6.n) {
8369
8530
  case 0:
8370
8531
  _context6.p = 0;
8371
8532
  req = {
@@ -8445,39 +8606,34 @@ var IPAssetClient = /*#__PURE__*/function () {
8445
8606
  value: (function () {
8446
8607
  var _mintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(request) {
8447
8608
  var _this3 = this;
8448
- var _request$txOptions4, _request$options2, _yield$validateLicens, licenseTerms, _yield$transformRegis, transformRequest, encodedTxData, contractCall, rsp, computedLicenseTermsIds, maxLicenseTokensTxHashes, _t0;
8609
+ var _request$txOptions4, _request$options2, _yield$transformRegis, transformRequest, encodedTxData, contractCall, rsp, computedLicenseTermsIds, maxLicenseTokensTxHashes, _t0;
8449
8610
  return _regenerator().w(function (_context7) {
8450
- while (1) switch (_context7.n) {
8611
+ while (1) switch (_context7.p = _context7.n) {
8451
8612
  case 0:
8452
8613
  _context7.p = 0;
8453
8614
  _context7.n = 1;
8454
- return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
8455
- case 1:
8456
- _yield$validateLicens = _context7.v;
8457
- licenseTerms = _yield$validateLicens.licenseTerms;
8458
- _context7.n = 2;
8459
8615
  return transformRegistrationRequest({
8460
8616
  request: request,
8461
8617
  rpcClient: this.rpcClient,
8462
8618
  wallet: this.wallet,
8463
8619
  chainId: this.chainId
8464
8620
  });
8465
- case 2:
8621
+ case 1:
8466
8622
  _yield$transformRegis = _context7.v;
8467
8623
  transformRequest = _yield$transformRegis.transformRequest;
8468
8624
  encodedTxData = this.licenseAttachmentWorkflowsClient.mintAndRegisterIpAndAttachPilTermsEncode(transformRequest);
8469
8625
  if (!((_request$txOptions4 = request.txOptions) !== null && _request$txOptions4 !== void 0 && _request$txOptions4.encodedTxDataOnly)) {
8470
- _context7.n = 3;
8626
+ _context7.n = 2;
8471
8627
  break;
8472
8628
  }
8473
8629
  return _context7.a(2, {
8474
8630
  encodedTxData: encodedTxData
8475
8631
  });
8476
- case 3:
8632
+ case 2:
8477
8633
  contractCall = function contractCall() {
8478
8634
  return _this3.licenseAttachmentWorkflowsClient.mintAndRegisterIpAndAttachPilTerms(transformRequest);
8479
8635
  };
8480
- _context7.n = 4;
8636
+ _context7.n = 3;
8481
8637
  return this.handleRegistrationWithFees({
8482
8638
  wipOptions: (_request$options2 = request.options) === null || _request$options2 === void 0 ? void 0 : _request$options2.wipOptions,
8483
8639
  sender: this.walletAddress,
@@ -8487,31 +8643,33 @@ var IPAssetClient = /*#__PURE__*/function () {
8487
8643
  contractCall: contractCall,
8488
8644
  txOptions: request.txOptions
8489
8645
  });
8490
- case 4:
8646
+ case 3:
8491
8647
  rsp = _context7.v;
8492
- _context7.n = 5;
8493
- return this.getLicenseTermsId(licenseTerms);
8494
- case 5:
8648
+ _context7.n = 4;
8649
+ return this.getLicenseTermsId(transformRequest.licenseTermsData.map(function (data) {
8650
+ return data.terms;
8651
+ }));
8652
+ case 4:
8495
8653
  computedLicenseTermsIds = _context7.v;
8496
- _context7.n = 6;
8654
+ _context7.n = 5;
8497
8655
  return this.setMaxLicenseTokens({
8498
8656
  maxLicenseTokensData: request.licenseTermsData,
8499
8657
  licensorIpId: rsp.ipId,
8500
8658
  licenseTermsIds: computedLicenseTermsIds
8501
8659
  });
8502
- case 6:
8660
+ case 5:
8503
8661
  maxLicenseTokensTxHashes = _context7.v;
8504
8662
  return _context7.a(2, _objectSpread2(_objectSpread2({}, rsp), {}, {
8505
8663
  licenseTermsIds: computedLicenseTermsIds
8506
8664
  }, maxLicenseTokensTxHashes.length > 0 && {
8507
8665
  maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
8508
8666
  }));
8509
- case 7:
8510
- _context7.p = 7;
8667
+ case 6:
8668
+ _context7.p = 6;
8511
8669
  _t0 = _context7.v;
8512
8670
  return _context7.a(2, handleError(_t0, "Failed to mint and register IP and attach PIL terms"));
8513
8671
  }
8514
- }, _callee7, this, [[0, 7]]);
8672
+ }, _callee7, this, [[0, 6]]);
8515
8673
  }));
8516
8674
  function mintAndRegisterIpAssetWithPilTerms(_x8) {
8517
8675
  return _mintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
@@ -8530,7 +8688,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8530
8688
  var _batchMintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(request) {
8531
8689
  var calldata, _iterator3, _step3, arg, result, txHash, txReceipt, results, j, licenseTerms, licenseTermsData, i, licenseTerm, licenseTermsIds, maxLicenseTokensTxHashes, _t1, _t10;
8532
8690
  return _regenerator().w(function (_context8) {
8533
- while (1) switch (_context8.n) {
8691
+ while (1) switch (_context8.p = _context8.n) {
8534
8692
  case 0:
8535
8693
  _context8.p = 0;
8536
8694
  calldata = [];
@@ -8590,58 +8748,46 @@ var IPAssetClient = /*#__PURE__*/function () {
8590
8748
  j = 0;
8591
8749
  case 11:
8592
8750
  if (!(j < request.args.length)) {
8593
- _context8.n = 19;
8751
+ _context8.n = 15;
8594
8752
  break;
8595
8753
  }
8596
8754
  licenseTerms = [];
8597
8755
  licenseTermsData = request.args[j].licenseTermsData;
8598
- i = 0;
8599
- case 12:
8600
- if (!(i < licenseTermsData.length)) {
8601
- _context8.n = 15;
8602
- break;
8756
+ for (i = 0; i < licenseTermsData.length; i++) {
8757
+ licenseTerm = PILFlavor.validateLicenseTerms(licenseTermsData[i].terms, this.chainId);
8758
+ licenseTerms.push(licenseTerm);
8603
8759
  }
8604
- _context8.n = 13;
8605
- return validateLicenseTerms(licenseTermsData[i].terms, this.rpcClient);
8606
- case 13:
8607
- licenseTerm = _context8.v;
8608
- licenseTerms.push(licenseTerm);
8609
- case 14:
8610
- i++;
8611
8760
  _context8.n = 12;
8612
- break;
8613
- case 15:
8614
- _context8.n = 16;
8615
8761
  return this.getLicenseTermsId(licenseTerms);
8616
- case 16:
8762
+ case 12:
8617
8763
  licenseTermsIds = _context8.v;
8618
8764
  results[j].licenseTermsIds = licenseTermsIds;
8619
- _context8.n = 17;
8765
+ _context8.n = 13;
8620
8766
  return this.setMaxLicenseTokens({
8621
8767
  maxLicenseTokensData: licenseTermsData,
8622
8768
  licensorIpId: results[j].ipId,
8623
8769
  licenseTermsIds: licenseTermsIds
8624
8770
  });
8625
- case 17:
8771
+ case 13:
8626
8772
  maxLicenseTokensTxHashes = _context8.v;
8627
8773
  if (maxLicenseTokensTxHashes.length > 0) {
8628
8774
  results[j].maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
8629
8775
  }
8630
- case 18:
8776
+ case 14:
8631
8777
  j++;
8632
8778
  _context8.n = 11;
8633
8779
  break;
8634
- case 19:
8780
+ case 15:
8635
8781
  return _context8.a(2, {
8636
8782
  txHash: txHash,
8637
8783
  results: results
8638
8784
  });
8639
- case 20:
8640
- _context8.p = 20;
8785
+ case 16:
8786
+ _context8.p = 16;
8641
8787
  _t10 = _context8.v;
8642
8788
  return _context8.a(2, handleError(_t10, "Failed to batch mint and register IP and attach PIL terms"));
8643
8789
  }
8644
- }, _callee8, this, [[1, 6, 7, 8], [0, 20]]);
8790
+ }, _callee8, this, [[1, 6, 7, 8], [0, 16]]);
8645
8791
  }));
8646
8792
  function batchMintAndRegisterIpAssetWithPilTerms(_x9) {
8647
8793
  return _batchMintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
@@ -8658,9 +8804,9 @@ var IPAssetClient = /*#__PURE__*/function () {
8658
8804
  key: "registerIpAndAttachPilTerms",
8659
8805
  value: (function () {
8660
8806
  var _registerIpAndAttachPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(request) {
8661
- var _request$txOptions5, ipIdAddress, isRegistered, _yield$validateLicens2, licenseTerms, _yield$transformRegis2, _transformRequest, txHash, txReceipt, log, licenseTermsIds, maxLicenseTokensTxHashes, _t11;
8807
+ var _request$txOptions5, ipIdAddress, isRegistered, _yield$validateLicens, licenseTerms, _yield$transformRegis2, _transformRequest, txHash, txReceipt, log, licenseTermsIds, maxLicenseTokensTxHashes, _t11;
8662
8808
  return _regenerator().w(function (_context9) {
8663
- while (1) switch (_context9.n) {
8809
+ while (1) switch (_context9.p = _context9.n) {
8664
8810
  case 0:
8665
8811
  _context9.p = 0;
8666
8812
  request.tokenId = BigInt(request.tokenId);
@@ -8687,8 +8833,8 @@ var IPAssetClient = /*#__PURE__*/function () {
8687
8833
  _context9.n = 4;
8688
8834
  return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
8689
8835
  case 4:
8690
- _yield$validateLicens2 = _context9.v;
8691
- licenseTerms = _yield$validateLicens2.licenseTerms;
8836
+ _yield$validateLicens = _context9.v;
8837
+ licenseTerms = _yield$validateLicens.licenseTerms;
8692
8838
  _context9.n = 5;
8693
8839
  return transformRegistrationRequest({
8694
8840
  request: request,
@@ -8766,7 +8912,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8766
8912
  var _this4 = this;
8767
8913
  var _request$txOptions6, _request$options3, tokenId, ipIdAddress, isRegistered, _yield$transformRegis3, _transformRequest2, encodedTxData, contractCall, _t12;
8768
8914
  return _regenerator().w(function (_context0) {
8769
- while (1) switch (_context0.n) {
8915
+ while (1) switch (_context0.p = _context0.n) {
8770
8916
  case 0:
8771
8917
  _context0.p = 0;
8772
8918
  tokenId = BigInt(request.tokenId);
@@ -8848,7 +8994,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8848
8994
  var _this5 = this;
8849
8995
  var _request$txOptions7, _request$options4, spgNftContract, _yield$transformRegis4, _transformRequest3, encodedTxData, contractCall, _t13;
8850
8996
  return _regenerator().w(function (_context1) {
8851
- while (1) switch (_context1.n) {
8997
+ while (1) switch (_context1.p = _context1.n) {
8852
8998
  case 0:
8853
8999
  _context1.p = 0;
8854
9000
  spgNftContract = validateAddress(request.spgNftContract);
@@ -8908,7 +9054,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8908
9054
  var _batchMintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(request) {
8909
9055
  var calldata, _iterator4, _step4, arg, result, txHash, txReceipt, _t14, _t15, _t16;
8910
9056
  return _regenerator().w(function (_context10) {
8911
- while (1) switch (_context10.n) {
9057
+ while (1) switch (_context10.p = _context10.n) {
8912
9058
  case 0:
8913
9059
  _context10.p = 0;
8914
9060
  calldata = [];
@@ -8993,7 +9139,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8993
9139
  var _this6 = this;
8994
9140
  var _request$txOptions8, _request$options5, _object, encodedTxData, contractCall, _t17;
8995
9141
  return _regenerator().w(function (_context11) {
8996
- while (1) switch (_context11.n) {
9142
+ while (1) switch (_context11.p = _context11.n) {
8997
9143
  case 0:
8998
9144
  _context11.p = 0;
8999
9145
  _object = {
@@ -9037,6 +9183,241 @@ var IPAssetClient = /*#__PURE__*/function () {
9037
9183
  }
9038
9184
  return mintAndRegisterIp;
9039
9185
  }()
9186
+ /**
9187
+ * Batch mints NFTs from SPGNFT collections and registers them as IP assets.
9188
+ *
9189
+ * Optimizes transaction processing by grouping requests and automatically selecting the most efficient multicall strategy:
9190
+ * - Uses `multicall3` for public minting contracts.
9191
+ * - Uses `SPG's multicall` for private minting contracts.
9192
+ *
9193
+ * @remark
9194
+ * For private minting, verifies the `caller` has the `minter role` and avoids `multicall3` batching to ensure correct `msg.sender`.
9195
+ *
9196
+ * 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.
9197
+ * The `multicall` and token handling behavior can be configured via `wipOptions`.
9198
+ *
9199
+ * Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
9200
+ */
9201
+ )
9202
+ }, {
9203
+ key: "batchMintAndRegisterIp",
9204
+ value: (function () {
9205
+ var _batchMintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(request) {
9206
+ var _this7 = this;
9207
+ var publicMintEncodedTxs, publicMintSpenders, privateMintEncodedTxs, privateMintSpenders, publicMintFeesTotal, privateMintFeesTotal, _iterator5, _step5, req, registrationRequest, isPublicMinting, nftMintFee, encodeTx, isMinterRole, handlePublicMintTransactions, handlePrivateMintTransactions, transactionResponses, publicMintResponse, privateMintResponse, _t18, _t19, _t20, _t21;
9208
+ return _regenerator().w(function (_context14) {
9209
+ while (1) switch (_context14.p = _context14.n) {
9210
+ case 0:
9211
+ _context14.p = 0;
9212
+ publicMintEncodedTxs = [];
9213
+ publicMintSpenders = [];
9214
+ privateMintEncodedTxs = [];
9215
+ privateMintSpenders = [];
9216
+ publicMintFeesTotal = 0n;
9217
+ privateMintFeesTotal = 0n;
9218
+ _iterator5 = _createForOfIteratorHelper(request.requests);
9219
+ _context14.p = 1;
9220
+ _iterator5.s();
9221
+ case 2:
9222
+ if ((_step5 = _iterator5.n()).done) {
9223
+ _context14.n = 9;
9224
+ break;
9225
+ }
9226
+ req = _step5.value;
9227
+ registrationRequest = {
9228
+ spgNftContract: validateAddress(req.spgNftContract),
9229
+ recipient: validateAddress(req.recipient || this.walletAddress),
9230
+ ipMetadata: getIpMetadataForWorkflow(req.ipMetadata),
9231
+ allowDuplicates: req.allowDuplicates || true
9232
+ };
9233
+ _context14.n = 3;
9234
+ return getPublicMinting(req.spgNftContract, this.rpcClient);
9235
+ case 3:
9236
+ isPublicMinting = _context14.v;
9237
+ _context14.n = 4;
9238
+ return calculateSPGWipMintFee(new SpgnftImplReadOnlyClient(this.rpcClient, registrationRequest.spgNftContract));
9239
+ case 4:
9240
+ nftMintFee = _context14.v;
9241
+ encodeTx = {
9242
+ to: this.registrationWorkflowsClient.address,
9243
+ data: viem.encodeFunctionData({
9244
+ abi: registrationWorkflowsAbi,
9245
+ functionName: "mintAndRegisterIp",
9246
+ args: [registrationRequest.spgNftContract, registrationRequest.recipient, registrationRequest.ipMetadata, registrationRequest.allowDuplicates]
9247
+ })
9248
+ };
9249
+ if (!isPublicMinting) {
9250
+ _context14.n = 5;
9251
+ break;
9252
+ }
9253
+ publicMintFeesTotal += nftMintFee;
9254
+ publicMintSpenders = mergeSpenders(publicMintSpenders, [{
9255
+ address: registrationRequest.spgNftContract,
9256
+ amount: nftMintFee
9257
+ }]);
9258
+ publicMintEncodedTxs.push(encodeTx);
9259
+ _context14.n = 8;
9260
+ break;
9261
+ case 5:
9262
+ _context14.n = 6;
9263
+ return hasMinterRole(registrationRequest.spgNftContract, this.rpcClient, this.walletAddress);
9264
+ case 6:
9265
+ isMinterRole = _context14.v;
9266
+ if (isMinterRole) {
9267
+ _context14.n = 7;
9268
+ break;
9269
+ }
9270
+ throw new Error("Caller ".concat(this.walletAddress, " does not have the minter role for ").concat(registrationRequest.spgNftContract));
9271
+ case 7:
9272
+ privateMintFeesTotal += nftMintFee;
9273
+ privateMintSpenders = mergeSpenders(privateMintSpenders, [{
9274
+ address: registrationRequest.spgNftContract,
9275
+ amount: nftMintFee
9276
+ }]);
9277
+ privateMintEncodedTxs.push(encodeTx);
9278
+ case 8:
9279
+ _context14.n = 2;
9280
+ break;
9281
+ case 9:
9282
+ _context14.n = 11;
9283
+ break;
9284
+ case 10:
9285
+ _context14.p = 10;
9286
+ _t18 = _context14.v;
9287
+ _iterator5.e(_t18);
9288
+ case 11:
9289
+ _context14.p = 11;
9290
+ _iterator5.f();
9291
+ return _context14.f(11);
9292
+ case 12:
9293
+ handlePublicMintTransactions = /*#__PURE__*/function () {
9294
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
9295
+ return _regenerator().w(function (_context12) {
9296
+ while (1) switch (_context12.n) {
9297
+ case 0:
9298
+ _context12.n = 1;
9299
+ return contractCallWithFees({
9300
+ totalFees: publicMintFeesTotal,
9301
+ options: {
9302
+ wipOptions: request.wipOptions
9303
+ },
9304
+ multicall3Address: _this7.multicall3Client.address,
9305
+ rpcClient: _this7.rpcClient,
9306
+ tokenSpenders: publicMintSpenders,
9307
+ contractCall: function contractCall() {
9308
+ return _this7.registrationWorkflowsClient.multicall({
9309
+ data: publicMintEncodedTxs.map(function (tx) {
9310
+ return tx.data;
9311
+ })
9312
+ });
9313
+ },
9314
+ sender: _this7.walletAddress,
9315
+ wallet: _this7.wallet,
9316
+ txOptions: request.txOptions,
9317
+ encodedTxs: publicMintEncodedTxs
9318
+ });
9319
+ case 1:
9320
+ return _context12.a(2, _context12.v);
9321
+ }
9322
+ }, _callee12);
9323
+ }));
9324
+ return function handlePublicMintTransactions() {
9325
+ return _ref2.apply(this, arguments);
9326
+ };
9327
+ }();
9328
+ handlePrivateMintTransactions = /*#__PURE__*/function () {
9329
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
9330
+ return _regenerator().w(function (_context13) {
9331
+ while (1) switch (_context13.n) {
9332
+ case 0:
9333
+ _context13.n = 1;
9334
+ return contractCallWithFees({
9335
+ totalFees: privateMintFeesTotal,
9336
+ options: {
9337
+ wipOptions: _objectSpread2(_objectSpread2({}, request.wipOptions), {}, {
9338
+ useMulticallWhenPossible: false
9339
+ })
9340
+ },
9341
+ multicall3Address: _this7.multicall3Client.address,
9342
+ rpcClient: _this7.rpcClient,
9343
+ tokenSpenders: privateMintSpenders,
9344
+ contractCall: function contractCall() {
9345
+ return _this7.registrationWorkflowsClient.multicall({
9346
+ data: privateMintEncodedTxs.map(function (tx) {
9347
+ return tx.data;
9348
+ })
9349
+ });
9350
+ },
9351
+ sender: _this7.walletAddress,
9352
+ wallet: _this7.wallet,
9353
+ txOptions: request.txOptions,
9354
+ encodedTxs: privateMintEncodedTxs
9355
+ });
9356
+ case 1:
9357
+ return _context13.a(2, _context13.v);
9358
+ }
9359
+ }, _callee13);
9360
+ }));
9361
+ return function handlePrivateMintTransactions() {
9362
+ return _ref3.apply(this, arguments);
9363
+ };
9364
+ }();
9365
+ transactionResponses = [];
9366
+ if (!(privateMintEncodedTxs.length === 0)) {
9367
+ _context14.n = 14;
9368
+ break;
9369
+ }
9370
+ _context14.n = 13;
9371
+ return handlePublicMintTransactions();
9372
+ case 13:
9373
+ _t19 = _context14.v;
9374
+ transactionResponses = [_t19];
9375
+ _context14.n = 19;
9376
+ break;
9377
+ case 14:
9378
+ if (!(publicMintEncodedTxs.length === 0)) {
9379
+ _context14.n = 16;
9380
+ break;
9381
+ }
9382
+ _context14.n = 15;
9383
+ return handlePrivateMintTransactions();
9384
+ case 15:
9385
+ _t20 = _context14.v;
9386
+ transactionResponses = [_t20];
9387
+ _context14.n = 19;
9388
+ break;
9389
+ case 16:
9390
+ _context14.n = 17;
9391
+ return handlePublicMintTransactions();
9392
+ case 17:
9393
+ publicMintResponse = _context14.v;
9394
+ _context14.n = 18;
9395
+ return handlePrivateMintTransactions();
9396
+ case 18:
9397
+ privateMintResponse = _context14.v;
9398
+ transactionResponses = [publicMintResponse, privateMintResponse];
9399
+ case 19:
9400
+ return _context14.a(2, {
9401
+ registrationResults: transactionResponses.map(function (r) {
9402
+ return {
9403
+ txHash: r.txHash,
9404
+ receipt: r.receipt,
9405
+ ipIdsAndTokenIds: _this7.getIpIdAndTokenIdsFromEvent(r.receipt, "spgNftContract")
9406
+ };
9407
+ })
9408
+ });
9409
+ case 20:
9410
+ _context14.p = 20;
9411
+ _t21 = _context14.v;
9412
+ return _context14.a(2, handleError(_t21, "Failed to batch mint and register IP"));
9413
+ }
9414
+ }, _callee14, this, [[1, 10, 11, 12], [0, 20]]);
9415
+ }));
9416
+ function batchMintAndRegisterIp(_x13) {
9417
+ return _batchMintAndRegisterIp.apply(this, arguments);
9418
+ }
9419
+ return batchMintAndRegisterIp;
9420
+ }()
9040
9421
  /**
9041
9422
  * Register Programmable IP License Terms (if unregistered) and attach it to IP.
9042
9423
  *
@@ -9046,40 +9427,40 @@ var IPAssetClient = /*#__PURE__*/function () {
9046
9427
  }, {
9047
9428
  key: "registerPilTermsAndAttach",
9048
9429
  value: (function () {
9049
- var _registerPilTermsAndAttach = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(request) {
9050
- var _request$txOptions9, ipId, isRegistered, _yield$validateLicens3, licenseTerms, licenseTermsData, calculatedDeadline, ipAccount, _yield$ipAccount$stat2, state, signature, _object2, txHash, licenseTermsIds, maxLicenseTokensTxHashes, _t18;
9051
- return _regenerator().w(function (_context12) {
9052
- while (1) switch (_context12.n) {
9430
+ var _registerPilTermsAndAttach = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(request) {
9431
+ var _request$txOptions9, ipId, isRegistered, _yield$validateLicens2, licenseTerms, licenseTermsData, calculatedDeadline, ipAccount, _yield$ipAccount$stat2, state, signature, _object2, txHash, licenseTermsIds, maxLicenseTokensTxHashes, _t22;
9432
+ return _regenerator().w(function (_context15) {
9433
+ while (1) switch (_context15.p = _context15.n) {
9053
9434
  case 0:
9054
- _context12.p = 0;
9435
+ _context15.p = 0;
9055
9436
  ipId = request.ipId;
9056
- _context12.n = 1;
9437
+ _context15.n = 1;
9057
9438
  return this.isRegistered(ipId);
9058
9439
  case 1:
9059
- isRegistered = _context12.v;
9440
+ isRegistered = _context15.v;
9060
9441
  if (isRegistered) {
9061
- _context12.n = 2;
9442
+ _context15.n = 2;
9062
9443
  break;
9063
9444
  }
9064
9445
  throw new Error("The IP with id ".concat(ipId, " is not registered."));
9065
9446
  case 2:
9066
- _context12.n = 3;
9447
+ _context15.n = 3;
9067
9448
  return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
9068
9449
  case 3:
9069
- _yield$validateLicens3 = _context12.v;
9070
- licenseTerms = _yield$validateLicens3.licenseTerms;
9071
- licenseTermsData = _yield$validateLicens3.licenseTermsData;
9072
- _context12.n = 4;
9450
+ _yield$validateLicens2 = _context15.v;
9451
+ licenseTerms = _yield$validateLicens2.licenseTerms;
9452
+ licenseTermsData = _yield$validateLicens2.licenseTermsData;
9453
+ _context15.n = 4;
9073
9454
  return getCalculatedDeadline(this.rpcClient, request.deadline);
9074
9455
  case 4:
9075
- calculatedDeadline = _context12.v;
9456
+ calculatedDeadline = _context15.v;
9076
9457
  ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, ipId);
9077
- _context12.n = 5;
9458
+ _context15.n = 5;
9078
9459
  return ipAccount.state();
9079
9460
  case 5:
9080
- _yield$ipAccount$stat2 = _context12.v;
9461
+ _yield$ipAccount$stat2 = _context15.v;
9081
9462
  state = _yield$ipAccount$stat2.result;
9082
- _context12.n = 6;
9463
+ _context15.n = 6;
9083
9464
  return generateOperationSignature({
9084
9465
  ipIdAddress: ipId,
9085
9466
  methodType: SignatureMethodType.REGISTER_PIL_TERMS_AND_ATTACH,
@@ -9089,7 +9470,7 @@ var IPAssetClient = /*#__PURE__*/function () {
9089
9470
  chainId: this.chainId
9090
9471
  });
9091
9472
  case 6:
9092
- signature = _context12.v;
9473
+ signature = _context15.v;
9093
9474
  _object2 = {
9094
9475
  ipId: ipId,
9095
9476
  licenseTermsData: licenseTermsData,
@@ -9100,53 +9481,53 @@ var IPAssetClient = /*#__PURE__*/function () {
9100
9481
  }
9101
9482
  };
9102
9483
  if (!((_request$txOptions9 = request.txOptions) !== null && _request$txOptions9 !== void 0 && _request$txOptions9.encodedTxDataOnly)) {
9103
- _context12.n = 7;
9484
+ _context15.n = 7;
9104
9485
  break;
9105
9486
  }
9106
- return _context12.a(2, {
9487
+ return _context15.a(2, {
9107
9488
  encodedTxData: this.licenseAttachmentWorkflowsClient.registerPilTermsAndAttachEncode(_object2)
9108
9489
  });
9109
9490
  case 7:
9110
- _context12.n = 8;
9491
+ _context15.n = 8;
9111
9492
  return this.licenseAttachmentWorkflowsClient.registerPilTermsAndAttach(_object2);
9112
9493
  case 8:
9113
- txHash = _context12.v;
9114
- _context12.n = 9;
9494
+ txHash = _context15.v;
9495
+ _context15.n = 9;
9115
9496
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
9116
9497
  hash: txHash
9117
9498
  }));
9118
9499
  case 9:
9119
- _context12.n = 10;
9500
+ _context15.n = 10;
9120
9501
  return this.getLicenseTermsId(licenseTerms);
9121
9502
  case 10:
9122
- licenseTermsIds = _context12.v;
9123
- _context12.n = 11;
9503
+ licenseTermsIds = _context15.v;
9504
+ _context15.n = 11;
9124
9505
  return this.setMaxLicenseTokens({
9125
9506
  maxLicenseTokensData: request.licenseTermsData,
9126
9507
  licensorIpId: ipId,
9127
9508
  licenseTermsIds: licenseTermsIds
9128
9509
  });
9129
9510
  case 11:
9130
- maxLicenseTokensTxHashes = _context12.v;
9131
- return _context12.a(2, _objectSpread2({
9511
+ maxLicenseTokensTxHashes = _context15.v;
9512
+ return _context15.a(2, _objectSpread2({
9132
9513
  txHash: txHash,
9133
9514
  licenseTermsIds: licenseTermsIds
9134
9515
  }, maxLicenseTokensTxHashes.length > 0 && {
9135
9516
  maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
9136
9517
  }));
9137
9518
  case 12:
9138
- _context12.n = 14;
9519
+ _context15.n = 14;
9139
9520
  break;
9140
9521
  case 13:
9141
- _context12.p = 13;
9142
- _t18 = _context12.v;
9143
- return _context12.a(2, handleError(_t18, "Failed to register PIL terms and attach"));
9522
+ _context15.p = 13;
9523
+ _t22 = _context15.v;
9524
+ return _context15.a(2, handleError(_t22, "Failed to register PIL terms and attach"));
9144
9525
  case 14:
9145
- return _context12.a(2);
9526
+ return _context15.a(2);
9146
9527
  }
9147
- }, _callee12, this, [[0, 13]]);
9528
+ }, _callee15, this, [[0, 13]]);
9148
9529
  }));
9149
- function registerPilTermsAndAttach(_x13) {
9530
+ function registerPilTermsAndAttach(_x14) {
9150
9531
  return _registerPilTermsAndAttach.apply(this, arguments);
9151
9532
  }
9152
9533
  return registerPilTermsAndAttach;
@@ -9161,17 +9542,17 @@ var IPAssetClient = /*#__PURE__*/function () {
9161
9542
  }, {
9162
9543
  key: "mintAndRegisterIpAndMakeDerivativeWithLicenseTokens",
9163
9544
  value: (function () {
9164
- var _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(request) {
9165
- var _this7 = this;
9166
- var _request$txOptions0, _request$options6, licenseTokenIds, _object3, encodedTxData, contractCall, _t19;
9167
- return _regenerator().w(function (_context14) {
9168
- while (1) switch (_context14.n) {
9545
+ var _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(request) {
9546
+ var _this8 = this;
9547
+ var _request$txOptions0, _request$options6, licenseTokenIds, _object3, encodedTxData, contractCall, _t23;
9548
+ return _regenerator().w(function (_context17) {
9549
+ while (1) switch (_context17.p = _context17.n) {
9169
9550
  case 0:
9170
- _context14.p = 0;
9171
- _context14.n = 1;
9551
+ _context17.p = 0;
9552
+ _context17.n = 1;
9172
9553
  return this.validateLicenseTokenIds(request.licenseTokenIds);
9173
9554
  case 1:
9174
- licenseTokenIds = _context14.v;
9555
+ licenseTokenIds = _context17.v;
9175
9556
  _object3 = {
9176
9557
  spgNftContract: validateAddress(request.spgNftContract),
9177
9558
  recipient: validateAddress(request.recipient || this.walletAddress),
@@ -9184,27 +9565,27 @@ var IPAssetClient = /*#__PURE__*/function () {
9184
9565
  validateMaxRts(_object3.maxRts);
9185
9566
  encodedTxData = this.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokensEncode(_object3);
9186
9567
  if (!((_request$txOptions0 = request.txOptions) !== null && _request$txOptions0 !== void 0 && _request$txOptions0.encodedTxDataOnly)) {
9187
- _context14.n = 2;
9568
+ _context17.n = 2;
9188
9569
  break;
9189
9570
  }
9190
- return _context14.a(2, {
9571
+ return _context17.a(2, {
9191
9572
  encodedTxData: encodedTxData
9192
9573
  });
9193
9574
  case 2:
9194
9575
  contractCall = /*#__PURE__*/function () {
9195
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
9196
- return _regenerator().w(function (_context13) {
9197
- while (1) switch (_context13.n) {
9576
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
9577
+ return _regenerator().w(function (_context16) {
9578
+ while (1) switch (_context16.n) {
9198
9579
  case 0:
9199
- return _context13.a(2, _this7.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_object3));
9580
+ return _context16.a(2, _this8.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_object3));
9200
9581
  }
9201
- }, _callee13);
9582
+ }, _callee16);
9202
9583
  }));
9203
9584
  return function contractCall() {
9204
- return _ref2.apply(this, arguments);
9585
+ return _ref4.apply(this, arguments);
9205
9586
  };
9206
9587
  }();
9207
- return _context14.a(2, this.handleRegistrationWithFees({
9588
+ return _context17.a(2, this.handleRegistrationWithFees({
9208
9589
  wipOptions: _objectSpread2(_objectSpread2({}, (_request$options6 = request.options) === null || _request$options6 === void 0 ? void 0 : _request$options6.wipOptions), {}, {
9209
9590
  // need to disable multicall to avoid needing to transfer the license
9210
9591
  // token to the multicall contract.
@@ -9218,13 +9599,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9218
9599
  txOptions: request.txOptions
9219
9600
  }));
9220
9601
  case 3:
9221
- _context14.p = 3;
9222
- _t19 = _context14.v;
9223
- return _context14.a(2, handleError(_t19, "Failed to mint and register IP and make derivative with license tokens"));
9602
+ _context17.p = 3;
9603
+ _t23 = _context17.v;
9604
+ return _context17.a(2, handleError(_t23, "Failed to mint and register IP and make derivative with license tokens"));
9224
9605
  }
9225
- }, _callee14, this, [[0, 3]]);
9606
+ }, _callee17, this, [[0, 3]]);
9226
9607
  }));
9227
- function mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_x14) {
9608
+ function mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_x15) {
9228
9609
  return _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens.apply(this, arguments);
9229
9610
  }
9230
9611
  return mintAndRegisterIpAndMakeDerivativeWithLicenseTokens;
@@ -9238,14 +9619,14 @@ var IPAssetClient = /*#__PURE__*/function () {
9238
9619
  }, {
9239
9620
  key: "registerIpAndMakeDerivativeWithLicenseTokens",
9240
9621
  value: (function () {
9241
- var _registerIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(request) {
9242
- var _request$txOptions1, tokenId, ipIdAddress, isRegistered, licenseTokenIds, calculatedDeadline, signature, _object4, txHash, receipt, log, _t20;
9243
- return _regenerator().w(function (_context15) {
9244
- while (1) switch (_context15.n) {
9622
+ var _registerIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(request) {
9623
+ var _request$txOptions1, tokenId, ipIdAddress, isRegistered, licenseTokenIds, calculatedDeadline, signature, _object4, txHash, receipt, log, _t24;
9624
+ return _regenerator().w(function (_context18) {
9625
+ while (1) switch (_context18.p = _context18.n) {
9245
9626
  case 0:
9246
- _context15.p = 0;
9627
+ _context18.p = 0;
9247
9628
  tokenId = BigInt(request.tokenId);
9248
- _context15.n = 1;
9629
+ _context18.n = 1;
9249
9630
  return getIpIdAddress({
9250
9631
  nftContract: request.nftContract,
9251
9632
  tokenId: tokenId,
@@ -9254,26 +9635,26 @@ var IPAssetClient = /*#__PURE__*/function () {
9254
9635
  chainId: this.chainId
9255
9636
  });
9256
9637
  case 1:
9257
- ipIdAddress = _context15.v;
9258
- _context15.n = 2;
9638
+ ipIdAddress = _context18.v;
9639
+ _context18.n = 2;
9259
9640
  return this.isRegistered(ipIdAddress);
9260
9641
  case 2:
9261
- isRegistered = _context15.v;
9642
+ isRegistered = _context18.v;
9262
9643
  if (!isRegistered) {
9263
- _context15.n = 3;
9644
+ _context18.n = 3;
9264
9645
  break;
9265
9646
  }
9266
9647
  throw new Error("The NFT with id ".concat(tokenId, " is already registered as IP."));
9267
9648
  case 3:
9268
- _context15.n = 4;
9649
+ _context18.n = 4;
9269
9650
  return this.validateLicenseTokenIds(request.licenseTokenIds);
9270
9651
  case 4:
9271
- licenseTokenIds = _context15.v;
9272
- _context15.n = 5;
9652
+ licenseTokenIds = _context18.v;
9653
+ _context18.n = 5;
9273
9654
  return getCalculatedDeadline(this.rpcClient, request.deadline);
9274
9655
  case 5:
9275
- calculatedDeadline = _context15.v;
9276
- _context15.n = 6;
9656
+ calculatedDeadline = _context18.v;
9657
+ _context18.n = 6;
9277
9658
  return generateOperationSignature({
9278
9659
  ipIdAddress: ipIdAddress,
9279
9660
  methodType: SignatureMethodType.REGISTER_IP_AND_MAKE_DERIVATIVE_WITH_LICENSE_TOKENS,
@@ -9282,7 +9663,7 @@ var IPAssetClient = /*#__PURE__*/function () {
9282
9663
  chainId: this.chainId
9283
9664
  });
9284
9665
  case 6:
9285
- signature = _context15.v;
9666
+ signature = _context18.v;
9286
9667
  _object4 = _objectSpread2(_objectSpread2({}, request), {}, {
9287
9668
  tokenId: tokenId,
9288
9669
  licenseTokenIds: licenseTokenIds,
@@ -9297,40 +9678,40 @@ var IPAssetClient = /*#__PURE__*/function () {
9297
9678
  });
9298
9679
  validateMaxRts(_object4.maxRts);
9299
9680
  if (!((_request$txOptions1 = request.txOptions) !== null && _request$txOptions1 !== void 0 && _request$txOptions1.encodedTxDataOnly)) {
9300
- _context15.n = 7;
9681
+ _context18.n = 7;
9301
9682
  break;
9302
9683
  }
9303
- return _context15.a(2, {
9684
+ return _context18.a(2, {
9304
9685
  encodedTxData: this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokensEncode(_object4)
9305
9686
  });
9306
9687
  case 7:
9307
- _context15.n = 8;
9688
+ _context18.n = 8;
9308
9689
  return this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokens(_object4);
9309
9690
  case 8:
9310
- txHash = _context15.v;
9311
- _context15.n = 9;
9691
+ txHash = _context18.v;
9692
+ _context18.n = 9;
9312
9693
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
9313
9694
  hash: txHash
9314
9695
  }));
9315
9696
  case 9:
9316
- receipt = _context15.v;
9697
+ receipt = _context18.v;
9317
9698
  log = this.getIpIdAndTokenIdsFromEvent(receipt)[0];
9318
- return _context15.a(2, _objectSpread2({
9699
+ return _context18.a(2, _objectSpread2({
9319
9700
  txHash: txHash
9320
9701
  }, log));
9321
9702
  case 10:
9322
- _context15.n = 12;
9703
+ _context18.n = 12;
9323
9704
  break;
9324
9705
  case 11:
9325
- _context15.p = 11;
9326
- _t20 = _context15.v;
9327
- return _context15.a(2, handleError(_t20, "Failed to register IP and make derivative with license tokens"));
9706
+ _context18.p = 11;
9707
+ _t24 = _context18.v;
9708
+ return _context18.a(2, handleError(_t24, "Failed to register IP and make derivative with license tokens"));
9328
9709
  case 12:
9329
- return _context15.a(2);
9710
+ return _context18.a(2);
9330
9711
  }
9331
- }, _callee15, this, [[0, 11]]);
9712
+ }, _callee18, this, [[0, 11]]);
9332
9713
  }));
9333
- function registerIpAndMakeDerivativeWithLicenseTokens(_x15) {
9714
+ function registerIpAndMakeDerivativeWithLicenseTokens(_x16) {
9334
9715
  return _registerIpAndMakeDerivativeWithLicenseTokens.apply(this, arguments);
9335
9716
  }
9336
9717
  return registerIpAndMakeDerivativeWithLicenseTokens;
@@ -9346,23 +9727,23 @@ var IPAssetClient = /*#__PURE__*/function () {
9346
9727
  }, {
9347
9728
  key: "registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens",
9348
9729
  value: (function () {
9349
- var _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(request) {
9350
- var _getRoyaltyShares, royaltyShares, totalAmount, _yield$validateLicens4, licenseTerms, calculatedDeadline, ipIdAddress, isRegistered, _yield$transformRegis5, _transformRequest4, registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash, txReceipt, ipId, licenseTermsIds, ipRoyaltyVault, distributeRoyaltyTokensTxHash, maxLicenseTokensTxHashes, _t21;
9351
- return _regenerator().w(function (_context16) {
9352
- while (1) switch (_context16.n) {
9730
+ var _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(request) {
9731
+ var _getRoyaltyShares, royaltyShares, totalAmount, _yield$validateLicens3, licenseTerms, calculatedDeadline, ipIdAddress, isRegistered, _yield$transformRegis5, _transformRequest4, registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash, txReceipt, ipId, licenseTermsIds, ipRoyaltyVault, distributeRoyaltyTokensTxHash, maxLicenseTokensTxHashes, _t25;
9732
+ return _regenerator().w(function (_context19) {
9733
+ while (1) switch (_context19.p = _context19.n) {
9353
9734
  case 0:
9354
- _context16.p = 0;
9735
+ _context19.p = 0;
9355
9736
  _getRoyaltyShares = getRoyaltyShares(request.royaltyShares), royaltyShares = _getRoyaltyShares.royaltyShares, totalAmount = _getRoyaltyShares.totalAmount;
9356
- _context16.n = 1;
9737
+ _context19.n = 1;
9357
9738
  return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
9358
9739
  case 1:
9359
- _yield$validateLicens4 = _context16.v;
9360
- licenseTerms = _yield$validateLicens4.licenseTerms;
9361
- _context16.n = 2;
9740
+ _yield$validateLicens3 = _context19.v;
9741
+ licenseTerms = _yield$validateLicens3.licenseTerms;
9742
+ _context19.n = 2;
9362
9743
  return getCalculatedDeadline(this.rpcClient, request.deadline);
9363
9744
  case 2:
9364
- calculatedDeadline = _context16.v;
9365
- _context16.n = 3;
9745
+ calculatedDeadline = _context19.v;
9746
+ _context19.n = 3;
9366
9747
  return getIpIdAddress({
9367
9748
  nftContract: validateAddress(request.nftContract),
9368
9749
  tokenId: BigInt(request.tokenId),
@@ -9371,18 +9752,18 @@ var IPAssetClient = /*#__PURE__*/function () {
9371
9752
  chainId: this.chainId
9372
9753
  });
9373
9754
  case 3:
9374
- ipIdAddress = _context16.v;
9375
- _context16.n = 4;
9755
+ ipIdAddress = _context19.v;
9756
+ _context19.n = 4;
9376
9757
  return this.isRegistered(ipIdAddress);
9377
9758
  case 4:
9378
- isRegistered = _context16.v;
9759
+ isRegistered = _context19.v;
9379
9760
  if (!isRegistered) {
9380
- _context16.n = 5;
9761
+ _context19.n = 5;
9381
9762
  break;
9382
9763
  }
9383
9764
  throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
9384
9765
  case 5:
9385
- _context16.n = 6;
9766
+ _context19.n = 6;
9386
9767
  return transformRegistrationRequest({
9387
9768
  request: request,
9388
9769
  rpcClient: this.rpcClient,
@@ -9390,25 +9771,25 @@ var IPAssetClient = /*#__PURE__*/function () {
9390
9771
  chainId: this.chainId
9391
9772
  });
9392
9773
  case 6:
9393
- _yield$transformRegis5 = _context16.v;
9774
+ _yield$transformRegis5 = _context19.v;
9394
9775
  _transformRequest4 = _yield$transformRegis5.transformRequest;
9395
- _context16.n = 7;
9776
+ _context19.n = 7;
9396
9777
  return this.royaltyTokenDistributionWorkflowsClient.registerIpAndAttachPilTermsAndDeployRoyaltyVault(_transformRequest4);
9397
9778
  case 7:
9398
- registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash = _context16.v;
9399
- _context16.n = 8;
9779
+ registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash = _context19.v;
9780
+ _context19.n = 8;
9400
9781
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
9401
9782
  hash: registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash
9402
9783
  }));
9403
9784
  case 8:
9404
- txReceipt = _context16.v;
9785
+ txReceipt = _context19.v;
9405
9786
  ipId = this.getIpIdAndTokenIdsFromEvent(txReceipt)[0].ipId;
9406
- _context16.n = 9;
9787
+ _context19.n = 9;
9407
9788
  return this.getLicenseTermsId(licenseTerms);
9408
9789
  case 9:
9409
- licenseTermsIds = _context16.v;
9790
+ licenseTermsIds = _context19.v;
9410
9791
  ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(txReceipt)[0].ipRoyaltyVault;
9411
- _context16.n = 10;
9792
+ _context19.n = 10;
9412
9793
  return this.distributeRoyaltyTokens({
9413
9794
  ipId: ipId,
9414
9795
  deadline: calculatedDeadline,
@@ -9418,21 +9799,21 @@ var IPAssetClient = /*#__PURE__*/function () {
9418
9799
  txOptions: request.txOptions
9419
9800
  });
9420
9801
  case 10:
9421
- distributeRoyaltyTokensTxHash = _context16.v;
9422
- _context16.n = 11;
9802
+ distributeRoyaltyTokensTxHash = _context19.v;
9803
+ _context19.n = 11;
9423
9804
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
9424
9805
  hash: distributeRoyaltyTokensTxHash
9425
9806
  }));
9426
9807
  case 11:
9427
- _context16.n = 12;
9808
+ _context19.n = 12;
9428
9809
  return this.setMaxLicenseTokens({
9429
9810
  maxLicenseTokensData: request.licenseTermsData,
9430
9811
  licensorIpId: ipId,
9431
9812
  licenseTermsIds: licenseTermsIds
9432
9813
  });
9433
9814
  case 12:
9434
- maxLicenseTokensTxHashes = _context16.v;
9435
- return _context16.a(2, _objectSpread2({
9815
+ maxLicenseTokensTxHashes = _context19.v;
9816
+ return _context19.a(2, _objectSpread2({
9436
9817
  registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash: registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash,
9437
9818
  distributeRoyaltyTokensTxHash: distributeRoyaltyTokensTxHash,
9438
9819
  ipId: ipId,
@@ -9442,13 +9823,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9442
9823
  maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
9443
9824
  }));
9444
9825
  case 13:
9445
- _context16.p = 13;
9446
- _t21 = _context16.v;
9447
- return _context16.a(2, handleError(_t21, "Failed to register IP and attach license terms and distribute royalty tokens"));
9826
+ _context19.p = 13;
9827
+ _t25 = _context19.v;
9828
+ return _context19.a(2, handleError(_t25, "Failed to register IP and attach license terms and distribute royalty tokens"));
9448
9829
  }
9449
- }, _callee16, this, [[0, 13]]);
9830
+ }, _callee19, this, [[0, 13]]);
9450
9831
  }));
9451
- function registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x16) {
9832
+ function registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x17) {
9452
9833
  return _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens.apply(this, arguments);
9453
9834
  }
9454
9835
  return registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens;
@@ -9463,14 +9844,14 @@ var IPAssetClient = /*#__PURE__*/function () {
9463
9844
  }, {
9464
9845
  key: "registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens",
9465
9846
  value: (function () {
9466
- var _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(request) {
9467
- var _this8 = this;
9468
- var _request$options7, ipIdAddress, _yield$transformRegis6, _transformRequest5, _getRoyaltyShares2, royaltyShares, totalAmount, isRegistered, encodedTxData, contractCall, _yield$this$handleReg, txHash, ipId, tokenId, receipt, ipRoyaltyVault, distributeRoyaltyTokensTxHash, _t22;
9469
- return _regenerator().w(function (_context17) {
9470
- while (1) switch (_context17.n) {
9847
+ var _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(request) {
9848
+ var _this9 = this;
9849
+ var _request$options7, ipIdAddress, _yield$transformRegis6, _transformRequest5, _getRoyaltyShares2, royaltyShares, totalAmount, isRegistered, encodedTxData, contractCall, _yield$this$handleReg, txHash, ipId, tokenId, receipt, ipRoyaltyVault, distributeRoyaltyTokensTxHash, _t26;
9850
+ return _regenerator().w(function (_context20) {
9851
+ while (1) switch (_context20.p = _context20.n) {
9471
9852
  case 0:
9472
- _context17.p = 0;
9473
- _context17.n = 1;
9853
+ _context20.p = 0;
9854
+ _context20.n = 1;
9474
9855
  return getIpIdAddress({
9475
9856
  nftContract: validateAddress(request.nftContract),
9476
9857
  tokenId: BigInt(request.tokenId),
@@ -9479,8 +9860,8 @@ var IPAssetClient = /*#__PURE__*/function () {
9479
9860
  chainId: this.chainId
9480
9861
  });
9481
9862
  case 1:
9482
- ipIdAddress = _context17.v;
9483
- _context17.n = 2;
9863
+ ipIdAddress = _context20.v;
9864
+ _context20.n = 2;
9484
9865
  return transformRegistrationRequest({
9485
9866
  request: request,
9486
9867
  rpcClient: this.rpcClient,
@@ -9488,24 +9869,24 @@ var IPAssetClient = /*#__PURE__*/function () {
9488
9869
  chainId: this.chainId
9489
9870
  });
9490
9871
  case 2:
9491
- _yield$transformRegis6 = _context17.v;
9872
+ _yield$transformRegis6 = _context20.v;
9492
9873
  _transformRequest5 = _yield$transformRegis6.transformRequest;
9493
9874
  _getRoyaltyShares2 = getRoyaltyShares(request.royaltyShares), royaltyShares = _getRoyaltyShares2.royaltyShares, totalAmount = _getRoyaltyShares2.totalAmount;
9494
- _context17.n = 3;
9875
+ _context20.n = 3;
9495
9876
  return this.isRegistered(ipIdAddress);
9496
9877
  case 3:
9497
- isRegistered = _context17.v;
9878
+ isRegistered = _context20.v;
9498
9879
  if (!isRegistered) {
9499
- _context17.n = 4;
9880
+ _context20.n = 4;
9500
9881
  break;
9501
9882
  }
9502
9883
  throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
9503
9884
  case 4:
9504
9885
  encodedTxData = this.royaltyTokenDistributionWorkflowsClient.registerIpAndMakeDerivativeAndDeployRoyaltyVaultEncode(_transformRequest5);
9505
9886
  contractCall = function contractCall() {
9506
- return _this8.royaltyTokenDistributionWorkflowsClient.registerIpAndMakeDerivativeAndDeployRoyaltyVault(_transformRequest5);
9887
+ return _this9.royaltyTokenDistributionWorkflowsClient.registerIpAndMakeDerivativeAndDeployRoyaltyVault(_transformRequest5);
9507
9888
  };
9508
- _context17.n = 5;
9889
+ _context20.n = 5;
9509
9890
  return this.handleRegistrationWithFees({
9510
9891
  wipOptions: _objectSpread2(_objectSpread2({}, (_request$options7 = request.options) === null || _request$options7 === void 0 ? void 0 : _request$options7.wipOptions), {}, {
9511
9892
  useMulticallWhenPossible: false
@@ -9518,13 +9899,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9518
9899
  txOptions: _objectSpread2({}, request.txOptions)
9519
9900
  });
9520
9901
  case 5:
9521
- _yield$this$handleReg = _context17.v;
9902
+ _yield$this$handleReg = _context20.v;
9522
9903
  txHash = _yield$this$handleReg.txHash;
9523
9904
  ipId = _yield$this$handleReg.ipId;
9524
9905
  tokenId = _yield$this$handleReg.tokenId;
9525
9906
  receipt = _yield$this$handleReg.receipt;
9526
9907
  if (!(tokenId === undefined || !ipId || !receipt)) {
9527
- _context17.n = 6;
9908
+ _context20.n = 6;
9528
9909
  break;
9529
9910
  }
9530
9911
  throw new Error("Failed to register derivative ip and deploy royalty vault.");
@@ -9532,7 +9913,7 @@ var IPAssetClient = /*#__PURE__*/function () {
9532
9913
  ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt).filter(function (item) {
9533
9914
  return item.ipId === ipId;
9534
9915
  })[0].ipRoyaltyVault;
9535
- _context17.n = 7;
9916
+ _context20.n = 7;
9536
9917
  return this.distributeRoyaltyTokens({
9537
9918
  ipId: ipId,
9538
9919
  deadline: request.deadline,
@@ -9542,13 +9923,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9542
9923
  txOptions: request.txOptions
9543
9924
  });
9544
9925
  case 7:
9545
- distributeRoyaltyTokensTxHash = _context17.v;
9546
- _context17.n = 8;
9926
+ distributeRoyaltyTokensTxHash = _context20.v;
9927
+ _context20.n = 8;
9547
9928
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
9548
9929
  hash: distributeRoyaltyTokensTxHash
9549
9930
  }));
9550
9931
  case 8:
9551
- return _context17.a(2, {
9932
+ return _context20.a(2, {
9552
9933
  registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokensTxHash: txHash,
9553
9934
  distributeRoyaltyTokensTxHash: distributeRoyaltyTokensTxHash,
9554
9935
  ipId: ipId,
@@ -9556,13 +9937,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9556
9937
  ipRoyaltyVault: ipRoyaltyVault
9557
9938
  });
9558
9939
  case 9:
9559
- _context17.p = 9;
9560
- _t22 = _context17.v;
9561
- return _context17.a(2, handleError(_t22, "Failed to register derivative IP and attach license terms and distribute royalty tokens"));
9940
+ _context20.p = 9;
9941
+ _t26 = _context20.v;
9942
+ return _context20.a(2, handleError(_t26, "Failed to register derivative IP and attach license terms and distribute royalty tokens"));
9562
9943
  }
9563
- }, _callee17, this, [[0, 9]]);
9944
+ }, _callee20, this, [[0, 9]]);
9564
9945
  }));
9565
- function registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x17) {
9946
+ function registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x18) {
9566
9947
  return _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens.apply(this, arguments);
9567
9948
  }
9568
9949
  return registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens;
@@ -9576,19 +9957,19 @@ var IPAssetClient = /*#__PURE__*/function () {
9576
9957
  }, {
9577
9958
  key: "mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens",
9578
9959
  value: (function () {
9579
- var _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(request) {
9580
- var _this9 = this;
9581
- var _request$options8, _yield$validateLicens5, licenseTerms, _yield$transformRegis7, _transformRequest6, encodedTxData, contractCall, _yield$this$handleReg2, txHash, ipId, tokenId, receipt, licenseTermsIds, ipRoyaltyVault, maxLicenseTokensTxHashes, _t23;
9582
- return _regenerator().w(function (_context18) {
9583
- while (1) switch (_context18.n) {
9960
+ var _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(request) {
9961
+ var _this0 = this;
9962
+ var _request$options8, _yield$validateLicens4, licenseTerms, _yield$transformRegis7, _transformRequest6, encodedTxData, contractCall, _yield$this$handleReg2, txHash, ipId, tokenId, receipt, licenseTermsIds, ipRoyaltyVault, maxLicenseTokensTxHashes, _t27;
9963
+ return _regenerator().w(function (_context21) {
9964
+ while (1) switch (_context21.p = _context21.n) {
9584
9965
  case 0:
9585
- _context18.p = 0;
9586
- _context18.n = 1;
9966
+ _context21.p = 0;
9967
+ _context21.n = 1;
9587
9968
  return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
9588
9969
  case 1:
9589
- _yield$validateLicens5 = _context18.v;
9590
- licenseTerms = _yield$validateLicens5.licenseTerms;
9591
- _context18.n = 2;
9970
+ _yield$validateLicens4 = _context21.v;
9971
+ licenseTerms = _yield$validateLicens4.licenseTerms;
9972
+ _context21.n = 2;
9592
9973
  return transformRegistrationRequest({
9593
9974
  request: request,
9594
9975
  rpcClient: this.rpcClient,
@@ -9596,13 +9977,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9596
9977
  chainId: this.chainId
9597
9978
  });
9598
9979
  case 2:
9599
- _yield$transformRegis7 = _context18.v;
9980
+ _yield$transformRegis7 = _context21.v;
9600
9981
  _transformRequest6 = _yield$transformRegis7.transformRequest;
9601
9982
  encodedTxData = this.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokensEncode(_transformRequest6);
9602
9983
  contractCall = function contractCall() {
9603
- return _this9.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_transformRequest6);
9984
+ return _this0.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_transformRequest6);
9604
9985
  };
9605
- _context18.n = 3;
9986
+ _context21.n = 3;
9606
9987
  return this.handleRegistrationWithFees({
9607
9988
  wipOptions: (_request$options8 = request.options) === null || _request$options8 === void 0 ? void 0 : _request$options8.wipOptions,
9608
9989
  sender: this.walletAddress,
@@ -9613,33 +9994,33 @@ var IPAssetClient = /*#__PURE__*/function () {
9613
9994
  txOptions: request.txOptions
9614
9995
  });
9615
9996
  case 3:
9616
- _yield$this$handleReg2 = _context18.v;
9997
+ _yield$this$handleReg2 = _context21.v;
9617
9998
  txHash = _yield$this$handleReg2.txHash;
9618
9999
  ipId = _yield$this$handleReg2.ipId;
9619
10000
  tokenId = _yield$this$handleReg2.tokenId;
9620
10001
  receipt = _yield$this$handleReg2.receipt;
9621
10002
  if (receipt) {
9622
- _context18.n = 4;
10003
+ _context21.n = 4;
9623
10004
  break;
9624
10005
  }
9625
- return _context18.a(2, {
10006
+ return _context21.a(2, {
9626
10007
  txHash: txHash
9627
10008
  });
9628
10009
  case 4:
9629
- _context18.n = 5;
10010
+ _context21.n = 5;
9630
10011
  return this.getLicenseTermsId(licenseTerms);
9631
10012
  case 5:
9632
- licenseTermsIds = _context18.v;
10013
+ licenseTermsIds = _context21.v;
9633
10014
  ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt)[0].ipRoyaltyVault;
9634
- _context18.n = 6;
10015
+ _context21.n = 6;
9635
10016
  return this.setMaxLicenseTokens({
9636
10017
  maxLicenseTokensData: request.licenseTermsData,
9637
10018
  licensorIpId: ipId,
9638
10019
  licenseTermsIds: licenseTermsIds
9639
10020
  });
9640
10021
  case 6:
9641
- maxLicenseTokensTxHashes = _context18.v;
9642
- return _context18.a(2, _objectSpread2({
10022
+ maxLicenseTokensTxHashes = _context21.v;
10023
+ return _context21.a(2, _objectSpread2({
9643
10024
  txHash: txHash,
9644
10025
  ipId: ipId,
9645
10026
  licenseTermsIds: licenseTermsIds,
@@ -9649,13 +10030,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9649
10030
  maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
9650
10031
  }));
9651
10032
  case 7:
9652
- _context18.p = 7;
9653
- _t23 = _context18.v;
9654
- return _context18.a(2, handleError(_t23, "Failed to mint and register IP and attach PIL terms and distribute royalty tokens"));
10033
+ _context21.p = 7;
10034
+ _t27 = _context21.v;
10035
+ return _context21.a(2, handleError(_t27, "Failed to mint and register IP and attach PIL terms and distribute royalty tokens"));
9655
10036
  }
9656
- }, _callee18, this, [[0, 7]]);
10037
+ }, _callee21, this, [[0, 7]]);
9657
10038
  }));
9658
- function mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_x18) {
10039
+ function mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_x19) {
9659
10040
  return _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens.apply(this, arguments);
9660
10041
  }
9661
10042
  return mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens;
@@ -9669,14 +10050,14 @@ var IPAssetClient = /*#__PURE__*/function () {
9669
10050
  }, {
9670
10051
  key: "mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens",
9671
10052
  value: (function () {
9672
- var _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(request) {
9673
- var _this0 = this;
9674
- var _request$options9, _yield$transformRegis8, _transformRequest7, encodedTxData, contractCall, _t24;
9675
- return _regenerator().w(function (_context19) {
9676
- while (1) switch (_context19.n) {
10053
+ var _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(request) {
10054
+ var _this1 = this;
10055
+ var _request$options9, _yield$transformRegis8, _transformRequest7, encodedTxData, contractCall, _t28;
10056
+ return _regenerator().w(function (_context22) {
10057
+ while (1) switch (_context22.p = _context22.n) {
9677
10058
  case 0:
9678
- _context19.p = 0;
9679
- _context19.n = 1;
10059
+ _context22.p = 0;
10060
+ _context22.n = 1;
9680
10061
  return transformRegistrationRequest({
9681
10062
  request: request,
9682
10063
  rpcClient: this.rpcClient,
@@ -9684,13 +10065,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9684
10065
  chainId: this.chainId
9685
10066
  });
9686
10067
  case 1:
9687
- _yield$transformRegis8 = _context19.v;
10068
+ _yield$transformRegis8 = _context22.v;
9688
10069
  _transformRequest7 = _yield$transformRegis8.transformRequest;
9689
10070
  encodedTxData = this.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokensEncode(_transformRequest7);
9690
10071
  contractCall = function contractCall() {
9691
- return _this0.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_transformRequest7);
10072
+ return _this1.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_transformRequest7);
9692
10073
  };
9693
- _context19.n = 2;
10074
+ _context22.n = 2;
9694
10075
  return this.handleRegistrationWithFees({
9695
10076
  spgNftContract: _transformRequest7.spgNftContract,
9696
10077
  wipOptions: (_request$options9 = request.options) === null || _request$options9 === void 0 ? void 0 : _request$options9.wipOptions,
@@ -9702,15 +10083,15 @@ var IPAssetClient = /*#__PURE__*/function () {
9702
10083
  txOptions: request.txOptions
9703
10084
  });
9704
10085
  case 2:
9705
- return _context19.a(2, _context19.v);
10086
+ return _context22.a(2, _context22.v);
9706
10087
  case 3:
9707
- _context19.p = 3;
9708
- _t24 = _context19.v;
9709
- return _context19.a(2, handleError(_t24, "Failed to mint and register IP and make derivative and distribute royalty tokens"));
10088
+ _context22.p = 3;
10089
+ _t28 = _context22.v;
10090
+ return _context22.a(2, handleError(_t28, "Failed to mint and register IP and make derivative and distribute royalty tokens"));
9710
10091
  }
9711
- }, _callee19, this, [[0, 3]]);
10092
+ }, _callee22, this, [[0, 3]]);
9712
10093
  }));
9713
- function mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_x19) {
10094
+ function mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_x20) {
9714
10095
  return _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens.apply(this, arguments);
9715
10096
  }
9716
10097
  return mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens;
@@ -9718,12 +10099,12 @@ var IPAssetClient = /*#__PURE__*/function () {
9718
10099
  }, {
9719
10100
  key: "distributeRoyaltyTokens",
9720
10101
  value: function () {
9721
- var _distributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(request) {
10102
+ var _distributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(request) {
9722
10103
  var _yield$transferDistri, transformRequest, txHash;
9723
- return _regenerator().w(function (_context20) {
9724
- while (1) switch (_context20.n) {
10104
+ return _regenerator().w(function (_context23) {
10105
+ while (1) switch (_context23.n) {
9725
10106
  case 0:
9726
- _context20.n = 1;
10107
+ _context23.n = 1;
9727
10108
  return transferDistributeRoyaltyTokensRequest({
9728
10109
  request: request,
9729
10110
  rpcClient: this.rpcClient,
@@ -9731,22 +10112,22 @@ var IPAssetClient = /*#__PURE__*/function () {
9731
10112
  chainId: this.chainId
9732
10113
  });
9733
10114
  case 1:
9734
- _yield$transferDistri = _context20.v;
10115
+ _yield$transferDistri = _context23.v;
9735
10116
  transformRequest = _yield$transferDistri.transformRequest;
9736
- _context20.n = 2;
10117
+ _context23.n = 2;
9737
10118
  return this.royaltyTokenDistributionWorkflowsClient.distributeRoyaltyTokens(transformRequest);
9738
10119
  case 2:
9739
- txHash = _context20.v;
9740
- _context20.n = 3;
10120
+ txHash = _context23.v;
10121
+ _context23.n = 3;
9741
10122
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
9742
10123
  hash: txHash
9743
10124
  }));
9744
10125
  case 3:
9745
- return _context20.a(2, txHash);
10126
+ return _context23.a(2, txHash);
9746
10127
  }
9747
- }, _callee20, this);
10128
+ }, _callee23, this);
9748
10129
  }));
9749
- function distributeRoyaltyTokens(_x20) {
10130
+ function distributeRoyaltyTokens(_x21) {
9750
10131
  return _distributeRoyaltyTokens.apply(this, arguments);
9751
10132
  }
9752
10133
  return distributeRoyaltyTokens;
@@ -9754,20 +10135,20 @@ var IPAssetClient = /*#__PURE__*/function () {
9754
10135
  }, {
9755
10136
  key: "isRegistered",
9756
10137
  value: function () {
9757
- var _isRegistered = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(ipId) {
9758
- return _regenerator().w(function (_context21) {
9759
- while (1) switch (_context21.n) {
10138
+ var _isRegistered = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(ipId) {
10139
+ return _regenerator().w(function (_context24) {
10140
+ while (1) switch (_context24.n) {
9760
10141
  case 0:
9761
- _context21.n = 1;
10142
+ _context24.n = 1;
9762
10143
  return this.ipAssetRegistryClient.isRegistered({
9763
10144
  id: validateAddress(ipId)
9764
10145
  });
9765
10146
  case 1:
9766
- return _context21.a(2, _context21.v);
10147
+ return _context24.a(2, _context24.v);
9767
10148
  }
9768
- }, _callee21, this);
10149
+ }, _callee24, this);
9769
10150
  }));
9770
- function isRegistered(_x21) {
10151
+ function isRegistered(_x22) {
9771
10152
  return _isRegistered.apply(this, arguments);
9772
10153
  }
9773
10154
  return isRegistered;
@@ -9811,24 +10192,24 @@ var IPAssetClient = /*#__PURE__*/function () {
9811
10192
  }, {
9812
10193
  key: "batchRegisterIpAssetsWithOptimizedWorkflows",
9813
10194
  value: (function () {
9814
- var _batchRegisterIpAssetsWithOptimizedWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(request) {
9815
- 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;
9816
- return _regenerator().w(function (_context22) {
9817
- while (1) switch (_context22.n) {
10195
+ var _batchRegisterIpAssetsWithOptimizedWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(request) {
10196
+ var _request$options0, _request$options10, transferWorkflowRequests, _iterator6, _step6, req, res, royaltyDistributionRequests, _yield$handleMultical, txResponses, aggregateRegistrationRequest, responses, royaltyTokensDistributionRequests, _iterator7, _step7, _step7$value, txHash, receipt, iPRegisteredLog, ipRoyaltyVaultEvent, response, distributeRoyaltyTokensTxHashes, _request$options1, _yield$handleMultical2, txResponse, registrationResults, _t29, _t30, _t31;
10197
+ return _regenerator().w(function (_context25) {
10198
+ while (1) switch (_context25.p = _context25.n) {
9818
10199
  case 0:
9819
- _context22.p = 0;
10200
+ _context25.p = 0;
9820
10201
  // Transform requests into workflow format
9821
10202
  transferWorkflowRequests = [];
9822
- _iterator5 = _createForOfIteratorHelper(request.requests);
9823
- _context22.p = 1;
9824
- _iterator5.s();
10203
+ _iterator6 = _createForOfIteratorHelper(request.requests);
10204
+ _context25.p = 1;
10205
+ _iterator6.s();
9825
10206
  case 2:
9826
- if ((_step5 = _iterator5.n()).done) {
9827
- _context22.n = 5;
10207
+ if ((_step6 = _iterator6.n()).done) {
10208
+ _context25.n = 5;
9828
10209
  break;
9829
10210
  }
9830
- req = _step5.value;
9831
- _context22.n = 3;
10211
+ req = _step6.value;
10212
+ _context25.n = 3;
9832
10213
  return transformRegistrationRequest({
9833
10214
  request: req,
9834
10215
  rpcClient: this.rpcClient,
@@ -9836,22 +10217,22 @@ var IPAssetClient = /*#__PURE__*/function () {
9836
10217
  chainId: this.chainId
9837
10218
  });
9838
10219
  case 3:
9839
- res = _context22.v;
10220
+ res = _context25.v;
9840
10221
  transferWorkflowRequests.push(res);
9841
10222
  case 4:
9842
- _context22.n = 2;
10223
+ _context25.n = 2;
9843
10224
  break;
9844
10225
  case 5:
9845
- _context22.n = 7;
10226
+ _context25.n = 7;
9846
10227
  break;
9847
10228
  case 6:
9848
- _context22.p = 6;
9849
- _t25 = _context22.v;
9850
- _iterator5.e(_t25);
10229
+ _context25.p = 6;
10230
+ _t29 = _context25.v;
10231
+ _iterator6.e(_t29);
9851
10232
  case 7:
9852
- _context22.p = 7;
9853
- _iterator5.f();
9854
- return _context22.f(7);
10233
+ _context25.p = 7;
10234
+ _iterator6.f();
10235
+ return _context25.f(7);
9855
10236
  case 8:
9856
10237
  /**
9857
10238
  * Extract royalty distribution requests from workflow responses that contain royalty shares
@@ -9869,7 +10250,7 @@ var IPAssetClient = /*#__PURE__*/function () {
9869
10250
  deadline: res.extraData.deadline
9870
10251
  };
9871
10252
  }); // Process initial registration transactions
9872
- _context22.n = 9;
10253
+ _context25.n = 9;
9873
10254
  return handleMulticall({
9874
10255
  transferWorkflowRequests: transferWorkflowRequests,
9875
10256
  multicall3Address: this.multicall3Client.address,
@@ -9880,23 +10261,23 @@ var IPAssetClient = /*#__PURE__*/function () {
9880
10261
  chainId: this.chainId
9881
10262
  });
9882
10263
  case 9:
9883
- _yield$handleMultical = _context22.v;
10264
+ _yield$handleMultical = _context25.v;
9884
10265
  txResponses = _yield$handleMultical.response;
9885
10266
  aggregateRegistrationRequest = _yield$handleMultical.aggregateRegistrationRequest;
9886
10267
  responses = [];
9887
10268
  royaltyTokensDistributionRequests = []; // Process each transaction response
9888
- _iterator6 = _createForOfIteratorHelper(txResponses);
9889
- _context22.p = 10;
9890
- _iterator6.s();
10269
+ _iterator7 = _createForOfIteratorHelper(txResponses);
10270
+ _context25.p = 10;
10271
+ _iterator7.s();
9891
10272
  case 11:
9892
- if ((_step6 = _iterator6.n()).done) {
9893
- _context22.n = 14;
10273
+ if ((_step7 = _iterator7.n()).done) {
10274
+ _context25.n = 14;
9894
10275
  break;
9895
10276
  }
9896
- _step6$value = _step6.value, txHash = _step6$value.txHash, receipt = _step6$value.receipt;
10277
+ _step7$value = _step7.value, txHash = _step7$value.txHash, receipt = _step7$value.receipt;
9897
10278
  iPRegisteredLog = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(receipt);
9898
10279
  ipRoyaltyVaultEvent = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt); // Prepare royalty distribution if needed
9899
- _context22.n = 12;
10280
+ _context25.n = 12;
9900
10281
  return prepareRoyaltyTokensDistributionRequests({
9901
10282
  royaltyDistributionRequests: royaltyDistributionRequests,
9902
10283
  ipRegisteredLog: iPRegisteredLog,
@@ -9906,7 +10287,7 @@ var IPAssetClient = /*#__PURE__*/function () {
9906
10287
  chainId: this.chainId
9907
10288
  });
9908
10289
  case 12:
9909
- response = _context22.v;
10290
+ response = _context25.v;
9910
10291
  royaltyTokensDistributionRequests.push.apply(royaltyTokensDistributionRequests, _toConsumableArray(response));
9911
10292
  responses.push({
9912
10293
  txHash: txHash,
@@ -9919,25 +10300,25 @@ var IPAssetClient = /*#__PURE__*/function () {
9919
10300
  })
9920
10301
  });
9921
10302
  case 13:
9922
- _context22.n = 11;
10303
+ _context25.n = 11;
9923
10304
  break;
9924
10305
  case 14:
9925
- _context22.n = 16;
10306
+ _context25.n = 16;
9926
10307
  break;
9927
10308
  case 15:
9928
- _context22.p = 15;
9929
- _t26 = _context22.v;
9930
- _iterator6.e(_t26);
10309
+ _context25.p = 15;
10310
+ _t30 = _context25.v;
10311
+ _iterator7.e(_t30);
9931
10312
  case 16:
9932
- _context22.p = 16;
9933
- _iterator6.f();
9934
- return _context22.f(16);
10313
+ _context25.p = 16;
10314
+ _iterator7.f();
10315
+ return _context25.f(16);
9935
10316
  case 17:
9936
10317
  if (!(royaltyTokensDistributionRequests.length > 0)) {
9937
- _context22.n = 19;
10318
+ _context25.n = 19;
9938
10319
  break;
9939
10320
  }
9940
- _context22.n = 18;
10321
+ _context25.n = 18;
9941
10322
  return handleMulticall({
9942
10323
  transferWorkflowRequests: royaltyTokensDistributionRequests,
9943
10324
  multicall3Address: this.multicall3Client.address,
@@ -9948,29 +10329,29 @@ var IPAssetClient = /*#__PURE__*/function () {
9948
10329
  chainId: this.chainId
9949
10330
  });
9950
10331
  case 18:
9951
- _yield$handleMultical2 = _context22.v;
10332
+ _yield$handleMultical2 = _context25.v;
9952
10333
  txResponse = _yield$handleMultical2.response;
9953
10334
  distributeRoyaltyTokensTxHashes = txResponse.map(function (tx) {
9954
10335
  return tx.txHash;
9955
10336
  });
9956
10337
  case 19:
9957
- _context22.n = 20;
10338
+ _context25.n = 20;
9958
10339
  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);
9959
10340
  case 20:
9960
- registrationResults = _context22.v;
9961
- return _context22.a(2, _objectSpread2({
10341
+ registrationResults = _context25.v;
10342
+ return _context25.a(2, _objectSpread2({
9962
10343
  registrationResults: registrationResults
9963
10344
  }, distributeRoyaltyTokensTxHashes && {
9964
10345
  distributeRoyaltyTokensTxHashes: distributeRoyaltyTokensTxHashes
9965
10346
  }));
9966
10347
  case 21:
9967
- _context22.p = 21;
9968
- _t27 = _context22.v;
9969
- return _context22.a(2, handleError(_t27, "Failed to batch register IP assets with optimized workflows"));
10348
+ _context25.p = 21;
10349
+ _t31 = _context25.v;
10350
+ return _context25.a(2, handleError(_t31, "Failed to batch register IP assets with optimized workflows"));
9970
10351
  }
9971
- }, _callee22, this, [[10, 15, 16, 17], [1, 6, 7, 8], [0, 21]]);
10352
+ }, _callee25, this, [[10, 15, 16, 17], [1, 6, 7, 8], [0, 21]]);
9972
10353
  }));
9973
- function batchRegisterIpAssetsWithOptimizedWorkflows(_x22) {
10354
+ function batchRegisterIpAssetsWithOptimizedWorkflows(_x23) {
9974
10355
  return _batchRegisterIpAssetsWithOptimizedWorkflows.apply(this, arguments);
9975
10356
  }
9976
10357
  return batchRegisterIpAssetsWithOptimizedWorkflows;
@@ -9978,48 +10359,48 @@ var IPAssetClient = /*#__PURE__*/function () {
9978
10359
  }, {
9979
10360
  key: "getLicenseTermsId",
9980
10361
  value: function () {
9981
- var _getLicenseTermsId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(licenseTerms) {
9982
- var licenseTermsIds, _iterator7, _step7, licenseTerm, licenseRes, _t28;
9983
- return _regenerator().w(function (_context23) {
9984
- while (1) switch (_context23.n) {
10362
+ var _getLicenseTermsId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(licenseTerms) {
10363
+ var licenseTermsIds, _iterator8, _step8, licenseTerm, licenseRes, _t32;
10364
+ return _regenerator().w(function (_context26) {
10365
+ while (1) switch (_context26.p = _context26.n) {
9985
10366
  case 0:
9986
10367
  licenseTermsIds = [];
9987
- _iterator7 = _createForOfIteratorHelper(licenseTerms);
9988
- _context23.p = 1;
9989
- _iterator7.s();
10368
+ _iterator8 = _createForOfIteratorHelper(licenseTerms);
10369
+ _context26.p = 1;
10370
+ _iterator8.s();
9990
10371
  case 2:
9991
- if ((_step7 = _iterator7.n()).done) {
9992
- _context23.n = 5;
10372
+ if ((_step8 = _iterator8.n()).done) {
10373
+ _context26.n = 5;
9993
10374
  break;
9994
10375
  }
9995
- licenseTerm = _step7.value;
9996
- _context23.n = 3;
10376
+ licenseTerm = _step8.value;
10377
+ _context26.n = 3;
9997
10378
  return this.licenseTemplateClient.getLicenseTermsId({
9998
10379
  terms: licenseTerm
9999
10380
  });
10000
10381
  case 3:
10001
- licenseRes = _context23.v;
10382
+ licenseRes = _context26.v;
10002
10383
  licenseTermsIds.push(licenseRes.selectedLicenseTermsId);
10003
10384
  case 4:
10004
- _context23.n = 2;
10385
+ _context26.n = 2;
10005
10386
  break;
10006
10387
  case 5:
10007
- _context23.n = 7;
10388
+ _context26.n = 7;
10008
10389
  break;
10009
10390
  case 6:
10010
- _context23.p = 6;
10011
- _t28 = _context23.v;
10012
- _iterator7.e(_t28);
10391
+ _context26.p = 6;
10392
+ _t32 = _context26.v;
10393
+ _iterator8.e(_t32);
10013
10394
  case 7:
10014
- _context23.p = 7;
10015
- _iterator7.f();
10016
- return _context23.f(7);
10395
+ _context26.p = 7;
10396
+ _iterator8.f();
10397
+ return _context26.f(7);
10017
10398
  case 8:
10018
- return _context23.a(2, licenseTermsIds);
10399
+ return _context26.a(2, licenseTermsIds);
10019
10400
  }
10020
- }, _callee23, this, [[1, 6, 7, 8]]);
10401
+ }, _callee26, this, [[1, 6, 7, 8]]);
10021
10402
  }));
10022
- function getLicenseTermsId(_x23) {
10403
+ function getLicenseTermsId(_x24) {
10023
10404
  return _getLicenseTermsId.apply(this, arguments);
10024
10405
  }
10025
10406
  return getLicenseTermsId;
@@ -10027,13 +10408,13 @@ var IPAssetClient = /*#__PURE__*/function () {
10027
10408
  }, {
10028
10409
  key: "validateLicenseTokenIds",
10029
10410
  value: function () {
10030
- var _validateLicenseTokenIds = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(licenseTokenIds) {
10031
- var newLicenseTokenIds, _iterator8, _step8, licenseTokenId, tokenOwnerAddress, _t29;
10032
- return _regenerator().w(function (_context24) {
10033
- while (1) switch (_context24.n) {
10411
+ var _validateLicenseTokenIds = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(licenseTokenIds) {
10412
+ var newLicenseTokenIds, _iterator9, _step9, licenseTokenId, tokenOwnerAddress, _t33;
10413
+ return _regenerator().w(function (_context27) {
10414
+ while (1) switch (_context27.p = _context27.n) {
10034
10415
  case 0:
10035
10416
  if (!(licenseTokenIds.length === 0)) {
10036
- _context24.n = 1;
10417
+ _context27.n = 1;
10037
10418
  break;
10038
10419
  }
10039
10420
  throw new Error("License token IDs must be provided.");
@@ -10041,46 +10422,46 @@ var IPAssetClient = /*#__PURE__*/function () {
10041
10422
  newLicenseTokenIds = licenseTokenIds.map(function (id) {
10042
10423
  return BigInt(id);
10043
10424
  });
10044
- _iterator8 = _createForOfIteratorHelper(newLicenseTokenIds);
10045
- _context24.p = 2;
10046
- _iterator8.s();
10425
+ _iterator9 = _createForOfIteratorHelper(newLicenseTokenIds);
10426
+ _context27.p = 2;
10427
+ _iterator9.s();
10047
10428
  case 3:
10048
- if ((_step8 = _iterator8.n()).done) {
10049
- _context24.n = 6;
10429
+ if ((_step9 = _iterator9.n()).done) {
10430
+ _context27.n = 6;
10050
10431
  break;
10051
10432
  }
10052
- licenseTokenId = _step8.value;
10053
- _context24.n = 4;
10433
+ licenseTokenId = _step9.value;
10434
+ _context27.n = 4;
10054
10435
  return this.licenseTokenReadOnlyClient.ownerOf({
10055
10436
  tokenId: licenseTokenId
10056
10437
  });
10057
10438
  case 4:
10058
- tokenOwnerAddress = _context24.v;
10439
+ tokenOwnerAddress = _context27.v;
10059
10440
  if (tokenOwnerAddress) {
10060
- _context24.n = 5;
10441
+ _context27.n = 5;
10061
10442
  break;
10062
10443
  }
10063
10444
  throw new Error("License token id ".concat(licenseTokenId, " must be owned by the caller."));
10064
10445
  case 5:
10065
- _context24.n = 3;
10446
+ _context27.n = 3;
10066
10447
  break;
10067
10448
  case 6:
10068
- _context24.n = 8;
10449
+ _context27.n = 8;
10069
10450
  break;
10070
10451
  case 7:
10071
- _context24.p = 7;
10072
- _t29 = _context24.v;
10073
- _iterator8.e(_t29);
10452
+ _context27.p = 7;
10453
+ _t33 = _context27.v;
10454
+ _iterator9.e(_t33);
10074
10455
  case 8:
10075
- _context24.p = 8;
10076
- _iterator8.f();
10077
- return _context24.f(8);
10456
+ _context27.p = 8;
10457
+ _iterator9.f();
10458
+ return _context27.f(8);
10078
10459
  case 9:
10079
- return _context24.a(2, newLicenseTokenIds);
10460
+ return _context27.a(2, newLicenseTokenIds);
10080
10461
  }
10081
- }, _callee24, this, [[2, 7, 8, 9]]);
10462
+ }, _callee27, this, [[2, 7, 8, 9]]);
10082
10463
  }));
10083
- function validateLicenseTokenIds(_x24) {
10464
+ function validateLicenseTokenIds(_x25) {
10084
10465
  return _validateLicenseTokenIds.apply(this, arguments);
10085
10466
  }
10086
10467
  return validateLicenseTokenIds;
@@ -10103,28 +10484,28 @@ var IPAssetClient = /*#__PURE__*/function () {
10103
10484
  }, {
10104
10485
  key: "handleRegistrationWithFees",
10105
10486
  value: function () {
10106
- var _handleRegistrationWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(_ref3) {
10487
+ var _handleRegistrationWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(_ref5) {
10107
10488
  var _wipOptions$useMultic, _this$getIpIdAndToken, _event$ipId, _event$tokenId;
10108
10489
  var sender, derivData, spgNftContract, spgSpenderAddress, txOptions, wipOptions, encodedTxs, contractCall, totalFees, wipSpenders, useMulticallWhenPossible, nftMintFee, publicMinting, totalDerivativeMintingFee, _yield$contractCallWi, txHash, receipt, event;
10109
- return _regenerator().w(function (_context25) {
10110
- while (1) switch (_context25.n) {
10490
+ return _regenerator().w(function (_context28) {
10491
+ while (1) switch (_context28.n) {
10111
10492
  case 0:
10112
- sender = _ref3.sender, derivData = _ref3.derivData, spgNftContract = _ref3.spgNftContract, spgSpenderAddress = _ref3.spgSpenderAddress, txOptions = _ref3.txOptions, wipOptions = _ref3.wipOptions, encodedTxs = _ref3.encodedTxs, contractCall = _ref3.contractCall;
10493
+ sender = _ref5.sender, derivData = _ref5.derivData, spgNftContract = _ref5.spgNftContract, spgSpenderAddress = _ref5.spgSpenderAddress, txOptions = _ref5.txOptions, wipOptions = _ref5.wipOptions, encodedTxs = _ref5.encodedTxs, contractCall = _ref5.contractCall;
10113
10494
  totalFees = 0n;
10114
10495
  wipSpenders = [];
10115
10496
  useMulticallWhenPossible = (_wipOptions$useMultic = wipOptions === null || wipOptions === void 0 ? void 0 : wipOptions.useMulticallWhenPossible) !== null && _wipOptions$useMultic !== void 0 ? _wipOptions$useMultic : true; // get spg minting fee
10116
10497
  if (!spgNftContract) {
10117
- _context25.n = 3;
10498
+ _context28.n = 3;
10118
10499
  break;
10119
10500
  }
10120
- _context25.n = 1;
10501
+ _context28.n = 1;
10121
10502
  return calculateSPGWipMintFee(new SpgnftImplReadOnlyClient(this.rpcClient, spgNftContract));
10122
10503
  case 1:
10123
- nftMintFee = _context25.v;
10124
- _context25.n = 2;
10504
+ nftMintFee = _context28.v;
10505
+ _context28.n = 2;
10125
10506
  return getPublicMinting(spgNftContract, this.rpcClient);
10126
10507
  case 2:
10127
- publicMinting = _context25.v;
10508
+ publicMinting = _context28.v;
10128
10509
  /**
10129
10510
  * If the SPG NFT contract's public minting is disabled, we need to check if the caller has the `minter role`.
10130
10511
  * When public minting is disabled, we can't use multicall because we need to perform additional role checks
@@ -10143,10 +10524,10 @@ var IPAssetClient = /*#__PURE__*/function () {
10143
10524
  });
10144
10525
  case 3:
10145
10526
  if (!derivData) {
10146
- _context25.n = 5;
10527
+ _context28.n = 5;
10147
10528
  break;
10148
10529
  }
10149
- _context25.n = 4;
10530
+ _context28.n = 4;
10150
10531
  return calculateDerivativeMintingFee({
10151
10532
  derivData: derivData,
10152
10533
  rpcClient: this.rpcClient,
@@ -10155,7 +10536,7 @@ var IPAssetClient = /*#__PURE__*/function () {
10155
10536
  sender: sender
10156
10537
  });
10157
10538
  case 4:
10158
- totalDerivativeMintingFee = _context25.v;
10539
+ totalDerivativeMintingFee = _context28.v;
10159
10540
  totalFees += totalDerivativeMintingFee;
10160
10541
  if (totalDerivativeMintingFee > 0) {
10161
10542
  wipSpenders.push({
@@ -10165,12 +10546,12 @@ var IPAssetClient = /*#__PURE__*/function () {
10165
10546
  }
10166
10547
  case 5:
10167
10548
  if (!(totalFees < 0)) {
10168
- _context25.n = 6;
10549
+ _context28.n = 6;
10169
10550
  break;
10170
10551
  }
10171
10552
  throw new Error("Total fees for registering derivative should never be negative: ".concat(totalFees));
10172
10553
  case 6:
10173
- _context25.n = 7;
10554
+ _context28.n = 7;
10174
10555
  return contractCallWithFees({
10175
10556
  totalFees: totalFees,
10176
10557
  options: {
@@ -10188,11 +10569,11 @@ var IPAssetClient = /*#__PURE__*/function () {
10188
10569
  encodedTxs: encodedTxs
10189
10570
  });
10190
10571
  case 7:
10191
- _yield$contractCallWi = _context25.v;
10572
+ _yield$contractCallWi = _context28.v;
10192
10573
  txHash = _yield$contractCallWi.txHash;
10193
10574
  receipt = _yield$contractCallWi.receipt;
10194
10575
  event = (_this$getIpIdAndToken = this.getIpIdAndTokenIdsFromEvent(receipt)) === null || _this$getIpIdAndToken === void 0 ? void 0 : _this$getIpIdAndToken[0];
10195
- return _context25.a(2, _objectSpread2({
10576
+ return _context28.a(2, _objectSpread2({
10196
10577
  txHash: txHash,
10197
10578
  receipt: receipt
10198
10579
  }, event && {
@@ -10200,9 +10581,9 @@ var IPAssetClient = /*#__PURE__*/function () {
10200
10581
  tokenId: (_event$tokenId = event.tokenId) !== null && _event$tokenId !== void 0 ? _event$tokenId : undefined
10201
10582
  }));
10202
10583
  }
10203
- }, _callee25, this);
10584
+ }, _callee28, this);
10204
10585
  }));
10205
- function handleRegistrationWithFees(_x25) {
10586
+ function handleRegistrationWithFees(_x26) {
10206
10587
  return _handleRegistrationWithFees.apply(this, arguments);
10207
10588
  }
10208
10589
  return handleRegistrationWithFees;
@@ -10210,27 +10591,27 @@ var IPAssetClient = /*#__PURE__*/function () {
10210
10591
  }, {
10211
10592
  key: "setMaxLicenseTokens",
10212
10593
  value: function () {
10213
- var _setMaxLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(_ref4) {
10594
+ var _setMaxLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(_ref6) {
10214
10595
  var maxLicenseTokensData, licensorIpId, licenseTermsIds, licenseTermsMaxLimitTxHashes, i, maxLicenseTokens, txHash;
10215
- return _regenerator().w(function (_context26) {
10216
- while (1) switch (_context26.n) {
10596
+ return _regenerator().w(function (_context29) {
10597
+ while (1) switch (_context29.n) {
10217
10598
  case 0:
10218
- maxLicenseTokensData = _ref4.maxLicenseTokensData, licensorIpId = _ref4.licensorIpId, licenseTermsIds = _ref4.licenseTermsIds;
10599
+ maxLicenseTokensData = _ref6.maxLicenseTokensData, licensorIpId = _ref6.licensorIpId, licenseTermsIds = _ref6.licenseTermsIds;
10219
10600
  licenseTermsMaxLimitTxHashes = [];
10220
10601
  i = 0;
10221
10602
  case 1:
10222
10603
  if (!(i < maxLicenseTokensData.length)) {
10223
- _context26.n = 5;
10604
+ _context29.n = 5;
10224
10605
  break;
10225
10606
  }
10226
10607
  maxLicenseTokens = maxLicenseTokensData[i].maxLicenseTokens;
10227
10608
  if (!(maxLicenseTokens === undefined || maxLicenseTokens < 0n)) {
10228
- _context26.n = 2;
10609
+ _context29.n = 2;
10229
10610
  break;
10230
10611
  }
10231
- return _context26.a(3, 4);
10612
+ return _context29.a(3, 4);
10232
10613
  case 2:
10233
- _context26.n = 3;
10614
+ _context29.n = 3;
10234
10615
  return this.totalLicenseTokenLimitHookClient.setTotalLicenseTokenLimit({
10235
10616
  licensorIpId: licensorIpId,
10236
10617
  // The contract now directly writes the `licenseTemplate` address internally,
@@ -10240,20 +10621,20 @@ var IPAssetClient = /*#__PURE__*/function () {
10240
10621
  limit: BigInt(maxLicenseTokens)
10241
10622
  });
10242
10623
  case 3:
10243
- txHash = _context26.v;
10624
+ txHash = _context29.v;
10244
10625
  if (txHash) {
10245
10626
  licenseTermsMaxLimitTxHashes.push(txHash);
10246
10627
  }
10247
10628
  case 4:
10248
10629
  i++;
10249
- _context26.n = 1;
10630
+ _context29.n = 1;
10250
10631
  break;
10251
10632
  case 5:
10252
- return _context26.a(2, licenseTermsMaxLimitTxHashes);
10633
+ return _context29.a(2, licenseTermsMaxLimitTxHashes);
10253
10634
  }
10254
- }, _callee26, this);
10635
+ }, _callee29, this);
10255
10636
  }));
10256
- function setMaxLicenseTokens(_x26) {
10637
+ function setMaxLicenseTokens(_x27) {
10257
10638
  return _setMaxLicenseTokens.apply(this, arguments);
10258
10639
  }
10259
10640
  return setMaxLicenseTokens;
@@ -10264,69 +10645,69 @@ var IPAssetClient = /*#__PURE__*/function () {
10264
10645
  }, {
10265
10646
  key: "processResponses",
10266
10647
  value: (function () {
10267
- var _processResponses = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(responses, aggregateRegistrationRequest, useMulticall) {
10268
- 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;
10269
- return _regenerator().w(function (_context27) {
10270
- while (1) switch (_context27.n) {
10648
+ var _processResponses = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30(responses, aggregateRegistrationRequest, useMulticall) {
10649
+ var _iterator0, _step0, _step0$value, responseIndex, response, _iterator1, _step1, _Object$values$respon, _step1$value, assetIndex, ipAsset, extraData, result, _extraData, i, _response, extraDataItem, _ipAsset, _t34, _t35;
10650
+ return _regenerator().w(function (_context30) {
10651
+ while (1) switch (_context30.p = _context30.n) {
10271
10652
  case 0:
10272
10653
  if (!useMulticall) {
10273
- _context27.n = 15;
10654
+ _context30.n = 15;
10274
10655
  break;
10275
10656
  }
10276
- _iterator9 = _createForOfIteratorHelper(responses.entries());
10277
- _context27.p = 1;
10278
- _iterator9.s();
10657
+ _iterator0 = _createForOfIteratorHelper(responses.entries());
10658
+ _context30.p = 1;
10659
+ _iterator0.s();
10279
10660
  case 2:
10280
- if ((_step9 = _iterator9.n()).done) {
10281
- _context27.n = 11;
10661
+ if ((_step0 = _iterator0.n()).done) {
10662
+ _context30.n = 11;
10282
10663
  break;
10283
10664
  }
10284
- _step9$value = _slicedToArray(_step9.value, 2), responseIndex = _step9$value[0], response = _step9$value[1];
10285
- _iterator0 = _createForOfIteratorHelper(response.ipAssetsWithLicenseTerms.entries());
10286
- _context27.p = 3;
10287
- _iterator0.s();
10665
+ _step0$value = _slicedToArray(_step0.value, 2), responseIndex = _step0$value[0], response = _step0$value[1];
10666
+ _iterator1 = _createForOfIteratorHelper(response.ipAssetsWithLicenseTerms.entries());
10667
+ _context30.p = 3;
10668
+ _iterator1.s();
10288
10669
  case 4:
10289
- if ((_step0 = _iterator0.n()).done) {
10290
- _context27.n = 7;
10670
+ if ((_step1 = _iterator1.n()).done) {
10671
+ _context30.n = 7;
10291
10672
  break;
10292
10673
  }
10293
- _step0$value = _slicedToArray(_step0.value, 2), assetIndex = _step0$value[0], ipAsset = _step0$value[1];
10674
+ _step1$value = _slicedToArray(_step1.value, 2), assetIndex = _step1$value[0], ipAsset = _step1$value[1];
10294
10675
  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];
10295
- _context27.n = 5;
10676
+ _context30.n = 5;
10296
10677
  return this.processIpAssetLicenseTerms(ipAsset, extraData);
10297
10678
  case 5:
10298
- result = _context27.v;
10679
+ result = _context30.v;
10299
10680
  responses[responseIndex].ipAssetsWithLicenseTerms[assetIndex] = result;
10300
10681
  case 6:
10301
- _context27.n = 4;
10682
+ _context30.n = 4;
10302
10683
  break;
10303
10684
  case 7:
10304
- _context27.n = 9;
10685
+ _context30.n = 9;
10305
10686
  break;
10306
10687
  case 8:
10307
- _context27.p = 8;
10308
- _t30 = _context27.v;
10309
- _iterator0.e(_t30);
10688
+ _context30.p = 8;
10689
+ _t34 = _context30.v;
10690
+ _iterator1.e(_t34);
10310
10691
  case 9:
10311
- _context27.p = 9;
10312
- _iterator0.f();
10313
- return _context27.f(9);
10692
+ _context30.p = 9;
10693
+ _iterator1.f();
10694
+ return _context30.f(9);
10314
10695
  case 10:
10315
- _context27.n = 2;
10696
+ _context30.n = 2;
10316
10697
  break;
10317
10698
  case 11:
10318
- _context27.n = 13;
10699
+ _context30.n = 13;
10319
10700
  break;
10320
10701
  case 12:
10321
- _context27.p = 12;
10322
- _t31 = _context27.v;
10323
- _iterator9.e(_t31);
10702
+ _context30.p = 12;
10703
+ _t35 = _context30.v;
10704
+ _iterator0.e(_t35);
10324
10705
  case 13:
10325
- _context27.p = 13;
10326
- _iterator9.f();
10327
- return _context27.f(13);
10706
+ _context30.p = 13;
10707
+ _iterator0.f();
10708
+ return _context30.f(13);
10328
10709
  case 14:
10329
- _context27.n = 19;
10710
+ _context30.n = 19;
10330
10711
  break;
10331
10712
  case 15:
10332
10713
  _extraData = [];
@@ -10337,26 +10718,26 @@ var IPAssetClient = /*#__PURE__*/function () {
10337
10718
  i = 0;
10338
10719
  case 16:
10339
10720
  if (!(i < responses.length)) {
10340
- _context27.n = 19;
10721
+ _context30.n = 19;
10341
10722
  break;
10342
10723
  }
10343
10724
  _response = responses[i];
10344
10725
  extraDataItem = _extraData[i];
10345
- _context27.n = 17;
10726
+ _context30.n = 17;
10346
10727
  return this.processIpAssetLicenseTerms(_response.ipAssetsWithLicenseTerms[0], extraDataItem);
10347
10728
  case 17:
10348
- _ipAsset = _context27.v;
10729
+ _ipAsset = _context30.v;
10349
10730
  responses[i].ipAssetsWithLicenseTerms[0] = _ipAsset;
10350
10731
  case 18:
10351
10732
  i++;
10352
- _context27.n = 16;
10733
+ _context30.n = 16;
10353
10734
  break;
10354
10735
  case 19:
10355
- return _context27.a(2, responses);
10736
+ return _context30.a(2, responses);
10356
10737
  }
10357
- }, _callee27, this, [[3, 8, 9, 10], [1, 12, 13, 14]]);
10738
+ }, _callee30, this, [[3, 8, 9, 10], [1, 12, 13, 14]]);
10358
10739
  }));
10359
- function processResponses(_x27, _x28, _x29) {
10740
+ function processResponses(_x28, _x29, _x30) {
10360
10741
  return _processResponses.apply(this, arguments);
10361
10742
  }
10362
10743
  return processResponses;
@@ -10364,31 +10745,31 @@ var IPAssetClient = /*#__PURE__*/function () {
10364
10745
  }, {
10365
10746
  key: "processIpAssetLicenseTerms",
10366
10747
  value: function () {
10367
- var _processIpAssetLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(ipAsset, extraData) {
10748
+ var _processIpAssetLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(ipAsset, extraData) {
10368
10749
  var _extraData$licenseTer;
10369
10750
  var licenseTermsIds, maxLicenseTokens, maxLicenseTokensData, maxLicenseTokensTxHashes;
10370
- return _regenerator().w(function (_context28) {
10371
- while (1) switch (_context28.n) {
10751
+ return _regenerator().w(function (_context31) {
10752
+ while (1) switch (_context31.n) {
10372
10753
  case 0:
10373
10754
  if (extraData !== null && extraData !== void 0 && (_extraData$licenseTer = extraData.licenseTermsData) !== null && _extraData$licenseTer !== void 0 && _extraData$licenseTer.length) {
10374
- _context28.n = 1;
10755
+ _context31.n = 1;
10375
10756
  break;
10376
10757
  }
10377
- return _context28.a(2, ipAsset);
10758
+ return _context31.a(2, ipAsset);
10378
10759
  case 1:
10379
- _context28.n = 2;
10760
+ _context31.n = 2;
10380
10761
  return this.getLicenseTermsId(extraData.licenseTermsData.map(function (item) {
10381
10762
  return item.terms;
10382
10763
  }));
10383
10764
  case 2:
10384
- licenseTermsIds = _context28.v;
10765
+ licenseTermsIds = _context31.v;
10385
10766
  ipAsset.licenseTermsIds = licenseTermsIds;
10386
10767
  maxLicenseTokens = extraData.maxLicenseTokens;
10387
10768
  if (maxLicenseTokens !== null && maxLicenseTokens !== void 0 && maxLicenseTokens.length) {
10388
- _context28.n = 3;
10769
+ _context31.n = 3;
10389
10770
  break;
10390
10771
  }
10391
- return _context28.a(2, ipAsset);
10772
+ return _context31.a(2, ipAsset);
10392
10773
  case 3:
10393
10774
  maxLicenseTokensData = maxLicenseTokens.filter(function (maxLicenseToken) {
10394
10775
  return maxLicenseToken !== undefined;
@@ -10397,22 +10778,22 @@ var IPAssetClient = /*#__PURE__*/function () {
10397
10778
  maxLicenseTokens: maxLicenseToken
10398
10779
  };
10399
10780
  });
10400
- _context28.n = 4;
10781
+ _context31.n = 4;
10401
10782
  return this.setMaxLicenseTokens({
10402
10783
  maxLicenseTokensData: maxLicenseTokensData,
10403
10784
  licensorIpId: ipAsset.ipId,
10404
10785
  licenseTermsIds: licenseTermsIds
10405
10786
  });
10406
10787
  case 4:
10407
- maxLicenseTokensTxHashes = _context28.v;
10788
+ maxLicenseTokensTxHashes = _context31.v;
10408
10789
  if (maxLicenseTokensTxHashes !== null && maxLicenseTokensTxHashes !== void 0 && maxLicenseTokensTxHashes.length) {
10409
10790
  ipAsset.maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
10410
10791
  }
10411
- return _context28.a(2, ipAsset);
10792
+ return _context31.a(2, ipAsset);
10412
10793
  }
10413
- }, _callee28, this);
10794
+ }, _callee31, this);
10414
10795
  }));
10415
- function processIpAssetLicenseTerms(_x30, _x31) {
10796
+ function processIpAssetLicenseTerms(_x31, _x32) {
10416
10797
  return _processIpAssetLicenseTerms.apply(this, arguments);
10417
10798
  }
10418
10799
  return processIpAssetLicenseTerms;
@@ -10447,37 +10828,22 @@ var LicenseClient = /*#__PURE__*/function () {
10447
10828
  key: "registerPILTerms",
10448
10829
  value: (function () {
10449
10830
  var _registerPILTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request) {
10450
- var object, licenseTermsId, _t;
10831
+ var object, _t;
10451
10832
  return _regenerator().w(function (_context) {
10452
- while (1) switch (_context.n) {
10833
+ while (1) switch (_context.p = _context.n) {
10453
10834
  case 0:
10454
10835
  _context.p = 0;
10836
+ object = PILFlavor.validateLicenseTerms(request, this.chainId);
10455
10837
  _context.n = 1;
10456
- return validateLicenseTerms(request, this.rpcClient);
10457
- case 1:
10458
- object = _context.v;
10459
- _context.n = 2;
10460
- return this.getLicenseTermsId(object);
10461
- case 2:
10462
- licenseTermsId = _context.v;
10463
- if (!(licenseTermsId !== 0n)) {
10464
- _context.n = 3;
10465
- break;
10466
- }
10467
- return _context.a(2, {
10468
- licenseTermsId: licenseTermsId
10469
- });
10470
- case 3:
10471
- _context.n = 4;
10472
10838
  return this.registerPILTermsHelper(object, request.txOptions);
10473
- case 4:
10839
+ case 1:
10474
10840
  return _context.a(2, _context.v);
10475
- case 5:
10476
- _context.p = 5;
10841
+ case 2:
10842
+ _context.p = 2;
10477
10843
  _t = _context.v;
10478
10844
  return _context.a(2, handleError(_t, "Failed to register license terms"));
10479
10845
  }
10480
- }, _callee, this, [[0, 5]]);
10846
+ }, _callee, this, [[0, 2]]);
10481
10847
  }));
10482
10848
  function registerPILTerms(_x) {
10483
10849
  return _registerPILTerms.apply(this, arguments);
@@ -10485,6 +10851,9 @@ var LicenseClient = /*#__PURE__*/function () {
10485
10851
  return registerPILTerms;
10486
10852
  }()
10487
10853
  /**
10854
+ * @deprecated Use {@link PILFlavor.nonCommercialSocialRemixing} with {@link LicenseClient.registerPILTerms} instead.
10855
+ * The method will be removed in the `v1.4.0`.
10856
+ *
10488
10857
  * Convenient function to register a PIL non commercial social remix license to the registry
10489
10858
  *
10490
10859
  * For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%231%3A-non-commercial-social-remixing | Non Commercial Social Remixing}.
@@ -10498,10 +10867,10 @@ var LicenseClient = /*#__PURE__*/function () {
10498
10867
  var _registerNonComSocialRemixingPIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(request) {
10499
10868
  var licenseTerms, _t2;
10500
10869
  return _regenerator().w(function (_context2) {
10501
- while (1) switch (_context2.n) {
10870
+ while (1) switch (_context2.p = _context2.n) {
10502
10871
  case 0:
10503
10872
  _context2.p = 0;
10504
- licenseTerms = getLicenseTermByType(PIL_TYPE.NON_COMMERCIAL_REMIX);
10873
+ licenseTerms = PILFlavor.nonCommercialSocialRemixing();
10505
10874
  _context2.n = 1;
10506
10875
  return this.registerPILTermsHelper(licenseTerms, request === null || request === void 0 ? void 0 : request.txOptions);
10507
10876
  case 1:
@@ -10519,6 +10888,9 @@ var LicenseClient = /*#__PURE__*/function () {
10519
10888
  return registerNonComSocialRemixingPIL;
10520
10889
  }()
10521
10890
  /**
10891
+ * @deprecated Use {@link PILFlavor.commercialUse} with {@link LicenseClient.registerPILTerms} instead.
10892
+ * The method will be removed in the `v1.4.0`.
10893
+ *
10522
10894
  * Convenient function to register a PIL commercial use license to the registry.
10523
10895
  *
10524
10896
  * For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%232%3A-commercial-use | Commercial Use}.
@@ -10532,13 +10904,13 @@ var LicenseClient = /*#__PURE__*/function () {
10532
10904
  var _registerCommercialUsePIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(request) {
10533
10905
  var licenseTerms, _t3;
10534
10906
  return _regenerator().w(function (_context3) {
10535
- while (1) switch (_context3.n) {
10907
+ while (1) switch (_context3.p = _context3.n) {
10536
10908
  case 0:
10537
10909
  _context3.p = 0;
10538
- licenseTerms = getLicenseTermByType(PIL_TYPE.COMMERCIAL_USE, {
10539
- defaultMintingFee: request.defaultMintingFee,
10910
+ licenseTerms = PILFlavor.commercialUse({
10911
+ defaultMintingFee: Number(request.defaultMintingFee),
10540
10912
  currency: request.currency,
10541
- royaltyPolicyAddress: validateAddress(request.royaltyPolicyAddress || royaltyPolicyLapAddress[this.chainId])
10913
+ royaltyPolicy: request.royaltyPolicyAddress
10542
10914
  });
10543
10915
  _context3.n = 1;
10544
10916
  return this.registerPILTermsHelper(licenseTerms, request.txOptions);
@@ -10557,6 +10929,9 @@ var LicenseClient = /*#__PURE__*/function () {
10557
10929
  return registerCommercialUsePIL;
10558
10930
  }()
10559
10931
  /**
10932
+ * @deprecated Use {@link PILFlavor.commercialRemix} with {@link LicenseClient.registerPILTerms} instead.
10933
+ * The method will be removed in the v1.4.0.
10934
+ *
10560
10935
  * Convenient function to register a PIL commercial Remix license to the registry.
10561
10936
  *
10562
10937
  * For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%233%3A-commercial-remix | Commercial Remix }.
@@ -10567,28 +10942,29 @@ var LicenseClient = /*#__PURE__*/function () {
10567
10942
  }, {
10568
10943
  key: "registerCommercialRemixPIL",
10569
10944
  value: (function () {
10570
- var _registerCommercialRemixPIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(request) {
10571
- var licenseTerms, _t4;
10945
+ var _registerCommercialRemixPIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(_ref) {
10946
+ var defaultMintingFee, currency, royaltyPolicyAddress, commercialRevShare, txOptions, licenseTerms, _t4;
10572
10947
  return _regenerator().w(function (_context4) {
10573
- while (1) switch (_context4.n) {
10948
+ while (1) switch (_context4.p = _context4.n) {
10574
10949
  case 0:
10575
- _context4.p = 0;
10576
- licenseTerms = getLicenseTermByType(PIL_TYPE.COMMERCIAL_REMIX, {
10577
- defaultMintingFee: request.defaultMintingFee,
10578
- currency: request.currency,
10579
- royaltyPolicyAddress: validateAddress(request.royaltyPolicyAddress || royaltyPolicyLapAddress[this.chainId]),
10580
- commercialRevShare: request.commercialRevShare
10950
+ defaultMintingFee = _ref.defaultMintingFee, currency = _ref.currency, royaltyPolicyAddress = _ref.royaltyPolicyAddress, commercialRevShare = _ref.commercialRevShare, txOptions = _ref.txOptions;
10951
+ _context4.p = 1;
10952
+ licenseTerms = PILFlavor.commercialRemix({
10953
+ defaultMintingFee: Number(defaultMintingFee),
10954
+ currency: currency,
10955
+ royaltyPolicy: royaltyPolicyAddress,
10956
+ commercialRevShare: commercialRevShare
10581
10957
  });
10582
- _context4.n = 1;
10583
- return this.registerPILTermsHelper(licenseTerms, request.txOptions);
10584
- case 1:
10585
- return _context4.a(2, _context4.v);
10958
+ _context4.n = 2;
10959
+ return this.registerPILTermsHelper(licenseTerms, txOptions);
10586
10960
  case 2:
10587
- _context4.p = 2;
10961
+ return _context4.a(2, _context4.v);
10962
+ case 3:
10963
+ _context4.p = 3;
10588
10964
  _t4 = _context4.v;
10589
10965
  return _context4.a(2, handleError(_t4, "Failed to register commercial remix PIL"));
10590
10966
  }
10591
- }, _callee4, this, [[0, 2]]);
10967
+ }, _callee4, this, [[1, 3]]);
10592
10968
  }));
10593
10969
  function registerCommercialRemixPIL(_x4) {
10594
10970
  return _registerCommercialRemixPIL.apply(this, arguments);
@@ -10596,6 +10972,9 @@ var LicenseClient = /*#__PURE__*/function () {
10596
10972
  return registerCommercialRemixPIL;
10597
10973
  }()
10598
10974
  /**
10975
+ * @deprecated Use {@link PILFlavor.creativeCommonsAttribution} with {@link LicenseClient.registerPILTerms} instead.
10976
+ * The method will be removed in the `v1.4.0`.
10977
+ *
10599
10978
  * Convenient function to register a PIL creative commons attribution license to the registry.
10600
10979
  * Creates a Creative Commons Attribution (CC-BY) license terms flavor.
10601
10980
  *
@@ -10607,17 +10986,17 @@ var LicenseClient = /*#__PURE__*/function () {
10607
10986
  }, {
10608
10987
  key: "registerCreativeCommonsAttributionPIL",
10609
10988
  value: (function () {
10610
- var _registerCreativeCommonsAttributionPIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref) {
10989
+ var _registerCreativeCommonsAttributionPIL = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref2) {
10611
10990
  var currency, royaltyPolicyAddress, txOptions, _t5;
10612
10991
  return _regenerator().w(function (_context5) {
10613
- while (1) switch (_context5.n) {
10992
+ while (1) switch (_context5.p = _context5.n) {
10614
10993
  case 0:
10615
- currency = _ref.currency, royaltyPolicyAddress = _ref.royaltyPolicyAddress, txOptions = _ref.txOptions;
10994
+ currency = _ref2.currency, royaltyPolicyAddress = _ref2.royaltyPolicyAddress, txOptions = _ref2.txOptions;
10616
10995
  _context5.p = 1;
10617
10996
  _context5.n = 2;
10618
- return this.registerPILTermsHelper(getLicenseTermByType(PIL_TYPE.CREATIVE_COMMONS_ATTRIBUTION, {
10997
+ return this.registerPILTermsHelper(PILFlavor.creativeCommonsAttribution({
10619
10998
  currency: currency,
10620
- royaltyPolicyAddress: royaltyPolicyAddress || royaltyPolicyLapAddress[this.chainId]
10999
+ royaltyPolicy: royaltyPolicyAddress
10621
11000
  }), txOptions);
10622
11001
  case 2:
10623
11002
  return _context5.a(2, _context5.v);
@@ -10643,7 +11022,7 @@ var LicenseClient = /*#__PURE__*/function () {
10643
11022
  var _attachLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(request) {
10644
11023
  var _request$txOptions, isRegistered, isExisted, isAttachedLicenseTerms, req, txHash, _t6;
10645
11024
  return _regenerator().w(function (_context6) {
10646
- while (1) switch (_context6.n) {
11025
+ while (1) switch (_context6.p = _context6.n) {
10647
11026
  case 0:
10648
11027
  _context6.p = 0;
10649
11028
  request.licenseTermsId = BigInt(request.licenseTermsId);
@@ -10753,7 +11132,7 @@ var LicenseClient = /*#__PURE__*/function () {
10753
11132
  var _this = this;
10754
11133
  var _request$txOptions2, _request$options, receiver, req, isLicenseIpIdRegistered, isExisted, ipAccount, ipOwner, isAttachedLicenseTerms, encodedTxData, licenseMintingFee, wipSpenders, _yield$contractCallWi, txHash, receipt, targetLogs, startLicenseTokenId, licenseTokenIds, i, _t7;
10755
11134
  return _regenerator().w(function (_context7) {
10756
- while (1) switch (_context7.n) {
11135
+ while (1) switch (_context7.p = _context7.n) {
10757
11136
  case 0:
10758
11137
  _context7.p = 0;
10759
11138
  receiver = validateAddress(request.receiver || this.walletAddress);
@@ -10761,7 +11140,7 @@ var LicenseClient = /*#__PURE__*/function () {
10761
11140
  licensorIpId: validateAddress(request.licensorIpId),
10762
11141
  licenseTemplate: validateAddress(request.licenseTemplate || this.licenseTemplateClient.address),
10763
11142
  licenseTermsId: BigInt(request.licenseTermsId),
10764
- amount: BigInt(request.amount || 1),
11143
+ amount: BigInt(request.amount === undefined ? 1 : request.amount),
10765
11144
  receiver: receiver,
10766
11145
  royaltyContext: viem.zeroAddress,
10767
11146
  maxMintingFee: BigInt(request.maxMintingFee),
@@ -10899,7 +11278,7 @@ var LicenseClient = /*#__PURE__*/function () {
10899
11278
  var _getLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(selectedLicenseTermsId) {
10900
11279
  var _t8;
10901
11280
  return _regenerator().w(function (_context8) {
10902
- while (1) switch (_context8.n) {
11281
+ while (1) switch (_context8.p = _context8.n) {
10903
11282
  case 0:
10904
11283
  _context8.p = 0;
10905
11284
  _context8.n = 1;
@@ -10930,7 +11309,7 @@ var LicenseClient = /*#__PURE__*/function () {
10930
11309
  var _predictMintingLicenseFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(request) {
10931
11310
  var isLicenseIpIdRegistered, licenseTermsId, isExisted, object, _t9;
10932
11311
  return _regenerator().w(function (_context9) {
10933
- while (1) switch (_context9.n) {
11312
+ while (1) switch (_context9.p = _context9.n) {
10934
11313
  case 0:
10935
11314
  _context9.p = 0;
10936
11315
  _context9.n = 1;
@@ -10996,7 +11375,7 @@ var LicenseClient = /*#__PURE__*/function () {
10996
11375
  var _setLicensingConfig = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(request) {
10997
11376
  var _request$txOptions3, req, isLicenseIpIdRegistered, isExisted, isRegistered, txHash, _t0;
10998
11377
  return _regenerator().w(function (_context0) {
10999
- while (1) switch (_context0.n) {
11378
+ while (1) switch (_context0.p = _context0.n) {
11000
11379
  case 0:
11001
11380
  _context0.p = 0;
11002
11381
  req = {
@@ -11108,12 +11487,12 @@ var LicenseClient = /*#__PURE__*/function () {
11108
11487
  }, {
11109
11488
  key: "setMaxLicenseTokens",
11110
11489
  value: (function () {
11111
- var _setMaxLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(_ref2) {
11490
+ var _setMaxLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(_ref3) {
11112
11491
  var ipId, licenseTermsId, maxLicenseTokens, licenseTemplate, txOptions, newLicenseTermsId, newLicenseTemplate, licensingConfig, txHash, _t1;
11113
11492
  return _regenerator().w(function (_context1) {
11114
- while (1) switch (_context1.n) {
11493
+ while (1) switch (_context1.p = _context1.n) {
11115
11494
  case 0:
11116
- ipId = _ref2.ipId, licenseTermsId = _ref2.licenseTermsId, maxLicenseTokens = _ref2.maxLicenseTokens, licenseTemplate = _ref2.licenseTemplate, txOptions = _ref2.txOptions;
11495
+ ipId = _ref3.ipId, licenseTermsId = _ref3.licenseTermsId, maxLicenseTokens = _ref3.maxLicenseTokens, licenseTemplate = _ref3.licenseTemplate, txOptions = _ref3.txOptions;
11117
11496
  _context1.p = 1;
11118
11497
  if (!(maxLicenseTokens < 0)) {
11119
11498
  _context1.n = 2;
@@ -11141,7 +11520,8 @@ var LicenseClient = /*#__PURE__*/function () {
11141
11520
  licenseTermsId: newLicenseTermsId,
11142
11521
  licenseTemplate: newLicenseTemplate,
11143
11522
  licensingConfig: _objectSpread2(_objectSpread2({}, licensingConfig), {}, {
11144
- licensingHook: this.totalLicenseTokenLimitHookClient.address
11523
+ licensingHook: this.totalLicenseTokenLimitHookClient.address,
11524
+ expectMinimumGroupRewardShare: licensingConfig.expectMinimumGroupRewardShare / 1000000
11145
11525
  })
11146
11526
  });
11147
11527
  case 4:
@@ -11177,7 +11557,7 @@ var LicenseClient = /*#__PURE__*/function () {
11177
11557
  var _getLicensingConfig = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(request) {
11178
11558
  var licensingConfigParam, _t10;
11179
11559
  return _regenerator().w(function (_context10) {
11180
- while (1) switch (_context10.n) {
11560
+ while (1) switch (_context10.p = _context10.n) {
11181
11561
  case 0:
11182
11562
  _context10.p = 0;
11183
11563
  licensingConfigParam = {
@@ -11232,6 +11612,7 @@ var LicenseClient = /*#__PURE__*/function () {
11232
11612
  return _regenerator().w(function (_context12) {
11233
11613
  while (1) switch (_context12.n) {
11234
11614
  case 0:
11615
+ licenseTerms.commercialRevShare = getRevenueShare(licenseTerms.commercialRevShare);
11235
11616
  if (!(txOptions !== null && txOptions !== void 0 && txOptions.encodedTxDataOnly)) {
11236
11617
  _context12.n = 1;
11237
11618
  break;
@@ -11307,7 +11688,7 @@ var NftClient = /*#__PURE__*/function () {
11307
11688
  var _createNFTCollection = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request) {
11308
11689
  var _request$baseURI, _request$maxSupply, _request$mintFee, _request$mintFeeToken, _request$txOptions, object, txHash, txReceipt, targetLogs, _t;
11309
11690
  return _regenerator().w(function (_context) {
11310
- while (1) switch (_context.n) {
11691
+ while (1) switch (_context.p = _context.n) {
11311
11692
  case 0:
11312
11693
  _context.p = 0;
11313
11694
  if (!(request.mintFee !== undefined && (request.mintFee < 0n || request.mintFeeToken === viem.zeroAddress || !viem.isAddress(request.mintFeeToken || "")))) {
@@ -11428,7 +11809,7 @@ var NftClient = /*#__PURE__*/function () {
11428
11809
  var _setTokenURI = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(_ref) {
11429
11810
  var tokenId, tokenURI, spgNftContract, txOptions, spgNftClient, txHash, _t2;
11430
11811
  return _regenerator().w(function (_context4) {
11431
- while (1) switch (_context4.n) {
11812
+ while (1) switch (_context4.p = _context4.n) {
11432
11813
  case 0:
11433
11814
  tokenId = _ref.tokenId, tokenURI = _ref.tokenURI, spgNftContract = _ref.spgNftContract, txOptions = _ref.txOptions;
11434
11815
  _context4.p = 1;
@@ -11514,7 +11895,7 @@ var PermissionClient = /*#__PURE__*/function () {
11514
11895
  var _setPermission = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request) {
11515
11896
  var _request$txOptions, req, txHash, _t;
11516
11897
  return _regenerator().w(function (_context) {
11517
- while (1) switch (_context.n) {
11898
+ while (1) switch (_context.p = _context.n) {
11518
11899
  case 0:
11519
11900
  _context.p = 0;
11520
11901
  _context.n = 1;
@@ -11577,7 +11958,7 @@ var PermissionClient = /*#__PURE__*/function () {
11577
11958
  var _createSetPermissionSignature = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(request) {
11578
11959
  var _request$txOptions2, ipId, signer, to, txOptions, func, permission, deadline, ipAccountClient, data, _yield$ipAccountClien, state, blockTimestamp, calculatedDeadline, _yield$getPermissionS, signature, req, txHash, _t2;
11579
11960
  return _regenerator().w(function (_context2) {
11580
- while (1) switch (_context2.n) {
11961
+ while (1) switch (_context2.p = _context2.n) {
11581
11962
  case 0:
11582
11963
  _context2.p = 0;
11583
11964
  ipId = request.ipId, signer = request.signer, to = request.to, txOptions = request.txOptions, func = request.func, permission = request.permission, deadline = request.deadline;
@@ -11676,7 +12057,7 @@ var PermissionClient = /*#__PURE__*/function () {
11676
12057
  var _setAllPermissions = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(request) {
11677
12058
  var _request$txOptions3, req, txHash, _t3;
11678
12059
  return _regenerator().w(function (_context3) {
11679
- while (1) switch (_context3.n) {
12060
+ while (1) switch (_context3.p = _context3.n) {
11680
12061
  case 0:
11681
12062
  _context3.p = 0;
11682
12063
  _context3.n = 1;
@@ -11737,7 +12118,7 @@ var PermissionClient = /*#__PURE__*/function () {
11737
12118
  var _setBatchPermissions = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(request) {
11738
12119
  var _request$txOptions4, permissions, txOptions, _iterator, _step, permission, req, txHash, _t4, _t5;
11739
12120
  return _regenerator().w(function (_context4) {
11740
- while (1) switch (_context4.n) {
12121
+ while (1) switch (_context4.p = _context4.n) {
11741
12122
  case 0:
11742
12123
  _context4.p = 0;
11743
12124
  permissions = request.permissions, txOptions = request.txOptions;
@@ -11828,7 +12209,7 @@ var PermissionClient = /*#__PURE__*/function () {
11828
12209
  var _createBatchPermissionSignature = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(request) {
11829
12210
  var _request$txOptions5, permissions, deadline, ipId, txOptions, _iterator2, _step2, permission, ipAccountClient, data, _yield$ipAccountClien2, state, blockTimestamp, calculatedDeadline, _yield$getPermissionS2, signature, req, txHash, _t6, _t7;
11830
12211
  return _regenerator().w(function (_context5) {
11831
- while (1) switch (_context5.n) {
12212
+ while (1) switch (_context5.p = _context5.n) {
11832
12213
  case 0:
11833
12214
  _context5.p = 0;
11834
12215
  permissions = request.permissions, deadline = request.deadline, ipId = request.ipId, txOptions = request.txOptions;
@@ -11972,32 +12353,6 @@ var PermissionClient = /*#__PURE__*/function () {
11972
12353
  }]);
11973
12354
  }();
11974
12355
 
11975
- /** The amount of revenue token claimable. */
11976
-
11977
- /**
11978
- * Native royalty policy created by the Story team
11979
- */
11980
- var NativeRoyaltyPolicy = /*#__PURE__*/function (NativeRoyaltyPolicy) {
11981
- NativeRoyaltyPolicy[NativeRoyaltyPolicy["LAP"] = 0] = "LAP";
11982
- NativeRoyaltyPolicy[NativeRoyaltyPolicy["LRP"] = 1] = "LRP";
11983
- return NativeRoyaltyPolicy;
11984
- }({});
11985
-
11986
- /**
11987
- * Allow custom royalty policy address or use a native royalty policy enum
11988
- */
11989
-
11990
- var royaltyPolicyInputToAddress = function royaltyPolicyInputToAddress(input, chainId) {
11991
- switch (input) {
11992
- case NativeRoyaltyPolicy.LAP:
11993
- return royaltyPolicyLapAddress[chain[chainId]];
11994
- case NativeRoyaltyPolicy.LRP:
11995
- return royaltyPolicyLrpAddress[chain[chainId]];
11996
- default:
11997
- return validateAddress(input);
11998
- }
11999
- };
12000
-
12001
12356
  var RoyaltyClient = /*#__PURE__*/function () {
12002
12357
  function RoyaltyClient(rpcClient, wallet, chainId) {
12003
12358
  _classCallCheck(this, RoyaltyClient);
@@ -12030,7 +12385,7 @@ var RoyaltyClient = /*#__PURE__*/function () {
12030
12385
  var _claimAllRevenue = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(req) {
12031
12386
  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;
12032
12387
  return _regenerator().w(function (_context) {
12033
- while (1) switch (_context.n) {
12388
+ while (1) switch (_context.p = _context.n) {
12034
12389
  case 0:
12035
12390
  _context.p = 0;
12036
12391
  ancestorIpId = validateAddress(req.ancestorIpId);
@@ -12129,7 +12484,7 @@ var RoyaltyClient = /*#__PURE__*/function () {
12129
12484
  var _this = this;
12130
12485
  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;
12131
12486
  return _regenerator().w(function (_context3) {
12132
- while (1) switch (_context3.n) {
12487
+ while (1) switch (_context3.p = _context3.n) {
12133
12488
  case 0:
12134
12489
  _context3.p = 0;
12135
12490
  txHashes = [];
@@ -12353,7 +12708,7 @@ var RoyaltyClient = /*#__PURE__*/function () {
12353
12708
  var _this2 = this;
12354
12709
  var _request$txOptions, receiverIpId, payerIpId, token, amount, _request$options2, _request$options3, erc20Options, wipOptions, txOptions, sender, payAmount, isReceiverRegistered, isPayerRegistered, req, encodedTxData, contractCall, tokenSpenders, _t5;
12355
12710
  return _regenerator().w(function (_context4) {
12356
- while (1) switch (_context4.n) {
12711
+ while (1) switch (_context4.p = _context4.n) {
12357
12712
  case 0:
12358
12713
  _context4.p = 0;
12359
12714
  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;
@@ -12457,7 +12812,7 @@ var RoyaltyClient = /*#__PURE__*/function () {
12457
12812
  var _claimableRevenue = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(request) {
12458
12813
  var proxyAddress, ipRoyaltyVault, _t6;
12459
12814
  return _regenerator().w(function (_context5) {
12460
- while (1) switch (_context5.n) {
12815
+ while (1) switch (_context5.p = _context5.n) {
12461
12816
  case 0:
12462
12817
  _context5.p = 0;
12463
12818
  _context5.n = 1;
@@ -12726,7 +13081,7 @@ var WipClient = /*#__PURE__*/function () {
12726
13081
  var _deposit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
12727
13082
  var amount, txOptions, _yield$this$rpcClient, call, txHash, _t;
12728
13083
  return _regenerator().w(function (_context) {
12729
- while (1) switch (_context.n) {
13084
+ while (1) switch (_context.p = _context.n) {
12730
13085
  case 0:
12731
13086
  amount = _ref.amount, txOptions = _ref.txOptions;
12732
13087
  _context.p = 1;
@@ -12778,7 +13133,7 @@ var WipClient = /*#__PURE__*/function () {
12778
13133
  var _withdraw = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref2) {
12779
13134
  var amount, txOptions, targetAmt, txHash, _t2;
12780
13135
  return _regenerator().w(function (_context2) {
12781
- while (1) switch (_context2.n) {
13136
+ while (1) switch (_context2.p = _context2.n) {
12782
13137
  case 0:
12783
13138
  amount = _ref2.amount, txOptions = _ref2.txOptions;
12784
13139
  _context2.p = 1;
@@ -12822,7 +13177,7 @@ var WipClient = /*#__PURE__*/function () {
12822
13177
  var _approve = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(req) {
12823
13178
  var amount, spender, txHash, _t3;
12824
13179
  return _regenerator().w(function (_context3) {
12825
- while (1) switch (_context3.n) {
13180
+ while (1) switch (_context3.p = _context3.n) {
12826
13181
  case 0:
12827
13182
  _context3.p = 0;
12828
13183
  amount = BigInt(req.amount);
@@ -12895,7 +13250,7 @@ var WipClient = /*#__PURE__*/function () {
12895
13250
  var _transfer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(request) {
12896
13251
  var amount, txHash, _t4;
12897
13252
  return _regenerator().w(function (_context5) {
12898
- while (1) switch (_context5.n) {
13253
+ while (1) switch (_context5.p = _context5.n) {
12899
13254
  case 0:
12900
13255
  _context5.p = 0;
12901
13256
  amount = BigInt(request.amount);
@@ -12939,7 +13294,7 @@ var WipClient = /*#__PURE__*/function () {
12939
13294
  var _transferFrom = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(request) {
12940
13295
  var amount, txHash, _t5;
12941
13296
  return _regenerator().w(function (_context6) {
12942
- while (1) switch (_context6.n) {
13297
+ while (1) switch (_context6.p = _context6.n) {
12943
13298
  case 0:
12944
13299
  _context6.p = 0;
12945
13300
  amount = BigInt(request.amount);
@@ -13331,6 +13686,26 @@ var AIRelationship = /*#__PURE__*/function (AIRelationship) {
13331
13686
  return AIRelationship;
13332
13687
  }({});
13333
13688
 
13689
+ /**
13690
+ * This structure defines the terms for a Programmable IP License (PIL).
13691
+ * These terms can be attached to IP Assets.
13692
+ *
13693
+ * For more information, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-terms | PIL}.
13694
+ **/
13695
+
13696
+ /**
13697
+ * @deprecated Use `PILFlavor.nonCommercialSocialRemixing`, `PILFlavor.commercialUse`, `PILFlavor.commercialRemix`, or `PILFlavor.creativeCommonsAttribution` instead.
13698
+ *
13699
+ * The type of PIL.
13700
+ */
13701
+ var PIL_TYPE = /*#__PURE__*/function (PIL_TYPE) {
13702
+ PIL_TYPE[PIL_TYPE["NON_COMMERCIAL_REMIX"] = 0] = "NON_COMMERCIAL_REMIX";
13703
+ PIL_TYPE[PIL_TYPE["COMMERCIAL_USE"] = 1] = "COMMERCIAL_USE";
13704
+ PIL_TYPE[PIL_TYPE["COMMERCIAL_REMIX"] = 2] = "COMMERCIAL_REMIX";
13705
+ PIL_TYPE[PIL_TYPE["CREATIVE_COMMONS_ATTRIBUTION"] = 3] = "CREATIVE_COMMONS_ATTRIBUTION";
13706
+ return PIL_TYPE;
13707
+ }({});
13708
+
13334
13709
  /**
13335
13710
  * Tags refer to the “labels” that can be applied to IP Assets in the protocol when raising a dispute.
13336
13711
  * Tags must be whitelisted by protocol governance to be used in a dispute.
@@ -13369,6 +13744,7 @@ exports.IPAssetClient = IPAssetClient;
13369
13744
  exports.LicenseClient = LicenseClient;
13370
13745
  exports.NativeRoyaltyPolicy = NativeRoyaltyPolicy;
13371
13746
  exports.NftClient = NftClient;
13747
+ exports.PILFlavor = PILFlavor;
13372
13748
  exports.PIL_TYPE = PIL_TYPE;
13373
13749
  exports.PermissionClient = PermissionClient;
13374
13750
  exports.RevShareType = RevShareType;