Class: SmartLicense
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
Name | Type |
---|---|
client | SpaceportSDK |
Returns
Methods
create
▸ create(smartLicenseId
, requiredParams?
, termCreationFee?
): Promise
<{ transactionHash
: `0x\{string}\` ; `smartLicenseHash`: \`0x{string}` }>
Creates a Smart License template.
Parameters
Name | Type | Description |
---|---|---|
smartLicenseId | string | An identifier for the license logic (e.g., a string ID or name) |
requiredParams | boolean [] | Array of boolean values indicating which parameters are required for this license |
termCreationFee | bigint | Fee 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
Name | Type | Description |
---|---|---|
params? | Object | Optional 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
Name | Type | Description |
---|---|---|
id | string | The 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
Name | Type | Description |
---|---|---|
hash | string | The hash of the smart license to retrieve |
status? | string | Optional status filter (e.g., ‘published’) |
Returns
Promise
<null
| SmartLicense
>
The smart license object or null if not found