> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spaceport.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Class: SmartLicense

[resources/smartLicenses](../modules/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

* [create](#create)
* [getAll](#getall)
* [getById](#getbyid)
* [getByHash](#getbyhash)

### constructor

• **new SmartLicenseClient**(`client`): [`SmartLicenseClient`](./smart-license)

#### Parameters

| Name     | Type                               |
| :------- | :--------------------------------- |
| `client` | [`SpaceportSDK`](../spaceport-sdk) |

#### Returns

[`SmartLicenseClient`](./smart-license)

## 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`](../types/smart-license)\[]>

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`](../types/smart-license)\[]>

Array of smart licenses

### getById

▸ **getById**(`id`): `Promise`\<[`SmartLicense`](../types/smart-license)>

Get a specific smart license by ID

#### Parameters

| Name | Type     | Description                             |
| :--- | :------- | :-------------------------------------- |
| `id` | `string` | The ID of the smart license to retrieve |

#### Returns

`Promise`\<[`SmartLicense`](../types/smart-license)>

The smart license object

### getByHash

▸ **getByHash**(`hash`, `status?`): `Promise`\<`null` | [`SmartLicense`](../types/smart-license)>

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`](../types/smart-license)>

The smart license object or null if not found
