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