Register an NFT as an IP Asset

This section demonstrates how to register an IP asset using the TypeScript SDK. There are generally two methods of IP registration:

  1. Register an existing NFT as an IP asset
  2. Create an NFT and register it as an IP asset in one transaction

For this section, we will register an existing NFT as a IP asset (#1 above).

Prerequisites

  • Setup the client object.
  • Own an ERC721 NFT in your wallet. Have it's contract address and token ID ready.

Register an Existing NFT as an IP Asset

You can register your NFT as an IP Asset by simply calling client.ipAsset.registerRootIp() and passing in the token's contract address and token ID, like so:

:information-source: If the provided tokenId from the tokenContractAddress has already been registered, the response object will contain the ipId of the existing IP Asset.

const response = await client.ipAsset.registerRootIp({
  tokenContractAddress: "0xd516482bef63Ff19Ed40E4C6C2e626ccE04e19ED", // your NFT contract address
  tokenId: "12", // your NFT token ID
  txOptions: { waitForTransaction: true }
});

console.log(`Root IPA created at transaction hash ${response.txHash}, IPA ID: ${response.ipId}`);
export type RegisterRootIpRequest = {
  policyId: string;
  tokenContractAddress: string;
  tokenId: string;
  ipName?: string;
  contentHash?: `0x${string}`;
  uri?: string;
  txOptions?: TxOptions;
};

export type RegisterRootIpResponse = {
  txHash?: string;
  ipId: string;
};

Optionally, you can provide additional properties to the IP asset such as:

  • ipName - a name for your asset
  • uri - a URI
  • contentHash - content hash
  • policyId - an id of an existing policy. You can always add another policy to your asset later

Setting waitForTransaction: true in the transaction options will return the ipId of the newly registered IP asset.

After we run the above code, the console output will look like:

Root IPA created at transaction hash 0xa3e1caa7c2124b1550d459abc739291cb1be77ac73b99c097707878ac4ef57ae,
IPA ID: 0x4c1f8c1035a8cE379dd4ed666758Fb29696CF721

Detailed Example

The following section guides you through providing additional properties using an actual example: "Kenta," an Azuki NFT.

The code snippet below shows you how to input these additional IP-related details into the IP registration function:

try {
  const response = await client.ipAsset.registerRootIp({
    tokenContractAddress: "0xed5af388653567af2f388e6224dc7c4b3241c544",
    tokenId: "3611", 
    ipName: "Kenta", 
    uri: "https://www.taketheredbean.com/", 
    contentHash: viem.stringToHex("KentaContentHash", { size: 32 }), 
    policyId: "1", // a pre-set PIL license
    txOptions: { waitForTransaction: true }
  });
  
  console.log(`Root IPA created at transaction hash ${response.txHash}, IPA ID: ${response.ipId}`)
} catch(e) {
  console.log('This NFT has already been registered as an IP Asset!') 
}

What’s Next