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 SourceBurnTokenAsync(ConsensusClient, BurnTokenParams, Action<IConsensusContext>?)
Removes Fungible Token coins from the token's Treasury account.
Declaration
public static Task<TokenReceipt> BurnTokenAsync(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.
var receipt = await client.BurnTokenAsync(token, 250_000);
Console.WriteLine($"Burn status: {receipt.Status}");
Console.WriteLine($"New circulation: {receipt.Circulation}");
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | If required arguments are missing or invalid. |
| InvalidOperationException | If required context configuration is missing. |
| PrecheckException | If the gateway node refused the transaction. Only a code about the transaction itself proves it did not execute; any other code leaves the outcome unknown, so settle it by its transaction id on a mirror node rather than resubmitting it (see PrecheckException). |
| ConsensusException | If the outcome could not be confirmed: the transaction may have executed, so settle it by its transaction id on a mirror node rather than resubmitting it. |
| TransactionException | If the network rejected the request as invalid or had missing data. |
BurnTokenAsync(ConsensusClient, EntityId, ulong, Action<IConsensusContext>?)
Removes Fungible Token coins from the token's Treasury account.
Declaration
public static Task<TokenReceipt> BurnTokenAsync(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.
var receipt = await client.BurnTokenAsync(token, 250_000);
Console.WriteLine($"Burn status: {receipt.Status}");
Console.WriteLine($"New circulation: {receipt.Circulation}");
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | If required arguments are missing or invalid. |
| InvalidOperationException | If required context configuration is missing. |
| PrecheckException | If the gateway node refused the transaction. Only a code about the transaction itself proves it did not execute; any other code leaves the outcome unknown, so settle it by its transaction id on a mirror node rather than resubmitting it (see PrecheckException). |
| ConsensusException | If the outcome could not be confirmed: the transaction may have executed, so settle it by its transaction id on a mirror node rather than resubmitting it. |
| TransactionException | If the network rejected the request as invalid or had missing data. |