@story-protocol/core-sdk 0.0.1-beta-rc.12 → 0.0.1-beta-rc.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. package/dist/declarations/src/client.d.ts +0 -9
  2. package/dist/declarations/src/client.d.ts.map +1 -1
  3. package/dist/declarations/src/clients/storyAPI.d.ts +0 -2
  4. package/dist/declarations/src/clients/storyAPI.d.ts.map +1 -1
  5. package/dist/declarations/src/index.d.ts +1 -3
  6. package/dist/declarations/src/index.d.ts.map +1 -1
  7. package/dist/declarations/src/resources/dispute.d.ts +321 -5
  8. package/dist/declarations/src/resources/dispute.d.ts.map +1 -1
  9. package/dist/declarations/src/resources/ipAccount.d.ts +321 -5
  10. package/dist/declarations/src/resources/ipAccount.d.ts.map +1 -1
  11. package/dist/declarations/src/resources/license.d.ts +2955 -211
  12. package/dist/declarations/src/resources/license.d.ts.map +1 -1
  13. package/dist/declarations/src/resources/permission.d.ts +642 -10
  14. package/dist/declarations/src/resources/permission.d.ts.map +1 -1
  15. package/dist/declarations/src/resources/royalty.d.ts +963 -15
  16. package/dist/declarations/src/resources/royalty.d.ts.map +1 -1
  17. package/dist/declarations/src/types/config.d.ts +2 -1
  18. package/dist/declarations/src/types/config.d.ts.map +1 -1
  19. package/dist/declarations/src/types/resources/ipAsset.d.ts +1 -1
  20. package/dist/declarations/src/types/resources/ipAsset.d.ts.map +1 -1
  21. package/dist/declarations/src/types/resources/license.d.ts +54 -18
  22. package/dist/declarations/src/types/resources/license.d.ts.map +1 -1
  23. package/dist/story-protocol-core-sdk.cjs.dev.js +863 -905
  24. package/dist/story-protocol-core-sdk.cjs.prod.js +863 -905
  25. package/dist/story-protocol-core-sdk.esm.js +865 -906
  26. package/package.json +5 -5
  27. package/dist/declarations/src/resources/policy.d.ts +0 -3253
  28. package/dist/declarations/src/resources/policy.d.ts.map +0 -1
  29. package/dist/declarations/src/types/resources/policy.d.ts +0 -83
  30. package/dist/declarations/src/types/resources/policy.d.ts.map +0 -1
@@ -608,9 +608,6 @@ function _waitTx() {
608
608
  }));
609
609
  return _waitTx.apply(this, arguments);
610
610
  }
611
- function typedDataToBytes(typedData) {
612
- return viem.encodeAbiParameters(viem.parseAbiParameters(typedData["interface"]), typedData.data);
613
- }
614
611
  function chainStringToViemChain(chainId) {
615
612
  switch (chainId) {
616
613
  case "11155111":
@@ -1085,170 +1082,88 @@ var LicensingModuleABI = [{
1085
1082
  type: "address"
1086
1083
  }, {
1087
1084
  indexed: false,
1088
- internalType: "address[]",
1089
- name: "parentIpIds",
1090
- type: "address[]"
1091
- }],
1092
- name: "IpIdLinkedToParents",
1093
- type: "event"
1094
- }, {
1095
- anonymous: false,
1096
- inputs: [{
1097
- indexed: true,
1098
- internalType: "address",
1099
- name: "caller",
1100
- type: "address"
1101
- }, {
1102
- indexed: true,
1103
1085
  internalType: "address",
1104
- name: "ipId",
1086
+ name: "licenseTemplate",
1105
1087
  type: "address"
1106
- }, {
1107
- indexed: true,
1108
- internalType: "uint256",
1109
- name: "policyId",
1110
- type: "uint256"
1111
1088
  }, {
1112
1089
  indexed: false,
1113
1090
  internalType: "uint256",
1114
- name: "index",
1091
+ name: "licenseTermsId",
1115
1092
  type: "uint256"
1116
- }, {
1117
- indexed: false,
1118
- internalType: "bool",
1119
- name: "isInherited",
1120
- type: "bool"
1121
1093
  }],
1122
- name: "PolicyAddedToIpId",
1094
+ name: "LicenseTermsAttached",
1123
1095
  type: "event"
1124
1096
  }, {
1125
1097
  anonymous: false,
1126
1098
  inputs: [{
1127
1099
  indexed: true,
1128
- internalType: "uint256",
1129
- name: "policyId",
1130
- type: "uint256"
1100
+ internalType: "address",
1101
+ name: "caller",
1102
+ type: "address"
1131
1103
  }, {
1132
1104
  indexed: true,
1133
1105
  internalType: "address",
1134
- name: "policyFrameworkManager",
1106
+ name: "licensorIpId",
1135
1107
  type: "address"
1136
- }, {
1137
- indexed: false,
1138
- internalType: "bytes",
1139
- name: "frameworkData",
1140
- type: "bytes"
1141
1108
  }, {
1142
1109
  indexed: false,
1143
1110
  internalType: "address",
1144
- name: "royaltyPolicy",
1111
+ name: "licenseTemplate",
1145
1112
  type: "address"
1146
1113
  }, {
1147
- indexed: false,
1148
- internalType: "bytes",
1149
- name: "royaltyData",
1150
- type: "bytes"
1114
+ indexed: true,
1115
+ internalType: "uint256",
1116
+ name: "licenseTermsId",
1117
+ type: "uint256"
1151
1118
  }, {
1152
1119
  indexed: false,
1153
1120
  internalType: "uint256",
1154
- name: "mintingFee",
1121
+ name: "amount",
1155
1122
  type: "uint256"
1156
1123
  }, {
1157
1124
  indexed: false,
1158
1125
  internalType: "address",
1159
- name: "mintingFeeToken",
1126
+ name: "receiver",
1160
1127
  type: "address"
1128
+ }, {
1129
+ indexed: false,
1130
+ internalType: "uint256",
1131
+ name: "startLicenseTokenId",
1132
+ type: "uint256"
1161
1133
  }],
1162
- name: "PolicyRegistered",
1134
+ name: "LicenseTokensMinted",
1163
1135
  type: "event"
1164
1136
  }, {
1165
1137
  inputs: [{
1166
1138
  internalType: "address",
1167
1139
  name: "ipId",
1168
1140
  type: "address"
1141
+ }, {
1142
+ internalType: "address",
1143
+ name: "licenseTemplate",
1144
+ type: "address"
1169
1145
  }, {
1170
1146
  internalType: "uint256",
1171
- name: "polId",
1172
- type: "uint256"
1173
- }],
1174
- name: "addPolicyToIp",
1175
- outputs: [{
1176
- internalType: "uint256",
1177
- name: "indexOnIpId",
1147
+ name: "licenseTermsId",
1178
1148
  type: "uint256"
1179
1149
  }],
1150
+ name: "attachLicenseTerms",
1151
+ outputs: [],
1180
1152
  stateMutability: "nonpayable",
1181
1153
  type: "function"
1182
1154
  }, {
1183
1155
  inputs: [{
1184
- components: [{
1185
- internalType: "bool",
1186
- name: "isLicenseTransferable",
1187
- type: "bool"
1188
- }, {
1189
- internalType: "address",
1190
- name: "policyFramework",
1191
- type: "address"
1192
- }, {
1193
- internalType: "bytes",
1194
- name: "frameworkData",
1195
- type: "bytes"
1196
- }, {
1197
- internalType: "address",
1198
- name: "royaltyPolicy",
1199
- type: "address"
1200
- }, {
1201
- internalType: "bytes",
1202
- name: "royaltyData",
1203
- type: "bytes"
1204
- }, {
1205
- internalType: "uint256",
1206
- name: "mintingFee",
1207
- type: "uint256"
1208
- }, {
1209
- internalType: "address",
1210
- name: "mintingFeeToken",
1211
- type: "address"
1212
- }],
1213
- internalType: "struct Licensing.Policy",
1214
- name: "pol",
1215
- type: "tuple"
1216
- }],
1217
- name: "getPolicyId",
1218
- outputs: [{
1219
- internalType: "uint256",
1220
- name: "policyId",
1221
- type: "uint256"
1222
- }],
1223
- stateMutability: "view",
1224
- type: "function"
1225
- }, {
1226
- inputs: [{
1227
- internalType: "uint256[]",
1228
- name: "licenseIds",
1229
- type: "uint256[]"
1156
+ internalType: "address",
1157
+ name: "licensorIpId",
1158
+ type: "address"
1230
1159
  }, {
1231
1160
  internalType: "address",
1232
- name: "childIpId",
1161
+ name: "licenseTemplate",
1233
1162
  type: "address"
1234
1163
  }, {
1235
- internalType: "bytes",
1236
- name: "royaltyContext",
1237
- type: "bytes"
1238
- }],
1239
- name: "linkIpToParents",
1240
- outputs: [],
1241
- stateMutability: "nonpayable",
1242
- type: "function"
1243
- }, {
1244
- inputs: [{
1245
1164
  internalType: "uint256",
1246
- name: "policyId",
1165
+ name: "licenseTermsId",
1247
1166
  type: "uint256"
1248
- }, {
1249
- internalType: "address",
1250
- name: "licensorIpId",
1251
- type: "address"
1252
1167
  }, {
1253
1168
  internalType: "uint256",
1254
1169
  name: "amount",
@@ -1262,60 +1177,116 @@ var LicensingModuleABI = [{
1262
1177
  name: "royaltyContext",
1263
1178
  type: "bytes"
1264
1179
  }],
1265
- name: "mintLicense",
1180
+ name: "mintLicenseTokens",
1266
1181
  outputs: [{
1267
1182
  internalType: "uint256",
1268
- name: "licenseId",
1183
+ name: "startLicenseTokenId",
1269
1184
  type: "uint256"
1270
1185
  }],
1271
1186
  stateMutability: "nonpayable",
1272
1187
  type: "function"
1188
+ }];
1189
+
1190
+ var PILicenseTemplateABI = [{
1191
+ anonymous: false,
1192
+ inputs: [{
1193
+ indexed: true,
1194
+ internalType: "uint256",
1195
+ name: "licenseTermsId",
1196
+ type: "uint256"
1197
+ }, {
1198
+ indexed: true,
1199
+ internalType: "address",
1200
+ name: "licenseTemplate",
1201
+ type: "address"
1202
+ }, {
1203
+ indexed: false,
1204
+ internalType: "bytes",
1205
+ name: "licenseTerms",
1206
+ type: "bytes"
1207
+ }],
1208
+ name: "LicenseTermsRegistered",
1209
+ type: "event"
1273
1210
  }, {
1274
1211
  inputs: [{
1275
1212
  components: [{
1276
1213
  internalType: "bool",
1277
- name: "isLicenseTransferable",
1214
+ name: "transferable",
1278
1215
  type: "bool"
1279
1216
  }, {
1280
1217
  internalType: "address",
1281
- name: "policyFramework",
1218
+ name: "royaltyPolicy",
1282
1219
  type: "address"
1283
1220
  }, {
1284
- internalType: "bytes",
1285
- name: "frameworkData",
1286
- type: "bytes"
1221
+ internalType: "uint256",
1222
+ name: "mintingFee",
1223
+ type: "uint256"
1224
+ }, {
1225
+ internalType: "uint256",
1226
+ name: "expiration",
1227
+ type: "uint256"
1228
+ }, {
1229
+ internalType: "bool",
1230
+ name: "commercialUse",
1231
+ type: "bool"
1232
+ }, {
1233
+ internalType: "bool",
1234
+ name: "commercialAttribution",
1235
+ type: "bool"
1287
1236
  }, {
1288
1237
  internalType: "address",
1289
- name: "royaltyPolicy",
1238
+ name: "commercializerChecker",
1290
1239
  type: "address"
1291
1240
  }, {
1292
1241
  internalType: "bytes",
1293
- name: "royaltyData",
1242
+ name: "commercializerCheckerData",
1294
1243
  type: "bytes"
1244
+ }, {
1245
+ internalType: "uint32",
1246
+ name: "commercialRevShare",
1247
+ type: "uint32"
1295
1248
  }, {
1296
1249
  internalType: "uint256",
1297
- name: "mintingFee",
1250
+ name: "commercialRevCelling",
1251
+ type: "uint256"
1252
+ }, {
1253
+ internalType: "bool",
1254
+ name: "derivativesAllowed",
1255
+ type: "bool"
1256
+ }, {
1257
+ internalType: "bool",
1258
+ name: "derivativesAttribution",
1259
+ type: "bool"
1260
+ }, {
1261
+ internalType: "bool",
1262
+ name: "derivativesApproval",
1263
+ type: "bool"
1264
+ }, {
1265
+ internalType: "bool",
1266
+ name: "derivativesReciprocal",
1267
+ type: "bool"
1268
+ }, {
1269
+ internalType: "uint256",
1270
+ name: "derivativeRevCelling",
1298
1271
  type: "uint256"
1299
1272
  }, {
1300
1273
  internalType: "address",
1301
- name: "mintingFeeToken",
1274
+ name: "currency",
1302
1275
  type: "address"
1303
1276
  }],
1304
- internalType: "struct Licensing.Policy",
1305
- name: "pol",
1277
+ internalType: "struct PILTerms",
1278
+ name: "terms",
1306
1279
  type: "tuple"
1307
1280
  }],
1308
- name: "registerPolicy",
1281
+ name: "getLicenseTermsId",
1309
1282
  outputs: [{
1310
1283
  internalType: "uint256",
1311
- name: "policyId",
1284
+ name: "selectedLicenseTermsId",
1312
1285
  type: "uint256"
1313
1286
  }],
1314
- stateMutability: "nonpayable",
1287
+ stateMutability: "view",
1315
1288
  type: "function"
1316
- }];
1317
-
1318
- var PILPolicyFrameworkManagerABI = [{
1289
+ }, {
1319
1290
  inputs: [{
1320
1291
  components: [{
1321
1292
  internalType: "bool",
@@ -1329,76 +1300,67 @@ var PILPolicyFrameworkManagerABI = [{
1329
1300
  internalType: "uint256",
1330
1301
  name: "mintingFee",
1331
1302
  type: "uint256"
1303
+ }, {
1304
+ internalType: "uint256",
1305
+ name: "expiration",
1306
+ type: "uint256"
1307
+ }, {
1308
+ internalType: "bool",
1309
+ name: "commercialUse",
1310
+ type: "bool"
1311
+ }, {
1312
+ internalType: "bool",
1313
+ name: "commercialAttribution",
1314
+ type: "bool"
1332
1315
  }, {
1333
1316
  internalType: "address",
1334
- name: "mintingFeeToken",
1317
+ name: "commercializerChecker",
1335
1318
  type: "address"
1336
1319
  }, {
1337
- components: [{
1338
- internalType: "bool",
1339
- name: "attribution",
1340
- type: "bool"
1341
- }, {
1342
- internalType: "bool",
1343
- name: "commercialUse",
1344
- type: "bool"
1345
- }, {
1346
- internalType: "bool",
1347
- name: "commercialAttribution",
1348
- type: "bool"
1349
- }, {
1350
- internalType: "address",
1351
- name: "commercializerChecker",
1352
- type: "address"
1353
- }, {
1354
- internalType: "bytes",
1355
- name: "commercializerCheckerData",
1356
- type: "bytes"
1357
- }, {
1358
- internalType: "uint32",
1359
- name: "commercialRevShare",
1360
- type: "uint32"
1361
- }, {
1362
- internalType: "bool",
1363
- name: "derivativesAllowed",
1364
- type: "bool"
1365
- }, {
1366
- internalType: "bool",
1367
- name: "derivativesAttribution",
1368
- type: "bool"
1369
- }, {
1370
- internalType: "bool",
1371
- name: "derivativesApproval",
1372
- type: "bool"
1373
- }, {
1374
- internalType: "bool",
1375
- name: "derivativesReciprocal",
1376
- type: "bool"
1377
- }, {
1378
- internalType: "string[]",
1379
- name: "territories",
1380
- type: "string[]"
1381
- }, {
1382
- internalType: "string[]",
1383
- name: "distributionChannels",
1384
- type: "string[]"
1385
- }, {
1386
- internalType: "string[]",
1387
- name: "contentRestrictions",
1388
- type: "string[]"
1389
- }],
1390
- internalType: "struct PILPolicy",
1391
- name: "policy",
1392
- type: "tuple"
1320
+ internalType: "bytes",
1321
+ name: "commercializerCheckerData",
1322
+ type: "bytes"
1323
+ }, {
1324
+ internalType: "uint32",
1325
+ name: "commercialRevShare",
1326
+ type: "uint32"
1327
+ }, {
1328
+ internalType: "uint256",
1329
+ name: "commercialRevCelling",
1330
+ type: "uint256"
1331
+ }, {
1332
+ internalType: "bool",
1333
+ name: "derivativesAllowed",
1334
+ type: "bool"
1335
+ }, {
1336
+ internalType: "bool",
1337
+ name: "derivativesAttribution",
1338
+ type: "bool"
1339
+ }, {
1340
+ internalType: "bool",
1341
+ name: "derivativesApproval",
1342
+ type: "bool"
1343
+ }, {
1344
+ internalType: "bool",
1345
+ name: "derivativesReciprocal",
1346
+ type: "bool"
1347
+ }, {
1348
+ internalType: "uint256",
1349
+ name: "derivativeRevCelling",
1350
+ type: "uint256"
1351
+ }, {
1352
+ internalType: "address",
1353
+ name: "currency",
1354
+ type: "address"
1393
1355
  }],
1394
- internalType: "struct RegisterPILPolicyParams",
1395
- name: "params",
1356
+ internalType: "struct PILTerms",
1357
+ name: "terms",
1396
1358
  type: "tuple"
1397
1359
  }],
1398
- name: "registerPolicy",
1360
+ name: "registerLicenseTerms",
1399
1361
  outputs: [{
1400
1362
  internalType: "uint256",
1401
- name: "policyId",
1363
+ name: "selectedLicenseTermsId",
1402
1364
  type: "uint256"
1403
1365
  }],
1404
1366
  stateMutability: "nonpayable",
@@ -1823,6 +1785,10 @@ var ErrorsABI = [{
1823
1785
  inputs: [],
1824
1786
  name: "IpRoyaltyVault__ClaimerNotAnAncestor",
1825
1787
  type: "error"
1788
+ }, {
1789
+ inputs: [],
1790
+ name: "IpRoyaltyVault__IpTagged",
1791
+ type: "error"
1826
1792
  }, {
1827
1793
  inputs: [],
1828
1794
  name: "IpRoyaltyVault__NotRoyaltyPolicyLAP",
@@ -1831,6 +1797,10 @@ var ErrorsABI = [{
1831
1797
  inputs: [],
1832
1798
  name: "IpRoyaltyVault__SnapshotIntervalTooShort",
1833
1799
  type: "error"
1800
+ }, {
1801
+ inputs: [],
1802
+ name: "IpRoyaltyVault__ZeroDisputeModule",
1803
+ type: "error"
1834
1804
  }, {
1835
1805
  inputs: [],
1836
1806
  name: "IpRoyaltyVault__ZeroIpId",
@@ -1844,36 +1814,260 @@ var ErrorsABI = [{
1844
1814
  name: "LicenseRegistry__CallerNotLicensingModule",
1845
1815
  type: "error"
1846
1816
  }, {
1847
- inputs: [],
1848
- name: "LicenseRegistry__NotTransferable",
1817
+ inputs: [{
1818
+ internalType: "address",
1819
+ name: "childIpId",
1820
+ type: "address"
1821
+ }],
1822
+ name: "LicenseRegistry__DerivativeAlreadyRegistered",
1849
1823
  type: "error"
1850
1824
  }, {
1851
- inputs: [],
1852
- name: "LicenseRegistry__RevokedLicense",
1825
+ inputs: [{
1826
+ internalType: "address",
1827
+ name: "childIpId",
1828
+ type: "address"
1829
+ }],
1830
+ name: "LicenseRegistry__DerivativeIpAlreadyHasLicense",
1853
1831
  type: "error"
1854
1832
  }, {
1855
- inputs: [],
1856
- name: "LicenseRegistry__ZeroDisputeModule",
1833
+ inputs: [{
1834
+ internalType: "address",
1835
+ name: "ipId",
1836
+ type: "address"
1837
+ }],
1838
+ name: "LicenseRegistry__DerivativeIsParent",
1857
1839
  type: "error"
1858
1840
  }, {
1859
- inputs: [],
1860
- name: "LicenseRegistry__ZeroLicensingModule",
1841
+ inputs: [{
1842
+ internalType: "address",
1843
+ name: "ipId",
1844
+ type: "address"
1845
+ }, {
1846
+ internalType: "uint256",
1847
+ name: "index",
1848
+ type: "uint256"
1849
+ }, {
1850
+ internalType: "uint256",
1851
+ name: "length",
1852
+ type: "uint256"
1853
+ }],
1854
+ name: "LicenseRegistry__IndexOutOfBounds",
1861
1855
  type: "error"
1862
1856
  }, {
1863
- inputs: [],
1864
- name: "LicensingModule__CallerNotLicenseRegistry",
1857
+ inputs: [{
1858
+ internalType: "address",
1859
+ name: "ipId",
1860
+ type: "address"
1861
+ }],
1862
+ name: "LicenseRegistry__IpExpired",
1865
1863
  type: "error"
1866
1864
  }, {
1867
- inputs: [],
1868
- name: "LicensingModule__CallerNotLicensorAndPolicyNotSet",
1865
+ inputs: [{
1866
+ internalType: "address",
1867
+ name: "licenseTemplate",
1868
+ type: "address"
1869
+ }, {
1870
+ internalType: "uint256",
1871
+ name: "licenseTermsId",
1872
+ type: "uint256"
1873
+ }],
1874
+ name: "LicenseRegistry__LicenseTermsNotExists",
1869
1875
  type: "error"
1870
1876
  }, {
1871
1877
  inputs: [],
1872
- name: "LicensingModule__CommercialTermInNonCommercialPolicy",
1878
+ name: "LicenseRegistry__NoParentIp",
1873
1879
  type: "error"
1874
1880
  }, {
1875
- inputs: [],
1876
- name: "LicensingModule__DerivativeRevShareSumExceedsMaxRNFTSupply",
1881
+ inputs: [{
1882
+ internalType: "address",
1883
+ name: "licenseTemplate",
1884
+ type: "address"
1885
+ }],
1886
+ name: "LicenseRegistry__NotLicenseTemplate",
1887
+ type: "error"
1888
+ }, {
1889
+ inputs: [],
1890
+ name: "LicenseRegistry__NotTransferable",
1891
+ type: "error"
1892
+ }, {
1893
+ inputs: [{
1894
+ internalType: "address",
1895
+ name: "ipId",
1896
+ type: "address"
1897
+ }],
1898
+ name: "LicenseRegistry__ParentIpExpired",
1899
+ type: "error"
1900
+ }, {
1901
+ inputs: [{
1902
+ internalType: "address",
1903
+ name: "ipId",
1904
+ type: "address"
1905
+ }, {
1906
+ internalType: "uint256",
1907
+ name: "licenseTermsId",
1908
+ type: "uint256"
1909
+ }],
1910
+ name: "LicenseRegistry__ParentIpHasNoLicenseTerms",
1911
+ type: "error"
1912
+ }, {
1913
+ inputs: [{
1914
+ internalType: "address",
1915
+ name: "ipId",
1916
+ type: "address"
1917
+ }],
1918
+ name: "LicenseRegistry__ParentIpTagged",
1919
+ type: "error"
1920
+ }, {
1921
+ inputs: [{
1922
+ internalType: "address",
1923
+ name: "ipId",
1924
+ type: "address"
1925
+ }, {
1926
+ internalType: "address",
1927
+ name: "licenseTemplate",
1928
+ type: "address"
1929
+ }],
1930
+ name: "LicenseRegistry__ParentIpUnmachedLicenseTemplate",
1931
+ type: "error"
1932
+ }, {
1933
+ inputs: [{
1934
+ internalType: "address",
1935
+ name: "licenseTemplate",
1936
+ type: "address"
1937
+ }],
1938
+ name: "LicenseRegistry__UnregisteredLicenseTemplate",
1939
+ type: "error"
1940
+ }, {
1941
+ inputs: [],
1942
+ name: "LicenseRegistry__ZeroDisputeModule",
1943
+ type: "error"
1944
+ }, {
1945
+ inputs: [],
1946
+ name: "LicenseRegistry__ZeroLicensingModule",
1947
+ type: "error"
1948
+ }, {
1949
+ inputs: [{
1950
+ internalType: "address",
1951
+ name: "licenseTemplate",
1952
+ type: "address"
1953
+ }, {
1954
+ internalType: "address",
1955
+ name: "anotherLicenseTemplate",
1956
+ type: "address"
1957
+ }],
1958
+ name: "LicenseToken__AllLicenseTokensMustFromSameLicenseTemplate",
1959
+ type: "error"
1960
+ }, {
1961
+ inputs: [],
1962
+ name: "LicenseToken__CallerNotLicensingModule",
1963
+ type: "error"
1964
+ }, {
1965
+ inputs: [{
1966
+ internalType: "uint256",
1967
+ name: "tokenId",
1968
+ type: "uint256"
1969
+ }, {
1970
+ internalType: "uint256",
1971
+ name: "expiredAt",
1972
+ type: "uint256"
1973
+ }, {
1974
+ internalType: "uint256",
1975
+ name: "currentTimestamp",
1976
+ type: "uint256"
1977
+ }],
1978
+ name: "LicenseToken__LicenseTokenExpired",
1979
+ type: "error"
1980
+ }, {
1981
+ inputs: [{
1982
+ internalType: "uint256",
1983
+ name: "tokenId",
1984
+ type: "uint256"
1985
+ }, {
1986
+ internalType: "address",
1987
+ name: "iPowner",
1988
+ type: "address"
1989
+ }, {
1990
+ internalType: "address",
1991
+ name: "tokenOwner",
1992
+ type: "address"
1993
+ }],
1994
+ name: "LicenseToken__NotLicenseTokenOwner",
1995
+ type: "error"
1996
+ }, {
1997
+ inputs: [],
1998
+ name: "LicenseToken__NotTransferable",
1999
+ type: "error"
2000
+ }, {
2001
+ inputs: [{
2002
+ internalType: "uint256",
2003
+ name: "tokenId",
2004
+ type: "uint256"
2005
+ }],
2006
+ name: "LicenseToken__RevokedLicense",
2007
+ type: "error"
2008
+ }, {
2009
+ inputs: [],
2010
+ name: "LicenseToken__ZeroDisputeModule",
2011
+ type: "error"
2012
+ }, {
2013
+ inputs: [],
2014
+ name: "LicenseToken__ZeroLicensingModule",
2015
+ type: "error"
2016
+ }, {
2017
+ inputs: [],
2018
+ name: "LicensingModule__CallerNotLicenseRegistry",
2019
+ type: "error"
2020
+ }, {
2021
+ inputs: [{
2022
+ internalType: "address",
2023
+ name: "caller",
2024
+ type: "address"
2025
+ }, {
2026
+ internalType: "address",
2027
+ name: "licensorIpId",
2028
+ type: "address"
2029
+ }, {
2030
+ internalType: "address",
2031
+ name: "licenseTemplate",
2032
+ type: "address"
2033
+ }, {
2034
+ internalType: "uint256",
2035
+ name: "licenseTermsId",
2036
+ type: "uint256"
2037
+ }],
2038
+ name: "LicensingModule__CallerNotLicensorAndIpHasNotAttachedLicenseTerms",
2039
+ type: "error"
2040
+ }, {
2041
+ inputs: [],
2042
+ name: "LicensingModule__CallerNotLicensorAndPolicyNotSet",
2043
+ type: "error"
2044
+ }, {
2045
+ inputs: [],
2046
+ name: "LicensingModule__CommercialTermInNonCommercialPolicy",
2047
+ type: "error"
2048
+ }, {
2049
+ inputs: [{
2050
+ internalType: "address",
2051
+ name: "ipId",
2052
+ type: "address"
2053
+ }],
2054
+ name: "LicensingModule__DerivativeAlreadyHasLicenseTerms",
2055
+ type: "error"
2056
+ }, {
2057
+ inputs: [],
2058
+ name: "LicensingModule__DerivativeAlreadyRegistered",
2059
+ type: "error"
2060
+ }, {
2061
+ inputs: [],
2062
+ name: "LicensingModule__DerivativeIsParent",
2063
+ type: "error"
2064
+ }, {
2065
+ inputs: [],
2066
+ name: "LicensingModule__DerivativeRevShareSumExceedsMaxRNFTSupply",
2067
+ type: "error"
2068
+ }, {
2069
+ inputs: [],
2070
+ name: "LicensingModule__DerivativesCannotAddLicenseTerms",
1877
2071
  type: "error"
1878
2072
  }, {
1879
2073
  inputs: [],
@@ -1897,11 +2091,19 @@ var ErrorsABI = [{
1897
2091
  type: "error"
1898
2092
  }, {
1899
2093
  inputs: [],
1900
- name: "LicensingModule__IncompatibleLicensorCommercialPolicy",
2094
+ name: "LicensingModule__IncompatibleLicensorRoyaltyDerivativeRevShare",
1901
2095
  type: "error"
1902
2096
  }, {
1903
- inputs: [],
1904
- name: "LicensingModule__IncompatibleLicensorRoyaltyDerivativeRevShare",
2097
+ inputs: [{
2098
+ internalType: "address",
2099
+ name: "royaltyPolicy",
2100
+ type: "address"
2101
+ }, {
2102
+ internalType: "address",
2103
+ name: "anotherRoyaltyPolicy",
2104
+ type: "address"
2105
+ }],
2106
+ name: "LicensingModule__IncompatibleRoyaltyPolicy",
1905
2107
  type: "error"
1906
2108
  }, {
1907
2109
  inputs: [],
@@ -1923,6 +2125,50 @@ var ErrorsABI = [{
1923
2125
  inputs: [],
1924
2126
  name: "LicensingModule__IpAlreadyLinked",
1925
2127
  type: "error"
2128
+ }, {
2129
+ inputs: [{
2130
+ internalType: "address",
2131
+ name: "childIpId",
2132
+ type: "address"
2133
+ }],
2134
+ name: "LicensingModule__LicenseNotCompatibleForDerivative",
2135
+ type: "error"
2136
+ }, {
2137
+ inputs: [{
2138
+ internalType: "uint256",
2139
+ name: "ipLength",
2140
+ type: "uint256"
2141
+ }, {
2142
+ internalType: "uint256",
2143
+ name: "licenseTermsLength",
2144
+ type: "uint256"
2145
+ }],
2146
+ name: "LicensingModule__LicenseTermsLengthMismatch",
2147
+ type: "error"
2148
+ }, {
2149
+ inputs: [{
2150
+ internalType: "address",
2151
+ name: "licenseTemplate",
2152
+ type: "address"
2153
+ }, {
2154
+ internalType: "uint256",
2155
+ name: "licenseTermsId",
2156
+ type: "uint256"
2157
+ }],
2158
+ name: "LicensingModule__LicenseTermsNotFound",
2159
+ type: "error"
2160
+ }, {
2161
+ inputs: [{
2162
+ internalType: "address",
2163
+ name: "childIpId",
2164
+ type: "address"
2165
+ }, {
2166
+ internalType: "uint256[]",
2167
+ name: "licenseTokenIds",
2168
+ type: "uint256[]"
2169
+ }],
2170
+ name: "LicensingModule__LicenseTokenNotCompatibleForDerivative",
2171
+ type: "error"
1926
2172
  }, {
1927
2173
  inputs: [],
1928
2174
  name: "LicensingModule__LicensorDoesntHaveThisPolicy",
@@ -1955,6 +2201,14 @@ var ErrorsABI = [{
1955
2201
  inputs: [],
1956
2202
  name: "LicensingModule__MismatchBetweenRoyaltyPolicy",
1957
2203
  type: "error"
2204
+ }, {
2205
+ inputs: [],
2206
+ name: "LicensingModule__NoLicenseToken",
2207
+ type: "error"
2208
+ }, {
2209
+ inputs: [],
2210
+ name: "LicensingModule__NoParentIp",
2211
+ type: "error"
1958
2212
  }, {
1959
2213
  inputs: [],
1960
2214
  name: "LicensingModule__NotLicensee",
@@ -1971,6 +2225,14 @@ var ErrorsABI = [{
1971
2225
  inputs: [],
1972
2226
  name: "LicensingModule__ParentIdEqualThanChild",
1973
2227
  type: "error"
2228
+ }, {
2229
+ inputs: [{
2230
+ internalType: "address",
2231
+ name: "ipId",
2232
+ type: "address"
2233
+ }],
2234
+ name: "LicensingModule__ParentIpHasNoLicenseTerms",
2235
+ type: "error"
1974
2236
  }, {
1975
2237
  inputs: [],
1976
2238
  name: "LicensingModule__PolicyAlreadySetForIpId",
@@ -1979,6 +2241,14 @@ var ErrorsABI = [{
1979
2241
  inputs: [],
1980
2242
  name: "LicensingModule__PolicyNotFound",
1981
2243
  type: "error"
2244
+ }, {
2245
+ inputs: [{
2246
+ internalType: "address",
2247
+ name: "receiver",
2248
+ type: "address"
2249
+ }],
2250
+ name: "LicensingModule__ReceiverCheckFailed",
2251
+ type: "error"
1982
2252
  }, {
1983
2253
  inputs: [],
1984
2254
  name: "LicensingModule__ReceiverZeroAddress",
@@ -2119,6 +2389,10 @@ var ErrorsABI = [{
2119
2389
  inputs: [],
2120
2390
  name: "RoyaltyModule__IncompatibleRoyaltyPolicy",
2121
2391
  type: "error"
2392
+ }, {
2393
+ inputs: [],
2394
+ name: "RoyaltyModule__IpIsTagged",
2395
+ type: "error"
2122
2396
  }, {
2123
2397
  inputs: [],
2124
2398
  name: "RoyaltyModule__NoParentsOnLinking",
@@ -2139,6 +2413,10 @@ var ErrorsABI = [{
2139
2413
  inputs: [],
2140
2414
  name: "RoyaltyModule__NotWhitelistedRoyaltyToken",
2141
2415
  type: "error"
2416
+ }, {
2417
+ inputs: [],
2418
+ name: "RoyaltyModule__ZeroDisputeModule",
2419
+ type: "error"
2142
2420
  }, {
2143
2421
  inputs: [],
2144
2422
  name: "RoyaltyModule__ZeroLicensingModule",
@@ -2231,32 +2509,35 @@ var sepolia = {
2231
2509
  MockERC721: "0x16d50f333B264b153B7BF1DD9fe65A2707B3281b",
2232
2510
  MockTokenGatedHook: "0x28C32a4B5B3E186d7f658C051d3Bb4a95243209a",
2233
2511
  ModuleRegistry: "0x5Aac3177F496F503Ac724A0D0A697f6ba9dA2C27",
2234
- PILPolicyFrameworkManager: "0xeAABf2b80B7e069EE449B5629590A1cc0F9bC9C2",
2512
+ PILicenseTemplate: "0xeAABf2b80B7e069EE449B5629590A1cc0F9bC9C2",
2235
2513
  RegistrationModule: "0x613128e88b568768764824f898C8135efED97fA6",
2236
2514
  RoyaltyModule: "0xA6bEf9CC650A16939566c1da5d5088f3F028a865",
2237
2515
  RoyaltyPolicyLAP: "0x16eF58e959522727588921A92e9084d36E5d3855",
2238
2516
  TokenWithdrawalModule: "0x66738a5722e9Cd91B694bA39146CFEcE95457F04"
2239
2517
  };
2240
2518
  var storyTestnet = {
2241
- AccessController: "0x6fB5BA9A8747E897109044a1cd1192898AA384a9",
2242
- ArbitrationPolicySP: "0x114aE96d362b802Ed92758A21992e429e9E83565",
2243
- DisputeModule: "0x837d095F9A11178545DF4114C44fb526dcf74168",
2244
- Governance: "0x0Fee5B61cF0976f3F59138146a9180a107738db9",
2245
- IPAccountImpl: "0x6d1398e1ceE174a3e41d6eB50F00Fe43132f9C8A",
2246
- IPAccountRegistry: "0x0CCc0CD388477ED0D7531d2aD6e68c9E24B8392d",
2247
- IPAssetRegistry: "0x30C89bCB41277f09b18DF0375b9438909e193bf0",
2248
- IpRoyaltyVaultBeacon: "0x8C7664Befc382A282F8aA821A2d337960e410E77",
2249
- IpRoyaltyVaultImpl: "0x0dB6AAb7525F03Bf94A1fC08A9aACCc2Ad25eD12",
2250
- LicenseRegistry: "0x790717fBa06Aa219Fc3A502ce360d8dEAF273Eb5",
2251
- LicensingModule: "0xB7a83a5f3C8b512A6DfE294ad4811F1b4AA10E96",
2252
- MockERC20: "0xCc97e835157daf88820cbDE105ADFF5d7981A382",
2253
- MockERC721: "0x7c0004C6D352bC0a0531AaD46d33A03D9d51ab1D",
2254
- MockTokenGatedHook: "0xD3Aa4F5B77509907FF3d7a90cEadE19bab2b6Fdb",
2255
- ModuleRegistry: "0xab0bf9846eCE1299AaA1cB3FF5EfbBA328968771",
2256
- PILPolicyFrameworkManager: "0x251bce81DF5957123869E43269C4E29308A062c4",
2257
- RoyaltyModule: "0xF77b0933F6aaC2dCE2eAa0d79f6Bfd6b9347a5E7",
2258
- RoyaltyPolicyLAP: "0x31f263D48df5FA5956E2Ba614b150e2A0fE1aDd3",
2259
- TokenWithdrawalModule: "0x446B734C3Fc13c53b4E32FEFCaaED97e0100552D"
2519
+ AccessController: "0x7e253Df9b0fC872746877Fa362b2cAf32712d770",
2520
+ ArbitrationPolicySP: "0xA25bc70932282b35407e0DC08cc9C91f6b00CEf0",
2521
+ CoreMetadataModule: "0x8A8FBAaEB6A0B7736ebde31c6F49CccD808232bA",
2522
+ CoreMetadataViewModule: "0x8A8FBAaEB6A0B7736ebde31c6F49CccD808232bA",
2523
+ DisputeModule: "0x6d54456Ae5DCbDC0C9E2713cC8E650fE4f445c7C",
2524
+ Governance: "0x63F4A670A8b518ef5eb291559BdAbea4b31c1AC4",
2525
+ IPAccountImpl: "0x38cAfD16502B1d61c6399A18d6Fa1Ea8CEca3678",
2526
+ IPAccountRegistry: "0x8448d0F77D7e67e0814f83D988aB3344D46bb1E4",
2527
+ IPAssetRegistry: "0x862de97662a1231FFc14038eC1BE93aB129D2169",
2528
+ IpRoyaltyVaultBeacon: "0xE92Cdf428f07D92248b6b15ce59a9d5597428F21",
2529
+ IpRoyaltyVaultImpl: "0x8Be22cc2D13ADF496a417D9C616dA4a253c68Af8",
2530
+ LicenseRegistry: "0x0c3D467537FAd845a78728CEdc3D9447338c5422",
2531
+ LicenseToken: "0xD40b7bCA204f96a346021e31c9ad54FF495226e7",
2532
+ LicensingModule: "0xEeDDE5529122b621105798860F235c28FD3aBA40",
2533
+ MockERC20: "0xA36F2A4A02f5C215d1b3630f71A4Ff55B5492AAE",
2534
+ MockERC721: "0x83DD606d14CcEb629dE9Bf8Aad7aE63767dB476f",
2535
+ MockTokenGatedHook: "0x80519d82FBE474AB9E863A066AC32E3eeAFc8F11",
2536
+ ModuleRegistry: "0xf2965E3B6251905Dd1E8671077760D07b0408cf2",
2537
+ PILicenseTemplate: "0xd0Be223ae9719bBD93447ecf5289319CCf8cA227",
2538
+ RoyaltyModule: "0x551AD8CD7893003cE00500aC2aCF1E327763D9f6",
2539
+ RoyaltyPolicyLAP: "0x2EcdB5bD12a037dCb9De0Ab7957f35FEeF758eA6",
2540
+ TokenWithdrawalModule: "0xC573E5c36B8FA5108b78f7357947972D030699d5"
2260
2541
  };
2261
2542
  var contractAddress = {
2262
2543
  sepolia: sepolia,
@@ -2296,12 +2577,6 @@ var getLicensingModuleConfig = function getLicensingModuleConfig(chain) {
2296
2577
  address: viem.getAddress(contractAddress[chain].LicensingModule)
2297
2578
  };
2298
2579
  };
2299
- var getPILPolicyFrameworkManagerConfig = function getPILPolicyFrameworkManagerConfig(chain) {
2300
- return {
2301
- abi: [].concat(_toConsumableArray(PILPolicyFrameworkManagerABI), _toConsumableArray(ErrorsABI)),
2302
- address: viem.getAddress(contractAddress[chain].PILPolicyFrameworkManager)
2303
- };
2304
- };
2305
2580
  var getRoyaltyPolicyLAPConfig = function getRoyaltyPolicyLAPConfig(chain) {
2306
2581
  return {
2307
2582
  abi: [].concat(_toConsumableArray(IRoyaltyPolicyLAPABI), _toConsumableArray(ErrorsABI)),
@@ -2320,6 +2595,12 @@ var getRoyaltyModuleConfig = function getRoyaltyModuleConfig(chain) {
2320
2595
  address: viem.getAddress(contractAddress[chain].RoyaltyModule)
2321
2596
  };
2322
2597
  };
2598
+ var getLicenseTemplateConfig = function getLicenseTemplateConfig(chain) {
2599
+ return {
2600
+ abi: [].concat(_toConsumableArray(PILicenseTemplateABI), _toConsumableArray(ErrorsABI)),
2601
+ address: viem.getAddress(contractAddress[chain].PILicenseTemplate)
2602
+ };
2603
+ };
2323
2604
 
2324
2605
  function handleError(error, msg) {
2325
2606
  if (error instanceof Error) {
@@ -2497,560 +2778,178 @@ var PermissionClient = /*#__PURE__*/function () {
2497
2778
  _context.next = 4;
2498
2779
  return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, IPAccountConfig), {}, {
2499
2780
  functionName: "execute",
2500
- args: [this.accessControllerConfig.address, parseToBigInt(0), viem.encodeFunctionData({
2501
- abi: this.accessControllerConfig.abi,
2502
- functionName: "setPermission",
2503
- args: [viem.getAddress(request.ipId),
2504
- // 0x Address
2505
- viem.getAddress(request.signer),
2506
- // 0x Address
2507
- viem.getAddress(request.to),
2508
- // 0x Address
2509
- request.func || "0x00000000",
2510
- // bytes4
2511
- request.permission // uint8
2512
- ]
2513
- })],
2514
- account: this.wallet.account
2515
- }));
2516
- case 4:
2517
- _yield$this$rpcClient = _context.sent;
2518
- call = _yield$this$rpcClient.request;
2519
- _context.next = 8;
2520
- return this.wallet.writeContract(call);
2521
- case 8:
2522
- txHash = _context.sent;
2523
- if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
2524
- _context.next = 15;
2525
- break;
2526
- }
2527
- _context.next = 12;
2528
- return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.accessControllerConfig), {}, {
2529
- eventName: "PermissionSet"
2530
- }));
2531
- case 12:
2532
- return _context.abrupt("return", {
2533
- txHash: txHash,
2534
- success: true
2535
- });
2536
- case 15:
2537
- return _context.abrupt("return", {
2538
- txHash: txHash
2539
- });
2540
- case 16:
2541
- _context.next = 21;
2542
- break;
2543
- case 18:
2544
- _context.prev = 18;
2545
- _context.t0 = _context["catch"](0);
2546
- handleError(_context.t0, "Failed to set permissions");
2547
- case 21:
2548
- case "end":
2549
- return _context.stop();
2550
- }
2551
- }, _callee, this, [[0, 18]]);
2552
- }));
2553
- function setPermission(_x) {
2554
- return _setPermission.apply(this, arguments);
2555
- }
2556
- return setPermission;
2557
- }())
2558
- }]);
2559
- }();
2560
-
2561
- function computeRoyaltyContext(_x, _x2) {
2562
- return _computeRoyaltyContext.apply(this, arguments);
2563
- }
2564
- function _computeRoyaltyContext() {
2565
- _computeRoyaltyContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(licenseIds, storyClient) {
2566
- var royaltyContext, i, licenseData, royaltyPolicy, policy, targetRoyaltyAmount;
2567
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2568
- while (1) switch (_context.prev = _context.next) {
2569
- case 0:
2570
- royaltyContext = {
2571
- targetAncestors: [],
2572
- targetRoyaltyAmount: [],
2573
- parentAncestors1: [],
2574
- parentAncestors2: [],
2575
- parentAncestorsRoyalties1: [],
2576
- parentAncestorsRoyalties2: []
2577
- };
2578
- i = 0;
2579
- case 2:
2580
- if (!(i < licenseIds.length)) {
2581
- _context.next = 16;
2582
- break;
2583
- }
2584
- _context.next = 5;
2585
- return storyClient.getLicense(licenseIds[i]);
2586
- case 5:
2587
- licenseData = _context.sent;
2588
- _context.next = 8;
2589
- return storyClient.getRoyaltyPolicy(licenseData.licensorIpId);
2590
- case 8:
2591
- royaltyPolicy = _context.sent;
2592
- _context.next = 11;
2593
- return storyClient.getPolicy(licenseData.policyId);
2594
- case 11:
2595
- policy = _context.sent;
2596
- if (royaltyPolicy) {
2597
- targetRoyaltyAmount = royaltyPolicy.targetRoyaltyAmount.map(function (e) {
2598
- return parseInt(e);
2599
- });
2600
- if (i === 0) {
2601
- royaltyContext.parentAncestors1 = royaltyPolicy.targetAncestors;
2602
- royaltyContext.parentAncestorsRoyalties1 = targetRoyaltyAmount;
2603
- } else {
2604
- royaltyContext.parentAncestors2 = royaltyPolicy.targetAncestors;
2605
- royaltyContext.parentAncestorsRoyalties2 = targetRoyaltyAmount;
2606
- }
2607
- updateRoyaltyContext(royaltyContext, [licenseData.licensorIpId], [parseInt(policy.pil.commercialRevShare)]);
2608
- updateRoyaltyContext(royaltyContext, royaltyPolicy.targetAncestors, targetRoyaltyAmount);
2609
- }
2610
- case 13:
2611
- i++;
2612
- _context.next = 2;
2613
- break;
2614
- case 16:
2615
- return _context.abrupt("return", royaltyContext);
2616
- case 17:
2617
- case "end":
2618
- return _context.stop();
2619
- }
2620
- }, _callee);
2621
- }));
2622
- return _computeRoyaltyContext.apply(this, arguments);
2623
- }
2624
- function encodeRoyaltyContext(royaltyContext) {
2625
- return typedDataToBytes({
2626
- "interface": "(address[], uint32[], address[], address[], uint32[], uint32[])",
2627
- data: [[royaltyContext.targetAncestors, royaltyContext.targetRoyaltyAmount, royaltyContext.parentAncestors1, royaltyContext.parentAncestors2, royaltyContext.parentAncestorsRoyalties1, royaltyContext.parentAncestorsRoyalties2]]
2628
- });
2629
- }
2630
- function updateRoyaltyContext(royaltyContext, targetAncestors, targetRoyaltyAccounts) {
2631
- for (var i = 0; i < targetAncestors.length; i++) {
2632
- var index = royaltyContext.targetAncestors.indexOf(targetAncestors[i]);
2633
- if (index === -1) {
2634
- royaltyContext.targetAncestors.push(targetAncestors[i]);
2635
- royaltyContext.targetRoyaltyAmount.push(targetRoyaltyAccounts[i]);
2636
- } else {
2637
- royaltyContext.targetRoyaltyAmount[index] += targetRoyaltyAccounts[i];
2638
- }
2639
- }
2640
- }
2641
-
2642
- var LicenseClient = /*#__PURE__*/function () {
2643
- function LicenseClient(rpcClient, wallet, storyClient, chainId) {
2644
- _classCallCheck(this, LicenseClient);
2645
- _defineProperty(this, "ipAccountABI", IPAccountABI);
2646
- this.wallet = wallet;
2647
- this.rpcClient = rpcClient;
2648
- this.storyClient = storyClient;
2649
- this.licenseRegistryConfig = getLicenseRegistryConfig(chainId);
2650
- this.licensingModuleConfig = getLicensingModuleConfig(chainId);
2651
- }
2652
-
2653
- /**
2654
- * Mints license NFTs representing a policy granted by a set of ipIds (licensors). This NFT needs to be
2655
- * burned in order to link a derivative IP with its parents. If this is the first combination of policy and
2656
- * licensors, a new licenseId will be created. If not, the license is fungible and an id will be reused.
2657
- * @dev Only callable by the licensing module.
2658
- * @param request The request object containing necessary data to mint a license.
2659
- * @param request.policyId The ID of the policy to be minted
2660
- * @param request.licensorIpId_ The ID of the IP granting the license (ie. licensor)
2661
- * @param request.mintAmount Number of licenses to mint. License NFT is fungible for same policy and same licensors
2662
- * @param request.receiver Receiver address of the minted license NFT(s).
2663
- * @returns licenseId The ID of the minted license NFT(s).
2664
- */
2665
- return _createClass(LicenseClient, [{
2666
- key: "mintLicense",
2667
- value: (function () {
2668
- var _mintLicense = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2669
- var _request$txOptions, royaltyContext, royaltyPolicy, _royaltyContext$targe, _royaltyContext$targe2, targetRoyaltyAmount, _yield$this$rpcClient, call, txHash, targetLogs;
2670
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2671
- while (1) switch (_context.prev = _context.next) {
2672
- case 0:
2673
- _context.prev = 0;
2674
- royaltyContext = {
2675
- targetAncestors: [],
2676
- targetRoyaltyAmount: [],
2677
- parentAncestors1: [],
2678
- parentAncestors2: [],
2679
- parentAncestorsRoyalties1: [],
2680
- parentAncestorsRoyalties2: []
2681
- };
2682
- _context.next = 4;
2683
- return this.storyClient.getRoyaltyPolicy(request.licensorIpId);
2684
- case 4:
2685
- royaltyPolicy = _context.sent;
2686
- if (royaltyPolicy) {
2687
- (_royaltyContext$targe = royaltyContext.targetAncestors).push.apply(_royaltyContext$targe, _toConsumableArray(royaltyPolicy.targetAncestors));
2688
- targetRoyaltyAmount = royaltyPolicy.targetRoyaltyAmount.map(function (e) {
2689
- return parseInt(e);
2690
- });
2691
- (_royaltyContext$targe2 = royaltyContext.targetRoyaltyAmount).push.apply(_royaltyContext$targe2, _toConsumableArray(targetRoyaltyAmount));
2692
- }
2693
- _context.next = 8;
2694
- return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.licensingModuleConfig), {}, {
2695
- functionName: "mintLicense",
2696
- args: [parseToBigInt(request.policyId), request.licensorIpId, parseToBigInt(request.mintAmount), viem.getAddress(request.receiverAddress), encodeRoyaltyContext(royaltyContext)],
2697
- account: this.wallet.account
2698
- }));
2699
- case 8:
2700
- _yield$this$rpcClient = _context.sent;
2701
- call = _yield$this$rpcClient.request;
2702
- _context.next = 12;
2703
- return this.wallet.writeContract(call);
2704
- case 12:
2705
- txHash = _context.sent;
2706
- if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
2707
- _context.next = 20;
2708
- break;
2709
- }
2710
- _context.next = 16;
2711
- return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licenseRegistryConfig), {}, {
2712
- eventName: "TransferSingle",
2713
- from: this.licenseRegistryConfig.address
2714
- }));
2715
- case 16:
2716
- targetLogs = _context.sent;
2717
- return _context.abrupt("return", {
2718
- txHash: txHash,
2719
- licenseId: targetLogs[0].args.id.toString()
2720
- });
2721
- case 20:
2722
- return _context.abrupt("return", {
2723
- txHash: txHash
2724
- });
2725
- case 21:
2726
- _context.next = 26;
2727
- break;
2728
- case 23:
2729
- _context.prev = 23;
2730
- _context.t0 = _context["catch"](0);
2731
- handleError(_context.t0, "Failed to mint license");
2732
- case 26:
2733
- case "end":
2734
- return _context.stop();
2735
- }
2736
- }, _callee, this, [[0, 23]]);
2737
- }));
2738
- function mintLicense(_x) {
2739
- return _mintLicense.apply(this, arguments);
2740
- }
2741
- return mintLicense;
2742
- }())
2743
- }, {
2744
- key: "linkIpToParent",
2745
- value: function () {
2746
- var _linkIpToParent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
2747
- var _request$txOptions2, IPAccountConfig, licenseIds, royaltyContext, _yield$this$rpcClient2, call, txHash;
2748
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2749
- while (1) switch (_context2.prev = _context2.next) {
2750
- case 0:
2751
- _context2.prev = 0;
2752
- IPAccountConfig = {
2753
- abi: this.ipAccountABI,
2754
- address: viem.getAddress(request.childIpId)
2755
- };
2756
- licenseIds = [];
2757
- request.licenseIds.forEach(function (licenseId) {
2758
- licenseIds.push(parseToBigInt(licenseId));
2759
- });
2760
- _context2.next = 6;
2761
- return computeRoyaltyContext(request.licenseIds, this.storyClient);
2762
- case 6:
2763
- royaltyContext = _context2.sent;
2764
- _context2.next = 9;
2765
- return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, IPAccountConfig), {}, {
2766
- functionName: "execute",
2767
- args: [this.licensingModuleConfig.address, parseToBigInt(0), viem.encodeFunctionData({
2768
- abi: this.licensingModuleConfig.abi,
2769
- functionName: "linkIpToParents",
2770
- args: [licenseIds, viem.getAddress(request.childIpId), encodeRoyaltyContext(royaltyContext)]
2781
+ args: [this.accessControllerConfig.address, parseToBigInt(0), viem.encodeFunctionData({
2782
+ abi: this.accessControllerConfig.abi,
2783
+ functionName: "setPermission",
2784
+ args: [viem.getAddress(request.ipId),
2785
+ // 0x Address
2786
+ viem.getAddress(request.signer),
2787
+ // 0x Address
2788
+ viem.getAddress(request.to),
2789
+ // 0x Address
2790
+ request.func || "0x00000000",
2791
+ // bytes4
2792
+ request.permission // uint8
2793
+ ]
2771
2794
  })],
2772
2795
  account: this.wallet.account
2773
2796
  }));
2774
- case 9:
2775
- _yield$this$rpcClient2 = _context2.sent;
2776
- call = _yield$this$rpcClient2.request;
2777
- _context2.next = 13;
2797
+ case 4:
2798
+ _yield$this$rpcClient = _context.sent;
2799
+ call = _yield$this$rpcClient.request;
2800
+ _context.next = 8;
2778
2801
  return this.wallet.writeContract(call);
2779
- case 13:
2780
- txHash = _context2.sent;
2781
- if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
2782
- _context2.next = 20;
2802
+ case 8:
2803
+ txHash = _context.sent;
2804
+ if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
2805
+ _context.next = 15;
2783
2806
  break;
2784
2807
  }
2785
- _context2.next = 17;
2786
- return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licenseRegistryConfig), {}, {
2787
- eventName: "TransferBatch"
2808
+ _context.next = 12;
2809
+ return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.accessControllerConfig), {}, {
2810
+ eventName: "PermissionSet"
2788
2811
  }));
2789
- case 17:
2790
- return _context2.abrupt("return", {
2812
+ case 12:
2813
+ return _context.abrupt("return", {
2791
2814
  txHash: txHash,
2792
2815
  success: true
2793
2816
  });
2794
- case 20:
2795
- return _context2.abrupt("return", {
2817
+ case 15:
2818
+ return _context.abrupt("return", {
2796
2819
  txHash: txHash
2797
2820
  });
2798
- case 21:
2799
- _context2.next = 26;
2821
+ case 16:
2822
+ _context.next = 21;
2800
2823
  break;
2801
- case 23:
2802
- _context2.prev = 23;
2803
- _context2.t0 = _context2["catch"](0);
2804
- handleError(_context2.t0, "Failed to link IP to parents");
2805
- case 26:
2824
+ case 18:
2825
+ _context.prev = 18;
2826
+ _context.t0 = _context["catch"](0);
2827
+ handleError(_context.t0, "Failed to set permissions");
2828
+ case 21:
2806
2829
  case "end":
2807
- return _context2.stop();
2830
+ return _context.stop();
2808
2831
  }
2809
- }, _callee2, this, [[0, 23]]);
2832
+ }, _callee, this, [[0, 18]]);
2810
2833
  }));
2811
- function linkIpToParent(_x2) {
2812
- return _linkIpToParent.apply(this, arguments);
2834
+ function setPermission(_x) {
2835
+ return _setPermission.apply(this, arguments);
2813
2836
  }
2814
- return linkIpToParent;
2815
- }()
2837
+ return setPermission;
2838
+ }())
2816
2839
  }]);
2817
2840
  }();
2818
2841
 
2819
- var PolicyClient = /*#__PURE__*/function () {
2820
- function PolicyClient(rpcClient, wallet, chainId) {
2821
- _classCallCheck(this, PolicyClient);
2842
+ var LicenseClient = /*#__PURE__*/function () {
2843
+ function LicenseClient(rpcClient, wallet, storyClient, chainId) {
2844
+ _classCallCheck(this, LicenseClient);
2822
2845
  _defineProperty(this, "ipAccountABI", IPAccountABI);
2823
2846
  this.wallet = wallet;
2824
2847
  this.rpcClient = rpcClient;
2848
+ this.storyClient = storyClient;
2849
+ this.licenseRegistryConfig = getLicenseRegistryConfig(chainId);
2825
2850
  this.licensingModuleConfig = getLicensingModuleConfig(chainId);
2826
- this.pilPolicyFrameworkManagerConfig = getPILPolicyFrameworkManagerConfig(chainId);
2851
+ this.licenseTemplateConfig = getLicenseTemplateConfig(chainId);
2827
2852
  this.royaltyPolicyLAPConfig = getRoyaltyPolicyLAPConfig(chainId);
2828
2853
  }
2829
-
2830
- /**
2831
- * Registers a PIL policy to the registry
2832
- * Internally, this function must generate a Licensing.Policy struct and call registerPolicy.
2833
- * @param request - the licensing parameters for the Programmable IP License v1 (PIL) standard.
2834
- * @param request.transferable Whether or not the license is transferable
2835
- * @param request.attribution Whether or not attribution is required when reproducing the work
2836
- * @param request.commercialUse Whether or not the work can be used commercially
2837
- * @param request.commercialAttribution Whether or not attribution is required when reproducing the work commercially
2838
- * @param request.commercializerChecker commericializers that are allowed to commercially exploit the work. If zero address, then no restrictions is enforced.
2839
- * @param request.commercialRevShare Percentage of revenue that must be shared with the licensor
2840
- * @param request.derivativesAllowed Whether or not the licensee can create derivatives of his work
2841
- * @param request.derivativesAttribution Whether or not attribution is required for derivatives of the work
2842
- * @param request.derivativesApproval Whether or not the licensor must approve derivatives of the work before they can be linked to the licensor IP ID
2843
- * @param request.derivativesReciprocal Whether or not the licensee must license derivatives of the work under the same terms.
2844
- * @param request.territories List of territories where the license is valid. If empty, global.
2845
- * @param request.distributionChannels List of distribution channels where the license is valid. Empty if no restrictions.
2846
- * @param request.royaltyPolicy Address of a royalty policy contract (e.g. RoyaltyPolicyLS) that will handle royalty payments
2847
- * @returns the transaction hash and the policy ID if the txOptions.waitForTransaction is set to true
2848
- */
2849
- return _createClass(PolicyClient, [{
2850
- key: "registerPILPolicy",
2851
- value: (function () {
2852
- var _registerPILPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2853
- var _request$txOptions, frameworkData, policyId, _yield$this$rpcClient, call, txHash, targetLogs;
2854
+ return _createClass(LicenseClient, [{
2855
+ key: "getLicenseTermsId",
2856
+ value: function () {
2857
+ var _getLicenseTermsId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2858
+ var selectedLicenseTermsId;
2854
2859
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2855
2860
  while (1) switch (_context.prev = _context.next) {
2856
2861
  case 0:
2857
- _context.prev = 0;
2858
- // First check if the policy exists
2859
- frameworkData = {
2860
- attribution: request.attribution || false,
2861
- commercialUse: request.commercialUse || false,
2862
- commercialAttribution: request.commercialAttribution || false,
2863
- commercializerChecker: request.commercializerChecker || viem.zeroAddress,
2864
- commercializerCheckerData: request.commercializerCheckerData || "0x",
2865
- commercialRevShare: request.commercialRevShare || 0,
2866
- derivativesAllowed: request.derivativesAllowed || false,
2867
- derivativesAttribution: request.derivativesAttribution || false,
2868
- derivativesApproval: request.derivativesApproval || false,
2869
- derivativesReciprocal: request.derivativesReciprocal || false,
2870
- territories: request.territories || [],
2871
- distributionChannels: request.distributionChannels || [],
2872
- contentRestrictions: request.contentRestrictions || []
2873
- };
2874
- _context.next = 4;
2875
- return this.getPolicyId(request.transferable, this.encodeFrameworkData(frameworkData), typedDataToBytes({
2876
- "interface": "uint32",
2877
- data: [request.commercialRevShare || 0]
2878
- }), request.mintingFee || "0", request.mintingFeeToken || viem.zeroAddress, request.royaltyPolicy || viem.zeroAddress);
2879
- case 4:
2880
- policyId = _context.sent;
2881
- if (!(policyId !== 0)) {
2882
- _context.next = 7;
2883
- break;
2884
- }
2885
- return _context.abrupt("return", {
2886
- policyId: policyId.toString()
2887
- });
2888
- case 7:
2889
- _context.next = 9;
2890
- return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.pilPolicyFrameworkManagerConfig), {}, {
2891
- functionName: "registerPolicy",
2892
- args: [{
2893
- transferable: request.transferable,
2894
- royaltyPolicy: request.royaltyPolicy || viem.zeroAddress,
2895
- mintingFee: parseToBigInt(request.mintingFee || "0"),
2896
- mintingFeeToken: request.mintingFeeToken || viem.zeroAddress,
2897
- policy: {
2898
- attribution: request.attribution || false,
2899
- commercialUse: request.commercialUse || false,
2900
- commercialAttribution: request.commercialAttribution || false,
2901
- commercialRevShare: request.commercialRevShare || 0,
2902
- derivativesAllowed: request.derivativesAllowed || false,
2903
- derivativesAttribution: request.derivativesAttribution || false,
2904
- derivativesApproval: request.derivativesApproval || false,
2905
- derivativesReciprocal: request.derivativesReciprocal || false,
2906
- commercializerChecker: request.commercializerChecker || viem.zeroAddress,
2907
- commercializerCheckerData: request.commercializerCheckerData || "0x",
2908
- territories: request.territories || [],
2909
- distributionChannels: request.distributionChannels || [],
2910
- contentRestrictions: request.contentRestrictions || []
2911
- }
2912
- }],
2913
- account: this.wallet.account
2914
- }));
2915
- case 9:
2916
- _yield$this$rpcClient = _context.sent;
2917
- call = _yield$this$rpcClient.request;
2918
- _context.next = 13;
2919
- return this.wallet.writeContract(call);
2920
- case 13:
2921
- txHash = _context.sent;
2922
- if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
2923
- _context.next = 21;
2924
- break;
2925
- }
2926
- _context.next = 17;
2927
- return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licensingModuleConfig), {}, {
2928
- eventName: "PolicyRegistered"
2862
+ _context.next = 2;
2863
+ return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.licenseTemplateConfig), {}, {
2864
+ functionName: "getLicenseTermsId",
2865
+ args: [request]
2929
2866
  }));
2930
- case 17:
2931
- targetLogs = _context.sent;
2932
- return _context.abrupt("return", {
2933
- txHash: txHash,
2934
- policyId: targetLogs[0].args.policyId.toString()
2935
- });
2936
- case 21:
2937
- return _context.abrupt("return", {
2938
- txHash: txHash
2939
- });
2940
- case 22:
2941
- _context.next = 27;
2942
- break;
2943
- case 24:
2944
- _context.prev = 24;
2945
- _context.t0 = _context["catch"](0);
2946
- handleError(_context.t0, "Failed to register policy");
2947
- case 27:
2867
+ case 2:
2868
+ selectedLicenseTermsId = _context.sent;
2869
+ return _context.abrupt("return", Number(selectedLicenseTermsId));
2870
+ case 4:
2948
2871
  case "end":
2949
2872
  return _context.stop();
2950
2873
  }
2951
- }, _callee, this, [[0, 24]]);
2874
+ }, _callee, this);
2952
2875
  }));
2953
- function registerPILPolicy(_x) {
2954
- return _registerPILPolicy.apply(this, arguments);
2876
+ function getLicenseTermsId(_x) {
2877
+ return _getLicenseTermsId.apply(this, arguments);
2955
2878
  }
2956
- return registerPILPolicy;
2879
+ return getLicenseTermsId;
2957
2880
  }()
2958
2881
  /**
2959
- * Convenient function to register a PIL social remix policy to the registry
2960
- * Internally, this function must generate a Licensing.Policy struct and call registerPolicy.
2961
- * @param request - the licensing parameters for the Programmable IP License v1 (PIL) standard.
2962
- * @param request.territories List of territories where the license is valid. If empty, global.
2963
- * @param request.distributionChannels List of distribution channels where the license is valid. Empty if no restrictions.
2964
- * @param request.contentRestrictions List of content restrictions where the license is valid. Empty if no restrictions.
2965
- * @returns the transaction hash and the policy ID if the txOptions.waitForTransaction is set to true
2882
+ * Convenient function to register a PIL non commercial social remix license to the registry
2883
+ * @param request The request object that contains all data needed to register a PIL non commercial social remix license.
2884
+ * @param request.txOptions [Optional] The transaction options.
2885
+ * @returns A Promise that resolves to an object containing the optional transaction hash and optional license ID.
2886
+ * @emits LicenseTermsRegistered (licenseTermsId, licenseTemplate, licenseTerms);
2966
2887
  */
2967
- )
2968
2888
  }, {
2969
- key: "registerPILSocialRemixPolicy",
2889
+ key: "registerNonComSocialRemixingPIL",
2970
2890
  value: (function () {
2971
- var _registerPILSocialRemixPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
2972
- var _request$txOptions2, frameworkData, policyId, _yield$this$rpcClient2, call, txHash, targetLog;
2891
+ var _registerNonComSocialRemixingPIL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
2892
+ var _request$txOptions, licenseTerms, licenseTermsId, _yield$this$rpcClient, call, txHash, targetLogs;
2973
2893
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2974
2894
  while (1) switch (_context2.prev = _context2.next) {
2975
2895
  case 0:
2976
2896
  _context2.prev = 0;
2977
- // First check if the policy exists
2978
- frameworkData = {
2979
- attribution: true,
2897
+ licenseTerms = {
2898
+ transferable: true,
2899
+ royaltyPolicy: viem.zeroAddress,
2900
+ mintingFee: BigInt(0),
2901
+ expiration: BigInt(0),
2980
2902
  commercialUse: false,
2981
2903
  commercialAttribution: false,
2982
2904
  commercializerChecker: viem.zeroAddress,
2983
- commercializerCheckerData: "0x",
2905
+ commercializerCheckerData: viem.zeroAddress,
2984
2906
  commercialRevShare: 0,
2907
+ commercialRevCelling: BigInt(0),
2985
2908
  derivativesAllowed: true,
2986
2909
  derivativesAttribution: true,
2987
2910
  derivativesApproval: false,
2988
2911
  derivativesReciprocal: true,
2989
- territories: request.territories || [],
2990
- distributionChannels: request.distributionChannels || [],
2991
- contentRestrictions: request.contentRestrictions || []
2912
+ derivativeRevCelling: BigInt(0),
2913
+ currency: viem.zeroAddress
2992
2914
  };
2993
2915
  _context2.next = 4;
2994
- return this.getPolicyId(true, this.encodeFrameworkData(frameworkData), typedDataToBytes({
2995
- "interface": "uint32",
2996
- data: [0]
2997
- }), "0", viem.zeroAddress, viem.zeroAddress);
2916
+ return this.getLicenseTermsId(licenseTerms);
2998
2917
  case 4:
2999
- policyId = _context2.sent;
3000
- if (!(policyId !== 0)) {
2918
+ licenseTermsId = _context2.sent;
2919
+ if (!(licenseTermsId !== 0)) {
3001
2920
  _context2.next = 7;
3002
2921
  break;
3003
2922
  }
3004
2923
  return _context2.abrupt("return", {
3005
- policyId: policyId.toString()
2924
+ licenseId: licenseTermsId.toString()
3006
2925
  });
3007
2926
  case 7:
3008
2927
  _context2.next = 9;
3009
- return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.pilPolicyFrameworkManagerConfig), {}, {
3010
- functionName: "registerPolicy",
3011
- args: [{
3012
- transferable: true,
3013
- royaltyPolicy: viem.zeroAddress,
3014
- mintingFee: parseToBigInt(0),
3015
- mintingFeeToken: viem.zeroAddress,
3016
- policy: {
3017
- attribution: true,
3018
- commercialUse: false,
3019
- commercialAttribution: false,
3020
- commercialRevShare: 0,
3021
- derivativesAllowed: true,
3022
- derivativesAttribution: true,
3023
- derivativesApproval: false,
3024
- derivativesReciprocal: true,
3025
- commercializerChecker: viem.zeroAddress,
3026
- commercializerCheckerData: "0x",
3027
- territories: request.territories || [],
3028
- distributionChannels: request.distributionChannels || [],
3029
- contentRestrictions: request.contentRestrictions || []
3030
- }
3031
- }],
2928
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.licenseTemplateConfig), {}, {
2929
+ functionName: "registerLicenseTerms",
2930
+ args: [licenseTerms],
3032
2931
  account: this.wallet.account
3033
2932
  }));
3034
2933
  case 9:
3035
- _yield$this$rpcClient2 = _context2.sent;
3036
- call = _yield$this$rpcClient2.request;
2934
+ _yield$this$rpcClient = _context2.sent;
2935
+ call = _yield$this$rpcClient.request;
3037
2936
  _context2.next = 13;
3038
2937
  return this.wallet.writeContract(call);
3039
2938
  case 13:
3040
2939
  txHash = _context2.sent;
3041
- if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
2940
+ if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
3042
2941
  _context2.next = 21;
3043
2942
  break;
3044
2943
  }
3045
2944
  _context2.next = 17;
3046
- return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licensingModuleConfig), {}, {
3047
- eventName: "PolicyRegistered"
2945
+ return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licenseTemplateConfig), {}, {
2946
+ eventName: "LicenseTermsRegistered"
3048
2947
  }));
3049
2948
  case 17:
3050
- targetLog = _context2.sent;
2949
+ targetLogs = _context2.sent;
3051
2950
  return _context2.abrupt("return", {
3052
2951
  txHash: txHash,
3053
- policyId: targetLog[0].args.policyId.toString()
2952
+ licenseId: targetLogs[0].args.licenseTermsId.toString()
3054
2953
  });
3055
2954
  case 21:
3056
2955
  return _context2.abrupt("return", {
@@ -3062,117 +2961,95 @@ var PolicyClient = /*#__PURE__*/function () {
3062
2961
  case 24:
3063
2962
  _context2.prev = 24;
3064
2963
  _context2.t0 = _context2["catch"](0);
3065
- handleError(_context2.t0, "Failed to register social remix policy");
2964
+ handleError(_context2.t0, "Failed to register non commercial social remixing PIL");
3066
2965
  case 27:
3067
2966
  case "end":
3068
2967
  return _context2.stop();
3069
2968
  }
3070
2969
  }, _callee2, this, [[0, 24]]);
3071
2970
  }));
3072
- function registerPILSocialRemixPolicy(_x2) {
3073
- return _registerPILSocialRemixPolicy.apply(this, arguments);
2971
+ function registerNonComSocialRemixingPIL(_x2) {
2972
+ return _registerNonComSocialRemixingPIL.apply(this, arguments);
3074
2973
  }
3075
- return registerPILSocialRemixPolicy;
2974
+ return registerNonComSocialRemixingPIL;
3076
2975
  }()
3077
2976
  /**
3078
- * Convenient function to register a PIL social remix policy to the registry
3079
- * Internally, this function must generate a Licensing.Policy struct and call registerPolicy.
3080
- * @param request - the licensing parameters for the Programmable IP License v1 (PIL) standard.
3081
- * @param request.commercialRevShare Percentage of revenue that must be shared with the licensor
3082
- * @param mintingFee Fee to be paid when minting a license
3083
- * @param mintingFeeToken Token to be used to pay the minting fee
3084
- * @param request.territories List of territories where the license is valid. If empty, global.
3085
- * @param request.distributionChannels List of distribution channels where the license is valid. Empty if no restrictions.
3086
- * @param request.contentRestrictions List of content restrictions where the license is valid. Empty if no restrictions.
3087
- * @returns the transaction hash and the policy ID if the txOptions.waitForTransaction is set to true
2977
+ * Convenient function to register a PIL commercial use license to the registry.
2978
+ * @param request The request object that contains all data needed to register a PIL commercial use license.
2979
+ * @param request.mintingFee The fee to be paid when minting a license.
2980
+ * @param request.currency The ERC20 token to be used to pay the minting fee.
2981
+ * the token must be registered in story protocol.
2982
+ * @param request.royaltyPolicy The address of the royalty policy contract which required to StoryProtocol in advance.
2983
+ * @param request.txOptions [Optional] The transaction options.
2984
+ * @returns A Promise that resolves to an object containing the optional transaction hash and optional license ID.
2985
+ * @emits LicenseTermsRegistered (licenseTermsId, licenseTemplate, licenseTerms);
3088
2986
  */
3089
2987
  )
3090
2988
  }, {
3091
- key: "registerPILCommercialUsePolicy",
2989
+ key: "registerCommercialUsePIL",
3092
2990
  value: (function () {
3093
- var _registerPILCommercialUsePolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(request) {
3094
- var _request$txOptions3, frameworkData, policyId, _yield$this$rpcClient3, call, txHash, targetLogs;
2991
+ var _registerCommercialUsePIL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(request) {
2992
+ var _request$txOptions2, licenseTerms, licenseTermsId, _yield$this$rpcClient2, call, txHash, targetLogs;
3095
2993
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
3096
2994
  while (1) switch (_context3.prev = _context3.next) {
3097
2995
  case 0:
3098
2996
  _context3.prev = 0;
3099
- // First check if the policy exists
3100
- frameworkData = {
3101
- attribution: true,
2997
+ licenseTerms = {
2998
+ transferable: true,
2999
+ royaltyPolicy: this.royaltyPolicyLAPConfig.address,
3000
+ mintingFee: BigInt(request.mintingFee),
3001
+ expiration: BigInt(0),
3102
3002
  commercialUse: true,
3103
3003
  commercialAttribution: true,
3104
3004
  commercializerChecker: viem.zeroAddress,
3105
- commercializerCheckerData: "0x",
3106
- commercialRevShare: request.commercialRevShare,
3005
+ commercializerCheckerData: viem.zeroAddress,
3006
+ commercialRevShare: 0,
3007
+ commercialRevCelling: BigInt(0),
3107
3008
  derivativesAllowed: true,
3108
3009
  derivativesAttribution: true,
3109
3010
  derivativesApproval: false,
3110
- derivativesReciprocal: true,
3111
- territories: request.territories || [],
3112
- distributionChannels: request.distributionChannels || [],
3113
- contentRestrictions: request.contentRestrictions || []
3011
+ derivativesReciprocal: false,
3012
+ derivativeRevCelling: BigInt(0),
3013
+ currency: request.currency
3114
3014
  };
3115
3015
  _context3.next = 4;
3116
- return this.getPolicyId(true, this.encodeFrameworkData(frameworkData), typedDataToBytes({
3117
- "interface": "uint32",
3118
- data: [request.commercialRevShare]
3119
- }), request.mintingFee || "0", request.mintingFeeToken || viem.zeroAddress, this.royaltyPolicyLAPConfig.address);
3016
+ return this.getLicenseTermsId(licenseTerms);
3120
3017
  case 4:
3121
- policyId = _context3.sent;
3122
- if (!(policyId !== 0)) {
3018
+ licenseTermsId = _context3.sent;
3019
+ if (!(licenseTermsId !== 0)) {
3123
3020
  _context3.next = 7;
3124
3021
  break;
3125
3022
  }
3126
3023
  return _context3.abrupt("return", {
3127
- policyId: policyId.toString()
3024
+ licenseId: licenseTermsId.toString()
3128
3025
  });
3129
3026
  case 7:
3130
3027
  _context3.next = 9;
3131
- return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.pilPolicyFrameworkManagerConfig), {}, {
3132
- functionName: "registerPolicy",
3133
- args: [{
3134
- transferable: true,
3135
- royaltyPolicy: this.royaltyPolicyLAPConfig.address,
3136
- mintingFee: parseToBigInt(request.mintingFee || "0"),
3137
- mintingFeeToken: request.mintingFeeToken || viem.zeroAddress,
3138
- policy: {
3139
- attribution: true,
3140
- commercialUse: true,
3141
- commercialAttribution: true,
3142
- commercialRevShare: request.commercialRevShare,
3143
- derivativesAllowed: true,
3144
- derivativesAttribution: true,
3145
- derivativesApproval: false,
3146
- derivativesReciprocal: true,
3147
- commercializerChecker: viem.zeroAddress,
3148
- commercializerCheckerData: "0x",
3149
- territories: request.territories || [],
3150
- distributionChannels: request.distributionChannels || [],
3151
- contentRestrictions: request.contentRestrictions || []
3152
- }
3153
- }],
3028
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.licenseTemplateConfig), {}, {
3029
+ functionName: "registerLicenseTerms",
3030
+ args: [licenseTerms],
3154
3031
  account: this.wallet.account
3155
3032
  }));
3156
3033
  case 9:
3157
- _yield$this$rpcClient3 = _context3.sent;
3158
- call = _yield$this$rpcClient3.request;
3034
+ _yield$this$rpcClient2 = _context3.sent;
3035
+ call = _yield$this$rpcClient2.request;
3159
3036
  _context3.next = 13;
3160
3037
  return this.wallet.writeContract(call);
3161
3038
  case 13:
3162
3039
  txHash = _context3.sent;
3163
- if (!((_request$txOptions3 = request.txOptions) !== null && _request$txOptions3 !== void 0 && _request$txOptions3.waitForTransaction)) {
3040
+ if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
3164
3041
  _context3.next = 21;
3165
3042
  break;
3166
3043
  }
3167
3044
  _context3.next = 17;
3168
- return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licensingModuleConfig), {}, {
3169
- eventName: "PolicyRegistered"
3045
+ return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licenseTemplateConfig), {}, {
3046
+ eventName: "LicenseTermsRegistered"
3170
3047
  }));
3171
3048
  case 17:
3172
3049
  targetLogs = _context3.sent;
3173
3050
  return _context3.abrupt("return", {
3174
3051
  txHash: txHash,
3175
- policyId: targetLogs[0].args.policyId.toString()
3052
+ licenseId: targetLogs[0].args.licenseTermsId.toString()
3176
3053
  });
3177
3054
  case 21:
3178
3055
  return _context3.abrupt("return", {
@@ -3184,134 +3061,256 @@ var PolicyClient = /*#__PURE__*/function () {
3184
3061
  case 24:
3185
3062
  _context3.prev = 24;
3186
3063
  _context3.t0 = _context3["catch"](0);
3187
- handleError(_context3.t0, "Failed to register commercial use policy");
3064
+ handleError(_context3.t0, "Failed to register commercial use PIL");
3188
3065
  case 27:
3189
3066
  case "end":
3190
3067
  return _context3.stop();
3191
3068
  }
3192
3069
  }, _callee3, this, [[0, 24]]);
3193
3070
  }));
3194
- function registerPILCommercialUsePolicy(_x3) {
3195
- return _registerPILCommercialUsePolicy.apply(this, arguments);
3071
+ function registerCommercialUsePIL(_x3) {
3072
+ return _registerCommercialUsePIL.apply(this, arguments);
3196
3073
  }
3197
- return registerPILCommercialUsePolicy;
3198
- }())
3074
+ return registerCommercialUsePIL;
3075
+ }()
3076
+ /**
3077
+ * Convenient function to register a PIL commercial Remix license to the registry.
3078
+ * @param request The request object that contains all data needed to register license.
3079
+ * @param request.mintingFee The fee to be paid when minting a license.
3080
+ * @param request.commercialRevShare Percentage of revenue that must be shared with the licensor.
3081
+ * @param request.currency The ERC20 token to be used to pay the minting fee. the token must be registered in story protocol.
3082
+ * @param request.royaltyPolicy The address of the royalty policy contract which required to StoryProtocol in advance.
3083
+ * @param request.txOptions [Optional] The transaction options.
3084
+ * @returns A Promise that resolves to an object containing the optional transaction hash and optional license ID.
3085
+ * @emits LicenseTermsRegistered (licenseTermsId, licenseTemplate, licenseTerms);
3086
+ */
3087
+ )
3199
3088
  }, {
3200
- key: "getPolicyId",
3201
- value: function () {
3202
- var _getPolicyId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(transferable, frameworkData, royaltyData, mintingFee, mintingFeeToken, royaltyPolicy, policyFramework) {
3203
- var data;
3089
+ key: "registerCommercialRemixPIL",
3090
+ value: (function () {
3091
+ var _registerCommercialRemixPIL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(request) {
3092
+ var _request$txOptions3, licenseTerms, licenseTermsId, _yield$this$rpcClient3, call, txHash, targetLogs;
3204
3093
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
3205
3094
  while (1) switch (_context4.prev = _context4.next) {
3206
3095
  case 0:
3207
- _context4.next = 2;
3208
- return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.licensingModuleConfig), {}, {
3209
- functionName: "getPolicyId",
3210
- args: [{
3211
- isLicenseTransferable: transferable,
3212
- policyFramework: policyFramework || this.pilPolicyFrameworkManagerConfig.address,
3213
- frameworkData: frameworkData,
3214
- royaltyPolicy: royaltyPolicy,
3215
- royaltyData: royaltyData,
3216
- mintingFee: parseToBigInt(mintingFee),
3217
- mintingFeeToken: mintingFeeToken
3218
- }]
3219
- }));
3220
- case 2:
3221
- data = _context4.sent;
3222
- return _context4.abrupt("return", Number(data));
3096
+ _context4.prev = 0;
3097
+ licenseTerms = {
3098
+ transferable: true,
3099
+ royaltyPolicy: this.royaltyPolicyLAPConfig.address,
3100
+ mintingFee: BigInt(request.mintingFee),
3101
+ expiration: BigInt(0),
3102
+ commercialUse: true,
3103
+ commercialAttribution: true,
3104
+ commercializerChecker: viem.zeroAddress,
3105
+ commercializerCheckerData: viem.zeroAddress,
3106
+ commercialRevShare: request.commercialRevShare,
3107
+ commercialRevCelling: BigInt(0),
3108
+ derivativesAllowed: true,
3109
+ derivativesAttribution: true,
3110
+ derivativesApproval: false,
3111
+ derivativesReciprocal: true,
3112
+ derivativeRevCelling: BigInt(0),
3113
+ currency: request.currency
3114
+ };
3115
+ _context4.next = 4;
3116
+ return this.getLicenseTermsId(licenseTerms);
3223
3117
  case 4:
3118
+ licenseTermsId = _context4.sent;
3119
+ if (!(licenseTermsId !== 0)) {
3120
+ _context4.next = 7;
3121
+ break;
3122
+ }
3123
+ return _context4.abrupt("return", {
3124
+ licenseId: licenseTermsId.toString()
3125
+ });
3126
+ case 7:
3127
+ _context4.next = 9;
3128
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.licenseTemplateConfig), {}, {
3129
+ functionName: "registerLicenseTerms",
3130
+ args: [licenseTerms],
3131
+ account: this.wallet.account
3132
+ }));
3133
+ case 9:
3134
+ _yield$this$rpcClient3 = _context4.sent;
3135
+ call = _yield$this$rpcClient3.request;
3136
+ _context4.next = 13;
3137
+ return this.wallet.writeContract(call);
3138
+ case 13:
3139
+ txHash = _context4.sent;
3140
+ if (!((_request$txOptions3 = request.txOptions) !== null && _request$txOptions3 !== void 0 && _request$txOptions3.waitForTransaction)) {
3141
+ _context4.next = 21;
3142
+ break;
3143
+ }
3144
+ _context4.next = 17;
3145
+ return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licenseTemplateConfig), {}, {
3146
+ eventName: "LicenseTermsRegistered"
3147
+ }));
3148
+ case 17:
3149
+ targetLogs = _context4.sent;
3150
+ return _context4.abrupt("return", {
3151
+ txHash: txHash,
3152
+ licenseId: targetLogs[0].args.licenseTermsId.toString()
3153
+ });
3154
+ case 21:
3155
+ return _context4.abrupt("return", {
3156
+ txHash: txHash
3157
+ });
3158
+ case 22:
3159
+ _context4.next = 27;
3160
+ break;
3161
+ case 24:
3162
+ _context4.prev = 24;
3163
+ _context4.t0 = _context4["catch"](0);
3164
+ handleError(_context4.t0, "Failed to register commercial remix PIL");
3165
+ case 27:
3224
3166
  case "end":
3225
3167
  return _context4.stop();
3226
3168
  }
3227
- }, _callee4, this);
3169
+ }, _callee4, this, [[0, 24]]);
3228
3170
  }));
3229
- function getPolicyId(_x4, _x5, _x6, _x7, _x8, _x9, _x10) {
3230
- return _getPolicyId.apply(this, arguments);
3171
+ function registerCommercialRemixPIL(_x4) {
3172
+ return _registerCommercialRemixPIL.apply(this, arguments);
3231
3173
  }
3232
- return getPolicyId;
3174
+ return registerCommercialRemixPIL;
3233
3175
  }()
3234
- }, {
3235
- key: "encodeFrameworkData",
3236
- value: function encodeFrameworkData(data) {
3237
- return typedDataToBytes({
3238
- "interface": "(bool, bool, bool, address, bytes, uint32, bool, bool, bool, bool, string[], string[], string[])",
3239
- data: [[data.attribution, data.commercialUse, data.commercialAttribution, data.commercializerChecker, data.commercializerCheckerData, data.commercialRevShare, data.derivativesAllowed, data.derivativesAttribution, data.derivativesApproval, data.derivativesReciprocal, data.territories, data.distributionChannels, data.contentRestrictions]]
3240
- });
3241
- }
3242
-
3243
3176
  /**
3244
- * Adds a policy to the set of policies of an IP
3245
- * @param request The request object containing details to add a policy to an IP
3246
- * @param request.ipId The id of the IP
3247
- * @param request.polId The id of the policy
3248
- * @return the transaction hash and the index of the policy in the IP's policy set if the txOptions.waitForTransaction is set to true
3177
+ * Attaches license terms to an IP, and the function must be called by the IP owner or an authorized operator.
3178
+ * @param request The request object that contains all data needed to attach license terms.
3179
+ @param request.ipId The IP ID.
3180
+ @param request.tokenAddress The address of the NFT.
3181
+ @param request.licenseTemplate The address of the license template.
3182
+ @param request.licenseTermsId The ID of the license terms.
3183
+ * @param request.txOptions [Optional] The transaction options.
3184
+ * @returns A Promise that resolves to an object containing the transaction hash.
3249
3185
  */
3186
+ )
3250
3187
  }, {
3251
- key: "addPolicyToIp",
3188
+ key: "attachLicenseTerms",
3252
3189
  value: (function () {
3253
- var _addPolicyToIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(request) {
3254
- var _request$txOptions4, IPAccountConfig, _yield$this$rpcClient4, call, txHash, targetLogs;
3190
+ var _attachLicenseTerms = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(request) {
3191
+ var _request$txOptions4;
3192
+ var _yield$this$rpcClient4, call, txHash;
3255
3193
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
3256
3194
  while (1) switch (_context5.prev = _context5.next) {
3257
3195
  case 0:
3258
- _context5.prev = 0;
3259
- IPAccountConfig = {
3260
- abi: this.ipAccountABI,
3261
- address: viem.getAddress(request.ipId)
3262
- };
3263
- _context5.next = 4;
3264
- return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, IPAccountConfig), {}, {
3265
- functionName: "execute",
3266
- args: [this.licensingModuleConfig.address, parseToBigInt(0), viem.encodeFunctionData({
3267
- abi: this.licensingModuleConfig.abi,
3268
- functionName: "addPolicyToIp",
3269
- args: [viem.getAddress(request.ipId), parseToBigInt(request.policyId)]
3270
- })],
3196
+ _context5.next = 2;
3197
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.licensingModuleConfig), {}, {
3198
+ functionName: "attachLicenseTerms",
3199
+ args: [request.ipId, request.licenseTemplate || this.licenseTemplateConfig.address, BigInt(request.licenseTermsId)],
3271
3200
  account: this.wallet.account
3272
3201
  }));
3273
- case 4:
3202
+ case 2:
3274
3203
  _yield$this$rpcClient4 = _context5.sent;
3275
3204
  call = _yield$this$rpcClient4.request;
3276
- _context5.next = 8;
3205
+ _context5.next = 6;
3277
3206
  return this.wallet.writeContract(call);
3278
- case 8:
3207
+ case 6:
3279
3208
  txHash = _context5.sent;
3280
3209
  if (!((_request$txOptions4 = request.txOptions) !== null && _request$txOptions4 !== void 0 && _request$txOptions4.waitForTransaction)) {
3281
- _context5.next = 16;
3210
+ _context5.next = 13;
3211
+ break;
3212
+ }
3213
+ _context5.next = 10;
3214
+ return waitTx(this.rpcClient, txHash);
3215
+ case 10:
3216
+ return _context5.abrupt("return", {
3217
+ txHash: txHash
3218
+ });
3219
+ case 13:
3220
+ return _context5.abrupt("return", {
3221
+ txHash: txHash
3222
+ });
3223
+ case 14:
3224
+ case "end":
3225
+ return _context5.stop();
3226
+ }
3227
+ }, _callee5, this);
3228
+ }));
3229
+ function attachLicenseTerms(_x5) {
3230
+ return _attachLicenseTerms.apply(this, arguments);
3231
+ }
3232
+ return attachLicenseTerms;
3233
+ }()
3234
+ /**
3235
+ * Mints license tokens for the license terms attached to an IP.
3236
+ * The license tokens are minted to the receiver.
3237
+ * The license terms must be attached to the IP before calling this function.
3238
+ * But it can mint license token of default license terms without attaching the default license terms,
3239
+ * since it is attached to all IPs by default.
3240
+ * IP owners can mint license tokens for their IPs for arbitrary license terms
3241
+ * without attaching the license terms to IP.
3242
+ * It might require the caller pay the minting fee, depending on the license terms or configured by the iP owner.
3243
+ * The minting fee is paid in the minting fee token specified in the license terms or configured by the IP owner.
3244
+ * IP owners can configure the minting fee of their IPs or
3245
+ * configure the minting fee module to determine the minting fee.
3246
+ * @param request The request object that contains all data needed to mint license tokens.
3247
+ * @param request.licensorIpId The licensor IP ID.
3248
+ * @param request.licenseTemplate The address of the license template.
3249
+ * @param request.licenseTermsId The ID of the license terms within the license template.
3250
+ * @param request.amount The amount of license tokens to mint.
3251
+ * @param request.receiver The address of the receiver.
3252
+ * @param request.txOptions [Optional] The transaction options.
3253
+ * @returns A Promise that resolves to an object containing the transaction hash and optional license token ID if waitForTxn is set to true.
3254
+ * @emits LicenseTokensMinted (msg.sender, licensorIpId, licenseTemplate, licenseTermsId, amount, receiver, startLicenseTokenId);
3255
+ */
3256
+ )
3257
+ }, {
3258
+ key: "mintLicenseTokens",
3259
+ value: (function () {
3260
+ var _mintLicenseTokens = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(request) {
3261
+ var _request$txOptions5, _yield$this$rpcClient5, call, txHash, targetLogs;
3262
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
3263
+ while (1) switch (_context6.prev = _context6.next) {
3264
+ case 0:
3265
+ _context6.prev = 0;
3266
+ _context6.next = 3;
3267
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.licensingModuleConfig), {}, {
3268
+ functionName: "mintLicenseTokens",
3269
+ args: [request.licensorIpId, request.licenseTemplate || this.licenseTemplateConfig.address, BigInt(request.licenseTermsId), BigInt(request.amount || 1), request.receiver || this.wallet.account.address, viem.zeroAddress],
3270
+ account: this.wallet.account
3271
+ }));
3272
+ case 3:
3273
+ _yield$this$rpcClient5 = _context6.sent;
3274
+ call = _yield$this$rpcClient5.request;
3275
+ _context6.next = 7;
3276
+ return this.wallet.writeContract(call);
3277
+ case 7:
3278
+ txHash = _context6.sent;
3279
+ if (!((_request$txOptions5 = request.txOptions) !== null && _request$txOptions5 !== void 0 && _request$txOptions5.waitForTransaction)) {
3280
+ _context6.next = 15;
3282
3281
  break;
3283
3282
  }
3284
- _context5.next = 12;
3283
+ _context6.next = 11;
3285
3284
  return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licensingModuleConfig), {}, {
3286
- eventName: "PolicyAddedToIpId"
3285
+ eventName: "LicenseTokensMinted"
3287
3286
  }));
3288
- case 12:
3289
- targetLogs = _context5.sent;
3290
- return _context5.abrupt("return", {
3287
+ case 11:
3288
+ targetLogs = _context6.sent;
3289
+ return _context6.abrupt("return", {
3291
3290
  txHash: txHash,
3292
- index: targetLogs[0].args.index.toString()
3291
+ licenseTokenId: targetLogs[0].args.startLicenseTokenId.toString()
3293
3292
  });
3294
- case 16:
3295
- return _context5.abrupt("return", {
3293
+ case 15:
3294
+ return _context6.abrupt("return", {
3296
3295
  txHash: txHash
3297
3296
  });
3298
- case 17:
3299
- _context5.next = 22;
3297
+ case 16:
3298
+ _context6.next = 21;
3300
3299
  break;
3301
- case 19:
3302
- _context5.prev = 19;
3303
- _context5.t0 = _context5["catch"](0);
3304
- handleError(_context5.t0, "Failed to add policy to IP");
3305
- case 22:
3300
+ case 18:
3301
+ _context6.prev = 18;
3302
+ _context6.t0 = _context6["catch"](0);
3303
+ handleError(_context6.t0, "Failed to mint license tokens");
3304
+ case 21:
3306
3305
  case "end":
3307
- return _context5.stop();
3306
+ return _context6.stop();
3308
3307
  }
3309
- }, _callee5, this, [[0, 19]]);
3308
+ }, _callee6, this, [[0, 18]]);
3310
3309
  }));
3311
- function addPolicyToIp(_x11) {
3312
- return _addPolicyToIp.apply(this, arguments);
3310
+ function mintLicenseTokens(_x6) {
3311
+ return _mintLicenseTokens.apply(this, arguments);
3313
3312
  }
3314
- return addPolicyToIp;
3313
+ return mintLicenseTokens;
3315
3314
  }())
3316
3315
  }]);
3317
3316
  }();
@@ -3707,30 +3706,6 @@ var StoryAPIClient = /*#__PURE__*/function () {
3707
3706
  }
3708
3707
  return getLicense;
3709
3708
  }()
3710
- }, {
3711
- key: "getPolicy",
3712
- value: function () {
3713
- var _getPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(policyId) {
3714
- var policyResp;
3715
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
3716
- while (1) switch (_context3.prev = _context3.next) {
3717
- case 0:
3718
- _context3.next = 2;
3719
- return this.httpClient.get("/api/v1/policies/".concat(policyId));
3720
- case 2:
3721
- policyResp = _context3.sent;
3722
- return _context3.abrupt("return", policyResp.data.data);
3723
- case 4:
3724
- case "end":
3725
- return _context3.stop();
3726
- }
3727
- }, _callee3, this);
3728
- }));
3729
- function getPolicy(_x3) {
3730
- return _getPolicy.apply(this, arguments);
3731
- }
3732
- return getPolicy;
3733
- }()
3734
3709
  }]);
3735
3710
  }();
3736
3711
 
@@ -3909,7 +3884,6 @@ var StoryClient = /*#__PURE__*/function () {
3909
3884
  _defineProperty(this, "_ipAsset", null);
3910
3885
  _defineProperty(this, "_permission", null);
3911
3886
  _defineProperty(this, "_license", null);
3912
- _defineProperty(this, "_policy", null);
3913
3887
  _defineProperty(this, "_dispute", null);
3914
3888
  _defineProperty(this, "_ipAccount", null);
3915
3889
  _defineProperty(this, "_royalty", null);
@@ -3929,7 +3903,7 @@ var StoryClient = /*#__PURE__*/function () {
3929
3903
  if (!account) {
3930
3904
  throw new Error("account is null");
3931
3905
  }
3932
- this.wallet = viem.createWalletClient(_objectSpread2(_objectSpread2({}, clientConfig), {}, {
3906
+ this.wallet = config.wallet || viem.createWalletClient(_objectSpread2(_objectSpread2({}, clientConfig), {}, {
3933
3907
  account: account
3934
3908
  }));
3935
3909
  }
@@ -3985,21 +3959,6 @@ var StoryClient = /*#__PURE__*/function () {
3985
3959
  return this._license;
3986
3960
  }
3987
3961
 
3988
- /**
3989
- * Getter for the policy client. The client is lazily created when
3990
- * this method is called.
3991
- *
3992
- * @returns the PolicyClient instance
3993
- */
3994
- }, {
3995
- key: "policy",
3996
- get: function get() {
3997
- if (this._policy === null) {
3998
- this._policy = new PolicyClient(this.rpcClient, this.wallet, this.config.chainId);
3999
- }
4000
- return this._policy;
4001
- }
4002
-
4003
3962
  /**
4004
3963
  * Getter for the dispute client. The client is lazily created when
4005
3964
  * this method is called.
@@ -4060,5 +4019,4 @@ exports.HashZero = HashZero;
4060
4019
  exports.IPAssetClient = IPAssetClient;
4061
4020
  exports.LicenseClient = LicenseClient;
4062
4021
  exports.PermissionClient = PermissionClient;
4063
- exports.PolicyClient = PolicyClient;
4064
4022
  exports.StoryClient = StoryClient;