Create An IP Asset

Create a new IP Asset for an IP Organization

🚧

This is a SDK for Alpha

This SDK is alpha and not production complete yet, which means that we could change the schemas, smart contract deployment and backend endpoints that at any time without warning or notice to you. When this SDK is production ready, we will remove this warning and will endeavor to ensure the production quality of the SDK and update the SDK in regular basis with formal notice.

Developers can use the IPAssetClient to create an IP Asset for an IP Organization. It will return the txHash and the IP asset ID on a successful creation transaction.

Usage

const { txHash, ipAssetId } = await client.ipAsset.create({
  name,
  typeIndex,
  ipOrgId,
  licenseId,
  owner,
  mediaUrl,
  contentHash
  preHookData,
  postHookData,
  txOptins
})

Parameters

  • name: string: The name of the IP asset.
  • typeIndex: number: the index of the IP asset type. The IP asset types supported by the specified IP org is defined when creating the IP Org. It is the index in the string array for the IP asset type.
  • ipOrgId: string: The identifier of the IP Organization who manages the IP Asset.
  • licenseId?: number: The ID of the license for the IP asset.
  • owner?: string: The owner address of the IP Asset.
  • mediaUrl?: string: URL for IP Asset media, image, video etc.
  • contentHash?: string: The checksum of the IP asset.
  • preHookData: Array<Record<string, unknown>>: An array of data passed into the pre-action hooks.
  • postHookData: Array<Record<string, unknown>>: An array of data passed into the post-action hooks.
  • txOptions: TxOption: the transaction option: whether or not to wait for the transaction complete.

Response

  • txHash: string: IP asset creation transaction hash.
  • ipAssetId: string: The ID of the created IP asset. It will be empty if waitForTransaction in txOption is set to false.

Example

You can refer to the source code below to call create function of IPAssetClient:

// Create an IP Asset
client.ipAsset.create({
  name: "A Simple Story",
  typeIndex: 0,
  ipOrgId: "0x86310d77f44e66d2db850266f3f600256d123579",
  owner: "0xc0246081FD87Fc0aa29570F7ABafD0A69a2Ca05F",
  mediaUrl: "https://arweave.net/m-3wkEOwmCwfkv1A25qgo8WS3O3t8a9-e-vi5vrejWE",
  txOptions: {waitForTransaction: true}
}).then(({ txHash, ipAssetId }) => {
  console.log("txHash:", txHash);
  console.log("ipAssetId:", ipAssetId);
});

Here is the output by running above example which return a string value represents the transaction hash ID and the IP asset ID:

txHash: 0x58f3855cbde6ce38f7afee87cd797ddf58bbfb28cb92c32705519b5aa61e171d
ipAssetId: 216

Similar to IP Org creation transaction, you can verify above transaction hash with the Sepolia explorer.

For the full source of the example, please refer to this link .