@story-protocol/core-sdk 1.0.0-rc.17 → 1.0.0-rc.19

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.
@@ -478,9 +478,9 @@ function _asyncToGenerator(fn) {
478
478
  };
479
479
  }
480
480
 
481
- var storyTestChain = defineChain({
481
+ var iliad = defineChain({
482
482
  id: 1513,
483
- name: "story-testnet",
483
+ name: "iliad",
484
484
  nativeCurrency: {
485
485
  name: "IP",
486
486
  symbol: "IP",
@@ -488,14 +488,14 @@ var storyTestChain = defineChain({
488
488
  },
489
489
  rpcUrls: {
490
490
  "default": {
491
- http: ["https://rpc.partner.testnet.storyprotocol.net"],
491
+ http: ["https://testnet.storyrpc.io"],
492
492
  webSocket: ["wss://story-network.rpc.caldera.xyz/ws"]
493
493
  }
494
494
  },
495
495
  blockExplorers: {
496
496
  "default": {
497
497
  name: "Explorer",
498
- url: "https://explorer.testnet.storyprotocol.net"
498
+ url: "https://testnet.storyscan.xyz"
499
499
  }
500
500
  },
501
501
  contracts: {
@@ -510,7 +510,7 @@ function chainStringToViemChain(chainId) {
510
510
  switch (chainId) {
511
511
  case "1513":
512
512
  case "iliad":
513
- return storyTestChain;
513
+ return iliad;
514
514
  default:
515
515
  throw new Error("chainId ".concat(chainId, " not supported"));
516
516
  }
@@ -9300,6 +9300,22 @@ var spgAbi = [{
9300
9300
  type: "error",
9301
9301
  inputs: [],
9302
9302
  name: "NotInitializing"
9303
+ }, {
9304
+ type: "error",
9305
+ inputs: [{
9306
+ name: "tokenId",
9307
+ internalType: "uint256",
9308
+ type: "uint256"
9309
+ }, {
9310
+ name: "caller",
9311
+ internalType: "address",
9312
+ type: "address"
9313
+ }, {
9314
+ name: "actualTokenOwner",
9315
+ internalType: "address",
9316
+ type: "address"
9317
+ }],
9318
+ name: "SPG__CallerAndNotTokenOwner"
9303
9319
  }, {
9304
9320
  type: "error",
9305
9321
  inputs: [],
@@ -9536,22 +9552,22 @@ var spgAbi = [{
9536
9552
  name: "recipient",
9537
9553
  internalType: "address",
9538
9554
  type: "address"
9539
- }, {
9540
- name: "nftMetadata",
9541
- internalType: "string",
9542
- type: "string"
9543
9555
  }, {
9544
9556
  name: "ipMetadata",
9545
9557
  internalType: "struct IStoryProtocolGateway.IPMetadata",
9546
9558
  type: "tuple",
9547
9559
  components: [{
9548
- name: "metadataURI",
9560
+ name: "ipMetadataURI",
9549
9561
  internalType: "string",
9550
9562
  type: "string"
9551
9563
  }, {
9552
- name: "metadataHash",
9564
+ name: "ipMetadataHash",
9553
9565
  internalType: "bytes32",
9554
9566
  type: "bytes32"
9567
+ }, {
9568
+ name: "nftMetadataURI",
9569
+ internalType: "string",
9570
+ type: "string"
9555
9571
  }, {
9556
9572
  name: "nftMetadataHash",
9557
9573
  internalType: "bytes32",
@@ -9579,22 +9595,22 @@ var spgAbi = [{
9579
9595
  name: "recipient",
9580
9596
  internalType: "address",
9581
9597
  type: "address"
9582
- }, {
9583
- name: "nftMetadata",
9584
- internalType: "string",
9585
- type: "string"
9586
9598
  }, {
9587
9599
  name: "ipMetadata",
9588
9600
  internalType: "struct IStoryProtocolGateway.IPMetadata",
9589
9601
  type: "tuple",
9590
9602
  components: [{
9591
- name: "metadataURI",
9603
+ name: "ipMetadataURI",
9592
9604
  internalType: "string",
9593
9605
  type: "string"
9594
9606
  }, {
9595
- name: "metadataHash",
9607
+ name: "ipMetadataHash",
9596
9608
  internalType: "bytes32",
9597
9609
  type: "bytes32"
9610
+ }, {
9611
+ name: "nftMetadataURI",
9612
+ internalType: "string",
9613
+ type: "string"
9598
9614
  }, {
9599
9615
  name: "nftMetadataHash",
9600
9616
  internalType: "bytes32",
@@ -9613,7 +9629,7 @@ var spgAbi = [{
9613
9629
  internalType: "address",
9614
9630
  type: "address"
9615
9631
  }, {
9616
- name: "mintingFee",
9632
+ name: "defaultMintingFee",
9617
9633
  internalType: "uint256",
9618
9634
  type: "uint256"
9619
9635
  }, {
@@ -9641,7 +9657,7 @@ var spgAbi = [{
9641
9657
  internalType: "uint32",
9642
9658
  type: "uint32"
9643
9659
  }, {
9644
- name: "commercialRevCelling",
9660
+ name: "commercialRevCeiling",
9645
9661
  internalType: "uint256",
9646
9662
  type: "uint256"
9647
9663
  }, {
@@ -9661,7 +9677,7 @@ var spgAbi = [{
9661
9677
  internalType: "bool",
9662
9678
  type: "bool"
9663
9679
  }, {
9664
- name: "derivativeRevCelling",
9680
+ name: "derivativeRevCeiling",
9665
9681
  internalType: "uint256",
9666
9682
  type: "uint256"
9667
9683
  }, {
@@ -9716,22 +9732,22 @@ var spgAbi = [{
9716
9732
  internalType: "bytes",
9717
9733
  type: "bytes"
9718
9734
  }]
9719
- }, {
9720
- name: "nftMetadata",
9721
- internalType: "string",
9722
- type: "string"
9723
9735
  }, {
9724
9736
  name: "ipMetadata",
9725
9737
  internalType: "struct IStoryProtocolGateway.IPMetadata",
9726
9738
  type: "tuple",
9727
9739
  components: [{
9728
- name: "metadataURI",
9740
+ name: "ipMetadataURI",
9729
9741
  internalType: "string",
9730
9742
  type: "string"
9731
9743
  }, {
9732
- name: "metadataHash",
9744
+ name: "ipMetadataHash",
9733
9745
  internalType: "bytes32",
9734
9746
  type: "bytes32"
9747
+ }, {
9748
+ name: "nftMetadataURI",
9749
+ internalType: "string",
9750
+ type: "string"
9735
9751
  }, {
9736
9752
  name: "nftMetadataHash",
9737
9753
  internalType: "bytes32",
@@ -9767,22 +9783,22 @@ var spgAbi = [{
9767
9783
  name: "royaltyContext",
9768
9784
  internalType: "bytes",
9769
9785
  type: "bytes"
9770
- }, {
9771
- name: "nftMetadata",
9772
- internalType: "string",
9773
- type: "string"
9774
9786
  }, {
9775
9787
  name: "ipMetadata",
9776
9788
  internalType: "struct IStoryProtocolGateway.IPMetadata",
9777
9789
  type: "tuple",
9778
9790
  components: [{
9779
- name: "metadataURI",
9791
+ name: "ipMetadataURI",
9780
9792
  internalType: "string",
9781
9793
  type: "string"
9782
9794
  }, {
9783
- name: "metadataHash",
9795
+ name: "ipMetadataHash",
9784
9796
  internalType: "bytes32",
9785
9797
  type: "bytes32"
9798
+ }, {
9799
+ name: "nftMetadataURI",
9800
+ internalType: "string",
9801
+ type: "string"
9786
9802
  }, {
9787
9803
  name: "nftMetadataHash",
9788
9804
  internalType: "bytes32",
@@ -9804,6 +9820,32 @@ var spgAbi = [{
9804
9820
  type: "uint256"
9805
9821
  }],
9806
9822
  stateMutability: "nonpayable"
9823
+ }, {
9824
+ type: "function",
9825
+ inputs: [{
9826
+ name: "",
9827
+ internalType: "address",
9828
+ type: "address"
9829
+ }, {
9830
+ name: "",
9831
+ internalType: "address",
9832
+ type: "address"
9833
+ }, {
9834
+ name: "",
9835
+ internalType: "uint256",
9836
+ type: "uint256"
9837
+ }, {
9838
+ name: "",
9839
+ internalType: "bytes",
9840
+ type: "bytes"
9841
+ }],
9842
+ name: "onERC721Received",
9843
+ outputs: [{
9844
+ name: "",
9845
+ internalType: "bytes4",
9846
+ type: "bytes4"
9847
+ }],
9848
+ stateMutability: "nonpayable"
9807
9849
  }, {
9808
9850
  type: "function",
9809
9851
  inputs: [],
@@ -9829,13 +9871,17 @@ var spgAbi = [{
9829
9871
  internalType: "struct IStoryProtocolGateway.IPMetadata",
9830
9872
  type: "tuple",
9831
9873
  components: [{
9832
- name: "metadataURI",
9874
+ name: "ipMetadataURI",
9833
9875
  internalType: "string",
9834
9876
  type: "string"
9835
9877
  }, {
9836
- name: "metadataHash",
9878
+ name: "ipMetadataHash",
9837
9879
  internalType: "bytes32",
9838
9880
  type: "bytes32"
9881
+ }, {
9882
+ name: "nftMetadataURI",
9883
+ internalType: "string",
9884
+ type: "string"
9839
9885
  }, {
9840
9886
  name: "nftMetadataHash",
9841
9887
  internalType: "bytes32",
@@ -9881,13 +9927,17 @@ var spgAbi = [{
9881
9927
  internalType: "struct IStoryProtocolGateway.IPMetadata",
9882
9928
  type: "tuple",
9883
9929
  components: [{
9884
- name: "metadataURI",
9930
+ name: "ipMetadataURI",
9885
9931
  internalType: "string",
9886
9932
  type: "string"
9887
9933
  }, {
9888
- name: "metadataHash",
9934
+ name: "ipMetadataHash",
9889
9935
  internalType: "bytes32",
9890
9936
  type: "bytes32"
9937
+ }, {
9938
+ name: "nftMetadataURI",
9939
+ internalType: "string",
9940
+ type: "string"
9891
9941
  }, {
9892
9942
  name: "nftMetadataHash",
9893
9943
  internalType: "bytes32",
@@ -9906,7 +9956,7 @@ var spgAbi = [{
9906
9956
  internalType: "address",
9907
9957
  type: "address"
9908
9958
  }, {
9909
- name: "mintingFee",
9959
+ name: "defaultMintingFee",
9910
9960
  internalType: "uint256",
9911
9961
  type: "uint256"
9912
9962
  }, {
@@ -9934,7 +9984,7 @@ var spgAbi = [{
9934
9984
  internalType: "uint32",
9935
9985
  type: "uint32"
9936
9986
  }, {
9937
- name: "commercialRevCelling",
9987
+ name: "commercialRevCeiling",
9938
9988
  internalType: "uint256",
9939
9989
  type: "uint256"
9940
9990
  }, {
@@ -9954,7 +10004,7 @@ var spgAbi = [{
9954
10004
  internalType: "bool",
9955
10005
  type: "bool"
9956
10006
  }, {
9957
- name: "derivativeRevCelling",
10007
+ name: "derivativeRevCeiling",
9958
10008
  internalType: "uint256",
9959
10009
  type: "uint256"
9960
10010
  }, {
@@ -10048,13 +10098,17 @@ var spgAbi = [{
10048
10098
  internalType: "struct IStoryProtocolGateway.IPMetadata",
10049
10099
  type: "tuple",
10050
10100
  components: [{
10051
- name: "metadataURI",
10101
+ name: "ipMetadataURI",
10052
10102
  internalType: "string",
10053
10103
  type: "string"
10054
10104
  }, {
10055
- name: "metadataHash",
10105
+ name: "ipMetadataHash",
10056
10106
  internalType: "bytes32",
10057
10107
  type: "bytes32"
10108
+ }, {
10109
+ name: "nftMetadataURI",
10110
+ internalType: "string",
10111
+ type: "string"
10058
10112
  }, {
10059
10113
  name: "nftMetadataHash",
10060
10114
  internalType: "bytes32",
@@ -10125,13 +10179,17 @@ var spgAbi = [{
10125
10179
  internalType: "struct IStoryProtocolGateway.IPMetadata",
10126
10180
  type: "tuple",
10127
10181
  components: [{
10128
- name: "metadataURI",
10182
+ name: "ipMetadataURI",
10129
10183
  internalType: "string",
10130
10184
  type: "string"
10131
10185
  }, {
10132
- name: "metadataHash",
10186
+ name: "ipMetadataHash",
10133
10187
  internalType: "bytes32",
10134
10188
  type: "bytes32"
10189
+ }, {
10190
+ name: "nftMetadataURI",
10191
+ internalType: "string",
10192
+ type: "string"
10135
10193
  }, {
10136
10194
  name: "nftMetadataHash",
10137
10195
  internalType: "bytes32",
@@ -10198,7 +10256,7 @@ var spgAbi = [{
10198
10256
  internalType: "address",
10199
10257
  type: "address"
10200
10258
  }, {
10201
- name: "mintingFee",
10259
+ name: "defaultMintingFee",
10202
10260
  internalType: "uint256",
10203
10261
  type: "uint256"
10204
10262
  }, {
@@ -10226,7 +10284,7 @@ var spgAbi = [{
10226
10284
  internalType: "uint32",
10227
10285
  type: "uint32"
10228
10286
  }, {
10229
- name: "commercialRevCelling",
10287
+ name: "commercialRevCeiling",
10230
10288
  internalType: "uint256",
10231
10289
  type: "uint256"
10232
10290
  }, {
@@ -10246,7 +10304,7 @@ var spgAbi = [{
10246
10304
  internalType: "bool",
10247
10305
  type: "bool"
10248
10306
  }, {
10249
- name: "derivativeRevCelling",
10307
+ name: "derivativeRevCeiling",
10250
10308
  internalType: "uint256",
10251
10309
  type: "uint256"
10252
10310
  }, {
@@ -17461,7 +17519,6 @@ var RoyaltyPolicyLapClient = /*#__PURE__*/function (_RoyaltyPolicyLapRead) {
17461
17519
  *
17462
17520
  * @param nftContract address
17463
17521
  * @param recipient address
17464
- * @param nftMetadata string
17465
17522
  * @param ipMetadata tuple
17466
17523
  */
17467
17524
 
@@ -17470,7 +17527,6 @@ var RoyaltyPolicyLapClient = /*#__PURE__*/function (_RoyaltyPolicyLapRead) {
17470
17527
  *
17471
17528
  * @param nftContract address
17472
17529
  * @param recipient address
17473
- * @param nftMetadata string
17474
17530
  * @param ipMetadata tuple
17475
17531
  * @param terms tuple
17476
17532
  */
@@ -17480,7 +17536,6 @@ var RoyaltyPolicyLapClient = /*#__PURE__*/function (_RoyaltyPolicyLapRead) {
17480
17536
  *
17481
17537
  * @param nftContract address
17482
17538
  * @param derivData tuple
17483
- * @param nftMetadata string
17484
17539
  * @param ipMetadata tuple
17485
17540
  * @param recipient address
17486
17541
  */
@@ -17491,7 +17546,6 @@ var RoyaltyPolicyLapClient = /*#__PURE__*/function (_RoyaltyPolicyLapRead) {
17491
17546
  * @param nftContract address
17492
17547
  * @param licenseTokenIds uint256[]
17493
17548
  * @param royaltyContext bytes
17494
- * @param nftMetadata string
17495
17549
  * @param ipMetadata tuple
17496
17550
  * @param recipient address
17497
17551
  */
@@ -17704,7 +17758,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17704
17758
  address: this.address,
17705
17759
  functionName: "mintAndRegisterIp",
17706
17760
  account: this.wallet.account,
17707
- args: [request.nftContract, request.recipient, request.nftMetadata, request.ipMetadata]
17761
+ args: [request.nftContract, request.recipient, request.ipMetadata]
17708
17762
  });
17709
17763
  case 2:
17710
17764
  _yield$this$rpcClient46 = _context112.sent;
@@ -17739,7 +17793,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17739
17793
  data: encodeFunctionData({
17740
17794
  abi: spgAbi,
17741
17795
  functionName: "mintAndRegisterIp",
17742
- args: [request.nftContract, request.recipient, request.nftMetadata, request.ipMetadata]
17796
+ args: [request.nftContract, request.recipient, request.ipMetadata]
17743
17797
  })
17744
17798
  };
17745
17799
  }
@@ -17764,7 +17818,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17764
17818
  address: this.address,
17765
17819
  functionName: "mintAndRegisterIpAndAttachPILTerms",
17766
17820
  account: this.wallet.account,
17767
- args: [request.nftContract, request.recipient, request.nftMetadata, request.ipMetadata, request.terms]
17821
+ args: [request.nftContract, request.recipient, request.ipMetadata, request.terms]
17768
17822
  });
17769
17823
  case 2:
17770
17824
  _yield$this$rpcClient47 = _context113.sent;
@@ -17799,7 +17853,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17799
17853
  data: encodeFunctionData({
17800
17854
  abi: spgAbi,
17801
17855
  functionName: "mintAndRegisterIpAndAttachPILTerms",
17802
- args: [request.nftContract, request.recipient, request.nftMetadata, request.ipMetadata, request.terms]
17856
+ args: [request.nftContract, request.recipient, request.ipMetadata, request.terms]
17803
17857
  })
17804
17858
  };
17805
17859
  }
@@ -17824,7 +17878,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17824
17878
  address: this.address,
17825
17879
  functionName: "mintAndRegisterIpAndMakeDerivative",
17826
17880
  account: this.wallet.account,
17827
- args: [request.nftContract, request.derivData, request.nftMetadata, request.ipMetadata, request.recipient]
17881
+ args: [request.nftContract, request.derivData, request.ipMetadata, request.recipient]
17828
17882
  });
17829
17883
  case 2:
17830
17884
  _yield$this$rpcClient48 = _context114.sent;
@@ -17859,7 +17913,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17859
17913
  data: encodeFunctionData({
17860
17914
  abi: spgAbi,
17861
17915
  functionName: "mintAndRegisterIpAndMakeDerivative",
17862
- args: [request.nftContract, request.derivData, request.nftMetadata, request.ipMetadata, request.recipient]
17916
+ args: [request.nftContract, request.derivData, request.ipMetadata, request.recipient]
17863
17917
  })
17864
17918
  };
17865
17919
  }
@@ -17884,7 +17938,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17884
17938
  address: this.address,
17885
17939
  functionName: "mintAndRegisterIpAndMakeDerivativeWithLicenseTokens",
17886
17940
  account: this.wallet.account,
17887
- args: [request.nftContract, request.licenseTokenIds, request.royaltyContext, request.nftMetadata, request.ipMetadata, request.recipient]
17941
+ args: [request.nftContract, request.licenseTokenIds, request.royaltyContext, request.ipMetadata, request.recipient]
17888
17942
  });
17889
17943
  case 2:
17890
17944
  _yield$this$rpcClient49 = _context115.sent;
@@ -17919,7 +17973,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17919
17973
  data: encodeFunctionData({
17920
17974
  abi: spgAbi,
17921
17975
  functionName: "mintAndRegisterIpAndMakeDerivativeWithLicenseTokens",
17922
- args: [request.nftContract, request.licenseTokenIds, request.royaltyContext, request.nftMetadata, request.ipMetadata, request.recipient]
17976
+ args: [request.nftContract, request.licenseTokenIds, request.royaltyContext, request.ipMetadata, request.recipient]
17923
17977
  })
17924
17978
  };
17925
17979
  }
@@ -18434,10 +18488,11 @@ var IPAssetClient = /*#__PURE__*/function () {
18434
18488
  * @param request - The request object that contains all data needed to register IP.
18435
18489
  * @param request.nftContract The address of the NFT.
18436
18490
  * @param request.tokenId The token identifier of the NFT.
18437
- * @param request.ipMetadata - [Optional] The ipMetadata for the IP.
18438
- * @param request.ipMetadata.metadataURI [Optional] The URI of the ipMetadata for the IP.
18439
- * @param request.ipMetadata.metadataHash [Optional] The ipMetadata for the IP.
18440
- * @param request.ipMetadata.nftMetadataHash [Optional] The ipMetadata for the IP NFT.
18491
+ * @param request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
18492
+ * @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
18493
+ * @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
18494
+ * @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
18495
+ * @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
18441
18496
  * @param request.deadline [Optional] The deadline for the signature in milliseconds, default is 1000ms.
18442
18497
  * @param request.txOptions [Optional] The transaction options.
18443
18498
  * @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true.
@@ -18447,7 +18502,7 @@ var IPAssetClient = /*#__PURE__*/function () {
18447
18502
  key: "register",
18448
18503
  value: (function () {
18449
18504
  var _register = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
18450
- var _request$txOptions, tokenId, ipIdAddress, isRegistered, object, _request$txOptions2, txHash, calculatedDeadline, signature, txReceipt, targetLogs;
18505
+ var _request$ipMetadata, _request$ipMetadata2, _request$ipMetadata3, _request$ipMetadata4, _request$txOptions, tokenId, ipIdAddress, isRegistered, object, _request$txOptions2, txHash, calculatedDeadline, signature, txReceipt, targetLogs;
18451
18506
  return _regeneratorRuntime().wrap(function _callee$(_context) {
18452
18507
  while (1) switch (_context.prev = _context.next) {
18453
18508
  case 0:
@@ -18473,9 +18528,10 @@ var IPAssetClient = /*#__PURE__*/function () {
18473
18528
  tokenId: tokenId,
18474
18529
  nftContract: getAddress$1(request.nftContract, "request.nftContract"),
18475
18530
  ipMetadata: {
18476
- metadataURI: "",
18477
- metadataHash: zeroHash,
18478
- nftMetadataHash: zeroHash
18531
+ ipMetadataURI: ((_request$ipMetadata = request.ipMetadata) === null || _request$ipMetadata === void 0 ? void 0 : _request$ipMetadata.ipMetadataURI) || "",
18532
+ ipMetadataHash: ((_request$ipMetadata2 = request.ipMetadata) === null || _request$ipMetadata2 === void 0 ? void 0 : _request$ipMetadata2.ipMetadataHash) || zeroHash,
18533
+ nftMetadataURI: ((_request$ipMetadata3 = request.ipMetadata) === null || _request$ipMetadata3 === void 0 ? void 0 : _request$ipMetadata3.nftMetadataURI) || "",
18534
+ nftMetadataHash: ((_request$ipMetadata4 = request.ipMetadata) === null || _request$ipMetadata4 === void 0 ? void 0 : _request$ipMetadata4.nftMetadataHash) || zeroHash
18479
18535
  },
18480
18536
  sigMetadata: {
18481
18537
  signer: zeroAddress,
@@ -18483,25 +18539,18 @@ var IPAssetClient = /*#__PURE__*/function () {
18483
18539
  signature: zeroHash
18484
18540
  }
18485
18541
  };
18486
- if (request.ipMetadata && (request.ipMetadata.metadataHash !== zeroHash || request.ipMetadata.metadataURI !== "" || request.ipMetadata.nftMetadataHash !== zeroHash)) {
18487
- object.ipMetadata = {
18488
- metadataURI: request.ipMetadata.metadataURI || object.ipMetadata.metadataURI,
18489
- metadataHash: request.ipMetadata.metadataHash || object.ipMetadata.metadataHash,
18490
- nftMetadataHash: request.ipMetadata.nftMetadataHash || object.ipMetadata.nftMetadataHash
18491
- };
18492
- }
18493
18542
  if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.encodedTxDataOnly)) {
18494
- _context.next = 20;
18543
+ _context.next = 19;
18495
18544
  break;
18496
18545
  }
18497
18546
  if (!request.ipMetadata) {
18498
- _context.next = 17;
18547
+ _context.next = 16;
18499
18548
  break;
18500
18549
  }
18501
18550
  return _context.abrupt("return", {
18502
18551
  encodedTxData: this.spgClient.registerIpEncode(object)
18503
18552
  });
18504
- case 17:
18553
+ case 16:
18505
18554
  return _context.abrupt("return", {
18506
18555
  encodedTxData: this.ipAssetRegistryClient.registerEncode({
18507
18556
  tokenContract: object.nftContract,
@@ -18509,16 +18558,16 @@ var IPAssetClient = /*#__PURE__*/function () {
18509
18558
  chainid: chain[this.chainId]
18510
18559
  })
18511
18560
  });
18512
- case 18:
18513
- _context.next = 43;
18561
+ case 17:
18562
+ _context.next = 42;
18514
18563
  break;
18515
- case 20:
18564
+ case 19:
18516
18565
  if (!request.ipMetadata) {
18517
- _context.next = 31;
18566
+ _context.next = 30;
18518
18567
  break;
18519
18568
  }
18520
18569
  calculatedDeadline = getDeadline(request.deadline);
18521
- _context.next = 24;
18570
+ _context.next = 23;
18522
18571
  return getPermissionSignature({
18523
18572
  ipId: ipIdAddress,
18524
18573
  deadline: calculatedDeadline,
@@ -18535,60 +18584,60 @@ var IPAssetClient = /*#__PURE__*/function () {
18535
18584
  func: "function setAll(address,string,bytes32,bytes32)"
18536
18585
  }]
18537
18586
  });
18538
- case 24:
18587
+ case 23:
18539
18588
  signature = _context.sent;
18540
18589
  object.sigMetadata = {
18541
18590
  signer: getAddress$1(this.wallet.account.address, "wallet.account.address"),
18542
18591
  deadline: calculatedDeadline,
18543
18592
  signature: signature
18544
18593
  };
18545
- _context.next = 28;
18594
+ _context.next = 27;
18546
18595
  return this.spgClient.registerIp(object);
18547
- case 28:
18596
+ case 27:
18548
18597
  txHash = _context.sent;
18549
- _context.next = 34;
18550
- break;
18551
- case 31:
18552
18598
  _context.next = 33;
18599
+ break;
18600
+ case 30:
18601
+ _context.next = 32;
18553
18602
  return this.ipAssetRegistryClient.register({
18554
18603
  tokenContract: object.nftContract,
18555
18604
  tokenId: object.tokenId,
18556
18605
  chainid: chain[this.chainId]
18557
18606
  });
18558
- case 33:
18607
+ case 32:
18559
18608
  txHash = _context.sent;
18560
- case 34:
18609
+ case 33:
18561
18610
  if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
18562
- _context.next = 42;
18611
+ _context.next = 41;
18563
18612
  break;
18564
18613
  }
18565
- _context.next = 37;
18614
+ _context.next = 36;
18566
18615
  return this.rpcClient.waitForTransactionReceipt({
18567
18616
  hash: txHash
18568
18617
  });
18569
- case 37:
18618
+ case 36:
18570
18619
  txReceipt = _context.sent;
18571
18620
  targetLogs = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt);
18572
18621
  return _context.abrupt("return", {
18573
18622
  txHash: txHash,
18574
18623
  ipId: targetLogs[0].ipId
18575
18624
  });
18576
- case 42:
18625
+ case 41:
18577
18626
  return _context.abrupt("return", {
18578
18627
  txHash: txHash
18579
18628
  });
18580
- case 43:
18581
- _context.next = 48;
18629
+ case 42:
18630
+ _context.next = 47;
18582
18631
  break;
18583
- case 45:
18584
- _context.prev = 45;
18632
+ case 44:
18633
+ _context.prev = 44;
18585
18634
  _context.t0 = _context["catch"](0);
18586
18635
  handleError(_context.t0, "Failed to register IP");
18587
- case 48:
18636
+ case 47:
18588
18637
  case "end":
18589
18638
  return _context.stop();
18590
18639
  }
18591
- }, _callee, this, [[0, 45]]);
18640
+ }, _callee, this, [[0, 44]]);
18592
18641
  }));
18593
18642
  function register(_x) {
18594
18643
  return _register.apply(this, arguments);
@@ -18871,11 +18920,11 @@ var IPAssetClient = /*#__PURE__*/function () {
18871
18920
  * @param request - The request object that contains all data needed to mint and register ip.
18872
18921
  * @param request.nftContract The address of the NFT collection.
18873
18922
  * @param request.pilType The type of the PIL.
18874
- * @param request.ipMetadata - [Optional] The ipMetadata for the IP.
18875
- * @param request.ipMetadata.metadataURI [Optional] The URI of the ipMetadata for the IP.
18876
- * @param request.ipMetadata.metadataHash [Optional] The ipMetadata for the IP.
18877
- * @param request.ipMetadata.nftMetadataHash [Optional] The ipMetadata for the IP NFT.
18878
- * @param request.nftMetadata [Optional] The desired metadata for the newly minted NFT.
18923
+ * @param request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
18924
+ * @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
18925
+ * @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
18926
+ * @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
18927
+ * @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
18879
18928
  * @param request.recipient [Optional] The address of the recipient of the minted NFT.
18880
18929
  * @param request.mintingFee [Optional] The fee to be paid when minting a license.
18881
18930
  * @param request.commercialRevShare [Optional] Percentage of revenue that must be shared with the licensor.
@@ -18890,7 +18939,7 @@ var IPAssetClient = /*#__PURE__*/function () {
18890
18939
  key: "mintAndRegisterIpAssetWithPilTerms",
18891
18940
  value: (function () {
18892
18941
  var _mintAndRegisterIpAssetWithPilTerms = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(request) {
18893
- var _request$txOptions7, licenseTerm, object, _request$txOptions8, txHash, txReceipt, iPRegisteredLog, licenseTermsId;
18942
+ var _request$ipMetadata5, _request$ipMetadata6, _request$ipMetadata7, _request$ipMetadata8, _request$txOptions7, licenseTerm, object, _request$txOptions8, txHash, txReceipt, iPRegisteredLog, licenseTermsId;
18894
18943
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
18895
18944
  while (1) switch (_context4.prev = _context4.next) {
18896
18945
  case 0:
@@ -18910,46 +18959,35 @@ var IPAssetClient = /*#__PURE__*/function () {
18910
18959
  object = {
18911
18960
  nftContract: getAddress$1(request.nftContract, "request.nftContract"),
18912
18961
  recipient: request.recipient && getAddress$1(request.recipient, "request.recipient") || this.wallet.account.address,
18913
- terms: _objectSpread2(_objectSpread2({}, licenseTerm), {}, {
18914
- mintingFee: BigInt(licenseTerm.defaultMintingFee),
18915
- derivativeRevCelling: licenseTerm.commercialRevCeiling,
18916
- commercialRevCelling: licenseTerm.commercialRevCeiling
18917
- }),
18962
+ terms: licenseTerm,
18918
18963
  ipMetadata: {
18919
- metadataURI: "",
18920
- metadataHash: zeroHash,
18921
- nftMetadataHash: zeroHash
18922
- },
18923
- nftMetadata: request.nftMetadata || ""
18964
+ ipMetadataURI: ((_request$ipMetadata5 = request.ipMetadata) === null || _request$ipMetadata5 === void 0 ? void 0 : _request$ipMetadata5.ipMetadataURI) || "",
18965
+ ipMetadataHash: ((_request$ipMetadata6 = request.ipMetadata) === null || _request$ipMetadata6 === void 0 ? void 0 : _request$ipMetadata6.ipMetadataHash) || zeroHash,
18966
+ nftMetadataURI: ((_request$ipMetadata7 = request.ipMetadata) === null || _request$ipMetadata7 === void 0 ? void 0 : _request$ipMetadata7.nftMetadataURI) || "",
18967
+ nftMetadataHash: ((_request$ipMetadata8 = request.ipMetadata) === null || _request$ipMetadata8 === void 0 ? void 0 : _request$ipMetadata8.nftMetadataHash) || zeroHash
18968
+ }
18924
18969
  };
18925
- if (request.ipMetadata && (request.ipMetadata.metadataHash !== zeroHash || request.ipMetadata.metadataURI !== "" || request.ipMetadata.nftMetadataHash !== zeroHash)) {
18926
- object.ipMetadata = {
18927
- metadataURI: request.ipMetadata.metadataURI || object.ipMetadata.metadataURI,
18928
- metadataHash: request.ipMetadata.metadataHash || object.ipMetadata.metadataHash,
18929
- nftMetadataHash: request.ipMetadata.nftMetadataHash || object.ipMetadata.nftMetadataHash
18930
- };
18931
- }
18932
18970
  if (!((_request$txOptions7 = request.txOptions) !== null && _request$txOptions7 !== void 0 && _request$txOptions7.encodedTxDataOnly)) {
18933
- _context4.next = 10;
18971
+ _context4.next = 9;
18934
18972
  break;
18935
18973
  }
18936
18974
  return _context4.abrupt("return", {
18937
18975
  encodedTxData: this.spgClient.mintAndRegisterIpAndAttachPilTermsEncode(object)
18938
18976
  });
18939
- case 10:
18940
- _context4.next = 12;
18977
+ case 9:
18978
+ _context4.next = 11;
18941
18979
  return this.spgClient.mintAndRegisterIpAndAttachPilTerms(object);
18942
- case 12:
18980
+ case 11:
18943
18981
  txHash = _context4.sent;
18944
18982
  if (!((_request$txOptions8 = request.txOptions) !== null && _request$txOptions8 !== void 0 && _request$txOptions8.waitForTransaction)) {
18945
- _context4.next = 20;
18983
+ _context4.next = 19;
18946
18984
  break;
18947
18985
  }
18948
- _context4.next = 16;
18986
+ _context4.next = 15;
18949
18987
  return this.rpcClient.waitForTransactionReceipt({
18950
18988
  hash: txHash
18951
18989
  });
18952
- case 16:
18990
+ case 15:
18953
18991
  txReceipt = _context4.sent;
18954
18992
  iPRegisteredLog = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt)[0];
18955
18993
  licenseTermsId = this.licensingModuleClient.parseTxLicenseTermsAttachedEvent(txReceipt)[0].licenseTermsId;
@@ -18959,22 +18997,22 @@ var IPAssetClient = /*#__PURE__*/function () {
18959
18997
  licenseTermsId: licenseTermsId,
18960
18998
  tokenId: iPRegisteredLog.tokenId
18961
18999
  });
18962
- case 20:
19000
+ case 19:
18963
19001
  return _context4.abrupt("return", {
18964
19002
  txHash: txHash
18965
19003
  });
18966
- case 21:
18967
- _context4.next = 26;
19004
+ case 20:
19005
+ _context4.next = 25;
18968
19006
  break;
18969
- case 23:
18970
- _context4.prev = 23;
19007
+ case 22:
19008
+ _context4.prev = 22;
18971
19009
  _context4.t0 = _context4["catch"](0);
18972
19010
  handleError(_context4.t0, "Failed to mint and register IP and attach PIL terms");
18973
- case 26:
19011
+ case 25:
18974
19012
  case "end":
18975
19013
  return _context4.stop();
18976
19014
  }
18977
- }, _callee4, this, [[0, 23]]);
19015
+ }, _callee4, this, [[0, 22]]);
18978
19016
  }));
18979
19017
  function mintAndRegisterIpAssetWithPilTerms(_x4) {
18980
19018
  return _mintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
@@ -18987,10 +19025,11 @@ var IPAssetClient = /*#__PURE__*/function () {
18987
19025
  * @param request.nftContract The address of the NFT collection.
18988
19026
  * @param request.tokenId The ID of the NFT.
18989
19027
  * @param request.pilType The type of the PIL.
18990
- * @param request.ipMetadata - [Optional] The desired ipMetadata for the newly registered IP.
18991
- * @param request.ipMetadata.metadataURI [Optional] The the ipMetadata for the IP hash.
18992
- * @param request.ipMetadata.metadataHash [Optional] The ipMetadata for the IP.
18993
- * @param request.ipMetadata.nftMetadataHash [Optional] The ipMetadata for the IP NFT.
19028
+ * @param request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
19029
+ * @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
19030
+ * @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
19031
+ * @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
19032
+ * @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
18994
19033
  * @param request.deadline [Optional] The deadline for the signature in milliseconds, default is 1000ms.
18995
19034
  * @param request.mintingFee [Optional] The fee to be paid when minting a license.
18996
19035
  * @param request.commercialRevShare [Optional] Percentage of revenue that must be shared with the licensor.
@@ -19004,7 +19043,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19004
19043
  key: "registerIpAndAttachPilTerms",
19005
19044
  value: (function () {
19006
19045
  var _registerIpAndAttachPilTerms = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(request) {
19007
- var _request$txOptions9, ipIdAddress, isRegistered, licenseTerm, calculatedDeadline, sigAttachSignature, object, sigMetadataSignature, _request$txOptions10, txHash, txReceipt, log;
19046
+ var _request$ipMetadata9, _request$ipMetadata10, _request$ipMetadata11, _request$ipMetadata12, _request$txOptions9, ipIdAddress, isRegistered, licenseTerm, calculatedDeadline, sigAttachSignature, object, sigMetadataSignature, _request$txOptions10, txHash, txReceipt, log;
19008
19047
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
19009
19048
  while (1) switch (_context5.prev = _context5.next) {
19010
19049
  case 0:
@@ -19063,15 +19102,12 @@ var IPAssetClient = /*#__PURE__*/function () {
19063
19102
  object = {
19064
19103
  nftContract: getAddress$1(request.nftContract, "request.nftContract"),
19065
19104
  tokenId: request.tokenId,
19066
- terms: _objectSpread2(_objectSpread2({}, licenseTerm), {}, {
19067
- mintingFee: BigInt(licenseTerm.defaultMintingFee),
19068
- derivativeRevCelling: licenseTerm.commercialRevCeiling,
19069
- commercialRevCelling: licenseTerm.commercialRevCeiling
19070
- }),
19105
+ terms: licenseTerm,
19071
19106
  ipMetadata: {
19072
- metadataURI: "",
19073
- metadataHash: zeroHash,
19074
- nftMetadataHash: zeroHash
19107
+ ipMetadataURI: ((_request$ipMetadata9 = request.ipMetadata) === null || _request$ipMetadata9 === void 0 ? void 0 : _request$ipMetadata9.ipMetadataURI) || "",
19108
+ ipMetadataHash: ((_request$ipMetadata10 = request.ipMetadata) === null || _request$ipMetadata10 === void 0 ? void 0 : _request$ipMetadata10.ipMetadataHash) || zeroHash,
19109
+ nftMetadataURI: ((_request$ipMetadata11 = request.ipMetadata) === null || _request$ipMetadata11 === void 0 ? void 0 : _request$ipMetadata11.nftMetadataURI) || "",
19110
+ nftMetadataHash: ((_request$ipMetadata12 = request.ipMetadata) === null || _request$ipMetadata12 === void 0 ? void 0 : _request$ipMetadata12.nftMetadataHash) || zeroHash
19075
19111
  },
19076
19112
  sigMetadata: {
19077
19113
  signer: zeroAddress,
@@ -19084,14 +19120,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19084
19120
  signature: sigAttachSignature
19085
19121
  }
19086
19122
  };
19087
- if (request.ipMetadata && (request.ipMetadata.metadataHash !== zeroHash || request.ipMetadata.metadataURI !== "" || request.ipMetadata.nftMetadataHash !== zeroHash)) {
19088
- object.ipMetadata = {
19089
- metadataURI: request.ipMetadata.metadataURI || object.ipMetadata.metadataURI,
19090
- metadataHash: request.ipMetadata.metadataHash || object.ipMetadata.metadataHash,
19091
- nftMetadataHash: request.ipMetadata.nftMetadataHash || object.ipMetadata.nftMetadataHash
19092
- };
19093
- }
19094
- _context5.next = 21;
19123
+ _context5.next = 20;
19095
19124
  return getPermissionSignature({
19096
19125
  ipId: ipIdAddress,
19097
19126
  deadline: calculatedDeadline,
@@ -19108,7 +19137,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19108
19137
  func: "function setAll(address,string,bytes32,bytes32)"
19109
19138
  }]
19110
19139
  });
19111
- case 21:
19140
+ case 20:
19112
19141
  sigMetadataSignature = _context5.sent;
19113
19142
  object.sigMetadata = {
19114
19143
  signer: getAddress$1(this.wallet.account.address, "wallet.account.address"),
@@ -19116,26 +19145,26 @@ var IPAssetClient = /*#__PURE__*/function () {
19116
19145
  signature: sigMetadataSignature
19117
19146
  };
19118
19147
  if (!((_request$txOptions9 = request.txOptions) !== null && _request$txOptions9 !== void 0 && _request$txOptions9.encodedTxDataOnly)) {
19119
- _context5.next = 27;
19148
+ _context5.next = 26;
19120
19149
  break;
19121
19150
  }
19122
19151
  return _context5.abrupt("return", {
19123
19152
  encodedTxData: this.spgClient.registerIpAndAttachPilTermsEncode(object)
19124
19153
  });
19125
- case 27:
19126
- _context5.next = 29;
19154
+ case 26:
19155
+ _context5.next = 28;
19127
19156
  return this.spgClient.registerIpAndAttachPilTerms(object);
19128
- case 29:
19157
+ case 28:
19129
19158
  txHash = _context5.sent;
19130
19159
  if (!((_request$txOptions10 = request.txOptions) !== null && _request$txOptions10 !== void 0 && _request$txOptions10.waitForTransaction)) {
19131
- _context5.next = 36;
19160
+ _context5.next = 35;
19132
19161
  break;
19133
19162
  }
19134
- _context5.next = 33;
19163
+ _context5.next = 32;
19135
19164
  return this.rpcClient.waitForTransactionReceipt({
19136
19165
  hash: txHash
19137
19166
  });
19138
- case 33:
19167
+ case 32:
19139
19168
  txReceipt = _context5.sent;
19140
19169
  log = this.licensingModuleClient.parseTxLicenseTermsAttachedEvent(txReceipt)[0];
19141
19170
  return _context5.abrupt("return", {
@@ -19143,22 +19172,22 @@ var IPAssetClient = /*#__PURE__*/function () {
19143
19172
  licenseTermsId: log.licenseTermsId,
19144
19173
  ipId: log.ipId
19145
19174
  });
19146
- case 36:
19175
+ case 35:
19147
19176
  return _context5.abrupt("return", {
19148
19177
  txHash: txHash
19149
19178
  });
19150
- case 37:
19151
- _context5.next = 42;
19179
+ case 36:
19180
+ _context5.next = 41;
19152
19181
  break;
19153
- case 39:
19154
- _context5.prev = 39;
19182
+ case 38:
19183
+ _context5.prev = 38;
19155
19184
  _context5.t0 = _context5["catch"](0);
19156
19185
  handleError(_context5.t0, "Failed to register IP and attach PIL terms");
19157
- case 42:
19186
+ case 41:
19158
19187
  case "end":
19159
19188
  return _context5.stop();
19160
19189
  }
19161
- }, _callee5, this, [[0, 39]]);
19190
+ }, _callee5, this, [[0, 38]]);
19162
19191
  }));
19163
19192
  function registerIpAndAttachPilTerms(_x5) {
19164
19193
  return _registerIpAndAttachPilTerms.apply(this, arguments);
@@ -19174,10 +19203,11 @@ var IPAssetClient = /*#__PURE__*/function () {
19174
19203
  * @param request.derivData.parentIpIds The IDs of the parent IPs to link the registered derivative IP.
19175
19204
  * @param request.derivData.licenseTemplate [Optional] The address of the license template to be used for the linking.
19176
19205
  * @param request.derivData.licenseTermsIds The IDs of the license terms to be used for the linking.
19177
- * @param request.ipMetadata - [Optional] The desired ipMetadata for the newly registered IP.
19178
- * @param request.ipMetadata.metadataURI [Optional] The URI of the ipMetadata for the IP.
19179
- * @param request.ipMetadata.metadataHash [Optional] The ipMetadata for the IP.
19180
- * @param request.ipMetadata.nftMetadataHash [Optional] The the ipMetadata for the IP NFT.
19206
+ * @param request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
19207
+ * @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
19208
+ * @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
19209
+ * @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
19210
+ * @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
19181
19211
  * @param request.deadline [Optional] The deadline for the signature in milliseconds,default is 1000ms.
19182
19212
  * @param request.txOptions [Optional] The transaction options.
19183
19213
  * @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true.
@@ -19188,7 +19218,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19188
19218
  key: "registerDerivativeIp",
19189
19219
  value: (function () {
19190
19220
  var _registerDerivativeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(request) {
19191
- var _request$txOptions11, tokenId, ipIdAddress, isRegistered, i, isAttachedLicenseTerms, calculatedDeadline, sigRegisterSignature, object, sigMetadataSignature, _request$txOptions12, txHash, receipt, log;
19221
+ var _request$ipMetadata13, _request$ipMetadata14, _request$ipMetadata15, _request$ipMetadata16, _request$txOptions11, tokenId, ipIdAddress, isRegistered, i, isAttachedLicenseTerms, calculatedDeadline, sigRegisterSignature, object, sigMetadataSignature, _request$txOptions12, txHash, receipt, log;
19192
19222
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
19193
19223
  while (1) switch (_context6.prev = _context6.next) {
19194
19224
  case 0:
@@ -19281,9 +19311,10 @@ var IPAssetClient = /*#__PURE__*/function () {
19281
19311
  signature: sigRegisterSignature
19282
19312
  },
19283
19313
  ipMetadata: {
19284
- metadataURI: "",
19285
- metadataHash: zeroHash,
19286
- nftMetadataHash: zeroHash
19314
+ ipMetadataURI: ((_request$ipMetadata13 = request.ipMetadata) === null || _request$ipMetadata13 === void 0 ? void 0 : _request$ipMetadata13.ipMetadataURI) || "",
19315
+ ipMetadataHash: ((_request$ipMetadata14 = request.ipMetadata) === null || _request$ipMetadata14 === void 0 ? void 0 : _request$ipMetadata14.ipMetadataHash) || zeroHash,
19316
+ nftMetadataURI: ((_request$ipMetadata15 = request.ipMetadata) === null || _request$ipMetadata15 === void 0 ? void 0 : _request$ipMetadata15.nftMetadataURI) || "",
19317
+ nftMetadataHash: ((_request$ipMetadata16 = request.ipMetadata) === null || _request$ipMetadata16 === void 0 ? void 0 : _request$ipMetadata16.nftMetadataHash) || zeroHash
19287
19318
  },
19288
19319
  sigMetadata: {
19289
19320
  signer: zeroAddress,
@@ -19291,14 +19322,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19291
19322
  signature: zeroHash
19292
19323
  }
19293
19324
  };
19294
- if (request.ipMetadata && (request.ipMetadata.metadataHash !== zeroHash || request.ipMetadata.metadataURI !== "" || request.ipMetadata.nftMetadataHash !== zeroHash)) {
19295
- object.ipMetadata = {
19296
- metadataURI: request.ipMetadata.metadataURI || object.ipMetadata.metadataURI,
19297
- metadataHash: request.ipMetadata.metadataHash || object.ipMetadata.metadataHash,
19298
- nftMetadataHash: request.ipMetadata.nftMetadataHash || object.ipMetadata.nftMetadataHash
19299
- };
19300
- }
19301
- _context6.next = 30;
19325
+ _context6.next = 29;
19302
19326
  return getPermissionSignature({
19303
19327
  ipId: ipIdAddress,
19304
19328
  deadline: calculatedDeadline,
@@ -19315,7 +19339,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19315
19339
  func: "function setAll(address,string,bytes32,bytes32)"
19316
19340
  }]
19317
19341
  });
19318
- case 30:
19342
+ case 29:
19319
19343
  sigMetadataSignature = _context6.sent;
19320
19344
  object.sigMetadata = {
19321
19345
  signer: getAddress$1(this.wallet.account.address, "wallet.account.address"),
@@ -19323,78 +19347,200 @@ var IPAssetClient = /*#__PURE__*/function () {
19323
19347
  signature: sigMetadataSignature
19324
19348
  };
19325
19349
  if (!((_request$txOptions11 = request.txOptions) !== null && _request$txOptions11 !== void 0 && _request$txOptions11.encodedTxDataOnly)) {
19326
- _context6.next = 36;
19350
+ _context6.next = 35;
19327
19351
  break;
19328
19352
  }
19329
19353
  return _context6.abrupt("return", {
19330
19354
  encodedTxData: this.spgClient.registerIpAndMakeDerivativeEncode(object)
19331
19355
  });
19332
- case 36:
19333
- _context6.next = 38;
19356
+ case 35:
19357
+ _context6.next = 37;
19334
19358
  return this.spgClient.registerIpAndMakeDerivative(object);
19335
- case 38:
19359
+ case 37:
19336
19360
  txHash = _context6.sent;
19337
19361
  if (!((_request$txOptions12 = request.txOptions) !== null && _request$txOptions12 !== void 0 && _request$txOptions12.waitForTransaction)) {
19338
- _context6.next = 45;
19362
+ _context6.next = 44;
19339
19363
  break;
19340
19364
  }
19341
- _context6.next = 42;
19365
+ _context6.next = 41;
19342
19366
  return this.rpcClient.waitForTransactionReceipt({
19343
19367
  hash: txHash
19344
19368
  });
19345
- case 42:
19369
+ case 41:
19346
19370
  receipt = _context6.sent;
19347
19371
  log = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(receipt)[0];
19348
19372
  return _context6.abrupt("return", {
19349
19373
  txHash: txHash,
19350
19374
  ipId: log.ipId
19351
19375
  });
19352
- case 45:
19376
+ case 44:
19353
19377
  return _context6.abrupt("return", {
19354
19378
  txHash: txHash
19355
19379
  });
19356
- case 46:
19357
- _context6.next = 51;
19380
+ case 45:
19381
+ _context6.next = 50;
19358
19382
  break;
19359
- case 48:
19360
- _context6.prev = 48;
19383
+ case 47:
19384
+ _context6.prev = 47;
19361
19385
  _context6.t0 = _context6["catch"](0);
19362
19386
  handleError(_context6.t0, "Failed to register derivative IP");
19363
- case 51:
19387
+ case 50:
19364
19388
  case "end":
19365
19389
  return _context6.stop();
19366
19390
  }
19367
- }, _callee6, this, [[0, 48]]);
19391
+ }, _callee6, this, [[0, 47]]);
19368
19392
  }));
19369
19393
  function registerDerivativeIp(_x6) {
19370
19394
  return _registerDerivativeIp.apply(this, arguments);
19371
19395
  }
19372
19396
  return registerDerivativeIp;
19397
+ }()
19398
+ /**
19399
+ * Mint an NFT from a collection and register it as a derivative IP without license tokens.
19400
+ * @param request - The request object that contains all data needed to mint and register ip and make derivative.
19401
+ * @param request.nftContract The address of the NFT collection.
19402
+ * @param request.derivData The derivative data to be used for registerDerivative.
19403
+ * @param request.derivData.parentIpIds The IDs of the parent IPs to link the registered derivative IP.
19404
+ * @param request.derivData.licenseTermsIds The IDs of the license terms to be used for the linking.
19405
+ * @param request.derivData.licenseTemplate [Optional] The address of the license template to be used for the linking.
19406
+ * @param request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
19407
+ * @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
19408
+ * @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
19409
+ * @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
19410
+ * @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.* @param request.recipient [Optional] The address of the recipient of the minted NFT.
19411
+ * @param request.txOptions [Optional] The transaction options.
19412
+ * @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true.
19413
+ * @emits IPRegistered (ipId, chainId, tokenContract, tokenId, name, uri, registrationDate)
19414
+ */
19415
+ )
19416
+ }, {
19417
+ key: "mintAndRegisterIpAndMakeDerivative",
19418
+ value: (function () {
19419
+ var _mintAndRegisterIpAndMakeDerivative = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(request) {
19420
+ var _request$ipMetadata17, _request$ipMetadata18, _request$ipMetadata19, _request$ipMetadata20, _request$txOptions13, i, isAttachedLicenseTerms, object, _request$txOptions14, txHash, receipt, log;
19421
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
19422
+ while (1) switch (_context7.prev = _context7.next) {
19423
+ case 0:
19424
+ _context7.prev = 0;
19425
+ if (!(request.derivData.parentIpIds.length !== request.derivData.licenseTermsIds.length)) {
19426
+ _context7.next = 3;
19427
+ break;
19428
+ }
19429
+ throw new Error("Parent IP IDs and License terms IDs must be provided in pairs.");
19430
+ case 3:
19431
+ i = 0;
19432
+ case 4:
19433
+ if (!(i < request.derivData.parentIpIds.length)) {
19434
+ _context7.next = 13;
19435
+ break;
19436
+ }
19437
+ _context7.next = 7;
19438
+ return this.licenseRegistryReadOnlyClient.hasIpAttachedLicenseTerms({
19439
+ ipId: getAddress$1(request.derivData.parentIpIds[i], "request.derivData.parentIpIds"),
19440
+ licenseTemplate: request.derivData.licenseTemplate && getAddress$1(request.derivData.licenseTemplate, "request.derivData.licenseTemplate") || this.licenseTemplateClient.address,
19441
+ licenseTermsId: BigInt(request.derivData.licenseTermsIds[i])
19442
+ });
19443
+ case 7:
19444
+ isAttachedLicenseTerms = _context7.sent;
19445
+ if (isAttachedLicenseTerms) {
19446
+ _context7.next = 10;
19447
+ break;
19448
+ }
19449
+ throw new Error("License terms id ".concat(request.derivData.licenseTermsIds[i], " must be attached to the parent ipId ").concat(request.derivData.parentIpIds[i], " before registering derivative."));
19450
+ case 10:
19451
+ i++;
19452
+ _context7.next = 4;
19453
+ break;
19454
+ case 13:
19455
+ object = _objectSpread2(_objectSpread2({}, request), {}, {
19456
+ derivData: _objectSpread2(_objectSpread2({}, request.derivData), {}, {
19457
+ royaltyContext: zeroAddress,
19458
+ licenseTemplate: request.derivData.licenseTemplate || this.licenseTemplateClient.address,
19459
+ licenseTermsIds: request.derivData.licenseTermsIds.map(function (id) {
19460
+ return BigInt(id);
19461
+ })
19462
+ }),
19463
+ ipMetadata: {
19464
+ ipMetadataURI: ((_request$ipMetadata17 = request.ipMetadata) === null || _request$ipMetadata17 === void 0 ? void 0 : _request$ipMetadata17.ipMetadataURI) || "",
19465
+ ipMetadataHash: ((_request$ipMetadata18 = request.ipMetadata) === null || _request$ipMetadata18 === void 0 ? void 0 : _request$ipMetadata18.ipMetadataHash) || zeroHash,
19466
+ nftMetadataURI: ((_request$ipMetadata19 = request.ipMetadata) === null || _request$ipMetadata19 === void 0 ? void 0 : _request$ipMetadata19.nftMetadataURI) || "",
19467
+ nftMetadataHash: ((_request$ipMetadata20 = request.ipMetadata) === null || _request$ipMetadata20 === void 0 ? void 0 : _request$ipMetadata20.nftMetadataHash) || zeroHash
19468
+ },
19469
+ recipient: request.recipient && getAddress$1(request.recipient, "request.recipient") || this.wallet.account.address
19470
+ });
19471
+ if (!((_request$txOptions13 = request.txOptions) !== null && _request$txOptions13 !== void 0 && _request$txOptions13.encodedTxDataOnly)) {
19472
+ _context7.next = 18;
19473
+ break;
19474
+ }
19475
+ return _context7.abrupt("return", {
19476
+ encodedTxData: this.spgClient.mintAndRegisterIpAndMakeDerivativeEncode(object)
19477
+ });
19478
+ case 18:
19479
+ _context7.next = 20;
19480
+ return this.spgClient.mintAndRegisterIpAndMakeDerivative(object);
19481
+ case 20:
19482
+ txHash = _context7.sent;
19483
+ if (!((_request$txOptions14 = request.txOptions) !== null && _request$txOptions14 !== void 0 && _request$txOptions14.waitForTransaction)) {
19484
+ _context7.next = 27;
19485
+ break;
19486
+ }
19487
+ _context7.next = 24;
19488
+ return this.rpcClient.waitForTransactionReceipt({
19489
+ hash: txHash
19490
+ });
19491
+ case 24:
19492
+ receipt = _context7.sent;
19493
+ log = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(receipt)[0];
19494
+ return _context7.abrupt("return", {
19495
+ txHash: txHash,
19496
+ childIpId: log.ipId
19497
+ });
19498
+ case 27:
19499
+ return _context7.abrupt("return", {
19500
+ txHash: txHash
19501
+ });
19502
+ case 28:
19503
+ _context7.next = 33;
19504
+ break;
19505
+ case 30:
19506
+ _context7.prev = 30;
19507
+ _context7.t0 = _context7["catch"](0);
19508
+ handleError(_context7.t0, "Failed to mint and register IP and make derivative");
19509
+ case 33:
19510
+ case "end":
19511
+ return _context7.stop();
19512
+ }
19513
+ }, _callee7, this, [[0, 30]]);
19514
+ }));
19515
+ function mintAndRegisterIpAndMakeDerivative(_x7) {
19516
+ return _mintAndRegisterIpAndMakeDerivative.apply(this, arguments);
19517
+ }
19518
+ return mintAndRegisterIpAndMakeDerivative;
19373
19519
  }())
19374
19520
  }, {
19375
19521
  key: "getIpIdAddress",
19376
19522
  value: function () {
19377
- var _getIpIdAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(nftContract, tokenId) {
19523
+ var _getIpIdAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(nftContract, tokenId) {
19378
19524
  var ipId;
19379
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
19380
- while (1) switch (_context7.prev = _context7.next) {
19525
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
19526
+ while (1) switch (_context8.prev = _context8.next) {
19381
19527
  case 0:
19382
- _context7.next = 2;
19528
+ _context8.next = 2;
19383
19529
  return this.ipAssetRegistryClient.ipId({
19384
19530
  chainId: chain[this.chainId],
19385
19531
  tokenContract: getAddress$1(nftContract, "nftContract"),
19386
19532
  tokenId: BigInt(tokenId)
19387
19533
  });
19388
19534
  case 2:
19389
- ipId = _context7.sent;
19390
- return _context7.abrupt("return", ipId);
19535
+ ipId = _context8.sent;
19536
+ return _context8.abrupt("return", ipId);
19391
19537
  case 4:
19392
19538
  case "end":
19393
- return _context7.stop();
19539
+ return _context8.stop();
19394
19540
  }
19395
- }, _callee7, this);
19541
+ }, _callee8, this);
19396
19542
  }));
19397
- function getIpIdAddress(_x7, _x8) {
19543
+ function getIpIdAddress(_x8, _x9) {
19398
19544
  return _getIpIdAddress.apply(this, arguments);
19399
19545
  }
19400
19546
  return getIpIdAddress;
@@ -19402,23 +19548,23 @@ var IPAssetClient = /*#__PURE__*/function () {
19402
19548
  }, {
19403
19549
  key: "isRegistered",
19404
19550
  value: function () {
19405
- var _isRegistered = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(ipId) {
19406
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
19407
- while (1) switch (_context8.prev = _context8.next) {
19551
+ var _isRegistered = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(ipId) {
19552
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
19553
+ while (1) switch (_context9.prev = _context9.next) {
19408
19554
  case 0:
19409
- _context8.next = 2;
19555
+ _context9.next = 2;
19410
19556
  return this.ipAssetRegistryClient.isRegistered({
19411
19557
  id: getAddress$1(ipId, "ipId")
19412
19558
  });
19413
19559
  case 2:
19414
- return _context8.abrupt("return", _context8.sent);
19560
+ return _context9.abrupt("return", _context9.sent);
19415
19561
  case 3:
19416
19562
  case "end":
19417
- return _context8.stop();
19563
+ return _context9.stop();
19418
19564
  }
19419
- }, _callee8, this);
19565
+ }, _callee9, this);
19420
19566
  }));
19421
- function isRegistered(_x9) {
19567
+ function isRegistered(_x10) {
19422
19568
  return _isRegistered.apply(this, arguments);
19423
19569
  }
19424
19570
  return isRegistered;