resources/smartLicenses.SmartLicenseClient

The SmartLicenseClient is used to manage Smart License templates on the blockchain. A Smart License is a reusable, on-chain template that defines the terms and conditions of a license, such as required licensee information or specific usage rights. These templates are then attached to listings to standardize and automate the licensing process.

Table of contents

Methods

constructor

new SmartLicenseClient(client): SmartLicenseClient

Parameters

NameType
clientSpaceportSDK

Returns

SmartLicenseClient

Methods

create

create(smartLicenseId, requiredParams?, termCreationFee?): Promise<{ transactionHash: `0x\{string}\` ; `smartLicenseHash`: \`0x{string}` }>

Creates a Smart License template.

Parameters

NameTypeDescription
smartLicenseIdstringAn identifier for the license logic (e.g., a string ID or name)
requiredParamsboolean[]Array of boolean values indicating which parameters are required for this license
termCreationFeebigintFee for the creation of terms (optional, defaults to 0)

Returns

Promise<{ transactionHash: `0x\{string}\` ; `smartLicenseHash`: \`0x{string}` }>

The transaction identifier and the calculated smart license hash.

getAll

getAll(params?): Promise<SmartLicense[]>

Get all smart licenses with optional filtering

Parameters

NameTypeDescription
params?ObjectOptional filtering parameters
params.status?string-
params.smartLicenseHash?string-
params.organization?string-

Returns

Promise<SmartLicense[]>

Array of smart licenses

getById

getById(id): Promise<SmartLicense>

Get a specific smart license by ID

Parameters

NameTypeDescription
idstringThe ID of the smart license to retrieve

Returns

Promise<SmartLicense>

The smart license object

getByHash

getByHash(hash, status?): Promise<null | SmartLicense>

Get a smart license by its hash

Parameters

NameTypeDescription
hashstringThe hash of the smart license to retrieve
status?stringOptional status filter (e.g., ‘published’)

Returns

Promise<null | SmartLicense>

The smart license object or null if not found