Register PIL Terms in TypeScript
This section demonstrates how to register a selection of License Terms using the PIL.
Whitelisted Revenue Tokens
At the moment, a token must be whitelisted by Story Protocol to be used in the royalty module as the
currency
field.This is the only whitelisted token right now on Sepolia testnet. You can mint tokens directly from that link.
Prerequisites
- Setup the client object.
- If License Terms already exist for the identical set of parameters you intend to create, it is unnecessary to create it again and the function will simply return the existing
licenseTermsId
and an undefinedtxHash
. You can use existing License Terms by itslicenseTermsId
.
Create a Commercial Use License
const commercialUseParams = {
currency: '0xB132A6B7AE652c974EE1557A3521D53d18F6739f', // see the above note on whitelisted revenue tokens
mintingFee: '10' // 10 of the currency (using the above currency, 10 MERC20)
}
const response = await client.license.registerCommercialUsePIL({
...commercialUseParams,
txOptions: { waitForTransaction: true }
});
console.log(`PIL Terms registered at transaction hash ${response.txHash}, License Terms ID: ${response.licenseTermsId}`)
export type RegisterCommercialUsePILRequest = {
mintingFee: string;
currency: Address;
txOptions?: TxOptions;
};
export type RegisterPILResponse = {
licenseTermsId?: bigint;
txHash?: string;
};
Setting waitForTransaction: true
in the transaction options will return the licenseTermsId
value.
Create a Commercial Remix License
const commercialRemixParams = {
currency: '0xB132A6B7AE652c974EE1557A3521D53d18F6739f', // see the above note on whitelisted revenue tokens
mintingFee: '10', // 10 of the currency (using the above currency, 10 MERC20)
commercialRevShare: 10 // 10%
}
const response = await client.license.registerCommercialRemixPIL({
...commercialRemixParams,
txOptions: { waitForTransaction: true }
});
console.log(`PIL Terms registered at transaction hash ${response.txHash}, License Terms ID: ${response.licenseTermsId}`)
export type RegisterCommercialRemixPILRequest = {
mintingFee: string;
commercialRevShare: number;
currency: Address;
txOptions?: TxOptions;
};
export type RegisterPILResponse = {
licenseTermsId?: bigint;
txHash?: string;
};
Setting waitForTransaction: true
in the transaction options will return the licenseTermsId
value.
Create a Non-Commercial Social Remixing License
There are currently no parameters to be passed in here, so this function should not really be used other than to get back the licenseTermsId
for this license.
const nonComSocialRemixingParams = {}
const response = await client.license.registerNonComSocialRemixingPIL({
...nonComSocialRemixingParams,
txOptions: { waitForTransaction: true }
});
console.log(`PIL Terms registered at transaction hash ${response.txHash}, License Terms ID: ${response.licenseTermsId}`)
export type RegisterNonComSocialRemixingPILRequest = {
txOptions?: TxOptions;
};
export type RegisterPILResponse = {
licenseTermsId?: bigint;
txHash?: string;
};
Setting waitForTransaction: true
in the transaction options will return the licenseTermsId
value.
Updated 2 days ago