Class BurnNftExtensions
Extension methods for burning NFT instances on the network.
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public static class BurnNftExtensions
Methods
| Edit this page View SourceBurnNftAsync(ConsensusClient, Nft, Action<IConsensusContext>?)
Destroys an NFT instance.
Declaration
public static Task<TokenReceipt> BurnNftAsync(this ConsensusClient client, Nft asset, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client orchestrating the burn. |
| Nft | asset | The identifier of the NFT to destroy. |
| 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 one specific NFT by (token, serial). The NFT must be held by
// the treasury — NFTs in arbitrary wallets must be transferred back to
// the treasury first, or confiscated via ConfiscateNftAsync.
var receipt = await client.BurnNftAsync(new Nft(nftCollection, serial));
Console.WriteLine($"Burn status: {receipt.Status}");
Console.WriteLine($"Remaining 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 nft 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 burn request as invalid or had missing data. |
BurnNftsAsync(ConsensusClient, BurnNftParams, Action<IConsensusContext>?)
Destroys multiple NFT instances.
Declaration
public static Task<TokenReceipt> BurnNftsAsync(this ConsensusClient client, BurnNftParams burnParams, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client orchestrating the burn. |
| BurnNftParams | burnParams | The Parameters for burning the NFTs, including the list of NFTs 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 several NFTs from the same collection in one transaction. Pass
// the serial numbers directly; the collection Id is supplied once.
var receipt = await client.BurnNftsAsync(new BurnNftParams
{
Token = nftCollection,
SerialNumbers = new long[] { 1, 2, 3 }
});
Console.WriteLine($"Burn status: {receipt.Status}");
Console.WriteLine($"Remaining 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 nft 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 burn request as invalid or had missing data. |