Class BurnTokenExtensions
Extension methods for burning fungible tokens from the treasury.
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public static class BurnTokenExtensions
Methods
| Edit this page View SourceBurnTokensAsync(ConsensusClient, BurnTokenParams, Action<IConsensusContext>?)
Removes Fungible Token coins from the token's Treasury account.
Declaration
public static Task<TokenReceipt> BurnTokensAsync(this ConsensusClient client, BurnTokenParams burnParams, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client orchestrating the burn. |
| BurnTokenParams | burnParams | The details identifying the token and amount to burn. |
| 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<TokenReceipt> | A transaction receipt indicating a successful operation. |
Examples
// Burn 250,000 tokens from the treasury account. Like minting, burning
// requires the supply key signature. The method name is plural:
// BurnTokensAsync (not BurnTokenAsync).
var receipt = await client.BurnTokensAsync(token, 250_000);
Console.WriteLine($"Burn status: {receipt.Status}");
Console.WriteLine($"New circulation: {receipt.Circulation}");
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. |
BurnTokensAsync(ConsensusClient, EntityId, ulong, Action<IConsensusContext>?)
Removes Fungible Token coins from the token's Treasury account.
Declaration
public static Task<TokenReceipt> BurnTokensAsync(this ConsensusClient client, EntityId token, ulong amount, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client orchestrating the burn. |
| EntityId | token | The identifier of the Token to remove coins from. |
| ulong | amount | The amount of coins to remove (specified in the smallest denomination). |
| 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<TokenReceipt> | A transaction receipt indicating a successful operation. |
Examples
// Burn 250,000 tokens from the treasury account. Like minting, burning
// requires the supply key signature. The method name is plural:
// BurnTokensAsync (not BurnTokenAsync).
var receipt = await client.BurnTokensAsync(token, 250_000);
Console.WriteLine($"Burn status: {receipt.Status}");
Console.WriteLine($"New circulation: {receipt.Circulation}");
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. |