Attach a Policy to an IP Asset

This section demonstrates how to add an existing policy to an IPA. By creating such a policy, 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 Policy (policyId). Learn how to create a PIL Policy here.

Attach a Policy to an IP asset

Once the policy is created, you can add the policy to your IP asset and mint licenses based on the policy. One IP asset can have multiple policies. When minting a license, the IP asset owner can decide which policy to use. Below is the code example to add the policy we just created to our IP Asset:

const response = await client.policy.addPolicyToIp({
   policyId: "1", 
   ipId: "0x4c1f8c1035a8cE379dd4ed666758Fb29696CF721",
   txOptions: { waitForTransaction: true }
});

console.log(`Attached Policy to IP at transaction hash ${response.txHash}, index: ${response.index}`)
export type AddPolicyToIpRequest = {
  ipId: `0x${string}`;
  policyId: string;
  txOptions?: TxOptions;
};
export type AddPolicyToIpResponse = {
  txHash: string;
  index?: string;
};

Setting waitForTransaction: true in the transaction options will return the index value which represents the array index of the added Policy.


What’s Next