-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathlicense.ts
More file actions
572 lines (552 loc) · 22.6 KB
/
Copy pathlicense.ts
File metadata and controls
572 lines (552 loc) · 22.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
import { Address, PublicClient, zeroAddress } from "viem";
import {
IpAccountImplClient,
IpAssetRegistryClient,
LicenseAttachmentWorkflowsClient,
LicenseAttachmentWorkflowsRegisterPilTermsAndAttachRequest,
LicenseRegistryGetLicensingConfigRequest,
LicenseRegistryReadOnlyClient,
LicensingModuleClient,
LicensingModuleMintLicenseTokensRequest,
LicensingModulePredictMintingLicenseFeeRequest,
LicensingModulePredictMintingLicenseFeeResponse,
LicensingModuleSetLicensingConfigRequest,
ModuleRegistryReadOnlyClient,
Multicall3Client,
PiLicenseTemplateClient,
PiLicenseTemplateGetLicenseTermsResponse,
PiLicenseTemplateReadOnlyClient,
royaltyModuleAddress,
SimpleWalletClient,
TotalLicenseTokenLimitHookClient,
WrappedIpClient,
} from "../abi/generated";
import { LicenseTermsIdInput, LicensingConfig, RevShareType } from "../types/common";
import { ChainIds } from "../types/config";
import { TransactionResponse, TxOptions } from "../types/options";
import {
AttachLicenseTermsRequest,
AttachLicenseTermsResponse,
GetLicensingConfigRequest,
LicenseTerms,
LicenseTermsIdResponse,
MintLicenseTokensRequest,
MintLicenseTokensResponse,
PredictMintingLicenseFeeRequest,
RegisterPILResponse,
RegisterPilTermsAndAttachRequest,
RegisterPilTermsAndAttachResponse,
RegisterPILTermsRequest,
SetLicensingConfigRequest,
SetLicensingConfigResponse,
SetMaxLicenseTokensRequest,
} from "../types/resources/license";
import { SignatureMethodType } from "../types/utils/registerHelper";
import { Erc20Spender } from "../types/utils/wip";
import { calculateLicenseWipMintFee, predictMintingLicenseFee } from "../utils/calculateMintFee";
import { handleError } from "../utils/errors";
import { contractCallWithFees } from "../utils/feeUtils";
import { generateOperationSignature } from "../utils/generateOperationSignature";
import { PILFlavor } from "../utils/pilFlavor";
import {
getCalculatedDeadline,
validateLicenseTermsData,
} from "../utils/registrationUtils/registerValidation";
import { getRevenueShare } from "../utils/royalty";
import { setMaxLicenseTokens } from "../utils/setMaxLicenseTokens";
import { waitForTxReceipt } from "../utils/txOptions";
import { validateAddress } from "../utils/utils";
import { validateLicenseConfig } from "../utils/validateLicenseConfig";
export class LicenseClient {
public licensingModuleClient: LicensingModuleClient;
public ipAssetRegistryClient: IpAssetRegistryClient;
public piLicenseTemplateReadOnlyClient: PiLicenseTemplateReadOnlyClient;
public licenseTemplateClient: PiLicenseTemplateClient;
public licenseRegistryReadOnlyClient: LicenseRegistryReadOnlyClient;
public moduleRegistryReadOnlyClient: ModuleRegistryReadOnlyClient;
public multicall3Client: Multicall3Client;
public totalLicenseTokenLimitHookClient: TotalLicenseTokenLimitHookClient;
public wipClient: WrappedIpClient;
public licenseAttachmentWorkflowsClient: LicenseAttachmentWorkflowsClient;
private readonly rpcClient: PublicClient;
private readonly wallet: SimpleWalletClient;
private readonly chainId: ChainIds;
private readonly walletAddress: Address;
constructor(rpcClient: PublicClient, wallet: SimpleWalletClient, chainId: ChainIds) {
this.licensingModuleClient = new LicensingModuleClient(rpcClient, wallet);
this.piLicenseTemplateReadOnlyClient = new PiLicenseTemplateReadOnlyClient(rpcClient);
this.licenseTemplateClient = new PiLicenseTemplateClient(rpcClient, wallet);
this.licenseRegistryReadOnlyClient = new LicenseRegistryReadOnlyClient(rpcClient);
this.ipAssetRegistryClient = new IpAssetRegistryClient(rpcClient, wallet);
this.moduleRegistryReadOnlyClient = new ModuleRegistryReadOnlyClient(rpcClient);
this.multicall3Client = new Multicall3Client(rpcClient, wallet);
this.wipClient = new WrappedIpClient(rpcClient, wallet);
this.totalLicenseTokenLimitHookClient = new TotalLicenseTokenLimitHookClient(rpcClient, wallet);
this.licenseAttachmentWorkflowsClient = new LicenseAttachmentWorkflowsClient(rpcClient, wallet);
this.rpcClient = rpcClient;
this.wallet = wallet;
this.chainId = chainId;
this.walletAddress = wallet.account!.address;
}
/**
* Registers new license terms and return the ID of the newly registered license terms.
*
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicenseTemplate.sol#L19 | `LicenseTermsRegistered`} event.
*/
public async registerPILTerms(request: RegisterPILTermsRequest): Promise<RegisterPILResponse> {
try {
const object = PILFlavor.validateLicenseTerms(request, this.chainId);
return await this.registerPILTermsHelper(object, request.txOptions);
} catch (error) {
return handleError(error, "Failed to register license terms");
}
}
/**
* Attaches license terms to an IP.
*/
public async attachLicenseTerms(
request: AttachLicenseTermsRequest,
): Promise<AttachLicenseTermsResponse> {
try {
request.licenseTermsId = BigInt(request.licenseTermsId);
const isRegistered = await this.ipAssetRegistryClient.isRegistered({
id: validateAddress(request.ipId),
});
if (!isRegistered) {
throw new Error(`The IP with id ${request.ipId} is not registered.`);
}
const isExisted = await this.piLicenseTemplateReadOnlyClient.exists({
licenseTermsId: request.licenseTermsId,
});
if (!isExisted) {
throw new Error(`License terms id ${request.licenseTermsId} do not exist.`);
}
const isAttachedLicenseTerms =
await this.licenseRegistryReadOnlyClient.hasIpAttachedLicenseTerms({
ipId: request.ipId,
licenseTemplate: validateAddress(
request.licenseTemplate || this.licenseTemplateClient.address,
),
licenseTermsId: request.licenseTermsId,
});
if (isAttachedLicenseTerms) {
return { success: false };
}
const req = {
ipId: request.ipId,
licenseTemplate: request.licenseTemplate || this.licenseTemplateClient.address,
licenseTermsId: request.licenseTermsId,
};
if (request.txOptions?.encodedTxDataOnly) {
return { encodedTxData: this.licensingModuleClient.attachLicenseTermsEncode(req) };
} else {
const txHash = await this.licensingModuleClient.attachLicenseTerms(req);
await this.rpcClient.waitForTransactionReceipt({
...request.txOptions,
hash: txHash,
});
return { txHash: txHash, success: true };
}
} catch (error) {
return handleError(error, "Failed to attach license terms");
}
}
/**
* Mints license tokens for the license terms attached to an IP.
* It might require the caller pay the minting fee, depending on the license terms or configured by the iP owner.
* The minting fee is paid in the minting fee token specified in the license terms or configured by the IP owner.
* IP owners can configure the minting fee of their IPs or configure the minting fee module to determine the minting fee.
*
* @remarks
* Before minting license tokens, the license terms must be attached to the IP, with two exceptions:
* 1. Default license terms can be minted without explicit attachment since they are automatically
* attached to all IPs by default
* 2. IP owners have special privileges and can mint license tokens for their own IPs using any
* license terms, even if those terms are not explicitly attached
*
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicensingModule.sol#L34 | `LicenseTokensMinted`} event.
*/
public async mintLicenseTokens(
request: MintLicenseTokensRequest,
): Promise<MintLicenseTokensResponse> {
try {
const receiver = validateAddress(request.receiver || this.walletAddress);
const req: LicensingModuleMintLicenseTokensRequest = {
licensorIpId: validateAddress(request.licensorIpId),
licenseTemplate: validateAddress(
request.licenseTemplate || this.licenseTemplateClient.address,
),
licenseTermsId: BigInt(request.licenseTermsId),
amount: BigInt(request.amount === undefined ? 1 : request.amount),
receiver,
royaltyContext: zeroAddress,
maxMintingFee: BigInt(request.maxMintingFee ?? 0),
maxRevenueShare: getRevenueShare(
request.maxRevenueShare ?? 100,
RevShareType.MAX_REVENUE_SHARE,
),
} as const;
if (req.maxMintingFee < 0) {
throw new Error(`The maxMintingFee must be greater than 0.`);
}
const isLicenseIpIdRegistered = await this.ipAssetRegistryClient.isRegistered({
id: validateAddress(request.licensorIpId),
});
if (!isLicenseIpIdRegistered) {
throw new Error(`The licensor IP with id ${request.licensorIpId} is not registered.`);
}
const isExisted = await this.piLicenseTemplateReadOnlyClient.exists({
licenseTermsId: req.licenseTermsId,
});
if (!isExisted) {
throw new Error(`License terms id ${request.licenseTermsId} do not exist.`);
}
const ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, req.licensorIpId);
const ipOwner = await ipAccount.owner();
if (ipOwner !== this.walletAddress) {
const isAttachedLicenseTerms =
await this.licenseRegistryReadOnlyClient.hasIpAttachedLicenseTerms({
ipId: req.licensorIpId,
licenseTemplate: req.licenseTemplate,
licenseTermsId: req.licenseTermsId,
});
if (!isAttachedLicenseTerms) {
throw new Error(
`License terms id ${req.licenseTermsId} is not attached to the IP with id ${req.licensorIpId}.`,
);
}
}
const encodedTxData = this.licensingModuleClient.mintLicenseTokensEncode(req);
if (request.txOptions?.encodedTxDataOnly) {
return { encodedTxData };
}
// get license token minting fee
const licenseMintingFee = await calculateLicenseWipMintFee({
predictMintingFeeRequest: req,
rpcClient: this.rpcClient,
chainId: this.chainId,
walletAddress: this.walletAddress,
});
const wipSpenders: Erc20Spender[] = [];
if (licenseMintingFee > 0n) {
wipSpenders.push({
address: royaltyModuleAddress[this.chainId],
amount: licenseMintingFee,
});
}
const { txHash, receipt } = await contractCallWithFees({
totalFees: licenseMintingFee,
options: { wipOptions: request.options?.wipOptions },
multicall3Address: this.multicall3Client.address,
rpcClient: this.rpcClient,
tokenSpenders: wipSpenders,
contractCall: () => {
return this.licensingModuleClient.mintLicenseTokens(req);
},
wallet: this.wallet,
sender: this.walletAddress,
txOptions: request.txOptions,
encodedTxs: [encodedTxData],
});
const targetLogs = this.licensingModuleClient.parseTxLicenseTokensMintedEvent(receipt);
const startLicenseTokenId = targetLogs[0].startLicenseTokenId;
const licenseTokenIds = [];
for (let i = 0; i < req.amount; i++) {
licenseTokenIds.push(startLicenseTokenId + BigInt(i));
}
return { txHash, licenseTokenIds: licenseTokenIds, receipt };
} catch (error) {
return handleError(error, "Failed to mint license tokens");
}
}
/**
* Gets license terms of the given ID.
*/
public async getLicenseTerms(
selectedLicenseTermsId: LicenseTermsIdInput,
): Promise<PiLicenseTemplateGetLicenseTermsResponse> {
try {
return await this.piLicenseTemplateReadOnlyClient.getLicenseTerms({
selectedLicenseTermsId: BigInt(selectedLicenseTermsId),
});
} catch (error) {
return handleError(error, "Failed to get license terms");
}
}
/**
* Pre-compute the minting license fee for the given IP and license terms. The function can be used to calculate the minting license fee before minting license tokens.
*/
public async predictMintingLicenseFee(
request: PredictMintingLicenseFeeRequest,
): Promise<LicensingModulePredictMintingLicenseFeeResponse> {
try {
const isLicenseIpIdRegistered = await this.ipAssetRegistryClient.isRegistered({
id: validateAddress(request.licensorIpId),
});
if (!isLicenseIpIdRegistered) {
throw new Error(`The licensor IP with id ${request.licensorIpId} is not registered.`);
}
const licenseTermsId = BigInt(request.licenseTermsId);
const isExisted = await this.piLicenseTemplateReadOnlyClient.exists({
licenseTermsId,
});
if (!isExisted) {
throw new Error(`License terms id ${request.licenseTermsId} do not exist.`);
}
const object: LicensingModulePredictMintingLicenseFeeRequest = {
...request,
receiver: validateAddress(request.receiver || this.walletAddress),
amount: BigInt(request.amount),
royaltyContext: zeroAddress,
licenseTemplate: validateAddress(
request.licenseTemplate || this.licenseTemplateClient.address,
),
licenseTermsId,
};
return await predictMintingLicenseFee({
predictMintingFeeRequest: object,
rpcClient: this.rpcClient,
chainId: this.chainId,
walletAddress: this.walletAddress,
});
} catch (error) {
return handleError(error, "Failed to predict minting license fee");
}
}
/**
* Sets the licensing configuration for a specific license terms of an IP. If both licenseTemplate and licenseTermsId are not specified then the licensing config apply to all licenses of given IP.
*/
public async setLicensingConfig(
request: SetLicensingConfigRequest,
): Promise<SetLicensingConfigResponse> {
try {
const req: LicensingModuleSetLicensingConfigRequest = {
ipId: request.ipId,
licenseTemplate: validateAddress(
request.licenseTemplate || this.licenseTemplateClient.address,
),
licenseTermsId: BigInt(request.licenseTermsId),
licensingConfig: validateLicenseConfig(request.licensingConfig),
};
if (req.licenseTemplate === zeroAddress && req.licensingConfig.commercialRevShare !== 0) {
throw new Error(
"The license template cannot be zero address if commercial revenue share is not zero.",
);
}
const isLicenseIpIdRegistered = await this.ipAssetRegistryClient.isRegistered({
id: validateAddress(req.ipId),
});
if (!isLicenseIpIdRegistered) {
throw new Error(`The licensor IP with id ${req.ipId} is not registered.`);
}
const isExisted = await this.piLicenseTemplateReadOnlyClient.exists({
licenseTermsId: req.licenseTermsId,
});
if (!isExisted) {
throw new Error(`License terms id ${req.licenseTermsId} do not exist.`);
}
if (req.licensingConfig.licensingHook !== zeroAddress) {
const isRegistered = await this.moduleRegistryReadOnlyClient.isRegistered({
moduleAddress: req.licensingConfig.licensingHook,
});
if (!isRegistered) {
throw new Error("The licensing hook is not registered.");
}
}
if (req.licenseTemplate === zeroAddress && req.licenseTermsId !== 0n) {
throw new Error("The license template is zero address but license terms id is not zero.");
}
if (request.txOptions?.encodedTxDataOnly) {
return { encodedTxData: this.licensingModuleClient.setLicensingConfigEncode(req) };
} else {
const txHash = await this.licensingModuleClient.setLicensingConfig(req);
await this.rpcClient.waitForTransactionReceipt({
...request.txOptions,
hash: txHash,
});
return { txHash: txHash, success: true };
}
} catch (error) {
return handleError(error, "Failed to set licensing config");
}
}
/**
* Set the max license token limit for a specific license.
*
* @remarks
* This method automatically configures the licensing hook to use the
* {@link https://github.com/storyprotocol/protocol-periphery-v1/blob/release/1.3/contracts/hooks/TotalLicenseTokenLimitHook.sol | TotalLicenseTokenLimitHook} contract
* if the current licensing hook is not set to `TotalLicenseTokenLimitHook`, and sets the max license tokens
* to the specified limit.
*/
public async setMaxLicenseTokens({
ipId,
licenseTermsId,
maxLicenseTokens,
licenseTemplate,
txOptions,
}: SetMaxLicenseTokensRequest): Promise<TransactionResponse> {
try {
if (maxLicenseTokens < 0) {
throw new Error("The max license tokens must be greater than 0.");
}
const newLicenseTermsId = BigInt(licenseTermsId);
const newLicenseTemplate = validateAddress(
licenseTemplate || this.licenseTemplateClient.address,
);
const licensingConfig = await this.getLicensingConfig({
ipId,
licenseTermsId: newLicenseTermsId,
licenseTemplate: newLicenseTemplate,
});
if (licensingConfig.licensingHook !== this.totalLicenseTokenLimitHookClient.address) {
await this.setLicensingConfig({
ipId,
licenseTermsId: newLicenseTermsId,
licenseTemplate: newLicenseTemplate,
licensingConfig: {
...licensingConfig,
licensingHook: this.totalLicenseTokenLimitHookClient.address,
expectMinimumGroupRewardShare: licensingConfig.expectMinimumGroupRewardShare / 1000000,
},
});
}
const txHash = await this.totalLicenseTokenLimitHookClient.setTotalLicenseTokenLimit({
licensorIpId: ipId,
licenseTemplate: newLicenseTemplate,
licenseTermsId: newLicenseTermsId,
limit: BigInt(maxLicenseTokens),
});
return waitForTxReceipt({
txHash,
txOptions,
rpcClient: this.rpcClient,
});
} catch (error) {
return handleError(error, "Failed to set max license tokens");
}
}
public async getLicensingConfig(request: GetLicensingConfigRequest): Promise<LicensingConfig> {
try {
const licensingConfigParam: LicenseRegistryGetLicensingConfigRequest = {
ipId: validateAddress(request.ipId),
licenseTemplate: validateAddress(
request.licenseTemplate || this.licenseTemplateClient.address,
),
licenseTermsId: BigInt(request.licenseTermsId),
};
return await this.licenseRegistryReadOnlyClient.getLicensingConfig(licensingConfigParam);
} catch (error) {
return handleError(error, "Failed to get licensing config");
}
}
/**
* Register Programmable IP License Terms (if unregistered) and attach it to IP.
*
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicensingModule.sol#L19 | `LicenseTermsAttached`} event.
*/
public async registerPilTermsAndAttach(
request: RegisterPilTermsAndAttachRequest,
): Promise<RegisterPilTermsAndAttachResponse> {
try {
const { ipId } = request;
const isRegistered = await this.ipAssetRegistryClient.isRegistered({
id: validateAddress(ipId),
});
if (!isRegistered) {
throw new Error(`The IP with id ${ipId} is not registered.`);
}
const { licenseTerms, licenseTermsData } = await validateLicenseTermsData(
request.licenseTermsData,
this.rpcClient,
this.chainId,
);
const calculatedDeadline = await getCalculatedDeadline(this.rpcClient, request.deadline);
const ipAccount = new IpAccountImplClient(this.rpcClient, this.wallet, ipId);
const { result: state } = await ipAccount.state();
const signature = await generateOperationSignature({
ipIdAddress: ipId,
methodType: SignatureMethodType.REGISTER_PIL_TERMS_AND_ATTACH,
deadline: calculatedDeadline,
state,
wallet: this.wallet,
chainId: this.chainId,
});
const object: LicenseAttachmentWorkflowsRegisterPilTermsAndAttachRequest = {
ipId: ipId,
licenseTermsData,
sigAttachAndConfig: {
signer: validateAddress(this.walletAddress),
deadline: calculatedDeadline,
signature,
},
};
if (request.txOptions?.encodedTxDataOnly) {
return {
encodedTxData:
this.licenseAttachmentWorkflowsClient.registerPilTermsAndAttachEncode(object),
};
} else {
const txHash = await this.licenseAttachmentWorkflowsClient.registerPilTermsAndAttach(
object,
);
await this.rpcClient.waitForTransactionReceipt({
...request.txOptions,
hash: txHash,
});
const licenseTermsIds: bigint[] = [];
for (let i = 0; i < licenseTerms.length; i++) {
licenseTermsIds.push(await this.getLicenseTermsId(licenseTerms[i]));
}
const maxLicenseTokensTxHashes = await setMaxLicenseTokens({
maxLicenseTokensData: request.licenseTermsData,
licensorIpId: ipId,
licenseTermsIds,
totalLicenseTokenLimitHookClient: this.totalLicenseTokenLimitHookClient,
templateAddress: this.licenseTemplateClient.address,
});
return {
txHash,
licenseTermsIds,
...(maxLicenseTokensTxHashes.length > 0 && { maxLicenseTokensTxHashes }),
};
}
} catch (error) {
return handleError(error, "Failed to register PIL terms and attach");
}
}
private async getLicenseTermsId(licenseTerms: LicenseTerms): Promise<LicenseTermsIdResponse> {
const licenseRes = await this.licenseTemplateClient.getLicenseTermsId({
terms: licenseTerms,
});
return licenseRes.selectedLicenseTermsId;
}
private async registerPILTermsHelper(
licenseTerms: LicenseTerms,
txOptions?: TxOptions,
): Promise<RegisterPILResponse> {
licenseTerms.commercialRevShare = getRevenueShare(licenseTerms.commercialRevShare);
if (txOptions?.encodedTxDataOnly) {
return {
encodedTxData: this.licenseTemplateClient.registerLicenseTermsEncode({
terms: licenseTerms,
}),
};
} else {
const licenseTermsId = await this.getLicenseTermsId(licenseTerms);
if (licenseTermsId !== 0n) {
return { licenseTermsId: licenseTermsId };
}
const txHash = await this.licenseTemplateClient.registerLicenseTerms({
terms: licenseTerms,
});
const { receipt } = await waitForTxReceipt({
txOptions,
rpcClient: this.rpcClient,
txHash,
});
const targetLogs = this.licenseTemplateClient.parseTxLicenseTermsRegisteredEvent(receipt);
return { txHash: txHash, licenseTermsId: targetLogs[0].licenseTermsId };
}
}
}