Remarks
Protocols can:- Use this implementation as-is for basic royalty management
- Extend it with additional calculation logic
- Create their own royalty module with custom distribution rules
- Skip the royalty module entirely and interact directly with Rights Bound Accounts
new RoyaltyClient()
new RoyaltyClient(publicClient,walletClient,contractAddress):RoyaltyClient
Parameters
publicClient
walletClient
contractAddress
`0x${string}`
Returns
RoyaltyClient
Methods
getRoyaltyInfo()
getRoyaltyInfo(Get royalty info for a tokentokenId):Promise<RoyaltyInfo>
Parameters
tokenId
bigint
The ID of the token to get royalty info for
Returns
Promise<RoyaltyInfo>
Royalty information including receiver address and royalty fraction
getRoyaltyInfoCount()
getRoyaltyInfoCount(Get the number of royalty info periods for a tokentokenId):Promise<bigint>
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(Get royalty info for a specific periodtokenId,index):Promise<RoyaltyInfoPeriod>
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>
Detailed information about the royalty period
registerRoyaltyDue()
registerRoyaltyDue(Register royalty due for a periodtokenId,amountDue,startDate,endDate,royaltyInfoIndex):Promise<`0x${string}`>
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(Pay royalty for a periodtokenId,amountPaid,periodIndex,culturaBoundAccount,signature):Promise<`0x${string}`>
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 callingsetPaymentInfo 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
signPaymentSignature()
signPaymentSignature(Create a payment signature for use with a RightsBoundAccountrightsBoundAccount,participants,amounts,totalAmount,period,chainId?):Promise<`0x${string}`>
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
