Skip to content

Commit 7fb0bdb

Browse files
authored
feat: remove deprecated methods (#634)
* feat: add linkDerivative method for managing derivative IP assets * test: add integration and unit tests for linkDerivative functionality in IP asset management * refactor: remove unnecessary whitespace in ipAsset type definitions * refactor: update license registration methods to use registerPILTerms for consistency * refactor: remove deprecated PIL_TYPE enum from license type definitions * test: remove deprecated tests for registerPILTerms in licenseClient * fix lint * test: update license tests to remove deprecated Creative Commons Attribution License tests and adjust minting fee and revenue share values * test: remove unused import from license integration tests
1 parent 052be2b commit 7fb0bdb

File tree

9 files changed

+10457
-12036
lines changed

9 files changed

+10457
-12036
lines changed

packages/core-sdk/src/abi/generated.ts

Lines changed: 10405 additions & 11294 deletions
Large diffs are not rendered by default.

packages/core-sdk/src/resources/license.ts

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ import {
3333
MintLicenseTokensRequest,
3434
MintLicenseTokensResponse,
3535
PredictMintingLicenseFeeRequest,
36-
RegisterCommercialRemixPILRequest,
37-
RegisterCommercialUsePILRequest,
38-
RegisterCreativeCommonsAttributionPILRequest,
39-
RegisterNonComSocialRemixingPILRequest,
4036
RegisterPILResponse,
4137
RegisterPILTermsRequest,
4238
SetLicensingConfigRequest,
@@ -98,111 +94,6 @@ export class LicenseClient {
9894
}
9995
}
10096

101-
/**
102-
* @deprecated Use {@link PILFlavor.nonCommercialSocialRemixing} with {@link LicenseClient.registerPILTerms} instead.
103-
* The method will be removed in the `v1.4.0`.
104-
*
105-
* Convenient function to register a PIL non commercial social remix license to the registry
106-
*
107-
* For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%231%3A-non-commercial-social-remixing | Non Commercial Social Remixing}.
108-
*
109-
* 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.
110-
*/
111-
public async registerNonComSocialRemixingPIL(
112-
request?: RegisterNonComSocialRemixingPILRequest,
113-
): Promise<RegisterPILResponse> {
114-
try {
115-
const licenseTerms = PILFlavor.nonCommercialSocialRemixing();
116-
return await this.registerPILTermsHelper(licenseTerms, request?.txOptions);
117-
} catch (error) {
118-
return handleError(error, "Failed to register non commercial social remixing PIL");
119-
}
120-
}
121-
122-
/**
123-
* @deprecated Use {@link PILFlavor.commercialUse} with {@link LicenseClient.registerPILTerms} instead.
124-
* The method will be removed in the `v1.4.0`.
125-
*
126-
* Convenient function to register a PIL commercial use license to the registry.
127-
*
128-
* For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%232%3A-commercial-use | Commercial Use}.
129-
*
130-
* 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.
131-
*/
132-
public async registerCommercialUsePIL(
133-
request: RegisterCommercialUsePILRequest,
134-
): Promise<RegisterPILResponse> {
135-
try {
136-
const licenseTerms = PILFlavor.commercialUse({
137-
defaultMintingFee: Number(request.defaultMintingFee),
138-
currency: request.currency,
139-
royaltyPolicy: request.royaltyPolicyAddress,
140-
});
141-
return await this.registerPILTermsHelper(licenseTerms, request.txOptions);
142-
} catch (error) {
143-
return handleError(error, "Failed to register commercial use PIL");
144-
}
145-
}
146-
147-
/**
148-
* @deprecated Use {@link PILFlavor.commercialRemix} with {@link LicenseClient.registerPILTerms} instead.
149-
* The method will be removed in the v1.4.0.
150-
*
151-
* Convenient function to register a PIL commercial Remix license to the registry.
152-
*
153-
* For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%233%3A-commercial-remix | Commercial Remix }.
154-
*
155-
* 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.
156-
*/
157-
public async registerCommercialRemixPIL({
158-
defaultMintingFee,
159-
currency,
160-
royaltyPolicyAddress,
161-
commercialRevShare,
162-
txOptions,
163-
}: RegisterCommercialRemixPILRequest): Promise<RegisterPILResponse> {
164-
try {
165-
const licenseTerms = PILFlavor.commercialRemix({
166-
defaultMintingFee: Number(defaultMintingFee),
167-
currency,
168-
royaltyPolicy: royaltyPolicyAddress,
169-
commercialRevShare,
170-
});
171-
return await this.registerPILTermsHelper(licenseTerms, txOptions);
172-
} catch (error) {
173-
return handleError(error, "Failed to register commercial remix PIL");
174-
}
175-
}
176-
177-
/**
178-
* @deprecated Use {@link PILFlavor.creativeCommonsAttribution} with {@link LicenseClient.registerPILTerms} instead.
179-
* The method will be removed in the `v1.4.0`.
180-
*
181-
* Convenient function to register a PIL creative commons attribution license to the registry.
182-
* Creates a Creative Commons Attribution (CC-BY) license terms flavor.
183-
*
184-
* For more details, see {@link https://docs.story.foundation/concepts/programmable-ip-license/pil-flavors#flavor-%234%3A-creative-commons-attribution | Creative Commons Attribution}.
185-
*
186-
* 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.
187-
*/
188-
public async registerCreativeCommonsAttributionPIL({
189-
currency,
190-
royaltyPolicyAddress,
191-
txOptions,
192-
}: RegisterCreativeCommonsAttributionPILRequest): Promise<RegisterPILResponse> {
193-
try {
194-
return await this.registerPILTermsHelper(
195-
PILFlavor.creativeCommonsAttribution({
196-
currency,
197-
royaltyPolicy: royaltyPolicyAddress,
198-
}),
199-
txOptions,
200-
);
201-
} catch (error) {
202-
return handleError(error, "Failed to register creative commons attribution PIL");
203-
}
204-
}
205-
20697
/**
20798
* Attaches license terms to an IP.
20899
*/

packages/core-sdk/src/types/resources/license.ts

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,6 @@ import { EncodedTxData } from "../../abi/generated";
44
import { LicensingConfigInput } from "../common";
55
import { TxOptions, WithTxOptions, WithWipOptions } from "../options";
66
import { RoyaltyPolicyInput } from "./royalty";
7-
8-
export type LicenseApiResponse = {
9-
data: License;
10-
};
11-
12-
export type License = {
13-
id: string;
14-
policyId: string;
15-
licensorIpId: Address;
16-
};
17-
18-
export type RegisterNonComSocialRemixingPILRequest = {
19-
txOptions?: TxOptions;
20-
};
21-
227
/**
238
* This structure defines the terms for a Programmable IP License (PIL).
249
* These terms can be attached to IP Assets.
@@ -104,47 +89,6 @@ export type RegisterPILResponse = {
10489
encodedTxData?: EncodedTxData;
10590
};
10691

107-
export type RegisterCommercialUsePILRequest = {
108-
/** The fee to be paid when minting a license. */
109-
defaultMintingFee: string | number | bigint;
110-
/** The ERC20 token to be used to pay the minting fee */
111-
currency: Address;
112-
/**
113-
* The address of the royalty policy contract.
114-
* Defaults to {@link https://docs.story.foundation/docs/liquid-absolute-percentage | LAP} policy address if not provided.
115-
*/
116-
royaltyPolicyAddress?: Address;
117-
txOptions?: TxOptions;
118-
};
119-
120-
export type RegisterCommercialRemixPILRequest = {
121-
/** The fee to be paid when minting a license. */
122-
defaultMintingFee: string | number | bigint;
123-
/**
124-
* Percentage of revenue that must be shared with the licensor.
125-
* Must be between 0 and 100 (where 100% represents 100_000_000).
126-
*/
127-
commercialRevShare: number;
128-
/** The ERC20 token to be used to pay the minting fee */
129-
currency: Address;
130-
/**
131-
* The address of the royalty policy contract.
132-
* Defaults to {@link https://docs.story.foundation/docs/liquid-absolute-percentage | LAP} policy address if not provided.
133-
*/
134-
royaltyPolicyAddress?: Address;
135-
txOptions?: TxOptions;
136-
};
137-
138-
export type RegisterCreativeCommonsAttributionPILRequest = WithTxOptions & {
139-
/** The ERC20 or WIP token to be used to pay the minting fee. */
140-
currency: Address;
141-
/**
142-
* The address of the royalty policy contract.
143-
* Defaults to {@link https://docs.story.foundation/docs/liquid-absolute-percentage | LAP} policy address if not provided.
144-
*/
145-
royaltyPolicyAddress?: Address;
146-
};
147-
14892
export type AttachLicenseTermsRequest = {
14993
/** The address of the IP ID to which the license terms are being attached. */
15094
ipId: Address;
@@ -192,18 +136,6 @@ export type MintLicenseTokensResponse = {
192136
encodedTxData?: EncodedTxData;
193137
};
194138

195-
/**
196-
* @deprecated Use `PILFlavor.nonCommercialSocialRemixing`, `PILFlavor.commercialUse`, `PILFlavor.commercialRemix`, or `PILFlavor.creativeCommonsAttribution` instead.
197-
*
198-
* The type of PIL.
199-
*/
200-
export enum PIL_TYPE {
201-
NON_COMMERCIAL_REMIX,
202-
COMMERCIAL_USE,
203-
COMMERCIAL_REMIX,
204-
CREATIVE_COMMONS_ATTRIBUTION,
205-
}
206-
207139
export type LicenseTermsId = string | number | bigint;
208140

209141
export type PredictMintingLicenseFeeRequest = {

packages/core-sdk/src/types/resources/permission.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ export type SignatureRequest = {
9696
wallet: SimpleWalletClient;
9797
/**
9898
* The IP ID (address) of the IP Account that will verify the signature.
99-
*
99+
*
100100
* Note: IP ID is the address of a specific IP Account's proxy contract.
101101
* Each IP Account has its own unique IP ID address.
102-
*
102+
*
103103
* @see https://docs.story.foundation/docs/ip-account for more details
104104
*/
105105
verifyingContract: Address;

packages/core-sdk/test/integration/ipAccount.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ describe("IPAccount Functions", () => {
8888
it("should successfully execute with valid signature", async () => {
8989
// Get the IP Account nonce (state)
9090
const nonceResult = await client.ipAccount.getIpAccountNonce(ipId);
91-
91+
9292
// Generate signature for the execute operation itself
9393
// We need to sign the data that will be executed, not the permission data
9494
const { signature } = await getSignature({
@@ -144,7 +144,7 @@ describe("IPAccount Functions", () => {
144144
// Generate signature with wrong signer
145145
const wrongSigner = "0x1234567890123456789012345678901234567890" as Address;
146146
const nonceResult = await client.ipAccount.getIpAccountNonce(ipId);
147-
147+
148148
const { signature } = await getSignature({
149149
state: nonceResult,
150150
to: permissionAddress,
@@ -169,7 +169,7 @@ describe("IPAccount Functions", () => {
169169

170170
it("should fail with invalid ipId format", async () => {
171171
const nonceResult = await client.ipAccount.getIpAccountNonce(ipId);
172-
172+
173173
const { signature } = await getSignature({
174174
state: nonceResult,
175175
to: permissionAddress,
@@ -195,12 +195,12 @@ describe("IPAccount Functions", () => {
195195
it("should fail when IP account does not exist", async () => {
196196
// Create a real non-existent IP address (but with correct format)
197197
const nonExistentIpId = "0x1111111111111111111111111111111111111111" as Address;
198-
198+
199199
// Generate signature for this non-existent IP
200200
// Note: We need to try to get nonce first, if IP doesn't exist, this step should fail
201201
try {
202202
const nonceResult = await client.ipAccount.getIpAccountNonce(nonExistentIpId);
203-
203+
204204
const { signature } = await getSignature({
205205
state: nonceResult,
206206
to: permissionAddress,
@@ -230,7 +230,7 @@ describe("IPAccount Functions", () => {
230230
it("should fail with unauthorized signer", async () => {
231231
// Test various unauthorized signer scenarios
232232
const unauthorizedSigner = "0x2222222222222222222222222222222222222222" as Address;
233-
233+
234234
const nonceResult = await client.ipAccount.getIpAccountNonce(ipId);
235235
const { signature } = await getSignature({
236236
state: nonceResult,
@@ -269,7 +269,7 @@ describe("IPAccount Functions", () => {
269269
});
270270

271271
const nonceResult = await client.ipAccount.getIpAccountNonce(ipId);
272-
272+
273273
const { signature } = await getSignature({
274274
state: nonceResult,
275275
to: permissionAddress,
@@ -296,7 +296,7 @@ describe("IPAccount Functions", () => {
296296
// Generate signature for different target address than what we execute
297297
const wrongTarget = "0x1234567890123456789012345678901234567890" as Address;
298298
const nonceResult = await client.ipAccount.getIpAccountNonce(ipId);
299-
299+
300300
const { signature } = await getSignature({
301301
state: nonceResult,
302302
to: wrongTarget, // Sign for wrong target
@@ -322,7 +322,7 @@ describe("IPAccount Functions", () => {
322322
it("should execute with zero value transaction", async () => {
323323
// Test successful execution with zero value
324324
const nonceResult = await client.ipAccount.getIpAccountNonce(ipId);
325-
325+
326326
const { signature } = await getSignature({
327327
state: nonceResult,
328328
to: permissionAddress,

packages/core-sdk/test/integration/ipAsset.test.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe("IP Asset Functions", () => {
4141

4242
before(async () => {
4343
client = getStoryClient();
44-
const res = await client.license.registerNonComSocialRemixingPIL();
44+
const res = await client.license.registerPILTerms(PILFlavor.nonCommercialSocialRemixing());
4545
noCommercialLicenseTermsId = res.licenseTermsId!;
4646
});
4747

@@ -128,11 +128,14 @@ describe("IP Asset Functions", () => {
128128

129129
it("should register derivative with Commercial Remix PIL", async () => {
130130
// Register commercial remix PIL
131-
const licenseResponse = await client.license.registerCommercialRemixPIL({
132-
defaultMintingFee: 10n,
133-
commercialRevShare: 10,
134-
currency: WIP_TOKEN_ADDRESS,
135-
});
131+
const licenseResponse = await client.license.registerPILTerms(
132+
PILFlavor.commercialRemix({
133+
defaultMintingFee: 10n,
134+
commercialRevShare: 10,
135+
currency: WIP_TOKEN_ADDRESS,
136+
royaltyPolicy: NativeRoyaltyPolicy.LAP,
137+
}),
138+
);
136139

137140
// Register parent IP
138141
const tokenId = await getTokenId();
@@ -2105,11 +2108,14 @@ describe("IP Asset Functions", () => {
21052108
spgNftContractWithPrivateMinting = privateMintingCollectionResult.spgNftContract!;
21062109

21072110
// Register a commercial remix PIL license
2108-
const commercialRemixPILResult = await client.license.registerCommercialRemixPIL({
2109-
defaultMintingFee: 10n,
2110-
commercialRevShare: 10,
2111-
currency: WIP_TOKEN_ADDRESS,
2112-
});
2111+
const commercialRemixPILResult = await client.license.registerPILTerms(
2112+
PILFlavor.commercialRemix({
2113+
defaultMintingFee: 10n,
2114+
commercialRevShare: 10,
2115+
currency: WIP_TOKEN_ADDRESS,
2116+
royaltyPolicy: NativeRoyaltyPolicy.LAP,
2117+
}),
2118+
);
21132119
licenseTermsId1 = commercialRemixPILResult.licenseTermsId!;
21142120

21152121
// Register a commercial use PIL license

0 commit comments

Comments
 (0)