Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
248 changes: 248 additions & 0 deletions packages/core-sdk/src/resources/ipAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,26 @@ export class IPAssetClient {
* The license terms must be attached to the parent IP before calling this function.
* All IPs attached default license terms by default.
* The derivative IP owner must be the caller or an authorized operator.
*
* @deprecated This method is deprecated. Please use the unified entry point {@link linkDerivative} instead.
* This method will become internal soon.
*
* @example Migration Example
* ```typescript
* // Before (deprecated):
* await client.ipAsset.registerDerivative({
* childIpId: '0x...',
* parentIpIds: ['0x...'],
* licenseTermsIds: [1n]
* });
*
* // After (recommended):
* await client.ipAsset.linkDerivative({
* childIpId: '0x...',
* parentIpIds: ['0x...'],
* licenseTermsIds: [1n]
* });
* ```
*/
public async registerDerivative(
request: RegisterDerivativeRequest,
Expand Down Expand Up @@ -479,6 +499,24 @@ export class IPAssetClient {
* Registers a derivative with license tokens. The derivative IP is registered with license tokens minted from the parent IP's license terms.
* The license terms of the parent IPs issued with license tokens are attached to the derivative IP.
* The caller must be the derivative IP owner or an authorized operator.
*
* @deprecated This method is deprecated. Please use the unified entry point {@link linkDerivative} instead.
* This method will become internal soon.
*
* @example Migration Example
* ```typescript
* // Before (deprecated):
* await client.ipAsset.registerDerivativeWithLicenseTokens({
* childIpId: '0x...',
* licenseTokenIds: [1n, 2n, 3n]
* });
*
* // After (recommended):
* await client.ipAsset.linkDerivative({
* childIpId: '0x...',
* licenseTokenIds: [1n, 2n, 3n]
* });
* ```
*/
public async registerDerivativeWithLicenseTokens(
request: RegisterDerivativeWithLicenseTokensRequest,
Expand Down Expand Up @@ -519,6 +557,24 @@ export class IPAssetClient {
/**
* Mint an NFT from a collection and register it as an IP.
*
* @deprecated This method is deprecated. Please use the unified entry point {@link registerIpAsset} instead.
* This method will become internal soon.
*
* @example Migration Example
* ```typescript
* // Before (deprecated):
* await client.ipAsset.mintAndRegisterIpAssetWithPilTerms({
* spgNftContract: '0x...',
* licenseTermsData: [{ terms: PILFlavor.commercialRemix({...}) }]
* });
*
* // After (recommended):
* await client.ipAsset.registerIpAsset({
* nft: { type: 'mint', spgNftContract: '0x...' },
* licenseTermsData: [{ terms: PILFlavor.commercialRemix({...}) }]
* });
* ```
*
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} and {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicensingModule.sol#L19 | `LicenseTermsAttached`} events.
*/
public async mintAndRegisterIpAssetWithPilTerms(
Expand Down Expand Up @@ -647,6 +703,25 @@ export class IPAssetClient {
/**
* Register a given NFT as an IP and attach Programmable IP License Terms.
*
* @deprecated This method is deprecated. Please use the unified entry point {@link registerIpAsset} instead.
* This method will become internal soon.
*
* @example Migration Example
* ```typescript
* // Before (deprecated):
* await client.ipAsset.registerIpAndAttachPilTerms({
* nftContract: '0x...',
* tokenId: 123n,
* licenseTermsData: [{ terms: PILFlavor.nonCommercialSocialRemixing() }]
* });
*
* // After (recommended):
* await client.ipAsset.registerIpAsset({
* nft: { type: 'minted', nftContract: '0x...', tokenId: 123n },
* licenseTermsData: [{ terms: PILFlavor.nonCommercialSocialRemixing() }]
* });
* ```
*
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} and {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/licensing/ILicensingModule.sol#L19 | `LicenseTermsAttached`} events.
*/
public async registerIpAndAttachPilTerms(
Expand Down Expand Up @@ -718,6 +793,25 @@ export class IPAssetClient {
/**
* Register the given NFT as a derivative IP with metadata without using license tokens.
*
* @deprecated This method is deprecated. Please use the unified entry point {@link registerDerivativeIpAsset} instead.
* This method will become internal soon.
*
* @example Migration Example
* ```typescript
* // Before (deprecated):
* await client.ipAsset.registerDerivativeIp({
* nftContract: '0x...',
* tokenId: 123n,
* derivData: { parentIpIds: ['0x...'], licenseTermsIds: [1n] }
* });
*
* // After (recommended):
* await client.ipAsset.registerDerivativeIpAsset({
* nft: { type: 'minted', nftContract: '0x...', tokenId: 123n },
* derivData: { parentIpIds: ['0x...'], licenseTermsIds: [1n] }
* });
* ```
*
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
*/
public async registerDerivativeIp(
Expand Down Expand Up @@ -772,6 +866,24 @@ export class IPAssetClient {
/**
* Mint an NFT from a collection and register it as a derivative IP without license tokens.
*
* @deprecated This method is deprecated. Please use the unified entry point {@link registerDerivativeIpAsset} instead.
* This method will become internal soon.
*
* @example Migration Example
* ```typescript
* // Before (deprecated):
* await client.ipAsset.mintAndRegisterIpAndMakeDerivative({
* spgNftContract: '0x...',
* derivData: { parentIpIds: ['0x...'], licenseTermsIds: [1n] }
* });
*
* // After (recommended):
* await client.ipAsset.registerDerivativeIpAsset({
* nft: { type: 'mint', spgNftContract: '0x...' },
* derivData: { parentIpIds: ['0x...'], licenseTermsIds: [1n] }
* });
* ```
*
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
*/
public async mintAndRegisterIpAndMakeDerivative(
Expand Down Expand Up @@ -854,6 +966,23 @@ export class IPAssetClient {
/**
* Mint an NFT from a SPGNFT collection and register it with metadata as an IP.
*
* @deprecated This method is deprecated. Please use the unified entry point {@link registerIpAsset} instead.
* This method will become internal soon.
*
* @example Migration Example
* ```typescript
* // Before (deprecated):
* await client.ipAsset.mintAndRegisterIp({
* spgNftContract: '0x...',
* recipient: '0x...'
* });
*
* // After (recommended):
* await client.ipAsset.registerIpAsset({
* nft: { type: 'mint', spgNftContract: '0x...', recipient: '0x...' }
* });
* ```
*
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
*/
public async mintAndRegisterIp(request: MintAndRegisterIpRequest): Promise<RegisterIpResponse> {
Expand Down Expand Up @@ -1030,6 +1159,24 @@ export class IPAssetClient {
* Mint an NFT from a collection and register it as a derivative IP using license tokens.
* Requires caller to have the minter role or the SPG NFT to allow public minting. Caller must own the license tokens and have approved DerivativeWorkflows to transfer them.
*
* @deprecated This method is deprecated. Please use the unified entry point {@link registerDerivativeIpAsset} instead.
* This method will become internal soon.
*
* @example Migration Example
* ```typescript
* // Before (deprecated):
* await client.ipAsset.mintAndRegisterIpAndMakeDerivativeWithLicenseTokens({
* spgNftContract: '0x...',
* licenseTokenIds: [1n, 2n, 3n]
* });
*
* // After (recommended):
* await client.ipAsset.registerDerivativeIpAsset({
* nft: { type: 'mint', spgNftContract: '0x...' },
* licenseTokenIds: [1n, 2n, 3n]
* });
* ```
*
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
*/
public async mintAndRegisterIpAndMakeDerivativeWithLicenseTokens(
Expand Down Expand Up @@ -1085,6 +1232,25 @@ export class IPAssetClient {
/**
* Register the given NFT as a derivative IP using license tokens.
*
* @deprecated This method is deprecated. Please use the unified entry point {@link registerDerivativeIpAsset} instead.
* This method will become internal soon.
*
* @example Migration Example
* ```typescript
* // Before (deprecated):
* await client.ipAsset.registerIpAndMakeDerivativeWithLicenseTokens({
* nftContract: '0x...',
* tokenId: 123n,
* licenseTokenIds: [1n, 2n, 3n]
* });
*
* // After (recommended):
* await client.ipAsset.registerDerivativeIpAsset({
* nft: { type: 'minted', nftContract: '0x...', tokenId: 123n },
* licenseTokenIds: [1n, 2n, 3n]
* });
* ```
*
* Emits an on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
*/
public async registerIpAndMakeDerivativeWithLicenseTokens(
Expand Down Expand Up @@ -1152,6 +1318,27 @@ export class IPAssetClient {
* tokens. In order to successfully distribute royalty tokens, the first
* license terms attached to the IP must be a commercial license.
*
* @deprecated This method is deprecated. Please use the unified entry point {@link registerIpAsset} instead.
* This method will become internal soon.
*
* @example Migration Example
* ```typescript
* // Before (deprecated):
* await client.ipAsset.registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens({
* nftContract: '0x...',
* tokenId: 123n,
* licenseTermsData: [{ terms: PILFlavor.commercialRemix({...}) }],
* royaltyShares: [{ recipient: '0x...', percentage: 100 }]
* });
*
* // After (recommended):
* await client.ipAsset.registerIpAsset({
* nft: { type: 'minted', nftContract: '0x...', tokenId: 123n },
* licenseTermsData: [{ terms: PILFlavor.commercialRemix({...}) }],
* royaltyShares: [{ recipient: '0x...', percentage: 100 }]
* });
* ```
*
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} and {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/royalty/IRoyaltyModule.sol#L88 | `IpRoyaltyVaultDeployed`} events.
*/
public async registerIPAndAttachLicenseTermsAndDistributeRoyaltyTokens(
Expand Down Expand Up @@ -1236,6 +1423,27 @@ export class IPAssetClient {
* Register the given NFT as a derivative IP and attach license terms and distribute royalty tokens. In order to successfully distribute royalty tokens, the license terms attached to the IP must be
* a commercial license.
*
* @deprecated This method is deprecated. Please use the unified entry point {@link registerDerivativeIpAsset} instead.
* This method will become internal soon.
*
* @example Migration Example
* ```typescript
* // Before (deprecated):
* await client.ipAsset.registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens({
* nftContract: '0x...',
* tokenId: 123n,
* derivData: { parentIpIds: ['0x...'], licenseTermsIds: [1n] },
* royaltyShares: [{ recipient: '0x...', percentage: 100 }]
* });
*
* // After (recommended):
* await client.ipAsset.registerDerivativeIpAsset({
* nft: { type: 'minted', nftContract: '0x...', tokenId: 123n },
* derivData: { parentIpIds: ['0x...'], licenseTermsIds: [1n] },
* royaltyShares: [{ recipient: '0x...', percentage: 100 }]
* });
* ```
*
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} and {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/royalty/IRoyaltyModule.sol#L88| `IpRoyaltyVaultDeployed`} events.
*/
public async registerDerivativeIpAndAttachLicenseTermsAndDistributeRoyaltyTokens(
Expand Down Expand Up @@ -1321,6 +1529,26 @@ export class IPAssetClient {
/**
* Mint an NFT and register the IP, attach PIL terms, and distribute royalty tokens.
*
* @deprecated This method is deprecated. Please use the unified entry point {@link registerIpAsset} instead.
* This method will become internal soon.
*
* @example Migration Example
* ```typescript
* // Before (deprecated):
* await client.ipAsset.mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens({
* spgNftContract: '0x...',
* licenseTermsData: [{ terms: PILFlavor.commercialRemix({...}) }],
* royaltyShares: [{ recipient: '0x...', percentage: 100 }]
* });
*
* // After (recommended):
* await client.ipAsset.registerIpAsset({
* nft: { type: 'mint', spgNftContract: '0x...' },
* licenseTermsData: [{ terms: PILFlavor.commercialRemix({...}) }],
* royaltyShares: [{ recipient: '0x...', percentage: 100 }]
* });
* ```
*
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} and {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/modules/royalty/IRoyaltyModule.sol#L88| `IpRoyaltyVaultDeployed`} events.
*/
public async mintAndRegisterIpAndAttachPilTermsAndDistributeRoyaltyTokens(
Expand Down Expand Up @@ -1391,6 +1619,26 @@ export class IPAssetClient {
/**
* Mint an NFT and register the IP, make a derivative, and distribute royalty tokens.
*
* @deprecated This method is deprecated. Please use the unified entry point {@link registerDerivativeIpAsset} instead.
* This method will become internal soon.
*
* @example Migration Example
* ```typescript
* // Before (deprecated):
* await client.ipAsset.mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens({
* spgNftContract: '0x...',
* derivData: { parentIpIds: ['0x...'], licenseTermsIds: [1n] },
* royaltyShares: [{ recipient: '0x...', percentage: 100 }]
* });
*
* // After (recommended):
* await client.ipAsset.registerDerivativeIpAsset({
* nft: { type: 'mint', spgNftContract: '0x...' },
* derivData: { parentIpIds: ['0x...'], licenseTermsIds: [1n] },
* royaltyShares: [{ recipient: '0x...', percentage: 100 }]
* });
* ```
*
* Emits on-chain {@link https://github.com/storyprotocol/protocol-core-v1/blob/v1.3.1/contracts/interfaces/registries/IIPAssetRegistry.sol#L17 | `IPRegistered`} event.
*/
public async mintAndRegisterIpAndMakeDerivativeAndDistributeRoyaltyTokens(
Expand Down