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.
resources/royalties.RoyaltyClient
The RoyaltyClient handles the complex process of royalty management.
Royalties are the payments due to licensors based on the revenue generated by licensed products.
This client provides methods to register sales data (via invoices), calculate royalties,
and manage their payment and acceptance both on-chain and off-chain.
Table of contents
Methods
constructor
• new RoyaltyClient(client): RoyaltyClient
Parameters
| Name | Type |
|---|
client | SpaceportSDK |
Returns
RoyaltyClient
Methods
register
▸ register(params): Promise<RegisterRoyaltiesResponse>
Registers royalties from a CSV invoice file.
This method uploads a CSV file containing invoice data and processes it for royalty registration.
It first imports the invoices, then creates royalty registration periods with the necessary signatures.
Parameters
| Name | Type | Description |
|---|
params | RegisterRoyaltiesParams | Royalty registration parameters including CSV file and product IDs |
Returns
Promise<RegisterRoyaltiesResponse>
Promise resolving to registration response
Example
const csvFile = new File([csvData], 'invoices.csv', { type: 'text/csv' });
const result = await sdk.royalties.register({
csvFile: csvFile,
productIds: [123, 456, 789],
userId: 'user-uuid',
licenseeAddress: '0x1234567890abcdef1234567890abcdef12345678'
});
if (result.success) {
console.log('Royalties registered with job ID:', result.jobId);
}
payOffchain
▸ payOffchain(params): Promise<OffchainPaymentResponse>
Pays royalties for a set of products.
Parameters
| Name | Type | Description |
|---|
params | PayOffchainRoyaltiesInput | Parameters for paying royalties. |
Returns
Promise<OffchainPaymentResponse>
A promise resolving to the response from the payment endpoint.
acceptOffchain
▸ acceptOffchain(royalties): Promise<OffchainAcceptanceDenialResponse>
Accepts royalties.
Parameters
| Name | Type | Description |
|---|
royalties | AcceptDenyRoyaltiesInput[] | An array of royalty inputs to accept. |
Returns
Promise<OffchainAcceptanceDenialResponse>
A promise resolving to the response from the acceptance endpoint.
denyOffchain
▸ denyOffchain(royalties): Promise<OffchainAcceptanceDenialResponse>
Denies royalties.
Parameters
| Name | Type | Description |
|---|
royalties | AcceptDenyRoyaltiesInput[] | An array of royalty inputs to deny. |
Returns
Promise<OffchainAcceptanceDenialResponse>
A promise resolving to the response from the denial endpoint.