@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.
- package/dist/declarations/src/abi/generated.d.ts +16 -0
- package/dist/declarations/src/abi/generated.d.ts.map +1 -1
- package/dist/declarations/src/client.d.ts +6 -0
- package/dist/declarations/src/client.d.ts.map +1 -1
- package/dist/declarations/src/resources/group.d.ts.map +1 -1
- package/dist/declarations/src/resources/ipAsset.d.ts +41 -3
- package/dist/declarations/src/resources/ipAsset.d.ts.map +1 -1
- package/dist/declarations/src/resources/license.d.ts.map +1 -1
- package/dist/declarations/src/resources/nftClient.d.ts +5 -1
- package/dist/declarations/src/resources/nftClient.d.ts.map +1 -1
- package/dist/declarations/src/types/config.d.ts +48 -1
- package/dist/declarations/src/types/config.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/ipAsset.d.ts +11 -1
- package/dist/declarations/src/types/resources/ipAsset.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/license.d.ts +47 -4
- package/dist/declarations/src/types/resources/license.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/nftClient.d.ts +6 -0
- package/dist/declarations/src/types/resources/nftClient.d.ts.map +1 -1
- package/dist/declarations/src/utils/chain.d.ts +18 -0
- package/dist/declarations/src/utils/chain.d.ts.map +1 -1
- package/dist/declarations/src/utils/oov3.d.ts +4 -0
- package/dist/declarations/src/utils/oov3.d.ts.map +1 -1
- package/dist/declarations/src/utils/pilFlavor.d.ts.map +1 -1
- package/dist/declarations/src/utils/token.d.ts +3 -0
- package/dist/declarations/src/utils/token.d.ts.map +1 -1
- package/dist/story-protocol-core-sdk.cjs.dev.js +1724 -1000
- package/dist/story-protocol-core-sdk.cjs.prod.js +1724 -1000
- package/dist/story-protocol-core-sdk.esm.js +1725 -1001
- package/package.json +3 -2
|
@@ -2665,6 +2665,10 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
|
|
|
2665
2665
|
* @param to address
|
|
2666
2666
|
* @param tokenId uint256
|
|
2667
2667
|
*//**
|
|
2668
|
+
* SpgnftImplBalanceOfRequest
|
|
2669
|
+
*
|
|
2670
|
+
* @param owner address
|
|
2671
|
+
*//**
|
|
2668
2672
|
* SpgnftImplHasRoleRequest
|
|
2669
2673
|
*
|
|
2670
2674
|
* @param role bytes32
|
|
@@ -2687,38 +2691,43 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
|
|
|
2687
2691
|
*/},{key:"parseTxTransferEvent",value:function parseTxTransferEvent(txReceipt){var targetLogs=[];var _iterator38=_createForOfIteratorHelper(txReceipt.logs),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var log=_step38.value;try{var event=viem.decodeEventLog({abi:spgnftImplAbi,eventName:"Transfer",data:log.data,topics:log.topics});if(event.eventName==="Transfer"){targetLogs.push(event.args);}}catch(e){/* empty */}}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}return targetLogs;}}]);}();/**
|
|
2688
2692
|
* contract SPGNFTImpl readonly method
|
|
2689
2693
|
*/var SpgnftImplReadOnlyClient=/*#__PURE__*/function(_SpgnftImplEventClien){function SpgnftImplReadOnlyClient(rpcClient,address){_classCallCheck(this,SpgnftImplReadOnlyClient);return _callSuper(this,SpgnftImplReadOnlyClient,[rpcClient,address]);}/**
|
|
2694
|
+
* method balanceOf for contract SPGNFTImpl
|
|
2695
|
+
*
|
|
2696
|
+
* @param request SpgnftImplBalanceOfRequest
|
|
2697
|
+
* @return Promise<SpgnftImplBalanceOfResponse>
|
|
2698
|
+
*/_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;}()/**
|
|
2690
2699
|
* method hasRole for contract SPGNFTImpl
|
|
2691
2700
|
*
|
|
2692
2701
|
* @param request SpgnftImplHasRoleRequest
|
|
2693
2702
|
* @return Promise<SpgnftImplHasRoleResponse>
|
|
2694
|
-
*/
|
|
2703
|
+
*/)},{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;}()/**
|
|
2695
2704
|
* method mintFee for contract SPGNFTImpl
|
|
2696
2705
|
*
|
|
2697
2706
|
* @param request SpgnftImplMintFeeRequest
|
|
2698
2707
|
* @return Promise<SpgnftImplMintFeeResponse>
|
|
2699
|
-
*/)},{key:"mintFee",value:(function(){var _mintFee=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2708
|
+
*/)},{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;}()/**
|
|
2700
2709
|
* method mintFeeToken for contract SPGNFTImpl
|
|
2701
2710
|
*
|
|
2702
2711
|
* @param request SpgnftImplMintFeeTokenRequest
|
|
2703
2712
|
* @return Promise<SpgnftImplMintFeeTokenResponse>
|
|
2704
|
-
*/)},{key:"mintFeeToken",value:(function(){var _mintFeeToken=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2713
|
+
*/)},{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;}()/**
|
|
2705
2714
|
* method publicMinting for contract SPGNFTImpl
|
|
2706
2715
|
*
|
|
2707
2716
|
* @param request SpgnftImplPublicMintingRequest
|
|
2708
2717
|
* @return Promise<SpgnftImplPublicMintingResponse>
|
|
2709
|
-
*/)},{key:"publicMinting",value:(function(){var _publicMinting=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2718
|
+
*/)},{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;}()/**
|
|
2710
2719
|
* method tokenURI for contract SPGNFTImpl
|
|
2711
2720
|
*
|
|
2712
2721
|
* @param request SpgnftImplTokenUriRequest
|
|
2713
2722
|
* @return Promise<SpgnftImplTokenUriResponse>
|
|
2714
|
-
*/)},{key:"tokenUri",value:(function(){var _tokenUri=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2723
|
+
*/)},{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);/**
|
|
2715
2724
|
* contract SPGNFTImpl write method
|
|
2716
2725
|
*/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;}/**
|
|
2717
2726
|
* method setTokenURI for contract SPGNFTImpl
|
|
2718
2727
|
*
|
|
2719
2728
|
* @param request SpgnftImplSetTokenUriRequest
|
|
2720
2729
|
* @return Promise<WriteContractReturnType>
|
|
2721
|
-
*/_inherits(SpgnftImplClient,_SpgnftImplReadOnlyCl);return _createClass(SpgnftImplClient,[{key:"setTokenUri",value:(function(){var _setTokenUri=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2730
|
+
*/_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;}()/**
|
|
2722
2731
|
* method setTokenURI for contract SPGNFTImpl with only encode
|
|
2723
2732
|
*
|
|
2724
2733
|
* @param request SpgnftImplSetTokenUriRequest
|
|
@@ -2738,7 +2747,7 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
|
|
|
2738
2747
|
*
|
|
2739
2748
|
* @param request TotalLicenseTokenLimitHookSetTotalLicenseTokenLimitRequest
|
|
2740
2749
|
* @return Promise<WriteContractReturnType>
|
|
2741
|
-
*/return _createClass(TotalLicenseTokenLimitHookClient,[{key:"setTotalLicenseTokenLimit",value:(function(){var _setTotalLicenseTokenLimit=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2750
|
+
*/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;}()/**
|
|
2742
2751
|
* method setTotalLicenseTokenLimit for contract TotalLicenseTokenLimitHook with only encode
|
|
2743
2752
|
*
|
|
2744
2753
|
* @param request TotalLicenseTokenLimitHookSetTotalLicenseTokenLimitRequest
|
|
@@ -2788,19 +2797,19 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
|
|
|
2788
2797
|
*
|
|
2789
2798
|
* @param request WrappedIpAllowanceRequest
|
|
2790
2799
|
* @return Promise<WrappedIpAllowanceResponse>
|
|
2791
|
-
*/return _createClass(WrappedIpReadOnlyClient,[{key:"allowance",value:(function(){var _allowance2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2800
|
+
*/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;}()/**
|
|
2792
2801
|
* method balanceOf for contract WrappedIP
|
|
2793
2802
|
*
|
|
2794
2803
|
* @param request WrappedIpBalanceOfRequest
|
|
2795
2804
|
* @return Promise<WrappedIpBalanceOfResponse>
|
|
2796
|
-
*/)},{key:"balanceOf",value:(function(){var
|
|
2805
|
+
*/)},{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;}())}]);}();/**
|
|
2797
2806
|
* contract WrappedIP write method
|
|
2798
2807
|
*/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;}/**
|
|
2799
2808
|
* method approve for contract WrappedIP
|
|
2800
2809
|
*
|
|
2801
2810
|
* @param request WrappedIpApproveRequest
|
|
2802
2811
|
* @return Promise<WriteContractReturnType>
|
|
2803
|
-
*/_inherits(WrappedIpClient,_WrappedIpReadOnlyCli);return _createClass(WrappedIpClient,[{key:"approve",value:(function(){var _approve3=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2812
|
+
*/_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;}()/**
|
|
2804
2813
|
* method approve for contract WrappedIP with only encode
|
|
2805
2814
|
*
|
|
2806
2815
|
* @param request WrappedIpApproveRequest
|
|
@@ -2810,7 +2819,7 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
|
|
|
2810
2819
|
*
|
|
2811
2820
|
* @param request WrappedIpDepositRequest
|
|
2812
2821
|
* @return Promise<WriteContractReturnType>
|
|
2813
|
-
*/},{key:"deposit",value:(function(){var _deposit=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2822
|
+
*/},{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;}()/**
|
|
2814
2823
|
* method deposit for contract WrappedIP with only encode
|
|
2815
2824
|
*
|
|
2816
2825
|
* @param request WrappedIpDepositRequest
|
|
@@ -2820,7 +2829,7 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
|
|
|
2820
2829
|
*
|
|
2821
2830
|
* @param request WrappedIpTransferRequest
|
|
2822
2831
|
* @return Promise<WriteContractReturnType>
|
|
2823
|
-
*/},{key:"transfer",value:(function(){var _transfer2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2832
|
+
*/},{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;}()/**
|
|
2824
2833
|
* method transfer for contract WrappedIP with only encode
|
|
2825
2834
|
*
|
|
2826
2835
|
* @param request WrappedIpTransferRequest
|
|
@@ -2830,7 +2839,7 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
|
|
|
2830
2839
|
*
|
|
2831
2840
|
* @param request WrappedIpTransferFromRequest
|
|
2832
2841
|
* @return Promise<WriteContractReturnType>
|
|
2833
|
-
*/},{key:"transferFrom",value:(function(){var _transferFrom2=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2842
|
+
*/},{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;}()/**
|
|
2834
2843
|
* method transferFrom for contract WrappedIP with only encode
|
|
2835
2844
|
*
|
|
2836
2845
|
* @param request WrappedIpTransferFromRequest
|
|
@@ -2840,7 +2849,7 @@ function getAddress(address,chainId){return address[chainId||0]||"0x";}// Contra
|
|
|
2840
2849
|
*
|
|
2841
2850
|
* @param request WrappedIpWithdrawRequest
|
|
2842
2851
|
* @return Promise<WriteContractReturnType>
|
|
2843
|
-
*/},{key:"withdraw",value:(function(){var _withdraw=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2852
|
+
*/},{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;}()/**
|
|
2844
2853
|
* method withdraw for contract WrappedIP with only encode
|
|
2845
2854
|
*
|
|
2846
2855
|
* @param request WrappedIpWithdrawRequest
|
|
@@ -3095,6 +3104,15 @@ var ERC20Client = /*#__PURE__*/function () {
|
|
|
3095
3104
|
value: value
|
|
3096
3105
|
});
|
|
3097
3106
|
}
|
|
3107
|
+
}, {
|
|
3108
|
+
key: "transferFromEncode",
|
|
3109
|
+
value: function transferFromEncode(from, to, value) {
|
|
3110
|
+
return this.ercClient.transferFromEncode({
|
|
3111
|
+
from: from,
|
|
3112
|
+
to: to,
|
|
3113
|
+
value: value
|
|
3114
|
+
});
|
|
3115
|
+
}
|
|
3098
3116
|
|
|
3099
3117
|
// The method only will work in test environment
|
|
3100
3118
|
}, {
|
|
@@ -3210,6 +3228,15 @@ var WipTokenClient = /*#__PURE__*/function () {
|
|
|
3210
3228
|
value: function depositEncode() {
|
|
3211
3229
|
return this.wipClient.depositEncode();
|
|
3212
3230
|
}
|
|
3231
|
+
}, {
|
|
3232
|
+
key: "transferFromEncode",
|
|
3233
|
+
value: function transferFromEncode(from, to, value) {
|
|
3234
|
+
return this.wipClient.transferFromEncode({
|
|
3235
|
+
from: from,
|
|
3236
|
+
to: to,
|
|
3237
|
+
amount: value
|
|
3238
|
+
});
|
|
3239
|
+
}
|
|
3213
3240
|
}, {
|
|
3214
3241
|
key: "address",
|
|
3215
3242
|
get: function get() {
|
|
@@ -4136,6 +4163,10 @@ var getMinimumBond = /*#__PURE__*/function () {
|
|
|
4136
4163
|
* - Executing the settlement transaction
|
|
4137
4164
|
* - Waiting for transaction confirmation
|
|
4138
4165
|
*
|
|
4166
|
+
* Retry behavior: If the OOV3 contract reverts with "Assertion not expired" (because
|
|
4167
|
+
* the assertion liveness period has not yet elapsed), the function retries up to 5 times
|
|
4168
|
+
* with a 3-second delay between attempts. Other errors are not retried.
|
|
4169
|
+
*
|
|
4139
4170
|
* @see https://docs.story.foundation/docs/uma-arbitration-policy#/
|
|
4140
4171
|
* @see https://docs.uma.xyz/developers/optimistic-oracle-v3
|
|
4141
4172
|
*
|
|
@@ -4146,11 +4177,19 @@ var getMinimumBond = /*#__PURE__*/function () {
|
|
|
4146
4177
|
*/
|
|
4147
4178
|
var settleAssertion = /*#__PURE__*/function () {
|
|
4148
4179
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(privateKey, disputeId, transport) {
|
|
4149
|
-
var baseConfig, rpcClient, walletClient, arbitrationPolicyUmaClient, oov3Contract, assertionId, txHash, _t;
|
|
4180
|
+
var maxAttempts, retryDelayMs, attempt, baseConfig, rpcClient, walletClient, arbitrationPolicyUmaClient, oov3Contract, assertionId, txHash, msg, _t;
|
|
4150
4181
|
return _regenerator().w(function (_context4) {
|
|
4151
4182
|
while (1) switch (_context4.p = _context4.n) {
|
|
4152
4183
|
case 0:
|
|
4153
|
-
|
|
4184
|
+
maxAttempts = 5;
|
|
4185
|
+
retryDelayMs = 3000;
|
|
4186
|
+
attempt = 1;
|
|
4187
|
+
case 1:
|
|
4188
|
+
if (!(attempt <= maxAttempts)) {
|
|
4189
|
+
_context4.n = 11;
|
|
4190
|
+
break;
|
|
4191
|
+
}
|
|
4192
|
+
_context4.p = 2;
|
|
4154
4193
|
baseConfig = {
|
|
4155
4194
|
chain: chainStringToViemChain("aeneid"),
|
|
4156
4195
|
transport: viem.http(transport !== null && transport !== void 0 ? transport : aeneid.rpcUrls["default"].http[0])
|
|
@@ -4160,37 +4199,57 @@ var settleAssertion = /*#__PURE__*/function () {
|
|
|
4160
4199
|
account: accounts.privateKeyToAccount(privateKey)
|
|
4161
4200
|
}));
|
|
4162
4201
|
arbitrationPolicyUmaClient = new ArbitrationPolicyUmaClient(rpcClient, walletClient);
|
|
4163
|
-
_context4.n =
|
|
4202
|
+
_context4.n = 3;
|
|
4164
4203
|
return getOov3Contract(arbitrationPolicyUmaClient);
|
|
4165
|
-
case
|
|
4204
|
+
case 3:
|
|
4166
4205
|
oov3Contract = _context4.v;
|
|
4167
|
-
_context4.n =
|
|
4206
|
+
_context4.n = 4;
|
|
4168
4207
|
return arbitrationPolicyUmaClient.disputeIdToAssertionId({
|
|
4169
4208
|
disputeId: BigInt(disputeId)
|
|
4170
4209
|
});
|
|
4171
|
-
case
|
|
4210
|
+
case 4:
|
|
4172
4211
|
assertionId = _context4.v;
|
|
4173
|
-
_context4.n =
|
|
4212
|
+
_context4.n = 5;
|
|
4174
4213
|
return walletClient.writeContract({
|
|
4175
4214
|
address: oov3Contract,
|
|
4176
4215
|
abi: ASSERTION_ABI,
|
|
4177
4216
|
functionName: "settleAssertion",
|
|
4178
4217
|
args: [assertionId]
|
|
4179
4218
|
});
|
|
4180
|
-
case
|
|
4219
|
+
case 5:
|
|
4181
4220
|
txHash = _context4.v;
|
|
4182
|
-
_context4.n =
|
|
4221
|
+
_context4.n = 6;
|
|
4183
4222
|
return rpcClient.waitForTransactionReceipt({
|
|
4184
4223
|
hash: txHash
|
|
4185
4224
|
});
|
|
4186
|
-
case
|
|
4225
|
+
case 6:
|
|
4187
4226
|
return _context4.a(2, txHash);
|
|
4188
|
-
case
|
|
4189
|
-
_context4.p =
|
|
4227
|
+
case 7:
|
|
4228
|
+
_context4.p = 7;
|
|
4190
4229
|
_t = _context4.v;
|
|
4230
|
+
msg = _t instanceof Error ? _t.message : String(_t);
|
|
4231
|
+
if (!(attempt < maxAttempts && msg.includes("Assertion not expired"))) {
|
|
4232
|
+
_context4.n = 9;
|
|
4233
|
+
break;
|
|
4234
|
+
}
|
|
4235
|
+
_context4.n = 8;
|
|
4236
|
+
return new Promise(function (resolve) {
|
|
4237
|
+
return setTimeout(resolve, retryDelayMs);
|
|
4238
|
+
});
|
|
4239
|
+
case 8:
|
|
4240
|
+
return _context4.a(3, 10);
|
|
4241
|
+
case 9:
|
|
4191
4242
|
return _context4.a(2, handleError(_t, "Failed to settle assertion"));
|
|
4243
|
+
case 10:
|
|
4244
|
+
attempt++;
|
|
4245
|
+
_context4.n = 1;
|
|
4246
|
+
break;
|
|
4247
|
+
case 11:
|
|
4248
|
+
throw new Error("Failed to settle assertion: max retries exceeded");
|
|
4249
|
+
case 12:
|
|
4250
|
+
return _context4.a(2);
|
|
4192
4251
|
}
|
|
4193
|
-
}, _callee4, null, [[
|
|
4252
|
+
}, _callee4, null, [[2, 7]]);
|
|
4194
4253
|
}));
|
|
4195
4254
|
return function settleAssertion(_x8, _x9, _x0) {
|
|
4196
4255
|
return _ref4.apply(this, arguments);
|
|
@@ -4784,6 +4843,48 @@ var AccessPermission = /*#__PURE__*/function (AccessPermission) {
|
|
|
4784
4843
|
return AccessPermission;
|
|
4785
4844
|
}({});
|
|
4786
4845
|
|
|
4846
|
+
var MAINNET_CHAIN_ID = 1514;
|
|
4847
|
+
var AENEID_CHAIN_ID = 1315;
|
|
4848
|
+
|
|
4849
|
+
/** Per-chain whitelist: chainId -> set of allowed currency token addresses (checksummed). */
|
|
4850
|
+
var CURRENCY_TOKEN_WHITELIST = _defineProperty(_defineProperty({}, MAINNET_CHAIN_ID, new Set([viem.getAddress(wrappedIpAddress[MAINNET_CHAIN_ID])])), AENEID_CHAIN_ID, new Set([viem.getAddress(wrappedIpAddress[AENEID_CHAIN_ID]), viem.getAddress(erc20Address[AENEID_CHAIN_ID])]));
|
|
4851
|
+
|
|
4852
|
+
/** Human-readable description and error hint per chain. */
|
|
4853
|
+
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.");
|
|
4854
|
+
var toChainId = function toChainId(chainId) {
|
|
4855
|
+
if (chainId === "mainnet" || chainId === 1514) {
|
|
4856
|
+
return 1514;
|
|
4857
|
+
}
|
|
4858
|
+
if (chainId === "aeneid" || chainId === 1315) {
|
|
4859
|
+
return 1315;
|
|
4860
|
+
}
|
|
4861
|
+
return chainId;
|
|
4862
|
+
};
|
|
4863
|
+
|
|
4864
|
+
/**
|
|
4865
|
+
* Validates that the currency token is allowed for the given chain.
|
|
4866
|
+
* - Aeneid Testnet (1315): allows WIP or MERC20
|
|
4867
|
+
* - Mainnet (1514): allows WIP only
|
|
4868
|
+
*
|
|
4869
|
+
* @param token - The currency token address to validate
|
|
4870
|
+
* @param chainId - The chain ID (1315 or "aeneid" for Aeneid, 1514 or "mainnet" for Mainnet)
|
|
4871
|
+
* @throws Error if token is zero address or not allowed for the chain
|
|
4872
|
+
*/
|
|
4873
|
+
var validateCurrencyToken = function validateCurrencyToken(token, chainId) {
|
|
4874
|
+
if (token === null || token === undefined || token === viem.zeroAddress) {
|
|
4875
|
+
throw new Error("Currency token cannot be zero address.");
|
|
4876
|
+
}
|
|
4877
|
+
var resolvedChainId = toChainId(chainId);
|
|
4878
|
+
var allowedTokens = CURRENCY_TOKEN_WHITELIST[resolvedChainId];
|
|
4879
|
+
if (allowedTokens === null || allowedTokens === undefined) {
|
|
4880
|
+
throw new Error("Unsupported chain ID: ".concat(chainId, "."));
|
|
4881
|
+
}
|
|
4882
|
+
var normalizedToken = viem.getAddress(token);
|
|
4883
|
+
if (!allowedTokens.has(normalizedToken)) {
|
|
4884
|
+
throw new Error("".concat(CHAIN_CURRENCY_HINT[resolvedChainId], " The provided token is not allowed."));
|
|
4885
|
+
}
|
|
4886
|
+
};
|
|
4887
|
+
|
|
4787
4888
|
/**
|
|
4788
4889
|
* Gets the function signature from an ABI for a given method name
|
|
4789
4890
|
* @param abi - The contract ABI
|
|
@@ -5558,6 +5659,9 @@ var GroupClient = /*#__PURE__*/function () {
|
|
|
5558
5659
|
}
|
|
5559
5660
|
throw new Error("Currency token cannot be the zero address.");
|
|
5560
5661
|
case 4:
|
|
5662
|
+
currencyTokens.forEach(function (token) {
|
|
5663
|
+
return validateCurrencyToken(validateAddress(token), _this.chainId);
|
|
5664
|
+
});
|
|
5561
5665
|
collectAndClaimParams = {
|
|
5562
5666
|
groupIpId: validateAddress(groupIpId),
|
|
5563
5667
|
currencyTokens: validateAddresses(currencyTokens),
|
|
@@ -5721,6 +5825,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
|
5721
5825
|
case 0:
|
|
5722
5826
|
groupIpId = _ref6.groupIpId, currencyToken = _ref6.currencyToken, memberIpIds = _ref6.memberIpIds;
|
|
5723
5827
|
_context9.p = 1;
|
|
5828
|
+
validateCurrencyToken(validateAddress(currencyToken), this.chainId);
|
|
5724
5829
|
_context9.n = 2;
|
|
5725
5830
|
return this.groupingModuleClient.getClaimableReward({
|
|
5726
5831
|
groupId: validateAddress(groupIpId),
|
|
@@ -5801,6 +5906,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
|
5801
5906
|
case 0:
|
|
5802
5907
|
groupIpId = _ref8.groupIpId, currencyToken = _ref8.currencyToken, memberIpIds = _ref8.memberIpIds, txOptions = _ref8.txOptions;
|
|
5803
5908
|
_context1.p = 1;
|
|
5909
|
+
validateCurrencyToken(validateAddress(currencyToken), this.chainId);
|
|
5804
5910
|
claimRewardParam = {
|
|
5805
5911
|
groupId: validateAddress(groupIpId),
|
|
5806
5912
|
ipIds: validateAddresses(memberIpIds),
|
|
@@ -5860,6 +5966,7 @@ var GroupClient = /*#__PURE__*/function () {
|
|
|
5860
5966
|
case 0:
|
|
5861
5967
|
groupIpId = _ref9.groupIpId, currencyToken = _ref9.currencyToken, txOptions = _ref9.txOptions;
|
|
5862
5968
|
_context10.p = 1;
|
|
5969
|
+
validateCurrencyToken(validateAddress(currencyToken), this.chainId);
|
|
5863
5970
|
collectRoyaltiesParam = {
|
|
5864
5971
|
groupId: validateAddress(groupIpId),
|
|
5865
5972
|
token: validateAddress(currencyToken)
|
|
@@ -6231,6 +6338,24 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
|
6231
6338
|
}]);
|
|
6232
6339
|
}();
|
|
6233
6340
|
|
|
6341
|
+
function _regeneratorValues(e) {
|
|
6342
|
+
if (null != e) {
|
|
6343
|
+
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
6344
|
+
r = 0;
|
|
6345
|
+
if (t) return t.call(e);
|
|
6346
|
+
if ("function" == typeof e.next) return e;
|
|
6347
|
+
if (!isNaN(e.length)) return {
|
|
6348
|
+
next: function () {
|
|
6349
|
+
return e && r >= e.length && (e = void 0), {
|
|
6350
|
+
value: e && e[r++],
|
|
6351
|
+
done: !e
|
|
6352
|
+
};
|
|
6353
|
+
}
|
|
6354
|
+
};
|
|
6355
|
+
}
|
|
6356
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
6357
|
+
}
|
|
6358
|
+
|
|
6234
6359
|
var SignatureMethodType = /*#__PURE__*/function (SignatureMethodType) {
|
|
6235
6360
|
SignatureMethodType["REGISTER_IP_AND_MAKE_DERIVATIVE_AND_DEPLOY_ROYALTY_VAULT"] = "registerIpAndMakeDerivativeAndDeployRoyaltyVault";
|
|
6236
6361
|
SignatureMethodType["DISTRIBUTE_ROYALTY_TOKENS"] = "distributeRoyaltyTokens";
|
|
@@ -6573,181 +6698,572 @@ var generateOperationSignature = /*#__PURE__*/function () {
|
|
|
6573
6698
|
};
|
|
6574
6699
|
}();
|
|
6575
6700
|
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
};
|
|
6583
|
-
var COMMON_DEFAULTS = {
|
|
6584
|
-
transferable: true,
|
|
6585
|
-
royaltyPolicy: viem.zeroAddress,
|
|
6586
|
-
defaultMintingFee: 0n,
|
|
6587
|
-
expiration: 0n,
|
|
6588
|
-
commercializerChecker: viem.zeroAddress,
|
|
6589
|
-
commercializerCheckerData: viem.zeroAddress,
|
|
6590
|
-
commercialRevShare: 0,
|
|
6591
|
-
commercialRevCeiling: 0n,
|
|
6592
|
-
derivativeRevCeiling: 0n,
|
|
6593
|
-
currency: viem.zeroAddress
|
|
6594
|
-
};
|
|
6595
|
-
|
|
6596
|
-
/**
|
|
6597
|
-
* Pre-configured Programmable IP License (PIL) flavors for ease of use.
|
|
6598
|
-
*
|
|
6599
|
-
* The PIL is highly configurable, but these pre-configured license terms (flavors)
|
|
6600
|
-
* are the most popular options that cover common use cases.
|
|
6601
|
-
*
|
|
6602
|
-
* @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors | PIL Flavors Documentation}
|
|
6603
|
-
*
|
|
6604
|
-
* @example
|
|
6605
|
-
* ```typescript
|
|
6606
|
-
* // Create a commercial use license
|
|
6607
|
-
* const commercialLicense = PILFlavor.commercialUse({
|
|
6608
|
-
* defaultMintingFee: 1000000000000000000n, // 1 IP minting fee
|
|
6609
|
-
* currencyToken: "0x1234...", // currency token
|
|
6610
|
-
* royaltyPolicy: "LAP" // royalty policy
|
|
6611
|
-
* });
|
|
6612
|
-
*
|
|
6613
|
-
* // Create a non-commercial social remixing license
|
|
6614
|
-
* const remixLicense = PILFlavor.nonCommercialSocialRemixing();
|
|
6615
|
-
* ```
|
|
6616
|
-
*/
|
|
6617
|
-
var PILFlavor = /*#__PURE__*/_createClass(function PILFlavor() {
|
|
6618
|
-
_classCallCheck(this, PILFlavor);
|
|
6619
|
-
});
|
|
6620
|
-
_PILFlavor = PILFlavor;
|
|
6621
|
-
_defineProperty(PILFlavor, "_nonComSocialRemixingPIL", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
|
|
6622
|
-
commercialUse: false,
|
|
6623
|
-
commercialAttribution: false,
|
|
6624
|
-
derivativesAllowed: true,
|
|
6625
|
-
derivativesAttribution: true,
|
|
6626
|
-
derivativesApproval: false,
|
|
6627
|
-
derivativesReciprocal: true,
|
|
6628
|
-
uri: PIL_URIS.NCSR
|
|
6629
|
-
}));
|
|
6630
|
-
_defineProperty(PILFlavor, "_commercialUse", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
|
|
6631
|
-
commercialUse: true,
|
|
6632
|
-
commercialAttribution: true,
|
|
6633
|
-
derivativesAllowed: false,
|
|
6634
|
-
derivativesAttribution: false,
|
|
6635
|
-
derivativesApproval: false,
|
|
6636
|
-
derivativesReciprocal: false,
|
|
6637
|
-
uri: PIL_URIS.COMMERCIAL_USE
|
|
6638
|
-
}));
|
|
6639
|
-
_defineProperty(PILFlavor, "_commercialRemix", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
|
|
6640
|
-
commercialUse: true,
|
|
6641
|
-
commercialAttribution: true,
|
|
6642
|
-
derivativesAllowed: true,
|
|
6643
|
-
derivativesAttribution: true,
|
|
6644
|
-
derivativesApproval: false,
|
|
6645
|
-
derivativesReciprocal: true,
|
|
6646
|
-
uri: PIL_URIS.COMMERCIAL_REMIX
|
|
6647
|
-
}));
|
|
6648
|
-
_defineProperty(PILFlavor, "_creativeCommonsAttribution", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
|
|
6649
|
-
commercialUse: true,
|
|
6650
|
-
commercialAttribution: true,
|
|
6651
|
-
derivativesAllowed: true,
|
|
6652
|
-
derivativesAttribution: true,
|
|
6653
|
-
derivativesApproval: false,
|
|
6654
|
-
derivativesReciprocal: true,
|
|
6655
|
-
uri: PIL_URIS.CC_BY
|
|
6656
|
-
}));
|
|
6657
|
-
/**
|
|
6658
|
-
* Gets the values to create a Non-Commercial Social Remixing license terms flavor.
|
|
6659
|
-
* @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#non-commercial-social-remixing | Non Commercial Social Remixing}
|
|
6660
|
-
*/
|
|
6661
|
-
_defineProperty(PILFlavor, "nonCommercialSocialRemixing", function (request) {
|
|
6662
|
-
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);
|
|
6663
|
-
});
|
|
6664
|
-
/**
|
|
6665
|
-
* Gets the values to create a Commercial Use license terms flavor.
|
|
6666
|
-
* @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#commercial-use | Commercial Use}
|
|
6667
|
-
*/
|
|
6668
|
-
_defineProperty(PILFlavor, "commercialUse", function (_ref) {
|
|
6669
|
-
var defaultMintingFee = _ref.defaultMintingFee,
|
|
6670
|
-
currency = _ref.currency,
|
|
6671
|
-
royaltyPolicy = _ref.royaltyPolicy,
|
|
6672
|
-
chainId = _ref.chainId,
|
|
6673
|
-
override = _ref.override;
|
|
6674
|
-
return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._commercialUse), {}, {
|
|
6675
|
-
defaultMintingFee: defaultMintingFee,
|
|
6676
|
-
currency: currency,
|
|
6677
|
-
royaltyPolicy: royaltyPolicy
|
|
6678
|
-
}, override), chainId);
|
|
6679
|
-
});
|
|
6680
|
-
/**
|
|
6681
|
-
* Gets the values to create a Commercial Remixing license terms flavor.
|
|
6682
|
-
* @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#commercial-remix | Commercial Remix}
|
|
6683
|
-
*/
|
|
6684
|
-
_defineProperty(PILFlavor, "commercialRemix", function (_ref2) {
|
|
6685
|
-
var defaultMintingFee = _ref2.defaultMintingFee,
|
|
6686
|
-
royaltyPolicy = _ref2.royaltyPolicy,
|
|
6687
|
-
currency = _ref2.currency,
|
|
6688
|
-
commercialRevShare = _ref2.commercialRevShare,
|
|
6689
|
-
chainId = _ref2.chainId,
|
|
6690
|
-
override = _ref2.override;
|
|
6691
|
-
return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._commercialRemix), {}, {
|
|
6692
|
-
commercialRevShare: commercialRevShare,
|
|
6693
|
-
defaultMintingFee: defaultMintingFee,
|
|
6694
|
-
currency: currency,
|
|
6695
|
-
royaltyPolicy: royaltyPolicy
|
|
6696
|
-
}, override), chainId);
|
|
6697
|
-
});
|
|
6698
|
-
/**
|
|
6699
|
-
* Gets the values to create a Creative Commons Attribution (CC-BY) license terms flavor.
|
|
6700
|
-
* @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#creative-commons-attribution | Creative Commons Attribution}
|
|
6701
|
-
*/
|
|
6702
|
-
_defineProperty(PILFlavor, "creativeCommonsAttribution", function (_ref3) {
|
|
6703
|
-
var royaltyPolicy = _ref3.royaltyPolicy,
|
|
6704
|
-
currency = _ref3.currency,
|
|
6705
|
-
chainId = _ref3.chainId,
|
|
6706
|
-
override = _ref3.override;
|
|
6707
|
-
return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._creativeCommonsAttribution), {}, {
|
|
6708
|
-
currency: currency,
|
|
6709
|
-
royaltyPolicy: royaltyPolicy
|
|
6710
|
-
}, override), chainId);
|
|
6711
|
-
});
|
|
6712
|
-
_defineProperty(PILFlavor, "validateLicenseTerms", function (params, chainId) {
|
|
6713
|
-
var normalized = _objectSpread2(_objectSpread2({}, params), {}, {
|
|
6714
|
-
defaultMintingFee: BigInt(params.defaultMintingFee),
|
|
6715
|
-
expiration: BigInt(params.expiration),
|
|
6716
|
-
commercialRevCeiling: BigInt(params.commercialRevCeiling),
|
|
6717
|
-
derivativeRevCeiling: BigInt(params.derivativeRevCeiling),
|
|
6718
|
-
royaltyPolicy: royaltyPolicyInputToAddress(params.royaltyPolicy, chainId)
|
|
6719
|
-
});
|
|
6720
|
-
var royaltyPolicy = normalized.royaltyPolicy,
|
|
6721
|
-
currency = normalized.currency;
|
|
6722
|
-
|
|
6723
|
-
// Validate royalty policy and currency relationship
|
|
6724
|
-
if (royaltyPolicy !== viem.zeroAddress && currency === viem.zeroAddress) {
|
|
6725
|
-
throw new PILFlavorError("Royalty policy requires currency token.");
|
|
6701
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
6702
|
+
if (null == r) return {};
|
|
6703
|
+
var t = {};
|
|
6704
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
6705
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
6706
|
+
t[n] = r[n];
|
|
6726
6707
|
}
|
|
6708
|
+
return t;
|
|
6709
|
+
}
|
|
6727
6710
|
|
|
6728
|
-
|
|
6729
|
-
if (
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6711
|
+
function _objectWithoutProperties(e, t) {
|
|
6712
|
+
if (null == e) return {};
|
|
6713
|
+
var o,
|
|
6714
|
+
r,
|
|
6715
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
6716
|
+
if (Object.getOwnPropertySymbols) {
|
|
6717
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
6718
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
6734
6719
|
}
|
|
6720
|
+
return i;
|
|
6721
|
+
}
|
|
6735
6722
|
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6723
|
+
var _excluded = ["mintFees", "spenderAddress", "encodedTxs"];
|
|
6724
|
+
/**
|
|
6725
|
+
* Handles batch transaction execution through IP Account with automatic fee management for ERC20 and WIP tokens.
|
|
6726
|
+
*/
|
|
6727
|
+
var IpAccountBatchExecutor = /*#__PURE__*/function () {
|
|
6728
|
+
function IpAccountBatchExecutor(rpcClient, wallet, ipId) {
|
|
6729
|
+
_classCallCheck(this, IpAccountBatchExecutor);
|
|
6730
|
+
this.rpcClient = rpcClient;
|
|
6731
|
+
this.wallet = wallet;
|
|
6732
|
+
this.ipId = ipId;
|
|
6733
|
+
//erc20 address only available in aeneid
|
|
6734
|
+
this.erc20Token = new ERC20Client(rpcClient, wallet, erc20Address[aeneid.id]);
|
|
6735
|
+
this.wipToken = new WipTokenClient(rpcClient, wallet);
|
|
6736
|
+
this.walletAddress = wallet.account.address;
|
|
6741
6737
|
}
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6738
|
+
|
|
6739
|
+
/**
|
|
6740
|
+
* Executes a batch transaction with automatic fee handling for both ERC20 and WIP tokens.
|
|
6741
|
+
*/
|
|
6742
|
+
return _createClass(IpAccountBatchExecutor, [{
|
|
6743
|
+
key: "executeWithFees",
|
|
6744
|
+
value: (function () {
|
|
6745
|
+
var _executeWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
6746
|
+
var _options$options;
|
|
6747
|
+
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;
|
|
6748
|
+
return _regenerator().w(function (_context) {
|
|
6749
|
+
while (1) switch (_context.p = _context.n) {
|
|
6750
|
+
case 0:
|
|
6751
|
+
mintFees = _ref.mintFees, spenderAddress = _ref.spenderAddress, encodedTxs = _ref.encodedTxs, options = _objectWithoutProperties(_ref, _excluded);
|
|
6752
|
+
_groupTokenSpenders = groupTokenSpenders(mintFees.map(function (fee) {
|
|
6753
|
+
return _objectSpread2({
|
|
6754
|
+
address: spenderAddress
|
|
6755
|
+
}, fee);
|
|
6756
|
+
})), wipSpenders = _groupTokenSpenders.wipSpenders, erc20Spenders = _groupTokenSpenders.erc20Spenders;
|
|
6757
|
+
wipTotalFees = wipSpenders.reduce(function (acc, spender) {
|
|
6758
|
+
return acc + (spender.amount || 0n);
|
|
6759
|
+
}, 0n);
|
|
6760
|
+
erc20TotalFees = erc20Spenders.reduce(function (acc, spender) {
|
|
6761
|
+
return acc + (spender.amount || 0n);
|
|
6762
|
+
}, 0n);
|
|
6763
|
+
_context.n = 1;
|
|
6764
|
+
return this.wipToken.balanceOf(this.walletAddress);
|
|
6765
|
+
case 1:
|
|
6766
|
+
wipBalance = _context.v;
|
|
6767
|
+
callData = [];
|
|
6768
|
+
depositValue = 0n; // Build ERC20 fee call data if needed
|
|
6769
|
+
if (!(erc20TotalFees > 0n)) {
|
|
6770
|
+
_context.n = 3;
|
|
6771
|
+
break;
|
|
6772
|
+
}
|
|
6773
|
+
_t = callData.push;
|
|
6774
|
+
_t2 = callData;
|
|
6775
|
+
_t3 = _toConsumableArray;
|
|
6776
|
+
_context.n = 2;
|
|
6777
|
+
return this.buildErc20FeeCallData(erc20TotalFees, spenderAddress, options);
|
|
6778
|
+
case 2:
|
|
6779
|
+
_t.apply.call(_t, _t2, _t3(_context.v));
|
|
6780
|
+
case 3:
|
|
6781
|
+
if (!(wipTotalFees > 0n)) {
|
|
6782
|
+
_context.n = 7;
|
|
6783
|
+
break;
|
|
6784
|
+
}
|
|
6785
|
+
if (!(wipBalance < wipTotalFees)) {
|
|
6786
|
+
_context.n = 5;
|
|
6787
|
+
break;
|
|
6788
|
+
}
|
|
6789
|
+
_context.n = 4;
|
|
6790
|
+
return this.buildWipDepositCallData(spenderAddress, wipTotalFees, wipBalance, options);
|
|
6791
|
+
case 4:
|
|
6792
|
+
_yield$this$buildWipD = _context.v;
|
|
6793
|
+
calls = _yield$this$buildWipD.calls;
|
|
6794
|
+
value = _yield$this$buildWipD.value;
|
|
6795
|
+
callData.push.apply(callData, _toConsumableArray(calls));
|
|
6796
|
+
depositValue = value;
|
|
6797
|
+
_context.n = 7;
|
|
6798
|
+
break;
|
|
6799
|
+
case 5:
|
|
6800
|
+
_t4 = callData.push;
|
|
6801
|
+
_t5 = callData;
|
|
6802
|
+
_t6 = _toConsumableArray;
|
|
6803
|
+
_context.n = 6;
|
|
6804
|
+
return this.buildWipTransferCallData(wipTotalFees, spenderAddress, options);
|
|
6805
|
+
case 6:
|
|
6806
|
+
_t4.apply.call(_t4, _t5, _t6(_context.v));
|
|
6807
|
+
case 7:
|
|
6808
|
+
// Add the actual transaction call data
|
|
6809
|
+
callData.push({
|
|
6810
|
+
target: encodedTxs.to,
|
|
6811
|
+
value: 0n,
|
|
6812
|
+
data: encodedTxs.data
|
|
6813
|
+
});
|
|
6814
|
+
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;
|
|
6815
|
+
if (isMulticall) {
|
|
6816
|
+
_context.n = 16;
|
|
6817
|
+
break;
|
|
6818
|
+
}
|
|
6819
|
+
_iterator = _createForOfIteratorHelper(callData.entries());
|
|
6820
|
+
_context.p = 8;
|
|
6821
|
+
_iterator.s();
|
|
6822
|
+
case 9:
|
|
6823
|
+
if ((_step = _iterator.n()).done) {
|
|
6824
|
+
_context.n = 13;
|
|
6825
|
+
break;
|
|
6826
|
+
}
|
|
6827
|
+
_step$value = _slicedToArray(_step.value, 2), index = _step$value[0], call = _step$value[1];
|
|
6828
|
+
_value = call.value;
|
|
6829
|
+
_context.n = 10;
|
|
6830
|
+
return simulateAndWriteContract({
|
|
6831
|
+
rpcClient: this.rpcClient,
|
|
6832
|
+
wallet: this.wallet,
|
|
6833
|
+
data: _objectSpread2({
|
|
6834
|
+
abi: ipAccountImplAbi,
|
|
6835
|
+
address: this.ipId,
|
|
6836
|
+
functionName: "execute",
|
|
6837
|
+
args: [call.target, call.value, call.data, 0]
|
|
6838
|
+
}, _value > 0n && {
|
|
6839
|
+
value: _value
|
|
6840
|
+
})
|
|
6841
|
+
});
|
|
6842
|
+
case 10:
|
|
6843
|
+
_txHash = _context.v;
|
|
6844
|
+
_context.n = 11;
|
|
6845
|
+
return waitTx(this.rpcClient, _txHash.txHash);
|
|
6846
|
+
case 11:
|
|
6847
|
+
if (!(index === callData.length - 1)) {
|
|
6848
|
+
_context.n = 12;
|
|
6849
|
+
break;
|
|
6850
|
+
}
|
|
6851
|
+
return _context.a(2, {
|
|
6852
|
+
txHash: _txHash.txHash,
|
|
6853
|
+
receipt: _txHash.receipt
|
|
6854
|
+
});
|
|
6855
|
+
case 12:
|
|
6856
|
+
_context.n = 9;
|
|
6857
|
+
break;
|
|
6858
|
+
case 13:
|
|
6859
|
+
_context.n = 15;
|
|
6860
|
+
break;
|
|
6861
|
+
case 14:
|
|
6862
|
+
_context.p = 14;
|
|
6863
|
+
_t7 = _context.v;
|
|
6864
|
+
_iterator.e(_t7);
|
|
6865
|
+
case 15:
|
|
6866
|
+
_context.p = 15;
|
|
6867
|
+
_iterator.f();
|
|
6868
|
+
return _context.f(15);
|
|
6869
|
+
case 16:
|
|
6870
|
+
_context.n = 17;
|
|
6871
|
+
return simulateAndWriteContract({
|
|
6872
|
+
rpcClient: this.rpcClient,
|
|
6873
|
+
wallet: this.wallet,
|
|
6874
|
+
data: _objectSpread2({
|
|
6875
|
+
abi: ipAccountImplAbi,
|
|
6876
|
+
address: this.ipId,
|
|
6877
|
+
functionName: "executeBatch",
|
|
6878
|
+
args: [callData, 0]
|
|
6879
|
+
}, depositValue > 0n && {
|
|
6880
|
+
value: depositValue
|
|
6881
|
+
})
|
|
6882
|
+
});
|
|
6883
|
+
case 17:
|
|
6884
|
+
txHash = _context.v;
|
|
6885
|
+
_context.n = 18;
|
|
6886
|
+
return waitTx(this.rpcClient, txHash.txHash, options.txOptions);
|
|
6887
|
+
case 18:
|
|
6888
|
+
return _context.a(2, {
|
|
6889
|
+
txHash: txHash.txHash,
|
|
6890
|
+
receipt: txHash.receipt
|
|
6891
|
+
});
|
|
6892
|
+
}
|
|
6893
|
+
}, _callee, this, [[8, 14, 15, 16]]);
|
|
6894
|
+
}));
|
|
6895
|
+
function executeWithFees(_x) {
|
|
6896
|
+
return _executeWithFees.apply(this, arguments);
|
|
6897
|
+
}
|
|
6898
|
+
return executeWithFees;
|
|
6899
|
+
}()
|
|
6900
|
+
/**
|
|
6901
|
+
* Builds call data for transferring ERC20 tokens from wallet to IP account and approving spender.
|
|
6902
|
+
*/
|
|
6903
|
+
)
|
|
6904
|
+
}, {
|
|
6905
|
+
key: "buildErc20FeeCallData",
|
|
6906
|
+
value: (function () {
|
|
6907
|
+
var _buildErc20FeeCallData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(totalFee, spenderAddress, options) {
|
|
6908
|
+
var _options$options2;
|
|
6909
|
+
var erc20Balance, autoApprove, erc20ContractAddress, allowance, calls, spenderAllowance, _t8, _t9;
|
|
6910
|
+
return _regenerator().w(function (_context2) {
|
|
6911
|
+
while (1) switch (_context2.n) {
|
|
6912
|
+
case 0:
|
|
6913
|
+
_context2.n = 1;
|
|
6914
|
+
return this.erc20Token.balanceOf(this.walletAddress);
|
|
6915
|
+
case 1:
|
|
6916
|
+
erc20Balance = _context2.v;
|
|
6917
|
+
if (!(erc20Balance < totalFee)) {
|
|
6918
|
+
_context2.n = 2;
|
|
6919
|
+
break;
|
|
6920
|
+
}
|
|
6921
|
+
throw new Error("Wallet does not have enough ERC20 tokens to pay for fees. " + "Required: ".concat(getTokenAmountDisplay(totalFee), ", ") + "Available: ".concat(getTokenAmountDisplay(erc20Balance), "."));
|
|
6922
|
+
case 2:
|
|
6923
|
+
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
|
|
6924
|
+
erc20ContractAddress = erc20Address[aeneid.id];
|
|
6925
|
+
_context2.n = 3;
|
|
6926
|
+
return this.erc20Token.allowance(this.walletAddress, this.ipId);
|
|
6927
|
+
case 3:
|
|
6928
|
+
allowance = _context2.v;
|
|
6929
|
+
if (!(autoApprove && allowance < totalFee)) {
|
|
6930
|
+
_context2.n = 5;
|
|
6931
|
+
break;
|
|
6932
|
+
}
|
|
6933
|
+
_t8 = waitTx;
|
|
6934
|
+
_t9 = this.rpcClient;
|
|
6935
|
+
_context2.n = 4;
|
|
6936
|
+
return this.erc20Token.approve(this.ipId, viem.maxUint256);
|
|
6937
|
+
case 4:
|
|
6938
|
+
_context2.n = 5;
|
|
6939
|
+
return _t8(_t9, _context2.v);
|
|
6940
|
+
case 5:
|
|
6941
|
+
calls = [{
|
|
6942
|
+
target: erc20ContractAddress,
|
|
6943
|
+
value: 0n,
|
|
6944
|
+
data: this.erc20Token.transferFromEncode(this.walletAddress, this.ipId, totalFee).data
|
|
6945
|
+
}];
|
|
6946
|
+
_context2.n = 6;
|
|
6947
|
+
return this.erc20Token.allowance(this.ipId, spenderAddress);
|
|
6948
|
+
case 6:
|
|
6949
|
+
spenderAllowance = _context2.v;
|
|
6950
|
+
if (autoApprove && spenderAllowance < totalFee) {
|
|
6951
|
+
calls.push({
|
|
6952
|
+
target: erc20ContractAddress,
|
|
6953
|
+
value: 0n,
|
|
6954
|
+
data: this.erc20Token.approveEncode(spenderAddress, viem.maxUint256).data
|
|
6955
|
+
});
|
|
6956
|
+
}
|
|
6957
|
+
return _context2.a(2, calls);
|
|
6958
|
+
}
|
|
6959
|
+
}, _callee2, this);
|
|
6960
|
+
}));
|
|
6961
|
+
function buildErc20FeeCallData(_x2, _x3, _x4) {
|
|
6962
|
+
return _buildErc20FeeCallData.apply(this, arguments);
|
|
6963
|
+
}
|
|
6964
|
+
return buildErc20FeeCallData;
|
|
6965
|
+
}()
|
|
6966
|
+
/**
|
|
6967
|
+
* Builds call data for depositing IP tokens to WIP and approving spender.
|
|
6968
|
+
*/
|
|
6969
|
+
)
|
|
6970
|
+
}, {
|
|
6971
|
+
key: "buildWipDepositCallData",
|
|
6972
|
+
value: (function () {
|
|
6973
|
+
var _buildWipDepositCallData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(spenderAddress, totalFee, wipBalance, options) {
|
|
6974
|
+
var _options$options3, _options$options4;
|
|
6975
|
+
var calls, autoApprove, autoWrapIp, ipBalance, value, allowance;
|
|
6976
|
+
return _regenerator().w(function (_context3) {
|
|
6977
|
+
while (1) switch (_context3.n) {
|
|
6978
|
+
case 0:
|
|
6979
|
+
calls = [];
|
|
6980
|
+
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;
|
|
6981
|
+
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;
|
|
6982
|
+
_context3.n = 1;
|
|
6983
|
+
return this.rpcClient.getBalance({
|
|
6984
|
+
address: this.walletAddress
|
|
6985
|
+
});
|
|
6986
|
+
case 1:
|
|
6987
|
+
ipBalance = _context3.v;
|
|
6988
|
+
if (autoWrapIp) {
|
|
6989
|
+
_context3.n = 2;
|
|
6990
|
+
break;
|
|
6991
|
+
}
|
|
6992
|
+
throw new Error("Wallet does not have enough WIP to pay for fees. Total fees: ".concat(getTokenAmountDisplay(totalFee), ", balance: ").concat(getTokenAmountDisplay(wipBalance, "WIP"), "."));
|
|
6993
|
+
case 2:
|
|
6994
|
+
if (!(ipBalance < totalFee)) {
|
|
6995
|
+
_context3.n = 3;
|
|
6996
|
+
break;
|
|
6997
|
+
}
|
|
6998
|
+
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), "."));
|
|
6999
|
+
case 3:
|
|
7000
|
+
calls.push({
|
|
7001
|
+
target: WIP_TOKEN_ADDRESS,
|
|
7002
|
+
value: totalFee,
|
|
7003
|
+
data: this.wipToken.depositEncode().data
|
|
7004
|
+
});
|
|
7005
|
+
value = totalFee;
|
|
7006
|
+
_context3.n = 4;
|
|
7007
|
+
return this.wipToken.allowance(this.ipId, spenderAddress);
|
|
7008
|
+
case 4:
|
|
7009
|
+
allowance = _context3.v;
|
|
7010
|
+
if (autoApprove && allowance < totalFee) {
|
|
7011
|
+
calls.push({
|
|
7012
|
+
target: WIP_TOKEN_ADDRESS,
|
|
7013
|
+
value: 0n,
|
|
7014
|
+
data: this.wipToken.approveEncode(spenderAddress, viem.maxUint256).data
|
|
7015
|
+
});
|
|
7016
|
+
}
|
|
7017
|
+
return _context3.a(2, {
|
|
7018
|
+
calls: calls,
|
|
7019
|
+
value: value
|
|
7020
|
+
});
|
|
7021
|
+
}
|
|
7022
|
+
}, _callee3, this);
|
|
7023
|
+
}));
|
|
7024
|
+
function buildWipDepositCallData(_x5, _x6, _x7, _x8) {
|
|
7025
|
+
return _buildWipDepositCallData.apply(this, arguments);
|
|
7026
|
+
}
|
|
7027
|
+
return buildWipDepositCallData;
|
|
7028
|
+
}()
|
|
7029
|
+
/**
|
|
7030
|
+
* Builds call data for transferring existing WIP tokens from wallet to IP account and approving spender.
|
|
7031
|
+
*/
|
|
7032
|
+
)
|
|
7033
|
+
}, {
|
|
7034
|
+
key: "buildWipTransferCallData",
|
|
7035
|
+
value: (function () {
|
|
7036
|
+
var _buildWipTransferCallData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(totalFee, spenderAddress, options) {
|
|
7037
|
+
var _options$options5;
|
|
7038
|
+
var autoApprove, allowance, calls, spenderAllowance, _t0, _t1;
|
|
7039
|
+
return _regenerator().w(function (_context4) {
|
|
7040
|
+
while (1) switch (_context4.n) {
|
|
7041
|
+
case 0:
|
|
7042
|
+
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;
|
|
7043
|
+
_context4.n = 1;
|
|
7044
|
+
return this.wipToken.allowance(this.walletAddress, this.ipId);
|
|
7045
|
+
case 1:
|
|
7046
|
+
allowance = _context4.v;
|
|
7047
|
+
if (!(autoApprove && allowance < totalFee)) {
|
|
7048
|
+
_context4.n = 3;
|
|
7049
|
+
break;
|
|
7050
|
+
}
|
|
7051
|
+
_t0 = waitTx;
|
|
7052
|
+
_t1 = this.rpcClient;
|
|
7053
|
+
_context4.n = 2;
|
|
7054
|
+
return this.wipToken.approve(this.ipId, viem.maxUint256);
|
|
7055
|
+
case 2:
|
|
7056
|
+
_context4.n = 3;
|
|
7057
|
+
return _t0(_t1, _context4.v);
|
|
7058
|
+
case 3:
|
|
7059
|
+
calls = [{
|
|
7060
|
+
target: WIP_TOKEN_ADDRESS,
|
|
7061
|
+
value: 0n,
|
|
7062
|
+
data: this.wipToken.transferFromEncode(this.walletAddress, this.ipId, totalFee).data
|
|
7063
|
+
}];
|
|
7064
|
+
_context4.n = 4;
|
|
7065
|
+
return this.wipToken.allowance(this.ipId, spenderAddress);
|
|
7066
|
+
case 4:
|
|
7067
|
+
spenderAllowance = _context4.v;
|
|
7068
|
+
if (autoApprove && spenderAllowance < totalFee) {
|
|
7069
|
+
calls.push({
|
|
7070
|
+
target: WIP_TOKEN_ADDRESS,
|
|
7071
|
+
value: 0n,
|
|
7072
|
+
data: this.wipToken.approveEncode(spenderAddress, viem.maxUint256).data
|
|
7073
|
+
});
|
|
7074
|
+
}
|
|
7075
|
+
return _context4.a(2, calls);
|
|
7076
|
+
}
|
|
7077
|
+
}, _callee4, this);
|
|
7078
|
+
}));
|
|
7079
|
+
function buildWipTransferCallData(_x9, _x0, _x1) {
|
|
7080
|
+
return _buildWipTransferCallData.apply(this, arguments);
|
|
7081
|
+
}
|
|
7082
|
+
return buildWipTransferCallData;
|
|
7083
|
+
}())
|
|
7084
|
+
}]);
|
|
7085
|
+
}();
|
|
7086
|
+
|
|
7087
|
+
var _PILFlavor;
|
|
7088
|
+
var PIL_URIS = {
|
|
7089
|
+
NCSR: "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/NCSR.json",
|
|
7090
|
+
COMMERCIAL_USE: "https://github.com/piplabs/pil-document/blob/9a1f803fcf8101a8a78f1dcc929e6014e144ab56/off-chain-terms/CommercialUse.json",
|
|
7091
|
+
COMMERCIAL_REMIX: "https://github.com/piplabs/pil-document/blob/ad67bb632a310d2557f8abcccd428e4c9c798db1/off-chain-terms/CommercialRemix.json",
|
|
7092
|
+
CC_BY: "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/CC-BY.json"
|
|
7093
|
+
};
|
|
7094
|
+
var COMMON_DEFAULTS = {
|
|
7095
|
+
transferable: true,
|
|
7096
|
+
royaltyPolicy: viem.zeroAddress,
|
|
7097
|
+
defaultMintingFee: 0n,
|
|
7098
|
+
expiration: 0n,
|
|
7099
|
+
commercializerChecker: viem.zeroAddress,
|
|
7100
|
+
commercializerCheckerData: viem.zeroAddress,
|
|
7101
|
+
commercialRevShare: 0,
|
|
7102
|
+
commercialRevCeiling: 0n,
|
|
7103
|
+
derivativeRevCeiling: 0n,
|
|
7104
|
+
currency: viem.zeroAddress
|
|
7105
|
+
};
|
|
7106
|
+
|
|
7107
|
+
/**
|
|
7108
|
+
* Pre-configured Programmable IP License (PIL) flavors for ease of use.
|
|
7109
|
+
*
|
|
7110
|
+
* The PIL is highly configurable, but these pre-configured license terms (flavors)
|
|
7111
|
+
* are the most popular options that cover common use cases.
|
|
7112
|
+
*
|
|
7113
|
+
* @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors | PIL Flavors Documentation}
|
|
7114
|
+
*
|
|
7115
|
+
* @example
|
|
7116
|
+
* ```typescript
|
|
7117
|
+
* // Create a commercial use license
|
|
7118
|
+
* const commercialLicense = PILFlavor.commercialUse({
|
|
7119
|
+
* defaultMintingFee: 1000000000000000000n, // 1 IP minting fee
|
|
7120
|
+
* currencyToken: "0x1234...", // currency token
|
|
7121
|
+
* royaltyPolicy: "LAP" // royalty policy
|
|
7122
|
+
* });
|
|
7123
|
+
*
|
|
7124
|
+
* // Create a non-commercial social remixing license
|
|
7125
|
+
* const remixLicense = PILFlavor.nonCommercialSocialRemixing();
|
|
7126
|
+
* ```
|
|
7127
|
+
*/
|
|
7128
|
+
var PILFlavor = /*#__PURE__*/_createClass(function PILFlavor() {
|
|
7129
|
+
_classCallCheck(this, PILFlavor);
|
|
7130
|
+
});
|
|
7131
|
+
_PILFlavor = PILFlavor;
|
|
7132
|
+
_defineProperty(PILFlavor, "_nonComSocialRemixingPIL", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
|
|
7133
|
+
commercialUse: false,
|
|
7134
|
+
commercialAttribution: false,
|
|
7135
|
+
derivativesAllowed: true,
|
|
7136
|
+
derivativesAttribution: true,
|
|
7137
|
+
derivativesApproval: false,
|
|
7138
|
+
derivativesReciprocal: true,
|
|
7139
|
+
uri: PIL_URIS.NCSR
|
|
7140
|
+
}));
|
|
7141
|
+
_defineProperty(PILFlavor, "_commercialUse", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
|
|
7142
|
+
commercialUse: true,
|
|
7143
|
+
commercialAttribution: true,
|
|
7144
|
+
derivativesAllowed: false,
|
|
7145
|
+
derivativesAttribution: false,
|
|
7146
|
+
derivativesApproval: false,
|
|
7147
|
+
derivativesReciprocal: false,
|
|
7148
|
+
uri: PIL_URIS.COMMERCIAL_USE
|
|
7149
|
+
}));
|
|
7150
|
+
_defineProperty(PILFlavor, "_commercialRemix", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
|
|
7151
|
+
commercialUse: true,
|
|
7152
|
+
commercialAttribution: true,
|
|
7153
|
+
derivativesAllowed: true,
|
|
7154
|
+
derivativesAttribution: true,
|
|
7155
|
+
derivativesApproval: false,
|
|
7156
|
+
derivativesReciprocal: true,
|
|
7157
|
+
uri: PIL_URIS.COMMERCIAL_REMIX
|
|
7158
|
+
}));
|
|
7159
|
+
_defineProperty(PILFlavor, "_creativeCommonsAttribution", _objectSpread2(_objectSpread2({}, COMMON_DEFAULTS), {}, {
|
|
7160
|
+
commercialUse: true,
|
|
7161
|
+
commercialAttribution: true,
|
|
7162
|
+
derivativesAllowed: true,
|
|
7163
|
+
derivativesAttribution: true,
|
|
7164
|
+
derivativesApproval: false,
|
|
7165
|
+
derivativesReciprocal: true,
|
|
7166
|
+
uri: PIL_URIS.CC_BY
|
|
7167
|
+
}));
|
|
7168
|
+
/**
|
|
7169
|
+
* Gets the values to create a Non-Commercial Social Remixing license terms flavor.
|
|
7170
|
+
* @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#non-commercial-social-remixing | Non Commercial Social Remixing}
|
|
7171
|
+
*/
|
|
7172
|
+
_defineProperty(PILFlavor, "nonCommercialSocialRemixing", function (request) {
|
|
7173
|
+
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);
|
|
7174
|
+
});
|
|
7175
|
+
/**
|
|
7176
|
+
* Gets the values to create a Commercial Use license terms flavor.
|
|
7177
|
+
* @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#commercial-use | Commercial Use}
|
|
7178
|
+
*/
|
|
7179
|
+
_defineProperty(PILFlavor, "commercialUse", function (_ref) {
|
|
7180
|
+
var defaultMintingFee = _ref.defaultMintingFee,
|
|
7181
|
+
currency = _ref.currency,
|
|
7182
|
+
royaltyPolicy = _ref.royaltyPolicy,
|
|
7183
|
+
chainId = _ref.chainId,
|
|
7184
|
+
override = _ref.override;
|
|
7185
|
+
return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._commercialUse), {}, {
|
|
7186
|
+
defaultMintingFee: defaultMintingFee,
|
|
7187
|
+
currency: currency,
|
|
7188
|
+
royaltyPolicy: royaltyPolicy
|
|
7189
|
+
}, override), chainId);
|
|
7190
|
+
});
|
|
7191
|
+
/**
|
|
7192
|
+
* Gets the values to create a Commercial Remixing license terms flavor.
|
|
7193
|
+
* @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#commercial-remix | Commercial Remix}
|
|
7194
|
+
*/
|
|
7195
|
+
_defineProperty(PILFlavor, "commercialRemix", function (_ref2) {
|
|
7196
|
+
var defaultMintingFee = _ref2.defaultMintingFee,
|
|
7197
|
+
royaltyPolicy = _ref2.royaltyPolicy,
|
|
7198
|
+
currency = _ref2.currency,
|
|
7199
|
+
commercialRevShare = _ref2.commercialRevShare,
|
|
7200
|
+
chainId = _ref2.chainId,
|
|
7201
|
+
override = _ref2.override;
|
|
7202
|
+
return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._commercialRemix), {}, {
|
|
7203
|
+
commercialRevShare: commercialRevShare,
|
|
7204
|
+
defaultMintingFee: defaultMintingFee,
|
|
7205
|
+
currency: currency,
|
|
7206
|
+
royaltyPolicy: royaltyPolicy
|
|
7207
|
+
}, override), chainId);
|
|
7208
|
+
});
|
|
7209
|
+
/**
|
|
7210
|
+
* Gets the values to create a Creative Commons Attribution (CC-BY) license terms flavor.
|
|
7211
|
+
* @see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#creative-commons-attribution | Creative Commons Attribution}
|
|
7212
|
+
*/
|
|
7213
|
+
_defineProperty(PILFlavor, "creativeCommonsAttribution", function (_ref3) {
|
|
7214
|
+
var royaltyPolicy = _ref3.royaltyPolicy,
|
|
7215
|
+
currency = _ref3.currency,
|
|
7216
|
+
chainId = _ref3.chainId,
|
|
7217
|
+
override = _ref3.override;
|
|
7218
|
+
return _PILFlavor.validateLicenseTerms(_objectSpread2(_objectSpread2({}, _PILFlavor._creativeCommonsAttribution), {}, {
|
|
7219
|
+
currency: currency,
|
|
7220
|
+
royaltyPolicy: royaltyPolicy
|
|
7221
|
+
}, override), chainId);
|
|
7222
|
+
});
|
|
7223
|
+
_defineProperty(PILFlavor, "validateLicenseTerms", function (params, chainId) {
|
|
7224
|
+
var normalized = _objectSpread2(_objectSpread2({}, params), {}, {
|
|
7225
|
+
defaultMintingFee: BigInt(params.defaultMintingFee),
|
|
7226
|
+
expiration: BigInt(params.expiration),
|
|
7227
|
+
commercialRevCeiling: BigInt(params.commercialRevCeiling),
|
|
7228
|
+
derivativeRevCeiling: BigInt(params.derivativeRevCeiling),
|
|
7229
|
+
royaltyPolicy: royaltyPolicyInputToAddress(params.royaltyPolicy, chainId)
|
|
7230
|
+
});
|
|
7231
|
+
var royaltyPolicy = normalized.royaltyPolicy,
|
|
7232
|
+
currency = normalized.currency;
|
|
7233
|
+
|
|
7234
|
+
// Validate royalty policy and currency relationship
|
|
7235
|
+
if (royaltyPolicy !== viem.zeroAddress && currency === viem.zeroAddress) {
|
|
7236
|
+
throw new PILFlavorError("Royalty policy requires currency token.");
|
|
7237
|
+
}
|
|
7238
|
+
|
|
7239
|
+
// 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).
|
|
7240
|
+
if (currency !== null && currency !== undefined && currency !== viem.zeroAddress && chainId !== undefined) {
|
|
7241
|
+
validateCurrencyToken(currency, chainId);
|
|
7242
|
+
}
|
|
7243
|
+
|
|
7244
|
+
// Validate defaultMintingFee
|
|
7245
|
+
if (normalized.defaultMintingFee < 0n) {
|
|
7246
|
+
throw new PILFlavorError("DefaultMintingFee should be greater than or equal to 0.");
|
|
7247
|
+
}
|
|
7248
|
+
if (normalized.defaultMintingFee > 0n && normalized.royaltyPolicy === viem.zeroAddress) {
|
|
7249
|
+
throw new PILFlavorError("Royalty policy is required when defaultMintingFee is greater than 0.");
|
|
7250
|
+
}
|
|
7251
|
+
|
|
7252
|
+
// Validate commercial use and derivatives
|
|
7253
|
+
_PILFlavor.verifyCommercialUse(normalized);
|
|
7254
|
+
_PILFlavor.verifyDerivatives(normalized);
|
|
7255
|
+
if (normalized.commercialRevShare > 100 || normalized.commercialRevShare < 0) {
|
|
7256
|
+
throw new PILFlavorError("commercialRevShare must be between 0 and 100.");
|
|
7257
|
+
}
|
|
7258
|
+
return normalized;
|
|
7259
|
+
});
|
|
7260
|
+
_defineProperty(PILFlavor, "verifyCommercialUse", function (terms) {
|
|
7261
|
+
if (!terms.commercialUse) {
|
|
7262
|
+
var commercialFields = [{
|
|
7263
|
+
field: "commercialAttribution",
|
|
7264
|
+
value: terms.commercialAttribution
|
|
7265
|
+
}, {
|
|
7266
|
+
field: "commercializerChecker",
|
|
6751
7267
|
value: terms.commercializerChecker !== viem.zeroAddress
|
|
6752
7268
|
}, {
|
|
6753
7269
|
field: "commercialRevShare",
|
|
@@ -6802,24 +7318,6 @@ _defineProperty(PILFlavor, "verifyDerivatives", function (terms) {
|
|
|
6802
7318
|
}
|
|
6803
7319
|
});
|
|
6804
7320
|
|
|
6805
|
-
function _regeneratorValues(e) {
|
|
6806
|
-
if (null != e) {
|
|
6807
|
-
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
6808
|
-
r = 0;
|
|
6809
|
-
if (t) return t.call(e);
|
|
6810
|
-
if ("function" == typeof e.next) return e;
|
|
6811
|
-
if (!isNaN(e.length)) return {
|
|
6812
|
-
next: function () {
|
|
6813
|
-
return e && r >= e.length && (e = void 0), {
|
|
6814
|
-
value: e && e[r++],
|
|
6815
|
-
done: !e
|
|
6816
|
-
};
|
|
6817
|
-
}
|
|
6818
|
-
};
|
|
6819
|
-
}
|
|
6820
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
6821
|
-
}
|
|
6822
|
-
|
|
6823
7321
|
function _regeneratorKeys(e) {
|
|
6824
7322
|
var n = Object(e),
|
|
6825
7323
|
r = [];
|
|
@@ -6850,7 +7348,7 @@ var getPublicMinting = /*#__PURE__*/function () {
|
|
|
6850
7348
|
}();
|
|
6851
7349
|
var validateLicenseTermsData = /*#__PURE__*/function () {
|
|
6852
7350
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(licenseTermsData, rpcClient, chainId) {
|
|
6853
|
-
var licenseTerms, processedLicenseTermsData, maxLicenseTokens, i, licenseTerm, royaltyModuleReadOnlyClient, isWhitelistedArbitrationPolicy, isWhitelistedRoyaltyToken, licensingConfig, maxLicenseTokensValue;
|
|
7351
|
+
var licenseTerms, processedLicenseTermsData, maxLicenseTokens, i, licenseTerm, licenseTermsDataInput, royaltyModuleReadOnlyClient, isWhitelistedArbitrationPolicy, isWhitelistedRoyaltyToken, piLicenseTemplateReadOnlyClient, isExist, response, licensingConfig, maxLicenseTokensValue;
|
|
6854
7352
|
return _regenerator().w(function (_context2) {
|
|
6855
7353
|
while (1) switch (_context2.n) {
|
|
6856
7354
|
case 0:
|
|
@@ -6860,10 +7358,16 @@ var validateLicenseTermsData = /*#__PURE__*/function () {
|
|
|
6860
7358
|
i = 0;
|
|
6861
7359
|
case 1:
|
|
6862
7360
|
if (!(i < licenseTermsData.length)) {
|
|
6863
|
-
_context2.n =
|
|
7361
|
+
_context2.n = 16;
|
|
6864
7362
|
break;
|
|
6865
7363
|
}
|
|
6866
|
-
licenseTerm =
|
|
7364
|
+
licenseTerm = void 0;
|
|
7365
|
+
licenseTermsDataInput = licenseTermsData[i];
|
|
7366
|
+
if (!licenseTermsDataInput.terms) {
|
|
7367
|
+
_context2.n = 6;
|
|
7368
|
+
break;
|
|
7369
|
+
}
|
|
7370
|
+
licenseTerm = PILFlavor.validateLicenseTerms(licenseTermsDataInput.terms, chainId);
|
|
6867
7371
|
licenseTerm.commercialRevShare = getRevenueShare(licenseTerm.commercialRevShare);
|
|
6868
7372
|
royaltyModuleReadOnlyClient = new RoyaltyModuleReadOnlyClient(rpcClient);
|
|
6869
7373
|
if (!(validateAddress(licenseTerm.royaltyPolicy) !== viem.zeroAddress)) {
|
|
@@ -6886,6 +7390,7 @@ var validateLicenseTermsData = /*#__PURE__*/function () {
|
|
|
6886
7390
|
_context2.n = 5;
|
|
6887
7391
|
break;
|
|
6888
7392
|
}
|
|
7393
|
+
validateCurrencyToken(licenseTerm.currency, chainId);
|
|
6889
7394
|
_context2.n = 4;
|
|
6890
7395
|
return royaltyModuleReadOnlyClient.isWhitelistedRoyaltyToken({
|
|
6891
7396
|
token: licenseTerm.currency
|
|
@@ -6898,37 +7403,69 @@ var validateLicenseTermsData = /*#__PURE__*/function () {
|
|
|
6898
7403
|
}
|
|
6899
7404
|
throw new Error("The currency token ".concat(licenseTerm.currency, " is not whitelisted."));
|
|
6900
7405
|
case 5:
|
|
7406
|
+
_context2.n = 11;
|
|
7407
|
+
break;
|
|
7408
|
+
case 6:
|
|
7409
|
+
if (!(licenseTermsDataInput.licenseTermsId !== undefined)) {
|
|
7410
|
+
_context2.n = 10;
|
|
7411
|
+
break;
|
|
7412
|
+
}
|
|
7413
|
+
piLicenseTemplateReadOnlyClient = new PiLicenseTemplateReadOnlyClient(rpcClient);
|
|
7414
|
+
_context2.n = 7;
|
|
7415
|
+
return piLicenseTemplateReadOnlyClient.exists({
|
|
7416
|
+
licenseTermsId: BigInt(licenseTermsDataInput.licenseTermsId)
|
|
7417
|
+
});
|
|
7418
|
+
case 7:
|
|
7419
|
+
isExist = _context2.v;
|
|
7420
|
+
if (isExist) {
|
|
7421
|
+
_context2.n = 8;
|
|
7422
|
+
break;
|
|
7423
|
+
}
|
|
7424
|
+
throw new Error("The license terms id ".concat(licenseTermsDataInput.licenseTermsId, " is not exist."));
|
|
7425
|
+
case 8:
|
|
7426
|
+
_context2.n = 9;
|
|
7427
|
+
return piLicenseTemplateReadOnlyClient.getLicenseTerms({
|
|
7428
|
+
selectedLicenseTermsId: BigInt(licenseTermsDataInput.licenseTermsId)
|
|
7429
|
+
});
|
|
7430
|
+
case 9:
|
|
7431
|
+
response = _context2.v;
|
|
7432
|
+
licenseTerm = response.terms;
|
|
7433
|
+
_context2.n = 11;
|
|
7434
|
+
break;
|
|
7435
|
+
case 10:
|
|
7436
|
+
throw new Error("Either terms or licenseTermsId must be provided.");
|
|
7437
|
+
case 11:
|
|
6901
7438
|
licensingConfig = validateLicenseConfig(licenseTermsData[i].licensingConfig);
|
|
6902
7439
|
if (!(licensingConfig.mintingFee > 0 && licenseTerm.royaltyPolicy === viem.zeroAddress)) {
|
|
6903
|
-
_context2.n =
|
|
7440
|
+
_context2.n = 12;
|
|
6904
7441
|
break;
|
|
6905
7442
|
}
|
|
6906
7443
|
throw new Error("A royalty policy must be provided when the minting fee is greater than 0.");
|
|
6907
|
-
case
|
|
7444
|
+
case 12:
|
|
6908
7445
|
maxLicenseTokensValue = licenseTermsData[i].maxLicenseTokens;
|
|
6909
7446
|
if (!(maxLicenseTokensValue !== undefined)) {
|
|
6910
|
-
_context2.n =
|
|
7447
|
+
_context2.n = 14;
|
|
6911
7448
|
break;
|
|
6912
7449
|
}
|
|
6913
7450
|
if (!(maxLicenseTokensValue < 0)) {
|
|
6914
|
-
_context2.n =
|
|
7451
|
+
_context2.n = 13;
|
|
6915
7452
|
break;
|
|
6916
7453
|
}
|
|
6917
7454
|
throw new Error("The max license tokens must be greater than or equal to 0.");
|
|
6918
|
-
case
|
|
7455
|
+
case 13:
|
|
6919
7456
|
licensingConfig.licensingHook = totalLicenseTokenLimitHookAddress[chainId];
|
|
6920
7457
|
maxLicenseTokens[i] = BigInt(maxLicenseTokensValue);
|
|
6921
|
-
case
|
|
7458
|
+
case 14:
|
|
6922
7459
|
licenseTerms.push(licenseTerm);
|
|
6923
7460
|
processedLicenseTermsData.push({
|
|
6924
7461
|
terms: licenseTerm,
|
|
6925
7462
|
licensingConfig: licensingConfig
|
|
6926
7463
|
});
|
|
6927
|
-
case
|
|
7464
|
+
case 15:
|
|
6928
7465
|
i++;
|
|
6929
7466
|
_context2.n = 1;
|
|
6930
7467
|
break;
|
|
6931
|
-
case
|
|
7468
|
+
case 16:
|
|
6932
7469
|
return _context2.a(2, {
|
|
6933
7470
|
licenseTerms: licenseTerms,
|
|
6934
7471
|
licenseTermsData: processedLicenseTermsData,
|
|
@@ -8369,6 +8906,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8369
8906
|
this.spgNftClient = new SpgnftImplReadOnlyClient(rpcClient);
|
|
8370
8907
|
this.totalLicenseTokenLimitHookClient = new TotalLicenseTokenLimitHookClient(rpcClient, wallet);
|
|
8371
8908
|
this.licenseTokenClient = new LicenseTokenClient(rpcClient, wallet);
|
|
8909
|
+
this.erc20Client = new Erc20Client(rpcClient, wallet, erc20Address[chainId]);
|
|
8372
8910
|
this.rpcClient = rpcClient;
|
|
8373
8911
|
this.wallet = wallet;
|
|
8374
8912
|
this.chainId = chainId;
|
|
@@ -8704,8 +9242,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8704
9242
|
key: "registerDerivative",
|
|
8705
9243
|
value: (function () {
|
|
8706
9244
|
var _registerDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(request) {
|
|
8707
|
-
var
|
|
8708
|
-
var _request$txOptions2, isChildIpIdRegistered, derivativeData, object, encodedTxData, _request$options, contractCall, _t5;
|
|
9245
|
+
var _request$txOptions2, isChildIpIdRegistered, derivativeData, object, encodedTxData, mintFees, batchExecutor, _t5;
|
|
8709
9246
|
return _regenerator().w(function (_context4) {
|
|
8710
9247
|
while (1) switch (_context4.p = _context4.n) {
|
|
8711
9248
|
case 0:
|
|
@@ -8741,82 +9278,160 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8741
9278
|
encodedTxData: encodedTxData
|
|
8742
9279
|
});
|
|
8743
9280
|
case 4:
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
};
|
|
8747
|
-
return _context4.a(2, this.handleRegistrationWithFees({
|
|
8748
|
-
sender: this.walletAddress,
|
|
9281
|
+
_context4.n = 5;
|
|
9282
|
+
return calculateDerivativeMintingFee({
|
|
8749
9283
|
derivData: object,
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
9284
|
+
rpcClient: this.rpcClient,
|
|
9285
|
+
wallet: this.wallet,
|
|
9286
|
+
chainId: this.chainId,
|
|
9287
|
+
sender: this.walletAddress
|
|
9288
|
+
});
|
|
9289
|
+
case 5:
|
|
9290
|
+
mintFees = _context4.v;
|
|
9291
|
+
batchExecutor = new IpAccountBatchExecutor(this.rpcClient, this.wallet, request.childIpId);
|
|
9292
|
+
return _context4.a(2, batchExecutor.executeWithFees({
|
|
9293
|
+
mintFees: mintFees,
|
|
9294
|
+
spenderAddress: this.royaltyModuleEventClient.address,
|
|
9295
|
+
encodedTxs: encodedTxData,
|
|
9296
|
+
options: request.options,
|
|
9297
|
+
txOptions: request.txOptions
|
|
9298
|
+
}));
|
|
9299
|
+
case 6:
|
|
9300
|
+
_context4.n = 8;
|
|
9301
|
+
break;
|
|
9302
|
+
case 7:
|
|
9303
|
+
_context4.p = 7;
|
|
9304
|
+
_t5 = _context4.v;
|
|
9305
|
+
return _context4.a(2, handleError(_t5, "Failed to register derivative"));
|
|
9306
|
+
case 8:
|
|
9307
|
+
return _context4.a(2);
|
|
9308
|
+
}
|
|
9309
|
+
}, _callee4, this, [[0, 7]]);
|
|
9310
|
+
}));
|
|
9311
|
+
function registerDerivative(_x5) {
|
|
9312
|
+
return _registerDerivative.apply(this, arguments);
|
|
9313
|
+
}
|
|
9314
|
+
return registerDerivative;
|
|
9315
|
+
}()
|
|
9316
|
+
/**
|
|
9317
|
+
* Batch registers a derivative directly with parent IP's license terms, without needing license tokens,
|
|
9318
|
+
* and attaches the license terms of the parent IPs to the derivative IP.
|
|
9319
|
+
* The license terms must be attached to the parent IP before calling this function.
|
|
9320
|
+
* All IPs attached default license terms by default.
|
|
9321
|
+
* The derivative IP owner must be the caller or an authorized operator.
|
|
9322
|
+
*
|
|
9323
|
+
* @remarks
|
|
9324
|
+
* This method supports automatic fee handling for both ERC20 and WIP tokens.
|
|
9325
|
+
* The fees are paid from the wallet address.
|
|
9326
|
+
* The transaction will be executed in the same order as the input arguments.
|
|
9327
|
+
* If a request fails, previous transactions will not be reverted.
|
|
9328
|
+
*/
|
|
9329
|
+
)
|
|
9330
|
+
}, {
|
|
9331
|
+
key: "batchRegisterDerivatives",
|
|
9332
|
+
value: (function () {
|
|
9333
|
+
var _batchRegisterDerivatives = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref2) {
|
|
9334
|
+
var requests, options, txOptions, txHashes, index, result, _t6;
|
|
9335
|
+
return _regenerator().w(function (_context5) {
|
|
9336
|
+
while (1) switch (_context5.p = _context5.n) {
|
|
9337
|
+
case 0:
|
|
9338
|
+
requests = _ref2.requests, options = _ref2.options, txOptions = _ref2.txOptions;
|
|
9339
|
+
txHashes = [];
|
|
9340
|
+
index = 0;
|
|
9341
|
+
case 1:
|
|
9342
|
+
if (!(index < requests.length)) {
|
|
9343
|
+
_context5.n = 6;
|
|
9344
|
+
break;
|
|
9345
|
+
}
|
|
9346
|
+
_context5.p = 2;
|
|
9347
|
+
_context5.n = 3;
|
|
9348
|
+
return this.registerDerivative(_objectSpread2(_objectSpread2({}, requests[index]), {}, {
|
|
9349
|
+
options: options,
|
|
9350
|
+
txOptions: txOptions
|
|
8759
9351
|
}));
|
|
9352
|
+
case 3:
|
|
9353
|
+
result = _context5.v;
|
|
9354
|
+
txHashes.push(result.txHash);
|
|
9355
|
+
index++;
|
|
9356
|
+
_context5.n = 5;
|
|
9357
|
+
break;
|
|
9358
|
+
case 4:
|
|
9359
|
+
_context5.p = 4;
|
|
9360
|
+
_t6 = _context5.v;
|
|
9361
|
+
return _context5.a(2, handleError(_t6, "Failed to batch register derivatives at index ".concat(index)));
|
|
8760
9362
|
case 5:
|
|
8761
|
-
|
|
9363
|
+
_context5.n = 1;
|
|
8762
9364
|
break;
|
|
8763
9365
|
case 6:
|
|
8764
|
-
|
|
8765
|
-
_t5 = _context4.v;
|
|
8766
|
-
return _context4.a(2, handleError(_t5, "Failed to register derivative"));
|
|
8767
|
-
case 7:
|
|
8768
|
-
return _context4.a(2);
|
|
9366
|
+
return _context5.a(2, txHashes);
|
|
8769
9367
|
}
|
|
8770
|
-
},
|
|
9368
|
+
}, _callee5, this, [[2, 4]]);
|
|
8771
9369
|
}));
|
|
8772
|
-
function
|
|
8773
|
-
return
|
|
9370
|
+
function batchRegisterDerivatives(_x6) {
|
|
9371
|
+
return _batchRegisterDerivatives.apply(this, arguments);
|
|
8774
9372
|
}
|
|
8775
|
-
return
|
|
9373
|
+
return batchRegisterDerivatives;
|
|
8776
9374
|
}()
|
|
8777
9375
|
/**
|
|
9376
|
+
* @deprecated This method is deprecated. Please use the {@link batchRegisterDerivatives} instead.
|
|
9377
|
+
* This method will be removed soon.
|
|
8778
9378
|
* Batch registers a derivative directly with parent IP's license terms.
|
|
9379
|
+
*
|
|
9380
|
+
* @example Migration Example
|
|
9381
|
+
* ```typescript
|
|
9382
|
+
* // Before (deprecated):
|
|
9383
|
+
* await client.ipAsset.batchRegisterDerivative({
|
|
9384
|
+
* args: [{ childIpId: '0x...', parentIpIds: ['0x...'], licenseTermsIds: [1n] }],
|
|
9385
|
+
* });
|
|
9386
|
+
*
|
|
9387
|
+
* // After (recommended):
|
|
9388
|
+
* await client.ipAsset.batchRegisterDerivatives({
|
|
9389
|
+
* requests: [{ childIpId: '0x...', parentIpIds: ['0x...'], licenseTermsIds: [1n] }],
|
|
9390
|
+
* });
|
|
9391
|
+
* ```
|
|
9392
|
+
*
|
|
9393
|
+
* @remarks This method does not support automatic fee handling for both ERC20 and WIP tokens.
|
|
8779
9394
|
*/
|
|
8780
9395
|
)
|
|
8781
9396
|
}, {
|
|
8782
9397
|
key: "batchRegisterDerivative",
|
|
8783
9398
|
value: (function () {
|
|
8784
|
-
var _batchRegisterDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
8785
|
-
var contracts, licenseModuleAddress, _iterator2, _step2, _arg$maxMintingFee, _arg$maxRevenueShare, arg, calculatedDeadline, ipAccount, data, _yield$ipAccount$stat, state, signature, txHash,
|
|
8786
|
-
return _regenerator().w(function (
|
|
8787
|
-
while (1) switch (
|
|
9399
|
+
var _batchRegisterDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(request) {
|
|
9400
|
+
var contracts, licenseModuleAddress, _iterator2, _step2, _arg$maxMintingFee, _arg$maxRevenueShare, arg, calculatedDeadline, ipAccount, data, _yield$ipAccount$stat, state, signature, txHash, _t7, _t8, _t9;
|
|
9401
|
+
return _regenerator().w(function (_context6) {
|
|
9402
|
+
while (1) switch (_context6.p = _context6.n) {
|
|
8788
9403
|
case 0:
|
|
8789
|
-
|
|
9404
|
+
_context6.p = 0;
|
|
8790
9405
|
contracts = [];
|
|
8791
9406
|
licenseModuleAddress = validateAddress(this.licensingModuleClient.address);
|
|
8792
9407
|
_iterator2 = _createForOfIteratorHelper(request.args);
|
|
8793
|
-
|
|
9408
|
+
_context6.p = 1;
|
|
8794
9409
|
_iterator2.s();
|
|
8795
9410
|
case 2:
|
|
8796
9411
|
if ((_step2 = _iterator2.n()).done) {
|
|
8797
|
-
|
|
9412
|
+
_context6.n = 11;
|
|
8798
9413
|
break;
|
|
8799
9414
|
}
|
|
8800
9415
|
arg = _step2.value;
|
|
8801
|
-
|
|
8802
|
-
|
|
9416
|
+
_context6.p = 3;
|
|
9417
|
+
_context6.n = 4;
|
|
8803
9418
|
return this.registerDerivative(_objectSpread2(_objectSpread2({}, arg), {}, {
|
|
8804
9419
|
txOptions: {
|
|
8805
9420
|
encodedTxDataOnly: true
|
|
8806
9421
|
}
|
|
8807
9422
|
}));
|
|
8808
9423
|
case 4:
|
|
8809
|
-
|
|
9424
|
+
_context6.n = 6;
|
|
8810
9425
|
break;
|
|
8811
9426
|
case 5:
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
throw new Error(
|
|
9427
|
+
_context6.p = 5;
|
|
9428
|
+
_t7 = _context6.v;
|
|
9429
|
+
throw new Error(_t7.message.replace("Failed to register derivative:", "").trim());
|
|
8815
9430
|
case 6:
|
|
8816
|
-
|
|
9431
|
+
_context6.n = 7;
|
|
8817
9432
|
return getCalculatedDeadline(this.rpcClient, request.deadline);
|
|
8818
9433
|
case 7:
|
|
8819
|
-
calculatedDeadline =
|
|
9434
|
+
calculatedDeadline = _context6.v;
|
|
8820
9435
|
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(arg.childIpId));
|
|
8821
9436
|
data = viem.encodeFunctionData({
|
|
8822
9437
|
abi: licensingModuleAbi,
|
|
@@ -8825,12 +9440,12 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8825
9440
|
return BigInt(id);
|
|
8826
9441
|
}), arg.licenseTemplate || this.licenseTemplateAddress, viem.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)]
|
|
8827
9442
|
});
|
|
8828
|
-
|
|
9443
|
+
_context6.n = 8;
|
|
8829
9444
|
return ipAccount.state();
|
|
8830
9445
|
case 8:
|
|
8831
|
-
_yield$ipAccount$stat =
|
|
9446
|
+
_yield$ipAccount$stat = _context6.v;
|
|
8832
9447
|
state = _yield$ipAccount$stat.result;
|
|
8833
|
-
|
|
9448
|
+
_context6.n = 9;
|
|
8834
9449
|
return generateOperationSignature({
|
|
8835
9450
|
ipIdAddress: arg.childIpId,
|
|
8836
9451
|
methodType: SignatureMethodType.BATCH_REGISTER_DERIVATIVE,
|
|
@@ -8841,7 +9456,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8841
9456
|
chainId: this.chainId
|
|
8842
9457
|
});
|
|
8843
9458
|
case 9:
|
|
8844
|
-
signature =
|
|
9459
|
+
signature = _context6.v;
|
|
8845
9460
|
contracts.push({
|
|
8846
9461
|
target: arg.childIpId,
|
|
8847
9462
|
allowFailure: false,
|
|
@@ -8852,42 +9467,42 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8852
9467
|
})
|
|
8853
9468
|
});
|
|
8854
9469
|
case 10:
|
|
8855
|
-
|
|
9470
|
+
_context6.n = 2;
|
|
8856
9471
|
break;
|
|
8857
9472
|
case 11:
|
|
8858
|
-
|
|
9473
|
+
_context6.n = 13;
|
|
8859
9474
|
break;
|
|
8860
9475
|
case 12:
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
_iterator2.e(
|
|
9476
|
+
_context6.p = 12;
|
|
9477
|
+
_t8 = _context6.v;
|
|
9478
|
+
_iterator2.e(_t8);
|
|
8864
9479
|
case 13:
|
|
8865
|
-
|
|
9480
|
+
_context6.p = 13;
|
|
8866
9481
|
_iterator2.f();
|
|
8867
|
-
return
|
|
9482
|
+
return _context6.f(13);
|
|
8868
9483
|
case 14:
|
|
8869
|
-
|
|
9484
|
+
_context6.n = 15;
|
|
8870
9485
|
return this.multicall3Client.aggregate3({
|
|
8871
9486
|
calls: contracts
|
|
8872
9487
|
});
|
|
8873
9488
|
case 15:
|
|
8874
|
-
txHash =
|
|
8875
|
-
|
|
9489
|
+
txHash = _context6.v;
|
|
9490
|
+
_context6.n = 16;
|
|
8876
9491
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
8877
9492
|
hash: txHash
|
|
8878
9493
|
}));
|
|
8879
9494
|
case 16:
|
|
8880
|
-
return
|
|
9495
|
+
return _context6.a(2, {
|
|
8881
9496
|
txHash: txHash
|
|
8882
9497
|
});
|
|
8883
9498
|
case 17:
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
return
|
|
9499
|
+
_context6.p = 17;
|
|
9500
|
+
_t9 = _context6.v;
|
|
9501
|
+
return _context6.a(2, handleError(_t9, "Failed to batch register derivative"));
|
|
8887
9502
|
}
|
|
8888
|
-
},
|
|
9503
|
+
}, _callee6, this, [[3, 5], [1, 12, 13, 14], [0, 17]]);
|
|
8889
9504
|
}));
|
|
8890
|
-
function batchRegisterDerivative(
|
|
9505
|
+
function batchRegisterDerivative(_x7) {
|
|
8891
9506
|
return _batchRegisterDerivative.apply(this, arguments);
|
|
8892
9507
|
}
|
|
8893
9508
|
return batchRegisterDerivative;
|
|
@@ -8919,12 +9534,12 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8919
9534
|
}, {
|
|
8920
9535
|
key: "registerDerivativeWithLicenseTokens",
|
|
8921
9536
|
value: (function () {
|
|
8922
|
-
var _registerDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
8923
|
-
var _request$txOptions3, req, isChildIpIdRegistered, txHash,
|
|
8924
|
-
return _regenerator().w(function (
|
|
8925
|
-
while (1) switch (
|
|
9537
|
+
var _registerDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(request) {
|
|
9538
|
+
var _request$txOptions3, req, isChildIpIdRegistered, txHash, _t0;
|
|
9539
|
+
return _regenerator().w(function (_context7) {
|
|
9540
|
+
while (1) switch (_context7.p = _context7.n) {
|
|
8926
9541
|
case 0:
|
|
8927
|
-
|
|
9542
|
+
_context7.p = 0;
|
|
8928
9543
|
req = {
|
|
8929
9544
|
childIpId: validateAddress(request.childIpId),
|
|
8930
9545
|
licenseTokenIds: request.licenseTokenIds.map(function (id) {
|
|
@@ -8933,59 +9548,59 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8933
9548
|
royaltyContext: viem.zeroAddress,
|
|
8934
9549
|
maxRts: validateMaxRts(request.maxRts)
|
|
8935
9550
|
};
|
|
8936
|
-
|
|
9551
|
+
_context7.n = 1;
|
|
8937
9552
|
return this.isRegistered(request.childIpId);
|
|
8938
9553
|
case 1:
|
|
8939
|
-
isChildIpIdRegistered =
|
|
9554
|
+
isChildIpIdRegistered = _context7.v;
|
|
8940
9555
|
if (isChildIpIdRegistered) {
|
|
8941
|
-
|
|
9556
|
+
_context7.n = 2;
|
|
8942
9557
|
break;
|
|
8943
9558
|
}
|
|
8944
9559
|
throw new Error("The child IP with id ".concat(request.childIpId, " is not registered."));
|
|
8945
9560
|
case 2:
|
|
8946
9561
|
if (!(request.licenseTokenIds.length === 0)) {
|
|
8947
|
-
|
|
9562
|
+
_context7.n = 3;
|
|
8948
9563
|
break;
|
|
8949
9564
|
}
|
|
8950
9565
|
throw new Error("The licenseTokenIds must be provided.");
|
|
8951
9566
|
case 3:
|
|
8952
|
-
|
|
9567
|
+
_context7.n = 4;
|
|
8953
9568
|
return this.validateLicenseTokenIds(request.licenseTokenIds);
|
|
8954
9569
|
case 4:
|
|
8955
|
-
request.licenseTokenIds =
|
|
9570
|
+
request.licenseTokenIds = _context7.v;
|
|
8956
9571
|
if (!((_request$txOptions3 = request.txOptions) !== null && _request$txOptions3 !== void 0 && _request$txOptions3.encodedTxDataOnly)) {
|
|
8957
|
-
|
|
9572
|
+
_context7.n = 5;
|
|
8958
9573
|
break;
|
|
8959
9574
|
}
|
|
8960
|
-
return
|
|
9575
|
+
return _context7.a(2, {
|
|
8961
9576
|
encodedTxData: this.licensingModuleClient.registerDerivativeWithLicenseTokensEncode(req)
|
|
8962
9577
|
});
|
|
8963
9578
|
case 5:
|
|
8964
|
-
|
|
9579
|
+
_context7.n = 6;
|
|
8965
9580
|
return this.licensingModuleClient.registerDerivativeWithLicenseTokens(req);
|
|
8966
9581
|
case 6:
|
|
8967
|
-
txHash =
|
|
8968
|
-
|
|
9582
|
+
txHash = _context7.v;
|
|
9583
|
+
_context7.n = 7;
|
|
8969
9584
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
8970
9585
|
hash: txHash
|
|
8971
9586
|
}));
|
|
8972
9587
|
case 7:
|
|
8973
|
-
return
|
|
9588
|
+
return _context7.a(2, {
|
|
8974
9589
|
txHash: txHash
|
|
8975
9590
|
});
|
|
8976
9591
|
case 8:
|
|
8977
|
-
|
|
9592
|
+
_context7.n = 10;
|
|
8978
9593
|
break;
|
|
8979
9594
|
case 9:
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
return
|
|
9595
|
+
_context7.p = 9;
|
|
9596
|
+
_t0 = _context7.v;
|
|
9597
|
+
return _context7.a(2, handleError(_t0, "Failed to register derivative with license tokens"));
|
|
8983
9598
|
case 10:
|
|
8984
|
-
return
|
|
9599
|
+
return _context7.a(2);
|
|
8985
9600
|
}
|
|
8986
|
-
},
|
|
9601
|
+
}, _callee7, this, [[0, 9]]);
|
|
8987
9602
|
}));
|
|
8988
|
-
function registerDerivativeWithLicenseTokens(
|
|
9603
|
+
function registerDerivativeWithLicenseTokens(_x8) {
|
|
8989
9604
|
return _registerDerivativeWithLicenseTokens.apply(this, arguments);
|
|
8990
9605
|
}
|
|
8991
9606
|
return registerDerivativeWithLicenseTokens;
|
|
@@ -9017,14 +9632,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9017
9632
|
}, {
|
|
9018
9633
|
key: "mintAndRegisterIpAssetWithPilTerms",
|
|
9019
9634
|
value: (function () {
|
|
9020
|
-
var _mintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
9021
|
-
var
|
|
9022
|
-
var _request$txOptions4, _yield$transformRegis, transformRequest, encodedTxData, contractCall, rsp, computedLicenseTermsIds, maxLicenseTokensTxHashes,
|
|
9023
|
-
return _regenerator().w(function (
|
|
9024
|
-
while (1) switch (
|
|
9635
|
+
var _mintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(request) {
|
|
9636
|
+
var _this2 = this;
|
|
9637
|
+
var _request$txOptions4, _yield$transformRegis, transformRequest, encodedTxData, contractCall, rsp, computedLicenseTermsIds, maxLicenseTokensTxHashes, _t1;
|
|
9638
|
+
return _regenerator().w(function (_context8) {
|
|
9639
|
+
while (1) switch (_context8.p = _context8.n) {
|
|
9025
9640
|
case 0:
|
|
9026
|
-
|
|
9027
|
-
|
|
9641
|
+
_context8.p = 0;
|
|
9642
|
+
_context8.n = 1;
|
|
9028
9643
|
return transformRegistrationRequest({
|
|
9029
9644
|
request: request,
|
|
9030
9645
|
rpcClient: this.rpcClient,
|
|
@@ -9032,21 +9647,21 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9032
9647
|
chainId: this.chainId
|
|
9033
9648
|
});
|
|
9034
9649
|
case 1:
|
|
9035
|
-
_yield$transformRegis =
|
|
9650
|
+
_yield$transformRegis = _context8.v;
|
|
9036
9651
|
transformRequest = _yield$transformRegis.transformRequest;
|
|
9037
9652
|
encodedTxData = this.licenseAttachmentWorkflowsClient.mintAndRegisterIpAndAttachPilTermsEncode(transformRequest);
|
|
9038
9653
|
if (!((_request$txOptions4 = request.txOptions) !== null && _request$txOptions4 !== void 0 && _request$txOptions4.encodedTxDataOnly)) {
|
|
9039
|
-
|
|
9654
|
+
_context8.n = 2;
|
|
9040
9655
|
break;
|
|
9041
9656
|
}
|
|
9042
|
-
return
|
|
9657
|
+
return _context8.a(2, {
|
|
9043
9658
|
encodedTxData: encodedTxData
|
|
9044
9659
|
});
|
|
9045
9660
|
case 2:
|
|
9046
9661
|
contractCall = function contractCall() {
|
|
9047
|
-
return
|
|
9662
|
+
return _this2.licenseAttachmentWorkflowsClient.mintAndRegisterIpAndAttachPilTerms(transformRequest);
|
|
9048
9663
|
};
|
|
9049
|
-
|
|
9664
|
+
_context8.n = 3;
|
|
9050
9665
|
return this.handleRegistrationWithFees({
|
|
9051
9666
|
options: request.options,
|
|
9052
9667
|
sender: this.walletAddress,
|
|
@@ -9057,14 +9672,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9057
9672
|
txOptions: request.txOptions
|
|
9058
9673
|
});
|
|
9059
9674
|
case 3:
|
|
9060
|
-
rsp =
|
|
9061
|
-
|
|
9675
|
+
rsp = _context8.v;
|
|
9676
|
+
_context8.n = 4;
|
|
9062
9677
|
return this.getLicenseTermsId(transformRequest.licenseTermsData.map(function (data) {
|
|
9063
9678
|
return data.terms;
|
|
9064
9679
|
}));
|
|
9065
9680
|
case 4:
|
|
9066
|
-
computedLicenseTermsIds =
|
|
9067
|
-
|
|
9681
|
+
computedLicenseTermsIds = _context8.v;
|
|
9682
|
+
_context8.n = 5;
|
|
9068
9683
|
return setMaxLicenseTokens({
|
|
9069
9684
|
maxLicenseTokensData: request.licenseTermsData,
|
|
9070
9685
|
licensorIpId: rsp.ipId,
|
|
@@ -9073,20 +9688,20 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9073
9688
|
templateAddress: this.licenseTemplateAddress
|
|
9074
9689
|
});
|
|
9075
9690
|
case 5:
|
|
9076
|
-
maxLicenseTokensTxHashes =
|
|
9077
|
-
return
|
|
9691
|
+
maxLicenseTokensTxHashes = _context8.v;
|
|
9692
|
+
return _context8.a(2, _objectSpread2(_objectSpread2({}, rsp), {}, {
|
|
9078
9693
|
licenseTermsIds: computedLicenseTermsIds
|
|
9079
9694
|
}, maxLicenseTokensTxHashes.length > 0 && {
|
|
9080
9695
|
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
|
9081
9696
|
}));
|
|
9082
9697
|
case 6:
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
return
|
|
9698
|
+
_context8.p = 6;
|
|
9699
|
+
_t1 = _context8.v;
|
|
9700
|
+
return _context8.a(2, handleError(_t1, "Failed to mint and register IP and attach PIL terms"));
|
|
9086
9701
|
}
|
|
9087
|
-
},
|
|
9702
|
+
}, _callee8, this, [[0, 6]]);
|
|
9088
9703
|
}));
|
|
9089
|
-
function mintAndRegisterIpAssetWithPilTerms(
|
|
9704
|
+
function mintAndRegisterIpAssetWithPilTerms(_x9) {
|
|
9090
9705
|
return _mintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
|
|
9091
9706
|
}
|
|
9092
9707
|
return mintAndRegisterIpAssetWithPilTerms;
|
|
@@ -9094,64 +9709,68 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9094
9709
|
/**
|
|
9095
9710
|
* Batch mint an NFT from a collection and register it as an IP.
|
|
9096
9711
|
*
|
|
9712
|
+
* @remark For better gas efficiency, consider using {@link batchRegisterIpAssetsWithOptimizedWorkflows} instead.
|
|
9713
|
+
* The optimized workflows method provides intelligent transaction batching, automatic token handling.
|
|
9714
|
+
*
|
|
9097
9715
|
* 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.
|
|
9098
9716
|
*/
|
|
9099
9717
|
)
|
|
9100
9718
|
}, {
|
|
9101
9719
|
key: "batchMintAndRegisterIpAssetWithPilTerms",
|
|
9102
9720
|
value: (function () {
|
|
9103
|
-
var _batchMintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
9104
|
-
var
|
|
9105
|
-
|
|
9106
|
-
|
|
9721
|
+
var _batchMintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(request) {
|
|
9722
|
+
var _this3 = this;
|
|
9723
|
+
var calldata, _iterator3, _step3, arg, result, txHash, txReceipt, results, _loop, j, _t10, _t11;
|
|
9724
|
+
return _regenerator().w(function (_context0) {
|
|
9725
|
+
while (1) switch (_context0.p = _context0.n) {
|
|
9107
9726
|
case 0:
|
|
9108
|
-
|
|
9727
|
+
_context0.p = 0;
|
|
9109
9728
|
calldata = [];
|
|
9110
9729
|
_iterator3 = _createForOfIteratorHelper(request.args);
|
|
9111
|
-
|
|
9730
|
+
_context0.p = 1;
|
|
9112
9731
|
_iterator3.s();
|
|
9113
9732
|
case 2:
|
|
9114
9733
|
if ((_step3 = _iterator3.n()).done) {
|
|
9115
|
-
|
|
9734
|
+
_context0.n = 5;
|
|
9116
9735
|
break;
|
|
9117
9736
|
}
|
|
9118
9737
|
arg = _step3.value;
|
|
9119
|
-
|
|
9738
|
+
_context0.n = 3;
|
|
9120
9739
|
return this.mintAndRegisterIpAssetWithPilTerms(_objectSpread2(_objectSpread2({}, arg), {}, {
|
|
9121
9740
|
txOptions: {
|
|
9122
9741
|
encodedTxDataOnly: true
|
|
9123
9742
|
}
|
|
9124
9743
|
}));
|
|
9125
9744
|
case 3:
|
|
9126
|
-
result =
|
|
9745
|
+
result = _context0.v;
|
|
9127
9746
|
calldata.push(result.encodedTxData.data);
|
|
9128
9747
|
case 4:
|
|
9129
|
-
|
|
9748
|
+
_context0.n = 2;
|
|
9130
9749
|
break;
|
|
9131
9750
|
case 5:
|
|
9132
|
-
|
|
9751
|
+
_context0.n = 7;
|
|
9133
9752
|
break;
|
|
9134
9753
|
case 6:
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
_iterator3.e(
|
|
9754
|
+
_context0.p = 6;
|
|
9755
|
+
_t10 = _context0.v;
|
|
9756
|
+
_iterator3.e(_t10);
|
|
9138
9757
|
case 7:
|
|
9139
|
-
|
|
9758
|
+
_context0.p = 7;
|
|
9140
9759
|
_iterator3.f();
|
|
9141
|
-
return
|
|
9760
|
+
return _context0.f(7);
|
|
9142
9761
|
case 8:
|
|
9143
|
-
|
|
9762
|
+
_context0.n = 9;
|
|
9144
9763
|
return this.licenseAttachmentWorkflowsClient.multicall({
|
|
9145
9764
|
data: calldata
|
|
9146
9765
|
});
|
|
9147
9766
|
case 9:
|
|
9148
|
-
txHash =
|
|
9149
|
-
|
|
9767
|
+
txHash = _context0.v;
|
|
9768
|
+
_context0.n = 10;
|
|
9150
9769
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
9151
9770
|
hash: txHash
|
|
9152
9771
|
}));
|
|
9153
9772
|
case 10:
|
|
9154
|
-
txReceipt =
|
|
9773
|
+
txReceipt = _context0.v;
|
|
9155
9774
|
results = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt).map(function (log) {
|
|
9156
9775
|
return {
|
|
9157
9776
|
ipId: log.ipId,
|
|
@@ -9159,54 +9778,80 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9159
9778
|
spgNftContract: log.tokenContract,
|
|
9160
9779
|
licenseTermsIds: []
|
|
9161
9780
|
};
|
|
9162
|
-
}); //
|
|
9781
|
+
}); // Get license terms id and max license tokens mapping relationship by the sequence of the request.args
|
|
9782
|
+
_loop = /*#__PURE__*/_regenerator().m(function _loop() {
|
|
9783
|
+
var licenseTerms, termsIndexes, licenseTermsData, licenseTermsIds, i, licenseTermsDataInput, validatedTerms, resolvedIds, filteredLicenseTermsIds, maxLicenseTokensTxHashes;
|
|
9784
|
+
return _regenerator().w(function (_context9) {
|
|
9785
|
+
while (1) switch (_context9.n) {
|
|
9786
|
+
case 0:
|
|
9787
|
+
licenseTerms = [];
|
|
9788
|
+
termsIndexes = [];
|
|
9789
|
+
licenseTermsData = request.args[j].licenseTermsData;
|
|
9790
|
+
licenseTermsIds = new Array(licenseTermsData.length).fill(null);
|
|
9791
|
+
for (i = 0; i < licenseTermsData.length; i++) {
|
|
9792
|
+
licenseTermsDataInput = licenseTermsData[i];
|
|
9793
|
+
if (licenseTermsDataInput.terms) {
|
|
9794
|
+
validatedTerms = PILFlavor.validateLicenseTerms(licenseTermsDataInput.terms, _this3.chainId);
|
|
9795
|
+
validatedTerms.commercialRevShare = getRevenueShare(validatedTerms.commercialRevShare);
|
|
9796
|
+
licenseTerms.push(validatedTerms);
|
|
9797
|
+
termsIndexes.push(i);
|
|
9798
|
+
} else if (licenseTermsDataInput.licenseTermsId !== undefined) {
|
|
9799
|
+
licenseTermsIds[i] = BigInt(licenseTermsDataInput.licenseTermsId);
|
|
9800
|
+
}
|
|
9801
|
+
}
|
|
9802
|
+
_context9.n = 1;
|
|
9803
|
+
return _this3.getLicenseTermsId(licenseTerms);
|
|
9804
|
+
case 1:
|
|
9805
|
+
resolvedIds = _context9.v;
|
|
9806
|
+
termsIndexes.forEach(function (value, index) {
|
|
9807
|
+
licenseTermsIds[value] = resolvedIds[index];
|
|
9808
|
+
});
|
|
9809
|
+
filteredLicenseTermsIds = licenseTermsIds.filter(function (id) {
|
|
9810
|
+
return id !== null;
|
|
9811
|
+
});
|
|
9812
|
+
results[j].licenseTermsIds = filteredLicenseTermsIds;
|
|
9813
|
+
_context9.n = 2;
|
|
9814
|
+
return setMaxLicenseTokens({
|
|
9815
|
+
maxLicenseTokensData: licenseTermsData,
|
|
9816
|
+
licensorIpId: results[j].ipId,
|
|
9817
|
+
licenseTermsIds: filteredLicenseTermsIds,
|
|
9818
|
+
totalLicenseTokenLimitHookClient: _this3.totalLicenseTokenLimitHookClient,
|
|
9819
|
+
templateAddress: _this3.licenseTemplateAddress
|
|
9820
|
+
});
|
|
9821
|
+
case 2:
|
|
9822
|
+
maxLicenseTokensTxHashes = _context9.v;
|
|
9823
|
+
if (maxLicenseTokensTxHashes.length > 0) {
|
|
9824
|
+
results[j].maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
|
|
9825
|
+
}
|
|
9826
|
+
case 3:
|
|
9827
|
+
return _context9.a(2);
|
|
9828
|
+
}
|
|
9829
|
+
}, _loop);
|
|
9830
|
+
});
|
|
9163
9831
|
j = 0;
|
|
9164
9832
|
case 11:
|
|
9165
9833
|
if (!(j < request.args.length)) {
|
|
9166
|
-
|
|
9834
|
+
_context0.n = 13;
|
|
9167
9835
|
break;
|
|
9168
9836
|
}
|
|
9169
|
-
|
|
9170
|
-
licenseTermsData = request.args[j].licenseTermsData;
|
|
9171
|
-
for (i = 0; i < licenseTermsData.length; i++) {
|
|
9172
|
-
licenseTerm = PILFlavor.validateLicenseTerms(licenseTermsData[i].terms, this.chainId);
|
|
9173
|
-
licenseTerms.push(licenseTerm);
|
|
9174
|
-
}
|
|
9175
|
-
_context8.n = 12;
|
|
9176
|
-
return this.getLicenseTermsId(licenseTerms);
|
|
9837
|
+
return _context0.d(_regeneratorValues(_loop()), 12);
|
|
9177
9838
|
case 12:
|
|
9178
|
-
licenseTermsIds = _context8.v;
|
|
9179
|
-
results[j].licenseTermsIds = licenseTermsIds;
|
|
9180
|
-
_context8.n = 13;
|
|
9181
|
-
return setMaxLicenseTokens({
|
|
9182
|
-
maxLicenseTokensData: licenseTermsData,
|
|
9183
|
-
licensorIpId: results[j].ipId,
|
|
9184
|
-
licenseTermsIds: licenseTermsIds,
|
|
9185
|
-
totalLicenseTokenLimitHookClient: this.totalLicenseTokenLimitHookClient,
|
|
9186
|
-
templateAddress: this.licenseTemplateAddress
|
|
9187
|
-
});
|
|
9188
|
-
case 13:
|
|
9189
|
-
maxLicenseTokensTxHashes = _context8.v;
|
|
9190
|
-
if (maxLicenseTokensTxHashes.length > 0) {
|
|
9191
|
-
results[j].maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
|
|
9192
|
-
}
|
|
9193
|
-
case 14:
|
|
9194
9839
|
j++;
|
|
9195
|
-
|
|
9840
|
+
_context0.n = 11;
|
|
9196
9841
|
break;
|
|
9197
|
-
case
|
|
9198
|
-
return
|
|
9842
|
+
case 13:
|
|
9843
|
+
return _context0.a(2, {
|
|
9199
9844
|
txHash: txHash,
|
|
9200
9845
|
results: results
|
|
9201
9846
|
});
|
|
9202
|
-
case
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
return
|
|
9847
|
+
case 14:
|
|
9848
|
+
_context0.p = 14;
|
|
9849
|
+
_t11 = _context0.v;
|
|
9850
|
+
return _context0.a(2, handleError(_t11, "Failed to batch mint and register IP and attach PIL terms"));
|
|
9206
9851
|
}
|
|
9207
|
-
},
|
|
9852
|
+
}, _callee9, this, [[1, 6, 7, 8], [0, 14]]);
|
|
9208
9853
|
}));
|
|
9209
|
-
function batchMintAndRegisterIpAssetWithPilTerms(
|
|
9854
|
+
function batchMintAndRegisterIpAssetWithPilTerms(_x0) {
|
|
9210
9855
|
return _batchMintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
|
|
9211
9856
|
}
|
|
9212
9857
|
return batchMintAndRegisterIpAssetWithPilTerms;
|
|
@@ -9239,14 +9884,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9239
9884
|
}, {
|
|
9240
9885
|
key: "registerIpAndAttachPilTerms",
|
|
9241
9886
|
value: (function () {
|
|
9242
|
-
var _registerIpAndAttachPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
9243
|
-
var _request$txOptions5, ipIdAddress, isRegistered, _yield$validateLicens, licenseTerms, _yield$transformRegis2, _transformRequest, txHash, txReceipt, log, licenseTermsIds, maxLicenseTokensTxHashes,
|
|
9244
|
-
return _regenerator().w(function (
|
|
9245
|
-
while (1) switch (
|
|
9887
|
+
var _registerIpAndAttachPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(request) {
|
|
9888
|
+
var _request$txOptions5, ipIdAddress, isRegistered, _yield$validateLicens, licenseTerms, _yield$transformRegis2, _transformRequest, txHash, txReceipt, log, licenseTermsIds, maxLicenseTokensTxHashes, _t12;
|
|
9889
|
+
return _regenerator().w(function (_context1) {
|
|
9890
|
+
while (1) switch (_context1.p = _context1.n) {
|
|
9246
9891
|
case 0:
|
|
9247
|
-
|
|
9892
|
+
_context1.p = 0;
|
|
9248
9893
|
request.tokenId = BigInt(request.tokenId);
|
|
9249
|
-
|
|
9894
|
+
_context1.n = 1;
|
|
9250
9895
|
return getIpIdAddress({
|
|
9251
9896
|
nftContract: request.nftContract,
|
|
9252
9897
|
tokenId: request.tokenId,
|
|
@@ -9255,23 +9900,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9255
9900
|
chainId: this.chainId
|
|
9256
9901
|
});
|
|
9257
9902
|
case 1:
|
|
9258
|
-
ipIdAddress =
|
|
9259
|
-
|
|
9903
|
+
ipIdAddress = _context1.v;
|
|
9904
|
+
_context1.n = 2;
|
|
9260
9905
|
return this.isRegistered(ipIdAddress);
|
|
9261
9906
|
case 2:
|
|
9262
|
-
isRegistered =
|
|
9907
|
+
isRegistered = _context1.v;
|
|
9263
9908
|
if (!isRegistered) {
|
|
9264
|
-
|
|
9909
|
+
_context1.n = 3;
|
|
9265
9910
|
break;
|
|
9266
9911
|
}
|
|
9267
9912
|
throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
|
|
9268
9913
|
case 3:
|
|
9269
|
-
|
|
9914
|
+
_context1.n = 4;
|
|
9270
9915
|
return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
|
|
9271
9916
|
case 4:
|
|
9272
|
-
_yield$validateLicens =
|
|
9917
|
+
_yield$validateLicens = _context1.v;
|
|
9273
9918
|
licenseTerms = _yield$validateLicens.licenseTerms;
|
|
9274
|
-
|
|
9919
|
+
_context1.n = 5;
|
|
9275
9920
|
return transformRegistrationRequest({
|
|
9276
9921
|
request: request,
|
|
9277
9922
|
rpcClient: this.rpcClient,
|
|
@@ -9279,32 +9924,32 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9279
9924
|
chainId: this.chainId
|
|
9280
9925
|
});
|
|
9281
9926
|
case 5:
|
|
9282
|
-
_yield$transformRegis2 =
|
|
9927
|
+
_yield$transformRegis2 = _context1.v;
|
|
9283
9928
|
_transformRequest = _yield$transformRegis2.transformRequest;
|
|
9284
9929
|
if (!((_request$txOptions5 = request.txOptions) !== null && _request$txOptions5 !== void 0 && _request$txOptions5.encodedTxDataOnly)) {
|
|
9285
|
-
|
|
9930
|
+
_context1.n = 6;
|
|
9286
9931
|
break;
|
|
9287
9932
|
}
|
|
9288
|
-
return
|
|
9933
|
+
return _context1.a(2, {
|
|
9289
9934
|
encodedTxData: this.licenseAttachmentWorkflowsClient.registerIpAndAttachPilTermsEncode(_transformRequest)
|
|
9290
9935
|
});
|
|
9291
9936
|
case 6:
|
|
9292
|
-
|
|
9937
|
+
_context1.n = 7;
|
|
9293
9938
|
return this.licenseAttachmentWorkflowsClient.registerIpAndAttachPilTerms(_transformRequest);
|
|
9294
9939
|
case 7:
|
|
9295
|
-
txHash =
|
|
9296
|
-
|
|
9940
|
+
txHash = _context1.v;
|
|
9941
|
+
_context1.n = 8;
|
|
9297
9942
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
9298
9943
|
hash: txHash
|
|
9299
9944
|
}));
|
|
9300
9945
|
case 8:
|
|
9301
|
-
txReceipt =
|
|
9946
|
+
txReceipt = _context1.v;
|
|
9302
9947
|
log = this.getIpIdAndTokenIdsFromEvent(txReceipt)[0];
|
|
9303
|
-
|
|
9948
|
+
_context1.n = 9;
|
|
9304
9949
|
return this.getLicenseTermsId(licenseTerms);
|
|
9305
9950
|
case 9:
|
|
9306
|
-
licenseTermsIds =
|
|
9307
|
-
|
|
9951
|
+
licenseTermsIds = _context1.v;
|
|
9952
|
+
_context1.n = 10;
|
|
9308
9953
|
return setMaxLicenseTokens({
|
|
9309
9954
|
maxLicenseTokensData: request.licenseTermsData,
|
|
9310
9955
|
licensorIpId: log.ipId,
|
|
@@ -9313,26 +9958,26 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9313
9958
|
templateAddress: this.licenseTemplateAddress
|
|
9314
9959
|
});
|
|
9315
9960
|
case 10:
|
|
9316
|
-
maxLicenseTokensTxHashes =
|
|
9317
|
-
return
|
|
9961
|
+
maxLicenseTokensTxHashes = _context1.v;
|
|
9962
|
+
return _context1.a(2, _objectSpread2(_objectSpread2({
|
|
9318
9963
|
txHash: txHash,
|
|
9319
9964
|
licenseTermsIds: licenseTermsIds
|
|
9320
9965
|
}, maxLicenseTokensTxHashes.length > 0 && {
|
|
9321
9966
|
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
|
9322
9967
|
}), log));
|
|
9323
9968
|
case 11:
|
|
9324
|
-
|
|
9969
|
+
_context1.n = 13;
|
|
9325
9970
|
break;
|
|
9326
9971
|
case 12:
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
return
|
|
9972
|
+
_context1.p = 12;
|
|
9973
|
+
_t12 = _context1.v;
|
|
9974
|
+
return _context1.a(2, handleError(_t12, "Failed to register IP and attach PIL terms"));
|
|
9330
9975
|
case 13:
|
|
9331
|
-
return
|
|
9976
|
+
return _context1.a(2);
|
|
9332
9977
|
}
|
|
9333
|
-
},
|
|
9978
|
+
}, _callee0, this, [[0, 12]]);
|
|
9334
9979
|
}));
|
|
9335
|
-
function registerIpAndAttachPilTerms(
|
|
9980
|
+
function registerIpAndAttachPilTerms(_x1) {
|
|
9336
9981
|
return _registerIpAndAttachPilTerms.apply(this, arguments);
|
|
9337
9982
|
}
|
|
9338
9983
|
return registerIpAndAttachPilTerms;
|
|
@@ -9365,15 +10010,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9365
10010
|
}, {
|
|
9366
10011
|
key: "registerDerivativeIp",
|
|
9367
10012
|
value: (function () {
|
|
9368
|
-
var _registerDerivativeIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10013
|
+
var _registerDerivativeIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(request) {
|
|
9369
10014
|
var _this4 = this;
|
|
9370
|
-
var _request$txOptions6, _request$
|
|
9371
|
-
return _regenerator().w(function (
|
|
9372
|
-
while (1) switch (
|
|
10015
|
+
var _request$txOptions6, _request$options, tokenId, ipIdAddress, isRegistered, _yield$transformRegis3, _transformRequest2, encodedTxData, contractCall, _t13;
|
|
10016
|
+
return _regenerator().w(function (_context10) {
|
|
10017
|
+
while (1) switch (_context10.p = _context10.n) {
|
|
9373
10018
|
case 0:
|
|
9374
|
-
|
|
10019
|
+
_context10.p = 0;
|
|
9375
10020
|
tokenId = BigInt(request.tokenId);
|
|
9376
|
-
|
|
10021
|
+
_context10.n = 1;
|
|
9377
10022
|
return getIpIdAddress({
|
|
9378
10023
|
nftContract: request.nftContract,
|
|
9379
10024
|
tokenId: tokenId,
|
|
@@ -9382,18 +10027,18 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9382
10027
|
chainId: this.chainId
|
|
9383
10028
|
});
|
|
9384
10029
|
case 1:
|
|
9385
|
-
ipIdAddress =
|
|
9386
|
-
|
|
10030
|
+
ipIdAddress = _context10.v;
|
|
10031
|
+
_context10.n = 2;
|
|
9387
10032
|
return this.isRegistered(ipIdAddress);
|
|
9388
10033
|
case 2:
|
|
9389
|
-
isRegistered =
|
|
10034
|
+
isRegistered = _context10.v;
|
|
9390
10035
|
if (!isRegistered) {
|
|
9391
|
-
|
|
10036
|
+
_context10.n = 3;
|
|
9392
10037
|
break;
|
|
9393
10038
|
}
|
|
9394
10039
|
throw new Error("The NFT with id ".concat(tokenId, " is already registered as IP."));
|
|
9395
10040
|
case 3:
|
|
9396
|
-
|
|
10041
|
+
_context10.n = 4;
|
|
9397
10042
|
return transformRegistrationRequest({
|
|
9398
10043
|
request: request,
|
|
9399
10044
|
rpcClient: this.rpcClient,
|
|
@@ -9401,23 +10046,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9401
10046
|
chainId: this.chainId
|
|
9402
10047
|
});
|
|
9403
10048
|
case 4:
|
|
9404
|
-
_yield$transformRegis3 =
|
|
10049
|
+
_yield$transformRegis3 = _context10.v;
|
|
9405
10050
|
_transformRequest2 = _yield$transformRegis3.transformRequest;
|
|
9406
10051
|
encodedTxData = this.derivativeWorkflowsClient.registerIpAndMakeDerivativeEncode(_transformRequest2);
|
|
9407
10052
|
if (!((_request$txOptions6 = request.txOptions) !== null && _request$txOptions6 !== void 0 && _request$txOptions6.encodedTxDataOnly)) {
|
|
9408
|
-
|
|
10053
|
+
_context10.n = 5;
|
|
9409
10054
|
break;
|
|
9410
10055
|
}
|
|
9411
|
-
return
|
|
10056
|
+
return _context10.a(2, {
|
|
9412
10057
|
encodedTxData: encodedTxData
|
|
9413
10058
|
});
|
|
9414
10059
|
case 5:
|
|
9415
10060
|
contractCall = function contractCall() {
|
|
9416
10061
|
return _this4.derivativeWorkflowsClient.registerIpAndMakeDerivative(_transformRequest2);
|
|
9417
10062
|
};
|
|
9418
|
-
return
|
|
10063
|
+
return _context10.a(2, this.handleRegistrationWithFees({
|
|
9419
10064
|
options: _objectSpread2(_objectSpread2({}, request.options), {}, {
|
|
9420
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$
|
|
10065
|
+
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options = request.options) === null || _request$options === void 0 ? void 0 : _request$options.wipOptions), {}, {
|
|
9421
10066
|
useMulticallWhenPossible: false
|
|
9422
10067
|
})
|
|
9423
10068
|
}),
|
|
@@ -9429,13 +10074,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9429
10074
|
txOptions: request.txOptions
|
|
9430
10075
|
}));
|
|
9431
10076
|
case 6:
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
return
|
|
10077
|
+
_context10.p = 6;
|
|
10078
|
+
_t13 = _context10.v;
|
|
10079
|
+
return _context10.a(2, handleError(_t13, "Failed to register derivative IP"));
|
|
9435
10080
|
}
|
|
9436
|
-
},
|
|
10081
|
+
}, _callee1, this, [[0, 6]]);
|
|
9437
10082
|
}));
|
|
9438
|
-
function registerDerivativeIp(
|
|
10083
|
+
function registerDerivativeIp(_x10) {
|
|
9439
10084
|
return _registerDerivativeIp.apply(this, arguments);
|
|
9440
10085
|
}
|
|
9441
10086
|
return registerDerivativeIp;
|
|
@@ -9467,15 +10112,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9467
10112
|
}, {
|
|
9468
10113
|
key: "mintAndRegisterIpAndMakeDerivative",
|
|
9469
10114
|
value: (function () {
|
|
9470
|
-
var _mintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10115
|
+
var _mintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(request) {
|
|
9471
10116
|
var _this5 = this;
|
|
9472
|
-
var _request$txOptions7, spgNftContract, _yield$transformRegis4, _transformRequest3, encodedTxData, contractCall,
|
|
9473
|
-
return _regenerator().w(function (
|
|
9474
|
-
while (1) switch (
|
|
10117
|
+
var _request$txOptions7, spgNftContract, _yield$transformRegis4, _transformRequest3, encodedTxData, contractCall, _t14;
|
|
10118
|
+
return _regenerator().w(function (_context11) {
|
|
10119
|
+
while (1) switch (_context11.p = _context11.n) {
|
|
9475
10120
|
case 0:
|
|
9476
|
-
|
|
10121
|
+
_context11.p = 0;
|
|
9477
10122
|
spgNftContract = validateAddress(request.spgNftContract);
|
|
9478
|
-
|
|
10123
|
+
_context11.n = 1;
|
|
9479
10124
|
return transformRegistrationRequest({
|
|
9480
10125
|
request: request,
|
|
9481
10126
|
rpcClient: this.rpcClient,
|
|
@@ -9483,21 +10128,21 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9483
10128
|
chainId: this.chainId
|
|
9484
10129
|
});
|
|
9485
10130
|
case 1:
|
|
9486
|
-
_yield$transformRegis4 =
|
|
10131
|
+
_yield$transformRegis4 = _context11.v;
|
|
9487
10132
|
_transformRequest3 = _yield$transformRegis4.transformRequest;
|
|
9488
10133
|
encodedTxData = this.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeEncode(_transformRequest3);
|
|
9489
10134
|
if (!((_request$txOptions7 = request.txOptions) !== null && _request$txOptions7 !== void 0 && _request$txOptions7.encodedTxDataOnly)) {
|
|
9490
|
-
|
|
10135
|
+
_context11.n = 2;
|
|
9491
10136
|
break;
|
|
9492
10137
|
}
|
|
9493
|
-
return
|
|
10138
|
+
return _context11.a(2, {
|
|
9494
10139
|
encodedTxData: encodedTxData
|
|
9495
10140
|
});
|
|
9496
10141
|
case 2:
|
|
9497
10142
|
contractCall = function contractCall() {
|
|
9498
10143
|
return _this5.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivative(_transformRequest3);
|
|
9499
10144
|
};
|
|
9500
|
-
return
|
|
10145
|
+
return _context11.a(2, this.handleRegistrationWithFees({
|
|
9501
10146
|
options: request.options,
|
|
9502
10147
|
sender: this.walletAddress,
|
|
9503
10148
|
spgSpenderAddress: this.derivativeWorkflowsClient.address,
|
|
@@ -9508,13 +10153,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9508
10153
|
txOptions: request.txOptions
|
|
9509
10154
|
}));
|
|
9510
10155
|
case 3:
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
return
|
|
10156
|
+
_context11.p = 3;
|
|
10157
|
+
_t14 = _context11.v;
|
|
10158
|
+
return _context11.a(2, handleError(_t14, "Failed to mint and register IP and make derivative"));
|
|
9514
10159
|
}
|
|
9515
|
-
},
|
|
10160
|
+
}, _callee10, this, [[0, 3]]);
|
|
9516
10161
|
}));
|
|
9517
|
-
function mintAndRegisterIpAndMakeDerivative(
|
|
10162
|
+
function mintAndRegisterIpAndMakeDerivative(_x11) {
|
|
9518
10163
|
return _mintAndRegisterIpAndMakeDerivative.apply(this, arguments);
|
|
9519
10164
|
}
|
|
9520
10165
|
return mintAndRegisterIpAndMakeDerivative;
|
|
@@ -9522,83 +10167,86 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9522
10167
|
/**
|
|
9523
10168
|
* Batch mint an NFT from a collection and register it as a derivative IP without license tokens.
|
|
9524
10169
|
*
|
|
10170
|
+
* @remark For better gas efficiency, consider using {@link batchRegisterIpAssetsWithOptimizedWorkflows} instead.
|
|
10171
|
+
* The optimized workflows method provides intelligent transaction batching, automatic token handling.
|
|
10172
|
+
*
|
|
9525
10173
|
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
|
9526
10174
|
*/
|
|
9527
10175
|
)
|
|
9528
10176
|
}, {
|
|
9529
10177
|
key: "batchMintAndRegisterIpAndMakeDerivative",
|
|
9530
10178
|
value: (function () {
|
|
9531
|
-
var _batchMintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
9532
|
-
var calldata, _iterator4, _step4, arg, result, txHash, txReceipt,
|
|
9533
|
-
return _regenerator().w(function (
|
|
9534
|
-
while (1) switch (
|
|
10179
|
+
var _batchMintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(request) {
|
|
10180
|
+
var calldata, _iterator4, _step4, arg, result, txHash, txReceipt, _t15, _t16, _t17;
|
|
10181
|
+
return _regenerator().w(function (_context12) {
|
|
10182
|
+
while (1) switch (_context12.p = _context12.n) {
|
|
9535
10183
|
case 0:
|
|
9536
|
-
|
|
10184
|
+
_context12.p = 0;
|
|
9537
10185
|
calldata = [];
|
|
9538
10186
|
_iterator4 = _createForOfIteratorHelper(request.args);
|
|
9539
|
-
|
|
10187
|
+
_context12.p = 1;
|
|
9540
10188
|
_iterator4.s();
|
|
9541
10189
|
case 2:
|
|
9542
10190
|
if ((_step4 = _iterator4.n()).done) {
|
|
9543
|
-
|
|
10191
|
+
_context12.n = 7;
|
|
9544
10192
|
break;
|
|
9545
10193
|
}
|
|
9546
10194
|
arg = _step4.value;
|
|
9547
|
-
|
|
9548
|
-
|
|
10195
|
+
_context12.p = 3;
|
|
10196
|
+
_context12.n = 4;
|
|
9549
10197
|
return this.mintAndRegisterIpAndMakeDerivative(_objectSpread2(_objectSpread2({}, arg), {}, {
|
|
9550
10198
|
txOptions: {
|
|
9551
10199
|
encodedTxDataOnly: true
|
|
9552
10200
|
}
|
|
9553
10201
|
}));
|
|
9554
10202
|
case 4:
|
|
9555
|
-
result =
|
|
10203
|
+
result = _context12.v;
|
|
9556
10204
|
calldata.push(result.encodedTxData.data);
|
|
9557
|
-
|
|
10205
|
+
_context12.n = 6;
|
|
9558
10206
|
break;
|
|
9559
10207
|
case 5:
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
throw new Error(
|
|
10208
|
+
_context12.p = 5;
|
|
10209
|
+
_t15 = _context12.v;
|
|
10210
|
+
throw new Error(_t15.message.replace("Failed to mint and register IP and make derivative: ", "").trim());
|
|
9563
10211
|
case 6:
|
|
9564
|
-
|
|
10212
|
+
_context12.n = 2;
|
|
9565
10213
|
break;
|
|
9566
10214
|
case 7:
|
|
9567
|
-
|
|
10215
|
+
_context12.n = 9;
|
|
9568
10216
|
break;
|
|
9569
10217
|
case 8:
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
_iterator4.e(
|
|
10218
|
+
_context12.p = 8;
|
|
10219
|
+
_t16 = _context12.v;
|
|
10220
|
+
_iterator4.e(_t16);
|
|
9573
10221
|
case 9:
|
|
9574
|
-
|
|
10222
|
+
_context12.p = 9;
|
|
9575
10223
|
_iterator4.f();
|
|
9576
|
-
return
|
|
10224
|
+
return _context12.f(9);
|
|
9577
10225
|
case 10:
|
|
9578
|
-
|
|
10226
|
+
_context12.n = 11;
|
|
9579
10227
|
return this.derivativeWorkflowsClient.multicall({
|
|
9580
10228
|
data: calldata
|
|
9581
10229
|
});
|
|
9582
10230
|
case 11:
|
|
9583
|
-
txHash =
|
|
9584
|
-
|
|
10231
|
+
txHash = _context12.v;
|
|
10232
|
+
_context12.n = 12;
|
|
9585
10233
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
9586
10234
|
hash: txHash
|
|
9587
10235
|
}));
|
|
9588
10236
|
case 12:
|
|
9589
|
-
txReceipt =
|
|
9590
|
-
return
|
|
10237
|
+
txReceipt = _context12.v;
|
|
10238
|
+
return _context12.a(2, {
|
|
9591
10239
|
txHash: txHash,
|
|
9592
10240
|
results: this.getIpIdAndTokenIdsFromEvent(txReceipt, "spgNftContract")
|
|
9593
10241
|
});
|
|
9594
10242
|
case 13:
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
return
|
|
10243
|
+
_context12.p = 13;
|
|
10244
|
+
_t17 = _context12.v;
|
|
10245
|
+
return _context12.a(2, handleError(_t17, "Failed to batch mint and register IP and make derivative"));
|
|
9598
10246
|
}
|
|
9599
|
-
},
|
|
10247
|
+
}, _callee11, this, [[3, 5], [1, 8, 9, 10], [0, 13]]);
|
|
9600
10248
|
}));
|
|
9601
|
-
function batchMintAndRegisterIpAndMakeDerivative(
|
|
10249
|
+
function batchMintAndRegisterIpAndMakeDerivative(_x12) {
|
|
9602
10250
|
return _batchMintAndRegisterIpAndMakeDerivative.apply(this, arguments);
|
|
9603
10251
|
}
|
|
9604
10252
|
return batchMintAndRegisterIpAndMakeDerivative;
|
|
@@ -9629,52 +10277,52 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9629
10277
|
}, {
|
|
9630
10278
|
key: "mintAndRegisterIp",
|
|
9631
10279
|
value: (function () {
|
|
9632
|
-
var _mintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10280
|
+
var _mintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(request) {
|
|
9633
10281
|
var _this6 = this;
|
|
9634
|
-
var _request$txOptions8, _request$
|
|
9635
|
-
return _regenerator().w(function (
|
|
9636
|
-
while (1) switch (
|
|
10282
|
+
var _request$txOptions8, _request$options2, object, encodedTxData, contractCall, _t18;
|
|
10283
|
+
return _regenerator().w(function (_context13) {
|
|
10284
|
+
while (1) switch (_context13.p = _context13.n) {
|
|
9637
10285
|
case 0:
|
|
9638
|
-
|
|
9639
|
-
|
|
10286
|
+
_context13.p = 0;
|
|
10287
|
+
object = {
|
|
9640
10288
|
spgNftContract: validateAddress(request.spgNftContract),
|
|
9641
10289
|
recipient: validateAddress(request.recipient || this.walletAddress),
|
|
9642
10290
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
|
9643
10291
|
allowDuplicates: request.allowDuplicates || true
|
|
9644
10292
|
};
|
|
9645
|
-
encodedTxData = this.registrationWorkflowsClient.mintAndRegisterIpEncode(
|
|
10293
|
+
encodedTxData = this.registrationWorkflowsClient.mintAndRegisterIpEncode(object);
|
|
9646
10294
|
if (!((_request$txOptions8 = request.txOptions) !== null && _request$txOptions8 !== void 0 && _request$txOptions8.encodedTxDataOnly)) {
|
|
9647
|
-
|
|
10295
|
+
_context13.n = 1;
|
|
9648
10296
|
break;
|
|
9649
10297
|
}
|
|
9650
|
-
return
|
|
10298
|
+
return _context13.a(2, {
|
|
9651
10299
|
encodedTxData: encodedTxData
|
|
9652
10300
|
});
|
|
9653
10301
|
case 1:
|
|
9654
10302
|
contractCall = function contractCall() {
|
|
9655
|
-
return _this6.registrationWorkflowsClient.mintAndRegisterIp(
|
|
10303
|
+
return _this6.registrationWorkflowsClient.mintAndRegisterIp(object);
|
|
9656
10304
|
};
|
|
9657
|
-
return
|
|
10305
|
+
return _context13.a(2, this.handleRegistrationWithFees({
|
|
9658
10306
|
sender: this.walletAddress,
|
|
9659
10307
|
spgSpenderAddress: this.registrationWorkflowsClient.address,
|
|
9660
10308
|
encodedTxs: [encodedTxData],
|
|
9661
10309
|
contractCall: contractCall,
|
|
9662
|
-
spgNftContract:
|
|
10310
|
+
spgNftContract: object.spgNftContract,
|
|
9663
10311
|
txOptions: request.txOptions,
|
|
9664
10312
|
options: _objectSpread2(_objectSpread2({}, request.options), {}, {
|
|
9665
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$
|
|
10313
|
+
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options2 = request.options) === null || _request$options2 === void 0 ? void 0 : _request$options2.wipOptions), {}, {
|
|
9666
10314
|
useMulticallWhenPossible: false
|
|
9667
10315
|
})
|
|
9668
10316
|
})
|
|
9669
10317
|
}));
|
|
9670
10318
|
case 2:
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
return
|
|
10319
|
+
_context13.p = 2;
|
|
10320
|
+
_t18 = _context13.v;
|
|
10321
|
+
return _context13.a(2, handleError(_t18, "Failed to mint and register IP"));
|
|
9674
10322
|
}
|
|
9675
|
-
},
|
|
10323
|
+
}, _callee12, this, [[0, 2]]);
|
|
9676
10324
|
}));
|
|
9677
|
-
function mintAndRegisterIp(
|
|
10325
|
+
function mintAndRegisterIp(_x13) {
|
|
9678
10326
|
return _mintAndRegisterIp.apply(this, arguments);
|
|
9679
10327
|
}
|
|
9680
10328
|
return mintAndRegisterIp;
|
|
@@ -9698,23 +10346,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9698
10346
|
}, {
|
|
9699
10347
|
key: "batchMintAndRegisterIp",
|
|
9700
10348
|
value: (function () {
|
|
9701
|
-
var _batchMintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10349
|
+
var _batchMintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(request) {
|
|
9702
10350
|
var _this7 = this;
|
|
9703
|
-
var publicMintEncodedTxs, publicMintSpenders, privateMintEncodedTxs, privateMintSpenders, _iterator5, _step5, req, registrationRequest, isPublicMinting, nftMintFee, encodeTx, isMinterRole, handlePublicMintTransactions, handlePrivateMintTransactions, transactionResponses, publicMintResponse, privateMintResponse,
|
|
9704
|
-
return _regenerator().w(function (
|
|
9705
|
-
while (1) switch (
|
|
10351
|
+
var publicMintEncodedTxs, publicMintSpenders, privateMintEncodedTxs, privateMintSpenders, _iterator5, _step5, req, registrationRequest, isPublicMinting, nftMintFee, encodeTx, isMinterRole, handlePublicMintTransactions, handlePrivateMintTransactions, transactionResponses, publicMintResponse, privateMintResponse, _t19, _t20, _t21, _t22;
|
|
10352
|
+
return _regenerator().w(function (_context16) {
|
|
10353
|
+
while (1) switch (_context16.p = _context16.n) {
|
|
9706
10354
|
case 0:
|
|
9707
|
-
|
|
10355
|
+
_context16.p = 0;
|
|
9708
10356
|
publicMintEncodedTxs = [];
|
|
9709
10357
|
publicMintSpenders = [];
|
|
9710
10358
|
privateMintEncodedTxs = [];
|
|
9711
10359
|
privateMintSpenders = [];
|
|
9712
10360
|
_iterator5 = _createForOfIteratorHelper(request.requests);
|
|
9713
|
-
|
|
10361
|
+
_context16.p = 1;
|
|
9714
10362
|
_iterator5.s();
|
|
9715
10363
|
case 2:
|
|
9716
10364
|
if ((_step5 = _iterator5.n()).done) {
|
|
9717
|
-
|
|
10365
|
+
_context16.n = 9;
|
|
9718
10366
|
break;
|
|
9719
10367
|
}
|
|
9720
10368
|
req = _step5.value;
|
|
@@ -9724,14 +10372,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9724
10372
|
ipMetadata: getIpMetadataForWorkflow(req.ipMetadata),
|
|
9725
10373
|
allowDuplicates: req.allowDuplicates || true
|
|
9726
10374
|
};
|
|
9727
|
-
|
|
10375
|
+
_context16.n = 3;
|
|
9728
10376
|
return getPublicMinting(req.spgNftContract, this.rpcClient);
|
|
9729
10377
|
case 3:
|
|
9730
|
-
isPublicMinting =
|
|
9731
|
-
|
|
10378
|
+
isPublicMinting = _context16.v;
|
|
10379
|
+
_context16.n = 4;
|
|
9732
10380
|
return calculateSPGMintFee(new SpgnftImplReadOnlyClient(this.rpcClient, registrationRequest.spgNftContract));
|
|
9733
10381
|
case 4:
|
|
9734
|
-
nftMintFee =
|
|
10382
|
+
nftMintFee = _context16.v;
|
|
9735
10383
|
encodeTx = {
|
|
9736
10384
|
to: this.registrationWorkflowsClient.address,
|
|
9737
10385
|
data: viem.encodeFunctionData({
|
|
@@ -9741,22 +10389,22 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9741
10389
|
})
|
|
9742
10390
|
};
|
|
9743
10391
|
if (!isPublicMinting) {
|
|
9744
|
-
|
|
10392
|
+
_context16.n = 5;
|
|
9745
10393
|
break;
|
|
9746
10394
|
}
|
|
9747
10395
|
publicMintSpenders = mergeSpenders(publicMintSpenders, nftMintFee ? [_objectSpread2({
|
|
9748
10396
|
address: registrationRequest.spgNftContract
|
|
9749
10397
|
}, nftMintFee)] : []);
|
|
9750
10398
|
publicMintEncodedTxs.push(encodeTx);
|
|
9751
|
-
|
|
10399
|
+
_context16.n = 8;
|
|
9752
10400
|
break;
|
|
9753
10401
|
case 5:
|
|
9754
|
-
|
|
10402
|
+
_context16.n = 6;
|
|
9755
10403
|
return hasMinterRole(registrationRequest.spgNftContract, this.rpcClient, this.walletAddress);
|
|
9756
10404
|
case 6:
|
|
9757
|
-
isMinterRole =
|
|
10405
|
+
isMinterRole = _context16.v;
|
|
9758
10406
|
if (isMinterRole) {
|
|
9759
|
-
|
|
10407
|
+
_context16.n = 7;
|
|
9760
10408
|
break;
|
|
9761
10409
|
}
|
|
9762
10410
|
throw new Error("Caller ".concat(this.walletAddress, " does not have the minter role for ").concat(registrationRequest.spgNftContract));
|
|
@@ -9766,26 +10414,26 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9766
10414
|
}, nftMintFee)] : []);
|
|
9767
10415
|
privateMintEncodedTxs.push(encodeTx);
|
|
9768
10416
|
case 8:
|
|
9769
|
-
|
|
10417
|
+
_context16.n = 2;
|
|
9770
10418
|
break;
|
|
9771
10419
|
case 9:
|
|
9772
|
-
|
|
10420
|
+
_context16.n = 11;
|
|
9773
10421
|
break;
|
|
9774
10422
|
case 10:
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
_iterator5.e(
|
|
10423
|
+
_context16.p = 10;
|
|
10424
|
+
_t19 = _context16.v;
|
|
10425
|
+
_iterator5.e(_t19);
|
|
9778
10426
|
case 11:
|
|
9779
|
-
|
|
10427
|
+
_context16.p = 11;
|
|
9780
10428
|
_iterator5.f();
|
|
9781
|
-
return
|
|
10429
|
+
return _context16.f(11);
|
|
9782
10430
|
case 12:
|
|
9783
10431
|
handlePublicMintTransactions = /*#__PURE__*/function () {
|
|
9784
|
-
var
|
|
9785
|
-
return _regenerator().w(function (
|
|
9786
|
-
while (1) switch (
|
|
10432
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
10433
|
+
return _regenerator().w(function (_context14) {
|
|
10434
|
+
while (1) switch (_context14.n) {
|
|
9787
10435
|
case 0:
|
|
9788
|
-
|
|
10436
|
+
_context14.n = 1;
|
|
9789
10437
|
return contractCallWithFees({
|
|
9790
10438
|
options: {
|
|
9791
10439
|
wipOptions: request.wipOptions,
|
|
@@ -9807,20 +10455,20 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9807
10455
|
encodedTxs: publicMintEncodedTxs
|
|
9808
10456
|
});
|
|
9809
10457
|
case 1:
|
|
9810
|
-
return
|
|
10458
|
+
return _context14.a(2, _context14.v);
|
|
9811
10459
|
}
|
|
9812
|
-
},
|
|
10460
|
+
}, _callee13);
|
|
9813
10461
|
}));
|
|
9814
10462
|
return function handlePublicMintTransactions() {
|
|
9815
|
-
return
|
|
10463
|
+
return _ref3.apply(this, arguments);
|
|
9816
10464
|
};
|
|
9817
10465
|
}();
|
|
9818
10466
|
handlePrivateMintTransactions = /*#__PURE__*/function () {
|
|
9819
|
-
var
|
|
9820
|
-
return _regenerator().w(function (
|
|
9821
|
-
while (1) switch (
|
|
10467
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
10468
|
+
return _regenerator().w(function (_context15) {
|
|
10469
|
+
while (1) switch (_context15.n) {
|
|
9822
10470
|
case 0:
|
|
9823
|
-
|
|
10471
|
+
_context15.n = 1;
|
|
9824
10472
|
return contractCallWithFees({
|
|
9825
10473
|
options: {
|
|
9826
10474
|
wipOptions: _objectSpread2(_objectSpread2({}, request.wipOptions), {}, {
|
|
@@ -9844,50 +10492,50 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9844
10492
|
encodedTxs: privateMintEncodedTxs
|
|
9845
10493
|
});
|
|
9846
10494
|
case 1:
|
|
9847
|
-
return
|
|
10495
|
+
return _context15.a(2, _context15.v);
|
|
9848
10496
|
}
|
|
9849
|
-
},
|
|
10497
|
+
}, _callee14);
|
|
9850
10498
|
}));
|
|
9851
10499
|
return function handlePrivateMintTransactions() {
|
|
9852
|
-
return
|
|
10500
|
+
return _ref4.apply(this, arguments);
|
|
9853
10501
|
};
|
|
9854
10502
|
}();
|
|
9855
10503
|
transactionResponses = [];
|
|
9856
10504
|
if (!(privateMintEncodedTxs.length === 0)) {
|
|
9857
|
-
|
|
10505
|
+
_context16.n = 14;
|
|
9858
10506
|
break;
|
|
9859
10507
|
}
|
|
9860
|
-
|
|
10508
|
+
_context16.n = 13;
|
|
9861
10509
|
return handlePublicMintTransactions();
|
|
9862
10510
|
case 13:
|
|
9863
|
-
|
|
9864
|
-
transactionResponses = [
|
|
9865
|
-
|
|
10511
|
+
_t20 = _context16.v;
|
|
10512
|
+
transactionResponses = [_t20];
|
|
10513
|
+
_context16.n = 19;
|
|
9866
10514
|
break;
|
|
9867
10515
|
case 14:
|
|
9868
10516
|
if (!(publicMintEncodedTxs.length === 0)) {
|
|
9869
|
-
|
|
10517
|
+
_context16.n = 16;
|
|
9870
10518
|
break;
|
|
9871
10519
|
}
|
|
9872
|
-
|
|
10520
|
+
_context16.n = 15;
|
|
9873
10521
|
return handlePrivateMintTransactions();
|
|
9874
10522
|
case 15:
|
|
9875
|
-
|
|
9876
|
-
transactionResponses = [
|
|
9877
|
-
|
|
10523
|
+
_t21 = _context16.v;
|
|
10524
|
+
transactionResponses = [_t21];
|
|
10525
|
+
_context16.n = 19;
|
|
9878
10526
|
break;
|
|
9879
10527
|
case 16:
|
|
9880
|
-
|
|
10528
|
+
_context16.n = 17;
|
|
9881
10529
|
return handlePublicMintTransactions();
|
|
9882
10530
|
case 17:
|
|
9883
|
-
publicMintResponse =
|
|
9884
|
-
|
|
10531
|
+
publicMintResponse = _context16.v;
|
|
10532
|
+
_context16.n = 18;
|
|
9885
10533
|
return handlePrivateMintTransactions();
|
|
9886
10534
|
case 18:
|
|
9887
|
-
privateMintResponse =
|
|
10535
|
+
privateMintResponse = _context16.v;
|
|
9888
10536
|
transactionResponses = [publicMintResponse, privateMintResponse];
|
|
9889
10537
|
case 19:
|
|
9890
|
-
return
|
|
10538
|
+
return _context16.a(2, {
|
|
9891
10539
|
registrationResults: transactionResponses.map(function (r) {
|
|
9892
10540
|
return {
|
|
9893
10541
|
txHash: r.txHash,
|
|
@@ -9897,13 +10545,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9897
10545
|
})
|
|
9898
10546
|
});
|
|
9899
10547
|
case 20:
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
return
|
|
10548
|
+
_context16.p = 20;
|
|
10549
|
+
_t22 = _context16.v;
|
|
10550
|
+
return _context16.a(2, handleError(_t22, "Failed to batch mint and register IP"));
|
|
9903
10551
|
}
|
|
9904
|
-
},
|
|
10552
|
+
}, _callee15, this, [[1, 10, 11, 12], [0, 20]]);
|
|
9905
10553
|
}));
|
|
9906
|
-
function batchMintAndRegisterIp(
|
|
10554
|
+
function batchMintAndRegisterIp(_x14) {
|
|
9907
10555
|
return _batchMintAndRegisterIp.apply(this, arguments);
|
|
9908
10556
|
}
|
|
9909
10557
|
return batchMintAndRegisterIp;
|
|
@@ -9936,18 +10584,18 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9936
10584
|
}, {
|
|
9937
10585
|
key: "mintAndRegisterIpAndMakeDerivativeWithLicenseTokens",
|
|
9938
10586
|
value: (function () {
|
|
9939
|
-
var _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10587
|
+
var _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(request) {
|
|
9940
10588
|
var _this8 = this;
|
|
9941
|
-
var _request$txOptions9, _request$
|
|
9942
|
-
return _regenerator().w(function (
|
|
9943
|
-
while (1) switch (
|
|
10589
|
+
var _request$txOptions9, _request$options3, licenseTokenIds, _object, encodedTxData, contractCall, _t23;
|
|
10590
|
+
return _regenerator().w(function (_context18) {
|
|
10591
|
+
while (1) switch (_context18.p = _context18.n) {
|
|
9944
10592
|
case 0:
|
|
9945
|
-
|
|
9946
|
-
|
|
10593
|
+
_context18.p = 0;
|
|
10594
|
+
_context18.n = 1;
|
|
9947
10595
|
return this.validateLicenseTokenIds(request.licenseTokenIds);
|
|
9948
10596
|
case 1:
|
|
9949
|
-
licenseTokenIds =
|
|
9950
|
-
|
|
10597
|
+
licenseTokenIds = _context18.v;
|
|
10598
|
+
_object = {
|
|
9951
10599
|
spgNftContract: validateAddress(request.spgNftContract),
|
|
9952
10600
|
recipient: validateAddress(request.recipient || this.walletAddress),
|
|
9953
10601
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
|
@@ -9956,54 +10604,54 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9956
10604
|
maxRts: validateMaxRts(request.maxRts),
|
|
9957
10605
|
allowDuplicates: request.allowDuplicates || true
|
|
9958
10606
|
};
|
|
9959
|
-
encodedTxData = this.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokensEncode(
|
|
10607
|
+
encodedTxData = this.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokensEncode(_object);
|
|
9960
10608
|
if (!((_request$txOptions9 = request.txOptions) !== null && _request$txOptions9 !== void 0 && _request$txOptions9.encodedTxDataOnly)) {
|
|
9961
|
-
|
|
10609
|
+
_context18.n = 2;
|
|
9962
10610
|
break;
|
|
9963
10611
|
}
|
|
9964
|
-
return
|
|
10612
|
+
return _context18.a(2, {
|
|
9965
10613
|
encodedTxData: encodedTxData
|
|
9966
10614
|
});
|
|
9967
10615
|
case 2:
|
|
9968
|
-
|
|
10616
|
+
_context18.n = 3;
|
|
9969
10617
|
return this.approveLicenseTokensForDerivativeWorkflows(request.licenseTokenIds, request.autoApproveLicenseTokens);
|
|
9970
10618
|
case 3:
|
|
9971
10619
|
contractCall = /*#__PURE__*/function () {
|
|
9972
|
-
var
|
|
9973
|
-
return _regenerator().w(function (
|
|
9974
|
-
while (1) switch (
|
|
10620
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
10621
|
+
return _regenerator().w(function (_context17) {
|
|
10622
|
+
while (1) switch (_context17.n) {
|
|
9975
10623
|
case 0:
|
|
9976
|
-
return
|
|
10624
|
+
return _context17.a(2, _this8.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_object));
|
|
9977
10625
|
}
|
|
9978
|
-
},
|
|
10626
|
+
}, _callee16);
|
|
9979
10627
|
}));
|
|
9980
10628
|
return function contractCall() {
|
|
9981
|
-
return
|
|
10629
|
+
return _ref5.apply(this, arguments);
|
|
9982
10630
|
};
|
|
9983
10631
|
}();
|
|
9984
|
-
return
|
|
10632
|
+
return _context18.a(2, this.handleRegistrationWithFees({
|
|
9985
10633
|
options: _objectSpread2(_objectSpread2({}, request.options), {}, {
|
|
9986
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$
|
|
10634
|
+
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options3 = request.options) === null || _request$options3 === void 0 ? void 0 : _request$options3.wipOptions), {}, {
|
|
9987
10635
|
// need to disable multicall to avoid needing to transfer the license
|
|
9988
10636
|
// token to the multicall contract.
|
|
9989
10637
|
useMulticallWhenPossible: false
|
|
9990
10638
|
})
|
|
9991
10639
|
}),
|
|
9992
10640
|
sender: this.walletAddress,
|
|
9993
|
-
spgNftContract:
|
|
10641
|
+
spgNftContract: _object.spgNftContract,
|
|
9994
10642
|
spgSpenderAddress: this.derivativeWorkflowsClient.address,
|
|
9995
10643
|
encodedTxs: [encodedTxData],
|
|
9996
10644
|
contractCall: contractCall,
|
|
9997
10645
|
txOptions: request.txOptions
|
|
9998
10646
|
}));
|
|
9999
10647
|
case 4:
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
return
|
|
10648
|
+
_context18.p = 4;
|
|
10649
|
+
_t23 = _context18.v;
|
|
10650
|
+
return _context18.a(2, handleError(_t23, "Failed to mint and register IP and make derivative with license tokens"));
|
|
10003
10651
|
}
|
|
10004
|
-
},
|
|
10652
|
+
}, _callee17, this, [[0, 4]]);
|
|
10005
10653
|
}));
|
|
10006
|
-
function mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(
|
|
10654
|
+
function mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_x15) {
|
|
10007
10655
|
return _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens.apply(this, arguments);
|
|
10008
10656
|
}
|
|
10009
10657
|
return mintAndRegisterIpAndMakeDerivativeWithLicenseTokens;
|
|
@@ -10036,14 +10684,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10036
10684
|
}, {
|
|
10037
10685
|
key: "registerIpAndMakeDerivativeWithLicenseTokens",
|
|
10038
10686
|
value: (function () {
|
|
10039
|
-
var _registerIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10040
|
-
var _request$txOptions0, tokenId, ipIdAddress, isRegistered, licenseTokenIds, calculatedDeadline, signature,
|
|
10041
|
-
return _regenerator().w(function (
|
|
10042
|
-
while (1) switch (
|
|
10687
|
+
var _registerIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(request) {
|
|
10688
|
+
var _request$txOptions0, tokenId, ipIdAddress, isRegistered, licenseTokenIds, calculatedDeadline, signature, _object2, txHash, receipt, log, _t24;
|
|
10689
|
+
return _regenerator().w(function (_context19) {
|
|
10690
|
+
while (1) switch (_context19.p = _context19.n) {
|
|
10043
10691
|
case 0:
|
|
10044
|
-
|
|
10692
|
+
_context19.p = 0;
|
|
10045
10693
|
tokenId = BigInt(request.tokenId);
|
|
10046
|
-
|
|
10694
|
+
_context19.n = 1;
|
|
10047
10695
|
return getIpIdAddress({
|
|
10048
10696
|
nftContract: request.nftContract,
|
|
10049
10697
|
tokenId: tokenId,
|
|
@@ -10052,26 +10700,26 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10052
10700
|
chainId: this.chainId
|
|
10053
10701
|
});
|
|
10054
10702
|
case 1:
|
|
10055
|
-
ipIdAddress =
|
|
10056
|
-
|
|
10703
|
+
ipIdAddress = _context19.v;
|
|
10704
|
+
_context19.n = 2;
|
|
10057
10705
|
return this.isRegistered(ipIdAddress);
|
|
10058
10706
|
case 2:
|
|
10059
|
-
isRegistered =
|
|
10707
|
+
isRegistered = _context19.v;
|
|
10060
10708
|
if (!isRegistered) {
|
|
10061
|
-
|
|
10709
|
+
_context19.n = 3;
|
|
10062
10710
|
break;
|
|
10063
10711
|
}
|
|
10064
10712
|
throw new Error("The NFT with id ".concat(tokenId, " is already registered as IP."));
|
|
10065
10713
|
case 3:
|
|
10066
|
-
|
|
10714
|
+
_context19.n = 4;
|
|
10067
10715
|
return this.validateLicenseTokenIds(request.licenseTokenIds);
|
|
10068
10716
|
case 4:
|
|
10069
|
-
licenseTokenIds =
|
|
10070
|
-
|
|
10717
|
+
licenseTokenIds = _context19.v;
|
|
10718
|
+
_context19.n = 5;
|
|
10071
10719
|
return getCalculatedDeadline(this.rpcClient, request.deadline);
|
|
10072
10720
|
case 5:
|
|
10073
|
-
calculatedDeadline =
|
|
10074
|
-
|
|
10721
|
+
calculatedDeadline = _context19.v;
|
|
10722
|
+
_context19.n = 6;
|
|
10075
10723
|
return generateOperationSignature({
|
|
10076
10724
|
ipIdAddress: ipIdAddress,
|
|
10077
10725
|
methodType: SignatureMethodType.REGISTER_IP_AND_MAKE_DERIVATIVE_WITH_LICENSE_TOKENS,
|
|
@@ -10080,11 +10728,11 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10080
10728
|
chainId: this.chainId
|
|
10081
10729
|
});
|
|
10082
10730
|
case 6:
|
|
10083
|
-
signature =
|
|
10084
|
-
|
|
10731
|
+
signature = _context19.v;
|
|
10732
|
+
_context19.n = 7;
|
|
10085
10733
|
return this.approveLicenseTokensForDerivativeWorkflows(licenseTokenIds, request.autoApproveLicenseTokens);
|
|
10086
10734
|
case 7:
|
|
10087
|
-
|
|
10735
|
+
_object2 = _objectSpread2(_objectSpread2({}, request), {}, {
|
|
10088
10736
|
tokenId: tokenId,
|
|
10089
10737
|
licenseTokenIds: licenseTokenIds,
|
|
10090
10738
|
royaltyContext: viem.zeroAddress,
|
|
@@ -10097,40 +10745,40 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10097
10745
|
maxRts: validateMaxRts(request.maxRts)
|
|
10098
10746
|
});
|
|
10099
10747
|
if (!((_request$txOptions0 = request.txOptions) !== null && _request$txOptions0 !== void 0 && _request$txOptions0.encodedTxDataOnly)) {
|
|
10100
|
-
|
|
10748
|
+
_context19.n = 8;
|
|
10101
10749
|
break;
|
|
10102
10750
|
}
|
|
10103
|
-
return
|
|
10104
|
-
encodedTxData: this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokensEncode(
|
|
10751
|
+
return _context19.a(2, {
|
|
10752
|
+
encodedTxData: this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokensEncode(_object2)
|
|
10105
10753
|
});
|
|
10106
10754
|
case 8:
|
|
10107
|
-
|
|
10108
|
-
return this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokens(
|
|
10755
|
+
_context19.n = 9;
|
|
10756
|
+
return this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokens(_object2);
|
|
10109
10757
|
case 9:
|
|
10110
|
-
txHash =
|
|
10111
|
-
|
|
10758
|
+
txHash = _context19.v;
|
|
10759
|
+
_context19.n = 10;
|
|
10112
10760
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
10113
10761
|
hash: txHash
|
|
10114
10762
|
}));
|
|
10115
10763
|
case 10:
|
|
10116
|
-
receipt =
|
|
10764
|
+
receipt = _context19.v;
|
|
10117
10765
|
log = this.getIpIdAndTokenIdsFromEvent(receipt)[0];
|
|
10118
|
-
return
|
|
10766
|
+
return _context19.a(2, _objectSpread2({
|
|
10119
10767
|
txHash: txHash
|
|
10120
10768
|
}, log));
|
|
10121
10769
|
case 11:
|
|
10122
|
-
|
|
10770
|
+
_context19.n = 13;
|
|
10123
10771
|
break;
|
|
10124
10772
|
case 12:
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
return
|
|
10773
|
+
_context19.p = 12;
|
|
10774
|
+
_t24 = _context19.v;
|
|
10775
|
+
return _context19.a(2, handleError(_t24, "Failed to register IP and make derivative with license tokens"));
|
|
10128
10776
|
case 13:
|
|
10129
|
-
return
|
|
10777
|
+
return _context19.a(2);
|
|
10130
10778
|
}
|
|
10131
|
-
},
|
|
10779
|
+
}, _callee18, this, [[0, 12]]);
|
|
10132
10780
|
}));
|
|
10133
|
-
function registerIpAndMakeDerivativeWithLicenseTokens(
|
|
10781
|
+
function registerIpAndMakeDerivativeWithLicenseTokens(_x16) {
|
|
10134
10782
|
return _registerIpAndMakeDerivativeWithLicenseTokens.apply(this, arguments);
|
|
10135
10783
|
}
|
|
10136
10784
|
return registerIpAndMakeDerivativeWithLicenseTokens;
|
|
@@ -10167,23 +10815,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10167
10815
|
}, {
|
|
10168
10816
|
key: "registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens",
|
|
10169
10817
|
value: (function () {
|
|
10170
|
-
var _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10171
|
-
var _getRoyaltyShares, royaltyShares, totalAmount, _yield$validateLicens2, licenseTerms, calculatedDeadline, ipIdAddress, isRegistered, _yield$transformRegis5, _transformRequest4, registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash, txReceipt, ipId, licenseTermsIds, ipRoyaltyVault, distributeRoyaltyTokensTxHash, maxLicenseTokensTxHashes,
|
|
10172
|
-
return _regenerator().w(function (
|
|
10173
|
-
while (1) switch (
|
|
10818
|
+
var _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(request) {
|
|
10819
|
+
var _getRoyaltyShares, royaltyShares, totalAmount, _yield$validateLicens2, licenseTerms, calculatedDeadline, ipIdAddress, isRegistered, _yield$transformRegis5, _transformRequest4, registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash, txReceipt, ipId, licenseTermsIds, ipRoyaltyVault, distributeRoyaltyTokensTxHash, maxLicenseTokensTxHashes, _t25;
|
|
10820
|
+
return _regenerator().w(function (_context20) {
|
|
10821
|
+
while (1) switch (_context20.p = _context20.n) {
|
|
10174
10822
|
case 0:
|
|
10175
|
-
|
|
10823
|
+
_context20.p = 0;
|
|
10176
10824
|
_getRoyaltyShares = getRoyaltyShares(request.royaltyShares), royaltyShares = _getRoyaltyShares.royaltyShares, totalAmount = _getRoyaltyShares.totalAmount;
|
|
10177
|
-
|
|
10825
|
+
_context20.n = 1;
|
|
10178
10826
|
return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
|
|
10179
10827
|
case 1:
|
|
10180
|
-
_yield$validateLicens2 =
|
|
10828
|
+
_yield$validateLicens2 = _context20.v;
|
|
10181
10829
|
licenseTerms = _yield$validateLicens2.licenseTerms;
|
|
10182
|
-
|
|
10830
|
+
_context20.n = 2;
|
|
10183
10831
|
return getCalculatedDeadline(this.rpcClient, request.deadline);
|
|
10184
10832
|
case 2:
|
|
10185
|
-
calculatedDeadline =
|
|
10186
|
-
|
|
10833
|
+
calculatedDeadline = _context20.v;
|
|
10834
|
+
_context20.n = 3;
|
|
10187
10835
|
return getIpIdAddress({
|
|
10188
10836
|
nftContract: validateAddress(request.nftContract),
|
|
10189
10837
|
tokenId: BigInt(request.tokenId),
|
|
@@ -10192,18 +10840,18 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10192
10840
|
chainId: this.chainId
|
|
10193
10841
|
});
|
|
10194
10842
|
case 3:
|
|
10195
|
-
ipIdAddress =
|
|
10196
|
-
|
|
10843
|
+
ipIdAddress = _context20.v;
|
|
10844
|
+
_context20.n = 4;
|
|
10197
10845
|
return this.isRegistered(ipIdAddress);
|
|
10198
10846
|
case 4:
|
|
10199
|
-
isRegistered =
|
|
10847
|
+
isRegistered = _context20.v;
|
|
10200
10848
|
if (!isRegistered) {
|
|
10201
|
-
|
|
10849
|
+
_context20.n = 5;
|
|
10202
10850
|
break;
|
|
10203
10851
|
}
|
|
10204
10852
|
throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
|
|
10205
10853
|
case 5:
|
|
10206
|
-
|
|
10854
|
+
_context20.n = 6;
|
|
10207
10855
|
return transformRegistrationRequest({
|
|
10208
10856
|
request: request,
|
|
10209
10857
|
rpcClient: this.rpcClient,
|
|
@@ -10211,25 +10859,25 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10211
10859
|
chainId: this.chainId
|
|
10212
10860
|
});
|
|
10213
10861
|
case 6:
|
|
10214
|
-
_yield$transformRegis5 =
|
|
10862
|
+
_yield$transformRegis5 = _context20.v;
|
|
10215
10863
|
_transformRequest4 = _yield$transformRegis5.transformRequest;
|
|
10216
|
-
|
|
10864
|
+
_context20.n = 7;
|
|
10217
10865
|
return this.royaltyTokenDistributionWorkflowsClient.registerIpAndAttachPilTermsAndDeployRoyaltyVault(_transformRequest4);
|
|
10218
10866
|
case 7:
|
|
10219
|
-
registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash =
|
|
10220
|
-
|
|
10867
|
+
registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash = _context20.v;
|
|
10868
|
+
_context20.n = 8;
|
|
10221
10869
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
10222
10870
|
hash: registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash
|
|
10223
10871
|
}));
|
|
10224
10872
|
case 8:
|
|
10225
|
-
txReceipt =
|
|
10873
|
+
txReceipt = _context20.v;
|
|
10226
10874
|
ipId = this.getIpIdAndTokenIdsFromEvent(txReceipt)[0].ipId;
|
|
10227
|
-
|
|
10875
|
+
_context20.n = 9;
|
|
10228
10876
|
return this.getLicenseTermsId(licenseTerms);
|
|
10229
10877
|
case 9:
|
|
10230
|
-
licenseTermsIds =
|
|
10878
|
+
licenseTermsIds = _context20.v;
|
|
10231
10879
|
ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(txReceipt)[0].ipRoyaltyVault;
|
|
10232
|
-
|
|
10880
|
+
_context20.n = 10;
|
|
10233
10881
|
return this.distributeRoyaltyTokens({
|
|
10234
10882
|
ipId: ipId,
|
|
10235
10883
|
deadline: calculatedDeadline,
|
|
@@ -10239,13 +10887,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10239
10887
|
txOptions: request.txOptions
|
|
10240
10888
|
});
|
|
10241
10889
|
case 10:
|
|
10242
|
-
distributeRoyaltyTokensTxHash =
|
|
10243
|
-
|
|
10890
|
+
distributeRoyaltyTokensTxHash = _context20.v;
|
|
10891
|
+
_context20.n = 11;
|
|
10244
10892
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
10245
10893
|
hash: distributeRoyaltyTokensTxHash
|
|
10246
10894
|
}));
|
|
10247
10895
|
case 11:
|
|
10248
|
-
|
|
10896
|
+
_context20.n = 12;
|
|
10249
10897
|
return setMaxLicenseTokens({
|
|
10250
10898
|
maxLicenseTokensData: request.licenseTermsData,
|
|
10251
10899
|
licensorIpId: ipId,
|
|
@@ -10254,8 +10902,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10254
10902
|
templateAddress: this.licenseTemplateAddress
|
|
10255
10903
|
});
|
|
10256
10904
|
case 12:
|
|
10257
|
-
maxLicenseTokensTxHashes =
|
|
10258
|
-
return
|
|
10905
|
+
maxLicenseTokensTxHashes = _context20.v;
|
|
10906
|
+
return _context20.a(2, _objectSpread2({
|
|
10259
10907
|
registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash: registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash,
|
|
10260
10908
|
distributeRoyaltyTokensTxHash: distributeRoyaltyTokensTxHash,
|
|
10261
10909
|
ipId: ipId,
|
|
@@ -10265,13 +10913,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10265
10913
|
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
|
10266
10914
|
}));
|
|
10267
10915
|
case 13:
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
return
|
|
10916
|
+
_context20.p = 13;
|
|
10917
|
+
_t25 = _context20.v;
|
|
10918
|
+
return _context20.a(2, handleError(_t25, "Failed to register IP and attach license terms and distribute royalty tokens"));
|
|
10271
10919
|
}
|
|
10272
|
-
},
|
|
10920
|
+
}, _callee19, this, [[0, 13]]);
|
|
10273
10921
|
}));
|
|
10274
|
-
function registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(
|
|
10922
|
+
function registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x17) {
|
|
10275
10923
|
return _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens.apply(this, arguments);
|
|
10276
10924
|
}
|
|
10277
10925
|
return registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens;
|
|
@@ -10307,14 +10955,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10307
10955
|
}, {
|
|
10308
10956
|
key: "registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens",
|
|
10309
10957
|
value: (function () {
|
|
10310
|
-
var _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10958
|
+
var _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(request) {
|
|
10311
10959
|
var _this9 = this;
|
|
10312
|
-
var _request$
|
|
10313
|
-
return _regenerator().w(function (
|
|
10314
|
-
while (1) switch (
|
|
10960
|
+
var _request$options4, ipIdAddress, _yield$transformRegis6, _transformRequest5, _getRoyaltyShares2, royaltyShares, totalAmount, isRegistered, encodedTxData, contractCall, _yield$this$handleReg, txHash, ipId, tokenId, receipt, ipRoyaltyVault, distributeRoyaltyTokensTxHash, _t26;
|
|
10961
|
+
return _regenerator().w(function (_context21) {
|
|
10962
|
+
while (1) switch (_context21.p = _context21.n) {
|
|
10315
10963
|
case 0:
|
|
10316
|
-
|
|
10317
|
-
|
|
10964
|
+
_context21.p = 0;
|
|
10965
|
+
_context21.n = 1;
|
|
10318
10966
|
return getIpIdAddress({
|
|
10319
10967
|
nftContract: validateAddress(request.nftContract),
|
|
10320
10968
|
tokenId: BigInt(request.tokenId),
|
|
@@ -10323,8 +10971,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10323
10971
|
chainId: this.chainId
|
|
10324
10972
|
});
|
|
10325
10973
|
case 1:
|
|
10326
|
-
ipIdAddress =
|
|
10327
|
-
|
|
10974
|
+
ipIdAddress = _context21.v;
|
|
10975
|
+
_context21.n = 2;
|
|
10328
10976
|
return transformRegistrationRequest({
|
|
10329
10977
|
request: request,
|
|
10330
10978
|
rpcClient: this.rpcClient,
|
|
@@ -10332,15 +10980,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10332
10980
|
chainId: this.chainId
|
|
10333
10981
|
});
|
|
10334
10982
|
case 2:
|
|
10335
|
-
_yield$transformRegis6 =
|
|
10983
|
+
_yield$transformRegis6 = _context21.v;
|
|
10336
10984
|
_transformRequest5 = _yield$transformRegis6.transformRequest;
|
|
10337
10985
|
_getRoyaltyShares2 = getRoyaltyShares(request.royaltyShares), royaltyShares = _getRoyaltyShares2.royaltyShares, totalAmount = _getRoyaltyShares2.totalAmount;
|
|
10338
|
-
|
|
10986
|
+
_context21.n = 3;
|
|
10339
10987
|
return this.isRegistered(ipIdAddress);
|
|
10340
10988
|
case 3:
|
|
10341
|
-
isRegistered =
|
|
10989
|
+
isRegistered = _context21.v;
|
|
10342
10990
|
if (!isRegistered) {
|
|
10343
|
-
|
|
10991
|
+
_context21.n = 4;
|
|
10344
10992
|
break;
|
|
10345
10993
|
}
|
|
10346
10994
|
throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
|
|
@@ -10349,10 +10997,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10349
10997
|
contractCall = function contractCall() {
|
|
10350
10998
|
return _this9.royaltyTokenDistributionWorkflowsClient.registerIpAndMakeDerivativeAndDeployRoyaltyVault(_transformRequest5);
|
|
10351
10999
|
};
|
|
10352
|
-
|
|
11000
|
+
_context21.n = 5;
|
|
10353
11001
|
return this.handleRegistrationWithFees({
|
|
10354
11002
|
options: _objectSpread2(_objectSpread2({}, request.options), {}, {
|
|
10355
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$
|
|
11003
|
+
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options4 = request.options) === null || _request$options4 === void 0 ? void 0 : _request$options4.wipOptions), {}, {
|
|
10356
11004
|
useMulticallWhenPossible: false
|
|
10357
11005
|
})
|
|
10358
11006
|
}),
|
|
@@ -10364,13 +11012,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10364
11012
|
txOptions: _objectSpread2({}, request.txOptions)
|
|
10365
11013
|
});
|
|
10366
11014
|
case 5:
|
|
10367
|
-
_yield$this$handleReg =
|
|
11015
|
+
_yield$this$handleReg = _context21.v;
|
|
10368
11016
|
txHash = _yield$this$handleReg.txHash;
|
|
10369
11017
|
ipId = _yield$this$handleReg.ipId;
|
|
10370
11018
|
tokenId = _yield$this$handleReg.tokenId;
|
|
10371
11019
|
receipt = _yield$this$handleReg.receipt;
|
|
10372
11020
|
if (!(tokenId === undefined || !ipId || !receipt)) {
|
|
10373
|
-
|
|
11021
|
+
_context21.n = 6;
|
|
10374
11022
|
break;
|
|
10375
11023
|
}
|
|
10376
11024
|
throw new Error("Failed to register derivative ip and deploy royalty vault.");
|
|
@@ -10378,7 +11026,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10378
11026
|
ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt).filter(function (item) {
|
|
10379
11027
|
return item.ipId === ipId;
|
|
10380
11028
|
})[0].ipRoyaltyVault;
|
|
10381
|
-
|
|
11029
|
+
_context21.n = 7;
|
|
10382
11030
|
return this.distributeRoyaltyTokens({
|
|
10383
11031
|
ipId: ipId,
|
|
10384
11032
|
deadline: request.deadline,
|
|
@@ -10388,13 +11036,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10388
11036
|
txOptions: request.txOptions
|
|
10389
11037
|
});
|
|
10390
11038
|
case 7:
|
|
10391
|
-
distributeRoyaltyTokensTxHash =
|
|
10392
|
-
|
|
11039
|
+
distributeRoyaltyTokensTxHash = _context21.v;
|
|
11040
|
+
_context21.n = 8;
|
|
10393
11041
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
10394
11042
|
hash: distributeRoyaltyTokensTxHash
|
|
10395
11043
|
}));
|
|
10396
11044
|
case 8:
|
|
10397
|
-
return
|
|
11045
|
+
return _context21.a(2, {
|
|
10398
11046
|
registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokensTxHash: txHash,
|
|
10399
11047
|
distributeRoyaltyTokensTxHash: distributeRoyaltyTokensTxHash,
|
|
10400
11048
|
ipId: ipId,
|
|
@@ -10402,13 +11050,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10402
11050
|
ipRoyaltyVault: ipRoyaltyVault
|
|
10403
11051
|
});
|
|
10404
11052
|
case 9:
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
return
|
|
11053
|
+
_context21.p = 9;
|
|
11054
|
+
_t26 = _context21.v;
|
|
11055
|
+
return _context21.a(2, handleError(_t26, "Failed to register derivative IP and attach license terms and distribute royalty tokens"));
|
|
10408
11056
|
}
|
|
10409
|
-
},
|
|
11057
|
+
}, _callee20, this, [[0, 9]]);
|
|
10410
11058
|
}));
|
|
10411
|
-
function registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(
|
|
11059
|
+
function registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x18) {
|
|
10412
11060
|
return _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens.apply(this, arguments);
|
|
10413
11061
|
}
|
|
10414
11062
|
return registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens;
|
|
@@ -10442,19 +11090,19 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10442
11090
|
}, {
|
|
10443
11091
|
key: "mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens",
|
|
10444
11092
|
value: (function () {
|
|
10445
|
-
var _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11093
|
+
var _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(request) {
|
|
10446
11094
|
var _this0 = this;
|
|
10447
|
-
var _request$
|
|
10448
|
-
return _regenerator().w(function (
|
|
10449
|
-
while (1) switch (
|
|
11095
|
+
var _request$options5, _yield$validateLicens3, licenseTerms, _yield$transformRegis7, _transformRequest6, encodedTxData, contractCall, _yield$this$handleReg2, txHash, ipId, tokenId, receipt, licenseTermsIds, ipRoyaltyVault, maxLicenseTokensTxHashes, _t27;
|
|
11096
|
+
return _regenerator().w(function (_context22) {
|
|
11097
|
+
while (1) switch (_context22.p = _context22.n) {
|
|
10450
11098
|
case 0:
|
|
10451
|
-
|
|
10452
|
-
|
|
11099
|
+
_context22.p = 0;
|
|
11100
|
+
_context22.n = 1;
|
|
10453
11101
|
return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
|
|
10454
11102
|
case 1:
|
|
10455
|
-
_yield$validateLicens3 =
|
|
11103
|
+
_yield$validateLicens3 = _context22.v;
|
|
10456
11104
|
licenseTerms = _yield$validateLicens3.licenseTerms;
|
|
10457
|
-
|
|
11105
|
+
_context22.n = 2;
|
|
10458
11106
|
return transformRegistrationRequest({
|
|
10459
11107
|
request: request,
|
|
10460
11108
|
rpcClient: this.rpcClient,
|
|
@@ -10462,16 +11110,16 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10462
11110
|
chainId: this.chainId
|
|
10463
11111
|
});
|
|
10464
11112
|
case 2:
|
|
10465
|
-
_yield$transformRegis7 =
|
|
11113
|
+
_yield$transformRegis7 = _context22.v;
|
|
10466
11114
|
_transformRequest6 = _yield$transformRegis7.transformRequest;
|
|
10467
11115
|
encodedTxData = this.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokensEncode(_transformRequest6);
|
|
10468
11116
|
contractCall = function contractCall() {
|
|
10469
11117
|
return _this0.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_transformRequest6);
|
|
10470
11118
|
};
|
|
10471
|
-
|
|
11119
|
+
_context22.n = 3;
|
|
10472
11120
|
return this.handleRegistrationWithFees({
|
|
10473
11121
|
options: _objectSpread2(_objectSpread2({}, request.options), {}, {
|
|
10474
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$
|
|
11122
|
+
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options5 = request.options) === null || _request$options5 === void 0 ? void 0 : _request$options5.wipOptions), {}, {
|
|
10475
11123
|
useMulticallWhenPossible: false
|
|
10476
11124
|
})
|
|
10477
11125
|
}),
|
|
@@ -10483,25 +11131,25 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10483
11131
|
txOptions: request.txOptions
|
|
10484
11132
|
});
|
|
10485
11133
|
case 3:
|
|
10486
|
-
_yield$this$handleReg2 =
|
|
11134
|
+
_yield$this$handleReg2 = _context22.v;
|
|
10487
11135
|
txHash = _yield$this$handleReg2.txHash;
|
|
10488
11136
|
ipId = _yield$this$handleReg2.ipId;
|
|
10489
11137
|
tokenId = _yield$this$handleReg2.tokenId;
|
|
10490
11138
|
receipt = _yield$this$handleReg2.receipt;
|
|
10491
11139
|
if (receipt) {
|
|
10492
|
-
|
|
11140
|
+
_context22.n = 4;
|
|
10493
11141
|
break;
|
|
10494
11142
|
}
|
|
10495
|
-
return
|
|
11143
|
+
return _context22.a(2, {
|
|
10496
11144
|
txHash: txHash
|
|
10497
11145
|
});
|
|
10498
11146
|
case 4:
|
|
10499
|
-
|
|
11147
|
+
_context22.n = 5;
|
|
10500
11148
|
return this.getLicenseTermsId(licenseTerms);
|
|
10501
11149
|
case 5:
|
|
10502
|
-
licenseTermsIds =
|
|
11150
|
+
licenseTermsIds = _context22.v;
|
|
10503
11151
|
ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt)[0].ipRoyaltyVault;
|
|
10504
|
-
|
|
11152
|
+
_context22.n = 6;
|
|
10505
11153
|
return setMaxLicenseTokens({
|
|
10506
11154
|
maxLicenseTokensData: request.licenseTermsData,
|
|
10507
11155
|
licensorIpId: ipId,
|
|
@@ -10510,8 +11158,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10510
11158
|
templateAddress: this.licenseTemplateAddress
|
|
10511
11159
|
});
|
|
10512
11160
|
case 6:
|
|
10513
|
-
maxLicenseTokensTxHashes =
|
|
10514
|
-
return
|
|
11161
|
+
maxLicenseTokensTxHashes = _context22.v;
|
|
11162
|
+
return _context22.a(2, _objectSpread2({
|
|
10515
11163
|
txHash: txHash,
|
|
10516
11164
|
ipId: ipId,
|
|
10517
11165
|
licenseTermsIds: licenseTermsIds,
|
|
@@ -10521,13 +11169,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10521
11169
|
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
|
10522
11170
|
}));
|
|
10523
11171
|
case 7:
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
return
|
|
11172
|
+
_context22.p = 7;
|
|
11173
|
+
_t27 = _context22.v;
|
|
11174
|
+
return _context22.a(2, handleError(_t27, "Failed to mint and register IP and attach PIL terms and distribute royalty tokens"));
|
|
10527
11175
|
}
|
|
10528
|
-
},
|
|
11176
|
+
}, _callee21, this, [[0, 7]]);
|
|
10529
11177
|
}));
|
|
10530
|
-
function mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(
|
|
11178
|
+
function mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_x19) {
|
|
10531
11179
|
return _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens.apply(this, arguments);
|
|
10532
11180
|
}
|
|
10533
11181
|
return mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens;
|
|
@@ -10561,14 +11209,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10561
11209
|
}, {
|
|
10562
11210
|
key: "mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens",
|
|
10563
11211
|
value: (function () {
|
|
10564
|
-
var _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11212
|
+
var _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(request) {
|
|
10565
11213
|
var _this1 = this;
|
|
10566
|
-
var _yield$transformRegis8, _transformRequest7, encodedTxData, contractCall,
|
|
10567
|
-
return _regenerator().w(function (
|
|
10568
|
-
while (1) switch (
|
|
11214
|
+
var _yield$transformRegis8, _transformRequest7, encodedTxData, contractCall, _t28;
|
|
11215
|
+
return _regenerator().w(function (_context23) {
|
|
11216
|
+
while (1) switch (_context23.p = _context23.n) {
|
|
10569
11217
|
case 0:
|
|
10570
|
-
|
|
10571
|
-
|
|
11218
|
+
_context23.p = 0;
|
|
11219
|
+
_context23.n = 1;
|
|
10572
11220
|
return transformRegistrationRequest({
|
|
10573
11221
|
request: request,
|
|
10574
11222
|
rpcClient: this.rpcClient,
|
|
@@ -10576,13 +11224,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10576
11224
|
chainId: this.chainId
|
|
10577
11225
|
});
|
|
10578
11226
|
case 1:
|
|
10579
|
-
_yield$transformRegis8 =
|
|
11227
|
+
_yield$transformRegis8 = _context23.v;
|
|
10580
11228
|
_transformRequest7 = _yield$transformRegis8.transformRequest;
|
|
10581
11229
|
encodedTxData = this.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokensEncode(_transformRequest7);
|
|
10582
11230
|
contractCall = function contractCall() {
|
|
10583
11231
|
return _this1.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_transformRequest7);
|
|
10584
11232
|
};
|
|
10585
|
-
|
|
11233
|
+
_context23.n = 2;
|
|
10586
11234
|
return this.handleRegistrationWithFees({
|
|
10587
11235
|
spgNftContract: _transformRequest7.spgNftContract,
|
|
10588
11236
|
options: request.options,
|
|
@@ -10594,15 +11242,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10594
11242
|
txOptions: request.txOptions
|
|
10595
11243
|
});
|
|
10596
11244
|
case 2:
|
|
10597
|
-
return
|
|
11245
|
+
return _context23.a(2, _context23.v);
|
|
10598
11246
|
case 3:
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
return
|
|
11247
|
+
_context23.p = 3;
|
|
11248
|
+
_t28 = _context23.v;
|
|
11249
|
+
return _context23.a(2, handleError(_t28, "Failed to mint and register IP and make derivative and distribute royalty tokens"));
|
|
10602
11250
|
}
|
|
10603
|
-
},
|
|
11251
|
+
}, _callee22, this, [[0, 3]]);
|
|
10604
11252
|
}));
|
|
10605
|
-
function mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(
|
|
11253
|
+
function mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_x20) {
|
|
10606
11254
|
return _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens.apply(this, arguments);
|
|
10607
11255
|
}
|
|
10608
11256
|
return mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens;
|
|
@@ -10610,12 +11258,12 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10610
11258
|
}, {
|
|
10611
11259
|
key: "distributeRoyaltyTokens",
|
|
10612
11260
|
value: function () {
|
|
10613
|
-
var _distributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11261
|
+
var _distributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(request) {
|
|
10614
11262
|
var _yield$transferDistri, transformRequest, txHash;
|
|
10615
|
-
return _regenerator().w(function (
|
|
10616
|
-
while (1) switch (
|
|
11263
|
+
return _regenerator().w(function (_context24) {
|
|
11264
|
+
while (1) switch (_context24.n) {
|
|
10617
11265
|
case 0:
|
|
10618
|
-
|
|
11266
|
+
_context24.n = 1;
|
|
10619
11267
|
return transferDistributeRoyaltyTokensRequest({
|
|
10620
11268
|
request: request,
|
|
10621
11269
|
rpcClient: this.rpcClient,
|
|
@@ -10623,22 +11271,22 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10623
11271
|
chainId: this.chainId
|
|
10624
11272
|
});
|
|
10625
11273
|
case 1:
|
|
10626
|
-
_yield$transferDistri =
|
|
11274
|
+
_yield$transferDistri = _context24.v;
|
|
10627
11275
|
transformRequest = _yield$transferDistri.transformRequest;
|
|
10628
|
-
|
|
11276
|
+
_context24.n = 2;
|
|
10629
11277
|
return this.royaltyTokenDistributionWorkflowsClient.distributeRoyaltyTokens(transformRequest);
|
|
10630
11278
|
case 2:
|
|
10631
|
-
txHash =
|
|
10632
|
-
|
|
11279
|
+
txHash = _context24.v;
|
|
11280
|
+
_context24.n = 3;
|
|
10633
11281
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
10634
11282
|
hash: txHash
|
|
10635
11283
|
}));
|
|
10636
11284
|
case 3:
|
|
10637
|
-
return
|
|
11285
|
+
return _context24.a(2, txHash);
|
|
10638
11286
|
}
|
|
10639
|
-
},
|
|
11287
|
+
}, _callee23, this);
|
|
10640
11288
|
}));
|
|
10641
|
-
function distributeRoyaltyTokens(
|
|
11289
|
+
function distributeRoyaltyTokens(_x21) {
|
|
10642
11290
|
return _distributeRoyaltyTokens.apply(this, arguments);
|
|
10643
11291
|
}
|
|
10644
11292
|
return distributeRoyaltyTokens;
|
|
@@ -10646,20 +11294,20 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10646
11294
|
}, {
|
|
10647
11295
|
key: "isRegistered",
|
|
10648
11296
|
value: function () {
|
|
10649
|
-
var _isRegistered = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10650
|
-
return _regenerator().w(function (
|
|
10651
|
-
while (1) switch (
|
|
11297
|
+
var _isRegistered = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(ipId) {
|
|
11298
|
+
return _regenerator().w(function (_context25) {
|
|
11299
|
+
while (1) switch (_context25.n) {
|
|
10652
11300
|
case 0:
|
|
10653
|
-
|
|
11301
|
+
_context25.n = 1;
|
|
10654
11302
|
return this.ipAssetRegistryClient.isRegistered({
|
|
10655
11303
|
id: validateAddress(ipId)
|
|
10656
11304
|
});
|
|
10657
11305
|
case 1:
|
|
10658
|
-
return
|
|
11306
|
+
return _context25.a(2, _context25.v);
|
|
10659
11307
|
}
|
|
10660
|
-
},
|
|
11308
|
+
}, _callee24, this);
|
|
10661
11309
|
}));
|
|
10662
|
-
function isRegistered(
|
|
11310
|
+
function isRegistered(_x22) {
|
|
10663
11311
|
return _isRegistered.apply(this, arguments);
|
|
10664
11312
|
}
|
|
10665
11313
|
return isRegistered;
|
|
@@ -10705,24 +11353,24 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10705
11353
|
}, {
|
|
10706
11354
|
key: "batchRegisterIpAssetsWithOptimizedWorkflows",
|
|
10707
11355
|
value: (function () {
|
|
10708
|
-
var _batchRegisterIpAssetsWithOptimizedWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10709
|
-
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,
|
|
10710
|
-
return _regenerator().w(function (
|
|
10711
|
-
while (1) switch (
|
|
11356
|
+
var _batchRegisterIpAssetsWithOptimizedWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(request) {
|
|
11357
|
+
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;
|
|
11358
|
+
return _regenerator().w(function (_context26) {
|
|
11359
|
+
while (1) switch (_context26.p = _context26.n) {
|
|
10712
11360
|
case 0:
|
|
10713
|
-
|
|
11361
|
+
_context26.p = 0;
|
|
10714
11362
|
// Transform requests into workflow format
|
|
10715
11363
|
transferWorkflowRequests = [];
|
|
10716
11364
|
_iterator6 = _createForOfIteratorHelper(request.requests);
|
|
10717
|
-
|
|
11365
|
+
_context26.p = 1;
|
|
10718
11366
|
_iterator6.s();
|
|
10719
11367
|
case 2:
|
|
10720
11368
|
if ((_step6 = _iterator6.n()).done) {
|
|
10721
|
-
|
|
11369
|
+
_context26.n = 5;
|
|
10722
11370
|
break;
|
|
10723
11371
|
}
|
|
10724
11372
|
req = _step6.value;
|
|
10725
|
-
|
|
11373
|
+
_context26.n = 3;
|
|
10726
11374
|
return transformRegistrationRequest({
|
|
10727
11375
|
request: req,
|
|
10728
11376
|
rpcClient: this.rpcClient,
|
|
@@ -10730,22 +11378,22 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10730
11378
|
chainId: this.chainId
|
|
10731
11379
|
});
|
|
10732
11380
|
case 3:
|
|
10733
|
-
res =
|
|
11381
|
+
res = _context26.v;
|
|
10734
11382
|
transferWorkflowRequests.push(res);
|
|
10735
11383
|
case 4:
|
|
10736
|
-
|
|
11384
|
+
_context26.n = 2;
|
|
10737
11385
|
break;
|
|
10738
11386
|
case 5:
|
|
10739
|
-
|
|
11387
|
+
_context26.n = 7;
|
|
10740
11388
|
break;
|
|
10741
11389
|
case 6:
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
_iterator6.e(
|
|
11390
|
+
_context26.p = 6;
|
|
11391
|
+
_t29 = _context26.v;
|
|
11392
|
+
_iterator6.e(_t29);
|
|
10745
11393
|
case 7:
|
|
10746
|
-
|
|
11394
|
+
_context26.p = 7;
|
|
10747
11395
|
_iterator6.f();
|
|
10748
|
-
return
|
|
11396
|
+
return _context26.f(7);
|
|
10749
11397
|
case 8:
|
|
10750
11398
|
/**
|
|
10751
11399
|
* Extract royalty distribution requests from workflow responses that contain royalty shares
|
|
@@ -10763,7 +11411,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10763
11411
|
deadline: res.extraData.deadline
|
|
10764
11412
|
};
|
|
10765
11413
|
}); // Process initial registration transactions
|
|
10766
|
-
|
|
11414
|
+
_context26.n = 9;
|
|
10767
11415
|
return handleMulticall({
|
|
10768
11416
|
transferWorkflowRequests: transferWorkflowRequests,
|
|
10769
11417
|
multicall3Address: this.multicall3Client.address,
|
|
@@ -10774,23 +11422,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10774
11422
|
chainId: this.chainId
|
|
10775
11423
|
});
|
|
10776
11424
|
case 9:
|
|
10777
|
-
_yield$handleMultical =
|
|
11425
|
+
_yield$handleMultical = _context26.v;
|
|
10778
11426
|
txResponses = _yield$handleMultical.response;
|
|
10779
11427
|
aggregateRegistrationRequest = _yield$handleMultical.aggregateRegistrationRequest;
|
|
10780
11428
|
responses = [];
|
|
10781
11429
|
royaltyTokensDistributionRequests = []; // Process each transaction response
|
|
10782
11430
|
_iterator7 = _createForOfIteratorHelper(txResponses);
|
|
10783
|
-
|
|
11431
|
+
_context26.p = 10;
|
|
10784
11432
|
_iterator7.s();
|
|
10785
11433
|
case 11:
|
|
10786
11434
|
if ((_step7 = _iterator7.n()).done) {
|
|
10787
|
-
|
|
11435
|
+
_context26.n = 14;
|
|
10788
11436
|
break;
|
|
10789
11437
|
}
|
|
10790
11438
|
_step7$value = _step7.value, txHash = _step7$value.txHash, receipt = _step7$value.receipt;
|
|
10791
11439
|
iPRegisteredLog = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(receipt);
|
|
10792
11440
|
ipRoyaltyVaultEvent = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt); // Prepare royalty distribution if needed
|
|
10793
|
-
|
|
11441
|
+
_context26.n = 12;
|
|
10794
11442
|
return prepareRoyaltyTokensDistributionRequests({
|
|
10795
11443
|
royaltyDistributionRequests: royaltyDistributionRequests,
|
|
10796
11444
|
ipRegisteredLog: iPRegisteredLog,
|
|
@@ -10800,7 +11448,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10800
11448
|
chainId: this.chainId
|
|
10801
11449
|
});
|
|
10802
11450
|
case 12:
|
|
10803
|
-
_yield$prepareRoyalty =
|
|
11451
|
+
_yield$prepareRoyalty = _context26.v;
|
|
10804
11452
|
requests = _yield$prepareRoyalty.requests;
|
|
10805
11453
|
ipRoyaltyVaults = _yield$prepareRoyalty.ipRoyaltyVaults;
|
|
10806
11454
|
royaltyTokensDistributionRequests.push.apply(royaltyTokensDistributionRequests, _toConsumableArray(requests));
|
|
@@ -10816,25 +11464,25 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10816
11464
|
})
|
|
10817
11465
|
});
|
|
10818
11466
|
case 13:
|
|
10819
|
-
|
|
11467
|
+
_context26.n = 11;
|
|
10820
11468
|
break;
|
|
10821
11469
|
case 14:
|
|
10822
|
-
|
|
11470
|
+
_context26.n = 16;
|
|
10823
11471
|
break;
|
|
10824
11472
|
case 15:
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
_iterator7.e(
|
|
11473
|
+
_context26.p = 15;
|
|
11474
|
+
_t30 = _context26.v;
|
|
11475
|
+
_iterator7.e(_t30);
|
|
10828
11476
|
case 16:
|
|
10829
|
-
|
|
11477
|
+
_context26.p = 16;
|
|
10830
11478
|
_iterator7.f();
|
|
10831
|
-
return
|
|
11479
|
+
return _context26.f(16);
|
|
10832
11480
|
case 17:
|
|
10833
11481
|
if (!(royaltyTokensDistributionRequests.length > 0)) {
|
|
10834
|
-
|
|
11482
|
+
_context26.n = 19;
|
|
10835
11483
|
break;
|
|
10836
11484
|
}
|
|
10837
|
-
|
|
11485
|
+
_context26.n = 18;
|
|
10838
11486
|
return handleMulticall({
|
|
10839
11487
|
transferWorkflowRequests: royaltyTokensDistributionRequests,
|
|
10840
11488
|
multicall3Address: this.multicall3Client.address,
|
|
@@ -10845,29 +11493,29 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10845
11493
|
chainId: this.chainId
|
|
10846
11494
|
});
|
|
10847
11495
|
case 18:
|
|
10848
|
-
_yield$handleMultical2 =
|
|
11496
|
+
_yield$handleMultical2 = _context26.v;
|
|
10849
11497
|
txResponse = _yield$handleMultical2.response;
|
|
10850
11498
|
distributeRoyaltyTokensTxHashes = txResponse.map(function (tx) {
|
|
10851
11499
|
return tx.txHash;
|
|
10852
11500
|
});
|
|
10853
11501
|
case 19:
|
|
10854
|
-
|
|
11502
|
+
_context26.n = 20;
|
|
10855
11503
|
return this.populateLicenseAndTokenIdsForRegistrationResults(responses, aggregateRegistrationRequest);
|
|
10856
11504
|
case 20:
|
|
10857
|
-
registrationResults =
|
|
10858
|
-
return
|
|
11505
|
+
registrationResults = _context26.v;
|
|
11506
|
+
return _context26.a(2, _objectSpread2({
|
|
10859
11507
|
registrationResults: registrationResults
|
|
10860
11508
|
}, distributeRoyaltyTokensTxHashes && {
|
|
10861
11509
|
distributeRoyaltyTokensTxHashes: distributeRoyaltyTokensTxHashes
|
|
10862
11510
|
}));
|
|
10863
11511
|
case 21:
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
return
|
|
11512
|
+
_context26.p = 21;
|
|
11513
|
+
_t31 = _context26.v;
|
|
11514
|
+
return _context26.a(2, handleError(_t31, "Failed to batch register IP assets with optimized workflows"));
|
|
10867
11515
|
}
|
|
10868
|
-
},
|
|
11516
|
+
}, _callee25, this, [[10, 15, 16, 17], [1, 6, 7, 8], [0, 21]]);
|
|
10869
11517
|
}));
|
|
10870
|
-
function batchRegisterIpAssetsWithOptimizedWorkflows(
|
|
11518
|
+
function batchRegisterIpAssetsWithOptimizedWorkflows(_x23) {
|
|
10871
11519
|
return _batchRegisterIpAssetsWithOptimizedWorkflows.apply(this, arguments);
|
|
10872
11520
|
}
|
|
10873
11521
|
return batchRegisterIpAssetsWithOptimizedWorkflows;
|
|
@@ -10937,51 +11585,51 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10937
11585
|
}, {
|
|
10938
11586
|
key: "registerIpAsset",
|
|
10939
11587
|
value: (function () {
|
|
10940
|
-
var _registerIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10941
|
-
var nft, licenseTermsData, royaltyShares,
|
|
10942
|
-
return _regenerator().w(function (
|
|
10943
|
-
while (1) switch (
|
|
11588
|
+
var _registerIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(request) {
|
|
11589
|
+
var nft, licenseTermsData, royaltyShares, _t32;
|
|
11590
|
+
return _regenerator().w(function (_context27) {
|
|
11591
|
+
while (1) switch (_context27.p = _context27.n) {
|
|
10944
11592
|
case 0:
|
|
10945
|
-
|
|
11593
|
+
_context27.p = 0;
|
|
10946
11594
|
nft = request.nft, licenseTermsData = request.licenseTermsData, royaltyShares = request.royaltyShares; // Validate royalty shares without license terms
|
|
10947
11595
|
if (!(royaltyShares && !licenseTermsData)) {
|
|
10948
|
-
|
|
11596
|
+
_context27.n = 1;
|
|
10949
11597
|
break;
|
|
10950
11598
|
}
|
|
10951
11599
|
throw new Error("License terms data must be provided when royalty shares are specified.");
|
|
10952
11600
|
case 1:
|
|
10953
11601
|
if (!(nft.type === "minted")) {
|
|
10954
|
-
|
|
11602
|
+
_context27.n = 3;
|
|
10955
11603
|
break;
|
|
10956
11604
|
}
|
|
10957
|
-
|
|
11605
|
+
_context27.n = 2;
|
|
10958
11606
|
return this.handleMintedNftRegistration(request);
|
|
10959
11607
|
case 2:
|
|
10960
|
-
return
|
|
11608
|
+
return _context27.a(2, _context27.v);
|
|
10961
11609
|
case 3:
|
|
10962
11610
|
if (!(nft.type === "mint")) {
|
|
10963
|
-
|
|
11611
|
+
_context27.n = 5;
|
|
10964
11612
|
break;
|
|
10965
11613
|
}
|
|
10966
|
-
|
|
11614
|
+
_context27.n = 4;
|
|
10967
11615
|
return this.handleMintNftRegistration(request);
|
|
10968
11616
|
case 4:
|
|
10969
|
-
return
|
|
11617
|
+
return _context27.a(2, _context27.v);
|
|
10970
11618
|
case 5:
|
|
10971
11619
|
throw new Error("Invalid NFT type");
|
|
10972
11620
|
case 6:
|
|
10973
|
-
|
|
11621
|
+
_context27.n = 8;
|
|
10974
11622
|
break;
|
|
10975
11623
|
case 7:
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
return
|
|
11624
|
+
_context27.p = 7;
|
|
11625
|
+
_t32 = _context27.v;
|
|
11626
|
+
return _context27.a(2, handleError(_t32, "Failed to register IP Asset"));
|
|
10979
11627
|
case 8:
|
|
10980
|
-
return
|
|
11628
|
+
return _context27.a(2);
|
|
10981
11629
|
}
|
|
10982
|
-
},
|
|
11630
|
+
}, _callee26, this, [[0, 7]]);
|
|
10983
11631
|
}));
|
|
10984
|
-
function registerIpAsset(
|
|
11632
|
+
function registerIpAsset(_x24) {
|
|
10985
11633
|
return _registerIpAsset.apply(this, arguments);
|
|
10986
11634
|
}
|
|
10987
11635
|
return registerIpAsset;
|
|
@@ -11050,15 +11698,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11050
11698
|
}, {
|
|
11051
11699
|
key: "registerDerivativeIpAsset",
|
|
11052
11700
|
value: (function () {
|
|
11053
|
-
var _registerDerivativeIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11054
|
-
var nft, licenseTokenIds, royaltyShares, derivData, hasDerivData, hasLicenseTokens,
|
|
11055
|
-
return _regenerator().w(function (
|
|
11056
|
-
while (1) switch (
|
|
11701
|
+
var _registerDerivativeIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(request) {
|
|
11702
|
+
var nft, licenseTokenIds, royaltyShares, derivData, hasDerivData, hasLicenseTokens, _t33;
|
|
11703
|
+
return _regenerator().w(function (_context28) {
|
|
11704
|
+
while (1) switch (_context28.p = _context28.n) {
|
|
11057
11705
|
case 0:
|
|
11058
|
-
|
|
11706
|
+
_context28.p = 0;
|
|
11059
11707
|
nft = request.nft, licenseTokenIds = request.licenseTokenIds, royaltyShares = request.royaltyShares, derivData = request.derivData;
|
|
11060
11708
|
if (!(royaltyShares && !derivData)) {
|
|
11061
|
-
|
|
11709
|
+
_context28.n = 1;
|
|
11062
11710
|
break;
|
|
11063
11711
|
}
|
|
11064
11712
|
throw new Error("derivData must be provided when royaltyShares are provided.");
|
|
@@ -11067,43 +11715,43 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11067
11715
|
hasDerivData = !!derivData;
|
|
11068
11716
|
hasLicenseTokens = !!(licenseTokenIds && licenseTokenIds.length > 0);
|
|
11069
11717
|
if (!(!hasDerivData && !hasLicenseTokens)) {
|
|
11070
|
-
|
|
11718
|
+
_context28.n = 2;
|
|
11071
11719
|
break;
|
|
11072
11720
|
}
|
|
11073
11721
|
throw new Error("Either derivData or licenseTokenIds must be provided.");
|
|
11074
11722
|
case 2:
|
|
11075
11723
|
if (!(nft.type === "minted")) {
|
|
11076
|
-
|
|
11724
|
+
_context28.n = 4;
|
|
11077
11725
|
break;
|
|
11078
11726
|
}
|
|
11079
|
-
|
|
11727
|
+
_context28.n = 3;
|
|
11080
11728
|
return this.handleMintedNftDerivativeRegistration(request);
|
|
11081
11729
|
case 3:
|
|
11082
|
-
return
|
|
11730
|
+
return _context28.a(2, _context28.v);
|
|
11083
11731
|
case 4:
|
|
11084
11732
|
if (!(nft.type === "mint")) {
|
|
11085
|
-
|
|
11733
|
+
_context28.n = 6;
|
|
11086
11734
|
break;
|
|
11087
11735
|
}
|
|
11088
|
-
|
|
11736
|
+
_context28.n = 5;
|
|
11089
11737
|
return this.handleMintNftDerivativeRegistration(request);
|
|
11090
11738
|
case 5:
|
|
11091
|
-
return
|
|
11739
|
+
return _context28.a(2, _context28.v);
|
|
11092
11740
|
case 6:
|
|
11093
11741
|
throw new Error("Invalid NFT type.");
|
|
11094
11742
|
case 7:
|
|
11095
|
-
|
|
11743
|
+
_context28.n = 9;
|
|
11096
11744
|
break;
|
|
11097
11745
|
case 8:
|
|
11098
|
-
|
|
11099
|
-
|
|
11100
|
-
return
|
|
11746
|
+
_context28.p = 8;
|
|
11747
|
+
_t33 = _context28.v;
|
|
11748
|
+
return _context28.a(2, handleError(_t33, "Failed to register derivative IP Asset"));
|
|
11101
11749
|
case 9:
|
|
11102
|
-
return
|
|
11750
|
+
return _context28.a(2);
|
|
11103
11751
|
}
|
|
11104
|
-
},
|
|
11752
|
+
}, _callee27, this, [[0, 8]]);
|
|
11105
11753
|
}));
|
|
11106
|
-
function registerDerivativeIpAsset(
|
|
11754
|
+
function registerDerivativeIpAsset(_x25) {
|
|
11107
11755
|
return _registerDerivativeIpAsset.apply(this, arguments);
|
|
11108
11756
|
}
|
|
11109
11757
|
return registerDerivativeIpAsset;
|
|
@@ -11120,10 +11768,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11120
11768
|
}, {
|
|
11121
11769
|
key: "handleMintedNftDerivativeRegistration",
|
|
11122
11770
|
value: (function () {
|
|
11123
|
-
var _handleMintedNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11771
|
+
var _handleMintedNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(request) {
|
|
11124
11772
|
var nft, royaltyShares, derivData, maxRts, licenseTokenIds, deadline, txOptions, options, ipMetadata, baseParams;
|
|
11125
|
-
return _regenerator().w(function (
|
|
11126
|
-
while (1) switch (
|
|
11773
|
+
return _regenerator().w(function (_context29) {
|
|
11774
|
+
while (1) switch (_context29.n) {
|
|
11127
11775
|
case 0:
|
|
11128
11776
|
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;
|
|
11129
11777
|
baseParams = {
|
|
@@ -11135,31 +11783,31 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11135
11783
|
options: options
|
|
11136
11784
|
};
|
|
11137
11785
|
if (!(royaltyShares && derivData)) {
|
|
11138
|
-
|
|
11786
|
+
_context29.n = 1;
|
|
11139
11787
|
break;
|
|
11140
11788
|
}
|
|
11141
|
-
return
|
|
11789
|
+
return _context29.a(2, this.registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11142
11790
|
royaltyShares: royaltyShares,
|
|
11143
11791
|
derivData: derivData
|
|
11144
11792
|
})));
|
|
11145
11793
|
case 1:
|
|
11146
11794
|
if (!derivData) {
|
|
11147
|
-
|
|
11795
|
+
_context29.n = 2;
|
|
11148
11796
|
break;
|
|
11149
11797
|
}
|
|
11150
|
-
return
|
|
11798
|
+
return _context29.a(2, this.registerDerivativeIp(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11151
11799
|
derivData: derivData
|
|
11152
11800
|
})));
|
|
11153
11801
|
case 2:
|
|
11154
|
-
return
|
|
11802
|
+
return _context29.a(2, this.registerIpAndMakeDerivativeWithLicenseTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11155
11803
|
licenseTokenIds: licenseTokenIds,
|
|
11156
11804
|
maxRts: maxRts,
|
|
11157
11805
|
autoApproveLicenseTokens: request.autoApproveLicenseTokens
|
|
11158
11806
|
})));
|
|
11159
11807
|
}
|
|
11160
|
-
},
|
|
11808
|
+
}, _callee28, this);
|
|
11161
11809
|
}));
|
|
11162
|
-
function handleMintedNftDerivativeRegistration(
|
|
11810
|
+
function handleMintedNftDerivativeRegistration(_x26) {
|
|
11163
11811
|
return _handleMintedNftDerivativeRegistration.apply(this, arguments);
|
|
11164
11812
|
}
|
|
11165
11813
|
return handleMintedNftDerivativeRegistration;
|
|
@@ -11176,10 +11824,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11176
11824
|
}, {
|
|
11177
11825
|
key: "handleMintNftDerivativeRegistration",
|
|
11178
11826
|
value: (function () {
|
|
11179
|
-
var _handleMintNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11827
|
+
var _handleMintNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(request) {
|
|
11180
11828
|
var nft, royaltyShares, derivData, maxRts, licenseTokenIds, txOptions, options, ipMetadata, baseParams;
|
|
11181
|
-
return _regenerator().w(function (
|
|
11182
|
-
while (1) switch (
|
|
11829
|
+
return _regenerator().w(function (_context30) {
|
|
11830
|
+
while (1) switch (_context30.n) {
|
|
11183
11831
|
case 0:
|
|
11184
11832
|
nft = request.nft, royaltyShares = request.royaltyShares, derivData = request.derivData, maxRts = request.maxRts, licenseTokenIds = request.licenseTokenIds, txOptions = request.txOptions, options = request.options, ipMetadata = request.ipMetadata;
|
|
11185
11833
|
baseParams = {
|
|
@@ -11191,31 +11839,31 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11191
11839
|
options: options
|
|
11192
11840
|
};
|
|
11193
11841
|
if (!(royaltyShares && derivData)) {
|
|
11194
|
-
|
|
11842
|
+
_context30.n = 1;
|
|
11195
11843
|
break;
|
|
11196
11844
|
}
|
|
11197
|
-
return
|
|
11845
|
+
return _context30.a(2, this.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11198
11846
|
royaltyShares: royaltyShares,
|
|
11199
11847
|
derivData: derivData
|
|
11200
11848
|
})));
|
|
11201
11849
|
case 1:
|
|
11202
11850
|
if (!derivData) {
|
|
11203
|
-
|
|
11851
|
+
_context30.n = 2;
|
|
11204
11852
|
break;
|
|
11205
11853
|
}
|
|
11206
|
-
return
|
|
11854
|
+
return _context30.a(2, this.mintAndRegisterIpAndMakeDerivative(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11207
11855
|
derivData: derivData
|
|
11208
11856
|
})));
|
|
11209
11857
|
case 2:
|
|
11210
|
-
return
|
|
11858
|
+
return _context30.a(2, this.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11211
11859
|
licenseTokenIds: licenseTokenIds,
|
|
11212
11860
|
maxRts: maxRts,
|
|
11213
11861
|
autoApproveLicenseTokens: request.autoApproveLicenseTokens
|
|
11214
11862
|
})));
|
|
11215
11863
|
}
|
|
11216
|
-
},
|
|
11864
|
+
}, _callee29, this);
|
|
11217
11865
|
}));
|
|
11218
|
-
function handleMintNftDerivativeRegistration(
|
|
11866
|
+
function handleMintNftDerivativeRegistration(_x27) {
|
|
11219
11867
|
return _handleMintNftDerivativeRegistration.apply(this, arguments);
|
|
11220
11868
|
}
|
|
11221
11869
|
return handleMintNftDerivativeRegistration;
|
|
@@ -11253,32 +11901,32 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11253
11901
|
}, {
|
|
11254
11902
|
key: "linkDerivative",
|
|
11255
11903
|
value: (function () {
|
|
11256
|
-
var _linkDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11257
|
-
var
|
|
11258
|
-
return _regenerator().w(function (
|
|
11259
|
-
while (1) switch (
|
|
11904
|
+
var _linkDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30(request) {
|
|
11905
|
+
var _t34;
|
|
11906
|
+
return _regenerator().w(function (_context31) {
|
|
11907
|
+
while (1) switch (_context31.p = _context31.n) {
|
|
11260
11908
|
case 0:
|
|
11261
|
-
|
|
11909
|
+
_context31.p = 0;
|
|
11262
11910
|
if (!("parentIpIds" in request)) {
|
|
11263
|
-
|
|
11911
|
+
_context31.n = 1;
|
|
11264
11912
|
break;
|
|
11265
11913
|
}
|
|
11266
|
-
return
|
|
11914
|
+
return _context31.a(2, this.registerDerivative(request));
|
|
11267
11915
|
case 1:
|
|
11268
|
-
return
|
|
11916
|
+
return _context31.a(2, this.registerDerivativeWithLicenseTokens(request));
|
|
11269
11917
|
case 2:
|
|
11270
|
-
|
|
11918
|
+
_context31.n = 4;
|
|
11271
11919
|
break;
|
|
11272
11920
|
case 3:
|
|
11273
|
-
|
|
11274
|
-
|
|
11275
|
-
return
|
|
11921
|
+
_context31.p = 3;
|
|
11922
|
+
_t34 = _context31.v;
|
|
11923
|
+
return _context31.a(2, handleError(_t34, "Failed to link derivative"));
|
|
11276
11924
|
case 4:
|
|
11277
|
-
return
|
|
11925
|
+
return _context31.a(2);
|
|
11278
11926
|
}
|
|
11279
|
-
},
|
|
11927
|
+
}, _callee30, this, [[0, 3]]);
|
|
11280
11928
|
}));
|
|
11281
|
-
function linkDerivative(
|
|
11929
|
+
function linkDerivative(_x28) {
|
|
11282
11930
|
return _linkDerivative.apply(this, arguments);
|
|
11283
11931
|
}
|
|
11284
11932
|
return linkDerivative;
|
|
@@ -11295,10 +11943,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11295
11943
|
}, {
|
|
11296
11944
|
key: "handleMintedNftRegistration",
|
|
11297
11945
|
value: (function () {
|
|
11298
|
-
var _handleMintedNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11946
|
+
var _handleMintedNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(request) {
|
|
11299
11947
|
var nft, ipMetadata, txOptions, licenseTermsData, royaltyShares, deadline, baseParams;
|
|
11300
|
-
return _regenerator().w(function (
|
|
11301
|
-
while (1) switch (
|
|
11948
|
+
return _regenerator().w(function (_context32) {
|
|
11949
|
+
while (1) switch (_context32.n) {
|
|
11302
11950
|
case 0:
|
|
11303
11951
|
nft = request.nft, ipMetadata = request.ipMetadata, txOptions = request.txOptions, licenseTermsData = request.licenseTermsData, royaltyShares = request.royaltyShares, deadline = request.deadline;
|
|
11304
11952
|
baseParams = {
|
|
@@ -11309,27 +11957,27 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11309
11957
|
txOptions: txOptions
|
|
11310
11958
|
};
|
|
11311
11959
|
if (!(licenseTermsData && royaltyShares)) {
|
|
11312
|
-
|
|
11960
|
+
_context32.n = 1;
|
|
11313
11961
|
break;
|
|
11314
11962
|
}
|
|
11315
|
-
return
|
|
11963
|
+
return _context32.a(2, this.registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11316
11964
|
licenseTermsData: licenseTermsData,
|
|
11317
11965
|
royaltyShares: royaltyShares
|
|
11318
11966
|
})));
|
|
11319
11967
|
case 1:
|
|
11320
11968
|
if (!licenseTermsData) {
|
|
11321
|
-
|
|
11969
|
+
_context32.n = 2;
|
|
11322
11970
|
break;
|
|
11323
11971
|
}
|
|
11324
|
-
return
|
|
11972
|
+
return _context32.a(2, this.registerIpAndAttachPilTerms(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11325
11973
|
licenseTermsData: licenseTermsData
|
|
11326
11974
|
})));
|
|
11327
11975
|
case 2:
|
|
11328
|
-
return
|
|
11976
|
+
return _context32.a(2, this.register(_objectSpread2({}, baseParams)));
|
|
11329
11977
|
}
|
|
11330
|
-
},
|
|
11978
|
+
}, _callee31, this);
|
|
11331
11979
|
}));
|
|
11332
|
-
function handleMintedNftRegistration(
|
|
11980
|
+
function handleMintedNftRegistration(_x29) {
|
|
11333
11981
|
return _handleMintedNftRegistration.apply(this, arguments);
|
|
11334
11982
|
}
|
|
11335
11983
|
return handleMintedNftRegistration;
|
|
@@ -11346,10 +11994,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11346
11994
|
}, {
|
|
11347
11995
|
key: "handleMintNftRegistration",
|
|
11348
11996
|
value: (function () {
|
|
11349
|
-
var _handleMintNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11997
|
+
var _handleMintNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32(request) {
|
|
11350
11998
|
var nft, ipMetadata, txOptions, options, licenseTermsData, royaltyShares, baseParams;
|
|
11351
|
-
return _regenerator().w(function (
|
|
11352
|
-
while (1) switch (
|
|
11999
|
+
return _regenerator().w(function (_context33) {
|
|
12000
|
+
while (1) switch (_context33.n) {
|
|
11353
12001
|
case 0:
|
|
11354
12002
|
nft = request.nft, ipMetadata = request.ipMetadata, txOptions = request.txOptions, options = request.options, licenseTermsData = request.licenseTermsData, royaltyShares = request.royaltyShares;
|
|
11355
12003
|
baseParams = {
|
|
@@ -11361,27 +12009,27 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11361
12009
|
options: options
|
|
11362
12010
|
};
|
|
11363
12011
|
if (!(licenseTermsData && royaltyShares)) {
|
|
11364
|
-
|
|
12012
|
+
_context33.n = 1;
|
|
11365
12013
|
break;
|
|
11366
12014
|
}
|
|
11367
|
-
return
|
|
12015
|
+
return _context33.a(2, this.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11368
12016
|
licenseTermsData: licenseTermsData,
|
|
11369
12017
|
royaltyShares: royaltyShares
|
|
11370
12018
|
})));
|
|
11371
12019
|
case 1:
|
|
11372
12020
|
if (!licenseTermsData) {
|
|
11373
|
-
|
|
12021
|
+
_context33.n = 2;
|
|
11374
12022
|
break;
|
|
11375
12023
|
}
|
|
11376
|
-
return
|
|
12024
|
+
return _context33.a(2, this.mintAndRegisterIpAssetWithPilTerms(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11377
12025
|
licenseTermsData: licenseTermsData
|
|
11378
12026
|
})));
|
|
11379
12027
|
case 2:
|
|
11380
|
-
return
|
|
12028
|
+
return _context33.a(2, this.mintAndRegisterIp(_objectSpread2({}, baseParams)));
|
|
11381
12029
|
}
|
|
11382
|
-
},
|
|
12030
|
+
}, _callee32, this);
|
|
11383
12031
|
}));
|
|
11384
|
-
function handleMintNftRegistration(
|
|
12032
|
+
function handleMintNftRegistration(_x30) {
|
|
11385
12033
|
return _handleMintNftRegistration.apply(this, arguments);
|
|
11386
12034
|
}
|
|
11387
12035
|
return handleMintNftRegistration;
|
|
@@ -11389,48 +12037,48 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11389
12037
|
}, {
|
|
11390
12038
|
key: "getLicenseTermsId",
|
|
11391
12039
|
value: function () {
|
|
11392
|
-
var _getLicenseTermsId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11393
|
-
var licenseTermsIds, _iterator8, _step8, licenseTerm, licenseRes,
|
|
11394
|
-
return _regenerator().w(function (
|
|
11395
|
-
while (1) switch (
|
|
12040
|
+
var _getLicenseTermsId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33(licenseTerms) {
|
|
12041
|
+
var licenseTermsIds, _iterator8, _step8, licenseTerm, licenseRes, _t35;
|
|
12042
|
+
return _regenerator().w(function (_context34) {
|
|
12043
|
+
while (1) switch (_context34.p = _context34.n) {
|
|
11396
12044
|
case 0:
|
|
11397
12045
|
licenseTermsIds = [];
|
|
11398
12046
|
_iterator8 = _createForOfIteratorHelper(licenseTerms);
|
|
11399
|
-
|
|
12047
|
+
_context34.p = 1;
|
|
11400
12048
|
_iterator8.s();
|
|
11401
12049
|
case 2:
|
|
11402
12050
|
if ((_step8 = _iterator8.n()).done) {
|
|
11403
|
-
|
|
12051
|
+
_context34.n = 5;
|
|
11404
12052
|
break;
|
|
11405
12053
|
}
|
|
11406
12054
|
licenseTerm = _step8.value;
|
|
11407
|
-
|
|
12055
|
+
_context34.n = 3;
|
|
11408
12056
|
return this.licenseTemplateClient.getLicenseTermsId({
|
|
11409
12057
|
terms: licenseTerm
|
|
11410
12058
|
});
|
|
11411
12059
|
case 3:
|
|
11412
|
-
licenseRes =
|
|
12060
|
+
licenseRes = _context34.v;
|
|
11413
12061
|
licenseTermsIds.push(licenseRes.selectedLicenseTermsId);
|
|
11414
12062
|
case 4:
|
|
11415
|
-
|
|
12063
|
+
_context34.n = 2;
|
|
11416
12064
|
break;
|
|
11417
12065
|
case 5:
|
|
11418
|
-
|
|
12066
|
+
_context34.n = 7;
|
|
11419
12067
|
break;
|
|
11420
12068
|
case 6:
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
_iterator8.e(
|
|
12069
|
+
_context34.p = 6;
|
|
12070
|
+
_t35 = _context34.v;
|
|
12071
|
+
_iterator8.e(_t35);
|
|
11424
12072
|
case 7:
|
|
11425
|
-
|
|
12073
|
+
_context34.p = 7;
|
|
11426
12074
|
_iterator8.f();
|
|
11427
|
-
return
|
|
12075
|
+
return _context34.f(7);
|
|
11428
12076
|
case 8:
|
|
11429
|
-
return
|
|
12077
|
+
return _context34.a(2, licenseTermsIds);
|
|
11430
12078
|
}
|
|
11431
|
-
},
|
|
12079
|
+
}, _callee33, this, [[1, 6, 7, 8]]);
|
|
11432
12080
|
}));
|
|
11433
|
-
function getLicenseTermsId(
|
|
12081
|
+
function getLicenseTermsId(_x31) {
|
|
11434
12082
|
return _getLicenseTermsId.apply(this, arguments);
|
|
11435
12083
|
}
|
|
11436
12084
|
return getLicenseTermsId;
|
|
@@ -11438,13 +12086,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11438
12086
|
}, {
|
|
11439
12087
|
key: "validateLicenseTokenIds",
|
|
11440
12088
|
value: function () {
|
|
11441
|
-
var _validateLicenseTokenIds = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11442
|
-
var newLicenseTokenIds, _iterator9, _step9, licenseTokenId, tokenOwnerAddress,
|
|
11443
|
-
return _regenerator().w(function (
|
|
11444
|
-
while (1) switch (
|
|
12089
|
+
var _validateLicenseTokenIds = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(licenseTokenIds) {
|
|
12090
|
+
var newLicenseTokenIds, _iterator9, _step9, licenseTokenId, tokenOwnerAddress, _t36;
|
|
12091
|
+
return _regenerator().w(function (_context35) {
|
|
12092
|
+
while (1) switch (_context35.p = _context35.n) {
|
|
11445
12093
|
case 0:
|
|
11446
12094
|
if (!(licenseTokenIds.length === 0)) {
|
|
11447
|
-
|
|
12095
|
+
_context35.n = 1;
|
|
11448
12096
|
break;
|
|
11449
12097
|
}
|
|
11450
12098
|
throw new Error("License token IDs must be provided.");
|
|
@@ -11453,45 +12101,45 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11453
12101
|
return BigInt(id);
|
|
11454
12102
|
});
|
|
11455
12103
|
_iterator9 = _createForOfIteratorHelper(newLicenseTokenIds);
|
|
11456
|
-
|
|
12104
|
+
_context35.p = 2;
|
|
11457
12105
|
_iterator9.s();
|
|
11458
12106
|
case 3:
|
|
11459
12107
|
if ((_step9 = _iterator9.n()).done) {
|
|
11460
|
-
|
|
12108
|
+
_context35.n = 6;
|
|
11461
12109
|
break;
|
|
11462
12110
|
}
|
|
11463
12111
|
licenseTokenId = _step9.value;
|
|
11464
|
-
|
|
12112
|
+
_context35.n = 4;
|
|
11465
12113
|
return this.licenseTokenReadOnlyClient.ownerOf({
|
|
11466
12114
|
tokenId: licenseTokenId
|
|
11467
12115
|
});
|
|
11468
12116
|
case 4:
|
|
11469
|
-
tokenOwnerAddress =
|
|
12117
|
+
tokenOwnerAddress = _context35.v;
|
|
11470
12118
|
if (tokenOwnerAddress) {
|
|
11471
|
-
|
|
12119
|
+
_context35.n = 5;
|
|
11472
12120
|
break;
|
|
11473
12121
|
}
|
|
11474
12122
|
throw new Error("License token id ".concat(licenseTokenId, " must be owned by the caller."));
|
|
11475
12123
|
case 5:
|
|
11476
|
-
|
|
12124
|
+
_context35.n = 3;
|
|
11477
12125
|
break;
|
|
11478
12126
|
case 6:
|
|
11479
|
-
|
|
12127
|
+
_context35.n = 8;
|
|
11480
12128
|
break;
|
|
11481
12129
|
case 7:
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
_iterator9.e(
|
|
12130
|
+
_context35.p = 7;
|
|
12131
|
+
_t36 = _context35.v;
|
|
12132
|
+
_iterator9.e(_t36);
|
|
11485
12133
|
case 8:
|
|
11486
|
-
|
|
12134
|
+
_context35.p = 8;
|
|
11487
12135
|
_iterator9.f();
|
|
11488
|
-
return
|
|
12136
|
+
return _context35.f(8);
|
|
11489
12137
|
case 9:
|
|
11490
|
-
return
|
|
12138
|
+
return _context35.a(2, newLicenseTokenIds);
|
|
11491
12139
|
}
|
|
11492
|
-
},
|
|
12140
|
+
}, _callee34, this, [[2, 7, 8, 9]]);
|
|
11493
12141
|
}));
|
|
11494
|
-
function validateLicenseTokenIds(
|
|
12142
|
+
function validateLicenseTokenIds(_x32) {
|
|
11495
12143
|
return _validateLicenseTokenIds.apply(this, arguments);
|
|
11496
12144
|
}
|
|
11497
12145
|
return validateLicenseTokenIds;
|
|
@@ -11514,28 +12162,28 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11514
12162
|
}, {
|
|
11515
12163
|
key: "handleRegistrationWithFees",
|
|
11516
12164
|
value: function () {
|
|
11517
|
-
var _handleRegistrationWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
12165
|
+
var _handleRegistrationWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35(_ref6) {
|
|
11518
12166
|
var _wipOptions$useMultic, _this$getIpIdAndToken, _event$ipId, _event$tokenId;
|
|
11519
12167
|
var sender, derivData, spgNftContract, spgSpenderAddress, txOptions, options, encodedTxs, contractCall, tokenSpenders, wipOptions, useMulticallWhenPossible, nftMintFee, publicMinting, mintFees, _iterator0, _step0, mintFee, _yield$contractCallWi, txHash, receipt, event;
|
|
11520
|
-
return _regenerator().w(function (
|
|
11521
|
-
while (1) switch (
|
|
12168
|
+
return _regenerator().w(function (_context36) {
|
|
12169
|
+
while (1) switch (_context36.n) {
|
|
11522
12170
|
case 0:
|
|
11523
|
-
sender =
|
|
12171
|
+
sender = _ref6.sender, derivData = _ref6.derivData, spgNftContract = _ref6.spgNftContract, spgSpenderAddress = _ref6.spgSpenderAddress, txOptions = _ref6.txOptions, options = _ref6.options, encodedTxs = _ref6.encodedTxs, contractCall = _ref6.contractCall;
|
|
11524
12172
|
tokenSpenders = [];
|
|
11525
12173
|
wipOptions = options === null || options === void 0 ? void 0 : options.wipOptions;
|
|
11526
12174
|
useMulticallWhenPossible = (_wipOptions$useMultic = wipOptions === null || wipOptions === void 0 ? void 0 : wipOptions.useMulticallWhenPossible) !== null && _wipOptions$useMultic !== void 0 ? _wipOptions$useMultic : true; // get spg minting fee
|
|
11527
12175
|
if (!spgNftContract) {
|
|
11528
|
-
|
|
12176
|
+
_context36.n = 3;
|
|
11529
12177
|
break;
|
|
11530
12178
|
}
|
|
11531
|
-
|
|
12179
|
+
_context36.n = 1;
|
|
11532
12180
|
return calculateSPGMintFee(new SpgnftImplReadOnlyClient(this.rpcClient, spgNftContract));
|
|
11533
12181
|
case 1:
|
|
11534
|
-
nftMintFee =
|
|
11535
|
-
|
|
12182
|
+
nftMintFee = _context36.v;
|
|
12183
|
+
_context36.n = 2;
|
|
11536
12184
|
return getPublicMinting(spgNftContract, this.rpcClient);
|
|
11537
12185
|
case 2:
|
|
11538
|
-
publicMinting =
|
|
12186
|
+
publicMinting = _context36.v;
|
|
11539
12187
|
/**
|
|
11540
12188
|
* If the SPG NFT contract's public minting is disabled, we need to check if the caller has the `minter role`.
|
|
11541
12189
|
* When public minting is disabled, we can't use multicall because we need to perform additional role checks
|
|
@@ -11552,10 +12200,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11552
12200
|
}, nftMintFee)] : []));
|
|
11553
12201
|
case 3:
|
|
11554
12202
|
if (!derivData) {
|
|
11555
|
-
|
|
12203
|
+
_context36.n = 5;
|
|
11556
12204
|
break;
|
|
11557
12205
|
}
|
|
11558
|
-
|
|
12206
|
+
_context36.n = 4;
|
|
11559
12207
|
return calculateDerivativeMintingFee({
|
|
11560
12208
|
derivData: derivData,
|
|
11561
12209
|
rpcClient: this.rpcClient,
|
|
@@ -11564,7 +12212,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11564
12212
|
sender: sender
|
|
11565
12213
|
});
|
|
11566
12214
|
case 4:
|
|
11567
|
-
mintFees =
|
|
12215
|
+
mintFees = _context36.v;
|
|
11568
12216
|
_iterator0 = _createForOfIteratorHelper(mintFees);
|
|
11569
12217
|
try {
|
|
11570
12218
|
for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
|
|
@@ -11579,7 +12227,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11579
12227
|
_iterator0.f();
|
|
11580
12228
|
}
|
|
11581
12229
|
case 5:
|
|
11582
|
-
|
|
12230
|
+
_context36.n = 6;
|
|
11583
12231
|
return contractCallWithFees({
|
|
11584
12232
|
options: _objectSpread2(_objectSpread2({}, options), {}, {
|
|
11585
12233
|
wipOptions: _objectSpread2(_objectSpread2({}, wipOptions), {}, {
|
|
@@ -11596,11 +12244,11 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11596
12244
|
encodedTxs: encodedTxs
|
|
11597
12245
|
});
|
|
11598
12246
|
case 6:
|
|
11599
|
-
_yield$contractCallWi =
|
|
12247
|
+
_yield$contractCallWi = _context36.v;
|
|
11600
12248
|
txHash = _yield$contractCallWi.txHash;
|
|
11601
12249
|
receipt = _yield$contractCallWi.receipt;
|
|
11602
12250
|
event = (_this$getIpIdAndToken = this.getIpIdAndTokenIdsFromEvent(receipt)) === null || _this$getIpIdAndToken === void 0 ? void 0 : _this$getIpIdAndToken[0];
|
|
11603
|
-
return
|
|
12251
|
+
return _context36.a(2, _objectSpread2({
|
|
11604
12252
|
txHash: txHash,
|
|
11605
12253
|
receipt: receipt
|
|
11606
12254
|
}, event && {
|
|
@@ -11608,9 +12256,9 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11608
12256
|
tokenId: (_event$tokenId = event.tokenId) !== null && _event$tokenId !== void 0 ? _event$tokenId : undefined
|
|
11609
12257
|
}));
|
|
11610
12258
|
}
|
|
11611
|
-
},
|
|
12259
|
+
}, _callee35, this);
|
|
11612
12260
|
}));
|
|
11613
|
-
function handleRegistrationWithFees(
|
|
12261
|
+
function handleRegistrationWithFees(_x33) {
|
|
11614
12262
|
return _handleRegistrationWithFees.apply(this, arguments);
|
|
11615
12263
|
}
|
|
11616
12264
|
return handleRegistrationWithFees;
|
|
@@ -11621,66 +12269,66 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11621
12269
|
}, {
|
|
11622
12270
|
key: "populateLicenseAndTokenIdsForRegistrationResults",
|
|
11623
12271
|
value: (function () {
|
|
11624
|
-
var _populateLicenseAndTokenIdsForRegistrationResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11625
|
-
var allExtraDataArrays, allExtraData, extraDataFlatIndex, _iterator1, _step1, registrationResult, i, ipAsset,
|
|
11626
|
-
return _regenerator().w(function (
|
|
11627
|
-
while (1) switch (
|
|
12272
|
+
var _populateLicenseAndTokenIdsForRegistrationResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36(registrationResults, aggregateRegistrationRequest) {
|
|
12273
|
+
var allExtraDataArrays, allExtraData, extraDataFlatIndex, _iterator1, _step1, registrationResult, i, ipAsset, _t37;
|
|
12274
|
+
return _regenerator().w(function (_context37) {
|
|
12275
|
+
while (1) switch (_context37.p = _context37.n) {
|
|
11628
12276
|
case 0:
|
|
11629
|
-
allExtraDataArrays = Object.values(aggregateRegistrationRequest).map(function (
|
|
11630
|
-
var extraData =
|
|
12277
|
+
allExtraDataArrays = Object.values(aggregateRegistrationRequest).map(function (_ref7) {
|
|
12278
|
+
var extraData = _ref7.extraData;
|
|
11631
12279
|
return extraData;
|
|
11632
12280
|
});
|
|
11633
12281
|
allExtraData = allExtraDataArrays.flat();
|
|
11634
12282
|
extraDataFlatIndex = -1;
|
|
11635
12283
|
_iterator1 = _createForOfIteratorHelper(registrationResults);
|
|
11636
|
-
|
|
12284
|
+
_context37.p = 1;
|
|
11637
12285
|
_iterator1.s();
|
|
11638
12286
|
case 2:
|
|
11639
12287
|
if ((_step1 = _iterator1.n()).done) {
|
|
11640
|
-
|
|
12288
|
+
_context37.n = 7;
|
|
11641
12289
|
break;
|
|
11642
12290
|
}
|
|
11643
12291
|
registrationResult = _step1.value;
|
|
11644
12292
|
i = 0;
|
|
11645
12293
|
case 3:
|
|
11646
12294
|
if (!(i < registrationResult.ipAssetsWithLicenseTerms.length)) {
|
|
11647
|
-
|
|
12295
|
+
_context37.n = 6;
|
|
11648
12296
|
break;
|
|
11649
12297
|
}
|
|
11650
12298
|
extraDataFlatIndex++;
|
|
11651
12299
|
if (!(registrationResult.ipAssetsWithLicenseTerms[i] && allExtraData[extraDataFlatIndex])) {
|
|
11652
|
-
|
|
12300
|
+
_context37.n = 5;
|
|
11653
12301
|
break;
|
|
11654
12302
|
}
|
|
11655
|
-
|
|
12303
|
+
_context37.n = 4;
|
|
11656
12304
|
return this.processIpAssetLicenseTerms(registrationResult.ipAssetsWithLicenseTerms[i], allExtraData[extraDataFlatIndex]);
|
|
11657
12305
|
case 4:
|
|
11658
|
-
ipAsset =
|
|
12306
|
+
ipAsset = _context37.v;
|
|
11659
12307
|
registrationResult.ipAssetsWithLicenseTerms[i] = ipAsset;
|
|
11660
12308
|
case 5:
|
|
11661
12309
|
i++;
|
|
11662
|
-
|
|
12310
|
+
_context37.n = 3;
|
|
11663
12311
|
break;
|
|
11664
12312
|
case 6:
|
|
11665
|
-
|
|
12313
|
+
_context37.n = 2;
|
|
11666
12314
|
break;
|
|
11667
12315
|
case 7:
|
|
11668
|
-
|
|
12316
|
+
_context37.n = 9;
|
|
11669
12317
|
break;
|
|
11670
12318
|
case 8:
|
|
11671
|
-
|
|
11672
|
-
|
|
11673
|
-
_iterator1.e(
|
|
12319
|
+
_context37.p = 8;
|
|
12320
|
+
_t37 = _context37.v;
|
|
12321
|
+
_iterator1.e(_t37);
|
|
11674
12322
|
case 9:
|
|
11675
|
-
|
|
12323
|
+
_context37.p = 9;
|
|
11676
12324
|
_iterator1.f();
|
|
11677
|
-
return
|
|
12325
|
+
return _context37.f(9);
|
|
11678
12326
|
case 10:
|
|
11679
|
-
return
|
|
12327
|
+
return _context37.a(2, registrationResults);
|
|
11680
12328
|
}
|
|
11681
|
-
},
|
|
12329
|
+
}, _callee36, this, [[1, 8, 9, 10]]);
|
|
11682
12330
|
}));
|
|
11683
|
-
function populateLicenseAndTokenIdsForRegistrationResults(
|
|
12331
|
+
function populateLicenseAndTokenIdsForRegistrationResults(_x34, _x35) {
|
|
11684
12332
|
return _populateLicenseAndTokenIdsForRegistrationResults.apply(this, arguments);
|
|
11685
12333
|
}
|
|
11686
12334
|
return populateLicenseAndTokenIdsForRegistrationResults;
|
|
@@ -11688,31 +12336,31 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11688
12336
|
}, {
|
|
11689
12337
|
key: "processIpAssetLicenseTerms",
|
|
11690
12338
|
value: function () {
|
|
11691
|
-
var _processIpAssetLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
12339
|
+
var _processIpAssetLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37(ipAsset, extraData) {
|
|
11692
12340
|
var _extraData$licenseTer;
|
|
11693
12341
|
var licenseTermsIds, maxLicenseTokens, maxLicenseTokensData, maxLicenseTokensTxHashes;
|
|
11694
|
-
return _regenerator().w(function (
|
|
11695
|
-
while (1) switch (
|
|
12342
|
+
return _regenerator().w(function (_context38) {
|
|
12343
|
+
while (1) switch (_context38.n) {
|
|
11696
12344
|
case 0:
|
|
11697
12345
|
if (extraData !== null && extraData !== void 0 && (_extraData$licenseTer = extraData.licenseTermsData) !== null && _extraData$licenseTer !== void 0 && _extraData$licenseTer.length) {
|
|
11698
|
-
|
|
12346
|
+
_context38.n = 1;
|
|
11699
12347
|
break;
|
|
11700
12348
|
}
|
|
11701
|
-
return
|
|
12349
|
+
return _context38.a(2, ipAsset);
|
|
11702
12350
|
case 1:
|
|
11703
|
-
|
|
12351
|
+
_context38.n = 2;
|
|
11704
12352
|
return this.getLicenseTermsId(extraData.licenseTermsData.map(function (item) {
|
|
11705
12353
|
return item.terms;
|
|
11706
12354
|
}));
|
|
11707
12355
|
case 2:
|
|
11708
|
-
licenseTermsIds =
|
|
12356
|
+
licenseTermsIds = _context38.v;
|
|
11709
12357
|
ipAsset.licenseTermsIds = licenseTermsIds;
|
|
11710
12358
|
maxLicenseTokens = extraData.maxLicenseTokens;
|
|
11711
12359
|
if (maxLicenseTokens !== null && maxLicenseTokens !== void 0 && maxLicenseTokens.length) {
|
|
11712
|
-
|
|
12360
|
+
_context38.n = 3;
|
|
11713
12361
|
break;
|
|
11714
12362
|
}
|
|
11715
|
-
return
|
|
12363
|
+
return _context38.a(2, ipAsset);
|
|
11716
12364
|
case 3:
|
|
11717
12365
|
maxLicenseTokensData = maxLicenseTokens.filter(function (maxLicenseToken) {
|
|
11718
12366
|
return maxLicenseToken !== undefined;
|
|
@@ -11721,7 +12369,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11721
12369
|
maxLicenseTokens: maxLicenseToken
|
|
11722
12370
|
};
|
|
11723
12371
|
});
|
|
11724
|
-
|
|
12372
|
+
_context38.n = 4;
|
|
11725
12373
|
return setMaxLicenseTokens({
|
|
11726
12374
|
maxLicenseTokensData: maxLicenseTokensData,
|
|
11727
12375
|
licensorIpId: ipAsset.ipId,
|
|
@@ -11730,15 +12378,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11730
12378
|
templateAddress: this.licenseTemplateAddress
|
|
11731
12379
|
});
|
|
11732
12380
|
case 4:
|
|
11733
|
-
maxLicenseTokensTxHashes =
|
|
12381
|
+
maxLicenseTokensTxHashes = _context38.v;
|
|
11734
12382
|
if (maxLicenseTokensTxHashes !== null && maxLicenseTokensTxHashes !== void 0 && maxLicenseTokensTxHashes.length) {
|
|
11735
12383
|
ipAsset.maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
|
|
11736
12384
|
}
|
|
11737
|
-
return
|
|
12385
|
+
return _context38.a(2, ipAsset);
|
|
11738
12386
|
}
|
|
11739
|
-
},
|
|
12387
|
+
}, _callee37, this);
|
|
11740
12388
|
}));
|
|
11741
|
-
function processIpAssetLicenseTerms(
|
|
12389
|
+
function processIpAssetLicenseTerms(_x36, _x37) {
|
|
11742
12390
|
return _processIpAssetLicenseTerms.apply(this, arguments);
|
|
11743
12391
|
}
|
|
11744
12392
|
return processIpAssetLicenseTerms;
|
|
@@ -11746,53 +12394,53 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11746
12394
|
}, {
|
|
11747
12395
|
key: "approveLicenseTokensForDerivativeWorkflows",
|
|
11748
12396
|
value: function () {
|
|
11749
|
-
var _approveLicenseTokensForDerivativeWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11750
|
-
var _iterator10, _step10, licenseTokenId, txHash,
|
|
11751
|
-
return _regenerator().w(function (
|
|
11752
|
-
while (1) switch (
|
|
12397
|
+
var _approveLicenseTokensForDerivativeWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38(licenseTokenIds, autoApproveLicenseTokens) {
|
|
12398
|
+
var _iterator10, _step10, licenseTokenId, txHash, _t38;
|
|
12399
|
+
return _regenerator().w(function (_context39) {
|
|
12400
|
+
while (1) switch (_context39.p = _context39.n) {
|
|
11753
12401
|
case 0:
|
|
11754
12402
|
if (!(autoApproveLicenseTokens !== false)) {
|
|
11755
|
-
|
|
12403
|
+
_context39.n = 8;
|
|
11756
12404
|
break;
|
|
11757
12405
|
}
|
|
11758
12406
|
_iterator10 = _createForOfIteratorHelper(licenseTokenIds);
|
|
11759
|
-
|
|
12407
|
+
_context39.p = 1;
|
|
11760
12408
|
_iterator10.s();
|
|
11761
12409
|
case 2:
|
|
11762
12410
|
if ((_step10 = _iterator10.n()).done) {
|
|
11763
|
-
|
|
12411
|
+
_context39.n = 5;
|
|
11764
12412
|
break;
|
|
11765
12413
|
}
|
|
11766
12414
|
licenseTokenId = _step10.value;
|
|
11767
|
-
|
|
12415
|
+
_context39.n = 3;
|
|
11768
12416
|
return this.licenseTokenClient.approve({
|
|
11769
12417
|
to: this.derivativeWorkflowsClient.address,
|
|
11770
12418
|
tokenId: BigInt(licenseTokenId)
|
|
11771
12419
|
});
|
|
11772
12420
|
case 3:
|
|
11773
|
-
txHash =
|
|
11774
|
-
|
|
12421
|
+
txHash = _context39.v;
|
|
12422
|
+
_context39.n = 4;
|
|
11775
12423
|
return waitTx(this.rpcClient, txHash);
|
|
11776
12424
|
case 4:
|
|
11777
|
-
|
|
12425
|
+
_context39.n = 2;
|
|
11778
12426
|
break;
|
|
11779
12427
|
case 5:
|
|
11780
|
-
|
|
12428
|
+
_context39.n = 7;
|
|
11781
12429
|
break;
|
|
11782
12430
|
case 6:
|
|
11783
|
-
|
|
11784
|
-
|
|
11785
|
-
_iterator10.e(
|
|
12431
|
+
_context39.p = 6;
|
|
12432
|
+
_t38 = _context39.v;
|
|
12433
|
+
_iterator10.e(_t38);
|
|
11786
12434
|
case 7:
|
|
11787
|
-
|
|
12435
|
+
_context39.p = 7;
|
|
11788
12436
|
_iterator10.f();
|
|
11789
|
-
return
|
|
12437
|
+
return _context39.f(7);
|
|
11790
12438
|
case 8:
|
|
11791
|
-
return
|
|
12439
|
+
return _context39.a(2);
|
|
11792
12440
|
}
|
|
11793
|
-
},
|
|
12441
|
+
}, _callee38, this, [[1, 6, 7, 8]]);
|
|
11794
12442
|
}));
|
|
11795
|
-
function approveLicenseTokensForDerivativeWorkflows(
|
|
12443
|
+
function approveLicenseTokensForDerivativeWorkflows(_x38, _x39) {
|
|
11796
12444
|
return _approveLicenseTokensForDerivativeWorkflows.apply(this, arguments);
|
|
11797
12445
|
}
|
|
11798
12446
|
return approveLicenseTokensForDerivativeWorkflows;
|
|
@@ -12356,7 +13004,8 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
|
12356
13004
|
licensingConfig: _objectSpread2(_objectSpread2({}, licensingConfig), {}, {
|
|
12357
13005
|
licensingHook: this.totalLicenseTokenLimitHookClient.address,
|
|
12358
13006
|
// use Math.trunc to avoid precision issues
|
|
12359
|
-
expectMinimumGroupRewardShare: Math.trunc(licensingConfig.expectMinimumGroupRewardShare / 1000000)
|
|
13007
|
+
expectMinimumGroupRewardShare: Math.trunc(licensingConfig.expectMinimumGroupRewardShare / 1000000),
|
|
13008
|
+
commercialRevShare: Math.trunc(licensingConfig.commercialRevShare / 1000000)
|
|
12360
13009
|
})
|
|
12361
13010
|
});
|
|
12362
13011
|
case 4:
|
|
@@ -12992,6 +13641,32 @@ var NftClient = /*#__PURE__*/function () {
|
|
|
12992
13641
|
return _getTokenURI.apply(this, arguments);
|
|
12993
13642
|
}
|
|
12994
13643
|
return getTokenURI;
|
|
13644
|
+
}()
|
|
13645
|
+
/**
|
|
13646
|
+
* Returns the number of NFTs owned by an address in a specific SPG NFT collection.
|
|
13647
|
+
*/
|
|
13648
|
+
)
|
|
13649
|
+
}, {
|
|
13650
|
+
key: "getNFTBalance",
|
|
13651
|
+
value: (function () {
|
|
13652
|
+
var _getNFTBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(_ref3) {
|
|
13653
|
+
var spgNftContract, owner, spgNftClient, ownerAddress;
|
|
13654
|
+
return _regenerator().w(function (_context6) {
|
|
13655
|
+
while (1) switch (_context6.n) {
|
|
13656
|
+
case 0:
|
|
13657
|
+
spgNftContract = _ref3.spgNftContract, owner = _ref3.owner;
|
|
13658
|
+
spgNftClient = new SpgnftImplReadOnlyClient(this.rpcClient, validateAddress(spgNftContract));
|
|
13659
|
+
ownerAddress = validateAddress(owner !== null && owner !== void 0 ? owner : this.wallet.account.address);
|
|
13660
|
+
return _context6.a(2, spgNftClient.balanceOf({
|
|
13661
|
+
owner: ownerAddress
|
|
13662
|
+
}));
|
|
13663
|
+
}
|
|
13664
|
+
}, _callee6, this);
|
|
13665
|
+
}));
|
|
13666
|
+
function getNFTBalance(_x6) {
|
|
13667
|
+
return _getNFTBalance.apply(this, arguments);
|
|
13668
|
+
}
|
|
13669
|
+
return getNFTBalance;
|
|
12995
13670
|
}())
|
|
12996
13671
|
}]);
|
|
12997
13672
|
}();
|
|
@@ -14484,6 +15159,12 @@ var StoryClient = /*#__PURE__*/function () {
|
|
|
14484
15159
|
transport: this.config.transport
|
|
14485
15160
|
};
|
|
14486
15161
|
this.rpcClient = viem.createPublicClient(clientConfig);
|
|
15162
|
+
|
|
15163
|
+
// If a txHashResolver is provided (e.g. for AA wallets like ZeroDev/Dynamic),
|
|
15164
|
+
// patch waitForTransactionReceipt to resolve the hash first.
|
|
15165
|
+
if (config.txHashResolver) {
|
|
15166
|
+
this.applyTxHashResolver(config.txHashResolver);
|
|
15167
|
+
}
|
|
14487
15168
|
if (this.config.wallet) {
|
|
14488
15169
|
this.wallet = this.config.wallet;
|
|
14489
15170
|
} else if (this.config.account) {
|
|
@@ -14495,7 +15176,38 @@ var StoryClient = /*#__PURE__*/function () {
|
|
|
14495
15176
|
throw new Error("must specify a wallet or account");
|
|
14496
15177
|
}
|
|
14497
15178
|
}
|
|
15179
|
+
|
|
15180
|
+
/**
|
|
15181
|
+
* Patches rpcClient.waitForTransactionReceipt to first resolve the hash
|
|
15182
|
+
* through the provided resolver. This transparently supports AA wallets
|
|
15183
|
+
* where writeContract returns a UserOperation hash instead of a tx hash.
|
|
15184
|
+
*/
|
|
14498
15185
|
return _createClass(StoryClient, [{
|
|
15186
|
+
key: "applyTxHashResolver",
|
|
15187
|
+
value: function applyTxHashResolver(resolver) {
|
|
15188
|
+
var originalWaitForReceipt = this.rpcClient.waitForTransactionReceipt.bind(this.rpcClient);
|
|
15189
|
+
this.rpcClient.waitForTransactionReceipt = /*#__PURE__*/function () {
|
|
15190
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(args) {
|
|
15191
|
+
var resolvedHash;
|
|
15192
|
+
return _regenerator().w(function (_context) {
|
|
15193
|
+
while (1) switch (_context.n) {
|
|
15194
|
+
case 0:
|
|
15195
|
+
_context.n = 1;
|
|
15196
|
+
return resolver(args.hash);
|
|
15197
|
+
case 1:
|
|
15198
|
+
resolvedHash = _context.v;
|
|
15199
|
+
return _context.a(2, originalWaitForReceipt(_objectSpread2(_objectSpread2({}, args), {}, {
|
|
15200
|
+
hash: resolvedHash
|
|
15201
|
+
})));
|
|
15202
|
+
}
|
|
15203
|
+
}, _callee);
|
|
15204
|
+
}));
|
|
15205
|
+
return function (_x) {
|
|
15206
|
+
return _ref.apply(this, arguments);
|
|
15207
|
+
};
|
|
15208
|
+
}();
|
|
15209
|
+
}
|
|
15210
|
+
}, {
|
|
14499
15211
|
key: "chainId",
|
|
14500
15212
|
get: function get() {
|
|
14501
15213
|
return this.config.chainId;
|
|
@@ -14620,22 +15332,22 @@ var StoryClient = /*#__PURE__*/function () {
|
|
|
14620
15332
|
}, {
|
|
14621
15333
|
key: "getWalletBalance",
|
|
14622
15334
|
value: function () {
|
|
14623
|
-
var _getWalletBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
14624
|
-
return _regenerator().w(function (
|
|
14625
|
-
while (1) switch (
|
|
15335
|
+
var _getWalletBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
15336
|
+
return _regenerator().w(function (_context2) {
|
|
15337
|
+
while (1) switch (_context2.n) {
|
|
14626
15338
|
case 0:
|
|
14627
15339
|
if (this.wallet.account) {
|
|
14628
|
-
|
|
15340
|
+
_context2.n = 1;
|
|
14629
15341
|
break;
|
|
14630
15342
|
}
|
|
14631
15343
|
throw new Error("No account found in wallet");
|
|
14632
15344
|
case 1:
|
|
14633
|
-
|
|
15345
|
+
_context2.n = 2;
|
|
14634
15346
|
return this.getBalance(this.wallet.account.address);
|
|
14635
15347
|
case 2:
|
|
14636
|
-
return
|
|
15348
|
+
return _context2.a(2, _context2.v);
|
|
14637
15349
|
}
|
|
14638
|
-
},
|
|
15350
|
+
}, _callee2, this);
|
|
14639
15351
|
}));
|
|
14640
15352
|
function getWalletBalance() {
|
|
14641
15353
|
return _getWalletBalance.apply(this, arguments);
|
|
@@ -14645,22 +15357,22 @@ var StoryClient = /*#__PURE__*/function () {
|
|
|
14645
15357
|
}, {
|
|
14646
15358
|
key: "getBalance",
|
|
14647
15359
|
value: function () {
|
|
14648
|
-
var _getBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
15360
|
+
var _getBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(address) {
|
|
14649
15361
|
var validAddress;
|
|
14650
|
-
return _regenerator().w(function (
|
|
14651
|
-
while (1) switch (
|
|
15362
|
+
return _regenerator().w(function (_context3) {
|
|
15363
|
+
while (1) switch (_context3.n) {
|
|
14652
15364
|
case 0:
|
|
14653
15365
|
validAddress = validateAddress(address);
|
|
14654
|
-
|
|
15366
|
+
_context3.n = 1;
|
|
14655
15367
|
return this.rpcClient.getBalance({
|
|
14656
15368
|
address: validAddress
|
|
14657
15369
|
});
|
|
14658
15370
|
case 1:
|
|
14659
|
-
return
|
|
15371
|
+
return _context3.a(2, _context3.v);
|
|
14660
15372
|
}
|
|
14661
|
-
},
|
|
15373
|
+
}, _callee3, this);
|
|
14662
15374
|
}));
|
|
14663
|
-
function getBalance(
|
|
15375
|
+
function getBalance(_x2) {
|
|
14664
15376
|
return _getBalance.apply(this, arguments);
|
|
14665
15377
|
}
|
|
14666
15378
|
return getBalance;
|
|
@@ -14680,7 +15392,8 @@ var StoryClient = /*#__PURE__*/function () {
|
|
|
14680
15392
|
return new StoryClient({
|
|
14681
15393
|
chainId: config.chainId,
|
|
14682
15394
|
transport: config.transport,
|
|
14683
|
-
wallet: config.wallet
|
|
15395
|
+
wallet: config.wallet,
|
|
15396
|
+
txHashResolver: config.txHashResolver
|
|
14684
15397
|
});
|
|
14685
15398
|
}
|
|
14686
15399
|
|
|
@@ -14693,7 +15406,8 @@ var StoryClient = /*#__PURE__*/function () {
|
|
|
14693
15406
|
return new StoryClient({
|
|
14694
15407
|
account: config.account,
|
|
14695
15408
|
chainId: config.chainId,
|
|
14696
|
-
transport: config.transport
|
|
15409
|
+
transport: config.transport,
|
|
15410
|
+
txHashResolver: config.txHashResolver
|
|
14697
15411
|
});
|
|
14698
15412
|
}
|
|
14699
15413
|
}]);
|
|
@@ -14816,6 +15530,16 @@ var AIRelationship = /*#__PURE__*/function (AIRelationship) {
|
|
|
14816
15530
|
* For more information, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-terms | PIL}.
|
|
14817
15531
|
**/
|
|
14818
15532
|
|
|
15533
|
+
/**
|
|
15534
|
+
* The data of the license and its configuration to be attached to the IP.
|
|
15535
|
+
*
|
|
15536
|
+
* You must provide either `licenseTermsId` or `terms`:
|
|
15537
|
+
* - `licenseTermsId`: Use an existing pre-registered license terms
|
|
15538
|
+
* - `terms`: Register new license terms and attach
|
|
15539
|
+
*
|
|
15540
|
+
* If both are provided, `terms` takes priority and new terms will be registered.
|
|
15541
|
+
*/
|
|
15542
|
+
|
|
14819
15543
|
/**
|
|
14820
15544
|
* @deprecated Use `PILFlavor.nonCommercialSocialRemixing`, `PILFlavor.commercialUse`, `PILFlavor.commercialRemix`, or `PILFlavor.creativeCommonsAttribution` instead.
|
|
14821
15545
|
*
|