> ## 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: Agreement

[resources/agreements](../modules/resources_agreements).AgreementClient

The AgreementClient provides methods for interacting with licensing agreements on the Spaceport platform.
Agreements represent the legally binding contract formed when a licensee accepts a licensor's listing terms.
This client handles actions like creating (signing), and accepting agreements, as well as querying agreement data.

## Table of contents

#### Methods

* [createAndSign](#createandsign)
* [getRequiredSigningDetails](#getrequiredsigningdetails)
* [get](#get)
* [accept](#accept)
* [batchSign](#batchsign)
* [batchAccept](#batchaccept)
* [getAll](#getall)
* [getAgreementAssets](#getagreementassets)

### constructor

• **new AgreementClient**(`client`): [`AgreementClient`](./agreement)

#### Parameters

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

#### Returns

[`AgreementClient`](./agreement)

## Methods

### createAndSign

▸ **createAndSign**(`params`): `Promise`\<[`CreateAndSignResponse`](../types/create-and-sign-response)>

Creates a user (if they don't exist) and signs an agreement in one step.
This method calls the server-side endpoint which handles user creation and agreement signing.
Request sequencing is handled by the server.

#### Parameters

| Name     | Type                                                     | Description                                          |
| :------- | :------------------------------------------------------- | :--------------------------------------------------- |
| `params` | [`CreateAndSignParams`](../types/create-and-sign-params) | The parameters for creating and signing an agreement |

#### Returns

`Promise`\<[`CreateAndSignResponse`](../types/create-and-sign-response)>

An object containing the job ID and success status

### getRequiredSigningDetails

▸ **getRequiredSigningDetails**(`smartLicense`): `Object`

Prepares the signing details object based on a smart license template.
This helps guide the user in providing the correct information for the licenseeSigningDetails.

#### Parameters

| Name           | Type                                     | Description               |
| :------------- | :--------------------------------------- | :------------------------ |
| `smartLicense` | [`SmartLicense`](../types/smart-license) | The smart license object. |

#### Returns

`Object`

An object containing suggested structures for details and files metadata.

| Name                    | Type                           |
| :---------------------- | :----------------------------- |
| `requiredDetails`       | `Record`\<`string`, `unknown`> |
| `requiredFilesMetadata` | `Record`\<`string`, `unknown`> |

### get

▸ **get**(`agreementId`): `Promise`\<`unknown`>

Gets agreement data.

#### Parameters

| Name          | Type     | Description              |
| :------------ | :------- | :----------------------- |
| `agreementId` | `bigint` | The ID of the agreement. |

#### Returns

`Promise`\<`unknown`>

Agreement data or throws error if not found.

### accept

▸ **accept**(`agreementId`, `docSignatureParams`, `licensorSignatureParams`, `docURI`): `Promise`\<\{ `transactionHash`: \`0x\$\{string}\`  }>

Accept an agreement proposal as a licensor.

#### Parameters

| Name                      | Type                                           | Description                            |
| :------------------------ | :--------------------------------------------- | :------------------------------------- |
| `agreementId`             | `bigint`                                       | -                                      |
| `docSignatureParams`      | [`SignatureParams`](../types/signature-params) | Signature over the document            |
| `licensorSignatureParams` | [`SignatureParams`](../types/signature-params) | Licensor's personal signature          |
| `docURI`                  | `string`                                       | URI pointing to the agreement document |

#### Returns

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

An object with the transaction identifier.

### batchSign

▸ **batchSign**(`data`): `Promise`\<\{ `transactionHash`: \`0x\$\{string}\`  }>

Batch sign multiple agreements at once.

#### Parameters

| Name                      | Type                                              | Description                                                           |
| :------------------------ | :------------------------------------------------ | :-------------------------------------------------------------------- |
| `data`                    | `Object`                                          | Object containing arrays of listing IDs, signatures and document URIs |
| `data.listingIds`         | `bigint`\[]                                       | -                                                                     |
| `data.docSignatures`      | [`SignatureParams`](../types/signature-params)\[] | -                                                                     |
| `data.personalSignatures` | [`SignatureParams`](../types/signature-params)\[] | -                                                                     |
| `data.docURIs`            | `string`\[]                                       | -                                                                     |

#### Returns

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

An object with the transaction identifier.

### batchAccept

▸ **batchAccept**(`data`): `Promise`\<\{ `transactionHash`: \`0x\$\{string}\`  }>

Batch accept multiple agreements at once.

#### Parameters

| Name                      | Type                                              | Description                                                             |
| :------------------------ | :------------------------------------------------ | :---------------------------------------------------------------------- |
| `data`                    | `Object`                                          | Object containing arrays of agreement IDs, signatures and document URIs |
| `data.agreementIds`       | `bigint`\[]                                       | -                                                                       |
| `data.docSignatures`      | [`SignatureParams`](../types/signature-params)\[] | -                                                                       |
| `data.personalSignatures` | [`SignatureParams`](../types/signature-params)\[] | -                                                                       |
| `data.docURIs`            | `string`\[]                                       | -                                                                       |

#### Returns

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

An object with the transaction identifier.

### getAll

▸ **getAll**(`params?`): `Promise`\<[`GetAgreementsResponse`](../types/get-agreements-response)>

Get agreements for the current user or a specific user

#### Parameters

| Name     | Type                                                    | Description                               |
| :------- | :------------------------------------------------------ | :---------------------------------------- |
| `params` | [`GetAgreementsParams`](../types/get-agreements-params) | Query parameters for filtering agreements |

#### Returns

`Promise`\<[`GetAgreementsResponse`](../types/get-agreements-response)>

Promise resolving to agreements response

### getAgreementAssets

▸ **getAgreementAssets**(`params`): `Promise`\<[`GetAgreementAssetsResponse`](../types/get-agreement-assets-response)>

Get assets for a specific agreement

#### Parameters

| Name     | Type                                                               | Description                       |
| :------- | :----------------------------------------------------------------- | :-------------------------------- |
| `params` | [`GetAgreementAssetsParams`](../types/get-agreement-assets-params) | Parameters including agreement ID |

#### Returns

`Promise`\<[`GetAgreementAssetsResponse`](../types/get-agreement-assets-response)>

Promise resolving to agreement assets response
