Attach Terms to an IP Asset in TypeScript

This section demonstrates how to add License Terms to an IPA. By attaching terms, an IPA becomes eligible for licensing creation. Users who then wish to creative derivatives of the IP may then mint licenses, which can be burned to enroll their IPs as derivative IPAs of the original work.

Prerequisites

  • Setup the client object.
  • An existing IPA (ipId). Learn how to register an IP Asset here.
  • An existing License Terms (termsId). Learn how to create PIL Terms here.

Attach License Terms

Below is a code example to add License Terms to our IP Asset:

try {
  const response = await client.license.attachLicenseTerms({
     licenseTermsId: "1", 
     ipId: "0x4c1f8c1035a8cE379dd4ed666758Fb29696CF721",
     txOptions: { waitForTransaction: true }
  });
  
  console.log(`Attached License Terms to IPA at transaction hash ${response.txHash}.`)
} catch(e) {
  console.log(`License Terms already attached to this IPA.`)
}
export type AttachLicenseTermsRequest = {
  ipId: Address;
  licenseTermsId: string;
  txOptions?: TxOptions;
};
export type AttachLicenseTermsResponse = {
  txHash: string;
};