@story-protocol/core-sdk 1.4.2 → 1.4.3
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/resources/ipAsset.d.ts +41 -3
- package/dist/declarations/src/resources/ipAsset.d.ts.map +1 -1
- package/dist/declarations/src/resources/license.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/ipAsset.d.ts +11 -1
- package/dist/declarations/src/types/resources/ipAsset.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/license.d.ts +47 -4
- package/dist/declarations/src/types/resources/license.d.ts.map +1 -1
- package/dist/declarations/src/utils/chain.d.ts +18 -0
- package/dist/declarations/src/utils/chain.d.ts.map +1 -1
- package/dist/declarations/src/utils/token.d.ts +3 -0
- package/dist/declarations/src/utils/token.d.ts.map +1 -1
- package/dist/story-protocol-core-sdk.cjs.dev.js +1355 -791
- package/dist/story-protocol-core-sdk.cjs.prod.js +1355 -791
- package/dist/story-protocol-core-sdk.esm.js +1356 -792
- package/package.json +1 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as dotenv from 'dotenv';
|
|
2
|
-
import { encodeFunctionData, decodeEventLog, isAddress, formatEther, maxUint256, http, createPublicClient, createWalletClient, stringToHex, encodeAbiParameters, zeroHash,
|
|
2
|
+
import { encodeFunctionData, decodeEventLog, isAddress, formatEther, maxUint256, http, createPublicClient, createWalletClient, stringToHex, encodeAbiParameters, zeroHash, toFunctionSelector, keccak256, 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';
|
|
@@ -3070,6 +3070,15 @@ var ERC20Client = /*#__PURE__*/function () {
|
|
|
3070
3070
|
value: value
|
|
3071
3071
|
});
|
|
3072
3072
|
}
|
|
3073
|
+
}, {
|
|
3074
|
+
key: "transferFromEncode",
|
|
3075
|
+
value: function transferFromEncode(from, to, value) {
|
|
3076
|
+
return this.ercClient.transferFromEncode({
|
|
3077
|
+
from: from,
|
|
3078
|
+
to: to,
|
|
3079
|
+
value: value
|
|
3080
|
+
});
|
|
3081
|
+
}
|
|
3073
3082
|
|
|
3074
3083
|
// The method only will work in test environment
|
|
3075
3084
|
}, {
|
|
@@ -3185,6 +3194,15 @@ var WipTokenClient = /*#__PURE__*/function () {
|
|
|
3185
3194
|
value: function depositEncode() {
|
|
3186
3195
|
return this.wipClient.depositEncode();
|
|
3187
3196
|
}
|
|
3197
|
+
}, {
|
|
3198
|
+
key: "transferFromEncode",
|
|
3199
|
+
value: function transferFromEncode(from, to, value) {
|
|
3200
|
+
return this.wipClient.transferFromEncode({
|
|
3201
|
+
from: from,
|
|
3202
|
+
to: to,
|
|
3203
|
+
amount: value
|
|
3204
|
+
});
|
|
3205
|
+
}
|
|
3188
3206
|
}, {
|
|
3189
3207
|
key: "address",
|
|
3190
3208
|
get: function get() {
|
|
@@ -6206,6 +6224,24 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
|
6206
6224
|
}]);
|
|
6207
6225
|
}();
|
|
6208
6226
|
|
|
6227
|
+
function _regeneratorValues(e) {
|
|
6228
|
+
if (null != e) {
|
|
6229
|
+
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
6230
|
+
r = 0;
|
|
6231
|
+
if (t) return t.call(e);
|
|
6232
|
+
if ("function" == typeof e.next) return e;
|
|
6233
|
+
if (!isNaN(e.length)) return {
|
|
6234
|
+
next: function () {
|
|
6235
|
+
return e && r >= e.length && (e = void 0), {
|
|
6236
|
+
value: e && e[r++],
|
|
6237
|
+
done: !e
|
|
6238
|
+
};
|
|
6239
|
+
}
|
|
6240
|
+
};
|
|
6241
|
+
}
|
|
6242
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
6243
|
+
}
|
|
6244
|
+
|
|
6209
6245
|
var SignatureMethodType = /*#__PURE__*/function (SignatureMethodType) {
|
|
6210
6246
|
SignatureMethodType["REGISTER_IP_AND_MAKE_DERIVATIVE_AND_DEPLOY_ROYALTY_VAULT"] = "registerIpAndMakeDerivativeAndDeployRoyaltyVault";
|
|
6211
6247
|
SignatureMethodType["DISTRIBUTE_ROYALTY_TOKENS"] = "distributeRoyaltyTokens";
|
|
@@ -6548,6 +6584,392 @@ var generateOperationSignature = /*#__PURE__*/function () {
|
|
|
6548
6584
|
};
|
|
6549
6585
|
}();
|
|
6550
6586
|
|
|
6587
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
6588
|
+
if (null == r) return {};
|
|
6589
|
+
var t = {};
|
|
6590
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
6591
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
6592
|
+
t[n] = r[n];
|
|
6593
|
+
}
|
|
6594
|
+
return t;
|
|
6595
|
+
}
|
|
6596
|
+
|
|
6597
|
+
function _objectWithoutProperties(e, t) {
|
|
6598
|
+
if (null == e) return {};
|
|
6599
|
+
var o,
|
|
6600
|
+
r,
|
|
6601
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
6602
|
+
if (Object.getOwnPropertySymbols) {
|
|
6603
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
6604
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
6605
|
+
}
|
|
6606
|
+
return i;
|
|
6607
|
+
}
|
|
6608
|
+
|
|
6609
|
+
var _excluded = ["mintFees", "spenderAddress", "encodedTxs"];
|
|
6610
|
+
/**
|
|
6611
|
+
* Handles batch transaction execution through IP Account with automatic fee management for ERC20 and WIP tokens.
|
|
6612
|
+
*/
|
|
6613
|
+
var IpAccountBatchExecutor = /*#__PURE__*/function () {
|
|
6614
|
+
function IpAccountBatchExecutor(rpcClient, wallet, ipId) {
|
|
6615
|
+
_classCallCheck(this, IpAccountBatchExecutor);
|
|
6616
|
+
this.rpcClient = rpcClient;
|
|
6617
|
+
this.wallet = wallet;
|
|
6618
|
+
this.ipId = ipId;
|
|
6619
|
+
//erc20 address only available in aeneid
|
|
6620
|
+
this.erc20Token = new ERC20Client(rpcClient, wallet, erc20Address[aeneid.id]);
|
|
6621
|
+
this.wipToken = new WipTokenClient(rpcClient, wallet);
|
|
6622
|
+
this.walletAddress = wallet.account.address;
|
|
6623
|
+
}
|
|
6624
|
+
|
|
6625
|
+
/**
|
|
6626
|
+
* Executes a batch transaction with automatic fee handling for both ERC20 and WIP tokens.
|
|
6627
|
+
*/
|
|
6628
|
+
return _createClass(IpAccountBatchExecutor, [{
|
|
6629
|
+
key: "executeWithFees",
|
|
6630
|
+
value: (function () {
|
|
6631
|
+
var _executeWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
6632
|
+
var _options$options;
|
|
6633
|
+
var mintFees, spenderAddress, encodedTxs, options, _groupTokenSpenders, wipSpenders, erc20Spenders, wipTotalFees, erc20TotalFees, wipBalance, callData, depositValue, _yield$this$buildWipD, calls, value, isMulticall, _iterator, _step, _step$value, index, call, _value, _txHash, txHash, _t, _t2, _t3, _t4, _t5, _t6, _t7;
|
|
6634
|
+
return _regenerator().w(function (_context) {
|
|
6635
|
+
while (1) switch (_context.p = _context.n) {
|
|
6636
|
+
case 0:
|
|
6637
|
+
mintFees = _ref.mintFees, spenderAddress = _ref.spenderAddress, encodedTxs = _ref.encodedTxs, options = _objectWithoutProperties(_ref, _excluded);
|
|
6638
|
+
_groupTokenSpenders = groupTokenSpenders(mintFees.map(function (fee) {
|
|
6639
|
+
return _objectSpread2({
|
|
6640
|
+
address: spenderAddress
|
|
6641
|
+
}, fee);
|
|
6642
|
+
})), wipSpenders = _groupTokenSpenders.wipSpenders, erc20Spenders = _groupTokenSpenders.erc20Spenders;
|
|
6643
|
+
wipTotalFees = wipSpenders.reduce(function (acc, spender) {
|
|
6644
|
+
return acc + (spender.amount || 0n);
|
|
6645
|
+
}, 0n);
|
|
6646
|
+
erc20TotalFees = erc20Spenders.reduce(function (acc, spender) {
|
|
6647
|
+
return acc + (spender.amount || 0n);
|
|
6648
|
+
}, 0n);
|
|
6649
|
+
_context.n = 1;
|
|
6650
|
+
return this.wipToken.balanceOf(this.walletAddress);
|
|
6651
|
+
case 1:
|
|
6652
|
+
wipBalance = _context.v;
|
|
6653
|
+
callData = [];
|
|
6654
|
+
depositValue = 0n; // Build ERC20 fee call data if needed
|
|
6655
|
+
if (!(erc20TotalFees > 0n)) {
|
|
6656
|
+
_context.n = 3;
|
|
6657
|
+
break;
|
|
6658
|
+
}
|
|
6659
|
+
_t = callData.push;
|
|
6660
|
+
_t2 = callData;
|
|
6661
|
+
_t3 = _toConsumableArray;
|
|
6662
|
+
_context.n = 2;
|
|
6663
|
+
return this.buildErc20FeeCallData(erc20TotalFees, spenderAddress, options);
|
|
6664
|
+
case 2:
|
|
6665
|
+
_t.apply.call(_t, _t2, _t3(_context.v));
|
|
6666
|
+
case 3:
|
|
6667
|
+
if (!(wipTotalFees > 0n)) {
|
|
6668
|
+
_context.n = 7;
|
|
6669
|
+
break;
|
|
6670
|
+
}
|
|
6671
|
+
if (!(wipBalance < wipTotalFees)) {
|
|
6672
|
+
_context.n = 5;
|
|
6673
|
+
break;
|
|
6674
|
+
}
|
|
6675
|
+
_context.n = 4;
|
|
6676
|
+
return this.buildWipDepositCallData(spenderAddress, wipTotalFees, wipBalance, options);
|
|
6677
|
+
case 4:
|
|
6678
|
+
_yield$this$buildWipD = _context.v;
|
|
6679
|
+
calls = _yield$this$buildWipD.calls;
|
|
6680
|
+
value = _yield$this$buildWipD.value;
|
|
6681
|
+
callData.push.apply(callData, _toConsumableArray(calls));
|
|
6682
|
+
depositValue = value;
|
|
6683
|
+
_context.n = 7;
|
|
6684
|
+
break;
|
|
6685
|
+
case 5:
|
|
6686
|
+
_t4 = callData.push;
|
|
6687
|
+
_t5 = callData;
|
|
6688
|
+
_t6 = _toConsumableArray;
|
|
6689
|
+
_context.n = 6;
|
|
6690
|
+
return this.buildWipTransferCallData(wipTotalFees, spenderAddress, options);
|
|
6691
|
+
case 6:
|
|
6692
|
+
_t4.apply.call(_t4, _t5, _t6(_context.v));
|
|
6693
|
+
case 7:
|
|
6694
|
+
// Add the actual transaction call data
|
|
6695
|
+
callData.push({
|
|
6696
|
+
target: encodedTxs.to,
|
|
6697
|
+
value: 0n,
|
|
6698
|
+
data: encodedTxs.data
|
|
6699
|
+
});
|
|
6700
|
+
isMulticall = ((_options$options = options.options) === null || _options$options === void 0 || (_options$options = _options$options.wipOptions) === null || _options$options === void 0 ? void 0 : _options$options.useMulticallWhenPossible) !== false;
|
|
6701
|
+
if (isMulticall) {
|
|
6702
|
+
_context.n = 16;
|
|
6703
|
+
break;
|
|
6704
|
+
}
|
|
6705
|
+
_iterator = _createForOfIteratorHelper(callData.entries());
|
|
6706
|
+
_context.p = 8;
|
|
6707
|
+
_iterator.s();
|
|
6708
|
+
case 9:
|
|
6709
|
+
if ((_step = _iterator.n()).done) {
|
|
6710
|
+
_context.n = 13;
|
|
6711
|
+
break;
|
|
6712
|
+
}
|
|
6713
|
+
_step$value = _slicedToArray(_step.value, 2), index = _step$value[0], call = _step$value[1];
|
|
6714
|
+
_value = call.value;
|
|
6715
|
+
_context.n = 10;
|
|
6716
|
+
return simulateAndWriteContract({
|
|
6717
|
+
rpcClient: this.rpcClient,
|
|
6718
|
+
wallet: this.wallet,
|
|
6719
|
+
data: _objectSpread2({
|
|
6720
|
+
abi: ipAccountImplAbi,
|
|
6721
|
+
address: this.ipId,
|
|
6722
|
+
functionName: "execute",
|
|
6723
|
+
args: [call.target, call.value, call.data, 0]
|
|
6724
|
+
}, _value > 0n && {
|
|
6725
|
+
value: _value
|
|
6726
|
+
})
|
|
6727
|
+
});
|
|
6728
|
+
case 10:
|
|
6729
|
+
_txHash = _context.v;
|
|
6730
|
+
_context.n = 11;
|
|
6731
|
+
return waitTx(this.rpcClient, _txHash.txHash);
|
|
6732
|
+
case 11:
|
|
6733
|
+
if (!(index === callData.length - 1)) {
|
|
6734
|
+
_context.n = 12;
|
|
6735
|
+
break;
|
|
6736
|
+
}
|
|
6737
|
+
return _context.a(2, {
|
|
6738
|
+
txHash: _txHash.txHash,
|
|
6739
|
+
receipt: _txHash.receipt
|
|
6740
|
+
});
|
|
6741
|
+
case 12:
|
|
6742
|
+
_context.n = 9;
|
|
6743
|
+
break;
|
|
6744
|
+
case 13:
|
|
6745
|
+
_context.n = 15;
|
|
6746
|
+
break;
|
|
6747
|
+
case 14:
|
|
6748
|
+
_context.p = 14;
|
|
6749
|
+
_t7 = _context.v;
|
|
6750
|
+
_iterator.e(_t7);
|
|
6751
|
+
case 15:
|
|
6752
|
+
_context.p = 15;
|
|
6753
|
+
_iterator.f();
|
|
6754
|
+
return _context.f(15);
|
|
6755
|
+
case 16:
|
|
6756
|
+
_context.n = 17;
|
|
6757
|
+
return simulateAndWriteContract({
|
|
6758
|
+
rpcClient: this.rpcClient,
|
|
6759
|
+
wallet: this.wallet,
|
|
6760
|
+
data: _objectSpread2({
|
|
6761
|
+
abi: ipAccountImplAbi,
|
|
6762
|
+
address: this.ipId,
|
|
6763
|
+
functionName: "executeBatch",
|
|
6764
|
+
args: [callData, 0]
|
|
6765
|
+
}, depositValue > 0n && {
|
|
6766
|
+
value: depositValue
|
|
6767
|
+
})
|
|
6768
|
+
});
|
|
6769
|
+
case 17:
|
|
6770
|
+
txHash = _context.v;
|
|
6771
|
+
_context.n = 18;
|
|
6772
|
+
return waitTx(this.rpcClient, txHash.txHash, options.txOptions);
|
|
6773
|
+
case 18:
|
|
6774
|
+
return _context.a(2, {
|
|
6775
|
+
txHash: txHash.txHash,
|
|
6776
|
+
receipt: txHash.receipt
|
|
6777
|
+
});
|
|
6778
|
+
}
|
|
6779
|
+
}, _callee, this, [[8, 14, 15, 16]]);
|
|
6780
|
+
}));
|
|
6781
|
+
function executeWithFees(_x) {
|
|
6782
|
+
return _executeWithFees.apply(this, arguments);
|
|
6783
|
+
}
|
|
6784
|
+
return executeWithFees;
|
|
6785
|
+
}()
|
|
6786
|
+
/**
|
|
6787
|
+
* Builds call data for transferring ERC20 tokens from wallet to IP account and approving spender.
|
|
6788
|
+
*/
|
|
6789
|
+
)
|
|
6790
|
+
}, {
|
|
6791
|
+
key: "buildErc20FeeCallData",
|
|
6792
|
+
value: (function () {
|
|
6793
|
+
var _buildErc20FeeCallData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(totalFee, spenderAddress, options) {
|
|
6794
|
+
var _options$options2;
|
|
6795
|
+
var erc20Balance, autoApprove, erc20ContractAddress, allowance, calls, spenderAllowance, _t8, _t9;
|
|
6796
|
+
return _regenerator().w(function (_context2) {
|
|
6797
|
+
while (1) switch (_context2.n) {
|
|
6798
|
+
case 0:
|
|
6799
|
+
_context2.n = 1;
|
|
6800
|
+
return this.erc20Token.balanceOf(this.walletAddress);
|
|
6801
|
+
case 1:
|
|
6802
|
+
erc20Balance = _context2.v;
|
|
6803
|
+
if (!(erc20Balance < totalFee)) {
|
|
6804
|
+
_context2.n = 2;
|
|
6805
|
+
break;
|
|
6806
|
+
}
|
|
6807
|
+
throw new Error("Wallet does not have enough ERC20 tokens to pay for fees. " + "Required: ".concat(getTokenAmountDisplay(totalFee), ", ") + "Available: ".concat(getTokenAmountDisplay(erc20Balance), "."));
|
|
6808
|
+
case 2:
|
|
6809
|
+
autoApprove = ((_options$options2 = options.options) === null || _options$options2 === void 0 || (_options$options2 = _options$options2.erc20Options) === null || _options$options2 === void 0 ? void 0 : _options$options2.enableAutoApprove) !== false; // erc20 address only available in aeneid
|
|
6810
|
+
erc20ContractAddress = erc20Address[aeneid.id];
|
|
6811
|
+
_context2.n = 3;
|
|
6812
|
+
return this.erc20Token.allowance(this.walletAddress, this.ipId);
|
|
6813
|
+
case 3:
|
|
6814
|
+
allowance = _context2.v;
|
|
6815
|
+
if (!(autoApprove && allowance < totalFee)) {
|
|
6816
|
+
_context2.n = 5;
|
|
6817
|
+
break;
|
|
6818
|
+
}
|
|
6819
|
+
_t8 = waitTx;
|
|
6820
|
+
_t9 = this.rpcClient;
|
|
6821
|
+
_context2.n = 4;
|
|
6822
|
+
return this.erc20Token.approve(this.ipId, maxUint256);
|
|
6823
|
+
case 4:
|
|
6824
|
+
_context2.n = 5;
|
|
6825
|
+
return _t8(_t9, _context2.v);
|
|
6826
|
+
case 5:
|
|
6827
|
+
calls = [{
|
|
6828
|
+
target: erc20ContractAddress,
|
|
6829
|
+
value: 0n,
|
|
6830
|
+
data: this.erc20Token.transferFromEncode(this.walletAddress, this.ipId, totalFee).data
|
|
6831
|
+
}];
|
|
6832
|
+
_context2.n = 6;
|
|
6833
|
+
return this.erc20Token.allowance(this.ipId, spenderAddress);
|
|
6834
|
+
case 6:
|
|
6835
|
+
spenderAllowance = _context2.v;
|
|
6836
|
+
if (autoApprove && spenderAllowance < totalFee) {
|
|
6837
|
+
calls.push({
|
|
6838
|
+
target: erc20ContractAddress,
|
|
6839
|
+
value: 0n,
|
|
6840
|
+
data: this.erc20Token.approveEncode(spenderAddress, maxUint256).data
|
|
6841
|
+
});
|
|
6842
|
+
}
|
|
6843
|
+
return _context2.a(2, calls);
|
|
6844
|
+
}
|
|
6845
|
+
}, _callee2, this);
|
|
6846
|
+
}));
|
|
6847
|
+
function buildErc20FeeCallData(_x2, _x3, _x4) {
|
|
6848
|
+
return _buildErc20FeeCallData.apply(this, arguments);
|
|
6849
|
+
}
|
|
6850
|
+
return buildErc20FeeCallData;
|
|
6851
|
+
}()
|
|
6852
|
+
/**
|
|
6853
|
+
* Builds call data for depositing IP tokens to WIP and approving spender.
|
|
6854
|
+
*/
|
|
6855
|
+
)
|
|
6856
|
+
}, {
|
|
6857
|
+
key: "buildWipDepositCallData",
|
|
6858
|
+
value: (function () {
|
|
6859
|
+
var _buildWipDepositCallData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(spenderAddress, totalFee, wipBalance, options) {
|
|
6860
|
+
var _options$options3, _options$options4;
|
|
6861
|
+
var calls, autoApprove, autoWrapIp, ipBalance, value, allowance;
|
|
6862
|
+
return _regenerator().w(function (_context3) {
|
|
6863
|
+
while (1) switch (_context3.n) {
|
|
6864
|
+
case 0:
|
|
6865
|
+
calls = [];
|
|
6866
|
+
autoApprove = ((_options$options3 = options.options) === null || _options$options3 === void 0 || (_options$options3 = _options$options3.wipOptions) === null || _options$options3 === void 0 ? void 0 : _options$options3.enableAutoApprove) !== false;
|
|
6867
|
+
autoWrapIp = ((_options$options4 = options.options) === null || _options$options4 === void 0 || (_options$options4 = _options$options4.wipOptions) === null || _options$options4 === void 0 ? void 0 : _options$options4.enableAutoWrapIp) !== false;
|
|
6868
|
+
_context3.n = 1;
|
|
6869
|
+
return this.rpcClient.getBalance({
|
|
6870
|
+
address: this.walletAddress
|
|
6871
|
+
});
|
|
6872
|
+
case 1:
|
|
6873
|
+
ipBalance = _context3.v;
|
|
6874
|
+
if (autoWrapIp) {
|
|
6875
|
+
_context3.n = 2;
|
|
6876
|
+
break;
|
|
6877
|
+
}
|
|
6878
|
+
throw new Error("Wallet does not have enough WIP to pay for fees. Total fees: ".concat(getTokenAmountDisplay(totalFee), ", balance: ").concat(getTokenAmountDisplay(wipBalance, "WIP"), "."));
|
|
6879
|
+
case 2:
|
|
6880
|
+
if (!(ipBalance < totalFee)) {
|
|
6881
|
+
_context3.n = 3;
|
|
6882
|
+
break;
|
|
6883
|
+
}
|
|
6884
|
+
throw new Error("Wallet does not have enough IP tokens to wrap to WIP and pay for fees. " + "Required: ".concat(getTokenAmountDisplay(totalFee), ", ") + "Available: ".concat(getTokenAmountDisplay(ipBalance), "."));
|
|
6885
|
+
case 3:
|
|
6886
|
+
calls.push({
|
|
6887
|
+
target: WIP_TOKEN_ADDRESS,
|
|
6888
|
+
value: totalFee,
|
|
6889
|
+
data: this.wipToken.depositEncode().data
|
|
6890
|
+
});
|
|
6891
|
+
value = totalFee;
|
|
6892
|
+
_context3.n = 4;
|
|
6893
|
+
return this.wipToken.allowance(this.ipId, spenderAddress);
|
|
6894
|
+
case 4:
|
|
6895
|
+
allowance = _context3.v;
|
|
6896
|
+
if (autoApprove && allowance < totalFee) {
|
|
6897
|
+
calls.push({
|
|
6898
|
+
target: WIP_TOKEN_ADDRESS,
|
|
6899
|
+
value: 0n,
|
|
6900
|
+
data: this.wipToken.approveEncode(spenderAddress, maxUint256).data
|
|
6901
|
+
});
|
|
6902
|
+
}
|
|
6903
|
+
return _context3.a(2, {
|
|
6904
|
+
calls: calls,
|
|
6905
|
+
value: value
|
|
6906
|
+
});
|
|
6907
|
+
}
|
|
6908
|
+
}, _callee3, this);
|
|
6909
|
+
}));
|
|
6910
|
+
function buildWipDepositCallData(_x5, _x6, _x7, _x8) {
|
|
6911
|
+
return _buildWipDepositCallData.apply(this, arguments);
|
|
6912
|
+
}
|
|
6913
|
+
return buildWipDepositCallData;
|
|
6914
|
+
}()
|
|
6915
|
+
/**
|
|
6916
|
+
* Builds call data for transferring existing WIP tokens from wallet to IP account and approving spender.
|
|
6917
|
+
*/
|
|
6918
|
+
)
|
|
6919
|
+
}, {
|
|
6920
|
+
key: "buildWipTransferCallData",
|
|
6921
|
+
value: (function () {
|
|
6922
|
+
var _buildWipTransferCallData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(totalFee, spenderAddress, options) {
|
|
6923
|
+
var _options$options5;
|
|
6924
|
+
var autoApprove, allowance, calls, spenderAllowance, _t0, _t1;
|
|
6925
|
+
return _regenerator().w(function (_context4) {
|
|
6926
|
+
while (1) switch (_context4.n) {
|
|
6927
|
+
case 0:
|
|
6928
|
+
autoApprove = ((_options$options5 = options.options) === null || _options$options5 === void 0 || (_options$options5 = _options$options5.wipOptions) === null || _options$options5 === void 0 ? void 0 : _options$options5.enableAutoApprove) !== false;
|
|
6929
|
+
_context4.n = 1;
|
|
6930
|
+
return this.wipToken.allowance(this.walletAddress, this.ipId);
|
|
6931
|
+
case 1:
|
|
6932
|
+
allowance = _context4.v;
|
|
6933
|
+
if (!(autoApprove && allowance < totalFee)) {
|
|
6934
|
+
_context4.n = 3;
|
|
6935
|
+
break;
|
|
6936
|
+
}
|
|
6937
|
+
_t0 = waitTx;
|
|
6938
|
+
_t1 = this.rpcClient;
|
|
6939
|
+
_context4.n = 2;
|
|
6940
|
+
return this.wipToken.approve(this.ipId, maxUint256);
|
|
6941
|
+
case 2:
|
|
6942
|
+
_context4.n = 3;
|
|
6943
|
+
return _t0(_t1, _context4.v);
|
|
6944
|
+
case 3:
|
|
6945
|
+
calls = [{
|
|
6946
|
+
target: WIP_TOKEN_ADDRESS,
|
|
6947
|
+
value: 0n,
|
|
6948
|
+
data: this.wipToken.transferFromEncode(this.walletAddress, this.ipId, totalFee).data
|
|
6949
|
+
}];
|
|
6950
|
+
_context4.n = 4;
|
|
6951
|
+
return this.wipToken.allowance(this.ipId, spenderAddress);
|
|
6952
|
+
case 4:
|
|
6953
|
+
spenderAllowance = _context4.v;
|
|
6954
|
+
if (autoApprove && spenderAllowance < totalFee) {
|
|
6955
|
+
calls.push({
|
|
6956
|
+
target: WIP_TOKEN_ADDRESS,
|
|
6957
|
+
value: 0n,
|
|
6958
|
+
data: this.wipToken.approveEncode(spenderAddress, maxUint256).data
|
|
6959
|
+
});
|
|
6960
|
+
}
|
|
6961
|
+
return _context4.a(2, calls);
|
|
6962
|
+
}
|
|
6963
|
+
}, _callee4, this);
|
|
6964
|
+
}));
|
|
6965
|
+
function buildWipTransferCallData(_x9, _x0, _x1) {
|
|
6966
|
+
return _buildWipTransferCallData.apply(this, arguments);
|
|
6967
|
+
}
|
|
6968
|
+
return buildWipTransferCallData;
|
|
6969
|
+
}())
|
|
6970
|
+
}]);
|
|
6971
|
+
}();
|
|
6972
|
+
|
|
6551
6973
|
var _PILFlavor;
|
|
6552
6974
|
var PIL_URIS = {
|
|
6553
6975
|
NCSR: "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/NCSR.json",
|
|
@@ -6777,24 +7199,6 @@ _defineProperty(PILFlavor, "verifyDerivatives", function (terms) {
|
|
|
6777
7199
|
}
|
|
6778
7200
|
});
|
|
6779
7201
|
|
|
6780
|
-
function _regeneratorValues(e) {
|
|
6781
|
-
if (null != e) {
|
|
6782
|
-
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
6783
|
-
r = 0;
|
|
6784
|
-
if (t) return t.call(e);
|
|
6785
|
-
if ("function" == typeof e.next) return e;
|
|
6786
|
-
if (!isNaN(e.length)) return {
|
|
6787
|
-
next: function () {
|
|
6788
|
-
return e && r >= e.length && (e = void 0), {
|
|
6789
|
-
value: e && e[r++],
|
|
6790
|
-
done: !e
|
|
6791
|
-
};
|
|
6792
|
-
}
|
|
6793
|
-
};
|
|
6794
|
-
}
|
|
6795
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
6796
|
-
}
|
|
6797
|
-
|
|
6798
7202
|
function _regeneratorKeys(e) {
|
|
6799
7203
|
var n = Object(e),
|
|
6800
7204
|
r = [];
|
|
@@ -6825,7 +7229,7 @@ var getPublicMinting = /*#__PURE__*/function () {
|
|
|
6825
7229
|
}();
|
|
6826
7230
|
var validateLicenseTermsData = /*#__PURE__*/function () {
|
|
6827
7231
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(licenseTermsData, rpcClient, chainId) {
|
|
6828
|
-
var licenseTerms, processedLicenseTermsData, maxLicenseTokens, i, licenseTerm, royaltyModuleReadOnlyClient, isWhitelistedArbitrationPolicy, isWhitelistedRoyaltyToken, licensingConfig, maxLicenseTokensValue;
|
|
7232
|
+
var licenseTerms, processedLicenseTermsData, maxLicenseTokens, i, licenseTerm, licenseTermsDataInput, royaltyModuleReadOnlyClient, isWhitelistedArbitrationPolicy, isWhitelistedRoyaltyToken, piLicenseTemplateReadOnlyClient, isExist, response, licensingConfig, maxLicenseTokensValue;
|
|
6829
7233
|
return _regenerator().w(function (_context2) {
|
|
6830
7234
|
while (1) switch (_context2.n) {
|
|
6831
7235
|
case 0:
|
|
@@ -6835,10 +7239,16 @@ var validateLicenseTermsData = /*#__PURE__*/function () {
|
|
|
6835
7239
|
i = 0;
|
|
6836
7240
|
case 1:
|
|
6837
7241
|
if (!(i < licenseTermsData.length)) {
|
|
6838
|
-
_context2.n =
|
|
7242
|
+
_context2.n = 16;
|
|
7243
|
+
break;
|
|
7244
|
+
}
|
|
7245
|
+
licenseTerm = void 0;
|
|
7246
|
+
licenseTermsDataInput = licenseTermsData[i];
|
|
7247
|
+
if (!licenseTermsDataInput.terms) {
|
|
7248
|
+
_context2.n = 6;
|
|
6839
7249
|
break;
|
|
6840
7250
|
}
|
|
6841
|
-
licenseTerm = PILFlavor.validateLicenseTerms(
|
|
7251
|
+
licenseTerm = PILFlavor.validateLicenseTerms(licenseTermsDataInput.terms, chainId);
|
|
6842
7252
|
licenseTerm.commercialRevShare = getRevenueShare(licenseTerm.commercialRevShare);
|
|
6843
7253
|
royaltyModuleReadOnlyClient = new RoyaltyModuleReadOnlyClient(rpcClient);
|
|
6844
7254
|
if (!(validateAddress(licenseTerm.royaltyPolicy) !== zeroAddress)) {
|
|
@@ -6873,37 +7283,69 @@ var validateLicenseTermsData = /*#__PURE__*/function () {
|
|
|
6873
7283
|
}
|
|
6874
7284
|
throw new Error("The currency token ".concat(licenseTerm.currency, " is not whitelisted."));
|
|
6875
7285
|
case 5:
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
_context2.n = 6;
|
|
6879
|
-
break;
|
|
6880
|
-
}
|
|
6881
|
-
throw new Error("A royalty policy must be provided when the minting fee is greater than 0.");
|
|
7286
|
+
_context2.n = 11;
|
|
7287
|
+
break;
|
|
6882
7288
|
case 6:
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
_context2.n = 8;
|
|
7289
|
+
if (!(licenseTermsDataInput.licenseTermsId !== undefined)) {
|
|
7290
|
+
_context2.n = 10;
|
|
6886
7291
|
break;
|
|
6887
7292
|
}
|
|
6888
|
-
|
|
6889
|
-
|
|
7293
|
+
piLicenseTemplateReadOnlyClient = new PiLicenseTemplateReadOnlyClient(rpcClient);
|
|
7294
|
+
_context2.n = 7;
|
|
7295
|
+
return piLicenseTemplateReadOnlyClient.exists({
|
|
7296
|
+
licenseTermsId: BigInt(licenseTermsDataInput.licenseTermsId)
|
|
7297
|
+
});
|
|
7298
|
+
case 7:
|
|
7299
|
+
isExist = _context2.v;
|
|
7300
|
+
if (isExist) {
|
|
7301
|
+
_context2.n = 8;
|
|
6890
7302
|
break;
|
|
6891
7303
|
}
|
|
6892
|
-
throw new Error("The
|
|
6893
|
-
case
|
|
7304
|
+
throw new Error("The license terms id ".concat(licenseTermsDataInput.licenseTermsId, " is not exist."));
|
|
7305
|
+
case 8:
|
|
7306
|
+
_context2.n = 9;
|
|
7307
|
+
return piLicenseTemplateReadOnlyClient.getLicenseTerms({
|
|
7308
|
+
selectedLicenseTermsId: BigInt(licenseTermsDataInput.licenseTermsId)
|
|
7309
|
+
});
|
|
7310
|
+
case 9:
|
|
7311
|
+
response = _context2.v;
|
|
7312
|
+
licenseTerm = response.terms;
|
|
7313
|
+
_context2.n = 11;
|
|
7314
|
+
break;
|
|
7315
|
+
case 10:
|
|
7316
|
+
throw new Error("Either terms or licenseTermsId must be provided.");
|
|
7317
|
+
case 11:
|
|
7318
|
+
licensingConfig = validateLicenseConfig(licenseTermsData[i].licensingConfig);
|
|
7319
|
+
if (!(licensingConfig.mintingFee > 0 && licenseTerm.royaltyPolicy === zeroAddress)) {
|
|
7320
|
+
_context2.n = 12;
|
|
7321
|
+
break;
|
|
7322
|
+
}
|
|
7323
|
+
throw new Error("A royalty policy must be provided when the minting fee is greater than 0.");
|
|
7324
|
+
case 12:
|
|
7325
|
+
maxLicenseTokensValue = licenseTermsData[i].maxLicenseTokens;
|
|
7326
|
+
if (!(maxLicenseTokensValue !== undefined)) {
|
|
7327
|
+
_context2.n = 14;
|
|
7328
|
+
break;
|
|
7329
|
+
}
|
|
7330
|
+
if (!(maxLicenseTokensValue < 0)) {
|
|
7331
|
+
_context2.n = 13;
|
|
7332
|
+
break;
|
|
7333
|
+
}
|
|
7334
|
+
throw new Error("The max license tokens must be greater than or equal to 0.");
|
|
7335
|
+
case 13:
|
|
6894
7336
|
licensingConfig.licensingHook = totalLicenseTokenLimitHookAddress[chainId];
|
|
6895
7337
|
maxLicenseTokens[i] = BigInt(maxLicenseTokensValue);
|
|
6896
|
-
case
|
|
7338
|
+
case 14:
|
|
6897
7339
|
licenseTerms.push(licenseTerm);
|
|
6898
7340
|
processedLicenseTermsData.push({
|
|
6899
7341
|
terms: licenseTerm,
|
|
6900
7342
|
licensingConfig: licensingConfig
|
|
6901
7343
|
});
|
|
6902
|
-
case
|
|
7344
|
+
case 15:
|
|
6903
7345
|
i++;
|
|
6904
7346
|
_context2.n = 1;
|
|
6905
7347
|
break;
|
|
6906
|
-
case
|
|
7348
|
+
case 16:
|
|
6907
7349
|
return _context2.a(2, {
|
|
6908
7350
|
licenseTerms: licenseTerms,
|
|
6909
7351
|
licenseTermsData: processedLicenseTermsData,
|
|
@@ -8344,6 +8786,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8344
8786
|
this.spgNftClient = new SpgnftImplReadOnlyClient(rpcClient);
|
|
8345
8787
|
this.totalLicenseTokenLimitHookClient = new TotalLicenseTokenLimitHookClient(rpcClient, wallet);
|
|
8346
8788
|
this.licenseTokenClient = new LicenseTokenClient(rpcClient, wallet);
|
|
8789
|
+
this.erc20Client = new Erc20Client(rpcClient, wallet, erc20Address[chainId]);
|
|
8347
8790
|
this.rpcClient = rpcClient;
|
|
8348
8791
|
this.wallet = wallet;
|
|
8349
8792
|
this.chainId = chainId;
|
|
@@ -8679,8 +9122,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8679
9122
|
key: "registerDerivative",
|
|
8680
9123
|
value: (function () {
|
|
8681
9124
|
var _registerDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(request) {
|
|
8682
|
-
var
|
|
8683
|
-
var _request$txOptions2, isChildIpIdRegistered, derivativeData, object, encodedTxData, _request$options, contractCall, _t5;
|
|
9125
|
+
var _request$txOptions2, isChildIpIdRegistered, derivativeData, object, encodedTxData, mintFees, batchExecutor, _t5;
|
|
8684
9126
|
return _regenerator().w(function (_context4) {
|
|
8685
9127
|
while (1) switch (_context4.p = _context4.n) {
|
|
8686
9128
|
case 0:
|
|
@@ -8716,33 +9158,35 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8716
9158
|
encodedTxData: encodedTxData
|
|
8717
9159
|
});
|
|
8718
9160
|
case 4:
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
};
|
|
8722
|
-
return _context4.a(2, this.handleRegistrationWithFees({
|
|
8723
|
-
sender: this.walletAddress,
|
|
9161
|
+
_context4.n = 5;
|
|
9162
|
+
return calculateDerivativeMintingFee({
|
|
8724
9163
|
derivData: object,
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options = request.options) === null || _request$options === void 0 ? void 0 : _request$options.wipOptions), {}, {
|
|
8731
|
-
useMulticallWhenPossible: false
|
|
8732
|
-
})
|
|
8733
|
-
})
|
|
8734
|
-
}));
|
|
9164
|
+
rpcClient: this.rpcClient,
|
|
9165
|
+
wallet: this.wallet,
|
|
9166
|
+
chainId: this.chainId,
|
|
9167
|
+
sender: this.walletAddress
|
|
9168
|
+
});
|
|
8735
9169
|
case 5:
|
|
8736
|
-
|
|
8737
|
-
|
|
9170
|
+
mintFees = _context4.v;
|
|
9171
|
+
batchExecutor = new IpAccountBatchExecutor(this.rpcClient, this.wallet, request.childIpId);
|
|
9172
|
+
return _context4.a(2, batchExecutor.executeWithFees({
|
|
9173
|
+
mintFees: mintFees,
|
|
9174
|
+
spenderAddress: this.royaltyModuleEventClient.address,
|
|
9175
|
+
encodedTxs: encodedTxData,
|
|
9176
|
+
options: request.options,
|
|
9177
|
+
txOptions: request.txOptions
|
|
9178
|
+
}));
|
|
8738
9179
|
case 6:
|
|
8739
|
-
_context4.
|
|
9180
|
+
_context4.n = 8;
|
|
9181
|
+
break;
|
|
9182
|
+
case 7:
|
|
9183
|
+
_context4.p = 7;
|
|
8740
9184
|
_t5 = _context4.v;
|
|
8741
9185
|
return _context4.a(2, handleError(_t5, "Failed to register derivative"));
|
|
8742
|
-
case
|
|
9186
|
+
case 8:
|
|
8743
9187
|
return _context4.a(2);
|
|
8744
9188
|
}
|
|
8745
|
-
}, _callee4, this, [[0,
|
|
9189
|
+
}, _callee4, this, [[0, 7]]);
|
|
8746
9190
|
}));
|
|
8747
9191
|
function registerDerivative(_x5) {
|
|
8748
9192
|
return _registerDerivative.apply(this, arguments);
|
|
@@ -8750,48 +9194,124 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8750
9194
|
return registerDerivative;
|
|
8751
9195
|
}()
|
|
8752
9196
|
/**
|
|
8753
|
-
* Batch registers a derivative directly with parent IP's license terms
|
|
9197
|
+
* Batch registers a derivative directly with parent IP's license terms, without needing license tokens,
|
|
9198
|
+
* and attaches the license terms of the parent IPs to the derivative IP.
|
|
9199
|
+
* The license terms must be attached to the parent IP before calling this function.
|
|
9200
|
+
* All IPs attached default license terms by default.
|
|
9201
|
+
* The derivative IP owner must be the caller or an authorized operator.
|
|
9202
|
+
*
|
|
9203
|
+
* @remarks
|
|
9204
|
+
* This method supports automatic fee handling for both ERC20 and WIP tokens.
|
|
9205
|
+
* The fees are paid from the wallet address.
|
|
9206
|
+
* The transaction will be executed in the same order as the input arguments.
|
|
9207
|
+
* If a request fails, previous transactions will not be reverted.
|
|
8754
9208
|
*/
|
|
8755
9209
|
)
|
|
8756
9210
|
}, {
|
|
8757
|
-
key: "
|
|
9211
|
+
key: "batchRegisterDerivatives",
|
|
8758
9212
|
value: (function () {
|
|
8759
|
-
var
|
|
8760
|
-
var
|
|
9213
|
+
var _batchRegisterDerivatives = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref2) {
|
|
9214
|
+
var requests, options, txOptions, txHashes, index, result, _t6;
|
|
8761
9215
|
return _regenerator().w(function (_context5) {
|
|
8762
9216
|
while (1) switch (_context5.p = _context5.n) {
|
|
8763
9217
|
case 0:
|
|
8764
|
-
|
|
9218
|
+
requests = _ref2.requests, options = _ref2.options, txOptions = _ref2.txOptions;
|
|
9219
|
+
txHashes = [];
|
|
9220
|
+
index = 0;
|
|
9221
|
+
case 1:
|
|
9222
|
+
if (!(index < requests.length)) {
|
|
9223
|
+
_context5.n = 6;
|
|
9224
|
+
break;
|
|
9225
|
+
}
|
|
9226
|
+
_context5.p = 2;
|
|
9227
|
+
_context5.n = 3;
|
|
9228
|
+
return this.registerDerivative(_objectSpread2(_objectSpread2({}, requests[index]), {}, {
|
|
9229
|
+
options: options,
|
|
9230
|
+
txOptions: txOptions
|
|
9231
|
+
}));
|
|
9232
|
+
case 3:
|
|
9233
|
+
result = _context5.v;
|
|
9234
|
+
txHashes.push(result.txHash);
|
|
9235
|
+
index++;
|
|
9236
|
+
_context5.n = 5;
|
|
9237
|
+
break;
|
|
9238
|
+
case 4:
|
|
9239
|
+
_context5.p = 4;
|
|
9240
|
+
_t6 = _context5.v;
|
|
9241
|
+
return _context5.a(2, handleError(_t6, "Failed to batch register derivatives at index ".concat(index)));
|
|
9242
|
+
case 5:
|
|
9243
|
+
_context5.n = 1;
|
|
9244
|
+
break;
|
|
9245
|
+
case 6:
|
|
9246
|
+
return _context5.a(2, txHashes);
|
|
9247
|
+
}
|
|
9248
|
+
}, _callee5, this, [[2, 4]]);
|
|
9249
|
+
}));
|
|
9250
|
+
function batchRegisterDerivatives(_x6) {
|
|
9251
|
+
return _batchRegisterDerivatives.apply(this, arguments);
|
|
9252
|
+
}
|
|
9253
|
+
return batchRegisterDerivatives;
|
|
9254
|
+
}()
|
|
9255
|
+
/**
|
|
9256
|
+
* @deprecated This method is deprecated. Please use the {@link batchRegisterDerivatives} instead.
|
|
9257
|
+
* This method will be removed soon.
|
|
9258
|
+
* Batch registers a derivative directly with parent IP's license terms.
|
|
9259
|
+
*
|
|
9260
|
+
* @example Migration Example
|
|
9261
|
+
* ```typescript
|
|
9262
|
+
* // Before (deprecated):
|
|
9263
|
+
* await client.ipAsset.batchRegisterDerivative({
|
|
9264
|
+
* args: [{ childIpId: '0x...', parentIpIds: ['0x...'], licenseTermsIds: [1n] }],
|
|
9265
|
+
* });
|
|
9266
|
+
*
|
|
9267
|
+
* // After (recommended):
|
|
9268
|
+
* await client.ipAsset.batchRegisterDerivatives({
|
|
9269
|
+
* requests: [{ childIpId: '0x...', parentIpIds: ['0x...'], licenseTermsIds: [1n] }],
|
|
9270
|
+
* });
|
|
9271
|
+
* ```
|
|
9272
|
+
*
|
|
9273
|
+
* @remarks This method does not support automatic fee handling for both ERC20 and WIP tokens.
|
|
9274
|
+
*/
|
|
9275
|
+
)
|
|
9276
|
+
}, {
|
|
9277
|
+
key: "batchRegisterDerivative",
|
|
9278
|
+
value: (function () {
|
|
9279
|
+
var _batchRegisterDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(request) {
|
|
9280
|
+
var contracts, licenseModuleAddress, _iterator2, _step2, _arg$maxMintingFee, _arg$maxRevenueShare, arg, calculatedDeadline, ipAccount, data, _yield$ipAccount$stat, state, signature, txHash, _t7, _t8, _t9;
|
|
9281
|
+
return _regenerator().w(function (_context6) {
|
|
9282
|
+
while (1) switch (_context6.p = _context6.n) {
|
|
9283
|
+
case 0:
|
|
9284
|
+
_context6.p = 0;
|
|
8765
9285
|
contracts = [];
|
|
8766
9286
|
licenseModuleAddress = validateAddress(this.licensingModuleClient.address);
|
|
8767
9287
|
_iterator2 = _createForOfIteratorHelper(request.args);
|
|
8768
|
-
|
|
9288
|
+
_context6.p = 1;
|
|
8769
9289
|
_iterator2.s();
|
|
8770
9290
|
case 2:
|
|
8771
9291
|
if ((_step2 = _iterator2.n()).done) {
|
|
8772
|
-
|
|
9292
|
+
_context6.n = 11;
|
|
8773
9293
|
break;
|
|
8774
9294
|
}
|
|
8775
9295
|
arg = _step2.value;
|
|
8776
|
-
|
|
8777
|
-
|
|
9296
|
+
_context6.p = 3;
|
|
9297
|
+
_context6.n = 4;
|
|
8778
9298
|
return this.registerDerivative(_objectSpread2(_objectSpread2({}, arg), {}, {
|
|
8779
9299
|
txOptions: {
|
|
8780
9300
|
encodedTxDataOnly: true
|
|
8781
9301
|
}
|
|
8782
9302
|
}));
|
|
8783
9303
|
case 4:
|
|
8784
|
-
|
|
9304
|
+
_context6.n = 6;
|
|
8785
9305
|
break;
|
|
8786
9306
|
case 5:
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
throw new Error(
|
|
9307
|
+
_context6.p = 5;
|
|
9308
|
+
_t7 = _context6.v;
|
|
9309
|
+
throw new Error(_t7.message.replace("Failed to register derivative:", "").trim());
|
|
8790
9310
|
case 6:
|
|
8791
|
-
|
|
9311
|
+
_context6.n = 7;
|
|
8792
9312
|
return getCalculatedDeadline(this.rpcClient, request.deadline);
|
|
8793
9313
|
case 7:
|
|
8794
|
-
calculatedDeadline =
|
|
9314
|
+
calculatedDeadline = _context6.v;
|
|
8795
9315
|
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(arg.childIpId));
|
|
8796
9316
|
data = encodeFunctionData({
|
|
8797
9317
|
abi: licensingModuleAbi,
|
|
@@ -8800,12 +9320,12 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8800
9320
|
return BigInt(id);
|
|
8801
9321
|
}), arg.licenseTemplate || this.licenseTemplateAddress, zeroAddress, BigInt((_arg$maxMintingFee = arg.maxMintingFee) !== null && _arg$maxMintingFee !== void 0 ? _arg$maxMintingFee : 0), validateMaxRts(arg.maxRts), getRevenueShare((_arg$maxRevenueShare = arg.maxRevenueShare) !== null && _arg$maxRevenueShare !== void 0 ? _arg$maxRevenueShare : 100, RevShareType.MAX_REVENUE_SHARE)]
|
|
8802
9322
|
});
|
|
8803
|
-
|
|
9323
|
+
_context6.n = 8;
|
|
8804
9324
|
return ipAccount.state();
|
|
8805
9325
|
case 8:
|
|
8806
|
-
_yield$ipAccount$stat =
|
|
9326
|
+
_yield$ipAccount$stat = _context6.v;
|
|
8807
9327
|
state = _yield$ipAccount$stat.result;
|
|
8808
|
-
|
|
9328
|
+
_context6.n = 9;
|
|
8809
9329
|
return generateOperationSignature({
|
|
8810
9330
|
ipIdAddress: arg.childIpId,
|
|
8811
9331
|
methodType: SignatureMethodType.BATCH_REGISTER_DERIVATIVE,
|
|
@@ -8816,7 +9336,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8816
9336
|
chainId: this.chainId
|
|
8817
9337
|
});
|
|
8818
9338
|
case 9:
|
|
8819
|
-
signature =
|
|
9339
|
+
signature = _context6.v;
|
|
8820
9340
|
contracts.push({
|
|
8821
9341
|
target: arg.childIpId,
|
|
8822
9342
|
allowFailure: false,
|
|
@@ -8827,42 +9347,42 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8827
9347
|
})
|
|
8828
9348
|
});
|
|
8829
9349
|
case 10:
|
|
8830
|
-
|
|
9350
|
+
_context6.n = 2;
|
|
8831
9351
|
break;
|
|
8832
9352
|
case 11:
|
|
8833
|
-
|
|
9353
|
+
_context6.n = 13;
|
|
8834
9354
|
break;
|
|
8835
9355
|
case 12:
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
_iterator2.e(
|
|
9356
|
+
_context6.p = 12;
|
|
9357
|
+
_t8 = _context6.v;
|
|
9358
|
+
_iterator2.e(_t8);
|
|
8839
9359
|
case 13:
|
|
8840
|
-
|
|
9360
|
+
_context6.p = 13;
|
|
8841
9361
|
_iterator2.f();
|
|
8842
|
-
return
|
|
9362
|
+
return _context6.f(13);
|
|
8843
9363
|
case 14:
|
|
8844
|
-
|
|
9364
|
+
_context6.n = 15;
|
|
8845
9365
|
return this.multicall3Client.aggregate3({
|
|
8846
9366
|
calls: contracts
|
|
8847
9367
|
});
|
|
8848
9368
|
case 15:
|
|
8849
|
-
txHash =
|
|
8850
|
-
|
|
9369
|
+
txHash = _context6.v;
|
|
9370
|
+
_context6.n = 16;
|
|
8851
9371
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
8852
9372
|
hash: txHash
|
|
8853
9373
|
}));
|
|
8854
9374
|
case 16:
|
|
8855
|
-
return
|
|
9375
|
+
return _context6.a(2, {
|
|
8856
9376
|
txHash: txHash
|
|
8857
9377
|
});
|
|
8858
9378
|
case 17:
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
return
|
|
9379
|
+
_context6.p = 17;
|
|
9380
|
+
_t9 = _context6.v;
|
|
9381
|
+
return _context6.a(2, handleError(_t9, "Failed to batch register derivative"));
|
|
8862
9382
|
}
|
|
8863
|
-
},
|
|
9383
|
+
}, _callee6, this, [[3, 5], [1, 12, 13, 14], [0, 17]]);
|
|
8864
9384
|
}));
|
|
8865
|
-
function batchRegisterDerivative(
|
|
9385
|
+
function batchRegisterDerivative(_x7) {
|
|
8866
9386
|
return _batchRegisterDerivative.apply(this, arguments);
|
|
8867
9387
|
}
|
|
8868
9388
|
return batchRegisterDerivative;
|
|
@@ -8894,12 +9414,12 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8894
9414
|
}, {
|
|
8895
9415
|
key: "registerDerivativeWithLicenseTokens",
|
|
8896
9416
|
value: (function () {
|
|
8897
|
-
var _registerDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
8898
|
-
var _request$txOptions3, req, isChildIpIdRegistered, txHash,
|
|
8899
|
-
return _regenerator().w(function (
|
|
8900
|
-
while (1) switch (
|
|
9417
|
+
var _registerDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(request) {
|
|
9418
|
+
var _request$txOptions3, req, isChildIpIdRegistered, txHash, _t0;
|
|
9419
|
+
return _regenerator().w(function (_context7) {
|
|
9420
|
+
while (1) switch (_context7.p = _context7.n) {
|
|
8901
9421
|
case 0:
|
|
8902
|
-
|
|
9422
|
+
_context7.p = 0;
|
|
8903
9423
|
req = {
|
|
8904
9424
|
childIpId: validateAddress(request.childIpId),
|
|
8905
9425
|
licenseTokenIds: request.licenseTokenIds.map(function (id) {
|
|
@@ -8908,59 +9428,59 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8908
9428
|
royaltyContext: zeroAddress,
|
|
8909
9429
|
maxRts: validateMaxRts(request.maxRts)
|
|
8910
9430
|
};
|
|
8911
|
-
|
|
9431
|
+
_context7.n = 1;
|
|
8912
9432
|
return this.isRegistered(request.childIpId);
|
|
8913
9433
|
case 1:
|
|
8914
|
-
isChildIpIdRegistered =
|
|
9434
|
+
isChildIpIdRegistered = _context7.v;
|
|
8915
9435
|
if (isChildIpIdRegistered) {
|
|
8916
|
-
|
|
9436
|
+
_context7.n = 2;
|
|
8917
9437
|
break;
|
|
8918
9438
|
}
|
|
8919
9439
|
throw new Error("The child IP with id ".concat(request.childIpId, " is not registered."));
|
|
8920
9440
|
case 2:
|
|
8921
9441
|
if (!(request.licenseTokenIds.length === 0)) {
|
|
8922
|
-
|
|
9442
|
+
_context7.n = 3;
|
|
8923
9443
|
break;
|
|
8924
9444
|
}
|
|
8925
9445
|
throw new Error("The licenseTokenIds must be provided.");
|
|
8926
9446
|
case 3:
|
|
8927
|
-
|
|
9447
|
+
_context7.n = 4;
|
|
8928
9448
|
return this.validateLicenseTokenIds(request.licenseTokenIds);
|
|
8929
9449
|
case 4:
|
|
8930
|
-
request.licenseTokenIds =
|
|
9450
|
+
request.licenseTokenIds = _context7.v;
|
|
8931
9451
|
if (!((_request$txOptions3 = request.txOptions) !== null && _request$txOptions3 !== void 0 && _request$txOptions3.encodedTxDataOnly)) {
|
|
8932
|
-
|
|
9452
|
+
_context7.n = 5;
|
|
8933
9453
|
break;
|
|
8934
9454
|
}
|
|
8935
|
-
return
|
|
9455
|
+
return _context7.a(2, {
|
|
8936
9456
|
encodedTxData: this.licensingModuleClient.registerDerivativeWithLicenseTokensEncode(req)
|
|
8937
9457
|
});
|
|
8938
9458
|
case 5:
|
|
8939
|
-
|
|
9459
|
+
_context7.n = 6;
|
|
8940
9460
|
return this.licensingModuleClient.registerDerivativeWithLicenseTokens(req);
|
|
8941
9461
|
case 6:
|
|
8942
|
-
txHash =
|
|
8943
|
-
|
|
9462
|
+
txHash = _context7.v;
|
|
9463
|
+
_context7.n = 7;
|
|
8944
9464
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
8945
9465
|
hash: txHash
|
|
8946
9466
|
}));
|
|
8947
9467
|
case 7:
|
|
8948
|
-
return
|
|
9468
|
+
return _context7.a(2, {
|
|
8949
9469
|
txHash: txHash
|
|
8950
9470
|
});
|
|
8951
9471
|
case 8:
|
|
8952
|
-
|
|
9472
|
+
_context7.n = 10;
|
|
8953
9473
|
break;
|
|
8954
9474
|
case 9:
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
return
|
|
9475
|
+
_context7.p = 9;
|
|
9476
|
+
_t0 = _context7.v;
|
|
9477
|
+
return _context7.a(2, handleError(_t0, "Failed to register derivative with license tokens"));
|
|
8958
9478
|
case 10:
|
|
8959
|
-
return
|
|
9479
|
+
return _context7.a(2);
|
|
8960
9480
|
}
|
|
8961
|
-
},
|
|
9481
|
+
}, _callee7, this, [[0, 9]]);
|
|
8962
9482
|
}));
|
|
8963
|
-
function registerDerivativeWithLicenseTokens(
|
|
9483
|
+
function registerDerivativeWithLicenseTokens(_x8) {
|
|
8964
9484
|
return _registerDerivativeWithLicenseTokens.apply(this, arguments);
|
|
8965
9485
|
}
|
|
8966
9486
|
return registerDerivativeWithLicenseTokens;
|
|
@@ -8992,14 +9512,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8992
9512
|
}, {
|
|
8993
9513
|
key: "mintAndRegisterIpAssetWithPilTerms",
|
|
8994
9514
|
value: (function () {
|
|
8995
|
-
var _mintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
8996
|
-
var
|
|
8997
|
-
var _request$txOptions4, _yield$transformRegis, transformRequest, encodedTxData, contractCall, rsp, computedLicenseTermsIds, maxLicenseTokensTxHashes,
|
|
8998
|
-
return _regenerator().w(function (
|
|
8999
|
-
while (1) switch (
|
|
9515
|
+
var _mintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(request) {
|
|
9516
|
+
var _this2 = this;
|
|
9517
|
+
var _request$txOptions4, _yield$transformRegis, transformRequest, encodedTxData, contractCall, rsp, computedLicenseTermsIds, maxLicenseTokensTxHashes, _t1;
|
|
9518
|
+
return _regenerator().w(function (_context8) {
|
|
9519
|
+
while (1) switch (_context8.p = _context8.n) {
|
|
9000
9520
|
case 0:
|
|
9001
|
-
|
|
9002
|
-
|
|
9521
|
+
_context8.p = 0;
|
|
9522
|
+
_context8.n = 1;
|
|
9003
9523
|
return transformRegistrationRequest({
|
|
9004
9524
|
request: request,
|
|
9005
9525
|
rpcClient: this.rpcClient,
|
|
@@ -9007,21 +9527,21 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9007
9527
|
chainId: this.chainId
|
|
9008
9528
|
});
|
|
9009
9529
|
case 1:
|
|
9010
|
-
_yield$transformRegis =
|
|
9530
|
+
_yield$transformRegis = _context8.v;
|
|
9011
9531
|
transformRequest = _yield$transformRegis.transformRequest;
|
|
9012
9532
|
encodedTxData = this.licenseAttachmentWorkflowsClient.mintAndRegisterIpAndAttachPilTermsEncode(transformRequest);
|
|
9013
9533
|
if (!((_request$txOptions4 = request.txOptions) !== null && _request$txOptions4 !== void 0 && _request$txOptions4.encodedTxDataOnly)) {
|
|
9014
|
-
|
|
9534
|
+
_context8.n = 2;
|
|
9015
9535
|
break;
|
|
9016
9536
|
}
|
|
9017
|
-
return
|
|
9537
|
+
return _context8.a(2, {
|
|
9018
9538
|
encodedTxData: encodedTxData
|
|
9019
9539
|
});
|
|
9020
9540
|
case 2:
|
|
9021
9541
|
contractCall = function contractCall() {
|
|
9022
|
-
return
|
|
9542
|
+
return _this2.licenseAttachmentWorkflowsClient.mintAndRegisterIpAndAttachPilTerms(transformRequest);
|
|
9023
9543
|
};
|
|
9024
|
-
|
|
9544
|
+
_context8.n = 3;
|
|
9025
9545
|
return this.handleRegistrationWithFees({
|
|
9026
9546
|
options: request.options,
|
|
9027
9547
|
sender: this.walletAddress,
|
|
@@ -9032,14 +9552,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9032
9552
|
txOptions: request.txOptions
|
|
9033
9553
|
});
|
|
9034
9554
|
case 3:
|
|
9035
|
-
rsp =
|
|
9036
|
-
|
|
9555
|
+
rsp = _context8.v;
|
|
9556
|
+
_context8.n = 4;
|
|
9037
9557
|
return this.getLicenseTermsId(transformRequest.licenseTermsData.map(function (data) {
|
|
9038
9558
|
return data.terms;
|
|
9039
9559
|
}));
|
|
9040
9560
|
case 4:
|
|
9041
|
-
computedLicenseTermsIds =
|
|
9042
|
-
|
|
9561
|
+
computedLicenseTermsIds = _context8.v;
|
|
9562
|
+
_context8.n = 5;
|
|
9043
9563
|
return setMaxLicenseTokens({
|
|
9044
9564
|
maxLicenseTokensData: request.licenseTermsData,
|
|
9045
9565
|
licensorIpId: rsp.ipId,
|
|
@@ -9048,20 +9568,20 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9048
9568
|
templateAddress: this.licenseTemplateAddress
|
|
9049
9569
|
});
|
|
9050
9570
|
case 5:
|
|
9051
|
-
maxLicenseTokensTxHashes =
|
|
9052
|
-
return
|
|
9571
|
+
maxLicenseTokensTxHashes = _context8.v;
|
|
9572
|
+
return _context8.a(2, _objectSpread2(_objectSpread2({}, rsp), {}, {
|
|
9053
9573
|
licenseTermsIds: computedLicenseTermsIds
|
|
9054
9574
|
}, maxLicenseTokensTxHashes.length > 0 && {
|
|
9055
9575
|
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
|
9056
9576
|
}));
|
|
9057
9577
|
case 6:
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
return
|
|
9578
|
+
_context8.p = 6;
|
|
9579
|
+
_t1 = _context8.v;
|
|
9580
|
+
return _context8.a(2, handleError(_t1, "Failed to mint and register IP and attach PIL terms"));
|
|
9061
9581
|
}
|
|
9062
|
-
},
|
|
9582
|
+
}, _callee8, this, [[0, 6]]);
|
|
9063
9583
|
}));
|
|
9064
|
-
function mintAndRegisterIpAssetWithPilTerms(
|
|
9584
|
+
function mintAndRegisterIpAssetWithPilTerms(_x9) {
|
|
9065
9585
|
return _mintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
|
|
9066
9586
|
}
|
|
9067
9587
|
return mintAndRegisterIpAssetWithPilTerms;
|
|
@@ -9069,64 +9589,68 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9069
9589
|
/**
|
|
9070
9590
|
* Batch mint an NFT from a collection and register it as an IP.
|
|
9071
9591
|
*
|
|
9592
|
+
* @remark For better gas efficiency, consider using {@link batchRegisterIpAssetsWithOptimizedWorkflows} instead.
|
|
9593
|
+
* The optimized workflows method provides intelligent transaction batching, automatic token handling.
|
|
9594
|
+
*
|
|
9072
9595
|
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} and {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicensingModule.sol#L19 | `LicenseTermsAttached`} events.
|
|
9073
9596
|
*/
|
|
9074
9597
|
)
|
|
9075
9598
|
}, {
|
|
9076
9599
|
key: "batchMintAndRegisterIpAssetWithPilTerms",
|
|
9077
9600
|
value: (function () {
|
|
9078
|
-
var _batchMintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
9079
|
-
var
|
|
9080
|
-
|
|
9081
|
-
|
|
9601
|
+
var _batchMintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(request) {
|
|
9602
|
+
var _this3 = this;
|
|
9603
|
+
var calldata, _iterator3, _step3, arg, result, txHash, txReceipt, results, _loop, j, _t10, _t11;
|
|
9604
|
+
return _regenerator().w(function (_context0) {
|
|
9605
|
+
while (1) switch (_context0.p = _context0.n) {
|
|
9082
9606
|
case 0:
|
|
9083
|
-
|
|
9607
|
+
_context0.p = 0;
|
|
9084
9608
|
calldata = [];
|
|
9085
9609
|
_iterator3 = _createForOfIteratorHelper(request.args);
|
|
9086
|
-
|
|
9610
|
+
_context0.p = 1;
|
|
9087
9611
|
_iterator3.s();
|
|
9088
9612
|
case 2:
|
|
9089
9613
|
if ((_step3 = _iterator3.n()).done) {
|
|
9090
|
-
|
|
9614
|
+
_context0.n = 5;
|
|
9091
9615
|
break;
|
|
9092
9616
|
}
|
|
9093
9617
|
arg = _step3.value;
|
|
9094
|
-
|
|
9618
|
+
_context0.n = 3;
|
|
9095
9619
|
return this.mintAndRegisterIpAssetWithPilTerms(_objectSpread2(_objectSpread2({}, arg), {}, {
|
|
9096
9620
|
txOptions: {
|
|
9097
9621
|
encodedTxDataOnly: true
|
|
9098
9622
|
}
|
|
9099
9623
|
}));
|
|
9100
9624
|
case 3:
|
|
9101
|
-
result =
|
|
9625
|
+
result = _context0.v;
|
|
9102
9626
|
calldata.push(result.encodedTxData.data);
|
|
9103
9627
|
case 4:
|
|
9104
|
-
|
|
9628
|
+
_context0.n = 2;
|
|
9105
9629
|
break;
|
|
9106
9630
|
case 5:
|
|
9107
|
-
|
|
9631
|
+
_context0.n = 7;
|
|
9108
9632
|
break;
|
|
9109
9633
|
case 6:
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
_iterator3.e(
|
|
9634
|
+
_context0.p = 6;
|
|
9635
|
+
_t10 = _context0.v;
|
|
9636
|
+
_iterator3.e(_t10);
|
|
9113
9637
|
case 7:
|
|
9114
|
-
|
|
9638
|
+
_context0.p = 7;
|
|
9115
9639
|
_iterator3.f();
|
|
9116
|
-
return
|
|
9640
|
+
return _context0.f(7);
|
|
9117
9641
|
case 8:
|
|
9118
|
-
|
|
9642
|
+
_context0.n = 9;
|
|
9119
9643
|
return this.licenseAttachmentWorkflowsClient.multicall({
|
|
9120
9644
|
data: calldata
|
|
9121
9645
|
});
|
|
9122
9646
|
case 9:
|
|
9123
|
-
txHash =
|
|
9124
|
-
|
|
9647
|
+
txHash = _context0.v;
|
|
9648
|
+
_context0.n = 10;
|
|
9125
9649
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
9126
9650
|
hash: txHash
|
|
9127
9651
|
}));
|
|
9128
9652
|
case 10:
|
|
9129
|
-
txReceipt =
|
|
9653
|
+
txReceipt = _context0.v;
|
|
9130
9654
|
results = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt).map(function (log) {
|
|
9131
9655
|
return {
|
|
9132
9656
|
ipId: log.ipId,
|
|
@@ -9134,54 +9658,80 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9134
9658
|
spgNftContract: log.tokenContract,
|
|
9135
9659
|
licenseTermsIds: []
|
|
9136
9660
|
};
|
|
9137
|
-
}); //
|
|
9661
|
+
}); // Get license terms id and max license tokens mapping relationship by the sequence of the request.args
|
|
9662
|
+
_loop = /*#__PURE__*/_regenerator().m(function _loop() {
|
|
9663
|
+
var licenseTerms, termsIndexes, licenseTermsData, licenseTermsIds, i, licenseTermsDataInput, validatedTerms, resolvedIds, filteredLicenseTermsIds, maxLicenseTokensTxHashes;
|
|
9664
|
+
return _regenerator().w(function (_context9) {
|
|
9665
|
+
while (1) switch (_context9.n) {
|
|
9666
|
+
case 0:
|
|
9667
|
+
licenseTerms = [];
|
|
9668
|
+
termsIndexes = [];
|
|
9669
|
+
licenseTermsData = request.args[j].licenseTermsData;
|
|
9670
|
+
licenseTermsIds = new Array(licenseTermsData.length).fill(null);
|
|
9671
|
+
for (i = 0; i < licenseTermsData.length; i++) {
|
|
9672
|
+
licenseTermsDataInput = licenseTermsData[i];
|
|
9673
|
+
if (licenseTermsDataInput.terms) {
|
|
9674
|
+
validatedTerms = PILFlavor.validateLicenseTerms(licenseTermsDataInput.terms, _this3.chainId);
|
|
9675
|
+
validatedTerms.commercialRevShare = getRevenueShare(validatedTerms.commercialRevShare);
|
|
9676
|
+
licenseTerms.push(validatedTerms);
|
|
9677
|
+
termsIndexes.push(i);
|
|
9678
|
+
} else if (licenseTermsDataInput.licenseTermsId !== undefined) {
|
|
9679
|
+
licenseTermsIds[i] = BigInt(licenseTermsDataInput.licenseTermsId);
|
|
9680
|
+
}
|
|
9681
|
+
}
|
|
9682
|
+
_context9.n = 1;
|
|
9683
|
+
return _this3.getLicenseTermsId(licenseTerms);
|
|
9684
|
+
case 1:
|
|
9685
|
+
resolvedIds = _context9.v;
|
|
9686
|
+
termsIndexes.forEach(function (value, index) {
|
|
9687
|
+
licenseTermsIds[value] = resolvedIds[index];
|
|
9688
|
+
});
|
|
9689
|
+
filteredLicenseTermsIds = licenseTermsIds.filter(function (id) {
|
|
9690
|
+
return id !== null;
|
|
9691
|
+
});
|
|
9692
|
+
results[j].licenseTermsIds = filteredLicenseTermsIds;
|
|
9693
|
+
_context9.n = 2;
|
|
9694
|
+
return setMaxLicenseTokens({
|
|
9695
|
+
maxLicenseTokensData: licenseTermsData,
|
|
9696
|
+
licensorIpId: results[j].ipId,
|
|
9697
|
+
licenseTermsIds: filteredLicenseTermsIds,
|
|
9698
|
+
totalLicenseTokenLimitHookClient: _this3.totalLicenseTokenLimitHookClient,
|
|
9699
|
+
templateAddress: _this3.licenseTemplateAddress
|
|
9700
|
+
});
|
|
9701
|
+
case 2:
|
|
9702
|
+
maxLicenseTokensTxHashes = _context9.v;
|
|
9703
|
+
if (maxLicenseTokensTxHashes.length > 0) {
|
|
9704
|
+
results[j].maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
|
|
9705
|
+
}
|
|
9706
|
+
case 3:
|
|
9707
|
+
return _context9.a(2);
|
|
9708
|
+
}
|
|
9709
|
+
}, _loop);
|
|
9710
|
+
});
|
|
9138
9711
|
j = 0;
|
|
9139
9712
|
case 11:
|
|
9140
9713
|
if (!(j < request.args.length)) {
|
|
9141
|
-
|
|
9714
|
+
_context0.n = 13;
|
|
9142
9715
|
break;
|
|
9143
9716
|
}
|
|
9144
|
-
|
|
9145
|
-
licenseTermsData = request.args[j].licenseTermsData;
|
|
9146
|
-
for (i = 0; i < licenseTermsData.length; i++) {
|
|
9147
|
-
licenseTerm = PILFlavor.validateLicenseTerms(licenseTermsData[i].terms, this.chainId);
|
|
9148
|
-
licenseTerms.push(licenseTerm);
|
|
9149
|
-
}
|
|
9150
|
-
_context8.n = 12;
|
|
9151
|
-
return this.getLicenseTermsId(licenseTerms);
|
|
9717
|
+
return _context0.d(_regeneratorValues(_loop()), 12);
|
|
9152
9718
|
case 12:
|
|
9153
|
-
licenseTermsIds = _context8.v;
|
|
9154
|
-
results[j].licenseTermsIds = licenseTermsIds;
|
|
9155
|
-
_context8.n = 13;
|
|
9156
|
-
return setMaxLicenseTokens({
|
|
9157
|
-
maxLicenseTokensData: licenseTermsData,
|
|
9158
|
-
licensorIpId: results[j].ipId,
|
|
9159
|
-
licenseTermsIds: licenseTermsIds,
|
|
9160
|
-
totalLicenseTokenLimitHookClient: this.totalLicenseTokenLimitHookClient,
|
|
9161
|
-
templateAddress: this.licenseTemplateAddress
|
|
9162
|
-
});
|
|
9163
|
-
case 13:
|
|
9164
|
-
maxLicenseTokensTxHashes = _context8.v;
|
|
9165
|
-
if (maxLicenseTokensTxHashes.length > 0) {
|
|
9166
|
-
results[j].maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
|
|
9167
|
-
}
|
|
9168
|
-
case 14:
|
|
9169
9719
|
j++;
|
|
9170
|
-
|
|
9720
|
+
_context0.n = 11;
|
|
9171
9721
|
break;
|
|
9172
|
-
case
|
|
9173
|
-
return
|
|
9722
|
+
case 13:
|
|
9723
|
+
return _context0.a(2, {
|
|
9174
9724
|
txHash: txHash,
|
|
9175
9725
|
results: results
|
|
9176
9726
|
});
|
|
9177
|
-
case
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
return
|
|
9727
|
+
case 14:
|
|
9728
|
+
_context0.p = 14;
|
|
9729
|
+
_t11 = _context0.v;
|
|
9730
|
+
return _context0.a(2, handleError(_t11, "Failed to batch mint and register IP and attach PIL terms"));
|
|
9181
9731
|
}
|
|
9182
|
-
},
|
|
9732
|
+
}, _callee9, this, [[1, 6, 7, 8], [0, 14]]);
|
|
9183
9733
|
}));
|
|
9184
|
-
function batchMintAndRegisterIpAssetWithPilTerms(
|
|
9734
|
+
function batchMintAndRegisterIpAssetWithPilTerms(_x0) {
|
|
9185
9735
|
return _batchMintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
|
|
9186
9736
|
}
|
|
9187
9737
|
return batchMintAndRegisterIpAssetWithPilTerms;
|
|
@@ -9214,14 +9764,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9214
9764
|
}, {
|
|
9215
9765
|
key: "registerIpAndAttachPilTerms",
|
|
9216
9766
|
value: (function () {
|
|
9217
|
-
var _registerIpAndAttachPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
9218
|
-
var _request$txOptions5, ipIdAddress, isRegistered, _yield$validateLicens, licenseTerms, _yield$transformRegis2, _transformRequest, txHash, txReceipt, log, licenseTermsIds, maxLicenseTokensTxHashes,
|
|
9219
|
-
return _regenerator().w(function (
|
|
9220
|
-
while (1) switch (
|
|
9767
|
+
var _registerIpAndAttachPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(request) {
|
|
9768
|
+
var _request$txOptions5, ipIdAddress, isRegistered, _yield$validateLicens, licenseTerms, _yield$transformRegis2, _transformRequest, txHash, txReceipt, log, licenseTermsIds, maxLicenseTokensTxHashes, _t12;
|
|
9769
|
+
return _regenerator().w(function (_context1) {
|
|
9770
|
+
while (1) switch (_context1.p = _context1.n) {
|
|
9221
9771
|
case 0:
|
|
9222
|
-
|
|
9772
|
+
_context1.p = 0;
|
|
9223
9773
|
request.tokenId = BigInt(request.tokenId);
|
|
9224
|
-
|
|
9774
|
+
_context1.n = 1;
|
|
9225
9775
|
return getIpIdAddress({
|
|
9226
9776
|
nftContract: request.nftContract,
|
|
9227
9777
|
tokenId: request.tokenId,
|
|
@@ -9230,23 +9780,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9230
9780
|
chainId: this.chainId
|
|
9231
9781
|
});
|
|
9232
9782
|
case 1:
|
|
9233
|
-
ipIdAddress =
|
|
9234
|
-
|
|
9783
|
+
ipIdAddress = _context1.v;
|
|
9784
|
+
_context1.n = 2;
|
|
9235
9785
|
return this.isRegistered(ipIdAddress);
|
|
9236
9786
|
case 2:
|
|
9237
|
-
isRegistered =
|
|
9787
|
+
isRegistered = _context1.v;
|
|
9238
9788
|
if (!isRegistered) {
|
|
9239
|
-
|
|
9789
|
+
_context1.n = 3;
|
|
9240
9790
|
break;
|
|
9241
9791
|
}
|
|
9242
9792
|
throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
|
|
9243
9793
|
case 3:
|
|
9244
|
-
|
|
9794
|
+
_context1.n = 4;
|
|
9245
9795
|
return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
|
|
9246
9796
|
case 4:
|
|
9247
|
-
_yield$validateLicens =
|
|
9797
|
+
_yield$validateLicens = _context1.v;
|
|
9248
9798
|
licenseTerms = _yield$validateLicens.licenseTerms;
|
|
9249
|
-
|
|
9799
|
+
_context1.n = 5;
|
|
9250
9800
|
return transformRegistrationRequest({
|
|
9251
9801
|
request: request,
|
|
9252
9802
|
rpcClient: this.rpcClient,
|
|
@@ -9254,32 +9804,32 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9254
9804
|
chainId: this.chainId
|
|
9255
9805
|
});
|
|
9256
9806
|
case 5:
|
|
9257
|
-
_yield$transformRegis2 =
|
|
9807
|
+
_yield$transformRegis2 = _context1.v;
|
|
9258
9808
|
_transformRequest = _yield$transformRegis2.transformRequest;
|
|
9259
9809
|
if (!((_request$txOptions5 = request.txOptions) !== null && _request$txOptions5 !== void 0 && _request$txOptions5.encodedTxDataOnly)) {
|
|
9260
|
-
|
|
9810
|
+
_context1.n = 6;
|
|
9261
9811
|
break;
|
|
9262
9812
|
}
|
|
9263
|
-
return
|
|
9813
|
+
return _context1.a(2, {
|
|
9264
9814
|
encodedTxData: this.licenseAttachmentWorkflowsClient.registerIpAndAttachPilTermsEncode(_transformRequest)
|
|
9265
9815
|
});
|
|
9266
9816
|
case 6:
|
|
9267
|
-
|
|
9817
|
+
_context1.n = 7;
|
|
9268
9818
|
return this.licenseAttachmentWorkflowsClient.registerIpAndAttachPilTerms(_transformRequest);
|
|
9269
9819
|
case 7:
|
|
9270
|
-
txHash =
|
|
9271
|
-
|
|
9820
|
+
txHash = _context1.v;
|
|
9821
|
+
_context1.n = 8;
|
|
9272
9822
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
9273
9823
|
hash: txHash
|
|
9274
9824
|
}));
|
|
9275
9825
|
case 8:
|
|
9276
|
-
txReceipt =
|
|
9826
|
+
txReceipt = _context1.v;
|
|
9277
9827
|
log = this.getIpIdAndTokenIdsFromEvent(txReceipt)[0];
|
|
9278
|
-
|
|
9828
|
+
_context1.n = 9;
|
|
9279
9829
|
return this.getLicenseTermsId(licenseTerms);
|
|
9280
9830
|
case 9:
|
|
9281
|
-
licenseTermsIds =
|
|
9282
|
-
|
|
9831
|
+
licenseTermsIds = _context1.v;
|
|
9832
|
+
_context1.n = 10;
|
|
9283
9833
|
return setMaxLicenseTokens({
|
|
9284
9834
|
maxLicenseTokensData: request.licenseTermsData,
|
|
9285
9835
|
licensorIpId: log.ipId,
|
|
@@ -9288,26 +9838,26 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9288
9838
|
templateAddress: this.licenseTemplateAddress
|
|
9289
9839
|
});
|
|
9290
9840
|
case 10:
|
|
9291
|
-
maxLicenseTokensTxHashes =
|
|
9292
|
-
return
|
|
9841
|
+
maxLicenseTokensTxHashes = _context1.v;
|
|
9842
|
+
return _context1.a(2, _objectSpread2(_objectSpread2({
|
|
9293
9843
|
txHash: txHash,
|
|
9294
9844
|
licenseTermsIds: licenseTermsIds
|
|
9295
9845
|
}, maxLicenseTokensTxHashes.length > 0 && {
|
|
9296
9846
|
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
|
9297
9847
|
}), log));
|
|
9298
9848
|
case 11:
|
|
9299
|
-
|
|
9849
|
+
_context1.n = 13;
|
|
9300
9850
|
break;
|
|
9301
9851
|
case 12:
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
return
|
|
9852
|
+
_context1.p = 12;
|
|
9853
|
+
_t12 = _context1.v;
|
|
9854
|
+
return _context1.a(2, handleError(_t12, "Failed to register IP and attach PIL terms"));
|
|
9305
9855
|
case 13:
|
|
9306
|
-
return
|
|
9856
|
+
return _context1.a(2);
|
|
9307
9857
|
}
|
|
9308
|
-
},
|
|
9858
|
+
}, _callee0, this, [[0, 12]]);
|
|
9309
9859
|
}));
|
|
9310
|
-
function registerIpAndAttachPilTerms(
|
|
9860
|
+
function registerIpAndAttachPilTerms(_x1) {
|
|
9311
9861
|
return _registerIpAndAttachPilTerms.apply(this, arguments);
|
|
9312
9862
|
}
|
|
9313
9863
|
return registerIpAndAttachPilTerms;
|
|
@@ -9340,15 +9890,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9340
9890
|
}, {
|
|
9341
9891
|
key: "registerDerivativeIp",
|
|
9342
9892
|
value: (function () {
|
|
9343
|
-
var _registerDerivativeIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
9893
|
+
var _registerDerivativeIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(request) {
|
|
9344
9894
|
var _this4 = this;
|
|
9345
|
-
var _request$txOptions6, _request$
|
|
9346
|
-
return _regenerator().w(function (
|
|
9347
|
-
while (1) switch (
|
|
9895
|
+
var _request$txOptions6, _request$options, tokenId, ipIdAddress, isRegistered, _yield$transformRegis3, _transformRequest2, encodedTxData, contractCall, _t13;
|
|
9896
|
+
return _regenerator().w(function (_context10) {
|
|
9897
|
+
while (1) switch (_context10.p = _context10.n) {
|
|
9348
9898
|
case 0:
|
|
9349
|
-
|
|
9899
|
+
_context10.p = 0;
|
|
9350
9900
|
tokenId = BigInt(request.tokenId);
|
|
9351
|
-
|
|
9901
|
+
_context10.n = 1;
|
|
9352
9902
|
return getIpIdAddress({
|
|
9353
9903
|
nftContract: request.nftContract,
|
|
9354
9904
|
tokenId: tokenId,
|
|
@@ -9357,18 +9907,18 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9357
9907
|
chainId: this.chainId
|
|
9358
9908
|
});
|
|
9359
9909
|
case 1:
|
|
9360
|
-
ipIdAddress =
|
|
9361
|
-
|
|
9910
|
+
ipIdAddress = _context10.v;
|
|
9911
|
+
_context10.n = 2;
|
|
9362
9912
|
return this.isRegistered(ipIdAddress);
|
|
9363
9913
|
case 2:
|
|
9364
|
-
isRegistered =
|
|
9914
|
+
isRegistered = _context10.v;
|
|
9365
9915
|
if (!isRegistered) {
|
|
9366
|
-
|
|
9916
|
+
_context10.n = 3;
|
|
9367
9917
|
break;
|
|
9368
9918
|
}
|
|
9369
9919
|
throw new Error("The NFT with id ".concat(tokenId, " is already registered as IP."));
|
|
9370
9920
|
case 3:
|
|
9371
|
-
|
|
9921
|
+
_context10.n = 4;
|
|
9372
9922
|
return transformRegistrationRequest({
|
|
9373
9923
|
request: request,
|
|
9374
9924
|
rpcClient: this.rpcClient,
|
|
@@ -9376,23 +9926,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9376
9926
|
chainId: this.chainId
|
|
9377
9927
|
});
|
|
9378
9928
|
case 4:
|
|
9379
|
-
_yield$transformRegis3 =
|
|
9929
|
+
_yield$transformRegis3 = _context10.v;
|
|
9380
9930
|
_transformRequest2 = _yield$transformRegis3.transformRequest;
|
|
9381
9931
|
encodedTxData = this.derivativeWorkflowsClient.registerIpAndMakeDerivativeEncode(_transformRequest2);
|
|
9382
9932
|
if (!((_request$txOptions6 = request.txOptions) !== null && _request$txOptions6 !== void 0 && _request$txOptions6.encodedTxDataOnly)) {
|
|
9383
|
-
|
|
9933
|
+
_context10.n = 5;
|
|
9384
9934
|
break;
|
|
9385
9935
|
}
|
|
9386
|
-
return
|
|
9936
|
+
return _context10.a(2, {
|
|
9387
9937
|
encodedTxData: encodedTxData
|
|
9388
9938
|
});
|
|
9389
9939
|
case 5:
|
|
9390
9940
|
contractCall = function contractCall() {
|
|
9391
9941
|
return _this4.derivativeWorkflowsClient.registerIpAndMakeDerivative(_transformRequest2);
|
|
9392
9942
|
};
|
|
9393
|
-
return
|
|
9943
|
+
return _context10.a(2, this.handleRegistrationWithFees({
|
|
9394
9944
|
options: _objectSpread2(_objectSpread2({}, request.options), {}, {
|
|
9395
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$
|
|
9945
|
+
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options = request.options) === null || _request$options === void 0 ? void 0 : _request$options.wipOptions), {}, {
|
|
9396
9946
|
useMulticallWhenPossible: false
|
|
9397
9947
|
})
|
|
9398
9948
|
}),
|
|
@@ -9404,13 +9954,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9404
9954
|
txOptions: request.txOptions
|
|
9405
9955
|
}));
|
|
9406
9956
|
case 6:
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
return
|
|
9957
|
+
_context10.p = 6;
|
|
9958
|
+
_t13 = _context10.v;
|
|
9959
|
+
return _context10.a(2, handleError(_t13, "Failed to register derivative IP"));
|
|
9410
9960
|
}
|
|
9411
|
-
},
|
|
9961
|
+
}, _callee1, this, [[0, 6]]);
|
|
9412
9962
|
}));
|
|
9413
|
-
function registerDerivativeIp(
|
|
9963
|
+
function registerDerivativeIp(_x10) {
|
|
9414
9964
|
return _registerDerivativeIp.apply(this, arguments);
|
|
9415
9965
|
}
|
|
9416
9966
|
return registerDerivativeIp;
|
|
@@ -9442,15 +9992,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9442
9992
|
}, {
|
|
9443
9993
|
key: "mintAndRegisterIpAndMakeDerivative",
|
|
9444
9994
|
value: (function () {
|
|
9445
|
-
var _mintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
9995
|
+
var _mintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(request) {
|
|
9446
9996
|
var _this5 = this;
|
|
9447
|
-
var _request$txOptions7, spgNftContract, _yield$transformRegis4, _transformRequest3, encodedTxData, contractCall,
|
|
9448
|
-
return _regenerator().w(function (
|
|
9449
|
-
while (1) switch (
|
|
9997
|
+
var _request$txOptions7, spgNftContract, _yield$transformRegis4, _transformRequest3, encodedTxData, contractCall, _t14;
|
|
9998
|
+
return _regenerator().w(function (_context11) {
|
|
9999
|
+
while (1) switch (_context11.p = _context11.n) {
|
|
9450
10000
|
case 0:
|
|
9451
|
-
|
|
10001
|
+
_context11.p = 0;
|
|
9452
10002
|
spgNftContract = validateAddress(request.spgNftContract);
|
|
9453
|
-
|
|
10003
|
+
_context11.n = 1;
|
|
9454
10004
|
return transformRegistrationRequest({
|
|
9455
10005
|
request: request,
|
|
9456
10006
|
rpcClient: this.rpcClient,
|
|
@@ -9458,21 +10008,21 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9458
10008
|
chainId: this.chainId
|
|
9459
10009
|
});
|
|
9460
10010
|
case 1:
|
|
9461
|
-
_yield$transformRegis4 =
|
|
10011
|
+
_yield$transformRegis4 = _context11.v;
|
|
9462
10012
|
_transformRequest3 = _yield$transformRegis4.transformRequest;
|
|
9463
10013
|
encodedTxData = this.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeEncode(_transformRequest3);
|
|
9464
10014
|
if (!((_request$txOptions7 = request.txOptions) !== null && _request$txOptions7 !== void 0 && _request$txOptions7.encodedTxDataOnly)) {
|
|
9465
|
-
|
|
10015
|
+
_context11.n = 2;
|
|
9466
10016
|
break;
|
|
9467
10017
|
}
|
|
9468
|
-
return
|
|
10018
|
+
return _context11.a(2, {
|
|
9469
10019
|
encodedTxData: encodedTxData
|
|
9470
10020
|
});
|
|
9471
10021
|
case 2:
|
|
9472
10022
|
contractCall = function contractCall() {
|
|
9473
10023
|
return _this5.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivative(_transformRequest3);
|
|
9474
10024
|
};
|
|
9475
|
-
return
|
|
10025
|
+
return _context11.a(2, this.handleRegistrationWithFees({
|
|
9476
10026
|
options: request.options,
|
|
9477
10027
|
sender: this.walletAddress,
|
|
9478
10028
|
spgSpenderAddress: this.derivativeWorkflowsClient.address,
|
|
@@ -9483,13 +10033,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9483
10033
|
txOptions: request.txOptions
|
|
9484
10034
|
}));
|
|
9485
10035
|
case 3:
|
|
9486
|
-
|
|
9487
|
-
|
|
9488
|
-
return
|
|
10036
|
+
_context11.p = 3;
|
|
10037
|
+
_t14 = _context11.v;
|
|
10038
|
+
return _context11.a(2, handleError(_t14, "Failed to mint and register IP and make derivative"));
|
|
9489
10039
|
}
|
|
9490
|
-
},
|
|
10040
|
+
}, _callee10, this, [[0, 3]]);
|
|
9491
10041
|
}));
|
|
9492
|
-
function mintAndRegisterIpAndMakeDerivative(
|
|
10042
|
+
function mintAndRegisterIpAndMakeDerivative(_x11) {
|
|
9493
10043
|
return _mintAndRegisterIpAndMakeDerivative.apply(this, arguments);
|
|
9494
10044
|
}
|
|
9495
10045
|
return mintAndRegisterIpAndMakeDerivative;
|
|
@@ -9497,83 +10047,86 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9497
10047
|
/**
|
|
9498
10048
|
* Batch mint an NFT from a collection and register it as a derivative IP without license tokens.
|
|
9499
10049
|
*
|
|
10050
|
+
* @remark For better gas efficiency, consider using {@link batchRegisterIpAssetsWithOptimizedWorkflows} instead.
|
|
10051
|
+
* The optimized workflows method provides intelligent transaction batching, automatic token handling.
|
|
10052
|
+
*
|
|
9500
10053
|
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
|
9501
10054
|
*/
|
|
9502
10055
|
)
|
|
9503
10056
|
}, {
|
|
9504
10057
|
key: "batchMintAndRegisterIpAndMakeDerivative",
|
|
9505
10058
|
value: (function () {
|
|
9506
|
-
var _batchMintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
9507
|
-
var calldata, _iterator4, _step4, arg, result, txHash, txReceipt,
|
|
9508
|
-
return _regenerator().w(function (
|
|
9509
|
-
while (1) switch (
|
|
10059
|
+
var _batchMintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(request) {
|
|
10060
|
+
var calldata, _iterator4, _step4, arg, result, txHash, txReceipt, _t15, _t16, _t17;
|
|
10061
|
+
return _regenerator().w(function (_context12) {
|
|
10062
|
+
while (1) switch (_context12.p = _context12.n) {
|
|
9510
10063
|
case 0:
|
|
9511
|
-
|
|
10064
|
+
_context12.p = 0;
|
|
9512
10065
|
calldata = [];
|
|
9513
10066
|
_iterator4 = _createForOfIteratorHelper(request.args);
|
|
9514
|
-
|
|
10067
|
+
_context12.p = 1;
|
|
9515
10068
|
_iterator4.s();
|
|
9516
10069
|
case 2:
|
|
9517
10070
|
if ((_step4 = _iterator4.n()).done) {
|
|
9518
|
-
|
|
10071
|
+
_context12.n = 7;
|
|
9519
10072
|
break;
|
|
9520
10073
|
}
|
|
9521
10074
|
arg = _step4.value;
|
|
9522
|
-
|
|
9523
|
-
|
|
10075
|
+
_context12.p = 3;
|
|
10076
|
+
_context12.n = 4;
|
|
9524
10077
|
return this.mintAndRegisterIpAndMakeDerivative(_objectSpread2(_objectSpread2({}, arg), {}, {
|
|
9525
10078
|
txOptions: {
|
|
9526
10079
|
encodedTxDataOnly: true
|
|
9527
10080
|
}
|
|
9528
10081
|
}));
|
|
9529
10082
|
case 4:
|
|
9530
|
-
result =
|
|
10083
|
+
result = _context12.v;
|
|
9531
10084
|
calldata.push(result.encodedTxData.data);
|
|
9532
|
-
|
|
10085
|
+
_context12.n = 6;
|
|
9533
10086
|
break;
|
|
9534
10087
|
case 5:
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
throw new Error(
|
|
10088
|
+
_context12.p = 5;
|
|
10089
|
+
_t15 = _context12.v;
|
|
10090
|
+
throw new Error(_t15.message.replace("Failed to mint and register IP and make derivative: ", "").trim());
|
|
9538
10091
|
case 6:
|
|
9539
|
-
|
|
10092
|
+
_context12.n = 2;
|
|
9540
10093
|
break;
|
|
9541
10094
|
case 7:
|
|
9542
|
-
|
|
10095
|
+
_context12.n = 9;
|
|
9543
10096
|
break;
|
|
9544
10097
|
case 8:
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
_iterator4.e(
|
|
10098
|
+
_context12.p = 8;
|
|
10099
|
+
_t16 = _context12.v;
|
|
10100
|
+
_iterator4.e(_t16);
|
|
9548
10101
|
case 9:
|
|
9549
|
-
|
|
10102
|
+
_context12.p = 9;
|
|
9550
10103
|
_iterator4.f();
|
|
9551
|
-
return
|
|
10104
|
+
return _context12.f(9);
|
|
9552
10105
|
case 10:
|
|
9553
|
-
|
|
10106
|
+
_context12.n = 11;
|
|
9554
10107
|
return this.derivativeWorkflowsClient.multicall({
|
|
9555
10108
|
data: calldata
|
|
9556
10109
|
});
|
|
9557
10110
|
case 11:
|
|
9558
|
-
txHash =
|
|
9559
|
-
|
|
10111
|
+
txHash = _context12.v;
|
|
10112
|
+
_context12.n = 12;
|
|
9560
10113
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
9561
10114
|
hash: txHash
|
|
9562
10115
|
}));
|
|
9563
10116
|
case 12:
|
|
9564
|
-
txReceipt =
|
|
9565
|
-
return
|
|
10117
|
+
txReceipt = _context12.v;
|
|
10118
|
+
return _context12.a(2, {
|
|
9566
10119
|
txHash: txHash,
|
|
9567
10120
|
results: this.getIpIdAndTokenIdsFromEvent(txReceipt, "spgNftContract")
|
|
9568
10121
|
});
|
|
9569
10122
|
case 13:
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
return
|
|
10123
|
+
_context12.p = 13;
|
|
10124
|
+
_t17 = _context12.v;
|
|
10125
|
+
return _context12.a(2, handleError(_t17, "Failed to batch mint and register IP and make derivative"));
|
|
9573
10126
|
}
|
|
9574
|
-
},
|
|
10127
|
+
}, _callee11, this, [[3, 5], [1, 8, 9, 10], [0, 13]]);
|
|
9575
10128
|
}));
|
|
9576
|
-
function batchMintAndRegisterIpAndMakeDerivative(
|
|
10129
|
+
function batchMintAndRegisterIpAndMakeDerivative(_x12) {
|
|
9577
10130
|
return _batchMintAndRegisterIpAndMakeDerivative.apply(this, arguments);
|
|
9578
10131
|
}
|
|
9579
10132
|
return batchMintAndRegisterIpAndMakeDerivative;
|
|
@@ -9604,52 +10157,52 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9604
10157
|
}, {
|
|
9605
10158
|
key: "mintAndRegisterIp",
|
|
9606
10159
|
value: (function () {
|
|
9607
|
-
var _mintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10160
|
+
var _mintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(request) {
|
|
9608
10161
|
var _this6 = this;
|
|
9609
|
-
var _request$txOptions8, _request$
|
|
9610
|
-
return _regenerator().w(function (
|
|
9611
|
-
while (1) switch (
|
|
10162
|
+
var _request$txOptions8, _request$options2, object, encodedTxData, contractCall, _t18;
|
|
10163
|
+
return _regenerator().w(function (_context13) {
|
|
10164
|
+
while (1) switch (_context13.p = _context13.n) {
|
|
9612
10165
|
case 0:
|
|
9613
|
-
|
|
9614
|
-
|
|
10166
|
+
_context13.p = 0;
|
|
10167
|
+
object = {
|
|
9615
10168
|
spgNftContract: validateAddress(request.spgNftContract),
|
|
9616
10169
|
recipient: validateAddress(request.recipient || this.walletAddress),
|
|
9617
10170
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
|
9618
10171
|
allowDuplicates: request.allowDuplicates || true
|
|
9619
10172
|
};
|
|
9620
|
-
encodedTxData = this.registrationWorkflowsClient.mintAndRegisterIpEncode(
|
|
10173
|
+
encodedTxData = this.registrationWorkflowsClient.mintAndRegisterIpEncode(object);
|
|
9621
10174
|
if (!((_request$txOptions8 = request.txOptions) !== null && _request$txOptions8 !== void 0 && _request$txOptions8.encodedTxDataOnly)) {
|
|
9622
|
-
|
|
10175
|
+
_context13.n = 1;
|
|
9623
10176
|
break;
|
|
9624
10177
|
}
|
|
9625
|
-
return
|
|
10178
|
+
return _context13.a(2, {
|
|
9626
10179
|
encodedTxData: encodedTxData
|
|
9627
10180
|
});
|
|
9628
10181
|
case 1:
|
|
9629
10182
|
contractCall = function contractCall() {
|
|
9630
|
-
return _this6.registrationWorkflowsClient.mintAndRegisterIp(
|
|
10183
|
+
return _this6.registrationWorkflowsClient.mintAndRegisterIp(object);
|
|
9631
10184
|
};
|
|
9632
|
-
return
|
|
10185
|
+
return _context13.a(2, this.handleRegistrationWithFees({
|
|
9633
10186
|
sender: this.walletAddress,
|
|
9634
10187
|
spgSpenderAddress: this.registrationWorkflowsClient.address,
|
|
9635
10188
|
encodedTxs: [encodedTxData],
|
|
9636
10189
|
contractCall: contractCall,
|
|
9637
|
-
spgNftContract:
|
|
10190
|
+
spgNftContract: object.spgNftContract,
|
|
9638
10191
|
txOptions: request.txOptions,
|
|
9639
10192
|
options: _objectSpread2(_objectSpread2({}, request.options), {}, {
|
|
9640
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$
|
|
10193
|
+
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options2 = request.options) === null || _request$options2 === void 0 ? void 0 : _request$options2.wipOptions), {}, {
|
|
9641
10194
|
useMulticallWhenPossible: false
|
|
9642
10195
|
})
|
|
9643
10196
|
})
|
|
9644
10197
|
}));
|
|
9645
10198
|
case 2:
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
return
|
|
10199
|
+
_context13.p = 2;
|
|
10200
|
+
_t18 = _context13.v;
|
|
10201
|
+
return _context13.a(2, handleError(_t18, "Failed to mint and register IP"));
|
|
9649
10202
|
}
|
|
9650
|
-
},
|
|
10203
|
+
}, _callee12, this, [[0, 2]]);
|
|
9651
10204
|
}));
|
|
9652
|
-
function mintAndRegisterIp(
|
|
10205
|
+
function mintAndRegisterIp(_x13) {
|
|
9653
10206
|
return _mintAndRegisterIp.apply(this, arguments);
|
|
9654
10207
|
}
|
|
9655
10208
|
return mintAndRegisterIp;
|
|
@@ -9673,23 +10226,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9673
10226
|
}, {
|
|
9674
10227
|
key: "batchMintAndRegisterIp",
|
|
9675
10228
|
value: (function () {
|
|
9676
|
-
var _batchMintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10229
|
+
var _batchMintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(request) {
|
|
9677
10230
|
var _this7 = this;
|
|
9678
|
-
var publicMintEncodedTxs, publicMintSpenders, privateMintEncodedTxs, privateMintSpenders, _iterator5, _step5, req, registrationRequest, isPublicMinting, nftMintFee, encodeTx, isMinterRole, handlePublicMintTransactions, handlePrivateMintTransactions, transactionResponses, publicMintResponse, privateMintResponse,
|
|
9679
|
-
return _regenerator().w(function (
|
|
9680
|
-
while (1) switch (
|
|
10231
|
+
var publicMintEncodedTxs, publicMintSpenders, privateMintEncodedTxs, privateMintSpenders, _iterator5, _step5, req, registrationRequest, isPublicMinting, nftMintFee, encodeTx, isMinterRole, handlePublicMintTransactions, handlePrivateMintTransactions, transactionResponses, publicMintResponse, privateMintResponse, _t19, _t20, _t21, _t22;
|
|
10232
|
+
return _regenerator().w(function (_context16) {
|
|
10233
|
+
while (1) switch (_context16.p = _context16.n) {
|
|
9681
10234
|
case 0:
|
|
9682
|
-
|
|
10235
|
+
_context16.p = 0;
|
|
9683
10236
|
publicMintEncodedTxs = [];
|
|
9684
10237
|
publicMintSpenders = [];
|
|
9685
10238
|
privateMintEncodedTxs = [];
|
|
9686
10239
|
privateMintSpenders = [];
|
|
9687
10240
|
_iterator5 = _createForOfIteratorHelper(request.requests);
|
|
9688
|
-
|
|
10241
|
+
_context16.p = 1;
|
|
9689
10242
|
_iterator5.s();
|
|
9690
10243
|
case 2:
|
|
9691
10244
|
if ((_step5 = _iterator5.n()).done) {
|
|
9692
|
-
|
|
10245
|
+
_context16.n = 9;
|
|
9693
10246
|
break;
|
|
9694
10247
|
}
|
|
9695
10248
|
req = _step5.value;
|
|
@@ -9699,14 +10252,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9699
10252
|
ipMetadata: getIpMetadataForWorkflow(req.ipMetadata),
|
|
9700
10253
|
allowDuplicates: req.allowDuplicates || true
|
|
9701
10254
|
};
|
|
9702
|
-
|
|
10255
|
+
_context16.n = 3;
|
|
9703
10256
|
return getPublicMinting(req.spgNftContract, this.rpcClient);
|
|
9704
10257
|
case 3:
|
|
9705
|
-
isPublicMinting =
|
|
9706
|
-
|
|
10258
|
+
isPublicMinting = _context16.v;
|
|
10259
|
+
_context16.n = 4;
|
|
9707
10260
|
return calculateSPGMintFee(new SpgnftImplReadOnlyClient(this.rpcClient, registrationRequest.spgNftContract));
|
|
9708
10261
|
case 4:
|
|
9709
|
-
nftMintFee =
|
|
10262
|
+
nftMintFee = _context16.v;
|
|
9710
10263
|
encodeTx = {
|
|
9711
10264
|
to: this.registrationWorkflowsClient.address,
|
|
9712
10265
|
data: encodeFunctionData({
|
|
@@ -9716,22 +10269,22 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9716
10269
|
})
|
|
9717
10270
|
};
|
|
9718
10271
|
if (!isPublicMinting) {
|
|
9719
|
-
|
|
10272
|
+
_context16.n = 5;
|
|
9720
10273
|
break;
|
|
9721
10274
|
}
|
|
9722
10275
|
publicMintSpenders = mergeSpenders(publicMintSpenders, nftMintFee ? [_objectSpread2({
|
|
9723
10276
|
address: registrationRequest.spgNftContract
|
|
9724
10277
|
}, nftMintFee)] : []);
|
|
9725
10278
|
publicMintEncodedTxs.push(encodeTx);
|
|
9726
|
-
|
|
10279
|
+
_context16.n = 8;
|
|
9727
10280
|
break;
|
|
9728
10281
|
case 5:
|
|
9729
|
-
|
|
10282
|
+
_context16.n = 6;
|
|
9730
10283
|
return hasMinterRole(registrationRequest.spgNftContract, this.rpcClient, this.walletAddress);
|
|
9731
10284
|
case 6:
|
|
9732
|
-
isMinterRole =
|
|
10285
|
+
isMinterRole = _context16.v;
|
|
9733
10286
|
if (isMinterRole) {
|
|
9734
|
-
|
|
10287
|
+
_context16.n = 7;
|
|
9735
10288
|
break;
|
|
9736
10289
|
}
|
|
9737
10290
|
throw new Error("Caller ".concat(this.walletAddress, " does not have the minter role for ").concat(registrationRequest.spgNftContract));
|
|
@@ -9741,26 +10294,26 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9741
10294
|
}, nftMintFee)] : []);
|
|
9742
10295
|
privateMintEncodedTxs.push(encodeTx);
|
|
9743
10296
|
case 8:
|
|
9744
|
-
|
|
10297
|
+
_context16.n = 2;
|
|
9745
10298
|
break;
|
|
9746
10299
|
case 9:
|
|
9747
|
-
|
|
10300
|
+
_context16.n = 11;
|
|
9748
10301
|
break;
|
|
9749
10302
|
case 10:
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
_iterator5.e(
|
|
10303
|
+
_context16.p = 10;
|
|
10304
|
+
_t19 = _context16.v;
|
|
10305
|
+
_iterator5.e(_t19);
|
|
9753
10306
|
case 11:
|
|
9754
|
-
|
|
10307
|
+
_context16.p = 11;
|
|
9755
10308
|
_iterator5.f();
|
|
9756
|
-
return
|
|
10309
|
+
return _context16.f(11);
|
|
9757
10310
|
case 12:
|
|
9758
10311
|
handlePublicMintTransactions = /*#__PURE__*/function () {
|
|
9759
|
-
var
|
|
9760
|
-
return _regenerator().w(function (
|
|
9761
|
-
while (1) switch (
|
|
10312
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
10313
|
+
return _regenerator().w(function (_context14) {
|
|
10314
|
+
while (1) switch (_context14.n) {
|
|
9762
10315
|
case 0:
|
|
9763
|
-
|
|
10316
|
+
_context14.n = 1;
|
|
9764
10317
|
return contractCallWithFees({
|
|
9765
10318
|
options: {
|
|
9766
10319
|
wipOptions: request.wipOptions,
|
|
@@ -9782,20 +10335,20 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9782
10335
|
encodedTxs: publicMintEncodedTxs
|
|
9783
10336
|
});
|
|
9784
10337
|
case 1:
|
|
9785
|
-
return
|
|
10338
|
+
return _context14.a(2, _context14.v);
|
|
9786
10339
|
}
|
|
9787
|
-
},
|
|
10340
|
+
}, _callee13);
|
|
9788
10341
|
}));
|
|
9789
10342
|
return function handlePublicMintTransactions() {
|
|
9790
|
-
return
|
|
10343
|
+
return _ref3.apply(this, arguments);
|
|
9791
10344
|
};
|
|
9792
10345
|
}();
|
|
9793
10346
|
handlePrivateMintTransactions = /*#__PURE__*/function () {
|
|
9794
|
-
var
|
|
9795
|
-
return _regenerator().w(function (
|
|
9796
|
-
while (1) switch (
|
|
10347
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
10348
|
+
return _regenerator().w(function (_context15) {
|
|
10349
|
+
while (1) switch (_context15.n) {
|
|
9797
10350
|
case 0:
|
|
9798
|
-
|
|
10351
|
+
_context15.n = 1;
|
|
9799
10352
|
return contractCallWithFees({
|
|
9800
10353
|
options: {
|
|
9801
10354
|
wipOptions: _objectSpread2(_objectSpread2({}, request.wipOptions), {}, {
|
|
@@ -9819,50 +10372,50 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9819
10372
|
encodedTxs: privateMintEncodedTxs
|
|
9820
10373
|
});
|
|
9821
10374
|
case 1:
|
|
9822
|
-
return
|
|
10375
|
+
return _context15.a(2, _context15.v);
|
|
9823
10376
|
}
|
|
9824
|
-
},
|
|
10377
|
+
}, _callee14);
|
|
9825
10378
|
}));
|
|
9826
10379
|
return function handlePrivateMintTransactions() {
|
|
9827
|
-
return
|
|
10380
|
+
return _ref4.apply(this, arguments);
|
|
9828
10381
|
};
|
|
9829
10382
|
}();
|
|
9830
10383
|
transactionResponses = [];
|
|
9831
10384
|
if (!(privateMintEncodedTxs.length === 0)) {
|
|
9832
|
-
|
|
10385
|
+
_context16.n = 14;
|
|
9833
10386
|
break;
|
|
9834
10387
|
}
|
|
9835
|
-
|
|
10388
|
+
_context16.n = 13;
|
|
9836
10389
|
return handlePublicMintTransactions();
|
|
9837
10390
|
case 13:
|
|
9838
|
-
|
|
9839
|
-
transactionResponses = [
|
|
9840
|
-
|
|
10391
|
+
_t20 = _context16.v;
|
|
10392
|
+
transactionResponses = [_t20];
|
|
10393
|
+
_context16.n = 19;
|
|
9841
10394
|
break;
|
|
9842
10395
|
case 14:
|
|
9843
10396
|
if (!(publicMintEncodedTxs.length === 0)) {
|
|
9844
|
-
|
|
10397
|
+
_context16.n = 16;
|
|
9845
10398
|
break;
|
|
9846
10399
|
}
|
|
9847
|
-
|
|
10400
|
+
_context16.n = 15;
|
|
9848
10401
|
return handlePrivateMintTransactions();
|
|
9849
10402
|
case 15:
|
|
9850
|
-
|
|
9851
|
-
transactionResponses = [
|
|
9852
|
-
|
|
10403
|
+
_t21 = _context16.v;
|
|
10404
|
+
transactionResponses = [_t21];
|
|
10405
|
+
_context16.n = 19;
|
|
9853
10406
|
break;
|
|
9854
10407
|
case 16:
|
|
9855
|
-
|
|
10408
|
+
_context16.n = 17;
|
|
9856
10409
|
return handlePublicMintTransactions();
|
|
9857
10410
|
case 17:
|
|
9858
|
-
publicMintResponse =
|
|
9859
|
-
|
|
10411
|
+
publicMintResponse = _context16.v;
|
|
10412
|
+
_context16.n = 18;
|
|
9860
10413
|
return handlePrivateMintTransactions();
|
|
9861
10414
|
case 18:
|
|
9862
|
-
privateMintResponse =
|
|
10415
|
+
privateMintResponse = _context16.v;
|
|
9863
10416
|
transactionResponses = [publicMintResponse, privateMintResponse];
|
|
9864
10417
|
case 19:
|
|
9865
|
-
return
|
|
10418
|
+
return _context16.a(2, {
|
|
9866
10419
|
registrationResults: transactionResponses.map(function (r) {
|
|
9867
10420
|
return {
|
|
9868
10421
|
txHash: r.txHash,
|
|
@@ -9872,13 +10425,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9872
10425
|
})
|
|
9873
10426
|
});
|
|
9874
10427
|
case 20:
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
return
|
|
10428
|
+
_context16.p = 20;
|
|
10429
|
+
_t22 = _context16.v;
|
|
10430
|
+
return _context16.a(2, handleError(_t22, "Failed to batch mint and register IP"));
|
|
9878
10431
|
}
|
|
9879
|
-
},
|
|
10432
|
+
}, _callee15, this, [[1, 10, 11, 12], [0, 20]]);
|
|
9880
10433
|
}));
|
|
9881
|
-
function batchMintAndRegisterIp(
|
|
10434
|
+
function batchMintAndRegisterIp(_x14) {
|
|
9882
10435
|
return _batchMintAndRegisterIp.apply(this, arguments);
|
|
9883
10436
|
}
|
|
9884
10437
|
return batchMintAndRegisterIp;
|
|
@@ -9911,18 +10464,18 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9911
10464
|
}, {
|
|
9912
10465
|
key: "mintAndRegisterIpAndMakeDerivativeWithLicenseTokens",
|
|
9913
10466
|
value: (function () {
|
|
9914
|
-
var _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10467
|
+
var _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(request) {
|
|
9915
10468
|
var _this8 = this;
|
|
9916
|
-
var _request$txOptions9, _request$
|
|
9917
|
-
return _regenerator().w(function (
|
|
9918
|
-
while (1) switch (
|
|
10469
|
+
var _request$txOptions9, _request$options3, licenseTokenIds, _object, encodedTxData, contractCall, _t23;
|
|
10470
|
+
return _regenerator().w(function (_context18) {
|
|
10471
|
+
while (1) switch (_context18.p = _context18.n) {
|
|
9919
10472
|
case 0:
|
|
9920
|
-
|
|
9921
|
-
|
|
10473
|
+
_context18.p = 0;
|
|
10474
|
+
_context18.n = 1;
|
|
9922
10475
|
return this.validateLicenseTokenIds(request.licenseTokenIds);
|
|
9923
10476
|
case 1:
|
|
9924
|
-
licenseTokenIds =
|
|
9925
|
-
|
|
10477
|
+
licenseTokenIds = _context18.v;
|
|
10478
|
+
_object = {
|
|
9926
10479
|
spgNftContract: validateAddress(request.spgNftContract),
|
|
9927
10480
|
recipient: validateAddress(request.recipient || this.walletAddress),
|
|
9928
10481
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
|
@@ -9931,54 +10484,54 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9931
10484
|
maxRts: validateMaxRts(request.maxRts),
|
|
9932
10485
|
allowDuplicates: request.allowDuplicates || true
|
|
9933
10486
|
};
|
|
9934
|
-
encodedTxData = this.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokensEncode(
|
|
10487
|
+
encodedTxData = this.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokensEncode(_object);
|
|
9935
10488
|
if (!((_request$txOptions9 = request.txOptions) !== null && _request$txOptions9 !== void 0 && _request$txOptions9.encodedTxDataOnly)) {
|
|
9936
|
-
|
|
10489
|
+
_context18.n = 2;
|
|
9937
10490
|
break;
|
|
9938
10491
|
}
|
|
9939
|
-
return
|
|
10492
|
+
return _context18.a(2, {
|
|
9940
10493
|
encodedTxData: encodedTxData
|
|
9941
10494
|
});
|
|
9942
10495
|
case 2:
|
|
9943
|
-
|
|
10496
|
+
_context18.n = 3;
|
|
9944
10497
|
return this.approveLicenseTokensForDerivativeWorkflows(request.licenseTokenIds, request.autoApproveLicenseTokens);
|
|
9945
10498
|
case 3:
|
|
9946
10499
|
contractCall = /*#__PURE__*/function () {
|
|
9947
|
-
var
|
|
9948
|
-
return _regenerator().w(function (
|
|
9949
|
-
while (1) switch (
|
|
10500
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
10501
|
+
return _regenerator().w(function (_context17) {
|
|
10502
|
+
while (1) switch (_context17.n) {
|
|
9950
10503
|
case 0:
|
|
9951
|
-
return
|
|
10504
|
+
return _context17.a(2, _this8.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_object));
|
|
9952
10505
|
}
|
|
9953
|
-
},
|
|
10506
|
+
}, _callee16);
|
|
9954
10507
|
}));
|
|
9955
10508
|
return function contractCall() {
|
|
9956
|
-
return
|
|
10509
|
+
return _ref5.apply(this, arguments);
|
|
9957
10510
|
};
|
|
9958
10511
|
}();
|
|
9959
|
-
return
|
|
10512
|
+
return _context18.a(2, this.handleRegistrationWithFees({
|
|
9960
10513
|
options: _objectSpread2(_objectSpread2({}, request.options), {}, {
|
|
9961
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$
|
|
10514
|
+
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options3 = request.options) === null || _request$options3 === void 0 ? void 0 : _request$options3.wipOptions), {}, {
|
|
9962
10515
|
// need to disable multicall to avoid needing to transfer the license
|
|
9963
10516
|
// token to the multicall contract.
|
|
9964
10517
|
useMulticallWhenPossible: false
|
|
9965
10518
|
})
|
|
9966
10519
|
}),
|
|
9967
10520
|
sender: this.walletAddress,
|
|
9968
|
-
spgNftContract:
|
|
10521
|
+
spgNftContract: _object.spgNftContract,
|
|
9969
10522
|
spgSpenderAddress: this.derivativeWorkflowsClient.address,
|
|
9970
10523
|
encodedTxs: [encodedTxData],
|
|
9971
10524
|
contractCall: contractCall,
|
|
9972
10525
|
txOptions: request.txOptions
|
|
9973
10526
|
}));
|
|
9974
10527
|
case 4:
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
return
|
|
10528
|
+
_context18.p = 4;
|
|
10529
|
+
_t23 = _context18.v;
|
|
10530
|
+
return _context18.a(2, handleError(_t23, "Failed to mint and register IP and make derivative with license tokens"));
|
|
9978
10531
|
}
|
|
9979
|
-
},
|
|
10532
|
+
}, _callee17, this, [[0, 4]]);
|
|
9980
10533
|
}));
|
|
9981
|
-
function mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(
|
|
10534
|
+
function mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_x15) {
|
|
9982
10535
|
return _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens.apply(this, arguments);
|
|
9983
10536
|
}
|
|
9984
10537
|
return mintAndRegisterIpAndMakeDerivativeWithLicenseTokens;
|
|
@@ -10011,14 +10564,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10011
10564
|
}, {
|
|
10012
10565
|
key: "registerIpAndMakeDerivativeWithLicenseTokens",
|
|
10013
10566
|
value: (function () {
|
|
10014
|
-
var _registerIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10015
|
-
var _request$txOptions0, tokenId, ipIdAddress, isRegistered, licenseTokenIds, calculatedDeadline, signature,
|
|
10016
|
-
return _regenerator().w(function (
|
|
10017
|
-
while (1) switch (
|
|
10567
|
+
var _registerIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(request) {
|
|
10568
|
+
var _request$txOptions0, tokenId, ipIdAddress, isRegistered, licenseTokenIds, calculatedDeadline, signature, _object2, txHash, receipt, log, _t24;
|
|
10569
|
+
return _regenerator().w(function (_context19) {
|
|
10570
|
+
while (1) switch (_context19.p = _context19.n) {
|
|
10018
10571
|
case 0:
|
|
10019
|
-
|
|
10572
|
+
_context19.p = 0;
|
|
10020
10573
|
tokenId = BigInt(request.tokenId);
|
|
10021
|
-
|
|
10574
|
+
_context19.n = 1;
|
|
10022
10575
|
return getIpIdAddress({
|
|
10023
10576
|
nftContract: request.nftContract,
|
|
10024
10577
|
tokenId: tokenId,
|
|
@@ -10027,26 +10580,26 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10027
10580
|
chainId: this.chainId
|
|
10028
10581
|
});
|
|
10029
10582
|
case 1:
|
|
10030
|
-
ipIdAddress =
|
|
10031
|
-
|
|
10583
|
+
ipIdAddress = _context19.v;
|
|
10584
|
+
_context19.n = 2;
|
|
10032
10585
|
return this.isRegistered(ipIdAddress);
|
|
10033
10586
|
case 2:
|
|
10034
|
-
isRegistered =
|
|
10587
|
+
isRegistered = _context19.v;
|
|
10035
10588
|
if (!isRegistered) {
|
|
10036
|
-
|
|
10589
|
+
_context19.n = 3;
|
|
10037
10590
|
break;
|
|
10038
10591
|
}
|
|
10039
10592
|
throw new Error("The NFT with id ".concat(tokenId, " is already registered as IP."));
|
|
10040
10593
|
case 3:
|
|
10041
|
-
|
|
10594
|
+
_context19.n = 4;
|
|
10042
10595
|
return this.validateLicenseTokenIds(request.licenseTokenIds);
|
|
10043
10596
|
case 4:
|
|
10044
|
-
licenseTokenIds =
|
|
10045
|
-
|
|
10597
|
+
licenseTokenIds = _context19.v;
|
|
10598
|
+
_context19.n = 5;
|
|
10046
10599
|
return getCalculatedDeadline(this.rpcClient, request.deadline);
|
|
10047
10600
|
case 5:
|
|
10048
|
-
calculatedDeadline =
|
|
10049
|
-
|
|
10601
|
+
calculatedDeadline = _context19.v;
|
|
10602
|
+
_context19.n = 6;
|
|
10050
10603
|
return generateOperationSignature({
|
|
10051
10604
|
ipIdAddress: ipIdAddress,
|
|
10052
10605
|
methodType: SignatureMethodType.REGISTER_IP_AND_MAKE_DERIVATIVE_WITH_LICENSE_TOKENS,
|
|
@@ -10055,11 +10608,11 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10055
10608
|
chainId: this.chainId
|
|
10056
10609
|
});
|
|
10057
10610
|
case 6:
|
|
10058
|
-
signature =
|
|
10059
|
-
|
|
10611
|
+
signature = _context19.v;
|
|
10612
|
+
_context19.n = 7;
|
|
10060
10613
|
return this.approveLicenseTokensForDerivativeWorkflows(licenseTokenIds, request.autoApproveLicenseTokens);
|
|
10061
10614
|
case 7:
|
|
10062
|
-
|
|
10615
|
+
_object2 = _objectSpread2(_objectSpread2({}, request), {}, {
|
|
10063
10616
|
tokenId: tokenId,
|
|
10064
10617
|
licenseTokenIds: licenseTokenIds,
|
|
10065
10618
|
royaltyContext: zeroAddress,
|
|
@@ -10072,40 +10625,40 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10072
10625
|
maxRts: validateMaxRts(request.maxRts)
|
|
10073
10626
|
});
|
|
10074
10627
|
if (!((_request$txOptions0 = request.txOptions) !== null && _request$txOptions0 !== void 0 && _request$txOptions0.encodedTxDataOnly)) {
|
|
10075
|
-
|
|
10628
|
+
_context19.n = 8;
|
|
10076
10629
|
break;
|
|
10077
10630
|
}
|
|
10078
|
-
return
|
|
10079
|
-
encodedTxData: this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokensEncode(
|
|
10631
|
+
return _context19.a(2, {
|
|
10632
|
+
encodedTxData: this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokensEncode(_object2)
|
|
10080
10633
|
});
|
|
10081
10634
|
case 8:
|
|
10082
|
-
|
|
10083
|
-
return this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokens(
|
|
10635
|
+
_context19.n = 9;
|
|
10636
|
+
return this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokens(_object2);
|
|
10084
10637
|
case 9:
|
|
10085
|
-
txHash =
|
|
10086
|
-
|
|
10638
|
+
txHash = _context19.v;
|
|
10639
|
+
_context19.n = 10;
|
|
10087
10640
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
10088
10641
|
hash: txHash
|
|
10089
10642
|
}));
|
|
10090
10643
|
case 10:
|
|
10091
|
-
receipt =
|
|
10644
|
+
receipt = _context19.v;
|
|
10092
10645
|
log = this.getIpIdAndTokenIdsFromEvent(receipt)[0];
|
|
10093
|
-
return
|
|
10646
|
+
return _context19.a(2, _objectSpread2({
|
|
10094
10647
|
txHash: txHash
|
|
10095
10648
|
}, log));
|
|
10096
10649
|
case 11:
|
|
10097
|
-
|
|
10650
|
+
_context19.n = 13;
|
|
10098
10651
|
break;
|
|
10099
10652
|
case 12:
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
return
|
|
10653
|
+
_context19.p = 12;
|
|
10654
|
+
_t24 = _context19.v;
|
|
10655
|
+
return _context19.a(2, handleError(_t24, "Failed to register IP and make derivative with license tokens"));
|
|
10103
10656
|
case 13:
|
|
10104
|
-
return
|
|
10657
|
+
return _context19.a(2);
|
|
10105
10658
|
}
|
|
10106
|
-
},
|
|
10659
|
+
}, _callee18, this, [[0, 12]]);
|
|
10107
10660
|
}));
|
|
10108
|
-
function registerIpAndMakeDerivativeWithLicenseTokens(
|
|
10661
|
+
function registerIpAndMakeDerivativeWithLicenseTokens(_x16) {
|
|
10109
10662
|
return _registerIpAndMakeDerivativeWithLicenseTokens.apply(this, arguments);
|
|
10110
10663
|
}
|
|
10111
10664
|
return registerIpAndMakeDerivativeWithLicenseTokens;
|
|
@@ -10142,23 +10695,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10142
10695
|
}, {
|
|
10143
10696
|
key: "registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens",
|
|
10144
10697
|
value: (function () {
|
|
10145
|
-
var _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10146
|
-
var _getRoyaltyShares, royaltyShares, totalAmount, _yield$validateLicens2, licenseTerms, calculatedDeadline, ipIdAddress, isRegistered, _yield$transformRegis5, _transformRequest4, registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash, txReceipt, ipId, licenseTermsIds, ipRoyaltyVault, distributeRoyaltyTokensTxHash, maxLicenseTokensTxHashes,
|
|
10147
|
-
return _regenerator().w(function (
|
|
10148
|
-
while (1) switch (
|
|
10698
|
+
var _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(request) {
|
|
10699
|
+
var _getRoyaltyShares, royaltyShares, totalAmount, _yield$validateLicens2, licenseTerms, calculatedDeadline, ipIdAddress, isRegistered, _yield$transformRegis5, _transformRequest4, registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash, txReceipt, ipId, licenseTermsIds, ipRoyaltyVault, distributeRoyaltyTokensTxHash, maxLicenseTokensTxHashes, _t25;
|
|
10700
|
+
return _regenerator().w(function (_context20) {
|
|
10701
|
+
while (1) switch (_context20.p = _context20.n) {
|
|
10149
10702
|
case 0:
|
|
10150
|
-
|
|
10703
|
+
_context20.p = 0;
|
|
10151
10704
|
_getRoyaltyShares = getRoyaltyShares(request.royaltyShares), royaltyShares = _getRoyaltyShares.royaltyShares, totalAmount = _getRoyaltyShares.totalAmount;
|
|
10152
|
-
|
|
10705
|
+
_context20.n = 1;
|
|
10153
10706
|
return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
|
|
10154
10707
|
case 1:
|
|
10155
|
-
_yield$validateLicens2 =
|
|
10708
|
+
_yield$validateLicens2 = _context20.v;
|
|
10156
10709
|
licenseTerms = _yield$validateLicens2.licenseTerms;
|
|
10157
|
-
|
|
10710
|
+
_context20.n = 2;
|
|
10158
10711
|
return getCalculatedDeadline(this.rpcClient, request.deadline);
|
|
10159
10712
|
case 2:
|
|
10160
|
-
calculatedDeadline =
|
|
10161
|
-
|
|
10713
|
+
calculatedDeadline = _context20.v;
|
|
10714
|
+
_context20.n = 3;
|
|
10162
10715
|
return getIpIdAddress({
|
|
10163
10716
|
nftContract: validateAddress(request.nftContract),
|
|
10164
10717
|
tokenId: BigInt(request.tokenId),
|
|
@@ -10167,18 +10720,18 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10167
10720
|
chainId: this.chainId
|
|
10168
10721
|
});
|
|
10169
10722
|
case 3:
|
|
10170
|
-
ipIdAddress =
|
|
10171
|
-
|
|
10723
|
+
ipIdAddress = _context20.v;
|
|
10724
|
+
_context20.n = 4;
|
|
10172
10725
|
return this.isRegistered(ipIdAddress);
|
|
10173
10726
|
case 4:
|
|
10174
|
-
isRegistered =
|
|
10727
|
+
isRegistered = _context20.v;
|
|
10175
10728
|
if (!isRegistered) {
|
|
10176
|
-
|
|
10729
|
+
_context20.n = 5;
|
|
10177
10730
|
break;
|
|
10178
10731
|
}
|
|
10179
10732
|
throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
|
|
10180
10733
|
case 5:
|
|
10181
|
-
|
|
10734
|
+
_context20.n = 6;
|
|
10182
10735
|
return transformRegistrationRequest({
|
|
10183
10736
|
request: request,
|
|
10184
10737
|
rpcClient: this.rpcClient,
|
|
@@ -10186,25 +10739,25 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10186
10739
|
chainId: this.chainId
|
|
10187
10740
|
});
|
|
10188
10741
|
case 6:
|
|
10189
|
-
_yield$transformRegis5 =
|
|
10742
|
+
_yield$transformRegis5 = _context20.v;
|
|
10190
10743
|
_transformRequest4 = _yield$transformRegis5.transformRequest;
|
|
10191
|
-
|
|
10744
|
+
_context20.n = 7;
|
|
10192
10745
|
return this.royaltyTokenDistributionWorkflowsClient.registerIpAndAttachPilTermsAndDeployRoyaltyVault(_transformRequest4);
|
|
10193
10746
|
case 7:
|
|
10194
|
-
registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash =
|
|
10195
|
-
|
|
10747
|
+
registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash = _context20.v;
|
|
10748
|
+
_context20.n = 8;
|
|
10196
10749
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
10197
10750
|
hash: registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash
|
|
10198
10751
|
}));
|
|
10199
10752
|
case 8:
|
|
10200
|
-
txReceipt =
|
|
10753
|
+
txReceipt = _context20.v;
|
|
10201
10754
|
ipId = this.getIpIdAndTokenIdsFromEvent(txReceipt)[0].ipId;
|
|
10202
|
-
|
|
10755
|
+
_context20.n = 9;
|
|
10203
10756
|
return this.getLicenseTermsId(licenseTerms);
|
|
10204
10757
|
case 9:
|
|
10205
|
-
licenseTermsIds =
|
|
10758
|
+
licenseTermsIds = _context20.v;
|
|
10206
10759
|
ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(txReceipt)[0].ipRoyaltyVault;
|
|
10207
|
-
|
|
10760
|
+
_context20.n = 10;
|
|
10208
10761
|
return this.distributeRoyaltyTokens({
|
|
10209
10762
|
ipId: ipId,
|
|
10210
10763
|
deadline: calculatedDeadline,
|
|
@@ -10214,13 +10767,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10214
10767
|
txOptions: request.txOptions
|
|
10215
10768
|
});
|
|
10216
10769
|
case 10:
|
|
10217
|
-
distributeRoyaltyTokensTxHash =
|
|
10218
|
-
|
|
10770
|
+
distributeRoyaltyTokensTxHash = _context20.v;
|
|
10771
|
+
_context20.n = 11;
|
|
10219
10772
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
10220
10773
|
hash: distributeRoyaltyTokensTxHash
|
|
10221
10774
|
}));
|
|
10222
10775
|
case 11:
|
|
10223
|
-
|
|
10776
|
+
_context20.n = 12;
|
|
10224
10777
|
return setMaxLicenseTokens({
|
|
10225
10778
|
maxLicenseTokensData: request.licenseTermsData,
|
|
10226
10779
|
licensorIpId: ipId,
|
|
@@ -10229,8 +10782,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10229
10782
|
templateAddress: this.licenseTemplateAddress
|
|
10230
10783
|
});
|
|
10231
10784
|
case 12:
|
|
10232
|
-
maxLicenseTokensTxHashes =
|
|
10233
|
-
return
|
|
10785
|
+
maxLicenseTokensTxHashes = _context20.v;
|
|
10786
|
+
return _context20.a(2, _objectSpread2({
|
|
10234
10787
|
registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash: registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash,
|
|
10235
10788
|
distributeRoyaltyTokensTxHash: distributeRoyaltyTokensTxHash,
|
|
10236
10789
|
ipId: ipId,
|
|
@@ -10240,13 +10793,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10240
10793
|
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
|
10241
10794
|
}));
|
|
10242
10795
|
case 13:
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
return
|
|
10796
|
+
_context20.p = 13;
|
|
10797
|
+
_t25 = _context20.v;
|
|
10798
|
+
return _context20.a(2, handleError(_t25, "Failed to register IP and attach license terms and distribute royalty tokens"));
|
|
10246
10799
|
}
|
|
10247
|
-
},
|
|
10800
|
+
}, _callee19, this, [[0, 13]]);
|
|
10248
10801
|
}));
|
|
10249
|
-
function registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(
|
|
10802
|
+
function registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x17) {
|
|
10250
10803
|
return _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens.apply(this, arguments);
|
|
10251
10804
|
}
|
|
10252
10805
|
return registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens;
|
|
@@ -10282,14 +10835,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10282
10835
|
}, {
|
|
10283
10836
|
key: "registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens",
|
|
10284
10837
|
value: (function () {
|
|
10285
|
-
var _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10838
|
+
var _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(request) {
|
|
10286
10839
|
var _this9 = this;
|
|
10287
|
-
var _request$
|
|
10288
|
-
return _regenerator().w(function (
|
|
10289
|
-
while (1) switch (
|
|
10840
|
+
var _request$options4, ipIdAddress, _yield$transformRegis6, _transformRequest5, _getRoyaltyShares2, royaltyShares, totalAmount, isRegistered, encodedTxData, contractCall, _yield$this$handleReg, txHash, ipId, tokenId, receipt, ipRoyaltyVault, distributeRoyaltyTokensTxHash, _t26;
|
|
10841
|
+
return _regenerator().w(function (_context21) {
|
|
10842
|
+
while (1) switch (_context21.p = _context21.n) {
|
|
10290
10843
|
case 0:
|
|
10291
|
-
|
|
10292
|
-
|
|
10844
|
+
_context21.p = 0;
|
|
10845
|
+
_context21.n = 1;
|
|
10293
10846
|
return getIpIdAddress({
|
|
10294
10847
|
nftContract: validateAddress(request.nftContract),
|
|
10295
10848
|
tokenId: BigInt(request.tokenId),
|
|
@@ -10298,8 +10851,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10298
10851
|
chainId: this.chainId
|
|
10299
10852
|
});
|
|
10300
10853
|
case 1:
|
|
10301
|
-
ipIdAddress =
|
|
10302
|
-
|
|
10854
|
+
ipIdAddress = _context21.v;
|
|
10855
|
+
_context21.n = 2;
|
|
10303
10856
|
return transformRegistrationRequest({
|
|
10304
10857
|
request: request,
|
|
10305
10858
|
rpcClient: this.rpcClient,
|
|
@@ -10307,15 +10860,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10307
10860
|
chainId: this.chainId
|
|
10308
10861
|
});
|
|
10309
10862
|
case 2:
|
|
10310
|
-
_yield$transformRegis6 =
|
|
10863
|
+
_yield$transformRegis6 = _context21.v;
|
|
10311
10864
|
_transformRequest5 = _yield$transformRegis6.transformRequest;
|
|
10312
10865
|
_getRoyaltyShares2 = getRoyaltyShares(request.royaltyShares), royaltyShares = _getRoyaltyShares2.royaltyShares, totalAmount = _getRoyaltyShares2.totalAmount;
|
|
10313
|
-
|
|
10866
|
+
_context21.n = 3;
|
|
10314
10867
|
return this.isRegistered(ipIdAddress);
|
|
10315
10868
|
case 3:
|
|
10316
|
-
isRegistered =
|
|
10869
|
+
isRegistered = _context21.v;
|
|
10317
10870
|
if (!isRegistered) {
|
|
10318
|
-
|
|
10871
|
+
_context21.n = 4;
|
|
10319
10872
|
break;
|
|
10320
10873
|
}
|
|
10321
10874
|
throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
|
|
@@ -10324,10 +10877,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10324
10877
|
contractCall = function contractCall() {
|
|
10325
10878
|
return _this9.royaltyTokenDistributionWorkflowsClient.registerIpAndMakeDerivativeAndDeployRoyaltyVault(_transformRequest5);
|
|
10326
10879
|
};
|
|
10327
|
-
|
|
10880
|
+
_context21.n = 5;
|
|
10328
10881
|
return this.handleRegistrationWithFees({
|
|
10329
10882
|
options: _objectSpread2(_objectSpread2({}, request.options), {}, {
|
|
10330
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$
|
|
10883
|
+
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options4 = request.options) === null || _request$options4 === void 0 ? void 0 : _request$options4.wipOptions), {}, {
|
|
10331
10884
|
useMulticallWhenPossible: false
|
|
10332
10885
|
})
|
|
10333
10886
|
}),
|
|
@@ -10339,13 +10892,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10339
10892
|
txOptions: _objectSpread2({}, request.txOptions)
|
|
10340
10893
|
});
|
|
10341
10894
|
case 5:
|
|
10342
|
-
_yield$this$handleReg =
|
|
10895
|
+
_yield$this$handleReg = _context21.v;
|
|
10343
10896
|
txHash = _yield$this$handleReg.txHash;
|
|
10344
10897
|
ipId = _yield$this$handleReg.ipId;
|
|
10345
10898
|
tokenId = _yield$this$handleReg.tokenId;
|
|
10346
10899
|
receipt = _yield$this$handleReg.receipt;
|
|
10347
10900
|
if (!(tokenId === undefined || !ipId || !receipt)) {
|
|
10348
|
-
|
|
10901
|
+
_context21.n = 6;
|
|
10349
10902
|
break;
|
|
10350
10903
|
}
|
|
10351
10904
|
throw new Error("Failed to register derivative ip and deploy royalty vault.");
|
|
@@ -10353,7 +10906,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10353
10906
|
ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt).filter(function (item) {
|
|
10354
10907
|
return item.ipId === ipId;
|
|
10355
10908
|
})[0].ipRoyaltyVault;
|
|
10356
|
-
|
|
10909
|
+
_context21.n = 7;
|
|
10357
10910
|
return this.distributeRoyaltyTokens({
|
|
10358
10911
|
ipId: ipId,
|
|
10359
10912
|
deadline: request.deadline,
|
|
@@ -10363,13 +10916,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10363
10916
|
txOptions: request.txOptions
|
|
10364
10917
|
});
|
|
10365
10918
|
case 7:
|
|
10366
|
-
distributeRoyaltyTokensTxHash =
|
|
10367
|
-
|
|
10919
|
+
distributeRoyaltyTokensTxHash = _context21.v;
|
|
10920
|
+
_context21.n = 8;
|
|
10368
10921
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
10369
10922
|
hash: distributeRoyaltyTokensTxHash
|
|
10370
10923
|
}));
|
|
10371
10924
|
case 8:
|
|
10372
|
-
return
|
|
10925
|
+
return _context21.a(2, {
|
|
10373
10926
|
registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokensTxHash: txHash,
|
|
10374
10927
|
distributeRoyaltyTokensTxHash: distributeRoyaltyTokensTxHash,
|
|
10375
10928
|
ipId: ipId,
|
|
@@ -10377,13 +10930,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10377
10930
|
ipRoyaltyVault: ipRoyaltyVault
|
|
10378
10931
|
});
|
|
10379
10932
|
case 9:
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
return
|
|
10933
|
+
_context21.p = 9;
|
|
10934
|
+
_t26 = _context21.v;
|
|
10935
|
+
return _context21.a(2, handleError(_t26, "Failed to register derivative IP and attach license terms and distribute royalty tokens"));
|
|
10383
10936
|
}
|
|
10384
|
-
},
|
|
10937
|
+
}, _callee20, this, [[0, 9]]);
|
|
10385
10938
|
}));
|
|
10386
|
-
function registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(
|
|
10939
|
+
function registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x18) {
|
|
10387
10940
|
return _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens.apply(this, arguments);
|
|
10388
10941
|
}
|
|
10389
10942
|
return registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens;
|
|
@@ -10417,19 +10970,19 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10417
10970
|
}, {
|
|
10418
10971
|
key: "mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens",
|
|
10419
10972
|
value: (function () {
|
|
10420
|
-
var _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10973
|
+
var _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(request) {
|
|
10421
10974
|
var _this0 = this;
|
|
10422
|
-
var _request$
|
|
10423
|
-
return _regenerator().w(function (
|
|
10424
|
-
while (1) switch (
|
|
10975
|
+
var _request$options5, _yield$validateLicens3, licenseTerms, _yield$transformRegis7, _transformRequest6, encodedTxData, contractCall, _yield$this$handleReg2, txHash, ipId, tokenId, receipt, licenseTermsIds, ipRoyaltyVault, maxLicenseTokensTxHashes, _t27;
|
|
10976
|
+
return _regenerator().w(function (_context22) {
|
|
10977
|
+
while (1) switch (_context22.p = _context22.n) {
|
|
10425
10978
|
case 0:
|
|
10426
|
-
|
|
10427
|
-
|
|
10979
|
+
_context22.p = 0;
|
|
10980
|
+
_context22.n = 1;
|
|
10428
10981
|
return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
|
|
10429
10982
|
case 1:
|
|
10430
|
-
_yield$validateLicens3 =
|
|
10983
|
+
_yield$validateLicens3 = _context22.v;
|
|
10431
10984
|
licenseTerms = _yield$validateLicens3.licenseTerms;
|
|
10432
|
-
|
|
10985
|
+
_context22.n = 2;
|
|
10433
10986
|
return transformRegistrationRequest({
|
|
10434
10987
|
request: request,
|
|
10435
10988
|
rpcClient: this.rpcClient,
|
|
@@ -10437,16 +10990,16 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10437
10990
|
chainId: this.chainId
|
|
10438
10991
|
});
|
|
10439
10992
|
case 2:
|
|
10440
|
-
_yield$transformRegis7 =
|
|
10993
|
+
_yield$transformRegis7 = _context22.v;
|
|
10441
10994
|
_transformRequest6 = _yield$transformRegis7.transformRequest;
|
|
10442
10995
|
encodedTxData = this.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokensEncode(_transformRequest6);
|
|
10443
10996
|
contractCall = function contractCall() {
|
|
10444
10997
|
return _this0.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_transformRequest6);
|
|
10445
10998
|
};
|
|
10446
|
-
|
|
10999
|
+
_context22.n = 3;
|
|
10447
11000
|
return this.handleRegistrationWithFees({
|
|
10448
11001
|
options: _objectSpread2(_objectSpread2({}, request.options), {}, {
|
|
10449
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$
|
|
11002
|
+
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options5 = request.options) === null || _request$options5 === void 0 ? void 0 : _request$options5.wipOptions), {}, {
|
|
10450
11003
|
useMulticallWhenPossible: false
|
|
10451
11004
|
})
|
|
10452
11005
|
}),
|
|
@@ -10458,25 +11011,25 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10458
11011
|
txOptions: request.txOptions
|
|
10459
11012
|
});
|
|
10460
11013
|
case 3:
|
|
10461
|
-
_yield$this$handleReg2 =
|
|
11014
|
+
_yield$this$handleReg2 = _context22.v;
|
|
10462
11015
|
txHash = _yield$this$handleReg2.txHash;
|
|
10463
11016
|
ipId = _yield$this$handleReg2.ipId;
|
|
10464
11017
|
tokenId = _yield$this$handleReg2.tokenId;
|
|
10465
11018
|
receipt = _yield$this$handleReg2.receipt;
|
|
10466
11019
|
if (receipt) {
|
|
10467
|
-
|
|
11020
|
+
_context22.n = 4;
|
|
10468
11021
|
break;
|
|
10469
11022
|
}
|
|
10470
|
-
return
|
|
11023
|
+
return _context22.a(2, {
|
|
10471
11024
|
txHash: txHash
|
|
10472
11025
|
});
|
|
10473
11026
|
case 4:
|
|
10474
|
-
|
|
11027
|
+
_context22.n = 5;
|
|
10475
11028
|
return this.getLicenseTermsId(licenseTerms);
|
|
10476
11029
|
case 5:
|
|
10477
|
-
licenseTermsIds =
|
|
11030
|
+
licenseTermsIds = _context22.v;
|
|
10478
11031
|
ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt)[0].ipRoyaltyVault;
|
|
10479
|
-
|
|
11032
|
+
_context22.n = 6;
|
|
10480
11033
|
return setMaxLicenseTokens({
|
|
10481
11034
|
maxLicenseTokensData: request.licenseTermsData,
|
|
10482
11035
|
licensorIpId: ipId,
|
|
@@ -10485,8 +11038,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10485
11038
|
templateAddress: this.licenseTemplateAddress
|
|
10486
11039
|
});
|
|
10487
11040
|
case 6:
|
|
10488
|
-
maxLicenseTokensTxHashes =
|
|
10489
|
-
return
|
|
11041
|
+
maxLicenseTokensTxHashes = _context22.v;
|
|
11042
|
+
return _context22.a(2, _objectSpread2({
|
|
10490
11043
|
txHash: txHash,
|
|
10491
11044
|
ipId: ipId,
|
|
10492
11045
|
licenseTermsIds: licenseTermsIds,
|
|
@@ -10496,13 +11049,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10496
11049
|
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
|
10497
11050
|
}));
|
|
10498
11051
|
case 7:
|
|
10499
|
-
|
|
10500
|
-
|
|
10501
|
-
return
|
|
11052
|
+
_context22.p = 7;
|
|
11053
|
+
_t27 = _context22.v;
|
|
11054
|
+
return _context22.a(2, handleError(_t27, "Failed to mint and register IP and attach PIL terms and distribute royalty tokens"));
|
|
10502
11055
|
}
|
|
10503
|
-
},
|
|
11056
|
+
}, _callee21, this, [[0, 7]]);
|
|
10504
11057
|
}));
|
|
10505
|
-
function mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(
|
|
11058
|
+
function mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_x19) {
|
|
10506
11059
|
return _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens.apply(this, arguments);
|
|
10507
11060
|
}
|
|
10508
11061
|
return mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens;
|
|
@@ -10536,14 +11089,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10536
11089
|
}, {
|
|
10537
11090
|
key: "mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens",
|
|
10538
11091
|
value: (function () {
|
|
10539
|
-
var _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11092
|
+
var _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(request) {
|
|
10540
11093
|
var _this1 = this;
|
|
10541
|
-
var _yield$transformRegis8, _transformRequest7, encodedTxData, contractCall,
|
|
10542
|
-
return _regenerator().w(function (
|
|
10543
|
-
while (1) switch (
|
|
11094
|
+
var _yield$transformRegis8, _transformRequest7, encodedTxData, contractCall, _t28;
|
|
11095
|
+
return _regenerator().w(function (_context23) {
|
|
11096
|
+
while (1) switch (_context23.p = _context23.n) {
|
|
10544
11097
|
case 0:
|
|
10545
|
-
|
|
10546
|
-
|
|
11098
|
+
_context23.p = 0;
|
|
11099
|
+
_context23.n = 1;
|
|
10547
11100
|
return transformRegistrationRequest({
|
|
10548
11101
|
request: request,
|
|
10549
11102
|
rpcClient: this.rpcClient,
|
|
@@ -10551,13 +11104,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10551
11104
|
chainId: this.chainId
|
|
10552
11105
|
});
|
|
10553
11106
|
case 1:
|
|
10554
|
-
_yield$transformRegis8 =
|
|
11107
|
+
_yield$transformRegis8 = _context23.v;
|
|
10555
11108
|
_transformRequest7 = _yield$transformRegis8.transformRequest;
|
|
10556
11109
|
encodedTxData = this.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokensEncode(_transformRequest7);
|
|
10557
11110
|
contractCall = function contractCall() {
|
|
10558
11111
|
return _this1.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_transformRequest7);
|
|
10559
11112
|
};
|
|
10560
|
-
|
|
11113
|
+
_context23.n = 2;
|
|
10561
11114
|
return this.handleRegistrationWithFees({
|
|
10562
11115
|
spgNftContract: _transformRequest7.spgNftContract,
|
|
10563
11116
|
options: request.options,
|
|
@@ -10569,15 +11122,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10569
11122
|
txOptions: request.txOptions
|
|
10570
11123
|
});
|
|
10571
11124
|
case 2:
|
|
10572
|
-
return
|
|
11125
|
+
return _context23.a(2, _context23.v);
|
|
10573
11126
|
case 3:
|
|
10574
|
-
|
|
10575
|
-
|
|
10576
|
-
return
|
|
11127
|
+
_context23.p = 3;
|
|
11128
|
+
_t28 = _context23.v;
|
|
11129
|
+
return _context23.a(2, handleError(_t28, "Failed to mint and register IP and make derivative and distribute royalty tokens"));
|
|
10577
11130
|
}
|
|
10578
|
-
},
|
|
11131
|
+
}, _callee22, this, [[0, 3]]);
|
|
10579
11132
|
}));
|
|
10580
|
-
function mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(
|
|
11133
|
+
function mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_x20) {
|
|
10581
11134
|
return _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens.apply(this, arguments);
|
|
10582
11135
|
}
|
|
10583
11136
|
return mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens;
|
|
@@ -10585,12 +11138,12 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10585
11138
|
}, {
|
|
10586
11139
|
key: "distributeRoyaltyTokens",
|
|
10587
11140
|
value: function () {
|
|
10588
|
-
var _distributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11141
|
+
var _distributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(request) {
|
|
10589
11142
|
var _yield$transferDistri, transformRequest, txHash;
|
|
10590
|
-
return _regenerator().w(function (
|
|
10591
|
-
while (1) switch (
|
|
11143
|
+
return _regenerator().w(function (_context24) {
|
|
11144
|
+
while (1) switch (_context24.n) {
|
|
10592
11145
|
case 0:
|
|
10593
|
-
|
|
11146
|
+
_context24.n = 1;
|
|
10594
11147
|
return transferDistributeRoyaltyTokensRequest({
|
|
10595
11148
|
request: request,
|
|
10596
11149
|
rpcClient: this.rpcClient,
|
|
@@ -10598,22 +11151,22 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10598
11151
|
chainId: this.chainId
|
|
10599
11152
|
});
|
|
10600
11153
|
case 1:
|
|
10601
|
-
_yield$transferDistri =
|
|
11154
|
+
_yield$transferDistri = _context24.v;
|
|
10602
11155
|
transformRequest = _yield$transferDistri.transformRequest;
|
|
10603
|
-
|
|
11156
|
+
_context24.n = 2;
|
|
10604
11157
|
return this.royaltyTokenDistributionWorkflowsClient.distributeRoyaltyTokens(transformRequest);
|
|
10605
11158
|
case 2:
|
|
10606
|
-
txHash =
|
|
10607
|
-
|
|
11159
|
+
txHash = _context24.v;
|
|
11160
|
+
_context24.n = 3;
|
|
10608
11161
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
10609
11162
|
hash: txHash
|
|
10610
11163
|
}));
|
|
10611
11164
|
case 3:
|
|
10612
|
-
return
|
|
11165
|
+
return _context24.a(2, txHash);
|
|
10613
11166
|
}
|
|
10614
|
-
},
|
|
11167
|
+
}, _callee23, this);
|
|
10615
11168
|
}));
|
|
10616
|
-
function distributeRoyaltyTokens(
|
|
11169
|
+
function distributeRoyaltyTokens(_x21) {
|
|
10617
11170
|
return _distributeRoyaltyTokens.apply(this, arguments);
|
|
10618
11171
|
}
|
|
10619
11172
|
return distributeRoyaltyTokens;
|
|
@@ -10621,20 +11174,20 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10621
11174
|
}, {
|
|
10622
11175
|
key: "isRegistered",
|
|
10623
11176
|
value: function () {
|
|
10624
|
-
var _isRegistered = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10625
|
-
return _regenerator().w(function (
|
|
10626
|
-
while (1) switch (
|
|
11177
|
+
var _isRegistered = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(ipId) {
|
|
11178
|
+
return _regenerator().w(function (_context25) {
|
|
11179
|
+
while (1) switch (_context25.n) {
|
|
10627
11180
|
case 0:
|
|
10628
|
-
|
|
11181
|
+
_context25.n = 1;
|
|
10629
11182
|
return this.ipAssetRegistryClient.isRegistered({
|
|
10630
11183
|
id: validateAddress(ipId)
|
|
10631
11184
|
});
|
|
10632
11185
|
case 1:
|
|
10633
|
-
return
|
|
11186
|
+
return _context25.a(2, _context25.v);
|
|
10634
11187
|
}
|
|
10635
|
-
},
|
|
11188
|
+
}, _callee24, this);
|
|
10636
11189
|
}));
|
|
10637
|
-
function isRegistered(
|
|
11190
|
+
function isRegistered(_x22) {
|
|
10638
11191
|
return _isRegistered.apply(this, arguments);
|
|
10639
11192
|
}
|
|
10640
11193
|
return isRegistered;
|
|
@@ -10680,24 +11233,24 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10680
11233
|
}, {
|
|
10681
11234
|
key: "batchRegisterIpAssetsWithOptimizedWorkflows",
|
|
10682
11235
|
value: (function () {
|
|
10683
|
-
var _batchRegisterIpAssetsWithOptimizedWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10684
|
-
var transferWorkflowRequests, _iterator6, _step6, req, res, royaltyDistributionRequests, _yield$handleMultical, txResponses, aggregateRegistrationRequest, responses, royaltyTokensDistributionRequests, _iterator7, _step7, _step7$value, txHash, receipt, iPRegisteredLog, ipRoyaltyVaultEvent, _yield$prepareRoyalty, requests, ipRoyaltyVaults, distributeRoyaltyTokensTxHashes, _yield$handleMultical2, txResponse, registrationResults,
|
|
10685
|
-
return _regenerator().w(function (
|
|
10686
|
-
while (1) switch (
|
|
11236
|
+
var _batchRegisterIpAssetsWithOptimizedWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(request) {
|
|
11237
|
+
var transferWorkflowRequests, _iterator6, _step6, req, res, royaltyDistributionRequests, _yield$handleMultical, txResponses, aggregateRegistrationRequest, responses, royaltyTokensDistributionRequests, _iterator7, _step7, _step7$value, txHash, receipt, iPRegisteredLog, ipRoyaltyVaultEvent, _yield$prepareRoyalty, requests, ipRoyaltyVaults, distributeRoyaltyTokensTxHashes, _yield$handleMultical2, txResponse, registrationResults, _t29, _t30, _t31;
|
|
11238
|
+
return _regenerator().w(function (_context26) {
|
|
11239
|
+
while (1) switch (_context26.p = _context26.n) {
|
|
10687
11240
|
case 0:
|
|
10688
|
-
|
|
11241
|
+
_context26.p = 0;
|
|
10689
11242
|
// Transform requests into workflow format
|
|
10690
11243
|
transferWorkflowRequests = [];
|
|
10691
11244
|
_iterator6 = _createForOfIteratorHelper(request.requests);
|
|
10692
|
-
|
|
11245
|
+
_context26.p = 1;
|
|
10693
11246
|
_iterator6.s();
|
|
10694
11247
|
case 2:
|
|
10695
11248
|
if ((_step6 = _iterator6.n()).done) {
|
|
10696
|
-
|
|
11249
|
+
_context26.n = 5;
|
|
10697
11250
|
break;
|
|
10698
11251
|
}
|
|
10699
11252
|
req = _step6.value;
|
|
10700
|
-
|
|
11253
|
+
_context26.n = 3;
|
|
10701
11254
|
return transformRegistrationRequest({
|
|
10702
11255
|
request: req,
|
|
10703
11256
|
rpcClient: this.rpcClient,
|
|
@@ -10705,22 +11258,22 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10705
11258
|
chainId: this.chainId
|
|
10706
11259
|
});
|
|
10707
11260
|
case 3:
|
|
10708
|
-
res =
|
|
11261
|
+
res = _context26.v;
|
|
10709
11262
|
transferWorkflowRequests.push(res);
|
|
10710
11263
|
case 4:
|
|
10711
|
-
|
|
11264
|
+
_context26.n = 2;
|
|
10712
11265
|
break;
|
|
10713
11266
|
case 5:
|
|
10714
|
-
|
|
11267
|
+
_context26.n = 7;
|
|
10715
11268
|
break;
|
|
10716
11269
|
case 6:
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
_iterator6.e(
|
|
11270
|
+
_context26.p = 6;
|
|
11271
|
+
_t29 = _context26.v;
|
|
11272
|
+
_iterator6.e(_t29);
|
|
10720
11273
|
case 7:
|
|
10721
|
-
|
|
11274
|
+
_context26.p = 7;
|
|
10722
11275
|
_iterator6.f();
|
|
10723
|
-
return
|
|
11276
|
+
return _context26.f(7);
|
|
10724
11277
|
case 8:
|
|
10725
11278
|
/**
|
|
10726
11279
|
* Extract royalty distribution requests from workflow responses that contain royalty shares
|
|
@@ -10738,7 +11291,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10738
11291
|
deadline: res.extraData.deadline
|
|
10739
11292
|
};
|
|
10740
11293
|
}); // Process initial registration transactions
|
|
10741
|
-
|
|
11294
|
+
_context26.n = 9;
|
|
10742
11295
|
return handleMulticall({
|
|
10743
11296
|
transferWorkflowRequests: transferWorkflowRequests,
|
|
10744
11297
|
multicall3Address: this.multicall3Client.address,
|
|
@@ -10749,23 +11302,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10749
11302
|
chainId: this.chainId
|
|
10750
11303
|
});
|
|
10751
11304
|
case 9:
|
|
10752
|
-
_yield$handleMultical =
|
|
11305
|
+
_yield$handleMultical = _context26.v;
|
|
10753
11306
|
txResponses = _yield$handleMultical.response;
|
|
10754
11307
|
aggregateRegistrationRequest = _yield$handleMultical.aggregateRegistrationRequest;
|
|
10755
11308
|
responses = [];
|
|
10756
11309
|
royaltyTokensDistributionRequests = []; // Process each transaction response
|
|
10757
11310
|
_iterator7 = _createForOfIteratorHelper(txResponses);
|
|
10758
|
-
|
|
11311
|
+
_context26.p = 10;
|
|
10759
11312
|
_iterator7.s();
|
|
10760
11313
|
case 11:
|
|
10761
11314
|
if ((_step7 = _iterator7.n()).done) {
|
|
10762
|
-
|
|
11315
|
+
_context26.n = 14;
|
|
10763
11316
|
break;
|
|
10764
11317
|
}
|
|
10765
11318
|
_step7$value = _step7.value, txHash = _step7$value.txHash, receipt = _step7$value.receipt;
|
|
10766
11319
|
iPRegisteredLog = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(receipt);
|
|
10767
11320
|
ipRoyaltyVaultEvent = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt); // Prepare royalty distribution if needed
|
|
10768
|
-
|
|
11321
|
+
_context26.n = 12;
|
|
10769
11322
|
return prepareRoyaltyTokensDistributionRequests({
|
|
10770
11323
|
royaltyDistributionRequests: royaltyDistributionRequests,
|
|
10771
11324
|
ipRegisteredLog: iPRegisteredLog,
|
|
@@ -10775,7 +11328,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10775
11328
|
chainId: this.chainId
|
|
10776
11329
|
});
|
|
10777
11330
|
case 12:
|
|
10778
|
-
_yield$prepareRoyalty =
|
|
11331
|
+
_yield$prepareRoyalty = _context26.v;
|
|
10779
11332
|
requests = _yield$prepareRoyalty.requests;
|
|
10780
11333
|
ipRoyaltyVaults = _yield$prepareRoyalty.ipRoyaltyVaults;
|
|
10781
11334
|
royaltyTokensDistributionRequests.push.apply(royaltyTokensDistributionRequests, _toConsumableArray(requests));
|
|
@@ -10791,25 +11344,25 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10791
11344
|
})
|
|
10792
11345
|
});
|
|
10793
11346
|
case 13:
|
|
10794
|
-
|
|
11347
|
+
_context26.n = 11;
|
|
10795
11348
|
break;
|
|
10796
11349
|
case 14:
|
|
10797
|
-
|
|
11350
|
+
_context26.n = 16;
|
|
10798
11351
|
break;
|
|
10799
11352
|
case 15:
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
_iterator7.e(
|
|
11353
|
+
_context26.p = 15;
|
|
11354
|
+
_t30 = _context26.v;
|
|
11355
|
+
_iterator7.e(_t30);
|
|
10803
11356
|
case 16:
|
|
10804
|
-
|
|
11357
|
+
_context26.p = 16;
|
|
10805
11358
|
_iterator7.f();
|
|
10806
|
-
return
|
|
11359
|
+
return _context26.f(16);
|
|
10807
11360
|
case 17:
|
|
10808
11361
|
if (!(royaltyTokensDistributionRequests.length > 0)) {
|
|
10809
|
-
|
|
11362
|
+
_context26.n = 19;
|
|
10810
11363
|
break;
|
|
10811
11364
|
}
|
|
10812
|
-
|
|
11365
|
+
_context26.n = 18;
|
|
10813
11366
|
return handleMulticall({
|
|
10814
11367
|
transferWorkflowRequests: royaltyTokensDistributionRequests,
|
|
10815
11368
|
multicall3Address: this.multicall3Client.address,
|
|
@@ -10820,29 +11373,29 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10820
11373
|
chainId: this.chainId
|
|
10821
11374
|
});
|
|
10822
11375
|
case 18:
|
|
10823
|
-
_yield$handleMultical2 =
|
|
11376
|
+
_yield$handleMultical2 = _context26.v;
|
|
10824
11377
|
txResponse = _yield$handleMultical2.response;
|
|
10825
11378
|
distributeRoyaltyTokensTxHashes = txResponse.map(function (tx) {
|
|
10826
11379
|
return tx.txHash;
|
|
10827
11380
|
});
|
|
10828
11381
|
case 19:
|
|
10829
|
-
|
|
11382
|
+
_context26.n = 20;
|
|
10830
11383
|
return this.populateLicenseAndTokenIdsForRegistrationResults(responses, aggregateRegistrationRequest);
|
|
10831
11384
|
case 20:
|
|
10832
|
-
registrationResults =
|
|
10833
|
-
return
|
|
11385
|
+
registrationResults = _context26.v;
|
|
11386
|
+
return _context26.a(2, _objectSpread2({
|
|
10834
11387
|
registrationResults: registrationResults
|
|
10835
11388
|
}, distributeRoyaltyTokensTxHashes && {
|
|
10836
11389
|
distributeRoyaltyTokensTxHashes: distributeRoyaltyTokensTxHashes
|
|
10837
11390
|
}));
|
|
10838
11391
|
case 21:
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
return
|
|
11392
|
+
_context26.p = 21;
|
|
11393
|
+
_t31 = _context26.v;
|
|
11394
|
+
return _context26.a(2, handleError(_t31, "Failed to batch register IP assets with optimized workflows"));
|
|
10842
11395
|
}
|
|
10843
|
-
},
|
|
11396
|
+
}, _callee25, this, [[10, 15, 16, 17], [1, 6, 7, 8], [0, 21]]);
|
|
10844
11397
|
}));
|
|
10845
|
-
function batchRegisterIpAssetsWithOptimizedWorkflows(
|
|
11398
|
+
function batchRegisterIpAssetsWithOptimizedWorkflows(_x23) {
|
|
10846
11399
|
return _batchRegisterIpAssetsWithOptimizedWorkflows.apply(this, arguments);
|
|
10847
11400
|
}
|
|
10848
11401
|
return batchRegisterIpAssetsWithOptimizedWorkflows;
|
|
@@ -10912,51 +11465,51 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10912
11465
|
}, {
|
|
10913
11466
|
key: "registerIpAsset",
|
|
10914
11467
|
value: (function () {
|
|
10915
|
-
var _registerIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10916
|
-
var nft, licenseTermsData, royaltyShares,
|
|
10917
|
-
return _regenerator().w(function (
|
|
10918
|
-
while (1) switch (
|
|
11468
|
+
var _registerIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(request) {
|
|
11469
|
+
var nft, licenseTermsData, royaltyShares, _t32;
|
|
11470
|
+
return _regenerator().w(function (_context27) {
|
|
11471
|
+
while (1) switch (_context27.p = _context27.n) {
|
|
10919
11472
|
case 0:
|
|
10920
|
-
|
|
11473
|
+
_context27.p = 0;
|
|
10921
11474
|
nft = request.nft, licenseTermsData = request.licenseTermsData, royaltyShares = request.royaltyShares; // Validate royalty shares without license terms
|
|
10922
11475
|
if (!(royaltyShares && !licenseTermsData)) {
|
|
10923
|
-
|
|
11476
|
+
_context27.n = 1;
|
|
10924
11477
|
break;
|
|
10925
11478
|
}
|
|
10926
11479
|
throw new Error("License terms data must be provided when royalty shares are specified.");
|
|
10927
11480
|
case 1:
|
|
10928
11481
|
if (!(nft.type === "minted")) {
|
|
10929
|
-
|
|
11482
|
+
_context27.n = 3;
|
|
10930
11483
|
break;
|
|
10931
11484
|
}
|
|
10932
|
-
|
|
11485
|
+
_context27.n = 2;
|
|
10933
11486
|
return this.handleMintedNftRegistration(request);
|
|
10934
11487
|
case 2:
|
|
10935
|
-
return
|
|
11488
|
+
return _context27.a(2, _context27.v);
|
|
10936
11489
|
case 3:
|
|
10937
11490
|
if (!(nft.type === "mint")) {
|
|
10938
|
-
|
|
11491
|
+
_context27.n = 5;
|
|
10939
11492
|
break;
|
|
10940
11493
|
}
|
|
10941
|
-
|
|
11494
|
+
_context27.n = 4;
|
|
10942
11495
|
return this.handleMintNftRegistration(request);
|
|
10943
11496
|
case 4:
|
|
10944
|
-
return
|
|
11497
|
+
return _context27.a(2, _context27.v);
|
|
10945
11498
|
case 5:
|
|
10946
11499
|
throw new Error("Invalid NFT type");
|
|
10947
11500
|
case 6:
|
|
10948
|
-
|
|
11501
|
+
_context27.n = 8;
|
|
10949
11502
|
break;
|
|
10950
11503
|
case 7:
|
|
10951
|
-
|
|
10952
|
-
|
|
10953
|
-
return
|
|
11504
|
+
_context27.p = 7;
|
|
11505
|
+
_t32 = _context27.v;
|
|
11506
|
+
return _context27.a(2, handleError(_t32, "Failed to register IP Asset"));
|
|
10954
11507
|
case 8:
|
|
10955
|
-
return
|
|
11508
|
+
return _context27.a(2);
|
|
10956
11509
|
}
|
|
10957
|
-
},
|
|
11510
|
+
}, _callee26, this, [[0, 7]]);
|
|
10958
11511
|
}));
|
|
10959
|
-
function registerIpAsset(
|
|
11512
|
+
function registerIpAsset(_x24) {
|
|
10960
11513
|
return _registerIpAsset.apply(this, arguments);
|
|
10961
11514
|
}
|
|
10962
11515
|
return registerIpAsset;
|
|
@@ -11025,15 +11578,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11025
11578
|
}, {
|
|
11026
11579
|
key: "registerDerivativeIpAsset",
|
|
11027
11580
|
value: (function () {
|
|
11028
|
-
var _registerDerivativeIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11029
|
-
var nft, licenseTokenIds, royaltyShares, derivData, hasDerivData, hasLicenseTokens,
|
|
11030
|
-
return _regenerator().w(function (
|
|
11031
|
-
while (1) switch (
|
|
11581
|
+
var _registerDerivativeIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(request) {
|
|
11582
|
+
var nft, licenseTokenIds, royaltyShares, derivData, hasDerivData, hasLicenseTokens, _t33;
|
|
11583
|
+
return _regenerator().w(function (_context28) {
|
|
11584
|
+
while (1) switch (_context28.p = _context28.n) {
|
|
11032
11585
|
case 0:
|
|
11033
|
-
|
|
11586
|
+
_context28.p = 0;
|
|
11034
11587
|
nft = request.nft, licenseTokenIds = request.licenseTokenIds, royaltyShares = request.royaltyShares, derivData = request.derivData;
|
|
11035
11588
|
if (!(royaltyShares && !derivData)) {
|
|
11036
|
-
|
|
11589
|
+
_context28.n = 1;
|
|
11037
11590
|
break;
|
|
11038
11591
|
}
|
|
11039
11592
|
throw new Error("derivData must be provided when royaltyShares are provided.");
|
|
@@ -11042,43 +11595,43 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11042
11595
|
hasDerivData = !!derivData;
|
|
11043
11596
|
hasLicenseTokens = !!(licenseTokenIds && licenseTokenIds.length > 0);
|
|
11044
11597
|
if (!(!hasDerivData && !hasLicenseTokens)) {
|
|
11045
|
-
|
|
11598
|
+
_context28.n = 2;
|
|
11046
11599
|
break;
|
|
11047
11600
|
}
|
|
11048
11601
|
throw new Error("Either derivData or licenseTokenIds must be provided.");
|
|
11049
11602
|
case 2:
|
|
11050
11603
|
if (!(nft.type === "minted")) {
|
|
11051
|
-
|
|
11604
|
+
_context28.n = 4;
|
|
11052
11605
|
break;
|
|
11053
11606
|
}
|
|
11054
|
-
|
|
11607
|
+
_context28.n = 3;
|
|
11055
11608
|
return this.handleMintedNftDerivativeRegistration(request);
|
|
11056
11609
|
case 3:
|
|
11057
|
-
return
|
|
11610
|
+
return _context28.a(2, _context28.v);
|
|
11058
11611
|
case 4:
|
|
11059
11612
|
if (!(nft.type === "mint")) {
|
|
11060
|
-
|
|
11613
|
+
_context28.n = 6;
|
|
11061
11614
|
break;
|
|
11062
11615
|
}
|
|
11063
|
-
|
|
11616
|
+
_context28.n = 5;
|
|
11064
11617
|
return this.handleMintNftDerivativeRegistration(request);
|
|
11065
11618
|
case 5:
|
|
11066
|
-
return
|
|
11619
|
+
return _context28.a(2, _context28.v);
|
|
11067
11620
|
case 6:
|
|
11068
11621
|
throw new Error("Invalid NFT type.");
|
|
11069
11622
|
case 7:
|
|
11070
|
-
|
|
11623
|
+
_context28.n = 9;
|
|
11071
11624
|
break;
|
|
11072
11625
|
case 8:
|
|
11073
|
-
|
|
11074
|
-
|
|
11075
|
-
return
|
|
11626
|
+
_context28.p = 8;
|
|
11627
|
+
_t33 = _context28.v;
|
|
11628
|
+
return _context28.a(2, handleError(_t33, "Failed to register derivative IP Asset"));
|
|
11076
11629
|
case 9:
|
|
11077
|
-
return
|
|
11630
|
+
return _context28.a(2);
|
|
11078
11631
|
}
|
|
11079
|
-
},
|
|
11632
|
+
}, _callee27, this, [[0, 8]]);
|
|
11080
11633
|
}));
|
|
11081
|
-
function registerDerivativeIpAsset(
|
|
11634
|
+
function registerDerivativeIpAsset(_x25) {
|
|
11082
11635
|
return _registerDerivativeIpAsset.apply(this, arguments);
|
|
11083
11636
|
}
|
|
11084
11637
|
return registerDerivativeIpAsset;
|
|
@@ -11095,10 +11648,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11095
11648
|
}, {
|
|
11096
11649
|
key: "handleMintedNftDerivativeRegistration",
|
|
11097
11650
|
value: (function () {
|
|
11098
|
-
var _handleMintedNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11651
|
+
var _handleMintedNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(request) {
|
|
11099
11652
|
var nft, royaltyShares, derivData, maxRts, licenseTokenIds, deadline, txOptions, options, ipMetadata, baseParams;
|
|
11100
|
-
return _regenerator().w(function (
|
|
11101
|
-
while (1) switch (
|
|
11653
|
+
return _regenerator().w(function (_context29) {
|
|
11654
|
+
while (1) switch (_context29.n) {
|
|
11102
11655
|
case 0:
|
|
11103
11656
|
nft = request.nft, royaltyShares = request.royaltyShares, derivData = request.derivData, maxRts = request.maxRts, licenseTokenIds = request.licenseTokenIds, deadline = request.deadline, txOptions = request.txOptions, options = request.options, ipMetadata = request.ipMetadata;
|
|
11104
11657
|
baseParams = {
|
|
@@ -11110,31 +11663,31 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11110
11663
|
options: options
|
|
11111
11664
|
};
|
|
11112
11665
|
if (!(royaltyShares && derivData)) {
|
|
11113
|
-
|
|
11666
|
+
_context29.n = 1;
|
|
11114
11667
|
break;
|
|
11115
11668
|
}
|
|
11116
|
-
return
|
|
11669
|
+
return _context29.a(2, this.registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11117
11670
|
royaltyShares: royaltyShares,
|
|
11118
11671
|
derivData: derivData
|
|
11119
11672
|
})));
|
|
11120
11673
|
case 1:
|
|
11121
11674
|
if (!derivData) {
|
|
11122
|
-
|
|
11675
|
+
_context29.n = 2;
|
|
11123
11676
|
break;
|
|
11124
11677
|
}
|
|
11125
|
-
return
|
|
11678
|
+
return _context29.a(2, this.registerDerivativeIp(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11126
11679
|
derivData: derivData
|
|
11127
11680
|
})));
|
|
11128
11681
|
case 2:
|
|
11129
|
-
return
|
|
11682
|
+
return _context29.a(2, this.registerIpAndMakeDerivativeWithLicenseTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11130
11683
|
licenseTokenIds: licenseTokenIds,
|
|
11131
11684
|
maxRts: maxRts,
|
|
11132
11685
|
autoApproveLicenseTokens: request.autoApproveLicenseTokens
|
|
11133
11686
|
})));
|
|
11134
11687
|
}
|
|
11135
|
-
},
|
|
11688
|
+
}, _callee28, this);
|
|
11136
11689
|
}));
|
|
11137
|
-
function handleMintedNftDerivativeRegistration(
|
|
11690
|
+
function handleMintedNftDerivativeRegistration(_x26) {
|
|
11138
11691
|
return _handleMintedNftDerivativeRegistration.apply(this, arguments);
|
|
11139
11692
|
}
|
|
11140
11693
|
return handleMintedNftDerivativeRegistration;
|
|
@@ -11151,10 +11704,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11151
11704
|
}, {
|
|
11152
11705
|
key: "handleMintNftDerivativeRegistration",
|
|
11153
11706
|
value: (function () {
|
|
11154
|
-
var _handleMintNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11707
|
+
var _handleMintNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(request) {
|
|
11155
11708
|
var nft, royaltyShares, derivData, maxRts, licenseTokenIds, txOptions, options, ipMetadata, baseParams;
|
|
11156
|
-
return _regenerator().w(function (
|
|
11157
|
-
while (1) switch (
|
|
11709
|
+
return _regenerator().w(function (_context30) {
|
|
11710
|
+
while (1) switch (_context30.n) {
|
|
11158
11711
|
case 0:
|
|
11159
11712
|
nft = request.nft, royaltyShares = request.royaltyShares, derivData = request.derivData, maxRts = request.maxRts, licenseTokenIds = request.licenseTokenIds, txOptions = request.txOptions, options = request.options, ipMetadata = request.ipMetadata;
|
|
11160
11713
|
baseParams = {
|
|
@@ -11166,31 +11719,31 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11166
11719
|
options: options
|
|
11167
11720
|
};
|
|
11168
11721
|
if (!(royaltyShares && derivData)) {
|
|
11169
|
-
|
|
11722
|
+
_context30.n = 1;
|
|
11170
11723
|
break;
|
|
11171
11724
|
}
|
|
11172
|
-
return
|
|
11725
|
+
return _context30.a(2, this.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11173
11726
|
royaltyShares: royaltyShares,
|
|
11174
11727
|
derivData: derivData
|
|
11175
11728
|
})));
|
|
11176
11729
|
case 1:
|
|
11177
11730
|
if (!derivData) {
|
|
11178
|
-
|
|
11731
|
+
_context30.n = 2;
|
|
11179
11732
|
break;
|
|
11180
11733
|
}
|
|
11181
|
-
return
|
|
11734
|
+
return _context30.a(2, this.mintAndRegisterIpAndMakeDerivative(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11182
11735
|
derivData: derivData
|
|
11183
11736
|
})));
|
|
11184
11737
|
case 2:
|
|
11185
|
-
return
|
|
11738
|
+
return _context30.a(2, this.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11186
11739
|
licenseTokenIds: licenseTokenIds,
|
|
11187
11740
|
maxRts: maxRts,
|
|
11188
11741
|
autoApproveLicenseTokens: request.autoApproveLicenseTokens
|
|
11189
11742
|
})));
|
|
11190
11743
|
}
|
|
11191
|
-
},
|
|
11744
|
+
}, _callee29, this);
|
|
11192
11745
|
}));
|
|
11193
|
-
function handleMintNftDerivativeRegistration(
|
|
11746
|
+
function handleMintNftDerivativeRegistration(_x27) {
|
|
11194
11747
|
return _handleMintNftDerivativeRegistration.apply(this, arguments);
|
|
11195
11748
|
}
|
|
11196
11749
|
return handleMintNftDerivativeRegistration;
|
|
@@ -11228,32 +11781,32 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11228
11781
|
}, {
|
|
11229
11782
|
key: "linkDerivative",
|
|
11230
11783
|
value: (function () {
|
|
11231
|
-
var _linkDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11232
|
-
var
|
|
11233
|
-
return _regenerator().w(function (
|
|
11234
|
-
while (1) switch (
|
|
11784
|
+
var _linkDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30(request) {
|
|
11785
|
+
var _t34;
|
|
11786
|
+
return _regenerator().w(function (_context31) {
|
|
11787
|
+
while (1) switch (_context31.p = _context31.n) {
|
|
11235
11788
|
case 0:
|
|
11236
|
-
|
|
11789
|
+
_context31.p = 0;
|
|
11237
11790
|
if (!("parentIpIds" in request)) {
|
|
11238
|
-
|
|
11791
|
+
_context31.n = 1;
|
|
11239
11792
|
break;
|
|
11240
11793
|
}
|
|
11241
|
-
return
|
|
11794
|
+
return _context31.a(2, this.registerDerivative(request));
|
|
11242
11795
|
case 1:
|
|
11243
|
-
return
|
|
11796
|
+
return _context31.a(2, this.registerDerivativeWithLicenseTokens(request));
|
|
11244
11797
|
case 2:
|
|
11245
|
-
|
|
11798
|
+
_context31.n = 4;
|
|
11246
11799
|
break;
|
|
11247
11800
|
case 3:
|
|
11248
|
-
|
|
11249
|
-
|
|
11250
|
-
return
|
|
11801
|
+
_context31.p = 3;
|
|
11802
|
+
_t34 = _context31.v;
|
|
11803
|
+
return _context31.a(2, handleError(_t34, "Failed to link derivative"));
|
|
11251
11804
|
case 4:
|
|
11252
|
-
return
|
|
11805
|
+
return _context31.a(2);
|
|
11253
11806
|
}
|
|
11254
|
-
},
|
|
11807
|
+
}, _callee30, this, [[0, 3]]);
|
|
11255
11808
|
}));
|
|
11256
|
-
function linkDerivative(
|
|
11809
|
+
function linkDerivative(_x28) {
|
|
11257
11810
|
return _linkDerivative.apply(this, arguments);
|
|
11258
11811
|
}
|
|
11259
11812
|
return linkDerivative;
|
|
@@ -11270,10 +11823,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11270
11823
|
}, {
|
|
11271
11824
|
key: "handleMintedNftRegistration",
|
|
11272
11825
|
value: (function () {
|
|
11273
|
-
var _handleMintedNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11826
|
+
var _handleMintedNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(request) {
|
|
11274
11827
|
var nft, ipMetadata, txOptions, licenseTermsData, royaltyShares, deadline, baseParams;
|
|
11275
|
-
return _regenerator().w(function (
|
|
11276
|
-
while (1) switch (
|
|
11828
|
+
return _regenerator().w(function (_context32) {
|
|
11829
|
+
while (1) switch (_context32.n) {
|
|
11277
11830
|
case 0:
|
|
11278
11831
|
nft = request.nft, ipMetadata = request.ipMetadata, txOptions = request.txOptions, licenseTermsData = request.licenseTermsData, royaltyShares = request.royaltyShares, deadline = request.deadline;
|
|
11279
11832
|
baseParams = {
|
|
@@ -11284,27 +11837,27 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11284
11837
|
txOptions: txOptions
|
|
11285
11838
|
};
|
|
11286
11839
|
if (!(licenseTermsData && royaltyShares)) {
|
|
11287
|
-
|
|
11840
|
+
_context32.n = 1;
|
|
11288
11841
|
break;
|
|
11289
11842
|
}
|
|
11290
|
-
return
|
|
11843
|
+
return _context32.a(2, this.registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11291
11844
|
licenseTermsData: licenseTermsData,
|
|
11292
11845
|
royaltyShares: royaltyShares
|
|
11293
11846
|
})));
|
|
11294
11847
|
case 1:
|
|
11295
11848
|
if (!licenseTermsData) {
|
|
11296
|
-
|
|
11849
|
+
_context32.n = 2;
|
|
11297
11850
|
break;
|
|
11298
11851
|
}
|
|
11299
|
-
return
|
|
11852
|
+
return _context32.a(2, this.registerIpAndAttachPilTerms(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11300
11853
|
licenseTermsData: licenseTermsData
|
|
11301
11854
|
})));
|
|
11302
11855
|
case 2:
|
|
11303
|
-
return
|
|
11856
|
+
return _context32.a(2, this.register(_objectSpread2({}, baseParams)));
|
|
11304
11857
|
}
|
|
11305
|
-
},
|
|
11858
|
+
}, _callee31, this);
|
|
11306
11859
|
}));
|
|
11307
|
-
function handleMintedNftRegistration(
|
|
11860
|
+
function handleMintedNftRegistration(_x29) {
|
|
11308
11861
|
return _handleMintedNftRegistration.apply(this, arguments);
|
|
11309
11862
|
}
|
|
11310
11863
|
return handleMintedNftRegistration;
|
|
@@ -11321,10 +11874,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11321
11874
|
}, {
|
|
11322
11875
|
key: "handleMintNftRegistration",
|
|
11323
11876
|
value: (function () {
|
|
11324
|
-
var _handleMintNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11877
|
+
var _handleMintNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32(request) {
|
|
11325
11878
|
var nft, ipMetadata, txOptions, options, licenseTermsData, royaltyShares, baseParams;
|
|
11326
|
-
return _regenerator().w(function (
|
|
11327
|
-
while (1) switch (
|
|
11879
|
+
return _regenerator().w(function (_context33) {
|
|
11880
|
+
while (1) switch (_context33.n) {
|
|
11328
11881
|
case 0:
|
|
11329
11882
|
nft = request.nft, ipMetadata = request.ipMetadata, txOptions = request.txOptions, options = request.options, licenseTermsData = request.licenseTermsData, royaltyShares = request.royaltyShares;
|
|
11330
11883
|
baseParams = {
|
|
@@ -11336,27 +11889,27 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11336
11889
|
options: options
|
|
11337
11890
|
};
|
|
11338
11891
|
if (!(licenseTermsData && royaltyShares)) {
|
|
11339
|
-
|
|
11892
|
+
_context33.n = 1;
|
|
11340
11893
|
break;
|
|
11341
11894
|
}
|
|
11342
|
-
return
|
|
11895
|
+
return _context33.a(2, this.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11343
11896
|
licenseTermsData: licenseTermsData,
|
|
11344
11897
|
royaltyShares: royaltyShares
|
|
11345
11898
|
})));
|
|
11346
11899
|
case 1:
|
|
11347
11900
|
if (!licenseTermsData) {
|
|
11348
|
-
|
|
11901
|
+
_context33.n = 2;
|
|
11349
11902
|
break;
|
|
11350
11903
|
}
|
|
11351
|
-
return
|
|
11904
|
+
return _context33.a(2, this.mintAndRegisterIpAssetWithPilTerms(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11352
11905
|
licenseTermsData: licenseTermsData
|
|
11353
11906
|
})));
|
|
11354
11907
|
case 2:
|
|
11355
|
-
return
|
|
11908
|
+
return _context33.a(2, this.mintAndRegisterIp(_objectSpread2({}, baseParams)));
|
|
11356
11909
|
}
|
|
11357
|
-
},
|
|
11910
|
+
}, _callee32, this);
|
|
11358
11911
|
}));
|
|
11359
|
-
function handleMintNftRegistration(
|
|
11912
|
+
function handleMintNftRegistration(_x30) {
|
|
11360
11913
|
return _handleMintNftRegistration.apply(this, arguments);
|
|
11361
11914
|
}
|
|
11362
11915
|
return handleMintNftRegistration;
|
|
@@ -11364,48 +11917,48 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11364
11917
|
}, {
|
|
11365
11918
|
key: "getLicenseTermsId",
|
|
11366
11919
|
value: function () {
|
|
11367
|
-
var _getLicenseTermsId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11368
|
-
var licenseTermsIds, _iterator8, _step8, licenseTerm, licenseRes,
|
|
11369
|
-
return _regenerator().w(function (
|
|
11370
|
-
while (1) switch (
|
|
11920
|
+
var _getLicenseTermsId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33(licenseTerms) {
|
|
11921
|
+
var licenseTermsIds, _iterator8, _step8, licenseTerm, licenseRes, _t35;
|
|
11922
|
+
return _regenerator().w(function (_context34) {
|
|
11923
|
+
while (1) switch (_context34.p = _context34.n) {
|
|
11371
11924
|
case 0:
|
|
11372
11925
|
licenseTermsIds = [];
|
|
11373
11926
|
_iterator8 = _createForOfIteratorHelper(licenseTerms);
|
|
11374
|
-
|
|
11927
|
+
_context34.p = 1;
|
|
11375
11928
|
_iterator8.s();
|
|
11376
11929
|
case 2:
|
|
11377
11930
|
if ((_step8 = _iterator8.n()).done) {
|
|
11378
|
-
|
|
11931
|
+
_context34.n = 5;
|
|
11379
11932
|
break;
|
|
11380
11933
|
}
|
|
11381
11934
|
licenseTerm = _step8.value;
|
|
11382
|
-
|
|
11935
|
+
_context34.n = 3;
|
|
11383
11936
|
return this.licenseTemplateClient.getLicenseTermsId({
|
|
11384
11937
|
terms: licenseTerm
|
|
11385
11938
|
});
|
|
11386
11939
|
case 3:
|
|
11387
|
-
licenseRes =
|
|
11940
|
+
licenseRes = _context34.v;
|
|
11388
11941
|
licenseTermsIds.push(licenseRes.selectedLicenseTermsId);
|
|
11389
11942
|
case 4:
|
|
11390
|
-
|
|
11943
|
+
_context34.n = 2;
|
|
11391
11944
|
break;
|
|
11392
11945
|
case 5:
|
|
11393
|
-
|
|
11946
|
+
_context34.n = 7;
|
|
11394
11947
|
break;
|
|
11395
11948
|
case 6:
|
|
11396
|
-
|
|
11397
|
-
|
|
11398
|
-
_iterator8.e(
|
|
11949
|
+
_context34.p = 6;
|
|
11950
|
+
_t35 = _context34.v;
|
|
11951
|
+
_iterator8.e(_t35);
|
|
11399
11952
|
case 7:
|
|
11400
|
-
|
|
11953
|
+
_context34.p = 7;
|
|
11401
11954
|
_iterator8.f();
|
|
11402
|
-
return
|
|
11955
|
+
return _context34.f(7);
|
|
11403
11956
|
case 8:
|
|
11404
|
-
return
|
|
11957
|
+
return _context34.a(2, licenseTermsIds);
|
|
11405
11958
|
}
|
|
11406
|
-
},
|
|
11959
|
+
}, _callee33, this, [[1, 6, 7, 8]]);
|
|
11407
11960
|
}));
|
|
11408
|
-
function getLicenseTermsId(
|
|
11961
|
+
function getLicenseTermsId(_x31) {
|
|
11409
11962
|
return _getLicenseTermsId.apply(this, arguments);
|
|
11410
11963
|
}
|
|
11411
11964
|
return getLicenseTermsId;
|
|
@@ -11413,13 +11966,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11413
11966
|
}, {
|
|
11414
11967
|
key: "validateLicenseTokenIds",
|
|
11415
11968
|
value: function () {
|
|
11416
|
-
var _validateLicenseTokenIds = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11417
|
-
var newLicenseTokenIds, _iterator9, _step9, licenseTokenId, tokenOwnerAddress,
|
|
11418
|
-
return _regenerator().w(function (
|
|
11419
|
-
while (1) switch (
|
|
11969
|
+
var _validateLicenseTokenIds = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(licenseTokenIds) {
|
|
11970
|
+
var newLicenseTokenIds, _iterator9, _step9, licenseTokenId, tokenOwnerAddress, _t36;
|
|
11971
|
+
return _regenerator().w(function (_context35) {
|
|
11972
|
+
while (1) switch (_context35.p = _context35.n) {
|
|
11420
11973
|
case 0:
|
|
11421
11974
|
if (!(licenseTokenIds.length === 0)) {
|
|
11422
|
-
|
|
11975
|
+
_context35.n = 1;
|
|
11423
11976
|
break;
|
|
11424
11977
|
}
|
|
11425
11978
|
throw new Error("License token IDs must be provided.");
|
|
@@ -11428,45 +11981,45 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11428
11981
|
return BigInt(id);
|
|
11429
11982
|
});
|
|
11430
11983
|
_iterator9 = _createForOfIteratorHelper(newLicenseTokenIds);
|
|
11431
|
-
|
|
11984
|
+
_context35.p = 2;
|
|
11432
11985
|
_iterator9.s();
|
|
11433
11986
|
case 3:
|
|
11434
11987
|
if ((_step9 = _iterator9.n()).done) {
|
|
11435
|
-
|
|
11988
|
+
_context35.n = 6;
|
|
11436
11989
|
break;
|
|
11437
11990
|
}
|
|
11438
11991
|
licenseTokenId = _step9.value;
|
|
11439
|
-
|
|
11992
|
+
_context35.n = 4;
|
|
11440
11993
|
return this.licenseTokenReadOnlyClient.ownerOf({
|
|
11441
11994
|
tokenId: licenseTokenId
|
|
11442
11995
|
});
|
|
11443
11996
|
case 4:
|
|
11444
|
-
tokenOwnerAddress =
|
|
11997
|
+
tokenOwnerAddress = _context35.v;
|
|
11445
11998
|
if (tokenOwnerAddress) {
|
|
11446
|
-
|
|
11999
|
+
_context35.n = 5;
|
|
11447
12000
|
break;
|
|
11448
12001
|
}
|
|
11449
12002
|
throw new Error("License token id ".concat(licenseTokenId, " must be owned by the caller."));
|
|
11450
12003
|
case 5:
|
|
11451
|
-
|
|
12004
|
+
_context35.n = 3;
|
|
11452
12005
|
break;
|
|
11453
12006
|
case 6:
|
|
11454
|
-
|
|
12007
|
+
_context35.n = 8;
|
|
11455
12008
|
break;
|
|
11456
12009
|
case 7:
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
_iterator9.e(
|
|
12010
|
+
_context35.p = 7;
|
|
12011
|
+
_t36 = _context35.v;
|
|
12012
|
+
_iterator9.e(_t36);
|
|
11460
12013
|
case 8:
|
|
11461
|
-
|
|
12014
|
+
_context35.p = 8;
|
|
11462
12015
|
_iterator9.f();
|
|
11463
|
-
return
|
|
12016
|
+
return _context35.f(8);
|
|
11464
12017
|
case 9:
|
|
11465
|
-
return
|
|
12018
|
+
return _context35.a(2, newLicenseTokenIds);
|
|
11466
12019
|
}
|
|
11467
|
-
},
|
|
12020
|
+
}, _callee34, this, [[2, 7, 8, 9]]);
|
|
11468
12021
|
}));
|
|
11469
|
-
function validateLicenseTokenIds(
|
|
12022
|
+
function validateLicenseTokenIds(_x32) {
|
|
11470
12023
|
return _validateLicenseTokenIds.apply(this, arguments);
|
|
11471
12024
|
}
|
|
11472
12025
|
return validateLicenseTokenIds;
|
|
@@ -11489,28 +12042,28 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11489
12042
|
}, {
|
|
11490
12043
|
key: "handleRegistrationWithFees",
|
|
11491
12044
|
value: function () {
|
|
11492
|
-
var _handleRegistrationWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
12045
|
+
var _handleRegistrationWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35(_ref6) {
|
|
11493
12046
|
var _wipOptions$useMultic, _this$getIpIdAndToken, _event$ipId, _event$tokenId;
|
|
11494
12047
|
var sender, derivData, spgNftContract, spgSpenderAddress, txOptions, options, encodedTxs, contractCall, tokenSpenders, wipOptions, useMulticallWhenPossible, nftMintFee, publicMinting, mintFees, _iterator0, _step0, mintFee, _yield$contractCallWi, txHash, receipt, event;
|
|
11495
|
-
return _regenerator().w(function (
|
|
11496
|
-
while (1) switch (
|
|
12048
|
+
return _regenerator().w(function (_context36) {
|
|
12049
|
+
while (1) switch (_context36.n) {
|
|
11497
12050
|
case 0:
|
|
11498
|
-
sender =
|
|
12051
|
+
sender = _ref6.sender, derivData = _ref6.derivData, spgNftContract = _ref6.spgNftContract, spgSpenderAddress = _ref6.spgSpenderAddress, txOptions = _ref6.txOptions, options = _ref6.options, encodedTxs = _ref6.encodedTxs, contractCall = _ref6.contractCall;
|
|
11499
12052
|
tokenSpenders = [];
|
|
11500
12053
|
wipOptions = options === null || options === void 0 ? void 0 : options.wipOptions;
|
|
11501
12054
|
useMulticallWhenPossible = (_wipOptions$useMultic = wipOptions === null || wipOptions === void 0 ? void 0 : wipOptions.useMulticallWhenPossible) !== null && _wipOptions$useMultic !== void 0 ? _wipOptions$useMultic : true; // get spg minting fee
|
|
11502
12055
|
if (!spgNftContract) {
|
|
11503
|
-
|
|
12056
|
+
_context36.n = 3;
|
|
11504
12057
|
break;
|
|
11505
12058
|
}
|
|
11506
|
-
|
|
12059
|
+
_context36.n = 1;
|
|
11507
12060
|
return calculateSPGMintFee(new SpgnftImplReadOnlyClient(this.rpcClient, spgNftContract));
|
|
11508
12061
|
case 1:
|
|
11509
|
-
nftMintFee =
|
|
11510
|
-
|
|
12062
|
+
nftMintFee = _context36.v;
|
|
12063
|
+
_context36.n = 2;
|
|
11511
12064
|
return getPublicMinting(spgNftContract, this.rpcClient);
|
|
11512
12065
|
case 2:
|
|
11513
|
-
publicMinting =
|
|
12066
|
+
publicMinting = _context36.v;
|
|
11514
12067
|
/**
|
|
11515
12068
|
* If the SPG NFT contract's public minting is disabled, we need to check if the caller has the `minter role`.
|
|
11516
12069
|
* When public minting is disabled, we can't use multicall because we need to perform additional role checks
|
|
@@ -11527,10 +12080,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11527
12080
|
}, nftMintFee)] : []));
|
|
11528
12081
|
case 3:
|
|
11529
12082
|
if (!derivData) {
|
|
11530
|
-
|
|
12083
|
+
_context36.n = 5;
|
|
11531
12084
|
break;
|
|
11532
12085
|
}
|
|
11533
|
-
|
|
12086
|
+
_context36.n = 4;
|
|
11534
12087
|
return calculateDerivativeMintingFee({
|
|
11535
12088
|
derivData: derivData,
|
|
11536
12089
|
rpcClient: this.rpcClient,
|
|
@@ -11539,7 +12092,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11539
12092
|
sender: sender
|
|
11540
12093
|
});
|
|
11541
12094
|
case 4:
|
|
11542
|
-
mintFees =
|
|
12095
|
+
mintFees = _context36.v;
|
|
11543
12096
|
_iterator0 = _createForOfIteratorHelper(mintFees);
|
|
11544
12097
|
try {
|
|
11545
12098
|
for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
|
|
@@ -11554,7 +12107,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11554
12107
|
_iterator0.f();
|
|
11555
12108
|
}
|
|
11556
12109
|
case 5:
|
|
11557
|
-
|
|
12110
|
+
_context36.n = 6;
|
|
11558
12111
|
return contractCallWithFees({
|
|
11559
12112
|
options: _objectSpread2(_objectSpread2({}, options), {}, {
|
|
11560
12113
|
wipOptions: _objectSpread2(_objectSpread2({}, wipOptions), {}, {
|
|
@@ -11571,11 +12124,11 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11571
12124
|
encodedTxs: encodedTxs
|
|
11572
12125
|
});
|
|
11573
12126
|
case 6:
|
|
11574
|
-
_yield$contractCallWi =
|
|
12127
|
+
_yield$contractCallWi = _context36.v;
|
|
11575
12128
|
txHash = _yield$contractCallWi.txHash;
|
|
11576
12129
|
receipt = _yield$contractCallWi.receipt;
|
|
11577
12130
|
event = (_this$getIpIdAndToken = this.getIpIdAndTokenIdsFromEvent(receipt)) === null || _this$getIpIdAndToken === void 0 ? void 0 : _this$getIpIdAndToken[0];
|
|
11578
|
-
return
|
|
12131
|
+
return _context36.a(2, _objectSpread2({
|
|
11579
12132
|
txHash: txHash,
|
|
11580
12133
|
receipt: receipt
|
|
11581
12134
|
}, event && {
|
|
@@ -11583,9 +12136,9 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11583
12136
|
tokenId: (_event$tokenId = event.tokenId) !== null && _event$tokenId !== void 0 ? _event$tokenId : undefined
|
|
11584
12137
|
}));
|
|
11585
12138
|
}
|
|
11586
|
-
},
|
|
12139
|
+
}, _callee35, this);
|
|
11587
12140
|
}));
|
|
11588
|
-
function handleRegistrationWithFees(
|
|
12141
|
+
function handleRegistrationWithFees(_x33) {
|
|
11589
12142
|
return _handleRegistrationWithFees.apply(this, arguments);
|
|
11590
12143
|
}
|
|
11591
12144
|
return handleRegistrationWithFees;
|
|
@@ -11596,66 +12149,66 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11596
12149
|
}, {
|
|
11597
12150
|
key: "populateLicenseAndTokenIdsForRegistrationResults",
|
|
11598
12151
|
value: (function () {
|
|
11599
|
-
var _populateLicenseAndTokenIdsForRegistrationResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11600
|
-
var allExtraDataArrays, allExtraData, extraDataFlatIndex, _iterator1, _step1, registrationResult, i, ipAsset,
|
|
11601
|
-
return _regenerator().w(function (
|
|
11602
|
-
while (1) switch (
|
|
12152
|
+
var _populateLicenseAndTokenIdsForRegistrationResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36(registrationResults, aggregateRegistrationRequest) {
|
|
12153
|
+
var allExtraDataArrays, allExtraData, extraDataFlatIndex, _iterator1, _step1, registrationResult, i, ipAsset, _t37;
|
|
12154
|
+
return _regenerator().w(function (_context37) {
|
|
12155
|
+
while (1) switch (_context37.p = _context37.n) {
|
|
11603
12156
|
case 0:
|
|
11604
|
-
allExtraDataArrays = Object.values(aggregateRegistrationRequest).map(function (
|
|
11605
|
-
var extraData =
|
|
12157
|
+
allExtraDataArrays = Object.values(aggregateRegistrationRequest).map(function (_ref7) {
|
|
12158
|
+
var extraData = _ref7.extraData;
|
|
11606
12159
|
return extraData;
|
|
11607
12160
|
});
|
|
11608
12161
|
allExtraData = allExtraDataArrays.flat();
|
|
11609
12162
|
extraDataFlatIndex = -1;
|
|
11610
12163
|
_iterator1 = _createForOfIteratorHelper(registrationResults);
|
|
11611
|
-
|
|
12164
|
+
_context37.p = 1;
|
|
11612
12165
|
_iterator1.s();
|
|
11613
12166
|
case 2:
|
|
11614
12167
|
if ((_step1 = _iterator1.n()).done) {
|
|
11615
|
-
|
|
12168
|
+
_context37.n = 7;
|
|
11616
12169
|
break;
|
|
11617
12170
|
}
|
|
11618
12171
|
registrationResult = _step1.value;
|
|
11619
12172
|
i = 0;
|
|
11620
12173
|
case 3:
|
|
11621
12174
|
if (!(i < registrationResult.ipAssetsWithLicenseTerms.length)) {
|
|
11622
|
-
|
|
12175
|
+
_context37.n = 6;
|
|
11623
12176
|
break;
|
|
11624
12177
|
}
|
|
11625
12178
|
extraDataFlatIndex++;
|
|
11626
12179
|
if (!(registrationResult.ipAssetsWithLicenseTerms[i] && allExtraData[extraDataFlatIndex])) {
|
|
11627
|
-
|
|
12180
|
+
_context37.n = 5;
|
|
11628
12181
|
break;
|
|
11629
12182
|
}
|
|
11630
|
-
|
|
12183
|
+
_context37.n = 4;
|
|
11631
12184
|
return this.processIpAssetLicenseTerms(registrationResult.ipAssetsWithLicenseTerms[i], allExtraData[extraDataFlatIndex]);
|
|
11632
12185
|
case 4:
|
|
11633
|
-
ipAsset =
|
|
12186
|
+
ipAsset = _context37.v;
|
|
11634
12187
|
registrationResult.ipAssetsWithLicenseTerms[i] = ipAsset;
|
|
11635
12188
|
case 5:
|
|
11636
12189
|
i++;
|
|
11637
|
-
|
|
12190
|
+
_context37.n = 3;
|
|
11638
12191
|
break;
|
|
11639
12192
|
case 6:
|
|
11640
|
-
|
|
12193
|
+
_context37.n = 2;
|
|
11641
12194
|
break;
|
|
11642
12195
|
case 7:
|
|
11643
|
-
|
|
12196
|
+
_context37.n = 9;
|
|
11644
12197
|
break;
|
|
11645
12198
|
case 8:
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
_iterator1.e(
|
|
12199
|
+
_context37.p = 8;
|
|
12200
|
+
_t37 = _context37.v;
|
|
12201
|
+
_iterator1.e(_t37);
|
|
11649
12202
|
case 9:
|
|
11650
|
-
|
|
12203
|
+
_context37.p = 9;
|
|
11651
12204
|
_iterator1.f();
|
|
11652
|
-
return
|
|
12205
|
+
return _context37.f(9);
|
|
11653
12206
|
case 10:
|
|
11654
|
-
return
|
|
12207
|
+
return _context37.a(2, registrationResults);
|
|
11655
12208
|
}
|
|
11656
|
-
},
|
|
12209
|
+
}, _callee36, this, [[1, 8, 9, 10]]);
|
|
11657
12210
|
}));
|
|
11658
|
-
function populateLicenseAndTokenIdsForRegistrationResults(
|
|
12211
|
+
function populateLicenseAndTokenIdsForRegistrationResults(_x34, _x35) {
|
|
11659
12212
|
return _populateLicenseAndTokenIdsForRegistrationResults.apply(this, arguments);
|
|
11660
12213
|
}
|
|
11661
12214
|
return populateLicenseAndTokenIdsForRegistrationResults;
|
|
@@ -11663,31 +12216,31 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11663
12216
|
}, {
|
|
11664
12217
|
key: "processIpAssetLicenseTerms",
|
|
11665
12218
|
value: function () {
|
|
11666
|
-
var _processIpAssetLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
12219
|
+
var _processIpAssetLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37(ipAsset, extraData) {
|
|
11667
12220
|
var _extraData$licenseTer;
|
|
11668
12221
|
var licenseTermsIds, maxLicenseTokens, maxLicenseTokensData, maxLicenseTokensTxHashes;
|
|
11669
|
-
return _regenerator().w(function (
|
|
11670
|
-
while (1) switch (
|
|
12222
|
+
return _regenerator().w(function (_context38) {
|
|
12223
|
+
while (1) switch (_context38.n) {
|
|
11671
12224
|
case 0:
|
|
11672
12225
|
if (extraData !== null && extraData !== void 0 && (_extraData$licenseTer = extraData.licenseTermsData) !== null && _extraData$licenseTer !== void 0 && _extraData$licenseTer.length) {
|
|
11673
|
-
|
|
12226
|
+
_context38.n = 1;
|
|
11674
12227
|
break;
|
|
11675
12228
|
}
|
|
11676
|
-
return
|
|
12229
|
+
return _context38.a(2, ipAsset);
|
|
11677
12230
|
case 1:
|
|
11678
|
-
|
|
12231
|
+
_context38.n = 2;
|
|
11679
12232
|
return this.getLicenseTermsId(extraData.licenseTermsData.map(function (item) {
|
|
11680
12233
|
return item.terms;
|
|
11681
12234
|
}));
|
|
11682
12235
|
case 2:
|
|
11683
|
-
licenseTermsIds =
|
|
12236
|
+
licenseTermsIds = _context38.v;
|
|
11684
12237
|
ipAsset.licenseTermsIds = licenseTermsIds;
|
|
11685
12238
|
maxLicenseTokens = extraData.maxLicenseTokens;
|
|
11686
12239
|
if (maxLicenseTokens !== null && maxLicenseTokens !== void 0 && maxLicenseTokens.length) {
|
|
11687
|
-
|
|
12240
|
+
_context38.n = 3;
|
|
11688
12241
|
break;
|
|
11689
12242
|
}
|
|
11690
|
-
return
|
|
12243
|
+
return _context38.a(2, ipAsset);
|
|
11691
12244
|
case 3:
|
|
11692
12245
|
maxLicenseTokensData = maxLicenseTokens.filter(function (maxLicenseToken) {
|
|
11693
12246
|
return maxLicenseToken !== undefined;
|
|
@@ -11696,7 +12249,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11696
12249
|
maxLicenseTokens: maxLicenseToken
|
|
11697
12250
|
};
|
|
11698
12251
|
});
|
|
11699
|
-
|
|
12252
|
+
_context38.n = 4;
|
|
11700
12253
|
return setMaxLicenseTokens({
|
|
11701
12254
|
maxLicenseTokensData: maxLicenseTokensData,
|
|
11702
12255
|
licensorIpId: ipAsset.ipId,
|
|
@@ -11705,15 +12258,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11705
12258
|
templateAddress: this.licenseTemplateAddress
|
|
11706
12259
|
});
|
|
11707
12260
|
case 4:
|
|
11708
|
-
maxLicenseTokensTxHashes =
|
|
12261
|
+
maxLicenseTokensTxHashes = _context38.v;
|
|
11709
12262
|
if (maxLicenseTokensTxHashes !== null && maxLicenseTokensTxHashes !== void 0 && maxLicenseTokensTxHashes.length) {
|
|
11710
12263
|
ipAsset.maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
|
|
11711
12264
|
}
|
|
11712
|
-
return
|
|
12265
|
+
return _context38.a(2, ipAsset);
|
|
11713
12266
|
}
|
|
11714
|
-
},
|
|
12267
|
+
}, _callee37, this);
|
|
11715
12268
|
}));
|
|
11716
|
-
function processIpAssetLicenseTerms(
|
|
12269
|
+
function processIpAssetLicenseTerms(_x36, _x37) {
|
|
11717
12270
|
return _processIpAssetLicenseTerms.apply(this, arguments);
|
|
11718
12271
|
}
|
|
11719
12272
|
return processIpAssetLicenseTerms;
|
|
@@ -11721,53 +12274,53 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11721
12274
|
}, {
|
|
11722
12275
|
key: "approveLicenseTokensForDerivativeWorkflows",
|
|
11723
12276
|
value: function () {
|
|
11724
|
-
var _approveLicenseTokensForDerivativeWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11725
|
-
var _iterator10, _step10, licenseTokenId, txHash,
|
|
11726
|
-
return _regenerator().w(function (
|
|
11727
|
-
while (1) switch (
|
|
12277
|
+
var _approveLicenseTokensForDerivativeWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38(licenseTokenIds, autoApproveLicenseTokens) {
|
|
12278
|
+
var _iterator10, _step10, licenseTokenId, txHash, _t38;
|
|
12279
|
+
return _regenerator().w(function (_context39) {
|
|
12280
|
+
while (1) switch (_context39.p = _context39.n) {
|
|
11728
12281
|
case 0:
|
|
11729
12282
|
if (!(autoApproveLicenseTokens !== false)) {
|
|
11730
|
-
|
|
12283
|
+
_context39.n = 8;
|
|
11731
12284
|
break;
|
|
11732
12285
|
}
|
|
11733
12286
|
_iterator10 = _createForOfIteratorHelper(licenseTokenIds);
|
|
11734
|
-
|
|
12287
|
+
_context39.p = 1;
|
|
11735
12288
|
_iterator10.s();
|
|
11736
12289
|
case 2:
|
|
11737
12290
|
if ((_step10 = _iterator10.n()).done) {
|
|
11738
|
-
|
|
12291
|
+
_context39.n = 5;
|
|
11739
12292
|
break;
|
|
11740
12293
|
}
|
|
11741
12294
|
licenseTokenId = _step10.value;
|
|
11742
|
-
|
|
12295
|
+
_context39.n = 3;
|
|
11743
12296
|
return this.licenseTokenClient.approve({
|
|
11744
12297
|
to: this.derivativeWorkflowsClient.address,
|
|
11745
12298
|
tokenId: BigInt(licenseTokenId)
|
|
11746
12299
|
});
|
|
11747
12300
|
case 3:
|
|
11748
|
-
txHash =
|
|
11749
|
-
|
|
12301
|
+
txHash = _context39.v;
|
|
12302
|
+
_context39.n = 4;
|
|
11750
12303
|
return waitTx(this.rpcClient, txHash);
|
|
11751
12304
|
case 4:
|
|
11752
|
-
|
|
12305
|
+
_context39.n = 2;
|
|
11753
12306
|
break;
|
|
11754
12307
|
case 5:
|
|
11755
|
-
|
|
12308
|
+
_context39.n = 7;
|
|
11756
12309
|
break;
|
|
11757
12310
|
case 6:
|
|
11758
|
-
|
|
11759
|
-
|
|
11760
|
-
_iterator10.e(
|
|
12311
|
+
_context39.p = 6;
|
|
12312
|
+
_t38 = _context39.v;
|
|
12313
|
+
_iterator10.e(_t38);
|
|
11761
12314
|
case 7:
|
|
11762
|
-
|
|
12315
|
+
_context39.p = 7;
|
|
11763
12316
|
_iterator10.f();
|
|
11764
|
-
return
|
|
12317
|
+
return _context39.f(7);
|
|
11765
12318
|
case 8:
|
|
11766
|
-
return
|
|
12319
|
+
return _context39.a(2);
|
|
11767
12320
|
}
|
|
11768
|
-
},
|
|
12321
|
+
}, _callee38, this, [[1, 6, 7, 8]]);
|
|
11769
12322
|
}));
|
|
11770
|
-
function approveLicenseTokensForDerivativeWorkflows(
|
|
12323
|
+
function approveLicenseTokensForDerivativeWorkflows(_x38, _x39) {
|
|
11771
12324
|
return _approveLicenseTokensForDerivativeWorkflows.apply(this, arguments);
|
|
11772
12325
|
}
|
|
11773
12326
|
return approveLicenseTokensForDerivativeWorkflows;
|
|
@@ -12331,7 +12884,8 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
|
12331
12884
|
licensingConfig: _objectSpread2(_objectSpread2({}, licensingConfig), {}, {
|
|
12332
12885
|
licensingHook: this.totalLicenseTokenLimitHookClient.address,
|
|
12333
12886
|
// use Math.trunc to avoid precision issues
|
|
12334
|
-
expectMinimumGroupRewardShare: Math.trunc(licensingConfig.expectMinimumGroupRewardShare / 1000000)
|
|
12887
|
+
expectMinimumGroupRewardShare: Math.trunc(licensingConfig.expectMinimumGroupRewardShare / 1000000),
|
|
12888
|
+
commercialRevShare: Math.trunc(licensingConfig.commercialRevShare / 1000000)
|
|
12335
12889
|
})
|
|
12336
12890
|
});
|
|
12337
12891
|
case 4:
|
|
@@ -14791,6 +15345,16 @@ var AIRelationship = /*#__PURE__*/function (AIRelationship) {
|
|
|
14791
15345
|
* For more information, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-terms | PIL}.
|
|
14792
15346
|
**/
|
|
14793
15347
|
|
|
15348
|
+
/**
|
|
15349
|
+
* The data of the license and its configuration to be attached to the IP.
|
|
15350
|
+
*
|
|
15351
|
+
* You must provide either `licenseTermsId` or `terms`:
|
|
15352
|
+
* - `licenseTermsId`: Use an existing pre-registered license terms
|
|
15353
|
+
* - `terms`: Register new license terms and attach
|
|
15354
|
+
*
|
|
15355
|
+
* If both are provided, `terms` takes priority and new terms will be registered.
|
|
15356
|
+
*/
|
|
15357
|
+
|
|
14794
15358
|
/**
|
|
14795
15359
|
* @deprecated Use `PILFlavor.nonCommercialSocialRemixing`, `PILFlavor.commercialUse`, `PILFlavor.commercialRemix`, or `PILFlavor.creativeCommonsAttribution` instead.
|
|
14796
15360
|
*
|