@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
|
@@ -3095,6 +3095,15 @@ var ERC20Client = /*#__PURE__*/function () {
|
|
|
3095
3095
|
value: value
|
|
3096
3096
|
});
|
|
3097
3097
|
}
|
|
3098
|
+
}, {
|
|
3099
|
+
key: "transferFromEncode",
|
|
3100
|
+
value: function transferFromEncode(from, to, value) {
|
|
3101
|
+
return this.ercClient.transferFromEncode({
|
|
3102
|
+
from: from,
|
|
3103
|
+
to: to,
|
|
3104
|
+
value: value
|
|
3105
|
+
});
|
|
3106
|
+
}
|
|
3098
3107
|
|
|
3099
3108
|
// The method only will work in test environment
|
|
3100
3109
|
}, {
|
|
@@ -3210,6 +3219,15 @@ var WipTokenClient = /*#__PURE__*/function () {
|
|
|
3210
3219
|
value: function depositEncode() {
|
|
3211
3220
|
return this.wipClient.depositEncode();
|
|
3212
3221
|
}
|
|
3222
|
+
}, {
|
|
3223
|
+
key: "transferFromEncode",
|
|
3224
|
+
value: function transferFromEncode(from, to, value) {
|
|
3225
|
+
return this.wipClient.transferFromEncode({
|
|
3226
|
+
from: from,
|
|
3227
|
+
to: to,
|
|
3228
|
+
amount: value
|
|
3229
|
+
});
|
|
3230
|
+
}
|
|
3213
3231
|
}, {
|
|
3214
3232
|
key: "address",
|
|
3215
3233
|
get: function get() {
|
|
@@ -6231,6 +6249,24 @@ var IPAccountClient = /*#__PURE__*/function () {
|
|
|
6231
6249
|
}]);
|
|
6232
6250
|
}();
|
|
6233
6251
|
|
|
6252
|
+
function _regeneratorValues(e) {
|
|
6253
|
+
if (null != e) {
|
|
6254
|
+
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
6255
|
+
r = 0;
|
|
6256
|
+
if (t) return t.call(e);
|
|
6257
|
+
if ("function" == typeof e.next) return e;
|
|
6258
|
+
if (!isNaN(e.length)) return {
|
|
6259
|
+
next: function () {
|
|
6260
|
+
return e && r >= e.length && (e = void 0), {
|
|
6261
|
+
value: e && e[r++],
|
|
6262
|
+
done: !e
|
|
6263
|
+
};
|
|
6264
|
+
}
|
|
6265
|
+
};
|
|
6266
|
+
}
|
|
6267
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
6268
|
+
}
|
|
6269
|
+
|
|
6234
6270
|
var SignatureMethodType = /*#__PURE__*/function (SignatureMethodType) {
|
|
6235
6271
|
SignatureMethodType["REGISTER_IP_AND_MAKE_DERIVATIVE_AND_DEPLOY_ROYALTY_VAULT"] = "registerIpAndMakeDerivativeAndDeployRoyaltyVault";
|
|
6236
6272
|
SignatureMethodType["DISTRIBUTE_ROYALTY_TOKENS"] = "distributeRoyaltyTokens";
|
|
@@ -6573,6 +6609,392 @@ var generateOperationSignature = /*#__PURE__*/function () {
|
|
|
6573
6609
|
};
|
|
6574
6610
|
}();
|
|
6575
6611
|
|
|
6612
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
6613
|
+
if (null == r) return {};
|
|
6614
|
+
var t = {};
|
|
6615
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
6616
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
6617
|
+
t[n] = r[n];
|
|
6618
|
+
}
|
|
6619
|
+
return t;
|
|
6620
|
+
}
|
|
6621
|
+
|
|
6622
|
+
function _objectWithoutProperties(e, t) {
|
|
6623
|
+
if (null == e) return {};
|
|
6624
|
+
var o,
|
|
6625
|
+
r,
|
|
6626
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
6627
|
+
if (Object.getOwnPropertySymbols) {
|
|
6628
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
6629
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
6630
|
+
}
|
|
6631
|
+
return i;
|
|
6632
|
+
}
|
|
6633
|
+
|
|
6634
|
+
var _excluded = ["mintFees", "spenderAddress", "encodedTxs"];
|
|
6635
|
+
/**
|
|
6636
|
+
* Handles batch transaction execution through IP Account with automatic fee management for ERC20 and WIP tokens.
|
|
6637
|
+
*/
|
|
6638
|
+
var IpAccountBatchExecutor = /*#__PURE__*/function () {
|
|
6639
|
+
function IpAccountBatchExecutor(rpcClient, wallet, ipId) {
|
|
6640
|
+
_classCallCheck(this, IpAccountBatchExecutor);
|
|
6641
|
+
this.rpcClient = rpcClient;
|
|
6642
|
+
this.wallet = wallet;
|
|
6643
|
+
this.ipId = ipId;
|
|
6644
|
+
//erc20 address only available in aeneid
|
|
6645
|
+
this.erc20Token = new ERC20Client(rpcClient, wallet, erc20Address[aeneid.id]);
|
|
6646
|
+
this.wipToken = new WipTokenClient(rpcClient, wallet);
|
|
6647
|
+
this.walletAddress = wallet.account.address;
|
|
6648
|
+
}
|
|
6649
|
+
|
|
6650
|
+
/**
|
|
6651
|
+
* Executes a batch transaction with automatic fee handling for both ERC20 and WIP tokens.
|
|
6652
|
+
*/
|
|
6653
|
+
return _createClass(IpAccountBatchExecutor, [{
|
|
6654
|
+
key: "executeWithFees",
|
|
6655
|
+
value: (function () {
|
|
6656
|
+
var _executeWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
6657
|
+
var _options$options;
|
|
6658
|
+
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;
|
|
6659
|
+
return _regenerator().w(function (_context) {
|
|
6660
|
+
while (1) switch (_context.p = _context.n) {
|
|
6661
|
+
case 0:
|
|
6662
|
+
mintFees = _ref.mintFees, spenderAddress = _ref.spenderAddress, encodedTxs = _ref.encodedTxs, options = _objectWithoutProperties(_ref, _excluded);
|
|
6663
|
+
_groupTokenSpenders = groupTokenSpenders(mintFees.map(function (fee) {
|
|
6664
|
+
return _objectSpread2({
|
|
6665
|
+
address: spenderAddress
|
|
6666
|
+
}, fee);
|
|
6667
|
+
})), wipSpenders = _groupTokenSpenders.wipSpenders, erc20Spenders = _groupTokenSpenders.erc20Spenders;
|
|
6668
|
+
wipTotalFees = wipSpenders.reduce(function (acc, spender) {
|
|
6669
|
+
return acc + (spender.amount || 0n);
|
|
6670
|
+
}, 0n);
|
|
6671
|
+
erc20TotalFees = erc20Spenders.reduce(function (acc, spender) {
|
|
6672
|
+
return acc + (spender.amount || 0n);
|
|
6673
|
+
}, 0n);
|
|
6674
|
+
_context.n = 1;
|
|
6675
|
+
return this.wipToken.balanceOf(this.walletAddress);
|
|
6676
|
+
case 1:
|
|
6677
|
+
wipBalance = _context.v;
|
|
6678
|
+
callData = [];
|
|
6679
|
+
depositValue = 0n; // Build ERC20 fee call data if needed
|
|
6680
|
+
if (!(erc20TotalFees > 0n)) {
|
|
6681
|
+
_context.n = 3;
|
|
6682
|
+
break;
|
|
6683
|
+
}
|
|
6684
|
+
_t = callData.push;
|
|
6685
|
+
_t2 = callData;
|
|
6686
|
+
_t3 = _toConsumableArray;
|
|
6687
|
+
_context.n = 2;
|
|
6688
|
+
return this.buildErc20FeeCallData(erc20TotalFees, spenderAddress, options);
|
|
6689
|
+
case 2:
|
|
6690
|
+
_t.apply.call(_t, _t2, _t3(_context.v));
|
|
6691
|
+
case 3:
|
|
6692
|
+
if (!(wipTotalFees > 0n)) {
|
|
6693
|
+
_context.n = 7;
|
|
6694
|
+
break;
|
|
6695
|
+
}
|
|
6696
|
+
if (!(wipBalance < wipTotalFees)) {
|
|
6697
|
+
_context.n = 5;
|
|
6698
|
+
break;
|
|
6699
|
+
}
|
|
6700
|
+
_context.n = 4;
|
|
6701
|
+
return this.buildWipDepositCallData(spenderAddress, wipTotalFees, wipBalance, options);
|
|
6702
|
+
case 4:
|
|
6703
|
+
_yield$this$buildWipD = _context.v;
|
|
6704
|
+
calls = _yield$this$buildWipD.calls;
|
|
6705
|
+
value = _yield$this$buildWipD.value;
|
|
6706
|
+
callData.push.apply(callData, _toConsumableArray(calls));
|
|
6707
|
+
depositValue = value;
|
|
6708
|
+
_context.n = 7;
|
|
6709
|
+
break;
|
|
6710
|
+
case 5:
|
|
6711
|
+
_t4 = callData.push;
|
|
6712
|
+
_t5 = callData;
|
|
6713
|
+
_t6 = _toConsumableArray;
|
|
6714
|
+
_context.n = 6;
|
|
6715
|
+
return this.buildWipTransferCallData(wipTotalFees, spenderAddress, options);
|
|
6716
|
+
case 6:
|
|
6717
|
+
_t4.apply.call(_t4, _t5, _t6(_context.v));
|
|
6718
|
+
case 7:
|
|
6719
|
+
// Add the actual transaction call data
|
|
6720
|
+
callData.push({
|
|
6721
|
+
target: encodedTxs.to,
|
|
6722
|
+
value: 0n,
|
|
6723
|
+
data: encodedTxs.data
|
|
6724
|
+
});
|
|
6725
|
+
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;
|
|
6726
|
+
if (isMulticall) {
|
|
6727
|
+
_context.n = 16;
|
|
6728
|
+
break;
|
|
6729
|
+
}
|
|
6730
|
+
_iterator = _createForOfIteratorHelper(callData.entries());
|
|
6731
|
+
_context.p = 8;
|
|
6732
|
+
_iterator.s();
|
|
6733
|
+
case 9:
|
|
6734
|
+
if ((_step = _iterator.n()).done) {
|
|
6735
|
+
_context.n = 13;
|
|
6736
|
+
break;
|
|
6737
|
+
}
|
|
6738
|
+
_step$value = _slicedToArray(_step.value, 2), index = _step$value[0], call = _step$value[1];
|
|
6739
|
+
_value = call.value;
|
|
6740
|
+
_context.n = 10;
|
|
6741
|
+
return simulateAndWriteContract({
|
|
6742
|
+
rpcClient: this.rpcClient,
|
|
6743
|
+
wallet: this.wallet,
|
|
6744
|
+
data: _objectSpread2({
|
|
6745
|
+
abi: ipAccountImplAbi,
|
|
6746
|
+
address: this.ipId,
|
|
6747
|
+
functionName: "execute",
|
|
6748
|
+
args: [call.target, call.value, call.data, 0]
|
|
6749
|
+
}, _value > 0n && {
|
|
6750
|
+
value: _value
|
|
6751
|
+
})
|
|
6752
|
+
});
|
|
6753
|
+
case 10:
|
|
6754
|
+
_txHash = _context.v;
|
|
6755
|
+
_context.n = 11;
|
|
6756
|
+
return waitTx(this.rpcClient, _txHash.txHash);
|
|
6757
|
+
case 11:
|
|
6758
|
+
if (!(index === callData.length - 1)) {
|
|
6759
|
+
_context.n = 12;
|
|
6760
|
+
break;
|
|
6761
|
+
}
|
|
6762
|
+
return _context.a(2, {
|
|
6763
|
+
txHash: _txHash.txHash,
|
|
6764
|
+
receipt: _txHash.receipt
|
|
6765
|
+
});
|
|
6766
|
+
case 12:
|
|
6767
|
+
_context.n = 9;
|
|
6768
|
+
break;
|
|
6769
|
+
case 13:
|
|
6770
|
+
_context.n = 15;
|
|
6771
|
+
break;
|
|
6772
|
+
case 14:
|
|
6773
|
+
_context.p = 14;
|
|
6774
|
+
_t7 = _context.v;
|
|
6775
|
+
_iterator.e(_t7);
|
|
6776
|
+
case 15:
|
|
6777
|
+
_context.p = 15;
|
|
6778
|
+
_iterator.f();
|
|
6779
|
+
return _context.f(15);
|
|
6780
|
+
case 16:
|
|
6781
|
+
_context.n = 17;
|
|
6782
|
+
return simulateAndWriteContract({
|
|
6783
|
+
rpcClient: this.rpcClient,
|
|
6784
|
+
wallet: this.wallet,
|
|
6785
|
+
data: _objectSpread2({
|
|
6786
|
+
abi: ipAccountImplAbi,
|
|
6787
|
+
address: this.ipId,
|
|
6788
|
+
functionName: "executeBatch",
|
|
6789
|
+
args: [callData, 0]
|
|
6790
|
+
}, depositValue > 0n && {
|
|
6791
|
+
value: depositValue
|
|
6792
|
+
})
|
|
6793
|
+
});
|
|
6794
|
+
case 17:
|
|
6795
|
+
txHash = _context.v;
|
|
6796
|
+
_context.n = 18;
|
|
6797
|
+
return waitTx(this.rpcClient, txHash.txHash, options.txOptions);
|
|
6798
|
+
case 18:
|
|
6799
|
+
return _context.a(2, {
|
|
6800
|
+
txHash: txHash.txHash,
|
|
6801
|
+
receipt: txHash.receipt
|
|
6802
|
+
});
|
|
6803
|
+
}
|
|
6804
|
+
}, _callee, this, [[8, 14, 15, 16]]);
|
|
6805
|
+
}));
|
|
6806
|
+
function executeWithFees(_x) {
|
|
6807
|
+
return _executeWithFees.apply(this, arguments);
|
|
6808
|
+
}
|
|
6809
|
+
return executeWithFees;
|
|
6810
|
+
}()
|
|
6811
|
+
/**
|
|
6812
|
+
* Builds call data for transferring ERC20 tokens from wallet to IP account and approving spender.
|
|
6813
|
+
*/
|
|
6814
|
+
)
|
|
6815
|
+
}, {
|
|
6816
|
+
key: "buildErc20FeeCallData",
|
|
6817
|
+
value: (function () {
|
|
6818
|
+
var _buildErc20FeeCallData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(totalFee, spenderAddress, options) {
|
|
6819
|
+
var _options$options2;
|
|
6820
|
+
var erc20Balance, autoApprove, erc20ContractAddress, allowance, calls, spenderAllowance, _t8, _t9;
|
|
6821
|
+
return _regenerator().w(function (_context2) {
|
|
6822
|
+
while (1) switch (_context2.n) {
|
|
6823
|
+
case 0:
|
|
6824
|
+
_context2.n = 1;
|
|
6825
|
+
return this.erc20Token.balanceOf(this.walletAddress);
|
|
6826
|
+
case 1:
|
|
6827
|
+
erc20Balance = _context2.v;
|
|
6828
|
+
if (!(erc20Balance < totalFee)) {
|
|
6829
|
+
_context2.n = 2;
|
|
6830
|
+
break;
|
|
6831
|
+
}
|
|
6832
|
+
throw new Error("Wallet does not have enough ERC20 tokens to pay for fees. " + "Required: ".concat(getTokenAmountDisplay(totalFee), ", ") + "Available: ".concat(getTokenAmountDisplay(erc20Balance), "."));
|
|
6833
|
+
case 2:
|
|
6834
|
+
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
|
|
6835
|
+
erc20ContractAddress = erc20Address[aeneid.id];
|
|
6836
|
+
_context2.n = 3;
|
|
6837
|
+
return this.erc20Token.allowance(this.walletAddress, this.ipId);
|
|
6838
|
+
case 3:
|
|
6839
|
+
allowance = _context2.v;
|
|
6840
|
+
if (!(autoApprove && allowance < totalFee)) {
|
|
6841
|
+
_context2.n = 5;
|
|
6842
|
+
break;
|
|
6843
|
+
}
|
|
6844
|
+
_t8 = waitTx;
|
|
6845
|
+
_t9 = this.rpcClient;
|
|
6846
|
+
_context2.n = 4;
|
|
6847
|
+
return this.erc20Token.approve(this.ipId, viem.maxUint256);
|
|
6848
|
+
case 4:
|
|
6849
|
+
_context2.n = 5;
|
|
6850
|
+
return _t8(_t9, _context2.v);
|
|
6851
|
+
case 5:
|
|
6852
|
+
calls = [{
|
|
6853
|
+
target: erc20ContractAddress,
|
|
6854
|
+
value: 0n,
|
|
6855
|
+
data: this.erc20Token.transferFromEncode(this.walletAddress, this.ipId, totalFee).data
|
|
6856
|
+
}];
|
|
6857
|
+
_context2.n = 6;
|
|
6858
|
+
return this.erc20Token.allowance(this.ipId, spenderAddress);
|
|
6859
|
+
case 6:
|
|
6860
|
+
spenderAllowance = _context2.v;
|
|
6861
|
+
if (autoApprove && spenderAllowance < totalFee) {
|
|
6862
|
+
calls.push({
|
|
6863
|
+
target: erc20ContractAddress,
|
|
6864
|
+
value: 0n,
|
|
6865
|
+
data: this.erc20Token.approveEncode(spenderAddress, viem.maxUint256).data
|
|
6866
|
+
});
|
|
6867
|
+
}
|
|
6868
|
+
return _context2.a(2, calls);
|
|
6869
|
+
}
|
|
6870
|
+
}, _callee2, this);
|
|
6871
|
+
}));
|
|
6872
|
+
function buildErc20FeeCallData(_x2, _x3, _x4) {
|
|
6873
|
+
return _buildErc20FeeCallData.apply(this, arguments);
|
|
6874
|
+
}
|
|
6875
|
+
return buildErc20FeeCallData;
|
|
6876
|
+
}()
|
|
6877
|
+
/**
|
|
6878
|
+
* Builds call data for depositing IP tokens to WIP and approving spender.
|
|
6879
|
+
*/
|
|
6880
|
+
)
|
|
6881
|
+
}, {
|
|
6882
|
+
key: "buildWipDepositCallData",
|
|
6883
|
+
value: (function () {
|
|
6884
|
+
var _buildWipDepositCallData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(spenderAddress, totalFee, wipBalance, options) {
|
|
6885
|
+
var _options$options3, _options$options4;
|
|
6886
|
+
var calls, autoApprove, autoWrapIp, ipBalance, value, allowance;
|
|
6887
|
+
return _regenerator().w(function (_context3) {
|
|
6888
|
+
while (1) switch (_context3.n) {
|
|
6889
|
+
case 0:
|
|
6890
|
+
calls = [];
|
|
6891
|
+
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;
|
|
6892
|
+
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;
|
|
6893
|
+
_context3.n = 1;
|
|
6894
|
+
return this.rpcClient.getBalance({
|
|
6895
|
+
address: this.walletAddress
|
|
6896
|
+
});
|
|
6897
|
+
case 1:
|
|
6898
|
+
ipBalance = _context3.v;
|
|
6899
|
+
if (autoWrapIp) {
|
|
6900
|
+
_context3.n = 2;
|
|
6901
|
+
break;
|
|
6902
|
+
}
|
|
6903
|
+
throw new Error("Wallet does not have enough WIP to pay for fees. Total fees: ".concat(getTokenAmountDisplay(totalFee), ", balance: ").concat(getTokenAmountDisplay(wipBalance, "WIP"), "."));
|
|
6904
|
+
case 2:
|
|
6905
|
+
if (!(ipBalance < totalFee)) {
|
|
6906
|
+
_context3.n = 3;
|
|
6907
|
+
break;
|
|
6908
|
+
}
|
|
6909
|
+
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), "."));
|
|
6910
|
+
case 3:
|
|
6911
|
+
calls.push({
|
|
6912
|
+
target: WIP_TOKEN_ADDRESS,
|
|
6913
|
+
value: totalFee,
|
|
6914
|
+
data: this.wipToken.depositEncode().data
|
|
6915
|
+
});
|
|
6916
|
+
value = totalFee;
|
|
6917
|
+
_context3.n = 4;
|
|
6918
|
+
return this.wipToken.allowance(this.ipId, spenderAddress);
|
|
6919
|
+
case 4:
|
|
6920
|
+
allowance = _context3.v;
|
|
6921
|
+
if (autoApprove && allowance < totalFee) {
|
|
6922
|
+
calls.push({
|
|
6923
|
+
target: WIP_TOKEN_ADDRESS,
|
|
6924
|
+
value: 0n,
|
|
6925
|
+
data: this.wipToken.approveEncode(spenderAddress, viem.maxUint256).data
|
|
6926
|
+
});
|
|
6927
|
+
}
|
|
6928
|
+
return _context3.a(2, {
|
|
6929
|
+
calls: calls,
|
|
6930
|
+
value: value
|
|
6931
|
+
});
|
|
6932
|
+
}
|
|
6933
|
+
}, _callee3, this);
|
|
6934
|
+
}));
|
|
6935
|
+
function buildWipDepositCallData(_x5, _x6, _x7, _x8) {
|
|
6936
|
+
return _buildWipDepositCallData.apply(this, arguments);
|
|
6937
|
+
}
|
|
6938
|
+
return buildWipDepositCallData;
|
|
6939
|
+
}()
|
|
6940
|
+
/**
|
|
6941
|
+
* Builds call data for transferring existing WIP tokens from wallet to IP account and approving spender.
|
|
6942
|
+
*/
|
|
6943
|
+
)
|
|
6944
|
+
}, {
|
|
6945
|
+
key: "buildWipTransferCallData",
|
|
6946
|
+
value: (function () {
|
|
6947
|
+
var _buildWipTransferCallData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(totalFee, spenderAddress, options) {
|
|
6948
|
+
var _options$options5;
|
|
6949
|
+
var autoApprove, allowance, calls, spenderAllowance, _t0, _t1;
|
|
6950
|
+
return _regenerator().w(function (_context4) {
|
|
6951
|
+
while (1) switch (_context4.n) {
|
|
6952
|
+
case 0:
|
|
6953
|
+
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;
|
|
6954
|
+
_context4.n = 1;
|
|
6955
|
+
return this.wipToken.allowance(this.walletAddress, this.ipId);
|
|
6956
|
+
case 1:
|
|
6957
|
+
allowance = _context4.v;
|
|
6958
|
+
if (!(autoApprove && allowance < totalFee)) {
|
|
6959
|
+
_context4.n = 3;
|
|
6960
|
+
break;
|
|
6961
|
+
}
|
|
6962
|
+
_t0 = waitTx;
|
|
6963
|
+
_t1 = this.rpcClient;
|
|
6964
|
+
_context4.n = 2;
|
|
6965
|
+
return this.wipToken.approve(this.ipId, viem.maxUint256);
|
|
6966
|
+
case 2:
|
|
6967
|
+
_context4.n = 3;
|
|
6968
|
+
return _t0(_t1, _context4.v);
|
|
6969
|
+
case 3:
|
|
6970
|
+
calls = [{
|
|
6971
|
+
target: WIP_TOKEN_ADDRESS,
|
|
6972
|
+
value: 0n,
|
|
6973
|
+
data: this.wipToken.transferFromEncode(this.walletAddress, this.ipId, totalFee).data
|
|
6974
|
+
}];
|
|
6975
|
+
_context4.n = 4;
|
|
6976
|
+
return this.wipToken.allowance(this.ipId, spenderAddress);
|
|
6977
|
+
case 4:
|
|
6978
|
+
spenderAllowance = _context4.v;
|
|
6979
|
+
if (autoApprove && spenderAllowance < totalFee) {
|
|
6980
|
+
calls.push({
|
|
6981
|
+
target: WIP_TOKEN_ADDRESS,
|
|
6982
|
+
value: 0n,
|
|
6983
|
+
data: this.wipToken.approveEncode(spenderAddress, viem.maxUint256).data
|
|
6984
|
+
});
|
|
6985
|
+
}
|
|
6986
|
+
return _context4.a(2, calls);
|
|
6987
|
+
}
|
|
6988
|
+
}, _callee4, this);
|
|
6989
|
+
}));
|
|
6990
|
+
function buildWipTransferCallData(_x9, _x0, _x1) {
|
|
6991
|
+
return _buildWipTransferCallData.apply(this, arguments);
|
|
6992
|
+
}
|
|
6993
|
+
return buildWipTransferCallData;
|
|
6994
|
+
}())
|
|
6995
|
+
}]);
|
|
6996
|
+
}();
|
|
6997
|
+
|
|
6576
6998
|
var _PILFlavor;
|
|
6577
6999
|
var PIL_URIS = {
|
|
6578
7000
|
NCSR: "https://github.com/piplabs/pil-document/blob/998c13e6ee1d04eb817aefd1fe16dfe8be3cd7a2/off-chain-terms/NCSR.json",
|
|
@@ -6802,24 +7224,6 @@ _defineProperty(PILFlavor, "verifyDerivatives", function (terms) {
|
|
|
6802
7224
|
}
|
|
6803
7225
|
});
|
|
6804
7226
|
|
|
6805
|
-
function _regeneratorValues(e) {
|
|
6806
|
-
if (null != e) {
|
|
6807
|
-
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
6808
|
-
r = 0;
|
|
6809
|
-
if (t) return t.call(e);
|
|
6810
|
-
if ("function" == typeof e.next) return e;
|
|
6811
|
-
if (!isNaN(e.length)) return {
|
|
6812
|
-
next: function () {
|
|
6813
|
-
return e && r >= e.length && (e = void 0), {
|
|
6814
|
-
value: e && e[r++],
|
|
6815
|
-
done: !e
|
|
6816
|
-
};
|
|
6817
|
-
}
|
|
6818
|
-
};
|
|
6819
|
-
}
|
|
6820
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
6821
|
-
}
|
|
6822
|
-
|
|
6823
7227
|
function _regeneratorKeys(e) {
|
|
6824
7228
|
var n = Object(e),
|
|
6825
7229
|
r = [];
|
|
@@ -6850,7 +7254,7 @@ var getPublicMinting = /*#__PURE__*/function () {
|
|
|
6850
7254
|
}();
|
|
6851
7255
|
var validateLicenseTermsData = /*#__PURE__*/function () {
|
|
6852
7256
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(licenseTermsData, rpcClient, chainId) {
|
|
6853
|
-
var licenseTerms, processedLicenseTermsData, maxLicenseTokens, i, licenseTerm, royaltyModuleReadOnlyClient, isWhitelistedArbitrationPolicy, isWhitelistedRoyaltyToken, licensingConfig, maxLicenseTokensValue;
|
|
7257
|
+
var licenseTerms, processedLicenseTermsData, maxLicenseTokens, i, licenseTerm, licenseTermsDataInput, royaltyModuleReadOnlyClient, isWhitelistedArbitrationPolicy, isWhitelistedRoyaltyToken, piLicenseTemplateReadOnlyClient, isExist, response, licensingConfig, maxLicenseTokensValue;
|
|
6854
7258
|
return _regenerator().w(function (_context2) {
|
|
6855
7259
|
while (1) switch (_context2.n) {
|
|
6856
7260
|
case 0:
|
|
@@ -6860,10 +7264,16 @@ var validateLicenseTermsData = /*#__PURE__*/function () {
|
|
|
6860
7264
|
i = 0;
|
|
6861
7265
|
case 1:
|
|
6862
7266
|
if (!(i < licenseTermsData.length)) {
|
|
6863
|
-
_context2.n =
|
|
7267
|
+
_context2.n = 16;
|
|
7268
|
+
break;
|
|
7269
|
+
}
|
|
7270
|
+
licenseTerm = void 0;
|
|
7271
|
+
licenseTermsDataInput = licenseTermsData[i];
|
|
7272
|
+
if (!licenseTermsDataInput.terms) {
|
|
7273
|
+
_context2.n = 6;
|
|
6864
7274
|
break;
|
|
6865
7275
|
}
|
|
6866
|
-
licenseTerm = PILFlavor.validateLicenseTerms(
|
|
7276
|
+
licenseTerm = PILFlavor.validateLicenseTerms(licenseTermsDataInput.terms, chainId);
|
|
6867
7277
|
licenseTerm.commercialRevShare = getRevenueShare(licenseTerm.commercialRevShare);
|
|
6868
7278
|
royaltyModuleReadOnlyClient = new RoyaltyModuleReadOnlyClient(rpcClient);
|
|
6869
7279
|
if (!(validateAddress(licenseTerm.royaltyPolicy) !== viem.zeroAddress)) {
|
|
@@ -6898,37 +7308,69 @@ var validateLicenseTermsData = /*#__PURE__*/function () {
|
|
|
6898
7308
|
}
|
|
6899
7309
|
throw new Error("The currency token ".concat(licenseTerm.currency, " is not whitelisted."));
|
|
6900
7310
|
case 5:
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
_context2.n = 6;
|
|
6904
|
-
break;
|
|
6905
|
-
}
|
|
6906
|
-
throw new Error("A royalty policy must be provided when the minting fee is greater than 0.");
|
|
7311
|
+
_context2.n = 11;
|
|
7312
|
+
break;
|
|
6907
7313
|
case 6:
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
_context2.n = 8;
|
|
7314
|
+
if (!(licenseTermsDataInput.licenseTermsId !== undefined)) {
|
|
7315
|
+
_context2.n = 10;
|
|
6911
7316
|
break;
|
|
6912
7317
|
}
|
|
6913
|
-
|
|
6914
|
-
|
|
7318
|
+
piLicenseTemplateReadOnlyClient = new PiLicenseTemplateReadOnlyClient(rpcClient);
|
|
7319
|
+
_context2.n = 7;
|
|
7320
|
+
return piLicenseTemplateReadOnlyClient.exists({
|
|
7321
|
+
licenseTermsId: BigInt(licenseTermsDataInput.licenseTermsId)
|
|
7322
|
+
});
|
|
7323
|
+
case 7:
|
|
7324
|
+
isExist = _context2.v;
|
|
7325
|
+
if (isExist) {
|
|
7326
|
+
_context2.n = 8;
|
|
6915
7327
|
break;
|
|
6916
7328
|
}
|
|
6917
|
-
throw new Error("The
|
|
6918
|
-
case
|
|
7329
|
+
throw new Error("The license terms id ".concat(licenseTermsDataInput.licenseTermsId, " is not exist."));
|
|
7330
|
+
case 8:
|
|
7331
|
+
_context2.n = 9;
|
|
7332
|
+
return piLicenseTemplateReadOnlyClient.getLicenseTerms({
|
|
7333
|
+
selectedLicenseTermsId: BigInt(licenseTermsDataInput.licenseTermsId)
|
|
7334
|
+
});
|
|
7335
|
+
case 9:
|
|
7336
|
+
response = _context2.v;
|
|
7337
|
+
licenseTerm = response.terms;
|
|
7338
|
+
_context2.n = 11;
|
|
7339
|
+
break;
|
|
7340
|
+
case 10:
|
|
7341
|
+
throw new Error("Either terms or licenseTermsId must be provided.");
|
|
7342
|
+
case 11:
|
|
7343
|
+
licensingConfig = validateLicenseConfig(licenseTermsData[i].licensingConfig);
|
|
7344
|
+
if (!(licensingConfig.mintingFee > 0 && licenseTerm.royaltyPolicy === viem.zeroAddress)) {
|
|
7345
|
+
_context2.n = 12;
|
|
7346
|
+
break;
|
|
7347
|
+
}
|
|
7348
|
+
throw new Error("A royalty policy must be provided when the minting fee is greater than 0.");
|
|
7349
|
+
case 12:
|
|
7350
|
+
maxLicenseTokensValue = licenseTermsData[i].maxLicenseTokens;
|
|
7351
|
+
if (!(maxLicenseTokensValue !== undefined)) {
|
|
7352
|
+
_context2.n = 14;
|
|
7353
|
+
break;
|
|
7354
|
+
}
|
|
7355
|
+
if (!(maxLicenseTokensValue < 0)) {
|
|
7356
|
+
_context2.n = 13;
|
|
7357
|
+
break;
|
|
7358
|
+
}
|
|
7359
|
+
throw new Error("The max license tokens must be greater than or equal to 0.");
|
|
7360
|
+
case 13:
|
|
6919
7361
|
licensingConfig.licensingHook = totalLicenseTokenLimitHookAddress[chainId];
|
|
6920
7362
|
maxLicenseTokens[i] = BigInt(maxLicenseTokensValue);
|
|
6921
|
-
case
|
|
7363
|
+
case 14:
|
|
6922
7364
|
licenseTerms.push(licenseTerm);
|
|
6923
7365
|
processedLicenseTermsData.push({
|
|
6924
7366
|
terms: licenseTerm,
|
|
6925
7367
|
licensingConfig: licensingConfig
|
|
6926
7368
|
});
|
|
6927
|
-
case
|
|
7369
|
+
case 15:
|
|
6928
7370
|
i++;
|
|
6929
7371
|
_context2.n = 1;
|
|
6930
7372
|
break;
|
|
6931
|
-
case
|
|
7373
|
+
case 16:
|
|
6932
7374
|
return _context2.a(2, {
|
|
6933
7375
|
licenseTerms: licenseTerms,
|
|
6934
7376
|
licenseTermsData: processedLicenseTermsData,
|
|
@@ -8369,6 +8811,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8369
8811
|
this.spgNftClient = new SpgnftImplReadOnlyClient(rpcClient);
|
|
8370
8812
|
this.totalLicenseTokenLimitHookClient = new TotalLicenseTokenLimitHookClient(rpcClient, wallet);
|
|
8371
8813
|
this.licenseTokenClient = new LicenseTokenClient(rpcClient, wallet);
|
|
8814
|
+
this.erc20Client = new Erc20Client(rpcClient, wallet, erc20Address[chainId]);
|
|
8372
8815
|
this.rpcClient = rpcClient;
|
|
8373
8816
|
this.wallet = wallet;
|
|
8374
8817
|
this.chainId = chainId;
|
|
@@ -8704,8 +9147,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8704
9147
|
key: "registerDerivative",
|
|
8705
9148
|
value: (function () {
|
|
8706
9149
|
var _registerDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(request) {
|
|
8707
|
-
var
|
|
8708
|
-
var _request$txOptions2, isChildIpIdRegistered, derivativeData, object, encodedTxData, _request$options, contractCall, _t5;
|
|
9150
|
+
var _request$txOptions2, isChildIpIdRegistered, derivativeData, object, encodedTxData, mintFees, batchExecutor, _t5;
|
|
8709
9151
|
return _regenerator().w(function (_context4) {
|
|
8710
9152
|
while (1) switch (_context4.p = _context4.n) {
|
|
8711
9153
|
case 0:
|
|
@@ -8741,33 +9183,35 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8741
9183
|
encodedTxData: encodedTxData
|
|
8742
9184
|
});
|
|
8743
9185
|
case 4:
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
};
|
|
8747
|
-
return _context4.a(2, this.handleRegistrationWithFees({
|
|
8748
|
-
sender: this.walletAddress,
|
|
9186
|
+
_context4.n = 5;
|
|
9187
|
+
return calculateDerivativeMintingFee({
|
|
8749
9188
|
derivData: object,
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options = request.options) === null || _request$options === void 0 ? void 0 : _request$options.wipOptions), {}, {
|
|
8756
|
-
useMulticallWhenPossible: false
|
|
8757
|
-
})
|
|
8758
|
-
})
|
|
8759
|
-
}));
|
|
9189
|
+
rpcClient: this.rpcClient,
|
|
9190
|
+
wallet: this.wallet,
|
|
9191
|
+
chainId: this.chainId,
|
|
9192
|
+
sender: this.walletAddress
|
|
9193
|
+
});
|
|
8760
9194
|
case 5:
|
|
8761
|
-
|
|
8762
|
-
|
|
9195
|
+
mintFees = _context4.v;
|
|
9196
|
+
batchExecutor = new IpAccountBatchExecutor(this.rpcClient, this.wallet, request.childIpId);
|
|
9197
|
+
return _context4.a(2, batchExecutor.executeWithFees({
|
|
9198
|
+
mintFees: mintFees,
|
|
9199
|
+
spenderAddress: this.royaltyModuleEventClient.address,
|
|
9200
|
+
encodedTxs: encodedTxData,
|
|
9201
|
+
options: request.options,
|
|
9202
|
+
txOptions: request.txOptions
|
|
9203
|
+
}));
|
|
8763
9204
|
case 6:
|
|
8764
|
-
_context4.
|
|
9205
|
+
_context4.n = 8;
|
|
9206
|
+
break;
|
|
9207
|
+
case 7:
|
|
9208
|
+
_context4.p = 7;
|
|
8765
9209
|
_t5 = _context4.v;
|
|
8766
9210
|
return _context4.a(2, handleError(_t5, "Failed to register derivative"));
|
|
8767
|
-
case
|
|
9211
|
+
case 8:
|
|
8768
9212
|
return _context4.a(2);
|
|
8769
9213
|
}
|
|
8770
|
-
}, _callee4, this, [[0,
|
|
9214
|
+
}, _callee4, this, [[0, 7]]);
|
|
8771
9215
|
}));
|
|
8772
9216
|
function registerDerivative(_x5) {
|
|
8773
9217
|
return _registerDerivative.apply(this, arguments);
|
|
@@ -8775,48 +9219,124 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8775
9219
|
return registerDerivative;
|
|
8776
9220
|
}()
|
|
8777
9221
|
/**
|
|
8778
|
-
* Batch registers a derivative directly with parent IP's license terms
|
|
9222
|
+
* Batch registers a derivative directly with parent IP's license terms, without needing license tokens,
|
|
9223
|
+
* and attaches the license terms of the parent IPs to the derivative IP.
|
|
9224
|
+
* The license terms must be attached to the parent IP before calling this function.
|
|
9225
|
+
* All IPs attached default license terms by default.
|
|
9226
|
+
* The derivative IP owner must be the caller or an authorized operator.
|
|
9227
|
+
*
|
|
9228
|
+
* @remarks
|
|
9229
|
+
* This method supports automatic fee handling for both ERC20 and WIP tokens.
|
|
9230
|
+
* The fees are paid from the wallet address.
|
|
9231
|
+
* The transaction will be executed in the same order as the input arguments.
|
|
9232
|
+
* If a request fails, previous transactions will not be reverted.
|
|
8779
9233
|
*/
|
|
8780
9234
|
)
|
|
8781
9235
|
}, {
|
|
8782
|
-
key: "
|
|
9236
|
+
key: "batchRegisterDerivatives",
|
|
8783
9237
|
value: (function () {
|
|
8784
|
-
var
|
|
8785
|
-
var
|
|
9238
|
+
var _batchRegisterDerivatives = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref2) {
|
|
9239
|
+
var requests, options, txOptions, txHashes, index, result, _t6;
|
|
8786
9240
|
return _regenerator().w(function (_context5) {
|
|
8787
9241
|
while (1) switch (_context5.p = _context5.n) {
|
|
8788
9242
|
case 0:
|
|
8789
|
-
|
|
9243
|
+
requests = _ref2.requests, options = _ref2.options, txOptions = _ref2.txOptions;
|
|
9244
|
+
txHashes = [];
|
|
9245
|
+
index = 0;
|
|
9246
|
+
case 1:
|
|
9247
|
+
if (!(index < requests.length)) {
|
|
9248
|
+
_context5.n = 6;
|
|
9249
|
+
break;
|
|
9250
|
+
}
|
|
9251
|
+
_context5.p = 2;
|
|
9252
|
+
_context5.n = 3;
|
|
9253
|
+
return this.registerDerivative(_objectSpread2(_objectSpread2({}, requests[index]), {}, {
|
|
9254
|
+
options: options,
|
|
9255
|
+
txOptions: txOptions
|
|
9256
|
+
}));
|
|
9257
|
+
case 3:
|
|
9258
|
+
result = _context5.v;
|
|
9259
|
+
txHashes.push(result.txHash);
|
|
9260
|
+
index++;
|
|
9261
|
+
_context5.n = 5;
|
|
9262
|
+
break;
|
|
9263
|
+
case 4:
|
|
9264
|
+
_context5.p = 4;
|
|
9265
|
+
_t6 = _context5.v;
|
|
9266
|
+
return _context5.a(2, handleError(_t6, "Failed to batch register derivatives at index ".concat(index)));
|
|
9267
|
+
case 5:
|
|
9268
|
+
_context5.n = 1;
|
|
9269
|
+
break;
|
|
9270
|
+
case 6:
|
|
9271
|
+
return _context5.a(2, txHashes);
|
|
9272
|
+
}
|
|
9273
|
+
}, _callee5, this, [[2, 4]]);
|
|
9274
|
+
}));
|
|
9275
|
+
function batchRegisterDerivatives(_x6) {
|
|
9276
|
+
return _batchRegisterDerivatives.apply(this, arguments);
|
|
9277
|
+
}
|
|
9278
|
+
return batchRegisterDerivatives;
|
|
9279
|
+
}()
|
|
9280
|
+
/**
|
|
9281
|
+
* @deprecated This method is deprecated. Please use the {@link batchRegisterDerivatives} instead.
|
|
9282
|
+
* This method will be removed soon.
|
|
9283
|
+
* Batch registers a derivative directly with parent IP's license terms.
|
|
9284
|
+
*
|
|
9285
|
+
* @example Migration Example
|
|
9286
|
+
* ```typescript
|
|
9287
|
+
* // Before (deprecated):
|
|
9288
|
+
* await client.ipAsset.batchRegisterDerivative({
|
|
9289
|
+
* args: [{ childIpId: '0x...', parentIpIds: ['0x...'], licenseTermsIds: [1n] }],
|
|
9290
|
+
* });
|
|
9291
|
+
*
|
|
9292
|
+
* // After (recommended):
|
|
9293
|
+
* await client.ipAsset.batchRegisterDerivatives({
|
|
9294
|
+
* requests: [{ childIpId: '0x...', parentIpIds: ['0x...'], licenseTermsIds: [1n] }],
|
|
9295
|
+
* });
|
|
9296
|
+
* ```
|
|
9297
|
+
*
|
|
9298
|
+
* @remarks This method does not support automatic fee handling for both ERC20 and WIP tokens.
|
|
9299
|
+
*/
|
|
9300
|
+
)
|
|
9301
|
+
}, {
|
|
9302
|
+
key: "batchRegisterDerivative",
|
|
9303
|
+
value: (function () {
|
|
9304
|
+
var _batchRegisterDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(request) {
|
|
9305
|
+
var contracts, licenseModuleAddress, _iterator2, _step2, _arg$maxMintingFee, _arg$maxRevenueShare, arg, calculatedDeadline, ipAccount, data, _yield$ipAccount$stat, state, signature, txHash, _t7, _t8, _t9;
|
|
9306
|
+
return _regenerator().w(function (_context6) {
|
|
9307
|
+
while (1) switch (_context6.p = _context6.n) {
|
|
9308
|
+
case 0:
|
|
9309
|
+
_context6.p = 0;
|
|
8790
9310
|
contracts = [];
|
|
8791
9311
|
licenseModuleAddress = validateAddress(this.licensingModuleClient.address);
|
|
8792
9312
|
_iterator2 = _createForOfIteratorHelper(request.args);
|
|
8793
|
-
|
|
9313
|
+
_context6.p = 1;
|
|
8794
9314
|
_iterator2.s();
|
|
8795
9315
|
case 2:
|
|
8796
9316
|
if ((_step2 = _iterator2.n()).done) {
|
|
8797
|
-
|
|
9317
|
+
_context6.n = 11;
|
|
8798
9318
|
break;
|
|
8799
9319
|
}
|
|
8800
9320
|
arg = _step2.value;
|
|
8801
|
-
|
|
8802
|
-
|
|
9321
|
+
_context6.p = 3;
|
|
9322
|
+
_context6.n = 4;
|
|
8803
9323
|
return this.registerDerivative(_objectSpread2(_objectSpread2({}, arg), {}, {
|
|
8804
9324
|
txOptions: {
|
|
8805
9325
|
encodedTxDataOnly: true
|
|
8806
9326
|
}
|
|
8807
9327
|
}));
|
|
8808
9328
|
case 4:
|
|
8809
|
-
|
|
9329
|
+
_context6.n = 6;
|
|
8810
9330
|
break;
|
|
8811
9331
|
case 5:
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
throw new Error(
|
|
9332
|
+
_context6.p = 5;
|
|
9333
|
+
_t7 = _context6.v;
|
|
9334
|
+
throw new Error(_t7.message.replace("Failed to register derivative:", "").trim());
|
|
8815
9335
|
case 6:
|
|
8816
|
-
|
|
9336
|
+
_context6.n = 7;
|
|
8817
9337
|
return getCalculatedDeadline(this.rpcClient, request.deadline);
|
|
8818
9338
|
case 7:
|
|
8819
|
-
calculatedDeadline =
|
|
9339
|
+
calculatedDeadline = _context6.v;
|
|
8820
9340
|
ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, validateAddress(arg.childIpId));
|
|
8821
9341
|
data = viem.encodeFunctionData({
|
|
8822
9342
|
abi: licensingModuleAbi,
|
|
@@ -8825,12 +9345,12 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8825
9345
|
return BigInt(id);
|
|
8826
9346
|
}), arg.licenseTemplate || this.licenseTemplateAddress, viem.zeroAddress, BigInt((_arg$maxMintingFee = arg.maxMintingFee) !== null && _arg$maxMintingFee !== void 0 ? _arg$maxMintingFee : 0), validateMaxRts(arg.maxRts), getRevenueShare((_arg$maxRevenueShare = arg.maxRevenueShare) !== null && _arg$maxRevenueShare !== void 0 ? _arg$maxRevenueShare : 100, RevShareType.MAX_REVENUE_SHARE)]
|
|
8827
9347
|
});
|
|
8828
|
-
|
|
9348
|
+
_context6.n = 8;
|
|
8829
9349
|
return ipAccount.state();
|
|
8830
9350
|
case 8:
|
|
8831
|
-
_yield$ipAccount$stat =
|
|
9351
|
+
_yield$ipAccount$stat = _context6.v;
|
|
8832
9352
|
state = _yield$ipAccount$stat.result;
|
|
8833
|
-
|
|
9353
|
+
_context6.n = 9;
|
|
8834
9354
|
return generateOperationSignature({
|
|
8835
9355
|
ipIdAddress: arg.childIpId,
|
|
8836
9356
|
methodType: SignatureMethodType.BATCH_REGISTER_DERIVATIVE,
|
|
@@ -8841,7 +9361,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8841
9361
|
chainId: this.chainId
|
|
8842
9362
|
});
|
|
8843
9363
|
case 9:
|
|
8844
|
-
signature =
|
|
9364
|
+
signature = _context6.v;
|
|
8845
9365
|
contracts.push({
|
|
8846
9366
|
target: arg.childIpId,
|
|
8847
9367
|
allowFailure: false,
|
|
@@ -8852,42 +9372,42 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8852
9372
|
})
|
|
8853
9373
|
});
|
|
8854
9374
|
case 10:
|
|
8855
|
-
|
|
9375
|
+
_context6.n = 2;
|
|
8856
9376
|
break;
|
|
8857
9377
|
case 11:
|
|
8858
|
-
|
|
9378
|
+
_context6.n = 13;
|
|
8859
9379
|
break;
|
|
8860
9380
|
case 12:
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
_iterator2.e(
|
|
9381
|
+
_context6.p = 12;
|
|
9382
|
+
_t8 = _context6.v;
|
|
9383
|
+
_iterator2.e(_t8);
|
|
8864
9384
|
case 13:
|
|
8865
|
-
|
|
9385
|
+
_context6.p = 13;
|
|
8866
9386
|
_iterator2.f();
|
|
8867
|
-
return
|
|
9387
|
+
return _context6.f(13);
|
|
8868
9388
|
case 14:
|
|
8869
|
-
|
|
9389
|
+
_context6.n = 15;
|
|
8870
9390
|
return this.multicall3Client.aggregate3({
|
|
8871
9391
|
calls: contracts
|
|
8872
9392
|
});
|
|
8873
9393
|
case 15:
|
|
8874
|
-
txHash =
|
|
8875
|
-
|
|
9394
|
+
txHash = _context6.v;
|
|
9395
|
+
_context6.n = 16;
|
|
8876
9396
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
8877
9397
|
hash: txHash
|
|
8878
9398
|
}));
|
|
8879
9399
|
case 16:
|
|
8880
|
-
return
|
|
9400
|
+
return _context6.a(2, {
|
|
8881
9401
|
txHash: txHash
|
|
8882
9402
|
});
|
|
8883
9403
|
case 17:
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
return
|
|
9404
|
+
_context6.p = 17;
|
|
9405
|
+
_t9 = _context6.v;
|
|
9406
|
+
return _context6.a(2, handleError(_t9, "Failed to batch register derivative"));
|
|
8887
9407
|
}
|
|
8888
|
-
},
|
|
9408
|
+
}, _callee6, this, [[3, 5], [1, 12, 13, 14], [0, 17]]);
|
|
8889
9409
|
}));
|
|
8890
|
-
function batchRegisterDerivative(
|
|
9410
|
+
function batchRegisterDerivative(_x7) {
|
|
8891
9411
|
return _batchRegisterDerivative.apply(this, arguments);
|
|
8892
9412
|
}
|
|
8893
9413
|
return batchRegisterDerivative;
|
|
@@ -8919,12 +9439,12 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8919
9439
|
}, {
|
|
8920
9440
|
key: "registerDerivativeWithLicenseTokens",
|
|
8921
9441
|
value: (function () {
|
|
8922
|
-
var _registerDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
8923
|
-
var _request$txOptions3, req, isChildIpIdRegistered, txHash,
|
|
8924
|
-
return _regenerator().w(function (
|
|
8925
|
-
while (1) switch (
|
|
9442
|
+
var _registerDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(request) {
|
|
9443
|
+
var _request$txOptions3, req, isChildIpIdRegistered, txHash, _t0;
|
|
9444
|
+
return _regenerator().w(function (_context7) {
|
|
9445
|
+
while (1) switch (_context7.p = _context7.n) {
|
|
8926
9446
|
case 0:
|
|
8927
|
-
|
|
9447
|
+
_context7.p = 0;
|
|
8928
9448
|
req = {
|
|
8929
9449
|
childIpId: validateAddress(request.childIpId),
|
|
8930
9450
|
licenseTokenIds: request.licenseTokenIds.map(function (id) {
|
|
@@ -8933,59 +9453,59 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
8933
9453
|
royaltyContext: viem.zeroAddress,
|
|
8934
9454
|
maxRts: validateMaxRts(request.maxRts)
|
|
8935
9455
|
};
|
|
8936
|
-
|
|
9456
|
+
_context7.n = 1;
|
|
8937
9457
|
return this.isRegistered(request.childIpId);
|
|
8938
9458
|
case 1:
|
|
8939
|
-
isChildIpIdRegistered =
|
|
9459
|
+
isChildIpIdRegistered = _context7.v;
|
|
8940
9460
|
if (isChildIpIdRegistered) {
|
|
8941
|
-
|
|
9461
|
+
_context7.n = 2;
|
|
8942
9462
|
break;
|
|
8943
9463
|
}
|
|
8944
9464
|
throw new Error("The child IP with id ".concat(request.childIpId, " is not registered."));
|
|
8945
9465
|
case 2:
|
|
8946
9466
|
if (!(request.licenseTokenIds.length === 0)) {
|
|
8947
|
-
|
|
9467
|
+
_context7.n = 3;
|
|
8948
9468
|
break;
|
|
8949
9469
|
}
|
|
8950
9470
|
throw new Error("The licenseTokenIds must be provided.");
|
|
8951
9471
|
case 3:
|
|
8952
|
-
|
|
9472
|
+
_context7.n = 4;
|
|
8953
9473
|
return this.validateLicenseTokenIds(request.licenseTokenIds);
|
|
8954
9474
|
case 4:
|
|
8955
|
-
request.licenseTokenIds =
|
|
9475
|
+
request.licenseTokenIds = _context7.v;
|
|
8956
9476
|
if (!((_request$txOptions3 = request.txOptions) !== null && _request$txOptions3 !== void 0 && _request$txOptions3.encodedTxDataOnly)) {
|
|
8957
|
-
|
|
9477
|
+
_context7.n = 5;
|
|
8958
9478
|
break;
|
|
8959
9479
|
}
|
|
8960
|
-
return
|
|
9480
|
+
return _context7.a(2, {
|
|
8961
9481
|
encodedTxData: this.licensingModuleClient.registerDerivativeWithLicenseTokensEncode(req)
|
|
8962
9482
|
});
|
|
8963
9483
|
case 5:
|
|
8964
|
-
|
|
9484
|
+
_context7.n = 6;
|
|
8965
9485
|
return this.licensingModuleClient.registerDerivativeWithLicenseTokens(req);
|
|
8966
9486
|
case 6:
|
|
8967
|
-
txHash =
|
|
8968
|
-
|
|
9487
|
+
txHash = _context7.v;
|
|
9488
|
+
_context7.n = 7;
|
|
8969
9489
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
8970
9490
|
hash: txHash
|
|
8971
9491
|
}));
|
|
8972
9492
|
case 7:
|
|
8973
|
-
return
|
|
9493
|
+
return _context7.a(2, {
|
|
8974
9494
|
txHash: txHash
|
|
8975
9495
|
});
|
|
8976
9496
|
case 8:
|
|
8977
|
-
|
|
9497
|
+
_context7.n = 10;
|
|
8978
9498
|
break;
|
|
8979
9499
|
case 9:
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
return
|
|
9500
|
+
_context7.p = 9;
|
|
9501
|
+
_t0 = _context7.v;
|
|
9502
|
+
return _context7.a(2, handleError(_t0, "Failed to register derivative with license tokens"));
|
|
8983
9503
|
case 10:
|
|
8984
|
-
return
|
|
9504
|
+
return _context7.a(2);
|
|
8985
9505
|
}
|
|
8986
|
-
},
|
|
9506
|
+
}, _callee7, this, [[0, 9]]);
|
|
8987
9507
|
}));
|
|
8988
|
-
function registerDerivativeWithLicenseTokens(
|
|
9508
|
+
function registerDerivativeWithLicenseTokens(_x8) {
|
|
8989
9509
|
return _registerDerivativeWithLicenseTokens.apply(this, arguments);
|
|
8990
9510
|
}
|
|
8991
9511
|
return registerDerivativeWithLicenseTokens;
|
|
@@ -9017,14 +9537,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9017
9537
|
}, {
|
|
9018
9538
|
key: "mintAndRegisterIpAssetWithPilTerms",
|
|
9019
9539
|
value: (function () {
|
|
9020
|
-
var _mintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
9021
|
-
var
|
|
9022
|
-
var _request$txOptions4, _yield$transformRegis, transformRequest, encodedTxData, contractCall, rsp, computedLicenseTermsIds, maxLicenseTokensTxHashes,
|
|
9023
|
-
return _regenerator().w(function (
|
|
9024
|
-
while (1) switch (
|
|
9540
|
+
var _mintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(request) {
|
|
9541
|
+
var _this2 = this;
|
|
9542
|
+
var _request$txOptions4, _yield$transformRegis, transformRequest, encodedTxData, contractCall, rsp, computedLicenseTermsIds, maxLicenseTokensTxHashes, _t1;
|
|
9543
|
+
return _regenerator().w(function (_context8) {
|
|
9544
|
+
while (1) switch (_context8.p = _context8.n) {
|
|
9025
9545
|
case 0:
|
|
9026
|
-
|
|
9027
|
-
|
|
9546
|
+
_context8.p = 0;
|
|
9547
|
+
_context8.n = 1;
|
|
9028
9548
|
return transformRegistrationRequest({
|
|
9029
9549
|
request: request,
|
|
9030
9550
|
rpcClient: this.rpcClient,
|
|
@@ -9032,21 +9552,21 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9032
9552
|
chainId: this.chainId
|
|
9033
9553
|
});
|
|
9034
9554
|
case 1:
|
|
9035
|
-
_yield$transformRegis =
|
|
9555
|
+
_yield$transformRegis = _context8.v;
|
|
9036
9556
|
transformRequest = _yield$transformRegis.transformRequest;
|
|
9037
9557
|
encodedTxData = this.licenseAttachmentWorkflowsClient.mintAndRegisterIpAndAttachPilTermsEncode(transformRequest);
|
|
9038
9558
|
if (!((_request$txOptions4 = request.txOptions) !== null && _request$txOptions4 !== void 0 && _request$txOptions4.encodedTxDataOnly)) {
|
|
9039
|
-
|
|
9559
|
+
_context8.n = 2;
|
|
9040
9560
|
break;
|
|
9041
9561
|
}
|
|
9042
|
-
return
|
|
9562
|
+
return _context8.a(2, {
|
|
9043
9563
|
encodedTxData: encodedTxData
|
|
9044
9564
|
});
|
|
9045
9565
|
case 2:
|
|
9046
9566
|
contractCall = function contractCall() {
|
|
9047
|
-
return
|
|
9567
|
+
return _this2.licenseAttachmentWorkflowsClient.mintAndRegisterIpAndAttachPilTerms(transformRequest);
|
|
9048
9568
|
};
|
|
9049
|
-
|
|
9569
|
+
_context8.n = 3;
|
|
9050
9570
|
return this.handleRegistrationWithFees({
|
|
9051
9571
|
options: request.options,
|
|
9052
9572
|
sender: this.walletAddress,
|
|
@@ -9057,14 +9577,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9057
9577
|
txOptions: request.txOptions
|
|
9058
9578
|
});
|
|
9059
9579
|
case 3:
|
|
9060
|
-
rsp =
|
|
9061
|
-
|
|
9580
|
+
rsp = _context8.v;
|
|
9581
|
+
_context8.n = 4;
|
|
9062
9582
|
return this.getLicenseTermsId(transformRequest.licenseTermsData.map(function (data) {
|
|
9063
9583
|
return data.terms;
|
|
9064
9584
|
}));
|
|
9065
9585
|
case 4:
|
|
9066
|
-
computedLicenseTermsIds =
|
|
9067
|
-
|
|
9586
|
+
computedLicenseTermsIds = _context8.v;
|
|
9587
|
+
_context8.n = 5;
|
|
9068
9588
|
return setMaxLicenseTokens({
|
|
9069
9589
|
maxLicenseTokensData: request.licenseTermsData,
|
|
9070
9590
|
licensorIpId: rsp.ipId,
|
|
@@ -9073,20 +9593,20 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9073
9593
|
templateAddress: this.licenseTemplateAddress
|
|
9074
9594
|
});
|
|
9075
9595
|
case 5:
|
|
9076
|
-
maxLicenseTokensTxHashes =
|
|
9077
|
-
return
|
|
9596
|
+
maxLicenseTokensTxHashes = _context8.v;
|
|
9597
|
+
return _context8.a(2, _objectSpread2(_objectSpread2({}, rsp), {}, {
|
|
9078
9598
|
licenseTermsIds: computedLicenseTermsIds
|
|
9079
9599
|
}, maxLicenseTokensTxHashes.length > 0 && {
|
|
9080
9600
|
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
|
9081
9601
|
}));
|
|
9082
9602
|
case 6:
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
return
|
|
9603
|
+
_context8.p = 6;
|
|
9604
|
+
_t1 = _context8.v;
|
|
9605
|
+
return _context8.a(2, handleError(_t1, "Failed to mint and register IP and attach PIL terms"));
|
|
9086
9606
|
}
|
|
9087
|
-
},
|
|
9607
|
+
}, _callee8, this, [[0, 6]]);
|
|
9088
9608
|
}));
|
|
9089
|
-
function mintAndRegisterIpAssetWithPilTerms(
|
|
9609
|
+
function mintAndRegisterIpAssetWithPilTerms(_x9) {
|
|
9090
9610
|
return _mintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
|
|
9091
9611
|
}
|
|
9092
9612
|
return mintAndRegisterIpAssetWithPilTerms;
|
|
@@ -9094,64 +9614,68 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9094
9614
|
/**
|
|
9095
9615
|
* Batch mint an NFT from a collection and register it as an IP.
|
|
9096
9616
|
*
|
|
9617
|
+
* @remark For better gas efficiency, consider using {@link batchRegisterIpAssetsWithOptimizedWorkflows} instead.
|
|
9618
|
+
* The optimized workflows method provides intelligent transaction batching, automatic token handling.
|
|
9619
|
+
*
|
|
9097
9620
|
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} and {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicensingModule.sol#L19 | `LicenseTermsAttached`} events.
|
|
9098
9621
|
*/
|
|
9099
9622
|
)
|
|
9100
9623
|
}, {
|
|
9101
9624
|
key: "batchMintAndRegisterIpAssetWithPilTerms",
|
|
9102
9625
|
value: (function () {
|
|
9103
|
-
var _batchMintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
9104
|
-
var
|
|
9105
|
-
|
|
9106
|
-
|
|
9626
|
+
var _batchMintAndRegisterIpAssetWithPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(request) {
|
|
9627
|
+
var _this3 = this;
|
|
9628
|
+
var calldata, _iterator3, _step3, arg, result, txHash, txReceipt, results, _loop, j, _t10, _t11;
|
|
9629
|
+
return _regenerator().w(function (_context0) {
|
|
9630
|
+
while (1) switch (_context0.p = _context0.n) {
|
|
9107
9631
|
case 0:
|
|
9108
|
-
|
|
9632
|
+
_context0.p = 0;
|
|
9109
9633
|
calldata = [];
|
|
9110
9634
|
_iterator3 = _createForOfIteratorHelper(request.args);
|
|
9111
|
-
|
|
9635
|
+
_context0.p = 1;
|
|
9112
9636
|
_iterator3.s();
|
|
9113
9637
|
case 2:
|
|
9114
9638
|
if ((_step3 = _iterator3.n()).done) {
|
|
9115
|
-
|
|
9639
|
+
_context0.n = 5;
|
|
9116
9640
|
break;
|
|
9117
9641
|
}
|
|
9118
9642
|
arg = _step3.value;
|
|
9119
|
-
|
|
9643
|
+
_context0.n = 3;
|
|
9120
9644
|
return this.mintAndRegisterIpAssetWithPilTerms(_objectSpread2(_objectSpread2({}, arg), {}, {
|
|
9121
9645
|
txOptions: {
|
|
9122
9646
|
encodedTxDataOnly: true
|
|
9123
9647
|
}
|
|
9124
9648
|
}));
|
|
9125
9649
|
case 3:
|
|
9126
|
-
result =
|
|
9650
|
+
result = _context0.v;
|
|
9127
9651
|
calldata.push(result.encodedTxData.data);
|
|
9128
9652
|
case 4:
|
|
9129
|
-
|
|
9653
|
+
_context0.n = 2;
|
|
9130
9654
|
break;
|
|
9131
9655
|
case 5:
|
|
9132
|
-
|
|
9656
|
+
_context0.n = 7;
|
|
9133
9657
|
break;
|
|
9134
9658
|
case 6:
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
_iterator3.e(
|
|
9659
|
+
_context0.p = 6;
|
|
9660
|
+
_t10 = _context0.v;
|
|
9661
|
+
_iterator3.e(_t10);
|
|
9138
9662
|
case 7:
|
|
9139
|
-
|
|
9663
|
+
_context0.p = 7;
|
|
9140
9664
|
_iterator3.f();
|
|
9141
|
-
return
|
|
9665
|
+
return _context0.f(7);
|
|
9142
9666
|
case 8:
|
|
9143
|
-
|
|
9667
|
+
_context0.n = 9;
|
|
9144
9668
|
return this.licenseAttachmentWorkflowsClient.multicall({
|
|
9145
9669
|
data: calldata
|
|
9146
9670
|
});
|
|
9147
9671
|
case 9:
|
|
9148
|
-
txHash =
|
|
9149
|
-
|
|
9672
|
+
txHash = _context0.v;
|
|
9673
|
+
_context0.n = 10;
|
|
9150
9674
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
9151
9675
|
hash: txHash
|
|
9152
9676
|
}));
|
|
9153
9677
|
case 10:
|
|
9154
|
-
txReceipt =
|
|
9678
|
+
txReceipt = _context0.v;
|
|
9155
9679
|
results = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt).map(function (log) {
|
|
9156
9680
|
return {
|
|
9157
9681
|
ipId: log.ipId,
|
|
@@ -9159,54 +9683,80 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9159
9683
|
spgNftContract: log.tokenContract,
|
|
9160
9684
|
licenseTermsIds: []
|
|
9161
9685
|
};
|
|
9162
|
-
}); //
|
|
9686
|
+
}); // Get license terms id and max license tokens mapping relationship by the sequence of the request.args
|
|
9687
|
+
_loop = /*#__PURE__*/_regenerator().m(function _loop() {
|
|
9688
|
+
var licenseTerms, termsIndexes, licenseTermsData, licenseTermsIds, i, licenseTermsDataInput, validatedTerms, resolvedIds, filteredLicenseTermsIds, maxLicenseTokensTxHashes;
|
|
9689
|
+
return _regenerator().w(function (_context9) {
|
|
9690
|
+
while (1) switch (_context9.n) {
|
|
9691
|
+
case 0:
|
|
9692
|
+
licenseTerms = [];
|
|
9693
|
+
termsIndexes = [];
|
|
9694
|
+
licenseTermsData = request.args[j].licenseTermsData;
|
|
9695
|
+
licenseTermsIds = new Array(licenseTermsData.length).fill(null);
|
|
9696
|
+
for (i = 0; i < licenseTermsData.length; i++) {
|
|
9697
|
+
licenseTermsDataInput = licenseTermsData[i];
|
|
9698
|
+
if (licenseTermsDataInput.terms) {
|
|
9699
|
+
validatedTerms = PILFlavor.validateLicenseTerms(licenseTermsDataInput.terms, _this3.chainId);
|
|
9700
|
+
validatedTerms.commercialRevShare = getRevenueShare(validatedTerms.commercialRevShare);
|
|
9701
|
+
licenseTerms.push(validatedTerms);
|
|
9702
|
+
termsIndexes.push(i);
|
|
9703
|
+
} else if (licenseTermsDataInput.licenseTermsId !== undefined) {
|
|
9704
|
+
licenseTermsIds[i] = BigInt(licenseTermsDataInput.licenseTermsId);
|
|
9705
|
+
}
|
|
9706
|
+
}
|
|
9707
|
+
_context9.n = 1;
|
|
9708
|
+
return _this3.getLicenseTermsId(licenseTerms);
|
|
9709
|
+
case 1:
|
|
9710
|
+
resolvedIds = _context9.v;
|
|
9711
|
+
termsIndexes.forEach(function (value, index) {
|
|
9712
|
+
licenseTermsIds[value] = resolvedIds[index];
|
|
9713
|
+
});
|
|
9714
|
+
filteredLicenseTermsIds = licenseTermsIds.filter(function (id) {
|
|
9715
|
+
return id !== null;
|
|
9716
|
+
});
|
|
9717
|
+
results[j].licenseTermsIds = filteredLicenseTermsIds;
|
|
9718
|
+
_context9.n = 2;
|
|
9719
|
+
return setMaxLicenseTokens({
|
|
9720
|
+
maxLicenseTokensData: licenseTermsData,
|
|
9721
|
+
licensorIpId: results[j].ipId,
|
|
9722
|
+
licenseTermsIds: filteredLicenseTermsIds,
|
|
9723
|
+
totalLicenseTokenLimitHookClient: _this3.totalLicenseTokenLimitHookClient,
|
|
9724
|
+
templateAddress: _this3.licenseTemplateAddress
|
|
9725
|
+
});
|
|
9726
|
+
case 2:
|
|
9727
|
+
maxLicenseTokensTxHashes = _context9.v;
|
|
9728
|
+
if (maxLicenseTokensTxHashes.length > 0) {
|
|
9729
|
+
results[j].maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
|
|
9730
|
+
}
|
|
9731
|
+
case 3:
|
|
9732
|
+
return _context9.a(2);
|
|
9733
|
+
}
|
|
9734
|
+
}, _loop);
|
|
9735
|
+
});
|
|
9163
9736
|
j = 0;
|
|
9164
9737
|
case 11:
|
|
9165
9738
|
if (!(j < request.args.length)) {
|
|
9166
|
-
|
|
9739
|
+
_context0.n = 13;
|
|
9167
9740
|
break;
|
|
9168
9741
|
}
|
|
9169
|
-
|
|
9170
|
-
licenseTermsData = request.args[j].licenseTermsData;
|
|
9171
|
-
for (i = 0; i < licenseTermsData.length; i++) {
|
|
9172
|
-
licenseTerm = PILFlavor.validateLicenseTerms(licenseTermsData[i].terms, this.chainId);
|
|
9173
|
-
licenseTerms.push(licenseTerm);
|
|
9174
|
-
}
|
|
9175
|
-
_context8.n = 12;
|
|
9176
|
-
return this.getLicenseTermsId(licenseTerms);
|
|
9742
|
+
return _context0.d(_regeneratorValues(_loop()), 12);
|
|
9177
9743
|
case 12:
|
|
9178
|
-
licenseTermsIds = _context8.v;
|
|
9179
|
-
results[j].licenseTermsIds = licenseTermsIds;
|
|
9180
|
-
_context8.n = 13;
|
|
9181
|
-
return setMaxLicenseTokens({
|
|
9182
|
-
maxLicenseTokensData: licenseTermsData,
|
|
9183
|
-
licensorIpId: results[j].ipId,
|
|
9184
|
-
licenseTermsIds: licenseTermsIds,
|
|
9185
|
-
totalLicenseTokenLimitHookClient: this.totalLicenseTokenLimitHookClient,
|
|
9186
|
-
templateAddress: this.licenseTemplateAddress
|
|
9187
|
-
});
|
|
9188
|
-
case 13:
|
|
9189
|
-
maxLicenseTokensTxHashes = _context8.v;
|
|
9190
|
-
if (maxLicenseTokensTxHashes.length > 0) {
|
|
9191
|
-
results[j].maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
|
|
9192
|
-
}
|
|
9193
|
-
case 14:
|
|
9194
9744
|
j++;
|
|
9195
|
-
|
|
9745
|
+
_context0.n = 11;
|
|
9196
9746
|
break;
|
|
9197
|
-
case
|
|
9198
|
-
return
|
|
9747
|
+
case 13:
|
|
9748
|
+
return _context0.a(2, {
|
|
9199
9749
|
txHash: txHash,
|
|
9200
9750
|
results: results
|
|
9201
9751
|
});
|
|
9202
|
-
case
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
return
|
|
9752
|
+
case 14:
|
|
9753
|
+
_context0.p = 14;
|
|
9754
|
+
_t11 = _context0.v;
|
|
9755
|
+
return _context0.a(2, handleError(_t11, "Failed to batch mint and register IP and attach PIL terms"));
|
|
9206
9756
|
}
|
|
9207
|
-
},
|
|
9757
|
+
}, _callee9, this, [[1, 6, 7, 8], [0, 14]]);
|
|
9208
9758
|
}));
|
|
9209
|
-
function batchMintAndRegisterIpAssetWithPilTerms(
|
|
9759
|
+
function batchMintAndRegisterIpAssetWithPilTerms(_x0) {
|
|
9210
9760
|
return _batchMintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
|
|
9211
9761
|
}
|
|
9212
9762
|
return batchMintAndRegisterIpAssetWithPilTerms;
|
|
@@ -9239,14 +9789,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9239
9789
|
}, {
|
|
9240
9790
|
key: "registerIpAndAttachPilTerms",
|
|
9241
9791
|
value: (function () {
|
|
9242
|
-
var _registerIpAndAttachPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
9243
|
-
var _request$txOptions5, ipIdAddress, isRegistered, _yield$validateLicens, licenseTerms, _yield$transformRegis2, _transformRequest, txHash, txReceipt, log, licenseTermsIds, maxLicenseTokensTxHashes,
|
|
9244
|
-
return _regenerator().w(function (
|
|
9245
|
-
while (1) switch (
|
|
9792
|
+
var _registerIpAndAttachPilTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(request) {
|
|
9793
|
+
var _request$txOptions5, ipIdAddress, isRegistered, _yield$validateLicens, licenseTerms, _yield$transformRegis2, _transformRequest, txHash, txReceipt, log, licenseTermsIds, maxLicenseTokensTxHashes, _t12;
|
|
9794
|
+
return _regenerator().w(function (_context1) {
|
|
9795
|
+
while (1) switch (_context1.p = _context1.n) {
|
|
9246
9796
|
case 0:
|
|
9247
|
-
|
|
9797
|
+
_context1.p = 0;
|
|
9248
9798
|
request.tokenId = BigInt(request.tokenId);
|
|
9249
|
-
|
|
9799
|
+
_context1.n = 1;
|
|
9250
9800
|
return getIpIdAddress({
|
|
9251
9801
|
nftContract: request.nftContract,
|
|
9252
9802
|
tokenId: request.tokenId,
|
|
@@ -9255,23 +9805,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9255
9805
|
chainId: this.chainId
|
|
9256
9806
|
});
|
|
9257
9807
|
case 1:
|
|
9258
|
-
ipIdAddress =
|
|
9259
|
-
|
|
9808
|
+
ipIdAddress = _context1.v;
|
|
9809
|
+
_context1.n = 2;
|
|
9260
9810
|
return this.isRegistered(ipIdAddress);
|
|
9261
9811
|
case 2:
|
|
9262
|
-
isRegistered =
|
|
9812
|
+
isRegistered = _context1.v;
|
|
9263
9813
|
if (!isRegistered) {
|
|
9264
|
-
|
|
9814
|
+
_context1.n = 3;
|
|
9265
9815
|
break;
|
|
9266
9816
|
}
|
|
9267
9817
|
throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
|
|
9268
9818
|
case 3:
|
|
9269
|
-
|
|
9819
|
+
_context1.n = 4;
|
|
9270
9820
|
return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
|
|
9271
9821
|
case 4:
|
|
9272
|
-
_yield$validateLicens =
|
|
9822
|
+
_yield$validateLicens = _context1.v;
|
|
9273
9823
|
licenseTerms = _yield$validateLicens.licenseTerms;
|
|
9274
|
-
|
|
9824
|
+
_context1.n = 5;
|
|
9275
9825
|
return transformRegistrationRequest({
|
|
9276
9826
|
request: request,
|
|
9277
9827
|
rpcClient: this.rpcClient,
|
|
@@ -9279,32 +9829,32 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9279
9829
|
chainId: this.chainId
|
|
9280
9830
|
});
|
|
9281
9831
|
case 5:
|
|
9282
|
-
_yield$transformRegis2 =
|
|
9832
|
+
_yield$transformRegis2 = _context1.v;
|
|
9283
9833
|
_transformRequest = _yield$transformRegis2.transformRequest;
|
|
9284
9834
|
if (!((_request$txOptions5 = request.txOptions) !== null && _request$txOptions5 !== void 0 && _request$txOptions5.encodedTxDataOnly)) {
|
|
9285
|
-
|
|
9835
|
+
_context1.n = 6;
|
|
9286
9836
|
break;
|
|
9287
9837
|
}
|
|
9288
|
-
return
|
|
9838
|
+
return _context1.a(2, {
|
|
9289
9839
|
encodedTxData: this.licenseAttachmentWorkflowsClient.registerIpAndAttachPilTermsEncode(_transformRequest)
|
|
9290
9840
|
});
|
|
9291
9841
|
case 6:
|
|
9292
|
-
|
|
9842
|
+
_context1.n = 7;
|
|
9293
9843
|
return this.licenseAttachmentWorkflowsClient.registerIpAndAttachPilTerms(_transformRequest);
|
|
9294
9844
|
case 7:
|
|
9295
|
-
txHash =
|
|
9296
|
-
|
|
9845
|
+
txHash = _context1.v;
|
|
9846
|
+
_context1.n = 8;
|
|
9297
9847
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
9298
9848
|
hash: txHash
|
|
9299
9849
|
}));
|
|
9300
9850
|
case 8:
|
|
9301
|
-
txReceipt =
|
|
9851
|
+
txReceipt = _context1.v;
|
|
9302
9852
|
log = this.getIpIdAndTokenIdsFromEvent(txReceipt)[0];
|
|
9303
|
-
|
|
9853
|
+
_context1.n = 9;
|
|
9304
9854
|
return this.getLicenseTermsId(licenseTerms);
|
|
9305
9855
|
case 9:
|
|
9306
|
-
licenseTermsIds =
|
|
9307
|
-
|
|
9856
|
+
licenseTermsIds = _context1.v;
|
|
9857
|
+
_context1.n = 10;
|
|
9308
9858
|
return setMaxLicenseTokens({
|
|
9309
9859
|
maxLicenseTokensData: request.licenseTermsData,
|
|
9310
9860
|
licensorIpId: log.ipId,
|
|
@@ -9313,26 +9863,26 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9313
9863
|
templateAddress: this.licenseTemplateAddress
|
|
9314
9864
|
});
|
|
9315
9865
|
case 10:
|
|
9316
|
-
maxLicenseTokensTxHashes =
|
|
9317
|
-
return
|
|
9866
|
+
maxLicenseTokensTxHashes = _context1.v;
|
|
9867
|
+
return _context1.a(2, _objectSpread2(_objectSpread2({
|
|
9318
9868
|
txHash: txHash,
|
|
9319
9869
|
licenseTermsIds: licenseTermsIds
|
|
9320
9870
|
}, maxLicenseTokensTxHashes.length > 0 && {
|
|
9321
9871
|
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
|
9322
9872
|
}), log));
|
|
9323
9873
|
case 11:
|
|
9324
|
-
|
|
9874
|
+
_context1.n = 13;
|
|
9325
9875
|
break;
|
|
9326
9876
|
case 12:
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
return
|
|
9877
|
+
_context1.p = 12;
|
|
9878
|
+
_t12 = _context1.v;
|
|
9879
|
+
return _context1.a(2, handleError(_t12, "Failed to register IP and attach PIL terms"));
|
|
9330
9880
|
case 13:
|
|
9331
|
-
return
|
|
9881
|
+
return _context1.a(2);
|
|
9332
9882
|
}
|
|
9333
|
-
},
|
|
9883
|
+
}, _callee0, this, [[0, 12]]);
|
|
9334
9884
|
}));
|
|
9335
|
-
function registerIpAndAttachPilTerms(
|
|
9885
|
+
function registerIpAndAttachPilTerms(_x1) {
|
|
9336
9886
|
return _registerIpAndAttachPilTerms.apply(this, arguments);
|
|
9337
9887
|
}
|
|
9338
9888
|
return registerIpAndAttachPilTerms;
|
|
@@ -9365,15 +9915,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9365
9915
|
}, {
|
|
9366
9916
|
key: "registerDerivativeIp",
|
|
9367
9917
|
value: (function () {
|
|
9368
|
-
var _registerDerivativeIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
9918
|
+
var _registerDerivativeIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(request) {
|
|
9369
9919
|
var _this4 = this;
|
|
9370
|
-
var _request$txOptions6, _request$
|
|
9371
|
-
return _regenerator().w(function (
|
|
9372
|
-
while (1) switch (
|
|
9920
|
+
var _request$txOptions6, _request$options, tokenId, ipIdAddress, isRegistered, _yield$transformRegis3, _transformRequest2, encodedTxData, contractCall, _t13;
|
|
9921
|
+
return _regenerator().w(function (_context10) {
|
|
9922
|
+
while (1) switch (_context10.p = _context10.n) {
|
|
9373
9923
|
case 0:
|
|
9374
|
-
|
|
9924
|
+
_context10.p = 0;
|
|
9375
9925
|
tokenId = BigInt(request.tokenId);
|
|
9376
|
-
|
|
9926
|
+
_context10.n = 1;
|
|
9377
9927
|
return getIpIdAddress({
|
|
9378
9928
|
nftContract: request.nftContract,
|
|
9379
9929
|
tokenId: tokenId,
|
|
@@ -9382,18 +9932,18 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9382
9932
|
chainId: this.chainId
|
|
9383
9933
|
});
|
|
9384
9934
|
case 1:
|
|
9385
|
-
ipIdAddress =
|
|
9386
|
-
|
|
9935
|
+
ipIdAddress = _context10.v;
|
|
9936
|
+
_context10.n = 2;
|
|
9387
9937
|
return this.isRegistered(ipIdAddress);
|
|
9388
9938
|
case 2:
|
|
9389
|
-
isRegistered =
|
|
9939
|
+
isRegistered = _context10.v;
|
|
9390
9940
|
if (!isRegistered) {
|
|
9391
|
-
|
|
9941
|
+
_context10.n = 3;
|
|
9392
9942
|
break;
|
|
9393
9943
|
}
|
|
9394
9944
|
throw new Error("The NFT with id ".concat(tokenId, " is already registered as IP."));
|
|
9395
9945
|
case 3:
|
|
9396
|
-
|
|
9946
|
+
_context10.n = 4;
|
|
9397
9947
|
return transformRegistrationRequest({
|
|
9398
9948
|
request: request,
|
|
9399
9949
|
rpcClient: this.rpcClient,
|
|
@@ -9401,23 +9951,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9401
9951
|
chainId: this.chainId
|
|
9402
9952
|
});
|
|
9403
9953
|
case 4:
|
|
9404
|
-
_yield$transformRegis3 =
|
|
9954
|
+
_yield$transformRegis3 = _context10.v;
|
|
9405
9955
|
_transformRequest2 = _yield$transformRegis3.transformRequest;
|
|
9406
9956
|
encodedTxData = this.derivativeWorkflowsClient.registerIpAndMakeDerivativeEncode(_transformRequest2);
|
|
9407
9957
|
if (!((_request$txOptions6 = request.txOptions) !== null && _request$txOptions6 !== void 0 && _request$txOptions6.encodedTxDataOnly)) {
|
|
9408
|
-
|
|
9958
|
+
_context10.n = 5;
|
|
9409
9959
|
break;
|
|
9410
9960
|
}
|
|
9411
|
-
return
|
|
9961
|
+
return _context10.a(2, {
|
|
9412
9962
|
encodedTxData: encodedTxData
|
|
9413
9963
|
});
|
|
9414
9964
|
case 5:
|
|
9415
9965
|
contractCall = function contractCall() {
|
|
9416
9966
|
return _this4.derivativeWorkflowsClient.registerIpAndMakeDerivative(_transformRequest2);
|
|
9417
9967
|
};
|
|
9418
|
-
return
|
|
9968
|
+
return _context10.a(2, this.handleRegistrationWithFees({
|
|
9419
9969
|
options: _objectSpread2(_objectSpread2({}, request.options), {}, {
|
|
9420
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$
|
|
9970
|
+
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options = request.options) === null || _request$options === void 0 ? void 0 : _request$options.wipOptions), {}, {
|
|
9421
9971
|
useMulticallWhenPossible: false
|
|
9422
9972
|
})
|
|
9423
9973
|
}),
|
|
@@ -9429,13 +9979,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9429
9979
|
txOptions: request.txOptions
|
|
9430
9980
|
}));
|
|
9431
9981
|
case 6:
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
return
|
|
9982
|
+
_context10.p = 6;
|
|
9983
|
+
_t13 = _context10.v;
|
|
9984
|
+
return _context10.a(2, handleError(_t13, "Failed to register derivative IP"));
|
|
9435
9985
|
}
|
|
9436
|
-
},
|
|
9986
|
+
}, _callee1, this, [[0, 6]]);
|
|
9437
9987
|
}));
|
|
9438
|
-
function registerDerivativeIp(
|
|
9988
|
+
function registerDerivativeIp(_x10) {
|
|
9439
9989
|
return _registerDerivativeIp.apply(this, arguments);
|
|
9440
9990
|
}
|
|
9441
9991
|
return registerDerivativeIp;
|
|
@@ -9467,15 +10017,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9467
10017
|
}, {
|
|
9468
10018
|
key: "mintAndRegisterIpAndMakeDerivative",
|
|
9469
10019
|
value: (function () {
|
|
9470
|
-
var _mintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10020
|
+
var _mintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(request) {
|
|
9471
10021
|
var _this5 = this;
|
|
9472
|
-
var _request$txOptions7, spgNftContract, _yield$transformRegis4, _transformRequest3, encodedTxData, contractCall,
|
|
9473
|
-
return _regenerator().w(function (
|
|
9474
|
-
while (1) switch (
|
|
10022
|
+
var _request$txOptions7, spgNftContract, _yield$transformRegis4, _transformRequest3, encodedTxData, contractCall, _t14;
|
|
10023
|
+
return _regenerator().w(function (_context11) {
|
|
10024
|
+
while (1) switch (_context11.p = _context11.n) {
|
|
9475
10025
|
case 0:
|
|
9476
|
-
|
|
10026
|
+
_context11.p = 0;
|
|
9477
10027
|
spgNftContract = validateAddress(request.spgNftContract);
|
|
9478
|
-
|
|
10028
|
+
_context11.n = 1;
|
|
9479
10029
|
return transformRegistrationRequest({
|
|
9480
10030
|
request: request,
|
|
9481
10031
|
rpcClient: this.rpcClient,
|
|
@@ -9483,21 +10033,21 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9483
10033
|
chainId: this.chainId
|
|
9484
10034
|
});
|
|
9485
10035
|
case 1:
|
|
9486
|
-
_yield$transformRegis4 =
|
|
10036
|
+
_yield$transformRegis4 = _context11.v;
|
|
9487
10037
|
_transformRequest3 = _yield$transformRegis4.transformRequest;
|
|
9488
10038
|
encodedTxData = this.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeEncode(_transformRequest3);
|
|
9489
10039
|
if (!((_request$txOptions7 = request.txOptions) !== null && _request$txOptions7 !== void 0 && _request$txOptions7.encodedTxDataOnly)) {
|
|
9490
|
-
|
|
10040
|
+
_context11.n = 2;
|
|
9491
10041
|
break;
|
|
9492
10042
|
}
|
|
9493
|
-
return
|
|
10043
|
+
return _context11.a(2, {
|
|
9494
10044
|
encodedTxData: encodedTxData
|
|
9495
10045
|
});
|
|
9496
10046
|
case 2:
|
|
9497
10047
|
contractCall = function contractCall() {
|
|
9498
10048
|
return _this5.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivative(_transformRequest3);
|
|
9499
10049
|
};
|
|
9500
|
-
return
|
|
10050
|
+
return _context11.a(2, this.handleRegistrationWithFees({
|
|
9501
10051
|
options: request.options,
|
|
9502
10052
|
sender: this.walletAddress,
|
|
9503
10053
|
spgSpenderAddress: this.derivativeWorkflowsClient.address,
|
|
@@ -9508,13 +10058,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9508
10058
|
txOptions: request.txOptions
|
|
9509
10059
|
}));
|
|
9510
10060
|
case 3:
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
return
|
|
10061
|
+
_context11.p = 3;
|
|
10062
|
+
_t14 = _context11.v;
|
|
10063
|
+
return _context11.a(2, handleError(_t14, "Failed to mint and register IP and make derivative"));
|
|
9514
10064
|
}
|
|
9515
|
-
},
|
|
10065
|
+
}, _callee10, this, [[0, 3]]);
|
|
9516
10066
|
}));
|
|
9517
|
-
function mintAndRegisterIpAndMakeDerivative(
|
|
10067
|
+
function mintAndRegisterIpAndMakeDerivative(_x11) {
|
|
9518
10068
|
return _mintAndRegisterIpAndMakeDerivative.apply(this, arguments);
|
|
9519
10069
|
}
|
|
9520
10070
|
return mintAndRegisterIpAndMakeDerivative;
|
|
@@ -9522,83 +10072,86 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9522
10072
|
/**
|
|
9523
10073
|
* Batch mint an NFT from a collection and register it as a derivative IP without license tokens.
|
|
9524
10074
|
*
|
|
10075
|
+
* @remark For better gas efficiency, consider using {@link batchRegisterIpAssetsWithOptimizedWorkflows} instead.
|
|
10076
|
+
* The optimized workflows method provides intelligent transaction batching, automatic token handling.
|
|
10077
|
+
*
|
|
9525
10078
|
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
|
|
9526
10079
|
*/
|
|
9527
10080
|
)
|
|
9528
10081
|
}, {
|
|
9529
10082
|
key: "batchMintAndRegisterIpAndMakeDerivative",
|
|
9530
10083
|
value: (function () {
|
|
9531
|
-
var _batchMintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
9532
|
-
var calldata, _iterator4, _step4, arg, result, txHash, txReceipt,
|
|
9533
|
-
return _regenerator().w(function (
|
|
9534
|
-
while (1) switch (
|
|
10084
|
+
var _batchMintAndRegisterIpAndMakeDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(request) {
|
|
10085
|
+
var calldata, _iterator4, _step4, arg, result, txHash, txReceipt, _t15, _t16, _t17;
|
|
10086
|
+
return _regenerator().w(function (_context12) {
|
|
10087
|
+
while (1) switch (_context12.p = _context12.n) {
|
|
9535
10088
|
case 0:
|
|
9536
|
-
|
|
10089
|
+
_context12.p = 0;
|
|
9537
10090
|
calldata = [];
|
|
9538
10091
|
_iterator4 = _createForOfIteratorHelper(request.args);
|
|
9539
|
-
|
|
10092
|
+
_context12.p = 1;
|
|
9540
10093
|
_iterator4.s();
|
|
9541
10094
|
case 2:
|
|
9542
10095
|
if ((_step4 = _iterator4.n()).done) {
|
|
9543
|
-
|
|
10096
|
+
_context12.n = 7;
|
|
9544
10097
|
break;
|
|
9545
10098
|
}
|
|
9546
10099
|
arg = _step4.value;
|
|
9547
|
-
|
|
9548
|
-
|
|
10100
|
+
_context12.p = 3;
|
|
10101
|
+
_context12.n = 4;
|
|
9549
10102
|
return this.mintAndRegisterIpAndMakeDerivative(_objectSpread2(_objectSpread2({}, arg), {}, {
|
|
9550
10103
|
txOptions: {
|
|
9551
10104
|
encodedTxDataOnly: true
|
|
9552
10105
|
}
|
|
9553
10106
|
}));
|
|
9554
10107
|
case 4:
|
|
9555
|
-
result =
|
|
10108
|
+
result = _context12.v;
|
|
9556
10109
|
calldata.push(result.encodedTxData.data);
|
|
9557
|
-
|
|
10110
|
+
_context12.n = 6;
|
|
9558
10111
|
break;
|
|
9559
10112
|
case 5:
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
throw new Error(
|
|
10113
|
+
_context12.p = 5;
|
|
10114
|
+
_t15 = _context12.v;
|
|
10115
|
+
throw new Error(_t15.message.replace("Failed to mint and register IP and make derivative: ", "").trim());
|
|
9563
10116
|
case 6:
|
|
9564
|
-
|
|
10117
|
+
_context12.n = 2;
|
|
9565
10118
|
break;
|
|
9566
10119
|
case 7:
|
|
9567
|
-
|
|
10120
|
+
_context12.n = 9;
|
|
9568
10121
|
break;
|
|
9569
10122
|
case 8:
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
_iterator4.e(
|
|
10123
|
+
_context12.p = 8;
|
|
10124
|
+
_t16 = _context12.v;
|
|
10125
|
+
_iterator4.e(_t16);
|
|
9573
10126
|
case 9:
|
|
9574
|
-
|
|
10127
|
+
_context12.p = 9;
|
|
9575
10128
|
_iterator4.f();
|
|
9576
|
-
return
|
|
10129
|
+
return _context12.f(9);
|
|
9577
10130
|
case 10:
|
|
9578
|
-
|
|
10131
|
+
_context12.n = 11;
|
|
9579
10132
|
return this.derivativeWorkflowsClient.multicall({
|
|
9580
10133
|
data: calldata
|
|
9581
10134
|
});
|
|
9582
10135
|
case 11:
|
|
9583
|
-
txHash =
|
|
9584
|
-
|
|
10136
|
+
txHash = _context12.v;
|
|
10137
|
+
_context12.n = 12;
|
|
9585
10138
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
9586
10139
|
hash: txHash
|
|
9587
10140
|
}));
|
|
9588
10141
|
case 12:
|
|
9589
|
-
txReceipt =
|
|
9590
|
-
return
|
|
10142
|
+
txReceipt = _context12.v;
|
|
10143
|
+
return _context12.a(2, {
|
|
9591
10144
|
txHash: txHash,
|
|
9592
10145
|
results: this.getIpIdAndTokenIdsFromEvent(txReceipt, "spgNftContract")
|
|
9593
10146
|
});
|
|
9594
10147
|
case 13:
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
return
|
|
10148
|
+
_context12.p = 13;
|
|
10149
|
+
_t17 = _context12.v;
|
|
10150
|
+
return _context12.a(2, handleError(_t17, "Failed to batch mint and register IP and make derivative"));
|
|
9598
10151
|
}
|
|
9599
|
-
},
|
|
10152
|
+
}, _callee11, this, [[3, 5], [1, 8, 9, 10], [0, 13]]);
|
|
9600
10153
|
}));
|
|
9601
|
-
function batchMintAndRegisterIpAndMakeDerivative(
|
|
10154
|
+
function batchMintAndRegisterIpAndMakeDerivative(_x12) {
|
|
9602
10155
|
return _batchMintAndRegisterIpAndMakeDerivative.apply(this, arguments);
|
|
9603
10156
|
}
|
|
9604
10157
|
return batchMintAndRegisterIpAndMakeDerivative;
|
|
@@ -9629,52 +10182,52 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9629
10182
|
}, {
|
|
9630
10183
|
key: "mintAndRegisterIp",
|
|
9631
10184
|
value: (function () {
|
|
9632
|
-
var _mintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10185
|
+
var _mintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(request) {
|
|
9633
10186
|
var _this6 = this;
|
|
9634
|
-
var _request$txOptions8, _request$
|
|
9635
|
-
return _regenerator().w(function (
|
|
9636
|
-
while (1) switch (
|
|
10187
|
+
var _request$txOptions8, _request$options2, object, encodedTxData, contractCall, _t18;
|
|
10188
|
+
return _regenerator().w(function (_context13) {
|
|
10189
|
+
while (1) switch (_context13.p = _context13.n) {
|
|
9637
10190
|
case 0:
|
|
9638
|
-
|
|
9639
|
-
|
|
10191
|
+
_context13.p = 0;
|
|
10192
|
+
object = {
|
|
9640
10193
|
spgNftContract: validateAddress(request.spgNftContract),
|
|
9641
10194
|
recipient: validateAddress(request.recipient || this.walletAddress),
|
|
9642
10195
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
|
9643
10196
|
allowDuplicates: request.allowDuplicates || true
|
|
9644
10197
|
};
|
|
9645
|
-
encodedTxData = this.registrationWorkflowsClient.mintAndRegisterIpEncode(
|
|
10198
|
+
encodedTxData = this.registrationWorkflowsClient.mintAndRegisterIpEncode(object);
|
|
9646
10199
|
if (!((_request$txOptions8 = request.txOptions) !== null && _request$txOptions8 !== void 0 && _request$txOptions8.encodedTxDataOnly)) {
|
|
9647
|
-
|
|
10200
|
+
_context13.n = 1;
|
|
9648
10201
|
break;
|
|
9649
10202
|
}
|
|
9650
|
-
return
|
|
10203
|
+
return _context13.a(2, {
|
|
9651
10204
|
encodedTxData: encodedTxData
|
|
9652
10205
|
});
|
|
9653
10206
|
case 1:
|
|
9654
10207
|
contractCall = function contractCall() {
|
|
9655
|
-
return _this6.registrationWorkflowsClient.mintAndRegisterIp(
|
|
10208
|
+
return _this6.registrationWorkflowsClient.mintAndRegisterIp(object);
|
|
9656
10209
|
};
|
|
9657
|
-
return
|
|
10210
|
+
return _context13.a(2, this.handleRegistrationWithFees({
|
|
9658
10211
|
sender: this.walletAddress,
|
|
9659
10212
|
spgSpenderAddress: this.registrationWorkflowsClient.address,
|
|
9660
10213
|
encodedTxs: [encodedTxData],
|
|
9661
10214
|
contractCall: contractCall,
|
|
9662
|
-
spgNftContract:
|
|
10215
|
+
spgNftContract: object.spgNftContract,
|
|
9663
10216
|
txOptions: request.txOptions,
|
|
9664
10217
|
options: _objectSpread2(_objectSpread2({}, request.options), {}, {
|
|
9665
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$
|
|
10218
|
+
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options2 = request.options) === null || _request$options2 === void 0 ? void 0 : _request$options2.wipOptions), {}, {
|
|
9666
10219
|
useMulticallWhenPossible: false
|
|
9667
10220
|
})
|
|
9668
10221
|
})
|
|
9669
10222
|
}));
|
|
9670
10223
|
case 2:
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
return
|
|
10224
|
+
_context13.p = 2;
|
|
10225
|
+
_t18 = _context13.v;
|
|
10226
|
+
return _context13.a(2, handleError(_t18, "Failed to mint and register IP"));
|
|
9674
10227
|
}
|
|
9675
|
-
},
|
|
10228
|
+
}, _callee12, this, [[0, 2]]);
|
|
9676
10229
|
}));
|
|
9677
|
-
function mintAndRegisterIp(
|
|
10230
|
+
function mintAndRegisterIp(_x13) {
|
|
9678
10231
|
return _mintAndRegisterIp.apply(this, arguments);
|
|
9679
10232
|
}
|
|
9680
10233
|
return mintAndRegisterIp;
|
|
@@ -9698,23 +10251,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9698
10251
|
}, {
|
|
9699
10252
|
key: "batchMintAndRegisterIp",
|
|
9700
10253
|
value: (function () {
|
|
9701
|
-
var _batchMintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10254
|
+
var _batchMintAndRegisterIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(request) {
|
|
9702
10255
|
var _this7 = this;
|
|
9703
|
-
var publicMintEncodedTxs, publicMintSpenders, privateMintEncodedTxs, privateMintSpenders, _iterator5, _step5, req, registrationRequest, isPublicMinting, nftMintFee, encodeTx, isMinterRole, handlePublicMintTransactions, handlePrivateMintTransactions, transactionResponses, publicMintResponse, privateMintResponse,
|
|
9704
|
-
return _regenerator().w(function (
|
|
9705
|
-
while (1) switch (
|
|
10256
|
+
var publicMintEncodedTxs, publicMintSpenders, privateMintEncodedTxs, privateMintSpenders, _iterator5, _step5, req, registrationRequest, isPublicMinting, nftMintFee, encodeTx, isMinterRole, handlePublicMintTransactions, handlePrivateMintTransactions, transactionResponses, publicMintResponse, privateMintResponse, _t19, _t20, _t21, _t22;
|
|
10257
|
+
return _regenerator().w(function (_context16) {
|
|
10258
|
+
while (1) switch (_context16.p = _context16.n) {
|
|
9706
10259
|
case 0:
|
|
9707
|
-
|
|
10260
|
+
_context16.p = 0;
|
|
9708
10261
|
publicMintEncodedTxs = [];
|
|
9709
10262
|
publicMintSpenders = [];
|
|
9710
10263
|
privateMintEncodedTxs = [];
|
|
9711
10264
|
privateMintSpenders = [];
|
|
9712
10265
|
_iterator5 = _createForOfIteratorHelper(request.requests);
|
|
9713
|
-
|
|
10266
|
+
_context16.p = 1;
|
|
9714
10267
|
_iterator5.s();
|
|
9715
10268
|
case 2:
|
|
9716
10269
|
if ((_step5 = _iterator5.n()).done) {
|
|
9717
|
-
|
|
10270
|
+
_context16.n = 9;
|
|
9718
10271
|
break;
|
|
9719
10272
|
}
|
|
9720
10273
|
req = _step5.value;
|
|
@@ -9724,14 +10277,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9724
10277
|
ipMetadata: getIpMetadataForWorkflow(req.ipMetadata),
|
|
9725
10278
|
allowDuplicates: req.allowDuplicates || true
|
|
9726
10279
|
};
|
|
9727
|
-
|
|
10280
|
+
_context16.n = 3;
|
|
9728
10281
|
return getPublicMinting(req.spgNftContract, this.rpcClient);
|
|
9729
10282
|
case 3:
|
|
9730
|
-
isPublicMinting =
|
|
9731
|
-
|
|
10283
|
+
isPublicMinting = _context16.v;
|
|
10284
|
+
_context16.n = 4;
|
|
9732
10285
|
return calculateSPGMintFee(new SpgnftImplReadOnlyClient(this.rpcClient, registrationRequest.spgNftContract));
|
|
9733
10286
|
case 4:
|
|
9734
|
-
nftMintFee =
|
|
10287
|
+
nftMintFee = _context16.v;
|
|
9735
10288
|
encodeTx = {
|
|
9736
10289
|
to: this.registrationWorkflowsClient.address,
|
|
9737
10290
|
data: viem.encodeFunctionData({
|
|
@@ -9741,22 +10294,22 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9741
10294
|
})
|
|
9742
10295
|
};
|
|
9743
10296
|
if (!isPublicMinting) {
|
|
9744
|
-
|
|
10297
|
+
_context16.n = 5;
|
|
9745
10298
|
break;
|
|
9746
10299
|
}
|
|
9747
10300
|
publicMintSpenders = mergeSpenders(publicMintSpenders, nftMintFee ? [_objectSpread2({
|
|
9748
10301
|
address: registrationRequest.spgNftContract
|
|
9749
10302
|
}, nftMintFee)] : []);
|
|
9750
10303
|
publicMintEncodedTxs.push(encodeTx);
|
|
9751
|
-
|
|
10304
|
+
_context16.n = 8;
|
|
9752
10305
|
break;
|
|
9753
10306
|
case 5:
|
|
9754
|
-
|
|
10307
|
+
_context16.n = 6;
|
|
9755
10308
|
return hasMinterRole(registrationRequest.spgNftContract, this.rpcClient, this.walletAddress);
|
|
9756
10309
|
case 6:
|
|
9757
|
-
isMinterRole =
|
|
10310
|
+
isMinterRole = _context16.v;
|
|
9758
10311
|
if (isMinterRole) {
|
|
9759
|
-
|
|
10312
|
+
_context16.n = 7;
|
|
9760
10313
|
break;
|
|
9761
10314
|
}
|
|
9762
10315
|
throw new Error("Caller ".concat(this.walletAddress, " does not have the minter role for ").concat(registrationRequest.spgNftContract));
|
|
@@ -9766,26 +10319,26 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9766
10319
|
}, nftMintFee)] : []);
|
|
9767
10320
|
privateMintEncodedTxs.push(encodeTx);
|
|
9768
10321
|
case 8:
|
|
9769
|
-
|
|
10322
|
+
_context16.n = 2;
|
|
9770
10323
|
break;
|
|
9771
10324
|
case 9:
|
|
9772
|
-
|
|
10325
|
+
_context16.n = 11;
|
|
9773
10326
|
break;
|
|
9774
10327
|
case 10:
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
_iterator5.e(
|
|
10328
|
+
_context16.p = 10;
|
|
10329
|
+
_t19 = _context16.v;
|
|
10330
|
+
_iterator5.e(_t19);
|
|
9778
10331
|
case 11:
|
|
9779
|
-
|
|
10332
|
+
_context16.p = 11;
|
|
9780
10333
|
_iterator5.f();
|
|
9781
|
-
return
|
|
10334
|
+
return _context16.f(11);
|
|
9782
10335
|
case 12:
|
|
9783
10336
|
handlePublicMintTransactions = /*#__PURE__*/function () {
|
|
9784
|
-
var
|
|
9785
|
-
return _regenerator().w(function (
|
|
9786
|
-
while (1) switch (
|
|
10337
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
10338
|
+
return _regenerator().w(function (_context14) {
|
|
10339
|
+
while (1) switch (_context14.n) {
|
|
9787
10340
|
case 0:
|
|
9788
|
-
|
|
10341
|
+
_context14.n = 1;
|
|
9789
10342
|
return contractCallWithFees({
|
|
9790
10343
|
options: {
|
|
9791
10344
|
wipOptions: request.wipOptions,
|
|
@@ -9807,20 +10360,20 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9807
10360
|
encodedTxs: publicMintEncodedTxs
|
|
9808
10361
|
});
|
|
9809
10362
|
case 1:
|
|
9810
|
-
return
|
|
10363
|
+
return _context14.a(2, _context14.v);
|
|
9811
10364
|
}
|
|
9812
|
-
},
|
|
10365
|
+
}, _callee13);
|
|
9813
10366
|
}));
|
|
9814
10367
|
return function handlePublicMintTransactions() {
|
|
9815
|
-
return
|
|
10368
|
+
return _ref3.apply(this, arguments);
|
|
9816
10369
|
};
|
|
9817
10370
|
}();
|
|
9818
10371
|
handlePrivateMintTransactions = /*#__PURE__*/function () {
|
|
9819
|
-
var
|
|
9820
|
-
return _regenerator().w(function (
|
|
9821
|
-
while (1) switch (
|
|
10372
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
10373
|
+
return _regenerator().w(function (_context15) {
|
|
10374
|
+
while (1) switch (_context15.n) {
|
|
9822
10375
|
case 0:
|
|
9823
|
-
|
|
10376
|
+
_context15.n = 1;
|
|
9824
10377
|
return contractCallWithFees({
|
|
9825
10378
|
options: {
|
|
9826
10379
|
wipOptions: _objectSpread2(_objectSpread2({}, request.wipOptions), {}, {
|
|
@@ -9844,50 +10397,50 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9844
10397
|
encodedTxs: privateMintEncodedTxs
|
|
9845
10398
|
});
|
|
9846
10399
|
case 1:
|
|
9847
|
-
return
|
|
10400
|
+
return _context15.a(2, _context15.v);
|
|
9848
10401
|
}
|
|
9849
|
-
},
|
|
10402
|
+
}, _callee14);
|
|
9850
10403
|
}));
|
|
9851
10404
|
return function handlePrivateMintTransactions() {
|
|
9852
|
-
return
|
|
10405
|
+
return _ref4.apply(this, arguments);
|
|
9853
10406
|
};
|
|
9854
10407
|
}();
|
|
9855
10408
|
transactionResponses = [];
|
|
9856
10409
|
if (!(privateMintEncodedTxs.length === 0)) {
|
|
9857
|
-
|
|
10410
|
+
_context16.n = 14;
|
|
9858
10411
|
break;
|
|
9859
10412
|
}
|
|
9860
|
-
|
|
10413
|
+
_context16.n = 13;
|
|
9861
10414
|
return handlePublicMintTransactions();
|
|
9862
10415
|
case 13:
|
|
9863
|
-
|
|
9864
|
-
transactionResponses = [
|
|
9865
|
-
|
|
10416
|
+
_t20 = _context16.v;
|
|
10417
|
+
transactionResponses = [_t20];
|
|
10418
|
+
_context16.n = 19;
|
|
9866
10419
|
break;
|
|
9867
10420
|
case 14:
|
|
9868
10421
|
if (!(publicMintEncodedTxs.length === 0)) {
|
|
9869
|
-
|
|
10422
|
+
_context16.n = 16;
|
|
9870
10423
|
break;
|
|
9871
10424
|
}
|
|
9872
|
-
|
|
10425
|
+
_context16.n = 15;
|
|
9873
10426
|
return handlePrivateMintTransactions();
|
|
9874
10427
|
case 15:
|
|
9875
|
-
|
|
9876
|
-
transactionResponses = [
|
|
9877
|
-
|
|
10428
|
+
_t21 = _context16.v;
|
|
10429
|
+
transactionResponses = [_t21];
|
|
10430
|
+
_context16.n = 19;
|
|
9878
10431
|
break;
|
|
9879
10432
|
case 16:
|
|
9880
|
-
|
|
10433
|
+
_context16.n = 17;
|
|
9881
10434
|
return handlePublicMintTransactions();
|
|
9882
10435
|
case 17:
|
|
9883
|
-
publicMintResponse =
|
|
9884
|
-
|
|
10436
|
+
publicMintResponse = _context16.v;
|
|
10437
|
+
_context16.n = 18;
|
|
9885
10438
|
return handlePrivateMintTransactions();
|
|
9886
10439
|
case 18:
|
|
9887
|
-
privateMintResponse =
|
|
10440
|
+
privateMintResponse = _context16.v;
|
|
9888
10441
|
transactionResponses = [publicMintResponse, privateMintResponse];
|
|
9889
10442
|
case 19:
|
|
9890
|
-
return
|
|
10443
|
+
return _context16.a(2, {
|
|
9891
10444
|
registrationResults: transactionResponses.map(function (r) {
|
|
9892
10445
|
return {
|
|
9893
10446
|
txHash: r.txHash,
|
|
@@ -9897,13 +10450,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9897
10450
|
})
|
|
9898
10451
|
});
|
|
9899
10452
|
case 20:
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
return
|
|
10453
|
+
_context16.p = 20;
|
|
10454
|
+
_t22 = _context16.v;
|
|
10455
|
+
return _context16.a(2, handleError(_t22, "Failed to batch mint and register IP"));
|
|
9903
10456
|
}
|
|
9904
|
-
},
|
|
10457
|
+
}, _callee15, this, [[1, 10, 11, 12], [0, 20]]);
|
|
9905
10458
|
}));
|
|
9906
|
-
function batchMintAndRegisterIp(
|
|
10459
|
+
function batchMintAndRegisterIp(_x14) {
|
|
9907
10460
|
return _batchMintAndRegisterIp.apply(this, arguments);
|
|
9908
10461
|
}
|
|
9909
10462
|
return batchMintAndRegisterIp;
|
|
@@ -9936,18 +10489,18 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9936
10489
|
}, {
|
|
9937
10490
|
key: "mintAndRegisterIpAndMakeDerivativeWithLicenseTokens",
|
|
9938
10491
|
value: (function () {
|
|
9939
|
-
var _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10492
|
+
var _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(request) {
|
|
9940
10493
|
var _this8 = this;
|
|
9941
|
-
var _request$txOptions9, _request$
|
|
9942
|
-
return _regenerator().w(function (
|
|
9943
|
-
while (1) switch (
|
|
10494
|
+
var _request$txOptions9, _request$options3, licenseTokenIds, _object, encodedTxData, contractCall, _t23;
|
|
10495
|
+
return _regenerator().w(function (_context18) {
|
|
10496
|
+
while (1) switch (_context18.p = _context18.n) {
|
|
9944
10497
|
case 0:
|
|
9945
|
-
|
|
9946
|
-
|
|
10498
|
+
_context18.p = 0;
|
|
10499
|
+
_context18.n = 1;
|
|
9947
10500
|
return this.validateLicenseTokenIds(request.licenseTokenIds);
|
|
9948
10501
|
case 1:
|
|
9949
|
-
licenseTokenIds =
|
|
9950
|
-
|
|
10502
|
+
licenseTokenIds = _context18.v;
|
|
10503
|
+
_object = {
|
|
9951
10504
|
spgNftContract: validateAddress(request.spgNftContract),
|
|
9952
10505
|
recipient: validateAddress(request.recipient || this.walletAddress),
|
|
9953
10506
|
ipMetadata: getIpMetadataForWorkflow(request.ipMetadata),
|
|
@@ -9956,54 +10509,54 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
9956
10509
|
maxRts: validateMaxRts(request.maxRts),
|
|
9957
10510
|
allowDuplicates: request.allowDuplicates || true
|
|
9958
10511
|
};
|
|
9959
|
-
encodedTxData = this.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokensEncode(
|
|
10512
|
+
encodedTxData = this.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokensEncode(_object);
|
|
9960
10513
|
if (!((_request$txOptions9 = request.txOptions) !== null && _request$txOptions9 !== void 0 && _request$txOptions9.encodedTxDataOnly)) {
|
|
9961
|
-
|
|
10514
|
+
_context18.n = 2;
|
|
9962
10515
|
break;
|
|
9963
10516
|
}
|
|
9964
|
-
return
|
|
10517
|
+
return _context18.a(2, {
|
|
9965
10518
|
encodedTxData: encodedTxData
|
|
9966
10519
|
});
|
|
9967
10520
|
case 2:
|
|
9968
|
-
|
|
10521
|
+
_context18.n = 3;
|
|
9969
10522
|
return this.approveLicenseTokensForDerivativeWorkflows(request.licenseTokenIds, request.autoApproveLicenseTokens);
|
|
9970
10523
|
case 3:
|
|
9971
10524
|
contractCall = /*#__PURE__*/function () {
|
|
9972
|
-
var
|
|
9973
|
-
return _regenerator().w(function (
|
|
9974
|
-
while (1) switch (
|
|
10525
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
10526
|
+
return _regenerator().w(function (_context17) {
|
|
10527
|
+
while (1) switch (_context17.n) {
|
|
9975
10528
|
case 0:
|
|
9976
|
-
return
|
|
10529
|
+
return _context17.a(2, _this8.derivativeWorkflowsClient.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_object));
|
|
9977
10530
|
}
|
|
9978
|
-
},
|
|
10531
|
+
}, _callee16);
|
|
9979
10532
|
}));
|
|
9980
10533
|
return function contractCall() {
|
|
9981
|
-
return
|
|
10534
|
+
return _ref5.apply(this, arguments);
|
|
9982
10535
|
};
|
|
9983
10536
|
}();
|
|
9984
|
-
return
|
|
10537
|
+
return _context18.a(2, this.handleRegistrationWithFees({
|
|
9985
10538
|
options: _objectSpread2(_objectSpread2({}, request.options), {}, {
|
|
9986
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$
|
|
10539
|
+
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options3 = request.options) === null || _request$options3 === void 0 ? void 0 : _request$options3.wipOptions), {}, {
|
|
9987
10540
|
// need to disable multicall to avoid needing to transfer the license
|
|
9988
10541
|
// token to the multicall contract.
|
|
9989
10542
|
useMulticallWhenPossible: false
|
|
9990
10543
|
})
|
|
9991
10544
|
}),
|
|
9992
10545
|
sender: this.walletAddress,
|
|
9993
|
-
spgNftContract:
|
|
10546
|
+
spgNftContract: _object.spgNftContract,
|
|
9994
10547
|
spgSpenderAddress: this.derivativeWorkflowsClient.address,
|
|
9995
10548
|
encodedTxs: [encodedTxData],
|
|
9996
10549
|
contractCall: contractCall,
|
|
9997
10550
|
txOptions: request.txOptions
|
|
9998
10551
|
}));
|
|
9999
10552
|
case 4:
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
return
|
|
10553
|
+
_context18.p = 4;
|
|
10554
|
+
_t23 = _context18.v;
|
|
10555
|
+
return _context18.a(2, handleError(_t23, "Failed to mint and register IP and make derivative with license tokens"));
|
|
10003
10556
|
}
|
|
10004
|
-
},
|
|
10557
|
+
}, _callee17, this, [[0, 4]]);
|
|
10005
10558
|
}));
|
|
10006
|
-
function mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(
|
|
10559
|
+
function mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_x15) {
|
|
10007
10560
|
return _mintAndRegisterIpAndMakeDerivativeWithLicenseTokens.apply(this, arguments);
|
|
10008
10561
|
}
|
|
10009
10562
|
return mintAndRegisterIpAndMakeDerivativeWithLicenseTokens;
|
|
@@ -10036,14 +10589,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10036
10589
|
}, {
|
|
10037
10590
|
key: "registerIpAndMakeDerivativeWithLicenseTokens",
|
|
10038
10591
|
value: (function () {
|
|
10039
|
-
var _registerIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10040
|
-
var _request$txOptions0, tokenId, ipIdAddress, isRegistered, licenseTokenIds, calculatedDeadline, signature,
|
|
10041
|
-
return _regenerator().w(function (
|
|
10042
|
-
while (1) switch (
|
|
10592
|
+
var _registerIpAndMakeDerivativeWithLicenseTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(request) {
|
|
10593
|
+
var _request$txOptions0, tokenId, ipIdAddress, isRegistered, licenseTokenIds, calculatedDeadline, signature, _object2, txHash, receipt, log, _t24;
|
|
10594
|
+
return _regenerator().w(function (_context19) {
|
|
10595
|
+
while (1) switch (_context19.p = _context19.n) {
|
|
10043
10596
|
case 0:
|
|
10044
|
-
|
|
10597
|
+
_context19.p = 0;
|
|
10045
10598
|
tokenId = BigInt(request.tokenId);
|
|
10046
|
-
|
|
10599
|
+
_context19.n = 1;
|
|
10047
10600
|
return getIpIdAddress({
|
|
10048
10601
|
nftContract: request.nftContract,
|
|
10049
10602
|
tokenId: tokenId,
|
|
@@ -10052,26 +10605,26 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10052
10605
|
chainId: this.chainId
|
|
10053
10606
|
});
|
|
10054
10607
|
case 1:
|
|
10055
|
-
ipIdAddress =
|
|
10056
|
-
|
|
10608
|
+
ipIdAddress = _context19.v;
|
|
10609
|
+
_context19.n = 2;
|
|
10057
10610
|
return this.isRegistered(ipIdAddress);
|
|
10058
10611
|
case 2:
|
|
10059
|
-
isRegistered =
|
|
10612
|
+
isRegistered = _context19.v;
|
|
10060
10613
|
if (!isRegistered) {
|
|
10061
|
-
|
|
10614
|
+
_context19.n = 3;
|
|
10062
10615
|
break;
|
|
10063
10616
|
}
|
|
10064
10617
|
throw new Error("The NFT with id ".concat(tokenId, " is already registered as IP."));
|
|
10065
10618
|
case 3:
|
|
10066
|
-
|
|
10619
|
+
_context19.n = 4;
|
|
10067
10620
|
return this.validateLicenseTokenIds(request.licenseTokenIds);
|
|
10068
10621
|
case 4:
|
|
10069
|
-
licenseTokenIds =
|
|
10070
|
-
|
|
10622
|
+
licenseTokenIds = _context19.v;
|
|
10623
|
+
_context19.n = 5;
|
|
10071
10624
|
return getCalculatedDeadline(this.rpcClient, request.deadline);
|
|
10072
10625
|
case 5:
|
|
10073
|
-
calculatedDeadline =
|
|
10074
|
-
|
|
10626
|
+
calculatedDeadline = _context19.v;
|
|
10627
|
+
_context19.n = 6;
|
|
10075
10628
|
return generateOperationSignature({
|
|
10076
10629
|
ipIdAddress: ipIdAddress,
|
|
10077
10630
|
methodType: SignatureMethodType.REGISTER_IP_AND_MAKE_DERIVATIVE_WITH_LICENSE_TOKENS,
|
|
@@ -10080,11 +10633,11 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10080
10633
|
chainId: this.chainId
|
|
10081
10634
|
});
|
|
10082
10635
|
case 6:
|
|
10083
|
-
signature =
|
|
10084
|
-
|
|
10636
|
+
signature = _context19.v;
|
|
10637
|
+
_context19.n = 7;
|
|
10085
10638
|
return this.approveLicenseTokensForDerivativeWorkflows(licenseTokenIds, request.autoApproveLicenseTokens);
|
|
10086
10639
|
case 7:
|
|
10087
|
-
|
|
10640
|
+
_object2 = _objectSpread2(_objectSpread2({}, request), {}, {
|
|
10088
10641
|
tokenId: tokenId,
|
|
10089
10642
|
licenseTokenIds: licenseTokenIds,
|
|
10090
10643
|
royaltyContext: viem.zeroAddress,
|
|
@@ -10097,40 +10650,40 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10097
10650
|
maxRts: validateMaxRts(request.maxRts)
|
|
10098
10651
|
});
|
|
10099
10652
|
if (!((_request$txOptions0 = request.txOptions) !== null && _request$txOptions0 !== void 0 && _request$txOptions0.encodedTxDataOnly)) {
|
|
10100
|
-
|
|
10653
|
+
_context19.n = 8;
|
|
10101
10654
|
break;
|
|
10102
10655
|
}
|
|
10103
|
-
return
|
|
10104
|
-
encodedTxData: this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokensEncode(
|
|
10656
|
+
return _context19.a(2, {
|
|
10657
|
+
encodedTxData: this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokensEncode(_object2)
|
|
10105
10658
|
});
|
|
10106
10659
|
case 8:
|
|
10107
|
-
|
|
10108
|
-
return this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokens(
|
|
10660
|
+
_context19.n = 9;
|
|
10661
|
+
return this.derivativeWorkflowsClient.registerIpAndMakeDerivativeWithLicenseTokens(_object2);
|
|
10109
10662
|
case 9:
|
|
10110
|
-
txHash =
|
|
10111
|
-
|
|
10663
|
+
txHash = _context19.v;
|
|
10664
|
+
_context19.n = 10;
|
|
10112
10665
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
10113
10666
|
hash: txHash
|
|
10114
10667
|
}));
|
|
10115
10668
|
case 10:
|
|
10116
|
-
receipt =
|
|
10669
|
+
receipt = _context19.v;
|
|
10117
10670
|
log = this.getIpIdAndTokenIdsFromEvent(receipt)[0];
|
|
10118
|
-
return
|
|
10671
|
+
return _context19.a(2, _objectSpread2({
|
|
10119
10672
|
txHash: txHash
|
|
10120
10673
|
}, log));
|
|
10121
10674
|
case 11:
|
|
10122
|
-
|
|
10675
|
+
_context19.n = 13;
|
|
10123
10676
|
break;
|
|
10124
10677
|
case 12:
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
return
|
|
10678
|
+
_context19.p = 12;
|
|
10679
|
+
_t24 = _context19.v;
|
|
10680
|
+
return _context19.a(2, handleError(_t24, "Failed to register IP and make derivative with license tokens"));
|
|
10128
10681
|
case 13:
|
|
10129
|
-
return
|
|
10682
|
+
return _context19.a(2);
|
|
10130
10683
|
}
|
|
10131
|
-
},
|
|
10684
|
+
}, _callee18, this, [[0, 12]]);
|
|
10132
10685
|
}));
|
|
10133
|
-
function registerIpAndMakeDerivativeWithLicenseTokens(
|
|
10686
|
+
function registerIpAndMakeDerivativeWithLicenseTokens(_x16) {
|
|
10134
10687
|
return _registerIpAndMakeDerivativeWithLicenseTokens.apply(this, arguments);
|
|
10135
10688
|
}
|
|
10136
10689
|
return registerIpAndMakeDerivativeWithLicenseTokens;
|
|
@@ -10167,23 +10720,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10167
10720
|
}, {
|
|
10168
10721
|
key: "registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens",
|
|
10169
10722
|
value: (function () {
|
|
10170
|
-
var _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10171
|
-
var _getRoyaltyShares, royaltyShares, totalAmount, _yield$validateLicens2, licenseTerms, calculatedDeadline, ipIdAddress, isRegistered, _yield$transformRegis5, _transformRequest4, registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash, txReceipt, ipId, licenseTermsIds, ipRoyaltyVault, distributeRoyaltyTokensTxHash, maxLicenseTokensTxHashes,
|
|
10172
|
-
return _regenerator().w(function (
|
|
10173
|
-
while (1) switch (
|
|
10723
|
+
var _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(request) {
|
|
10724
|
+
var _getRoyaltyShares, royaltyShares, totalAmount, _yield$validateLicens2, licenseTerms, calculatedDeadline, ipIdAddress, isRegistered, _yield$transformRegis5, _transformRequest4, registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash, txReceipt, ipId, licenseTermsIds, ipRoyaltyVault, distributeRoyaltyTokensTxHash, maxLicenseTokensTxHashes, _t25;
|
|
10725
|
+
return _regenerator().w(function (_context20) {
|
|
10726
|
+
while (1) switch (_context20.p = _context20.n) {
|
|
10174
10727
|
case 0:
|
|
10175
|
-
|
|
10728
|
+
_context20.p = 0;
|
|
10176
10729
|
_getRoyaltyShares = getRoyaltyShares(request.royaltyShares), royaltyShares = _getRoyaltyShares.royaltyShares, totalAmount = _getRoyaltyShares.totalAmount;
|
|
10177
|
-
|
|
10730
|
+
_context20.n = 1;
|
|
10178
10731
|
return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
|
|
10179
10732
|
case 1:
|
|
10180
|
-
_yield$validateLicens2 =
|
|
10733
|
+
_yield$validateLicens2 = _context20.v;
|
|
10181
10734
|
licenseTerms = _yield$validateLicens2.licenseTerms;
|
|
10182
|
-
|
|
10735
|
+
_context20.n = 2;
|
|
10183
10736
|
return getCalculatedDeadline(this.rpcClient, request.deadline);
|
|
10184
10737
|
case 2:
|
|
10185
|
-
calculatedDeadline =
|
|
10186
|
-
|
|
10738
|
+
calculatedDeadline = _context20.v;
|
|
10739
|
+
_context20.n = 3;
|
|
10187
10740
|
return getIpIdAddress({
|
|
10188
10741
|
nftContract: validateAddress(request.nftContract),
|
|
10189
10742
|
tokenId: BigInt(request.tokenId),
|
|
@@ -10192,18 +10745,18 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10192
10745
|
chainId: this.chainId
|
|
10193
10746
|
});
|
|
10194
10747
|
case 3:
|
|
10195
|
-
ipIdAddress =
|
|
10196
|
-
|
|
10748
|
+
ipIdAddress = _context20.v;
|
|
10749
|
+
_context20.n = 4;
|
|
10197
10750
|
return this.isRegistered(ipIdAddress);
|
|
10198
10751
|
case 4:
|
|
10199
|
-
isRegistered =
|
|
10752
|
+
isRegistered = _context20.v;
|
|
10200
10753
|
if (!isRegistered) {
|
|
10201
|
-
|
|
10754
|
+
_context20.n = 5;
|
|
10202
10755
|
break;
|
|
10203
10756
|
}
|
|
10204
10757
|
throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
|
|
10205
10758
|
case 5:
|
|
10206
|
-
|
|
10759
|
+
_context20.n = 6;
|
|
10207
10760
|
return transformRegistrationRequest({
|
|
10208
10761
|
request: request,
|
|
10209
10762
|
rpcClient: this.rpcClient,
|
|
@@ -10211,25 +10764,25 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10211
10764
|
chainId: this.chainId
|
|
10212
10765
|
});
|
|
10213
10766
|
case 6:
|
|
10214
|
-
_yield$transformRegis5 =
|
|
10767
|
+
_yield$transformRegis5 = _context20.v;
|
|
10215
10768
|
_transformRequest4 = _yield$transformRegis5.transformRequest;
|
|
10216
|
-
|
|
10769
|
+
_context20.n = 7;
|
|
10217
10770
|
return this.royaltyTokenDistributionWorkflowsClient.registerIpAndAttachPilTermsAndDeployRoyaltyVault(_transformRequest4);
|
|
10218
10771
|
case 7:
|
|
10219
|
-
registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash =
|
|
10220
|
-
|
|
10772
|
+
registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash = _context20.v;
|
|
10773
|
+
_context20.n = 8;
|
|
10221
10774
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
10222
10775
|
hash: registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash
|
|
10223
10776
|
}));
|
|
10224
10777
|
case 8:
|
|
10225
|
-
txReceipt =
|
|
10778
|
+
txReceipt = _context20.v;
|
|
10226
10779
|
ipId = this.getIpIdAndTokenIdsFromEvent(txReceipt)[0].ipId;
|
|
10227
|
-
|
|
10780
|
+
_context20.n = 9;
|
|
10228
10781
|
return this.getLicenseTermsId(licenseTerms);
|
|
10229
10782
|
case 9:
|
|
10230
|
-
licenseTermsIds =
|
|
10783
|
+
licenseTermsIds = _context20.v;
|
|
10231
10784
|
ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(txReceipt)[0].ipRoyaltyVault;
|
|
10232
|
-
|
|
10785
|
+
_context20.n = 10;
|
|
10233
10786
|
return this.distributeRoyaltyTokens({
|
|
10234
10787
|
ipId: ipId,
|
|
10235
10788
|
deadline: calculatedDeadline,
|
|
@@ -10239,13 +10792,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10239
10792
|
txOptions: request.txOptions
|
|
10240
10793
|
});
|
|
10241
10794
|
case 10:
|
|
10242
|
-
distributeRoyaltyTokensTxHash =
|
|
10243
|
-
|
|
10795
|
+
distributeRoyaltyTokensTxHash = _context20.v;
|
|
10796
|
+
_context20.n = 11;
|
|
10244
10797
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
10245
10798
|
hash: distributeRoyaltyTokensTxHash
|
|
10246
10799
|
}));
|
|
10247
10800
|
case 11:
|
|
10248
|
-
|
|
10801
|
+
_context20.n = 12;
|
|
10249
10802
|
return setMaxLicenseTokens({
|
|
10250
10803
|
maxLicenseTokensData: request.licenseTermsData,
|
|
10251
10804
|
licensorIpId: ipId,
|
|
@@ -10254,8 +10807,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10254
10807
|
templateAddress: this.licenseTemplateAddress
|
|
10255
10808
|
});
|
|
10256
10809
|
case 12:
|
|
10257
|
-
maxLicenseTokensTxHashes =
|
|
10258
|
-
return
|
|
10810
|
+
maxLicenseTokensTxHashes = _context20.v;
|
|
10811
|
+
return _context20.a(2, _objectSpread2({
|
|
10259
10812
|
registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash: registerIpAndAttachPilTermsAndDeployRoyaltyVaultTxHash,
|
|
10260
10813
|
distributeRoyaltyTokensTxHash: distributeRoyaltyTokensTxHash,
|
|
10261
10814
|
ipId: ipId,
|
|
@@ -10265,13 +10818,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10265
10818
|
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
|
10266
10819
|
}));
|
|
10267
10820
|
case 13:
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
return
|
|
10821
|
+
_context20.p = 13;
|
|
10822
|
+
_t25 = _context20.v;
|
|
10823
|
+
return _context20.a(2, handleError(_t25, "Failed to register IP and attach license terms and distribute royalty tokens"));
|
|
10271
10824
|
}
|
|
10272
|
-
},
|
|
10825
|
+
}, _callee19, this, [[0, 13]]);
|
|
10273
10826
|
}));
|
|
10274
|
-
function registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(
|
|
10827
|
+
function registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x17) {
|
|
10275
10828
|
return _registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens.apply(this, arguments);
|
|
10276
10829
|
}
|
|
10277
10830
|
return registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens;
|
|
@@ -10307,14 +10860,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10307
10860
|
}, {
|
|
10308
10861
|
key: "registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens",
|
|
10309
10862
|
value: (function () {
|
|
10310
|
-
var _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10863
|
+
var _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(request) {
|
|
10311
10864
|
var _this9 = this;
|
|
10312
|
-
var _request$
|
|
10313
|
-
return _regenerator().w(function (
|
|
10314
|
-
while (1) switch (
|
|
10865
|
+
var _request$options4, ipIdAddress, _yield$transformRegis6, _transformRequest5, _getRoyaltyShares2, royaltyShares, totalAmount, isRegistered, encodedTxData, contractCall, _yield$this$handleReg, txHash, ipId, tokenId, receipt, ipRoyaltyVault, distributeRoyaltyTokensTxHash, _t26;
|
|
10866
|
+
return _regenerator().w(function (_context21) {
|
|
10867
|
+
while (1) switch (_context21.p = _context21.n) {
|
|
10315
10868
|
case 0:
|
|
10316
|
-
|
|
10317
|
-
|
|
10869
|
+
_context21.p = 0;
|
|
10870
|
+
_context21.n = 1;
|
|
10318
10871
|
return getIpIdAddress({
|
|
10319
10872
|
nftContract: validateAddress(request.nftContract),
|
|
10320
10873
|
tokenId: BigInt(request.tokenId),
|
|
@@ -10323,8 +10876,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10323
10876
|
chainId: this.chainId
|
|
10324
10877
|
});
|
|
10325
10878
|
case 1:
|
|
10326
|
-
ipIdAddress =
|
|
10327
|
-
|
|
10879
|
+
ipIdAddress = _context21.v;
|
|
10880
|
+
_context21.n = 2;
|
|
10328
10881
|
return transformRegistrationRequest({
|
|
10329
10882
|
request: request,
|
|
10330
10883
|
rpcClient: this.rpcClient,
|
|
@@ -10332,15 +10885,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10332
10885
|
chainId: this.chainId
|
|
10333
10886
|
});
|
|
10334
10887
|
case 2:
|
|
10335
|
-
_yield$transformRegis6 =
|
|
10888
|
+
_yield$transformRegis6 = _context21.v;
|
|
10336
10889
|
_transformRequest5 = _yield$transformRegis6.transformRequest;
|
|
10337
10890
|
_getRoyaltyShares2 = getRoyaltyShares(request.royaltyShares), royaltyShares = _getRoyaltyShares2.royaltyShares, totalAmount = _getRoyaltyShares2.totalAmount;
|
|
10338
|
-
|
|
10891
|
+
_context21.n = 3;
|
|
10339
10892
|
return this.isRegistered(ipIdAddress);
|
|
10340
10893
|
case 3:
|
|
10341
|
-
isRegistered =
|
|
10894
|
+
isRegistered = _context21.v;
|
|
10342
10895
|
if (!isRegistered) {
|
|
10343
|
-
|
|
10896
|
+
_context21.n = 4;
|
|
10344
10897
|
break;
|
|
10345
10898
|
}
|
|
10346
10899
|
throw new Error("The NFT with id ".concat(request.tokenId, " is already registered as IP."));
|
|
@@ -10349,10 +10902,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10349
10902
|
contractCall = function contractCall() {
|
|
10350
10903
|
return _this9.royaltyTokenDistributionWorkflowsClient.registerIpAndMakeDerivativeAndDeployRoyaltyVault(_transformRequest5);
|
|
10351
10904
|
};
|
|
10352
|
-
|
|
10905
|
+
_context21.n = 5;
|
|
10353
10906
|
return this.handleRegistrationWithFees({
|
|
10354
10907
|
options: _objectSpread2(_objectSpread2({}, request.options), {}, {
|
|
10355
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$
|
|
10908
|
+
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options4 = request.options) === null || _request$options4 === void 0 ? void 0 : _request$options4.wipOptions), {}, {
|
|
10356
10909
|
useMulticallWhenPossible: false
|
|
10357
10910
|
})
|
|
10358
10911
|
}),
|
|
@@ -10364,13 +10917,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10364
10917
|
txOptions: _objectSpread2({}, request.txOptions)
|
|
10365
10918
|
});
|
|
10366
10919
|
case 5:
|
|
10367
|
-
_yield$this$handleReg =
|
|
10920
|
+
_yield$this$handleReg = _context21.v;
|
|
10368
10921
|
txHash = _yield$this$handleReg.txHash;
|
|
10369
10922
|
ipId = _yield$this$handleReg.ipId;
|
|
10370
10923
|
tokenId = _yield$this$handleReg.tokenId;
|
|
10371
10924
|
receipt = _yield$this$handleReg.receipt;
|
|
10372
10925
|
if (!(tokenId === undefined || !ipId || !receipt)) {
|
|
10373
|
-
|
|
10926
|
+
_context21.n = 6;
|
|
10374
10927
|
break;
|
|
10375
10928
|
}
|
|
10376
10929
|
throw new Error("Failed to register derivative ip and deploy royalty vault.");
|
|
@@ -10378,7 +10931,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10378
10931
|
ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt).filter(function (item) {
|
|
10379
10932
|
return item.ipId === ipId;
|
|
10380
10933
|
})[0].ipRoyaltyVault;
|
|
10381
|
-
|
|
10934
|
+
_context21.n = 7;
|
|
10382
10935
|
return this.distributeRoyaltyTokens({
|
|
10383
10936
|
ipId: ipId,
|
|
10384
10937
|
deadline: request.deadline,
|
|
@@ -10388,13 +10941,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10388
10941
|
txOptions: request.txOptions
|
|
10389
10942
|
});
|
|
10390
10943
|
case 7:
|
|
10391
|
-
distributeRoyaltyTokensTxHash =
|
|
10392
|
-
|
|
10944
|
+
distributeRoyaltyTokensTxHash = _context21.v;
|
|
10945
|
+
_context21.n = 8;
|
|
10393
10946
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
10394
10947
|
hash: distributeRoyaltyTokensTxHash
|
|
10395
10948
|
}));
|
|
10396
10949
|
case 8:
|
|
10397
|
-
return
|
|
10950
|
+
return _context21.a(2, {
|
|
10398
10951
|
registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokensTxHash: txHash,
|
|
10399
10952
|
distributeRoyaltyTokensTxHash: distributeRoyaltyTokensTxHash,
|
|
10400
10953
|
ipId: ipId,
|
|
@@ -10402,13 +10955,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10402
10955
|
ipRoyaltyVault: ipRoyaltyVault
|
|
10403
10956
|
});
|
|
10404
10957
|
case 9:
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
return
|
|
10958
|
+
_context21.p = 9;
|
|
10959
|
+
_t26 = _context21.v;
|
|
10960
|
+
return _context21.a(2, handleError(_t26, "Failed to register derivative IP and attach license terms and distribute royalty tokens"));
|
|
10408
10961
|
}
|
|
10409
|
-
},
|
|
10962
|
+
}, _callee20, this, [[0, 9]]);
|
|
10410
10963
|
}));
|
|
10411
|
-
function registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(
|
|
10964
|
+
function registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_x18) {
|
|
10412
10965
|
return _registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens.apply(this, arguments);
|
|
10413
10966
|
}
|
|
10414
10967
|
return registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens;
|
|
@@ -10442,19 +10995,19 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10442
10995
|
}, {
|
|
10443
10996
|
key: "mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens",
|
|
10444
10997
|
value: (function () {
|
|
10445
|
-
var _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10998
|
+
var _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21(request) {
|
|
10446
10999
|
var _this0 = this;
|
|
10447
|
-
var _request$
|
|
10448
|
-
return _regenerator().w(function (
|
|
10449
|
-
while (1) switch (
|
|
11000
|
+
var _request$options5, _yield$validateLicens3, licenseTerms, _yield$transformRegis7, _transformRequest6, encodedTxData, contractCall, _yield$this$handleReg2, txHash, ipId, tokenId, receipt, licenseTermsIds, ipRoyaltyVault, maxLicenseTokensTxHashes, _t27;
|
|
11001
|
+
return _regenerator().w(function (_context22) {
|
|
11002
|
+
while (1) switch (_context22.p = _context22.n) {
|
|
10450
11003
|
case 0:
|
|
10451
|
-
|
|
10452
|
-
|
|
11004
|
+
_context22.p = 0;
|
|
11005
|
+
_context22.n = 1;
|
|
10453
11006
|
return validateLicenseTermsData(request.licenseTermsData, this.rpcClient, this.chainId);
|
|
10454
11007
|
case 1:
|
|
10455
|
-
_yield$validateLicens3 =
|
|
11008
|
+
_yield$validateLicens3 = _context22.v;
|
|
10456
11009
|
licenseTerms = _yield$validateLicens3.licenseTerms;
|
|
10457
|
-
|
|
11010
|
+
_context22.n = 2;
|
|
10458
11011
|
return transformRegistrationRequest({
|
|
10459
11012
|
request: request,
|
|
10460
11013
|
rpcClient: this.rpcClient,
|
|
@@ -10462,16 +11015,16 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10462
11015
|
chainId: this.chainId
|
|
10463
11016
|
});
|
|
10464
11017
|
case 2:
|
|
10465
|
-
_yield$transformRegis7 =
|
|
11018
|
+
_yield$transformRegis7 = _context22.v;
|
|
10466
11019
|
_transformRequest6 = _yield$transformRegis7.transformRequest;
|
|
10467
11020
|
encodedTxData = this.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokensEncode(_transformRequest6);
|
|
10468
11021
|
contractCall = function contractCall() {
|
|
10469
11022
|
return _this0.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_transformRequest6);
|
|
10470
11023
|
};
|
|
10471
|
-
|
|
11024
|
+
_context22.n = 3;
|
|
10472
11025
|
return this.handleRegistrationWithFees({
|
|
10473
11026
|
options: _objectSpread2(_objectSpread2({}, request.options), {}, {
|
|
10474
|
-
wipOptions: _objectSpread2(_objectSpread2({}, (_request$
|
|
11027
|
+
wipOptions: _objectSpread2(_objectSpread2({}, (_request$options5 = request.options) === null || _request$options5 === void 0 ? void 0 : _request$options5.wipOptions), {}, {
|
|
10475
11028
|
useMulticallWhenPossible: false
|
|
10476
11029
|
})
|
|
10477
11030
|
}),
|
|
@@ -10483,25 +11036,25 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10483
11036
|
txOptions: request.txOptions
|
|
10484
11037
|
});
|
|
10485
11038
|
case 3:
|
|
10486
|
-
_yield$this$handleReg2 =
|
|
11039
|
+
_yield$this$handleReg2 = _context22.v;
|
|
10487
11040
|
txHash = _yield$this$handleReg2.txHash;
|
|
10488
11041
|
ipId = _yield$this$handleReg2.ipId;
|
|
10489
11042
|
tokenId = _yield$this$handleReg2.tokenId;
|
|
10490
11043
|
receipt = _yield$this$handleReg2.receipt;
|
|
10491
11044
|
if (receipt) {
|
|
10492
|
-
|
|
11045
|
+
_context22.n = 4;
|
|
10493
11046
|
break;
|
|
10494
11047
|
}
|
|
10495
|
-
return
|
|
11048
|
+
return _context22.a(2, {
|
|
10496
11049
|
txHash: txHash
|
|
10497
11050
|
});
|
|
10498
11051
|
case 4:
|
|
10499
|
-
|
|
11052
|
+
_context22.n = 5;
|
|
10500
11053
|
return this.getLicenseTermsId(licenseTerms);
|
|
10501
11054
|
case 5:
|
|
10502
|
-
licenseTermsIds =
|
|
11055
|
+
licenseTermsIds = _context22.v;
|
|
10503
11056
|
ipRoyaltyVault = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt)[0].ipRoyaltyVault;
|
|
10504
|
-
|
|
11057
|
+
_context22.n = 6;
|
|
10505
11058
|
return setMaxLicenseTokens({
|
|
10506
11059
|
maxLicenseTokensData: request.licenseTermsData,
|
|
10507
11060
|
licensorIpId: ipId,
|
|
@@ -10510,8 +11063,8 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10510
11063
|
templateAddress: this.licenseTemplateAddress
|
|
10511
11064
|
});
|
|
10512
11065
|
case 6:
|
|
10513
|
-
maxLicenseTokensTxHashes =
|
|
10514
|
-
return
|
|
11066
|
+
maxLicenseTokensTxHashes = _context22.v;
|
|
11067
|
+
return _context22.a(2, _objectSpread2({
|
|
10515
11068
|
txHash: txHash,
|
|
10516
11069
|
ipId: ipId,
|
|
10517
11070
|
licenseTermsIds: licenseTermsIds,
|
|
@@ -10521,13 +11074,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10521
11074
|
maxLicenseTokensTxHashes: maxLicenseTokensTxHashes
|
|
10522
11075
|
}));
|
|
10523
11076
|
case 7:
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
return
|
|
11077
|
+
_context22.p = 7;
|
|
11078
|
+
_t27 = _context22.v;
|
|
11079
|
+
return _context22.a(2, handleError(_t27, "Failed to mint and register IP and attach PIL terms and distribute royalty tokens"));
|
|
10527
11080
|
}
|
|
10528
|
-
},
|
|
11081
|
+
}, _callee21, this, [[0, 7]]);
|
|
10529
11082
|
}));
|
|
10530
|
-
function mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(
|
|
11083
|
+
function mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_x19) {
|
|
10531
11084
|
return _mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens.apply(this, arguments);
|
|
10532
11085
|
}
|
|
10533
11086
|
return mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens;
|
|
@@ -10561,14 +11114,14 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10561
11114
|
}, {
|
|
10562
11115
|
key: "mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens",
|
|
10563
11116
|
value: (function () {
|
|
10564
|
-
var _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11117
|
+
var _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22(request) {
|
|
10565
11118
|
var _this1 = this;
|
|
10566
|
-
var _yield$transformRegis8, _transformRequest7, encodedTxData, contractCall,
|
|
10567
|
-
return _regenerator().w(function (
|
|
10568
|
-
while (1) switch (
|
|
11119
|
+
var _yield$transformRegis8, _transformRequest7, encodedTxData, contractCall, _t28;
|
|
11120
|
+
return _regenerator().w(function (_context23) {
|
|
11121
|
+
while (1) switch (_context23.p = _context23.n) {
|
|
10569
11122
|
case 0:
|
|
10570
|
-
|
|
10571
|
-
|
|
11123
|
+
_context23.p = 0;
|
|
11124
|
+
_context23.n = 1;
|
|
10572
11125
|
return transformRegistrationRequest({
|
|
10573
11126
|
request: request,
|
|
10574
11127
|
rpcClient: this.rpcClient,
|
|
@@ -10576,13 +11129,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10576
11129
|
chainId: this.chainId
|
|
10577
11130
|
});
|
|
10578
11131
|
case 1:
|
|
10579
|
-
_yield$transformRegis8 =
|
|
11132
|
+
_yield$transformRegis8 = _context23.v;
|
|
10580
11133
|
_transformRequest7 = _yield$transformRegis8.transformRequest;
|
|
10581
11134
|
encodedTxData = this.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokensEncode(_transformRequest7);
|
|
10582
11135
|
contractCall = function contractCall() {
|
|
10583
11136
|
return _this1.royaltyTokenDistributionWorkflowsClient.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_transformRequest7);
|
|
10584
11137
|
};
|
|
10585
|
-
|
|
11138
|
+
_context23.n = 2;
|
|
10586
11139
|
return this.handleRegistrationWithFees({
|
|
10587
11140
|
spgNftContract: _transformRequest7.spgNftContract,
|
|
10588
11141
|
options: request.options,
|
|
@@ -10594,15 +11147,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10594
11147
|
txOptions: request.txOptions
|
|
10595
11148
|
});
|
|
10596
11149
|
case 2:
|
|
10597
|
-
return
|
|
11150
|
+
return _context23.a(2, _context23.v);
|
|
10598
11151
|
case 3:
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
return
|
|
11152
|
+
_context23.p = 3;
|
|
11153
|
+
_t28 = _context23.v;
|
|
11154
|
+
return _context23.a(2, handleError(_t28, "Failed to mint and register IP and make derivative and distribute royalty tokens"));
|
|
10602
11155
|
}
|
|
10603
|
-
},
|
|
11156
|
+
}, _callee22, this, [[0, 3]]);
|
|
10604
11157
|
}));
|
|
10605
|
-
function mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(
|
|
11158
|
+
function mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_x20) {
|
|
10606
11159
|
return _mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens.apply(this, arguments);
|
|
10607
11160
|
}
|
|
10608
11161
|
return mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens;
|
|
@@ -10610,12 +11163,12 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10610
11163
|
}, {
|
|
10611
11164
|
key: "distributeRoyaltyTokens",
|
|
10612
11165
|
value: function () {
|
|
10613
|
-
var _distributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11166
|
+
var _distributeRoyaltyTokens = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(request) {
|
|
10614
11167
|
var _yield$transferDistri, transformRequest, txHash;
|
|
10615
|
-
return _regenerator().w(function (
|
|
10616
|
-
while (1) switch (
|
|
11168
|
+
return _regenerator().w(function (_context24) {
|
|
11169
|
+
while (1) switch (_context24.n) {
|
|
10617
11170
|
case 0:
|
|
10618
|
-
|
|
11171
|
+
_context24.n = 1;
|
|
10619
11172
|
return transferDistributeRoyaltyTokensRequest({
|
|
10620
11173
|
request: request,
|
|
10621
11174
|
rpcClient: this.rpcClient,
|
|
@@ -10623,22 +11176,22 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10623
11176
|
chainId: this.chainId
|
|
10624
11177
|
});
|
|
10625
11178
|
case 1:
|
|
10626
|
-
_yield$transferDistri =
|
|
11179
|
+
_yield$transferDistri = _context24.v;
|
|
10627
11180
|
transformRequest = _yield$transferDistri.transformRequest;
|
|
10628
|
-
|
|
11181
|
+
_context24.n = 2;
|
|
10629
11182
|
return this.royaltyTokenDistributionWorkflowsClient.distributeRoyaltyTokens(transformRequest);
|
|
10630
11183
|
case 2:
|
|
10631
|
-
txHash =
|
|
10632
|
-
|
|
11184
|
+
txHash = _context24.v;
|
|
11185
|
+
_context24.n = 3;
|
|
10633
11186
|
return this.rpcClient.waitForTransactionReceipt(_objectSpread2(_objectSpread2({}, request.txOptions), {}, {
|
|
10634
11187
|
hash: txHash
|
|
10635
11188
|
}));
|
|
10636
11189
|
case 3:
|
|
10637
|
-
return
|
|
11190
|
+
return _context24.a(2, txHash);
|
|
10638
11191
|
}
|
|
10639
|
-
},
|
|
11192
|
+
}, _callee23, this);
|
|
10640
11193
|
}));
|
|
10641
|
-
function distributeRoyaltyTokens(
|
|
11194
|
+
function distributeRoyaltyTokens(_x21) {
|
|
10642
11195
|
return _distributeRoyaltyTokens.apply(this, arguments);
|
|
10643
11196
|
}
|
|
10644
11197
|
return distributeRoyaltyTokens;
|
|
@@ -10646,20 +11199,20 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10646
11199
|
}, {
|
|
10647
11200
|
key: "isRegistered",
|
|
10648
11201
|
value: function () {
|
|
10649
|
-
var _isRegistered = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10650
|
-
return _regenerator().w(function (
|
|
10651
|
-
while (1) switch (
|
|
11202
|
+
var _isRegistered = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(ipId) {
|
|
11203
|
+
return _regenerator().w(function (_context25) {
|
|
11204
|
+
while (1) switch (_context25.n) {
|
|
10652
11205
|
case 0:
|
|
10653
|
-
|
|
11206
|
+
_context25.n = 1;
|
|
10654
11207
|
return this.ipAssetRegistryClient.isRegistered({
|
|
10655
11208
|
id: validateAddress(ipId)
|
|
10656
11209
|
});
|
|
10657
11210
|
case 1:
|
|
10658
|
-
return
|
|
11211
|
+
return _context25.a(2, _context25.v);
|
|
10659
11212
|
}
|
|
10660
|
-
},
|
|
11213
|
+
}, _callee24, this);
|
|
10661
11214
|
}));
|
|
10662
|
-
function isRegistered(
|
|
11215
|
+
function isRegistered(_x22) {
|
|
10663
11216
|
return _isRegistered.apply(this, arguments);
|
|
10664
11217
|
}
|
|
10665
11218
|
return isRegistered;
|
|
@@ -10705,24 +11258,24 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10705
11258
|
}, {
|
|
10706
11259
|
key: "batchRegisterIpAssetsWithOptimizedWorkflows",
|
|
10707
11260
|
value: (function () {
|
|
10708
|
-
var _batchRegisterIpAssetsWithOptimizedWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10709
|
-
var transferWorkflowRequests, _iterator6, _step6, req, res, royaltyDistributionRequests, _yield$handleMultical, txResponses, aggregateRegistrationRequest, responses, royaltyTokensDistributionRequests, _iterator7, _step7, _step7$value, txHash, receipt, iPRegisteredLog, ipRoyaltyVaultEvent, _yield$prepareRoyalty, requests, ipRoyaltyVaults, distributeRoyaltyTokensTxHashes, _yield$handleMultical2, txResponse, registrationResults,
|
|
10710
|
-
return _regenerator().w(function (
|
|
10711
|
-
while (1) switch (
|
|
11261
|
+
var _batchRegisterIpAssetsWithOptimizedWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(request) {
|
|
11262
|
+
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;
|
|
11263
|
+
return _regenerator().w(function (_context26) {
|
|
11264
|
+
while (1) switch (_context26.p = _context26.n) {
|
|
10712
11265
|
case 0:
|
|
10713
|
-
|
|
11266
|
+
_context26.p = 0;
|
|
10714
11267
|
// Transform requests into workflow format
|
|
10715
11268
|
transferWorkflowRequests = [];
|
|
10716
11269
|
_iterator6 = _createForOfIteratorHelper(request.requests);
|
|
10717
|
-
|
|
11270
|
+
_context26.p = 1;
|
|
10718
11271
|
_iterator6.s();
|
|
10719
11272
|
case 2:
|
|
10720
11273
|
if ((_step6 = _iterator6.n()).done) {
|
|
10721
|
-
|
|
11274
|
+
_context26.n = 5;
|
|
10722
11275
|
break;
|
|
10723
11276
|
}
|
|
10724
11277
|
req = _step6.value;
|
|
10725
|
-
|
|
11278
|
+
_context26.n = 3;
|
|
10726
11279
|
return transformRegistrationRequest({
|
|
10727
11280
|
request: req,
|
|
10728
11281
|
rpcClient: this.rpcClient,
|
|
@@ -10730,22 +11283,22 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10730
11283
|
chainId: this.chainId
|
|
10731
11284
|
});
|
|
10732
11285
|
case 3:
|
|
10733
|
-
res =
|
|
11286
|
+
res = _context26.v;
|
|
10734
11287
|
transferWorkflowRequests.push(res);
|
|
10735
11288
|
case 4:
|
|
10736
|
-
|
|
11289
|
+
_context26.n = 2;
|
|
10737
11290
|
break;
|
|
10738
11291
|
case 5:
|
|
10739
|
-
|
|
11292
|
+
_context26.n = 7;
|
|
10740
11293
|
break;
|
|
10741
11294
|
case 6:
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
_iterator6.e(
|
|
11295
|
+
_context26.p = 6;
|
|
11296
|
+
_t29 = _context26.v;
|
|
11297
|
+
_iterator6.e(_t29);
|
|
10745
11298
|
case 7:
|
|
10746
|
-
|
|
11299
|
+
_context26.p = 7;
|
|
10747
11300
|
_iterator6.f();
|
|
10748
|
-
return
|
|
11301
|
+
return _context26.f(7);
|
|
10749
11302
|
case 8:
|
|
10750
11303
|
/**
|
|
10751
11304
|
* Extract royalty distribution requests from workflow responses that contain royalty shares
|
|
@@ -10763,7 +11316,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10763
11316
|
deadline: res.extraData.deadline
|
|
10764
11317
|
};
|
|
10765
11318
|
}); // Process initial registration transactions
|
|
10766
|
-
|
|
11319
|
+
_context26.n = 9;
|
|
10767
11320
|
return handleMulticall({
|
|
10768
11321
|
transferWorkflowRequests: transferWorkflowRequests,
|
|
10769
11322
|
multicall3Address: this.multicall3Client.address,
|
|
@@ -10774,23 +11327,23 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10774
11327
|
chainId: this.chainId
|
|
10775
11328
|
});
|
|
10776
11329
|
case 9:
|
|
10777
|
-
_yield$handleMultical =
|
|
11330
|
+
_yield$handleMultical = _context26.v;
|
|
10778
11331
|
txResponses = _yield$handleMultical.response;
|
|
10779
11332
|
aggregateRegistrationRequest = _yield$handleMultical.aggregateRegistrationRequest;
|
|
10780
11333
|
responses = [];
|
|
10781
11334
|
royaltyTokensDistributionRequests = []; // Process each transaction response
|
|
10782
11335
|
_iterator7 = _createForOfIteratorHelper(txResponses);
|
|
10783
|
-
|
|
11336
|
+
_context26.p = 10;
|
|
10784
11337
|
_iterator7.s();
|
|
10785
11338
|
case 11:
|
|
10786
11339
|
if ((_step7 = _iterator7.n()).done) {
|
|
10787
|
-
|
|
11340
|
+
_context26.n = 14;
|
|
10788
11341
|
break;
|
|
10789
11342
|
}
|
|
10790
11343
|
_step7$value = _step7.value, txHash = _step7$value.txHash, receipt = _step7$value.receipt;
|
|
10791
11344
|
iPRegisteredLog = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(receipt);
|
|
10792
11345
|
ipRoyaltyVaultEvent = this.royaltyModuleEventClient.parseTxIpRoyaltyVaultDeployedEvent(receipt); // Prepare royalty distribution if needed
|
|
10793
|
-
|
|
11346
|
+
_context26.n = 12;
|
|
10794
11347
|
return prepareRoyaltyTokensDistributionRequests({
|
|
10795
11348
|
royaltyDistributionRequests: royaltyDistributionRequests,
|
|
10796
11349
|
ipRegisteredLog: iPRegisteredLog,
|
|
@@ -10800,7 +11353,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10800
11353
|
chainId: this.chainId
|
|
10801
11354
|
});
|
|
10802
11355
|
case 12:
|
|
10803
|
-
_yield$prepareRoyalty =
|
|
11356
|
+
_yield$prepareRoyalty = _context26.v;
|
|
10804
11357
|
requests = _yield$prepareRoyalty.requests;
|
|
10805
11358
|
ipRoyaltyVaults = _yield$prepareRoyalty.ipRoyaltyVaults;
|
|
10806
11359
|
royaltyTokensDistributionRequests.push.apply(royaltyTokensDistributionRequests, _toConsumableArray(requests));
|
|
@@ -10816,25 +11369,25 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10816
11369
|
})
|
|
10817
11370
|
});
|
|
10818
11371
|
case 13:
|
|
10819
|
-
|
|
11372
|
+
_context26.n = 11;
|
|
10820
11373
|
break;
|
|
10821
11374
|
case 14:
|
|
10822
|
-
|
|
11375
|
+
_context26.n = 16;
|
|
10823
11376
|
break;
|
|
10824
11377
|
case 15:
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
_iterator7.e(
|
|
11378
|
+
_context26.p = 15;
|
|
11379
|
+
_t30 = _context26.v;
|
|
11380
|
+
_iterator7.e(_t30);
|
|
10828
11381
|
case 16:
|
|
10829
|
-
|
|
11382
|
+
_context26.p = 16;
|
|
10830
11383
|
_iterator7.f();
|
|
10831
|
-
return
|
|
11384
|
+
return _context26.f(16);
|
|
10832
11385
|
case 17:
|
|
10833
11386
|
if (!(royaltyTokensDistributionRequests.length > 0)) {
|
|
10834
|
-
|
|
11387
|
+
_context26.n = 19;
|
|
10835
11388
|
break;
|
|
10836
11389
|
}
|
|
10837
|
-
|
|
11390
|
+
_context26.n = 18;
|
|
10838
11391
|
return handleMulticall({
|
|
10839
11392
|
transferWorkflowRequests: royaltyTokensDistributionRequests,
|
|
10840
11393
|
multicall3Address: this.multicall3Client.address,
|
|
@@ -10845,29 +11398,29 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10845
11398
|
chainId: this.chainId
|
|
10846
11399
|
});
|
|
10847
11400
|
case 18:
|
|
10848
|
-
_yield$handleMultical2 =
|
|
11401
|
+
_yield$handleMultical2 = _context26.v;
|
|
10849
11402
|
txResponse = _yield$handleMultical2.response;
|
|
10850
11403
|
distributeRoyaltyTokensTxHashes = txResponse.map(function (tx) {
|
|
10851
11404
|
return tx.txHash;
|
|
10852
11405
|
});
|
|
10853
11406
|
case 19:
|
|
10854
|
-
|
|
11407
|
+
_context26.n = 20;
|
|
10855
11408
|
return this.populateLicenseAndTokenIdsForRegistrationResults(responses, aggregateRegistrationRequest);
|
|
10856
11409
|
case 20:
|
|
10857
|
-
registrationResults =
|
|
10858
|
-
return
|
|
11410
|
+
registrationResults = _context26.v;
|
|
11411
|
+
return _context26.a(2, _objectSpread2({
|
|
10859
11412
|
registrationResults: registrationResults
|
|
10860
11413
|
}, distributeRoyaltyTokensTxHashes && {
|
|
10861
11414
|
distributeRoyaltyTokensTxHashes: distributeRoyaltyTokensTxHashes
|
|
10862
11415
|
}));
|
|
10863
11416
|
case 21:
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
return
|
|
11417
|
+
_context26.p = 21;
|
|
11418
|
+
_t31 = _context26.v;
|
|
11419
|
+
return _context26.a(2, handleError(_t31, "Failed to batch register IP assets with optimized workflows"));
|
|
10867
11420
|
}
|
|
10868
|
-
},
|
|
11421
|
+
}, _callee25, this, [[10, 15, 16, 17], [1, 6, 7, 8], [0, 21]]);
|
|
10869
11422
|
}));
|
|
10870
|
-
function batchRegisterIpAssetsWithOptimizedWorkflows(
|
|
11423
|
+
function batchRegisterIpAssetsWithOptimizedWorkflows(_x23) {
|
|
10871
11424
|
return _batchRegisterIpAssetsWithOptimizedWorkflows.apply(this, arguments);
|
|
10872
11425
|
}
|
|
10873
11426
|
return batchRegisterIpAssetsWithOptimizedWorkflows;
|
|
@@ -10937,51 +11490,51 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
10937
11490
|
}, {
|
|
10938
11491
|
key: "registerIpAsset",
|
|
10939
11492
|
value: (function () {
|
|
10940
|
-
var _registerIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
10941
|
-
var nft, licenseTermsData, royaltyShares,
|
|
10942
|
-
return _regenerator().w(function (
|
|
10943
|
-
while (1) switch (
|
|
11493
|
+
var _registerIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(request) {
|
|
11494
|
+
var nft, licenseTermsData, royaltyShares, _t32;
|
|
11495
|
+
return _regenerator().w(function (_context27) {
|
|
11496
|
+
while (1) switch (_context27.p = _context27.n) {
|
|
10944
11497
|
case 0:
|
|
10945
|
-
|
|
11498
|
+
_context27.p = 0;
|
|
10946
11499
|
nft = request.nft, licenseTermsData = request.licenseTermsData, royaltyShares = request.royaltyShares; // Validate royalty shares without license terms
|
|
10947
11500
|
if (!(royaltyShares && !licenseTermsData)) {
|
|
10948
|
-
|
|
11501
|
+
_context27.n = 1;
|
|
10949
11502
|
break;
|
|
10950
11503
|
}
|
|
10951
11504
|
throw new Error("License terms data must be provided when royalty shares are specified.");
|
|
10952
11505
|
case 1:
|
|
10953
11506
|
if (!(nft.type === "minted")) {
|
|
10954
|
-
|
|
11507
|
+
_context27.n = 3;
|
|
10955
11508
|
break;
|
|
10956
11509
|
}
|
|
10957
|
-
|
|
11510
|
+
_context27.n = 2;
|
|
10958
11511
|
return this.handleMintedNftRegistration(request);
|
|
10959
11512
|
case 2:
|
|
10960
|
-
return
|
|
11513
|
+
return _context27.a(2, _context27.v);
|
|
10961
11514
|
case 3:
|
|
10962
11515
|
if (!(nft.type === "mint")) {
|
|
10963
|
-
|
|
11516
|
+
_context27.n = 5;
|
|
10964
11517
|
break;
|
|
10965
11518
|
}
|
|
10966
|
-
|
|
11519
|
+
_context27.n = 4;
|
|
10967
11520
|
return this.handleMintNftRegistration(request);
|
|
10968
11521
|
case 4:
|
|
10969
|
-
return
|
|
11522
|
+
return _context27.a(2, _context27.v);
|
|
10970
11523
|
case 5:
|
|
10971
11524
|
throw new Error("Invalid NFT type");
|
|
10972
11525
|
case 6:
|
|
10973
|
-
|
|
11526
|
+
_context27.n = 8;
|
|
10974
11527
|
break;
|
|
10975
11528
|
case 7:
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
return
|
|
11529
|
+
_context27.p = 7;
|
|
11530
|
+
_t32 = _context27.v;
|
|
11531
|
+
return _context27.a(2, handleError(_t32, "Failed to register IP Asset"));
|
|
10979
11532
|
case 8:
|
|
10980
|
-
return
|
|
11533
|
+
return _context27.a(2);
|
|
10981
11534
|
}
|
|
10982
|
-
},
|
|
11535
|
+
}, _callee26, this, [[0, 7]]);
|
|
10983
11536
|
}));
|
|
10984
|
-
function registerIpAsset(
|
|
11537
|
+
function registerIpAsset(_x24) {
|
|
10985
11538
|
return _registerIpAsset.apply(this, arguments);
|
|
10986
11539
|
}
|
|
10987
11540
|
return registerIpAsset;
|
|
@@ -11050,15 +11603,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11050
11603
|
}, {
|
|
11051
11604
|
key: "registerDerivativeIpAsset",
|
|
11052
11605
|
value: (function () {
|
|
11053
|
-
var _registerDerivativeIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11054
|
-
var nft, licenseTokenIds, royaltyShares, derivData, hasDerivData, hasLicenseTokens,
|
|
11055
|
-
return _regenerator().w(function (
|
|
11056
|
-
while (1) switch (
|
|
11606
|
+
var _registerDerivativeIpAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(request) {
|
|
11607
|
+
var nft, licenseTokenIds, royaltyShares, derivData, hasDerivData, hasLicenseTokens, _t33;
|
|
11608
|
+
return _regenerator().w(function (_context28) {
|
|
11609
|
+
while (1) switch (_context28.p = _context28.n) {
|
|
11057
11610
|
case 0:
|
|
11058
|
-
|
|
11611
|
+
_context28.p = 0;
|
|
11059
11612
|
nft = request.nft, licenseTokenIds = request.licenseTokenIds, royaltyShares = request.royaltyShares, derivData = request.derivData;
|
|
11060
11613
|
if (!(royaltyShares && !derivData)) {
|
|
11061
|
-
|
|
11614
|
+
_context28.n = 1;
|
|
11062
11615
|
break;
|
|
11063
11616
|
}
|
|
11064
11617
|
throw new Error("derivData must be provided when royaltyShares are provided.");
|
|
@@ -11067,43 +11620,43 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11067
11620
|
hasDerivData = !!derivData;
|
|
11068
11621
|
hasLicenseTokens = !!(licenseTokenIds && licenseTokenIds.length > 0);
|
|
11069
11622
|
if (!(!hasDerivData && !hasLicenseTokens)) {
|
|
11070
|
-
|
|
11623
|
+
_context28.n = 2;
|
|
11071
11624
|
break;
|
|
11072
11625
|
}
|
|
11073
11626
|
throw new Error("Either derivData or licenseTokenIds must be provided.");
|
|
11074
11627
|
case 2:
|
|
11075
11628
|
if (!(nft.type === "minted")) {
|
|
11076
|
-
|
|
11629
|
+
_context28.n = 4;
|
|
11077
11630
|
break;
|
|
11078
11631
|
}
|
|
11079
|
-
|
|
11632
|
+
_context28.n = 3;
|
|
11080
11633
|
return this.handleMintedNftDerivativeRegistration(request);
|
|
11081
11634
|
case 3:
|
|
11082
|
-
return
|
|
11635
|
+
return _context28.a(2, _context28.v);
|
|
11083
11636
|
case 4:
|
|
11084
11637
|
if (!(nft.type === "mint")) {
|
|
11085
|
-
|
|
11638
|
+
_context28.n = 6;
|
|
11086
11639
|
break;
|
|
11087
11640
|
}
|
|
11088
|
-
|
|
11641
|
+
_context28.n = 5;
|
|
11089
11642
|
return this.handleMintNftDerivativeRegistration(request);
|
|
11090
11643
|
case 5:
|
|
11091
|
-
return
|
|
11644
|
+
return _context28.a(2, _context28.v);
|
|
11092
11645
|
case 6:
|
|
11093
11646
|
throw new Error("Invalid NFT type.");
|
|
11094
11647
|
case 7:
|
|
11095
|
-
|
|
11648
|
+
_context28.n = 9;
|
|
11096
11649
|
break;
|
|
11097
11650
|
case 8:
|
|
11098
|
-
|
|
11099
|
-
|
|
11100
|
-
return
|
|
11651
|
+
_context28.p = 8;
|
|
11652
|
+
_t33 = _context28.v;
|
|
11653
|
+
return _context28.a(2, handleError(_t33, "Failed to register derivative IP Asset"));
|
|
11101
11654
|
case 9:
|
|
11102
|
-
return
|
|
11655
|
+
return _context28.a(2);
|
|
11103
11656
|
}
|
|
11104
|
-
},
|
|
11657
|
+
}, _callee27, this, [[0, 8]]);
|
|
11105
11658
|
}));
|
|
11106
|
-
function registerDerivativeIpAsset(
|
|
11659
|
+
function registerDerivativeIpAsset(_x25) {
|
|
11107
11660
|
return _registerDerivativeIpAsset.apply(this, arguments);
|
|
11108
11661
|
}
|
|
11109
11662
|
return registerDerivativeIpAsset;
|
|
@@ -11120,10 +11673,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11120
11673
|
}, {
|
|
11121
11674
|
key: "handleMintedNftDerivativeRegistration",
|
|
11122
11675
|
value: (function () {
|
|
11123
|
-
var _handleMintedNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11676
|
+
var _handleMintedNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(request) {
|
|
11124
11677
|
var nft, royaltyShares, derivData, maxRts, licenseTokenIds, deadline, txOptions, options, ipMetadata, baseParams;
|
|
11125
|
-
return _regenerator().w(function (
|
|
11126
|
-
while (1) switch (
|
|
11678
|
+
return _regenerator().w(function (_context29) {
|
|
11679
|
+
while (1) switch (_context29.n) {
|
|
11127
11680
|
case 0:
|
|
11128
11681
|
nft = request.nft, royaltyShares = request.royaltyShares, derivData = request.derivData, maxRts = request.maxRts, licenseTokenIds = request.licenseTokenIds, deadline = request.deadline, txOptions = request.txOptions, options = request.options, ipMetadata = request.ipMetadata;
|
|
11129
11682
|
baseParams = {
|
|
@@ -11135,31 +11688,31 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11135
11688
|
options: options
|
|
11136
11689
|
};
|
|
11137
11690
|
if (!(royaltyShares && derivData)) {
|
|
11138
|
-
|
|
11691
|
+
_context29.n = 1;
|
|
11139
11692
|
break;
|
|
11140
11693
|
}
|
|
11141
|
-
return
|
|
11694
|
+
return _context29.a(2, this.registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11142
11695
|
royaltyShares: royaltyShares,
|
|
11143
11696
|
derivData: derivData
|
|
11144
11697
|
})));
|
|
11145
11698
|
case 1:
|
|
11146
11699
|
if (!derivData) {
|
|
11147
|
-
|
|
11700
|
+
_context29.n = 2;
|
|
11148
11701
|
break;
|
|
11149
11702
|
}
|
|
11150
|
-
return
|
|
11703
|
+
return _context29.a(2, this.registerDerivativeIp(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11151
11704
|
derivData: derivData
|
|
11152
11705
|
})));
|
|
11153
11706
|
case 2:
|
|
11154
|
-
return
|
|
11707
|
+
return _context29.a(2, this.registerIpAndMakeDerivativeWithLicenseTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11155
11708
|
licenseTokenIds: licenseTokenIds,
|
|
11156
11709
|
maxRts: maxRts,
|
|
11157
11710
|
autoApproveLicenseTokens: request.autoApproveLicenseTokens
|
|
11158
11711
|
})));
|
|
11159
11712
|
}
|
|
11160
|
-
},
|
|
11713
|
+
}, _callee28, this);
|
|
11161
11714
|
}));
|
|
11162
|
-
function handleMintedNftDerivativeRegistration(
|
|
11715
|
+
function handleMintedNftDerivativeRegistration(_x26) {
|
|
11163
11716
|
return _handleMintedNftDerivativeRegistration.apply(this, arguments);
|
|
11164
11717
|
}
|
|
11165
11718
|
return handleMintedNftDerivativeRegistration;
|
|
@@ -11176,10 +11729,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11176
11729
|
}, {
|
|
11177
11730
|
key: "handleMintNftDerivativeRegistration",
|
|
11178
11731
|
value: (function () {
|
|
11179
|
-
var _handleMintNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11732
|
+
var _handleMintNftDerivativeRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29(request) {
|
|
11180
11733
|
var nft, royaltyShares, derivData, maxRts, licenseTokenIds, txOptions, options, ipMetadata, baseParams;
|
|
11181
|
-
return _regenerator().w(function (
|
|
11182
|
-
while (1) switch (
|
|
11734
|
+
return _regenerator().w(function (_context30) {
|
|
11735
|
+
while (1) switch (_context30.n) {
|
|
11183
11736
|
case 0:
|
|
11184
11737
|
nft = request.nft, royaltyShares = request.royaltyShares, derivData = request.derivData, maxRts = request.maxRts, licenseTokenIds = request.licenseTokenIds, txOptions = request.txOptions, options = request.options, ipMetadata = request.ipMetadata;
|
|
11185
11738
|
baseParams = {
|
|
@@ -11191,31 +11744,31 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11191
11744
|
options: options
|
|
11192
11745
|
};
|
|
11193
11746
|
if (!(royaltyShares && derivData)) {
|
|
11194
|
-
|
|
11747
|
+
_context30.n = 1;
|
|
11195
11748
|
break;
|
|
11196
11749
|
}
|
|
11197
|
-
return
|
|
11750
|
+
return _context30.a(2, this.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11198
11751
|
royaltyShares: royaltyShares,
|
|
11199
11752
|
derivData: derivData
|
|
11200
11753
|
})));
|
|
11201
11754
|
case 1:
|
|
11202
11755
|
if (!derivData) {
|
|
11203
|
-
|
|
11756
|
+
_context30.n = 2;
|
|
11204
11757
|
break;
|
|
11205
11758
|
}
|
|
11206
|
-
return
|
|
11759
|
+
return _context30.a(2, this.mintAndRegisterIpAndMakeDerivative(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11207
11760
|
derivData: derivData
|
|
11208
11761
|
})));
|
|
11209
11762
|
case 2:
|
|
11210
|
-
return
|
|
11763
|
+
return _context30.a(2, this.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11211
11764
|
licenseTokenIds: licenseTokenIds,
|
|
11212
11765
|
maxRts: maxRts,
|
|
11213
11766
|
autoApproveLicenseTokens: request.autoApproveLicenseTokens
|
|
11214
11767
|
})));
|
|
11215
11768
|
}
|
|
11216
|
-
},
|
|
11769
|
+
}, _callee29, this);
|
|
11217
11770
|
}));
|
|
11218
|
-
function handleMintNftDerivativeRegistration(
|
|
11771
|
+
function handleMintNftDerivativeRegistration(_x27) {
|
|
11219
11772
|
return _handleMintNftDerivativeRegistration.apply(this, arguments);
|
|
11220
11773
|
}
|
|
11221
11774
|
return handleMintNftDerivativeRegistration;
|
|
@@ -11253,32 +11806,32 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11253
11806
|
}, {
|
|
11254
11807
|
key: "linkDerivative",
|
|
11255
11808
|
value: (function () {
|
|
11256
|
-
var _linkDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11257
|
-
var
|
|
11258
|
-
return _regenerator().w(function (
|
|
11259
|
-
while (1) switch (
|
|
11809
|
+
var _linkDerivative = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30(request) {
|
|
11810
|
+
var _t34;
|
|
11811
|
+
return _regenerator().w(function (_context31) {
|
|
11812
|
+
while (1) switch (_context31.p = _context31.n) {
|
|
11260
11813
|
case 0:
|
|
11261
|
-
|
|
11814
|
+
_context31.p = 0;
|
|
11262
11815
|
if (!("parentIpIds" in request)) {
|
|
11263
|
-
|
|
11816
|
+
_context31.n = 1;
|
|
11264
11817
|
break;
|
|
11265
11818
|
}
|
|
11266
|
-
return
|
|
11819
|
+
return _context31.a(2, this.registerDerivative(request));
|
|
11267
11820
|
case 1:
|
|
11268
|
-
return
|
|
11821
|
+
return _context31.a(2, this.registerDerivativeWithLicenseTokens(request));
|
|
11269
11822
|
case 2:
|
|
11270
|
-
|
|
11823
|
+
_context31.n = 4;
|
|
11271
11824
|
break;
|
|
11272
11825
|
case 3:
|
|
11273
|
-
|
|
11274
|
-
|
|
11275
|
-
return
|
|
11826
|
+
_context31.p = 3;
|
|
11827
|
+
_t34 = _context31.v;
|
|
11828
|
+
return _context31.a(2, handleError(_t34, "Failed to link derivative"));
|
|
11276
11829
|
case 4:
|
|
11277
|
-
return
|
|
11830
|
+
return _context31.a(2);
|
|
11278
11831
|
}
|
|
11279
|
-
},
|
|
11832
|
+
}, _callee30, this, [[0, 3]]);
|
|
11280
11833
|
}));
|
|
11281
|
-
function linkDerivative(
|
|
11834
|
+
function linkDerivative(_x28) {
|
|
11282
11835
|
return _linkDerivative.apply(this, arguments);
|
|
11283
11836
|
}
|
|
11284
11837
|
return linkDerivative;
|
|
@@ -11295,10 +11848,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11295
11848
|
}, {
|
|
11296
11849
|
key: "handleMintedNftRegistration",
|
|
11297
11850
|
value: (function () {
|
|
11298
|
-
var _handleMintedNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11851
|
+
var _handleMintedNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(request) {
|
|
11299
11852
|
var nft, ipMetadata, txOptions, licenseTermsData, royaltyShares, deadline, baseParams;
|
|
11300
|
-
return _regenerator().w(function (
|
|
11301
|
-
while (1) switch (
|
|
11853
|
+
return _regenerator().w(function (_context32) {
|
|
11854
|
+
while (1) switch (_context32.n) {
|
|
11302
11855
|
case 0:
|
|
11303
11856
|
nft = request.nft, ipMetadata = request.ipMetadata, txOptions = request.txOptions, licenseTermsData = request.licenseTermsData, royaltyShares = request.royaltyShares, deadline = request.deadline;
|
|
11304
11857
|
baseParams = {
|
|
@@ -11309,27 +11862,27 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11309
11862
|
txOptions: txOptions
|
|
11310
11863
|
};
|
|
11311
11864
|
if (!(licenseTermsData && royaltyShares)) {
|
|
11312
|
-
|
|
11865
|
+
_context32.n = 1;
|
|
11313
11866
|
break;
|
|
11314
11867
|
}
|
|
11315
|
-
return
|
|
11868
|
+
return _context32.a(2, this.registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11316
11869
|
licenseTermsData: licenseTermsData,
|
|
11317
11870
|
royaltyShares: royaltyShares
|
|
11318
11871
|
})));
|
|
11319
11872
|
case 1:
|
|
11320
11873
|
if (!licenseTermsData) {
|
|
11321
|
-
|
|
11874
|
+
_context32.n = 2;
|
|
11322
11875
|
break;
|
|
11323
11876
|
}
|
|
11324
|
-
return
|
|
11877
|
+
return _context32.a(2, this.registerIpAndAttachPilTerms(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11325
11878
|
licenseTermsData: licenseTermsData
|
|
11326
11879
|
})));
|
|
11327
11880
|
case 2:
|
|
11328
|
-
return
|
|
11881
|
+
return _context32.a(2, this.register(_objectSpread2({}, baseParams)));
|
|
11329
11882
|
}
|
|
11330
|
-
},
|
|
11883
|
+
}, _callee31, this);
|
|
11331
11884
|
}));
|
|
11332
|
-
function handleMintedNftRegistration(
|
|
11885
|
+
function handleMintedNftRegistration(_x29) {
|
|
11333
11886
|
return _handleMintedNftRegistration.apply(this, arguments);
|
|
11334
11887
|
}
|
|
11335
11888
|
return handleMintedNftRegistration;
|
|
@@ -11346,10 +11899,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11346
11899
|
}, {
|
|
11347
11900
|
key: "handleMintNftRegistration",
|
|
11348
11901
|
value: (function () {
|
|
11349
|
-
var _handleMintNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11902
|
+
var _handleMintNftRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32(request) {
|
|
11350
11903
|
var nft, ipMetadata, txOptions, options, licenseTermsData, royaltyShares, baseParams;
|
|
11351
|
-
return _regenerator().w(function (
|
|
11352
|
-
while (1) switch (
|
|
11904
|
+
return _regenerator().w(function (_context33) {
|
|
11905
|
+
while (1) switch (_context33.n) {
|
|
11353
11906
|
case 0:
|
|
11354
11907
|
nft = request.nft, ipMetadata = request.ipMetadata, txOptions = request.txOptions, options = request.options, licenseTermsData = request.licenseTermsData, royaltyShares = request.royaltyShares;
|
|
11355
11908
|
baseParams = {
|
|
@@ -11361,27 +11914,27 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11361
11914
|
options: options
|
|
11362
11915
|
};
|
|
11363
11916
|
if (!(licenseTermsData && royaltyShares)) {
|
|
11364
|
-
|
|
11917
|
+
_context33.n = 1;
|
|
11365
11918
|
break;
|
|
11366
11919
|
}
|
|
11367
|
-
return
|
|
11920
|
+
return _context33.a(2, this.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11368
11921
|
licenseTermsData: licenseTermsData,
|
|
11369
11922
|
royaltyShares: royaltyShares
|
|
11370
11923
|
})));
|
|
11371
11924
|
case 1:
|
|
11372
11925
|
if (!licenseTermsData) {
|
|
11373
|
-
|
|
11926
|
+
_context33.n = 2;
|
|
11374
11927
|
break;
|
|
11375
11928
|
}
|
|
11376
|
-
return
|
|
11929
|
+
return _context33.a(2, this.mintAndRegisterIpAssetWithPilTerms(_objectSpread2(_objectSpread2({}, baseParams), {}, {
|
|
11377
11930
|
licenseTermsData: licenseTermsData
|
|
11378
11931
|
})));
|
|
11379
11932
|
case 2:
|
|
11380
|
-
return
|
|
11933
|
+
return _context33.a(2, this.mintAndRegisterIp(_objectSpread2({}, baseParams)));
|
|
11381
11934
|
}
|
|
11382
|
-
},
|
|
11935
|
+
}, _callee32, this);
|
|
11383
11936
|
}));
|
|
11384
|
-
function handleMintNftRegistration(
|
|
11937
|
+
function handleMintNftRegistration(_x30) {
|
|
11385
11938
|
return _handleMintNftRegistration.apply(this, arguments);
|
|
11386
11939
|
}
|
|
11387
11940
|
return handleMintNftRegistration;
|
|
@@ -11389,48 +11942,48 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11389
11942
|
}, {
|
|
11390
11943
|
key: "getLicenseTermsId",
|
|
11391
11944
|
value: function () {
|
|
11392
|
-
var _getLicenseTermsId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11393
|
-
var licenseTermsIds, _iterator8, _step8, licenseTerm, licenseRes,
|
|
11394
|
-
return _regenerator().w(function (
|
|
11395
|
-
while (1) switch (
|
|
11945
|
+
var _getLicenseTermsId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33(licenseTerms) {
|
|
11946
|
+
var licenseTermsIds, _iterator8, _step8, licenseTerm, licenseRes, _t35;
|
|
11947
|
+
return _regenerator().w(function (_context34) {
|
|
11948
|
+
while (1) switch (_context34.p = _context34.n) {
|
|
11396
11949
|
case 0:
|
|
11397
11950
|
licenseTermsIds = [];
|
|
11398
11951
|
_iterator8 = _createForOfIteratorHelper(licenseTerms);
|
|
11399
|
-
|
|
11952
|
+
_context34.p = 1;
|
|
11400
11953
|
_iterator8.s();
|
|
11401
11954
|
case 2:
|
|
11402
11955
|
if ((_step8 = _iterator8.n()).done) {
|
|
11403
|
-
|
|
11956
|
+
_context34.n = 5;
|
|
11404
11957
|
break;
|
|
11405
11958
|
}
|
|
11406
11959
|
licenseTerm = _step8.value;
|
|
11407
|
-
|
|
11960
|
+
_context34.n = 3;
|
|
11408
11961
|
return this.licenseTemplateClient.getLicenseTermsId({
|
|
11409
11962
|
terms: licenseTerm
|
|
11410
11963
|
});
|
|
11411
11964
|
case 3:
|
|
11412
|
-
licenseRes =
|
|
11965
|
+
licenseRes = _context34.v;
|
|
11413
11966
|
licenseTermsIds.push(licenseRes.selectedLicenseTermsId);
|
|
11414
11967
|
case 4:
|
|
11415
|
-
|
|
11968
|
+
_context34.n = 2;
|
|
11416
11969
|
break;
|
|
11417
11970
|
case 5:
|
|
11418
|
-
|
|
11971
|
+
_context34.n = 7;
|
|
11419
11972
|
break;
|
|
11420
11973
|
case 6:
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
_iterator8.e(
|
|
11974
|
+
_context34.p = 6;
|
|
11975
|
+
_t35 = _context34.v;
|
|
11976
|
+
_iterator8.e(_t35);
|
|
11424
11977
|
case 7:
|
|
11425
|
-
|
|
11978
|
+
_context34.p = 7;
|
|
11426
11979
|
_iterator8.f();
|
|
11427
|
-
return
|
|
11980
|
+
return _context34.f(7);
|
|
11428
11981
|
case 8:
|
|
11429
|
-
return
|
|
11982
|
+
return _context34.a(2, licenseTermsIds);
|
|
11430
11983
|
}
|
|
11431
|
-
},
|
|
11984
|
+
}, _callee33, this, [[1, 6, 7, 8]]);
|
|
11432
11985
|
}));
|
|
11433
|
-
function getLicenseTermsId(
|
|
11986
|
+
function getLicenseTermsId(_x31) {
|
|
11434
11987
|
return _getLicenseTermsId.apply(this, arguments);
|
|
11435
11988
|
}
|
|
11436
11989
|
return getLicenseTermsId;
|
|
@@ -11438,13 +11991,13 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11438
11991
|
}, {
|
|
11439
11992
|
key: "validateLicenseTokenIds",
|
|
11440
11993
|
value: function () {
|
|
11441
|
-
var _validateLicenseTokenIds = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11442
|
-
var newLicenseTokenIds, _iterator9, _step9, licenseTokenId, tokenOwnerAddress,
|
|
11443
|
-
return _regenerator().w(function (
|
|
11444
|
-
while (1) switch (
|
|
11994
|
+
var _validateLicenseTokenIds = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34(licenseTokenIds) {
|
|
11995
|
+
var newLicenseTokenIds, _iterator9, _step9, licenseTokenId, tokenOwnerAddress, _t36;
|
|
11996
|
+
return _regenerator().w(function (_context35) {
|
|
11997
|
+
while (1) switch (_context35.p = _context35.n) {
|
|
11445
11998
|
case 0:
|
|
11446
11999
|
if (!(licenseTokenIds.length === 0)) {
|
|
11447
|
-
|
|
12000
|
+
_context35.n = 1;
|
|
11448
12001
|
break;
|
|
11449
12002
|
}
|
|
11450
12003
|
throw new Error("License token IDs must be provided.");
|
|
@@ -11453,45 +12006,45 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11453
12006
|
return BigInt(id);
|
|
11454
12007
|
});
|
|
11455
12008
|
_iterator9 = _createForOfIteratorHelper(newLicenseTokenIds);
|
|
11456
|
-
|
|
12009
|
+
_context35.p = 2;
|
|
11457
12010
|
_iterator9.s();
|
|
11458
12011
|
case 3:
|
|
11459
12012
|
if ((_step9 = _iterator9.n()).done) {
|
|
11460
|
-
|
|
12013
|
+
_context35.n = 6;
|
|
11461
12014
|
break;
|
|
11462
12015
|
}
|
|
11463
12016
|
licenseTokenId = _step9.value;
|
|
11464
|
-
|
|
12017
|
+
_context35.n = 4;
|
|
11465
12018
|
return this.licenseTokenReadOnlyClient.ownerOf({
|
|
11466
12019
|
tokenId: licenseTokenId
|
|
11467
12020
|
});
|
|
11468
12021
|
case 4:
|
|
11469
|
-
tokenOwnerAddress =
|
|
12022
|
+
tokenOwnerAddress = _context35.v;
|
|
11470
12023
|
if (tokenOwnerAddress) {
|
|
11471
|
-
|
|
12024
|
+
_context35.n = 5;
|
|
11472
12025
|
break;
|
|
11473
12026
|
}
|
|
11474
12027
|
throw new Error("License token id ".concat(licenseTokenId, " must be owned by the caller."));
|
|
11475
12028
|
case 5:
|
|
11476
|
-
|
|
12029
|
+
_context35.n = 3;
|
|
11477
12030
|
break;
|
|
11478
12031
|
case 6:
|
|
11479
|
-
|
|
12032
|
+
_context35.n = 8;
|
|
11480
12033
|
break;
|
|
11481
12034
|
case 7:
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
_iterator9.e(
|
|
12035
|
+
_context35.p = 7;
|
|
12036
|
+
_t36 = _context35.v;
|
|
12037
|
+
_iterator9.e(_t36);
|
|
11485
12038
|
case 8:
|
|
11486
|
-
|
|
12039
|
+
_context35.p = 8;
|
|
11487
12040
|
_iterator9.f();
|
|
11488
|
-
return
|
|
12041
|
+
return _context35.f(8);
|
|
11489
12042
|
case 9:
|
|
11490
|
-
return
|
|
12043
|
+
return _context35.a(2, newLicenseTokenIds);
|
|
11491
12044
|
}
|
|
11492
|
-
},
|
|
12045
|
+
}, _callee34, this, [[2, 7, 8, 9]]);
|
|
11493
12046
|
}));
|
|
11494
|
-
function validateLicenseTokenIds(
|
|
12047
|
+
function validateLicenseTokenIds(_x32) {
|
|
11495
12048
|
return _validateLicenseTokenIds.apply(this, arguments);
|
|
11496
12049
|
}
|
|
11497
12050
|
return validateLicenseTokenIds;
|
|
@@ -11514,28 +12067,28 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11514
12067
|
}, {
|
|
11515
12068
|
key: "handleRegistrationWithFees",
|
|
11516
12069
|
value: function () {
|
|
11517
|
-
var _handleRegistrationWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
12070
|
+
var _handleRegistrationWithFees = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35(_ref6) {
|
|
11518
12071
|
var _wipOptions$useMultic, _this$getIpIdAndToken, _event$ipId, _event$tokenId;
|
|
11519
12072
|
var sender, derivData, spgNftContract, spgSpenderAddress, txOptions, options, encodedTxs, contractCall, tokenSpenders, wipOptions, useMulticallWhenPossible, nftMintFee, publicMinting, mintFees, _iterator0, _step0, mintFee, _yield$contractCallWi, txHash, receipt, event;
|
|
11520
|
-
return _regenerator().w(function (
|
|
11521
|
-
while (1) switch (
|
|
12073
|
+
return _regenerator().w(function (_context36) {
|
|
12074
|
+
while (1) switch (_context36.n) {
|
|
11522
12075
|
case 0:
|
|
11523
|
-
sender =
|
|
12076
|
+
sender = _ref6.sender, derivData = _ref6.derivData, spgNftContract = _ref6.spgNftContract, spgSpenderAddress = _ref6.spgSpenderAddress, txOptions = _ref6.txOptions, options = _ref6.options, encodedTxs = _ref6.encodedTxs, contractCall = _ref6.contractCall;
|
|
11524
12077
|
tokenSpenders = [];
|
|
11525
12078
|
wipOptions = options === null || options === void 0 ? void 0 : options.wipOptions;
|
|
11526
12079
|
useMulticallWhenPossible = (_wipOptions$useMultic = wipOptions === null || wipOptions === void 0 ? void 0 : wipOptions.useMulticallWhenPossible) !== null && _wipOptions$useMultic !== void 0 ? _wipOptions$useMultic : true; // get spg minting fee
|
|
11527
12080
|
if (!spgNftContract) {
|
|
11528
|
-
|
|
12081
|
+
_context36.n = 3;
|
|
11529
12082
|
break;
|
|
11530
12083
|
}
|
|
11531
|
-
|
|
12084
|
+
_context36.n = 1;
|
|
11532
12085
|
return calculateSPGMintFee(new SpgnftImplReadOnlyClient(this.rpcClient, spgNftContract));
|
|
11533
12086
|
case 1:
|
|
11534
|
-
nftMintFee =
|
|
11535
|
-
|
|
12087
|
+
nftMintFee = _context36.v;
|
|
12088
|
+
_context36.n = 2;
|
|
11536
12089
|
return getPublicMinting(spgNftContract, this.rpcClient);
|
|
11537
12090
|
case 2:
|
|
11538
|
-
publicMinting =
|
|
12091
|
+
publicMinting = _context36.v;
|
|
11539
12092
|
/**
|
|
11540
12093
|
* If the SPG NFT contract's public minting is disabled, we need to check if the caller has the `minter role`.
|
|
11541
12094
|
* When public minting is disabled, we can't use multicall because we need to perform additional role checks
|
|
@@ -11552,10 +12105,10 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11552
12105
|
}, nftMintFee)] : []));
|
|
11553
12106
|
case 3:
|
|
11554
12107
|
if (!derivData) {
|
|
11555
|
-
|
|
12108
|
+
_context36.n = 5;
|
|
11556
12109
|
break;
|
|
11557
12110
|
}
|
|
11558
|
-
|
|
12111
|
+
_context36.n = 4;
|
|
11559
12112
|
return calculateDerivativeMintingFee({
|
|
11560
12113
|
derivData: derivData,
|
|
11561
12114
|
rpcClient: this.rpcClient,
|
|
@@ -11564,7 +12117,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11564
12117
|
sender: sender
|
|
11565
12118
|
});
|
|
11566
12119
|
case 4:
|
|
11567
|
-
mintFees =
|
|
12120
|
+
mintFees = _context36.v;
|
|
11568
12121
|
_iterator0 = _createForOfIteratorHelper(mintFees);
|
|
11569
12122
|
try {
|
|
11570
12123
|
for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
|
|
@@ -11579,7 +12132,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11579
12132
|
_iterator0.f();
|
|
11580
12133
|
}
|
|
11581
12134
|
case 5:
|
|
11582
|
-
|
|
12135
|
+
_context36.n = 6;
|
|
11583
12136
|
return contractCallWithFees({
|
|
11584
12137
|
options: _objectSpread2(_objectSpread2({}, options), {}, {
|
|
11585
12138
|
wipOptions: _objectSpread2(_objectSpread2({}, wipOptions), {}, {
|
|
@@ -11596,11 +12149,11 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11596
12149
|
encodedTxs: encodedTxs
|
|
11597
12150
|
});
|
|
11598
12151
|
case 6:
|
|
11599
|
-
_yield$contractCallWi =
|
|
12152
|
+
_yield$contractCallWi = _context36.v;
|
|
11600
12153
|
txHash = _yield$contractCallWi.txHash;
|
|
11601
12154
|
receipt = _yield$contractCallWi.receipt;
|
|
11602
12155
|
event = (_this$getIpIdAndToken = this.getIpIdAndTokenIdsFromEvent(receipt)) === null || _this$getIpIdAndToken === void 0 ? void 0 : _this$getIpIdAndToken[0];
|
|
11603
|
-
return
|
|
12156
|
+
return _context36.a(2, _objectSpread2({
|
|
11604
12157
|
txHash: txHash,
|
|
11605
12158
|
receipt: receipt
|
|
11606
12159
|
}, event && {
|
|
@@ -11608,9 +12161,9 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11608
12161
|
tokenId: (_event$tokenId = event.tokenId) !== null && _event$tokenId !== void 0 ? _event$tokenId : undefined
|
|
11609
12162
|
}));
|
|
11610
12163
|
}
|
|
11611
|
-
},
|
|
12164
|
+
}, _callee35, this);
|
|
11612
12165
|
}));
|
|
11613
|
-
function handleRegistrationWithFees(
|
|
12166
|
+
function handleRegistrationWithFees(_x33) {
|
|
11614
12167
|
return _handleRegistrationWithFees.apply(this, arguments);
|
|
11615
12168
|
}
|
|
11616
12169
|
return handleRegistrationWithFees;
|
|
@@ -11621,66 +12174,66 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11621
12174
|
}, {
|
|
11622
12175
|
key: "populateLicenseAndTokenIdsForRegistrationResults",
|
|
11623
12176
|
value: (function () {
|
|
11624
|
-
var _populateLicenseAndTokenIdsForRegistrationResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11625
|
-
var allExtraDataArrays, allExtraData, extraDataFlatIndex, _iterator1, _step1, registrationResult, i, ipAsset,
|
|
11626
|
-
return _regenerator().w(function (
|
|
11627
|
-
while (1) switch (
|
|
12177
|
+
var _populateLicenseAndTokenIdsForRegistrationResults = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36(registrationResults, aggregateRegistrationRequest) {
|
|
12178
|
+
var allExtraDataArrays, allExtraData, extraDataFlatIndex, _iterator1, _step1, registrationResult, i, ipAsset, _t37;
|
|
12179
|
+
return _regenerator().w(function (_context37) {
|
|
12180
|
+
while (1) switch (_context37.p = _context37.n) {
|
|
11628
12181
|
case 0:
|
|
11629
|
-
allExtraDataArrays = Object.values(aggregateRegistrationRequest).map(function (
|
|
11630
|
-
var extraData =
|
|
12182
|
+
allExtraDataArrays = Object.values(aggregateRegistrationRequest).map(function (_ref7) {
|
|
12183
|
+
var extraData = _ref7.extraData;
|
|
11631
12184
|
return extraData;
|
|
11632
12185
|
});
|
|
11633
12186
|
allExtraData = allExtraDataArrays.flat();
|
|
11634
12187
|
extraDataFlatIndex = -1;
|
|
11635
12188
|
_iterator1 = _createForOfIteratorHelper(registrationResults);
|
|
11636
|
-
|
|
12189
|
+
_context37.p = 1;
|
|
11637
12190
|
_iterator1.s();
|
|
11638
12191
|
case 2:
|
|
11639
12192
|
if ((_step1 = _iterator1.n()).done) {
|
|
11640
|
-
|
|
12193
|
+
_context37.n = 7;
|
|
11641
12194
|
break;
|
|
11642
12195
|
}
|
|
11643
12196
|
registrationResult = _step1.value;
|
|
11644
12197
|
i = 0;
|
|
11645
12198
|
case 3:
|
|
11646
12199
|
if (!(i < registrationResult.ipAssetsWithLicenseTerms.length)) {
|
|
11647
|
-
|
|
12200
|
+
_context37.n = 6;
|
|
11648
12201
|
break;
|
|
11649
12202
|
}
|
|
11650
12203
|
extraDataFlatIndex++;
|
|
11651
12204
|
if (!(registrationResult.ipAssetsWithLicenseTerms[i] && allExtraData[extraDataFlatIndex])) {
|
|
11652
|
-
|
|
12205
|
+
_context37.n = 5;
|
|
11653
12206
|
break;
|
|
11654
12207
|
}
|
|
11655
|
-
|
|
12208
|
+
_context37.n = 4;
|
|
11656
12209
|
return this.processIpAssetLicenseTerms(registrationResult.ipAssetsWithLicenseTerms[i], allExtraData[extraDataFlatIndex]);
|
|
11657
12210
|
case 4:
|
|
11658
|
-
ipAsset =
|
|
12211
|
+
ipAsset = _context37.v;
|
|
11659
12212
|
registrationResult.ipAssetsWithLicenseTerms[i] = ipAsset;
|
|
11660
12213
|
case 5:
|
|
11661
12214
|
i++;
|
|
11662
|
-
|
|
12215
|
+
_context37.n = 3;
|
|
11663
12216
|
break;
|
|
11664
12217
|
case 6:
|
|
11665
|
-
|
|
12218
|
+
_context37.n = 2;
|
|
11666
12219
|
break;
|
|
11667
12220
|
case 7:
|
|
11668
|
-
|
|
12221
|
+
_context37.n = 9;
|
|
11669
12222
|
break;
|
|
11670
12223
|
case 8:
|
|
11671
|
-
|
|
11672
|
-
|
|
11673
|
-
_iterator1.e(
|
|
12224
|
+
_context37.p = 8;
|
|
12225
|
+
_t37 = _context37.v;
|
|
12226
|
+
_iterator1.e(_t37);
|
|
11674
12227
|
case 9:
|
|
11675
|
-
|
|
12228
|
+
_context37.p = 9;
|
|
11676
12229
|
_iterator1.f();
|
|
11677
|
-
return
|
|
12230
|
+
return _context37.f(9);
|
|
11678
12231
|
case 10:
|
|
11679
|
-
return
|
|
12232
|
+
return _context37.a(2, registrationResults);
|
|
11680
12233
|
}
|
|
11681
|
-
},
|
|
12234
|
+
}, _callee36, this, [[1, 8, 9, 10]]);
|
|
11682
12235
|
}));
|
|
11683
|
-
function populateLicenseAndTokenIdsForRegistrationResults(
|
|
12236
|
+
function populateLicenseAndTokenIdsForRegistrationResults(_x34, _x35) {
|
|
11684
12237
|
return _populateLicenseAndTokenIdsForRegistrationResults.apply(this, arguments);
|
|
11685
12238
|
}
|
|
11686
12239
|
return populateLicenseAndTokenIdsForRegistrationResults;
|
|
@@ -11688,31 +12241,31 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11688
12241
|
}, {
|
|
11689
12242
|
key: "processIpAssetLicenseTerms",
|
|
11690
12243
|
value: function () {
|
|
11691
|
-
var _processIpAssetLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
12244
|
+
var _processIpAssetLicenseTerms = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37(ipAsset, extraData) {
|
|
11692
12245
|
var _extraData$licenseTer;
|
|
11693
12246
|
var licenseTermsIds, maxLicenseTokens, maxLicenseTokensData, maxLicenseTokensTxHashes;
|
|
11694
|
-
return _regenerator().w(function (
|
|
11695
|
-
while (1) switch (
|
|
12247
|
+
return _regenerator().w(function (_context38) {
|
|
12248
|
+
while (1) switch (_context38.n) {
|
|
11696
12249
|
case 0:
|
|
11697
12250
|
if (extraData !== null && extraData !== void 0 && (_extraData$licenseTer = extraData.licenseTermsData) !== null && _extraData$licenseTer !== void 0 && _extraData$licenseTer.length) {
|
|
11698
|
-
|
|
12251
|
+
_context38.n = 1;
|
|
11699
12252
|
break;
|
|
11700
12253
|
}
|
|
11701
|
-
return
|
|
12254
|
+
return _context38.a(2, ipAsset);
|
|
11702
12255
|
case 1:
|
|
11703
|
-
|
|
12256
|
+
_context38.n = 2;
|
|
11704
12257
|
return this.getLicenseTermsId(extraData.licenseTermsData.map(function (item) {
|
|
11705
12258
|
return item.terms;
|
|
11706
12259
|
}));
|
|
11707
12260
|
case 2:
|
|
11708
|
-
licenseTermsIds =
|
|
12261
|
+
licenseTermsIds = _context38.v;
|
|
11709
12262
|
ipAsset.licenseTermsIds = licenseTermsIds;
|
|
11710
12263
|
maxLicenseTokens = extraData.maxLicenseTokens;
|
|
11711
12264
|
if (maxLicenseTokens !== null && maxLicenseTokens !== void 0 && maxLicenseTokens.length) {
|
|
11712
|
-
|
|
12265
|
+
_context38.n = 3;
|
|
11713
12266
|
break;
|
|
11714
12267
|
}
|
|
11715
|
-
return
|
|
12268
|
+
return _context38.a(2, ipAsset);
|
|
11716
12269
|
case 3:
|
|
11717
12270
|
maxLicenseTokensData = maxLicenseTokens.filter(function (maxLicenseToken) {
|
|
11718
12271
|
return maxLicenseToken !== undefined;
|
|
@@ -11721,7 +12274,7 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11721
12274
|
maxLicenseTokens: maxLicenseToken
|
|
11722
12275
|
};
|
|
11723
12276
|
});
|
|
11724
|
-
|
|
12277
|
+
_context38.n = 4;
|
|
11725
12278
|
return setMaxLicenseTokens({
|
|
11726
12279
|
maxLicenseTokensData: maxLicenseTokensData,
|
|
11727
12280
|
licensorIpId: ipAsset.ipId,
|
|
@@ -11730,15 +12283,15 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11730
12283
|
templateAddress: this.licenseTemplateAddress
|
|
11731
12284
|
});
|
|
11732
12285
|
case 4:
|
|
11733
|
-
maxLicenseTokensTxHashes =
|
|
12286
|
+
maxLicenseTokensTxHashes = _context38.v;
|
|
11734
12287
|
if (maxLicenseTokensTxHashes !== null && maxLicenseTokensTxHashes !== void 0 && maxLicenseTokensTxHashes.length) {
|
|
11735
12288
|
ipAsset.maxLicenseTokensTxHashes = maxLicenseTokensTxHashes;
|
|
11736
12289
|
}
|
|
11737
|
-
return
|
|
12290
|
+
return _context38.a(2, ipAsset);
|
|
11738
12291
|
}
|
|
11739
|
-
},
|
|
12292
|
+
}, _callee37, this);
|
|
11740
12293
|
}));
|
|
11741
|
-
function processIpAssetLicenseTerms(
|
|
12294
|
+
function processIpAssetLicenseTerms(_x36, _x37) {
|
|
11742
12295
|
return _processIpAssetLicenseTerms.apply(this, arguments);
|
|
11743
12296
|
}
|
|
11744
12297
|
return processIpAssetLicenseTerms;
|
|
@@ -11746,53 +12299,53 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
|
11746
12299
|
}, {
|
|
11747
12300
|
key: "approveLicenseTokensForDerivativeWorkflows",
|
|
11748
12301
|
value: function () {
|
|
11749
|
-
var _approveLicenseTokensForDerivativeWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
11750
|
-
var _iterator10, _step10, licenseTokenId, txHash,
|
|
11751
|
-
return _regenerator().w(function (
|
|
11752
|
-
while (1) switch (
|
|
12302
|
+
var _approveLicenseTokensForDerivativeWorkflows = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38(licenseTokenIds, autoApproveLicenseTokens) {
|
|
12303
|
+
var _iterator10, _step10, licenseTokenId, txHash, _t38;
|
|
12304
|
+
return _regenerator().w(function (_context39) {
|
|
12305
|
+
while (1) switch (_context39.p = _context39.n) {
|
|
11753
12306
|
case 0:
|
|
11754
12307
|
if (!(autoApproveLicenseTokens !== false)) {
|
|
11755
|
-
|
|
12308
|
+
_context39.n = 8;
|
|
11756
12309
|
break;
|
|
11757
12310
|
}
|
|
11758
12311
|
_iterator10 = _createForOfIteratorHelper(licenseTokenIds);
|
|
11759
|
-
|
|
12312
|
+
_context39.p = 1;
|
|
11760
12313
|
_iterator10.s();
|
|
11761
12314
|
case 2:
|
|
11762
12315
|
if ((_step10 = _iterator10.n()).done) {
|
|
11763
|
-
|
|
12316
|
+
_context39.n = 5;
|
|
11764
12317
|
break;
|
|
11765
12318
|
}
|
|
11766
12319
|
licenseTokenId = _step10.value;
|
|
11767
|
-
|
|
12320
|
+
_context39.n = 3;
|
|
11768
12321
|
return this.licenseTokenClient.approve({
|
|
11769
12322
|
to: this.derivativeWorkflowsClient.address,
|
|
11770
12323
|
tokenId: BigInt(licenseTokenId)
|
|
11771
12324
|
});
|
|
11772
12325
|
case 3:
|
|
11773
|
-
txHash =
|
|
11774
|
-
|
|
12326
|
+
txHash = _context39.v;
|
|
12327
|
+
_context39.n = 4;
|
|
11775
12328
|
return waitTx(this.rpcClient, txHash);
|
|
11776
12329
|
case 4:
|
|
11777
|
-
|
|
12330
|
+
_context39.n = 2;
|
|
11778
12331
|
break;
|
|
11779
12332
|
case 5:
|
|
11780
|
-
|
|
12333
|
+
_context39.n = 7;
|
|
11781
12334
|
break;
|
|
11782
12335
|
case 6:
|
|
11783
|
-
|
|
11784
|
-
|
|
11785
|
-
_iterator10.e(
|
|
12336
|
+
_context39.p = 6;
|
|
12337
|
+
_t38 = _context39.v;
|
|
12338
|
+
_iterator10.e(_t38);
|
|
11786
12339
|
case 7:
|
|
11787
|
-
|
|
12340
|
+
_context39.p = 7;
|
|
11788
12341
|
_iterator10.f();
|
|
11789
|
-
return
|
|
12342
|
+
return _context39.f(7);
|
|
11790
12343
|
case 8:
|
|
11791
|
-
return
|
|
12344
|
+
return _context39.a(2);
|
|
11792
12345
|
}
|
|
11793
|
-
},
|
|
12346
|
+
}, _callee38, this, [[1, 6, 7, 8]]);
|
|
11794
12347
|
}));
|
|
11795
|
-
function approveLicenseTokensForDerivativeWorkflows(
|
|
12348
|
+
function approveLicenseTokensForDerivativeWorkflows(_x38, _x39) {
|
|
11796
12349
|
return _approveLicenseTokensForDerivativeWorkflows.apply(this, arguments);
|
|
11797
12350
|
}
|
|
11798
12351
|
return approveLicenseTokensForDerivativeWorkflows;
|
|
@@ -12356,7 +12909,8 @@ var LicenseClient = /*#__PURE__*/function () {
|
|
|
12356
12909
|
licensingConfig: _objectSpread2(_objectSpread2({}, licensingConfig), {}, {
|
|
12357
12910
|
licensingHook: this.totalLicenseTokenLimitHookClient.address,
|
|
12358
12911
|
// use Math.trunc to avoid precision issues
|
|
12359
|
-
expectMinimumGroupRewardShare: Math.trunc(licensingConfig.expectMinimumGroupRewardShare / 1000000)
|
|
12912
|
+
expectMinimumGroupRewardShare: Math.trunc(licensingConfig.expectMinimumGroupRewardShare / 1000000),
|
|
12913
|
+
commercialRevShare: Math.trunc(licensingConfig.commercialRevShare / 1000000)
|
|
12360
12914
|
})
|
|
12361
12915
|
});
|
|
12362
12916
|
case 4:
|
|
@@ -14816,6 +15370,16 @@ var AIRelationship = /*#__PURE__*/function (AIRelationship) {
|
|
|
14816
15370
|
* For more information, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-terms | PIL}.
|
|
14817
15371
|
**/
|
|
14818
15372
|
|
|
15373
|
+
/**
|
|
15374
|
+
* The data of the license and its configuration to be attached to the IP.
|
|
15375
|
+
*
|
|
15376
|
+
* You must provide either `licenseTermsId` or `terms`:
|
|
15377
|
+
* - `licenseTermsId`: Use an existing pre-registered license terms
|
|
15378
|
+
* - `terms`: Register new license terms and attach
|
|
15379
|
+
*
|
|
15380
|
+
* If both are provided, `terms` takes priority and new terms will be registered.
|
|
15381
|
+
*/
|
|
15382
|
+
|
|
14819
15383
|
/**
|
|
14820
15384
|
* @deprecated Use `PILFlavor.nonCommercialSocialRemixing`, `PILFlavor.commercialUse`, `PILFlavor.commercialRemix`, or `PILFlavor.creativeCommonsAttribution` instead.
|
|
14821
15385
|
*
|