@story-protocol/core-sdk 0.0.1-beta-rc.3 → 0.0.1-beta-rc.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/dist/declarations/src/client.d.ts +28 -13
  2. package/dist/declarations/src/client.d.ts.map +1 -1
  3. package/dist/declarations/src/clients/storyAPI.d.ts +11 -0
  4. package/dist/declarations/src/clients/storyAPI.d.ts.map +1 -0
  5. package/dist/declarations/src/index.d.ts +2 -4
  6. package/dist/declarations/src/index.d.ts.map +1 -1
  7. package/dist/declarations/src/resources/dispute.d.ts.map +1 -1
  8. package/dist/declarations/src/resources/ipAccount.d.ts +752 -0
  9. package/dist/declarations/src/resources/ipAccount.d.ts.map +1 -0
  10. package/dist/declarations/src/resources/ipAsset.d.ts +674 -4
  11. package/dist/declarations/src/resources/ipAsset.d.ts.map +1 -1
  12. package/dist/declarations/src/resources/license.d.ts +736 -66
  13. package/dist/declarations/src/resources/license.d.ts.map +1 -1
  14. package/dist/declarations/src/resources/permission.d.ts +58 -58
  15. package/dist/declarations/src/resources/policy.d.ts +1416 -66
  16. package/dist/declarations/src/resources/policy.d.ts.map +1 -1
  17. package/dist/declarations/src/types/resources/ipAccount.d.ts +25 -0
  18. package/dist/declarations/src/types/resources/ipAccount.d.ts.map +1 -0
  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 +8 -1
  22. package/dist/declarations/src/types/resources/license.d.ts.map +1 -1
  23. package/dist/declarations/src/types/resources/permission.d.ts +2 -2
  24. package/dist/declarations/src/types/resources/policy.d.ts +11 -1
  25. package/dist/declarations/src/types/resources/policy.d.ts.map +1 -1
  26. package/dist/declarations/src/types/resources/royalty.d.ts +17 -0
  27. package/dist/declarations/src/types/resources/royalty.d.ts.map +1 -0
  28. package/dist/story-protocol-core-sdk.cjs.dev.js +412 -299
  29. package/dist/story-protocol-core-sdk.cjs.prod.js +412 -299
  30. package/dist/story-protocol-core-sdk.esm.js +413 -298
  31. package/package.json +5 -5
  32. package/dist/declarations/src/resources/tagging.d.ts +0 -718
  33. package/dist/declarations/src/resources/tagging.d.ts.map +0 -1
  34. package/dist/declarations/src/types/resources/tagging.d.ts +0 -23
  35. package/dist/declarations/src/types/resources/tagging.d.ts.map +0 -1
  36. package/dist/declarations/src/utils/platform.d.ts +0 -17
  37. package/dist/declarations/src/utils/platform.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
- import { getAddress, decodeEventLog, encodeFunctionData, zeroAddress, stringToHex, createPublicClient, createWalletClient } from 'viem';
2
- import axios from 'axios';
1
+ import { getAddress, decodeEventLog, encodeAbiParameters, parseAbiParameters, encodeFunctionData, zeroAddress, stringToHex, createPublicClient, createWalletClient } from 'viem';
3
2
  import * as dotenv from 'dotenv';
4
3
  import { polygonMumbai, sepolia as sepolia$1, mainnet } from 'viem/chains';
4
+ import axios from 'axios';
5
5
 
6
6
  function _toPrimitive(input, hint) {
7
7
  if (typeof input !== "object" || input === null) return input;
@@ -420,6 +420,9 @@ function handleError(error, msg) {
420
420
  throw new Error("".concat(msg, ": Unknown error type"));
421
421
  }
422
422
 
423
+ var AddressZero = "0x0000000000000000000000000000000000000000";
424
+ var HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
425
+
423
426
  function _arrayLikeToArray(arr, len) {
424
427
  if (len == null || len > arr.length) len = arr.length;
425
428
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
@@ -1154,44 +1157,6 @@ var RegistrationModuleABI = [{
1154
1157
  type: "function"
1155
1158
  }];
1156
1159
 
1157
- var TaggingModuleABI = [{
1158
- inputs: [{
1159
- internalType: "string",
1160
- name: "tag",
1161
- type: "string"
1162
- }, {
1163
- internalType: "address",
1164
- name: "ipId",
1165
- type: "address"
1166
- }],
1167
- name: "removeTag",
1168
- outputs: [{
1169
- internalType: "bool",
1170
- name: "removed",
1171
- type: "bool"
1172
- }],
1173
- stateMutability: "nonpayable",
1174
- type: "function"
1175
- }, {
1176
- inputs: [{
1177
- internalType: "string",
1178
- name: "tag",
1179
- type: "string"
1180
- }, {
1181
- internalType: "address",
1182
- name: "ipId",
1183
- type: "address"
1184
- }],
1185
- name: "setTag",
1186
- outputs: [{
1187
- internalType: "bool",
1188
- name: "added",
1189
- type: "bool"
1190
- }],
1191
- stateMutability: "nonpayable",
1192
- type: "function"
1193
- }];
1194
-
1195
1160
  var ErrorsABI = [{
1196
1161
  inputs: [{
1197
1162
  internalType: "address",
@@ -1883,8 +1848,7 @@ var sepolia = {
1883
1848
  PILPolicyFrameworkManager: "0x49cF5C5523011F8B4A0489969096Eb68C571C197",
1884
1849
  RegistrationModule: "0x248c8CbF469ec7CB22Dc9914E569920b93d717a3",
1885
1850
  RoyaltyModule: "0x512bbF310452cC96E0E9818B0870EcA557b86d4D",
1886
- RoyaltyPolicyLAP: "0x8404061350BA0CA85c4E733B0be78c5519679003",
1887
- TaggingModule: "0xED445f1DeE74Cf470Aab47F4b63734653C4C9537"
1851
+ RoyaltyPolicyLAP: "0x8404061350BA0CA85c4E733B0be78c5519679003"
1888
1852
  };
1889
1853
 
1890
1854
  var IPAccountABI = [].concat(_toConsumableArray(IPAccountImplABI), _toConsumableArray(ErrorsABI));
@@ -1905,22 +1869,15 @@ var LicenseRegistryConfig = {
1905
1869
  address: getAddress(sepolia.LicenseRegistry)
1906
1870
  };
1907
1871
  var LicensingModuleConfig = {
1908
- abi: LicensingModuleABI,
1909
- //abi: [...LicensingModuleABI, ...ErrorsABI],
1872
+ abi: [].concat(_toConsumableArray(LicensingModuleABI), _toConsumableArray(ErrorsABI)),
1910
1873
  address: getAddress(sepolia.LicensingModule)
1911
1874
  };
1912
1875
  var RegistrationModuleConfig = {
1913
- abi: RegistrationModuleABI,
1914
- //abi: [...RegistrationModuleABI, ...ErrorsABI],
1876
+ abi: [].concat(_toConsumableArray(RegistrationModuleABI), _toConsumableArray(ErrorsABI)),
1915
1877
  address: getAddress(sepolia.RegistrationModule)
1916
1878
  };
1917
- var TaggingModuleConfig = {
1918
- abi: [].concat(_toConsumableArray(TaggingModuleABI), _toConsumableArray(ErrorsABI)),
1919
- address: getAddress(sepolia.TaggingModule)
1920
- };
1921
1879
  var PILPolicyFrameworkManagerConfig = {
1922
- abi: PILPolicyFrameworkManagerABI,
1923
- //abi: [...PILPolicyFrameworkManagerABI, ...ErrorsABI],
1880
+ abi: [].concat(_toConsumableArray(PILPolicyFrameworkManagerABI), _toConsumableArray(ErrorsABI)),
1924
1881
  address: getAddress(sepolia.PILPolicyFrameworkManager)
1925
1882
  };
1926
1883
 
@@ -2061,6 +2018,9 @@ function _waitTx() {
2061
2018
  }));
2062
2019
  return _waitTx.apply(this, arguments);
2063
2020
  }
2021
+ function typedDataToBytes(typedData) {
2022
+ return encodeAbiParameters(parseAbiParameters(typedData["interface"]), typedData.data);
2023
+ }
2064
2024
  function chainStringToViemChain(chainId) {
2065
2025
  switch (chainId) {
2066
2026
  case "1":
@@ -2078,119 +2038,95 @@ function chainStringToViemChain(chainId) {
2078
2038
  }
2079
2039
  }
2080
2040
 
2081
- var TaggingClient = /*#__PURE__*/function () {
2082
- function TaggingClient(rpcClient, wallet) {
2083
- _classCallCheck(this, TaggingClient);
2084
- _defineProperty(this, "taggingModuleConfig", TaggingModuleConfig);
2085
- this.rpcClient = rpcClient;
2086
- this.wallet = wallet;
2087
- }
2088
- _createClass(TaggingClient, [{
2089
- key: "setTag",
2090
- value: function () {
2091
- var _setTag = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2092
- var _request$txOptions, _yield$this$rpcClient, call, txHash;
2093
- return _regeneratorRuntime().wrap(function _callee$(_context) {
2094
- while (1) switch (_context.prev = _context.next) {
2095
- case 0:
2096
- _context.prev = 0;
2097
- _context.next = 3;
2098
- return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.taggingModuleConfig), {}, {
2099
- functionName: "setTag",
2100
- args: [request.tag, request.ipId]
2101
- }));
2102
- case 3:
2103
- _yield$this$rpcClient = _context.sent;
2104
- call = _yield$this$rpcClient.request;
2105
- _context.next = 7;
2106
- return this.wallet.writeContract(call);
2107
- case 7:
2108
- txHash = _context.sent;
2109
- if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
2110
- _context.next = 11;
2111
- break;
2112
- }
2113
- _context.next = 11;
2114
- return waitTx(this.rpcClient, txHash);
2115
- case 11:
2116
- return _context.abrupt("return", {
2117
- txHash: txHash
2118
- });
2119
- case 14:
2120
- _context.prev = 14;
2121
- _context.t0 = _context["catch"](0);
2122
- handleError(_context.t0, "Failed to set tag");
2123
- case 17:
2124
- case "end":
2125
- return _context.stop();
2041
+ function computeRoyaltyContext(_x, _x2) {
2042
+ return _computeRoyaltyContext.apply(this, arguments);
2043
+ }
2044
+ function _computeRoyaltyContext() {
2045
+ _computeRoyaltyContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(licenseIds, storyClient) {
2046
+ var royaltyContext, i, licenseData, royaltyPolicy, policy, targetRoyaltyAmount;
2047
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2048
+ while (1) switch (_context.prev = _context.next) {
2049
+ case 0:
2050
+ royaltyContext = {
2051
+ targetAncestors: [],
2052
+ targetRoyaltyAmount: [],
2053
+ parentAncestors1: [],
2054
+ parentAncestors2: [],
2055
+ parentAncestorsRoyalties1: [],
2056
+ parentAncestorsRoyalties2: []
2057
+ };
2058
+ i = 0;
2059
+ case 2:
2060
+ if (!(i < licenseIds.length)) {
2061
+ _context.next = 16;
2062
+ break;
2126
2063
  }
2127
- }, _callee, this, [[0, 14]]);
2128
- }));
2129
- function setTag(_x) {
2130
- return _setTag.apply(this, arguments);
2131
- }
2132
- return setTag;
2133
- }()
2134
- }, {
2135
- key: "removeTag",
2136
- value: function () {
2137
- var _removeTag = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
2138
- var _request$txOptions2, _yield$this$rpcClient2, call, txHash;
2139
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2140
- while (1) switch (_context2.prev = _context2.next) {
2141
- case 0:
2142
- _context2.prev = 0;
2143
- _context2.next = 3;
2144
- return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.taggingModuleConfig), {}, {
2145
- functionName: "removeTag",
2146
- args: [request.tag, request.ipId]
2147
- }));
2148
- case 3:
2149
- _yield$this$rpcClient2 = _context2.sent;
2150
- call = _yield$this$rpcClient2.request;
2151
- _context2.next = 7;
2152
- return this.wallet.writeContract(call);
2153
- case 7:
2154
- txHash = _context2.sent;
2155
- if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
2156
- _context2.next = 11;
2157
- break;
2158
- }
2159
- _context2.next = 11;
2160
- return waitTx(this.rpcClient, txHash);
2161
- case 11:
2162
- return _context2.abrupt("return", {
2163
- txHash: txHash
2164
- });
2165
- case 14:
2166
- _context2.prev = 14;
2167
- _context2.t0 = _context2["catch"](0);
2168
- handleError(_context2.t0, "Failed to remove tag");
2169
- case 17:
2170
- case "end":
2171
- return _context2.stop();
2064
+ _context.next = 5;
2065
+ return storyClient.getLicense(licenseIds[i]);
2066
+ case 5:
2067
+ licenseData = _context.sent;
2068
+ _context.next = 8;
2069
+ return storyClient.getRoyaltyPolicy(licenseData.licensorIpId);
2070
+ case 8:
2071
+ royaltyPolicy = _context.sent;
2072
+ _context.next = 11;
2073
+ return storyClient.getPolicy(licenseData.policyId);
2074
+ case 11:
2075
+ policy = _context.sent;
2076
+ if (royaltyPolicy) {
2077
+ targetRoyaltyAmount = royaltyPolicy.targetRoyaltyAmount.map(function (e) {
2078
+ return parseInt(e);
2079
+ });
2080
+ if (i === 0) {
2081
+ royaltyContext.parentAncestors1 = royaltyPolicy.targetAncestors;
2082
+ royaltyContext.parentAncestorsRoyalties1 = targetRoyaltyAmount;
2083
+ } else {
2084
+ royaltyContext.parentAncestors2 = royaltyPolicy.targetAncestors;
2085
+ royaltyContext.parentAncestorsRoyalties2 = targetRoyaltyAmount;
2086
+ }
2087
+ updateRoyaltyContext(royaltyContext, [licenseData.licensorIpId], [parseInt(policy.pil.commercialRevShare)]);
2088
+ updateRoyaltyContext(royaltyContext, royaltyPolicy.targetAncestors, targetRoyaltyAmount);
2172
2089
  }
2173
- }, _callee2, this, [[0, 14]]);
2174
- }));
2175
- function removeTag(_x2) {
2176
- return _removeTag.apply(this, arguments);
2090
+ case 13:
2091
+ i++;
2092
+ _context.next = 2;
2093
+ break;
2094
+ case 16:
2095
+ return _context.abrupt("return", royaltyContext);
2096
+ case 17:
2097
+ case "end":
2098
+ return _context.stop();
2177
2099
  }
2178
- return removeTag;
2179
- }()
2180
- }]);
2181
- return TaggingClient;
2182
- }();
2183
-
2184
- var AddressZero = "0x0000000000000000000000000000000000000000";
2185
- var HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
2100
+ }, _callee);
2101
+ }));
2102
+ return _computeRoyaltyContext.apply(this, arguments);
2103
+ }
2104
+ function encodeRoyaltyContext(royaltyContext) {
2105
+ return typedDataToBytes({
2106
+ "interface": "(address[], uint32[], address[], address[], uint32[], uint32[])",
2107
+ data: [[royaltyContext.targetAncestors, royaltyContext.targetRoyaltyAmount, royaltyContext.parentAncestors1, royaltyContext.parentAncestors2, royaltyContext.parentAncestorsRoyalties1, royaltyContext.parentAncestorsRoyalties2]]
2108
+ });
2109
+ }
2110
+ function updateRoyaltyContext(royaltyContext, targetAncestors, targetRoyaltyAccounts) {
2111
+ for (var i = 0; i < targetAncestors.length; i++) {
2112
+ var index = royaltyContext.targetAncestors.indexOf(targetAncestors[i]);
2113
+ if (index === -1) {
2114
+ royaltyContext.targetAncestors.push(targetAncestors[i]);
2115
+ royaltyContext.targetRoyaltyAmount.push(targetRoyaltyAccounts[i]);
2116
+ } else {
2117
+ royaltyContext.targetRoyaltyAmount[index] += targetRoyaltyAccounts[i];
2118
+ }
2119
+ }
2120
+ }
2186
2121
 
2187
2122
  var IPAssetClient = /*#__PURE__*/function () {
2188
- function IPAssetClient(rpcClient, wallet) {
2123
+ function IPAssetClient(rpcClient, wallet, storyClient) {
2189
2124
  _classCallCheck(this, IPAssetClient);
2190
2125
  _defineProperty(this, "ipAssetRegistryConfig", IPAssetRegistryConfig);
2191
2126
  _defineProperty(this, "registrationModuleConfig", RegistrationModuleConfig);
2192
2127
  this.wallet = wallet;
2193
2128
  this.rpcClient = rpcClient;
2129
+ this.storyClient = storyClient;
2194
2130
  }
2195
2131
 
2196
2132
  /**
@@ -2220,7 +2156,7 @@ var IPAssetClient = /*#__PURE__*/function () {
2220
2156
  _context.next = 3;
2221
2157
  return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.registrationModuleConfig), {}, {
2222
2158
  functionName: "registerRootIp",
2223
- args: [parseToBigInt(request.policyId), getAddress(request.tokenContractAddress),
2159
+ args: [parseToBigInt(request.policyId || "0"), getAddress(request.tokenContractAddress),
2224
2160
  // 0x Address
2225
2161
  parseToBigInt(request.tokenId), request.ipName || "", request.contentHash || HashZero, request.uri || ""],
2226
2162
  account: this.wallet.account
@@ -2287,7 +2223,7 @@ var IPAssetClient = /*#__PURE__*/function () {
2287
2223
  key: "registerDerivativeIp",
2288
2224
  value: function () {
2289
2225
  var _registerDerivativeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
2290
- var _request$txOptions2, licenseIds, _yield$this$rpcClient2, call, txHash, targetLog;
2226
+ var _request$txOptions2, licenseIds, royaltyContext, _yield$this$rpcClient2, call, txHash, targetLog;
2291
2227
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2292
2228
  while (1) switch (_context2.prev = _context2.next) {
2293
2229
  case 0:
@@ -2297,50 +2233,54 @@ var IPAssetClient = /*#__PURE__*/function () {
2297
2233
  licenseIds.push(parseToBigInt(licenseId));
2298
2234
  });
2299
2235
  _context2.next = 5;
2236
+ return computeRoyaltyContext(request.licenseIds, this.storyClient);
2237
+ case 5:
2238
+ royaltyContext = _context2.sent;
2239
+ _context2.next = 8;
2300
2240
  return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.registrationModuleConfig), {}, {
2301
2241
  functionName: "registerDerivativeIp",
2302
2242
  args: [licenseIds, getAddress(request.tokenContractAddress),
2303
2243
  // 0x Address
2304
- parseToBigInt(request.tokenId), request.ipName || "", request.contentHash || HashZero, request.uri || "", "0x"],
2244
+ parseToBigInt(request.tokenId), request.ipName || "", request.contentHash || HashZero, request.uri || "", encodeRoyaltyContext(royaltyContext)],
2305
2245
  account: this.wallet.account
2306
2246
  }));
2307
- case 5:
2247
+ case 8:
2308
2248
  _yield$this$rpcClient2 = _context2.sent;
2309
2249
  call = _yield$this$rpcClient2.request;
2310
- _context2.next = 9;
2250
+ _context2.next = 12;
2311
2251
  return this.wallet.writeContract(call);
2312
- case 9:
2252
+ case 12:
2313
2253
  txHash = _context2.sent;
2314
2254
  if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
2315
- _context2.next = 17;
2255
+ _context2.next = 20;
2316
2256
  break;
2317
2257
  }
2318
- _context2.next = 13;
2258
+ _context2.next = 16;
2319
2259
  return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
2320
2260
  eventName: "IPRegistered"
2321
2261
  }));
2322
- case 13:
2262
+ case 16:
2323
2263
  targetLog = _context2.sent;
2324
2264
  return _context2.abrupt("return", {
2325
2265
  txHash: txHash,
2326
2266
  ipId: targetLog.args.ipId
2327
2267
  });
2328
- case 17:
2268
+ case 20:
2329
2269
  return _context2.abrupt("return", {
2330
2270
  txHash: txHash
2331
2271
  });
2332
- case 18:
2333
- _context2.next = 23;
2272
+ case 21:
2273
+ _context2.next = 26;
2334
2274
  break;
2335
- case 20:
2336
- _context2.prev = 20;
2275
+ case 23:
2276
+ _context2.prev = 23;
2337
2277
  _context2.t0 = _context2["catch"](0);
2338
2278
  handleError(_context2.t0, "Failed to register derivative IP");
2339
- case 23:
2279
+ case 26:
2340
2280
  case "end":
2341
2281
  return _context2.stop();
2342
2282
  }
2343
- }, _callee2, this, [[0, 20]]);
2283
+ }, _callee2, this, [[0, 23]]);
2344
2284
  }));
2345
2285
  function registerDerivativeIp(_x2) {
2346
2286
  return _registerDerivativeIp.apply(this, arguments);
@@ -2459,13 +2399,14 @@ var PermissionClient = /*#__PURE__*/function () {
2459
2399
  }();
2460
2400
 
2461
2401
  var LicenseClient = /*#__PURE__*/function () {
2462
- function LicenseClient(rpcClient, wallet) {
2402
+ function LicenseClient(rpcClient, wallet, storyClient) {
2463
2403
  _classCallCheck(this, LicenseClient);
2464
2404
  _defineProperty(this, "ipAccountABI", IPAccountABI);
2465
2405
  _defineProperty(this, "licenseRegistryConfig", LicenseRegistryConfig);
2466
2406
  _defineProperty(this, "licensingModuleConfig", LicensingModuleConfig);
2467
2407
  this.wallet = wallet;
2468
2408
  this.rpcClient = rpcClient;
2409
+ this.storyClient = storyClient;
2469
2410
  }
2470
2411
 
2471
2412
  /**
@@ -2478,68 +2419,79 @@ var LicenseClient = /*#__PURE__*/function () {
2478
2419
  * @param request.licensorIpId_ The ID of the IP granting the license (ie. licensor)
2479
2420
  * @param request.mintAmount Number of licenses to mint. License NFT is fungible for same policy and same licensors
2480
2421
  * @param request.receiver Receiver address of the minted license NFT(s).
2481
- * @return licenseId The ID of the minted license NFT(s).
2422
+ * @returns licenseId The ID of the minted license NFT(s).
2482
2423
  */
2483
2424
  _createClass(LicenseClient, [{
2484
2425
  key: "mintLicense",
2485
2426
  value: function () {
2486
2427
  var _mintLicense = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2487
- var _request$txOptions, IPAccountConfig, _yield$this$rpcClient, call, txHash, targetLog;
2428
+ var _request$txOptions, royaltyContext, royaltyPolicy, _royaltyContext$targe, _royaltyContext$targe2, targetRoyaltyAmount, _yield$this$rpcClient, call, txHash, targetLog;
2488
2429
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2489
2430
  while (1) switch (_context.prev = _context.next) {
2490
2431
  case 0:
2491
2432
  _context.prev = 0;
2492
- IPAccountConfig = {
2493
- abi: this.ipAccountABI,
2494
- address: getAddress(request.licensorIpId)
2433
+ royaltyContext = {
2434
+ targetAncestors: [],
2435
+ targetRoyaltyAmount: [],
2436
+ parentAncestors1: [],
2437
+ parentAncestors2: [],
2438
+ parentAncestorsRoyalties1: [],
2439
+ parentAncestorsRoyalties2: []
2495
2440
  };
2496
2441
  _context.next = 4;
2497
- return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, IPAccountConfig), {}, {
2498
- functionName: "execute",
2499
- args: [this.licensingModuleConfig.address, parseToBigInt(0), encodeFunctionData({
2500
- abi: this.licensingModuleConfig.abi,
2501
- functionName: "mintLicense",
2502
- args: [parseToBigInt(request.policyId), request.licensorIpId, parseToBigInt(request.mintAmount), getAddress(request.receiverAddress), "0x"]
2503
- })],
2442
+ return this.storyClient.getRoyaltyPolicy(request.licensorIpId);
2443
+ case 4:
2444
+ royaltyPolicy = _context.sent;
2445
+ if (royaltyPolicy) {
2446
+ (_royaltyContext$targe = royaltyContext.targetAncestors).push.apply(_royaltyContext$targe, _toConsumableArray(royaltyPolicy.targetAncestors));
2447
+ targetRoyaltyAmount = royaltyPolicy.targetRoyaltyAmount.map(function (e) {
2448
+ return parseInt(e);
2449
+ });
2450
+ (_royaltyContext$targe2 = royaltyContext.targetRoyaltyAmount).push.apply(_royaltyContext$targe2, _toConsumableArray(targetRoyaltyAmount));
2451
+ }
2452
+ _context.next = 8;
2453
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.licensingModuleConfig), {}, {
2454
+ functionName: "mintLicense",
2455
+ args: [parseToBigInt(request.policyId), request.licensorIpId, parseToBigInt(request.mintAmount), getAddress(request.receiverAddress), encodeRoyaltyContext(royaltyContext)],
2504
2456
  account: this.wallet.account
2505
2457
  }));
2506
- case 4:
2458
+ case 8:
2507
2459
  _yield$this$rpcClient = _context.sent;
2508
2460
  call = _yield$this$rpcClient.request;
2509
- _context.next = 8;
2461
+ _context.next = 12;
2510
2462
  return this.wallet.writeContract(call);
2511
- case 8:
2463
+ case 12:
2512
2464
  txHash = _context.sent;
2513
2465
  if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
2514
- _context.next = 16;
2466
+ _context.next = 20;
2515
2467
  break;
2516
2468
  }
2517
- _context.next = 12;
2469
+ _context.next = 16;
2518
2470
  return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licenseRegistryConfig), {}, {
2519
2471
  eventName: "TransferSingle"
2520
2472
  }));
2521
- case 12:
2473
+ case 16:
2522
2474
  targetLog = _context.sent;
2523
2475
  return _context.abrupt("return", {
2524
2476
  txHash: txHash,
2525
2477
  licenseId: targetLog.args.id.toString()
2526
2478
  });
2527
- case 16:
2479
+ case 20:
2528
2480
  return _context.abrupt("return", {
2529
2481
  txHash: txHash
2530
2482
  });
2531
- case 17:
2532
- _context.next = 22;
2483
+ case 21:
2484
+ _context.next = 26;
2533
2485
  break;
2534
- case 19:
2535
- _context.prev = 19;
2486
+ case 23:
2487
+ _context.prev = 23;
2536
2488
  _context.t0 = _context["catch"](0);
2537
2489
  handleError(_context.t0, "Failed to mint license");
2538
- case 22:
2490
+ case 26:
2539
2491
  case "end":
2540
2492
  return _context.stop();
2541
2493
  }
2542
- }, _callee, this, [[0, 19]]);
2494
+ }, _callee, this, [[0, 23]]);
2543
2495
  }));
2544
2496
  function mintLicense(_x) {
2545
2497
  return _mintLicense.apply(this, arguments);
@@ -2550,7 +2502,7 @@ var LicenseClient = /*#__PURE__*/function () {
2550
2502
  key: "linkIpToParent",
2551
2503
  value: function () {
2552
2504
  var _linkIpToParent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
2553
- var _request$txOptions2, IPAccountConfig, licenseIds, _yield$this$rpcClient2, call, txHash;
2505
+ var _request$txOptions2, IPAccountConfig, licenseIds, royaltyContext, _yield$this$rpcClient2, call, txHash;
2554
2506
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2555
2507
  while (1) switch (_context2.prev = _context2.next) {
2556
2508
  case 0:
@@ -2564,51 +2516,55 @@ var LicenseClient = /*#__PURE__*/function () {
2564
2516
  licenseIds.push(parseToBigInt(licenseId));
2565
2517
  });
2566
2518
  _context2.next = 6;
2519
+ return computeRoyaltyContext(request.licenseIds, this.storyClient);
2520
+ case 6:
2521
+ royaltyContext = _context2.sent;
2522
+ _context2.next = 9;
2567
2523
  return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, IPAccountConfig), {}, {
2568
2524
  functionName: "execute",
2569
2525
  args: [this.licensingModuleConfig.address, parseToBigInt(0), encodeFunctionData({
2570
2526
  abi: this.licensingModuleConfig.abi,
2571
2527
  functionName: "linkIpToParents",
2572
- args: [licenseIds, getAddress(request.childIpId), "0x"]
2528
+ args: [licenseIds, getAddress(request.childIpId), encodeRoyaltyContext(royaltyContext)]
2573
2529
  })],
2574
2530
  account: this.wallet.account
2575
2531
  }));
2576
- case 6:
2532
+ case 9:
2577
2533
  _yield$this$rpcClient2 = _context2.sent;
2578
2534
  call = _yield$this$rpcClient2.request;
2579
- _context2.next = 10;
2535
+ _context2.next = 13;
2580
2536
  return this.wallet.writeContract(call);
2581
- case 10:
2537
+ case 13:
2582
2538
  txHash = _context2.sent;
2583
2539
  if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
2584
- _context2.next = 17;
2540
+ _context2.next = 20;
2585
2541
  break;
2586
2542
  }
2587
- _context2.next = 14;
2543
+ _context2.next = 17;
2588
2544
  return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, LicenseRegistryConfig), {}, {
2589
2545
  eventName: "TransferBatch"
2590
2546
  }));
2591
- case 14:
2547
+ case 17:
2592
2548
  return _context2.abrupt("return", {
2593
2549
  txHash: txHash,
2594
2550
  success: true
2595
2551
  });
2596
- case 17:
2552
+ case 20:
2597
2553
  return _context2.abrupt("return", {
2598
2554
  txHash: txHash
2599
2555
  });
2600
- case 18:
2601
- _context2.next = 23;
2556
+ case 21:
2557
+ _context2.next = 26;
2602
2558
  break;
2603
- case 20:
2604
- _context2.prev = 20;
2605
- _context2.t0 = _context2["catch"](0);
2606
- handleError(_context2.t0, "Failed to mint license");
2607
2559
  case 23:
2560
+ _context2.prev = 23;
2561
+ _context2.t0 = _context2["catch"](0);
2562
+ handleError(_context2.t0, "Failed to link IP to parents");
2563
+ case 26:
2608
2564
  case "end":
2609
2565
  return _context2.stop();
2610
2566
  }
2611
- }, _callee2, this, [[0, 20]]);
2567
+ }, _callee2, this, [[0, 23]]);
2612
2568
  }));
2613
2569
  function linkIpToParent(_x2) {
2614
2570
  return _linkIpToParent.apply(this, arguments);
@@ -2841,7 +2797,8 @@ var DisputeClient = /*#__PURE__*/function () {
2841
2797
  functionName: "raiseDispute",
2842
2798
  args: [request.targetIpId, request.linkToDisputeEvidence, stringToHex(request.targetTag, {
2843
2799
  size: 32
2844
- }), request.calldata || "0x"]
2800
+ }), request.calldata || "0x"],
2801
+ account: this.wallet.account
2845
2802
  }));
2846
2803
  case 3:
2847
2804
  _yield$this$rpcClient = _context.sent;
@@ -2907,7 +2864,8 @@ var DisputeClient = /*#__PURE__*/function () {
2907
2864
  _context2.next = 3;
2908
2865
  return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.disputeModuleConfig), {}, {
2909
2866
  functionName: "cancelDispute",
2910
- args: [BigInt(request.disputeId), request.calldata ? request.calldata : "0x"]
2867
+ args: [BigInt(request.disputeId), request.calldata ? request.calldata : "0x"],
2868
+ account: this.wallet.account
2911
2869
  }));
2912
2870
  case 3:
2913
2871
  _yield$this$rpcClient2 = _context2.sent;
@@ -2962,7 +2920,8 @@ var DisputeClient = /*#__PURE__*/function () {
2962
2920
  _context3.next = 3;
2963
2921
  return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.disputeModuleConfig), {}, {
2964
2922
  functionName: "resolveDispute",
2965
- args: [BigInt(request.disputeId)]
2923
+ args: [BigInt(request.disputeId)],
2924
+ account: this.wallet.account
2966
2925
  }));
2967
2926
  case 3:
2968
2927
  _yield$this$rpcClient3 = _context3.sent;
@@ -3000,72 +2959,222 @@ var DisputeClient = /*#__PURE__*/function () {
3000
2959
  return DisputeClient;
3001
2960
  }();
3002
2961
 
3003
- var PlatformClient = /*#__PURE__*/function () {
3004
- function PlatformClient(httpClient) {
3005
- _classCallCheck(this, PlatformClient);
3006
- this.httpClient = httpClient;
2962
+ var IPAccountClient = /*#__PURE__*/function () {
2963
+ function IPAccountClient(rpcClient, wallet) {
2964
+ _classCallCheck(this, IPAccountClient);
2965
+ _defineProperty(this, "ipAccountABI", IPAccountABI);
2966
+ this.wallet = wallet;
2967
+ this.rpcClient = rpcClient;
3007
2968
  }
3008
2969
 
3009
- /**
3010
- * Upload a file to Arweave.
3011
- *
3012
- * @param file - the file binary data to upload
3013
- * @param mimeType - the mime type of the file
3014
- * @returns the response object that contains the uri of the uploaded file
2970
+ /** Executes a transaction from the IP Account.
2971
+ * @param request The request object containing necessary data to execute IP Account a transaction.
2972
+ * @param request.to The recipient of the transaction.
2973
+ * @param request.value The amount of Ether to send.
2974
+ * @param request.data The data to send along with the transaction.
2975
+ * @returns Tx hash for the transaction.
3015
2976
  */
3016
- _createClass(PlatformClient, [{
3017
- key: "uploadFile",
2977
+ _createClass(IPAccountClient, [{
2978
+ key: "execute",
3018
2979
  value: function () {
3019
- var _uploadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file, mimeType) {
3020
- var preSignUrlResp, data, uploadResp, confirmResp;
2980
+ var _execute = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
2981
+ var _request$txOptions, IPAccountConfig, _yield$this$rpcClient, call, txHash;
3021
2982
  return _regeneratorRuntime().wrap(function _callee$(_context) {
3022
2983
  while (1) switch (_context.prev = _context.next) {
3023
2984
  case 0:
3024
2985
  _context.prev = 0;
3025
- _context.next = 3;
3026
- return this.httpClient.post("/platform/file-upload/request");
3027
- case 3:
3028
- preSignUrlResp = _context.sent;
3029
- data = preSignUrlResp.data; // upload the file to s3
3030
- _context.next = 7;
3031
- return this.httpClient.put(data.url, file, {
3032
- timeout: 0,
3033
- headers: {
3034
- "Content-Type": mimeType
3035
- }
3036
- });
3037
- case 7:
3038
- uploadResp = _context.sent;
3039
- if (!(uploadResp.status !== 200)) {
3040
- _context.next = 10;
2986
+ IPAccountConfig = {
2987
+ abi: this.ipAccountABI,
2988
+ address: getAddress(request.accountAddress)
2989
+ };
2990
+ _context.next = 4;
2991
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, IPAccountConfig), {}, {
2992
+ functionName: "execute",
2993
+ args: [request.to, parseToBigInt(0), request.data],
2994
+ account: this.wallet.account
2995
+ }));
2996
+ case 4:
2997
+ _yield$this$rpcClient = _context.sent;
2998
+ call = _yield$this$rpcClient.request;
2999
+ _context.next = 8;
3000
+ return this.wallet.writeContract(call);
3001
+ case 8:
3002
+ txHash = _context.sent;
3003
+ if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
3004
+ _context.next = 12;
3041
3005
  break;
3042
3006
  }
3043
- throw new Error("Failed to upload file to s3. Status: ".concat(uploadResp.status));
3044
- case 10:
3045
3007
  _context.next = 12;
3046
- return this.httpClient.post("/platform/file-upload/confirm", {
3047
- key: data.key
3048
- });
3008
+ return waitTx(this.rpcClient, txHash);
3049
3009
  case 12:
3050
- confirmResp = _context.sent;
3051
- return _context.abrupt("return", confirmResp.data);
3052
- case 16:
3053
- _context.prev = 16;
3010
+ return _context.abrupt("return", {
3011
+ txHash: txHash
3012
+ });
3013
+ case 15:
3014
+ _context.prev = 15;
3054
3015
  _context.t0 = _context["catch"](0);
3055
- return _context.abrupt("return", handleError(_context.t0, "Failed to upload file"));
3056
- case 19:
3016
+ handleError(_context.t0, "Failed to execute the IP Account transaction");
3017
+ case 18:
3057
3018
  case "end":
3058
3019
  return _context.stop();
3059
3020
  }
3060
- }, _callee, this, [[0, 16]]);
3021
+ }, _callee, this, [[0, 15]]);
3061
3022
  }));
3062
- function uploadFile(_x, _x2) {
3063
- return _uploadFile.apply(this, arguments);
3023
+ function execute(_x) {
3024
+ return _execute.apply(this, arguments);
3064
3025
  }
3065
- return uploadFile;
3026
+ return execute;
3027
+ }()
3028
+ /** Executes a transaction from the IP Account.
3029
+ * @param request The request object containing necessary data to execute IP Account a transaction.
3030
+ * @param request.to The recipient of the transaction.
3031
+ * @param request.value The amount of Ether to send.
3032
+ * @param request.data The data to send along with the transaction.
3033
+ * @param request.signer The signer of the transaction.
3034
+ * @param request.deadline The deadline of the transaction signature.
3035
+ * @param request.signature The signature of the transaction, EIP-712 encoded.
3036
+ * @returns Tx hash for the transaction.
3037
+ */
3038
+ }, {
3039
+ key: "executeWithSig",
3040
+ value: function () {
3041
+ var _executeWithSig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
3042
+ var _request$txOptions2, IPAccountConfig, _yield$this$rpcClient2, call, txHash;
3043
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3044
+ while (1) switch (_context2.prev = _context2.next) {
3045
+ case 0:
3046
+ _context2.prev = 0;
3047
+ IPAccountConfig = {
3048
+ abi: this.ipAccountABI,
3049
+ address: getAddress(request.accountAddress)
3050
+ };
3051
+ _context2.next = 4;
3052
+ return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, IPAccountConfig), {}, {
3053
+ functionName: "executeWithSig",
3054
+ args: [request.to, parseToBigInt(0), request.data, request.signer, parseToBigInt(request.deadline), request.signature],
3055
+ account: this.wallet.account
3056
+ }));
3057
+ case 4:
3058
+ _yield$this$rpcClient2 = _context2.sent;
3059
+ call = _yield$this$rpcClient2.request;
3060
+ _context2.next = 8;
3061
+ return this.wallet.writeContract(call);
3062
+ case 8:
3063
+ txHash = _context2.sent;
3064
+ if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
3065
+ _context2.next = 12;
3066
+ break;
3067
+ }
3068
+ _context2.next = 12;
3069
+ return waitTx(this.rpcClient, txHash);
3070
+ case 12:
3071
+ return _context2.abrupt("return", {
3072
+ txHash: txHash
3073
+ });
3074
+ case 15:
3075
+ _context2.prev = 15;
3076
+ _context2.t0 = _context2["catch"](0);
3077
+ handleError(_context2.t0, "Failed to execute with signature for the IP Account transaction");
3078
+ case 18:
3079
+ case "end":
3080
+ return _context2.stop();
3081
+ }
3082
+ }, _callee2, this, [[0, 15]]);
3083
+ }));
3084
+ function executeWithSig(_x2) {
3085
+ return _executeWithSig.apply(this, arguments);
3086
+ }
3087
+ return executeWithSig;
3066
3088
  }()
3067
3089
  }]);
3068
- return PlatformClient;
3090
+ return IPAccountClient;
3091
+ }();
3092
+
3093
+ var StoryAPIClient = /*#__PURE__*/function () {
3094
+ function StoryAPIClient() {
3095
+ _classCallCheck(this, StoryAPIClient);
3096
+ this.httpClient = axios.create({
3097
+ baseURL: "https://api.storyprotocol.net",
3098
+ timeout: 60000,
3099
+ headers: {
3100
+ "x-api-key": "U3RvcnlQcm90b2NvbFRlc3RBUElLRVk="
3101
+ }
3102
+ });
3103
+ }
3104
+ _createClass(StoryAPIClient, [{
3105
+ key: "getRoyaltyPolicy",
3106
+ value: function () {
3107
+ var _getRoyaltyPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(ipId) {
3108
+ var royaltyPolicyResp;
3109
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3110
+ while (1) switch (_context.prev = _context.next) {
3111
+ case 0:
3112
+ _context.next = 2;
3113
+ return this.httpClient.get("/api/v1/royalties/policies/".concat(ipId));
3114
+ case 2:
3115
+ royaltyPolicyResp = _context.sent;
3116
+ return _context.abrupt("return", royaltyPolicyResp.data.data);
3117
+ case 4:
3118
+ case "end":
3119
+ return _context.stop();
3120
+ }
3121
+ }, _callee, this);
3122
+ }));
3123
+ function getRoyaltyPolicy(_x) {
3124
+ return _getRoyaltyPolicy.apply(this, arguments);
3125
+ }
3126
+ return getRoyaltyPolicy;
3127
+ }()
3128
+ }, {
3129
+ key: "getLicense",
3130
+ value: function () {
3131
+ var _getLicense = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(licenseId) {
3132
+ var licenseResp;
3133
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3134
+ while (1) switch (_context2.prev = _context2.next) {
3135
+ case 0:
3136
+ _context2.next = 2;
3137
+ return this.httpClient.get("/api/v1/licenses/".concat(licenseId));
3138
+ case 2:
3139
+ licenseResp = _context2.sent;
3140
+ return _context2.abrupt("return", licenseResp.data.data);
3141
+ case 4:
3142
+ case "end":
3143
+ return _context2.stop();
3144
+ }
3145
+ }, _callee2, this);
3146
+ }));
3147
+ function getLicense(_x2) {
3148
+ return _getLicense.apply(this, arguments);
3149
+ }
3150
+ return getLicense;
3151
+ }()
3152
+ }, {
3153
+ key: "getPolicy",
3154
+ value: function () {
3155
+ var _getPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(policyId) {
3156
+ var policyResp;
3157
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
3158
+ while (1) switch (_context3.prev = _context3.next) {
3159
+ case 0:
3160
+ _context3.next = 2;
3161
+ return this.httpClient.get("/api/v1/policies/".concat(policyId));
3162
+ case 2:
3163
+ policyResp = _context3.sent;
3164
+ return _context3.abrupt("return", policyResp.data.data);
3165
+ case 4:
3166
+ case "end":
3167
+ return _context3.stop();
3168
+ }
3169
+ }, _callee3, this);
3170
+ }));
3171
+ function getPolicy(_x3) {
3172
+ return _getPolicy.apply(this, arguments);
3173
+ }
3174
+ return getPolicy;
3175
+ }()
3176
+ }]);
3177
+ return StoryAPIClient;
3069
3178
  }();
3070
3179
 
3071
3180
  if (typeof process !== "undefined") {
@@ -3080,29 +3189,22 @@ var StoryClient = /*#__PURE__*/function () {
3080
3189
  */
3081
3190
  function StoryClient(config) {
3082
3191
  _classCallCheck(this, StoryClient);
3083
- _defineProperty(this, "_ipAccount", null);
3192
+ _defineProperty(this, "_ipAsset", null);
3084
3193
  _defineProperty(this, "_permission", null);
3085
3194
  _defineProperty(this, "_license", null);
3086
3195
  _defineProperty(this, "_policy", null);
3087
- _defineProperty(this, "_platform", null);
3088
- _defineProperty(this, "_tagging", null);
3089
3196
  _defineProperty(this, "_dispute", null);
3197
+ _defineProperty(this, "_ipAccount", null);
3090
3198
  this.config = config;
3091
3199
  if (!this.config.transport) {
3092
3200
  throw new Error("transport is null, please pass in a valid RPC Provider URL as the transport.");
3093
3201
  }
3094
- this.httpClient = axios.create({
3095
- baseURL: "https://stag.api.storyprotocol.net",
3096
- timeout: 5000,
3097
- headers: {
3098
- version: "v0-alpha"
3099
- }
3100
- });
3101
3202
  var clientConfig = {
3102
3203
  chain: chainStringToViemChain(this.config.chainId || "sepolia"),
3103
3204
  transport: this.config.transport
3104
3205
  };
3105
3206
  this.rpcClient = createPublicClient(clientConfig);
3207
+ this.storyClient = new StoryAPIClient();
3106
3208
  var account = this.config.account;
3107
3209
  if (!account) {
3108
3210
  throw new Error("account is null");
@@ -3119,12 +3221,26 @@ var StoryClient = /*#__PURE__*/function () {
3119
3221
  */
3120
3222
  _createClass(StoryClient, [{
3121
3223
  key: "ipAsset",
3122
- get: function get() {
3123
- if (this._ipAccount === null) {
3124
- this._ipAccount = new IPAssetClient(this.rpcClient, this.wallet);
3224
+ get:
3225
+ /**
3226
+ * Getter for the ip asset client. The client is lazily created when
3227
+ * this method is called.
3228
+ *
3229
+ * @returns the IPAssetClient instance
3230
+ */
3231
+ function get() {
3232
+ if (this._ipAsset === null) {
3233
+ this._ipAsset = new IPAssetClient(this.rpcClient, this.wallet, this.storyClient);
3125
3234
  }
3126
- return this._ipAccount;
3235
+ return this._ipAsset;
3127
3236
  }
3237
+
3238
+ /**
3239
+ * Getter for the permission client. The client is lazily created when
3240
+ * this method is called.
3241
+ *
3242
+ * @returns the PermissionClient instance
3243
+ */
3128
3244
  }, {
3129
3245
  key: "permission",
3130
3246
  get: function get() {
@@ -3133,36 +3249,35 @@ var StoryClient = /*#__PURE__*/function () {
3133
3249
  }
3134
3250
  return this._permission;
3135
3251
  }
3252
+
3253
+ /**
3254
+ * Getter for the license client. The client is lazily created when
3255
+ * this method is called.
3256
+ *
3257
+ * @returns the LicenseClient instance
3258
+ */
3136
3259
  }, {
3137
3260
  key: "license",
3138
3261
  get: function get() {
3139
3262
  if (this._license === null) {
3140
- this._license = new LicenseClient(this.rpcClient, this.wallet);
3263
+ this._license = new LicenseClient(this.rpcClient, this.wallet, this.storyClient);
3141
3264
  }
3142
3265
  return this._license;
3143
3266
  }
3144
- }, {
3145
- key: "policy",
3146
- get: function get() {
3147
- if (this._policy === null) {
3148
- this._policy = new PolicyClient(this.rpcClient, this.wallet);
3149
- }
3150
- return this._policy;
3151
- }
3152
3267
 
3153
3268
  /**
3154
- * Getter for the tagging client. The client is lazily created when
3269
+ * Getter for the policy client. The client is lazily created when
3155
3270
  * this method is called.
3156
3271
  *
3157
- * @returns the TaggingClient instance
3272
+ * @returns the PolicyClient instance
3158
3273
  */
3159
3274
  }, {
3160
- key: "tagging",
3275
+ key: "policy",
3161
3276
  get: function get() {
3162
- if (this._tagging === null) {
3163
- this._tagging = new TaggingClient(this.rpcClient, this.wallet);
3277
+ if (this._policy === null) {
3278
+ this._policy = new PolicyClient(this.rpcClient, this.wallet);
3164
3279
  }
3165
- return this._tagging;
3280
+ return this._policy;
3166
3281
  }
3167
3282
 
3168
3283
  /**
@@ -3181,18 +3296,18 @@ var StoryClient = /*#__PURE__*/function () {
3181
3296
  }
3182
3297
 
3183
3298
  /**
3184
- * Getter for the platform client. The client is lazily created when
3299
+ * Getter for the ip account client. The client is lazily created when
3185
3300
  * this method is called.
3186
3301
  *
3187
- * @returns the PlatformClient instance
3302
+ * @returns the IPAccountClient instance
3188
3303
  */
3189
3304
  }, {
3190
- key: "platform",
3305
+ key: "ipAccount",
3191
3306
  get: function get() {
3192
- if (this._platform === null) {
3193
- this._platform = new PlatformClient(this.httpClient);
3307
+ if (this._ipAccount === null) {
3308
+ this._ipAccount = new IPAccountClient(this.rpcClient, this.wallet);
3194
3309
  }
3195
- return this._platform;
3310
+ return this._ipAccount;
3196
3311
  }
3197
3312
  }], [{
3198
3313
  key: "newClient",
@@ -3203,4 +3318,4 @@ var StoryClient = /*#__PURE__*/function () {
3203
3318
  return StoryClient;
3204
3319
  }();
3205
3320
 
3206
- export { AddressZero, DisputeClient, HashZero, IPAssetClient, LicenseClient, PermissionClient, PlatformClient, PolicyClient, StoryClient, TaggingClient };
3321
+ export { AddressZero, DisputeClient, HashZero, IPAssetClient, LicenseClient, PermissionClient, PolicyClient, StoryClient };