@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.
@@ -502,9 +502,9 @@ function _asyncToGenerator(fn) {
502
502
  };
503
503
  }
504
504
 
505
- var storyTestChain = viem.defineChain({
505
+ var iliad = viem.defineChain({
506
506
  id: 1513,
507
- name: "story-testnet",
507
+ name: "iliad",
508
508
  nativeCurrency: {
509
509
  name: "IP",
510
510
  symbol: "IP",
@@ -512,14 +512,14 @@ var storyTestChain = viem.defineChain({
512
512
  },
513
513
  rpcUrls: {
514
514
  "default": {
515
- http: ["https://rpc.partner.testnet.storyprotocol.net"],
515
+ http: ["https://testnet.storyrpc.io"],
516
516
  webSocket: ["wss://story-network.rpc.caldera.xyz/ws"]
517
517
  }
518
518
  },
519
519
  blockExplorers: {
520
520
  "default": {
521
521
  name: "Explorer",
522
- url: "https://explorer.testnet.storyprotocol.net"
522
+ url: "https://testnet.storyscan.xyz"
523
523
  }
524
524
  },
525
525
  contracts: {
@@ -534,7 +534,7 @@ function chainStringToViemChain(chainId) {
534
534
  switch (chainId) {
535
535
  case "1513":
536
536
  case "iliad":
537
- return storyTestChain;
537
+ return iliad;
538
538
  default:
539
539
  throw new Error("chainId ".concat(chainId, " not supported"));
540
540
  }
@@ -9324,6 +9324,22 @@ var spgAbi = [{
9324
9324
  type: "error",
9325
9325
  inputs: [],
9326
9326
  name: "NotInitializing"
9327
+ }, {
9328
+ type: "error",
9329
+ inputs: [{
9330
+ name: "tokenId",
9331
+ internalType: "uint256",
9332
+ type: "uint256"
9333
+ }, {
9334
+ name: "caller",
9335
+ internalType: "address",
9336
+ type: "address"
9337
+ }, {
9338
+ name: "actualTokenOwner",
9339
+ internalType: "address",
9340
+ type: "address"
9341
+ }],
9342
+ name: "SPG__CallerAndNotTokenOwner"
9327
9343
  }, {
9328
9344
  type: "error",
9329
9345
  inputs: [],
@@ -9560,22 +9576,22 @@ var spgAbi = [{
9560
9576
  name: "recipient",
9561
9577
  internalType: "address",
9562
9578
  type: "address"
9563
- }, {
9564
- name: "nftMetadata",
9565
- internalType: "string",
9566
- type: "string"
9567
9579
  }, {
9568
9580
  name: "ipMetadata",
9569
9581
  internalType: "struct IStoryProtocolGateway.IPMetadata",
9570
9582
  type: "tuple",
9571
9583
  components: [{
9572
- name: "metadataURI",
9584
+ name: "ipMetadataURI",
9573
9585
  internalType: "string",
9574
9586
  type: "string"
9575
9587
  }, {
9576
- name: "metadataHash",
9588
+ name: "ipMetadataHash",
9577
9589
  internalType: "bytes32",
9578
9590
  type: "bytes32"
9591
+ }, {
9592
+ name: "nftMetadataURI",
9593
+ internalType: "string",
9594
+ type: "string"
9579
9595
  }, {
9580
9596
  name: "nftMetadataHash",
9581
9597
  internalType: "bytes32",
@@ -9603,22 +9619,22 @@ var spgAbi = [{
9603
9619
  name: "recipient",
9604
9620
  internalType: "address",
9605
9621
  type: "address"
9606
- }, {
9607
- name: "nftMetadata",
9608
- internalType: "string",
9609
- type: "string"
9610
9622
  }, {
9611
9623
  name: "ipMetadata",
9612
9624
  internalType: "struct IStoryProtocolGateway.IPMetadata",
9613
9625
  type: "tuple",
9614
9626
  components: [{
9615
- name: "metadataURI",
9627
+ name: "ipMetadataURI",
9616
9628
  internalType: "string",
9617
9629
  type: "string"
9618
9630
  }, {
9619
- name: "metadataHash",
9631
+ name: "ipMetadataHash",
9620
9632
  internalType: "bytes32",
9621
9633
  type: "bytes32"
9634
+ }, {
9635
+ name: "nftMetadataURI",
9636
+ internalType: "string",
9637
+ type: "string"
9622
9638
  }, {
9623
9639
  name: "nftMetadataHash",
9624
9640
  internalType: "bytes32",
@@ -9637,7 +9653,7 @@ var spgAbi = [{
9637
9653
  internalType: "address",
9638
9654
  type: "address"
9639
9655
  }, {
9640
- name: "mintingFee",
9656
+ name: "defaultMintingFee",
9641
9657
  internalType: "uint256",
9642
9658
  type: "uint256"
9643
9659
  }, {
@@ -9665,7 +9681,7 @@ var spgAbi = [{
9665
9681
  internalType: "uint32",
9666
9682
  type: "uint32"
9667
9683
  }, {
9668
- name: "commercialRevCelling",
9684
+ name: "commercialRevCeiling",
9669
9685
  internalType: "uint256",
9670
9686
  type: "uint256"
9671
9687
  }, {
@@ -9685,7 +9701,7 @@ var spgAbi = [{
9685
9701
  internalType: "bool",
9686
9702
  type: "bool"
9687
9703
  }, {
9688
- name: "derivativeRevCelling",
9704
+ name: "derivativeRevCeiling",
9689
9705
  internalType: "uint256",
9690
9706
  type: "uint256"
9691
9707
  }, {
@@ -9740,22 +9756,22 @@ var spgAbi = [{
9740
9756
  internalType: "bytes",
9741
9757
  type: "bytes"
9742
9758
  }]
9743
- }, {
9744
- name: "nftMetadata",
9745
- internalType: "string",
9746
- type: "string"
9747
9759
  }, {
9748
9760
  name: "ipMetadata",
9749
9761
  internalType: "struct IStoryProtocolGateway.IPMetadata",
9750
9762
  type: "tuple",
9751
9763
  components: [{
9752
- name: "metadataURI",
9764
+ name: "ipMetadataURI",
9753
9765
  internalType: "string",
9754
9766
  type: "string"
9755
9767
  }, {
9756
- name: "metadataHash",
9768
+ name: "ipMetadataHash",
9757
9769
  internalType: "bytes32",
9758
9770
  type: "bytes32"
9771
+ }, {
9772
+ name: "nftMetadataURI",
9773
+ internalType: "string",
9774
+ type: "string"
9759
9775
  }, {
9760
9776
  name: "nftMetadataHash",
9761
9777
  internalType: "bytes32",
@@ -9791,22 +9807,22 @@ var spgAbi = [{
9791
9807
  name: "royaltyContext",
9792
9808
  internalType: "bytes",
9793
9809
  type: "bytes"
9794
- }, {
9795
- name: "nftMetadata",
9796
- internalType: "string",
9797
- type: "string"
9798
9810
  }, {
9799
9811
  name: "ipMetadata",
9800
9812
  internalType: "struct IStoryProtocolGateway.IPMetadata",
9801
9813
  type: "tuple",
9802
9814
  components: [{
9803
- name: "metadataURI",
9815
+ name: "ipMetadataURI",
9804
9816
  internalType: "string",
9805
9817
  type: "string"
9806
9818
  }, {
9807
- name: "metadataHash",
9819
+ name: "ipMetadataHash",
9808
9820
  internalType: "bytes32",
9809
9821
  type: "bytes32"
9822
+ }, {
9823
+ name: "nftMetadataURI",
9824
+ internalType: "string",
9825
+ type: "string"
9810
9826
  }, {
9811
9827
  name: "nftMetadataHash",
9812
9828
  internalType: "bytes32",
@@ -9828,6 +9844,32 @@ var spgAbi = [{
9828
9844
  type: "uint256"
9829
9845
  }],
9830
9846
  stateMutability: "nonpayable"
9847
+ }, {
9848
+ type: "function",
9849
+ inputs: [{
9850
+ name: "",
9851
+ internalType: "address",
9852
+ type: "address"
9853
+ }, {
9854
+ name: "",
9855
+ internalType: "address",
9856
+ type: "address"
9857
+ }, {
9858
+ name: "",
9859
+ internalType: "uint256",
9860
+ type: "uint256"
9861
+ }, {
9862
+ name: "",
9863
+ internalType: "bytes",
9864
+ type: "bytes"
9865
+ }],
9866
+ name: "onERC721Received",
9867
+ outputs: [{
9868
+ name: "",
9869
+ internalType: "bytes4",
9870
+ type: "bytes4"
9871
+ }],
9872
+ stateMutability: "nonpayable"
9831
9873
  }, {
9832
9874
  type: "function",
9833
9875
  inputs: [],
@@ -9853,13 +9895,17 @@ var spgAbi = [{
9853
9895
  internalType: "struct IStoryProtocolGateway.IPMetadata",
9854
9896
  type: "tuple",
9855
9897
  components: [{
9856
- name: "metadataURI",
9898
+ name: "ipMetadataURI",
9857
9899
  internalType: "string",
9858
9900
  type: "string"
9859
9901
  }, {
9860
- name: "metadataHash",
9902
+ name: "ipMetadataHash",
9861
9903
  internalType: "bytes32",
9862
9904
  type: "bytes32"
9905
+ }, {
9906
+ name: "nftMetadataURI",
9907
+ internalType: "string",
9908
+ type: "string"
9863
9909
  }, {
9864
9910
  name: "nftMetadataHash",
9865
9911
  internalType: "bytes32",
@@ -9905,13 +9951,17 @@ var spgAbi = [{
9905
9951
  internalType: "struct IStoryProtocolGateway.IPMetadata",
9906
9952
  type: "tuple",
9907
9953
  components: [{
9908
- name: "metadataURI",
9954
+ name: "ipMetadataURI",
9909
9955
  internalType: "string",
9910
9956
  type: "string"
9911
9957
  }, {
9912
- name: "metadataHash",
9958
+ name: "ipMetadataHash",
9913
9959
  internalType: "bytes32",
9914
9960
  type: "bytes32"
9961
+ }, {
9962
+ name: "nftMetadataURI",
9963
+ internalType: "string",
9964
+ type: "string"
9915
9965
  }, {
9916
9966
  name: "nftMetadataHash",
9917
9967
  internalType: "bytes32",
@@ -9930,7 +9980,7 @@ var spgAbi = [{
9930
9980
  internalType: "address",
9931
9981
  type: "address"
9932
9982
  }, {
9933
- name: "mintingFee",
9983
+ name: "defaultMintingFee",
9934
9984
  internalType: "uint256",
9935
9985
  type: "uint256"
9936
9986
  }, {
@@ -9958,7 +10008,7 @@ var spgAbi = [{
9958
10008
  internalType: "uint32",
9959
10009
  type: "uint32"
9960
10010
  }, {
9961
- name: "commercialRevCelling",
10011
+ name: "commercialRevCeiling",
9962
10012
  internalType: "uint256",
9963
10013
  type: "uint256"
9964
10014
  }, {
@@ -9978,7 +10028,7 @@ var spgAbi = [{
9978
10028
  internalType: "bool",
9979
10029
  type: "bool"
9980
10030
  }, {
9981
- name: "derivativeRevCelling",
10031
+ name: "derivativeRevCeiling",
9982
10032
  internalType: "uint256",
9983
10033
  type: "uint256"
9984
10034
  }, {
@@ -10072,13 +10122,17 @@ var spgAbi = [{
10072
10122
  internalType: "struct IStoryProtocolGateway.IPMetadata",
10073
10123
  type: "tuple",
10074
10124
  components: [{
10075
- name: "metadataURI",
10125
+ name: "ipMetadataURI",
10076
10126
  internalType: "string",
10077
10127
  type: "string"
10078
10128
  }, {
10079
- name: "metadataHash",
10129
+ name: "ipMetadataHash",
10080
10130
  internalType: "bytes32",
10081
10131
  type: "bytes32"
10132
+ }, {
10133
+ name: "nftMetadataURI",
10134
+ internalType: "string",
10135
+ type: "string"
10082
10136
  }, {
10083
10137
  name: "nftMetadataHash",
10084
10138
  internalType: "bytes32",
@@ -10149,13 +10203,17 @@ var spgAbi = [{
10149
10203
  internalType: "struct IStoryProtocolGateway.IPMetadata",
10150
10204
  type: "tuple",
10151
10205
  components: [{
10152
- name: "metadataURI",
10206
+ name: "ipMetadataURI",
10153
10207
  internalType: "string",
10154
10208
  type: "string"
10155
10209
  }, {
10156
- name: "metadataHash",
10210
+ name: "ipMetadataHash",
10157
10211
  internalType: "bytes32",
10158
10212
  type: "bytes32"
10213
+ }, {
10214
+ name: "nftMetadataURI",
10215
+ internalType: "string",
10216
+ type: "string"
10159
10217
  }, {
10160
10218
  name: "nftMetadataHash",
10161
10219
  internalType: "bytes32",
@@ -10222,7 +10280,7 @@ var spgAbi = [{
10222
10280
  internalType: "address",
10223
10281
  type: "address"
10224
10282
  }, {
10225
- name: "mintingFee",
10283
+ name: "defaultMintingFee",
10226
10284
  internalType: "uint256",
10227
10285
  type: "uint256"
10228
10286
  }, {
@@ -10250,7 +10308,7 @@ var spgAbi = [{
10250
10308
  internalType: "uint32",
10251
10309
  type: "uint32"
10252
10310
  }, {
10253
- name: "commercialRevCelling",
10311
+ name: "commercialRevCeiling",
10254
10312
  internalType: "uint256",
10255
10313
  type: "uint256"
10256
10314
  }, {
@@ -10270,7 +10328,7 @@ var spgAbi = [{
10270
10328
  internalType: "bool",
10271
10329
  type: "bool"
10272
10330
  }, {
10273
- name: "derivativeRevCelling",
10331
+ name: "derivativeRevCeiling",
10274
10332
  internalType: "uint256",
10275
10333
  type: "uint256"
10276
10334
  }, {
@@ -17485,7 +17543,6 @@ var RoyaltyPolicyLapClient = /*#__PURE__*/function (_RoyaltyPolicyLapRead) {
17485
17543
  *
17486
17544
  * @param nftContract address
17487
17545
  * @param recipient address
17488
- * @param nftMetadata string
17489
17546
  * @param ipMetadata tuple
17490
17547
  */
17491
17548
 
@@ -17494,7 +17551,6 @@ var RoyaltyPolicyLapClient = /*#__PURE__*/function (_RoyaltyPolicyLapRead) {
17494
17551
  *
17495
17552
  * @param nftContract address
17496
17553
  * @param recipient address
17497
- * @param nftMetadata string
17498
17554
  * @param ipMetadata tuple
17499
17555
  * @param terms tuple
17500
17556
  */
@@ -17504,7 +17560,6 @@ var RoyaltyPolicyLapClient = /*#__PURE__*/function (_RoyaltyPolicyLapRead) {
17504
17560
  *
17505
17561
  * @param nftContract address
17506
17562
  * @param derivData tuple
17507
- * @param nftMetadata string
17508
17563
  * @param ipMetadata tuple
17509
17564
  * @param recipient address
17510
17565
  */
@@ -17515,7 +17570,6 @@ var RoyaltyPolicyLapClient = /*#__PURE__*/function (_RoyaltyPolicyLapRead) {
17515
17570
  * @param nftContract address
17516
17571
  * @param licenseTokenIds uint256[]
17517
17572
  * @param royaltyContext bytes
17518
- * @param nftMetadata string
17519
17573
  * @param ipMetadata tuple
17520
17574
  * @param recipient address
17521
17575
  */
@@ -17728,7 +17782,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17728
17782
  address: this.address,
17729
17783
  functionName: "mintAndRegisterIp",
17730
17784
  account: this.wallet.account,
17731
- args: [request.nftContract, request.recipient, request.nftMetadata, request.ipMetadata]
17785
+ args: [request.nftContract, request.recipient, request.ipMetadata]
17732
17786
  });
17733
17787
  case 2:
17734
17788
  _yield$this$rpcClient46 = _context112.sent;
@@ -17763,7 +17817,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17763
17817
  data: viem.encodeFunctionData({
17764
17818
  abi: spgAbi,
17765
17819
  functionName: "mintAndRegisterIp",
17766
- args: [request.nftContract, request.recipient, request.nftMetadata, request.ipMetadata]
17820
+ args: [request.nftContract, request.recipient, request.ipMetadata]
17767
17821
  })
17768
17822
  };
17769
17823
  }
@@ -17788,7 +17842,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17788
17842
  address: this.address,
17789
17843
  functionName: "mintAndRegisterIpAndAttachPILTerms",
17790
17844
  account: this.wallet.account,
17791
- args: [request.nftContract, request.recipient, request.nftMetadata, request.ipMetadata, request.terms]
17845
+ args: [request.nftContract, request.recipient, request.ipMetadata, request.terms]
17792
17846
  });
17793
17847
  case 2:
17794
17848
  _yield$this$rpcClient47 = _context113.sent;
@@ -17823,7 +17877,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17823
17877
  data: viem.encodeFunctionData({
17824
17878
  abi: spgAbi,
17825
17879
  functionName: "mintAndRegisterIpAndAttachPILTerms",
17826
- args: [request.nftContract, request.recipient, request.nftMetadata, request.ipMetadata, request.terms]
17880
+ args: [request.nftContract, request.recipient, request.ipMetadata, request.terms]
17827
17881
  })
17828
17882
  };
17829
17883
  }
@@ -17848,7 +17902,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17848
17902
  address: this.address,
17849
17903
  functionName: "mintAndRegisterIpAndMakeDerivative",
17850
17904
  account: this.wallet.account,
17851
- args: [request.nftContract, request.derivData, request.nftMetadata, request.ipMetadata, request.recipient]
17905
+ args: [request.nftContract, request.derivData, request.ipMetadata, request.recipient]
17852
17906
  });
17853
17907
  case 2:
17854
17908
  _yield$this$rpcClient48 = _context114.sent;
@@ -17883,7 +17937,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17883
17937
  data: viem.encodeFunctionData({
17884
17938
  abi: spgAbi,
17885
17939
  functionName: "mintAndRegisterIpAndMakeDerivative",
17886
- args: [request.nftContract, request.derivData, request.nftMetadata, request.ipMetadata, request.recipient]
17940
+ args: [request.nftContract, request.derivData, request.ipMetadata, request.recipient]
17887
17941
  })
17888
17942
  };
17889
17943
  }
@@ -17908,7 +17962,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17908
17962
  address: this.address,
17909
17963
  functionName: "mintAndRegisterIpAndMakeDerivativeWithLicenseTokens",
17910
17964
  account: this.wallet.account,
17911
- args: [request.nftContract, request.licenseTokenIds, request.royaltyContext, request.nftMetadata, request.ipMetadata, request.recipient]
17965
+ args: [request.nftContract, request.licenseTokenIds, request.royaltyContext, request.ipMetadata, request.recipient]
17912
17966
  });
17913
17967
  case 2:
17914
17968
  _yield$this$rpcClient49 = _context115.sent;
@@ -17943,7 +17997,7 @@ var SpgClient = /*#__PURE__*/function (_SpgEventClient) {
17943
17997
  data: viem.encodeFunctionData({
17944
17998
  abi: spgAbi,
17945
17999
  functionName: "mintAndRegisterIpAndMakeDerivativeWithLicenseTokens",
17946
- args: [request.nftContract, request.licenseTokenIds, request.royaltyContext, request.nftMetadata, request.ipMetadata, request.recipient]
18000
+ args: [request.nftContract, request.licenseTokenIds, request.royaltyContext, request.ipMetadata, request.recipient]
17947
18001
  })
17948
18002
  };
17949
18003
  }
@@ -18458,10 +18512,11 @@ var IPAssetClient = /*#__PURE__*/function () {
18458
18512
  * @param request - The request object that contains all data needed to register IP.
18459
18513
  * @param request.nftContract The address of the NFT.
18460
18514
  * @param request.tokenId The token identifier of the NFT.
18461
- * @param request.ipMetadata - [Optional] The ipMetadata for the IP.
18462
- * @param request.ipMetadata.metadataURI [Optional] The URI of the ipMetadata for the IP.
18463
- * @param request.ipMetadata.metadataHash [Optional] The ipMetadata for the IP.
18464
- * @param request.ipMetadata.nftMetadataHash [Optional] The ipMetadata for the IP NFT.
18515
+ * @param request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
18516
+ * @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
18517
+ * @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
18518
+ * @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
18519
+ * @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
18465
18520
  * @param request.deadline [Optional] The deadline for the signature in milliseconds, default is 1000ms.
18466
18521
  * @param request.txOptions [Optional] The transaction options.
18467
18522
  * @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true.
@@ -18471,7 +18526,7 @@ var IPAssetClient = /*#__PURE__*/function () {
18471
18526
  key: "register",
18472
18527
  value: (function () {
18473
18528
  var _register = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
18474
- var _request$txOptions, tokenId, ipIdAddress, isRegistered, object, _request$txOptions2, txHash, calculatedDeadline, signature, txReceipt, targetLogs;
18529
+ var _request$ipMetadata, _request$ipMetadata2, _request$ipMetadata3, _request$ipMetadata4, _request$txOptions, tokenId, ipIdAddress, isRegistered, object, _request$txOptions2, txHash, calculatedDeadline, signature, txReceipt, targetLogs;
18475
18530
  return _regeneratorRuntime().wrap(function _callee$(_context) {
18476
18531
  while (1) switch (_context.prev = _context.next) {
18477
18532
  case 0:
@@ -18497,9 +18552,10 @@ var IPAssetClient = /*#__PURE__*/function () {
18497
18552
  tokenId: tokenId,
18498
18553
  nftContract: getAddress$1(request.nftContract, "request.nftContract"),
18499
18554
  ipMetadata: {
18500
- metadataURI: "",
18501
- metadataHash: viem.zeroHash,
18502
- nftMetadataHash: viem.zeroHash
18555
+ ipMetadataURI: ((_request$ipMetadata = request.ipMetadata) === null || _request$ipMetadata === void 0 ? void 0 : _request$ipMetadata.ipMetadataURI) || "",
18556
+ ipMetadataHash: ((_request$ipMetadata2 = request.ipMetadata) === null || _request$ipMetadata2 === void 0 ? void 0 : _request$ipMetadata2.ipMetadataHash) || viem.zeroHash,
18557
+ nftMetadataURI: ((_request$ipMetadata3 = request.ipMetadata) === null || _request$ipMetadata3 === void 0 ? void 0 : _request$ipMetadata3.nftMetadataURI) || "",
18558
+ nftMetadataHash: ((_request$ipMetadata4 = request.ipMetadata) === null || _request$ipMetadata4 === void 0 ? void 0 : _request$ipMetadata4.nftMetadataHash) || viem.zeroHash
18503
18559
  },
18504
18560
  sigMetadata: {
18505
18561
  signer: viem.zeroAddress,
@@ -18507,25 +18563,18 @@ var IPAssetClient = /*#__PURE__*/function () {
18507
18563
  signature: viem.zeroHash
18508
18564
  }
18509
18565
  };
18510
- if (request.ipMetadata && (request.ipMetadata.metadataHash !== viem.zeroHash || request.ipMetadata.metadataURI !== "" || request.ipMetadata.nftMetadataHash !== viem.zeroHash)) {
18511
- object.ipMetadata = {
18512
- metadataURI: request.ipMetadata.metadataURI || object.ipMetadata.metadataURI,
18513
- metadataHash: request.ipMetadata.metadataHash || object.ipMetadata.metadataHash,
18514
- nftMetadataHash: request.ipMetadata.nftMetadataHash || object.ipMetadata.nftMetadataHash
18515
- };
18516
- }
18517
18566
  if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.encodedTxDataOnly)) {
18518
- _context.next = 20;
18567
+ _context.next = 19;
18519
18568
  break;
18520
18569
  }
18521
18570
  if (!request.ipMetadata) {
18522
- _context.next = 17;
18571
+ _context.next = 16;
18523
18572
  break;
18524
18573
  }
18525
18574
  return _context.abrupt("return", {
18526
18575
  encodedTxData: this.spgClient.registerIpEncode(object)
18527
18576
  });
18528
- case 17:
18577
+ case 16:
18529
18578
  return _context.abrupt("return", {
18530
18579
  encodedTxData: this.ipAssetRegistryClient.registerEncode({
18531
18580
  tokenContract: object.nftContract,
@@ -18533,16 +18582,16 @@ var IPAssetClient = /*#__PURE__*/function () {
18533
18582
  chainid: chain[this.chainId]
18534
18583
  })
18535
18584
  });
18536
- case 18:
18537
- _context.next = 43;
18585
+ case 17:
18586
+ _context.next = 42;
18538
18587
  break;
18539
- case 20:
18588
+ case 19:
18540
18589
  if (!request.ipMetadata) {
18541
- _context.next = 31;
18590
+ _context.next = 30;
18542
18591
  break;
18543
18592
  }
18544
18593
  calculatedDeadline = getDeadline(request.deadline);
18545
- _context.next = 24;
18594
+ _context.next = 23;
18546
18595
  return getPermissionSignature({
18547
18596
  ipId: ipIdAddress,
18548
18597
  deadline: calculatedDeadline,
@@ -18559,60 +18608,60 @@ var IPAssetClient = /*#__PURE__*/function () {
18559
18608
  func: "function setAll(address,string,bytes32,bytes32)"
18560
18609
  }]
18561
18610
  });
18562
- case 24:
18611
+ case 23:
18563
18612
  signature = _context.sent;
18564
18613
  object.sigMetadata = {
18565
18614
  signer: getAddress$1(this.wallet.account.address, "wallet.account.address"),
18566
18615
  deadline: calculatedDeadline,
18567
18616
  signature: signature
18568
18617
  };
18569
- _context.next = 28;
18618
+ _context.next = 27;
18570
18619
  return this.spgClient.registerIp(object);
18571
- case 28:
18620
+ case 27:
18572
18621
  txHash = _context.sent;
18573
- _context.next = 34;
18574
- break;
18575
- case 31:
18576
18622
  _context.next = 33;
18623
+ break;
18624
+ case 30:
18625
+ _context.next = 32;
18577
18626
  return this.ipAssetRegistryClient.register({
18578
18627
  tokenContract: object.nftContract,
18579
18628
  tokenId: object.tokenId,
18580
18629
  chainid: chain[this.chainId]
18581
18630
  });
18582
- case 33:
18631
+ case 32:
18583
18632
  txHash = _context.sent;
18584
- case 34:
18633
+ case 33:
18585
18634
  if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
18586
- _context.next = 42;
18635
+ _context.next = 41;
18587
18636
  break;
18588
18637
  }
18589
- _context.next = 37;
18638
+ _context.next = 36;
18590
18639
  return this.rpcClient.waitForTransactionReceipt({
18591
18640
  hash: txHash
18592
18641
  });
18593
- case 37:
18642
+ case 36:
18594
18643
  txReceipt = _context.sent;
18595
18644
  targetLogs = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt);
18596
18645
  return _context.abrupt("return", {
18597
18646
  txHash: txHash,
18598
18647
  ipId: targetLogs[0].ipId
18599
18648
  });
18600
- case 42:
18649
+ case 41:
18601
18650
  return _context.abrupt("return", {
18602
18651
  txHash: txHash
18603
18652
  });
18604
- case 43:
18605
- _context.next = 48;
18653
+ case 42:
18654
+ _context.next = 47;
18606
18655
  break;
18607
- case 45:
18608
- _context.prev = 45;
18656
+ case 44:
18657
+ _context.prev = 44;
18609
18658
  _context.t0 = _context["catch"](0);
18610
18659
  handleError(_context.t0, "Failed to register IP");
18611
- case 48:
18660
+ case 47:
18612
18661
  case "end":
18613
18662
  return _context.stop();
18614
18663
  }
18615
- }, _callee, this, [[0, 45]]);
18664
+ }, _callee, this, [[0, 44]]);
18616
18665
  }));
18617
18666
  function register(_x) {
18618
18667
  return _register.apply(this, arguments);
@@ -18895,11 +18944,11 @@ var IPAssetClient = /*#__PURE__*/function () {
18895
18944
  * @param request - The request object that contains all data needed to mint and register ip.
18896
18945
  * @param request.nftContract The address of the NFT collection.
18897
18946
  * @param request.pilType The type of the PIL.
18898
- * @param request.ipMetadata - [Optional] The ipMetadata for the IP.
18899
- * @param request.ipMetadata.metadataURI [Optional] The URI of the ipMetadata for the IP.
18900
- * @param request.ipMetadata.metadataHash [Optional] The ipMetadata for the IP.
18901
- * @param request.ipMetadata.nftMetadataHash [Optional] The ipMetadata for the IP NFT.
18902
- * @param request.nftMetadata [Optional] The desired metadata for the newly minted NFT.
18947
+ * @param request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
18948
+ * @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
18949
+ * @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
18950
+ * @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
18951
+ * @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
18903
18952
  * @param request.recipient [Optional] The address of the recipient of the minted NFT.
18904
18953
  * @param request.mintingFee [Optional] The fee to be paid when minting a license.
18905
18954
  * @param request.commercialRevShare [Optional] Percentage of revenue that must be shared with the licensor.
@@ -18914,7 +18963,7 @@ var IPAssetClient = /*#__PURE__*/function () {
18914
18963
  key: "mintAndRegisterIpAssetWithPilTerms",
18915
18964
  value: (function () {
18916
18965
  var _mintAndRegisterIpAssetWithPilTerms = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(request) {
18917
- var _request$txOptions7, licenseTerm, object, _request$txOptions8, txHash, txReceipt, iPRegisteredLog, licenseTermsId;
18966
+ var _request$ipMetadata5, _request$ipMetadata6, _request$ipMetadata7, _request$ipMetadata8, _request$txOptions7, licenseTerm, object, _request$txOptions8, txHash, txReceipt, iPRegisteredLog, licenseTermsId;
18918
18967
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
18919
18968
  while (1) switch (_context4.prev = _context4.next) {
18920
18969
  case 0:
@@ -18934,46 +18983,35 @@ var IPAssetClient = /*#__PURE__*/function () {
18934
18983
  object = {
18935
18984
  nftContract: getAddress$1(request.nftContract, "request.nftContract"),
18936
18985
  recipient: request.recipient && getAddress$1(request.recipient, "request.recipient") || this.wallet.account.address,
18937
- terms: _objectSpread2(_objectSpread2({}, licenseTerm), {}, {
18938
- mintingFee: BigInt(licenseTerm.defaultMintingFee),
18939
- derivativeRevCelling: licenseTerm.commercialRevCeiling,
18940
- commercialRevCelling: licenseTerm.commercialRevCeiling
18941
- }),
18986
+ terms: licenseTerm,
18942
18987
  ipMetadata: {
18943
- metadataURI: "",
18944
- metadataHash: viem.zeroHash,
18945
- nftMetadataHash: viem.zeroHash
18946
- },
18947
- nftMetadata: request.nftMetadata || ""
18988
+ ipMetadataURI: ((_request$ipMetadata5 = request.ipMetadata) === null || _request$ipMetadata5 === void 0 ? void 0 : _request$ipMetadata5.ipMetadataURI) || "",
18989
+ ipMetadataHash: ((_request$ipMetadata6 = request.ipMetadata) === null || _request$ipMetadata6 === void 0 ? void 0 : _request$ipMetadata6.ipMetadataHash) || viem.zeroHash,
18990
+ nftMetadataURI: ((_request$ipMetadata7 = request.ipMetadata) === null || _request$ipMetadata7 === void 0 ? void 0 : _request$ipMetadata7.nftMetadataURI) || "",
18991
+ nftMetadataHash: ((_request$ipMetadata8 = request.ipMetadata) === null || _request$ipMetadata8 === void 0 ? void 0 : _request$ipMetadata8.nftMetadataHash) || viem.zeroHash
18992
+ }
18948
18993
  };
18949
- if (request.ipMetadata && (request.ipMetadata.metadataHash !== viem.zeroHash || request.ipMetadata.metadataURI !== "" || request.ipMetadata.nftMetadataHash !== viem.zeroHash)) {
18950
- object.ipMetadata = {
18951
- metadataURI: request.ipMetadata.metadataURI || object.ipMetadata.metadataURI,
18952
- metadataHash: request.ipMetadata.metadataHash || object.ipMetadata.metadataHash,
18953
- nftMetadataHash: request.ipMetadata.nftMetadataHash || object.ipMetadata.nftMetadataHash
18954
- };
18955
- }
18956
18994
  if (!((_request$txOptions7 = request.txOptions) !== null && _request$txOptions7 !== void 0 && _request$txOptions7.encodedTxDataOnly)) {
18957
- _context4.next = 10;
18995
+ _context4.next = 9;
18958
18996
  break;
18959
18997
  }
18960
18998
  return _context4.abrupt("return", {
18961
18999
  encodedTxData: this.spgClient.mintAndRegisterIpAndAttachPilTermsEncode(object)
18962
19000
  });
18963
- case 10:
18964
- _context4.next = 12;
19001
+ case 9:
19002
+ _context4.next = 11;
18965
19003
  return this.spgClient.mintAndRegisterIpAndAttachPilTerms(object);
18966
- case 12:
19004
+ case 11:
18967
19005
  txHash = _context4.sent;
18968
19006
  if (!((_request$txOptions8 = request.txOptions) !== null && _request$txOptions8 !== void 0 && _request$txOptions8.waitForTransaction)) {
18969
- _context4.next = 20;
19007
+ _context4.next = 19;
18970
19008
  break;
18971
19009
  }
18972
- _context4.next = 16;
19010
+ _context4.next = 15;
18973
19011
  return this.rpcClient.waitForTransactionReceipt({
18974
19012
  hash: txHash
18975
19013
  });
18976
- case 16:
19014
+ case 15:
18977
19015
  txReceipt = _context4.sent;
18978
19016
  iPRegisteredLog = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(txReceipt)[0];
18979
19017
  licenseTermsId = this.licensingModuleClient.parseTxLicenseTermsAttachedEvent(txReceipt)[0].licenseTermsId;
@@ -18983,22 +19021,22 @@ var IPAssetClient = /*#__PURE__*/function () {
18983
19021
  licenseTermsId: licenseTermsId,
18984
19022
  tokenId: iPRegisteredLog.tokenId
18985
19023
  });
18986
- case 20:
19024
+ case 19:
18987
19025
  return _context4.abrupt("return", {
18988
19026
  txHash: txHash
18989
19027
  });
18990
- case 21:
18991
- _context4.next = 26;
19028
+ case 20:
19029
+ _context4.next = 25;
18992
19030
  break;
18993
- case 23:
18994
- _context4.prev = 23;
19031
+ case 22:
19032
+ _context4.prev = 22;
18995
19033
  _context4.t0 = _context4["catch"](0);
18996
19034
  handleError(_context4.t0, "Failed to mint and register IP and attach PIL terms");
18997
- case 26:
19035
+ case 25:
18998
19036
  case "end":
18999
19037
  return _context4.stop();
19000
19038
  }
19001
- }, _callee4, this, [[0, 23]]);
19039
+ }, _callee4, this, [[0, 22]]);
19002
19040
  }));
19003
19041
  function mintAndRegisterIpAssetWithPilTerms(_x4) {
19004
19042
  return _mintAndRegisterIpAssetWithPilTerms.apply(this, arguments);
@@ -19011,10 +19049,11 @@ var IPAssetClient = /*#__PURE__*/function () {
19011
19049
  * @param request.nftContract The address of the NFT collection.
19012
19050
  * @param request.tokenId The ID of the NFT.
19013
19051
  * @param request.pilType The type of the PIL.
19014
- * @param request.ipMetadata - [Optional] The desired ipMetadata for the newly registered IP.
19015
- * @param request.ipMetadata.metadataURI [Optional] The the ipMetadata for the IP hash.
19016
- * @param request.ipMetadata.metadataHash [Optional] The ipMetadata for the IP.
19017
- * @param request.ipMetadata.nftMetadataHash [Optional] The ipMetadata for the IP NFT.
19052
+ * @param request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
19053
+ * @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
19054
+ * @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
19055
+ * @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
19056
+ * @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
19018
19057
  * @param request.deadline [Optional] The deadline for the signature in milliseconds, default is 1000ms.
19019
19058
  * @param request.mintingFee [Optional] The fee to be paid when minting a license.
19020
19059
  * @param request.commercialRevShare [Optional] Percentage of revenue that must be shared with the licensor.
@@ -19028,7 +19067,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19028
19067
  key: "registerIpAndAttachPilTerms",
19029
19068
  value: (function () {
19030
19069
  var _registerIpAndAttachPilTerms = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(request) {
19031
- var _request$txOptions9, ipIdAddress, isRegistered, licenseTerm, calculatedDeadline, sigAttachSignature, object, sigMetadataSignature, _request$txOptions10, txHash, txReceipt, log;
19070
+ var _request$ipMetadata9, _request$ipMetadata10, _request$ipMetadata11, _request$ipMetadata12, _request$txOptions9, ipIdAddress, isRegistered, licenseTerm, calculatedDeadline, sigAttachSignature, object, sigMetadataSignature, _request$txOptions10, txHash, txReceipt, log;
19032
19071
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
19033
19072
  while (1) switch (_context5.prev = _context5.next) {
19034
19073
  case 0:
@@ -19087,15 +19126,12 @@ var IPAssetClient = /*#__PURE__*/function () {
19087
19126
  object = {
19088
19127
  nftContract: getAddress$1(request.nftContract, "request.nftContract"),
19089
19128
  tokenId: request.tokenId,
19090
- terms: _objectSpread2(_objectSpread2({}, licenseTerm), {}, {
19091
- mintingFee: BigInt(licenseTerm.defaultMintingFee),
19092
- derivativeRevCelling: licenseTerm.commercialRevCeiling,
19093
- commercialRevCelling: licenseTerm.commercialRevCeiling
19094
- }),
19129
+ terms: licenseTerm,
19095
19130
  ipMetadata: {
19096
- metadataURI: "",
19097
- metadataHash: viem.zeroHash,
19098
- nftMetadataHash: viem.zeroHash
19131
+ ipMetadataURI: ((_request$ipMetadata9 = request.ipMetadata) === null || _request$ipMetadata9 === void 0 ? void 0 : _request$ipMetadata9.ipMetadataURI) || "",
19132
+ ipMetadataHash: ((_request$ipMetadata10 = request.ipMetadata) === null || _request$ipMetadata10 === void 0 ? void 0 : _request$ipMetadata10.ipMetadataHash) || viem.zeroHash,
19133
+ nftMetadataURI: ((_request$ipMetadata11 = request.ipMetadata) === null || _request$ipMetadata11 === void 0 ? void 0 : _request$ipMetadata11.nftMetadataURI) || "",
19134
+ nftMetadataHash: ((_request$ipMetadata12 = request.ipMetadata) === null || _request$ipMetadata12 === void 0 ? void 0 : _request$ipMetadata12.nftMetadataHash) || viem.zeroHash
19099
19135
  },
19100
19136
  sigMetadata: {
19101
19137
  signer: viem.zeroAddress,
@@ -19108,14 +19144,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19108
19144
  signature: sigAttachSignature
19109
19145
  }
19110
19146
  };
19111
- if (request.ipMetadata && (request.ipMetadata.metadataHash !== viem.zeroHash || request.ipMetadata.metadataURI !== "" || request.ipMetadata.nftMetadataHash !== viem.zeroHash)) {
19112
- object.ipMetadata = {
19113
- metadataURI: request.ipMetadata.metadataURI || object.ipMetadata.metadataURI,
19114
- metadataHash: request.ipMetadata.metadataHash || object.ipMetadata.metadataHash,
19115
- nftMetadataHash: request.ipMetadata.nftMetadataHash || object.ipMetadata.nftMetadataHash
19116
- };
19117
- }
19118
- _context5.next = 21;
19147
+ _context5.next = 20;
19119
19148
  return getPermissionSignature({
19120
19149
  ipId: ipIdAddress,
19121
19150
  deadline: calculatedDeadline,
@@ -19132,7 +19161,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19132
19161
  func: "function setAll(address,string,bytes32,bytes32)"
19133
19162
  }]
19134
19163
  });
19135
- case 21:
19164
+ case 20:
19136
19165
  sigMetadataSignature = _context5.sent;
19137
19166
  object.sigMetadata = {
19138
19167
  signer: getAddress$1(this.wallet.account.address, "wallet.account.address"),
@@ -19140,26 +19169,26 @@ var IPAssetClient = /*#__PURE__*/function () {
19140
19169
  signature: sigMetadataSignature
19141
19170
  };
19142
19171
  if (!((_request$txOptions9 = request.txOptions) !== null && _request$txOptions9 !== void 0 && _request$txOptions9.encodedTxDataOnly)) {
19143
- _context5.next = 27;
19172
+ _context5.next = 26;
19144
19173
  break;
19145
19174
  }
19146
19175
  return _context5.abrupt("return", {
19147
19176
  encodedTxData: this.spgClient.registerIpAndAttachPilTermsEncode(object)
19148
19177
  });
19149
- case 27:
19150
- _context5.next = 29;
19178
+ case 26:
19179
+ _context5.next = 28;
19151
19180
  return this.spgClient.registerIpAndAttachPilTerms(object);
19152
- case 29:
19181
+ case 28:
19153
19182
  txHash = _context5.sent;
19154
19183
  if (!((_request$txOptions10 = request.txOptions) !== null && _request$txOptions10 !== void 0 && _request$txOptions10.waitForTransaction)) {
19155
- _context5.next = 36;
19184
+ _context5.next = 35;
19156
19185
  break;
19157
19186
  }
19158
- _context5.next = 33;
19187
+ _context5.next = 32;
19159
19188
  return this.rpcClient.waitForTransactionReceipt({
19160
19189
  hash: txHash
19161
19190
  });
19162
- case 33:
19191
+ case 32:
19163
19192
  txReceipt = _context5.sent;
19164
19193
  log = this.licensingModuleClient.parseTxLicenseTermsAttachedEvent(txReceipt)[0];
19165
19194
  return _context5.abrupt("return", {
@@ -19167,22 +19196,22 @@ var IPAssetClient = /*#__PURE__*/function () {
19167
19196
  licenseTermsId: log.licenseTermsId,
19168
19197
  ipId: log.ipId
19169
19198
  });
19170
- case 36:
19199
+ case 35:
19171
19200
  return _context5.abrupt("return", {
19172
19201
  txHash: txHash
19173
19202
  });
19174
- case 37:
19175
- _context5.next = 42;
19203
+ case 36:
19204
+ _context5.next = 41;
19176
19205
  break;
19177
- case 39:
19178
- _context5.prev = 39;
19206
+ case 38:
19207
+ _context5.prev = 38;
19179
19208
  _context5.t0 = _context5["catch"](0);
19180
19209
  handleError(_context5.t0, "Failed to register IP and attach PIL terms");
19181
- case 42:
19210
+ case 41:
19182
19211
  case "end":
19183
19212
  return _context5.stop();
19184
19213
  }
19185
- }, _callee5, this, [[0, 39]]);
19214
+ }, _callee5, this, [[0, 38]]);
19186
19215
  }));
19187
19216
  function registerIpAndAttachPilTerms(_x5) {
19188
19217
  return _registerIpAndAttachPilTerms.apply(this, arguments);
@@ -19198,10 +19227,11 @@ var IPAssetClient = /*#__PURE__*/function () {
19198
19227
  * @param request.derivData.parentIpIds The IDs of the parent IPs to link the registered derivative IP.
19199
19228
  * @param request.derivData.licenseTemplate [Optional] The address of the license template to be used for the linking.
19200
19229
  * @param request.derivData.licenseTermsIds The IDs of the license terms to be used for the linking.
19201
- * @param request.ipMetadata - [Optional] The desired ipMetadata for the newly registered IP.
19202
- * @param request.ipMetadata.metadataURI [Optional] The URI of the ipMetadata for the IP.
19203
- * @param request.ipMetadata.metadataHash [Optional] The ipMetadata for the IP.
19204
- * @param request.ipMetadata.nftMetadataHash [Optional] The the ipMetadata for the IP NFT.
19230
+ * @param request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
19231
+ * @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
19232
+ * @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
19233
+ * @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
19234
+ * @param request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
19205
19235
  * @param request.deadline [Optional] The deadline for the signature in milliseconds,default is 1000ms.
19206
19236
  * @param request.txOptions [Optional] The transaction options.
19207
19237
  * @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true.
@@ -19212,7 +19242,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19212
19242
  key: "registerDerivativeIp",
19213
19243
  value: (function () {
19214
19244
  var _registerDerivativeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(request) {
19215
- var _request$txOptions11, tokenId, ipIdAddress, isRegistered, i, isAttachedLicenseTerms, calculatedDeadline, sigRegisterSignature, object, sigMetadataSignature, _request$txOptions12, txHash, receipt, log;
19245
+ 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;
19216
19246
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
19217
19247
  while (1) switch (_context6.prev = _context6.next) {
19218
19248
  case 0:
@@ -19305,9 +19335,10 @@ var IPAssetClient = /*#__PURE__*/function () {
19305
19335
  signature: sigRegisterSignature
19306
19336
  },
19307
19337
  ipMetadata: {
19308
- metadataURI: "",
19309
- metadataHash: viem.zeroHash,
19310
- nftMetadataHash: viem.zeroHash
19338
+ ipMetadataURI: ((_request$ipMetadata13 = request.ipMetadata) === null || _request$ipMetadata13 === void 0 ? void 0 : _request$ipMetadata13.ipMetadataURI) || "",
19339
+ ipMetadataHash: ((_request$ipMetadata14 = request.ipMetadata) === null || _request$ipMetadata14 === void 0 ? void 0 : _request$ipMetadata14.ipMetadataHash) || viem.zeroHash,
19340
+ nftMetadataURI: ((_request$ipMetadata15 = request.ipMetadata) === null || _request$ipMetadata15 === void 0 ? void 0 : _request$ipMetadata15.nftMetadataURI) || "",
19341
+ nftMetadataHash: ((_request$ipMetadata16 = request.ipMetadata) === null || _request$ipMetadata16 === void 0 ? void 0 : _request$ipMetadata16.nftMetadataHash) || viem.zeroHash
19311
19342
  },
19312
19343
  sigMetadata: {
19313
19344
  signer: viem.zeroAddress,
@@ -19315,14 +19346,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19315
19346
  signature: viem.zeroHash
19316
19347
  }
19317
19348
  };
19318
- if (request.ipMetadata && (request.ipMetadata.metadataHash !== viem.zeroHash || request.ipMetadata.metadataURI !== "" || request.ipMetadata.nftMetadataHash !== viem.zeroHash)) {
19319
- object.ipMetadata = {
19320
- metadataURI: request.ipMetadata.metadataURI || object.ipMetadata.metadataURI,
19321
- metadataHash: request.ipMetadata.metadataHash || object.ipMetadata.metadataHash,
19322
- nftMetadataHash: request.ipMetadata.nftMetadataHash || object.ipMetadata.nftMetadataHash
19323
- };
19324
- }
19325
- _context6.next = 30;
19349
+ _context6.next = 29;
19326
19350
  return getPermissionSignature({
19327
19351
  ipId: ipIdAddress,
19328
19352
  deadline: calculatedDeadline,
@@ -19339,7 +19363,7 @@ var IPAssetClient = /*#__PURE__*/function () {
19339
19363
  func: "function setAll(address,string,bytes32,bytes32)"
19340
19364
  }]
19341
19365
  });
19342
- case 30:
19366
+ case 29:
19343
19367
  sigMetadataSignature = _context6.sent;
19344
19368
  object.sigMetadata = {
19345
19369
  signer: getAddress$1(this.wallet.account.address, "wallet.account.address"),
@@ -19347,78 +19371,200 @@ var IPAssetClient = /*#__PURE__*/function () {
19347
19371
  signature: sigMetadataSignature
19348
19372
  };
19349
19373
  if (!((_request$txOptions11 = request.txOptions) !== null && _request$txOptions11 !== void 0 && _request$txOptions11.encodedTxDataOnly)) {
19350
- _context6.next = 36;
19374
+ _context6.next = 35;
19351
19375
  break;
19352
19376
  }
19353
19377
  return _context6.abrupt("return", {
19354
19378
  encodedTxData: this.spgClient.registerIpAndMakeDerivativeEncode(object)
19355
19379
  });
19356
- case 36:
19357
- _context6.next = 38;
19380
+ case 35:
19381
+ _context6.next = 37;
19358
19382
  return this.spgClient.registerIpAndMakeDerivative(object);
19359
- case 38:
19383
+ case 37:
19360
19384
  txHash = _context6.sent;
19361
19385
  if (!((_request$txOptions12 = request.txOptions) !== null && _request$txOptions12 !== void 0 && _request$txOptions12.waitForTransaction)) {
19362
- _context6.next = 45;
19386
+ _context6.next = 44;
19363
19387
  break;
19364
19388
  }
19365
- _context6.next = 42;
19389
+ _context6.next = 41;
19366
19390
  return this.rpcClient.waitForTransactionReceipt({
19367
19391
  hash: txHash
19368
19392
  });
19369
- case 42:
19393
+ case 41:
19370
19394
  receipt = _context6.sent;
19371
19395
  log = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(receipt)[0];
19372
19396
  return _context6.abrupt("return", {
19373
19397
  txHash: txHash,
19374
19398
  ipId: log.ipId
19375
19399
  });
19376
- case 45:
19400
+ case 44:
19377
19401
  return _context6.abrupt("return", {
19378
19402
  txHash: txHash
19379
19403
  });
19380
- case 46:
19381
- _context6.next = 51;
19404
+ case 45:
19405
+ _context6.next = 50;
19382
19406
  break;
19383
- case 48:
19384
- _context6.prev = 48;
19407
+ case 47:
19408
+ _context6.prev = 47;
19385
19409
  _context6.t0 = _context6["catch"](0);
19386
19410
  handleError(_context6.t0, "Failed to register derivative IP");
19387
- case 51:
19411
+ case 50:
19388
19412
  case "end":
19389
19413
  return _context6.stop();
19390
19414
  }
19391
- }, _callee6, this, [[0, 48]]);
19415
+ }, _callee6, this, [[0, 47]]);
19392
19416
  }));
19393
19417
  function registerDerivativeIp(_x6) {
19394
19418
  return _registerDerivativeIp.apply(this, arguments);
19395
19419
  }
19396
19420
  return registerDerivativeIp;
19421
+ }()
19422
+ /**
19423
+ * Mint an NFT from a collection and register it as a derivative IP without license tokens.
19424
+ * @param request - The request object that contains all data needed to mint and register ip and make derivative.
19425
+ * @param request.nftContract The address of the NFT collection.
19426
+ * @param request.derivData The derivative data to be used for registerDerivative.
19427
+ * @param request.derivData.parentIpIds The IDs of the parent IPs to link the registered derivative IP.
19428
+ * @param request.derivData.licenseTermsIds The IDs of the license terms to be used for the linking.
19429
+ * @param request.derivData.licenseTemplate [Optional] The address of the license template to be used for the linking.
19430
+ * @param request.ipMetadata - [Optional] The desired metadata for the newly minted NFT and newly registered IP.
19431
+ * @param request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
19432
+ * @param request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
19433
+ * @param request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
19434
+ * @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.
19435
+ * @param request.txOptions [Optional] The transaction options.
19436
+ * @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true.
19437
+ * @emits IPRegistered (ipId, chainId, tokenContract, tokenId, name, uri, registrationDate)
19438
+ */
19439
+ )
19440
+ }, {
19441
+ key: "mintAndRegisterIpAndMakeDerivative",
19442
+ value: (function () {
19443
+ var _mintAndRegisterIpAndMakeDerivative = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(request) {
19444
+ var _request$ipMetadata17, _request$ipMetadata18, _request$ipMetadata19, _request$ipMetadata20, _request$txOptions13, i, isAttachedLicenseTerms, object, _request$txOptions14, txHash, receipt, log;
19445
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
19446
+ while (1) switch (_context7.prev = _context7.next) {
19447
+ case 0:
19448
+ _context7.prev = 0;
19449
+ if (!(request.derivData.parentIpIds.length !== request.derivData.licenseTermsIds.length)) {
19450
+ _context7.next = 3;
19451
+ break;
19452
+ }
19453
+ throw new Error("Parent IP IDs and License terms IDs must be provided in pairs.");
19454
+ case 3:
19455
+ i = 0;
19456
+ case 4:
19457
+ if (!(i < request.derivData.parentIpIds.length)) {
19458
+ _context7.next = 13;
19459
+ break;
19460
+ }
19461
+ _context7.next = 7;
19462
+ return this.licenseRegistryReadOnlyClient.hasIpAttachedLicenseTerms({
19463
+ ipId: getAddress$1(request.derivData.parentIpIds[i], "request.derivData.parentIpIds"),
19464
+ licenseTemplate: request.derivData.licenseTemplate && getAddress$1(request.derivData.licenseTemplate, "request.derivData.licenseTemplate") || this.licenseTemplateClient.address,
19465
+ licenseTermsId: BigInt(request.derivData.licenseTermsIds[i])
19466
+ });
19467
+ case 7:
19468
+ isAttachedLicenseTerms = _context7.sent;
19469
+ if (isAttachedLicenseTerms) {
19470
+ _context7.next = 10;
19471
+ break;
19472
+ }
19473
+ 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."));
19474
+ case 10:
19475
+ i++;
19476
+ _context7.next = 4;
19477
+ break;
19478
+ case 13:
19479
+ object = _objectSpread2(_objectSpread2({}, request), {}, {
19480
+ derivData: _objectSpread2(_objectSpread2({}, request.derivData), {}, {
19481
+ royaltyContext: viem.zeroAddress,
19482
+ licenseTemplate: request.derivData.licenseTemplate || this.licenseTemplateClient.address,
19483
+ licenseTermsIds: request.derivData.licenseTermsIds.map(function (id) {
19484
+ return BigInt(id);
19485
+ })
19486
+ }),
19487
+ ipMetadata: {
19488
+ ipMetadataURI: ((_request$ipMetadata17 = request.ipMetadata) === null || _request$ipMetadata17 === void 0 ? void 0 : _request$ipMetadata17.ipMetadataURI) || "",
19489
+ ipMetadataHash: ((_request$ipMetadata18 = request.ipMetadata) === null || _request$ipMetadata18 === void 0 ? void 0 : _request$ipMetadata18.ipMetadataHash) || viem.zeroHash,
19490
+ nftMetadataURI: ((_request$ipMetadata19 = request.ipMetadata) === null || _request$ipMetadata19 === void 0 ? void 0 : _request$ipMetadata19.nftMetadataURI) || "",
19491
+ nftMetadataHash: ((_request$ipMetadata20 = request.ipMetadata) === null || _request$ipMetadata20 === void 0 ? void 0 : _request$ipMetadata20.nftMetadataHash) || viem.zeroHash
19492
+ },
19493
+ recipient: request.recipient && getAddress$1(request.recipient, "request.recipient") || this.wallet.account.address
19494
+ });
19495
+ if (!((_request$txOptions13 = request.txOptions) !== null && _request$txOptions13 !== void 0 && _request$txOptions13.encodedTxDataOnly)) {
19496
+ _context7.next = 18;
19497
+ break;
19498
+ }
19499
+ return _context7.abrupt("return", {
19500
+ encodedTxData: this.spgClient.mintAndRegisterIpAndMakeDerivativeEncode(object)
19501
+ });
19502
+ case 18:
19503
+ _context7.next = 20;
19504
+ return this.spgClient.mintAndRegisterIpAndMakeDerivative(object);
19505
+ case 20:
19506
+ txHash = _context7.sent;
19507
+ if (!((_request$txOptions14 = request.txOptions) !== null && _request$txOptions14 !== void 0 && _request$txOptions14.waitForTransaction)) {
19508
+ _context7.next = 27;
19509
+ break;
19510
+ }
19511
+ _context7.next = 24;
19512
+ return this.rpcClient.waitForTransactionReceipt({
19513
+ hash: txHash
19514
+ });
19515
+ case 24:
19516
+ receipt = _context7.sent;
19517
+ log = this.ipAssetRegistryClient.parseTxIpRegisteredEvent(receipt)[0];
19518
+ return _context7.abrupt("return", {
19519
+ txHash: txHash,
19520
+ childIpId: log.ipId
19521
+ });
19522
+ case 27:
19523
+ return _context7.abrupt("return", {
19524
+ txHash: txHash
19525
+ });
19526
+ case 28:
19527
+ _context7.next = 33;
19528
+ break;
19529
+ case 30:
19530
+ _context7.prev = 30;
19531
+ _context7.t0 = _context7["catch"](0);
19532
+ handleError(_context7.t0, "Failed to mint and register IP and make derivative");
19533
+ case 33:
19534
+ case "end":
19535
+ return _context7.stop();
19536
+ }
19537
+ }, _callee7, this, [[0, 30]]);
19538
+ }));
19539
+ function mintAndRegisterIpAndMakeDerivative(_x7) {
19540
+ return _mintAndRegisterIpAndMakeDerivative.apply(this, arguments);
19541
+ }
19542
+ return mintAndRegisterIpAndMakeDerivative;
19397
19543
  }())
19398
19544
  }, {
19399
19545
  key: "getIpIdAddress",
19400
19546
  value: function () {
19401
- var _getIpIdAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(nftContract, tokenId) {
19547
+ var _getIpIdAddress = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(nftContract, tokenId) {
19402
19548
  var ipId;
19403
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
19404
- while (1) switch (_context7.prev = _context7.next) {
19549
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
19550
+ while (1) switch (_context8.prev = _context8.next) {
19405
19551
  case 0:
19406
- _context7.next = 2;
19552
+ _context8.next = 2;
19407
19553
  return this.ipAssetRegistryClient.ipId({
19408
19554
  chainId: chain[this.chainId],
19409
19555
  tokenContract: getAddress$1(nftContract, "nftContract"),
19410
19556
  tokenId: BigInt(tokenId)
19411
19557
  });
19412
19558
  case 2:
19413
- ipId = _context7.sent;
19414
- return _context7.abrupt("return", ipId);
19559
+ ipId = _context8.sent;
19560
+ return _context8.abrupt("return", ipId);
19415
19561
  case 4:
19416
19562
  case "end":
19417
- return _context7.stop();
19563
+ return _context8.stop();
19418
19564
  }
19419
- }, _callee7, this);
19565
+ }, _callee8, this);
19420
19566
  }));
19421
- function getIpIdAddress(_x7, _x8) {
19567
+ function getIpIdAddress(_x8, _x9) {
19422
19568
  return _getIpIdAddress.apply(this, arguments);
19423
19569
  }
19424
19570
  return getIpIdAddress;
@@ -19426,23 +19572,23 @@ var IPAssetClient = /*#__PURE__*/function () {
19426
19572
  }, {
19427
19573
  key: "isRegistered",
19428
19574
  value: function () {
19429
- var _isRegistered = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(ipId) {
19430
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
19431
- while (1) switch (_context8.prev = _context8.next) {
19575
+ var _isRegistered = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(ipId) {
19576
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
19577
+ while (1) switch (_context9.prev = _context9.next) {
19432
19578
  case 0:
19433
- _context8.next = 2;
19579
+ _context9.next = 2;
19434
19580
  return this.ipAssetRegistryClient.isRegistered({
19435
19581
  id: getAddress$1(ipId, "ipId")
19436
19582
  });
19437
19583
  case 2:
19438
- return _context8.abrupt("return", _context8.sent);
19584
+ return _context9.abrupt("return", _context9.sent);
19439
19585
  case 3:
19440
19586
  case "end":
19441
- return _context8.stop();
19587
+ return _context9.stop();
19442
19588
  }
19443
- }, _callee8, this);
19589
+ }, _callee9, this);
19444
19590
  }));
19445
- function isRegistered(_x9) {
19591
+ function isRegistered(_x10) {
19446
19592
  return _isRegistered.apply(this, arguments);
19447
19593
  }
19448
19594
  return isRegistered;