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

constructor

new AgreementClient(client): AgreementClient

Parameters

NameType
clientSpaceportSDK

Returns

AgreementClient

Methods

createAndSign

createAndSign(params): Promise<CreateAndSignResponse>

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

NameTypeDescription
paramsCreateAndSignParamsThe parameters for creating and signing an agreement

Returns

Promise<CreateAndSignResponse>

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

NameTypeDescription
smartLicenseSmartLicenseThe smart license object.

Returns

Object

An object containing suggested structures for details and files metadata.

NameType
requiredDetailsRecord<string, unknown>
requiredFilesMetadataRecord<string, unknown>

get

get(agreementId): Promise<unknown>

Gets agreement data.

Parameters

NameTypeDescription
agreementIdbigintThe 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

NameTypeDescription
agreementIdbigint-
docSignatureParamsSignatureParamsSignature over the document
licensorSignatureParamsSignatureParamsLicensor’s personal signature
docURIstringURI 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

NameTypeDescription
dataObjectObject containing arrays of listing IDs, signatures and document URIs
data.listingIdsbigint[]-
data.docSignaturesSignatureParams[]-
data.personalSignaturesSignatureParams[]-
data.docURIsstring[]-

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

NameTypeDescription
dataObjectObject containing arrays of agreement IDs, signatures and document URIs
data.agreementIdsbigint[]-
data.docSignaturesSignatureParams[]-
data.personalSignaturesSignatureParams[]-
data.docURIsstring[]-

Returns

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

An object with the transaction identifier.

getAll

getAll(params?): Promise<GetAgreementsResponse>

Get agreements for the current user or a specific user

Parameters

NameTypeDescription
paramsGetAgreementsParamsQuery parameters for filtering agreements

Returns

Promise<GetAgreementsResponse>

Promise resolving to agreements response

getAgreementAssets

getAgreementAssets(params): Promise<GetAgreementAssetsResponse>

Get assets for a specific agreement

Parameters

NameTypeDescription
paramsGetAgreementAssetsParamsParameters including agreement ID

Returns

Promise<GetAgreementAssetsResponse>

Promise resolving to agreement assets response