Class: Agreement
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
Name | Type |
---|---|
client | SpaceportSDK |
Returns
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
Name | Type | Description |
---|---|---|
params | CreateAndSignParams | The 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
Name | Type | Description |
---|---|---|
smartLicense | SmartLicense | 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 | Signature over the document |
licensorSignatureParams | SignatureParams | 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 [] | - |
data.personalSignatures | SignatureParams [] | - |
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 [] | - |
data.personalSignatures | SignatureParams [] | - |
data.docURIs | string [] | - |
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
Name | Type | Description |
---|---|---|
params | GetAgreementsParams | Query parameters for filtering agreements |
Returns
Promise
<GetAgreementsResponse
>
Promise resolving to agreements response
getAgreementAssets
▸ getAgreementAssets(params
): Promise
<GetAgreementAssetsResponse
>
Get assets for a specific agreement
Parameters
Name | Type | Description |
---|---|---|
params | GetAgreementAssetsParams | Parameters including agreement ID |
Returns
Promise
<GetAgreementAssetsResponse
>
Promise resolving to agreement assets response