@story-protocol/core-sdk 1.4.2 → 1.4.4

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 (29) hide show
  1. package/dist/declarations/src/abi/generated.d.ts +16 -0
  2. package/dist/declarations/src/abi/generated.d.ts.map +1 -1
  3. package/dist/declarations/src/client.d.ts +6 -0
  4. package/dist/declarations/src/client.d.ts.map +1 -1
  5. package/dist/declarations/src/resources/group.d.ts.map +1 -1
  6. package/dist/declarations/src/resources/ipAsset.d.ts +41 -3
  7. package/dist/declarations/src/resources/ipAsset.d.ts.map +1 -1
  8. package/dist/declarations/src/resources/license.d.ts.map +1 -1
  9. package/dist/declarations/src/resources/nftClient.d.ts +5 -1
  10. package/dist/declarations/src/resources/nftClient.d.ts.map +1 -1
  11. package/dist/declarations/src/types/config.d.ts +48 -1
  12. package/dist/declarations/src/types/config.d.ts.map +1 -1
  13. package/dist/declarations/src/types/resources/ipAsset.d.ts +11 -1
  14. package/dist/declarations/src/types/resources/ipAsset.d.ts.map +1 -1
  15. package/dist/declarations/src/types/resources/license.d.ts +47 -4
  16. package/dist/declarations/src/types/resources/license.d.ts.map +1 -1
  17. package/dist/declarations/src/types/resources/nftClient.d.ts +6 -0
  18. package/dist/declarations/src/types/resources/nftClient.d.ts.map +1 -1
  19. package/dist/declarations/src/utils/chain.d.ts +18 -0
  20. package/dist/declarations/src/utils/chain.d.ts.map +1 -1
  21. package/dist/declarations/src/utils/oov3.d.ts +4 -0
  22. package/dist/declarations/src/utils/oov3.d.ts.map +1 -1
  23. package/dist/declarations/src/utils/pilFlavor.d.ts.map +1 -1
  24. package/dist/declarations/src/utils/token.d.ts +3 -0
  25. package/dist/declarations/src/utils/token.d.ts.map +1 -1
  26. package/dist/story-protocol-core-sdk.cjs.dev.js +1724 -1000
  27. package/dist/story-protocol-core-sdk.cjs.prod.js +1724 -1000
  28. package/dist/story-protocol-core-sdk.esm.js +1725 -1001
  29. package/package.json +3 -2
@@ -1,5 +1,5 @@
1
1
  import * as dotenv from 'dotenv';
2
- import { encodeFunctionData, decodeEventLog, isAddress, formatEther, maxUint256, http, createPublicClient, createWalletClient, stringToHex, encodeAbiParameters, zeroHash, keccak256, toFunctionSelector, zeroAddress, toHex, maxUint32, erc20Abi as erc20Abi$1 } from 'viem';
2
+ import { encodeFunctionData, decodeEventLog, isAddress, formatEther, maxUint256, http, createPublicClient, createWalletClient, stringToHex, encodeAbiParameters, zeroAddress, getAddress as getAddress$1, zeroHash, toFunctionSelector, keccak256, toHex, maxUint32, erc20Abi as erc20Abi$1 } from 'viem';
3
3
  import { defineChain } from 'viem/utils';
4
4
  import bs58 from 'bs58';
5
5
  import { base58btc } from 'multiformats/bases/base58';
@@ -2640,6 +2640,10 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2640
2640
  * @param to address
2641
2641
  * @param tokenId uint256
2642
2642
  *//**
2643
+ * SpgnftImplBalanceOfRequest
2644
+ *
2645
+ * @param owner address
2646
+ *//**
2643
2647
  * SpgnftImplHasRoleRequest
2644
2648
  *
2645
2649
  * @param role bytes32
@@ -2662,38 +2666,43 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2662
2666
  */},{key:"parseTxTransferEvent",value:function parseTxTransferEvent(txReceipt){var targetLogs=[];var _iterator38=_createForOfIteratorHelper(txReceipt.logs),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var log=_step38.value;try{var event=decodeEventLog({abi:spgnftImplAbi,eventName:"Transfer",data:log.data,topics:log.topics});if(event.eventName==="Transfer"){targetLogs.push(event.args);}}catch(e){/* empty */}}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}return targetLogs;}}]);}();/**
2663
2667
  * contract SPGNFTImpl readonly method
2664
2668
  */var SpgnftImplReadOnlyClient=/*#__PURE__*/function(_SpgnftImplEventClien){function SpgnftImplReadOnlyClient(rpcClient,address){_classCallCheck(this,SpgnftImplReadOnlyClient);return _callSuper(this,SpgnftImplReadOnlyClient,[rpcClient,address]);}/**
2669
+ * method balanceOf for contract SPGNFTImpl
2670
+ *
2671
+ * @param request SpgnftImplBalanceOfRequest
2672
+ * @return Promise<SpgnftImplBalanceOfResponse>
2673
+ */_inherits(SpgnftImplReadOnlyClient,_SpgnftImplEventClien);return _createClass(SpgnftImplReadOnlyClient,[{key:"balanceOf",value:(function(){var _balanceOf3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee188(request){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:"balanceOf",args:[request.owner]});case 1:return _context188.a(2,_context188.v);}},_callee188,this);}));function balanceOf(_x134){return _balanceOf3.apply(this,arguments);}return balanceOf;}()/**
2665
2674
  * method hasRole for contract SPGNFTImpl
2666
2675
  *
2667
2676
  * @param request SpgnftImplHasRoleRequest
2668
2677
  * @return Promise<SpgnftImplHasRoleResponse>
2669
- */_inherits(SpgnftImplReadOnlyClient,_SpgnftImplEventClien);return _createClass(SpgnftImplReadOnlyClient,[{key:"hasRole",value:(function(){var _hasRole=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee188(request){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:"hasRole",args:[request.role,request.account]});case 1:return _context188.a(2,_context188.v);}},_callee188,this);}));function hasRole(_x134){return _hasRole.apply(this,arguments);}return hasRole;}()/**
2678
+ */)},{key:"hasRole",value:(function(){var _hasRole=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee189(request){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:"hasRole",args:[request.role,request.account]});case 1:return _context189.a(2,_context189.v);}},_callee189,this);}));function hasRole(_x135){return _hasRole.apply(this,arguments);}return hasRole;}()/**
2670
2679
  * method mintFee for contract SPGNFTImpl
2671
2680
  *
2672
2681
  * @param request SpgnftImplMintFeeRequest
2673
2682
  * @return Promise<SpgnftImplMintFeeResponse>
2674
- */)},{key:"mintFee",value:(function(){var _mintFee=_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:"mintFee"});case 1:return _context189.a(2,_context189.v);}},_callee189,this);}));function mintFee(){return _mintFee.apply(this,arguments);}return mintFee;}()/**
2683
+ */)},{key:"mintFee",value:(function(){var _mintFee=_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:"mintFee"});case 1:return _context190.a(2,_context190.v);}},_callee190,this);}));function mintFee(){return _mintFee.apply(this,arguments);}return mintFee;}()/**
2675
2684
  * method mintFeeToken for contract SPGNFTImpl
2676
2685
  *
2677
2686
  * @param request SpgnftImplMintFeeTokenRequest
2678
2687
  * @return Promise<SpgnftImplMintFeeTokenResponse>
2679
- */)},{key:"mintFeeToken",value:(function(){var _mintFeeToken=_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:"mintFeeToken"});case 1:return _context190.a(2,_context190.v);}},_callee190,this);}));function mintFeeToken(){return _mintFeeToken.apply(this,arguments);}return mintFeeToken;}()/**
2688
+ */)},{key:"mintFeeToken",value:(function(){var _mintFeeToken=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee191(){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:"mintFeeToken"});case 1:return _context191.a(2,_context191.v);}},_callee191,this);}));function mintFeeToken(){return _mintFeeToken.apply(this,arguments);}return mintFeeToken;}()/**
2680
2689
  * method publicMinting for contract SPGNFTImpl
2681
2690
  *
2682
2691
  * @param request SpgnftImplPublicMintingRequest
2683
2692
  * @return Promise<SpgnftImplPublicMintingResponse>
2684
- */)},{key:"publicMinting",value:(function(){var _publicMinting=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee191(){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:"publicMinting"});case 1:return _context191.a(2,_context191.v);}},_callee191,this);}));function publicMinting(){return _publicMinting.apply(this,arguments);}return publicMinting;}()/**
2693
+ */)},{key:"publicMinting",value:(function(){var _publicMinting=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee192(){return _regenerator().w(function(_context192){while(1)switch(_context192.n){case 0:_context192.n=1;return this.rpcClient.readContract({abi:spgnftImplAbi,address:this.address,functionName:"publicMinting"});case 1:return _context192.a(2,_context192.v);}},_callee192,this);}));function publicMinting(){return _publicMinting.apply(this,arguments);}return publicMinting;}()/**
2685
2694
  * method tokenURI for contract SPGNFTImpl
2686
2695
  *
2687
2696
  * @param request SpgnftImplTokenUriRequest
2688
2697
  * @return Promise<SpgnftImplTokenUriResponse>
2689
- */)},{key:"tokenUri",value:(function(){var _tokenUri=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee192(request){return _regenerator().w(function(_context192){while(1)switch(_context192.n){case 0:_context192.n=1;return this.rpcClient.readContract({abi:spgnftImplAbi,address:this.address,functionName:"tokenURI",args:[request.tokenId]});case 1:return _context192.a(2,_context192.v);}},_callee192,this);}));function tokenUri(_x135){return _tokenUri.apply(this,arguments);}return tokenUri;}())}]);}(SpgnftImplEventClient);/**
2698
+ */)},{key:"tokenUri",value:(function(){var _tokenUri=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee193(request){return _regenerator().w(function(_context193){while(1)switch(_context193.n){case 0:_context193.n=1;return this.rpcClient.readContract({abi:spgnftImplAbi,address:this.address,functionName:"tokenURI",args:[request.tokenId]});case 1:return _context193.a(2,_context193.v);}},_callee193,this);}));function tokenUri(_x136){return _tokenUri.apply(this,arguments);}return tokenUri;}())}]);}(SpgnftImplEventClient);/**
2690
2699
  * contract SPGNFTImpl write method
2691
2700
  */var SpgnftImplClient=/*#__PURE__*/function(_SpgnftImplReadOnlyCl){function SpgnftImplClient(rpcClient,wallet,address){var _this15;_classCallCheck(this,SpgnftImplClient);_this15=_callSuper(this,SpgnftImplClient,[rpcClient,address]);_this15.wallet=wallet;return _this15;}/**
2692
2701
  * method setTokenURI for contract SPGNFTImpl
2693
2702
  *
2694
2703
  * @param request SpgnftImplSetTokenUriRequest
2695
2704
  * @return Promise<WriteContractReturnType>
2696
- */_inherits(SpgnftImplClient,_SpgnftImplReadOnlyCl);return _createClass(SpgnftImplClient,[{key:"setTokenUri",value:(function(){var _setTokenUri=_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:spgnftImplAbi,address:this.address,functionName:"setTokenURI",account:this.wallet.account,args:[request.tokenId,request.tokenUri]});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 setTokenUri(_x136){return _setTokenUri.apply(this,arguments);}return setTokenUri;}()/**
2705
+ */_inherits(SpgnftImplClient,_SpgnftImplReadOnlyCl);return _createClass(SpgnftImplClient,[{key:"setTokenUri",value:(function(){var _setTokenUri=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee194(request){var _yield$this$rpcClient93,call;return _regenerator().w(function(_context194){while(1)switch(_context194.n){case 0:_context194.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$rpcClient93=_context194.v;call=_yield$this$rpcClient93.request;_context194.n=2;return this.wallet.writeContract(call);case 2:return _context194.a(2,_context194.v);}},_callee194,this);}));function setTokenUri(_x137){return _setTokenUri.apply(this,arguments);}return setTokenUri;}()/**
2697
2706
  * method setTokenURI for contract SPGNFTImpl with only encode
2698
2707
  *
2699
2708
  * @param request SpgnftImplSetTokenUriRequest
@@ -2713,7 +2722,7 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2713
2722
  *
2714
2723
  * @param request TotalLicenseTokenLimitHookSetTotalLicenseTokenLimitRequest
2715
2724
  * @return Promise<WriteContractReturnType>
2716
- */return _createClass(TotalLicenseTokenLimitHookClient,[{key:"setTotalLicenseTokenLimit",value:(function(){var _setTotalLicenseTokenLimit=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee194(request){var _yield$this$rpcClient94,call;return _regenerator().w(function(_context194){while(1)switch(_context194.n){case 0:_context194.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$rpcClient94=_context194.v;call=_yield$this$rpcClient94.request;_context194.n=2;return this.wallet.writeContract(call);case 2:return _context194.a(2,_context194.v);}},_callee194,this);}));function setTotalLicenseTokenLimit(_x137){return _setTotalLicenseTokenLimit.apply(this,arguments);}return setTotalLicenseTokenLimit;}()/**
2725
+ */return _createClass(TotalLicenseTokenLimitHookClient,[{key:"setTotalLicenseTokenLimit",value:(function(){var _setTotalLicenseTokenLimit=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee195(request){var _yield$this$rpcClient94,call;return _regenerator().w(function(_context195){while(1)switch(_context195.n){case 0:_context195.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$rpcClient94=_context195.v;call=_yield$this$rpcClient94.request;_context195.n=2;return this.wallet.writeContract(call);case 2:return _context195.a(2,_context195.v);}},_callee195,this);}));function setTotalLicenseTokenLimit(_x138){return _setTotalLicenseTokenLimit.apply(this,arguments);}return setTotalLicenseTokenLimit;}()/**
2717
2726
  * method setTotalLicenseTokenLimit for contract TotalLicenseTokenLimitHook with only encode
2718
2727
  *
2719
2728
  * @param request TotalLicenseTokenLimitHookSetTotalLicenseTokenLimitRequest
@@ -2763,19 +2772,19 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2763
2772
  *
2764
2773
  * @param request WrappedIpAllowanceRequest
2765
2774
  * @return Promise<WrappedIpAllowanceResponse>
2766
- */return _createClass(WrappedIpReadOnlyClient,[{key:"allowance",value:(function(){var _allowance2=_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:"allowance",args:[request.owner,request.spender]});case 1:result=_context195.v;return _context195.a(2,{result:result});}},_callee195,this);}));function allowance(_x138){return _allowance2.apply(this,arguments);}return allowance;}()/**
2775
+ */return _createClass(WrappedIpReadOnlyClient,[{key:"allowance",value:(function(){var _allowance2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee196(request){var result;return _regenerator().w(function(_context196){while(1)switch(_context196.n){case 0:_context196.n=1;return this.rpcClient.readContract({abi:wrappedIpAbi,address:this.address,functionName:"allowance",args:[request.owner,request.spender]});case 1:result=_context196.v;return _context196.a(2,{result:result});}},_callee196,this);}));function allowance(_x139){return _allowance2.apply(this,arguments);}return allowance;}()/**
2767
2776
  * method balanceOf for contract WrappedIP
2768
2777
  *
2769
2778
  * @param request WrappedIpBalanceOfRequest
2770
2779
  * @return Promise<WrappedIpBalanceOfResponse>
2771
- */)},{key:"balanceOf",value:(function(){var _balanceOf3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee196(request){var result;return _regenerator().w(function(_context196){while(1)switch(_context196.n){case 0:_context196.n=1;return this.rpcClient.readContract({abi:wrappedIpAbi,address:this.address,functionName:"balanceOf",args:[request.owner]});case 1:result=_context196.v;return _context196.a(2,{result:result});}},_callee196,this);}));function balanceOf(_x139){return _balanceOf3.apply(this,arguments);}return balanceOf;}())}]);}();/**
2780
+ */)},{key:"balanceOf",value:(function(){var _balanceOf4=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee197(request){var result;return _regenerator().w(function(_context197){while(1)switch(_context197.n){case 0:_context197.n=1;return this.rpcClient.readContract({abi:wrappedIpAbi,address:this.address,functionName:"balanceOf",args:[request.owner]});case 1:result=_context197.v;return _context197.a(2,{result:result});}},_callee197,this);}));function balanceOf(_x140){return _balanceOf4.apply(this,arguments);}return balanceOf;}())}]);}();/**
2772
2781
  * contract WrappedIP write method
2773
2782
  */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;}/**
2774
2783
  * method approve for contract WrappedIP
2775
2784
  *
2776
2785
  * @param request WrappedIpApproveRequest
2777
2786
  * @return Promise<WriteContractReturnType>
2778
- */_inherits(WrappedIpClient,_WrappedIpReadOnlyCli);return _createClass(WrappedIpClient,[{key:"approve",value:(function(){var _approve3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee197(request){var _yield$this$rpcClient95,call;return _regenerator().w(function(_context197){while(1)switch(_context197.n){case 0:_context197.n=1;return this.rpcClient.simulateContract({abi:wrappedIpAbi,address:this.address,functionName:"approve",account:this.wallet.account,args:[request.spender,request.amount]});case 1:_yield$this$rpcClient95=_context197.v;call=_yield$this$rpcClient95.request;_context197.n=2;return this.wallet.writeContract(call);case 2:return _context197.a(2,_context197.v);}},_callee197,this);}));function approve(_x140){return _approve3.apply(this,arguments);}return approve;}()/**
2787
+ */_inherits(WrappedIpClient,_WrappedIpReadOnlyCli);return _createClass(WrappedIpClient,[{key:"approve",value:(function(){var _approve3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee198(request){var _yield$this$rpcClient95,call;return _regenerator().w(function(_context198){while(1)switch(_context198.n){case 0:_context198.n=1;return this.rpcClient.simulateContract({abi:wrappedIpAbi,address:this.address,functionName:"approve",account:this.wallet.account,args:[request.spender,request.amount]});case 1:_yield$this$rpcClient95=_context198.v;call=_yield$this$rpcClient95.request;_context198.n=2;return this.wallet.writeContract(call);case 2:return _context198.a(2,_context198.v);}},_callee198,this);}));function approve(_x141){return _approve3.apply(this,arguments);}return approve;}()/**
2779
2788
  * method approve for contract WrappedIP with only encode
2780
2789
  *
2781
2790
  * @param request WrappedIpApproveRequest
@@ -2785,7 +2794,7 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2785
2794
  *
2786
2795
  * @param request WrappedIpDepositRequest
2787
2796
  * @return Promise<WriteContractReturnType>
2788
- */},{key:"deposit",value:(function(){var _deposit=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee198(){var _yield$this$rpcClient96,call;return _regenerator().w(function(_context198){while(1)switch(_context198.n){case 0:_context198.n=1;return this.rpcClient.simulateContract({abi:wrappedIpAbi,address:this.address,functionName:"deposit",account:this.wallet.account});case 1:_yield$this$rpcClient96=_context198.v;call=_yield$this$rpcClient96.request;_context198.n=2;return this.wallet.writeContract(call);case 2:return _context198.a(2,_context198.v);}},_callee198,this);}));function deposit(){return _deposit.apply(this,arguments);}return deposit;}()/**
2797
+ */},{key:"deposit",value:(function(){var _deposit=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee199(){var _yield$this$rpcClient96,call;return _regenerator().w(function(_context199){while(1)switch(_context199.n){case 0:_context199.n=1;return this.rpcClient.simulateContract({abi:wrappedIpAbi,address:this.address,functionName:"deposit",account:this.wallet.account});case 1:_yield$this$rpcClient96=_context199.v;call=_yield$this$rpcClient96.request;_context199.n=2;return this.wallet.writeContract(call);case 2:return _context199.a(2,_context199.v);}},_callee199,this);}));function deposit(){return _deposit.apply(this,arguments);}return deposit;}()/**
2789
2798
  * method deposit for contract WrappedIP with only encode
2790
2799
  *
2791
2800
  * @param request WrappedIpDepositRequest
@@ -2795,7 +2804,7 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2795
2804
  *
2796
2805
  * @param request WrappedIpTransferRequest
2797
2806
  * @return Promise<WriteContractReturnType>
2798
- */},{key:"transfer",value:(function(){var _transfer2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee199(request){var _yield$this$rpcClient97,call;return _regenerator().w(function(_context199){while(1)switch(_context199.n){case 0:_context199.n=1;return this.rpcClient.simulateContract({abi:wrappedIpAbi,address:this.address,functionName:"transfer",account:this.wallet.account,args:[request.to,request.amount]});case 1:_yield$this$rpcClient97=_context199.v;call=_yield$this$rpcClient97.request;_context199.n=2;return this.wallet.writeContract(call);case 2:return _context199.a(2,_context199.v);}},_callee199,this);}));function transfer(_x141){return _transfer2.apply(this,arguments);}return transfer;}()/**
2807
+ */},{key:"transfer",value:(function(){var _transfer2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee200(request){var _yield$this$rpcClient97,call;return _regenerator().w(function(_context200){while(1)switch(_context200.n){case 0:_context200.n=1;return this.rpcClient.simulateContract({abi:wrappedIpAbi,address:this.address,functionName:"transfer",account:this.wallet.account,args:[request.to,request.amount]});case 1:_yield$this$rpcClient97=_context200.v;call=_yield$this$rpcClient97.request;_context200.n=2;return this.wallet.writeContract(call);case 2:return _context200.a(2,_context200.v);}},_callee200,this);}));function transfer(_x142){return _transfer2.apply(this,arguments);}return transfer;}()/**
2799
2808
  * method transfer for contract WrappedIP with only encode
2800
2809
  *
2801
2810
  * @param request WrappedIpTransferRequest
@@ -2805,7 +2814,7 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2805
2814
  *
2806
2815
  * @param request WrappedIpTransferFromRequest
2807
2816
  * @return Promise<WriteContractReturnType>
2808
- */},{key:"transferFrom",value:(function(){var _transferFrom2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee200(request){var _yield$this$rpcClient98,call;return _regenerator().w(function(_context200){while(1)switch(_context200.n){case 0:_context200.n=1;return this.rpcClient.simulateContract({abi:wrappedIpAbi,address:this.address,functionName:"transferFrom",account:this.wallet.account,args:[request.from,request.to,request.amount]});case 1:_yield$this$rpcClient98=_context200.v;call=_yield$this$rpcClient98.request;_context200.n=2;return this.wallet.writeContract(call);case 2:return _context200.a(2,_context200.v);}},_callee200,this);}));function transferFrom(_x142){return _transferFrom2.apply(this,arguments);}return transferFrom;}()/**
2817
+ */},{key:"transferFrom",value:(function(){var _transferFrom2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee201(request){var _yield$this$rpcClient98,call;return _regenerator().w(function(_context201){while(1)switch(_context201.n){case 0:_context201.n=1;return this.rpcClient.simulateContract({abi:wrappedIpAbi,address:this.address,functionName:"transferFrom",account:this.wallet.account,args:[request.from,request.to,request.amount]});case 1:_yield$this$rpcClient98=_context201.v;call=_yield$this$rpcClient98.request;_context201.n=2;return this.wallet.writeContract(call);case 2:return _context201.a(2,_context201.v);}},_callee201,this);}));function transferFrom(_x143){return _transferFrom2.apply(this,arguments);}return transferFrom;}()/**
2809
2818
  * method transferFrom for contract WrappedIP with only encode
2810
2819
  *
2811
2820
  * @param request WrappedIpTransferFromRequest
@@ -2815,7 +2824,7 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
2815
2824
  *
2816
2825
  * @param request WrappedIpWithdrawRequest
2817
2826
  * @return Promise<WriteContractReturnType>
2818
- */},{key:"withdraw",value:(function(){var _withdraw=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee201(request){var _yield$this$rpcClient99,call;return _regenerator().w(function(_context201){while(1)switch(_context201.n){case 0:_context201.n=1;return this.rpcClient.simulateContract({abi:wrappedIpAbi,address:this.address,functionName:"withdraw",account:this.wallet.account,args:[request.value]});case 1:_yield$this$rpcClient99=_context201.v;call=_yield$this$rpcClient99.request;_context201.n=2;return this.wallet.writeContract(call);case 2:return _context201.a(2,_context201.v);}},_callee201,this);}));function withdraw(_x143){return _withdraw.apply(this,arguments);}return withdraw;}()/**
2827
+ */},{key:"withdraw",value:(function(){var _withdraw=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee202(request){var _yield$this$rpcClient99,call;return _regenerator().w(function(_context202){while(1)switch(_context202.n){case 0:_context202.n=1;return this.rpcClient.simulateContract({abi:wrappedIpAbi,address:this.address,functionName:"withdraw",account:this.wallet.account,args:[request.value]});case 1:_yield$this$rpcClient99=_context202.v;call=_yield$this$rpcClient99.request;_context202.n=2;return this.wallet.writeContract(call);case 2:return _context202.a(2,_context202.v);}},_callee202,this);}));function withdraw(_x144){return _withdraw.apply(this,arguments);}return withdraw;}()/**
2819
2828
  * method withdraw for contract WrappedIP with only encode
2820
2829
  *
2821
2830
  * @param request WrappedIpWithdrawRequest
@@ -3070,6 +3079,15 @@ var ERC20Client = /*#__PURE__*/function () {
3070
3079
  value: value
3071
3080
  });
3072
3081
  }
3082
+ }, {
3083
+ key: "transferFromEncode",
3084
+ value: function transferFromEncode(from, to, value) {
3085
+ return this.ercClient.transferFromEncode({
3086
+ from: from,
3087
+ to: to,
3088
+ value: value
3089
+ });
3090
+ }
3073
3091
 
3074
3092
  // The method only will work in test environment
3075
3093
  }, {
@@ -3185,6 +3203,15 @@ var WipTokenClient = /*#__PURE__*/function () {
3185
3203
  value: function depositEncode() {
3186
3204
  return this.wipClient.depositEncode();
3187
3205
  }
3206
+ }, {
3207
+ key: "transferFromEncode",
3208
+ value: function transferFromEncode(from, to, value) {
3209
+ return this.wipClient.transferFromEncode({
3210
+ from: from,
3211
+ to: to,
3212
+ amount: value
3213
+ });
3214
+ }
3188
3215
  }, {
3189
3216
  key: "address",
3190
3217
  get: function get() {
@@ -4111,6 +4138,10 @@ var getMinimumBond = /*#__PURE__*/function () {
4111
4138
  * - Executing the settlement transaction
4112
4139
  * - Waiting for transaction confirmation
4113
4140
  *
4141
+ * Retry behavior: If the OOV3 contract reverts with "Assertion not expired" (because
4142
+ * the assertion liveness period has not yet elapsed), the function retries up to 5 times
4143
+ * with a 3-second delay between attempts. Other errors are not retried.
4144
+ *
4114
4145
  * @see https://docs.story.foundation/docs/uma-arbitration-policy#/
4115
4146
  * @see https://docs.uma.xyz/developers/optimistic-oracle-v3
4116
4147
  *
@@ -4121,11 +4152,19 @@ var getMinimumBond = /*#__PURE__*/function () {
4121
4152
  */
4122
4153
  var settleAssertion = /*#__PURE__*/function () {
4123
4154
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(privateKey, disputeId, transport) {
4124
- var baseConfig, rpcClient, walletClient, arbitrationPolicyUmaClient, oov3Contract, assertionId, txHash, _t;
4155
+ var maxAttempts, retryDelayMs, attempt, baseConfig, rpcClient, walletClient, arbitrationPolicyUmaClient, oov3Contract, assertionId, txHash, msg, _t;
4125
4156
  return _regenerator().w(function (_context4) {
4126
4157
  while (1) switch (_context4.p = _context4.n) {
4127
4158
  case 0:
4128
- _context4.p = 0;
4159
+ maxAttempts = 5;
4160
+ retryDelayMs = 3000;
4161
+ attempt = 1;
4162
+ case 1:
4163
+ if (!(attempt <= maxAttempts)) {
4164
+ _context4.n = 11;
4165
+ break;
4166
+ }
4167
+ _context4.p = 2;
4129
4168
  baseConfig = {
4130
4169
  chain: chainStringToViemChain("aeneid"),
4131
4170
  transport: http(transport !== null && transport !== void 0 ? transport : aeneid.rpcUrls["default"].http[0])
@@ -4135,37 +4174,57 @@ var settleAssertion = /*#__PURE__*/function () {
4135
4174
  account: privateKeyToAccount(privateKey)
4136
4175
  }));
4137
4176
  arbitrationPolicyUmaClient = new ArbitrationPolicyUmaClient(rpcClient, walletClient);
4138
- _context4.n = 1;
4177
+ _context4.n = 3;
4139
4178
  return getOov3Contract(arbitrationPolicyUmaClient);
4140
- case 1:
4179
+ case 3:
4141
4180
  oov3Contract = _context4.v;
4142
- _context4.n = 2;
4181
+ _context4.n = 4;
4143
4182
  return arbitrationPolicyUmaClient.disputeIdToAssertionId({
4144
4183
  disputeId: BigInt(disputeId)
4145
4184
  });
4146
- case 2:
4185
+ case 4:
4147
4186
  assertionId = _context4.v;
4148
- _context4.n = 3;
4187
+ _context4.n = 5;
4149
4188
  return walletClient.writeContract({
4150
4189
  address: oov3Contract,
4151
4190
  abi: ASSERTION_ABI,
4152
4191
  functionName: "settleAssertion",
4153
4192
  args: [assertionId]
4154
4193
  });
4155
- case 3:
4194
+ case 5:
4156
4195
  txHash = _context4.v;
4157
- _context4.n = 4;
4196
+ _context4.n = 6;
4158
4197
  return rpcClient.waitForTransactionReceipt({
4159
4198
  hash: txHash
4160
4199
  });
4161
- case 4:
4200
+ case 6:
4162
4201
  return _context4.a(2, txHash);
4163
- case 5:
4164
- _context4.p = 5;
4202
+ case 7:
4203
+ _context4.p = 7;
4165
4204
  _t = _context4.v;
4205
+ msg = _t instanceof Error ? _t.message : String(_t);
4206
+ if (!(attempt < maxAttempts && msg.includes("Assertion not expired"))) {
4207
+ _context4.n = 9;
4208
+ break;
4209
+ }
4210
+ _context4.n = 8;
4211
+ return new Promise(function (resolve) {
4212
+ return setTimeout(resolve, retryDelayMs);
4213
+ });
4214
+ case 8:
4215
+ return _context4.a(3, 10);
4216
+ case 9:
4166
4217
  return _context4.a(2, handleError(_t, "Failed to settle assertion"));
4218
+ case 10:
4219
+ attempt++;
4220
+ _context4.n = 1;
4221
+ break;
4222
+ case 11:
4223
+ throw new Error("Failed to settle assertion: max retries exceeded");
4224
+ case 12:
4225
+ return _context4.a(2);
4167
4226
  }
4168
- }, _callee4, null, [[0, 5]]);
4227
+ }, _callee4, null, [[2, 7]]);
4169
4228
  }));
4170
4229
  return function settleAssertion(_x8, _x9, _x0) {
4171
4230
  return _ref4.apply(this, arguments);
@@ -4759,6 +4818,48 @@ var AccessPermission = /*#__PURE__*/function (AccessPermission) {
4759
4818
  return AccessPermission;
4760
4819
  }({});
4761
4820
 
4821
+ var MAINNET_CHAIN_ID = 1514;
4822
+ var AENEID_CHAIN_ID = 1315;
4823
+
4824
+ /** Per-chain whitelist: chainId -> set of allowed currency token addresses (checksummed). */
4825
+ var CURRENCY_TOKEN_WHITELIST = _defineProperty(_defineProperty({}, MAINNET_CHAIN_ID, new Set([getAddress$1(wrappedIpAddress[MAINNET_CHAIN_ID])])), AENEID_CHAIN_ID, new Set([getAddress$1(wrappedIpAddress[AENEID_CHAIN_ID]), getAddress$1(erc20Address[AENEID_CHAIN_ID])]));
4826
+
4827
+ /** Human-readable description and error hint per chain. */
4828
+ var CHAIN_CURRENCY_HINT = _defineProperty(_defineProperty({}, MAINNET_CHAIN_ID, "On Mainnet, only WIP is allowed as currency token."), AENEID_CHAIN_ID, "On Aeneid Testnet, only WIP or MERC20 is allowed as currency token.");
4829
+ var toChainId = function toChainId(chainId) {
4830
+ if (chainId === "mainnet" || chainId === 1514) {
4831
+ return 1514;
4832
+ }
4833
+ if (chainId === "aeneid" || chainId === 1315) {
4834
+ return 1315;
4835
+ }
4836
+ return chainId;
4837
+ };
4838
+
4839
+ /**
4840
+ * Validates that the currency token is allowed for the given chain.
4841
+ * - Aeneid Testnet (1315): allows WIP or MERC20
4842
+ * - Mainnet (1514): allows WIP only
4843
+ *
4844
+ * @param token - The currency token address to validate
4845
+ * @param chainId - The chain ID (1315 or "aeneid" for Aeneid, 1514 or "mainnet" for Mainnet)
4846
+ * @throws Error if token is zero address or not allowed for the chain
4847
+ */
4848
+ var validateCurrencyToken = function validateCurrencyToken(token, chainId) {
4849
+ if (token === null || token === undefined || token === zeroAddress) {
4850
+ throw new Error("Currency token cannot be zero address.");
4851
+ }
4852
+ var resolvedChainId = toChainId(chainId);
4853
+ var allowedTokens = CURRENCY_TOKEN_WHITELIST[resolvedChainId];
4854
+ if (allowedTokens === null || allowedTokens === undefined) {
4855
+ throw new Error("Unsupported chain ID: ".concat(chainId, "."));
4856
+ }
4857
+ var normalizedToken = getAddress$1(token);
4858
+ if (!allowedTokens.has(normalizedToken)) {
4859
+ throw new Error("".concat(CHAIN_CURRENCY_HINT[resolvedChainId], " The provided token is not allowed."));
4860
+ }
4861
+ };
4862
+
4762
4863
  /**
4763
4864
  * Gets the function signature from an ABI for a given method name
4764
4865
  * @param abi - The contract ABI
@@ -5533,6 +5634,9 @@ var GroupClient = /*#__PURE__*/function () {
5533
5634
  }
5534
5635
  throw new Error("Currency token cannot be the zero address.");
5535
5636
  case 4:
5637
+ currencyTokens.forEach(function (token) {
5638
+ return validateCurrencyToken(validateAddress(token), _this.chainId);
5639
+ });
5536
5640
  collectAndClaimParams = {
5537
5641
  groupIpId: validateAddress(groupIpId),
5538
5642
  currencyTokens: validateAddresses(currencyTokens),
@@ -5696,6 +5800,7 @@ var GroupClient = /*#__PURE__*/function () {
5696
5800
  case 0:
5697
5801
  groupIpId = _ref6.groupIpId, currencyToken = _ref6.currencyToken, memberIpIds = _ref6.memberIpIds;
5698
5802
  _context9.p = 1;
5803
+ validateCurrencyToken(validateAddress(currencyToken), this.chainId);
5699
5804
  _context9.n = 2;
5700
5805
  return this.groupingModuleClient.getClaimableReward({
5701
5806
  groupId: validateAddress(groupIpId),
@@ -5776,6 +5881,7 @@ var GroupClient = /*#__PURE__*/function () {
5776
5881
  case 0:
5777
5882
  groupIpId = _ref8.groupIpId, currencyToken = _ref8.currencyToken, memberIpIds = _ref8.memberIpIds, txOptions = _ref8.txOptions;
5778
5883
  _context1.p = 1;
5884
+ validateCurrencyToken(validateAddress(currencyToken), this.chainId);
5779
5885
  claimRewardParam = {
5780
5886
  groupId: validateAddress(groupIpId),
5781
5887
  ipIds: validateAddresses(memberIpIds),
@@ -5835,6 +5941,7 @@ var GroupClient = /*#__PURE__*/function () {
5835
5941
  case 0:
5836
5942
  groupIpId = _ref9.groupIpId, currencyToken = _ref9.currencyToken, txOptions = _ref9.txOptions;
5837
5943
  _context10.p = 1;
5944
+ validateCurrencyToken(validateAddress(currencyToken), this.chainId);
5838
5945
  collectRoyaltiesParam = {
5839
5946
  groupId: validateAddress(groupIpId),
5840
5947
  token: validateAddress(currencyToken)
@@ -6206,6 +6313,24 @@ var IPAccountClient = /*#__PURE__*/function () {
6206
6313
  }]);
6207
6314
  }();
6208
6315
 
6316
+ function _regeneratorValues(e) {
6317
+ if (null != e) {
6318
+ var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
6319
+ r = 0;
6320
+ if (t) return t.call(e);
6321
+ if ("function" == typeof e.next) return e;
6322
+ if (!isNaN(e.length)) return {
6323
+ next: function () {
6324
+ return e && r >= e.length && (e = void 0), {
6325
+ value: e && e[r++],
6326
+ done: !e
6327
+ };
6328
+ }
6329
+ };
6330
+ }
6331
+ throw new TypeError(typeof e + " is not iterable");
6332
+ }
6333
+
6209
6334
  var SignatureMethodType = /*#__PURE__*/function (SignatureMethodType) {
6210
6335
  SignatureMethodType["REGISTER_IP_AND_MAKE_DERIVATIVE_AND_DEPLOY_ROYALTY_VAULT"] = "registerIpAndMakeDerivativeAndDeployRoyaltyVault";
6211
6336
  SignatureMethodType["DISTRIBUTE_ROYALTY_TOKENS"] = "distributeRoyaltyTokens";
@@ -6548,181 +6673,572 @@ var generateOperationSignature = /*#__PURE__*/function () {
6548
6673
  };
6549
6674
  }();
6550
6675
 
6551
- var _PILFlavor;
6552
- var PIL_URIS = {
6553
- NCSR: "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/NCSR.json",
6554
- COMMERCIAL_USE: "https://github.com/piplabs/pil-document/blob/9a1f803fcf8101a8a78f1dcc929e6014e144ab56/off-chain-terms/CommercialUse.json",
6555
- COMMERCIAL_REMIX: "https://github.com/piplabs/pil-document/blob/ad67bb632a310d2557f8abcccd428e4c9c798db1/off-chain-terms/CommercialRemix.json",
6556
- CC_BY: "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/CC-BY.json"
6557
- };
6558
- var COMMON_DEFAULTS = {
6559
- transferable: true,
6560
- royaltyPolicy: zeroAddress,
6561
- defaultMintingFee: 0n,
6562
- expiration: 0n,
6563
- commercializerChecker: zeroAddress,
6564
- commercializerCheckerData: zeroAddress,
6565
- commercialRevShare: 0,
6566
- commercialRevCeiling: 0n,
6567
- derivativeRevCeiling: 0n,
6568
- currency: zeroAddress
6569
- };
6570
-
6571
- /**
6572
- * Pre-configured Programmable IP License (PIL) flavors for ease of use.
6573
- *
6574
- * The PIL is highly configurable, but these pre-configured license terms (flavors)
6575
- * are the most popular options that cover common use cases.
6576
- *
6577
- * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors | PIL Flavors Documentation}
6578
- *
6579
- * @example
6580
- * ```typescript
6581
- * // Create a commercial use license
6582
- * const commercialLicense = PILFlavor.commercialUse({
6583
- * defaultMintingFee: 1000000000000000000n, // 1 IP minting fee
6584
- * currencyToken: "0x1234...", // currency token
6585
- * royaltyPolicy: "LAP" // royalty policy
6586
- * });
6587
- *
6588
- * // Create a non-commercial social remixing license
6589
- * const remixLicense = PILFlavor.nonCommercialSocialRemixing();
6590
- * ```
6591
- */
6592
- var PILFlavor = /*#__PURE__*/_createClass(function PILFlavor() {
6593
- _classCallCheck(this, PILFlavor);
6594
- });
6595
- _PILFlavor = PILFlavor;
6596
- _defineProperty(PILFlavor, "_nonComSocialRemixingPIL", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
6597
- commercialUse: false,
6598
- commercialAttribution: false,
6599
- derivativesAllowed: true,
6600
- derivativesAttribution: true,
6601
- derivativesApproval: false,
6602
- derivativesReciprocal: true,
6603
- uri: PIL_URIS.NCSR
6604
- }));
6605
- _defineProperty(PILFlavor, "_commercialUse", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
6606
- commercialUse: true,
6607
- commercialAttribution: true,
6608
- derivativesAllowed: false,
6609
- derivativesAttribution: false,
6610
- derivativesApproval: false,
6611
- derivativesReciprocal: false,
6612
- uri: PIL_URIS.COMMERCIAL_USE
6613
- }));
6614
- _defineProperty(PILFlavor, "_commercialRemix", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
6615
- commercialUse: true,
6616
- commercialAttribution: true,
6617
- derivativesAllowed: true,
6618
- derivativesAttribution: true,
6619
- derivativesApproval: false,
6620
- derivativesReciprocal: true,
6621
- uri: PIL_URIS.COMMERCIAL_REMIX
6622
- }));
6623
- _defineProperty(PILFlavor, "_creativeCommonsAttribution", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
6624
- commercialUse: true,
6625
- commercialAttribution: true,
6626
- derivativesAllowed: true,
6627
- derivativesAttribution: true,
6628
- derivativesApproval: false,
6629
- derivativesReciprocal: true,
6630
- uri: PIL_URIS.CC_BY
6631
- }));
6632
- /**
6633
- * Gets the values to create a Non-Commercial Social Remixing license terms flavor.
6634
- * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#non-commercial-social-remixing | Non Commercial Social Remixing}
6635
- */
6636
- _defineProperty(PILFlavor, "nonCommercialSocialRemixing", function (request) {
6637
- 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);
6638
- });
6639
- /**
6640
- * Gets the values to create a Commercial Use license terms flavor.
6641
- * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#commercial-use | Commercial Use}
6642
- */
6643
- _defineProperty(PILFlavor, "commercialUse", function (_ref) {
6644
- var defaultMintingFee = _ref.defaultMintingFee,
6645
- currency = _ref.currency,
6646
- royaltyPolicy = _ref.royaltyPolicy,
6647
- chainId = _ref.chainId,
6648
- override = _ref.override;
6649
- return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._commercialUse), {}, {
6650
- defaultMintingFee: defaultMintingFee,
6651
- currency: currency,
6652
- royaltyPolicy: royaltyPolicy
6653
- }, override), chainId);
6654
- });
6655
- /**
6656
- * Gets the values to create a Commercial Remixing license terms flavor.
6657
- * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#commercial-remix | Commercial Remix}
6658
- */
6659
- _defineProperty(PILFlavor, "commercialRemix", function (_ref2) {
6660
- var defaultMintingFee = _ref2.defaultMintingFee,
6661
- royaltyPolicy = _ref2.royaltyPolicy,
6662
- currency = _ref2.currency,
6663
- commercialRevShare = _ref2.commercialRevShare,
6664
- chainId = _ref2.chainId,
6665
- override = _ref2.override;
6666
- return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._commercialRemix), {}, {
6667
- commercialRevShare: commercialRevShare,
6668
- defaultMintingFee: defaultMintingFee,
6669
- currency: currency,
6670
- royaltyPolicy: royaltyPolicy
6671
- }, override), chainId);
6672
- });
6673
- /**
6674
- * Gets the values to create a Creative Commons Attribution (CC-BY) license terms flavor.
6675
- * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#creative-commons-attribution | Creative Commons Attribution}
6676
- */
6677
- _defineProperty(PILFlavor, "creativeCommonsAttribution", function (_ref3) {
6678
- var royaltyPolicy = _ref3.royaltyPolicy,
6679
- currency = _ref3.currency,
6680
- chainId = _ref3.chainId,
6681
- override = _ref3.override;
6682
- return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._creativeCommonsAttribution), {}, {
6683
- currency: currency,
6684
- royaltyPolicy: royaltyPolicy
6685
- }, override), chainId);
6686
- });
6687
- _defineProperty(PILFlavor, "validateLicenseTerms", function (params, chainId) {
6688
- var normalized = _objectSpread2(_objectSpread2({}, params), {}, {
6689
- defaultMintingFee: BigInt(params.defaultMintingFee),
6690
- expiration: BigInt(params.expiration),
6691
- commercialRevCeiling: BigInt(params.commercialRevCeiling),
6692
- derivativeRevCeiling: BigInt(params.derivativeRevCeiling),
6693
- royaltyPolicy: royaltyPolicyInputToAddress(params.royaltyPolicy, chainId)
6694
- });
6695
- var royaltyPolicy = normalized.royaltyPolicy,
6696
- currency = normalized.currency;
6697
-
6698
- // Validate royalty policy and currency relationship
6699
- if (royaltyPolicy !== zeroAddress && currency === zeroAddress) {
6700
- throw new PILFlavorError("Royalty policy requires currency token.");
6676
+ function _objectWithoutPropertiesLoose(r, e) {
6677
+ if (null == r) return {};
6678
+ var t = {};
6679
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
6680
+ if (-1 !== e.indexOf(n)) continue;
6681
+ t[n] = r[n];
6701
6682
  }
6683
+ return t;
6684
+ }
6702
6685
 
6703
- // Validate defaultMintingFee
6704
- if (normalized.defaultMintingFee < 0n) {
6705
- throw new PILFlavorError("DefaultMintingFee should be greater than or equal to 0.");
6706
- }
6707
- if (normalized.defaultMintingFee > 0n && normalized.royaltyPolicy === zeroAddress) {
6708
- throw new PILFlavorError("Royalty policy is required when defaultMintingFee is greater than 0.");
6686
+ function _objectWithoutProperties(e, t) {
6687
+ if (null == e) return {};
6688
+ var o,
6689
+ r,
6690
+ i = _objectWithoutPropertiesLoose(e, t);
6691
+ if (Object.getOwnPropertySymbols) {
6692
+ var n = Object.getOwnPropertySymbols(e);
6693
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
6709
6694
  }
6695
+ return i;
6696
+ }
6710
6697
 
6711
- // Validate commercial use and derivatives
6712
- _PILFlavor.verifyCommercialUse(normalized);
6713
- _PILFlavor.verifyDerivatives(normalized);
6714
- if (normalized.commercialRevShare > 100 || normalized.commercialRevShare < 0) {
6715
- throw new PILFlavorError("commercialRevShare must be between 0 and 100.");
6698
+ var _excluded = ["mintFees", "spenderAddress", "encodedTxs"];
6699
+ /**
6700
+ * Handles batch transaction execution through IP Account with automatic fee management for ERC20 and WIP tokens.
6701
+ */
6702
+ var IpAccountBatchExecutor = /*#__PURE__*/function () {
6703
+ function IpAccountBatchExecutor(rpcClient, wallet, ipId) {
6704
+ _classCallCheck(this, IpAccountBatchExecutor);
6705
+ this.rpcClient = rpcClient;
6706
+ this.wallet = wallet;
6707
+ this.ipId = ipId;
6708
+ //erc20 address only available in aeneid
6709
+ this.erc20Token = new ERC20Client(rpcClient, wallet, erc20Address[aeneid.id]);
6710
+ this.wipToken = new WipTokenClient(rpcClient, wallet);
6711
+ this.walletAddress = wallet.account.address;
6716
6712
  }
6717
- return normalized;
6718
- });
6719
- _defineProperty(PILFlavor, "verifyCommercialUse", function (terms) {
6720
- if (!terms.commercialUse) {
6721
- var commercialFields = [{
6722
- field: "commercialAttribution",
6723
- value: terms.commercialAttribution
6724
- }, {
6725
- field: "commercializerChecker",
6713
+
6714
+ /**
6715
+ * Executes a batch transaction with automatic fee handling for both ERC20 and WIP tokens.
6716
+ */
6717
+ return _createClass(IpAccountBatchExecutor, [{
6718
+ key: "executeWithFees",
6719
+ value: (function () {
6720
+ var _executeWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
6721
+ var _options$options;
6722
+ var mintFees, spenderAddress, encodedTxs, options, _groupTokenSpenders, wipSpenders, erc20Spenders, wipTotalFees, erc20TotalFees, wipBalance, callData, depositValue, _yield$this$buildWipD, calls, value, isMulticall, _iterator, _step, _step$value, index, call, _value, _txHash, txHash, _t, _t2, _t3, _t4, _t5, _t6, _t7;
6723
+ return _regenerator().w(function (_context) {
6724
+ while (1) switch (_context.p = _context.n) {
6725
+ case 0:
6726
+ mintFees = _ref.mintFees, spenderAddress = _ref.spenderAddress, encodedTxs = _ref.encodedTxs, options = _objectWithoutProperties(_ref, _excluded);
6727
+ _groupTokenSpenders = groupTokenSpenders(mintFees.map(function (fee) {
6728
+ return _objectSpread2({
6729
+ address: spenderAddress
6730
+ }, fee);
6731
+ })), wipSpenders = _groupTokenSpenders.wipSpenders, erc20Spenders = _groupTokenSpenders.erc20Spenders;
6732
+ wipTotalFees = wipSpenders.reduce(function (acc, spender) {
6733
+ return acc + (spender.amount || 0n);
6734
+ }, 0n);
6735
+ erc20TotalFees = erc20Spenders.reduce(function (acc, spender) {
6736
+ return acc + (spender.amount || 0n);
6737
+ }, 0n);
6738
+ _context.n = 1;
6739
+ return this.wipToken.balanceOf(this.walletAddress);
6740
+ case 1:
6741
+ wipBalance = _context.v;
6742
+ callData = [];
6743
+ depositValue = 0n; // Build ERC20 fee call data if needed
6744
+ if (!(erc20TotalFees > 0n)) {
6745
+ _context.n = 3;
6746
+ break;
6747
+ }
6748
+ _t = callData.push;
6749
+ _t2 = callData;
6750
+ _t3 = _toConsumableArray;
6751
+ _context.n = 2;
6752
+ return this.buildErc20FeeCallData(erc20TotalFees, spenderAddress, options);
6753
+ case 2:
6754
+ _t.apply.call(_t, _t2, _t3(_context.v));
6755
+ case 3:
6756
+ if (!(wipTotalFees > 0n)) {
6757
+ _context.n = 7;
6758
+ break;
6759
+ }
6760
+ if (!(wipBalance < wipTotalFees)) {
6761
+ _context.n = 5;
6762
+ break;
6763
+ }
6764
+ _context.n = 4;
6765
+ return this.buildWipDepositCallData(spenderAddress, wipTotalFees, wipBalance, options);
6766
+ case 4:
6767
+ _yield$this$buildWipD = _context.v;
6768
+ calls = _yield$this$buildWipD.calls;
6769
+ value = _yield$this$buildWipD.value;
6770
+ callData.push.apply(callData, _toConsumableArray(calls));
6771
+ depositValue = value;
6772
+ _context.n = 7;
6773
+ break;
6774
+ case 5:
6775
+ _t4 = callData.push;
6776
+ _t5 = callData;
6777
+ _t6 = _toConsumableArray;
6778
+ _context.n = 6;
6779
+ return this.buildWipTransferCallData(wipTotalFees, spenderAddress, options);
6780
+ case 6:
6781
+ _t4.apply.call(_t4, _t5, _t6(_context.v));
6782
+ case 7:
6783
+ // Add the actual transaction call data
6784
+ callData.push({
6785
+ target: encodedTxs.to,
6786
+ value: 0n,
6787
+ data: encodedTxs.data
6788
+ });
6789
+ isMulticall = ((_options$options = options.options) === null || _options$options === void 0 || (_options$options = _options$options.wipOptions) === null || _options$options === void 0 ? void 0 : _options$options.useMulticallWhenPossible) !== false;
6790
+ if (isMulticall) {
6791
+ _context.n = 16;
6792
+ break;
6793
+ }
6794
+ _iterator = _createForOfIteratorHelper(callData.entries());
6795
+ _context.p = 8;
6796
+ _iterator.s();
6797
+ case 9:
6798
+ if ((_step = _iterator.n()).done) {
6799
+ _context.n = 13;
6800
+ break;
6801
+ }
6802
+ _step$value = _slicedToArray(_step.value, 2), index = _step$value[0], call = _step$value[1];
6803
+ _value = call.value;
6804
+ _context.n = 10;
6805
+ return simulateAndWriteContract({
6806
+ rpcClient: this.rpcClient,
6807
+ wallet: this.wallet,
6808
+ data: _objectSpread2({
6809
+ abi: ipAccountImplAbi,
6810
+ address: this.ipId,
6811
+ functionName: "execute",
6812
+ args: [call.target, call.value, call.data, 0]
6813
+ }, _value > 0n && {
6814
+ value: _value
6815
+ })
6816
+ });
6817
+ case 10:
6818
+ _txHash = _context.v;
6819
+ _context.n = 11;
6820
+ return waitTx(this.rpcClient, _txHash.txHash);
6821
+ case 11:
6822
+ if (!(index === callData.length - 1)) {
6823
+ _context.n = 12;
6824
+ break;
6825
+ }
6826
+ return _context.a(2, {
6827
+ txHash: _txHash.txHash,
6828
+ receipt: _txHash.receipt
6829
+ });
6830
+ case 12:
6831
+ _context.n = 9;
6832
+ break;
6833
+ case 13:
6834
+ _context.n = 15;
6835
+ break;
6836
+ case 14:
6837
+ _context.p = 14;
6838
+ _t7 = _context.v;
6839
+ _iterator.e(_t7);
6840
+ case 15:
6841
+ _context.p = 15;
6842
+ _iterator.f();
6843
+ return _context.f(15);
6844
+ case 16:
6845
+ _context.n = 17;
6846
+ return simulateAndWriteContract({
6847
+ rpcClient: this.rpcClient,
6848
+ wallet: this.wallet,
6849
+ data: _objectSpread2({
6850
+ abi: ipAccountImplAbi,
6851
+ address: this.ipId,
6852
+ functionName: "executeBatch",
6853
+ args: [callData, 0]
6854
+ }, depositValue > 0n && {
6855
+ value: depositValue
6856
+ })
6857
+ });
6858
+ case 17:
6859
+ txHash = _context.v;
6860
+ _context.n = 18;
6861
+ return waitTx(this.rpcClient, txHash.txHash, options.txOptions);
6862
+ case 18:
6863
+ return _context.a(2, {
6864
+ txHash: txHash.txHash,
6865
+ receipt: txHash.receipt
6866
+ });
6867
+ }
6868
+ }, _callee, this, [[8, 14, 15, 16]]);
6869
+ }));
6870
+ function executeWithFees(_x) {
6871
+ return _executeWithFees.apply(this, arguments);
6872
+ }
6873
+ return executeWithFees;
6874
+ }()
6875
+ /**
6876
+ * Builds call data for transferring ERC20 tokens from wallet to IP account and approving spender.
6877
+ */
6878
+ )
6879
+ }, {
6880
+ key: "buildErc20FeeCallData",
6881
+ value: (function () {
6882
+ var _buildErc20FeeCallData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(totalFee, spenderAddress, options) {
6883
+ var _options$options2;
6884
+ var erc20Balance, autoApprove, erc20ContractAddress, allowance, calls, spenderAllowance, _t8, _t9;
6885
+ return _regenerator().w(function (_context2) {
6886
+ while (1) switch (_context2.n) {
6887
+ case 0:
6888
+ _context2.n = 1;
6889
+ return this.erc20Token.balanceOf(this.walletAddress);
6890
+ case 1:
6891
+ erc20Balance = _context2.v;
6892
+ if (!(erc20Balance < totalFee)) {
6893
+ _context2.n = 2;
6894
+ break;
6895
+ }
6896
+ throw new Error("Wallet does not have enough ERC20 tokens to pay for fees. " + "Required: ".concat(getTokenAmountDisplay(totalFee), ", ") + "Available: ".concat(getTokenAmountDisplay(erc20Balance), "."));
6897
+ case 2:
6898
+ autoApprove = ((_options$options2 = options.options) === null || _options$options2 === void 0 || (_options$options2 = _options$options2.erc20Options) === null || _options$options2 === void 0 ? void 0 : _options$options2.enableAutoApprove) !== false; // erc20 address only available in aeneid
6899
+ erc20ContractAddress = erc20Address[aeneid.id];
6900
+ _context2.n = 3;
6901
+ return this.erc20Token.allowance(this.walletAddress, this.ipId);
6902
+ case 3:
6903
+ allowance = _context2.v;
6904
+ if (!(autoApprove && allowance < totalFee)) {
6905
+ _context2.n = 5;
6906
+ break;
6907
+ }
6908
+ _t8 = waitTx;
6909
+ _t9 = this.rpcClient;
6910
+ _context2.n = 4;
6911
+ return this.erc20Token.approve(this.ipId, maxUint256);
6912
+ case 4:
6913
+ _context2.n = 5;
6914
+ return _t8(_t9, _context2.v);
6915
+ case 5:
6916
+ calls = [{
6917
+ target: erc20ContractAddress,
6918
+ value: 0n,
6919
+ data: this.erc20Token.transferFromEncode(this.walletAddress, this.ipId, totalFee).data
6920
+ }];
6921
+ _context2.n = 6;
6922
+ return this.erc20Token.allowance(this.ipId, spenderAddress);
6923
+ case 6:
6924
+ spenderAllowance = _context2.v;
6925
+ if (autoApprove && spenderAllowance < totalFee) {
6926
+ calls.push({
6927
+ target: erc20ContractAddress,
6928
+ value: 0n,
6929
+ data: this.erc20Token.approveEncode(spenderAddress, maxUint256).data
6930
+ });
6931
+ }
6932
+ return _context2.a(2, calls);
6933
+ }
6934
+ }, _callee2, this);
6935
+ }));
6936
+ function buildErc20FeeCallData(_x2, _x3, _x4) {
6937
+ return _buildErc20FeeCallData.apply(this, arguments);
6938
+ }
6939
+ return buildErc20FeeCallData;
6940
+ }()
6941
+ /**
6942
+ * Builds call data for depositing IP tokens to WIP and approving spender.
6943
+ */
6944
+ )
6945
+ }, {
6946
+ key: "buildWipDepositCallData",
6947
+ value: (function () {
6948
+ var _buildWipDepositCallData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(spenderAddress, totalFee, wipBalance, options) {
6949
+ var _options$options3, _options$options4;
6950
+ var calls, autoApprove, autoWrapIp, ipBalance, value, allowance;
6951
+ return _regenerator().w(function (_context3) {
6952
+ while (1) switch (_context3.n) {
6953
+ case 0:
6954
+ calls = [];
6955
+ autoApprove = ((_options$options3 = options.options) === null || _options$options3 === void 0 || (_options$options3 = _options$options3.wipOptions) === null || _options$options3 === void 0 ? void 0 : _options$options3.enableAutoApprove) !== false;
6956
+ autoWrapIp = ((_options$options4 = options.options) === null || _options$options4 === void 0 || (_options$options4 = _options$options4.wipOptions) === null || _options$options4 === void 0 ? void 0 : _options$options4.enableAutoWrapIp) !== false;
6957
+ _context3.n = 1;
6958
+ return this.rpcClient.getBalance({
6959
+ address: this.walletAddress
6960
+ });
6961
+ case 1:
6962
+ ipBalance = _context3.v;
6963
+ if (autoWrapIp) {
6964
+ _context3.n = 2;
6965
+ break;
6966
+ }
6967
+ throw new Error("Wallet does not have enough WIP to pay for fees. Total fees: ".concat(getTokenAmountDisplay(totalFee), ", balance: ").concat(getTokenAmountDisplay(wipBalance, "WIP"), "."));
6968
+ case 2:
6969
+ if (!(ipBalance < totalFee)) {
6970
+ _context3.n = 3;
6971
+ break;
6972
+ }
6973
+ throw new Error("Wallet does not have enough IP tokens to wrap to WIP and pay for fees. " + "Required: ".concat(getTokenAmountDisplay(totalFee), ", ") + "Available: ".concat(getTokenAmountDisplay(ipBalance), "."));
6974
+ case 3:
6975
+ calls.push({
6976
+ target: WIP_TOKEN_ADDRESS,
6977
+ value: totalFee,
6978
+ data: this.wipToken.depositEncode().data
6979
+ });
6980
+ value = totalFee;
6981
+ _context3.n = 4;
6982
+ return this.wipToken.allowance(this.ipId, spenderAddress);
6983
+ case 4:
6984
+ allowance = _context3.v;
6985
+ if (autoApprove && allowance < totalFee) {
6986
+ calls.push({
6987
+ target: WIP_TOKEN_ADDRESS,
6988
+ value: 0n,
6989
+ data: this.wipToken.approveEncode(spenderAddress, maxUint256).data
6990
+ });
6991
+ }
6992
+ return _context3.a(2, {
6993
+ calls: calls,
6994
+ value: value
6995
+ });
6996
+ }
6997
+ }, _callee3, this);
6998
+ }));
6999
+ function buildWipDepositCallData(_x5, _x6, _x7, _x8) {
7000
+ return _buildWipDepositCallData.apply(this, arguments);
7001
+ }
7002
+ return buildWipDepositCallData;
7003
+ }()
7004
+ /**
7005
+ * Builds call data for transferring existing WIP tokens from wallet to IP account and approving spender.
7006
+ */
7007
+ )
7008
+ }, {
7009
+ key: "buildWipTransferCallData",
7010
+ value: (function () {
7011
+ var _buildWipTransferCallData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(totalFee, spenderAddress, options) {
7012
+ var _options$options5;
7013
+ var autoApprove, allowance, calls, spenderAllowance, _t0, _t1;
7014
+ return _regenerator().w(function (_context4) {
7015
+ while (1) switch (_context4.n) {
7016
+ case 0:
7017
+ autoApprove = ((_options$options5 = options.options) === null || _options$options5 === void 0 || (_options$options5 = _options$options5.wipOptions) === null || _options$options5 === void 0 ? void 0 : _options$options5.enableAutoApprove) !== false;
7018
+ _context4.n = 1;
7019
+ return this.wipToken.allowance(this.walletAddress, this.ipId);
7020
+ case 1:
7021
+ allowance = _context4.v;
7022
+ if (!(autoApprove && allowance < totalFee)) {
7023
+ _context4.n = 3;
7024
+ break;
7025
+ }
7026
+ _t0 = waitTx;
7027
+ _t1 = this.rpcClient;
7028
+ _context4.n = 2;
7029
+ return this.wipToken.approve(this.ipId, maxUint256);
7030
+ case 2:
7031
+ _context4.n = 3;
7032
+ return _t0(_t1, _context4.v);
7033
+ case 3:
7034
+ calls = [{
7035
+ target: WIP_TOKEN_ADDRESS,
7036
+ value: 0n,
7037
+ data: this.wipToken.transferFromEncode(this.walletAddress, this.ipId, totalFee).data
7038
+ }];
7039
+ _context4.n = 4;
7040
+ return this.wipToken.allowance(this.ipId, spenderAddress);
7041
+ case 4:
7042
+ spenderAllowance = _context4.v;
7043
+ if (autoApprove && spenderAllowance < totalFee) {
7044
+ calls.push({
7045
+ target: WIP_TOKEN_ADDRESS,
7046
+ value: 0n,
7047
+ data: this.wipToken.approveEncode(spenderAddress, maxUint256).data
7048
+ });
7049
+ }
7050
+ return _context4.a(2, calls);
7051
+ }
7052
+ }, _callee4, this);
7053
+ }));
7054
+ function buildWipTransferCallData(_x9, _x0, _x1) {
7055
+ return _buildWipTransferCallData.apply(this, arguments);
7056
+ }
7057
+ return buildWipTransferCallData;
7058
+ }())
7059
+ }]);
7060
+ }();
7061
+
7062
+ var _PILFlavor;
7063
+ var PIL_URIS = {
7064
+ NCSR: "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/NCSR.json",
7065
+ COMMERCIAL_USE: "https://github.com/piplabs/pil-document/blob/9a1f803fcf8101a8a78f1dcc929e6014e144ab56/off-chain-terms/CommercialUse.json",
7066
+ COMMERCIAL_REMIX: "https://github.com/piplabs/pil-document/blob/ad67bb632a310d2557f8abcccd428e4c9c798db1/off-chain-terms/CommercialRemix.json",
7067
+ CC_BY: "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/CC-BY.json"
7068
+ };
7069
+ var COMMON_DEFAULTS = {
7070
+ transferable: true,
7071
+ royaltyPolicy: zeroAddress,
7072
+ defaultMintingFee: 0n,
7073
+ expiration: 0n,
7074
+ commercializerChecker: zeroAddress,
7075
+ commercializerCheckerData: zeroAddress,
7076
+ commercialRevShare: 0,
7077
+ commercialRevCeiling: 0n,
7078
+ derivativeRevCeiling: 0n,
7079
+ currency: zeroAddress
7080
+ };
7081
+
7082
+ /**
7083
+ * Pre-configured Programmable IP License (PIL) flavors for ease of use.
7084
+ *
7085
+ * The PIL is highly configurable, but these pre-configured license terms (flavors)
7086
+ * are the most popular options that cover common use cases.
7087
+ *
7088
+ * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors | PIL Flavors Documentation}
7089
+ *
7090
+ * @example
7091
+ * ```typescript
7092
+ * // Create a commercial use license
7093
+ * const commercialLicense = PILFlavor.commercialUse({
7094
+ * defaultMintingFee: 1000000000000000000n, // 1 IP minting fee
7095
+ * currencyToken: "0x1234...", // currency token
7096
+ * royaltyPolicy: "LAP" // royalty policy
7097
+ * });
7098
+ *
7099
+ * // Create a non-commercial social remixing license
7100
+ * const remixLicense = PILFlavor.nonCommercialSocialRemixing();
7101
+ * ```
7102
+ */
7103
+ var PILFlavor = /*#__PURE__*/_createClass(function PILFlavor() {
7104
+ _classCallCheck(this, PILFlavor);
7105
+ });
7106
+ _PILFlavor = PILFlavor;
7107
+ _defineProperty(PILFlavor, "_nonComSocialRemixingPIL", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
7108
+ commercialUse: false,
7109
+ commercialAttribution: false,
7110
+ derivativesAllowed: true,
7111
+ derivativesAttribution: true,
7112
+ derivativesApproval: false,
7113
+ derivativesReciprocal: true,
7114
+ uri: PIL_URIS.NCSR
7115
+ }));
7116
+ _defineProperty(PILFlavor, "_commercialUse", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
7117
+ commercialUse: true,
7118
+ commercialAttribution: true,
7119
+ derivativesAllowed: false,
7120
+ derivativesAttribution: false,
7121
+ derivativesApproval: false,
7122
+ derivativesReciprocal: false,
7123
+ uri: PIL_URIS.COMMERCIAL_USE
7124
+ }));
7125
+ _defineProperty(PILFlavor, "_commercialRemix", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
7126
+ commercialUse: true,
7127
+ commercialAttribution: true,
7128
+ derivativesAllowed: true,
7129
+ derivativesAttribution: true,
7130
+ derivativesApproval: false,
7131
+ derivativesReciprocal: true,
7132
+ uri: PIL_URIS.COMMERCIAL_REMIX
7133
+ }));
7134
+ _defineProperty(PILFlavor, "_creativeCommonsAttribution", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
7135
+ commercialUse: true,
7136
+ commercialAttribution: true,
7137
+ derivativesAllowed: true,
7138
+ derivativesAttribution: true,
7139
+ derivativesApproval: false,
7140
+ derivativesReciprocal: true,
7141
+ uri: PIL_URIS.CC_BY
7142
+ }));
7143
+ /**
7144
+ * Gets the values to create a Non-Commercial Social Remixing license terms flavor.
7145
+ * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#non-commercial-social-remixing | Non Commercial Social Remixing}
7146
+ */
7147
+ _defineProperty(PILFlavor, "nonCommercialSocialRemixing", function (request) {
7148
+ 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);
7149
+ });
7150
+ /**
7151
+ * Gets the values to create a Commercial Use license terms flavor.
7152
+ * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#commercial-use | Commercial Use}
7153
+ */
7154
+ _defineProperty(PILFlavor, "commercialUse", function (_ref) {
7155
+ var defaultMintingFee = _ref.defaultMintingFee,
7156
+ currency = _ref.currency,
7157
+ royaltyPolicy = _ref.royaltyPolicy,
7158
+ chainId = _ref.chainId,
7159
+ override = _ref.override;
7160
+ return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._commercialUse), {}, {
7161
+ defaultMintingFee: defaultMintingFee,
7162
+ currency: currency,
7163
+ royaltyPolicy: royaltyPolicy
7164
+ }, override), chainId);
7165
+ });
7166
+ /**
7167
+ * Gets the values to create a Commercial Remixing license terms flavor.
7168
+ * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#commercial-remix | Commercial Remix}
7169
+ */
7170
+ _defineProperty(PILFlavor, "commercialRemix", function (_ref2) {
7171
+ var defaultMintingFee = _ref2.defaultMintingFee,
7172
+ royaltyPolicy = _ref2.royaltyPolicy,
7173
+ currency = _ref2.currency,
7174
+ commercialRevShare = _ref2.commercialRevShare,
7175
+ chainId = _ref2.chainId,
7176
+ override = _ref2.override;
7177
+ return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._commercialRemix), {}, {
7178
+ commercialRevShare: commercialRevShare,
7179
+ defaultMintingFee: defaultMintingFee,
7180
+ currency: currency,
7181
+ royaltyPolicy: royaltyPolicy
7182
+ }, override), chainId);
7183
+ });
7184
+ /**
7185
+ * Gets the values to create a Creative Commons Attribution (CC-BY) license terms flavor.
7186
+ * @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#creative-commons-attribution | Creative Commons Attribution}
7187
+ */
7188
+ _defineProperty(PILFlavor, "creativeCommonsAttribution", function (_ref3) {
7189
+ var royaltyPolicy = _ref3.royaltyPolicy,
7190
+ currency = _ref3.currency,
7191
+ chainId = _ref3.chainId,
7192
+ override = _ref3.override;
7193
+ return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._creativeCommonsAttribution), {}, {
7194
+ currency: currency,
7195
+ royaltyPolicy: royaltyPolicy
7196
+ }, override), chainId);
7197
+ });
7198
+ _defineProperty(PILFlavor, "validateLicenseTerms", function (params, chainId) {
7199
+ var normalized = _objectSpread2(_objectSpread2({}, params), {}, {
7200
+ defaultMintingFee: BigInt(params.defaultMintingFee),
7201
+ expiration: BigInt(params.expiration),
7202
+ commercialRevCeiling: BigInt(params.commercialRevCeiling),
7203
+ derivativeRevCeiling: BigInt(params.derivativeRevCeiling),
7204
+ royaltyPolicy: royaltyPolicyInputToAddress(params.royaltyPolicy, chainId)
7205
+ });
7206
+ var royaltyPolicy = normalized.royaltyPolicy,
7207
+ currency = normalized.currency;
7208
+
7209
+ // Validate royalty policy and currency relationship
7210
+ if (royaltyPolicy !== zeroAddress && currency === zeroAddress) {
7211
+ throw new PILFlavorError("Royalty policy requires currency token.");
7212
+ }
7213
+
7214
+ // Validate currency token is allowed for the chain when currency is set (Aeneid: WIP or MERC20; Mainnet: WIP only). Zero address is allowed (e.g. no royalty).
7215
+ if (currency !== null && currency !== undefined && currency !== zeroAddress && chainId !== undefined) {
7216
+ validateCurrencyToken(currency, chainId);
7217
+ }
7218
+
7219
+ // Validate defaultMintingFee
7220
+ if (normalized.defaultMintingFee < 0n) {
7221
+ throw new PILFlavorError("DefaultMintingFee should be greater than or equal to 0.");
7222
+ }
7223
+ if (normalized.defaultMintingFee > 0n && normalized.royaltyPolicy === zeroAddress) {
7224
+ throw new PILFlavorError("Royalty policy is required when defaultMintingFee is greater than 0.");
7225
+ }
7226
+
7227
+ // Validate commercial use and derivatives
7228
+ _PILFlavor.verifyCommercialUse(normalized);
7229
+ _PILFlavor.verifyDerivatives(normalized);
7230
+ if (normalized.commercialRevShare > 100 || normalized.commercialRevShare < 0) {
7231
+ throw new PILFlavorError("commercialRevShare must be between 0 and 100.");
7232
+ }
7233
+ return normalized;
7234
+ });
7235
+ _defineProperty(PILFlavor, "verifyCommercialUse", function (terms) {
7236
+ if (!terms.commercialUse) {
7237
+ var commercialFields = [{
7238
+ field: "commercialAttribution",
7239
+ value: terms.commercialAttribution
7240
+ }, {
7241
+ field: "commercializerChecker",
6726
7242
  value: terms.commercializerChecker !== zeroAddress
6727
7243
  }, {
6728
7244
  field: "commercialRevShare",
@@ -6777,24 +7293,6 @@ _defineProperty(PILFlavor, "verifyDerivatives", function (terms) {
6777
7293
  }
6778
7294
  });
6779
7295
 
6780
- function _regeneratorValues(e) {
6781
- if (null != e) {
6782
- var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
6783
- r = 0;
6784
- if (t) return t.call(e);
6785
- if ("function" == typeof e.next) return e;
6786
- if (!isNaN(e.length)) return {
6787
- next: function () {
6788
- return e && r >= e.length && (e = void 0), {
6789
- value: e && e[r++],
6790
- done: !e
6791
- };
6792
- }
6793
- };
6794
- }
6795
- throw new TypeError(typeof e + " is not iterable");
6796
- }
6797
-
6798
7296
  function _regeneratorKeys(e) {
6799
7297
  var n = Object(e),
6800
7298
  r = [];
@@ -6825,7 +7323,7 @@ var getPublicMinting = /*#__PURE__*/function () {
6825
7323
  }();
6826
7324
  var validateLicenseTermsData = /*#__PURE__*/function () {
6827
7325
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(licenseTermsData, rpcClient, chainId) {
6828
- var licenseTerms, processedLicenseTermsData, maxLicenseTokens, i, licenseTerm, royaltyModuleReadOnlyClient, isWhitelistedArbitrationPolicy, isWhitelistedRoyaltyToken, licensingConfig, maxLicenseTokensValue;
7326
+ var licenseTerms, processedLicenseTermsData, maxLicenseTokens, i, licenseTerm, licenseTermsDataInput, royaltyModuleReadOnlyClient, isWhitelistedArbitrationPolicy, isWhitelistedRoyaltyToken, piLicenseTemplateReadOnlyClient, isExist, response, licensingConfig, maxLicenseTokensValue;
6829
7327
  return _regenerator().w(function (_context2) {
6830
7328
  while (1) switch (_context2.n) {
6831
7329
  case 0:
@@ -6835,10 +7333,16 @@ var validateLicenseTermsData = /*#__PURE__*/function () {
6835
7333
  i = 0;
6836
7334
  case 1:
6837
7335
  if (!(i < licenseTermsData.length)) {
6838
- _context2.n = 10;
7336
+ _context2.n = 16;
6839
7337
  break;
6840
7338
  }
6841
- licenseTerm = PILFlavor.validateLicenseTerms(licenseTermsData[i].terms, chainId);
7339
+ licenseTerm = void 0;
7340
+ licenseTermsDataInput = licenseTermsData[i];
7341
+ if (!licenseTermsDataInput.terms) {
7342
+ _context2.n = 6;
7343
+ break;
7344
+ }
7345
+ licenseTerm = PILFlavor.validateLicenseTerms(licenseTermsDataInput.terms, chainId);
6842
7346
  licenseTerm.commercialRevShare = getRevenueShare(licenseTerm.commercialRevShare);
6843
7347
  royaltyModuleReadOnlyClient = new RoyaltyModuleReadOnlyClient(rpcClient);
6844
7348
  if (!(validateAddress(licenseTerm.royaltyPolicy) !== zeroAddress)) {
@@ -6861,6 +7365,7 @@ var validateLicenseTermsData = /*#__PURE__*/function () {
6861
7365
  _context2.n = 5;
6862
7366
  break;
6863
7367
  }
7368
+ validateCurrencyToken(licenseTerm.currency, chainId);
6864
7369
  _context2.n = 4;
6865
7370
  return royaltyModuleReadOnlyClient.isWhitelistedRoyaltyToken({
6866
7371
  token: licenseTerm.currency
@@ -6873,37 +7378,69 @@ var validateLicenseTermsData = /*#__PURE__*/function () {
6873
7378
  }
6874
7379
  throw new Error("The currency token ".concat(licenseTerm.currency, " is not whitelisted."));
6875
7380
  case 5:
7381
+ _context2.n = 11;
7382
+ break;
7383
+ case 6:
7384
+ if (!(licenseTermsDataInput.licenseTermsId !== undefined)) {
7385
+ _context2.n = 10;
7386
+ break;
7387
+ }
7388
+ piLicenseTemplateReadOnlyClient = new PiLicenseTemplateReadOnlyClient(rpcClient);
7389
+ _context2.n = 7;
7390
+ return piLicenseTemplateReadOnlyClient.exists({
7391
+ licenseTermsId: BigInt(licenseTermsDataInput.licenseTermsId)
7392
+ });
7393
+ case 7:
7394
+ isExist = _context2.v;
7395
+ if (isExist) {
7396
+ _context2.n = 8;
7397
+ break;
7398
+ }
7399
+ throw new Error("The license terms id ".concat(licenseTermsDataInput.licenseTermsId, " is not exist."));
7400
+ case 8:
7401
+ _context2.n = 9;
7402
+ return piLicenseTemplateReadOnlyClient.getLicenseTerms({
7403
+ selectedLicenseTermsId: BigInt(licenseTermsDataInput.licenseTermsId)
7404
+ });
7405
+ case 9:
7406
+ response = _context2.v;
7407
+ licenseTerm = response.terms;
7408
+ _context2.n = 11;
7409
+ break;
7410
+ case 10:
7411
+ throw new Error("Either terms or licenseTermsId must be provided.");
7412
+ case 11:
6876
7413
  licensingConfig = validateLicenseConfig(licenseTermsData[i].licensingConfig);
6877
7414
  if (!(licensingConfig.mintingFee > 0 && licenseTerm.royaltyPolicy === zeroAddress)) {
6878
- _context2.n = 6;
7415
+ _context2.n = 12;
6879
7416
  break;
6880
7417
  }
6881
7418
  throw new Error("A royalty policy must be provided when the minting fee is greater than 0.");
6882
- case 6:
7419
+ case 12:
6883
7420
  maxLicenseTokensValue = licenseTermsData[i].maxLicenseTokens;
6884
7421
  if (!(maxLicenseTokensValue !== undefined)) {
6885
- _context2.n = 8;
7422
+ _context2.n = 14;
6886
7423
  break;
6887
7424
  }
6888
7425
  if (!(maxLicenseTokensValue < 0)) {
6889
- _context2.n = 7;
7426
+ _context2.n = 13;
6890
7427
  break;
6891
7428
  }
6892
7429
  throw new Error("The max license tokens must be greater than or equal to 0.");
6893
- case 7:
7430
+ case 13:
6894
7431
  licensingConfig.licensingHook = totalLicenseTokenLimitHookAddress[chainId];
6895
7432
  maxLicenseTokens[i] = BigInt(maxLicenseTokensValue);
6896
- case 8:
7433
+ case 14:
6897
7434
  licenseTerms.push(licenseTerm);
6898
7435
  processedLicenseTermsData.push({
6899
7436
  terms: licenseTerm,
6900
7437
  licensingConfig: licensingConfig
6901
7438
  });
6902
- case 9:
7439
+ case 15:
6903
7440
  i++;
6904
7441
  _context2.n = 1;
6905
7442
  break;
6906
- case 10:
7443
+ case 16:
6907
7444
  return _context2.a(2, {
6908
7445
  licenseTerms: licenseTerms,
6909
7446
  licenseTermsData: processedLicenseTermsData,
@@ -8344,6 +8881,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8344
8881
  this.spgNftClient = new SpgnftImplReadOnlyClient(rpcClient);
8345
8882
  this.totalLicenseTokenLimitHookClient = new TotalLicenseTokenLimitHookClient(rpcClient, wallet);
8346
8883
  this.licenseTokenClient = new LicenseTokenClient(rpcClient, wallet);
8884
+ this.erc20Client = new Erc20Client(rpcClient, wallet, erc20Address[chainId]);
8347
8885
  this.rpcClient = rpcClient;
8348
8886
  this.wallet = wallet;
8349
8887
  this.chainId = chainId;
@@ -8679,8 +9217,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8679
9217
  key: "registerDerivative",
8680
9218
  value: (function () {
8681
9219
  var _registerDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(request) {
8682
- var _this2 = this;
8683
- var _request$txOptions2, isChildIpIdRegistered, derivativeData, object, encodedTxData, _request$options, contractCall, _t5;
9220
+ var _request$txOptions2, isChildIpIdRegistered, derivativeData, object, encodedTxData, mintFees, batchExecutor, _t5;
8684
9221
  return _regenerator().w(function (_context4) {
8685
9222
  while (1) switch (_context4.p = _context4.n) {
8686
9223
  case 0:
@@ -8716,82 +9253,160 @@ var IPAssetClient = /*#__PURE__*/function () {
8716
9253
  encodedTxData: encodedTxData
8717
9254
  });
8718
9255
  case 4:
8719
- contractCall = function contractCall() {
8720
- return _this2.licensingModuleClient.registerDerivative(object);
8721
- };
8722
- return _context4.a(2, this.handleRegistrationWithFees({
8723
- sender: this.walletAddress,
9256
+ _context4.n = 5;
9257
+ return calculateDerivativeMintingFee({
8724
9258
  derivData: object,
8725
- contractCall: contractCall,
8726
- txOptions: request.txOptions,
8727
- encodedTxs: [encodedTxData],
8728
- spgSpenderAddress: this.royaltyModuleEventClient.address,
8729
- options: _objectSpread2(_objectSpread2({}, request.options), {}, {
8730
- wipOptions: _objectSpread2(_objectSpread2({}, (_request$options = request.options) === null || _request$options === void 0 ? void 0 : _request$options.wipOptions), {}, {
8731
- useMulticallWhenPossible: false
8732
- })
8733
- })
9259
+ rpcClient: this.rpcClient,
9260
+ wallet: this.wallet,
9261
+ chainId: this.chainId,
9262
+ sender: this.walletAddress
9263
+ });
9264
+ case 5:
9265
+ mintFees = _context4.v;
9266
+ batchExecutor = new IpAccountBatchExecutor(this.rpcClient, this.wallet, request.childIpId);
9267
+ return _context4.a(2, batchExecutor.executeWithFees({
9268
+ mintFees: mintFees,
9269
+ spenderAddress: this.royaltyModuleEventClient.address,
9270
+ encodedTxs: encodedTxData,
9271
+ options: request.options,
9272
+ txOptions: request.txOptions
9273
+ }));
9274
+ case 6:
9275
+ _context4.n = 8;
9276
+ break;
9277
+ case 7:
9278
+ _context4.p = 7;
9279
+ _t5 = _context4.v;
9280
+ return _context4.a(2, handleError(_t5, "Failed to register derivative"));
9281
+ case 8:
9282
+ return _context4.a(2);
9283
+ }
9284
+ }, _callee4, this, [[0, 7]]);
9285
+ }));
9286
+ function registerDerivative(_x5) {
9287
+ return _registerDerivative.apply(this, arguments);
9288
+ }
9289
+ return registerDerivative;
9290
+ }()
9291
+ /**
9292
+ * Batch registers a derivative directly with parent IP's license terms, without needing license tokens,
9293
+ * and attaches the license terms of the parent IPs to the derivative IP.
9294
+ * The license terms must be attached to the parent IP before calling this function.
9295
+ * All IPs attached default license terms by default.
9296
+ * The derivative IP owner must be the caller or an authorized operator.
9297
+ *
9298
+ * @remarks
9299
+ * This method supports automatic fee handling for both ERC20 and WIP tokens.
9300
+ * The fees are paid from the wallet address.
9301
+ * The transaction will be executed in the same order as the input arguments.
9302
+ * If a request fails, previous transactions will not be reverted.
9303
+ */
9304
+ )
9305
+ }, {
9306
+ key: "batchRegisterDerivatives",
9307
+ value: (function () {
9308
+ var _batchRegisterDerivatives = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref2) {
9309
+ var requests, options, txOptions, txHashes, index, result, _t6;
9310
+ return _regenerator().w(function (_context5) {
9311
+ while (1) switch (_context5.p = _context5.n) {
9312
+ case 0:
9313
+ requests = _ref2.requests, options = _ref2.options, txOptions = _ref2.txOptions;
9314
+ txHashes = [];
9315
+ index = 0;
9316
+ case 1:
9317
+ if (!(index < requests.length)) {
9318
+ _context5.n = 6;
9319
+ break;
9320
+ }
9321
+ _context5.p = 2;
9322
+ _context5.n = 3;
9323
+ return this.registerDerivative(_objectSpread2(_objectSpread2({}, requests[index]), {}, {
9324
+ options: options,
9325
+ txOptions: txOptions
8734
9326
  }));
9327
+ case 3:
9328
+ result = _context5.v;
9329
+ txHashes.push(result.txHash);
9330
+ index++;
9331
+ _context5.n = 5;
9332
+ break;
9333
+ case 4:
9334
+ _context5.p = 4;
9335
+ _t6 = _context5.v;
9336
+ return _context5.a(2, handleError(_t6, "Failed to batch register derivatives at index ".concat(index)));
8735
9337
  case 5:
8736
- _context4.n = 7;
9338
+ _context5.n = 1;
8737
9339
  break;
8738
9340
  case 6:
8739
- _context4.p = 6;
8740
- _t5 = _context4.v;
8741
- return _context4.a(2, handleError(_t5, "Failed to register derivative"));
8742
- case 7:
8743
- return _context4.a(2);
9341
+ return _context5.a(2, txHashes);
8744
9342
  }
8745
- }, _callee4, this, [[0, 6]]);
9343
+ }, _callee5, this, [[2, 4]]);
8746
9344
  }));
8747
- function registerDerivative(_x5) {
8748
- return _registerDerivative.apply(this, arguments);
9345
+ function batchRegisterDerivatives(_x6) {
9346
+ return _batchRegisterDerivatives.apply(this, arguments);
8749
9347
  }
8750
- return registerDerivative;
9348
+ return batchRegisterDerivatives;
8751
9349
  }()
8752
9350
  /**
9351
+ * @deprecated This method is deprecated. Please use the {@link batchRegisterDerivatives} instead.
9352
+ * This method will be removed soon.
8753
9353
  * Batch registers a derivative directly with parent IP's license terms.
9354
+ *
9355
+ * @example Migration Example
9356
+ * ```typescript
9357
+ * // Before (deprecated):
9358
+ * await client.ipAsset.batchRegisterDerivative({
9359
+ * args: [{ childIpId: '0x...', parentIpIds: ['0x...'], licenseTermsIds: [1n] }],
9360
+ * });
9361
+ *
9362
+ * // After (recommended):
9363
+ * await client.ipAsset.batchRegisterDerivatives({
9364
+ * requests: [{ childIpId: '0x...', parentIpIds: ['0x...'], licenseTermsIds: [1n] }],
9365
+ * });
9366
+ * ```
9367
+ *
9368
+ * @remarks This method does not support automatic fee handling for both ERC20 and WIP tokens.
8754
9369
  */
8755
9370
  )
8756
9371
  }, {
8757
9372
  key: "batchRegisterDerivative",
8758
9373
  value: (function () {
8759
- var _batchRegisterDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(request) {
8760
- var contracts, licenseModuleAddress, _iterator2, _step2, _arg$maxMintingFee, _arg$maxRevenueShare, arg, calculatedDeadline, ipAccount, data, _yield$ipAccount$stat, state, signature, txHash, _t6, _t7, _t8;
8761
- return _regenerator().w(function (_context5) {
8762
- while (1) switch (_context5.p = _context5.n) {
9374
+ var _batchRegisterDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(request) {
9375
+ var contracts, licenseModuleAddress, _iterator2, _step2, _arg$maxMintingFee, _arg$maxRevenueShare, arg, calculatedDeadline, ipAccount, data, _yield$ipAccount$stat, state, signature, txHash, _t7, _t8, _t9;
9376
+ return _regenerator().w(function (_context6) {
9377
+ while (1) switch (_context6.p = _context6.n) {
8763
9378
  case 0:
8764
- _context5.p = 0;
9379
+ _context6.p = 0;
8765
9380
  contracts = [];
8766
9381
  licenseModuleAddress = validateAddress(this.licensingModuleClient.address);
8767
9382
  _iterator2 = _createForOfIteratorHelper(request.args);
8768
- _context5.p = 1;
9383
+ _context6.p = 1;
8769
9384
  _iterator2.s();
8770
9385
  case 2:
8771
9386
  if ((_step2 = _iterator2.n()).done) {
8772
- _context5.n = 11;
9387
+ _context6.n = 11;
8773
9388
  break;
8774
9389
  }
8775
9390
  arg = _step2.value;
8776
- _context5.p = 3;
8777
- _context5.n = 4;
9391
+ _context6.p = 3;
9392
+ _context6.n = 4;
8778
9393
  return this.registerDerivative(_objectSpread2(_objectSpread2({}, arg), {}, {
8779
9394
  txOptions: {
8780
9395
  encodedTxDataOnly: true
8781
9396
  }
8782
9397
  }));
8783
9398
  case 4:
8784
- _context5.n = 6;
9399
+ _context6.n = 6;
8785
9400
  break;
8786
9401
  case 5:
8787
- _context5.p = 5;
8788
- _t6 = _context5.v;
8789
- throw new Error(_t6.message.replace("Failed to register derivative:", "").trim());
9402
+ _context6.p = 5;
9403
+ _t7 = _context6.v;
9404
+ throw new Error(_t7.message.replace("Failed to register derivative:", "").trim());
8790
9405
  case 6:
8791
- _context5.n = 7;
9406
+ _context6.n = 7;
8792
9407
  return getCalculatedDeadline(this.rpcClient, request.deadline);
8793
9408
  case 7:
8794
- calculatedDeadline = _context5.v;
9409
+ calculatedDeadline = _context6.v;
8795
9410
  ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(arg.childIpId));
8796
9411
  data = encodeFunctionData({
8797
9412
  abi: licensingModuleAbi,
@@ -8800,12 +9415,12 @@ var IPAssetClient = /*#__PURE__*/function () {
8800
9415
  return BigInt(id);
8801
9416
  }), arg.licenseTemplate || this.licenseTemplateAddress, zeroAddress, BigInt((_arg$maxMintingFee = arg.maxMintingFee) !== null && _arg$maxMintingFee !== void 0 ? _arg$maxMintingFee : 0), validateMaxRts(arg.maxRts), getRevenueShare((_arg$maxRevenueShare = arg.maxRevenueShare) !== null && _arg$maxRevenueShare !== void 0 ? _arg$maxRevenueShare : 100, RevShareType.MAX_REVENUE_SHARE)]
8802
9417
  });
8803
- _context5.n = 8;
9418
+ _context6.n = 8;
8804
9419
  return ipAccount.state();
8805
9420
  case 8:
8806
- _yield$ipAccount$stat = _context5.v;
9421
+ _yield$ipAccount$stat = _context6.v;
8807
9422
  state = _yield$ipAccount$stat.result;
8808
- _context5.n = 9;
9423
+ _context6.n = 9;
8809
9424
  return generateOperationSignature({
8810
9425
  ipIdAddress: arg.childIpId,
8811
9426
  methodType: SignatureMethodType.BATCH_REGISTER_DERIVATIVE,
@@ -8816,7 +9431,7 @@ var IPAssetClient = /*#__PURE__*/function () {
8816
9431
  chainId: this.chainId
8817
9432
  });
8818
9433
  case 9:
8819
- signature = _context5.v;
9434
+ signature = _context6.v;
8820
9435
  contracts.push({
8821
9436
  target: arg.childIpId,
8822
9437
  allowFailure: false,
@@ -8827,42 +9442,42 @@ var IPAssetClient = /*#__PURE__*/function () {
8827
9442
  })
8828
9443
  });
8829
9444
  case 10:
8830
- _context5.n = 2;
9445
+ _context6.n = 2;
8831
9446
  break;
8832
9447
  case 11:
8833
- _context5.n = 13;
9448
+ _context6.n = 13;
8834
9449
  break;
8835
9450
  case 12:
8836
- _context5.p = 12;
8837
- _t7 = _context5.v;
8838
- _iterator2.e(_t7);
9451
+ _context6.p = 12;
9452
+ _t8 = _context6.v;
9453
+ _iterator2.e(_t8);
8839
9454
  case 13:
8840
- _context5.p = 13;
9455
+ _context6.p = 13;
8841
9456
  _iterator2.f();
8842
- return _context5.f(13);
9457
+ return _context6.f(13);
8843
9458
  case 14:
8844
- _context5.n = 15;
9459
+ _context6.n = 15;
8845
9460
  return this.multicall3Client.aggregate3({
8846
9461
  calls: contracts
8847
9462
  });
8848
9463
  case 15:
8849
- txHash = _context5.v;
8850
- _context5.n = 16;
9464
+ txHash = _context6.v;
9465
+ _context6.n = 16;
8851
9466
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
8852
9467
  hash: txHash
8853
9468
  }));
8854
9469
  case 16:
8855
- return _context5.a(2, {
9470
+ return _context6.a(2, {
8856
9471
  txHash: txHash
8857
9472
  });
8858
9473
  case 17:
8859
- _context5.p = 17;
8860
- _t8 = _context5.v;
8861
- return _context5.a(2, handleError(_t8, "Failed to batch register derivative"));
9474
+ _context6.p = 17;
9475
+ _t9 = _context6.v;
9476
+ return _context6.a(2, handleError(_t9, "Failed to batch register derivative"));
8862
9477
  }
8863
- }, _callee5, this, [[3, 5], [1, 12, 13, 14], [0, 17]]);
9478
+ }, _callee6, this, [[3, 5], [1, 12, 13, 14], [0, 17]]);
8864
9479
  }));
8865
- function batchRegisterDerivative(_x6) {
9480
+ function batchRegisterDerivative(_x7) {
8866
9481
  return _batchRegisterDerivative.apply(this, arguments);
8867
9482
  }
8868
9483
  return batchRegisterDerivative;
@@ -8894,12 +9509,12 @@ var IPAssetClient = /*#__PURE__*/function () {
8894
9509
  }, {
8895
9510
  key: "registerDerivativeWithLicenseTokens",
8896
9511
  value: (function () {
8897
- var _registerDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(request) {
8898
- var _request$txOptions3, req, isChildIpIdRegistered, txHash, _t9;
8899
- return _regenerator().w(function (_context6) {
8900
- while (1) switch (_context6.p = _context6.n) {
9512
+ var _registerDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(request) {
9513
+ var _request$txOptions3, req, isChildIpIdRegistered, txHash, _t0;
9514
+ return _regenerator().w(function (_context7) {
9515
+ while (1) switch (_context7.p = _context7.n) {
8901
9516
  case 0:
8902
- _context6.p = 0;
9517
+ _context7.p = 0;
8903
9518
  req = {
8904
9519
  childIpId: validateAddress(request.childIpId),
8905
9520
  licenseTokenIds: request.licenseTokenIds.map(function (id) {
@@ -8908,59 +9523,59 @@ var IPAssetClient = /*#__PURE__*/function () {
8908
9523
  royaltyContext: zeroAddress,
8909
9524
  maxRts: validateMaxRts(request.maxRts)
8910
9525
  };
8911
- _context6.n = 1;
9526
+ _context7.n = 1;
8912
9527
  return this.isRegistered(request.childIpId);
8913
9528
  case 1:
8914
- isChildIpIdRegistered = _context6.v;
9529
+ isChildIpIdRegistered = _context7.v;
8915
9530
  if (isChildIpIdRegistered) {
8916
- _context6.n = 2;
9531
+ _context7.n = 2;
8917
9532
  break;
8918
9533
  }
8919
9534
  throw new Error("The child IP with id ".concat(request.childIpId, " is not registered."));
8920
9535
  case 2:
8921
9536
  if (!(request.licenseTokenIds.length === 0)) {
8922
- _context6.n = 3;
9537
+ _context7.n = 3;
8923
9538
  break;
8924
9539
  }
8925
9540
  throw new Error("The licenseTokenIds must be provided.");
8926
9541
  case 3:
8927
- _context6.n = 4;
9542
+ _context7.n = 4;
8928
9543
  return this.validateLicenseTokenIds(request.licenseTokenIds);
8929
9544
  case 4:
8930
- request.licenseTokenIds = _context6.v;
9545
+ request.licenseTokenIds = _context7.v;
8931
9546
  if (!((_request$txOptions3 = request.txOptions) !== null && _request$txOptions3 !== void 0 && _request$txOptions3.encodedTxDataOnly)) {
8932
- _context6.n = 5;
9547
+ _context7.n = 5;
8933
9548
  break;
8934
9549
  }
8935
- return _context6.a(2, {
9550
+ return _context7.a(2, {
8936
9551
  encodedTxData: this.licensingModuleClient.registerDerivativeWithLicenseTokensEncode(req)
8937
9552
  });
8938
9553
  case 5:
8939
- _context6.n = 6;
9554
+ _context7.n = 6;
8940
9555
  return this.licensingModuleClient.registerDerivativeWithLicenseTokens(req);
8941
9556
  case 6:
8942
- txHash = _context6.v;
8943
- _context6.n = 7;
9557
+ txHash = _context7.v;
9558
+ _context7.n = 7;
8944
9559
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
8945
9560
  hash: txHash
8946
9561
  }));
8947
9562
  case 7:
8948
- return _context6.a(2, {
9563
+ return _context7.a(2, {
8949
9564
  txHash: txHash
8950
9565
  });
8951
9566
  case 8:
8952
- _context6.n = 10;
9567
+ _context7.n = 10;
8953
9568
  break;
8954
9569
  case 9:
8955
- _context6.p = 9;
8956
- _t9 = _context6.v;
8957
- return _context6.a(2, handleError(_t9, "Failed to register derivative with license tokens"));
9570
+ _context7.p = 9;
9571
+ _t0 = _context7.v;
9572
+ return _context7.a(2, handleError(_t0, "Failed to register derivative with license tokens"));
8958
9573
  case 10:
8959
- return _context6.a(2);
9574
+ return _context7.a(2);
8960
9575
  }
8961
- }, _callee6, this, [[0, 9]]);
9576
+ }, _callee7, this, [[0, 9]]);
8962
9577
  }));
8963
- function registerDerivativeWithLicenseTokens(_x7) {
9578
+ function registerDerivativeWithLicenseTokens(_x8) {
8964
9579
  return _registerDerivativeWithLicenseTokens.apply(this, arguments);
8965
9580
  }
8966
9581
  return registerDerivativeWithLicenseTokens;
@@ -8992,14 +9607,14 @@ var IPAssetClient = /*#__PURE__*/function () {
8992
9607
  }, {
8993
9608
  key: "mintAndRegisterIpAssetWithPilTerms",
8994
9609
  value: (function () {
8995
- var _mintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(request) {
8996
- var _this3 = this;
8997
- var _request$txOptions4, _yield$transformRegis, transformRequest, encodedTxData, contractCall, rsp, computedLicenseTermsIds, maxLicenseTokensTxHashes, _t0;
8998
- return _regenerator().w(function (_context7) {
8999
- while (1) switch (_context7.p = _context7.n) {
9610
+ var _mintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(request) {
9611
+ var _this2 = this;
9612
+ var _request$txOptions4, _yield$transformRegis, transformRequest, encodedTxData, contractCall, rsp, computedLicenseTermsIds, maxLicenseTokensTxHashes, _t1;
9613
+ return _regenerator().w(function (_context8) {
9614
+ while (1) switch (_context8.p = _context8.n) {
9000
9615
  case 0:
9001
- _context7.p = 0;
9002
- _context7.n = 1;
9616
+ _context8.p = 0;
9617
+ _context8.n = 1;
9003
9618
  return transformRegistrationRequest({
9004
9619
  request: request,
9005
9620
  rpcClient: this.rpcClient,
@@ -9007,21 +9622,21 @@ var IPAssetClient = /*#__PURE__*/function () {
9007
9622
  chainId: this.chainId
9008
9623
  });
9009
9624
  case 1:
9010
- _yield$transformRegis = _context7.v;
9625
+ _yield$transformRegis = _context8.v;
9011
9626
  transformRequest = _yield$transformRegis.transformRequest;
9012
9627
  encodedTxData = this.licenseAttachmentWorkflowsClient.mintAndRegisterIpAndAttachPilTermsEncode(transformRequest);
9013
9628
  if (!((_request$txOptions4 = request.txOptions) !== null && _request$txOptions4 !== void 0 && _request$txOptions4.encodedTxDataOnly)) {
9014
- _context7.n = 2;
9629
+ _context8.n = 2;
9015
9630
  break;
9016
9631
  }
9017
- return _context7.a(2, {
9632
+ return _context8.a(2, {
9018
9633
  encodedTxData: encodedTxData
9019
9634
  });
9020
9635
  case 2:
9021
9636
  contractCall = function contractCall() {
9022
- return _this3.licenseAttachmentWorkflowsClient.mintAndRegisterIpAndAttachPilTerms(transformRequest);
9637
+ return _this2.licenseAttachmentWorkflowsClient.mintAndRegisterIpAndAttachPilTerms(transformRequest);
9023
9638
  };
9024
- _context7.n = 3;
9639
+ _context8.n = 3;
9025
9640
  return this.handleRegistrationWithFees({
9026
9641
  options: request.options,
9027
9642
  sender: this.walletAddress,
@@ -9032,14 +9647,14 @@ var IPAssetClient = /*#__PURE__*/function () {
9032
9647
  txOptions: request.txOptions
9033
9648
  });
9034
9649
  case 3:
9035
- rsp = _context7.v;
9036
- _context7.n = 4;
9650
+ rsp = _context8.v;
9651
+ _context8.n = 4;
9037
9652
  return this.getLicenseTermsId(transformRequest.licenseTermsData.map(function (data) {
9038
9653
  return data.terms;
9039
9654
  }));
9040
9655
  case 4:
9041
- computedLicenseTermsIds = _context7.v;
9042
- _context7.n = 5;
9656
+ computedLicenseTermsIds = _context8.v;
9657
+ _context8.n = 5;
9043
9658
  return setMaxLicenseTokens({
9044
9659
  maxLicenseTokensData: request.licenseTermsData,
9045
9660
  licensorIpId: rsp.ipId,
@@ -9048,20 +9663,20 @@ var IPAssetClient = /*#__PURE__*/function () {
9048
9663
  templateAddress: this.licenseTemplateAddress
9049
9664
  });
9050
9665
  case 5:
9051
- maxLicenseTokensTxHashes = _context7.v;
9052
- return _context7.a(2, _objectSpread2(_objectSpread2({}, rsp), {}, {
9666
+ maxLicenseTokensTxHashes = _context8.v;
9667
+ return _context8.a(2, _objectSpread2(_objectSpread2({}, rsp), {}, {
9053
9668
  licenseTermsIds: computedLicenseTermsIds
9054
9669
  }, maxLicenseTokensTxHashes.length > 0 && {
9055
9670
  maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
9056
9671
  }));
9057
9672
  case 6:
9058
- _context7.p = 6;
9059
- _t0 = _context7.v;
9060
- return _context7.a(2, handleError(_t0, "Failed to mint and register IP and attach PIL terms"));
9673
+ _context8.p = 6;
9674
+ _t1 = _context8.v;
9675
+ return _context8.a(2, handleError(_t1, "Failed to mint and register IP and attach PIL terms"));
9061
9676
  }
9062
- }, _callee7, this, [[0, 6]]);
9677
+ }, _callee8, this, [[0, 6]]);
9063
9678
  }));
9064
- function mintAndRegisterIpAssetWithPilTerms(_x8) {
9679
+ function mintAndRegisterIpAssetWithPilTerms(_x9) {
9065
9680
  return _mintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
9066
9681
  }
9067
9682
  return mintAndRegisterIpAssetWithPilTerms;
@@ -9069,64 +9684,68 @@ var IPAssetClient = /*#__PURE__*/function () {
9069
9684
  /**
9070
9685
  * Batch mint an NFT from a collection and register it as an IP.
9071
9686
  *
9687
+ * @remark For better gas efficiency, consider using {@link batchRegisterIpAssetsWithOptimizedWorkflows} instead.
9688
+ * The optimized workflows method provides intelligent transaction batching, automatic token handling.
9689
+ *
9072
9690
  * Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} and {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicensingModule.sol#L19 | `LicenseTermsAttached`} events.
9073
9691
  */
9074
9692
  )
9075
9693
  }, {
9076
9694
  key: "batchMintAndRegisterIpAssetWithPilTerms",
9077
9695
  value: (function () {
9078
- var _batchMintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(request) {
9079
- var calldata, _iterator3, _step3, arg, result, txHash, txReceipt, results, j, licenseTerms, licenseTermsData, i, licenseTerm, licenseTermsIds, maxLicenseTokensTxHashes, _t1, _t10;
9080
- return _regenerator().w(function (_context8) {
9081
- while (1) switch (_context8.p = _context8.n) {
9696
+ var _batchMintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(request) {
9697
+ var _this3 = this;
9698
+ var calldata, _iterator3, _step3, arg, result, txHash, txReceipt, results, _loop, j, _t10, _t11;
9699
+ return _regenerator().w(function (_context0) {
9700
+ while (1) switch (_context0.p = _context0.n) {
9082
9701
  case 0:
9083
- _context8.p = 0;
9702
+ _context0.p = 0;
9084
9703
  calldata = [];
9085
9704
  _iterator3 = _createForOfIteratorHelper(request.args);
9086
- _context8.p = 1;
9705
+ _context0.p = 1;
9087
9706
  _iterator3.s();
9088
9707
  case 2:
9089
9708
  if ((_step3 = _iterator3.n()).done) {
9090
- _context8.n = 5;
9709
+ _context0.n = 5;
9091
9710
  break;
9092
9711
  }
9093
9712
  arg = _step3.value;
9094
- _context8.n = 3;
9713
+ _context0.n = 3;
9095
9714
  return this.mintAndRegisterIpAssetWithPilTerms(_objectSpread2(_objectSpread2({}, arg), {}, {
9096
9715
  txOptions: {
9097
9716
  encodedTxDataOnly: true
9098
9717
  }
9099
9718
  }));
9100
9719
  case 3:
9101
- result = _context8.v;
9720
+ result = _context0.v;
9102
9721
  calldata.push(result.encodedTxData.data);
9103
9722
  case 4:
9104
- _context8.n = 2;
9723
+ _context0.n = 2;
9105
9724
  break;
9106
9725
  case 5:
9107
- _context8.n = 7;
9726
+ _context0.n = 7;
9108
9727
  break;
9109
9728
  case 6:
9110
- _context8.p = 6;
9111
- _t1 = _context8.v;
9112
- _iterator3.e(_t1);
9729
+ _context0.p = 6;
9730
+ _t10 = _context0.v;
9731
+ _iterator3.e(_t10);
9113
9732
  case 7:
9114
- _context8.p = 7;
9733
+ _context0.p = 7;
9115
9734
  _iterator3.f();
9116
- return _context8.f(7);
9735
+ return _context0.f(7);
9117
9736
  case 8:
9118
- _context8.n = 9;
9737
+ _context0.n = 9;
9119
9738
  return this.licenseAttachmentWorkflowsClient.multicall({
9120
9739
  data: calldata
9121
9740
  });
9122
9741
  case 9:
9123
- txHash = _context8.v;
9124
- _context8.n = 10;
9742
+ txHash = _context0.v;
9743
+ _context0.n = 10;
9125
9744
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
9126
9745
  hash: txHash
9127
9746
  }));
9128
9747
  case 10:
9129
- txReceipt = _context8.v;
9748
+ txReceipt = _context0.v;
9130
9749
  results = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt).map(function (log) {
9131
9750
  return {
9132
9751
  ipId: log.ipId,
@@ -9134,54 +9753,80 @@ var IPAssetClient = /*#__PURE__*/function () {
9134
9753
  spgNftContract: log.tokenContract,
9135
9754
  licenseTermsIds: []
9136
9755
  };
9137
- }); // Due to emit event log by sequence, we need to get license terms id from request.args
9756
+ }); // Get license terms id and max license tokens mapping relationship by the sequence of the request.args
9757
+ _loop = /*#__PURE__*/_regenerator().m(function _loop() {
9758
+ var licenseTerms, termsIndexes, licenseTermsData, licenseTermsIds, i, licenseTermsDataInput, validatedTerms, resolvedIds, filteredLicenseTermsIds, maxLicenseTokensTxHashes;
9759
+ return _regenerator().w(function (_context9) {
9760
+ while (1) switch (_context9.n) {
9761
+ case 0:
9762
+ licenseTerms = [];
9763
+ termsIndexes = [];
9764
+ licenseTermsData = request.args[j].licenseTermsData;
9765
+ licenseTermsIds = new Array(licenseTermsData.length).fill(null);
9766
+ for (i = 0; i < licenseTermsData.length; i++) {
9767
+ licenseTermsDataInput = licenseTermsData[i];
9768
+ if (licenseTermsDataInput.terms) {
9769
+ validatedTerms = PILFlavor.validateLicenseTerms(licenseTermsDataInput.terms, _this3.chainId);
9770
+ validatedTerms.commercialRevShare = getRevenueShare(validatedTerms.commercialRevShare);
9771
+ licenseTerms.push(validatedTerms);
9772
+ termsIndexes.push(i);
9773
+ } else if (licenseTermsDataInput.licenseTermsId !== undefined) {
9774
+ licenseTermsIds[i] = BigInt(licenseTermsDataInput.licenseTermsId);
9775
+ }
9776
+ }
9777
+ _context9.n = 1;
9778
+ return _this3.getLicenseTermsId(licenseTerms);
9779
+ case 1:
9780
+ resolvedIds = _context9.v;
9781
+ termsIndexes.forEach(function (value, index) {
9782
+ licenseTermsIds[value] = resolvedIds[index];
9783
+ });
9784
+ filteredLicenseTermsIds = licenseTermsIds.filter(function (id) {
9785
+ return id !== null;
9786
+ });
9787
+ results[j].licenseTermsIds = filteredLicenseTermsIds;
9788
+ _context9.n = 2;
9789
+ return setMaxLicenseTokens({
9790
+ maxLicenseTokensData: licenseTermsData,
9791
+ licensorIpId: results[j].ipId,
9792
+ licenseTermsIds: filteredLicenseTermsIds,
9793
+ totalLicenseTokenLimitHookClient: _this3.totalLicenseTokenLimitHookClient,
9794
+ templateAddress: _this3.licenseTemplateAddress
9795
+ });
9796
+ case 2:
9797
+ maxLicenseTokensTxHashes = _context9.v;
9798
+ if (maxLicenseTokensTxHashes.length > 0) {
9799
+ results[j].maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
9800
+ }
9801
+ case 3:
9802
+ return _context9.a(2);
9803
+ }
9804
+ }, _loop);
9805
+ });
9138
9806
  j = 0;
9139
9807
  case 11:
9140
9808
  if (!(j < request.args.length)) {
9141
- _context8.n = 15;
9809
+ _context0.n = 13;
9142
9810
  break;
9143
9811
  }
9144
- licenseTerms = [];
9145
- licenseTermsData = request.args[j].licenseTermsData;
9146
- for (i = 0; i < licenseTermsData.length; i++) {
9147
- licenseTerm = PILFlavor.validateLicenseTerms(licenseTermsData[i].terms, this.chainId);
9148
- licenseTerms.push(licenseTerm);
9149
- }
9150
- _context8.n = 12;
9151
- return this.getLicenseTermsId(licenseTerms);
9812
+ return _context0.d(_regeneratorValues(_loop()), 12);
9152
9813
  case 12:
9153
- licenseTermsIds = _context8.v;
9154
- results[j].licenseTermsIds = licenseTermsIds;
9155
- _context8.n = 13;
9156
- return setMaxLicenseTokens({
9157
- maxLicenseTokensData: licenseTermsData,
9158
- licensorIpId: results[j].ipId,
9159
- licenseTermsIds: licenseTermsIds,
9160
- totalLicenseTokenLimitHookClient: this.totalLicenseTokenLimitHookClient,
9161
- templateAddress: this.licenseTemplateAddress
9162
- });
9163
- case 13:
9164
- maxLicenseTokensTxHashes = _context8.v;
9165
- if (maxLicenseTokensTxHashes.length > 0) {
9166
- results[j].maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
9167
- }
9168
- case 14:
9169
9814
  j++;
9170
- _context8.n = 11;
9815
+ _context0.n = 11;
9171
9816
  break;
9172
- case 15:
9173
- return _context8.a(2, {
9817
+ case 13:
9818
+ return _context0.a(2, {
9174
9819
  txHash: txHash,
9175
9820
  results: results
9176
9821
  });
9177
- case 16:
9178
- _context8.p = 16;
9179
- _t10 = _context8.v;
9180
- return _context8.a(2, handleError(_t10, "Failed to batch mint and register IP and attach PIL terms"));
9822
+ case 14:
9823
+ _context0.p = 14;
9824
+ _t11 = _context0.v;
9825
+ return _context0.a(2, handleError(_t11, "Failed to batch mint and register IP and attach PIL terms"));
9181
9826
  }
9182
- }, _callee8, this, [[1, 6, 7, 8], [0, 16]]);
9827
+ }, _callee9, this, [[1, 6, 7, 8], [0, 14]]);
9183
9828
  }));
9184
- function batchMintAndRegisterIpAssetWithPilTerms(_x9) {
9829
+ function batchMintAndRegisterIpAssetWithPilTerms(_x0) {
9185
9830
  return _batchMintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
9186
9831
  }
9187
9832
  return batchMintAndRegisterIpAssetWithPilTerms;
@@ -9214,14 +9859,14 @@ var IPAssetClient = /*#__PURE__*/function () {
9214
9859
  }, {
9215
9860
  key: "registerIpAndAttachPilTerms",
9216
9861
  value: (function () {
9217
- var _registerIpAndAttachPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(request) {
9218
- var _request$txOptions5, ipIdAddress, isRegistered, _yield$validateLicens, licenseTerms, _yield$transformRegis2, _transformRequest, txHash, txReceipt, log, licenseTermsIds, maxLicenseTokensTxHashes, _t11;
9219
- return _regenerator().w(function (_context9) {
9220
- while (1) switch (_context9.p = _context9.n) {
9862
+ var _registerIpAndAttachPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(request) {
9863
+ var _request$txOptions5, ipIdAddress, isRegistered, _yield$validateLicens, licenseTerms, _yield$transformRegis2, _transformRequest, txHash, txReceipt, log, licenseTermsIds, maxLicenseTokensTxHashes, _t12;
9864
+ return _regenerator().w(function (_context1) {
9865
+ while (1) switch (_context1.p = _context1.n) {
9221
9866
  case 0:
9222
- _context9.p = 0;
9867
+ _context1.p = 0;
9223
9868
  request.tokenId = BigInt(request.tokenId);
9224
- _context9.n = 1;
9869
+ _context1.n = 1;
9225
9870
  return getIpIdAddress({
9226
9871
  nftContract: request.nftContract,
9227
9872
  tokenId: request.tokenId,
@@ -9230,23 +9875,23 @@ var IPAssetClient = /*#__PURE__*/function () {
9230
9875
  chainId: this.chainId
9231
9876
  });
9232
9877
  case 1:
9233
- ipIdAddress = _context9.v;
9234
- _context9.n = 2;
9878
+ ipIdAddress = _context1.v;
9879
+ _context1.n = 2;
9235
9880
  return this.isRegistered(ipIdAddress);
9236
9881
  case 2:
9237
- isRegistered = _context9.v;
9882
+ isRegistered = _context1.v;
9238
9883
  if (!isRegistered) {
9239
- _context9.n = 3;
9884
+ _context1.n = 3;
9240
9885
  break;
9241
9886
  }
9242
9887
  throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
9243
9888
  case 3:
9244
- _context9.n = 4;
9889
+ _context1.n = 4;
9245
9890
  return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
9246
9891
  case 4:
9247
- _yield$validateLicens = _context9.v;
9892
+ _yield$validateLicens = _context1.v;
9248
9893
  licenseTerms = _yield$validateLicens.licenseTerms;
9249
- _context9.n = 5;
9894
+ _context1.n = 5;
9250
9895
  return transformRegistrationRequest({
9251
9896
  request: request,
9252
9897
  rpcClient: this.rpcClient,
@@ -9254,32 +9899,32 @@ var IPAssetClient = /*#__PURE__*/function () {
9254
9899
  chainId: this.chainId
9255
9900
  });
9256
9901
  case 5:
9257
- _yield$transformRegis2 = _context9.v;
9902
+ _yield$transformRegis2 = _context1.v;
9258
9903
  _transformRequest = _yield$transformRegis2.transformRequest;
9259
9904
  if (!((_request$txOptions5 = request.txOptions) !== null && _request$txOptions5 !== void 0 && _request$txOptions5.encodedTxDataOnly)) {
9260
- _context9.n = 6;
9905
+ _context1.n = 6;
9261
9906
  break;
9262
9907
  }
9263
- return _context9.a(2, {
9908
+ return _context1.a(2, {
9264
9909
  encodedTxData: this.licenseAttachmentWorkflowsClient.registerIpAndAttachPilTermsEncode(_transformRequest)
9265
9910
  });
9266
9911
  case 6:
9267
- _context9.n = 7;
9912
+ _context1.n = 7;
9268
9913
  return this.licenseAttachmentWorkflowsClient.registerIpAndAttachPilTerms(_transformRequest);
9269
9914
  case 7:
9270
- txHash = _context9.v;
9271
- _context9.n = 8;
9915
+ txHash = _context1.v;
9916
+ _context1.n = 8;
9272
9917
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
9273
9918
  hash: txHash
9274
9919
  }));
9275
9920
  case 8:
9276
- txReceipt = _context9.v;
9921
+ txReceipt = _context1.v;
9277
9922
  log = this.getIpIdAndTokenIdsFromEvent(txReceipt)[0];
9278
- _context9.n = 9;
9923
+ _context1.n = 9;
9279
9924
  return this.getLicenseTermsId(licenseTerms);
9280
9925
  case 9:
9281
- licenseTermsIds = _context9.v;
9282
- _context9.n = 10;
9926
+ licenseTermsIds = _context1.v;
9927
+ _context1.n = 10;
9283
9928
  return setMaxLicenseTokens({
9284
9929
  maxLicenseTokensData: request.licenseTermsData,
9285
9930
  licensorIpId: log.ipId,
@@ -9288,26 +9933,26 @@ var IPAssetClient = /*#__PURE__*/function () {
9288
9933
  templateAddress: this.licenseTemplateAddress
9289
9934
  });
9290
9935
  case 10:
9291
- maxLicenseTokensTxHashes = _context9.v;
9292
- return _context9.a(2, _objectSpread2(_objectSpread2({
9936
+ maxLicenseTokensTxHashes = _context1.v;
9937
+ return _context1.a(2, _objectSpread2(_objectSpread2({
9293
9938
  txHash: txHash,
9294
9939
  licenseTermsIds: licenseTermsIds
9295
9940
  }, maxLicenseTokensTxHashes.length > 0 && {
9296
9941
  maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
9297
9942
  }), log));
9298
9943
  case 11:
9299
- _context9.n = 13;
9944
+ _context1.n = 13;
9300
9945
  break;
9301
9946
  case 12:
9302
- _context9.p = 12;
9303
- _t11 = _context9.v;
9304
- return _context9.a(2, handleError(_t11, "Failed to register IP and attach PIL terms"));
9947
+ _context1.p = 12;
9948
+ _t12 = _context1.v;
9949
+ return _context1.a(2, handleError(_t12, "Failed to register IP and attach PIL terms"));
9305
9950
  case 13:
9306
- return _context9.a(2);
9951
+ return _context1.a(2);
9307
9952
  }
9308
- }, _callee9, this, [[0, 12]]);
9953
+ }, _callee0, this, [[0, 12]]);
9309
9954
  }));
9310
- function registerIpAndAttachPilTerms(_x0) {
9955
+ function registerIpAndAttachPilTerms(_x1) {
9311
9956
  return _registerIpAndAttachPilTerms.apply(this, arguments);
9312
9957
  }
9313
9958
  return registerIpAndAttachPilTerms;
@@ -9340,15 +9985,15 @@ var IPAssetClient = /*#__PURE__*/function () {
9340
9985
  }, {
9341
9986
  key: "registerDerivativeIp",
9342
9987
  value: (function () {
9343
- var _registerDerivativeIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(request) {
9988
+ var _registerDerivativeIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(request) {
9344
9989
  var _this4 = this;
9345
- var _request$txOptions6, _request$options2, tokenId, ipIdAddress, isRegistered, _yield$transformRegis3, _transformRequest2, encodedTxData, contractCall, _t12;
9346
- return _regenerator().w(function (_context0) {
9347
- while (1) switch (_context0.p = _context0.n) {
9990
+ var _request$txOptions6, _request$options, tokenId, ipIdAddress, isRegistered, _yield$transformRegis3, _transformRequest2, encodedTxData, contractCall, _t13;
9991
+ return _regenerator().w(function (_context10) {
9992
+ while (1) switch (_context10.p = _context10.n) {
9348
9993
  case 0:
9349
- _context0.p = 0;
9994
+ _context10.p = 0;
9350
9995
  tokenId = BigInt(request.tokenId);
9351
- _context0.n = 1;
9996
+ _context10.n = 1;
9352
9997
  return getIpIdAddress({
9353
9998
  nftContract: request.nftContract,
9354
9999
  tokenId: tokenId,
@@ -9357,18 +10002,18 @@ var IPAssetClient = /*#__PURE__*/function () {
9357
10002
  chainId: this.chainId
9358
10003
  });
9359
10004
  case 1:
9360
- ipIdAddress = _context0.v;
9361
- _context0.n = 2;
10005
+ ipIdAddress = _context10.v;
10006
+ _context10.n = 2;
9362
10007
  return this.isRegistered(ipIdAddress);
9363
10008
  case 2:
9364
- isRegistered = _context0.v;
10009
+ isRegistered = _context10.v;
9365
10010
  if (!isRegistered) {
9366
- _context0.n = 3;
10011
+ _context10.n = 3;
9367
10012
  break;
9368
10013
  }
9369
10014
  throw new Error("The NFT with id ".concat(tokenId, " is already registered as IP."));
9370
10015
  case 3:
9371
- _context0.n = 4;
10016
+ _context10.n = 4;
9372
10017
  return transformRegistrationRequest({
9373
10018
  request: request,
9374
10019
  rpcClient: this.rpcClient,
@@ -9376,23 +10021,23 @@ var IPAssetClient = /*#__PURE__*/function () {
9376
10021
  chainId: this.chainId
9377
10022
  });
9378
10023
  case 4:
9379
- _yield$transformRegis3 = _context0.v;
10024
+ _yield$transformRegis3 = _context10.v;
9380
10025
  _transformRequest2 = _yield$transformRegis3.transformRequest;
9381
10026
  encodedTxData = this.derivativeWorkflowsClient.registerIpAndMakeDerivativeEncode(_transformRequest2);
9382
10027
  if (!((_request$txOptions6 = request.txOptions) !== null && _request$txOptions6 !== void 0 && _request$txOptions6.encodedTxDataOnly)) {
9383
- _context0.n = 5;
10028
+ _context10.n = 5;
9384
10029
  break;
9385
10030
  }
9386
- return _context0.a(2, {
10031
+ return _context10.a(2, {
9387
10032
  encodedTxData: encodedTxData
9388
10033
  });
9389
10034
  case 5:
9390
10035
  contractCall = function contractCall() {
9391
10036
  return _this4.derivativeWorkflowsClient.registerIpAndMakeDerivative(_transformRequest2);
9392
10037
  };
9393
- return _context0.a(2, this.handleRegistrationWithFees({
10038
+ return _context10.a(2, this.handleRegistrationWithFees({
9394
10039
  options: _objectSpread2(_objectSpread2({}, request.options), {}, {
9395
- wipOptions: _objectSpread2(_objectSpread2({}, (_request$options2 = request.options) === null || _request$options2 === void 0 ? void 0 : _request$options2.wipOptions), {}, {
10040
+ wipOptions: _objectSpread2(_objectSpread2({}, (_request$options = request.options) === null || _request$options === void 0 ? void 0 : _request$options.wipOptions), {}, {
9396
10041
  useMulticallWhenPossible: false
9397
10042
  })
9398
10043
  }),
@@ -9404,13 +10049,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9404
10049
  txOptions: request.txOptions
9405
10050
  }));
9406
10051
  case 6:
9407
- _context0.p = 6;
9408
- _t12 = _context0.v;
9409
- return _context0.a(2, handleError(_t12, "Failed to register derivative IP"));
10052
+ _context10.p = 6;
10053
+ _t13 = _context10.v;
10054
+ return _context10.a(2, handleError(_t13, "Failed to register derivative IP"));
9410
10055
  }
9411
- }, _callee0, this, [[0, 6]]);
10056
+ }, _callee1, this, [[0, 6]]);
9412
10057
  }));
9413
- function registerDerivativeIp(_x1) {
10058
+ function registerDerivativeIp(_x10) {
9414
10059
  return _registerDerivativeIp.apply(this, arguments);
9415
10060
  }
9416
10061
  return registerDerivativeIp;
@@ -9442,15 +10087,15 @@ var IPAssetClient = /*#__PURE__*/function () {
9442
10087
  }, {
9443
10088
  key: "mintAndRegisterIpAndMakeDerivative",
9444
10089
  value: (function () {
9445
- var _mintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(request) {
10090
+ var _mintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(request) {
9446
10091
  var _this5 = this;
9447
- var _request$txOptions7, spgNftContract, _yield$transformRegis4, _transformRequest3, encodedTxData, contractCall, _t13;
9448
- return _regenerator().w(function (_context1) {
9449
- while (1) switch (_context1.p = _context1.n) {
10092
+ var _request$txOptions7, spgNftContract, _yield$transformRegis4, _transformRequest3, encodedTxData, contractCall, _t14;
10093
+ return _regenerator().w(function (_context11) {
10094
+ while (1) switch (_context11.p = _context11.n) {
9450
10095
  case 0:
9451
- _context1.p = 0;
10096
+ _context11.p = 0;
9452
10097
  spgNftContract = validateAddress(request.spgNftContract);
9453
- _context1.n = 1;
10098
+ _context11.n = 1;
9454
10099
  return transformRegistrationRequest({
9455
10100
  request: request,
9456
10101
  rpcClient: this.rpcClient,
@@ -9458,21 +10103,21 @@ var IPAssetClient = /*#__PURE__*/function () {
9458
10103
  chainId: this.chainId
9459
10104
  });
9460
10105
  case 1:
9461
- _yield$transformRegis4 = _context1.v;
10106
+ _yield$transformRegis4 = _context11.v;
9462
10107
  _transformRequest3 = _yield$transformRegis4.transformRequest;
9463
10108
  encodedTxData = this.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeEncode(_transformRequest3);
9464
10109
  if (!((_request$txOptions7 = request.txOptions) !== null && _request$txOptions7 !== void 0 && _request$txOptions7.encodedTxDataOnly)) {
9465
- _context1.n = 2;
10110
+ _context11.n = 2;
9466
10111
  break;
9467
10112
  }
9468
- return _context1.a(2, {
10113
+ return _context11.a(2, {
9469
10114
  encodedTxData: encodedTxData
9470
10115
  });
9471
10116
  case 2:
9472
10117
  contractCall = function contractCall() {
9473
10118
  return _this5.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivative(_transformRequest3);
9474
10119
  };
9475
- return _context1.a(2, this.handleRegistrationWithFees({
10120
+ return _context11.a(2, this.handleRegistrationWithFees({
9476
10121
  options: request.options,
9477
10122
  sender: this.walletAddress,
9478
10123
  spgSpenderAddress: this.derivativeWorkflowsClient.address,
@@ -9483,13 +10128,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9483
10128
  txOptions: request.txOptions
9484
10129
  }));
9485
10130
  case 3:
9486
- _context1.p = 3;
9487
- _t13 = _context1.v;
9488
- return _context1.a(2, handleError(_t13, "Failed to mint and register IP and make derivative"));
10131
+ _context11.p = 3;
10132
+ _t14 = _context11.v;
10133
+ return _context11.a(2, handleError(_t14, "Failed to mint and register IP and make derivative"));
9489
10134
  }
9490
- }, _callee1, this, [[0, 3]]);
10135
+ }, _callee10, this, [[0, 3]]);
9491
10136
  }));
9492
- function mintAndRegisterIpAndMakeDerivative(_x10) {
10137
+ function mintAndRegisterIpAndMakeDerivative(_x11) {
9493
10138
  return _mintAndRegisterIpAndMakeDerivative.apply(this, arguments);
9494
10139
  }
9495
10140
  return mintAndRegisterIpAndMakeDerivative;
@@ -9497,83 +10142,86 @@ var IPAssetClient = /*#__PURE__*/function () {
9497
10142
  /**
9498
10143
  * Batch mint an NFT from a collection and register it as a derivative IP without license tokens.
9499
10144
  *
10145
+ * @remark For better gas efficiency, consider using {@link batchRegisterIpAssetsWithOptimizedWorkflows} instead.
10146
+ * The optimized workflows method provides intelligent transaction batching, automatic token handling.
10147
+ *
9500
10148
  * Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
9501
10149
  */
9502
10150
  )
9503
10151
  }, {
9504
10152
  key: "batchMintAndRegisterIpAndMakeDerivative",
9505
10153
  value: (function () {
9506
- var _batchMintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(request) {
9507
- var calldata, _iterator4, _step4, arg, result, txHash, txReceipt, _t14, _t15, _t16;
9508
- return _regenerator().w(function (_context10) {
9509
- while (1) switch (_context10.p = _context10.n) {
10154
+ var _batchMintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(request) {
10155
+ var calldata, _iterator4, _step4, arg, result, txHash, txReceipt, _t15, _t16, _t17;
10156
+ return _regenerator().w(function (_context12) {
10157
+ while (1) switch (_context12.p = _context12.n) {
9510
10158
  case 0:
9511
- _context10.p = 0;
10159
+ _context12.p = 0;
9512
10160
  calldata = [];
9513
10161
  _iterator4 = _createForOfIteratorHelper(request.args);
9514
- _context10.p = 1;
10162
+ _context12.p = 1;
9515
10163
  _iterator4.s();
9516
10164
  case 2:
9517
10165
  if ((_step4 = _iterator4.n()).done) {
9518
- _context10.n = 7;
10166
+ _context12.n = 7;
9519
10167
  break;
9520
10168
  }
9521
10169
  arg = _step4.value;
9522
- _context10.p = 3;
9523
- _context10.n = 4;
10170
+ _context12.p = 3;
10171
+ _context12.n = 4;
9524
10172
  return this.mintAndRegisterIpAndMakeDerivative(_objectSpread2(_objectSpread2({}, arg), {}, {
9525
10173
  txOptions: {
9526
10174
  encodedTxDataOnly: true
9527
10175
  }
9528
10176
  }));
9529
10177
  case 4:
9530
- result = _context10.v;
10178
+ result = _context12.v;
9531
10179
  calldata.push(result.encodedTxData.data);
9532
- _context10.n = 6;
10180
+ _context12.n = 6;
9533
10181
  break;
9534
10182
  case 5:
9535
- _context10.p = 5;
9536
- _t14 = _context10.v;
9537
- throw new Error(_t14.message.replace("Failed to mint and register IP and make derivative: ", "").trim());
10183
+ _context12.p = 5;
10184
+ _t15 = _context12.v;
10185
+ throw new Error(_t15.message.replace("Failed to mint and register IP and make derivative: ", "").trim());
9538
10186
  case 6:
9539
- _context10.n = 2;
10187
+ _context12.n = 2;
9540
10188
  break;
9541
10189
  case 7:
9542
- _context10.n = 9;
10190
+ _context12.n = 9;
9543
10191
  break;
9544
10192
  case 8:
9545
- _context10.p = 8;
9546
- _t15 = _context10.v;
9547
- _iterator4.e(_t15);
10193
+ _context12.p = 8;
10194
+ _t16 = _context12.v;
10195
+ _iterator4.e(_t16);
9548
10196
  case 9:
9549
- _context10.p = 9;
10197
+ _context12.p = 9;
9550
10198
  _iterator4.f();
9551
- return _context10.f(9);
10199
+ return _context12.f(9);
9552
10200
  case 10:
9553
- _context10.n = 11;
10201
+ _context12.n = 11;
9554
10202
  return this.derivativeWorkflowsClient.multicall({
9555
10203
  data: calldata
9556
10204
  });
9557
10205
  case 11:
9558
- txHash = _context10.v;
9559
- _context10.n = 12;
10206
+ txHash = _context12.v;
10207
+ _context12.n = 12;
9560
10208
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
9561
10209
  hash: txHash
9562
10210
  }));
9563
10211
  case 12:
9564
- txReceipt = _context10.v;
9565
- return _context10.a(2, {
10212
+ txReceipt = _context12.v;
10213
+ return _context12.a(2, {
9566
10214
  txHash: txHash,
9567
10215
  results: this.getIpIdAndTokenIdsFromEvent(txReceipt, "spgNftContract")
9568
10216
  });
9569
10217
  case 13:
9570
- _context10.p = 13;
9571
- _t16 = _context10.v;
9572
- return _context10.a(2, handleError(_t16, "Failed to batch mint and register IP and make derivative"));
10218
+ _context12.p = 13;
10219
+ _t17 = _context12.v;
10220
+ return _context12.a(2, handleError(_t17, "Failed to batch mint and register IP and make derivative"));
9573
10221
  }
9574
- }, _callee10, this, [[3, 5], [1, 8, 9, 10], [0, 13]]);
10222
+ }, _callee11, this, [[3, 5], [1, 8, 9, 10], [0, 13]]);
9575
10223
  }));
9576
- function batchMintAndRegisterIpAndMakeDerivative(_x11) {
10224
+ function batchMintAndRegisterIpAndMakeDerivative(_x12) {
9577
10225
  return _batchMintAndRegisterIpAndMakeDerivative.apply(this, arguments);
9578
10226
  }
9579
10227
  return batchMintAndRegisterIpAndMakeDerivative;
@@ -9604,52 +10252,52 @@ var IPAssetClient = /*#__PURE__*/function () {
9604
10252
  }, {
9605
10253
  key: "mintAndRegisterIp",
9606
10254
  value: (function () {
9607
- var _mintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(request) {
10255
+ var _mintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(request) {
9608
10256
  var _this6 = this;
9609
- var _request$txOptions8, _request$options3, _object, encodedTxData, contractCall, _t17;
9610
- return _regenerator().w(function (_context11) {
9611
- while (1) switch (_context11.p = _context11.n) {
10257
+ var _request$txOptions8, _request$options2, object, encodedTxData, contractCall, _t18;
10258
+ return _regenerator().w(function (_context13) {
10259
+ while (1) switch (_context13.p = _context13.n) {
9612
10260
  case 0:
9613
- _context11.p = 0;
9614
- _object = {
10261
+ _context13.p = 0;
10262
+ object = {
9615
10263
  spgNftContract: validateAddress(request.spgNftContract),
9616
10264
  recipient: validateAddress(request.recipient || this.walletAddress),
9617
10265
  ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
9618
10266
  allowDuplicates: request.allowDuplicates || true
9619
10267
  };
9620
- encodedTxData = this.registrationWorkflowsClient.mintAndRegisterIpEncode(_object);
10268
+ encodedTxData = this.registrationWorkflowsClient.mintAndRegisterIpEncode(object);
9621
10269
  if (!((_request$txOptions8 = request.txOptions) !== null && _request$txOptions8 !== void 0 && _request$txOptions8.encodedTxDataOnly)) {
9622
- _context11.n = 1;
10270
+ _context13.n = 1;
9623
10271
  break;
9624
10272
  }
9625
- return _context11.a(2, {
10273
+ return _context13.a(2, {
9626
10274
  encodedTxData: encodedTxData
9627
10275
  });
9628
10276
  case 1:
9629
10277
  contractCall = function contractCall() {
9630
- return _this6.registrationWorkflowsClient.mintAndRegisterIp(_object);
10278
+ return _this6.registrationWorkflowsClient.mintAndRegisterIp(object);
9631
10279
  };
9632
- return _context11.a(2, this.handleRegistrationWithFees({
10280
+ return _context13.a(2, this.handleRegistrationWithFees({
9633
10281
  sender: this.walletAddress,
9634
10282
  spgSpenderAddress: this.registrationWorkflowsClient.address,
9635
10283
  encodedTxs: [encodedTxData],
9636
10284
  contractCall: contractCall,
9637
- spgNftContract: _object.spgNftContract,
10285
+ spgNftContract: object.spgNftContract,
9638
10286
  txOptions: request.txOptions,
9639
10287
  options: _objectSpread2(_objectSpread2({}, request.options), {}, {
9640
- wipOptions: _objectSpread2(_objectSpread2({}, (_request$options3 = request.options) === null || _request$options3 === void 0 ? void 0 : _request$options3.wipOptions), {}, {
10288
+ wipOptions: _objectSpread2(_objectSpread2({}, (_request$options2 = request.options) === null || _request$options2 === void 0 ? void 0 : _request$options2.wipOptions), {}, {
9641
10289
  useMulticallWhenPossible: false
9642
10290
  })
9643
10291
  })
9644
10292
  }));
9645
10293
  case 2:
9646
- _context11.p = 2;
9647
- _t17 = _context11.v;
9648
- return _context11.a(2, handleError(_t17, "Failed to mint and register IP"));
10294
+ _context13.p = 2;
10295
+ _t18 = _context13.v;
10296
+ return _context13.a(2, handleError(_t18, "Failed to mint and register IP"));
9649
10297
  }
9650
- }, _callee11, this, [[0, 2]]);
10298
+ }, _callee12, this, [[0, 2]]);
9651
10299
  }));
9652
- function mintAndRegisterIp(_x12) {
10300
+ function mintAndRegisterIp(_x13) {
9653
10301
  return _mintAndRegisterIp.apply(this, arguments);
9654
10302
  }
9655
10303
  return mintAndRegisterIp;
@@ -9673,23 +10321,23 @@ var IPAssetClient = /*#__PURE__*/function () {
9673
10321
  }, {
9674
10322
  key: "batchMintAndRegisterIp",
9675
10323
  value: (function () {
9676
- var _batchMintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(request) {
10324
+ var _batchMintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(request) {
9677
10325
  var _this7 = this;
9678
- var publicMintEncodedTxs, publicMintSpenders, privateMintEncodedTxs, privateMintSpenders, _iterator5, _step5, req, registrationRequest, isPublicMinting, nftMintFee, encodeTx, isMinterRole, handlePublicMintTransactions, handlePrivateMintTransactions, transactionResponses, publicMintResponse, privateMintResponse, _t18, _t19, _t20, _t21;
9679
- return _regenerator().w(function (_context14) {
9680
- while (1) switch (_context14.p = _context14.n) {
10326
+ var publicMintEncodedTxs, publicMintSpenders, privateMintEncodedTxs, privateMintSpenders, _iterator5, _step5, req, registrationRequest, isPublicMinting, nftMintFee, encodeTx, isMinterRole, handlePublicMintTransactions, handlePrivateMintTransactions, transactionResponses, publicMintResponse, privateMintResponse, _t19, _t20, _t21, _t22;
10327
+ return _regenerator().w(function (_context16) {
10328
+ while (1) switch (_context16.p = _context16.n) {
9681
10329
  case 0:
9682
- _context14.p = 0;
10330
+ _context16.p = 0;
9683
10331
  publicMintEncodedTxs = [];
9684
10332
  publicMintSpenders = [];
9685
10333
  privateMintEncodedTxs = [];
9686
10334
  privateMintSpenders = [];
9687
10335
  _iterator5 = _createForOfIteratorHelper(request.requests);
9688
- _context14.p = 1;
10336
+ _context16.p = 1;
9689
10337
  _iterator5.s();
9690
10338
  case 2:
9691
10339
  if ((_step5 = _iterator5.n()).done) {
9692
- _context14.n = 9;
10340
+ _context16.n = 9;
9693
10341
  break;
9694
10342
  }
9695
10343
  req = _step5.value;
@@ -9699,14 +10347,14 @@ var IPAssetClient = /*#__PURE__*/function () {
9699
10347
  ipMetadata: getIpMetadataForWorkflow(req.ipMetadata),
9700
10348
  allowDuplicates: req.allowDuplicates || true
9701
10349
  };
9702
- _context14.n = 3;
10350
+ _context16.n = 3;
9703
10351
  return getPublicMinting(req.spgNftContract, this.rpcClient);
9704
10352
  case 3:
9705
- isPublicMinting = _context14.v;
9706
- _context14.n = 4;
10353
+ isPublicMinting = _context16.v;
10354
+ _context16.n = 4;
9707
10355
  return calculateSPGMintFee(new SpgnftImplReadOnlyClient(this.rpcClient, registrationRequest.spgNftContract));
9708
10356
  case 4:
9709
- nftMintFee = _context14.v;
10357
+ nftMintFee = _context16.v;
9710
10358
  encodeTx = {
9711
10359
  to: this.registrationWorkflowsClient.address,
9712
10360
  data: encodeFunctionData({
@@ -9716,22 +10364,22 @@ var IPAssetClient = /*#__PURE__*/function () {
9716
10364
  })
9717
10365
  };
9718
10366
  if (!isPublicMinting) {
9719
- _context14.n = 5;
10367
+ _context16.n = 5;
9720
10368
  break;
9721
10369
  }
9722
10370
  publicMintSpenders = mergeSpenders(publicMintSpenders, nftMintFee ? [_objectSpread2({
9723
10371
  address: registrationRequest.spgNftContract
9724
10372
  }, nftMintFee)] : []);
9725
10373
  publicMintEncodedTxs.push(encodeTx);
9726
- _context14.n = 8;
10374
+ _context16.n = 8;
9727
10375
  break;
9728
10376
  case 5:
9729
- _context14.n = 6;
10377
+ _context16.n = 6;
9730
10378
  return hasMinterRole(registrationRequest.spgNftContract, this.rpcClient, this.walletAddress);
9731
10379
  case 6:
9732
- isMinterRole = _context14.v;
10380
+ isMinterRole = _context16.v;
9733
10381
  if (isMinterRole) {
9734
- _context14.n = 7;
10382
+ _context16.n = 7;
9735
10383
  break;
9736
10384
  }
9737
10385
  throw new Error("Caller ".concat(this.walletAddress, " does not have the minter role for ").concat(registrationRequest.spgNftContract));
@@ -9741,26 +10389,26 @@ var IPAssetClient = /*#__PURE__*/function () {
9741
10389
  }, nftMintFee)] : []);
9742
10390
  privateMintEncodedTxs.push(encodeTx);
9743
10391
  case 8:
9744
- _context14.n = 2;
10392
+ _context16.n = 2;
9745
10393
  break;
9746
10394
  case 9:
9747
- _context14.n = 11;
10395
+ _context16.n = 11;
9748
10396
  break;
9749
10397
  case 10:
9750
- _context14.p = 10;
9751
- _t18 = _context14.v;
9752
- _iterator5.e(_t18);
10398
+ _context16.p = 10;
10399
+ _t19 = _context16.v;
10400
+ _iterator5.e(_t19);
9753
10401
  case 11:
9754
- _context14.p = 11;
10402
+ _context16.p = 11;
9755
10403
  _iterator5.f();
9756
- return _context14.f(11);
10404
+ return _context16.f(11);
9757
10405
  case 12:
9758
10406
  handlePublicMintTransactions = /*#__PURE__*/function () {
9759
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
9760
- return _regenerator().w(function (_context12) {
9761
- while (1) switch (_context12.n) {
10407
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
10408
+ return _regenerator().w(function (_context14) {
10409
+ while (1) switch (_context14.n) {
9762
10410
  case 0:
9763
- _context12.n = 1;
10411
+ _context14.n = 1;
9764
10412
  return contractCallWithFees({
9765
10413
  options: {
9766
10414
  wipOptions: request.wipOptions,
@@ -9782,20 +10430,20 @@ var IPAssetClient = /*#__PURE__*/function () {
9782
10430
  encodedTxs: publicMintEncodedTxs
9783
10431
  });
9784
10432
  case 1:
9785
- return _context12.a(2, _context12.v);
10433
+ return _context14.a(2, _context14.v);
9786
10434
  }
9787
- }, _callee12);
10435
+ }, _callee13);
9788
10436
  }));
9789
10437
  return function handlePublicMintTransactions() {
9790
- return _ref2.apply(this, arguments);
10438
+ return _ref3.apply(this, arguments);
9791
10439
  };
9792
10440
  }();
9793
10441
  handlePrivateMintTransactions = /*#__PURE__*/function () {
9794
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
9795
- return _regenerator().w(function (_context13) {
9796
- while (1) switch (_context13.n) {
10442
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
10443
+ return _regenerator().w(function (_context15) {
10444
+ while (1) switch (_context15.n) {
9797
10445
  case 0:
9798
- _context13.n = 1;
10446
+ _context15.n = 1;
9799
10447
  return contractCallWithFees({
9800
10448
  options: {
9801
10449
  wipOptions: _objectSpread2(_objectSpread2({}, request.wipOptions), {}, {
@@ -9819,50 +10467,50 @@ var IPAssetClient = /*#__PURE__*/function () {
9819
10467
  encodedTxs: privateMintEncodedTxs
9820
10468
  });
9821
10469
  case 1:
9822
- return _context13.a(2, _context13.v);
10470
+ return _context15.a(2, _context15.v);
9823
10471
  }
9824
- }, _callee13);
10472
+ }, _callee14);
9825
10473
  }));
9826
10474
  return function handlePrivateMintTransactions() {
9827
- return _ref3.apply(this, arguments);
10475
+ return _ref4.apply(this, arguments);
9828
10476
  };
9829
10477
  }();
9830
10478
  transactionResponses = [];
9831
10479
  if (!(privateMintEncodedTxs.length === 0)) {
9832
- _context14.n = 14;
10480
+ _context16.n = 14;
9833
10481
  break;
9834
10482
  }
9835
- _context14.n = 13;
10483
+ _context16.n = 13;
9836
10484
  return handlePublicMintTransactions();
9837
10485
  case 13:
9838
- _t19 = _context14.v;
9839
- transactionResponses = [_t19];
9840
- _context14.n = 19;
10486
+ _t20 = _context16.v;
10487
+ transactionResponses = [_t20];
10488
+ _context16.n = 19;
9841
10489
  break;
9842
10490
  case 14:
9843
10491
  if (!(publicMintEncodedTxs.length === 0)) {
9844
- _context14.n = 16;
10492
+ _context16.n = 16;
9845
10493
  break;
9846
10494
  }
9847
- _context14.n = 15;
10495
+ _context16.n = 15;
9848
10496
  return handlePrivateMintTransactions();
9849
10497
  case 15:
9850
- _t20 = _context14.v;
9851
- transactionResponses = [_t20];
9852
- _context14.n = 19;
10498
+ _t21 = _context16.v;
10499
+ transactionResponses = [_t21];
10500
+ _context16.n = 19;
9853
10501
  break;
9854
10502
  case 16:
9855
- _context14.n = 17;
10503
+ _context16.n = 17;
9856
10504
  return handlePublicMintTransactions();
9857
10505
  case 17:
9858
- publicMintResponse = _context14.v;
9859
- _context14.n = 18;
10506
+ publicMintResponse = _context16.v;
10507
+ _context16.n = 18;
9860
10508
  return handlePrivateMintTransactions();
9861
10509
  case 18:
9862
- privateMintResponse = _context14.v;
10510
+ privateMintResponse = _context16.v;
9863
10511
  transactionResponses = [publicMintResponse, privateMintResponse];
9864
10512
  case 19:
9865
- return _context14.a(2, {
10513
+ return _context16.a(2, {
9866
10514
  registrationResults: transactionResponses.map(function (r) {
9867
10515
  return {
9868
10516
  txHash: r.txHash,
@@ -9872,13 +10520,13 @@ var IPAssetClient = /*#__PURE__*/function () {
9872
10520
  })
9873
10521
  });
9874
10522
  case 20:
9875
- _context14.p = 20;
9876
- _t21 = _context14.v;
9877
- return _context14.a(2, handleError(_t21, "Failed to batch mint and register IP"));
10523
+ _context16.p = 20;
10524
+ _t22 = _context16.v;
10525
+ return _context16.a(2, handleError(_t22, "Failed to batch mint and register IP"));
9878
10526
  }
9879
- }, _callee14, this, [[1, 10, 11, 12], [0, 20]]);
10527
+ }, _callee15, this, [[1, 10, 11, 12], [0, 20]]);
9880
10528
  }));
9881
- function batchMintAndRegisterIp(_x13) {
10529
+ function batchMintAndRegisterIp(_x14) {
9882
10530
  return _batchMintAndRegisterIp.apply(this, arguments);
9883
10531
  }
9884
10532
  return batchMintAndRegisterIp;
@@ -9911,18 +10559,18 @@ var IPAssetClient = /*#__PURE__*/function () {
9911
10559
  }, {
9912
10560
  key: "mintAndRegisterIpAndMakeDerivativeWithLicenseTokens",
9913
10561
  value: (function () {
9914
- var _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(request) {
10562
+ var _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(request) {
9915
10563
  var _this8 = this;
9916
- var _request$txOptions9, _request$options4, licenseTokenIds, _object2, encodedTxData, contractCall, _t22;
9917
- return _regenerator().w(function (_context16) {
9918
- while (1) switch (_context16.p = _context16.n) {
10564
+ var _request$txOptions9, _request$options3, licenseTokenIds, _object, encodedTxData, contractCall, _t23;
10565
+ return _regenerator().w(function (_context18) {
10566
+ while (1) switch (_context18.p = _context18.n) {
9919
10567
  case 0:
9920
- _context16.p = 0;
9921
- _context16.n = 1;
10568
+ _context18.p = 0;
10569
+ _context18.n = 1;
9922
10570
  return this.validateLicenseTokenIds(request.licenseTokenIds);
9923
10571
  case 1:
9924
- licenseTokenIds = _context16.v;
9925
- _object2 = {
10572
+ licenseTokenIds = _context18.v;
10573
+ _object = {
9926
10574
  spgNftContract: validateAddress(request.spgNftContract),
9927
10575
  recipient: validateAddress(request.recipient || this.walletAddress),
9928
10576
  ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
@@ -9931,54 +10579,54 @@ var IPAssetClient = /*#__PURE__*/function () {
9931
10579
  maxRts: validateMaxRts(request.maxRts),
9932
10580
  allowDuplicates: request.allowDuplicates || true
9933
10581
  };
9934
- encodedTxData = this.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokensEncode(_object2);
10582
+ encodedTxData = this.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokensEncode(_object);
9935
10583
  if (!((_request$txOptions9 = request.txOptions) !== null && _request$txOptions9 !== void 0 && _request$txOptions9.encodedTxDataOnly)) {
9936
- _context16.n = 2;
10584
+ _context18.n = 2;
9937
10585
  break;
9938
10586
  }
9939
- return _context16.a(2, {
10587
+ return _context18.a(2, {
9940
10588
  encodedTxData: encodedTxData
9941
10589
  });
9942
10590
  case 2:
9943
- _context16.n = 3;
10591
+ _context18.n = 3;
9944
10592
  return this.approveLicenseTokensForDerivativeWorkflows(request.licenseTokenIds, request.autoApproveLicenseTokens);
9945
10593
  case 3:
9946
10594
  contractCall = /*#__PURE__*/function () {
9947
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
9948
- return _regenerator().w(function (_context15) {
9949
- while (1) switch (_context15.n) {
10595
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
10596
+ return _regenerator().w(function (_context17) {
10597
+ while (1) switch (_context17.n) {
9950
10598
  case 0:
9951
- return _context15.a(2, _this8.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_object2));
10599
+ return _context17.a(2, _this8.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_object));
9952
10600
  }
9953
- }, _callee15);
10601
+ }, _callee16);
9954
10602
  }));
9955
10603
  return function contractCall() {
9956
- return _ref4.apply(this, arguments);
10604
+ return _ref5.apply(this, arguments);
9957
10605
  };
9958
10606
  }();
9959
- return _context16.a(2, this.handleRegistrationWithFees({
10607
+ return _context18.a(2, this.handleRegistrationWithFees({
9960
10608
  options: _objectSpread2(_objectSpread2({}, request.options), {}, {
9961
- wipOptions: _objectSpread2(_objectSpread2({}, (_request$options4 = request.options) === null || _request$options4 === void 0 ? void 0 : _request$options4.wipOptions), {}, {
10609
+ wipOptions: _objectSpread2(_objectSpread2({}, (_request$options3 = request.options) === null || _request$options3 === void 0 ? void 0 : _request$options3.wipOptions), {}, {
9962
10610
  // need to disable multicall to avoid needing to transfer the license
9963
10611
  // token to the multicall contract.
9964
10612
  useMulticallWhenPossible: false
9965
10613
  })
9966
10614
  }),
9967
10615
  sender: this.walletAddress,
9968
- spgNftContract: _object2.spgNftContract,
10616
+ spgNftContract: _object.spgNftContract,
9969
10617
  spgSpenderAddress: this.derivativeWorkflowsClient.address,
9970
10618
  encodedTxs: [encodedTxData],
9971
10619
  contractCall: contractCall,
9972
10620
  txOptions: request.txOptions
9973
10621
  }));
9974
10622
  case 4:
9975
- _context16.p = 4;
9976
- _t22 = _context16.v;
9977
- return _context16.a(2, handleError(_t22, "Failed to mint and register IP and make derivative with license tokens"));
10623
+ _context18.p = 4;
10624
+ _t23 = _context18.v;
10625
+ return _context18.a(2, handleError(_t23, "Failed to mint and register IP and make derivative with license tokens"));
9978
10626
  }
9979
- }, _callee16, this, [[0, 4]]);
10627
+ }, _callee17, this, [[0, 4]]);
9980
10628
  }));
9981
- function mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_x14) {
10629
+ function mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_x15) {
9982
10630
  return _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens.apply(this, arguments);
9983
10631
  }
9984
10632
  return mintAndRegisterIpAndMakeDerivativeWithLicenseTokens;
@@ -10011,14 +10659,14 @@ var IPAssetClient = /*#__PURE__*/function () {
10011
10659
  }, {
10012
10660
  key: "registerIpAndMakeDerivativeWithLicenseTokens",
10013
10661
  value: (function () {
10014
- var _registerIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(request) {
10015
- var _request$txOptions0, tokenId, ipIdAddress, isRegistered, licenseTokenIds, calculatedDeadline, signature, _object3, txHash, receipt, log, _t23;
10016
- return _regenerator().w(function (_context17) {
10017
- while (1) switch (_context17.p = _context17.n) {
10662
+ var _registerIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(request) {
10663
+ var _request$txOptions0, tokenId, ipIdAddress, isRegistered, licenseTokenIds, calculatedDeadline, signature, _object2, txHash, receipt, log, _t24;
10664
+ return _regenerator().w(function (_context19) {
10665
+ while (1) switch (_context19.p = _context19.n) {
10018
10666
  case 0:
10019
- _context17.p = 0;
10667
+ _context19.p = 0;
10020
10668
  tokenId = BigInt(request.tokenId);
10021
- _context17.n = 1;
10669
+ _context19.n = 1;
10022
10670
  return getIpIdAddress({
10023
10671
  nftContract: request.nftContract,
10024
10672
  tokenId: tokenId,
@@ -10027,26 +10675,26 @@ var IPAssetClient = /*#__PURE__*/function () {
10027
10675
  chainId: this.chainId
10028
10676
  });
10029
10677
  case 1:
10030
- ipIdAddress = _context17.v;
10031
- _context17.n = 2;
10678
+ ipIdAddress = _context19.v;
10679
+ _context19.n = 2;
10032
10680
  return this.isRegistered(ipIdAddress);
10033
10681
  case 2:
10034
- isRegistered = _context17.v;
10682
+ isRegistered = _context19.v;
10035
10683
  if (!isRegistered) {
10036
- _context17.n = 3;
10684
+ _context19.n = 3;
10037
10685
  break;
10038
10686
  }
10039
10687
  throw new Error("The NFT with id ".concat(tokenId, " is already registered as IP."));
10040
10688
  case 3:
10041
- _context17.n = 4;
10689
+ _context19.n = 4;
10042
10690
  return this.validateLicenseTokenIds(request.licenseTokenIds);
10043
10691
  case 4:
10044
- licenseTokenIds = _context17.v;
10045
- _context17.n = 5;
10692
+ licenseTokenIds = _context19.v;
10693
+ _context19.n = 5;
10046
10694
  return getCalculatedDeadline(this.rpcClient, request.deadline);
10047
10695
  case 5:
10048
- calculatedDeadline = _context17.v;
10049
- _context17.n = 6;
10696
+ calculatedDeadline = _context19.v;
10697
+ _context19.n = 6;
10050
10698
  return generateOperationSignature({
10051
10699
  ipIdAddress: ipIdAddress,
10052
10700
  methodType: SignatureMethodType.REGISTER_IP_AND_MAKE_DERIVATIVE_WITH_LICENSE_TOKENS,
@@ -10055,11 +10703,11 @@ var IPAssetClient = /*#__PURE__*/function () {
10055
10703
  chainId: this.chainId
10056
10704
  });
10057
10705
  case 6:
10058
- signature = _context17.v;
10059
- _context17.n = 7;
10706
+ signature = _context19.v;
10707
+ _context19.n = 7;
10060
10708
  return this.approveLicenseTokensForDerivativeWorkflows(licenseTokenIds, request.autoApproveLicenseTokens);
10061
10709
  case 7:
10062
- _object3 = _objectSpread2(_objectSpread2({}, request), {}, {
10710
+ _object2 = _objectSpread2(_objectSpread2({}, request), {}, {
10063
10711
  tokenId: tokenId,
10064
10712
  licenseTokenIds: licenseTokenIds,
10065
10713
  royaltyContext: zeroAddress,
@@ -10072,40 +10720,40 @@ var IPAssetClient = /*#__PURE__*/function () {
10072
10720
  maxRts: validateMaxRts(request.maxRts)
10073
10721
  });
10074
10722
  if (!((_request$txOptions0 = request.txOptions) !== null && _request$txOptions0 !== void 0 && _request$txOptions0.encodedTxDataOnly)) {
10075
- _context17.n = 8;
10723
+ _context19.n = 8;
10076
10724
  break;
10077
10725
  }
10078
- return _context17.a(2, {
10079
- encodedTxData: this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokensEncode(_object3)
10726
+ return _context19.a(2, {
10727
+ encodedTxData: this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokensEncode(_object2)
10080
10728
  });
10081
10729
  case 8:
10082
- _context17.n = 9;
10083
- return this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokens(_object3);
10730
+ _context19.n = 9;
10731
+ return this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokens(_object2);
10084
10732
  case 9:
10085
- txHash = _context17.v;
10086
- _context17.n = 10;
10733
+ txHash = _context19.v;
10734
+ _context19.n = 10;
10087
10735
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
10088
10736
  hash: txHash
10089
10737
  }));
10090
10738
  case 10:
10091
- receipt = _context17.v;
10739
+ receipt = _context19.v;
10092
10740
  log = this.getIpIdAndTokenIdsFromEvent(receipt)[0];
10093
- return _context17.a(2, _objectSpread2({
10741
+ return _context19.a(2, _objectSpread2({
10094
10742
  txHash: txHash
10095
10743
  }, log));
10096
10744
  case 11:
10097
- _context17.n = 13;
10745
+ _context19.n = 13;
10098
10746
  break;
10099
10747
  case 12:
10100
- _context17.p = 12;
10101
- _t23 = _context17.v;
10102
- return _context17.a(2, handleError(_t23, "Failed to register IP and make derivative with license tokens"));
10748
+ _context19.p = 12;
10749
+ _t24 = _context19.v;
10750
+ return _context19.a(2, handleError(_t24, "Failed to register IP and make derivative with license tokens"));
10103
10751
  case 13:
10104
- return _context17.a(2);
10752
+ return _context19.a(2);
10105
10753
  }
10106
- }, _callee17, this, [[0, 12]]);
10754
+ }, _callee18, this, [[0, 12]]);
10107
10755
  }));
10108
- function registerIpAndMakeDerivativeWithLicenseTokens(_x15) {
10756
+ function registerIpAndMakeDerivativeWithLicenseTokens(_x16) {
10109
10757
  return _registerIpAndMakeDerivativeWithLicenseTokens.apply(this, arguments);
10110
10758
  }
10111
10759
  return registerIpAndMakeDerivativeWithLicenseTokens;
@@ -10142,23 +10790,23 @@ var IPAssetClient = /*#__PURE__*/function () {
10142
10790
  }, {
10143
10791
  key: "registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens",
10144
10792
  value: (function () {
10145
- var _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(request) {
10146
- var _getRoyaltyShares, royaltyShares, totalAmount, _yield$validateLicens2, licenseTerms, calculatedDeadline, ipIdAddress, isRegistered, _yield$transformRegis5, _transformRequest4, registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash, txReceipt, ipId, licenseTermsIds, ipRoyaltyVault, distributeRoyaltyTokensTxHash, maxLicenseTokensTxHashes, _t24;
10147
- return _regenerator().w(function (_context18) {
10148
- while (1) switch (_context18.p = _context18.n) {
10793
+ var _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(request) {
10794
+ var _getRoyaltyShares, royaltyShares, totalAmount, _yield$validateLicens2, licenseTerms, calculatedDeadline, ipIdAddress, isRegistered, _yield$transformRegis5, _transformRequest4, registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash, txReceipt, ipId, licenseTermsIds, ipRoyaltyVault, distributeRoyaltyTokensTxHash, maxLicenseTokensTxHashes, _t25;
10795
+ return _regenerator().w(function (_context20) {
10796
+ while (1) switch (_context20.p = _context20.n) {
10149
10797
  case 0:
10150
- _context18.p = 0;
10798
+ _context20.p = 0;
10151
10799
  _getRoyaltyShares = getRoyaltyShares(request.royaltyShares), royaltyShares = _getRoyaltyShares.royaltyShares, totalAmount = _getRoyaltyShares.totalAmount;
10152
- _context18.n = 1;
10800
+ _context20.n = 1;
10153
10801
  return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
10154
10802
  case 1:
10155
- _yield$validateLicens2 = _context18.v;
10803
+ _yield$validateLicens2 = _context20.v;
10156
10804
  licenseTerms = _yield$validateLicens2.licenseTerms;
10157
- _context18.n = 2;
10805
+ _context20.n = 2;
10158
10806
  return getCalculatedDeadline(this.rpcClient, request.deadline);
10159
10807
  case 2:
10160
- calculatedDeadline = _context18.v;
10161
- _context18.n = 3;
10808
+ calculatedDeadline = _context20.v;
10809
+ _context20.n = 3;
10162
10810
  return getIpIdAddress({
10163
10811
  nftContract: validateAddress(request.nftContract),
10164
10812
  tokenId: BigInt(request.tokenId),
@@ -10167,18 +10815,18 @@ var IPAssetClient = /*#__PURE__*/function () {
10167
10815
  chainId: this.chainId
10168
10816
  });
10169
10817
  case 3:
10170
- ipIdAddress = _context18.v;
10171
- _context18.n = 4;
10818
+ ipIdAddress = _context20.v;
10819
+ _context20.n = 4;
10172
10820
  return this.isRegistered(ipIdAddress);
10173
10821
  case 4:
10174
- isRegistered = _context18.v;
10822
+ isRegistered = _context20.v;
10175
10823
  if (!isRegistered) {
10176
- _context18.n = 5;
10824
+ _context20.n = 5;
10177
10825
  break;
10178
10826
  }
10179
10827
  throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
10180
10828
  case 5:
10181
- _context18.n = 6;
10829
+ _context20.n = 6;
10182
10830
  return transformRegistrationRequest({
10183
10831
  request: request,
10184
10832
  rpcClient: this.rpcClient,
@@ -10186,25 +10834,25 @@ var IPAssetClient = /*#__PURE__*/function () {
10186
10834
  chainId: this.chainId
10187
10835
  });
10188
10836
  case 6:
10189
- _yield$transformRegis5 = _context18.v;
10837
+ _yield$transformRegis5 = _context20.v;
10190
10838
  _transformRequest4 = _yield$transformRegis5.transformRequest;
10191
- _context18.n = 7;
10839
+ _context20.n = 7;
10192
10840
  return this.royaltyTokenDistributionWorkflowsClient.registerIpAndAttachPilTermsAndDeployRoyaltyVault(_transformRequest4);
10193
10841
  case 7:
10194
- registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash = _context18.v;
10195
- _context18.n = 8;
10842
+ registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash = _context20.v;
10843
+ _context20.n = 8;
10196
10844
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
10197
10845
  hash: registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash
10198
10846
  }));
10199
10847
  case 8:
10200
- txReceipt = _context18.v;
10848
+ txReceipt = _context20.v;
10201
10849
  ipId = this.getIpIdAndTokenIdsFromEvent(txReceipt)[0].ipId;
10202
- _context18.n = 9;
10850
+ _context20.n = 9;
10203
10851
  return this.getLicenseTermsId(licenseTerms);
10204
10852
  case 9:
10205
- licenseTermsIds = _context18.v;
10853
+ licenseTermsIds = _context20.v;
10206
10854
  ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(txReceipt)[0].ipRoyaltyVault;
10207
- _context18.n = 10;
10855
+ _context20.n = 10;
10208
10856
  return this.distributeRoyaltyTokens({
10209
10857
  ipId: ipId,
10210
10858
  deadline: calculatedDeadline,
@@ -10214,13 +10862,13 @@ var IPAssetClient = /*#__PURE__*/function () {
10214
10862
  txOptions: request.txOptions
10215
10863
  });
10216
10864
  case 10:
10217
- distributeRoyaltyTokensTxHash = _context18.v;
10218
- _context18.n = 11;
10865
+ distributeRoyaltyTokensTxHash = _context20.v;
10866
+ _context20.n = 11;
10219
10867
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
10220
10868
  hash: distributeRoyaltyTokensTxHash
10221
10869
  }));
10222
10870
  case 11:
10223
- _context18.n = 12;
10871
+ _context20.n = 12;
10224
10872
  return setMaxLicenseTokens({
10225
10873
  maxLicenseTokensData: request.licenseTermsData,
10226
10874
  licensorIpId: ipId,
@@ -10229,8 +10877,8 @@ var IPAssetClient = /*#__PURE__*/function () {
10229
10877
  templateAddress: this.licenseTemplateAddress
10230
10878
  });
10231
10879
  case 12:
10232
- maxLicenseTokensTxHashes = _context18.v;
10233
- return _context18.a(2, _objectSpread2({
10880
+ maxLicenseTokensTxHashes = _context20.v;
10881
+ return _context20.a(2, _objectSpread2({
10234
10882
  registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash: registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash,
10235
10883
  distributeRoyaltyTokensTxHash: distributeRoyaltyTokensTxHash,
10236
10884
  ipId: ipId,
@@ -10240,13 +10888,13 @@ var IPAssetClient = /*#__PURE__*/function () {
10240
10888
  maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
10241
10889
  }));
10242
10890
  case 13:
10243
- _context18.p = 13;
10244
- _t24 = _context18.v;
10245
- return _context18.a(2, handleError(_t24, "Failed to register IP and attach license terms and distribute royalty tokens"));
10891
+ _context20.p = 13;
10892
+ _t25 = _context20.v;
10893
+ return _context20.a(2, handleError(_t25, "Failed to register IP and attach license terms and distribute royalty tokens"));
10246
10894
  }
10247
- }, _callee18, this, [[0, 13]]);
10895
+ }, _callee19, this, [[0, 13]]);
10248
10896
  }));
10249
- function registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x16) {
10897
+ function registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x17) {
10250
10898
  return _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens.apply(this, arguments);
10251
10899
  }
10252
10900
  return registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens;
@@ -10282,14 +10930,14 @@ var IPAssetClient = /*#__PURE__*/function () {
10282
10930
  }, {
10283
10931
  key: "registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens",
10284
10932
  value: (function () {
10285
- var _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(request) {
10933
+ var _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(request) {
10286
10934
  var _this9 = this;
10287
- var _request$options5, ipIdAddress, _yield$transformRegis6, _transformRequest5, _getRoyaltyShares2, royaltyShares, totalAmount, isRegistered, encodedTxData, contractCall, _yield$this$handleReg, txHash, ipId, tokenId, receipt, ipRoyaltyVault, distributeRoyaltyTokensTxHash, _t25;
10288
- return _regenerator().w(function (_context19) {
10289
- while (1) switch (_context19.p = _context19.n) {
10935
+ var _request$options4, ipIdAddress, _yield$transformRegis6, _transformRequest5, _getRoyaltyShares2, royaltyShares, totalAmount, isRegistered, encodedTxData, contractCall, _yield$this$handleReg, txHash, ipId, tokenId, receipt, ipRoyaltyVault, distributeRoyaltyTokensTxHash, _t26;
10936
+ return _regenerator().w(function (_context21) {
10937
+ while (1) switch (_context21.p = _context21.n) {
10290
10938
  case 0:
10291
- _context19.p = 0;
10292
- _context19.n = 1;
10939
+ _context21.p = 0;
10940
+ _context21.n = 1;
10293
10941
  return getIpIdAddress({
10294
10942
  nftContract: validateAddress(request.nftContract),
10295
10943
  tokenId: BigInt(request.tokenId),
@@ -10298,8 +10946,8 @@ var IPAssetClient = /*#__PURE__*/function () {
10298
10946
  chainId: this.chainId
10299
10947
  });
10300
10948
  case 1:
10301
- ipIdAddress = _context19.v;
10302
- _context19.n = 2;
10949
+ ipIdAddress = _context21.v;
10950
+ _context21.n = 2;
10303
10951
  return transformRegistrationRequest({
10304
10952
  request: request,
10305
10953
  rpcClient: this.rpcClient,
@@ -10307,15 +10955,15 @@ var IPAssetClient = /*#__PURE__*/function () {
10307
10955
  chainId: this.chainId
10308
10956
  });
10309
10957
  case 2:
10310
- _yield$transformRegis6 = _context19.v;
10958
+ _yield$transformRegis6 = _context21.v;
10311
10959
  _transformRequest5 = _yield$transformRegis6.transformRequest;
10312
10960
  _getRoyaltyShares2 = getRoyaltyShares(request.royaltyShares), royaltyShares = _getRoyaltyShares2.royaltyShares, totalAmount = _getRoyaltyShares2.totalAmount;
10313
- _context19.n = 3;
10961
+ _context21.n = 3;
10314
10962
  return this.isRegistered(ipIdAddress);
10315
10963
  case 3:
10316
- isRegistered = _context19.v;
10964
+ isRegistered = _context21.v;
10317
10965
  if (!isRegistered) {
10318
- _context19.n = 4;
10966
+ _context21.n = 4;
10319
10967
  break;
10320
10968
  }
10321
10969
  throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
@@ -10324,10 +10972,10 @@ var IPAssetClient = /*#__PURE__*/function () {
10324
10972
  contractCall = function contractCall() {
10325
10973
  return _this9.royaltyTokenDistributionWorkflowsClient.registerIpAndMakeDerivativeAndDeployRoyaltyVault(_transformRequest5);
10326
10974
  };
10327
- _context19.n = 5;
10975
+ _context21.n = 5;
10328
10976
  return this.handleRegistrationWithFees({
10329
10977
  options: _objectSpread2(_objectSpread2({}, request.options), {}, {
10330
- wipOptions: _objectSpread2(_objectSpread2({}, (_request$options5 = request.options) === null || _request$options5 === void 0 ? void 0 : _request$options5.wipOptions), {}, {
10978
+ wipOptions: _objectSpread2(_objectSpread2({}, (_request$options4 = request.options) === null || _request$options4 === void 0 ? void 0 : _request$options4.wipOptions), {}, {
10331
10979
  useMulticallWhenPossible: false
10332
10980
  })
10333
10981
  }),
@@ -10339,13 +10987,13 @@ var IPAssetClient = /*#__PURE__*/function () {
10339
10987
  txOptions: _objectSpread2({}, request.txOptions)
10340
10988
  });
10341
10989
  case 5:
10342
- _yield$this$handleReg = _context19.v;
10990
+ _yield$this$handleReg = _context21.v;
10343
10991
  txHash = _yield$this$handleReg.txHash;
10344
10992
  ipId = _yield$this$handleReg.ipId;
10345
10993
  tokenId = _yield$this$handleReg.tokenId;
10346
10994
  receipt = _yield$this$handleReg.receipt;
10347
10995
  if (!(tokenId === undefined || !ipId || !receipt)) {
10348
- _context19.n = 6;
10996
+ _context21.n = 6;
10349
10997
  break;
10350
10998
  }
10351
10999
  throw new Error("Failed to register derivative ip and deploy royalty vault.");
@@ -10353,7 +11001,7 @@ var IPAssetClient = /*#__PURE__*/function () {
10353
11001
  ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt).filter(function (item) {
10354
11002
  return item.ipId === ipId;
10355
11003
  })[0].ipRoyaltyVault;
10356
- _context19.n = 7;
11004
+ _context21.n = 7;
10357
11005
  return this.distributeRoyaltyTokens({
10358
11006
  ipId: ipId,
10359
11007
  deadline: request.deadline,
@@ -10363,13 +11011,13 @@ var IPAssetClient = /*#__PURE__*/function () {
10363
11011
  txOptions: request.txOptions
10364
11012
  });
10365
11013
  case 7:
10366
- distributeRoyaltyTokensTxHash = _context19.v;
10367
- _context19.n = 8;
11014
+ distributeRoyaltyTokensTxHash = _context21.v;
11015
+ _context21.n = 8;
10368
11016
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
10369
11017
  hash: distributeRoyaltyTokensTxHash
10370
11018
  }));
10371
11019
  case 8:
10372
- return _context19.a(2, {
11020
+ return _context21.a(2, {
10373
11021
  registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokensTxHash: txHash,
10374
11022
  distributeRoyaltyTokensTxHash: distributeRoyaltyTokensTxHash,
10375
11023
  ipId: ipId,
@@ -10377,13 +11025,13 @@ var IPAssetClient = /*#__PURE__*/function () {
10377
11025
  ipRoyaltyVault: ipRoyaltyVault
10378
11026
  });
10379
11027
  case 9:
10380
- _context19.p = 9;
10381
- _t25 = _context19.v;
10382
- return _context19.a(2, handleError(_t25, "Failed to register derivative IP and attach license terms and distribute royalty tokens"));
11028
+ _context21.p = 9;
11029
+ _t26 = _context21.v;
11030
+ return _context21.a(2, handleError(_t26, "Failed to register derivative IP and attach license terms and distribute royalty tokens"));
10383
11031
  }
10384
- }, _callee19, this, [[0, 9]]);
11032
+ }, _callee20, this, [[0, 9]]);
10385
11033
  }));
10386
- function registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x17) {
11034
+ function registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x18) {
10387
11035
  return _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens.apply(this, arguments);
10388
11036
  }
10389
11037
  return registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens;
@@ -10417,19 +11065,19 @@ var IPAssetClient = /*#__PURE__*/function () {
10417
11065
  }, {
10418
11066
  key: "mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens",
10419
11067
  value: (function () {
10420
- var _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(request) {
11068
+ var _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(request) {
10421
11069
  var _this0 = this;
10422
- var _request$options6, _yield$validateLicens3, licenseTerms, _yield$transformRegis7, _transformRequest6, encodedTxData, contractCall, _yield$this$handleReg2, txHash, ipId, tokenId, receipt, licenseTermsIds, ipRoyaltyVault, maxLicenseTokensTxHashes, _t26;
10423
- return _regenerator().w(function (_context20) {
10424
- while (1) switch (_context20.p = _context20.n) {
11070
+ var _request$options5, _yield$validateLicens3, licenseTerms, _yield$transformRegis7, _transformRequest6, encodedTxData, contractCall, _yield$this$handleReg2, txHash, ipId, tokenId, receipt, licenseTermsIds, ipRoyaltyVault, maxLicenseTokensTxHashes, _t27;
11071
+ return _regenerator().w(function (_context22) {
11072
+ while (1) switch (_context22.p = _context22.n) {
10425
11073
  case 0:
10426
- _context20.p = 0;
10427
- _context20.n = 1;
11074
+ _context22.p = 0;
11075
+ _context22.n = 1;
10428
11076
  return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
10429
11077
  case 1:
10430
- _yield$validateLicens3 = _context20.v;
11078
+ _yield$validateLicens3 = _context22.v;
10431
11079
  licenseTerms = _yield$validateLicens3.licenseTerms;
10432
- _context20.n = 2;
11080
+ _context22.n = 2;
10433
11081
  return transformRegistrationRequest({
10434
11082
  request: request,
10435
11083
  rpcClient: this.rpcClient,
@@ -10437,16 +11085,16 @@ var IPAssetClient = /*#__PURE__*/function () {
10437
11085
  chainId: this.chainId
10438
11086
  });
10439
11087
  case 2:
10440
- _yield$transformRegis7 = _context20.v;
11088
+ _yield$transformRegis7 = _context22.v;
10441
11089
  _transformRequest6 = _yield$transformRegis7.transformRequest;
10442
11090
  encodedTxData = this.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokensEncode(_transformRequest6);
10443
11091
  contractCall = function contractCall() {
10444
11092
  return _this0.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_transformRequest6);
10445
11093
  };
10446
- _context20.n = 3;
11094
+ _context22.n = 3;
10447
11095
  return this.handleRegistrationWithFees({
10448
11096
  options: _objectSpread2(_objectSpread2({}, request.options), {}, {
10449
- wipOptions: _objectSpread2(_objectSpread2({}, (_request$options6 = request.options) === null || _request$options6 === void 0 ? void 0 : _request$options6.wipOptions), {}, {
11097
+ wipOptions: _objectSpread2(_objectSpread2({}, (_request$options5 = request.options) === null || _request$options5 === void 0 ? void 0 : _request$options5.wipOptions), {}, {
10450
11098
  useMulticallWhenPossible: false
10451
11099
  })
10452
11100
  }),
@@ -10458,25 +11106,25 @@ var IPAssetClient = /*#__PURE__*/function () {
10458
11106
  txOptions: request.txOptions
10459
11107
  });
10460
11108
  case 3:
10461
- _yield$this$handleReg2 = _context20.v;
11109
+ _yield$this$handleReg2 = _context22.v;
10462
11110
  txHash = _yield$this$handleReg2.txHash;
10463
11111
  ipId = _yield$this$handleReg2.ipId;
10464
11112
  tokenId = _yield$this$handleReg2.tokenId;
10465
11113
  receipt = _yield$this$handleReg2.receipt;
10466
11114
  if (receipt) {
10467
- _context20.n = 4;
11115
+ _context22.n = 4;
10468
11116
  break;
10469
11117
  }
10470
- return _context20.a(2, {
11118
+ return _context22.a(2, {
10471
11119
  txHash: txHash
10472
11120
  });
10473
11121
  case 4:
10474
- _context20.n = 5;
11122
+ _context22.n = 5;
10475
11123
  return this.getLicenseTermsId(licenseTerms);
10476
11124
  case 5:
10477
- licenseTermsIds = _context20.v;
11125
+ licenseTermsIds = _context22.v;
10478
11126
  ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt)[0].ipRoyaltyVault;
10479
- _context20.n = 6;
11127
+ _context22.n = 6;
10480
11128
  return setMaxLicenseTokens({
10481
11129
  maxLicenseTokensData: request.licenseTermsData,
10482
11130
  licensorIpId: ipId,
@@ -10485,8 +11133,8 @@ var IPAssetClient = /*#__PURE__*/function () {
10485
11133
  templateAddress: this.licenseTemplateAddress
10486
11134
  });
10487
11135
  case 6:
10488
- maxLicenseTokensTxHashes = _context20.v;
10489
- return _context20.a(2, _objectSpread2({
11136
+ maxLicenseTokensTxHashes = _context22.v;
11137
+ return _context22.a(2, _objectSpread2({
10490
11138
  txHash: txHash,
10491
11139
  ipId: ipId,
10492
11140
  licenseTermsIds: licenseTermsIds,
@@ -10496,13 +11144,13 @@ var IPAssetClient = /*#__PURE__*/function () {
10496
11144
  maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
10497
11145
  }));
10498
11146
  case 7:
10499
- _context20.p = 7;
10500
- _t26 = _context20.v;
10501
- return _context20.a(2, handleError(_t26, "Failed to mint and register IP and attach PIL terms and distribute royalty tokens"));
11147
+ _context22.p = 7;
11148
+ _t27 = _context22.v;
11149
+ return _context22.a(2, handleError(_t27, "Failed to mint and register IP and attach PIL terms and distribute royalty tokens"));
10502
11150
  }
10503
- }, _callee20, this, [[0, 7]]);
11151
+ }, _callee21, this, [[0, 7]]);
10504
11152
  }));
10505
- function mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_x18) {
11153
+ function mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_x19) {
10506
11154
  return _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens.apply(this, arguments);
10507
11155
  }
10508
11156
  return mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens;
@@ -10536,14 +11184,14 @@ var IPAssetClient = /*#__PURE__*/function () {
10536
11184
  }, {
10537
11185
  key: "mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens",
10538
11186
  value: (function () {
10539
- var _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(request) {
11187
+ var _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(request) {
10540
11188
  var _this1 = this;
10541
- var _yield$transformRegis8, _transformRequest7, encodedTxData, contractCall, _t27;
10542
- return _regenerator().w(function (_context21) {
10543
- while (1) switch (_context21.p = _context21.n) {
11189
+ var _yield$transformRegis8, _transformRequest7, encodedTxData, contractCall, _t28;
11190
+ return _regenerator().w(function (_context23) {
11191
+ while (1) switch (_context23.p = _context23.n) {
10544
11192
  case 0:
10545
- _context21.p = 0;
10546
- _context21.n = 1;
11193
+ _context23.p = 0;
11194
+ _context23.n = 1;
10547
11195
  return transformRegistrationRequest({
10548
11196
  request: request,
10549
11197
  rpcClient: this.rpcClient,
@@ -10551,13 +11199,13 @@ var IPAssetClient = /*#__PURE__*/function () {
10551
11199
  chainId: this.chainId
10552
11200
  });
10553
11201
  case 1:
10554
- _yield$transformRegis8 = _context21.v;
11202
+ _yield$transformRegis8 = _context23.v;
10555
11203
  _transformRequest7 = _yield$transformRegis8.transformRequest;
10556
11204
  encodedTxData = this.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokensEncode(_transformRequest7);
10557
11205
  contractCall = function contractCall() {
10558
11206
  return _this1.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_transformRequest7);
10559
11207
  };
10560
- _context21.n = 2;
11208
+ _context23.n = 2;
10561
11209
  return this.handleRegistrationWithFees({
10562
11210
  spgNftContract: _transformRequest7.spgNftContract,
10563
11211
  options: request.options,
@@ -10569,15 +11217,15 @@ var IPAssetClient = /*#__PURE__*/function () {
10569
11217
  txOptions: request.txOptions
10570
11218
  });
10571
11219
  case 2:
10572
- return _context21.a(2, _context21.v);
11220
+ return _context23.a(2, _context23.v);
10573
11221
  case 3:
10574
- _context21.p = 3;
10575
- _t27 = _context21.v;
10576
- return _context21.a(2, handleError(_t27, "Failed to mint and register IP and make derivative and distribute royalty tokens"));
11222
+ _context23.p = 3;
11223
+ _t28 = _context23.v;
11224
+ return _context23.a(2, handleError(_t28, "Failed to mint and register IP and make derivative and distribute royalty tokens"));
10577
11225
  }
10578
- }, _callee21, this, [[0, 3]]);
11226
+ }, _callee22, this, [[0, 3]]);
10579
11227
  }));
10580
- function mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_x19) {
11228
+ function mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_x20) {
10581
11229
  return _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens.apply(this, arguments);
10582
11230
  }
10583
11231
  return mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens;
@@ -10585,12 +11233,12 @@ var IPAssetClient = /*#__PURE__*/function () {
10585
11233
  }, {
10586
11234
  key: "distributeRoyaltyTokens",
10587
11235
  value: function () {
10588
- var _distributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(request) {
11236
+ var _distributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(request) {
10589
11237
  var _yield$transferDistri, transformRequest, txHash;
10590
- return _regenerator().w(function (_context22) {
10591
- while (1) switch (_context22.n) {
11238
+ return _regenerator().w(function (_context24) {
11239
+ while (1) switch (_context24.n) {
10592
11240
  case 0:
10593
- _context22.n = 1;
11241
+ _context24.n = 1;
10594
11242
  return transferDistributeRoyaltyTokensRequest({
10595
11243
  request: request,
10596
11244
  rpcClient: this.rpcClient,
@@ -10598,22 +11246,22 @@ var IPAssetClient = /*#__PURE__*/function () {
10598
11246
  chainId: this.chainId
10599
11247
  });
10600
11248
  case 1:
10601
- _yield$transferDistri = _context22.v;
11249
+ _yield$transferDistri = _context24.v;
10602
11250
  transformRequest = _yield$transferDistri.transformRequest;
10603
- _context22.n = 2;
11251
+ _context24.n = 2;
10604
11252
  return this.royaltyTokenDistributionWorkflowsClient.distributeRoyaltyTokens(transformRequest);
10605
11253
  case 2:
10606
- txHash = _context22.v;
10607
- _context22.n = 3;
11254
+ txHash = _context24.v;
11255
+ _context24.n = 3;
10608
11256
  return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
10609
11257
  hash: txHash
10610
11258
  }));
10611
11259
  case 3:
10612
- return _context22.a(2, txHash);
11260
+ return _context24.a(2, txHash);
10613
11261
  }
10614
- }, _callee22, this);
11262
+ }, _callee23, this);
10615
11263
  }));
10616
- function distributeRoyaltyTokens(_x20) {
11264
+ function distributeRoyaltyTokens(_x21) {
10617
11265
  return _distributeRoyaltyTokens.apply(this, arguments);
10618
11266
  }
10619
11267
  return distributeRoyaltyTokens;
@@ -10621,20 +11269,20 @@ var IPAssetClient = /*#__PURE__*/function () {
10621
11269
  }, {
10622
11270
  key: "isRegistered",
10623
11271
  value: function () {
10624
- var _isRegistered = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(ipId) {
10625
- return _regenerator().w(function (_context23) {
10626
- while (1) switch (_context23.n) {
11272
+ var _isRegistered = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(ipId) {
11273
+ return _regenerator().w(function (_context25) {
11274
+ while (1) switch (_context25.n) {
10627
11275
  case 0:
10628
- _context23.n = 1;
11276
+ _context25.n = 1;
10629
11277
  return this.ipAssetRegistryClient.isRegistered({
10630
11278
  id: validateAddress(ipId)
10631
11279
  });
10632
11280
  case 1:
10633
- return _context23.a(2, _context23.v);
11281
+ return _context25.a(2, _context25.v);
10634
11282
  }
10635
- }, _callee23, this);
11283
+ }, _callee24, this);
10636
11284
  }));
10637
- function isRegistered(_x21) {
11285
+ function isRegistered(_x22) {
10638
11286
  return _isRegistered.apply(this, arguments);
10639
11287
  }
10640
11288
  return isRegistered;
@@ -10680,24 +11328,24 @@ var IPAssetClient = /*#__PURE__*/function () {
10680
11328
  }, {
10681
11329
  key: "batchRegisterIpAssetsWithOptimizedWorkflows",
10682
11330
  value: (function () {
10683
- var _batchRegisterIpAssetsWithOptimizedWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(request) {
10684
- var transferWorkflowRequests, _iterator6, _step6, req, res, royaltyDistributionRequests, _yield$handleMultical, txResponses, aggregateRegistrationRequest, responses, royaltyTokensDistributionRequests, _iterator7, _step7, _step7$value, txHash, receipt, iPRegisteredLog, ipRoyaltyVaultEvent, _yield$prepareRoyalty, requests, ipRoyaltyVaults, distributeRoyaltyTokensTxHashes, _yield$handleMultical2, txResponse, registrationResults, _t28, _t29, _t30;
10685
- return _regenerator().w(function (_context24) {
10686
- while (1) switch (_context24.p = _context24.n) {
11331
+ var _batchRegisterIpAssetsWithOptimizedWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(request) {
11332
+ var transferWorkflowRequests, _iterator6, _step6, req, res, royaltyDistributionRequests, _yield$handleMultical, txResponses, aggregateRegistrationRequest, responses, royaltyTokensDistributionRequests, _iterator7, _step7, _step7$value, txHash, receipt, iPRegisteredLog, ipRoyaltyVaultEvent, _yield$prepareRoyalty, requests, ipRoyaltyVaults, distributeRoyaltyTokensTxHashes, _yield$handleMultical2, txResponse, registrationResults, _t29, _t30, _t31;
11333
+ return _regenerator().w(function (_context26) {
11334
+ while (1) switch (_context26.p = _context26.n) {
10687
11335
  case 0:
10688
- _context24.p = 0;
11336
+ _context26.p = 0;
10689
11337
  // Transform requests into workflow format
10690
11338
  transferWorkflowRequests = [];
10691
11339
  _iterator6 = _createForOfIteratorHelper(request.requests);
10692
- _context24.p = 1;
11340
+ _context26.p = 1;
10693
11341
  _iterator6.s();
10694
11342
  case 2:
10695
11343
  if ((_step6 = _iterator6.n()).done) {
10696
- _context24.n = 5;
11344
+ _context26.n = 5;
10697
11345
  break;
10698
11346
  }
10699
11347
  req = _step6.value;
10700
- _context24.n = 3;
11348
+ _context26.n = 3;
10701
11349
  return transformRegistrationRequest({
10702
11350
  request: req,
10703
11351
  rpcClient: this.rpcClient,
@@ -10705,22 +11353,22 @@ var IPAssetClient = /*#__PURE__*/function () {
10705
11353
  chainId: this.chainId
10706
11354
  });
10707
11355
  case 3:
10708
- res = _context24.v;
11356
+ res = _context26.v;
10709
11357
  transferWorkflowRequests.push(res);
10710
11358
  case 4:
10711
- _context24.n = 2;
11359
+ _context26.n = 2;
10712
11360
  break;
10713
11361
  case 5:
10714
- _context24.n = 7;
11362
+ _context26.n = 7;
10715
11363
  break;
10716
11364
  case 6:
10717
- _context24.p = 6;
10718
- _t28 = _context24.v;
10719
- _iterator6.e(_t28);
11365
+ _context26.p = 6;
11366
+ _t29 = _context26.v;
11367
+ _iterator6.e(_t29);
10720
11368
  case 7:
10721
- _context24.p = 7;
11369
+ _context26.p = 7;
10722
11370
  _iterator6.f();
10723
- return _context24.f(7);
11371
+ return _context26.f(7);
10724
11372
  case 8:
10725
11373
  /**
10726
11374
  * Extract royalty distribution requests from workflow responses that contain royalty shares
@@ -10738,7 +11386,7 @@ var IPAssetClient = /*#__PURE__*/function () {
10738
11386
  deadline: res.extraData.deadline
10739
11387
  };
10740
11388
  }); // Process initial registration transactions
10741
- _context24.n = 9;
11389
+ _context26.n = 9;
10742
11390
  return handleMulticall({
10743
11391
  transferWorkflowRequests: transferWorkflowRequests,
10744
11392
  multicall3Address: this.multicall3Client.address,
@@ -10749,23 +11397,23 @@ var IPAssetClient = /*#__PURE__*/function () {
10749
11397
  chainId: this.chainId
10750
11398
  });
10751
11399
  case 9:
10752
- _yield$handleMultical = _context24.v;
11400
+ _yield$handleMultical = _context26.v;
10753
11401
  txResponses = _yield$handleMultical.response;
10754
11402
  aggregateRegistrationRequest = _yield$handleMultical.aggregateRegistrationRequest;
10755
11403
  responses = [];
10756
11404
  royaltyTokensDistributionRequests = []; // Process each transaction response
10757
11405
  _iterator7 = _createForOfIteratorHelper(txResponses);
10758
- _context24.p = 10;
11406
+ _context26.p = 10;
10759
11407
  _iterator7.s();
10760
11408
  case 11:
10761
11409
  if ((_step7 = _iterator7.n()).done) {
10762
- _context24.n = 14;
11410
+ _context26.n = 14;
10763
11411
  break;
10764
11412
  }
10765
11413
  _step7$value = _step7.value, txHash = _step7$value.txHash, receipt = _step7$value.receipt;
10766
11414
  iPRegisteredLog = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(receipt);
10767
11415
  ipRoyaltyVaultEvent = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt); // Prepare royalty distribution if needed
10768
- _context24.n = 12;
11416
+ _context26.n = 12;
10769
11417
  return prepareRoyaltyTokensDistributionRequests({
10770
11418
  royaltyDistributionRequests: royaltyDistributionRequests,
10771
11419
  ipRegisteredLog: iPRegisteredLog,
@@ -10775,7 +11423,7 @@ var IPAssetClient = /*#__PURE__*/function () {
10775
11423
  chainId: this.chainId
10776
11424
  });
10777
11425
  case 12:
10778
- _yield$prepareRoyalty = _context24.v;
11426
+ _yield$prepareRoyalty = _context26.v;
10779
11427
  requests = _yield$prepareRoyalty.requests;
10780
11428
  ipRoyaltyVaults = _yield$prepareRoyalty.ipRoyaltyVaults;
10781
11429
  royaltyTokensDistributionRequests.push.apply(royaltyTokensDistributionRequests, _toConsumableArray(requests));
@@ -10791,25 +11439,25 @@ var IPAssetClient = /*#__PURE__*/function () {
10791
11439
  })
10792
11440
  });
10793
11441
  case 13:
10794
- _context24.n = 11;
11442
+ _context26.n = 11;
10795
11443
  break;
10796
11444
  case 14:
10797
- _context24.n = 16;
11445
+ _context26.n = 16;
10798
11446
  break;
10799
11447
  case 15:
10800
- _context24.p = 15;
10801
- _t29 = _context24.v;
10802
- _iterator7.e(_t29);
11448
+ _context26.p = 15;
11449
+ _t30 = _context26.v;
11450
+ _iterator7.e(_t30);
10803
11451
  case 16:
10804
- _context24.p = 16;
11452
+ _context26.p = 16;
10805
11453
  _iterator7.f();
10806
- return _context24.f(16);
11454
+ return _context26.f(16);
10807
11455
  case 17:
10808
11456
  if (!(royaltyTokensDistributionRequests.length > 0)) {
10809
- _context24.n = 19;
11457
+ _context26.n = 19;
10810
11458
  break;
10811
11459
  }
10812
- _context24.n = 18;
11460
+ _context26.n = 18;
10813
11461
  return handleMulticall({
10814
11462
  transferWorkflowRequests: royaltyTokensDistributionRequests,
10815
11463
  multicall3Address: this.multicall3Client.address,
@@ -10820,29 +11468,29 @@ var IPAssetClient = /*#__PURE__*/function () {
10820
11468
  chainId: this.chainId
10821
11469
  });
10822
11470
  case 18:
10823
- _yield$handleMultical2 = _context24.v;
11471
+ _yield$handleMultical2 = _context26.v;
10824
11472
  txResponse = _yield$handleMultical2.response;
10825
11473
  distributeRoyaltyTokensTxHashes = txResponse.map(function (tx) {
10826
11474
  return tx.txHash;
10827
11475
  });
10828
11476
  case 19:
10829
- _context24.n = 20;
11477
+ _context26.n = 20;
10830
11478
  return this.populateLicenseAndTokenIdsForRegistrationResults(responses, aggregateRegistrationRequest);
10831
11479
  case 20:
10832
- registrationResults = _context24.v;
10833
- return _context24.a(2, _objectSpread2({
11480
+ registrationResults = _context26.v;
11481
+ return _context26.a(2, _objectSpread2({
10834
11482
  registrationResults: registrationResults
10835
11483
  }, distributeRoyaltyTokensTxHashes && {
10836
11484
  distributeRoyaltyTokensTxHashes: distributeRoyaltyTokensTxHashes
10837
11485
  }));
10838
11486
  case 21:
10839
- _context24.p = 21;
10840
- _t30 = _context24.v;
10841
- return _context24.a(2, handleError(_t30, "Failed to batch register IP assets with optimized workflows"));
11487
+ _context26.p = 21;
11488
+ _t31 = _context26.v;
11489
+ return _context26.a(2, handleError(_t31, "Failed to batch register IP assets with optimized workflows"));
10842
11490
  }
10843
- }, _callee24, this, [[10, 15, 16, 17], [1, 6, 7, 8], [0, 21]]);
11491
+ }, _callee25, this, [[10, 15, 16, 17], [1, 6, 7, 8], [0, 21]]);
10844
11492
  }));
10845
- function batchRegisterIpAssetsWithOptimizedWorkflows(_x22) {
11493
+ function batchRegisterIpAssetsWithOptimizedWorkflows(_x23) {
10846
11494
  return _batchRegisterIpAssetsWithOptimizedWorkflows.apply(this, arguments);
10847
11495
  }
10848
11496
  return batchRegisterIpAssetsWithOptimizedWorkflows;
@@ -10912,51 +11560,51 @@ var IPAssetClient = /*#__PURE__*/function () {
10912
11560
  }, {
10913
11561
  key: "registerIpAsset",
10914
11562
  value: (function () {
10915
- var _registerIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(request) {
10916
- var nft, licenseTermsData, royaltyShares, _t31;
10917
- return _regenerator().w(function (_context25) {
10918
- while (1) switch (_context25.p = _context25.n) {
11563
+ var _registerIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(request) {
11564
+ var nft, licenseTermsData, royaltyShares, _t32;
11565
+ return _regenerator().w(function (_context27) {
11566
+ while (1) switch (_context27.p = _context27.n) {
10919
11567
  case 0:
10920
- _context25.p = 0;
11568
+ _context27.p = 0;
10921
11569
  nft = request.nft, licenseTermsData = request.licenseTermsData, royaltyShares = request.royaltyShares; // Validate royalty shares without license terms
10922
11570
  if (!(royaltyShares && !licenseTermsData)) {
10923
- _context25.n = 1;
11571
+ _context27.n = 1;
10924
11572
  break;
10925
11573
  }
10926
11574
  throw new Error("License terms data must be provided when royalty shares are specified.");
10927
11575
  case 1:
10928
11576
  if (!(nft.type === "minted")) {
10929
- _context25.n = 3;
11577
+ _context27.n = 3;
10930
11578
  break;
10931
11579
  }
10932
- _context25.n = 2;
11580
+ _context27.n = 2;
10933
11581
  return this.handleMintedNftRegistration(request);
10934
11582
  case 2:
10935
- return _context25.a(2, _context25.v);
11583
+ return _context27.a(2, _context27.v);
10936
11584
  case 3:
10937
11585
  if (!(nft.type === "mint")) {
10938
- _context25.n = 5;
11586
+ _context27.n = 5;
10939
11587
  break;
10940
11588
  }
10941
- _context25.n = 4;
11589
+ _context27.n = 4;
10942
11590
  return this.handleMintNftRegistration(request);
10943
11591
  case 4:
10944
- return _context25.a(2, _context25.v);
11592
+ return _context27.a(2, _context27.v);
10945
11593
  case 5:
10946
11594
  throw new Error("Invalid NFT type");
10947
11595
  case 6:
10948
- _context25.n = 8;
11596
+ _context27.n = 8;
10949
11597
  break;
10950
11598
  case 7:
10951
- _context25.p = 7;
10952
- _t31 = _context25.v;
10953
- return _context25.a(2, handleError(_t31, "Failed to register IP Asset"));
11599
+ _context27.p = 7;
11600
+ _t32 = _context27.v;
11601
+ return _context27.a(2, handleError(_t32, "Failed to register IP Asset"));
10954
11602
  case 8:
10955
- return _context25.a(2);
11603
+ return _context27.a(2);
10956
11604
  }
10957
- }, _callee25, this, [[0, 7]]);
11605
+ }, _callee26, this, [[0, 7]]);
10958
11606
  }));
10959
- function registerIpAsset(_x23) {
11607
+ function registerIpAsset(_x24) {
10960
11608
  return _registerIpAsset.apply(this, arguments);
10961
11609
  }
10962
11610
  return registerIpAsset;
@@ -11025,15 +11673,15 @@ var IPAssetClient = /*#__PURE__*/function () {
11025
11673
  }, {
11026
11674
  key: "registerDerivativeIpAsset",
11027
11675
  value: (function () {
11028
- var _registerDerivativeIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(request) {
11029
- var nft, licenseTokenIds, royaltyShares, derivData, hasDerivData, hasLicenseTokens, _t32;
11030
- return _regenerator().w(function (_context26) {
11031
- while (1) switch (_context26.p = _context26.n) {
11676
+ var _registerDerivativeIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(request) {
11677
+ var nft, licenseTokenIds, royaltyShares, derivData, hasDerivData, hasLicenseTokens, _t33;
11678
+ return _regenerator().w(function (_context28) {
11679
+ while (1) switch (_context28.p = _context28.n) {
11032
11680
  case 0:
11033
- _context26.p = 0;
11681
+ _context28.p = 0;
11034
11682
  nft = request.nft, licenseTokenIds = request.licenseTokenIds, royaltyShares = request.royaltyShares, derivData = request.derivData;
11035
11683
  if (!(royaltyShares && !derivData)) {
11036
- _context26.n = 1;
11684
+ _context28.n = 1;
11037
11685
  break;
11038
11686
  }
11039
11687
  throw new Error("derivData must be provided when royaltyShares are provided.");
@@ -11042,43 +11690,43 @@ var IPAssetClient = /*#__PURE__*/function () {
11042
11690
  hasDerivData = !!derivData;
11043
11691
  hasLicenseTokens = !!(licenseTokenIds && licenseTokenIds.length > 0);
11044
11692
  if (!(!hasDerivData && !hasLicenseTokens)) {
11045
- _context26.n = 2;
11693
+ _context28.n = 2;
11046
11694
  break;
11047
11695
  }
11048
11696
  throw new Error("Either derivData or licenseTokenIds must be provided.");
11049
11697
  case 2:
11050
11698
  if (!(nft.type === "minted")) {
11051
- _context26.n = 4;
11699
+ _context28.n = 4;
11052
11700
  break;
11053
11701
  }
11054
- _context26.n = 3;
11702
+ _context28.n = 3;
11055
11703
  return this.handleMintedNftDerivativeRegistration(request);
11056
11704
  case 3:
11057
- return _context26.a(2, _context26.v);
11705
+ return _context28.a(2, _context28.v);
11058
11706
  case 4:
11059
11707
  if (!(nft.type === "mint")) {
11060
- _context26.n = 6;
11708
+ _context28.n = 6;
11061
11709
  break;
11062
11710
  }
11063
- _context26.n = 5;
11711
+ _context28.n = 5;
11064
11712
  return this.handleMintNftDerivativeRegistration(request);
11065
11713
  case 5:
11066
- return _context26.a(2, _context26.v);
11714
+ return _context28.a(2, _context28.v);
11067
11715
  case 6:
11068
11716
  throw new Error("Invalid NFT type.");
11069
11717
  case 7:
11070
- _context26.n = 9;
11718
+ _context28.n = 9;
11071
11719
  break;
11072
11720
  case 8:
11073
- _context26.p = 8;
11074
- _t32 = _context26.v;
11075
- return _context26.a(2, handleError(_t32, "Failed to register derivative IP Asset"));
11721
+ _context28.p = 8;
11722
+ _t33 = _context28.v;
11723
+ return _context28.a(2, handleError(_t33, "Failed to register derivative IP Asset"));
11076
11724
  case 9:
11077
- return _context26.a(2);
11725
+ return _context28.a(2);
11078
11726
  }
11079
- }, _callee26, this, [[0, 8]]);
11727
+ }, _callee27, this, [[0, 8]]);
11080
11728
  }));
11081
- function registerDerivativeIpAsset(_x24) {
11729
+ function registerDerivativeIpAsset(_x25) {
11082
11730
  return _registerDerivativeIpAsset.apply(this, arguments);
11083
11731
  }
11084
11732
  return registerDerivativeIpAsset;
@@ -11095,10 +11743,10 @@ var IPAssetClient = /*#__PURE__*/function () {
11095
11743
  }, {
11096
11744
  key: "handleMintedNftDerivativeRegistration",
11097
11745
  value: (function () {
11098
- var _handleMintedNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(request) {
11746
+ var _handleMintedNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(request) {
11099
11747
  var nft, royaltyShares, derivData, maxRts, licenseTokenIds, deadline, txOptions, options, ipMetadata, baseParams;
11100
- return _regenerator().w(function (_context27) {
11101
- while (1) switch (_context27.n) {
11748
+ return _regenerator().w(function (_context29) {
11749
+ while (1) switch (_context29.n) {
11102
11750
  case 0:
11103
11751
  nft = request.nft, royaltyShares = request.royaltyShares, derivData = request.derivData, maxRts = request.maxRts, licenseTokenIds = request.licenseTokenIds, deadline = request.deadline, txOptions = request.txOptions, options = request.options, ipMetadata = request.ipMetadata;
11104
11752
  baseParams = {
@@ -11110,31 +11758,31 @@ var IPAssetClient = /*#__PURE__*/function () {
11110
11758
  options: options
11111
11759
  };
11112
11760
  if (!(royaltyShares && derivData)) {
11113
- _context27.n = 1;
11761
+ _context29.n = 1;
11114
11762
  break;
11115
11763
  }
11116
- return _context27.a(2, this.registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11764
+ return _context29.a(2, this.registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11117
11765
  royaltyShares: royaltyShares,
11118
11766
  derivData: derivData
11119
11767
  })));
11120
11768
  case 1:
11121
11769
  if (!derivData) {
11122
- _context27.n = 2;
11770
+ _context29.n = 2;
11123
11771
  break;
11124
11772
  }
11125
- return _context27.a(2, this.registerDerivativeIp(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11773
+ return _context29.a(2, this.registerDerivativeIp(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11126
11774
  derivData: derivData
11127
11775
  })));
11128
11776
  case 2:
11129
- return _context27.a(2, this.registerIpAndMakeDerivativeWithLicenseTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11777
+ return _context29.a(2, this.registerIpAndMakeDerivativeWithLicenseTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11130
11778
  licenseTokenIds: licenseTokenIds,
11131
11779
  maxRts: maxRts,
11132
11780
  autoApproveLicenseTokens: request.autoApproveLicenseTokens
11133
11781
  })));
11134
11782
  }
11135
- }, _callee27, this);
11783
+ }, _callee28, this);
11136
11784
  }));
11137
- function handleMintedNftDerivativeRegistration(_x25) {
11785
+ function handleMintedNftDerivativeRegistration(_x26) {
11138
11786
  return _handleMintedNftDerivativeRegistration.apply(this, arguments);
11139
11787
  }
11140
11788
  return handleMintedNftDerivativeRegistration;
@@ -11151,10 +11799,10 @@ var IPAssetClient = /*#__PURE__*/function () {
11151
11799
  }, {
11152
11800
  key: "handleMintNftDerivativeRegistration",
11153
11801
  value: (function () {
11154
- var _handleMintNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(request) {
11802
+ var _handleMintNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(request) {
11155
11803
  var nft, royaltyShares, derivData, maxRts, licenseTokenIds, txOptions, options, ipMetadata, baseParams;
11156
- return _regenerator().w(function (_context28) {
11157
- while (1) switch (_context28.n) {
11804
+ return _regenerator().w(function (_context30) {
11805
+ while (1) switch (_context30.n) {
11158
11806
  case 0:
11159
11807
  nft = request.nft, royaltyShares = request.royaltyShares, derivData = request.derivData, maxRts = request.maxRts, licenseTokenIds = request.licenseTokenIds, txOptions = request.txOptions, options = request.options, ipMetadata = request.ipMetadata;
11160
11808
  baseParams = {
@@ -11166,31 +11814,31 @@ var IPAssetClient = /*#__PURE__*/function () {
11166
11814
  options: options
11167
11815
  };
11168
11816
  if (!(royaltyShares && derivData)) {
11169
- _context28.n = 1;
11817
+ _context30.n = 1;
11170
11818
  break;
11171
11819
  }
11172
- return _context28.a(2, this.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11820
+ return _context30.a(2, this.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11173
11821
  royaltyShares: royaltyShares,
11174
11822
  derivData: derivData
11175
11823
  })));
11176
11824
  case 1:
11177
11825
  if (!derivData) {
11178
- _context28.n = 2;
11826
+ _context30.n = 2;
11179
11827
  break;
11180
11828
  }
11181
- return _context28.a(2, this.mintAndRegisterIpAndMakeDerivative(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11829
+ return _context30.a(2, this.mintAndRegisterIpAndMakeDerivative(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11182
11830
  derivData: derivData
11183
11831
  })));
11184
11832
  case 2:
11185
- return _context28.a(2, this.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11833
+ return _context30.a(2, this.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11186
11834
  licenseTokenIds: licenseTokenIds,
11187
11835
  maxRts: maxRts,
11188
11836
  autoApproveLicenseTokens: request.autoApproveLicenseTokens
11189
11837
  })));
11190
11838
  }
11191
- }, _callee28, this);
11839
+ }, _callee29, this);
11192
11840
  }));
11193
- function handleMintNftDerivativeRegistration(_x26) {
11841
+ function handleMintNftDerivativeRegistration(_x27) {
11194
11842
  return _handleMintNftDerivativeRegistration.apply(this, arguments);
11195
11843
  }
11196
11844
  return handleMintNftDerivativeRegistration;
@@ -11228,32 +11876,32 @@ var IPAssetClient = /*#__PURE__*/function () {
11228
11876
  }, {
11229
11877
  key: "linkDerivative",
11230
11878
  value: (function () {
11231
- var _linkDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(request) {
11232
- var _t33;
11233
- return _regenerator().w(function (_context29) {
11234
- while (1) switch (_context29.p = _context29.n) {
11879
+ var _linkDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30(request) {
11880
+ var _t34;
11881
+ return _regenerator().w(function (_context31) {
11882
+ while (1) switch (_context31.p = _context31.n) {
11235
11883
  case 0:
11236
- _context29.p = 0;
11884
+ _context31.p = 0;
11237
11885
  if (!("parentIpIds" in request)) {
11238
- _context29.n = 1;
11886
+ _context31.n = 1;
11239
11887
  break;
11240
11888
  }
11241
- return _context29.a(2, this.registerDerivative(request));
11889
+ return _context31.a(2, this.registerDerivative(request));
11242
11890
  case 1:
11243
- return _context29.a(2, this.registerDerivativeWithLicenseTokens(request));
11891
+ return _context31.a(2, this.registerDerivativeWithLicenseTokens(request));
11244
11892
  case 2:
11245
- _context29.n = 4;
11893
+ _context31.n = 4;
11246
11894
  break;
11247
11895
  case 3:
11248
- _context29.p = 3;
11249
- _t33 = _context29.v;
11250
- return _context29.a(2, handleError(_t33, "Failed to link derivative"));
11896
+ _context31.p = 3;
11897
+ _t34 = _context31.v;
11898
+ return _context31.a(2, handleError(_t34, "Failed to link derivative"));
11251
11899
  case 4:
11252
- return _context29.a(2);
11900
+ return _context31.a(2);
11253
11901
  }
11254
- }, _callee29, this, [[0, 3]]);
11902
+ }, _callee30, this, [[0, 3]]);
11255
11903
  }));
11256
- function linkDerivative(_x27) {
11904
+ function linkDerivative(_x28) {
11257
11905
  return _linkDerivative.apply(this, arguments);
11258
11906
  }
11259
11907
  return linkDerivative;
@@ -11270,10 +11918,10 @@ var IPAssetClient = /*#__PURE__*/function () {
11270
11918
  }, {
11271
11919
  key: "handleMintedNftRegistration",
11272
11920
  value: (function () {
11273
- var _handleMintedNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30(request) {
11921
+ var _handleMintedNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(request) {
11274
11922
  var nft, ipMetadata, txOptions, licenseTermsData, royaltyShares, deadline, baseParams;
11275
- return _regenerator().w(function (_context30) {
11276
- while (1) switch (_context30.n) {
11923
+ return _regenerator().w(function (_context32) {
11924
+ while (1) switch (_context32.n) {
11277
11925
  case 0:
11278
11926
  nft = request.nft, ipMetadata = request.ipMetadata, txOptions = request.txOptions, licenseTermsData = request.licenseTermsData, royaltyShares = request.royaltyShares, deadline = request.deadline;
11279
11927
  baseParams = {
@@ -11284,27 +11932,27 @@ var IPAssetClient = /*#__PURE__*/function () {
11284
11932
  txOptions: txOptions
11285
11933
  };
11286
11934
  if (!(licenseTermsData && royaltyShares)) {
11287
- _context30.n = 1;
11935
+ _context32.n = 1;
11288
11936
  break;
11289
11937
  }
11290
- return _context30.a(2, this.registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11938
+ return _context32.a(2, this.registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11291
11939
  licenseTermsData: licenseTermsData,
11292
11940
  royaltyShares: royaltyShares
11293
11941
  })));
11294
11942
  case 1:
11295
11943
  if (!licenseTermsData) {
11296
- _context30.n = 2;
11944
+ _context32.n = 2;
11297
11945
  break;
11298
11946
  }
11299
- return _context30.a(2, this.registerIpAndAttachPilTerms(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11947
+ return _context32.a(2, this.registerIpAndAttachPilTerms(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11300
11948
  licenseTermsData: licenseTermsData
11301
11949
  })));
11302
11950
  case 2:
11303
- return _context30.a(2, this.register(_objectSpread2({}, baseParams)));
11951
+ return _context32.a(2, this.register(_objectSpread2({}, baseParams)));
11304
11952
  }
11305
- }, _callee30, this);
11953
+ }, _callee31, this);
11306
11954
  }));
11307
- function handleMintedNftRegistration(_x28) {
11955
+ function handleMintedNftRegistration(_x29) {
11308
11956
  return _handleMintedNftRegistration.apply(this, arguments);
11309
11957
  }
11310
11958
  return handleMintedNftRegistration;
@@ -11321,10 +11969,10 @@ var IPAssetClient = /*#__PURE__*/function () {
11321
11969
  }, {
11322
11970
  key: "handleMintNftRegistration",
11323
11971
  value: (function () {
11324
- var _handleMintNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(request) {
11972
+ var _handleMintNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32(request) {
11325
11973
  var nft, ipMetadata, txOptions, options, licenseTermsData, royaltyShares, baseParams;
11326
- return _regenerator().w(function (_context31) {
11327
- while (1) switch (_context31.n) {
11974
+ return _regenerator().w(function (_context33) {
11975
+ while (1) switch (_context33.n) {
11328
11976
  case 0:
11329
11977
  nft = request.nft, ipMetadata = request.ipMetadata, txOptions = request.txOptions, options = request.options, licenseTermsData = request.licenseTermsData, royaltyShares = request.royaltyShares;
11330
11978
  baseParams = {
@@ -11336,27 +11984,27 @@ var IPAssetClient = /*#__PURE__*/function () {
11336
11984
  options: options
11337
11985
  };
11338
11986
  if (!(licenseTermsData && royaltyShares)) {
11339
- _context31.n = 1;
11987
+ _context33.n = 1;
11340
11988
  break;
11341
11989
  }
11342
- return _context31.a(2, this.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11990
+ return _context33.a(2, this.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11343
11991
  licenseTermsData: licenseTermsData,
11344
11992
  royaltyShares: royaltyShares
11345
11993
  })));
11346
11994
  case 1:
11347
11995
  if (!licenseTermsData) {
11348
- _context31.n = 2;
11996
+ _context33.n = 2;
11349
11997
  break;
11350
11998
  }
11351
- return _context31.a(2, this.mintAndRegisterIpAssetWithPilTerms(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11999
+ return _context33.a(2, this.mintAndRegisterIpAssetWithPilTerms(_objectSpread2(_objectSpread2({}, baseParams), {}, {
11352
12000
  licenseTermsData: licenseTermsData
11353
12001
  })));
11354
12002
  case 2:
11355
- return _context31.a(2, this.mintAndRegisterIp(_objectSpread2({}, baseParams)));
12003
+ return _context33.a(2, this.mintAndRegisterIp(_objectSpread2({}, baseParams)));
11356
12004
  }
11357
- }, _callee31, this);
12005
+ }, _callee32, this);
11358
12006
  }));
11359
- function handleMintNftRegistration(_x29) {
12007
+ function handleMintNftRegistration(_x30) {
11360
12008
  return _handleMintNftRegistration.apply(this, arguments);
11361
12009
  }
11362
12010
  return handleMintNftRegistration;
@@ -11364,48 +12012,48 @@ var IPAssetClient = /*#__PURE__*/function () {
11364
12012
  }, {
11365
12013
  key: "getLicenseTermsId",
11366
12014
  value: function () {
11367
- var _getLicenseTermsId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32(licenseTerms) {
11368
- var licenseTermsIds, _iterator8, _step8, licenseTerm, licenseRes, _t34;
11369
- return _regenerator().w(function (_context32) {
11370
- while (1) switch (_context32.p = _context32.n) {
12015
+ var _getLicenseTermsId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33(licenseTerms) {
12016
+ var licenseTermsIds, _iterator8, _step8, licenseTerm, licenseRes, _t35;
12017
+ return _regenerator().w(function (_context34) {
12018
+ while (1) switch (_context34.p = _context34.n) {
11371
12019
  case 0:
11372
12020
  licenseTermsIds = [];
11373
12021
  _iterator8 = _createForOfIteratorHelper(licenseTerms);
11374
- _context32.p = 1;
12022
+ _context34.p = 1;
11375
12023
  _iterator8.s();
11376
12024
  case 2:
11377
12025
  if ((_step8 = _iterator8.n()).done) {
11378
- _context32.n = 5;
12026
+ _context34.n = 5;
11379
12027
  break;
11380
12028
  }
11381
12029
  licenseTerm = _step8.value;
11382
- _context32.n = 3;
12030
+ _context34.n = 3;
11383
12031
  return this.licenseTemplateClient.getLicenseTermsId({
11384
12032
  terms: licenseTerm
11385
12033
  });
11386
12034
  case 3:
11387
- licenseRes = _context32.v;
12035
+ licenseRes = _context34.v;
11388
12036
  licenseTermsIds.push(licenseRes.selectedLicenseTermsId);
11389
12037
  case 4:
11390
- _context32.n = 2;
12038
+ _context34.n = 2;
11391
12039
  break;
11392
12040
  case 5:
11393
- _context32.n = 7;
12041
+ _context34.n = 7;
11394
12042
  break;
11395
12043
  case 6:
11396
- _context32.p = 6;
11397
- _t34 = _context32.v;
11398
- _iterator8.e(_t34);
12044
+ _context34.p = 6;
12045
+ _t35 = _context34.v;
12046
+ _iterator8.e(_t35);
11399
12047
  case 7:
11400
- _context32.p = 7;
12048
+ _context34.p = 7;
11401
12049
  _iterator8.f();
11402
- return _context32.f(7);
12050
+ return _context34.f(7);
11403
12051
  case 8:
11404
- return _context32.a(2, licenseTermsIds);
12052
+ return _context34.a(2, licenseTermsIds);
11405
12053
  }
11406
- }, _callee32, this, [[1, 6, 7, 8]]);
12054
+ }, _callee33, this, [[1, 6, 7, 8]]);
11407
12055
  }));
11408
- function getLicenseTermsId(_x30) {
12056
+ function getLicenseTermsId(_x31) {
11409
12057
  return _getLicenseTermsId.apply(this, arguments);
11410
12058
  }
11411
12059
  return getLicenseTermsId;
@@ -11413,13 +12061,13 @@ var IPAssetClient = /*#__PURE__*/function () {
11413
12061
  }, {
11414
12062
  key: "validateLicenseTokenIds",
11415
12063
  value: function () {
11416
- var _validateLicenseTokenIds = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33(licenseTokenIds) {
11417
- var newLicenseTokenIds, _iterator9, _step9, licenseTokenId, tokenOwnerAddress, _t35;
11418
- return _regenerator().w(function (_context33) {
11419
- while (1) switch (_context33.p = _context33.n) {
12064
+ var _validateLicenseTokenIds = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(licenseTokenIds) {
12065
+ var newLicenseTokenIds, _iterator9, _step9, licenseTokenId, tokenOwnerAddress, _t36;
12066
+ return _regenerator().w(function (_context35) {
12067
+ while (1) switch (_context35.p = _context35.n) {
11420
12068
  case 0:
11421
12069
  if (!(licenseTokenIds.length === 0)) {
11422
- _context33.n = 1;
12070
+ _context35.n = 1;
11423
12071
  break;
11424
12072
  }
11425
12073
  throw new Error("License token IDs must be provided.");
@@ -11428,45 +12076,45 @@ var IPAssetClient = /*#__PURE__*/function () {
11428
12076
  return BigInt(id);
11429
12077
  });
11430
12078
  _iterator9 = _createForOfIteratorHelper(newLicenseTokenIds);
11431
- _context33.p = 2;
12079
+ _context35.p = 2;
11432
12080
  _iterator9.s();
11433
12081
  case 3:
11434
12082
  if ((_step9 = _iterator9.n()).done) {
11435
- _context33.n = 6;
12083
+ _context35.n = 6;
11436
12084
  break;
11437
12085
  }
11438
12086
  licenseTokenId = _step9.value;
11439
- _context33.n = 4;
12087
+ _context35.n = 4;
11440
12088
  return this.licenseTokenReadOnlyClient.ownerOf({
11441
12089
  tokenId: licenseTokenId
11442
12090
  });
11443
12091
  case 4:
11444
- tokenOwnerAddress = _context33.v;
12092
+ tokenOwnerAddress = _context35.v;
11445
12093
  if (tokenOwnerAddress) {
11446
- _context33.n = 5;
12094
+ _context35.n = 5;
11447
12095
  break;
11448
12096
  }
11449
12097
  throw new Error("License token id ".concat(licenseTokenId, " must be owned by the caller."));
11450
12098
  case 5:
11451
- _context33.n = 3;
12099
+ _context35.n = 3;
11452
12100
  break;
11453
12101
  case 6:
11454
- _context33.n = 8;
12102
+ _context35.n = 8;
11455
12103
  break;
11456
12104
  case 7:
11457
- _context33.p = 7;
11458
- _t35 = _context33.v;
11459
- _iterator9.e(_t35);
12105
+ _context35.p = 7;
12106
+ _t36 = _context35.v;
12107
+ _iterator9.e(_t36);
11460
12108
  case 8:
11461
- _context33.p = 8;
12109
+ _context35.p = 8;
11462
12110
  _iterator9.f();
11463
- return _context33.f(8);
12111
+ return _context35.f(8);
11464
12112
  case 9:
11465
- return _context33.a(2, newLicenseTokenIds);
12113
+ return _context35.a(2, newLicenseTokenIds);
11466
12114
  }
11467
- }, _callee33, this, [[2, 7, 8, 9]]);
12115
+ }, _callee34, this, [[2, 7, 8, 9]]);
11468
12116
  }));
11469
- function validateLicenseTokenIds(_x31) {
12117
+ function validateLicenseTokenIds(_x32) {
11470
12118
  return _validateLicenseTokenIds.apply(this, arguments);
11471
12119
  }
11472
12120
  return validateLicenseTokenIds;
@@ -11489,28 +12137,28 @@ var IPAssetClient = /*#__PURE__*/function () {
11489
12137
  }, {
11490
12138
  key: "handleRegistrationWithFees",
11491
12139
  value: function () {
11492
- var _handleRegistrationWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(_ref5) {
12140
+ var _handleRegistrationWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35(_ref6) {
11493
12141
  var _wipOptions$useMultic, _this$getIpIdAndToken, _event$ipId, _event$tokenId;
11494
12142
  var sender, derivData, spgNftContract, spgSpenderAddress, txOptions, options, encodedTxs, contractCall, tokenSpenders, wipOptions, useMulticallWhenPossible, nftMintFee, publicMinting, mintFees, _iterator0, _step0, mintFee, _yield$contractCallWi, txHash, receipt, event;
11495
- return _regenerator().w(function (_context34) {
11496
- while (1) switch (_context34.n) {
12143
+ return _regenerator().w(function (_context36) {
12144
+ while (1) switch (_context36.n) {
11497
12145
  case 0:
11498
- sender = _ref5.sender, derivData = _ref5.derivData, spgNftContract = _ref5.spgNftContract, spgSpenderAddress = _ref5.spgSpenderAddress, txOptions = _ref5.txOptions, options = _ref5.options, encodedTxs = _ref5.encodedTxs, contractCall = _ref5.contractCall;
12146
+ sender = _ref6.sender, derivData = _ref6.derivData, spgNftContract = _ref6.spgNftContract, spgSpenderAddress = _ref6.spgSpenderAddress, txOptions = _ref6.txOptions, options = _ref6.options, encodedTxs = _ref6.encodedTxs, contractCall = _ref6.contractCall;
11499
12147
  tokenSpenders = [];
11500
12148
  wipOptions = options === null || options === void 0 ? void 0 : options.wipOptions;
11501
12149
  useMulticallWhenPossible = (_wipOptions$useMultic = wipOptions === null || wipOptions === void 0 ? void 0 : wipOptions.useMulticallWhenPossible) !== null && _wipOptions$useMultic !== void 0 ? _wipOptions$useMultic : true; // get spg minting fee
11502
12150
  if (!spgNftContract) {
11503
- _context34.n = 3;
12151
+ _context36.n = 3;
11504
12152
  break;
11505
12153
  }
11506
- _context34.n = 1;
12154
+ _context36.n = 1;
11507
12155
  return calculateSPGMintFee(new SpgnftImplReadOnlyClient(this.rpcClient, spgNftContract));
11508
12156
  case 1:
11509
- nftMintFee = _context34.v;
11510
- _context34.n = 2;
12157
+ nftMintFee = _context36.v;
12158
+ _context36.n = 2;
11511
12159
  return getPublicMinting(spgNftContract, this.rpcClient);
11512
12160
  case 2:
11513
- publicMinting = _context34.v;
12161
+ publicMinting = _context36.v;
11514
12162
  /**
11515
12163
  * If the SPG NFT contract's public minting is disabled, we need to check if the caller has the `minter role`.
11516
12164
  * When public minting is disabled, we can't use multicall because we need to perform additional role checks
@@ -11527,10 +12175,10 @@ var IPAssetClient = /*#__PURE__*/function () {
11527
12175
  }, nftMintFee)] : []));
11528
12176
  case 3:
11529
12177
  if (!derivData) {
11530
- _context34.n = 5;
12178
+ _context36.n = 5;
11531
12179
  break;
11532
12180
  }
11533
- _context34.n = 4;
12181
+ _context36.n = 4;
11534
12182
  return calculateDerivativeMintingFee({
11535
12183
  derivData: derivData,
11536
12184
  rpcClient: this.rpcClient,
@@ -11539,7 +12187,7 @@ var IPAssetClient = /*#__PURE__*/function () {
11539
12187
  sender: sender
11540
12188
  });
11541
12189
  case 4:
11542
- mintFees = _context34.v;
12190
+ mintFees = _context36.v;
11543
12191
  _iterator0 = _createForOfIteratorHelper(mintFees);
11544
12192
  try {
11545
12193
  for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
@@ -11554,7 +12202,7 @@ var IPAssetClient = /*#__PURE__*/function () {
11554
12202
  _iterator0.f();
11555
12203
  }
11556
12204
  case 5:
11557
- _context34.n = 6;
12205
+ _context36.n = 6;
11558
12206
  return contractCallWithFees({
11559
12207
  options: _objectSpread2(_objectSpread2({}, options), {}, {
11560
12208
  wipOptions: _objectSpread2(_objectSpread2({}, wipOptions), {}, {
@@ -11571,11 +12219,11 @@ var IPAssetClient = /*#__PURE__*/function () {
11571
12219
  encodedTxs: encodedTxs
11572
12220
  });
11573
12221
  case 6:
11574
- _yield$contractCallWi = _context34.v;
12222
+ _yield$contractCallWi = _context36.v;
11575
12223
  txHash = _yield$contractCallWi.txHash;
11576
12224
  receipt = _yield$contractCallWi.receipt;
11577
12225
  event = (_this$getIpIdAndToken = this.getIpIdAndTokenIdsFromEvent(receipt)) === null || _this$getIpIdAndToken === void 0 ? void 0 : _this$getIpIdAndToken[0];
11578
- return _context34.a(2, _objectSpread2({
12226
+ return _context36.a(2, _objectSpread2({
11579
12227
  txHash: txHash,
11580
12228
  receipt: receipt
11581
12229
  }, event && {
@@ -11583,9 +12231,9 @@ var IPAssetClient = /*#__PURE__*/function () {
11583
12231
  tokenId: (_event$tokenId = event.tokenId) !== null && _event$tokenId !== void 0 ? _event$tokenId : undefined
11584
12232
  }));
11585
12233
  }
11586
- }, _callee34, this);
12234
+ }, _callee35, this);
11587
12235
  }));
11588
- function handleRegistrationWithFees(_x32) {
12236
+ function handleRegistrationWithFees(_x33) {
11589
12237
  return _handleRegistrationWithFees.apply(this, arguments);
11590
12238
  }
11591
12239
  return handleRegistrationWithFees;
@@ -11596,66 +12244,66 @@ var IPAssetClient = /*#__PURE__*/function () {
11596
12244
  }, {
11597
12245
  key: "populateLicenseAndTokenIdsForRegistrationResults",
11598
12246
  value: (function () {
11599
- var _populateLicenseAndTokenIdsForRegistrationResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35(registrationResults, aggregateRegistrationRequest) {
11600
- var allExtraDataArrays, allExtraData, extraDataFlatIndex, _iterator1, _step1, registrationResult, i, ipAsset, _t36;
11601
- return _regenerator().w(function (_context35) {
11602
- while (1) switch (_context35.p = _context35.n) {
12247
+ var _populateLicenseAndTokenIdsForRegistrationResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36(registrationResults, aggregateRegistrationRequest) {
12248
+ var allExtraDataArrays, allExtraData, extraDataFlatIndex, _iterator1, _step1, registrationResult, i, ipAsset, _t37;
12249
+ return _regenerator().w(function (_context37) {
12250
+ while (1) switch (_context37.p = _context37.n) {
11603
12251
  case 0:
11604
- allExtraDataArrays = Object.values(aggregateRegistrationRequest).map(function (_ref6) {
11605
- var extraData = _ref6.extraData;
12252
+ allExtraDataArrays = Object.values(aggregateRegistrationRequest).map(function (_ref7) {
12253
+ var extraData = _ref7.extraData;
11606
12254
  return extraData;
11607
12255
  });
11608
12256
  allExtraData = allExtraDataArrays.flat();
11609
12257
  extraDataFlatIndex = -1;
11610
12258
  _iterator1 = _createForOfIteratorHelper(registrationResults);
11611
- _context35.p = 1;
12259
+ _context37.p = 1;
11612
12260
  _iterator1.s();
11613
12261
  case 2:
11614
12262
  if ((_step1 = _iterator1.n()).done) {
11615
- _context35.n = 7;
12263
+ _context37.n = 7;
11616
12264
  break;
11617
12265
  }
11618
12266
  registrationResult = _step1.value;
11619
12267
  i = 0;
11620
12268
  case 3:
11621
12269
  if (!(i < registrationResult.ipAssetsWithLicenseTerms.length)) {
11622
- _context35.n = 6;
12270
+ _context37.n = 6;
11623
12271
  break;
11624
12272
  }
11625
12273
  extraDataFlatIndex++;
11626
12274
  if (!(registrationResult.ipAssetsWithLicenseTerms[i] && allExtraData[extraDataFlatIndex])) {
11627
- _context35.n = 5;
12275
+ _context37.n = 5;
11628
12276
  break;
11629
12277
  }
11630
- _context35.n = 4;
12278
+ _context37.n = 4;
11631
12279
  return this.processIpAssetLicenseTerms(registrationResult.ipAssetsWithLicenseTerms[i], allExtraData[extraDataFlatIndex]);
11632
12280
  case 4:
11633
- ipAsset = _context35.v;
12281
+ ipAsset = _context37.v;
11634
12282
  registrationResult.ipAssetsWithLicenseTerms[i] = ipAsset;
11635
12283
  case 5:
11636
12284
  i++;
11637
- _context35.n = 3;
12285
+ _context37.n = 3;
11638
12286
  break;
11639
12287
  case 6:
11640
- _context35.n = 2;
12288
+ _context37.n = 2;
11641
12289
  break;
11642
12290
  case 7:
11643
- _context35.n = 9;
12291
+ _context37.n = 9;
11644
12292
  break;
11645
12293
  case 8:
11646
- _context35.p = 8;
11647
- _t36 = _context35.v;
11648
- _iterator1.e(_t36);
12294
+ _context37.p = 8;
12295
+ _t37 = _context37.v;
12296
+ _iterator1.e(_t37);
11649
12297
  case 9:
11650
- _context35.p = 9;
12298
+ _context37.p = 9;
11651
12299
  _iterator1.f();
11652
- return _context35.f(9);
12300
+ return _context37.f(9);
11653
12301
  case 10:
11654
- return _context35.a(2, registrationResults);
12302
+ return _context37.a(2, registrationResults);
11655
12303
  }
11656
- }, _callee35, this, [[1, 8, 9, 10]]);
12304
+ }, _callee36, this, [[1, 8, 9, 10]]);
11657
12305
  }));
11658
- function populateLicenseAndTokenIdsForRegistrationResults(_x33, _x34) {
12306
+ function populateLicenseAndTokenIdsForRegistrationResults(_x34, _x35) {
11659
12307
  return _populateLicenseAndTokenIdsForRegistrationResults.apply(this, arguments);
11660
12308
  }
11661
12309
  return populateLicenseAndTokenIdsForRegistrationResults;
@@ -11663,31 +12311,31 @@ var IPAssetClient = /*#__PURE__*/function () {
11663
12311
  }, {
11664
12312
  key: "processIpAssetLicenseTerms",
11665
12313
  value: function () {
11666
- var _processIpAssetLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36(ipAsset, extraData) {
12314
+ var _processIpAssetLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37(ipAsset, extraData) {
11667
12315
  var _extraData$licenseTer;
11668
12316
  var licenseTermsIds, maxLicenseTokens, maxLicenseTokensData, maxLicenseTokensTxHashes;
11669
- return _regenerator().w(function (_context36) {
11670
- while (1) switch (_context36.n) {
12317
+ return _regenerator().w(function (_context38) {
12318
+ while (1) switch (_context38.n) {
11671
12319
  case 0:
11672
12320
  if (extraData !== null && extraData !== void 0 && (_extraData$licenseTer = extraData.licenseTermsData) !== null && _extraData$licenseTer !== void 0 && _extraData$licenseTer.length) {
11673
- _context36.n = 1;
12321
+ _context38.n = 1;
11674
12322
  break;
11675
12323
  }
11676
- return _context36.a(2, ipAsset);
12324
+ return _context38.a(2, ipAsset);
11677
12325
  case 1:
11678
- _context36.n = 2;
12326
+ _context38.n = 2;
11679
12327
  return this.getLicenseTermsId(extraData.licenseTermsData.map(function (item) {
11680
12328
  return item.terms;
11681
12329
  }));
11682
12330
  case 2:
11683
- licenseTermsIds = _context36.v;
12331
+ licenseTermsIds = _context38.v;
11684
12332
  ipAsset.licenseTermsIds = licenseTermsIds;
11685
12333
  maxLicenseTokens = extraData.maxLicenseTokens;
11686
12334
  if (maxLicenseTokens !== null && maxLicenseTokens !== void 0 && maxLicenseTokens.length) {
11687
- _context36.n = 3;
12335
+ _context38.n = 3;
11688
12336
  break;
11689
12337
  }
11690
- return _context36.a(2, ipAsset);
12338
+ return _context38.a(2, ipAsset);
11691
12339
  case 3:
11692
12340
  maxLicenseTokensData = maxLicenseTokens.filter(function (maxLicenseToken) {
11693
12341
  return maxLicenseToken !== undefined;
@@ -11696,7 +12344,7 @@ var IPAssetClient = /*#__PURE__*/function () {
11696
12344
  maxLicenseTokens: maxLicenseToken
11697
12345
  };
11698
12346
  });
11699
- _context36.n = 4;
12347
+ _context38.n = 4;
11700
12348
  return setMaxLicenseTokens({
11701
12349
  maxLicenseTokensData: maxLicenseTokensData,
11702
12350
  licensorIpId: ipAsset.ipId,
@@ -11705,15 +12353,15 @@ var IPAssetClient = /*#__PURE__*/function () {
11705
12353
  templateAddress: this.licenseTemplateAddress
11706
12354
  });
11707
12355
  case 4:
11708
- maxLicenseTokensTxHashes = _context36.v;
12356
+ maxLicenseTokensTxHashes = _context38.v;
11709
12357
  if (maxLicenseTokensTxHashes !== null && maxLicenseTokensTxHashes !== void 0 && maxLicenseTokensTxHashes.length) {
11710
12358
  ipAsset.maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
11711
12359
  }
11712
- return _context36.a(2, ipAsset);
12360
+ return _context38.a(2, ipAsset);
11713
12361
  }
11714
- }, _callee36, this);
12362
+ }, _callee37, this);
11715
12363
  }));
11716
- function processIpAssetLicenseTerms(_x35, _x36) {
12364
+ function processIpAssetLicenseTerms(_x36, _x37) {
11717
12365
  return _processIpAssetLicenseTerms.apply(this, arguments);
11718
12366
  }
11719
12367
  return processIpAssetLicenseTerms;
@@ -11721,53 +12369,53 @@ var IPAssetClient = /*#__PURE__*/function () {
11721
12369
  }, {
11722
12370
  key: "approveLicenseTokensForDerivativeWorkflows",
11723
12371
  value: function () {
11724
- var _approveLicenseTokensForDerivativeWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37(licenseTokenIds, autoApproveLicenseTokens) {
11725
- var _iterator10, _step10, licenseTokenId, txHash, _t37;
11726
- return _regenerator().w(function (_context37) {
11727
- while (1) switch (_context37.p = _context37.n) {
12372
+ var _approveLicenseTokensForDerivativeWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38(licenseTokenIds, autoApproveLicenseTokens) {
12373
+ var _iterator10, _step10, licenseTokenId, txHash, _t38;
12374
+ return _regenerator().w(function (_context39) {
12375
+ while (1) switch (_context39.p = _context39.n) {
11728
12376
  case 0:
11729
12377
  if (!(autoApproveLicenseTokens !== false)) {
11730
- _context37.n = 8;
12378
+ _context39.n = 8;
11731
12379
  break;
11732
12380
  }
11733
12381
  _iterator10 = _createForOfIteratorHelper(licenseTokenIds);
11734
- _context37.p = 1;
12382
+ _context39.p = 1;
11735
12383
  _iterator10.s();
11736
12384
  case 2:
11737
12385
  if ((_step10 = _iterator10.n()).done) {
11738
- _context37.n = 5;
12386
+ _context39.n = 5;
11739
12387
  break;
11740
12388
  }
11741
12389
  licenseTokenId = _step10.value;
11742
- _context37.n = 3;
12390
+ _context39.n = 3;
11743
12391
  return this.licenseTokenClient.approve({
11744
12392
  to: this.derivativeWorkflowsClient.address,
11745
12393
  tokenId: BigInt(licenseTokenId)
11746
12394
  });
11747
12395
  case 3:
11748
- txHash = _context37.v;
11749
- _context37.n = 4;
12396
+ txHash = _context39.v;
12397
+ _context39.n = 4;
11750
12398
  return waitTx(this.rpcClient, txHash);
11751
12399
  case 4:
11752
- _context37.n = 2;
12400
+ _context39.n = 2;
11753
12401
  break;
11754
12402
  case 5:
11755
- _context37.n = 7;
12403
+ _context39.n = 7;
11756
12404
  break;
11757
12405
  case 6:
11758
- _context37.p = 6;
11759
- _t37 = _context37.v;
11760
- _iterator10.e(_t37);
12406
+ _context39.p = 6;
12407
+ _t38 = _context39.v;
12408
+ _iterator10.e(_t38);
11761
12409
  case 7:
11762
- _context37.p = 7;
12410
+ _context39.p = 7;
11763
12411
  _iterator10.f();
11764
- return _context37.f(7);
12412
+ return _context39.f(7);
11765
12413
  case 8:
11766
- return _context37.a(2);
12414
+ return _context39.a(2);
11767
12415
  }
11768
- }, _callee37, this, [[1, 6, 7, 8]]);
12416
+ }, _callee38, this, [[1, 6, 7, 8]]);
11769
12417
  }));
11770
- function approveLicenseTokensForDerivativeWorkflows(_x37, _x38) {
12418
+ function approveLicenseTokensForDerivativeWorkflows(_x38, _x39) {
11771
12419
  return _approveLicenseTokensForDerivativeWorkflows.apply(this, arguments);
11772
12420
  }
11773
12421
  return approveLicenseTokensForDerivativeWorkflows;
@@ -12331,7 +12979,8 @@ var LicenseClient = /*#__PURE__*/function () {
12331
12979
  licensingConfig: _objectSpread2(_objectSpread2({}, licensingConfig), {}, {
12332
12980
  licensingHook: this.totalLicenseTokenLimitHookClient.address,
12333
12981
  // use Math.trunc to avoid precision issues
12334
- expectMinimumGroupRewardShare: Math.trunc(licensingConfig.expectMinimumGroupRewardShare / 1000000)
12982
+ expectMinimumGroupRewardShare: Math.trunc(licensingConfig.expectMinimumGroupRewardShare / 1000000),
12983
+ commercialRevShare: Math.trunc(licensingConfig.commercialRevShare / 1000000)
12335
12984
  })
12336
12985
  });
12337
12986
  case 4:
@@ -12967,6 +13616,32 @@ var NftClient = /*#__PURE__*/function () {
12967
13616
  return _getTokenURI.apply(this, arguments);
12968
13617
  }
12969
13618
  return getTokenURI;
13619
+ }()
13620
+ /**
13621
+ * Returns the number of NFTs owned by an address in a specific SPG NFT collection.
13622
+ */
13623
+ )
13624
+ }, {
13625
+ key: "getNFTBalance",
13626
+ value: (function () {
13627
+ var _getNFTBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(_ref3) {
13628
+ var spgNftContract, owner, spgNftClient, ownerAddress;
13629
+ return _regenerator().w(function (_context6) {
13630
+ while (1) switch (_context6.n) {
13631
+ case 0:
13632
+ spgNftContract = _ref3.spgNftContract, owner = _ref3.owner;
13633
+ spgNftClient = new SpgnftImplReadOnlyClient(this.rpcClient, validateAddress(spgNftContract));
13634
+ ownerAddress = validateAddress(owner !== null && owner !== void 0 ? owner : this.wallet.account.address);
13635
+ return _context6.a(2, spgNftClient.balanceOf({
13636
+ owner: ownerAddress
13637
+ }));
13638
+ }
13639
+ }, _callee6, this);
13640
+ }));
13641
+ function getNFTBalance(_x6) {
13642
+ return _getNFTBalance.apply(this, arguments);
13643
+ }
13644
+ return getNFTBalance;
12970
13645
  }())
12971
13646
  }]);
12972
13647
  }();
@@ -14459,6 +15134,12 @@ var StoryClient = /*#__PURE__*/function () {
14459
15134
  transport: this.config.transport
14460
15135
  };
14461
15136
  this.rpcClient = createPublicClient(clientConfig);
15137
+
15138
+ // If a txHashResolver is provided (e.g. for AA wallets like ZeroDev/Dynamic),
15139
+ // patch waitForTransactionReceipt to resolve the hash first.
15140
+ if (config.txHashResolver) {
15141
+ this.applyTxHashResolver(config.txHashResolver);
15142
+ }
14462
15143
  if (this.config.wallet) {
14463
15144
  this.wallet = this.config.wallet;
14464
15145
  } else if (this.config.account) {
@@ -14470,7 +15151,38 @@ var StoryClient = /*#__PURE__*/function () {
14470
15151
  throw new Error("must specify a wallet or account");
14471
15152
  }
14472
15153
  }
15154
+
15155
+ /**
15156
+ * Patches rpcClient.waitForTransactionReceipt to first resolve the hash
15157
+ * through the provided resolver. This transparently supports AA wallets
15158
+ * where writeContract returns a UserOperation hash instead of a tx hash.
15159
+ */
14473
15160
  return _createClass(StoryClient, [{
15161
+ key: "applyTxHashResolver",
15162
+ value: function applyTxHashResolver(resolver) {
15163
+ var originalWaitForReceipt = this.rpcClient.waitForTransactionReceipt.bind(this.rpcClient);
15164
+ this.rpcClient.waitForTransactionReceipt = /*#__PURE__*/function () {
15165
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(args) {
15166
+ var resolvedHash;
15167
+ return _regenerator().w(function (_context) {
15168
+ while (1) switch (_context.n) {
15169
+ case 0:
15170
+ _context.n = 1;
15171
+ return resolver(args.hash);
15172
+ case 1:
15173
+ resolvedHash = _context.v;
15174
+ return _context.a(2, originalWaitForReceipt(_objectSpread2(_objectSpread2({}, args), {}, {
15175
+ hash: resolvedHash
15176
+ })));
15177
+ }
15178
+ }, _callee);
15179
+ }));
15180
+ return function (_x) {
15181
+ return _ref.apply(this, arguments);
15182
+ };
15183
+ }();
15184
+ }
15185
+ }, {
14474
15186
  key: "chainId",
14475
15187
  get: function get() {
14476
15188
  return this.config.chainId;
@@ -14595,22 +15307,22 @@ var StoryClient = /*#__PURE__*/function () {
14595
15307
  }, {
14596
15308
  key: "getWalletBalance",
14597
15309
  value: function () {
14598
- var _getWalletBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
14599
- return _regenerator().w(function (_context) {
14600
- while (1) switch (_context.n) {
15310
+ var _getWalletBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
15311
+ return _regenerator().w(function (_context2) {
15312
+ while (1) switch (_context2.n) {
14601
15313
  case 0:
14602
15314
  if (this.wallet.account) {
14603
- _context.n = 1;
15315
+ _context2.n = 1;
14604
15316
  break;
14605
15317
  }
14606
15318
  throw new Error("No account found in wallet");
14607
15319
  case 1:
14608
- _context.n = 2;
15320
+ _context2.n = 2;
14609
15321
  return this.getBalance(this.wallet.account.address);
14610
15322
  case 2:
14611
- return _context.a(2, _context.v);
15323
+ return _context2.a(2, _context2.v);
14612
15324
  }
14613
- }, _callee, this);
15325
+ }, _callee2, this);
14614
15326
  }));
14615
15327
  function getWalletBalance() {
14616
15328
  return _getWalletBalance.apply(this, arguments);
@@ -14620,22 +15332,22 @@ var StoryClient = /*#__PURE__*/function () {
14620
15332
  }, {
14621
15333
  key: "getBalance",
14622
15334
  value: function () {
14623
- var _getBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(address) {
15335
+ var _getBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(address) {
14624
15336
  var validAddress;
14625
- return _regenerator().w(function (_context2) {
14626
- while (1) switch (_context2.n) {
15337
+ return _regenerator().w(function (_context3) {
15338
+ while (1) switch (_context3.n) {
14627
15339
  case 0:
14628
15340
  validAddress = validateAddress(address);
14629
- _context2.n = 1;
15341
+ _context3.n = 1;
14630
15342
  return this.rpcClient.getBalance({
14631
15343
  address: validAddress
14632
15344
  });
14633
15345
  case 1:
14634
- return _context2.a(2, _context2.v);
15346
+ return _context3.a(2, _context3.v);
14635
15347
  }
14636
- }, _callee2, this);
15348
+ }, _callee3, this);
14637
15349
  }));
14638
- function getBalance(_x) {
15350
+ function getBalance(_x2) {
14639
15351
  return _getBalance.apply(this, arguments);
14640
15352
  }
14641
15353
  return getBalance;
@@ -14655,7 +15367,8 @@ var StoryClient = /*#__PURE__*/function () {
14655
15367
  return new StoryClient({
14656
15368
  chainId: config.chainId,
14657
15369
  transport: config.transport,
14658
- wallet: config.wallet
15370
+ wallet: config.wallet,
15371
+ txHashResolver: config.txHashResolver
14659
15372
  });
14660
15373
  }
14661
15374
 
@@ -14668,7 +15381,8 @@ var StoryClient = /*#__PURE__*/function () {
14668
15381
  return new StoryClient({
14669
15382
  account: config.account,
14670
15383
  chainId: config.chainId,
14671
- transport: config.transport
15384
+ transport: config.transport,
15385
+ txHashResolver: config.txHashResolver
14672
15386
  });
14673
15387
  }
14674
15388
  }]);
@@ -14791,6 +15505,16 @@ var AIRelationship = /*#__PURE__*/function (AIRelationship) {
14791
15505
  * For more information, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-terms | PIL}.
14792
15506
  **/
14793
15507
 
15508
+ /**
15509
+ * The data of the license and its configuration to be attached to the IP.
15510
+ *
15511
+ * You must provide either `licenseTermsId` or `terms`:
15512
+ * - `licenseTermsId`: Use an existing pre-registered license terms
15513
+ * - `terms`: Register new license terms and attach
15514
+ *
15515
+ * If both are provided, `terms` takes priority and new terms will be registered.
15516
+ */
15517
+
14794
15518
  /**
14795
15519
  * @deprecated Use `PILFlavor.nonCommercialSocialRemixing`, `PILFlavor.commercialUse`, `PILFlavor.commercialRemix`, or `PILFlavor.creativeCommonsAttribution` instead.
14796
15520
  *