Because there are a lot of functions to interact with the π Licensing Module, we have broken them down into a helpful chart so you can identify what youβre looking for, and then find the associated docs.
Registers a derivative directly with parent IPβs license terms, without needing license tokens, and attaches the license terms of the parent IPs to the derivative IP.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.
request.licenseTermsIds: Array of license term IDs that authorize the creation of this derivative IP. Each ID must correspond positionally to a parent IP in the parentIpIds array, creating a one-to-one mapping. Story verifies on-chain that each specified license term permits derivative registration for its corresponding parent IP. Transaction fails if arrays donβt match in length or if terms donβt permit derivative creation.
request.parentIpIds: Array of parent IP IDs from which this derivative is created. Each parent IP must have corresponding license terms specified at the same index in the licenseTermsIds array that authorize the derivative relationship.
request.licenseTemplate: [Optional] The address of the license template to be used for the linking. For now, this can only be the PIL
request.maxMintingFee: [Optional] The maximum minting fee that the caller is willing to pay. If set to 0, then there is no no limit. Default: 0
request.maxRevenueShare: [Optional] The maximum revenue share percentage agreed upon between a child and parent when a child is registering as derivative. Must be between 0 and 100. Default: 100
request.maxRts: [Optional] The maximum number of royalty tokens that can be distributed to the external royalty policies. Must be between 0 and 100,000,000. Default: 100_000_000
Copy
Ask AI
const response = await client.ipAsset.registerDerivative({ childIpId: "0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba", parentIpIds: ["0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba"], licenseTermsIds: ["5"],});console.log( `Derivative IPA linked to parent at transaction hash ${response.txHash}`);
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.
request.licenseTokenIds: The IDs of the license tokens.
request.maxRts: The maximum number of royalty tokens that can be distributed to the external royalty policies. Must be between 0 and 100,000,000. Recommended for simplicity: 100_000_000
Copy
Ask AI
const response = await client.ipAsset.registerDerivativeWithLicenseTokens({ childIpId: "0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba", licenseTokenIds: ["5"], // array of license ids relevant to the creation of the derivative, minted from the parent IPA});console.log( `Derivative IPA linked to parent at transaction hash ${response.txHash}`);
request.licenseTermsData.licensingConfig: [Optional] See the LicensingConfig type. If none provided, it will default to the one shown here.
request.licenseTermsData.maxLicenseTokens: [Optional] The max number of license tokens that can be minted from this license term. If not provided, there is no limit on license token minting.
request.ipMetadata: [Optional] The desired metadata for the newly minted NFT and newly registered IP.
request.ipMetadata.ipMetadataURI: [Optional] The URI of the metadata for the IP.
request.ipMetadata.ipMetadataHash: [Optional] The hash of the metadata for the IP.
request.ipMetadata.nftMetadataURI: [Optional] The URI of the metadata for the NFT.
request.ipMetadata.nftMetadataHash: [Optional] The hash of the metadata for the IP NFT.
request.recipient: [Optional] The address of the recipient of the minted NFT.
request.licenseTermsData.licensingConfig: [Optional] See the LicensingConfig type. If none provided, it will default to the one shown here.
request.licenseTermsData.maxLicenseTokens: [Optional] The max number of license tokens that can be minted from this license term. If not provided, there is no limit on license token minting.
request.ipMetadata: [Optional] The desired metadata for the newly minted NFT and newly registered IP.
request.ipMetadata.ipMetadataURI: [Optional] The URI of the metadata for the IP.
request.ipMetadata.ipMetadataHash: [Optional] The hash of the metadata for the IP.
request.ipMetadata.nftMetadataURI: [Optional] The URI of the metadata for the NFT.
request.ipMetadata.nftMetadataHash: [Optional] The hash of the metadata for the IP NFT.
request.deadline: [Optional] The deadline for the signature in milliseconds. Defaults to 1000.
request.nftContract: The address of the NFT collection.
request.tokenId: The ID of the NFT.
request.derivData: The derivative data to be used for registerDerivative.
request.derivData.parentIpIds: The IDs of the parent IPs to link the registered derivative IP.
request.derivData.licenseTermsIds: The IDs of the license terms to be used for the linking.
request.derivData.maxMintingFee: [Optional] The maximum minting fee that the caller is willing to pay. If set to 0, then there is no no limit. Default: 0
request.derivData.maxRevenueShare: [Optional] The maximum revenue share percentage agreed upon between a child and parent when a child is registering as derivative. Must be between 0 and 100. Default: 100
request.derivData.maxRts: [Optional]The maximum number of royalty tokens that can be distributed to the external royalty policies. Must be between 0 and 100,000,000. Default: 100_000_000
request.derivData.licenseTemplate: [Optional] The address of the license template to be used for the linking. For now, this can only be the PIL
request.ipMetadata: [Optional] The desired metadata for the newly minted NFT and newly registered IP.
request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
request.deadline: [Optional] The deadline for the signature in milliseconds. Defaults to 1000.
request.spgNftContract: The address of the NFT collection.
request.allowDuplicates: [Optional] Set to true to allow minting IPs with the same NFT metadata. Default: true
request.derivData: The derivative data to be used for registerDerivative.
request.derivData.parentIpIds: The IDs of the parent IPs to link the registered derivative IP.
request.derivData.licenseTermsIds: The IDs of the license terms to be used for the linking.
request.derivData.maxMintingFee: [Optional] The maximum minting fee that the caller is willing to pay. If set to 0, then there is no no limit. Default: 0
request.derivData.maxRevenueShare: [Optional] The maximum revenue share percentage agreed upon between a child and parent when a child is registering as derivative. Must be between 0 and 100. Default: 100
request.derivData.maxRts: [Optional] The maximum number of royalty tokens that can be distributed to the external royalty policies. Must be between 0 and 100,000,000. Default: 100_000_000
request.derivData.licenseTemplate: [Optional] The address of the license template to be used for the linking. For now, this can only be the PIL
request.ipMetadata: [Optional] The desired metadata for the newly minted NFT and newly registered IP.
request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
request.recipient: [Optional] The address of the recipient of the minted NFT, default value is your wallet address.
Copy
Ask AI
import { toHex } from "viem";const response = await client.ipAsset.mintAndRegisterIpAndMakeDerivative({ // an NFT contract address created by the SPG spgNftContract: "0xc32A8a0FF3beDDDa58393d022aF433e78739FAbc", derivData: { parentIpIds: ["0xd142822Dc1674154EaF4DDF38bbF7EF8f0D8ECe4"], licenseTermsIds: ["1"], }, // https://docs.story.foundation/docs/ip-asset#adding-nft--ip-metadata-to-ip-asset ipMetadata: { ipMetadataURI: "test-uri", ipMetadataHash: toHex("test-metadata-hash", { size: 32 }), nftMetadataHash: toHex("test-nft-metadata-hash", { size: 32 }), nftMetadataURI: "test-nft-uri", },});console.log( `Completed at transaction hash ${response.txHash}, IPA ID: ${response.ipId}, Token ID: ${response.tokenId}`);
request.spgNftContract: The address of the NFT collection.
request.allowDuplicates: [Optional] Set to true to allow minting IPs with the same NFT metadata. Default: true
request.maxRts: The maximum number of royalty tokens that can be distributed to the external royalty policies. Must be between 0 and 100,000,000. Recommended for simplicity: 100_000_000
request.licenseTokenIds: The IDs of the license tokens to be burned for linking the IP to parent IPs.
request.ipMetadata: [Optional] The desired metadata for the newly minted NFT and newly registered IP.
request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
request.recipient: [Optional] The address to receive the minted NFT, default value is your wallet address.
request.nftContract: The address of the NFT collection.
request.tokenId: The ID of the NFT.
request.maxRts: The maximum number of royalty tokens that can be distributed to the external royalty policies. Must be between 0 and 100,000,000. Recommended for simplicity: 100_000_000
request.licenseTokenIds: The IDs of the license tokens to be burned for linking the IP to parent IPs.
request.ipMetadata: [Optional] The desired metadata for the newly minted NFT and newly registered IP.
request.ipMetadata.ipMetadataURI [Optional] The URI of the metadata for the IP.
request.ipMetadata.ipMetadataHash [Optional] The hash of the metadata for the IP.
request.ipMetadata.nftMetadataURI [Optional] The URI of the metadata for the NFT.
request.ipMetadata.nftMetadataHash [Optional] The hash of the metadata for the IP NFT.
request.deadline: [Optional] The deadline for the signature in milliseconds. Default is 1000.
Batch register multiple IP assets in optimized transactions, supporting various registration methods. This method optimizes transaction processing by grouping related workflow requests together and intelligently selecting between multicall3 and SPGβs multicall based on compatibility.The batching strategy significantly reduces gas costs and improves transaction throughput by minimizing the number of separate blockchain transactions. It also handles complex workflows like royalty token distribution automatically.The method supports automatic token handling for minting fees:
If the walletβs IP token balance is insufficient to cover minting fees, it automatically wraps native IP tokens into WIP tokens
It checks allowances for all required spenders and automatically approves them if their current allowance is lower than needed
These automatic processes can be configured through the wipOptions parameter