Configure License for IP Org

Set license framework for an IP Org

🚧

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.

Before creating licenses for IP assets, the license framework must be configured for IP org, and all the licenses are regulated by the framework. Developers can use the LicenseClient to configure licenses for IP orgs by calling configure function.

Usage

const {txHash, success} = await client.license.configure({
  ipOrg,
  frameworkId,
  params,
  licensor,
  txOptions,
});

Parameters

  • ipOrg: string: The ID of the IP Org to be configured.
  • frameworkId: string: The ID of the license framework. We currently have one framework built with Story Protocol, its ID is SPUML-1.0.
  • param: ParamValues[]: the parameters for the license configuration. Each parameter is defined by the ParamValues data type:
export type ParamValues = {
    tag: string;
    value: TypedData;
};

Each parameter represented by ParamValues has two field: tag and value. The tag is the parameter name of the license, e.g. Channels-Of-Distribution. The value is defined by TypedData with the data type of the value and the values of the value:

export type TypedData = {
    interface: string;
    data: unknown[];
};
  • licensor: LicensorConfigEnum: This field defines how does the licensor assigned to a specific license. This is a enum type with the following definition:
export declare enum LicensorConfigEnum {
  Unset = 0,            // The licensor address is unset.
  IpOrgOwnerAlways = 1, // The licensor address is the IP Org owner address.
  Source = 2            // The licensor address is the licencor of the parent licence.
                        // If parent licence doesn't exist, the licensor address will be the IP Asset owner's address.
                        // If the license doesn't bound to an IP asset, the licensor will be the IP org owner.
}
  • txOptions?: TxOptions: the transaction option. You can specified whether or not to wait for the transaction completion.

Response

  • txHash: string: IP asset creation transaction hash.
  • success: boolean: whether the operation is success.

Example:

You can refer to the following code to call configure function to configure license for IP Org:

// Configure license for an IP Org
client.license.configure({
  ipOrg: "0xF509f04Ab4a926805312DD30accA4a2bcC18D98D",
  frameworkId: "SPUML-1.0",
  params: [
    {
      tag: "Attribution",
      value: {
        interface: "bool",
        data: [false],
      }
    }
  ],
  licensor: LicensorConfigEnum.Source,
  txOptions: {waitForTransaction: true}
}).then({txHash, success} => {
  console.log("txHash:", txHash);
  console.log("success:", success);
});

Here is the output by running above code which returns the values for txHash and success fields:

txHash: 0xf1b3fa087627232808ddc458722f4b7c5609dbf3b0b599e0147e402b0ad1a3f0
success: true