Class UpdateRoyaltiesExtensions
Extension methods for updating token royalties (custom fees) on the network.
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public static class UpdateRoyaltiesExtensions
Methods
| Edit this page View SourceUpdateRoyaltiesAsync(ConsensusClient, EntityId, IReadOnlyList<IRoyalty>?, Action<IConsensusContext>?)
Updates (replaces) the royalties (custom fees) associated with a token, must be signed by the RoyaltiesEndorsement private key(s).
Declaration
public static Task<TransactionReceipt> UpdateRoyaltiesAsync(this ConsensusClient client, EntityId token, IReadOnlyList<IRoyalty>? royalties, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client orchestrating the update. |
| EntityId | token | The address of the token definition to update. |
| IReadOnlyList<IRoyalty> | royalties | The list of royalties to apply to token transactions, may be a blank list or null, this list replaces the previous list of royalties in full. |
| Action<IConsensusContext> | configure | Optional callback method providing an opportunity to modify the execution configuration for just this method call. It is executed prior to submitting the request to the network. |
Returns
| Type | Description |
|---|---|
| Task<TransactionReceipt> | A transaction receipt indicating a successful operation. |
Examples
// Replace the royalty (custom transfer fee) schedule on a token.
// Pass null to clear all royalties. Requires the RoyaltiesEndorsement.
// Each IRoyalty implementation represents a different fee model —
// FixedRoyalty (flat fee in a given token), TokenRoyalty (percentage
// of fungible transfer), or NftRoyalty (royalty on NFT sales).
var royalties = new IRoyalty[]
{
// 2.5% of every fungible transfer goes to royaltyReceiver
new TokenRoyalty(royaltyReceiver, numerator: 25, denominator: 1000,
minimum: 0, maximum: 0)
};
var receipt = await client.UpdateRoyaltiesAsync(token, royalties);
Console.WriteLine($"UpdateRoyalties status: {receipt.Status}");
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | If required arguments are missing. |
| InvalidOperationException | If required context configuration is missing. |
| PrecheckException | If the gateway node rejected the request upon submission, for example if the token is already deleted. |
| ConsensusException | If the network was unable to come to consensus before the duration of the transaction expired. |
| TransactionException | If the network rejected the request as invalid or had missing data. |
UpdateRoyaltiesAsync(ConsensusClient, UpdateRoyaltiesParams, Action<IConsensusContext>?)
Updates (replaces) the royalties (custom fees) associated with a token, must be signed by the RoyaltiesEndorsement private key(s).
Declaration
public static Task<TransactionReceipt> UpdateRoyaltiesAsync(this ConsensusClient client, UpdateRoyaltiesParams updateRoyaltiesParams, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client orchestrating the update. |
| UpdateRoyaltiesParams | updateRoyaltiesParams | The parameters containing the token and royalties to update. |
| Action<IConsensusContext> | configure | Optional callback method providing an opportunity to modify the execution configuration for just this method call. It is executed prior to submitting the request to the network. |
Returns
| Type | Description |
|---|---|
| Task<TransactionReceipt> | A transaction receipt indicating a successful operation. |
Examples
// Replace the royalty (custom transfer fee) schedule on a token.
// Pass null to clear all royalties. Requires the RoyaltiesEndorsement.
// Each IRoyalty implementation represents a different fee model —
// FixedRoyalty (flat fee in a given token), TokenRoyalty (percentage
// of fungible transfer), or NftRoyalty (royalty on NFT sales).
var royalties = new IRoyalty[]
{
// 2.5% of every fungible transfer goes to royaltyReceiver
new TokenRoyalty(royaltyReceiver, numerator: 25, denominator: 1000,
minimum: 0, maximum: 0)
};
var receipt = await client.UpdateRoyaltiesAsync(token, royalties);
Console.WriteLine($"UpdateRoyalties status: {receipt.Status}");
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | If required arguments are missing. |
| InvalidOperationException | If required context configuration is missing. |
| PrecheckException | If the gateway node rejected the request upon submission, for example if the token is already deleted. |
| ConsensusException | If the network was unable to come to consensus before the duration of the transaction expired. |
| TransactionException | If the network rejected the request as invalid or had missing data. |