@story-protocol/core-sdk 0.0.1-beta-rc.5 → 0.0.1-beta-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -43
- package/dist/declarations/src/constants/common.d.ts +1 -0
- package/dist/declarations/src/constants/common.d.ts.map +1 -1
- package/dist/declarations/src/resources/dispute.d.ts +0 -20
- package/dist/declarations/src/resources/dispute.d.ts.map +1 -1
- package/dist/declarations/src/resources/ipAccount.d.ts +0 -20
- package/dist/declarations/src/resources/ipAccount.d.ts.map +1 -1
- package/dist/declarations/src/resources/ipAsset.d.ts +52 -21
- package/dist/declarations/src/resources/ipAsset.d.ts.map +1 -1
- package/dist/declarations/src/resources/license.d.ts +43 -40
- package/dist/declarations/src/resources/license.d.ts.map +1 -1
- package/dist/declarations/src/resources/permission.d.ts +1 -41
- package/dist/declarations/src/resources/permission.d.ts.map +1 -1
- package/dist/declarations/src/resources/policy.d.ts +99 -82
- package/dist/declarations/src/resources/policy.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/ipAsset.d.ts +4 -4
- package/dist/declarations/src/types/resources/ipAsset.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/permission.d.ts +1 -1
- package/dist/declarations/src/types/resources/permission.d.ts.map +1 -1
- package/dist/declarations/src/types/resources/policy.d.ts +39 -1
- package/dist/declarations/src/types/resources/policy.d.ts.map +1 -1
- package/dist/story-protocol-core-sdk.cjs.dev.js +551 -114
- package/dist/story-protocol-core-sdk.cjs.prod.js +551 -114
- package/dist/story-protocol-core-sdk.esm.js +552 -115
- package/package.json +1 -1
@@ -449,6 +449,7 @@ function handleError(error, msg) {
|
|
449
449
|
|
450
450
|
var AddressZero = "0x0000000000000000000000000000000000000000";
|
451
451
|
var HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
452
|
+
var SepoliaChainId = "11155111";
|
452
453
|
|
453
454
|
function _arrayLikeToArray(arr, len) {
|
454
455
|
if (len == null || len > arr.length) len = arr.length;
|
@@ -821,6 +822,42 @@ var IPAssetRegistryABI = [{
|
|
821
822
|
}],
|
822
823
|
name: "IPRegistered",
|
823
824
|
type: "event"
|
825
|
+
}, {
|
826
|
+
inputs: [{
|
827
|
+
internalType: "uint256",
|
828
|
+
name: "chainId",
|
829
|
+
type: "uint256"
|
830
|
+
}, {
|
831
|
+
internalType: "address",
|
832
|
+
name: "tokenContract",
|
833
|
+
type: "address"
|
834
|
+
}, {
|
835
|
+
internalType: "uint256",
|
836
|
+
name: "tokenId",
|
837
|
+
type: "uint256"
|
838
|
+
}],
|
839
|
+
name: "ipId",
|
840
|
+
outputs: [{
|
841
|
+
internalType: "address",
|
842
|
+
name: "",
|
843
|
+
type: "address"
|
844
|
+
}],
|
845
|
+
stateMutability: "view",
|
846
|
+
type: "function"
|
847
|
+
}, {
|
848
|
+
inputs: [{
|
849
|
+
internalType: "address",
|
850
|
+
name: "id",
|
851
|
+
type: "address"
|
852
|
+
}],
|
853
|
+
name: "isRegistered",
|
854
|
+
outputs: [{
|
855
|
+
internalType: "bool",
|
856
|
+
name: "",
|
857
|
+
type: "bool"
|
858
|
+
}],
|
859
|
+
stateMutability: "view",
|
860
|
+
type: "function"
|
824
861
|
}];
|
825
862
|
|
826
863
|
var LicensingModuleABI = [{
|
@@ -931,6 +968,49 @@ var LicensingModuleABI = [{
|
|
931
968
|
}],
|
932
969
|
stateMutability: "nonpayable",
|
933
970
|
type: "function"
|
971
|
+
}, {
|
972
|
+
inputs: [{
|
973
|
+
components: [{
|
974
|
+
internalType: "bool",
|
975
|
+
name: "isLicenseTransferable",
|
976
|
+
type: "bool"
|
977
|
+
}, {
|
978
|
+
internalType: "address",
|
979
|
+
name: "policyFramework",
|
980
|
+
type: "address"
|
981
|
+
}, {
|
982
|
+
internalType: "bytes",
|
983
|
+
name: "frameworkData",
|
984
|
+
type: "bytes"
|
985
|
+
}, {
|
986
|
+
internalType: "address",
|
987
|
+
name: "royaltyPolicy",
|
988
|
+
type: "address"
|
989
|
+
}, {
|
990
|
+
internalType: "bytes",
|
991
|
+
name: "royaltyData",
|
992
|
+
type: "bytes"
|
993
|
+
}, {
|
994
|
+
internalType: "uint256",
|
995
|
+
name: "mintingFee",
|
996
|
+
type: "uint256"
|
997
|
+
}, {
|
998
|
+
internalType: "address",
|
999
|
+
name: "mintingFeeToken",
|
1000
|
+
type: "address"
|
1001
|
+
}],
|
1002
|
+
internalType: "struct Licensing.Policy",
|
1003
|
+
name: "pol",
|
1004
|
+
type: "tuple"
|
1005
|
+
}],
|
1006
|
+
name: "getPolicyId",
|
1007
|
+
outputs: [{
|
1008
|
+
internalType: "uint256",
|
1009
|
+
name: "policyId",
|
1010
|
+
type: "uint256"
|
1011
|
+
}],
|
1012
|
+
stateMutability: "view",
|
1013
|
+
type: "function"
|
934
1014
|
}, {
|
935
1015
|
inputs: [{
|
936
1016
|
internalType: "uint256[]",
|
@@ -1832,50 +1912,31 @@ var ErrorsABI = [{
|
|
1832
1912
|
inputs: [],
|
1833
1913
|
name: "RoyaltyPolicyLAP__ZeroRoyaltyModule",
|
1834
1914
|
type: "error"
|
1835
|
-
}, {
|
1836
|
-
inputs: [],
|
1837
|
-
name: "TaggingModule__DstIpIdDoesNotHaveDstTag",
|
1838
|
-
type: "error"
|
1839
|
-
}, {
|
1840
|
-
inputs: [],
|
1841
|
-
name: "TaggingModule__InvalidRelationTypeName",
|
1842
|
-
type: "error"
|
1843
|
-
}, {
|
1844
|
-
inputs: [],
|
1845
|
-
name: "TaggingModule__RelationTypeAlreadyExists",
|
1846
|
-
type: "error"
|
1847
|
-
}, {
|
1848
|
-
inputs: [],
|
1849
|
-
name: "TaggingModule__RelationTypeDoesNotExist",
|
1850
|
-
type: "error"
|
1851
|
-
}, {
|
1852
|
-
inputs: [],
|
1853
|
-
name: "TaggingModule__SrcIpIdDoesNotHaveSrcTag",
|
1854
|
-
type: "error"
|
1855
1915
|
}];
|
1856
1916
|
|
1857
1917
|
var sepolia = {
|
1858
|
-
AccessController: "
|
1859
|
-
AncestorsVaultLAP: "
|
1860
|
-
ArbitrationPolicySP: "
|
1861
|
-
DisputeModule: "
|
1862
|
-
Governance: "
|
1863
|
-
IPAccountImpl: "
|
1864
|
-
IPAccountRegistry: "
|
1865
|
-
IPAssetRegistry: "
|
1866
|
-
IPAssetRenderer: "
|
1867
|
-
IPMetadataProvider: "
|
1868
|
-
IPResolver: "
|
1869
|
-
LicenseRegistry: "
|
1870
|
-
LicensingModule: "
|
1871
|
-
MockERC20: "
|
1872
|
-
MockERC721: "
|
1873
|
-
MockTokenGatedHook: "
|
1874
|
-
ModuleRegistry: "
|
1875
|
-
PILPolicyFrameworkManager: "
|
1876
|
-
RegistrationModule: "
|
1877
|
-
RoyaltyModule: "
|
1878
|
-
RoyaltyPolicyLAP: "
|
1918
|
+
AccessController: "0x8eB53745795E2107E3568c647A77a7294C89Ef31",
|
1919
|
+
AncestorsVaultLAP: "0x7FD793C4914da052022524BA17508976733B09AA",
|
1920
|
+
ArbitrationPolicySP: "0xFfE389378AFa13D91485182D72700d226Cb0db16",
|
1921
|
+
DisputeModule: "0xe94d7198EF5657C15be755aC3D9cb386F2Db50Bd",
|
1922
|
+
Governance: "0x14Ac96796aadef6053e993aBDc3C1e7830ede901",
|
1923
|
+
IPAccountImpl: "0xec3F947902fac41e59aa25669Fe39997BFA1357c",
|
1924
|
+
IPAccountRegistry: "0xfe3ef84acECAd1F91583CB09E62953669C1c2bb5",
|
1925
|
+
IPAssetRegistry: "0xA3a77482C64e91d4C89114D83Bd51457132ea947",
|
1926
|
+
IPAssetRenderer: "0xF36c279a61b32D39e5Bc25e317f779362Be07E1d",
|
1927
|
+
IPMetadataProvider: "0x40D52438C3852A872c71eB3a8b81d6274C5b6274",
|
1928
|
+
IPResolver: "0x8BcE3019dBe94402A0276A2630373CDDB67fe271",
|
1929
|
+
LicenseRegistry: "0x176d33Cc80ed3390256033bbf7Fd651c9C5A364F",
|
1930
|
+
LicensingModule: "0x9CDDD88Dd34429a0F39eaDf91a56D1bf0533E72B",
|
1931
|
+
MockERC20: "0x1219A0E87e617E6560104fA11cfd4f01FeB47362",
|
1932
|
+
MockERC721: "0x9d790FF5B6A7469f32f18E677E15D48b86C6839b",
|
1933
|
+
MockTokenGatedHook: "0x25018B7521E7607A7101302401bE81eDCA2E9730",
|
1934
|
+
ModuleRegistry: "0x6E09516f10a4094b9B9A8C2b7Aa611A2D7827d3F",
|
1935
|
+
PILPolicyFrameworkManager: "0x50c3bCAA67D4eC3f285E4328451315Ab0D9e539f",
|
1936
|
+
RegistrationModule: "0x8b3f6b736b520F69c37a575293D3c1ff6383D495",
|
1937
|
+
RoyaltyModule: "0x833774B42357939B4c96e1bCF5cE26e815AE3Ae6",
|
1938
|
+
RoyaltyPolicyLAP: "0xda483fd6e6ecA1C2D913802F9a6B57a83b73029f",
|
1939
|
+
TokenWithdrawalModule: "0x01469702E71F5C8199A15a97e8147D002C60a0B9"
|
1879
1940
|
};
|
1880
1941
|
|
1881
1942
|
var IPAccountABI = [].concat(_toConsumableArray(IPAccountImplABI), _toConsumableArray(ErrorsABI));
|
@@ -1907,6 +1968,9 @@ var PILPolicyFrameworkManagerConfig = {
|
|
1907
1968
|
abi: [].concat(_toConsumableArray(PILPolicyFrameworkManagerABI), _toConsumableArray(ErrorsABI)),
|
1908
1969
|
address: viem.getAddress(sepolia.PILPolicyFrameworkManager)
|
1909
1970
|
};
|
1971
|
+
var RoyaltyPolicyLAPConfig = {
|
1972
|
+
address: viem.getAddress(sepolia.RoyaltyPolicyLAP)
|
1973
|
+
};
|
1910
1974
|
|
1911
1975
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
1912
1976
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
@@ -2175,12 +2239,24 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
2175
2239
|
key: "registerRootIp",
|
2176
2240
|
value: function () {
|
2177
2241
|
var _registerRootIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
2178
|
-
var _request$txOptions, _yield$this$rpcClient, call, txHash, targetLog;
|
2242
|
+
var _request$txOptions, ipId, _yield$this$rpcClient, call, txHash, targetLog;
|
2179
2243
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
2180
2244
|
while (1) switch (_context.prev = _context.next) {
|
2181
2245
|
case 0:
|
2182
2246
|
_context.prev = 0;
|
2183
2247
|
_context.next = 3;
|
2248
|
+
return this.isNFTRegistered(SepoliaChainId, request.tokenContractAddress, request.tokenId);
|
2249
|
+
case 3:
|
2250
|
+
ipId = _context.sent;
|
2251
|
+
if (!ipId) {
|
2252
|
+
_context.next = 6;
|
2253
|
+
break;
|
2254
|
+
}
|
2255
|
+
return _context.abrupt("return", {
|
2256
|
+
ipId: ipId
|
2257
|
+
});
|
2258
|
+
case 6:
|
2259
|
+
_context.next = 8;
|
2184
2260
|
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.registrationModuleConfig), {}, {
|
2185
2261
|
functionName: "registerRootIp",
|
2186
2262
|
args: [parseToBigInt(request.policyId || "0"), viem.getAddress(request.tokenContractAddress),
|
@@ -2188,43 +2264,43 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
2188
2264
|
parseToBigInt(request.tokenId), request.ipName || "", request.contentHash || HashZero, request.uri || ""],
|
2189
2265
|
account: this.wallet.account
|
2190
2266
|
}));
|
2191
|
-
case
|
2267
|
+
case 8:
|
2192
2268
|
_yield$this$rpcClient = _context.sent;
|
2193
2269
|
call = _yield$this$rpcClient.request;
|
2194
|
-
_context.next =
|
2270
|
+
_context.next = 12;
|
2195
2271
|
return this.wallet.writeContract(call);
|
2196
|
-
case
|
2272
|
+
case 12:
|
2197
2273
|
txHash = _context.sent;
|
2198
2274
|
if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
|
2199
|
-
_context.next =
|
2275
|
+
_context.next = 20;
|
2200
2276
|
break;
|
2201
2277
|
}
|
2202
|
-
_context.next =
|
2278
|
+
_context.next = 16;
|
2203
2279
|
return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
|
2204
2280
|
eventName: "IPRegistered"
|
2205
2281
|
}));
|
2206
|
-
case
|
2282
|
+
case 16:
|
2207
2283
|
targetLog = _context.sent;
|
2208
2284
|
return _context.abrupt("return", {
|
2209
2285
|
txHash: txHash,
|
2210
2286
|
ipId: targetLog.args.ipId
|
2211
2287
|
});
|
2212
|
-
case
|
2288
|
+
case 20:
|
2213
2289
|
return _context.abrupt("return", {
|
2214
2290
|
txHash: txHash
|
2215
2291
|
});
|
2216
|
-
case
|
2217
|
-
_context.next =
|
2292
|
+
case 21:
|
2293
|
+
_context.next = 26;
|
2218
2294
|
break;
|
2219
|
-
case
|
2220
|
-
_context.prev =
|
2295
|
+
case 23:
|
2296
|
+
_context.prev = 23;
|
2221
2297
|
_context.t0 = _context["catch"](0);
|
2222
2298
|
handleError(_context.t0, "Failed to register root IP");
|
2223
|
-
case
|
2299
|
+
case 26:
|
2224
2300
|
case "end":
|
2225
2301
|
return _context.stop();
|
2226
2302
|
}
|
2227
|
-
}, _callee, this, [[0,
|
2303
|
+
}, _callee, this, [[0, 23]]);
|
2228
2304
|
}));
|
2229
2305
|
function registerRootIp(_x) {
|
2230
2306
|
return _registerRootIp.apply(this, arguments);
|
@@ -2250,20 +2326,32 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
2250
2326
|
key: "registerDerivativeIp",
|
2251
2327
|
value: function () {
|
2252
2328
|
var _registerDerivativeIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
|
2253
|
-
var _request$txOptions2, licenseIds, royaltyContext, _yield$this$rpcClient2, call, txHash, targetLog;
|
2329
|
+
var _request$txOptions2, ipId, licenseIds, royaltyContext, _yield$this$rpcClient2, call, txHash, targetLog;
|
2254
2330
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
2255
2331
|
while (1) switch (_context2.prev = _context2.next) {
|
2256
2332
|
case 0:
|
2257
2333
|
_context2.prev = 0;
|
2334
|
+
_context2.next = 3;
|
2335
|
+
return this.isNFTRegistered(SepoliaChainId, request.tokenContractAddress, request.tokenId);
|
2336
|
+
case 3:
|
2337
|
+
ipId = _context2.sent;
|
2338
|
+
if (!(ipId !== "0x")) {
|
2339
|
+
_context2.next = 6;
|
2340
|
+
break;
|
2341
|
+
}
|
2342
|
+
return _context2.abrupt("return", {
|
2343
|
+
ipId: ipId
|
2344
|
+
});
|
2345
|
+
case 6:
|
2258
2346
|
licenseIds = [];
|
2259
2347
|
request.licenseIds.forEach(function (licenseId) {
|
2260
2348
|
licenseIds.push(parseToBigInt(licenseId));
|
2261
2349
|
});
|
2262
|
-
_context2.next =
|
2350
|
+
_context2.next = 10;
|
2263
2351
|
return computeRoyaltyContext(request.licenseIds, this.storyClient);
|
2264
|
-
case
|
2352
|
+
case 10:
|
2265
2353
|
royaltyContext = _context2.sent;
|
2266
|
-
_context2.next =
|
2354
|
+
_context2.next = 13;
|
2267
2355
|
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.registrationModuleConfig), {}, {
|
2268
2356
|
functionName: "registerDerivativeIp",
|
2269
2357
|
args: [licenseIds, viem.getAddress(request.tokenContractAddress),
|
@@ -2271,49 +2359,83 @@ var IPAssetClient = /*#__PURE__*/function () {
|
|
2271
2359
|
parseToBigInt(request.tokenId), request.ipName || "", request.contentHash || HashZero, request.uri || "", encodeRoyaltyContext(royaltyContext)],
|
2272
2360
|
account: this.wallet.account
|
2273
2361
|
}));
|
2274
|
-
case
|
2362
|
+
case 13:
|
2275
2363
|
_yield$this$rpcClient2 = _context2.sent;
|
2276
2364
|
call = _yield$this$rpcClient2.request;
|
2277
|
-
_context2.next =
|
2365
|
+
_context2.next = 17;
|
2278
2366
|
return this.wallet.writeContract(call);
|
2279
|
-
case
|
2367
|
+
case 17:
|
2280
2368
|
txHash = _context2.sent;
|
2281
2369
|
if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
|
2282
|
-
_context2.next =
|
2370
|
+
_context2.next = 25;
|
2283
2371
|
break;
|
2284
2372
|
}
|
2285
|
-
_context2.next =
|
2373
|
+
_context2.next = 21;
|
2286
2374
|
return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
|
2287
2375
|
eventName: "IPRegistered"
|
2288
2376
|
}));
|
2289
|
-
case
|
2377
|
+
case 21:
|
2290
2378
|
targetLog = _context2.sent;
|
2291
2379
|
return _context2.abrupt("return", {
|
2292
2380
|
txHash: txHash,
|
2293
2381
|
ipId: targetLog.args.ipId
|
2294
2382
|
});
|
2295
|
-
case
|
2383
|
+
case 25:
|
2296
2384
|
return _context2.abrupt("return", {
|
2297
2385
|
txHash: txHash
|
2298
2386
|
});
|
2299
|
-
case
|
2300
|
-
_context2.next =
|
2387
|
+
case 26:
|
2388
|
+
_context2.next = 31;
|
2301
2389
|
break;
|
2302
|
-
case
|
2303
|
-
_context2.prev =
|
2390
|
+
case 28:
|
2391
|
+
_context2.prev = 28;
|
2304
2392
|
_context2.t0 = _context2["catch"](0);
|
2305
2393
|
handleError(_context2.t0, "Failed to register derivative IP");
|
2306
|
-
case
|
2394
|
+
case 31:
|
2307
2395
|
case "end":
|
2308
2396
|
return _context2.stop();
|
2309
2397
|
}
|
2310
|
-
}, _callee2, this, [[0,
|
2398
|
+
}, _callee2, this, [[0, 28]]);
|
2311
2399
|
}));
|
2312
2400
|
function registerDerivativeIp(_x2) {
|
2313
2401
|
return _registerDerivativeIp.apply(this, arguments);
|
2314
2402
|
}
|
2315
2403
|
return registerDerivativeIp;
|
2316
2404
|
}()
|
2405
|
+
}, {
|
2406
|
+
key: "isNFTRegistered",
|
2407
|
+
value: function () {
|
2408
|
+
var _isNFTRegistered = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(chainId, tokenAddress, tokenId) {
|
2409
|
+
var ipId, isRegistered;
|
2410
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
2411
|
+
while (1) switch (_context3.prev = _context3.next) {
|
2412
|
+
case 0:
|
2413
|
+
_context3.next = 2;
|
2414
|
+
return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
|
2415
|
+
functionName: "ipId",
|
2416
|
+
args: [parseToBigInt(chainId), tokenAddress, parseToBigInt(tokenId)]
|
2417
|
+
}));
|
2418
|
+
case 2:
|
2419
|
+
ipId = _context3.sent;
|
2420
|
+
_context3.next = 5;
|
2421
|
+
return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.ipAssetRegistryConfig), {}, {
|
2422
|
+
functionName: "isRegistered",
|
2423
|
+
args: [ipId]
|
2424
|
+
}));
|
2425
|
+
case 5:
|
2426
|
+
isRegistered = _context3.sent;
|
2427
|
+
return _context3.abrupt("return", isRegistered ? ipId : "0x");
|
2428
|
+
case 7:
|
2429
|
+
case "end":
|
2430
|
+
return _context3.stop();
|
2431
|
+
}
|
2432
|
+
}, _callee3, this);
|
2433
|
+
}));
|
2434
|
+
function isNFTRegistered(_x3, _x4, _x5) {
|
2435
|
+
return _isNFTRegistered.apply(this, arguments);
|
2436
|
+
}
|
2437
|
+
return isNFTRegistered;
|
2438
|
+
}()
|
2317
2439
|
}]);
|
2318
2440
|
return IPAssetClient;
|
2319
2441
|
}();
|
@@ -2341,7 +2463,7 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
2341
2463
|
* @param request.ipAsset The address of the IP account that grants the permission for `signer`
|
2342
2464
|
* @param request.signer The address that can call `to` on behalf of the `ipAccount`
|
2343
2465
|
* @param request.to The address that can be called by the `signer` (currently only modules can be `to`)
|
2344
|
-
* @param request.func The function selector string of `to` that can be called by the `signer` on behalf of the `ipAccount
|
2466
|
+
* @param request.func Optional. The function selector string of `to` that can be called by the `signer` on behalf of the `ipAccount`. Be default, it allows all functions.
|
2345
2467
|
* @param request.permission The new permission level
|
2346
2468
|
* @returns A Promise that resolves to an object containing the transaction hash
|
2347
2469
|
* @emits PermissionSet (ipAccountOwner, ipAccount, signer, to, func, permission)
|
@@ -2371,7 +2493,7 @@ var PermissionClient = /*#__PURE__*/function () {
|
|
2371
2493
|
// 0x Address
|
2372
2494
|
viem.getAddress(request.to),
|
2373
2495
|
// 0x Address
|
2374
|
-
request.func,
|
2496
|
+
request.func || "0x00000000",
|
2375
2497
|
// bytes4
|
2376
2498
|
request.permission // uint8
|
2377
2499
|
]
|
@@ -2608,6 +2730,7 @@ var PolicyClient = /*#__PURE__*/function () {
|
|
2608
2730
|
_defineProperty(this, "ipAccountABI", IPAccountABI);
|
2609
2731
|
_defineProperty(this, "licensingModuleConfig", LicensingModuleConfig);
|
2610
2732
|
_defineProperty(this, "pilPolicyFrameworkManagerConfig", PILPolicyFrameworkManagerConfig);
|
2733
|
+
_defineProperty(this, "royaltyPolicyLAPConfig", RoyaltyPolicyLAPConfig);
|
2611
2734
|
this.wallet = wallet;
|
2612
2735
|
this.rpcClient = rpcClient;
|
2613
2736
|
}
|
@@ -2635,18 +2758,49 @@ var PolicyClient = /*#__PURE__*/function () {
|
|
2635
2758
|
key: "registerPILPolicy",
|
2636
2759
|
value: function () {
|
2637
2760
|
var _registerPILPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
2638
|
-
var _request$txOptions, _yield$this$rpcClient, call, txHash, targetLog;
|
2761
|
+
var _request$txOptions, frameworkData, policyId, _yield$this$rpcClient, call, txHash, targetLog;
|
2639
2762
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
2640
2763
|
while (1) switch (_context.prev = _context.next) {
|
2641
2764
|
case 0:
|
2642
2765
|
_context.prev = 0;
|
2643
|
-
|
2766
|
+
// First check if the policy exists
|
2767
|
+
frameworkData = {
|
2768
|
+
attribution: request.attribution || false,
|
2769
|
+
commercialUse: request.commercialUse || false,
|
2770
|
+
commercialAttribution: request.commercialAttribution || false,
|
2771
|
+
commercializerChecker: request.commercializerChecker || viem.zeroAddress,
|
2772
|
+
commercializerCheckerData: request.commercializerCheckerData || "0x",
|
2773
|
+
commercialRevShare: request.commercialRevShare || 0,
|
2774
|
+
derivativesAllowed: request.derivativesAllowed || false,
|
2775
|
+
derivativesAttribution: request.derivativesAttribution || false,
|
2776
|
+
derivativesApproval: request.derivativesApproval || false,
|
2777
|
+
derivativesReciprocal: request.derivativesReciprocal || false,
|
2778
|
+
territories: request.territories || [],
|
2779
|
+
distributionChannels: request.distributionChannels || [],
|
2780
|
+
contentRestrictions: request.contentRestrictions || []
|
2781
|
+
};
|
2782
|
+
_context.next = 4;
|
2783
|
+
return this.getPolicyId(request.transferable, this.encodeFrameworkData(frameworkData), typedDataToBytes({
|
2784
|
+
"interface": "uint32",
|
2785
|
+
data: [request.commercialRevShare || 0]
|
2786
|
+
}), request.mintingFee || "0", request.mintingFeeToken || viem.zeroAddress, request.royaltyPolicy || viem.zeroAddress);
|
2787
|
+
case 4:
|
2788
|
+
policyId = _context.sent;
|
2789
|
+
if (!(policyId !== 0)) {
|
2790
|
+
_context.next = 7;
|
2791
|
+
break;
|
2792
|
+
}
|
2793
|
+
return _context.abrupt("return", {
|
2794
|
+
policyId: policyId.toString()
|
2795
|
+
});
|
2796
|
+
case 7:
|
2797
|
+
_context.next = 9;
|
2644
2798
|
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.pilPolicyFrameworkManagerConfig), {}, {
|
2645
2799
|
functionName: "registerPolicy",
|
2646
2800
|
args: [{
|
2647
2801
|
transferable: request.transferable,
|
2648
2802
|
royaltyPolicy: request.royaltyPolicy || viem.zeroAddress,
|
2649
|
-
mintingFee: parseToBigInt(request.mintingFee || 0),
|
2803
|
+
mintingFee: parseToBigInt(request.mintingFee || "0"),
|
2650
2804
|
mintingFeeToken: request.mintingFeeToken || viem.zeroAddress,
|
2651
2805
|
policy: {
|
2652
2806
|
attribution: request.attribution || false,
|
@@ -2654,7 +2808,7 @@ var PolicyClient = /*#__PURE__*/function () {
|
|
2654
2808
|
commercialAttribution: request.commercialAttribution || false,
|
2655
2809
|
commercialRevShare: request.commercialRevShare || 0,
|
2656
2810
|
derivativesAllowed: request.derivativesAllowed || false,
|
2657
|
-
derivativesAttribution: request.
|
2811
|
+
derivativesAttribution: request.derivativesAttribution || false,
|
2658
2812
|
derivativesApproval: request.derivativesApproval || false,
|
2659
2813
|
derivativesReciprocal: request.derivativesReciprocal || false,
|
2660
2814
|
commercializerChecker: request.commercializerChecker || viem.zeroAddress,
|
@@ -2666,49 +2820,332 @@ var PolicyClient = /*#__PURE__*/function () {
|
|
2666
2820
|
}],
|
2667
2821
|
account: this.wallet.account
|
2668
2822
|
}));
|
2669
|
-
case
|
2823
|
+
case 9:
|
2670
2824
|
_yield$this$rpcClient = _context.sent;
|
2671
2825
|
call = _yield$this$rpcClient.request;
|
2672
|
-
_context.next =
|
2826
|
+
_context.next = 13;
|
2673
2827
|
return this.wallet.writeContract(call);
|
2674
|
-
case
|
2828
|
+
case 13:
|
2675
2829
|
txHash = _context.sent;
|
2676
2830
|
if (!((_request$txOptions = request.txOptions) !== null && _request$txOptions !== void 0 && _request$txOptions.waitForTransaction)) {
|
2677
|
-
_context.next =
|
2831
|
+
_context.next = 21;
|
2678
2832
|
break;
|
2679
2833
|
}
|
2680
|
-
_context.next =
|
2834
|
+
_context.next = 17;
|
2681
2835
|
return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licensingModuleConfig), {}, {
|
2682
2836
|
eventName: "PolicyRegistered"
|
2683
2837
|
}));
|
2684
|
-
case
|
2838
|
+
case 17:
|
2685
2839
|
targetLog = _context.sent;
|
2686
2840
|
return _context.abrupt("return", {
|
2687
2841
|
txHash: txHash,
|
2688
2842
|
policyId: targetLog === null || targetLog === void 0 ? void 0 : targetLog.args.policyId.toString()
|
2689
2843
|
});
|
2690
|
-
case
|
2844
|
+
case 21:
|
2691
2845
|
return _context.abrupt("return", {
|
2692
2846
|
txHash: txHash
|
2693
2847
|
});
|
2694
|
-
case
|
2695
|
-
_context.next =
|
2848
|
+
case 22:
|
2849
|
+
_context.next = 27;
|
2696
2850
|
break;
|
2697
|
-
case
|
2698
|
-
_context.prev =
|
2851
|
+
case 24:
|
2852
|
+
_context.prev = 24;
|
2699
2853
|
_context.t0 = _context["catch"](0);
|
2700
2854
|
handleError(_context.t0, "Failed to register policy");
|
2701
|
-
case
|
2855
|
+
case 27:
|
2702
2856
|
case "end":
|
2703
2857
|
return _context.stop();
|
2704
2858
|
}
|
2705
|
-
}, _callee, this, [[0,
|
2859
|
+
}, _callee, this, [[0, 24]]);
|
2706
2860
|
}));
|
2707
2861
|
function registerPILPolicy(_x) {
|
2708
2862
|
return _registerPILPolicy.apply(this, arguments);
|
2709
2863
|
}
|
2710
2864
|
return registerPILPolicy;
|
2711
2865
|
}()
|
2866
|
+
/**
|
2867
|
+
* Convenient function to register a PIL social remix policy to the registry
|
2868
|
+
* Internally, this function must generate a Licensing.Policy struct and call registerPolicy.
|
2869
|
+
* @param request - the licensing parameters for the Programmable IP License v1 (PIL) standard.
|
2870
|
+
* @param request.territories List of territories where the license is valid. If empty, global.
|
2871
|
+
* @param request.distributionChannels List of distribution channels where the license is valid. Empty if no restrictions.
|
2872
|
+
* @param request.contentRestrictions List of content restrictions where the license is valid. Empty if no restrictions.
|
2873
|
+
* @returns the transaction hash and the policy ID if the txOptions.waitForTransaction is set to true
|
2874
|
+
*/
|
2875
|
+
}, {
|
2876
|
+
key: "registerPILSocialRemixPolicy",
|
2877
|
+
value: function () {
|
2878
|
+
var _registerPILSocialRemixPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request) {
|
2879
|
+
var _request$txOptions2, frameworkData, policyId, _yield$this$rpcClient2, call, txHash, targetLog;
|
2880
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
2881
|
+
while (1) switch (_context2.prev = _context2.next) {
|
2882
|
+
case 0:
|
2883
|
+
_context2.prev = 0;
|
2884
|
+
// First check if the policy exists
|
2885
|
+
frameworkData = {
|
2886
|
+
attribution: true,
|
2887
|
+
commercialUse: false,
|
2888
|
+
commercialAttribution: false,
|
2889
|
+
commercializerChecker: viem.zeroAddress,
|
2890
|
+
commercializerCheckerData: "0x",
|
2891
|
+
commercialRevShare: 0,
|
2892
|
+
derivativesAllowed: true,
|
2893
|
+
derivativesAttribution: true,
|
2894
|
+
derivativesApproval: false,
|
2895
|
+
derivativesReciprocal: true,
|
2896
|
+
territories: request.territories || [],
|
2897
|
+
distributionChannels: request.distributionChannels || [],
|
2898
|
+
contentRestrictions: request.contentRestrictions || []
|
2899
|
+
};
|
2900
|
+
_context2.next = 4;
|
2901
|
+
return this.getPolicyId(true, this.encodeFrameworkData(frameworkData), typedDataToBytes({
|
2902
|
+
"interface": "uint32",
|
2903
|
+
data: [0]
|
2904
|
+
}), "0", viem.zeroAddress, viem.zeroAddress);
|
2905
|
+
case 4:
|
2906
|
+
policyId = _context2.sent;
|
2907
|
+
if (!(policyId !== 0)) {
|
2908
|
+
_context2.next = 7;
|
2909
|
+
break;
|
2910
|
+
}
|
2911
|
+
return _context2.abrupt("return", {
|
2912
|
+
policyId: policyId.toString()
|
2913
|
+
});
|
2914
|
+
case 7:
|
2915
|
+
_context2.next = 9;
|
2916
|
+
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.pilPolicyFrameworkManagerConfig), {}, {
|
2917
|
+
functionName: "registerPolicy",
|
2918
|
+
args: [{
|
2919
|
+
transferable: true,
|
2920
|
+
royaltyPolicy: viem.zeroAddress,
|
2921
|
+
mintingFee: parseToBigInt(0),
|
2922
|
+
mintingFeeToken: viem.zeroAddress,
|
2923
|
+
policy: {
|
2924
|
+
attribution: true,
|
2925
|
+
commercialUse: false,
|
2926
|
+
commercialAttribution: false,
|
2927
|
+
commercialRevShare: 0,
|
2928
|
+
derivativesAllowed: true,
|
2929
|
+
derivativesAttribution: true,
|
2930
|
+
derivativesApproval: false,
|
2931
|
+
derivativesReciprocal: true,
|
2932
|
+
commercializerChecker: viem.zeroAddress,
|
2933
|
+
commercializerCheckerData: "0x",
|
2934
|
+
territories: request.territories || [],
|
2935
|
+
distributionChannels: request.distributionChannels || [],
|
2936
|
+
contentRestrictions: request.contentRestrictions || []
|
2937
|
+
}
|
2938
|
+
}],
|
2939
|
+
account: this.wallet.account
|
2940
|
+
}));
|
2941
|
+
case 9:
|
2942
|
+
_yield$this$rpcClient2 = _context2.sent;
|
2943
|
+
call = _yield$this$rpcClient2.request;
|
2944
|
+
_context2.next = 13;
|
2945
|
+
return this.wallet.writeContract(call);
|
2946
|
+
case 13:
|
2947
|
+
txHash = _context2.sent;
|
2948
|
+
if (!((_request$txOptions2 = request.txOptions) !== null && _request$txOptions2 !== void 0 && _request$txOptions2.waitForTransaction)) {
|
2949
|
+
_context2.next = 21;
|
2950
|
+
break;
|
2951
|
+
}
|
2952
|
+
_context2.next = 17;
|
2953
|
+
return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licensingModuleConfig), {}, {
|
2954
|
+
eventName: "PolicyRegistered"
|
2955
|
+
}));
|
2956
|
+
case 17:
|
2957
|
+
targetLog = _context2.sent;
|
2958
|
+
return _context2.abrupt("return", {
|
2959
|
+
txHash: txHash,
|
2960
|
+
policyId: targetLog === null || targetLog === void 0 ? void 0 : targetLog.args.policyId.toString()
|
2961
|
+
});
|
2962
|
+
case 21:
|
2963
|
+
return _context2.abrupt("return", {
|
2964
|
+
txHash: txHash
|
2965
|
+
});
|
2966
|
+
case 22:
|
2967
|
+
_context2.next = 27;
|
2968
|
+
break;
|
2969
|
+
case 24:
|
2970
|
+
_context2.prev = 24;
|
2971
|
+
_context2.t0 = _context2["catch"](0);
|
2972
|
+
handleError(_context2.t0, "Failed to register social remix policy");
|
2973
|
+
case 27:
|
2974
|
+
case "end":
|
2975
|
+
return _context2.stop();
|
2976
|
+
}
|
2977
|
+
}, _callee2, this, [[0, 24]]);
|
2978
|
+
}));
|
2979
|
+
function registerPILSocialRemixPolicy(_x2) {
|
2980
|
+
return _registerPILSocialRemixPolicy.apply(this, arguments);
|
2981
|
+
}
|
2982
|
+
return registerPILSocialRemixPolicy;
|
2983
|
+
}()
|
2984
|
+
/**
|
2985
|
+
* Convenient function to register a PIL social remix policy to the registry
|
2986
|
+
* Internally, this function must generate a Licensing.Policy struct and call registerPolicy.
|
2987
|
+
* @param request - the licensing parameters for the Programmable IP License v1 (PIL) standard.
|
2988
|
+
* @param request.commercialRevShare Percentage of revenue that must be shared with the licensor
|
2989
|
+
* @param mintingFee Fee to be paid when minting a license
|
2990
|
+
* @param mintingFeeToken Token to be used to pay the minting fee
|
2991
|
+
* @param request.territories List of territories where the license is valid. If empty, global.
|
2992
|
+
* @param request.distributionChannels List of distribution channels where the license is valid. Empty if no restrictions.
|
2993
|
+
* @param request.contentRestrictions List of content restrictions where the license is valid. Empty if no restrictions.
|
2994
|
+
* @returns the transaction hash and the policy ID if the txOptions.waitForTransaction is set to true
|
2995
|
+
*/
|
2996
|
+
}, {
|
2997
|
+
key: "registerPILCommercialUsePolicy",
|
2998
|
+
value: function () {
|
2999
|
+
var _registerPILCommercialUsePolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(request) {
|
3000
|
+
var _request$txOptions3, frameworkData, policyId, _yield$this$rpcClient3, call, txHash, targetLog;
|
3001
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
3002
|
+
while (1) switch (_context3.prev = _context3.next) {
|
3003
|
+
case 0:
|
3004
|
+
_context3.prev = 0;
|
3005
|
+
// First check if the policy exists
|
3006
|
+
frameworkData = {
|
3007
|
+
attribution: true,
|
3008
|
+
commercialUse: true,
|
3009
|
+
commercialAttribution: true,
|
3010
|
+
commercializerChecker: viem.zeroAddress,
|
3011
|
+
commercializerCheckerData: "0x",
|
3012
|
+
commercialRevShare: request.commercialRevShare,
|
3013
|
+
derivativesAllowed: true,
|
3014
|
+
derivativesAttribution: true,
|
3015
|
+
derivativesApproval: false,
|
3016
|
+
derivativesReciprocal: true,
|
3017
|
+
territories: request.territories || [],
|
3018
|
+
distributionChannels: request.distributionChannels || [],
|
3019
|
+
contentRestrictions: request.contentRestrictions || []
|
3020
|
+
};
|
3021
|
+
_context3.next = 4;
|
3022
|
+
return this.getPolicyId(true, this.encodeFrameworkData(frameworkData), typedDataToBytes({
|
3023
|
+
"interface": "uint32",
|
3024
|
+
data: [request.commercialRevShare]
|
3025
|
+
}), request.mintingFee || "0", request.mintingFeeToken || viem.zeroAddress, this.royaltyPolicyLAPConfig.address);
|
3026
|
+
case 4:
|
3027
|
+
policyId = _context3.sent;
|
3028
|
+
if (!(policyId !== 0)) {
|
3029
|
+
_context3.next = 7;
|
3030
|
+
break;
|
3031
|
+
}
|
3032
|
+
return _context3.abrupt("return", {
|
3033
|
+
policyId: policyId.toString()
|
3034
|
+
});
|
3035
|
+
case 7:
|
3036
|
+
_context3.next = 9;
|
3037
|
+
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, this.pilPolicyFrameworkManagerConfig), {}, {
|
3038
|
+
functionName: "registerPolicy",
|
3039
|
+
args: [{
|
3040
|
+
transferable: true,
|
3041
|
+
royaltyPolicy: this.royaltyPolicyLAPConfig.address,
|
3042
|
+
mintingFee: parseToBigInt(request.mintingFee || "0"),
|
3043
|
+
mintingFeeToken: request.mintingFeeToken || viem.zeroAddress,
|
3044
|
+
policy: {
|
3045
|
+
attribution: true,
|
3046
|
+
commercialUse: true,
|
3047
|
+
commercialAttribution: true,
|
3048
|
+
commercialRevShare: request.commercialRevShare,
|
3049
|
+
derivativesAllowed: true,
|
3050
|
+
derivativesAttribution: true,
|
3051
|
+
derivativesApproval: false,
|
3052
|
+
derivativesReciprocal: true,
|
3053
|
+
commercializerChecker: viem.zeroAddress,
|
3054
|
+
commercializerCheckerData: "0x",
|
3055
|
+
territories: request.territories || [],
|
3056
|
+
distributionChannels: request.distributionChannels || [],
|
3057
|
+
contentRestrictions: request.contentRestrictions || []
|
3058
|
+
}
|
3059
|
+
}],
|
3060
|
+
account: this.wallet.account
|
3061
|
+
}));
|
3062
|
+
case 9:
|
3063
|
+
_yield$this$rpcClient3 = _context3.sent;
|
3064
|
+
call = _yield$this$rpcClient3.request;
|
3065
|
+
_context3.next = 13;
|
3066
|
+
return this.wallet.writeContract(call);
|
3067
|
+
case 13:
|
3068
|
+
txHash = _context3.sent;
|
3069
|
+
if (!((_request$txOptions3 = request.txOptions) !== null && _request$txOptions3 !== void 0 && _request$txOptions3.waitForTransaction)) {
|
3070
|
+
_context3.next = 21;
|
3071
|
+
break;
|
3072
|
+
}
|
3073
|
+
_context3.next = 17;
|
3074
|
+
return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licensingModuleConfig), {}, {
|
3075
|
+
eventName: "PolicyRegistered"
|
3076
|
+
}));
|
3077
|
+
case 17:
|
3078
|
+
targetLog = _context3.sent;
|
3079
|
+
return _context3.abrupt("return", {
|
3080
|
+
txHash: txHash,
|
3081
|
+
policyId: targetLog === null || targetLog === void 0 ? void 0 : targetLog.args.policyId.toString()
|
3082
|
+
});
|
3083
|
+
case 21:
|
3084
|
+
return _context3.abrupt("return", {
|
3085
|
+
txHash: txHash
|
3086
|
+
});
|
3087
|
+
case 22:
|
3088
|
+
_context3.next = 27;
|
3089
|
+
break;
|
3090
|
+
case 24:
|
3091
|
+
_context3.prev = 24;
|
3092
|
+
_context3.t0 = _context3["catch"](0);
|
3093
|
+
handleError(_context3.t0, "Failed to register commercial use policy");
|
3094
|
+
case 27:
|
3095
|
+
case "end":
|
3096
|
+
return _context3.stop();
|
3097
|
+
}
|
3098
|
+
}, _callee3, this, [[0, 24]]);
|
3099
|
+
}));
|
3100
|
+
function registerPILCommercialUsePolicy(_x3) {
|
3101
|
+
return _registerPILCommercialUsePolicy.apply(this, arguments);
|
3102
|
+
}
|
3103
|
+
return registerPILCommercialUsePolicy;
|
3104
|
+
}()
|
3105
|
+
}, {
|
3106
|
+
key: "getPolicyId",
|
3107
|
+
value: function () {
|
3108
|
+
var _getPolicyId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(transferable, frameworkData, royaltyData, mintingFee, mintingFeeToken, royaltyPolicy, policyFramework) {
|
3109
|
+
var data;
|
3110
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
3111
|
+
while (1) switch (_context4.prev = _context4.next) {
|
3112
|
+
case 0:
|
3113
|
+
_context4.next = 2;
|
3114
|
+
return this.rpcClient.readContract(_objectSpread2(_objectSpread2({}, this.licensingModuleConfig), {}, {
|
3115
|
+
functionName: "getPolicyId",
|
3116
|
+
args: [{
|
3117
|
+
isLicenseTransferable: transferable,
|
3118
|
+
policyFramework: policyFramework || this.pilPolicyFrameworkManagerConfig.address,
|
3119
|
+
frameworkData: frameworkData,
|
3120
|
+
royaltyPolicy: royaltyPolicy,
|
3121
|
+
royaltyData: royaltyData,
|
3122
|
+
mintingFee: parseToBigInt(mintingFee),
|
3123
|
+
mintingFeeToken: mintingFeeToken
|
3124
|
+
}]
|
3125
|
+
}));
|
3126
|
+
case 2:
|
3127
|
+
data = _context4.sent;
|
3128
|
+
return _context4.abrupt("return", Number(data));
|
3129
|
+
case 4:
|
3130
|
+
case "end":
|
3131
|
+
return _context4.stop();
|
3132
|
+
}
|
3133
|
+
}, _callee4, this);
|
3134
|
+
}));
|
3135
|
+
function getPolicyId(_x4, _x5, _x6, _x7, _x8, _x9, _x10) {
|
3136
|
+
return _getPolicyId.apply(this, arguments);
|
3137
|
+
}
|
3138
|
+
return getPolicyId;
|
3139
|
+
}()
|
3140
|
+
}, {
|
3141
|
+
key: "encodeFrameworkData",
|
3142
|
+
value: function encodeFrameworkData(data) {
|
3143
|
+
return typedDataToBytes({
|
3144
|
+
"interface": "(bool, bool, bool, address, bytes, uint32, bool, bool, bool, bool, string[], string[], string[])",
|
3145
|
+
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]]
|
3146
|
+
});
|
3147
|
+
}
|
3148
|
+
|
2712
3149
|
/**
|
2713
3150
|
* Adds a policy to the set of policies of an IP
|
2714
3151
|
* @param request The request object containing details to add a policy to an IP
|
@@ -2719,17 +3156,17 @@ var PolicyClient = /*#__PURE__*/function () {
|
|
2719
3156
|
}, {
|
2720
3157
|
key: "addPolicyToIp",
|
2721
3158
|
value: function () {
|
2722
|
-
var _addPolicyToIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
2723
|
-
var _request$
|
2724
|
-
return _regeneratorRuntime().wrap(function
|
2725
|
-
while (1) switch (
|
3159
|
+
var _addPolicyToIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(request) {
|
3160
|
+
var _request$txOptions4, IPAccountConfig, _yield$this$rpcClient4, call, txHash, targetLog;
|
3161
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
3162
|
+
while (1) switch (_context5.prev = _context5.next) {
|
2726
3163
|
case 0:
|
2727
|
-
|
3164
|
+
_context5.prev = 0;
|
2728
3165
|
IPAccountConfig = {
|
2729
3166
|
abi: this.ipAccountABI,
|
2730
3167
|
address: viem.getAddress(request.ipId)
|
2731
3168
|
};
|
2732
|
-
|
3169
|
+
_context5.next = 4;
|
2733
3170
|
return this.rpcClient.simulateContract(_objectSpread2(_objectSpread2({}, IPAccountConfig), {}, {
|
2734
3171
|
functionName: "execute",
|
2735
3172
|
args: [this.licensingModuleConfig.address, parseToBigInt(0), viem.encodeFunctionData({
|
@@ -2740,44 +3177,44 @@ var PolicyClient = /*#__PURE__*/function () {
|
|
2740
3177
|
account: this.wallet.account
|
2741
3178
|
}));
|
2742
3179
|
case 4:
|
2743
|
-
_yield$this$
|
2744
|
-
call = _yield$this$
|
2745
|
-
|
3180
|
+
_yield$this$rpcClient4 = _context5.sent;
|
3181
|
+
call = _yield$this$rpcClient4.request;
|
3182
|
+
_context5.next = 8;
|
2746
3183
|
return this.wallet.writeContract(call);
|
2747
3184
|
case 8:
|
2748
|
-
txHash =
|
2749
|
-
if (!((_request$
|
2750
|
-
|
3185
|
+
txHash = _context5.sent;
|
3186
|
+
if (!((_request$txOptions4 = request.txOptions) !== null && _request$txOptions4 !== void 0 && _request$txOptions4.waitForTransaction)) {
|
3187
|
+
_context5.next = 16;
|
2751
3188
|
break;
|
2752
3189
|
}
|
2753
|
-
|
3190
|
+
_context5.next = 12;
|
2754
3191
|
return waitTxAndFilterLog(this.rpcClient, txHash, _objectSpread2(_objectSpread2({}, this.licensingModuleConfig), {}, {
|
2755
3192
|
eventName: "PolicyAddedToIpId"
|
2756
3193
|
}));
|
2757
3194
|
case 12:
|
2758
|
-
targetLog =
|
2759
|
-
return
|
3195
|
+
targetLog = _context5.sent;
|
3196
|
+
return _context5.abrupt("return", {
|
2760
3197
|
txHash: txHash,
|
2761
3198
|
index: targetLog.args.index.toString()
|
2762
3199
|
});
|
2763
3200
|
case 16:
|
2764
|
-
return
|
3201
|
+
return _context5.abrupt("return", {
|
2765
3202
|
txHash: txHash
|
2766
3203
|
});
|
2767
3204
|
case 17:
|
2768
|
-
|
3205
|
+
_context5.next = 22;
|
2769
3206
|
break;
|
2770
3207
|
case 19:
|
2771
|
-
|
2772
|
-
|
2773
|
-
handleError(
|
3208
|
+
_context5.prev = 19;
|
3209
|
+
_context5.t0 = _context5["catch"](0);
|
3210
|
+
handleError(_context5.t0, "Failed to add policy to IP");
|
2774
3211
|
case 22:
|
2775
3212
|
case "end":
|
2776
|
-
return
|
3213
|
+
return _context5.stop();
|
2777
3214
|
}
|
2778
|
-
},
|
3215
|
+
}, _callee5, this, [[0, 19]]);
|
2779
3216
|
}));
|
2780
|
-
function addPolicyToIp(
|
3217
|
+
function addPolicyToIp(_x11) {
|
2781
3218
|
return _addPolicyToIp.apply(this, arguments);
|
2782
3219
|
}
|
2783
3220
|
return addPolicyToIp;
|