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

# Class: Royalty

Client for interacting with the Cultura Royalty System contract

This client provides a reference implementation for managing and calculating royalty
distributions in the Cultura ecosystem. This module can be customized or replaced
to accommodate different royalty calculation needs.

## Remarks

Protocols can:

1. Use this implementation as-is for basic royalty management
2. Extend it with additional calculation logic
3. Create their own royalty module with custom distribution rules
4. Skip the royalty module entirely and interact directly with Rights Bound Accounts

### new RoyaltyClient()

> **new RoyaltyClient**(`publicClient`, `walletClient`, `contractAddress`): [`RoyaltyClient`](./royalty)

#### Parameters

##### publicClient

##### walletClient

##### contractAddress

`` `0x${string}` ``

#### Returns

[`RoyaltyClient`](./royalty)

## Methods

### getRoyaltyInfo()

> **getRoyaltyInfo**(`tokenId`): `Promise`\<[`RoyaltyInfo`](../types/royalty-info)>

Get royalty info for a token

#### Parameters

##### tokenId

`bigint`

The ID of the token to get royalty info for

#### Returns

`Promise`\<[`RoyaltyInfo`](../types/royalty-info)>

Royalty information including receiver address and royalty fraction

### getRoyaltyInfoCount()

> **getRoyaltyInfoCount**(`tokenId`): `Promise`\<`bigint`>

Get the number of royalty info periods for a token

#### Parameters

##### tokenId

`bigint`

The ID of the token to get royalty period count for

#### Returns

`Promise`\<`bigint`>

The number of royalty periods for the token

### getRoyaltyInfoPeriod()

> **getRoyaltyInfoPeriod**(`tokenId`, `index`): `Promise`\<[`RoyaltyInfoPeriod`](../types/royalty-info-period)>

Get royalty info for a specific period

#### Parameters

##### tokenId

`bigint`

The ID of the token to get royalty period info for

##### index

`bigint`

The index of the royalty period

#### Returns

`Promise`\<[`RoyaltyInfoPeriod`](../types/royalty-info-period)>

Detailed information about the royalty period

### registerRoyaltyDue()

> **registerRoyaltyDue**(`tokenId`, `amountDue`, `startDate`, `endDate`, `royaltyInfoIndex`): `Promise`\<`` `0x${string}` ``>

Register royalty due for a period

#### Parameters

##### tokenId

`bigint`

The ID of the token to register royalty for

##### amountDue

`bigint`

The amount of royalty due for the period

##### startDate

`bigint`

The start date of the royalty period (as Unix timestamp)

##### endDate

`bigint`

The end date of the royalty period (as Unix timestamp)

##### royaltyInfoIndex

`bigint`

The index of the royalty info

#### Returns

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

Transaction hash

#### Remarks

This is an optional step that protocols can use for tracking and transparency.
This function is part of the reference implementation and can be skipped if
protocols have their own royalty calculation mechanisms.

### payRoyalty()

> **payRoyalty**(`tokenId`, `amountPaid`, `periodIndex`, `culturaBoundAccount`, `signature`): `Promise`\<`` `0x${string}` ``>

Pay royalty for a period

#### Parameters

##### tokenId

`bigint`

The ID of the token to pay royalty for

##### amountPaid

`bigint`

The amount of royalty being paid

##### periodIndex

`bigint`

The index of the royalty period being paid

##### culturaBoundAccount

`` `0x${string}` ``

The Cultura bound account address

##### signature

`` `0x${string}` ``

Signature authorizing the payment

#### Returns

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

Transaction hash

#### Remarks

Processes royalty payments by calling `setPaymentInfo` on the Rights Bound Account with
calculated distributions. Protocols can bypass this client and directly interact
with Rights Bound Accounts if they have their own royalty calculation logic.

#### Example

```typescript theme={null}
// Calculate royalty distributions according to protocol rules
const distributions = calculateCustomRoyalties(...)

// Approve token transfer
await bondToken.approve(rightsBoundAccountAddress, totalAmount)

// Set payment info directly on Rights Bound Account
await rightsBoundAccount.setPaymentInfo({
  participants: distributions.recipients,
  amounts: distributions.amounts,
  totalAmount: distributions.total,
  signature: approvalSignature
})
```

### signPaymentSignature()

> **signPaymentSignature**(`rightsBoundAccount`, `participants`, `amounts`, `totalAmount`, `period`, `chainId`?): `Promise`\<`` `0x${string}` ``>

Create a payment signature for use with a RightsBoundAccount

#### Parameters

##### rightsBoundAccount

`` `0x${string}` ``

The address of the RightsBoundAccount

##### participants

`` `0x${string}` ``\[]

Array of participant addresses to receive payments

##### amounts

`bigint`\[]

Array of amounts to pay each participant

##### totalAmount

`bigint`

Total amount of the payment

##### period

`bigint`

Royalty period index

##### chainId?

`number`

Chain ID for the signature domain

#### Returns

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

Payment signature
