Class CreateNftExtensions
Extension methods for creating new NFT token definitions on the network.
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public static class CreateNftExtensions
Methods
| Edit this page View SourceCreateNftAsync(ConsensusClient, CreateNftParams, Action<IConsensusContext>?)
Creates a new Non-Fungible token definition with the given create parameters.
Declaration
public static Task<CreateTokenReceipt> CreateNftAsync(this ConsensusClient client, CreateNftParams createParameters, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client orchestrating the creation. |
| CreateNftParams | createParameters | Details regarding the NFT definition to instantiate. |
| 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<CreateTokenReceipt> | A transaction receipt with a description of the newly created NFT metadata. |
Examples
var createReceipt = await client.CreateNftAsync(new CreateNftParams
{
Name = "Sample NFTs",
Symbol = "SNFT",
Ceiling = 100,
Treasury = treasury,
Administrator = adminEndorsement,
SupplyEndorsement = adminEndorsement,
Memo = "Hiero SDK sample NFT collection"
});
Console.WriteLine($"NFT collection created: {createReceipt.Token}");
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. |
| ConsensusException | If the network was unable to come to consensus before the duration of the transaction expired. |
| TransactionException | If the network rejected the create request as invalid or had missing data. |